diff options
2314 files changed, 133950 insertions, 81451 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..0e7d70f2a7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# This file is for standardising the coding style between different editors +# http://editorconfig.org/ + +root = true + +[*] +end_of_line = lf +indent_size = 4 +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_size = 4 +indent_style = space diff --git a/.gitignore b/.gitignore index 06b13923f5..8fd9b40073 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,24 @@ *~ /phpunit.xml -/phpBB/cache/twig/* -/phpBB/cache/*.html -/phpBB/cache/*.php -/phpBB/cache/*.lock +/phpBB/cache/* +!/phpBB/cache/.htaccess +!/phpBB/cache/index.html /phpBB/composer.phar -/phpBB/config.php -/phpBB/config_dev.php -/phpBB/config_test.php +/phpBB/config*.php /phpBB/ext/* /phpBB/files/* /phpBB/images/avatars/gallery/* /phpBB/images/avatars/upload/* +/phpBB/images/ranks/* +/phpBB/install/schemas/schema.json +/phpBB/language/* +!/phpBB/language/en /phpBB/store/* +/phpBB/styles/* +!/phpBB/styles/prosilver +!/phpBB/styles/all /phpBB/vendor -/tests/phpbb_unit_tests.sqlite2 -/tests/test_config.php +/tests/phpbb_unit_tests.sqlite* +/tests/test_config*.php /tests/tmp/* +/tests/vendor diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000000..9dd5ab82e6 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,78 @@ + +{ + "excludeFiles": ["node_modules/**", "**/build/**"], + "requireCurlyBraces": [ + "if", "else", "for", "while", "do", "try", "catch" + ], + "requireSpaceBeforeKeywords": [ + "else", "while", "catch" + ], + "requireSpaceAfterKeywords": [ + "do", "for", "if", "else", "switch", "case", "try", "catch", "while", "return", "typeof" + ], + "requireSpaceBeforeBlockStatements": true, + "requireParenthesesAroundIIFE": true, + "requireSpacesInConditionalExpression": { + "afterTest": true, + "beforeConsequent": true, + "afterConsequent": true, + "beforeAlternate": true + }, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInNamedFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "requireSpacesInFunction": { + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInCallExpression": true, + "requireBlocksOnNewline": true, + "requirePaddingNewlinesBeforeKeywords": ["case"], + "disallowEmptyBlocks": true, + "disallowSpacesInsideArrayBrackets": "nested", + "disallowSpacesInsideParentheses": true, + "requireSpacesInsideObjectBrackets": "all", + "disallowQuotedKeysInObjects": "allButReserved", + "disallowSpaceAfterObjectKeys": true, + "requireSpaceBeforeObjectValues": true, + "requireCommaBeforeLineBreak": true, + "requireOperatorBeforeLineBreak": [ + "?", "=", "+", "-", "/", "*", "===", "!==", ">", ">=", "<", "<=" + ], + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforeBinaryOperators": [ + "=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">=" + ], + "requireSpaceAfterBinaryOperators": [ + "=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">=" + ], + "disallowKeywords": ["with"], + "disallowMultipleLineStrings": true, + "disallowMixedSpacesAndTabs": "smart", + "disallowTrailingWhitespace": true, + "disallowTrailingComma": true, + "disallowKeywordsOnNewLine": ["else"], + "requireLineFeedAtFileEnd": true, + "maximumLineLength": { + "value": 120, + "tabSize": 4, + "allowUrlComments": true, + "allowRegex": true + }, + "requireCapitalizedConstructors": true, + "requireDotNotation": true, + "disallowYodaConditions": true, + "requireSpaceAfterLineComment": { + "allExcept": ["#", "="] + }, + "disallowNewlineBeforeBlockStatements": true, + "validateQuoteMarks": { + "mark": "'", + "escape": true + }, + "validateParameterSeparator": ", ", + "safeContextKeyword": ["that"] +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000000..90d3bb613e --- /dev/null +++ b/.jshintrc @@ -0,0 +1,24 @@ + +{ + "bitwise": true, + "curly": true, + "eqeqeq": true, + "es3": true, + "forin": false, + "freeze": true, + "newcap": true, + "noarg": true, + "noempty": true, + "nonbsp": true, + "undef": true, + "unused": true, + "strict": true, + + "browser": true, + "devel": true, + "jquery": true, + + "globals": { + "JSON": true + } +} diff --git a/.travis.yml b/.travis.yml index 70428d611d..8d0fe27203 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,40 +1,49 @@ language: php -php: - - 5.3.3 - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - hhvm -env: - - DB=mariadb - - DB=mysql - - DB=postgres +matrix: + include: + - php: 5.4 + env: DB=none;NOTESTS=1 + - php: 5.4 + env: DB=mysqli # MyISAM + - php: 5.4 + env: DB=mysql + - php: 5.4 + env: DB=mariadb + - php: 5.4 + env: DB=postgres + - php: 5.4 + env: DB=sqlite3 + - php: 5.4 + env: DB=mysqli;SLOWTESTS=1 + - php: 5.5 + env: DB=mysqli + - php: 5.6 + env: DB=mysqli + - php: 7.0 + env: DB=mysqli + - php: hhvm + env: DB=mysqli + allow_failures: + - php: hhvm + fast_finish: true services: - redis-server install: - - sh -c "if [ '$DB' = 'mariadb' ]; then travis/setup-mariadb.sh; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then travis/setup-php-extensions.sh; fi" - - sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi" - - cd phpBB - - php ../composer.phar install --dev --no-interaction --prefer-source - - cd .. + - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION $NOTESTS before_script: - - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" - - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" - - sh -c "if [ '$DB' = 'mysql' -o '$DB' = 'mariadb' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" + - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION $NOTESTS + - phantomjs --webdriver=8910 > /dev/null & script: - - cd build - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then ../phpBB/vendor/bin/phing sniff; fi" - - cd .. - - phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH...FETCH_HEAD; fi" - -matrix: - allow_failures: - - php: hhvm + - travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION $NOTESTS + - travis/check-sami-parse-errors.sh $DB $TRAVIS_PHP_VERSION $NOTESTS + - travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION $NOTESTS + - travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION $NOTESTS ./ + - sh -c "if [ '$SLOWTESTS' != '1' -a '$DB' = 'mysqli' ]; then phpBB/vendor/bin/phpunit tests/lint_test.php; fi" + - sh -c "if [ '$NOTESTS' != '1' -a '$SLOWTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi" + - sh -c "if [ '$SLOWTESTS' = '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --group slow; fi" + - sh -c "set -x;if [ '$NOTESTS' = '1' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..6996ca22d3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,6 @@ +## CONTRIBUTE + +1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register) +2. [Create a ticket (unless there already is one)](http://tracker.phpbb.com/secure/CreateIssue!default.jspa) +3. Read our [Coding guidelines](https://wiki.phpbb.com/Coding_guidelines) and [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 @@ -25,9 +25,11 @@ To be able to run an installation from the repo (and not from a pre-built packag ## 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/phpbb) -develop-olympus - [](http://travis-ci.org/phpbb/phpbb) +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: + +* [](http://travis-ci.org/phpbb/phpbb) **master** - Latest development version +* [](http://travis-ci.org/phpbb/phpbb) **3.1.x** - Development of version 3.1.x +* [](http://travis-ci.org/phpbb/phpbb) **3.0.x** - Development of version 3.0.x ## LICENSE diff --git a/build/build.xml b/build/build.xml index 1022565ff0..f517b679cf 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ <project name="phpBB" description="The phpBB forum software" default="all" basedir="../"> <!-- a few settings for the build --> - <property name="newversion" value="3.1.0-a4-dev" /> - <property name="prevversion" value="3.1.0-a2" /> - <property name="olderversions" value="3.0.12, 3.1.0-a1" /> + <property name="newversion" value="3.2.0-a3-dev" /> + <property name="prevversion" value="3.2.0-a1" /> + <property name="olderversions" value="3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> @@ -67,7 +67,6 @@ <exec dir="." command="phpBB/vendor/bin/phpunit --log-junit build/logs/phpunit.xml - --configuration phpunit.xml.all --group slow --coverage-clover build/logs/clover-slow.xml --coverage-html build/coverage-slow" @@ -76,31 +75,41 @@ <target name="sniff"> <exec command="phpBB/vendor/bin/phpcs - -s + -s -p --extensions=php - --standard=build/code_sniffer/ruleset-php-strict.xml - --ignore=phpBB/phpbb/db/migration/data/v30x/* + --standard=build/code_sniffer/ruleset-php-strict-core.xml + --ignore=${project.basedir}/phpBB/phpbb/db/migration/data/v30x/* phpBB/phpbb" dir="." returnProperty="retval-php-strict" passthru="true" /> <exec command="phpBB/vendor/bin/phpcs - -s + -s -p --extensions=php - --standard=build/code_sniffer/ruleset-php-legacy.xml - --ignore=phpBB/cache/* - --ignore=phpBB/develop/* - --ignore=phpBB/includes/diff/*.php - --ignore=phpBB/includes/sphinxapi.php - --ignore=phpBB/includes/utf/data/* - --ignore=phpBB/install/data/* - --ignore=phpBB/install/database_update.php - --ignore=phpBB/phpbb/* - --ignore=phpBB/vendor/* + --standard=build/code_sniffer/ruleset-php-legacy-core.xml + --ignore=${project.basedir}/phpBB/cache/* + --ignore=${project.basedir}/phpBB/develop/* + --ignore=${project.basedir}/phpBB/ext/* + --ignore=${project.basedir}/phpBB/includes/diff/*.php + --ignore=${project.basedir}/phpBB/includes/sphinxapi.php + --ignore=${project.basedir}/phpBB/includes/utf/data/* + --ignore=${project.basedir}/phpBB/install/data/* + --ignore=${project.basedir}/phpBB/install/database_update.php + --ignore=${project.basedir}/phpBB/phpbb/* + --ignore=${project.basedir}/phpBB/vendor/* phpBB" dir="." returnProperty="retval-php-legacy" passthru="true" /> + <exec command="phpBB/vendor/bin/phpcs + -s -p + --extensions=php + --standard=build/code_sniffer/ruleset-php-extensions.xml + --ignore=${project.basedir}/phpBB/ext/*/tests/* + --ignore=${project.basedir}/phpBB/ext/*/vendor/* + phpBB/ext" + dir="." returnProperty="retval-php-ext" passthru="true" /> <if> <or> <not><equals arg1="${retval-php-strict}" arg2="0" /></not> <not><equals arg1="${retval-php-legacy}" arg2="0" /></not> + <not><equals arg1="${retval-php-ext}" arg2="0" /></not> </or> <then> <fail message="PHP Code Sniffer failed." /> @@ -108,15 +117,16 @@ </if> </target> + <!-- Builds docs for current branch into build/api/output/master --> <target name="docs"> - <!-- only works if you setup phpdoctor: - git clone https://github.com/peej/phpdoctor.git - and then create an executable phpdoctor in your path containing - #!/bin/sh - php -f /path/to/phpdoctor/phpdoc.php $@ - --> - <exec dir="build" - command="phpdoctor phpdoc-phpbb.ini" + <exec dir="." + command="phpBB/vendor/bin/sami.php update build/sami-checkout.conf.php" + passthru="true" /> + </target> + <!-- Builds docs for multiple branches/tags into build/api/output/$branch --> + <target name="docs-all"> + <exec dir="." + command="phpBB/vendor/bin/sami.php update build/sami-all.conf.php" passthru="true" /> </target> @@ -139,8 +149,9 @@ <property name="dir" value="build/old_versions/release-${version}" /> </phingcall> - <exec dir="build/old_versions" command="LC_ALL=C diff -crNEBwd release-${version} release-${newversion} > + <exec dir="build/old_versions" command="LC_ALL=C diff -crNEBZbd release-${version} release-${newversion} > ../new_version/patches/phpBB-${version}_to_${newversion}.patch" escape="false" /> + <exec dir="build/old_versions" command="LC_ALL=C diff -qr release-${version} release-${newversion} | grep 'Only in release-${version}' > ../new_version/patches/phpBB-${version}_to_${newversion}.deleted" escape="false" /> </target> <target name="prepare-new-version"> @@ -166,14 +177,11 @@ <target name="package" depends="clean,prepare,prepare-new-version,old-version-diffs"> <exec dir="build" command="php -f package.php '${versions}' > logs/package.log" escape="false" /> <exec dir="build" escape="false" - command="diff -crNEBwd old_versions/release-${prevversion}/language new_version/phpBB3/language > + command="LC_ALL=C diff -crNEBZbd old_versions/release-${prevversion}/language new_version/phpBB3/language > save/phpbb-${prevversion}_to_${newversion}_language.patch" /> <exec dir="build" escape="false" - command="diff -crNEBwd old_versions/release-${prevversion}/styles/prosilver new_version/phpBB3/styles/prosilver > + command="LC_ALL=C diff -crNEBZbd old_versions/release-${prevversion}/styles/prosilver new_version/phpBB3/styles/prosilver > save/phpbb-${prevversion}_to_${newversion}_prosilver.patch" /> - <exec dir="build" escape="false" - command="diff -crNEBwd old_versions/release-${prevversion}/styles/subsilver2 new_version/phpBB3/styles/subsilver2 > - save/phpbb-${prevversion}_to_${newversion}_subsilver2.patch" /> <exec dir="build" escape="false" command="git shortlog --summary --numbered release-${prevversion}...HEAD > @@ -255,7 +263,7 @@ command="git archive ${revision} composer.phar | tar -xf - -C ${dir}" checkreturn="true" /> <exec dir="${dir}" - command="php composer.phar install" + command="php composer.phar install --no-dev --optimize-autoloader" checkreturn="true" passthru="true" /> <delete file="${dir}/composer.phar" /> @@ -269,9 +277,18 @@ </else> </if> + <!-- Create schema.json --> + <exec dir="${dir}" command="php develop/create_schema_files.php" /> + <delete file="${dir}/config.php" /> <delete dir="${dir}/develop" /> <delete dir="${dir}/install/data" /> + <delete dir="${dir}/config/development" /> + <delete dir="${dir}/config/test" /> + + <phingcall target="clean-vendor-dir"> + <property name="dir" value="${dir}" /> + </phingcall> <echo msg="Setting permissions for checkout of ${revision} in ${dir}" /> <!-- set permissions of all files to 644, directories to 755 --> @@ -284,6 +301,137 @@ <chmod mode="0777" file="${dir}/images/avatars/upload" /> </target> + <target name="clean-vendor-dir"> + <!-- Delete unrelated files from vendor/, see PHPBB3-12390 --> + <delete dir="${dir}/vendor/bantu/ini-get-wrapper/tests" /> + <delete file="${dir}/vendor/bantu/ini-get-wrapper/.gitignore" /> + <delete file="${dir}/vendor/bantu/ini-get-wrapper/.scrutinizer.yml" /> + <delete file="${dir}/vendor/bantu/ini-get-wrapper/.travis.yml" /> + <delete file="${dir}/vendor/bantu/ini-get-wrapper/phpunit.xml.dist" /> + <delete file="${dir}/vendor/bantu/ini-get-wrapper/README.md" /> + + <delete dir="${dir}/vendor/google/recaptcha/examples" /> + <delete dir="${dir}/vendor/google/recaptcha/tests" /> + <delete file="${dir}/vendor/google/recaptcha/.gitignore" /> + <delete file="${dir}/vendor/google/recaptcha/.travis.yml" /> + <delete file="${dir}/vendor/google/recaptcha/CONTRIBUTING.md" /> + <delete file="${dir}/vendor/google/recaptcha/phpunit.xml.dist" /> + <delete file="${dir}/vendor/google/recaptcha/README.md" /> + + <delete dir="${dir}/vendor/lusitanian/oauth/examples" /> + <delete dir="${dir}/vendor/lusitanian/oauth/tests" /> + <delete file="${dir}/vendor/lusitanian/oauth/.gitignore" /> + <delete file="${dir}/vendor/lusitanian/oauth/.scrutinizer.yml" /> + <delete file="${dir}/vendor/lusitanian/oauth/.travis.yml" /> + <delete file="${dir}/vendor/lusitanian/oauth/phpunit.xml.dist" /> + <delete file="${dir}/vendor/lusitanian/oauth/README.md" /> + + <delete file="${dir}/vendor/patchwork/utf8/.travis.yml" /> + <delete file="${dir}/vendor/patchwork/utf8/CHANGELOG.md" /> + <delete file="${dir}/vendor/patchwork/utf8/phpunit.xml.dist" /> + <delete file="${dir}/vendor/patchwork/utf8/README.md" /> + + <delete dir="${dir}/vendor/psr/log/Psr/Log/Test" /> + <delete file="${dir}/vendor/psr/log/.gitignore" /> + <delete file="${dir}/vendor/psr/log/README.md" /> + + <delete dir="${dir}/vendor/s9e/text-formatter/.git" /> + + <delete dir="${dir}/vendor/symfony/config/.git" /> + <delete dir="${dir}/vendor/symfony/config/Tests" /> + <delete file="${dir}/vendor/symfony/config/.gitignore" /> + <delete file="${dir}/vendor/symfony/config/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/config/README.md" /> + <delete file="${dir}/vendor/symfony/config/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/console/.git" /> + <delete dir="${dir}/vendor/symfony/console/Tests" /> + <delete file="${dir}/vendor/symfony/console/.gitignore" /> + <delete file="${dir}/vendor/symfony/console/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/console/README.md" /> + <delete file="${dir}/vendor/symfony/console/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/debug/.git" /> + <delete dir="${dir}/vendor/symfony/debug/Tests" /> + <delete file="${dir}/vendor/symfony/debug/.gitignore" /> + <delete file="${dir}/vendor/symfony/debug/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/debug/README.md" /> + <delete file="${dir}/vendor/symfony/debug/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/dependency-injection/.git" /> + <delete dir="${dir}/vendor/symfony/dependency-injection/Tests" /> + <delete file="${dir}/vendor/symfony/dependency-injection/.gitignore" /> + <delete file="${dir}/vendor/symfony/dependency-injection/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/dependency-injection/README.md" /> + <delete file="${dir}/vendor/symfony/dependency-injection/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/event-dispatcher/.git" /> + <delete dir="${dir}/vendor/symfony/event-dispatcher/Tests" /> + <delete file="${dir}/vendor/symfony/event-dispatcher/.gitignore" /> + <delete file="${dir}/vendor/symfony/event-dispatcher/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/event-dispatcher/README.md" /> + <delete file="${dir}/vendor/symfony/event-dispatcher/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/filesystem/.git" /> + <delete dir="${dir}/vendor/symfony/filesystem/Tests" /> + <delete file="${dir}/vendor/symfony/filesystem/.gitignore" /> + <delete file="${dir}/vendor/symfony/filesystem/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/filesystem/README.md" /> + <delete file="${dir}/vendor/symfony/filesystem/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/finder/.git" /> + <delete dir="${dir}/vendor/symfony/finder/Tests" /> + <delete file="${dir}/vendor/symfony/finder/.gitignore" /> + <delete file="${dir}/vendor/symfony/finder/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/finder/README.md" /> + <delete file="${dir}/vendor/symfony/finder/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/http-foundation/.git" /> + <delete dir="${dir}/vendor/symfony/http-foundation/Tests" /> + <delete file="${dir}/vendor/symfony/http-foundation/.gitignore" /> + <delete file="${dir}/vendor/symfony/http-foundation/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/http-foundation/README.md" /> + <delete file="${dir}/vendor/symfony/http-foundation/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/http-kernel/.git" /> + <delete dir="${dir}/vendor/symfony/http-kernel/Tests" /> + <delete file="${dir}/vendor/symfony/http-kernel/.gitignore" /> + <delete file="${dir}/vendor/symfony/http-kernel/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/http-kernel/README.md" /> + <delete file="${dir}/vendor/symfony/http-kernel/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/routing/.git" /> + <delete dir="${dir}/vendor/symfony/routing/Tests" /> + <delete file="${dir}/vendor/symfony/routing/.gitignore" /> + <delete file="${dir}/vendor/symfony/routing/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/routing/README.md" /> + <delete file="${dir}/vendor/symfony/routing/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/twig-bridge/.git" /> + <delete dir="${dir}/vendor/symfony/twig-bridge/Tests" /> + <delete file="${dir}/vendor/symfony/twig-bridge/.gitignore" /> + <delete file="${dir}/vendor/symfony/twig-bridge/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/twig-bridge/README.md" /> + <delete file="${dir}/vendor/symfony/twig-bridge/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/symfony/yaml/.git" /> + <delete dir="${dir}/vendor/symfony/yaml/Tests" /> + <delete file="${dir}/vendor/symfony/yaml/.gitignore" /> + <delete file="${dir}/vendor/symfony/yaml/CHANGELOG.md" /> + <delete file="${dir}/vendor/symfony/yaml/README.md" /> + <delete file="${dir}/vendor/symfony/yaml/phpunit.xml.dist" /> + + <delete dir="${dir}/vendor/twig/twig/doc" /> + <delete dir="${dir}/vendor/twig/twig/ext" /> + <delete dir="${dir}/vendor/twig/twig/test" /> + <delete file="${dir}/vendor/twig/twig/.editorconfig" /> + <delete file="${dir}/vendor/twig/twig/.gitignore" /> + <delete file="${dir}/vendor/twig/twig/.travis.yml" /> + <delete file="${dir}/vendor/twig/twig/CHANGELOG" /> + <delete file="${dir}/vendor/twig/twig/phpunit.xml.dist" /> + <delete file="${dir}/vendor/twig/twig/README.rst" /> + </target> + <target name="clean-diff-dir"> <delete dir="${dir}/cache" /> <delete dir="${dir}/docs" /> diff --git a/build/build_announcement.php b/build/build_announcement.php index a1a496fd68..0718bbc82a 100755 --- a/build/build_announcement.php +++ b/build/build_announcement.php @@ -2,9 +2,13 @@ <?php /** * -* @package build -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/build/build_changelog.php b/build/build_changelog.php index 1e80959adf..2d38480f9f 100755 --- a/build/build_changelog.php +++ b/build/build_changelog.php @@ -2,9 +2,13 @@ <?php /** * -* @package build -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,7 +20,7 @@ if ($_SERVER['argc'] != 2) $fixVersion = $_SERVER['argv'][1]; -$query = 'project = PHPBB3 +$query = 'project IN (PHPBB3, SECURITY) AND resolution = Fixed AND fixVersion = "' . $fixVersion . '" AND status IN ("Unverified Fix", Closed)'; diff --git a/build/build_helper.php b/build/build_helper.php index d6169b913b..3ff1b89eab 100644 --- a/build/build_helper.php +++ b/build/build_helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package build -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,11 +22,11 @@ class build_package // -r - compare recursive // -N - Treat missing files as empty // -E - Ignore tab expansions - // not used: -b - Ignore space changes. - // -w - Ignore all whitespace + // -Z - Ignore white space at line end. + // -b - Ignore changes in the amount of white space. // -B - Ignore blank lines // -d - Try to find smaller set of changes - var $diff_options = '-crNEBwd'; + var $diff_options = '-crNEBZbd'; var $diff_options_long = '-x images -crNEB'; // -x fonts -x imageset //imageset not used here, because it includes the imageset.cfg file. ;) var $verbose = false; @@ -312,4 +316,63 @@ class build_package return $result; } + + /** + * Collect the list of the deleted files from a list of deleted files and folders. + * + * @param string $deleted_filename The full path to a file containing the list of deleted files and directories + * @param string $package_name The name of the package + * @return array + */ + public function collect_deleted_files($deleted_filename, $package_name) + { + $result = array(); + $file_contents = file($deleted_filename); + + foreach ($file_contents as $filename) + { + $filename = trim($filename); + + if (!$filename) + { + continue; + } + + $filename = str_replace('Only in ' . $package_name, '', $filename); + $filename = ltrim($filename, '/'); + + if (substr($filename, 0, 1) == ':') + { + $replace = ''; + } + else + { + $replace = '/'; + } + + $filename = str_replace(': ', $replace, $filename); + + if (is_dir("{$this->locations['old_versions']}{$package_name}/{$filename}")) + { + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator( + "{$this->locations['old_versions']}{$package_name}/{$filename}", + \FilesystemIterator::UNIX_PATHS | \FilesystemIterator::SKIP_DOTS + ), + \RecursiveIteratorIterator::LEAVES_ONLY + ); + + foreach ($iterator as $file_info) + { + $result[] = "{$filename}/{$iterator->getSubPathname()}"; + } + } + else + { + $result[] = $filename; + } + } + + return $result; + } } diff --git a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php index 68e9e6bb86..8c0ec853ff 100644 --- a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php +++ b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php @@ -1,17 +1,19 @@ <?php -/** +/** * -* @package code_sniffer -* @version $Id: $ -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ /** -* Checks that each source file contains the standard header. -* -* Based on Coding Guidelines 1.ii File Header. +* Checks that each PHP source file contains a valid header as defined by the +* phpBB Coding Guidelines. * * @package code_sniffer * @author Manuel Pichler <mapi@phpundercontrol.org> @@ -44,10 +46,10 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff { if ($phpcsFile->findPrevious(T_OPEN_TAG, $stackPtr - 1) !== false) { - return; + return; } } - + // Fetch next non whitespace token $tokens = $phpcsFile->getTokens(); $start = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true); @@ -58,70 +60,65 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff return; } // Mark as error if this is not a doc comment - else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT) + else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT_OPEN_TAG) { $phpcsFile->addError('Missing required file doc comment.', $stackPtr); return; } - + // Find comment end token - $end = $phpcsFile->findNext(T_DOC_COMMENT, $start + 1, null, true) - 1; - + $end = $tokens[$start]['comment_closer']; + // If there is no end, skip processing here if ($end === false) { return; } - - // List of found comment tags - $tags = array(); - + // check comment lines without the first(/**) an last(*/) line - for ($i = $start + 1, $c = ($end - $start); $i <= $c; ++$i) + for ($token = $start + 1, $c = $end - 2; $token <= $c; ++$token) { - $line = $tokens[$i]['content']; - // Check that each line starts with a '*' - if (substr($line, 0, 1) !== '*') + if ($tokens[$token]['column'] === 1 && (($tokens[$token]['content'] !== '*' && $tokens[$token]['content'] !== ' ') || ($tokens[$token]['content'] === ' ' && $tokens[$token + 1]['content'] !== '*'))) { - $message = 'The file doc comment should not be idented.'; - $phpcsFile->addWarning($message, $i); - } - else if (preg_match('/^\*\s+@([\w]+)\s+(.*)$/', $line, $match) !== 0) - { - $tags[$match[1]] = array($match[2], $i); + $message = 'The file doc comment should not be indented.'; + $phpcsFile->addWarning($message, $token); } } - + // Check that the first and last line is empty - if (trim($tokens[$start + 1]['content']) !== '*') + // /**T_WHITESPACE + // (T_WHITESPACE)*T_WHITESPACE + // (T_WHITESPACE)* ... + // (T_WHITESPACE)*T_WHITESPACE + // T_WHITESPACE*/ + if (!(($tokens[$start + 2]['content'] !== '*' && $tokens[$start + 4]['content'] !== '*') || ($tokens[$start + 3]['content'] !== '*' && $tokens[$start + 6]['content'] !== '*'))) { $message = 'The first file comment line should be empty.'; - $phpcsFile->addWarning($message, ($start + 1)); + $phpcsFile->addWarning($message, ($start + 1)); } - if (trim($tokens[$end - $start]['content']) !== '*') - { - $message = 'The last file comment line should be empty.'; - $phpcsFile->addWarning($message, ($end - $start)); - } - - $this->processPackage($phpcsFile, $start, $tags); - $this->processVersion($phpcsFile, $start, $tags); - $this->processCopyright($phpcsFile, $start, $tags); - $this->processLicense($phpcsFile, $start, $tags); - - //print_r($tags); + + if ($tokens[$end - 3]['content'] !== '*' && $tokens[$end - 6]['content'] !== '*') + { + $message = 'The last file comment line should be empty.'; + $phpcsFile->addWarning($message, $end - 1); + } + + //$this->processPackage($phpcsFile, $start, $tags); + //$this->processVersion($phpcsFile, $start, $tags); + $this->processCopyright($phpcsFile, $start, $tokens[$start]['comment_tags']); + $this->processLicense($phpcsFile, $start, $tokens[$start]['comment_tags']); } - + /** - * Checks that the tags array contains a valid package tag - * - * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. - * @param integer The stack pointer for the first comment token. - * @param array(string=>array) $tags The found file doc comment tags. - * - * @return null - */ + * Checks that the tags array contains a valid package tag + * + * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. + * @param integer The stack pointer for the first comment token. + * @param array(string=>array) $tags The found file doc comment tags. + * + * @return null + */ protected function processPackage(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) { if (!isset($tags['package'])) @@ -131,80 +128,105 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff } else if (preg_match('/^([\w]+)$/', $tags['package'][0]) === 0) { - $message = 'Invalid content found for @package tag.'; - $phpcsFile->addWarning($message, $tags['package'][1]); + $message = 'Invalid content found for @package tag.'; + $phpcsFile->addWarning($message, $tags['package'][1]); } } - + /** - * Checks that the tags array contains a valid version tag - * - * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. - * @param integer The stack pointer for the first comment token. - * @param array(string=>array) $tags The found file doc comment tags. - * - * @return null - */ + * Checks that the tags array contains a valid version tag + * + * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. + * @param integer The stack pointer for the first comment token. + * @param array(string=>array) $tags The found file doc comment tags. + * + * @return null + */ protected function processVersion(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) - { - if (!isset($tags['version'])) - { - $message = 'Missing require @version tag in file doc comment.'; - $phpcsFile->addError($message, $ptr); - } - else if (preg_match('/^\$Id:[^\$]+\$$/', $tags['version'][0]) === 0) - { - $message = 'Invalid content found for @version tag, use "$Id: $".'; - $phpcsFile->addError($message, $tags['version'][1]); - } - } - - /** - * Checks that the tags array contains a valid copyright tag - * - * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. - * @param integer The stack pointer for the first comment token. - * @param array(string=>array) $tags The found file doc comment tags. - * - * @return null - */ - protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) - { - if (!isset($tags['copyright'])) - { - $message = 'Missing require @copyright tag in file doc comment.'; - $phpcsFile->addError($message, $ptr); - } - else if (preg_match('/^\(c\) 2[0-9]{3} phpBB Group\s*$/', $tags['copyright'][0]) === 0) - { - $message = 'Invalid content found for @copyright tag, use "(c) <year> phpBB Group".'; - $phpcsFile->addError($message, $tags['copyright'][1]); - } - } - - /** - * Checks that the tags array contains a valid license tag - * - * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. - * @param integer The stack pointer for the first comment token. - * @param array(string=>array) $tags The found file doc comment tags. - * - * @return null - */ - protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) - { - $license = 'http://opensource.org/licenses/gpl-license.php GNU Public License'; - - if (!isset($tags['license'])) - { - $message = 'Missing require @license tag in file doc comment.'; - $phpcsFile->addError($message, $ptr); - } - else if (trim($tags['license'][0]) !== $license) - { - $message = 'Invalid content found for @license tag, use ' - . '"' . $license . '".'; - $phpcsFile->addError($message, $tags['license'][1]); - } - } + { + if (!isset($tags['version'])) + { + $message = 'Missing require @version tag in file doc comment.'; + $phpcsFile->addError($message, $ptr); + } + else if (preg_match('/^\$Id:[^\$]+\$$/', $tags['version'][0]) === 0) + { + $message = 'Invalid content found for @version tag, use "$Id: $".'; + $phpcsFile->addError($message, $tags['version'][1]); + } + } + + /** + * Checks that the tags array contains a valid copyright tag + * + * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. + * @param integer The stack pointer for the first comment token. + * @param array(string=>array) $tags The found file doc comment tags. + * + * @return null + */ + protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) + { + $copyright = '(c) phpBB Limited <https://www.phpbb.com>'; + $tokens = $phpcsFile->getTokens(); + + foreach ($tags as $tag) + { + if ($tokens[$tag]['content'] === '@copyright') + { + if ($tokens[$tag + 2]['content'] !== $copyright) + { + $message = 'Invalid content found for the first @copyright tag, use "' . $copyright . '".'; + $phpcsFile->addError($message, $tags['copyright'][0][1]); + } + + return; + } + } + + $message = 'Missing require @copyright tag in file doc comment.'; + $phpcsFile->addError($message, $ptr); + } + + /** + * Checks that the tags array contains a valid license tag + * + * @param PHP_CodeSniffer_File $phpcsFile The context source file instance. + * @param integer The stack pointer for the first comment token. + * @param array(string=>array) $tags The found file doc comment tags. + * + * @return null + */ + protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags) + { + $license = 'GNU General Public License, version 2 (GPL-2.0)'; + $tokens = $phpcsFile->getTokens(); + + $found = false; + foreach ($tags as $tag) + { + if ($tokens[$tag]['content'] === '@license') + { + if ($found) + { + $message = 'It must be only one @license tag in file doc comment.'; + $phpcsFile->addError($message, $ptr); + } + + $found = true; + + if ($tokens[$tag + 2]['content'] !== $license) + { + $message = 'Invalid content found for @license tag, use "' . $license . '".'; + $phpcsFile->addError($message, $tags['license'][0][1]); + } + } + } + + if (!$found) + { + $message = 'Missing require @license tag in file doc comment.'; + $phpcsFile->addError($message, $ptr); + } + } } diff --git a/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php new file mode 100644 index 0000000000..885c38c5b4 --- /dev/null +++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php @@ -0,0 +1,143 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** + * Checks that the opening brace of a control structures is on the line after. + * From Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff + */ +class phpbb_Sniffs_ControlStructures_OpeningBraceBsdAllmanSniff implements PHP_CodeSniffer_Sniff +{ + /** + * Registers the tokens that this sniff wants to listen for. + */ + public function register() + { + return array( + T_IF, + T_ELSE, + T_FOREACH, + T_WHILE, + T_DO, + T_FOR, + T_SWITCH, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_opener']) === false) + { + return; + } + + /* + * ... + * } + * else if () + * { + * ... + */ + if ($tokens[$stackPtr]['code'] === T_ELSE && $tokens[$stackPtr + 2]['code'] === T_IF) + { + return; + } + + $openingBrace = $tokens[$stackPtr]['scope_opener']; + + /* + * ... + * do + * { + * <code> + * } while(); + * ... + * } + * else + * { + * ... + */ + if ($tokens[$stackPtr]['code'] === T_DO ||$tokens[$stackPtr]['code'] === T_ELSE) + { + $cs_line = $tokens[$stackPtr]['line']; + } + else + { + // The end of the function occurs at the end of the argument list. Its + // like this because some people like to break long function declarations + // over multiple lines. + $cs_line = $tokens[$tokens[$stackPtr]['parenthesis_closer']]['line']; + } + + $braceLine = $tokens[$openingBrace]['line']; + + $lineDifference = ($braceLine - $cs_line); + + if ($lineDifference === 0) + { + $error = 'Opening brace should be on a new line'; + $phpcsFile->addError($error, $openingBrace, 'BraceOnSameLine'); + return; + } + + if ($lineDifference > 1) + { + $error = 'Opening brace should be on the line after the declaration; found %s blank line(s)'; + $data = array(($lineDifference - 1)); + $phpcsFile->addError($error, $openingBrace, 'BraceSpacing', $data); + return; + } + + // We need to actually find the first piece of content on this line, + // as if this is a method with tokens before it (public, static etc) + // or an if with an else before it, then we need to start the scope + // checking from there, rather than the current token. + $lineStart = $stackPtr; + while (($lineStart = $phpcsFile->findPrevious(array(T_WHITESPACE), ($lineStart - 1), null, false)) !== false) + { + if (strpos($tokens[$lineStart]['content'], $phpcsFile->eolChar) !== false) + { + break; + } + } + + // We found a new line, now go forward and find the first non-whitespace + // token. + $lineStart = $phpcsFile->findNext(array(T_WHITESPACE), $lineStart, null, true); + + // The opening brace is on the correct line, now it needs to be + // checked to be correctly indented. + $startColumn = $tokens[$lineStart]['column']; + $braceIndent = $tokens[$openingBrace]['column']; + + if ($braceIndent !== $startColumn) + { + $error = 'Opening brace indented incorrectly; expected %s spaces, found %s'; + $data = array( + ($startColumn - 1), + ($braceIndent - 1), + ); + $phpcsFile->addError($error, $openingBrace, 'BraceIndent', $data); + } + } +} diff --git a/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php new file mode 100644 index 0000000000..349bccbb02 --- /dev/null +++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php @@ -0,0 +1,60 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * Checks that there is exactly one space between the keyword and the opening + * parenthesis of a control structures. + */ +class phpbb_Sniffs_ControlStructures_OpeningParenthesisSniff implements PHP_CodeSniffer_Sniff +{ + /** + * Registers the tokens that this sniff wants to listen for. + */ + public function register() + { + return array( + T_IF, + T_FOREACH, + T_WHILE, + T_FOR, + T_SWITCH, + T_ELSEIF, + T_CATCH, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr + 1]['content'] === '(') + { + $error = 'There should be exactly one space between the keyword and opening parenthesis'; + $phpcsFile->addError($error, $stackPtr, 'NoSpaceBeforeOpeningParenthesis'); + } + else if ($tokens[$stackPtr + 1]['content'] !== ' ') + { + $error = 'There should be exactly one space between the keyword and opening parenthesis'; + $phpcsFile->addError($error, $stackPtr, 'IncorrectSpaceBeforeOpeningParenthesis'); + } + } +} diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php new file mode 100644 index 0000000000..c04113b84e --- /dev/null +++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php @@ -0,0 +1,242 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* Checks that each use statement is used. +*/ +class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff +{ + /** + * {@inheritdoc} + */ + public function register() + { + return array(T_USE); + } + + protected function check($phpcsFile, $found_name, $full_name, $short_name, $line) + { + + if ($found_name === $full_name) + { + $error = 'Either use statement or full name must be used.'; + $phpcsFile->addError($error, $line, 'FullName'); + } + + if ($found_name === $short_name) + { + return true; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + { + if ($this->should_ignore_use($phpcsFile, $stackPtr) === true) + { + return; + } + + $tokens = $phpcsFile->getTokens(); + + $class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($stackPtr + 1)); + + $find = array( + T_NS_SEPARATOR, + T_STRING, + T_WHITESPACE, + ); + + $class_name_end = $phpcsFile->findNext($find, ($stackPtr + 1), null, true); + + $aliasing_as_position = $phpcsFile->findNext(T_AS, $class_name_end, null, false, null, true); + if ($aliasing_as_position !== false) + { + $alias_position = $phpcsFile->findNext(T_STRING, $aliasing_as_position, null, false, null, true); + $class_name_short = $tokens[$alias_position]['content']; + $class_name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start - 1)); + } + else + { + $class_name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start)); + $class_name_short = $tokens[$class_name_end - 1]['content']; + } + + $ok = false; + + // Checks in simple statements (new, instanceof and extends) + foreach (array(T_INSTANCEOF, T_NEW, T_EXTENDS) as $keyword) + { + $old_simple_statement = $stackPtr; + while (($simple_statement = $phpcsFile->findNext($keyword, ($old_simple_statement + 1))) !== false) + { + $old_simple_statement = $simple_statement; + + $simple_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($simple_statement + 1)); + + if ($simple_class_name_start === false) { + continue; + } + + $simple_class_name_end = $phpcsFile->findNext($find, ($simple_statement + 1), null, true); + + $simple_class_name = trim($phpcsFile->getTokensAsString($simple_class_name_start, ($simple_class_name_end - $simple_class_name_start))); + + $ok = $this->check($phpcsFile, $simple_class_name, $class_name_full, $class_name_short, $simple_statement) ? true : $ok; + } + } + + // Checks paamayim nekudotayim + $old_paamayim_nekudotayim = $stackPtr; + while (($paamayim_nekudotayim = $phpcsFile->findNext(T_PAAMAYIM_NEKUDOTAYIM, ($old_paamayim_nekudotayim + 1))) !== false) + { + $old_paamayim_nekudotayim = $paamayim_nekudotayim; + + $paamayim_nekudotayim_class_name_start = $phpcsFile->findPrevious($find, $paamayim_nekudotayim - 1, null, true); + $paamayim_nekudotayim_class_name_end = $paamayim_nekudotayim - 1; + + $paamayim_nekudotayim_class_name = trim($phpcsFile->getTokensAsString($paamayim_nekudotayim_class_name_start + 1, ($paamayim_nekudotayim_class_name_end - $paamayim_nekudotayim_class_name_start))); + + $ok = $this->check($phpcsFile, $paamayim_nekudotayim_class_name, $class_name_full, $class_name_short, $paamayim_nekudotayim) ? true : $ok; + } + + // Checks in implements + $old_implements = $stackPtr; + while (($implements = $phpcsFile->findNext(T_IMPLEMENTS, ($old_implements + 1))) !== false) + { + $old_implements = $implements; + + $old_implemented_class = $implements; + while (($implemented_class = $phpcsFile->findNext(T_STRING, ($old_implemented_class + 1), null, false, null, true)) !== false) + { + $old_implemented_class = $implemented_class; + + $implements_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($implemented_class - 1)); + $implements_class_name_end = $phpcsFile->findNext($find, ($implemented_class - 1), null, true); + + $implements_class_name = trim($phpcsFile->getTokensAsString($implements_class_name_start, ($implements_class_name_end - $implements_class_name_start))); + + $ok = $this->check($phpcsFile, $implements_class_name, $class_name_full, $class_name_short, $implements) ? true : $ok; + } + } + + // Checks in type hinting + $old_function_declaration = $stackPtr; + while (($function_declaration = $phpcsFile->findNext(T_FUNCTION, ($old_function_declaration + 1))) !== false) + { + $old_function_declaration = $function_declaration; + + // Check docblocks + $find = array( + T_COMMENT, + T_DOC_COMMENT_CLOSE_TAG, + T_DOC_COMMENT, + T_CLASS, + T_FUNCTION, + T_OPEN_TAG, + ); + + $comment_end = $phpcsFile->findPrevious($find, ($function_declaration - 1)); + if ($comment_end !== false) + { + if ($tokens[$comment_end]['code'] === T_DOC_COMMENT_CLOSE_TAG) + { + $comment_start = $tokens[$comment_end]['comment_opener']; + foreach ($tokens[$comment_start]['comment_tags'] as $tag) { + if ($tokens[$tag]['content'] !== '@param' && $tokens[$tag]['content'] !== '@return' && $tokens[$tag]['content'] !== '@throws') { + continue; + } + + $classes = $tokens[($tag + 2)]['content']; + $space = strpos($classes, ' '); + if ($space !== false) { + $classes = substr($classes, 0, $space); + } + + $tab = strpos($classes, "\t"); + if ($tab !== false) { + $classes = substr($classes, 0, $tab); + } + + $classes = explode('|', str_replace('[]', '', $classes)); + foreach ($classes as $class) + { + $ok = $this->check($phpcsFile, $class, $class_name_full, $class_name_short, $tokens[$tag + 2]['line']) ? true : $ok; + } + } + } + } + + // Check type hint + $params = $phpcsFile->getMethodParameters($function_declaration); + foreach ($params as $param) + { + $ok = $this->check($phpcsFile, $param['type_hint'], $class_name_full, $class_name_short, $function_declaration) ? true : $ok; + } + } + + // Checks in catch blocks + $old_catch = $stackPtr; + while (($catch = $phpcsFile->findNext(T_CATCH, ($old_catch + 1))) !== false) + { + $old_catch = $catch; + + $caught_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), $catch + 1); + $caught_class_name_end = $phpcsFile->findNext($find, $caught_class_name_start + 1, null, true); + + $caught_class_name = trim($phpcsFile->getTokensAsString($caught_class_name_start, ($caught_class_name_end - $caught_class_name_start))); + + $ok = $this->check($phpcsFile, $caught_class_name, $class_name_full, $class_name_short, $catch) ? true : $ok; + } + + if (!$ok) + { + $error = 'There must not be unused USE statements.'; + $phpcsFile->addError($error, $stackPtr, 'Unused'); + } + } + + /** + * Check if this use statement is part of the namespace block. + * + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return bool + */ + private function should_ignore_use(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Ignore USE keywords inside closures. + $next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); + if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) + { + return true; + } + + // Ignore USE keywords for traits. + if ($phpcsFile->hasCondition($stackPtr, array(T_CLASS, T_TRAIT)) === true) + { + return true; + } + + return false; + + } +} diff --git a/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc deleted file mode 100644 index 0ace1c1bda..0000000000 --- a/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/** -* -* @package code_sniffer³ -* @version $Id: $ -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php BSD License - * -*/ -?> -<?php -/** -* Broken but not first file doc comment. -* -* @version @package_version@ -* @license http://www.opensource.org/licenses/bsd-license.php BSD License -* @copyright (c) 2007 phpBB Group -* -*/ diff --git a/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php deleted file mode 100644 index affa27b56c..0000000000 --- a/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** -* -* @package code_sniffer -* @version $Id: $ -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* Unit test class for the EmptyStatement sniff. -* -* @package code_sniffer -* @author Manuel Pichler <mapi@phpundercontrol.org> -*/ -class phpbb_Tests_Commenting_FileCommentUnitTest extends AbstractSniffUnitTest -{ - - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @return array(int => int) - */ - public function getErrorList() - { - return array( - 7 => 1 // BSD License error :) - ); - }//end getErrorList() - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array(int => int) - */ - public function getWarningList() - { - return array( - 4 => 1, - 8 => 1 - ); - }//end getWarningList() -} diff --git a/build/code_sniffer/phpbb/build.xml b/build/code_sniffer/phpbb/build.xml deleted file mode 100644 index b6d3bf6451..0000000000 --- a/build/code_sniffer/phpbb/build.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="code_sniffer" basedir="." default="install"> - - <property name="working.dir" value="${basedir}" /> - <property name="target.dir" value="/usr/share/php/PHP/CodeSniffer/Standards" /> - - <!-- - Install phpbb sniff - --> - <target name="install"> - <delete dir="${target.dir}/phpbb" /> - <mkdir dir="${target.dir}/phpbb"/> - - <copy todir="${target.dir}/phpbb"> - <fileset file="${working.dir}/phpbbCodingStandard.php" /> - </copy> - <copy todir="${target.dir}/phpbb/Sniffs"> - <fileset dir="${working.dir}/Sniffs" /> - </copy> - - </target> - -</project> diff --git a/build/code_sniffer/phpbb/phpbbCodingStandard.php b/build/code_sniffer/phpbb/phpbbCodingStandard.php deleted file mode 100644 index adbba9d915..0000000000 --- a/build/code_sniffer/phpbb/phpbbCodingStandard.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** -* -* @package code_sniffer -* @version $Id: $ -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** - * @ignore - */ -if (class_exists('PHP_CodeSniffer_Standards_CodingStandard', true) === false) { - throw new PHP_CodeSniffer_Exception( - 'Class PHP_CodeSniffer_Standards_CodingStandard not found' - ); -} - -/** - * Primary class for the phpbb coding standard. - * - * @package code_sniffer - */ -class PHP_CodeSniffer_Standards_phpbb_phpbbCodingStandard extends PHP_CodeSniffer_Standards_CodingStandard -{ - /** - * Return a list of external sniffs to include with this standard. - * - * External locations can be single sniffs, a whole directory of sniffs, or - * an entire coding standard. Locations start with the standard name. For - * example: - * PEAR => include all sniffs in this standard - * PEAR/Sniffs/Files => include all sniffs in this dir - * PEAR/Sniffs/Files/LineLengthSniff => include this single sniff - * - * @return array - */ - public function getIncludedSniffs() - { - return array(); - } -} diff --git a/build/code_sniffer/ruleset-minimum.xml b/build/code_sniffer/ruleset-minimum.xml index 33d0177390..13f122cae7 100644 --- a/build/code_sniffer/ruleset-minimum.xml +++ b/build/code_sniffer/ruleset-minimum.xml @@ -12,4 +12,7 @@ <!-- Tabs MUST be used for indentation --> <rule ref="Generic.WhiteSpace.DisallowSpaceIndent" /> + <!-- ALL braces MUST be on their own lines. --> + <rule ref="./phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php" /> + </ruleset> diff --git a/build/code_sniffer/ruleset-php-extensions.xml b/build/code_sniffer/ruleset-php-extensions.xml new file mode 100644 index 0000000000..2d388103c3 --- /dev/null +++ b/build/code_sniffer/ruleset-php-extensions.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<ruleset name="phpBB PHP Strict Standard Extensions"> + + <description>phpBB coding standard for PHP files of phpBB extensions</description> + + <rule ref="./ruleset-php-strict.xml" /> + +</ruleset> diff --git a/build/code_sniffer/ruleset-php-legacy-core.xml b/build/code_sniffer/ruleset-php-legacy-core.xml new file mode 100644 index 0000000000..55f2461a04 --- /dev/null +++ b/build/code_sniffer/ruleset-php-legacy-core.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<ruleset name="phpBB PHP Legacy Standard Core"> + + <description>phpBB legacy coding standard for PHP files of phpBB core</description> + + <rule ref="./ruleset-php-legacy.xml" /> + + <!-- Each file MUST start with a valid header as defined by the Coding Guidelines --> + <rule ref="./phpbb/Sniffs/Commenting/FileCommentSniff.php" /> + +</ruleset> diff --git a/build/code_sniffer/ruleset-php-legacy.xml b/build/code_sniffer/ruleset-php-legacy.xml index 550c919b5d..c740c6080f 100644 --- a/build/code_sniffer/ruleset-php-legacy.xml +++ b/build/code_sniffer/ruleset-php-legacy.xml @@ -20,6 +20,16 @@ <!-- Call-time pass-by-reference MUST not be used. --> <rule ref="Generic.Functions.CallTimePassByReference.NotAllowed" /> + <!-- Filenames MUST be lowercase. --> + <rule ref="Generic.Files.LowercasedFilename" /> + + <!-- The function brace MUST be on the line following the function declaration + and MUST be indented to the same column as the start of the function declaration. --> + <rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman" /> + + <!-- There MUST be exactly one space after a cast. --> + <rule ref="Generic.Formatting.SpaceAfterCast" /> + <!-- Class constants MUST be declared in all upper case with underscore separators. --> <rule ref="Generic.NamingConventions.UpperCaseConstantName" /> @@ -32,6 +42,20 @@ <!-- Each file MUST end with exactly one newline character --> <rule ref="PSR2.Files.EndFileNewline" /> + <!-- When referencing arrays there MUST NOT be any whitespace around the opening bracket + or before the closing bracket. --> + <rule ref="Squiz.Arrays.ArrayBracketSpacing" /> + + <!-- The "else if" statement MUST be written with a space between the words else and if. --> + <rule ref="Squiz.ControlStructures.ElseIfDeclaration" /> + + <!-- There MUST be a space between each element of a foreach loop. --> + <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" /> + + <!-- In a for loop declaration, there MUST be no space inside the brackets + and there MUST be 0 spaces before and 1 space after semicolons. --> + <rule ref="Squiz.ControlStructures.ForLoopDeclaration" /> + <!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. --> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"> @@ -41,7 +65,28 @@ </rule> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint" /> + <!-- All built-in PHP functions MUST be called lowercased. --> + <rule ref="Squiz.Functions.LowercaseFunctionKeywords" /> + + <!-- The eval() function MUST NOT be used. --> + <rule ref="Squiz.PHP.Eval" /> + + <!-- There MUST NOT be trailing whitespace at the end of lines. --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" /> + + <!-- There MUST NOT be whitespace before the first content of a file --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" /> + + <!-- There MUST NOT be whitespace after the last content of a file --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" /> + + <!-- Functions MUST NOT contain multiple empty lines in a row --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" /> + <!-- The ?> closing tag MUST be omitted from files containing only PHP. --> <rule ref="Zend.Files.ClosingTag" /> + <!-- There MUST be one space between control structure and opening parenthesis --> + <rule ref="./phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php" /> + </ruleset> diff --git a/build/code_sniffer/ruleset-php-strict-core.xml b/build/code_sniffer/ruleset-php-strict-core.xml new file mode 100644 index 0000000000..5ca4d0cf1e --- /dev/null +++ b/build/code_sniffer/ruleset-php-strict-core.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<ruleset name="phpBB PHP Strict Standard Core"> + + <description>phpBB coding standard for PHP files of phpBB core</description> + + <rule ref="./ruleset-php-legacy-core.xml" /> + <rule ref="./ruleset-php-strict.xml" /> + +</ruleset> diff --git a/build/code_sniffer/ruleset-php-strict.xml b/build/code_sniffer/ruleset-php-strict.xml index 5e3c26a616..9e2f0664d8 100644 --- a/build/code_sniffer/ruleset-php-strict.xml +++ b/build/code_sniffer/ruleset-php-strict.xml @@ -22,17 +22,8 @@ <!-- PHP keywords MUST be in lower case. --> <rule ref="Generic.PHP.LowerCaseKeyword" /> - <!-- There MUST NOT be trailing whitespace at the end of lines. --> - <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" /> - - <!-- There MUST NOT be whitespace before the first content of a file --> - <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" /> - - <!-- There MUST NOT be whitespace after the last content of a file --> - <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" /> - - <!-- Functions MUST NOT contain multiple empty lines in a row --> - <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" /> + <!-- Constructors MUST be called __construct() instead of after the class. --> + <rule ref="Generic.NamingConventions.ConstructorName" /> <!-- Classes etc. MUST be namespaced --> <rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace" /> @@ -48,4 +39,10 @@ There MUST be one blank line after the use block. --> <rule ref="PSR2.Namespaces.UseDeclaration" /> + <!-- There MUST be one blank line after the namespace declaration --> + <rule ref="PSR2.Namespaces.NamespaceDeclaration" /> + + <!-- There MUST NOT be unused use statements. --> + <rule ref="./phpbb/Sniffs/Namespaces/UnusedUseSniff.php" /> + </ruleset> diff --git a/build/package.php b/build/package.php index 97bfc4ea5c..178a27faad 100755 --- a/build/package.php +++ b/build/package.php @@ -2,9 +2,13 @@ <?php /** * -* @package build -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -45,6 +49,10 @@ if (sizeof($package->old_packages)) $package->get('patch_directory') . '/phpBB-' . $dest_package_filename . $package->get('new_version_number') . '.patch', $_package_name ); + $diff_file_changes[$_package_name]['deleted'] = $package->collect_deleted_files( + $package->get('patch_directory') . '/phpBB-' . $dest_package_filename . $package->get('new_version_number') . '.deleted', + $_package_name + ); } // Now put those files determined within the correct directories @@ -139,6 +147,12 @@ if (sizeof($package->old_packages)) { unset($file_contents['all'][$index]); } + + $source_filename = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $file; + if (!file_exists($source_filename)) + { + unset($file_contents['all'][$index]); + } } // First of all, fill the 'old' directory @@ -181,16 +195,11 @@ if (sizeof($package->old_packages)) * referenced files from the same or subsequent directories. */ $copy_relative_directories = array( - 'adm/style/admin.css' => array( - 'copied' => false, - 'copy' => array( - 'adm/images/*' => 'adm/images', - ), - ), 'config/' => array( + 'recursive' => true, 'copied' => false, 'copy' => array( - 'config/*.yml' => 'config', + 'config/*' => 'config', ), ), ); @@ -200,12 +209,6 @@ if (sizeof($package->old_packages)) { $source_filename = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $file; $dest_filename = $dest_filename_dir . '/install/update/new/' . $file; - - if (!file_exists($source_filename)) - { - continue; - } - $filename = $file; // Create Directories along the way? @@ -254,13 +257,57 @@ if (sizeof($package->old_packages)) } $source_dir_files = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $source_dir_files; $destination_dir = $dest_filename_dir . '/install/update/new/' . $destination_dir; - $package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir); + + if (isset($data['recursive']) && $data['recursive']) + { + $package->run_command('cp -Rp ' . $source_dir_files . ' ' . $destination_dir); + } + else + { + $package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir); + } } $copy_relative_directories[$reference]['copied'] = true; } } } + /** + * We need to always copy the template and asset files that we need in + * the update, to ensure that the page is displayed correctly. + */ + $copy_update_files = array( + 'adm/images/*' => 'adm/images', + 'adm/style/admin.css' => 'adm/style', + 'adm/style/admin.js' => 'adm/style', + 'adm/style/ajax.js' => 'adm/style', + 'adm/style/installer_*' => 'adm/style', + 'assets/javascript/*' => 'assets/javascript', + ); + + foreach ($copy_update_files as $source_files => $destination_dir) + { + // Create directories along the way? + $directories = explode('/', $destination_dir); + + chdir($dest_filename_dir . '/install/update/new'); + foreach ($directories as $dir) + { + $dir = trim($dir); + if ($dir) + { + if (!file_exists('./' . $dir)) + { + $package->run_command('mkdir ' . $dir); + } + chdir('./' . $dir); + } + } + $source_dir_files = $package->locations['old_versions'] . $package->get('simple_name') . '/' . $source_files; + $destination_dir = $dest_filename_dir . '/install/update/new/' . $destination_dir; + $package->run_command('cp ' . $source_dir_files . ' ' . $destination_dir); + } + // Build index.php file for holding the file structure $index_contents = '<?php @@ -276,29 +323,32 @@ $update_info = array( if (sizeof($file_contents['all'])) { - $index_contents .= '\'files\' => array(\'' . implode("',\n\t'", $file_contents['all']) . '\'), -'; + $index_contents .= "\t'files' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['all']) . "',\n\t),\n"; } else { - $index_contents .= '\'files\' => array(), -'; + $index_contents .= "\t'files' => array(),\n"; } if (sizeof($file_contents['binary'])) { - $index_contents .= '\'binary\' => array(\'' . implode("',\n\t'", $file_contents['binary']) . '\'), -'; + $index_contents .= "\t'binary' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['binary']) . "',\n\t),\n"; } else { - $index_contents .= '\'binary\' => array(), -'; + $index_contents .= "\t'binary' => array(),\n"; } - $index_contents .= '); + if (sizeof($file_contents['deleted'])) + { + $index_contents .= "\t'deleted' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['deleted']) . "',\n\t),\n"; + } + else + { + $index_contents .= "\t'deleted' => array(),\n"; + } -?' . '>'; + $index_contents .= ");\n"; $fp = fopen($dest_filename_dir . '/install/update/index.php', 'wt'); fwrite($fp, $index_contents); @@ -353,6 +403,7 @@ if (sizeof($package->old_packages)) $package->run_command('mkdir ' . $package->get('files_directory') . '/release'); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('files_directory') . '/release'); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('files_directory') . '/release'); + $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('files_directory') . '/release'); $package->run_command('rm -v ' . $package->get('files_directory') . '/release/install/install_install.php'); $package->run_command('rm -v ' . $package->get('files_directory') . '/release/install/install_update.php'); diff --git a/build/phpdoc-phpbb.ini b/build/phpdoc-phpbb.ini deleted file mode 100644 index f1a7a4bee5..0000000000 --- a/build/phpdoc-phpbb.ini +++ /dev/null @@ -1,145 +0,0 @@ -; Default configuration file for PHPDoctor - -; This config file will cause PHPDoctor to generate API documentation of -; itself. - - -; PHPDoctor settings -; ----------------------------------------------------------------------------- - -; Names of files to parse. This can be a single filename, or a comma separated -; list of filenames. Wildcards are allowed. - -files = "*.php" - -; Names of files or directories to ignore. This can be a single filename, or a -; comma separated list of filenames. Wildcards are NOT allowed. - -;ignore = "CVS, .svn, .git, _compiled" -ignore = templates_c/,*HTML/default/*,spec/,*config.php*,*CVS/,test_chora.php,testupdate/,cache/,store/,*proSilver/,develop/,includes/utf/data/,includes/captcha/fonts/,install/update/,install/update.new/,files/,*phpinfo.php*,*update_script.php*,*upgrade.php*,*convert.php*,install/converter/,language/de/,script/,*swatch.php*,*test.php*,*test2.php*,*install.php*,*functions_diff.php*,*acp_update.php*,acm_xcache.php - -; The directory to look for files in, if not used the PHPDoctor will look in -; the current directory (the directory it is run from). - -source_path = "../phpBB/" - -; If you do not want PHPDoctor to look in each sub directory for files -; uncomment this line. - -;subdirs = off - -; Set how loud PHPDoctor is as it runs. Quiet mode suppresses all output other -; than warnings and errors. Verbose mode outputs additional messages during -; execution. - -quiet = on -;verbose = on - -; Select the doclet to use for generating output. - -doclet = standard -;doclet = debug - -; The directory to find the doclet in. Doclets control the HTML output of -; phpDoctor and can be modified to suit your needs. They are expected to be -; in a directory named after themselves at the location given. - -;doclet_path = ./doclets - -; Select the formatter to use for generating output. - -;formatter = htmlStandardFormatter - -; The directory to find the formatter in. Formatters convert textual markup -; for use by the doclet. - -;formatter_path = ./formatters - -; The directory to find taglets in. Taglets allow you to make PHPDoctor handle -; new tags and to alter the behavour of existing tags and their output. - -;taglet_path = ./taglets - -; If the code you are parsing does not use package tags or not all elements -; have package tags, use this setting to place unbound elements into a -; particular package. - -default_package = "phpBB" - -use_class_path_as_package = off - -ignore_package_tags = off - -; Specifies the name of a HTML file containing text for the overview -; documentation to be placed on the overview page. The path is relative to -; "source_path" unless an absolute path is given. - -overview = ../README.md - -; Package comments will be looked for in a file named package.html in the same -; directory as the first source file parsed in that package or in the directory -; given below. If package comments are placed in the directory given below then -; they should be named "<packageName>.html". - -package_comment_dir = ./ - -; Parse out global variables and/or global constants? - -;globals = off -;constants = off - -; Generate documentation for all class members - -;private = on - -; Generate documentation for public and protected class members - -;protected = on - -; Generate documentation for only public class members - -;public = on - -; Use the PEAR compatible handling of the docblock first sentence - -;pear_compat = on - -; Standard doclet settings -; ----------------------------------------------------------------------------- - -; The directory to place generated documentation in. If the given path is -; relative to it will be relative to "source_path". - -d = "../build/api/" - -; Specifies the title to be placed in the HTML <title> tag. - -windowtitle = "phpBB3" - -; Specifies the title to be placed near the top of the overview summary file. - -doctitle = "phpBB3 Sourcecode Documentation" - -; Specifies the header text to be placed at the top of each output file. The -; header will be placed to the right of the upper navigation bar. - -header = "phpBB3" - -; Specifies the footer text to be placed at the bottom of each output file. The -; footer will be placed to the right of the lower navigation bar. - -footer = "phpBB3" - -; Specifies the text to be placed at the bottom of each output file. The text -; will be placed at the bottom of the page, below the lower navigation bar. - -;bottom = "This document was generated by <a href="http://peej.github.com/phpdoctor/">PHPDoctor: The PHP Documentation Creator</a>" - -; Create a class tree? - -;tree = off - -; Use GeSHi to include formatted source files in the documentation. PHPDoctor will look in the current doclet directory for a /geshi subdirectory. Unpack the GeSHi archive from http://qbnz.com/highlighter to get this directory - it will contain a php script and a subdirectory with formatting files. - -include_source = off - diff --git a/build/sami-all.conf.php b/build/sami-all.conf.php new file mode 100644 index 0000000000..9c10209e8b --- /dev/null +++ b/build/sami-all.conf.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require __DIR__ . '/sami-checkout.conf.php'; + +$config['versions'] = Sami\Version\GitVersionCollection::create(__DIR__ . '/../') + /* + This would be nice, but currently causes various problems that need + debugging. + ->addFromTags('release-3.0.*') + ->add('3.0.x', '3.0-next (olympus)') + ->addFromTags('release-3.1.*') + ->add('3.1.x', '3.1-next (ascraeus)') + ->add('master') + */ + ->add('3.0.x') + ->add('3.1.x') + ->add('master') +; + +return new Sami\Sami($iterator, $config); diff --git a/build/sami-checkout.conf.php b/build/sami-checkout.conf.php new file mode 100644 index 0000000000..abbf1d257e --- /dev/null +++ b/build/sami-checkout.conf.php @@ -0,0 +1,44 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +// Prevent 'Class "acm" does not exist.' exception on removeClass(). +class PhpbbArrayStore extends Sami\Store\ArrayStore +{ + public function removeClass(Sami\Project $project, $name) + { + unset($this->classes[$name]); + } +} + +$iterator = Symfony\Component\Finder\Finder::create() + ->files() + ->name('*.php') + ->in(__DIR__ . '/../phpBB/') + ->notPath('#^cache/#') + ->notPath('#^develop/#') + ->notPath('#^ext/#') + ->notPath('#^vendor/#') + ->notPath('data') +; + +$config = array( + 'theme' => 'enhanced', + 'title' => 'phpBB API Documentation', + 'build_dir' => __DIR__.'/api/output/%version%', + 'cache_dir' => __DIR__.'/api/cache/%version%', + 'default_opened_level' => 2, + // Do not use JsonStore. See https://github.com/fabpot/Sami/issues/79 + 'store' => new PhpbbArrayStore, +); + +return new Sami\Sami($iterator, $config); diff --git a/composer.phar b/composer.phar Binary files differindex a035fdc911..7826664865 100755 --- a/composer.phar +++ b/composer.phar diff --git a/git-tools/commit-msg-hook-range.sh b/git-tools/commit-msg-hook-range.sh index 66628c1d17..91f7577eb5 100755 --- a/git-tools/commit-msg-hook-range.sh +++ b/git-tools/commit-msg-hook-range.sh @@ -1,30 +1,56 @@ #!/bin/bash # -# @copyright (c) 2014 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. # # Calls the git commit-msg hook on all non-merge commits in a given commit range. # -set -e if [ "$#" -ne 1 ]; then - echo "Expected one argument (commit range, e.g. eef1b586...1666476b)." + echo "Expected one argument (commit range, e.g. phpbb/develop..ticket/12345)." exit fi DIR=$(dirname "$0") -COMMIT_MSG_HOOK_PATH="$DIR/hooks/commit-msg" - COMMIT_RANGE="$1" +COMMIT_MSG_HOOK_PATH="$DIR/hooks/commit-msg" +COMMIT_MSG_HOOK_FATAL=$(git config --bool phpbb.hooks.commit-msg.fatal 2> /dev/null) +git config phpbb.hooks.commit-msg.fatal true +EXIT_STATUS=0 for COMMIT_HASH in $(git rev-list --no-merges "$COMMIT_RANGE") do + echo "Inspecting commit message of commit $COMMIT_HASH" + # The git commit-msg hook takes a path to a file containing a commit # message. So we have to extract the commit message into a file first, # which then also needs to be deleted after our work is done. COMMIT_MESSAGE_PATH="$DIR/commit_msg.$COMMIT_HASH" git log -n 1 --pretty=format:%B "$COMMIT_HASH" > "$COMMIT_MESSAGE_PATH" + + # Invoke hook on commit message file. "$COMMIT_MSG_HOOK_PATH" "$COMMIT_MESSAGE_PATH" + + # If any commit message hook complains with a non-zero exit status, we + # will send a non-zero exit status upstream. + if [ $? -ne 0 ] + then + EXIT_STATUS=1 + fi + rm "$COMMIT_MESSAGE_PATH" done + +# Restore phpbb.hooks.commit-msg.fatal config +if [ -n "$COMMIT_MSG_HOOK_FATAL" ] +then + git config phpbb.hooks.commit-msg.fatal "$COMMIT_MSG_HOOK_FATAL" +fi + +exit $EXIT_STATUS diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index b156d276df..136606252c 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -191,12 +191,12 @@ do err=$ERR_HEADER; echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] .+$" result=$? - if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$" + if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [a-zA-Z].+$" then # Don't be too strict. # Commits may be temporary, intended to be squashed later. # Just issue a warning here. - complain "$severity: heading should be a sentence beginning with a capital letter." 1>&2 + complain "$severity: heading should be a sentence beginning with a letter." 1>&2 complain "You entered:" 1>&2 complain "$line" 1>&2 fi diff --git a/git-tools/merge.php b/git-tools/merge.php index f6142095fb..a9bb051401 100755 --- a/git-tools/merge.php +++ b/git-tools/merge.php @@ -2,9 +2,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php index 4e144edae6..100ac53b33 100755 --- a/git-tools/setup_github_network.php +++ b/git-tools/setup_github_network.php @@ -2,9 +2,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/.htaccess b/phpBB/.htaccess index 6f33916775..1ae74ed825 100644 --- a/phpBB/.htaccess +++ b/phpBB/.htaccess @@ -26,12 +26,50 @@ RewriteRule ^(.*)$ app.php [QSA,L] #Options +FollowSymLinks </IfModule> -<Files "config.php"> -Order Allow,Deny -Deny from All -</Files> - -<Files "common.php"> -Order Allow,Deny -Deny from All -</Files> +# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from +# module mod_authz_host to a new module called mod_access_compat (which may be +# disabled) and a new "Require" syntax has been introduced to mod_authz_host. +# We could just conditionally provide both versions, but unfortunately Apache +# does not explicitly tell us its version if the module mod_version is not +# available. In this case, we check for the availability of module +# mod_authz_core (which should be on 2.4 or higher only) as a best guess. +<IfModule mod_version.c> + <IfVersion < 2.4> + <Files "config.php"> + Order Allow,Deny + Deny from All + </Files> + <Files "common.php"> + Order Allow,Deny + Deny from All + </Files> + </IfVersion> + <IfVersion >= 2.4> + <Files "config.php"> + Require all denied + </Files> + <Files "common.php"> + Require all denied + </Files> + </IfVersion> +</IfModule> +<IfModule !mod_version.c> + <IfModule !mod_authz_core.c> + <Files "config.php"> + Order Allow,Deny + Deny from All + </Files> + <Files "common.php"> + Order Allow,Deny + Deny from All + </Files> + </IfModule> + <IfModule mod_authz_core.c> + <Files "config.php"> + Require all denied + </Files> + <Files "common.php"> + Require all denied + </Files> + </IfModule> +</IfModule> diff --git a/phpBB/adm/images/arrow_down.gif b/phpBB/adm/images/arrow_down.gif Binary files differindex e45c365ecc..b7fbf7e276 100644 --- a/phpBB/adm/images/arrow_down.gif +++ b/phpBB/adm/images/arrow_down.gif diff --git a/phpBB/adm/images/arrow_left.gif b/phpBB/adm/images/arrow_left.gif Binary files differindex 076a5596f1..ac92cb4971 100644 --- a/phpBB/adm/images/arrow_left.gif +++ b/phpBB/adm/images/arrow_left.gif diff --git a/phpBB/adm/images/arrow_right.gif b/phpBB/adm/images/arrow_right.gif Binary files differindex c5827a401f..3a080ffdfe 100644 --- a/phpBB/adm/images/arrow_right.gif +++ b/phpBB/adm/images/arrow_right.gif diff --git a/phpBB/adm/images/arrow_up.gif b/phpBB/adm/images/arrow_up.gif Binary files differindex 38b5a62c17..0ff5872182 100644 --- a/phpBB/adm/images/arrow_up.gif +++ b/phpBB/adm/images/arrow_up.gif diff --git a/phpBB/adm/images/bg_tabs1.gif b/phpBB/adm/images/bg_tabs1.gif Binary files differdeleted file mode 100644 index d129365661..0000000000 --- a/phpBB/adm/images/bg_tabs1.gif +++ /dev/null diff --git a/phpBB/adm/images/bg_tabs2.gif b/phpBB/adm/images/bg_tabs2.gif Binary files differdeleted file mode 100644 index 0aace9b6db..0000000000 --- a/phpBB/adm/images/bg_tabs2.gif +++ /dev/null diff --git a/phpBB/adm/images/icon_folder.gif b/phpBB/adm/images/icon_folder.gif Binary files differindex 82ceee0784..845618c1a2 100644 --- a/phpBB/adm/images/icon_folder.gif +++ b/phpBB/adm/images/icon_folder.gif diff --git a/phpBB/adm/images/icon_folder_link.gif b/phpBB/adm/images/icon_folder_link.gif Binary files differindex 01fb1c4e1e..efeaf0a11f 100644 --- a/phpBB/adm/images/icon_folder_link.gif +++ b/phpBB/adm/images/icon_folder_link.gif diff --git a/phpBB/adm/images/icon_folder_lock.gif b/phpBB/adm/images/icon_folder_lock.gif Binary files differindex 450bf28c3c..7afb092a8f 100644 --- a/phpBB/adm/images/icon_folder_lock.gif +++ b/phpBB/adm/images/icon_folder_lock.gif diff --git a/phpBB/adm/images/icon_subfolder.gif b/phpBB/adm/images/icon_subfolder.gif Binary files differindex 5e97bc94ce..7119486539 100644 --- a/phpBB/adm/images/icon_subfolder.gif +++ b/phpBB/adm/images/icon_subfolder.gif diff --git a/phpBB/adm/images/phpbb_logo.png b/phpBB/adm/images/phpbb_logo.png Binary files differindex c3f9248ed7..2d76ef18cb 100644 --- a/phpBB/adm/images/phpbb_logo.png +++ b/phpBB/adm/images/phpbb_logo.png diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index c1e8edbd03..7dc8e4b13d 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -46,11 +50,17 @@ define('IN_ADMIN', true); // Some oft used variables $safe_mode = (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on') ? true : false; $file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on') ? true : false; -$module_id = request_var('i', ''); -$mode = request_var('mode', ''); +$module_id = $request->variable('i', ''); +$mode = $request->variable('mode', ''); // Set custom style for admin area -$template->set_custom_style('adm', $phpbb_admin_path . 'style'); +$template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), +), $phpbb_admin_path . 'style'); + $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 82fb229fae..da8a0096ea 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -205,8 +205,8 @@ </dl> <dl> <dt><label for="allowed_forums">{L_ALLOWED_FORUMS}{L_COLON}</label><br /><span>{L_ALLOWED_FORUMS_EXPLAIN}</span></dt> - <dd><label><input type="radio" id="allowed_forums" class="radio" name="forum_select" value="0"<!-- IF not S_FORUM_IDS --> checked="checked"<!-- ENDIF --> /> {L_ALLOW_ALL_FORUMS}</label> - <label><input type="radio" class="radio" name="forum_select" value="1"<!-- IF S_FORUM_IDS --> checked="checked"<!-- ENDIF --> /> {L_ALLOW_SELECTED_FORUMS}</label></dd> + <dd><label><input type="radio" id="allowed_forums" class="radio" name="forum_select" value="0"<!-- IF not S_FORUM_IDS --> checked="checked"<!-- ENDIF --> /> {L_ALLOW_ALL_FORUMS}</label></dd> + <dd><label><input type="radio" class="radio" name="forum_select" value="1"<!-- IF S_FORUM_IDS --> checked="checked"<!-- ENDIF --> /> {L_ALLOW_SELECTED_FORUMS}</label></dd> <dd><select name="allowed_forums[]" multiple="multiple" size="8">{S_FORUM_ID_OPTIONS}</select></dd> </dl> @@ -284,8 +284,6 @@ </fieldset> </form> - <br /> - <form id="change_ext" method="post" action="{U_ACTION}"> <fieldset class="tabulated"> @@ -331,15 +329,15 @@ <fieldset class="tabulated"> <legend>{L_TITLE}</legend> - <table class="table1 zebra-table"> + <table class="table1 zebra-table fixed-width-table"> <thead> <tr> <th>{L_FILENAME}</th> - <th>{L_FILEDATE}</th> - <th>{L_FILESIZE}</th> - <th>{L_ATTACH_POST_ID}</th> - <th>{L_ATTACH_TO_POST}</th> - <th>{L_DELETE}</th> + <th style="width: 15%;">{L_FILEDATE}</th> + <th style="width: 15%;">{L_FILESIZE}</th> + <th style="width: 15%;">{L_ATTACH_POST_ID}</th> + <th style="width: 15%;">{L_ATTACH_TO_POST}</th> + <th style="width: 15%;">{L_DELETE}</th> </tr> </thead> <tbody> @@ -348,7 +346,7 @@ <td><a href="{orphan.U_FILE}">{orphan.REAL_FILENAME}</a></td> <td>{orphan.FILETIME}</td> <td>{orphan.FILESIZE}</td> - <td><strong>{L_ATTACH_ID}{L_COLON} </strong><input type="number" name="post_id[{orphan.ATTACH_ID}]" size="7" maxlength="10" value="{orphan.POST_ID}" /></td> + <td><strong>{L_ATTACH_ID}{L_COLON} </strong><input type="number" name="post_id[{orphan.ATTACH_ID}]" maxlength="10" value="{orphan.POST_ID}" style="width: 75%;" /></td> <td><input type="checkbox" class="radio" name="add[{orphan.ATTACH_ID}]" /></td> <td><input type="checkbox" class="radio" name="delete[{orphan.ATTACH_ID}]" /></td> </tr> @@ -378,7 +376,7 @@ <fieldset class="tabulated"> <legend>{L_TITLE}</legend> - <div class="pagination"> + <div class="pagination top-pagination"> <!-- IF .pagination or TOTAL_FILES --> {L_NUMBER_FILES}{L_COLON} {TOTAL_FILES} • {L_TOTAL_SIZE}{L_COLON} {TOTAL_SIZE} <!-- IF .pagination --> @@ -389,13 +387,14 @@ <!-- ENDIF --> </div> - <table class="table1 zebra-table"> +<!-- IF .attachments --> + <table class="table1 zebra-table fixed-width-table"> <thead> <tr> <th>{L_FILENAME}</th> - <th>{L_POSTED}</th> - <th>{L_FILESIZE}</th> - <th>{L_DELETE}</th> + <th style="width: 15%;">{L_POSTED}</th> + <th style="width: 15%;" class="centered-text">{L_FILESIZE}</th> + <th style="width: 10%;" class="centered-text">{L_MARK}</th> </tr> </thead> <tbody> @@ -406,25 +405,19 @@ <!-- ELSE --><a href="{attachments.U_FILE}" style="font-weight: bold;">{attachments.REAL_FILENAME}</a><br /><!-- IF attachments.COMMENT -->{attachments.COMMENT}<br /><!-- ENDIF -->{attachments.L_DOWNLOAD_COUNT}<br />{L_TOPIC}{L_COLON} <a href="{attachments.U_VIEW_TOPIC}">{attachments.TOPIC_TITLE}</a><!-- ENDIF --> </td> <td>{attachments.FILETIME}<br />{L_POST_BY_AUTHOR} {attachments.ATTACHMENT_POSTER}</td> - <td>{attachments.FILESIZE}</td> - <td><input type="checkbox" class="radio" name="delete[{attachments.ATTACH_ID}]" /></td> + <td class="centered-text">{attachments.FILESIZE}</td> + <td class="centered-text"><input type="checkbox" class="radio" name="delete[{attachments.ATTACH_ID}]" /></td> </tr> <!-- END attachments --> - <tr class="row4"> - <td colspan="3"> </td> - <td class="small"><a href="#" onclick="marklist('attachments', 'delete', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('attachments', 'delete', false); return false;">{L_UNMARK_ALL}</a></td> - </tr> </tbody> </table> +<!-- ELSE --> + <div class="errorbox"> + <p>{L_NO_ATTACHMENTS}</p> + </div> +<!-- ENDIF --> <!-- IF TOTAL_FILES --> - <fieldset class="display-options"> - {L_DISPLAY_LOG}{L_COLON} {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR} - <input class="button2" type="submit" value="{L_GO}" name="sort" /> - </fieldset> - - <hr /> - <div class="pagination"> {L_NUMBER_FILES}{L_COLON} {TOTAL_FILES} • {L_TOTAL_SIZE}{L_COLON} {TOTAL_SIZE} <!-- IF .pagination --> @@ -435,10 +428,22 @@ </div> <!-- ENDIF --> - <p class="submit-buttons"> - <input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" /> - <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" /> - </p> + <fieldset class="display-options"> + {L_DISPLAY_LOG}{L_COLON} {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR} + <input class="button2" type="submit" value="{L_GO}" name="sort" /> + </fieldset> + + <hr /> + +<!-- IF .attachments --> + <fieldset class="quick"> + <input class="button2" type="submit" name="submit" value="{L_DELETE_MARKED}" /><br /> + <p class="small"> + <a href="#" onclick="marklist('attachments', 'delete', true); return false;">{L_MARK_ALL}</a> • + <a href="#" onclick="marklist('attachments', 'delete', false); return false;">{L_UNMARK_ALL}</a> + </p> + </fieldset> +<!-- ENDIF --> {S_FORM_TOKEN} </fieldset> </form> diff --git a/phpBB/adm/style/acp_avatar_options_local.html b/phpBB/adm/style/acp_avatar_options_local.html index 0cdb3644d7..bee3c57ea0 100644 --- a/phpBB/adm/style/acp_avatar_options_local.html +++ b/phpBB/adm/style/acp_avatar_options_local.html @@ -1,7 +1,6 @@ <dl> <dt><label for="category">{L_AVATAR_CATEGORY}{L_COLON}</label></dt> <dd><select name="avatar_local_cat" id="category"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> <!-- BEGIN avatar_local_cats --> <option value="{avatar_local_cats.NAME}"<!-- IF avatar_local_cats.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_local_cats.NAME}</option> <!-- END avatar_local_cats --> @@ -13,7 +12,7 @@ <!-- BEGIN avatar_local_col --> <li> <label for="av-{avatar_local_row.S_ROW_COUNT}-{avatar_local_row.avatar_local_col.S_ROW_COUNT}"><img src="{avatar_local_row.avatar_local_col.AVATAR_IMAGE}" alt="" /><br /> - <input type="radio" name="avatar_local_file" id="av-{avatar_local_row.S_ROW_COUNT}-{avatar_local_row.avatar_local_col.S_ROW_COUNT}" value="{avatar_local_row.avatar_local_col.AVATAR_FILE}" /></label> + <input type="radio" name="avatar_local_file" id="av-{avatar_local_row.S_ROW_COUNT}-{avatar_local_row.avatar_local_col.S_ROW_COUNT}" value="{avatar_local_row.avatar_local_col.AVATAR_FILE}"<!-- IF avatar_local_row.avatar_local_col.CHECKED -->checked="checked"<!-- ENDIF --> /></label> </li> <!-- END avatar_local_col --> <!-- END avatar_local_row --> diff --git a/phpBB/adm/style/acp_ban.html b/phpBB/adm/style/acp_ban.html index 71c737de70..f2249941a5 100644 --- a/phpBB/adm/style/acp_ban.html +++ b/phpBB/adm/style/acp_ban.html @@ -13,27 +13,34 @@ var ban_length = new Array(); ban_length[-1] = ''; - <!-- BEGIN ban_length --> - ban_length['{ban_length.BAN_ID}'] = '{ban_length.A_LENGTH}'; - <!-- END ban_length --> - var ban_reason = new Array(); ban_reason[-1] = ''; - <!-- BEGIN ban_reason --> - ban_reason['{ban_reason.BAN_ID}'] = '{ban_reason.A_REASON}'; - <!-- END ban_reason --> - var ban_give_reason = new Array(); ban_give_reason[-1] = ''; - <!-- BEGIN ban_give_reason --> - ban_give_reason['{ban_give_reason.BAN_ID}'] = '{ban_give_reason.A_REASON}'; - <!-- END ban_give_reason --> + + <!-- BEGIN bans --> + ban_length['{bans.BAN_ID}'] = '{bans.A_LENGTH}'; + <!-- IF bans.A_REASON --> + ban_reason['{bans.BAN_ID}'] = '{bans.A_REASON}'; + <!-- ENDIF --> + <!-- IF bans.A_GIVE_REASON --> + ban_give_reason['{bans.BAN_ID}'] = '{bans.A_GIVE_REASON}'; + <!-- ENDIF --> + <!-- END bans --> function display_details(option) { - document.getElementById('acp_unban').unbangivereason.innerHTML = ban_give_reason[option]; - document.getElementById('acp_unban').unbanreason.innerHTML = ban_reason[option]; - document.getElementById('acp_unban').unbanlength.value = ban_length[option]; + document.getElementById('unbanlength').value = ban_length[option]; + if (option in ban_reason) { + document.getElementById('unbanreason').innerHTML = ban_reason[option]; + } else { + document.getElementById('unbanreason').innerHTML = ''; + } + if (option in ban_give_reason) { + document.getElementById('unbangivereason').innerHTML = ban_give_reason[option]; + } else { + document.getElementById('unbangivereason').innerHTML = ''; + } } // ]]> @@ -45,7 +52,7 @@ <legend>{L_TITLE}</legend> <dl> <dt><label for="ban">{L_BAN_CELL}{L_COLON}</label></dt> - <dd><textarea name="ban" cols="40" rows="3" id="ban"></textarea></dd> + <dd><!-- EVENT acp_ban_cell_prepend --><textarea name="ban" cols="40" rows="3" id="ban"></textarea><!-- EVENT acp_ban_cell_append --></dd> <!-- IF S_USERNAME_BAN --><dd>[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</dd><!-- ENDIF --> </dl> <dl> diff --git a/phpBB/adm/style/acp_board.html b/phpBB/adm/style/acp_board.html index 1a09c4eee6..64592a5de2 100644 --- a/phpBB/adm/style/acp_board.html +++ b/phpBB/adm/style/acp_board.html @@ -33,9 +33,12 @@ <!-- END options --> <!-- IF S_AUTH --> + </fieldset> <!-- BEGIN auth_tpl --> <!-- INCLUDE {auth_tpl.TEMPLATE_FILE} --> <!-- END auth_tpl --> + <fieldset> + <legend>{L_ACP_SUBMIT_CHANGES}</legend> <!-- ENDIF --> <p class="submit-buttons"> diff --git a/phpBB/adm/style/acp_captcha.html b/phpBB/adm/style/acp_captcha.html index df4c675209..0efbbac51e 100644 --- a/phpBB/adm/style/acp_captcha.html +++ b/phpBB/adm/style/acp_captcha.html @@ -6,6 +6,14 @@ <p>{L_ACP_VC_SETTINGS_EXPLAIN}</p> +<p>{L_ACP_VC_EXT_GET_MORE}</p> + +<!-- IF ERROR_MSG --> +<div class="errorbox"> + <h3>{L_WARNING}</h3> + <p>{ERROR_MSG}</p> +</div> +<!-- ENDIF --> <form id="acp_captcha" method="post" action="{U_ACTION}"> diff --git a/phpBB/adm/style/acp_contact.html b/phpBB/adm/style/acp_contact.html new file mode 100644 index 0000000000..828fd4b659 --- /dev/null +++ b/phpBB/adm/style/acp_contact.html @@ -0,0 +1,76 @@ +<!-- INCLUDE overall_header.html --> + +<script type="text/javascript"> +// <![CDATA[ + + var form_name = 'acp_contact'; + var text_name = 'contact_admin_info'; + var load_draft = false; + var upload = false; + var imageTag = false; + +// ]]> +</script> + +<a id="maincontent"></a> + +<h1>{L_ACP_CONTACT_SETTINGS}</h1> + +<p>{L_ACP_CONTACT_SETTINGS_EXPLAIN}</p> + +<form id="acp_contact" method="post" action="{U_ACTION}"> + <fieldset> + <legend>{L_GENERAL_OPTIONS}</legend> + <dl> + <dt><label for="contact_admin_form_enable">{L_CONTACT_US_ENABLE}{L_COLON}</label><br /><span>{L_CONTACT_US_ENABLE_EXPLAIN}</span></dt> + <dd> + <label><input type="radio" class="radio" id="contact_admin_form_enable" name="contact_admin_form_enable" value="1"<!-- IF CONTACT_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label> + <label><input type="radio" class="radio" name="contact_admin_form_enable" value="0"<!-- IF not CONTACT_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label> + </dd> + </dl> + </fieldset> + + <!-- IF CONTACT_US_INFO_PREVIEW --> + <fieldset> + <legend>{L_CONTACT_US_INFO_PREVIEW}</legend> + <p>{CONTACT_US_INFO_PREVIEW}</p> + </fieldset> + <!-- ENDIF --> + + <fieldset> + <legend>{L_CONTACT_US_INFO}</legend> + <p>{L_CONTACT_US_INFO_EXPLAIN}</p> + + <!-- INCLUDE acp_posting_buttons.html --> + + <dl class="responsive-columns"> + <dt style="width: 90px;" id="color_palette_placeholder" data-orientation="v" data-height="12" data-width="15" data-bbcode="true"> + </dt> + + <dd style="margin-{S_CONTENT_FLOW_BEGIN}: 90px;"> + <textarea name="contact_admin_info" rows="10" cols="60" style="width: 95%;" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();" data-bbcode="true">{CONTACT_US_INFO}</textarea> + </dd> + + <dd style="margin-{S_CONTENT_FLOW_BEGIN}: 90px; margin-top: 5px;"> + <!-- IF S_BBCODE_ALLOWED --> + <label><input type="checkbox" class="radio" name="disable_bbcode"<!-- IF S_BBCODE_DISABLE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_DISABLE_BBCODE}</label> + <!-- ENDIF --> + <!-- IF S_SMILIES_ALLOWED --> + <label><input type="checkbox" class="radio" name="disable_smilies"<!-- IF S_SMILIES_DISABLE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_DISABLE_SMILIES}</label> + <!-- ENDIF --> + <!-- IF S_LINKS_ALLOWED --> + <label><input type="checkbox" class="radio" name="disable_magic_url"<!-- IF S_MAGIC_URL_DISABLE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_DISABLE_MAGIC_URL}</label> + <!-- ENDIF --> + </dd> + <dd style="margin-{S_CONTENT_FLOW_BEGIN}: 90px; margin-top: 10px;"><strong>{L_OPTIONS}{L_COLON} </strong>{BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}</dd> + </dl> + </fieldset> + + <fieldset class="submit-buttons"> + <input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" /> + <input class="button2" type="submit" name="preview" value="{L_PREVIEW}" /> + {S_FORM_TOKEN} + </fieldset> +</form> + +<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/adm/style/acp_email.html b/phpBB/adm/style/acp_email.html index 950ecb40b0..e14c56ab47 100644 --- a/phpBB/adm/style/acp_email.html +++ b/phpBB/adm/style/acp_email.html @@ -19,12 +19,14 @@ <legend>{L_COMPOSE}</legend> <dl> <dt><label for="group">{L_SEND_TO_GROUP}{L_COLON}</label></dt> + <!-- EVENT acp_email_group_options_prepend --> <dd><select id="group" name="g">{S_GROUP_OPTIONS}</select></dd> + <!-- EVENT acp_email_group_options_append --> </dl> <dl> <dt><label for="usernames">{L_SEND_TO_USERS}{L_COLON}</label><br /><span>{L_SEND_TO_USERS_EXPLAIN}</span></dt> <dd><textarea name="usernames" id="usernames" rows="5" cols="40">{USERNAMES}</textarea></dd> - <dd>[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</dd> + <dd><!-- EVENT acp_email_find_username_prepend -->[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]<!-- EVENT acp_email_find_username_append --></dd> </dl> <dl> <dt><label for="subject">{L_SUBJECT}{L_COLON}</label></dt> @@ -47,6 +49,8 @@ <dd><input id="send" type="checkbox" class="radio" name="send_immediately" checked="checked" /></dd> </dl> +<!-- EVENT acp_email_options_after --> + <p class="submit-buttons"> <input class="button1" type="submit" id="submit" name="submit" value="{L_SEND_EMAIL}" /> <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" /> diff --git a/phpBB/adm/style/acp_ext_delete_data.html b/phpBB/adm/style/acp_ext_delete_data.html index 5b38d9b8d0..0f3adb7cfe 100644 --- a/phpBB/adm/style/acp_ext_delete_data.html +++ b/phpBB/adm/style/acp_ext_delete_data.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> - <a name="maincontent"></a> + <a id="maincontent"></a> <h1>{L_EXTENSIONS_ADMIN}</h1> diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html index 18786d80f9..830c2e3cb4 100644 --- a/phpBB/adm/style/acp_ext_details.html +++ b/phpBB/adm/style/acp_ext_details.html @@ -1,64 +1,106 @@ <!-- INCLUDE overall_header.html --> -<a name="maincontent"></a> +<a id="maincontent"></a> <a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a> <h1>{L_EXTENSIONS_ADMIN}</h1> + <!-- IF S_VERSIONCHECK --> + <div class="<!-- IF S_UP_TO_DATE -->successbox<!-- ELSE -->errorbox<!-- ENDIF -->"> + <p>{UP_TO_DATE_MSG} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> + </div> + <!-- ELSE IF S_VERSIONCHECK_STATUS == 0 --> + <div class="errorbox notice"> + <p>{L_VERSIONCHECK_FAIL}</p> + <p>{VERSIONCHECK_FAIL_REASON}</p> + <p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> + </div> + <!-- ELSE IF S_VERSIONCHECK_STATUS == 1 --> + <div class="errorbox notice"> + <p>{VERSIONCHECK_FAIL_REASON}</p> + </div> + <!-- ENDIF --> + <fieldset> <legend>{L_EXT_DETAILS}</legend> <!-- IF META_DISPLAY_NAME --> <dl> - <dt><label for="meta_display_name">{L_DISPLAY_NAME}{L_COLON}</label></dt> + <dt><label>{L_DISPLAY_NAME}{L_COLON}</label></dt> <dd><strong id="meta_display_name">{META_DISPLAY_NAME}</strong></dd> </dl> <!-- ENDIF --> <dl> - <dt><label for="meta_name">{L_CLEAN_NAME}{L_COLON}</label></dt> + <dt><label>{L_CLEAN_NAME}{L_COLON}</label></dt> <dd><strong id="meta_name">{META_NAME}</strong></dd> </dl> <!-- IF META_DESCRIPTION --> <dl> - <dt><label for="meta_description">{L_DESCRIPTION}{L_COLON}</label></dt> - <dd><p id="meta_description">{META_DESCRIPTION}</p></dd> + <dt><label>{L_DESCRIPTION}{L_COLON}</label></dt> + <dd><span id="meta_description">{META_DESCRIPTION}</span></dd> </dl> <!-- ENDIF --> <dl> - <dt><label for="meta_version">{L_VERSION}{L_COLON}</label></dt> - <dd><p id="meta_version">{META_VERSION}</p></dd> + <dt><label>{L_VERSION}{L_COLON}</label></dt> + <dd><span id="meta_version">{META_VERSION}</span></dd> </dl> <!-- IF META_HOMEPAGE --> <dl> - <dt><label for="meta_homepage">{L_HOMEPAGE}{L_COLON}</label></dt> - <dd><p id="meta_homepage">{META_HOMEPAGE}</p></dd> + <dt><label>{L_HOMEPAGE}{L_COLON}</label></dt> + <dd><strong id="meta_homepage"><a href="{META_HOMEPAGE}">{META_HOMEPAGE}</a></strong></dd> </dl> <!-- ENDIF --> <!-- IF META_TIME --> <dl> - <dt><label for="meta_time">{L_TIME}{L_COLON}</label></dt> - <dd><p id="meta_time">{META_TIME}</p></dd> + <dt><label>{L_TIME}{L_COLON}</label></dt> + <dd><span id="meta_time">{META_TIME}</span></dd> </dl> <!-- ENDIF --> <dl> - <dt><label for="meta_license">{L_LICENCE}{L_COLON}</label></dt> - <dd><p id="meta_license">{META_LICENCE}</p></dd> + <dt><label>{L_LICENSE}{L_COLON}</label></dt> + <dd><span id="meta_license">{META_LICENSE}</span></dd> </dl> </fieldset> + <!-- IF S_VERSIONCHECK && not S_UP_TO_DATE --> + <fieldset> + <legend>{L_LATEST_VERSION}</legend> + <!-- BEGIN updates_available --> + <fieldset> + <dl> + <dt><label>{L_VERSION}{L_COLON}</label></dt> + <dd><strong>{updates_available.current}</strong></dd> + </dl> + <!-- IF updates_available.download--> + <dl> + <dt><label>{L_DOWNLOAD_LATEST}</label></dt> + <dd><strong><a href="{updates_available.download}">{L_DOWNLOAD} {META_NAME} {LATEST_VERSION}</a></strong></dd> + </dl> + <!-- ENDIF --> + <!-- IF updates_available.announcement --> + <dl> + <dt><label>{L_ANNOUNCEMENT_TOPIC}</label></dt> + <dd><strong><a href="{updates_available.announcement}">{L_RELEASE_ANNOUNCEMENT}</a></strong></dd> + </dl> + <!-- ENDIF --> + </fieldset> + <!-- END updates_available --> + </fieldset> + <!-- ENDIF --> + <!-- IF META_REQUIRE_PHPBB || META_REQUIRE_PHP --> <fieldset> <legend>{L_REQUIREMENTS}</legend> <!-- IF META_REQUIRE_PHPBB --> <dl<!-- IF META_REQUIRE_PHPBB_FAIL --> class="requirements_not_met"<!-- ENDIF -->> - <dt><label for="require_phpbb">{L_PHPBB_VERSION}{L_COLON}</label></dt> - <dd><p id="require_phpbb">{META_REQUIRE_PHPBB}</p></dd> + <dt><label>{L_PHPBB_VERSION}{L_COLON}</label></dt> + <dd><span id="require_phpbb">{META_REQUIRE_PHPBB}</span></dd> </dl> <!-- ENDIF --> <!-- IF META_REQUIRE_PHP --> <dl<!-- IF META_REQUIRE_PHP_FAIL --> class="requirements_not_met"<!-- ENDIF -->> - <dt><label for="require_php">{L_PHP_VERSION}{L_COLON}</label></dt> - <dd><p id="require_php">{META_REQUIRE_PHP}</p></dd> + <dt><label>{L_PHP_VERSION}{L_COLON}</label></dt> + <dd><span id="require_php">{META_REQUIRE_PHP}</span></dd> </dl> <!-- ENDIF --> </fieldset> @@ -69,25 +111,25 @@ <!-- BEGIN meta_authors --> <fieldset> <dl> - <dt><label for="meta_author_name">{L_AUTHOR_NAME}{L_COLON}</label></dt> - <dd><strong id="meta_author_name">{meta_authors.AUTHOR_NAME}</strong></dd> + <dt><label>{L_AUTHOR_NAME}{L_COLON}</label></dt> + <dd><strong>{meta_authors.AUTHOR_NAME}</strong></dd> </dl> <!-- IF meta_authors.AUTHOR_EMAIL --> <dl> - <dt><label for="meta_author_email">{L_AUTHOR_EMAIL}{L_COLON}</label></dt> - <dd><strong id="meta_author_email"><a href="mailto:{meta_authors.AUTHOR_EMAIL}">{meta_authors.AUTHOR_EMAIL}</a></strong></dd> + <dt><label>{L_AUTHOR_EMAIL}{L_COLON}</label></dt> + <dd><strong><a href="mailto:{meta_authors.AUTHOR_EMAIL}">{meta_authors.AUTHOR_EMAIL}</a></strong></dd> </dl> <!-- ENDIF --> <!-- IF meta_authors.AUTHOR_HOMEPAGE --> <dl> - <dt><label for="meta_author_url">{L_AUTHOR_HOMEPAGE}{L_COLON}</label></dt> - <dd><strong id="meta_author_url"><a href="{meta_authors.AUTHOR_HOMEPAGE}">{meta_authors.AUTHOR_HOMEPAGE}</a></strong></dd> + <dt><label>{L_AUTHOR_HOMEPAGE}{L_COLON}</label></dt> + <dd><strong><a href="{meta_authors.AUTHOR_HOMEPAGE}">{meta_authors.AUTHOR_HOMEPAGE}</a></strong></dd> </dl> <!-- ENDIF --> <!-- IF meta_authors.AUTHOR_ROLE --> <dl> - <dt><label for="author_role">{L_AUTHOR_ROLE}{L_COLON}</label></dt> - <dd><strong id="meta_author_role">{meta_authors.AUTHOR_ROLE}</strong></dd> + <dt><label>{L_AUTHOR_ROLE}{L_COLON}</label></dt> + <dd><strong>{meta_authors.AUTHOR_ROLE}</strong></dd> </dl> <!-- ENDIF --> </fieldset> diff --git a/phpBB/adm/style/acp_ext_disable.html b/phpBB/adm/style/acp_ext_disable.html index 4fa0893be7..d2b5c46fe8 100644 --- a/phpBB/adm/style/acp_ext_disable.html +++ b/phpBB/adm/style/acp_ext_disable.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> - <a name="maincontent"></a> + <a id="maincontent"></a> <h1>{L_EXTENSIONS_ADMIN}</h1> @@ -8,19 +8,19 @@ <p>{L_EXTENSION_DISABLE_EXPLAIN}</p> <!-- IF PRE --> - <div class="errorbox"> + <fieldset> + <h2>{L_CONFIRM}</h2> <p>{L_CONFIRM_MESSAGE}</p> - </div> + </fieldset> <form id="acp_extensions" method="post" action="{U_DISABLE}"> <fieldset class="submit-buttons"> - <legend>{L_EXTENSION_DISABLE}</legend> <input class="button1" type="submit" name="disable" value="{L_EXTENSION_DISABLE}" /> <input class="button2" type="submit" name="cancel" value="{L_CANCEL}" /> </fieldset> </form> <!-- ELSEIF S_NEXT_STEP --> - <div class="errorbox"> + <div class="successbox notice"> <p>{L_EXTENSION_DISABLE_IN_PROGRESS}</p> </div> <!-- ELSE --> diff --git a/phpBB/adm/style/acp_ext_enable.html b/phpBB/adm/style/acp_ext_enable.html index 670904a2ce..8a4a35359e 100644 --- a/phpBB/adm/style/acp_ext_enable.html +++ b/phpBB/adm/style/acp_ext_enable.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> - <a name="maincontent"></a> + <a id="maincontent"></a> <h1>{L_EXTENSIONS_ADMIN}</h1> @@ -14,19 +14,19 @@ <p><a href="{U_RETURN}">{L_RETURN_TO_EXTENSION_LIST}</a></p> </div> <!-- ELSEIF PRE --> - <div class="errorbox"> + <fieldset> + <h2>{L_CONFIRM}</h2> <p>{L_CONFIRM_MESSAGE}</p> - </div> + </fieldset> <form id="acp_extensions" method="post" action="{U_ENABLE}"> <fieldset class="submit-buttons"> - <legend>{L_EXTENSION_ENABLE}</legend> <input class="button1" type="submit" name="enable" value="{L_EXTENSION_ENABLE}" /> <input class="button2" type="submit" name="cancel" value="{L_CANCEL}" /> </fieldset> </form> <!-- ELSEIF S_NEXT_STEP --> - <div class="errorbox"> + <div class="successbox notice"> <p>{L_EXTENSION_ENABLE_IN_PROGRESS}</p> </div> <!-- ELSE --> diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 09cf6a31f5..8feb12a423 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -1,28 +1,61 @@ <!-- INCLUDE overall_header.html --> -<a name="maincontent"></a> +<a id="maincontent"></a> <h1>{L_EXTENSIONS_ADMIN}</h1> <p>{L_EXTENSIONS_EXPLAIN}</p> + <fieldset class="quick"> + <span class="small"><a href="https://www.phpbb.com/go/customise/extensions/3.1" target="_blank">{L_BROWSE_EXTENSIONS_DATABASE}</a> • <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE_ALL}</a> • <a href="javascript:phpbb.toggleDisplay('version_check_settings');">{L_SETTINGS}</a></span> + </fieldset> + + <form id="version_check_settings" method="post" action="{U_ACTION}" style="display:none"> + + <fieldset> + <legend>{L_EXTENSIONS_VERSION_CHECK_SETTINGS}</legend> + <dl> + <dt><label for="force_unstable">{L_FORCE_UNSTABLE}{L_COLON}</label></dt> + <dd> + <label><input type="radio" id="force_unstable" name="force_unstable" class="radio" value="1"<!-- IF FORCE_UNSTABLE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> + <label><input type="radio" name="force_unstable" class="radio" value="0"<!-- IF not FORCE_UNSTABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label> + </dd> + </dl> + + <p class="submit-buttons"> + <input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> + <input class="button2" type="reset" name="reset" value="{L_RESET}" /> + <input type="hidden" name="action" value="set_config_version_check_force_unstable" /> + {S_FORM_TOKEN} + </p> + </fieldset> + </form> + <table class="table1"> - <col class="row1" ><col class="row2" ><col class="row2" > + <col class="row1" ><col class="row1" ><col class="row2" ><col class="row2" > <thead> <tr> <th>{L_EXTENSION_NAME}</th> - <th>{L_EXTENSION_OPTIONS}</th> - <th>{L_EXTENSION_ACTIONS}</th> + <th style="text-align: center; width: 20%;">{L_CURRENT_VERSION}</th> + <th style="text-align: center; width: 10%;">{L_EXTENSION_OPTIONS}</th> + <th style="text-align: center; width: 25%;">{L_EXTENSION_ACTIONS}</th> </tr> </thead> <tbody> <!-- IF .enabled --> <tr> - <td class="row3" colspan="3"><strong>{L_EXTENSIONS_ENABLED}</strong></td> + <td class="row3" colspan="4"><strong>{L_EXTENSIONS_ENABLED}</strong></td> </tr> <!-- BEGIN enabled --> - <tr class="ext_enabled"> - <td><strong>{enabled.META_DISPLAY_NAME}</strong></td> + <tr class="ext_enabled row-highlight"> + <td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong></td> + <td style="text-align: center;"> + <!-- IF enabled.S_VERSIONCHECK --> + <strong <!-- IF enabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{enabled.META_VERSION}</strong> + <!-- ELSE --> + {enabled.META_VERSION} + <!-- ENDIF --> + </td> <td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td> <td style="text-align: center;"> <!-- BEGIN actions --> @@ -36,11 +69,18 @@ <!-- IF .disabled --> <tr> - <td class="row3" colspan="3"><strong>{L_EXTENSIONS_DISABLED}</strong></td> + <td class="row3" colspan="4"><strong>{L_EXTENSIONS_DISABLED}</strong></td> </tr> <!-- BEGIN disabled --> - <tr class="ext_disabled"> - <td><strong>{disabled.META_DISPLAY_NAME}</strong></td> + <tr class="ext_disabled row-highlight"> + <td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong></td> + <td style="text-align: center;"> + <!-- IF disabled.S_VERSIONCHECK --> + <strong <!-- IF disabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{disabled.META_VERSION}</strong> + <!-- ELSE --> + {disabled.META_VERSION} + <!-- ENDIF --> + </td> <td style="text-align: center;"> <!-- IF disabled.U_DETAILS --><a href="{disabled.U_DETAILS}">{L_DETAILS}</a><!-- ENDIF --> </td> @@ -55,10 +95,15 @@ <!-- ENDIF --> </tbody> </table> - <br /> <table class="table1"> <tr> + <th>{L_EXTENSION_INSTALL_HEADLINE}</th> + </tr> + <tr> + <td class="row3">{L_EXTENSION_INSTALL_EXPLAIN}</td> + </tr> + <tr> <th>{L_EXTENSION_UPDATE_HEADLINE}</th> </tr> <tr> diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index e8b20007dc..dcad90d7bc 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -14,45 +14,45 @@ <!-- IF not S_ADD_ACTION and S_FORUM_ORIG_POST --> if (value == {FORUM_POST}) { - dE('type_actions', -1); + phpbb.toggleDisplay('type_actions', -1); } else { - dE('type_actions', 1); + phpbb.toggleDisplay('type_actions', 1); } <!-- ENDIF --> <!-- IF not S_ADD_ACTION and S_FORUM_ORIG_CAT and S_HAS_SUBFORUMS --> if (value == {FORUM_LINK}) { - dE('cat_to_link_actions', 1); + phpbb.toggleDisplay('cat_to_link_actions', 1); } else { - dE('cat_to_link_actions', -1); + phpbb.toggleDisplay('cat_to_link_actions', -1); } <!-- ENDIF --> if (value == {FORUM_POST}) { - dE('forum_post_options', 1); - dE('forum_link_options', -1); - dE('forum_rules_options', 1); - dE('forum_cat_options', -1); + phpbb.toggleDisplay('forum_post_options', 1); + phpbb.toggleDisplay('forum_link_options', -1); + phpbb.toggleDisplay('forum_rules_options', 1); + phpbb.toggleDisplay('forum_cat_options', -1); } else if (value == {FORUM_LINK}) { - dE('forum_post_options', -1); - dE('forum_link_options', 1); - dE('forum_rules_options', -1); - dE('forum_cat_options', -1); + phpbb.toggleDisplay('forum_post_options', -1); + phpbb.toggleDisplay('forum_link_options', 1); + phpbb.toggleDisplay('forum_rules_options', -1); + phpbb.toggleDisplay('forum_cat_options', -1); } else if (value == {FORUM_CAT}) { - dE('forum_post_options', -1); - dE('forum_link_options', -1); - dE('forum_rules_options', 1); - dE('forum_cat_options', 1); + phpbb.toggleDisplay('forum_post_options', -1); + phpbb.toggleDisplay('forum_link_options', -1); + phpbb.toggleDisplay('forum_rules_options', 1); + phpbb.toggleDisplay('forum_cat_options', 1); } } @@ -64,30 +64,30 @@ { <!-- IF not S_ADD_ACTION and S_FORUM_ORIG_POST --> <!-- IF S_FORUM_POST --> - dE('type_actions', -1); + phpbb.toggleDisplay('type_actions', -1); <!-- ENDIF --> <!-- ENDIF --> <!-- IF not S_ADD_ACTION and S_FORUM_ORIG_CAT and S_HAS_SUBFORUMS --> <!-- IF S_FORUM_CAT --> - dE('cat_to_link_actions', -1); + phpbb.toggleDisplay('cat_to_link_actions', -1); <!-- ENDIF --> <!-- ENDIF --> <!-- IF not S_FORUM_POST --> - dE('forum_post_options', -1); + phpbb.toggleDisplay('forum_post_options', -1); <!-- ENDIF --> <!-- IF not S_FORUM_CAT --> - dE('forum_cat_options', -1); + phpbb.toggleDisplay('forum_cat_options', -1); <!-- ENDIF --> <!-- IF not S_FORUM_LINK --> - dE('forum_link_options', -1); + phpbb.toggleDisplay('forum_link_options', -1); <!-- ENDIF --> <!-- IF S_FORUM_LINK --> - dE('forum_rules_options', -1); + phpbb.toggleDisplay('forum_rules_options', -1); <!-- ENDIF --> } @@ -111,6 +111,7 @@ <fieldset> <legend>{L_FORUM_SETTINGS}</legend> + <!-- EVENT acp_forums_main_settings_prepend --> <dl> <dt><label for="forum_type">{L_FORUM_TYPE}{L_COLON}</label></dt> <dd><select id="forum_type" name="forum_type" onchange="display_options(this.options[this.selectedIndex].value);">{S_FORUM_TYPE_OPTIONS}</select></dd> @@ -182,6 +183,7 @@ <dt><label for="forum_style">{L_FORUM_STYLE}{L_COLON}</label></dt> <dd><select id="forum_style" name="forum_style"><option value="0">{L_DEFAULT_STYLE}</option>{S_STYLES_OPTIONS}</select></dd> </dl> + <!-- EVENT acp_forums_main_settings_append --> </fieldset> <div id="forum_cat_options"> @@ -198,6 +200,7 @@ <div id="forum_post_options"> <fieldset> <legend>{L_GENERAL_FORUM_SETTINGS}</legend> + <!-- EVENT acp_forums_normal_settings_prepend --> <dl> <dt><label for="forum_status">{L_FORUM_STATUS}{L_COLON}</label></dt> <dd><select id="forum_status" name="forum_status">{S_STATUS_OPTIONS}</select></dd> @@ -246,6 +249,7 @@ <fieldset> <legend>{L_FORUM_PRUNE_SETTINGS}</legend> + <!-- EVENT acp_forums_prune_settings_prepend --> <dl> <dt><label for="enable_prune">{L_FORUM_AUTO_PRUNE}{L_COLON}</label><br /><span>{L_FORUM_AUTO_PRUNE_EXPLAIN}</span></dt> <dd><label><input type="radio" class="radio" name="enable_prune" value="1"<!-- IF S_PRUNE_ENABLE --> id="enable_prune" checked="checked"<!-- ENDIF --> /> {L_YES}</label> @@ -278,6 +282,20 @@ <dd><label><input type="radio" class="radio" name="prune_sticky" value="1"<!-- IF S_PRUNE_STICKY --> id="prune_sticky" checked="checked"<!-- ENDIF --> /> {L_YES}</label> <label><input type="radio" class="radio" name="prune_sticky" value="0"<!-- IF not S_PRUNE_STICKY --> id="prune_sticky" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> </dl> + <dl> + <dt><label for="enable_shadow_prune">{L_FORUM_PRUNE_SHADOW}{L_COLON}</label><br /><span>{L_FORUM_PRUNE_SHADOW_EXPLAIN}</span></dt> + <dd><label><input type="radio" class="radio" name="enable_shadow_prune" value="1"<!-- IF S_PRUNE_SHADOW_ENABLE --> id="enable_shadow_prune" checked="checked"<!-- ENDIF --> /> {L_YES}</label> + <label><input type="radio" class="radio" name="enable_shadow_prune" value="0"<!-- IF not S_PRUNE_SHADOW_ENABLE --> id="enable_shadow_prune" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> + </dl> + <dl> + <dt><label for="prune_shadow_freq">{L_AUTO_PRUNE_SHADOW_FREQ}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_SHADOW_FREQ_EXPLAIN}</span></dt> + <dd><input type="number" id="prune_shadow_freq" name="prune_shadow_freq" value="{PRUNE_SHADOW_FREQ}" maxlength="4" size="4" min="0" max="9999" /> {L_DAYS}</dd> + </dl> + <dl> + <dt><label for="prune_shadow_days">{L_AUTO_PRUNE_SHADOW_DAYS}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_SHADOW_DAYS_EXPLAIN}</span></dt> + <dd><input type="number" id="prune_shadow_days" name="prune_shadow_days" value="{PRUNE_SHADOW_DAYS}" maxlength="4" size="4" min="0" max="9999" /> {L_DAYS}</dd> + </dl> + <!-- EVENT acp_forums_prune_settings_append --> </fieldset> </div> @@ -304,6 +322,7 @@ <div id="forum_rules_options"> <fieldset> <legend>{L_FORUM_RULES}</legend> + <!-- EVENT acp_forums_rules_settings_prepend --> <dl> <dt><label for="forum_rules_link">{L_FORUM_RULES_LINK}{L_COLON}</label><br /><span>{L_FORUM_RULES_LINK_EXPLAIN}</span></dt> <dd><input class="text medium" type="text" id="forum_rules_link" name="forum_rules_link" value="{FORUM_RULES_LINK}" maxlength="255" /></dd> @@ -321,8 +340,11 @@ <label><input type="checkbox" class="radio" name="rules_parse_smilies"<!-- IF S_SMILIES_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_SMILIES}</label> <label><input type="checkbox" class="radio" name="rules_parse_urls"<!-- IF S_URLS_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_URLS}</label></dd> </dl> + <!-- EVENT acp_forums_rules_settings_append --> </fieldset> </div> + + <!-- EVENT acp_forums_custom_settings --> <fieldset class="submit-buttons"> <legend>{L_SUBMIT}</legend> @@ -454,9 +476,9 @@ </td> <td class="actions"> <span class="up-disabled" style="display:none;">{ICON_MOVE_UP_DISABLED}</span> - <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="row_up" data-overlay="false">{ICON_MOVE_UP}</a></span> + <span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="row_up">{ICON_MOVE_UP}</a></span> <span class="down-disabled" style="display:none;">{ICON_MOVE_DOWN_DISABLED}</span> - <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="row_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> + <span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="row_down">{ICON_MOVE_DOWN}</a></span> <a href="{forums.U_EDIT}">{ICON_EDIT}</a> <!-- IF not forums.S_FORUM_LINK --> <a href="{forums.U_SYNC}" onclick="popup_progress_bar();">{ICON_SYNC}</a> @@ -476,7 +498,7 @@ <fieldset class="quick"> {L_SELECT_FORUM}{L_COLON} <select name="parent_id" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit(); }">{FORUM_BOX}</select> - <input class="button2" type="submit" value="{L_GO}" /> + <!-- EVENT acp_forums_quick_select_button_prepend --><input class="button2" type="submit" value="{L_GO}" /><!-- EVENT acp_forums_quick_select_button_append --> {S_FORM_TOKEN} </fieldset> </form> diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index 72f4f2b239..23f6e744c0 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -56,6 +56,7 @@ <fieldset> <legend>{L_GROUP_OPTIONS_SAVE}</legend> + <!-- EVENT acp_group_options_before --> <!-- IF S_USER_FOUNDER --> <dl> <dt><label for="group_founder_manage">{L_GROUP_FOUNDER_MANAGE}{L_COLON}</label><br /><span>{L_GROUP_FOUNDER_MANAGE_EXPLAIN}</span></dt> @@ -78,6 +79,7 @@ <dt><label for="group_receive_pm">{L_GROUP_RECEIVE_PM}{L_COLON}</label><br /><span>{L_GROUP_RECEIVE_PM_EXPLAIN}</span></dt> <dd><input name="group_receive_pm" type="checkbox" value="1" class="radio" id="group_receive_pm"{GROUP_RECEIVE_PM} /></dd> </dl> + <!-- EVENT acp_group_options_after --> </fieldset> <fieldset> @@ -114,10 +116,9 @@ </dl> <dl> <dt><label>{L_AVATAR_TYPE}{L_COLON}</label></dt> - <dd><select name="avatar_driver" id="avatar_driver"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> + <dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true"> <!-- BEGIN avatar_drivers --> - <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_drivers.L_TITLE}</option> + <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF --> data-toggle-setting="#avatar_option_{avatar_drivers.DRIVER}">{avatar_drivers.L_TITLE}</option> <!-- END avatar_drivers --> </select></dd> </dl> @@ -139,8 +140,6 @@ </fieldset> </form> - <!-- INCLUDEJS avatars.js --> - <!-- ELSEIF S_LIST --> <a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a> @@ -237,7 +236,7 @@ <dl> <dt><label for="usernames">{L_USERNAME}{L_COLON}</label><br /><span>{L_USERNAMES_EXPLAIN}</span></dt> <dd><textarea id="usernames" name="usernames" cols="40" rows="5"></textarea></dd> - <dd>[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</dd> + <dd><!-- EVENT acp_groups_find_username_prepend -->[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]<!-- EVENT acp_groups_find_username_append --></dd> </dl> <p class="quick"> @@ -266,6 +265,7 @@ <form id="acp_groups" method="post" action="{U_ACTION}"> + <!-- EVENT acp_groups_manage_before --> <table class="table1"> <col class="col1" /><col class="col1" /><col class="col2" /><col class="col2" /><col class="col2" /> <thead> @@ -286,6 +286,7 @@ <!-- ENDIF --> </tbody> </table> + <!-- EVENT acp_groups_manage_after --> <fieldset class="quick"> <!-- IF S_GROUP_ADD --> diff --git a/phpBB/adm/style/acp_groups_position.html b/phpBB/adm/style/acp_groups_position.html index b1df6b6162..20ed9521f0 100644 --- a/phpBB/adm/style/acp_groups_position.html +++ b/phpBB/adm/style/acp_groups_position.html @@ -43,9 +43,9 @@ <td style="text-align: center;">{legend.GROUP_TYPE}</td> <td class="actions"> <span class="up-disabled" style="display: none;">{ICON_MOVE_UP_DISABLED}</span> - <span class="up"><a href="{legend.U_MOVE_UP}" data-ajax="row_up" data-overlay="false">{ICON_MOVE_UP}</a></span> + <span class="up"><a href="{legend.U_MOVE_UP}" data-ajax="row_up">{ICON_MOVE_UP}</a></span> <span class="down-disabled" style="display:none;">{ICON_MOVE_DOWN_DISABLED}</span> - <span class="down"><a href="{legend.U_MOVE_DOWN}" data-ajax="row_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> + <span class="down"><a href="{legend.U_MOVE_DOWN}" data-ajax="row_down">{ICON_MOVE_DOWN}</a></span> <a href="{legend.U_DELETE}">{ICON_DELETE}</a> </td> </tr> @@ -65,8 +65,10 @@ <option<!-- IF add_legend.GROUP_SPECIAL --> class="sep"<!-- ENDIF --> value="{add_legend.GROUP_ID}">{add_legend.GROUP_NAME}</option> <!-- END add_legend --> </select> + <!-- EVENT acp_groups_position_legend_add_button_before --> <input class="button2" type="submit" name="submit" value="{L_ADD}" /> <input type="hidden" name="action" value="add" /> + <!-- EVENT acp_groups_position_legend_add_button_after --> {S_FORM_TOKEN} </fieldset> </form> @@ -129,9 +131,9 @@ </td></td> <td class="actions"> <span class="up-disabled" style="display: none;">{ICON_MOVE_UP_DISABLED}</span> - <span class="up"><a href="{teampage.U_MOVE_UP}" data-ajax="row_up" data-overlay="false">{ICON_MOVE_UP}</a></span> + <span class="up"><a href="{teampage.U_MOVE_UP}" data-ajax="row_up">{ICON_MOVE_UP}</a></span> <span class="down-disabled" style="display:none;">{ICON_MOVE_DOWN_DISABLED}</span> - <span class="down"><a href="{teampage.U_MOVE_DOWN}" data-ajax="row_down" data-overlay="false">{ICON_MOVE_DOWN}</a></span> + <span class="down"><a href="{teampage.U_MOVE_DOWN}" data-ajax="row_down">{ICON_MOVE_DOWN}</a></span> <a href="{teampage.U_DELETE}">{ICON_DELETE}</a> </td> </tr> @@ -162,8 +164,10 @@ <option<!-- IF add_teampage.GROUP_SPECIAL --> class="sep"<!-- ENDIF --> value="{add_teampage.GROUP_ID}">{add_teampage.GROUP_NAME}</option> <!-- END add_teampage --> </select> + <!-- EVENT acp_groups_position_teampage_add_button_before --> <input class="button2" type="submit" name="submit" value="{L_ADD}" /> <input type="hidden" name="action" value="add" /> + <!-- EVENT acp_groups_position_teampage_add_button_after --> {S_FORM_TOKEN} </fieldset> </form> diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index 9117052d87..e723129e37 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -7,7 +7,7 @@ <script type="text/javascript" defer="defer"> // <![CDATA[ <!-- IF S_ADD_CODE --> - + var smiley = Array(); <!-- BEGIN smile --> smiley['{smile.SMILEY_URL}'] = Array(); @@ -37,10 +37,10 @@ } } } - + <!-- ENDIF --> - + function toggle_select(icon, display, select) { var disp = document.getElementById('order_disp_' + select); @@ -89,6 +89,9 @@ <!-- ENDIF --> <td>{L_WIDTH}</td> <td>{L_HEIGHT}</td> + <!-- IF not S_SMILIES --> + <td>{L_ALT_TEXT}</td> + <!-- ENDIF --> <td>{L_DISPLAY_ON_POSTING}</td> <!-- IF ID or S_ADD --> <td>{L_ORDER}</td> @@ -101,8 +104,8 @@ <tbody> <!-- BEGIN items --> <tr> - - <td style="text-align: center;"><img src="{items.IMG_SRC}" alt="" title="" /><input type="hidden" name="image[{items.IMG}]" value="1" /></td> + + <td style="text-align: center;"><img src="{items.IMG_SRC}" alt="{items.TEXT_ALT}" title="{items.TEXT_ALT}" /><input type="hidden" name="image[{items.IMG}]" value="1" /></td> <td style="vertical-align: top;">[{items.IMG}]</td> <!-- IF S_SMILIES --> <td><input class="text post" type="text" name="code[{items.IMG}]" value="{items.CODE}" size="10" maxlength="50" /></td> @@ -110,6 +113,9 @@ <!-- ENDIF --> <td><input class="text post" type="number" size="3" name="width[{items.IMG}]" value="{items.WIDTH}" /></td> <td><input class="text post" type="number" size="3" name="height[{items.IMG}]" value="{items.HEIGHT}" /></td> + <!-- IF not S_SMILIES --> + <td><input class="text post" type="text" name="alt[{items.IMG}]" value="{items.ALT}" size="10" maxlength="50" /></td> + <!-- ENDIF --> <td> <input type="checkbox" class="radio" name="display_on_posting[{items.IMG}]"{items.POSTING_CHECKED} onclick="toggle_select('{items.A_IMG}', this.checked, '{items.S_ROW_COUNT}');"/> <!-- IF items.S_ID --> @@ -121,7 +127,7 @@ <optgroup id="order_disp_{items.S_ROW_COUNT}" label="{L_DISPLAY_POSTING}" <!-- IF not items.POSTING_CHECKED -->disabled="disabled" class="disabled-options" <!-- ENDIF -->>{S_ORDER_LIST_DISPLAY}</optgroup> <optgroup id="order_no_disp_{items.S_ROW_COUNT}" label="{L_DISPLAY_POSTING_NO}" <!-- IF items.POSTING_CHECKED -->disabled="disabled" class="disabled-options" <!-- ENDIF -->>{S_ORDER_LIST_UNDISPLAY}</optgroup> </select></td> - <!-- ENDIF --> + <!-- ENDIF --> <!-- IF S_ADD --> <td><input type="checkbox" class="radio" name="add_img[{items.IMG}]" value="1" /></td> <!-- ENDIF --> @@ -147,6 +153,8 @@ </tr> <!-- ENDIF --> <!-- ELSE --> + </thead> + <tbody> <tr class="row3"> <td colspan="{COLSPAN}">{L_NO_ICONS}</td> </tr> @@ -174,7 +182,7 @@ <fieldset> <legend>{L_IMPORT}</legend> - + <!-- IF not S_PAK_OPTIONS --> <p>{L_NO_PAK_OPTIONS}</p> @@ -259,7 +267,7 @@ </table> <div class="pagination"> <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> + <!-- INCLUDE pagination.html --> <!-- ENDIF --> </div> <p class="quick"> diff --git a/phpBB/adm/style/acp_inactive.html b/phpBB/adm/style/acp_inactive.html index 1cdc1abe6b..2aa3051f53 100644 --- a/phpBB/adm/style/acp_inactive.html +++ b/phpBB/adm/style/acp_inactive.html @@ -2,14 +2,12 @@ <a id="maincontent"></a> -<h2>{L_INACTIVE_USERS}</h2> +<h1>{L_INACTIVE_USERS}</h1> <p>{L_INACTIVE_USERS_EXPLAIN}</p> <form id="inactive" method="post" action="{U_ACTION}"> -<div class="clearfix"></div> - <!-- IF .pagination --> <div class="pagination"> <!-- INCLUDE pagination.html --> @@ -20,6 +18,7 @@ <thead> <tr> <th>{L_USERNAME}</th> + <th>{L_EMAIL}</th> <th>{L_JOINED}</th> <th>{L_INACTIVE_DATE}</th> <th>{L_LAST_VISIT}</th> @@ -34,6 +33,7 @@ {inactive.USERNAME_FULL} <!-- IF inactive.POSTS --><br />{L_POSTS}{L_COLON} <strong>{inactive.POSTS}</strong> [<a href="{inactive.U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a>]<!-- ENDIF --> </td> + <td style="vertical-align: top;">{inactive.USER_EMAIL}</td> <td style="vertical-align: top;">{inactive.JOINED}</td> <td style="vertical-align: top;">{inactive.INACTIVE_DATE}</td> <td style="vertical-align: top;">{inactive.LAST_VISIT}</td> diff --git a/phpBB/adm/style/acp_jabber.html b/phpBB/adm/style/acp_jabber.html index 4d0b1b0d97..9246987f1f 100644 --- a/phpBB/adm/style/acp_jabber.html +++ b/phpBB/adm/style/acp_jabber.html @@ -39,7 +39,7 @@ </dl> <dl> <dt><label for="jab_password">{L_JAB_PASSWORD}{L_COLON}</label><br /><span>{L_JAB_PASSWORD_EXPLAIN}</span></dt> - <dd><input type="password" id="jab_password" name="jab_password" value="{JAB_PASSWORD}" /></dd> + <dd><input type="password" id="jab_password" name="jab_password" value="{JAB_PASSWORD}" autocomplete="off" /></dd> </dl> <!-- IF S_CAN_USE_SSL --> <dl> diff --git a/phpBB/adm/style/acp_language.html b/phpBB/adm/style/acp_language.html index d32f6b7eac..f708eb1508 100644 --- a/phpBB/adm/style/acp_language.html +++ b/phpBB/adm/style/acp_language.html @@ -2,29 +2,7 @@ <a id="maincontent"></a> -<!-- IF S_SELECT_METHOD --> - - <a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a> - - <h1>{L_SELECT_DOWNLOAD_FORMAT}</h1> - - <form id="selectmethod" method="post" action="{U_ACTION}"> - - <fieldset> - <legend>{L_DOWNLOAD_AS}</legend> - <dl> - <dt><label for="use_method">{L_DOWNLOAD_AS}{L_COLON}</label></dt> - <dd>{RADIO_BUTTONS}</dd> - </dl> - - <p class="quick"> - <input type="submit" class="button2" value="{L_DOWNLOAD}" name="download" /> - </p> - </fieldset> - - </form> - -<!-- ELSEIF S_DETAILS --> +<!-- IF S_DETAILS --> <a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a> @@ -58,159 +36,42 @@ </fieldset> </form> - <br /><br /> - - <!-- IF S_MISSING_FILES --> - <div class="errorbox"> - <h3>{L_MISSING_FILES}</h3> - <p>{MISSING_FILES}</p> - </div> - <br /><br /> - <!-- ENDIF --> + <!-- IF .missing_files --> + <h3 class="error">{L_MISSING_FILES}</h3> - <!-- IF S_MISSING_VARS --> - <h1>{L_MISSING_LANG_VARIABLES}</h1> - - <p>{L_MISSING_VARS_EXPLAIN}</p> - - <form id="missing" method="post" action="{U_MISSING_ACTION}"> - - <table class="table1"> - <thead> - <tr> - <th>{L_LANGUAGE_KEY}</th> - <th>{L_LANGUAGE_VARIABLE}</th> - </tr> - </thead> - <tbody> - <!-- BEGIN missing --> - <tr class="row4"> - <td><strong>{missing.FILE}</strong></td> - <td style="text-align: right;"><input type="submit" name="missing_file[{missing.KEY}]" value="{L_SELECT}" class="button2" /></td> - </tr> - {missing.TPL} - <!-- END missing --> - </tbody> - </table> - <div>{S_FORM_TOKEN}</div> - </form> - - <br /><br /> - <!-- ENDIF --> - - <a id="entries"></a> - - <h1>{L_LANGUAGE_ENTRIES}</h1> - - <p>{L_LANGUAGE_ENTRIES_EXPLAIN}</p> - - <form id="lang_entries" method="post" action="{U_ENTRY_ACTION}"> - - <!-- IF S_FROM_STORE --> - <fieldset class="quick" style="float: {S_CONTENT_FLOW_BEGIN};"> - <input type="submit" name="remove_store" value="{L_REMOVE_FROM_STORAGE_FOLDER}" class="button2" /> + <fieldset> + <legend>{L_MISSING_LANG_FILES}</legend> + <!-- BEGIN missing_files --> + » {missing_files.FILE_NAME}<br /> + <!-- END missing_files --> </fieldset> <!-- ENDIF --> - <fieldset class="quick" style="float: {S_CONTENT_FLOW_END};"> - <select name="language_file">{S_LANG_OPTIONS}</select> <input type="submit" class="button2" name="change" value="{L_SELECT}" /> - </fieldset> - - <p> <br /> </p> - - - <!--[if lt IE 8]> - <style type="text/css"> - /* <![CDATA[ */ - input.langvalue, textarea.langvalue { - width: 450px; - } - /* ]]> */ - </style> - <![endif]--> - - <table class="table1"> - <thead> - <!-- IF S_EMAIL_FILE --> - <tr> - <th colspan="2">{L_FILE_CONTENTS}</th> - </tr> - <!-- ELSE --> - <tr> - <th>{L_LANGUAGE_KEY}</th> - <th>{L_LANGUAGE_VARIABLE}</th> - </tr> - <!-- ENDIF --> - <tr> - <td rowspan="2" class="row3"><strong>{PRINT_MESSAGE}<!-- IF S_FROM_STORE --><br /><span style="color: red;">{L_FILE_FROM_STORAGE}</span><!-- ENDIF --></strong></td> - <td class="row3" style="text-align: right;"><input type="submit" name="download_file" class="button2" value="{L_SUBMIT_AND_DOWNLOAD}" /> <input type="submit" name="submit_file" class="button2" value="{L_SUBMIT}" /></td> - </tr> - <tr> - <td class="row3" style="text-align: right;"> - <!-- IF ALLOW_UPLOAD --> {L_UPLOAD_METHOD}{L_COLON} <!-- BEGIN buttons --><input type="radio" class="radio"<!-- IF buttons.S_FIRST_ROW --> id="method" checked="checked"<!-- ENDIF --> value="{buttons.VALUE}" name="method" /> {buttons.VALUE} <!-- END buttons --><input type="submit" name="upload_file" class="button2" value="{L_SUBMIT_AND_UPLOAD}" /><!-- ENDIF --></td> - </tr> - </thead> - <tbody> - <!-- IF S_EMAIL_FILE --> - <tr> - <td class="row2" colspan="2" style="text-align: center;"><textarea name="entry" id="entry" cols="80" rows="20">{LANG}</textarea></td> - </tr> - <!-- ELSE --> - {TPL} - <!-- ENDIF --> - <tr> - <td class="row3" colspan="3" style="text-align: right;">{S_FORM_TOKEN}<input type="submit" name="download_file" class="button2" value="{L_SUBMIT_AND_DOWNLOAD}" /> <input type="submit" name="submit_file" class="button2" value="{L_SUBMIT}" /></td> - </tr> - </tbody> - </table> - </form> - -<!-- ELSEIF S_UPLOAD --> - - <a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a> - - <h1>{L_UPLOAD_SETTINGS}</h1> - - <form id="upload" method="post" action="{U_ACTION}"> - - <!-- IF S_CONNECTION_SUCCESS --> - <div class="successbox"> - <p>{L_CONNECTION_SUCCESS}</p> - </div> - <!-- ELSEIF S_CONNECTION_FAILED --> - <div class="errorbox"> - <p>{L_CONNECTION_FAILED}</p> - </div> + <!-- IF .missing_varfile --> + <h3 class="error">{L_MISSING_VARS_EXPLAIN}</h3> + + <fieldset> + <legend>{L_MISSING_LANG_VARIABLES}</legend> + <!-- BEGIN missing_varfile --> + <dl> + <dt><label>{missing_varfile.FILE_NAME}</label></dt> + <!-- BEGIN variable --> + <dd>{missing_varfile.variable.VAR_NAME}</dd> + <!-- END variable --> + </dl> + <!-- END missing_varfile --> + </fieldset> <!-- ENDIF --> - - <fieldset> - <legend>{L_UPLOAD_SETTINGS}</legend> - <dl> - <dt><label>{L_UPLOAD_METHOD}{L_COLON}</label></dt> - <dd><strong>{NAME}</strong></dd> - </dl> - <!-- BEGIN data --> - <dl> - <dt><label for="{data.DATA}">{data.NAME}{L_COLON}</label><br /><span>{data.EXPLAIN}</span></dt> - <dd><input type="<!-- IF data.DATA == 'password' -->password<!-- ELSE -->text<!-- ENDIF -->" id="{data.DATA}" name="{data.DATA}" value="{data.DEFAULT}" /></dd> - </dl> - <!-- END data --> - </fieldset> - - <fieldset class="quick"> - {HIDDEN} - {S_FORM_TOKEN} - <input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> - <input class="button1" type="submit" name="test_connection" value="{L_TEST_CONNECTION}" /> - </fieldset> - </form> - <!-- ELSE --> <h1>{L_ACP_LANGUAGE_PACKS}</h1> <p>{L_ACP_LANGUAGE_PACKS_EXPLAIN}</p> + <fieldset class="quick"> + <span class="small"><a href="https://www.phpbb.com/go/customise/language-packs/3.1" target="_blank">{L_BROWSE_LANGUAGE_PACKS_DATABASE}</a></span> + </fieldset> + <table class="table1 zebra-table"> <thead> <tr> @@ -231,7 +92,7 @@ <td>{lang.LOCAL_NAME}</td> <td style="text-align: center;"><strong>{lang.ISO}</strong></td> <td style="text-align: center;">{lang.USED_BY}</td> - <td style="text-align: center;"> <a href="{lang.U_DOWNLOAD}">{L_DOWNLOAD}</a> | <a href="{lang.U_DELETE}">{L_DELETE}</a></td> + <td style="text-align: center;"><a href="{lang.U_DELETE}">{L_DELETE}</a></td> </tr> <!-- END lang --> <!-- IF .notinst --> diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index 592b5bbc16..cb15a8f51d 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -8,29 +8,26 @@ <form id="list" method="post" action="{U_ACTION}"> -<fieldset class="display-options" style="float: left"> +<fieldset class="display-options search-box"> {L_SEARCH_KEYWORDS}{L_COLON} <input type="text" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="button2" name="filter" value="{L_SEARCH}" /> </fieldset> <!-- IF .pagination --> -<div class="pagination" style="float: right; margin: 15px 0 2px 0"> +<div class="pagination top-pagination"> <!-- INCLUDE pagination.html --> </div> <!-- ENDIF --> -<div class="clearfix"> </div> -<div><br style="clear: both;" /></div> - <!-- IF .log --> - <table class="table1 zebra-table"> + <table class="table1 zebra-table fixed-width-table"> <thead> <tr> - <th>{L_USERNAME}</th> - <th>{L_IP}</th> - <th>{L_TIME}</th> + <th style="width: 15%;">{L_USERNAME}</th> + <th style="width: 15%;">{L_IP}</th> + <th style="width: 20%;">{L_TIME}</th> <th>{L_ACTION}</th> <!-- IF S_CLEARLOGS --> - <th>{L_MARK}</th> + <th style="width: 50px;">{L_MARK}</th> <!-- ENDIF --> </tr> </thead> @@ -76,7 +73,7 @@ <!-- IF S_SHOW_FORUMS --> <fieldset class="quick"> {L_SELECT_FORUM}{L_COLON} <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit(); }">{S_FORUM_BOX}</select> - <input class="button2" type="submit" value="{L_GO}" /> + <!-- EVENT acp_logs_quick_select_forum_button_prepend --><input class="button2" type="submit" value="{L_GO}" /><!-- EVENT acp_logs_quick_select_forum_button_append --> </fieldset> <!-- ENDIF --> diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 6e28c7a0cc..4af3f1a62c 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -17,6 +17,7 @@ <!-- IF S_VERSIONCHECK_FAIL --> <div class="errorbox notice"> <p>{L_VERSIONCHECK_FAIL}</p> + <p>{VERSIONCHECK_FAIL_REASON}</p> <p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> · <a href="{U_VERSIONCHECK}">{L_MORE_INFORMATION}</a></p> </div> <!-- ELSEIF not S_VERSION_UP_TO_DATE --> @@ -140,19 +141,24 @@ <td>{L_GZIP_COMPRESSION}{L_COLON} </td> <td><strong>{GZIP_COMPRESSION}</strong></td> </tr> + <!-- IF S_TOTAL_ORPHAN or S_VERSIONCHECK --> <tr> + <!-- IF S_VERSIONCHECK --> <td>{L_BOARD_VERSION}{L_COLON} </td> <td> - <strong><a href="{U_VERSIONCHECK}" <!-- IF S_VERSION_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF --> title="{L_MORE_INFORMATION}">{BOARD_VERSION}</a></strong> [ <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> ] + <strong><a href="{U_VERSIONCHECK}" <!-- IF S_VERSION_UP_TO_DATE -->style="color: #228822;" <!-- ELSEIF not S_VERSIONCHECK_FAIL -->style="color: #BC2A4D;" <!-- ENDIF -->title="{L_MORE_INFORMATION}">{BOARD_VERSION}</a></strong> [ <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> ] </td> + <!-- ENDIF --> <!-- IF S_TOTAL_ORPHAN --> <td>{L_NUMBER_ORPHAN}{L_COLON} </td> <td><strong>{TOTAL_ORPHAN}</strong></td> - <!-- ELSE --> + <!-- ENDIF --> + <!-- IF not S_TOTAL_ORPHAN or not S_VERSIONCHECK --> <td> </td> <td> </td> <!-- ENDIF --> </tr> + <!-- ENDIF --> </tbody> </table> @@ -242,9 +248,6 @@ <!-- END log --> </tbody> </table> - - <br /> - <!-- ENDIF --> <!-- IF S_INACTIVE_USERS --> @@ -286,7 +289,6 @@ <!-- END inactive --> </tbody> </table> - <!-- ENDIF --> <!-- ENDIF --> diff --git a/phpBB/adm/style/acp_modules.html b/phpBB/adm/style/acp_modules.html index c7688a610c..3c97706e6a 100644 --- a/phpBB/adm/style/acp_modules.html +++ b/phpBB/adm/style/acp_modules.html @@ -10,11 +10,11 @@ { if (value == 'category') { - dE('modoptions', -1); + phpbb.toggleDisplay('modoptions', -1); } else { - dE('modoptions', 1); + phpbb.toggleDisplay('modoptions', 1); } } diff --git a/phpBB/adm/style/acp_permissions.html b/phpBB/adm/style/acp_permissions.html index 6dc9dca2e7..7766052c59 100644 --- a/phpBB/adm/style/acp_permissions.html +++ b/phpBB/adm/style/acp_permissions.html @@ -30,7 +30,7 @@ <legend>{L_LOOK_UP_FORUM}</legend> <!-- IF S_FORUM_MULTIPLE --><p>{L_LOOK_UP_FORUMS_EXPLAIN}</p><!-- ENDIF --> <dl> - <dt><label for="forum">{L_LOOK_UP_FORUM}{L_COLON}</label></dt> + <dt><!-- EVENT acp_permissions_select_multiple_forum_prepend --><label for="forum">{L_LOOK_UP_FORUM}{L_COLON}</label><!-- EVENT acp_permissions_select_multiple_forum_append --></dt> <dd><select id="forum" name="forum_id[]"<!-- IF S_FORUM_MULTIPLE --> multiple="multiple"<!-- ENDIF --> size="10">{S_FORUM_OPTIONS}</select></dd> <!-- IF S_FORUM_ALL --><dd><label><input type="checkbox" class="radio" name="all_forums" value="1" /> {L_ALL_FORUMS}</label></dd><!-- ENDIF --> </dl> @@ -52,7 +52,7 @@ <legend>{L_LOOK_UP_FORUM}</legend> <p>{L_SELECT_FORUM_SUBFORUM_EXPLAIN}</p> <dl> - <dt><label for="sforum">{L_LOOK_UP_FORUM}{L_COLON}</label></dt> + <dt><!-- EVENT acp_permissions_select_forum_prepend --><label for="sforum">{L_LOOK_UP_FORUM}{L_COLON}</label><!-- EVENT acp_permissions_select_forum_append --></dt> <dd><select id="sforum" name="subforum_id">{S_SUBFORUM_OPTIONS}</select></dd> </dl> @@ -95,7 +95,7 @@ <fieldset> <legend>{L_LOOK_UP_GROUP}</legend> <dl> - <dt><label for="group">{L_LOOK_UP_GROUP}{L_COLON}</label></dt> + <dt><!-- EVENT acp_permissions_select_group_prepend --><label for="group">{L_LOOK_UP_GROUP}{L_COLON}</label><!-- EVENT acp_permissions_select_group_append --></dt> <dd><select name="group_id[]" id="group">{S_GROUP_OPTIONS}</select></dd> </dl> @@ -140,7 +140,7 @@ <p>{L_USERNAMES_EXPLAIN}</p> <dl> <dd class="full"><textarea id="username" name="usernames" rows="5" cols="5" style="width: 100%; height: 60px;"></textarea></dd> - <dd class="full" style="text-align: left;"><div style="float: {S_CONTENT_FLOW_END};">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</div><label><input type="checkbox" class="radio" id="anonymous" name="user_id[]" value="{ANONYMOUS_USER_ID}" /> {L_SELECT_ANONYMOUS}</label></dd> + <dd class="full" style="text-align: left;"><!-- EVENT acp_permissions_find_username_prepend --><div style="float: {S_CONTENT_FLOW_END};">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</div><!-- EVENT acp_permissions_find_username_append --><label><input type="checkbox" class="radio" id="anonymous" name="user_id[]" value="{ANONYMOUS_USER_ID}" /> {L_SELECT_ANONYMOUS}</label></dd> </dl> </fieldset> @@ -183,7 +183,7 @@ <fieldset> <legend>{L_ADD_GROUPS}</legend> <dl> - <dd class="full"><select name="group_id[]" style="width: 100%; height: 107px;" multiple="multiple">{S_ADD_GROUP_OPTIONS}</select></dd> + <dd class="full"><!-- EVENT acp_permissions_add_group_options_prepend --><select name="group_id[]" style="width: 100%; height: 107px;" multiple="multiple">{S_ADD_GROUP_OPTIONS}</select><!-- EVENT acp_permissions_add_group_options_append --></dd> </dl> </fieldset> @@ -267,7 +267,9 @@ <legend>{L_LOOK_UP_GROUP}</legend> <dl> <dt><label for="group_select">{L_LOOK_UP_GROUP}{L_COLON}</label></dt> + <!-- EVENT acp_permissions_select_group_before --> <dd><select name="group_id[]" id="group_select">{S_ADD_GROUP_OPTIONS}</select></dd> + <!-- EVENT acp_permissions_select_group_after --> <dd> </dd> </dl> </fieldset> @@ -327,14 +329,9 @@ <br class="responsive-hide" /><br class="responsive-hide" /> <!-- include tooltip file --> - <script type="text/javascript" src="style/tooltip.js"></script> - <script type="text/javascript"> - // <![CDATA[ - window.onload = function(){enable_tooltips_select('set-permissions', '{LA_ROLE_DESCRIPTION}', 'role')}; - // ]]> - </script> - - <form id="set-permissions" method="post" action="{U_ACTION}"> + <!-- INCLUDEJS tooltip.js --> + + <form id="set-permissions" method="post" action="{U_ACTION}" data-role-description="{L_ROLE_DESCRIPTION}"> {S_HIDDEN_FIELDS} diff --git a/phpBB/adm/style/acp_posting_buttons.html b/phpBB/adm/style/acp_posting_buttons.html new file mode 100644 index 0000000000..70b6259689 --- /dev/null +++ b/phpBB/adm/style/acp_posting_buttons.html @@ -0,0 +1,70 @@ +<script type="text/javascript"> +// <![CDATA[ + + // Define the bbCode tags + var bbcode = new Array(); + var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[flash=]', '[/flash]','[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->); + + // Helpline messages + var help_line = { + b: '{LA_BBCODE_B_HELP}', + i: '{LA_BBCODE_I_HELP}', + u: '{LA_BBCODE_U_HELP}', + q: '{LA_BBCODE_Q_HELP}', + c: '{LA_BBCODE_C_HELP}', + l: '{LA_BBCODE_L_HELP}', + o: '{LA_BBCODE_O_HELP}', + p: '{LA_BBCODE_P_HELP}', + w: '{LA_BBCODE_W_HELP}', + a: '{LA_BBCODE_A_HELP}', + s: '{LA_BBCODE_S_HELP}', + f: '{LA_BBCODE_F_HELP}', + y: '{LA_BBCODE_Y_HELP}', + d: '{LA_BBCODE_D_HELP}' + <!-- BEGIN custom_tags --> + ,cb_{custom_tags.BBCODE_ID}{L_COLON} '{custom_tags.A_BBCODE_HELPLINE}' + <!-- END custom_tags --> + } + +// ]]> +</script> + +<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js --> + +<!-- EVENT acp_posting_buttons_before --> +<div id="format-buttons"> + <input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}" /> + <input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}" /> + <input type="button" class="button2" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" title="{L_BBCODE_U_HELP}" /> + <!-- IF S_BBCODE_QUOTE --> + <input type="button" class="button2" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" title="{L_BBCODE_Q_HELP}" /> + <!-- ENDIF --> + <input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" title="{L_BBCODE_C_HELP}" /> + <input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" title="{L_BBCODE_L_HELP}" /> + <input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" title="{L_BBCODE_O_HELP}" /> + <input type="button" class="button2" accesskey="y" name="addlistitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" title="{L_BBCODE_LISTITEM_HELP}" /> + <!-- IF S_BBCODE_IMG --> + <input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}" /> + <!-- ENDIF --> + <!-- IF S_LINKS_ALLOWED --> + <input type="button" class="button2" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" title="{L_BBCODE_W_HELP}" /> + <!-- ENDIF --> + <!-- IF S_BBCODE_FLASH --> + <input type="button" class="button2" accesskey="d" name="addbbcode18" value="Flash" onclick="bbstyle(18)" title="{L_BBCODE_D_HELP}" /> + <!-- ENDIF --> + <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" title="{L_BBCODE_F_HELP}"> + <option value="50">{L_FONT_TINY}</option> + <option value="85">{L_FONT_SMALL}</option> + <option value="100" selected="selected">{L_FONT_NORMAL}</option> + <!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 150 --> + <option value="150">{L_FONT_LARGE}</option> + <!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 200 --> + <option value="200">{L_FONT_HUGE}</option> + <!-- ENDIF --> + <!-- ENDIF --> + </select> + <!-- BEGIN custom_tags --> + <input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" /> + <!-- END custom_tags --> +</div> +<!-- EVENT acp_posting_buttons_after --> diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 04e6d9f12b..07718846cc 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -17,7 +17,7 @@ </div> <!-- ENDIF --> - <form id="add_profile_field" method="post" action="{U_ACTION}"> + <form id="add_profile_field" method="post" action="{U_ACTION}"{S_FORM_ENCTYPE}> <!-- IF S_STEP_ONE --> @@ -79,6 +79,13 @@ <dt><label for="field_hide">{L_HIDE_PROFILE_FIELD}{L_COLON}</label><br /><span>{L_HIDE_PROFILE_FIELD_EXPLAIN}</span></dt> <dd><input type="checkbox" class="radio" id="field_hide" name="field_hide" value="1"<!-- IF S_FIELD_HIDE --> checked="checked"<!-- ENDIF --> /></dd> </dl> + <!-- EVENT acp_profile_contact_before --> + <dl> + <dt><label for="field_is_contact">{L_FIELD_IS_CONTACT}{L_COLON}</label><br /><span>{L_FIELD_IS_CONTACT_EXPLAIN}</span></dt> + <dd><input type="checkbox" class="radio" id="field_is_contact" name="field_is_contact" value="1"<!-- IF S_FIELD_CONTACT --> checked="checked"<!-- ENDIF --> /></dd> + <dd><input class="text medium" type="text" name="field_contact_desc" id="field_contact_desc" value="{FIELD_CONTACT_DESC}" /> <label for="field_contact_desc">{L_FIELD_CONTACT_DESC}</label></dd> + <dd><input class="text medium" type="text" name="field_contact_url" id="field_contact_url" value="{FIELD_CONTACT_URL}" /> <label for="field_contact_url">{L_FIELD_CONTACT_URL}</label></dd> + </dl> </fieldset> <!-- IF S_EDIT_MODE --> diff --git a/phpBB/adm/style/acp_prune_forums.html b/phpBB/adm/style/acp_prune_forums.html index 4d748f1cce..b8c681ea00 100644 --- a/phpBB/adm/style/acp_prune_forums.html +++ b/phpBB/adm/style/acp_prune_forums.html @@ -43,7 +43,7 @@ <legend>{L_SELECT_FORUM}</legend> <p>{L_LOOK_UP_FORUMS_EXPLAIN}</p> <dl> - <dt><label for="forum">{L_LOOK_UP_FORUM}{L_COLON}</label></dt> + <dt><!-- EVENT acp_prune_forums_prepend --><label for="forum">{L_LOOK_UP_FORUM}{L_COLON}</label><!-- EVENT acp_prune_forums_append --></dt> <dd><select id="forum" name="f[]" multiple="multiple" size="10">{S_FORUM_OPTIONS}</select></dd> <dd><label><input type="checkbox" class="radio" name="all_forums" value="1" /> {L_ALL_FORUMS}</label></dd> </dl> diff --git a/phpBB/adm/style/acp_prune_users.html b/phpBB/adm/style/acp_prune_users.html index 2bbb03a834..6e8b2e4214 100644 --- a/phpBB/adm/style/acp_prune_users.html +++ b/phpBB/adm/style/acp_prune_users.html @@ -19,11 +19,7 @@ <dd><input type="text" id="email" name="email" /></dd> </dl> <dl> - <dt><label for="email">{L_WEBSITE}{L_COLON}</label></dt> - <dd><input type="text" id="website" name="website" /></dd> -</dl> -<dl> - <dt><label for="joined">{L_JOINED}{L_COLON}</label><br /><span>{L_JOINED_EXPLAIN}</span></dt> + <dt><label for="joined_after">{L_JOINED}{L_COLON}</label><br /><span>{L_JOINED_EXPLAIN}</span></dt> <dd> <strong>{L_AFTER}</strong> <input type="text" id="joined_after" name="joined_after" /> <br /> <br /> <strong>{L_BEFORE}</strong> <input type="text" id="joined_before" name="joined_before" /> @@ -44,7 +40,7 @@ <!-- IF S_GROUP_LIST --> <dl> <dt><label for="group_id">{L_GROUP}{L_COLON}</label><br /><span>{L_PRUNE_USERS_GROUP_EXPLAIN}</span></dt> - <dd><select name="group_id">{S_GROUP_LIST}</select></dd> + <dd><select id="group_id" name="group_id">{S_GROUP_LIST}</select></dd> </dl> <!-- ENDIF --> </fieldset> @@ -54,7 +50,7 @@ <dl> <dt><label for="users">{L_ACP_PRUNE_USERS}{L_COLON}</label><br /><span>{L_SELECT_USERS_EXPLAIN}</span></dt> <dd><textarea id="users" name="users" cols="40" rows="5"></textarea></dd> - <dd>[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</dd> + <dd><!-- EVENT acp_prune_users_find_username_prepend -->[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]<!-- EVENT acp_prune_users_find_username_append --></dd> </dl> </fieldset> diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index be68dda695..fa06513b98 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -24,6 +24,9 @@ <fieldset> <legend>{L_ACP_RANKS}</legend> + + <!-- EVENT acp_ranks_edit_before --> + <dl> <dt><label for="title">{L_RANK_TITLE}{L_COLON}</label></dt> <dd><input name="title" type="text" id="title" value="{RANK_TITLE}" maxlength="255" /></dd> @@ -35,16 +38,18 @@ </dl> <dl> <dt><label for="special_rank">{L_RANK_SPECIAL}{L_COLON}</label></dt> - <dd><label><input onclick="dE('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> - <label><input onclick="dE('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> + <dd><label><input onclick="phpbb.toggleDisplay('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> + <label><input onclick="phpbb.toggleDisplay('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> </dl> - <!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF --> + <div id="posts"<!-- IF S_SPECIAL_RANK --> style="display: none;"<!-- ENDIF -->> <dl> <dt><label for="min_posts">{L_RANK_MINIMUM}{L_COLON}</label></dt> <dd><input name="min_posts" type="number" id="min_posts" maxlength="10" value="{MIN_POSTS}" /></dd> </dl> </div> + <!-- EVENT acp_ranks_edit_after --> + <p class="submit-buttons"> <input type="hidden" name="action" value="save" /> @@ -68,18 +73,22 @@ <table class="table1 zebra-table"> <thead> <tr> + <!-- EVENT acp_ranks_list_header_before --> <th>{L_RANK_IMAGE}</th> <th>{L_RANK_TITLE}</th> <th>{L_RANK_MINIMUM}</th> + <!-- EVENT acp_ranks_list_header_after --> <th>{L_ACTION}</th> </tr> </thead> <tbody> <!-- BEGIN ranks --> <tr> + <!-- EVENT acp_ranks_list_column_before --> <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;"><!-- IF ranks.S_SPECIAL_RANK --> - <!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td> + <!-- EVENT acp_ranks_list_column_after --> <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> <!-- END ranks --> diff --git a/phpBB/adm/style/acp_search.html b/phpBB/adm/style/acp_search.html index 496a8b2675..1cde52acf3 100644 --- a/phpBB/adm/style/acp_search.html +++ b/phpBB/adm/style/acp_search.html @@ -46,13 +46,13 @@ <legend>{L_SEARCH_TYPE}</legend> <dl> <dt><label for="search_type">{L_SEARCH_TYPE}{L_COLON}</label><br /><span>{L_SEARCH_TYPE_EXPLAIN}</span></dt> - <dd><select id="search_type" name="config[search_type]">{S_SEARCH_TYPES}</select></dd> + <dd><select id="search_type" name="config[search_type]" data-togglable-settings="true">{S_SEARCH_TYPES}</select></dd> </dl> </fieldset> <!-- BEGIN backend --> - <fieldset> + <fieldset id="search_{backend.IDENTIFIER}_settings"> <legend>{backend.NAME}</legend> {backend.SETTINGS} </fieldset> diff --git a/phpBB/adm/style/acp_send_statistics.html b/phpBB/adm/style/acp_send_statistics.html index 2d6c4837fd..480e438e1f 100644 --- a/phpBB/adm/style/acp_send_statistics.html +++ b/phpBB/adm/style/acp_send_statistics.html @@ -17,8 +17,8 @@ function iframe_updated() return; } - dE('questionnaire-form', -1); - dE('questionnaire-thanks', 1); + phpbb.toggleDisplay('questionnaire-form', -1); + phpbb.toggleDisplay('questionnaire-thanks', 1); } //]]> </script> @@ -31,10 +31,10 @@ function iframe_updated() <p>{L_EXPLAIN_SHOW_STATISTICS}</p> - <p id="show-button"><input type="button" class="button2" onclick="dE('configlist', 1); dE('show-button', -1);" value="{L_SHOW_STATISTICS}" /></p> + <p id="show-button"><input type="button" class="button2" onclick="phpbb.toggleDisplay('configlist', 1); phpbb.toggleDisplay('show-button', -1);" value="{L_SHOW_STATISTICS}" /></p> <div id="configlist"> - <input type="button" class="button2" onclick="dE('show-button', 1); dE('configlist', -1);" value="{L_HIDE_STATISTICS}" /> + <input type="button" class="button2" onclick="phpbb.toggleDisplay('show-button', 1); phpbb.toggleDisplay('configlist', -1);" value="{L_HIDE_STATISTICS}" /> <p class="submit-buttons"> <input class="button1" type="submit" id="submit" name="submit" value="{L_SEND_STATISTICS}" /> </p> @@ -61,11 +61,4 @@ function iframe_updated() <p><strong>{L_THANKS_SEND_STATISTICS}</strong><br /><br /><a href="{U_ACP_MAIN}">« {L_GO_ACP_MAIN}</a></p> </div> -<script type="text/javascript"> -//<![CDATA[ - dE('configlist', -1); - dE('questionnaire-thanks', -1); -//]]> -</script> - <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index b5c691b36b..a36d15fe73 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -2,6 +2,10 @@ <a id="maincontent"></a> +<!-- IF S_STYLE_DETAILS --> + <a href="{U_ACTION}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a> +<!-- ENDIF --> + <!-- IF S_CONFIRM_ACTION --> <form id="confirm" method="post" action="{S_CONFIRM_ACTION}"> @@ -15,12 +19,12 @@ {S_HIDDEN_FIELDS} <div style="text-align: center;"> - <input type="submit" name="confirm" value="{L_YES}" class="button2" /> + <input type="submit" name="confirm" value="{L_YES}" class="button2" /> <input type="submit" name="cancel" value="{L_NO}" class="button2" /> </div> </fieldset> - + </form> <!-- ELSE --> @@ -28,6 +32,10 @@ <!-- IF L_EXPLAIN --><p>{L_EXPLAIN}</p><!-- ENDIF --> +<fieldset class="quick"> + <span class="small"><a href="https://www.phpbb.com/go/customise/styles/3.1" target="_blank">{L_BROWSE_STYLES_DATABASE}</a></span> +</fieldset> + <form id="acp_styles" method="post" action="{U_ACTION}"> {S_HIDDEN_FIELDS} {S_FORM_TOKEN} @@ -40,7 +48,7 @@ <dd><input type="text" id="name" name="style_name" value="{STYLE_NAME}" /></dd> </dl> <dl> - <dt><label>{L_STYLE_PATH}</label></dt> + <dt><label>{L_STYLE_PATH}{L_COLON}</label></dt> <dd><strong>{STYLE_PATH}</strong></dd> </dl> <dl> @@ -72,13 +80,14 @@ <fieldset class="submit-buttons"> <legend>{L_SUBMIT}</legend> - <input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> - <a href="{U_ACTION}" class="button2">{L_BACK}</a> + <input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> + <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" /> {S_FORM_TOKEN} </fieldset> <!-- ENDIF --> <!-- IF .styles_list --> + <!-- EVENT acp_styles_list_before --> <table class="table1 styles"> <thead> <tr> @@ -91,7 +100,7 @@ </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 -->> + <tr class="row-highlight<!-- IF styles_list.STYLE_ID and not styles_list.STYLE_ACTIVE --> row-inactive<!-- ENDIF -->"> <!-- IF styles_list.LEVEL is odd --> <!-- IF $ROW_CLASS == 'row1a' --><!-- DEFINE $ROW_CLASS = 'row1b' --><!-- ELSE --><!-- DEFINE $ROW_CLASS = 'row1a' --><!-- ENDIF --> <!-- ELSE --> @@ -113,7 +122,7 @@ <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> + <span class="style-path"><br />{L_STYLE_PATH}{L_COLON} {styles_list.STYLE_PATH_FULL}</span> <!-- ENDIF --> </td> <!-- IF not STYLES_LIST_HIDE_COUNT --> @@ -154,14 +163,6 @@ </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> <!-- ENDIF --> diff --git a/phpBB/adm/style/acp_update.html b/phpBB/adm/style/acp_update.html index 00d37515b3..0cc995959b 100644 --- a/phpBB/adm/style/acp_update.html +++ b/phpBB/adm/style/acp_update.html @@ -1,52 +1,46 @@ <!-- INCLUDE overall_header.html --> <a id="maincontent"></a> - -<!-- IF S_VERSION_CHECK --> - <h1>{L_VERSION_CHECK}</h1> +<h1>{L_VERSION_CHECK}</h1> - <p>{L_VERSION_CHECK_EXPLAIN}</p> +<p>{L_VERSION_CHECK_EXPLAIN}</p> - <!-- IF S_UP_TO_DATE and S_UP_TO_DATE_AUTO --> - <div class="successbox"> - <p>{L_VERSION_UP_TO_DATE_ACP} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> - </div> - <!-- ELSE --> - <div class="errorbox"> - <p>{L_VERSION_NOT_UP_TO_DATE_ACP} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> - </div> - <!-- ENDIF --> - - <!-- IF NEXT_FEATURE_VERSION --> - <div class="errorbox"> - <p>{UPGRADE_INSTRUCTIONS}</p> - </div> - <!-- ENDIF --> +<!-- IF S_UP_TO_DATE --> + <div class="successbox"> + <p>{L_VERSION_UP_TO_DATE_ACP} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> + </div> +<!-- ELSE --> + <div class="errorbox"> + <p>{L_VERSION_NOT_UP_TO_DATE_ACP} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> + </div> +<!-- ENDIF --> - <fieldset> - <legend></legend> +<fieldset> + <legend></legend> <dl> <dt><label>{L_CURRENT_VERSION}</label></dt> - <dd><strong><!-- IF S_UP_TO_DATE and not S_UP_TO_DATE_AUTO -->{AUTO_VERSION}<!-- ELSE -->{CURRENT_VERSION}<!-- ENDIF --></strong></dd> - </dl> - <dl> - <dt><label>{L_LATEST_VERSION}</label></dt> - <dd><strong>{LATEST_VERSION}</strong></dd> + <dd><strong>{CURRENT_VERSION}</strong></dd> </dl> - </fieldset> +</fieldset> - <!-- IF S_UP_TO_DATE and not S_UP_TO_DATE_AUTO --> - {L_UPDATE_INSTRUCTIONS_INCOMPLETE} - <br /><br /> - {UPDATE_INSTRUCTIONS} - <br /><br /> - <!-- ENDIF --> - <!-- IF not S_UP_TO_DATE --> - {UPDATE_INSTRUCTIONS} - <br /><br /> - <!-- ENDIF --> +<!-- BEGIN updates_available --> + <fieldset> + <legend></legend> + <dl> + <dt><label>{L_LATEST_VERSION}</label></dt> + <dd><strong>{updates_available.current}</strong></dd> + </dl> + <dl> + <dt><label>{L_RELEASE_ANNOUNCEMENT}</label></dt> + <dd><strong><a href="{updates_available.announcement}">{updates_available.announcement}</a></strong></dd> + </dl> + </fieldset> +<!-- END updates_available --> +<!-- IF not S_UP_TO_DATE --> + {UPDATE_INSTRUCTIONS} + <br /><br /> <!-- ENDIF --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index b84e32013f..18c3d84f96 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -146,7 +146,9 @@ <!-- IF S_GROUP_OPTIONS --> <fieldset class="quick"> + <!-- EVENT acp_users_select_group_before --> {L_USER_GROUP_ADD}{L_COLON} <select name="g">{S_GROUP_OPTIONS}</select> <input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> + <!-- EVENT acp_users_select_group_after --> {S_FORM_TOKEN} </fieldset> <!-- ENDIF --> @@ -164,14 +166,14 @@ </div> <!-- IF .attach --> - <table class="table1 zebra-table"> + <table class="table1 zebra-table fixed-width-table"> <thead> <tr> <th>{L_FILENAME}</th> - <th>{L_POST_TIME}</th> - <th>{L_FILESIZE}</th> - <th>{L_DOWNLOADS}</th> - <th>{L_MARK}</th> + <th style="width: 20%;">{L_POST_TIME}</th> + <th style="width: 20%;">{L_FILESIZE}</th> + <th style="width: 20%;">{L_DOWNLOADS}</th> + <th style="width: 50px;">{L_MARK}</th> </tr> </thead> <tbody> diff --git a/phpBB/adm/style/acp_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html index 0a72bb0b62..8466985fb3 100644 --- a/phpBB/adm/style/acp_users_avatar.html +++ b/phpBB/adm/style/acp_users_avatar.html @@ -13,10 +13,9 @@ <legend>{L_AVATAR_SELECT}</legend> <dl> <dt><label>{L_AVATAR_TYPE}</label></dt> - <dd><select name="avatar_driver" id="avatar_driver"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> + <dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true"> <!-- BEGIN avatar_drivers --> - <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_drivers.L_TITLE}</option> + <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF --> data-toggle-setting="#avatar_option_{avatar_drivers.DRIVER}">{avatar_drivers.L_TITLE}</option> <!-- END avatar_drivers --> </select></dd> </dl> @@ -35,5 +34,3 @@ {S_FORM_TOKEN} </fieldset> </form> - - <!-- INCLUDEJS avatars.js --> diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 1caa6e5e13..506101c3f7 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -30,7 +30,20 @@ </dl> <dl> <dt><label>{L_POSTS}{L_COLON}</label></dt> - <dd><strong>{USER_POSTS}</strong><!-- IF POSTS_IN_QUEUE and U_MCP_QUEUE --> (<a href="{U_MCP_QUEUE}">{L_POSTS_IN_QUEUE}</a>)<!-- ELSEIF POSTS_IN_QUEUE --> ({L_POSTS_IN_QUEUE})<!-- ENDIF --></dd> + <dd> + <strong> + <!-- IF USER_HAS_POSTS and U_SEARCH_USER --> + <a href="{U_SEARCH_USER}">{USER_POSTS}</a> + <!-- ELSE --> + {USER_POSTS} + <!-- ENDIF --> + </strong> + <!-- IF POSTS_IN_QUEUE and U_MCP_QUEUE --> + (<a href="{U_MCP_QUEUE}">{L_POSTS_IN_QUEUE}</a>) + <!-- ELSEIF POSTS_IN_QUEUE --> + ({L_POSTS_IN_QUEUE}) + <!-- ENDIF --> + </dd> </dl> <dl> <dt><label>{L_WARNINGS}{L_COLON}</label></dt> @@ -73,11 +86,11 @@ { if (option != 'banuser' && option != 'banemail' && option != 'banip') { - dE('reasons', -1); + phpbb.toggleDisplay('reasons', -1); return; } - dE('reasons', 1); + phpbb.toggleDisplay('reasons', 1); element = document.getElementById('user_quick_tools').ban_reason; diff --git a/phpBB/adm/style/acp_users_prefs.html b/phpBB/adm/style/acp_users_prefs.html index 1092b25b04..61904adc23 100644 --- a/phpBB/adm/style/acp_users_prefs.html +++ b/phpBB/adm/style/acp_users_prefs.html @@ -5,9 +5,10 @@ </script> <form id="user_prefs" method="post" action="{U_ACTION}"> - + <!-- EVENT acp_users_prefs_prepend --> <fieldset> <legend>{L_UCP_PREFS_PERSONAL}</legend> + <!-- EVENT acp_users_prefs_personal_prepend --> <dl> <dt><label for="viewemail">{L_SHOW_EMAIL}{L_COLON}</label></dt> <dd><label><input type="radio" class="radio" name="viewemail" value="1"<!-- IF VIEW_EMAIL --> id="viewemail" checked="checked"<!-- ENDIF --> /> {L_YES}</label> @@ -50,13 +51,15 @@ <!-- INCLUDE timezone_option.html --> <dl> <dt><label for="dateoptions">{L_BOARD_DATE_FORMAT}{L_COLON}</label><br /><span>{L_BOARD_DATE_FORMAT_EXPLAIN}</span></dt> - <dd><select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){dE('custom_date',1);}else{dE('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }">{S_DATEFORMAT_OPTIONS}</select></dd> - <dd><div id="custom_date"<!-- IF not S_CUSTOM_DATEFORMAT --> style="display:none;"<!-- ENDIF -->><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" /></div></dd> + <dd><select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){phpbb.toggleDisplay('custom_date',1);}else{phpbb.toggleDisplay('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }">{S_DATEFORMAT_OPTIONS}</select></dd> + <dd><div id="custom_date"<!-- IF not S_CUSTOM_DATEFORMAT --> style="display:none;"<!-- ENDIF -->><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="64" /></div></dd> </dl> + <!-- EVENT acp_users_prefs_personal_append --> </fieldset> <fieldset> <legend>{L_UCP_PREFS_POST}</legend> + <!-- EVENT acp_users_prefs_post_prepend --> <dl> <dt><label for="bbcode">{L_DEFAULT_BBCODE}{L_COLON}</label></dt> <dd><label><input type="radio" class="radio" name="bbcode" value="1"<!-- IF BBCODE --> id="bbcode" checked="checked"<!-- ENDIF --> /> {L_YES}</label> @@ -77,10 +80,12 @@ <dd><label><input type="radio" class="radio" name="notify" value="1"<!-- IF NOTIFY --> id="notify" checked="checked"<!-- ENDIF --> /> {L_YES}</label> <label><input type="radio" class="radio" name="notify" value="0"<!-- IF not NOTIFY --> id="notify" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> </dl> + <!-- EVENT acp_users_prefs_post_append --> </fieldset> <fieldset> <legend>{L_UCP_PREFS_VIEW}</legend> + <!-- EVENT acp_users_prefs_view_prepend --> <dl> <dt><label for="view_images">{L_VIEW_IMAGES}{L_COLON}</label></dt> <dd><label><input type="radio" class="radio" name="view_images" value="1"<!-- IF VIEW_IMAGES --> id="view_images" checked="checked"<!-- ENDIF --> /> {L_YES}</label> @@ -135,8 +140,9 @@ <dt><label>{L_VIEW_POSTS_DIR}{L_COLON}</label></dt> <dd>{S_POST_SORT_DIR}</dd> </dl> + <!-- EVENT acp_users_prefs_view_append --> </fieldset> - + <!-- EVENT acp_users_prefs_append --> <fieldset class="quick"> <input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_users_profile.html b/phpBB/adm/style/acp_users_profile.html index f4a3c06e67..9296638ff6 100644 --- a/phpBB/adm/style/acp_users_profile.html +++ b/phpBB/adm/style/acp_users_profile.html @@ -1,35 +1,17 @@ - <form id="user_profile" method="post" action="{U_ACTION}"> + <form id="user_profile" method="post" action="{U_ACTION}"{S_FORM_ENCTYPE}> <fieldset> <legend>{L_USER_PROFILE}</legend> - <dl> - <dt><label for="icq">{L_UCP_ICQ}{L_COLON}</label></dt> - <dd><input type="text" id="icq" name="icq" value="{ICQ}" /></dd> - </dl> - <dl> - <dt><label for="aim">{L_UCP_AIM}{L_COLON}</label></dt> - <dd><input type="text" id="aim" name="aim" value="{AIM}" /></dd> - </dl> - <dl> - <dt><label for="msn">{L_UCP_MSNM}{L_COLON}</label></dt> - <dd><input type="email" id="msn" name="msn" value="{MSN}" /></dd> - </dl> - <dl> - <dt><label for="yim">{L_UCP_YIM}{L_COLON}</label></dt> - <dd><input type="text" id="yim" name="yim" value="{YIM}" /></dd> - </dl> + <!-- EVENT acp_users_profile_before --> <dl> <dt><label for="jabber">{L_UCP_JABBER}{L_COLON}</label></dt> <dd><input type="email" id="jabber" name="jabber" value="{JABBER}" /></dd> </dl> <dl> - <dt><label for="website">{L_WEBSITE}{L_COLON}</label></dt> - <dd><input type="url" id="website" name="website" value="{WEBSITE}" /></dd> - </dl> - <dl> <dt><label for="birthday">{L_BIRTHDAY}{L_COLON}</label><br /><span>{L_BIRTHDAY_EXPLAIN}</span></dt> <dd>{L_DAY}{L_COLON} <select id="birthday" name="bday_day">{S_BIRTHDAY_DAY_OPTIONS}</select> {L_MONTH}{L_COLON} <select name="bday_month">{S_BIRTHDAY_MONTH_OPTIONS}</select> {L_YEAR}{L_COLON} <select name="bday_year">{S_BIRTHDAY_YEAR_OPTIONS}</select></dd> </dl> + <!-- EVENT acp_users_profile_after --> </fieldset> <!-- IF .profile_fields --> @@ -46,7 +28,7 @@ <!-- END profile_fields --> </fieldset> <!-- ENDIF --> - + <!-- EVENT acp_users_profile_custom_after --> <fieldset class="quick"> <input class="button1" type="submit" name="update" value="{L_SUBMIT}" /> {S_FORM_TOKEN} diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html index 5b5c3ecf7f..c7ec5cc0eb 100644 --- a/phpBB/adm/style/acp_users_signature.html +++ b/phpBB/adm/style/acp_users_signature.html @@ -5,36 +5,10 @@ var text_name = 'signature'; var load_draft = false; var upload = false; - - // Define the bbCode tags - var bbcode = new Array(); - var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[flash=]', '[/flash]','[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->); var imageTag = false; - // Helpline messages - var help_line = { - b: '{LA_BBCODE_B_HELP}', - i: '{LA_BBCODE_I_HELP}', - u: '{LA_BBCODE_U_HELP}', - q: '{LA_BBCODE_Q_HELP}', - c: '{LA_BBCODE_C_HELP}', - l: '{LA_BBCODE_L_HELP}', - o: '{LA_BBCODE_O_HELP}', - p: '{LA_BBCODE_P_HELP}', - w: '{LA_BBCODE_W_HELP}', - a: '{LA_BBCODE_A_HELP}', - s: '{LA_BBCODE_S_HELP}', - f: '{LA_BBCODE_F_HELP}', - y: '{LA_BBCODE_Y_HELP}', - d: '{LA_BBCODE_D_HELP}' - <!-- BEGIN custom_tags --> - ,cb_{custom_tags.BBCODE_ID}{L_COLON} '{custom_tags.A_BBCODE_HELPLINE}' - <!-- END custom_tags --> - } - // ]]> </script> -<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js --> <form id="user_signature" method="post" action="{U_ACTION}"> @@ -49,43 +23,7 @@ <legend>{L_SIGNATURE}</legend> <p>{L_SIGNATURE_EXPLAIN}</p> - <!-- EVENT acp_users_signature_editor_buttons_before --> - <div id="format-buttons"> - <input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}" /> - <input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}" /> - <input type="button" class="button2" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" title="{L_BBCODE_U_HELP}" /> - <!-- IF S_BBCODE_QUOTE --> - <input type="button" class="button2" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" title="{L_BBCODE_Q_HELP}" /> - <!-- ENDIF --> - <input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" title="{L_BBCODE_C_HELP}" /> - <input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" title="{L_BBCODE_L_HELP}" /> - <input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" title="{L_BBCODE_O_HELP}" /> - <input type="button" class="button2" accesskey="y" name="addlistitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" title="{L_BBCODE_LISTITEM_HELP}" /> - <!-- IF S_BBCODE_IMG --> - <input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}" /> - <!-- ENDIF --> - <!-- IF S_LINKS_ALLOWED --> - <input type="button" class="button2" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" title="{L_BBCODE_W_HELP}" /> - <!-- ENDIF --> - <!-- IF S_BBCODE_FLASH --> - <input type="button" class="button2" accesskey="d" name="addbbcode18" value="Flash" onclick="bbstyle(18)" title="{L_BBCODE_D_HELP}" /> - <!-- ENDIF --> - <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" title="{L_BBCODE_F_HELP}"> - <option value="50">{L_FONT_TINY}</option> - <option value="85">{L_FONT_SMALL}</option> - <option value="100" selected="selected">{L_FONT_NORMAL}</option> - <!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 150 --> - <option value="150">{L_FONT_LARGE}</option> - <!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 200 --> - <option value="200">{L_FONT_HUGE}</option> - <!-- ENDIF --> - <!-- ENDIF --> - </select> - <!-- BEGIN custom_tags --> - <input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" /> - <!-- END custom_tags --> - </div> - <!-- EVENT acp_users_signature_editor_buttons_after --> + <!-- INCLUDE acp_posting_buttons.html --> <dl class="responsive-columns"> <dt style="width: 90px;" id="color_palette_placeholder" data-orientation="v" data-height="12" data-width="15" data-bbcode="true"> diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 3c7e378b2b..e38e1cc3d7 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -1,7 +1,10 @@ /* phpBB 3.1 Admin Style Sheet ------------------------------------------------------------------------ Original author: subBlue ( http://www.subblue.com/ ) - Copyright 2007 phpBB Group ( http://www.phpbb.com/ ) + Copyright (c) phpBB Limited <https://www.phpbb.com> + + For full copyright and license information, please see + the docs/CREDITS.txt file. ------------------------------------------------------------------------ */ @@ -14,6 +17,10 @@ font-size: 100%; } +abbr { + text-decoration: none; +} + body, div, p, th, td, li, dd { font-size: x-small; voice-family: "\"}\""; @@ -43,6 +50,10 @@ body { margin: 10px 15px; } +code, samp { + font-size: 1.2em; +} + img { border: 0; } @@ -98,6 +109,18 @@ hr { height: 1px; } +.centered-text { + text-align: center; +} + +.search-box { + float: left; +} + +.rtl .search-box { + float: right; +} + .small { font-size: 0.85em; } @@ -143,6 +166,10 @@ a:active { font-weight: bold; } +a#maincontent, a#acl, a#assigned_to { + display: block; +} + /* List items */ ul, ol { list-style-position: inside; @@ -163,7 +190,6 @@ li { } #page-header { - clear: both; text-align: right; background: url("../images/phpbb_logo.png") top left no-repeat; height: 54px; @@ -192,12 +218,10 @@ li { } #page-body { - clear: both; min-width: 650px; } -#page-footer { - clear: both; +.copyright { font-size: 0.75em; text-align: center; } @@ -306,182 +330,155 @@ li { /* Tabbed menu - Based on: http://www.alistapart.com/articles/slidingdoors2/ ----------------------------------------*/ #tabs { + font-family: Arial, Helvetica, sans-serif; line-height: normal; margin: 0 7px; - min-width: 600px; position: relative; z-index: 2; } -#tabs ul { - margin:0; - padding: 0; +#tabs > ul { list-style: none; -} - -#tabs ul:after { - content: ''; - display: block; - clear: both; -} - -#tabs li { - display: block; - float: left; margin: 0; padding: 0; - font-size: 0.85em; - font-weight: bold; -} - -#tabs li:after { - content: ''; - display: block; - clear: both; } -#tabs a { +#tabs .tab { + display: inline-block; float: left; - background:url("../images/bg_tabs1.gif") no-repeat 0% -34px; - margin: 0 1px 0 0; - padding: 0 0 0 7px; - text-decoration: none; - position: relative; + font-size: 0.85em; + font-weight: bold; + line-height: 14px; } -.rtl #tabs li { +.rtl #tabs .tab { float: right; } -#tabs a span { - float: left; - display: block; - background: url("../images/bg_tabs2.gif") no-repeat 100% -34px; - padding: 7px 10px 4px 4px; - min-height: 14px; +#tabs .tab > a { + background: #D4D6DA; + background: -moz-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #CACBCF), color-stop(100%, #D4D6DA)); + background: -webkit-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -o-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -ms-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: linear-gradient(to bottom, #CACBCF 0%, #D4D6DA 100%); + border: 1px solid #BBB; + border-bottom-width: 0; + border-radius: 5px 5px 0 0; color: #767676; - white-space: nowrap; - font-family: Arial, Helvetica, sans-serif; - text-transform: uppercase; + display: block; font-weight: bold; + margin: 1px 1px 2px 0; + padding: 6px 9px 4px; + position: relative; + text-decoration: none; + text-transform: uppercase; + white-space: nowrap; + cursor: pointer; } -.rtl #tabs a span { - float: right; -} - -/* Commented Backslash Hack hides rule from IE5-Mac \*/ -#tabs a span, .rtl #tabs a span { float:none;} -/* End hack */ - -#tabs a:hover span { +#tabs .tab > a:hover { + background: #F1F1EE; + border-color: #C0BFBB; color: #BC2A4D; } -#tabs a:hover { - background-position: 0 -69px; -} - -#tabs a:hover span { - background-position: 100% -69px; -} - -#tabs .activetab a { - background-position: 0 0; - border-bottom: 1px solid #DCDEE2; -} - -#tabs .activetab a span { - background-position: 100% 0; - padding-bottom: 5px; +#tabs .activetab > a, +#tabs .activetab > a:hover { + background: #DCDEE2; + background: -moz-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #F2F2F2), color-stop(100%, #DCDEE2)); + background: -webkit-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -o-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -ms-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: linear-gradient(to bottom, #F2F2F2 0%, #DCDEE2 100%); + border-color: #999; + border-bottom: 2px solid #DCDEE2; + box-shadow: 0 1px 1px #FFF inset; color: #23649F; + margin: 0 1px 0 0; + padding: 7px 10px 4px; } -#tabs .activetab a:hover span { +#tabs .activetab > a:hover { color: #115098; } +/* Responsive tabs +----------------------------------------*/ .responsive-tab { position: relative; } -.responsive-tab .responsive-tab-link span { - display: inline-block; +.responsive-tab > a.responsive-tab-link { + display: block; font-size: 16px; position: relative; width: 16px; line-height: 14px; text-decoration: none; + padding-left: 9px !important; + padding-right: 9px !important; } -.responsive-tab .responsive-tab-link span:before { +.responsive-tab .responsive-tab-link:before { content: ''; position: absolute; - left: 5px; - top: 8px; + left: 10px; + top: 7px; height: .125em; width: 14px; border-bottom: 0.125em solid #767676; border-top: 0.375em double #767676; } -.responsive-tab .responsive-tab-link:hover span:before { +.responsive-tab .responsive-tab-link:hover:before { border-color: #BC2A4D; } -.responsive-tab.activetab .responsive-tab-link span:before { +.responsive-tab.activetab .responsive-tab-link:before { border-color: #23649F; } -.responsive-tab.activetab .responsive-tab-link:hover span:before { +.responsive-tab.activetab .responsive-tab-link:hover:before { border-color: #115098; } -#tabs .dropdown { - top: 18px; - margin-right: -1px; +#tabs .dropdown, #minitabs .dropdown { + top: 20px; + margin-right: -2px; + font-weight: normal; } #tabs .dropdown-right .dropdown { margin-left: -2px; } -#tabs .dropdown li { - display: block !important; - float: none; - background: transparent none; - padding: 0; +#tabs .dropdown-contents { + list-style: none; + margin: 0; } -#tabs .dropdown a, #tabs .dropdown a span { - background: transparent; - display: block; - border-width: 0; - float: none; - margin: 0; - padding: 0; - text-align: right; +#tabs .dropdown li { + border-bottom: 1px dotted #DCDCDC; } -#tabs .dropdown a span { - padding: 4px 8px; - color: inherit !important; +#tabs .dropdown li:last-child { + border-bottom: none; } -@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) -{ - #tabs { - min-width: 0; - } +#tabs .dropdown a { + display: block; + padding: 4px 8px; + text-align: right; } /* Main Panel ---------------------------------------- */ #acp { - clear: both; position: relative; top: -2px; margin: 0 0 2px; @@ -571,12 +568,6 @@ li { padding: 3px 8px 3px 3px; } -#menu li span, #menu .header { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - #menu li a:hover, #menu li a:hover span { text-decoration: none; background-color: #FFFFFF; @@ -735,6 +726,7 @@ td { .table1 { border-collapse: separate; border-spacing: 1px; + clear: both; } dt#color_palette_placeholder table { @@ -867,6 +859,8 @@ table.zebra-table tbody tr:nth-child(even) { .row2a { background-color: #E7EEF4; } .row2b { background-color: #E3EBF2; } +tr.row-highlight:hover td { background-color: #DBDFE2; } + .spacer { background-color: #DBDFE2; height: 1px; @@ -874,10 +868,10 @@ table.zebra-table tbody tr:nth-child(even) { } /* Deactivated row */ -.row-inactive { - color: #999; +.row-inactive { + color: #999; } -.row-inactive a, .row-inactive strong { +.row-inactive a, .row-inactive strong { color: #888; } .row-inactive a:hover { @@ -909,6 +903,11 @@ table.styles td.users, table td.mark { text-align: center; } +table.fixed-width-table { + table-layout: fixed; + word-break: break-word; +} + @media only screen and (max-width: 700px), only screen and (max-device-width: 700px) { table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { @@ -974,6 +973,10 @@ table.styles td.users, table td.mark { margin-bottom: 1px; } + .rtl table.responsive td { + text-align: right !important; + } + table.responsive td.empty { display: none !important; } @@ -994,6 +997,10 @@ table.styles td.users, table td.mark { box-sizing: border-box; } + .rtl table.responsive.two-columns td { + float: right; + } + table.responsive.two-columns td:nth-child(2n+1) { clear: left; } @@ -1069,6 +1076,10 @@ fieldset { border-radius: 3px; } +fieldset h2 { + margin-top: 0; +} + .rtl fieldset { border-top: 1px solid #D7D7D7; border-right: 1px solid #D7D7D7; @@ -1127,12 +1138,20 @@ input.langvalue, textarea.langvalue { width: 90%; } +input[type="number"] { + width: 60px; + -moz-padding-end: 0; +} + optgroup, select { + background-color: #FAFAFA; + border: 1px solid #666666; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 0.85em; font-weight: normal; font-style: normal; cursor: pointer; + padding: 1px; vertical-align: middle; width: auto; color: #000; @@ -1218,8 +1237,8 @@ fieldset.quick legend { fieldset.tabulated { background: none; margin: 0; + margin-top: 5px; padding: 0; - padding-top: 5px; border: 0; } @@ -1240,7 +1259,7 @@ fieldset.display-options { border: none; background-color: transparent; text-align: center; - font-size: 0.75em; + font-size: 0.85em; } fieldset.display-options select, fieldset.display-options input, fieldset.display-options label { @@ -1456,7 +1475,7 @@ input:focus, textarea:focus { { select, dd select, dd input { max-width: 240px; - } + } } /* Submit button fieldset or paragraph @@ -1515,7 +1534,7 @@ input.autowidth { width: auto !important;} /* Form button styles ---------------------------------------- */ -a.button1, input.button1, input.button3, +a.button1, input.button1, a.button2, input.button2 { width: auto !important; padding: 1px 3px 0 3px; @@ -1558,7 +1577,7 @@ input.disabled { } /* Focus states */ -input.button1:focus, input.button2:focus, input.button3:focus { +input.button1:focus, input.button2:focus { outline-style: none; } @@ -1572,12 +1591,11 @@ input.button1:focus, input.button2:focus, input.button3:focus { top: 150px; left: 0; right: 0; - max-width: 600px; + width: 620px; margin: 0 auto; z-index: 50; padding: 25px; padding: 0 25px 20px 25px; - text-align: left; } .phpbb_alert .alert_close { @@ -1642,7 +1660,7 @@ input.button1:focus, input.button2:focus, input.button3:focus { @media only screen and (max-width: 700px), only screen and (max-device-width: 700px) { .phpbb_alert { - max-width: none; + width: auto; margin: 0 25px; } } @@ -1665,11 +1683,16 @@ input.button1:focus, input.button2:focus, input.button3:focus { /* Pagination ---------------------------------------- */ .pagination { + font-size: .85em; height: 1%; /* IE tweak (holly hack) */ width: auto; text-align: right; - margin-top: 5px; + margin: 5px 0; +} + +.top-pagination { float: right; + margin: 15px 0 5px 0; } .rtl .pagination { @@ -1759,11 +1782,12 @@ li.pagination ul { /* Action Highlighting ---------------------------------------- */ -.successbox, .errorbox { +.successbox, .errorbox, .warningbox { padding: 8px; margin: 10px 0; color: #FFFFFF; text-align: center; + clear: both; } .success { @@ -1782,6 +1806,10 @@ li.pagination ul { background-color: #BC2A4D; } +.warningbox { + background-color: #fca600; +} + .successbox h3, .errorbox h3 { color: #FFFFFF; margin: 0 0 0.5em; @@ -1808,10 +1836,33 @@ li.pagination ul { font-weight: bold; } +#log-container { + display: none; + max-height: 300px; + padding: 8px; + margin: 10px 0; + clear: both; + overflow-y: auto; + background-color: #FFFFFF; +} + +#log-container.show_log_container { + display: block; + border: 1px solid #DBD7D1; +} + +.log { + font-size: 0.8em; +} + .notice { background-color: #62A5CC; } +.download-box { + margin: 10px 0 10px 0; +} + /* Special cases for the error page */ #errorpage #page-header a { font-weight: bold; @@ -1840,6 +1891,7 @@ li.pagination ul { color: #000; text-align: center; border: 1px solid #AAA; + opacity: .95; } .tooltip span.top { @@ -1865,17 +1917,7 @@ li.pagination ul { vertical-align: middle; } -/* Nice method for clearing floated blocks without having to insert any extra markup - From http://www.positioniseverything.net/easyclearing.html -.clearfix:after, #tabs:after, .row:after, #content:after, fieldset dl:after, #page-body:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -}*/ - -.clearfix, .row, #content, fieldset dl, #page-body { +.row, fieldset dl { overflow: hidden; } @@ -2427,6 +2469,39 @@ fieldset.permissions .padding { display: none !important; } +.roles-options > .dropdown { + left: auto; + top: 3em; + width: 250px; +} + +.roles-options { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + width: 250px; +} + +.roles-options > span { + border: 1px solid #DEDEDE; + border-radius: 3px; + padding: 4px; + width: 250px; + display: block; + background: url('../images/arrow_down.gif') no-repeat 245px .7em; +} + +.roles-options li { + list-style: none; +} + +.roles-highlight { + background-color: #1e90ff; + color: #fff; +} + /* Classes for additional tasks ---------------------------------------- */ @@ -2458,3 +2533,48 @@ fieldset.permissions .padding { .responsive-show-inline { display: inline !important; } .responsive-show-inline-block { display: inline-block !important; } } + +.clearfix { + overflow: hidden; +} + +.pagination:after, +#page-header:after, +#page-body:after, +#tabs:after, +#tabs > ul:after, +#tabs li:after, +#acp:after, +#content:after { + content: ''; + clear: both; + display: block; +} + +#progress-bar { + position: relative; + width: 90%; + height: 25px; + margin: 20px auto; + border: 1px solid #cecece; +} + +#progress-bar #progress-bar-text { + position: absolute; + top: 0; + width: 100%; + text-align: center; + line-height: 25px; + font-weight: bold; + color: #fff; +} + +#progress-bar #progress-bar-filler { + display: block; + position: relative; + top: 0; + left: 0; + background-color: #3c84ad; + width: 0; + height: 25px; +} diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index dd46124f97..253fd46a62 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -75,7 +75,7 @@ function parse_document(container) var cell = $(this), colspan = parseInt(cell.attr('colspan')), dfn = cell.attr('data-dfn'), - text = dfn ? dfn : cell.text().trim(); + text = dfn ? dfn : $.trim(cell.text()); if (text == ' ') text = ''; colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; @@ -114,7 +114,7 @@ function parse_document(container) cells.each(function() { var cell = $(this), colspan = parseInt(cell.attr('colspan')), - text = cell.text().trim(); + text = $.trim(cell.text()); if (headersLength <= column) { return; @@ -169,7 +169,7 @@ function parse_document(container) ul = $this.children(), tabs = ul.children().not('[data-skip-responsive]'), links = tabs.children('a'), - item = ul.append('<li class="responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link"><span> </span></a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'), + item = ul.append('<li class="tab responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link"> </a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'), menu = item.find('.dropdown-contents'), maxHeight = 0, lastWidth = false, @@ -211,7 +211,7 @@ function parse_document(container) for (i = total - 1; i >= 0; i --) { tab = availableTabs.eq(i); - menu.prepend(tab.clone(true)); + menu.prepend(tab.clone(true).removeClass('tab')); tab.hide(); if ($this.height() <= maxHeight) { menu.find('a').click(function() { check(true); }); @@ -242,5 +242,9 @@ function parse_document(container) }); parse_document($('body')); + + // Hide configlist and success message in send statistics page + phpbb.toggleDisplay('configlist', -1); + phpbb.toggleDisplay('questionnaire-thanks', -1); }); })(jQuery); diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 959580d6c2..4ad6b6afa5 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -1,6 +1,8 @@ +/* global phpbb */ + (function($) { // Avoid conflicts with other libraries -"use strict"; +'use strict'; /** * The following callbacks are for reording items. row_down @@ -13,11 +15,10 @@ phpbb.addAjaxCallback('row_down', function(res) { return; } - var el = $(this), - tr = el.parents('tr'), - trSwap = tr.next(); + var $firstTr = $(this).parents('tr'), + $secondTr = $firstTr.next(); - tr.insertAfter(trSwap); + $firstTr.insertAfter($secondTr); }); phpbb.addAjaxCallback('row_up', function(res) { @@ -25,11 +26,10 @@ phpbb.addAjaxCallback('row_up', function(res) { return; } - var el = $(this), - tr = el.parents('tr'), - trSwap = tr.prev(); + var $secondTr = $(this).parents('tr'), + $firstTr = $secondTr.prev(); - tr.insertBefore(trSwap); + $secondTr.insertBefore($firstTr); }); /** @@ -38,10 +38,10 @@ phpbb.addAjaxCallback('row_up', function(res) { * in the href with "deactivate", and vice versa. */ phpbb.addAjaxCallback('activate_deactivate', function(res) { - var el = $(this), - newHref = el.attr('href'); + var $this = $(this), + newHref = $this.attr('href'); - el.text(res.text); + $this.text(res.text); if (newHref.indexOf('deactivate') !== -1) { newHref = newHref.replace('deactivate', 'activate'); @@ -49,7 +49,7 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) { newHref = newHref.replace('activate', 'deactivate'); } - el.attr('href', newHref); + $this.attr('href', newHref); }); /** @@ -66,11 +66,10 @@ phpbb.addAjaxCallback('row_delete', function(res) { $('[data-ajax]').each(function() { var $this = $(this), - ajax = $this.attr('data-ajax'), - fn; + ajax = $this.attr('data-ajax'); if (ajax !== 'false') { - fn = (ajax !== 'true') ? ajax : null; + var fn = (ajax !== 'true') ? ajax : null; phpbb.ajaxify({ selector: this, refresh: $this.attr('data-refresh') !== undefined, @@ -82,7 +81,7 @@ $('[data-ajax]').each(function() { /** * Automatically resize textarea */ -$(document).ready(function() { +$(function() { phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75}); }); diff --git a/phpBB/adm/style/auth_provider_ldap.html b/phpBB/adm/style/auth_provider_ldap.html index 81afa44373..97684db396 100644 --- a/phpBB/adm/style/auth_provider_ldap.html +++ b/phpBB/adm/style/auth_provider_ldap.html @@ -1,32 +1,35 @@ -<dl> - <dt><label for="ldap_server">{L_LDAP_SERVER}{L_COLON}</label><br /><span>{L_LDAP_SERVER_EXPLAIN}</span></dt> - <dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="{AUTH_LDAP_SERVER}" /></dd> -</dl> -<dl> - <dt><label for="ldap_port">{L_LDAP_PORT}{L_COLON}</label><br /><span>{L_LDAP_PORT_EXPLAIN}</span></dt> - <dd><input type="text" id="ldap_port" size="40" name="config[ldap_port]" value="{AUTH_LDAP_PORT}" /></dd> -</dl> -<dl> - <dt><label for="ldap_dn">{L_LDAP_DN}{L_COLON}</label><br /><span>{L_LDAP_DN_EXPLAIN}</span></dt> - <dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="{AUTH_LDAP_BASE_DN}" /></dd> -</dl> -<dl> - <dt><label for="ldap_uid">{L_LDAP_UID}{L_COLON}</label><br /><span>{L_LDAP_UID_EXPLAIN}</span></dt> - <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="{AUTH_LDAP_UID}" /></dd> -</dl> -<dl> - <dt><label for="ldap_user_filter">{L_LDAP_USER_FILTER}{L_COLON}</label><br /><span>{L_LDAP_USER_FILTER_EXPLAIN}</span></dt> - <dd><input type="text" id="ldap_user_filter" size="40" name="config[ldap_user_filter]" value="{AUTH_LDAP_USER_FILTER}" /></dd> -</dl> -<dl> - <dt><label for="ldap_email">{L_LDAP_EMAIL}{L_COLON}</label><br /><span>{L_LDAP_EMAIL_EXPLAIN}</span></dt> - <dd><input type="email" id="ldap_email" size="40" name="config[ldap_email]" value="{AUTH_LDAP_EMAIL}" /></dd> -</dl> -<dl> - <dt><label for="ldap_user">{L_LDAP_USER}{L_COLON}</label><br /><span>{L_LDAP_USER_EXPLAIN}</span></dt> - <dd><input type="text" id="ldap_user" size="40" name="config[ldap_user]" value="{AUTH_LDAP_USER}" /></dd> -</dl> -<dl> - <dt><label for="ldap_password">{L_LDAP_PASSWORD}{L_COLON}</label><br /><span>{L_LDAP_PASSWORD_EXPLAIN}</span></dt> - <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="{AUTH_LDAP_PASSWORD}" autocomplete="off" /></dd> -</dl> +<fieldset id="auth_ldap_settings"> + <legend>{L_LDAP}</legend> + <dl> + <dt><label for="ldap_server">{L_LDAP_SERVER}{L_COLON}</label><br /><span>{L_LDAP_SERVER_EXPLAIN}</span></dt> + <dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="{AUTH_LDAP_SERVER}" /></dd> + </dl> + <dl> + <dt><label for="ldap_port">{L_LDAP_PORT}{L_COLON}</label><br /><span>{L_LDAP_PORT_EXPLAIN}</span></dt> + <dd><input type="text" id="ldap_port" size="40" name="config[ldap_port]" value="{AUTH_LDAP_PORT}" /></dd> + </dl> + <dl> + <dt><label for="ldap_dn">{L_LDAP_DN}{L_COLON}</label><br /><span>{L_LDAP_DN_EXPLAIN}</span></dt> + <dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="{AUTH_LDAP_BASE_DN}" /></dd> + </dl> + <dl> + <dt><label for="ldap_uid">{L_LDAP_UID}{L_COLON}</label><br /><span>{L_LDAP_UID_EXPLAIN}</span></dt> + <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="{AUTH_LDAP_UID}" /></dd> + </dl> + <dl> + <dt><label for="ldap_user_filter">{L_LDAP_USER_FILTER}{L_COLON}</label><br /><span>{L_LDAP_USER_FILTER_EXPLAIN}</span></dt> + <dd><input type="text" id="ldap_user_filter" size="40" name="config[ldap_user_filter]" value="{AUTH_LDAP_USER_FILTER}" /></dd> + </dl> + <dl> + <dt><label for="ldap_email">{L_LDAP_EMAIL}{L_COLON}</label><br /><span>{L_LDAP_EMAIL_EXPLAIN}</span></dt> + <dd><input type="text" id="ldap_email" size="40" name="config[ldap_email]" value="{AUTH_LDAP_EMAIL}" /></dd> + </dl> + <dl> + <dt><label for="ldap_user">{L_LDAP_USER}{L_COLON}</label><br /><span>{L_LDAP_USER_EXPLAIN}</span></dt> + <dd><input type="text" id="ldap_user" size="40" name="config[ldap_user]" value="{AUTH_LDAP_USER}" /></dd> + </dl> + <dl> + <dt><label for="ldap_password">{L_LDAP_PASSWORD}{L_COLON}</label><br /><span>{L_LDAP_PASSWORD_EXPLAIN}</span></dt> + <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="{AUTH_LDAP_PASSWORD}" autocomplete="off" /></dd> + </dl> +</fieldset> diff --git a/phpBB/adm/style/auth_provider_oauth.html b/phpBB/adm/style/auth_provider_oauth.html index 25e40ff596..4c8ff4d36c 100644 --- a/phpBB/adm/style/auth_provider_oauth.html +++ b/phpBB/adm/style/auth_provider_oauth.html @@ -1,17 +1,18 @@ -<h2>{L_AUTH_PROVIDER_OAUTH_TITLE}</h2> -<p>{L_AUTH_PROVIDER_OAUTH_EXPLAIN}</p> +<div id="auth_oauth_settings"> + <p>{L_AUTH_PROVIDER_OAUTH_EXPLAIN}</p> -<!-- BEGIN oauth_services --> -<fieldset> - <legend>{oauth_services.ACTUAL_NAME}</legend> - <dl> - <dt><label for="oauth_service_{oauth_services.NAME}_key">{L_AUTH_PROVIDER_OAUTH_KEY}{L_COLON}</label></dt> - <dd><input type="text" id="oauth_service_{oauth_services.NAME}_key" size="40" name="config[auth_oauth_{oauth_services.NAME}_key]" value="{oauth_services.KEY}" /></dd> - </dl> - <dl> - <dt><label for="oauth_service_{oauth_services.NAME}_secret">{L_AUTH_PROVIDER_OAUTH_SECRET}{L_COLON}</label></dt> - <dd><input type="text" id="oauth_service_{oauth_services.NAME}_secret" size="40" name="config[auth_oauth_{oauth_services.NAME}_secret]" value="{oauth_services.SECRET}" /></dd> - </dl> -</fieldset> -<!-- END oauth_services --> + <!-- BEGIN oauth_services --> + <fieldset> + <legend>{oauth_services.ACTUAL_NAME}</legend> + <dl> + <dt><label for="oauth_service_{oauth_services.NAME}_key">{L_AUTH_PROVIDER_OAUTH_KEY}{L_COLON}</label></dt> + <dd><input type="text" id="oauth_service_{oauth_services.NAME}_key" size="40" name="config[auth_oauth_{oauth_services.NAME}_key]" value="{oauth_services.KEY}" /></dd> + </dl> + <dl> + <dt><label for="oauth_service_{oauth_services.NAME}_secret">{L_AUTH_PROVIDER_OAUTH_SECRET}{L_COLON}</label></dt> + <dd><input type="text" id="oauth_service_{oauth_services.NAME}_secret" size="40" name="config[auth_oauth_{oauth_services.NAME}_secret]" value="{oauth_services.SECRET}" /></dd> + </dl> + </fieldset> + <!-- END oauth_services --> +</div> diff --git a/phpBB/adm/style/avatars.js b/phpBB/adm/style/avatars.js deleted file mode 100644 index 26ea24c0db..0000000000 --- a/phpBB/adm/style/avatars.js +++ /dev/null @@ -1,15 +0,0 @@ -(function($) { // Avoid conflicts with other libraries - -"use strict"; - -function avatarHide() { - $('#avatar_options > div').hide(); - - var selected = $('#avatar_driver').val(); - $('#avatar_option_' + selected).show(); -} - -avatarHide(); -$('#avatar_driver').bind('change', avatarHide); - -})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/adm/style/captcha_recaptcha.html b/phpBB/adm/style/captcha_recaptcha.html index d3038fd714..3f61c76cb1 100644 --- a/phpBB/adm/style/captcha_recaptcha.html +++ b/phpBB/adm/style/captcha_recaptcha.html @@ -1,32 +1,12 @@ <!-- IF S_RECAPTCHA_AVAILABLE --> <dl> <dd> - <script type="text/javascript"> - // <![CDATA[ - var RecaptchaOptions = { - lang : '{LA_RECAPTCHA_LANG}', - theme : 'clean' - }; - // ]]> - </script> - <script type="text/javascript" src="{RECAPTCHA_SERVER}/challenge?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}"></script> - <script type="text/javascript"> - // <![CDATA[ - <!-- IF S_CONTENT_DIRECTION eq 'rtl' --> - document.getElementById('recaptcha_table').style.direction = 'ltr'; - <!-- ENDIF --> - // ]]> - </script> - - <noscript> - <div> - <object data="{RECAPTCHA_SERVER}/noscript?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" type="text/html" height="300" width="500"></object><br /> - <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> - <input type="hidden" name="recaptcha_response_field" value="manual_challenge" /> - </div> + <div>{L_RECAPTCHA_NOSCRIPT}</div> </noscript> + <script src="{RECAPTCHA_SERVER}.js?hl={LA_RECAPTCHA_LANG}" async defer></script> + <div class="g-recaptcha" data-sitekey="{RECAPTCHA_PUBKEY}"></div> </dd> </dl> <!-- ELSE --> diff --git a/phpBB/adm/style/custom_profile_fields.html b/phpBB/adm/style/custom_profile_fields.html deleted file mode 100644 index 982356bfa7..0000000000 --- a/phpBB/adm/style/custom_profile_fields.html +++ /dev/null @@ -1,32 +0,0 @@ - -<!-- BEGIN dropdown --> - <select name="{dropdown.FIELD_IDENT}" id="{dropdown.FIELD_IDENT}"> - <!-- BEGIN options --><option value="{dropdown.options.OPTION_ID}"{dropdown.options.SELECTED}>{dropdown.options.VALUE}</option><!-- END options --> - </select> -<!-- END dropdown --> - -<!-- BEGIN text --> - <textarea name="{text.FIELD_IDENT}" id="{text.FIELD_IDENT}" rows="{text.FIELD_ROWS}" cols="{text.FIELD_COLS}">{text.FIELD_VALUE}</textarea> -<!-- END text --> - -<!-- BEGIN string --> - <input type="text" name="{string.FIELD_IDENT}" id="{string.FIELD_IDENT}" size="{string.FIELD_LENGTH}" maxlength="{string.FIELD_MAXLEN}" value="{string.FIELD_VALUE}" /> -<!-- END string --> - -<!-- BEGIN bool --> - <!-- IF bool.FIELD_LENGTH eq 1 --> - <!-- BEGIN options --><label for="{bool.FIELD_IDENT}_{bool.options.OPTION_ID}"><input type="radio" class="radio" name="{bool.FIELD_IDENT}" id="{bool.FIELD_IDENT}_{bool.options.OPTION_ID}" value="{bool.options.OPTION_ID}"{bool.options.CHECKED} /> {bool.options.VALUE}</label> <!-- END options --> - <!-- ELSE --> - <input type="checkbox" class="radio" name="{bool.FIELD_IDENT}" id="{bool.FIELD_IDENT}" value="1"<!-- IF bool.FIELD_VALUE --> checked="checked"<!-- ENDIF --> /> - <!-- ENDIF --> -<!-- END bool --> - -<!-- BEGIN int --> - <input type="text" name="{int.FIELD_IDENT}" id="{int.FIELD_IDENT}" size="{int.FIELD_LENGTH}" value="{int.FIELD_VALUE}" /> -<!-- END int --> - -<!-- BEGIN date --> - <span>{L_DAY}{L_COLON}</span> <select name="{date.FIELD_IDENT}_day" id="{date.FIELD_IDENT}_day">{date.S_DAY_OPTIONS}</select> - <span>{L_MONTH}{L_COLON}</span> <select name="{date.FIELD_IDENT}_month" id="{date.FIELD_IDENT}_month">{date.S_MONTH_OPTIONS}</select> - <span>{L_YEAR}{L_COLON}</span> <select name="{date.FIELD_IDENT}_year" id="{date.FIELD_IDENT}_year">{date.S_YEAR_OPTIONS}</select> -<!-- END date --> diff --git a/phpBB/adm/style/install_convert.html b/phpBB/adm/style/install_convert.html deleted file mode 100644 index 7e22404f56..0000000000 --- a/phpBB/adm/style/install_convert.html +++ /dev/null @@ -1,134 +0,0 @@ -<!-- INCLUDE install_header.html --> - -<!-- IF S_NOT_INSTALLED --> - - <h1>{TITLE}</h1> - - <p>{BODY}</p> - -<!-- ELSE --> - - <form id="install_convert" method="post" action="{U_ACTION}"> - - <h1>{TITLE}</h1> - - <p>{BODY}</p> - - <!-- IF S_ERROR_BOX --> - <div class="errorbox"> - <h3>{ERROR_TITLE}</h3> - <p>{ERROR_MSG}</p> - </div> - <!-- ENDIF --> - - <!-- IF S_LIST --> - <table class="table1"> - <caption>{L_AVAILABLE_CONVERTORS}</caption> - <col class="col1" /><col class="col2" /><col class="col1" /><col class="col2" /> - <thead> - <tr> - <th>{L_SOFTWARE}</th> - <th>{L_VERSION}</th> - <th>{L_AUTHOR}</th> - <th>{L_OPTIONS}</th> - </tr> - </thead> - <tbody> - <!-- IF .convertors --> - <!-- BEGIN convertors --> - <tr> - <td>{convertors.SOFTWARE}</td> - <td>{convertors.VERSION}</td> - <td>{convertors.AUTHOR}</td> - <td><a href="{convertors.U_CONVERT}">{L_CONVERT}</a></td> - </tr> - <!-- END convertors --> - <!-- ELSE --> - <tr> - <td>{L_NO_CONVERTORS}</td> - <td>-</td> - <td>-</td> - <td>-</td> - </tr> - <!-- ENDIF --> - </tbody> - </table> - <!-- ENDIF --> - - <!-- IF S_CONTINUE --> - </form> - - <fieldset class="submit-buttons"> - <form method="post" action="{U_NEW_ACTION}"> - <input class="button1" type="submit" name="submit_new" value="{L_NEW}" /> - </form> - <br /> - <form method="post" action="{U_CONTINUE_ACTION}"> - <input class="button1" type="submit" name="submit_cont" value="{L_CONTINUE}" /> - </form> - </fieldset> - - <form method="post" action="{U_ACTION}"> - <!-- ENDIF --> - - <!-- IF .checks --> - <fieldset> - - <!-- BEGIN checks --> - <!-- IF checks.S_LEGEND --> - <!-- IF not checks.S_FIRST_ROW --> - </fieldset> - - <fieldset> - <!-- ENDIF --> - <legend>{checks.LEGEND}</legend> - <!-- IF checks.LEGEND_EXPLAIN --><p>{checks.LEGEND_EXPLAIN}</p><!-- ENDIF --> - <!-- ELSE --> - - <dl> - <dt><label>{checks.TITLE}{L_COLON}</label><!-- IF checks.S_EXPLAIN --><br /><span class="explain">{checks.TITLE_EXPLAIN}</span><!-- ENDIF --></dt> - <dd>{checks.RESULT}</dd> - </dl> - <!-- ENDIF --> - <!-- END checks --> - - </fieldset> - <!-- ENDIF --> - - <!-- IF .options --> - <fieldset> - - <!-- BEGIN options --> - <!-- IF options.S_LEGEND --> - <!-- IF not options.S_FIRST_ROW --> - </fieldset> - - <fieldset> - <!-- ENDIF --> - <legend>{options.LEGEND}</legend> - <!-- ELSE --> - - <dl> - <dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span class="explain">{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt> - <dd>{options.CONTENT}</dd> - </dl> - - <!-- ENDIF --> - <!-- END options --> - - </fieldset> - <!-- ENDIF --> - - <!-- IF L_SUBMIT --> - <!-- IF L_MESSAGE --><p>{L_MESSAGE}</p><!-- ENDIF --> - - <fieldset class="submit-buttons"> - {S_HIDDEN} - <!-- IF L_SUBMIT --><input class="button1<!-- IF S_REFRESH --> disabled<!-- ENDIF -->" type="submit" id="submit" <!-- IF S_REFRESH -->disabled="disabled" <!-- ELSE --> onclick="this.className = 'button1 disabled';" onsubmit="this.disabled = 'disabled';" <!-- ENDIF -->name="submit" value="{L_SUBMIT}" /><!-- ENDIF --> - </fieldset> - <!-- ENDIF --> - - </form> -<!-- ENDIF --> - -<!-- INCLUDE install_footer.html --> diff --git a/phpBB/adm/style/install_error.html b/phpBB/adm/style/install_error.html deleted file mode 100644 index 3f7c8b9ed4..0000000000 --- a/phpBB/adm/style/install_error.html +++ /dev/null @@ -1,8 +0,0 @@ -<!-- INCLUDE install_header.html --> - -<div class="errorbox"> - <h3>{MESSAGE_TITLE}</h3> - <p>{MESSAGE_TEXT}</p> -</div> - -<!-- INCLUDE install_footer.html --> diff --git a/phpBB/adm/style/install_footer.html b/phpBB/adm/style/install_footer.html deleted file mode 100644 index c5356e7b9d..0000000000 --- a/phpBB/adm/style/install_footer.html +++ /dev/null @@ -1,18 +0,0 @@ - </div> - </div><!-- /#main --> - </div> - </div><!-- /#acp --> - </div> - - <div id="page-footer"> - Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group - </div> -</div> - -<script type="text/javascript" src="{T_JQUERY_LINK}"></script> -<!-- IF S_ALLOW_CDN --><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 --> -<!-- INCLUDEJS admin.js --> -{$SCRIPTS} - -</body> -</html> diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html deleted file mode 100644 index 560bf501e9..0000000000 --- a/phpBB/adm/style/install_header.html +++ /dev/null @@ -1,79 +0,0 @@ -<!DOCTYPE html> -<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> -<head> -<meta charset="utf-8"> -<meta name="viewport" content="width=device-width" /> -<!-- IF META -->{META}<!-- ENDIF --> -<title>{PAGE_TITLE}</title> - -<link href="{T_TEMPLATE_PATH}/admin.css" rel="stylesheet" type="text/css" media="screen" /> - -<script type="text/javascript"> -// <![CDATA[ - -/** -* Set display of page element -* s[-1,0,1] = hide,toggle display,show -*/ -function dE(n, s, type) -{ - if (!type) - { - type = 'block'; - } - - var e = document.getElementById(n); - if (!s) - { - s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1; - } - e.style.display = (s == 1) ? type : 'none'; -} - -// ]]> -</script> - -</head> - -<body class="{S_CONTENT_DIRECTION} nojs"> -<div id="wrap"> - <div id="page-header"> - <h1>{L_INSTALL_PANEL}</h1> - <p id="skip"><a href="#acp">{L_SKIP}</a></p> - <!-- IF S_LANG_SELECT --> - <form method="post" action=""> - <fieldset class="nobg"> - <label for="language">{L_SELECT_LANG}{L_COLON}</label> - {S_LANG_SELECT} - <input class="button1" type="submit" id="change_lang" name="change_lang" value="{L_CHANGE}" /> - </fieldset> - </form> - <!-- ENDIF --> - </div> - - <div id="page-body"> - <div id="tabs"> - <ul> - <!-- BEGIN t_block1 --> - <li<!-- IF t_block1.S_SELECTED --> class="activetab"<!-- ENDIF -->><a href="{t_block1.U_TITLE}"><span>{t_block1.L_TITLE}</span></a></li> - <!-- END t_block1 --> - </ul> - </div> - - <div id="acp"> - <div id="content"> - <div id="menu"> - <div class="menu-block no-header"> - <ul> - <!-- BEGIN l_block1 --> - <li<!-- IF l_block1.S_SELECTED --> id="activemenu"<!-- ENDIF -->><a href="{l_block1.U_TITLE}"><span>{l_block1.L_TITLE}</span></a></li> - <!-- END l_block1 --> - <!-- BEGIN l_block2 --> - <li<!-- IF l_block2.S_SELECTED --> id="activemenu"<!-- ENDIF -->><span<!-- IF l_block2.S_COMPLETE --> class="completed"<!-- ENDIF -->>{l_block2.L_TITLE}</span></li> - <!-- END l_block2 --> - </ul> - </div> - </div> - - <div id="main" class="install-body"> - <div class="main"> diff --git a/phpBB/adm/style/install_install.html b/phpBB/adm/style/install_install.html deleted file mode 100644 index 1a809a3588..0000000000 --- a/phpBB/adm/style/install_install.html +++ /dev/null @@ -1,77 +0,0 @@ -<!-- INCLUDE install_header.html --> - -<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';"> - -<!-- IF TITLE --><h1>{TITLE}</h1><!-- ENDIF --> -<!-- IF BODY --><p>{BODY}</p><!-- ENDIF --> - -<!-- IF .checks --> - <fieldset> - - <!-- BEGIN checks --> - <!-- IF checks.S_LEGEND --> - <!-- IF not checks.S_FIRST_ROW --> - </fieldset> - - <fieldset> - <!-- ENDIF --> - <legend>{checks.LEGEND}</legend> - <!-- IF checks.LEGEND_EXPLAIN --><p>{checks.LEGEND_EXPLAIN}</p><!-- ENDIF --> - <!-- ELSE --> - - <dl> - <dt>{checks.TITLE}{L_COLON}<!-- IF checks.S_EXPLAIN --><br /><span class="explain">{checks.TITLE_EXPLAIN}</span><!-- ENDIF --></dt> - <dd>{checks.RESULT}</dd> - </dl> - <!-- ENDIF --> - <!-- END checks --> - - </fieldset> -<!-- ENDIF --> - -<!-- IF .options --> - <fieldset> - - <!-- BEGIN options --> - <!-- IF options.S_LEGEND --> - <!-- IF not options.S_FIRST_ROW --> - </fieldset> - - <fieldset> - <!-- ENDIF --> - <legend>{options.LEGEND}</legend> - <!-- ELSE --> - - <dl> - <dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span class="explain">{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt> - <dd>{options.CONTENT}</dd> - </dl> - - <!-- ENDIF --> - <!-- END options --> - - </fieldset> -<!-- ENDIF --> - -<!-- IF S_SHOW_DOWNLOAD --> - <h1>{L_DL_CONFIG}</h1> - <p>{L_DL_CONFIG_EXPLAIN}</p> - - <fieldset class="submit-buttons"> - <legend>{L_DL_CONFIG}</legend> - {S_HIDDEN} - <input class="button1" type="submit" id="dlconfig" name="dlconfig" value="{L_DL_DOWNLOAD}" /> <input class="button1" type="submit" id="dldone" name="dldone" value="{L_DL_DONE}" /> - </fieldset> -<!-- ENDIF --> - -<!-- IF L_SUBMIT --> - <fieldset class="submit-buttons"> - <legend>{L_SUBMIT}</legend> - {S_HIDDEN} - <!-- IF L_SUBMIT --><input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_SUBMIT}" /><!-- ENDIF --> - </fieldset> -<!-- ENDIF --> - -</form> - -<!-- INCLUDE install_footer.html --> diff --git a/phpBB/adm/style/install_main.html b/phpBB/adm/style/install_main.html deleted file mode 100644 index 73e73ad578..0000000000 --- a/phpBB/adm/style/install_main.html +++ /dev/null @@ -1,6 +0,0 @@ -<!-- INCLUDE install_header.html --> - - <h1>{TITLE}</h1> - <p>{BODY}</p> - -<!-- INCLUDE install_footer.html --> diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html deleted file mode 100644 index d746226753..0000000000 --- a/phpBB/adm/style/install_update.html +++ /dev/null @@ -1,467 +0,0 @@ -<!-- INCLUDE install_header.html --> - -<script type="text/javascript"> -// <![CDATA[ - function popup(url, width, height, name) - { - if (!name) - { - name = '_popup'; - } - - window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes, width=' + width); - return false; - } - - function diff_popup(url) - { - popup(url, 950, 600, '_diff'); - return false; - } -// ]]> -</script> - -<!-- IF S_ERROR --> - <div class="errorbox" style="margin-top: 0;"> - <h3>{L_NOTICE}</h3> - <p>{ERROR_MSG}</p> - </div> -<!-- ENDIF --> - -<!-- IF S_IN_PROGRESS --> - - <div class="successbox" style="margin-top: 0;"> - <h3>{L_IN_PROGRESS}</h3> - <p>{L_IN_PROGRESS_EXPLAIN}</p> - </div> - -<!-- ELSEIF S_INTRO --> - - <!-- IF S_WARNING --> - <div class="successbox" style="margin-top: 0;"> - <h3>{L_NOTICE}</h3> - <p>{WARNING_MSG}</p> - </div> - <!-- ENDIF --> - - <div class="errorbox" style="margin-top: 0;"> - <h3>{L_NOTICE}</h3> - <p>{L_BACKUP_NOTICE}</p> - </div> - - <form id="install_update" method="post" action="{U_ACTION}"> - - <h1>{L_UPDATE_INSTALLATION}</h1> - <p>{L_UPDATE_INSTALLATION_EXPLAIN}</p> - - <fieldset class="submit-buttons"> - <input class="button1" type="submit" name="submit" value="{L_NEXT_STEP}" /> - </fieldset> - - </form> - -<!-- ELSEIF S_UPLOAD_SUCCESS --> - - <form id="install_update" method="post" action="{U_ACTION}"> - - <h1>{L_UPDATE_SUCCESS}</h1> - <p>{L_UPDATE_SUCCESS_EXPLAIN}</p> - - <fieldset class="submit-buttons"> - <input class="button1" type="submit" name="check_again" value="{L_CONTINUE_UPDATE}" /> - </fieldset> - - </form> - -<!-- ENDIF --> - -<!-- IF S_VERSION_CHECK --> - - <h1>{L_VERSION_CHECK}</h1> - - <p>{L_VERSION_CHECK_EXPLAIN}</p> - - <!-- IF S_UP_TO_DATE --> - <div class="successbox"> - <p>{L_VERSION_UP_TO_DATE}</p> - </div> - <!-- ELSE --> - <div class="errorbox"> - <p>{L_VERSION_NOT_UP_TO_DATE}</p> - </div> - <!-- ENDIF --> - - <fieldset> - <legend></legend> - <dl> - <dt><label>{L_CURRENT_VERSION}</label></dt> - <dd><strong>{CURRENT_VERSION}</strong></dd> - </dl> - <dl> - <dt><label>{L_LATEST_VERSION}</label></dt> - <dd><strong>{LATEST_VERSION}</strong></dd> - </dl> - <!-- IF PACKAGE_VERSION and not S_UP_TO_DATE --> - <dl> - <dt><label>{L_PACKAGE_UPDATES_TO}</label></dt> - <dd><strong>{PACKAGE_VERSION}</strong></dd> - </dl> - <!-- ENDIF --> - </fieldset> - - <form id="install_update" method="post" action="{U_ACTION}"> - - <fieldset class="submit-buttons"> - <p>{L_CHECK_FILES_EXPLAIN}</p> - <input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" /> - </fieldset> - - </form> - -<!-- ELSEIF S_DB_UPDATE --> - - <!-- IF not S_DB_UPDATE_FINISHED --> - - <h1>{L_PERFORM_DATABASE_UPDATE}</h1> - - <p> - {L_PERFORM_DATABASE_UPDATE_EXPLAIN}<br /> - </p> - - <br /><br /> - - <form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}"> - - <fieldset class="submit-buttons"> - <a href="{U_DB_UPDATE}" class="button1">{L_RUN_DATABASE_SCRIPT}</a> - - <!-- input class="button1" type="submit" name="db_update" value="{L_CHECK_UPDATE_DATABASE}" / --> - </fieldset> - - </form> - - <!-- ELSE --> - - <div class="successbox"> - <h3>{L_UPDATE_SUCCESS}</h3> - <p>{L_EVERYTHING_UP_TO_DATE}</p> - </div> - - <!-- ENDIF --> - -<!-- ELSEIF S_FILE_CHECK --> - - <!-- IF S_ALL_UP_TO_DATE --> - - <h1>{L_UPDATE_FILE_SUCCESS}</h1> - <p>{L_ALL_FILES_UP_TO_DATE}</p> - - <p>{L_UPDATE_DATABASE_EXPLAIN}</p> - - <form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}"> - - <fieldset class="submit-buttons"> - <input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" /> - </fieldset> - - </form> - - <!-- ELSE --> - <h1>{L_COLLECTED_INFORMATION}</h1> - - <p>{L_COLLECTED_INFORMATION_EXPLAIN}</p> - - <!-- IF S_NO_UPDATE_FILES --> - <div class="errorbox"> - <h3>{L_NO_UPDATE_FILES}</h3> - - <p>{L_NO_UPDATE_FILES_EXPLAIN}</p><br /> - - <strong>{NO_UPDATE_FILES}</strong> - - </div> - <!-- ENDIF --> - - <form id="install_update" method="post" action="{U_UPDATE_ACTION}"> - - <!-- IF .up_to_date --> - <h2>{L_FILES_UP_TO_DATE}</h2> - <p>{L_FILES_UP_TO_DATE_EXPLAIN}</p> - - <fieldset> - <legend><img src="{T_IMAGE_PATH}file_up_to_date.gif" alt="{L_STATUS_UP_TO_DATE}" /></legend> - <!-- BEGIN up_to_date --> - <dl> - <dd class="full" style="text-align: {S_CONTENT_FLOW_BEGIN};"><strong>{up_to_date.FILENAME}</strong></dd> - </dl> - <!-- END up_to_date --> - </fieldset> - - <!-- ENDIF --> - - <!-- IF .new --> - <h2>{L_FILES_NEW}</h2> - <p>{L_FILES_NEW_EXPLAIN}</p> - - <fieldset> - <legend><img src="{T_IMAGE_PATH}file_new.gif" alt="{L_STATUS_NEW}" /></legend> - <!-- BEGIN new --> - <dl> - <dt style="width: 60%;"><strong><!-- IF new.DIR_PART -->{new.DIR_PART}<br /><!-- ENDIF -->{new.FILE_PART}</strong> - <!-- IF new.S_CUSTOM --><br /><span><em>{L_FILE_USED}{L_COLON} </em>{new.CUSTOM_ORIGINAL}</span><!-- ENDIF --> - </dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"> - <!-- IF not new.S_BINARY -->[<a href="{new.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{new.L_SHOW_DIFF}</a>]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --> - </dd> - <!-- IF new.S_CUSTOM --> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><label><input type="checkbox" name="no_update[]" value="{new.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd> - <!-- ENDIF --> - </dl> - <!-- END new --> - </fieldset> - - <!-- ENDIF --> - - <!-- IF .not_modified --> - <h2>{L_FILES_NOT_MODIFIED}</h2> - <div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="dE('not_modified', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> - <p>{L_FILES_NOT_MODIFIED_EXPLAIN}</p> - - <fieldset id="not_modified" style="display: none;"> - <legend><img src="{T_IMAGE_PATH}file_not_modified.gif" alt="{L_STATUS_NOT_MODIFIED}" /></legend> - <!-- BEGIN not_modified --> - <dl> - <dt style="width: 60%;"><strong><!-- IF not_modified.DIR_PART -->{not_modified.DIR_PART}<br /><!-- ENDIF -->{not_modified.FILE_PART}</strong> - <!-- IF not_modified.S_CUSTOM --><br /><span><em>{L_FILE_USED}{L_COLON} </em>{not_modified.CUSTOM_ORIGINAL}</span><!-- ENDIF --> - </dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><!-- IF not not_modified.S_BINARY -->[<a href="{not_modified.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{not_modified.L_SHOW_DIFF}</a>]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --></dd> - <!-- IF not_modified.S_CUSTOM --> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><label><input type="checkbox" name="no_update[]" value="{not_modified.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd> - <!-- ENDIF --> - </dl> - <!-- END not_modified --> - </fieldset> - - <!-- ENDIF --> - - <!-- IF .modified --> - <h2>{L_FILES_MODIFIED}</h2> - <p>{L_FILES_MODIFIED_EXPLAIN}</p> - - <!-- BEGIN modified --> - <fieldset> - <legend><img src="{T_IMAGE_PATH}file_modified.gif" alt="{L_STATUS_MODIFIED}" /></legend> - <dl> - <dt style="width: 60%;"><strong><!-- IF modified.DIR_PART -->{modified.DIR_PART}<br /><!-- ENDIF -->{modified.FILE_PART}</strong> - <!-- IF modified.S_CUSTOM --><br /><span><em>{L_FILE_USED}{L_COLON} </em>{modified.CUSTOM_ORIGINAL}</span><!-- ENDIF --> - </dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"> </dd> - <!-- IF modified.S_CUSTOM --> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><label><input type="checkbox" name="no_update[]" value="{modified.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd> - <!-- ENDIF --> - </dl> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{modified.FILENAME}]" value="0" checked="checked" /> {L_MERGE_MODIFICATIONS_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><!-- IF not modified.S_BINARY -->[<a href="{modified.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{modified.L_SHOW_DIFF}</a>]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --></dd> - </dl> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{modified.FILENAME}]" value="1" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><!-- IF not modified.S_BINARY -->[<a href="{modified.U_VIEW_NO_MERGE_NEW}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE --> <!-- ENDIF --></dd> - </dl> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{modified.FILENAME}]" value="2" /> {L_MERGE_NO_MERGE_MOD_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><!-- IF not modified.S_BINARY -->[<a href="{modified.U_VIEW_NO_MERGE_MOD}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE --> <!-- ENDIF --></dd> - </dl> - </fieldset> - <!-- END modified --> - - <!-- ENDIF --> - - <!-- IF .new_conflict --> - <h2>{L_FILES_NEW_CONFLICT}</h2> - <p>{L_FILES_NEW_CONFLICT_EXPLAIN}</p> - - <fieldset> - <legend><img src="{T_IMAGE_PATH}file_new_conflict.gif" alt="{L_STATUS_NEW_CONFLICT}" /></legend> - <!-- BEGIN new_conflict --> - <dl> - <dt style="width: 60%;"><strong><!-- IF new_conflict.DIR_PART -->{new_conflict.DIR_PART}<br /><!-- ENDIF -->{new_conflict.FILE_PART}</strong> - <!-- IF new_conflict.S_CUSTOM --><br /><span><em>{L_FILE_USED}{L_COLON} </em>{new_conflict.CUSTOM_ORIGINAL}</span><!-- ENDIF --> - </dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"> - <!-- IF not new_conflict.S_BINARY -->[<a href="{new_conflict.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{new_conflict.L_SHOW_DIFF}</a>]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --> - </dd> - <!-- IF new_conflict.S_CUSTOM --> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><label><input type="checkbox" name="no_update[]" value="{new_conflict.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd> - <!-- ENDIF --> - </dl> - <!-- END new_conflict --> - </fieldset> - - <!-- ENDIF --> - - <!-- IF .conflict --> - <h2>{L_FILES_CONFLICT}</h2> - <p>{L_FILES_CONFLICT_EXPLAIN}</p> - - <!-- BEGIN conflict --> - <fieldset> - <legend><img src="{T_IMAGE_PATH}file_conflict.gif" alt="{L_STATUS_CONFLICT}" /></legend> - <dl> - <dt style="width: 60%;"><strong><!-- IF conflict.DIR_PART -->{conflict.DIR_PART}<br /><!-- ENDIF -->{conflict.FILE_PART}</strong> - <!-- IF conflict.S_CUSTOM --><br /><span><em>{L_FILE_USED}{L_COLON} </em>{conflict.CUSTOM_ORIGINAL}</span><!-- ENDIF --> - <!-- IF conflict.NUM_CONFLICTS --><br /><span>{L_NUM_CONFLICTS}{L_COLON} {conflict.NUM_CONFLICTS}</span><!-- ENDIF --> - </dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"> - <!-- IF not conflict.S_BINARY -->[<a href="{conflict.U_SHOW_DIFF}">{L_DOWNLOAD_CONFLICTS}</a>]<br />{L_DOWNLOAD_CONFLICTS_EXPLAIN} - <!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --> - </dd> - <!-- IF conflict.S_CUSTOM --> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"><label><input type="checkbox" name="no_update[]" value="{conflict.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd> - <!-- ENDIF --> - </dl> - <!-- IF conflict.S_BINARY --> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="1" checked="checked" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;"> </dd> - </dl> - <!-- ELSE --> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="3" checked="checked" /> {L_MERGE_NEW_FILE_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;">[<a href="{conflict.U_VIEW_NEW_FILE}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_MODIFIED}</a>]</dd> - </dl> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="4" /> {L_MERGE_MOD_FILE_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;">[<a href="{conflict.U_VIEW_MOD_FILE}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_MODIFIED}</a>]</dd> - </dl> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="1" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;">[<a href="{conflict.U_VIEW_NO_MERGE_NEW}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]</dd> - </dl> - <dl> - <dt style="width: 60%"><label><input type="radio" class="radio" name="conflict[{conflict.FILENAME}]" value="2" /> {L_MERGE_NO_MERGE_MOD_OPTION}</label></dt> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 60%;">[<a href="{conflict.U_VIEW_NO_MERGE_MOD}" onclick="diff_popup(this.href); return false;">{L_SHOW_DIFF_FINAL}</a>]</dd> - </dl> - <!-- ENDIF --> - </fieldset> - <!-- END conflict --> - - <!-- ENDIF --> - - <br /> - - <fieldset class="quick"> - <input class="button1" type="submit" name="check_again" value="{L_CHECK_FILES_AGAIN}" /> - </fieldset> - - <br /> - - <h1>{L_UPDATE_METHOD}</h1> - - <p>{L_UPDATE_METHOD_EXPLAIN}</p> - - <fieldset class="submit-buttons"> - <input class="button1" type="submit" name="ftp_upload" value="{L_FTP_UPDATE_METHOD}" /> <input class="button1" type="submit" name="download" value="{L_DOWNLOAD_UPDATE_METHOD_BUTTON}" /> - </fieldset> - - </form> - - <!-- ENDIF --> - -<!-- ELSEIF S_DOWNLOAD_FILES --> - - <h1>{L_DOWNLOAD_UPDATE_METHOD}</h1> - - <p>{L_DOWNLOAD_UPDATE_METHOD_EXPLAIN}</p> - - <form id="install_update" method="post" action="{U_ACTION}"> - - <fieldset> - <legend>{L_SELECT_DOWNLOAD_FORMAT}</legend> - <dl> - <dt><label for="use_method">{L_DOWNLOAD_AS}{L_COLON}</label></dt> - <dd>{RADIO_BUTTONS}</dd> - </dl> - </fieldset> - - <fieldset class="submit-buttons"> - {S_HIDDEN_FIELDS} - <input type="submit" class="button2" value="{L_CONTINUE_UPDATE}" name="check_again" /> <input type="submit" class="button1" value="{L_DOWNLOAD}" name="download" /> - </fieldset> - - </form> - - <br /><br /> - - <p>{L_MAPPING_FILE_STRUCTURE}</p> - - <table class="table1"> - <col class="row1" /><col class="row2" /><col class="row1" /> - <thead> - <tr> - <th style="width: 49%">{L_ARCHIVE_FILE}</th> - <th style="width: 2%"> </th> - <th style="width: 49%">{L_DESTINATION}</th> - </tr> - </thead> - <tbody> - <!-- BEGIN location --> - <tr> - <td>{location.SOURCE}</td> - <td><strong>»</strong></td> - <td>{location.DESTINATION}</td> - </tr> - <!-- END location --> - </tbody> - </table> - -<!-- ELSEIF S_FTP_UPLOAD --> - - <h1>{L_SELECT_FTP_SETTINGS}</h1> - - <form id="install_update" method="post" action="{U_ACTION}"> - - <!-- IF S_CONNECTION_SUCCESS --> - <div class="successbox"> - <p>{L_CONNECTION_SUCCESS}</p> - </div> - <!-- ELSEIF S_CONNECTION_FAILED --> - <div class="successbox"> - <p>{L_TRY_DOWNLOAD_METHOD}</p> - - <fieldset class="quick"> - <input class="button1" type="submit" name="download" value="{L_TRY_DOWNLOAD_METHOD_BUTTON}" /> - </fieldset> - </div> - - <div class="errorbox"> - <p>{L_CONNECTION_FAILED}<br />{ERROR_MSG}</p> - </div> - <!-- ENDIF --> - - <fieldset> - <legend>{L_FTP_SETTINGS}</legend> - <dl> - <dt><label>{L_UPLOAD_METHOD}{L_COLON}</label></dt> - <dd><strong>{UPLOAD_METHOD}</strong></dd> - </dl> - <!-- BEGIN data --> - <dl> - <dt><label for="{data.DATA}">{data.NAME}{L_COLON}</label><br /><span>{data.EXPLAIN}</span></dt> - <dd><input type="<!-- IF data.DATA == 'password' -->password<!-- ELSE -->text<!-- ENDIF -->" id="{data.DATA}" name="{data.DATA}" value="{data.DEFAULT}" /></dd> - </dl> - <!-- END data --> - </fieldset> - - <fieldset class="submit-buttons"> - {S_HIDDEN_FIELDS} - <input class="button2" type="submit" name="check_again" value="{L_BACK}" /> - <input class="button1" type="submit" name="test_connection" value="{L_TEST_CONNECTION}" /> - <input class="button1" type="submit" name="submit" value="{L_UPDATE_FILES}" /> - </fieldset> - - </form> - -<!-- ENDIF --> - -<!-- INCLUDE install_footer.html --> diff --git a/phpBB/adm/style/install_update_diff.html b/phpBB/adm/style/install_update_diff.html deleted file mode 100644 index c27304a425..0000000000 --- a/phpBB/adm/style/install_update_diff.html +++ /dev/null @@ -1,254 +0,0 @@ -<!DOCTYPE html> -<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> -<head> -<meta charset="utf-8"> -<meta name="viewport" content="width=device-width" /> -<!-- IF META -->{META}<!-- ENDIF --> -<title>{PAGE_TITLE}</title> - -<link href="{T_TEMPLATE_PATH}/admin.css" rel="stylesheet" type="text/css" media="screen" /> - -<script type="text/javascript"> -// <![CDATA[ -function resize_panel() -{ - var block = document.getElementById('diff_content'); - var height; - - if (window.innerHeight) - { - height = window.innerHeight - 200; - block.style.height = height + 'px'; - } - else - { - //whatever IE needs to do this - } -} - -window.onresize = resize_panel; - -// ]]> -</script> - -<style type="text/css"> -/* <![CDATA[ */ - -#main, .rtl #main { - font-size: 1em; - line-height: 0.7em; - margin: 0; - padding: 0; - width: 99%; -} - -#diff_content { - padding: 30px 10px 10px; - overflow: hidden; -} - -<!-- IF DIFF_MODE neq 'side_by_side' and DIFF_MODE neq 'raw' --> -div#codepanel { - width: 100%; -} -<!-- ELSE --> -div#codepanel { - background-color: #eee; -} -<!-- ENDIF --> - -<!-- IF DIFF_MODE neq 'unified' and DIFF_MODE neq 'side_by_side' --> -div#diff_content pre { - overflow: auto; - height: 414px; - width: 100% !important; -} -<!-- ENDIF --> - -<!-- IF not S_DIFF_NEW_FILE --> -/** -* Unified Diff -*/ -.file { - line-height: .7em; - overflow: auto; - height: 414px; -} - -.diff { - margin: 0; -} - -.added { - background-color: #dfd; -} - -.removed { - background-color: #fdd; -} - -.info { - color: #888; -} - -.context { - background-color: #eee; -} - -/** -* Inline Diff -*/ -.ins { - background-color: #dfd; - text-decoration: underline; -} - -.del { - background-color: #fdd; - text-decoration: line-through; -} - -/** -* Column Diff -*/ -table.hrdiff { - margin: 0 0 8px 5px; - width: 100%; - overflow: hidden; - border-bottom: 1px solid #999; - table-layout: fixed; - background: transparent; -} - -table.hrdiff th { - text-align: left; - width: 50%; - color: #333; - font-family: Verdana,Helvetica,sans-serif; - font-size: 11px; - border-bottom: 1px solid #999; - border-right: 1px solid #999; - background: #D9D9D9; -} - -table.hrdiff thead th { - font-weight: bold; - font-size: 110%; - padding: 2px; -} - -table.hrdiff tr:first-child th { - border-top: none; -} - -table.hrdiff tbody th { - font-size: 80%; - border-top: 1px solid #999; -} - -table.hrdiff tbody td { - border-right: 1px solid #999; -} - -table.hrdiff td pre { - font-family: "Consolas", monospace; - font-size: 1.1em; - white-space: pre-wrap; /* css-3 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ -} - -table.hrdiff .unmodified { - background: transparent; -} - -table.hrdiff .added { - background: #9f9; -} - -table.hrdiff .added_empty { - background: #cfc; -} - -table.hrdiff .modified { - background: #fd9; -} - -table.hrdiff .removed { - background: #f99; -} - -table.hrdiff .removed_empty { - background: #fcc; -} - -table.hrdiff caption { - caption-side: top; - text-align: left; - margin: 0 0 8px 5px; - font-size: 90%; - font-weight: bold; - padding: 5px; -} - -table.hrdiff caption span { - height: 10px; - width: 10px; - line-height: 10px; - letter-spacing: 10px; - border: 1px solid #000; - margin-left: 0.5em; - vertical-align: baseline; -} - -<!-- ENDIF --> - -/* ]]> */ -</style> - -</head> - -<!-- IF DIFF_MODE neq 'side_by_side' and DIFF_MODE neq 'raw' --> -<body onload="resize_panel();"> -<!-- ELSE --> -<body> -<!-- ENDIF --> - -<div id="wrap"> - <div id="page-header"> -<!-- IF S_DIFF_NEW_FILE --> - - <h1>{L_VIEWING_FILE_CONTENTS}</h1> -<!-- ELSE --> - <h1>{L_VIEWING_FILE_DIFF}</h1> -<!-- ENDIF --> -<!-- IF not S_DIFF_NEW_FILE --> - <p id="skip"><a href="#acp">{L_SKIP}</a></p> - <form method="post" action=""> - <fieldset class="quick"> - <label for="diff_mode">{L_SELECT_DIFF_MODE}{L_COLON}</label> - <select name="diff_mode" id="diff_mode">{S_DIFF_MODE_OPTIONS}</select> - - <input class="button1" type="submit" id="submit" name="submit" value="{L_CHANGE}" /> - </fieldset> - </form> -<!-- ENDIF --> -<!-- IF S_DIFF_CONFLICT_FILE --> - <div style="float: {S_CONTENT_FLOW_BEGIN};"><strong>{L_NUM_CONFLICTS}{L_COLON} {NUM_CONFLICTS}</strong></div> - <br style="clear: both;" /> -<!-- ENDIF --> - </div> - - <div id="page-body"> - <div id="acp"> - <div id="codepanel"> - <div id="diff_content"> - <div id="main"> - {DIFF_CONTENT} - </div> - </div> - </div> - </div> - </div> - - -<!-- INCLUDE simple_footer.html --> diff --git a/phpBB/adm/style/installer_footer.html b/phpBB/adm/style/installer_footer.html new file mode 100644 index 0000000000..63aebec993 --- /dev/null +++ b/phpBB/adm/style/installer_footer.html @@ -0,0 +1,21 @@ + </div> + </div><!-- /#main --> + </div> + </div><!-- /#acp --> + </div> + + <div id="page-footer"> + <div class="copyright"> + Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited + </div> + </div> +</div> + +<script type="text/javascript" src="{T_JQUERY_LINK}"></script> +<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write('\x3Cscript src="{T_ASSETS_PATH}/javascript/jquery.min.js">\x3C/script>');</script><!-- ENDIF --> +<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> +<!-- INCLUDEJS admin.js --> +{$SCRIPTS} + +</body> +</html> diff --git a/phpBB/adm/style/installer_form.html b/phpBB/adm/style/installer_form.html new file mode 100644 index 0000000000..cc5b041fa1 --- /dev/null +++ b/phpBB/adm/style/installer_form.html @@ -0,0 +1,56 @@ +<form id="<!-- IF FORM_ID -->{FORM_ID}<!-- ELSE -->install_install<!-- ENDIF -->" method="POST" action="{U_ACTION}"> +<!-- IF .options --> +<!-- IF S_NOT_ONLY_BUTTON_FORM --> +<fieldset> +<!-- ENDIF --> + + <!-- BEGIN options --> + <!-- IF options.S_LEGEND --> + <!-- IF not options.S_FIRST_ROW --> + </fieldset> + + <fieldset> + <!-- ENDIF --> + <legend>{options.LEGEND}</legend> + <!-- ELSE --> + <dl> + <dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span class="explain">{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt> + <dd> + <!-- IF options.TYPE == 'text' --> + <input type="text" name="{options.KEY}" value="{options.DEFAULT}" /> + <!-- ENDIF --> + <!-- IF options.TYPE == 'email' --> + <input type="email" name="{options.KEY}" value="{options.DEFAULT}" /> + <!-- ENDIF --> + <!-- IF options.TYPE == 'password' --> + <input type="password" name="{options.KEY}" /> + <!-- ENDIF --> + <!-- IF options.TYPE == 'select' --> + <select name="{options.KEY}"> + <!-- BEGIN options.OPTIONS --> + <option value="{options.OPTIONS.value}"<!-- IF options.OPTIONS.selected --> selected<!-- ENDIF -->>{options.OPTIONS.label}</option> + <!-- END options.OPTIONS --> + </select> + <!-- ENDIF --> + <!-- IF options.TYPE == 'radio' --> + <!-- BEGIN options.OPTIONS --> + <input type="radio" name="{options.KEY}" value="{options.OPTIONS.value}" <!-- IF options.OPTIONS.selected -->checked<!-- ENDIF --> /> {options.OPTIONS.label} + <!-- END options.OPTIONS --> + <!-- ENDIF --> + </dd> + </dl> + <!-- ENDIF--> + <!-- END options --> +<!-- IF S_NOT_ONLY_BUTTON_FORM --> +</fieldset> +<!-- ENDIF --> +<!-- ENDIF --> +<!-- IF .submit_buttons --> +<fieldset class="submit-buttons"> + <legend>{L_SUBMIT}</legend> + <!-- BEGIN submit_buttons --> + <input class="button1" type="submit" name="{submit_buttons.KEY}" value="{submit_buttons.TITLE}" /> + <!-- END submit_buttons --> +</fieldset> +<!-- ENDIF --> +</form> diff --git a/phpBB/adm/style/installer_header.html b/phpBB/adm/style/installer_header.html new file mode 100644 index 0000000000..775caa7c67 --- /dev/null +++ b/phpBB/adm/style/installer_header.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <!-- IF META -->{META}<!-- ENDIF --> + <title>{PAGE_TITLE}</title> + + <link href="{T_TEMPLATE_PATH}/admin.css" rel="stylesheet" type="text/css" media="screen" /> +</head> + +<body class="{S_CONTENT_DIRECTION} nojs"> +<div id="wrap"> + <div id="page-header"> + <h1>{L_INSTALL_PANEL}</h1> + <p id="skip"><a href="#acp">{L_SKIP}</a></p> + <!-- IF S_LANG_SELECT --> + <form method="post" action="#" id="language_selector"> + <fieldset class="nobg"> + <label for="language">{L_SELECT_LANG}{L_COLON}</label> + <select id="language" name="language"> + <!-- BEGIN language_select_item --> + <option value="{language_select_item.VALUE}"<!-- IF language_select_item.SELECTED --> selected="selected"<!-- ENDIF -->>{language_select_item.NAME}</option> + <!-- END language_select_item --> + </select> + <input class="button1" type="submit" id="change_lang" name="change_lang" value="{L_CHANGE}" /> + </fieldset> + </form> + <!-- ENDIF --> + </div> + + <div id="page-body"> + <div id="tabs"> + <ul> + <!-- BEGIN t_block1 --> + <li class="tab<!-- IF t_block1.S_SELECTED --> activetab<!-- ENDIF -->"><a href="{t_block1.U_TITLE}">{t_block1.L_TITLE}</a></li> + <!-- END t_block1 --> + </ul> + </div> + + <div id="acp"> + <div id="content"> + <div id="menu"> + <div class="menu-block no-header"> + <ul> + <!-- BEGIN l_block1 --> + <li<!-- IF l_block1.S_SELECTED --> id="activemenu"<!-- ENDIF -->><a href="{l_block1.U_TITLE}"><span>{l_block1.L_TITLE}</span></a></li> + <!-- END l_block1 --> + <!-- BEGIN l_block2 --> + <li<!-- IF l_block2.S_SELECTED --> id="activemenu"<!-- ENDIF -->><span<!-- IF l_block2.S_COMPLETE --> class="completed"<!-- ENDIF --> id="installer-stage-{l_block2.STAGE_NAME}">{l_block2.L_TITLE}</span></li> + <!-- END l_block2 --> + </ul> + </div> + </div> + + <div id="main" class="install-body"> + <div class="main"> diff --git a/phpBB/adm/style/installer_install.html b/phpBB/adm/style/installer_install.html new file mode 100644 index 0000000000..53a91f2700 --- /dev/null +++ b/phpBB/adm/style/installer_install.html @@ -0,0 +1,13 @@ +<!-- INCLUDE installer_header.html --> +<h1>{TITLE}</h1> +<p>{CONTENT}</p> +<!-- IF SHOW_INSTALL_START_FORM --> +<form id="install_install" method="post" action="{U_ACTION}"> + <fieldset class="submit-buttons"> + <legend>{L_SUBMIT}</legend> + <input class="button1" name="install" type="submit" value="{L_INSTALL}" /> + </fieldset> +</form> +<!-- ENDIF --> +<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/installer.js --> +<!-- INCLUDE installer_footer.html --> diff --git a/phpBB/adm/style/installer_main.html b/phpBB/adm/style/installer_main.html new file mode 100644 index 0000000000..f14fe4da70 --- /dev/null +++ b/phpBB/adm/style/installer_main.html @@ -0,0 +1,6 @@ +<!-- INCLUDE installer_header.html --> + + <h1>{TITLE}</h1> + <p>{BODY}</p> + +<!-- INCLUDE installer_footer.html --> diff --git a/phpBB/adm/style/installer_update.html b/phpBB/adm/style/installer_update.html new file mode 100644 index 0000000000..48cc07f5d6 --- /dev/null +++ b/phpBB/adm/style/installer_update.html @@ -0,0 +1,13 @@ +<!-- INCLUDE installer_header.html --> +<h1>{TITLE}</h1> +<p>{CONTENT}</p> +<!-- IF SHOW_INSTALL_START_FORM --> +<form id="install_install" method="post" action="{U_ACTION}"> + <fieldset class="submit-buttons"> + <legend>{L_SUBMIT}</legend> + <input class="button1" name="update" type="submit" value="{L_UPDATE}" /> + </fieldset> +</form> +<!-- ENDIF --> +<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/installer.js --> +<!-- INCLUDE installer_footer.html --> diff --git a/phpBB/adm/style/installer_update_file_status.html b/phpBB/adm/style/installer_update_file_status.html new file mode 100644 index 0000000000..a27bfa6a44 --- /dev/null +++ b/phpBB/adm/style/installer_update_file_status.html @@ -0,0 +1,80 @@ +<!-- IF .deleted --> +<h2>{L_FILES_DELETED}</h2> +<div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="phpbb.toggleDisplay('deleted', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> +<p>{L_FILES_DELETED_EXPLAIN}</p> + +<fieldset id="deleted"> + <legend><img src="{T_IMAGE_PATH}/icon_delete.gif" alt="{L_STATUS_DELETED}" /></legend> + <!-- BEGIN deleted --> + <dl> + <dt style="width: 100%;"><!-- IF deleted.DIR_PART -->{deleted.DIR_PART}<!-- ENDIF --><strong>{deleted.FILE_PART}</strong></dt> + </dl> + <!-- END deleted --> +</fieldset> + +<!-- ENDIF --> + +<!-- IF .conflict --> +<h2>{L_FILES_CONFLICT}</h2> +<div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="phpbb.toggleDisplay('conflict', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> +<p>{L_FILES_CONFLICT_EXPLAIN}</p> + +<fieldset id="conflict"> + <legend><img src="{T_IMAGE_PATH}/file_conflict.gif" alt="{L_STATUS_CONFLICT}" /></legend> + <!-- BEGIN conflict --> + <dl> + <dt style="width: 100%;"><!-- IF conflict.DIR_PART -->{conflict.DIR_PART}<!-- ENDIF --><strong>{conflict.FILE_PART}</strong></dt> + </dl> + <!-- END conflict --> +</fieldset> + +<!-- ENDIF --> + +<!-- IF .modified --> +<h2>{L_FILES_MODIFIED}</h2> +<div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="phpbb.toggleDisplay('modified', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> +<p>{L_FILES_MODIFIED_EXPLAIN}</p> + +<fieldset id="modified"> + <legend><img src="{T_IMAGE_PATH}/file_modified.gif" alt="{L_STATUS_MODIFIED}" /></legend> + <!-- BEGIN modified --> + <dl> + <dt style="width: 100%;"><!-- IF modified.DIR_PART -->{modified.DIR_PART}<!-- ENDIF --><strong>{modified.FILE_PART}</strong></dt> + </dl> + <!-- END modified --> +</fieldset> + +<!-- ENDIF --> + +<!-- IF .new --> +<h2>{L_FILES_NEW}</h2> +<div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="phpbb.toggleDisplay('new_files', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> +<p>{L_FILES_NEW_EXPLAIN}</p> + +<fieldset id="new_files" style="display: none;"> + <legend><img src="{T_IMAGE_PATH}/file_new.gif" alt="{L_STATUS_NEW}" /></legend> + <!-- BEGIN new --> + <dl> + <dt style="width: 100%;"><!-- IF new.DIR_PART -->{new.DIR_PART}<!-- ENDIF --><strong>{new.FILE_PART}</strong> + </dt> + </dl> + <!-- END new --> +</fieldset> + +<!-- ENDIF --> + +<!-- IF .not_modified --> +<h2>{L_FILES_NOT_MODIFIED}</h2> +<div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="phpbb.toggleDisplay('not_modified', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> +<p>{L_FILES_NOT_MODIFIED_EXPLAIN}</p> + +<fieldset id="not_modified" style="display: none;"> + <legend><img src="{T_IMAGE_PATH}/file_not_modified.gif" alt="{L_STATUS_NOT_MODIFIED}" /></legend> + <!-- BEGIN not_modified --> + <dl> + <dt style="width: 100%;"><!-- IF not_modified.DIR_PART -->{not_modified.DIR_PART}<!-- ENDIF --><strong>{not_modified.FILE_PART}</strong></dt> + </dl> + <!-- END not_modified --> +</fieldset> + +<!-- ENDIF --> diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index 8810414fc2..8745286d64 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -5,15 +5,17 @@ </div> <div id="page-footer"> - <!-- IF S_COPYRIGHT_HTML --> - {CREDIT_LINE} - <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> - <!-- ENDIF --> + <div class="copyright"> + <!-- IF S_COPYRIGHT_HTML --> + {CREDIT_LINE} + <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> + <!-- ENDIF --> - <!-- IF DEBUG_OUTPUT --> - <!-- IF S_COPYRIGHT_HTML --><br /><!-- ENDIF --> - {DEBUG_OUTPUT} - <!-- ENDIF --> + <!-- IF DEBUG_OUTPUT --> + <!-- IF S_COPYRIGHT_HTML --><br /><!-- ENDIF --> + {DEBUG_OUTPUT} + <!-- ENDIF --> + </div> <div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}"> <div id="darken"> </div> @@ -32,7 +34,7 @@ </div> <script type="text/javascript" src="{T_JQUERY_LINK}"></script> -<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> +<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write('\x3Cscript src="{T_ASSETS_PATH}/javascript/jquery.min.js?assets_version={T_ASSETS_VERSION}">\x3C/script>');</script><!-- ENDIF --> <script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> <!-- INCLUDEJS ajax.js --> <!-- INCLUDEJS admin.js --> diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index 1fc1261489..ada88edff2 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -2,7 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8"> -<meta name="viewport" content="width=device-width" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- IF META -->{META}<!-- ENDIF --> <title>{PAGE_TITLE}</title> @@ -36,25 +36,6 @@ function jumpto() } /** -* Set display of page element -* s[-1,0,1] = hide,toggle display,show -*/ -function dE(n, s, type) -{ - if (!type) - { - type = 'block'; - } - - var e = document.getElementById(n); - if (!s) - { - s = (e.style.display == '') ? -1 : 1; - } - e.style.display = (s == 1) ? type : 'none'; -} - -/** * Mark/unmark checkboxes * id = ID of parent container, name = name prefix, state = state [true/false] */ @@ -108,9 +89,13 @@ function popup(url, width, height, name) {$STYLESHEETS} +<!-- EVENT acp_overall_header_stylesheets_after --> + </head> -<body class="{S_CONTENT_DIRECTION} nojs"> +<body class="{S_CONTENT_DIRECTION} {BODY_CLASS} nojs"> + +<!-- EVENT acp_overall_header_body_before --> <div id="wrap"> <div id="page-header"> @@ -123,7 +108,7 @@ function popup(url, width, height, name) <div id="tabs"> <ul> <!-- BEGIN t_block1 --> - <li<!-- IF t_block1.S_SELECTED --> class="activetab"<!-- ENDIF -->><a href="{t_block1.U_TITLE}"><span>{t_block1.L_TITLE}</span></a></li> + <li class="tab<!-- IF t_block1.S_SELECTED --> activetab<!-- ENDIF -->"><a href="{t_block1.U_TITLE}">{t_block1.L_TITLE}</a></li> <!-- END t_block1 --> </ul> </div> diff --git a/phpBB/adm/style/pagination.html b/phpBB/adm/style/pagination.html index 7158f83fbc..5e755723e8 100644 --- a/phpBB/adm/style/pagination.html +++ b/phpBB/adm/style/pagination.html @@ -1,5 +1,5 @@ - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • + <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE_CLICK}">{PAGE_NUMBER}</a> • <ul> <!-- BEGIN pagination --> <!-- IF pagination.S_IS_PREV --><li><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a></li> diff --git a/phpBB/adm/style/permission_forum_copy.html b/phpBB/adm/style/permission_forum_copy.html index 1e012a9347..b1539aff12 100644 --- a/phpBB/adm/style/permission_forum_copy.html +++ b/phpBB/adm/style/permission_forum_copy.html @@ -12,7 +12,7 @@ <legend>{L_LOOK_UP_FORUM}</legend> <dl> - <dt><label for="src_forum">{L_COPY_PERMISSIONS_FROM}{L_COLON}</label><br /><span>{L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}</span></dt> + <dt><!-- EVENT acp_permission_forum_copy_src_forum_prepend --><label for="src_forum">{L_COPY_PERMISSIONS_FROM}{L_COLON}</label><br /><span>{L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}</span><!-- EVENT acp_permission_forum_copy_src_forum_append --></dt> <dd><select id="src_forum" name="src_forum_id"><option value="0">{L_SELECT_FORUM}</option><option value="-1">------------------</option>{S_FORUM_OPTIONS}</select></dd> </dl> </fieldset> @@ -22,7 +22,7 @@ <p>{L_LOOK_UP_FORUMS_EXPLAIN}</p> <dl> - <dt><label for="dest_forums">{L_COPY_PERMISSIONS_TO}{L_COLON}</label><br /><span>{L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}</span></dt> + <dt><!-- EVENT acp_permission_forum_copy_dest_forum_prepend --><label for="dest_forums">{L_COPY_PERMISSIONS_TO}{L_COLON}</label><br /><span>{L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}</span><!-- EVENT acp_permission_forum_copy_dest_forum_append --></dt> <dd><select id="dest_forums" name="dest_forum_ids[]" multiple="multiple" size="10">{S_FORUM_OPTIONS}</select></dd> </dl> </fieldset> diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html index 7b5c071693..347da3181e 100644 --- a/phpBB/adm/style/permission_mask.html +++ b/phpBB/adm/style/permission_mask.html @@ -39,11 +39,23 @@ </div> <dl class="permissions-simple"> <dt style="width: 20%"><label for="role{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}">{L_ROLE}{L_COLON}</label></dt> - <!-- IF p_mask.f_mask.S_ROLE_OPTIONS --> - <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 20%"><select id="role{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" name="role[{p_mask.f_mask.UG_ID}][{p_mask.f_mask.FORUM_ID}]" onchange="set_role_settings(this.options[selectedIndex].value, 'advanced{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}'); init_colours('{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}')">{p_mask.f_mask.S_ROLE_OPTIONS}</select></dd> - <!-- ELSE --> + {% if role_options %} + <dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 20%"> + <div class="dropdown-container dropdown-button-control roles-options" data-alt-text="{LA_ROLE_DESCRIPTION}"> + <span title="Roles" class="button icon-button tools-icon dropdown-trigger dropdown-select">{L_NO_ROLE_ASSIGNED}</span> + <div class="dropdown hidden"> + <ul class="dropdown-contents" id="role{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" > + {% for role in loops.role_options %} + <li data-id="{{ role.ID }}" data-target-id="advanced{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" data-title="{{ role.TITLE }}"{% if role.SELECTED == true %} data-selected="{{ role.SELECTED }}"{% endif %}>{{ role.ROLE_NAME }}</li> + {% endfor %} + </ul> + </div> + <input type="hidden" name="role[{p_mask.f_mask.UG_ID}][{p_mask.f_mask.FORUM_ID}]"{% if S_ROLE_ID %}value="{{ S_ROLE_ID }}"{% endif %} /> + </div> + </dd> + {% else %} <dd>{L_NO_ROLE_AVAILABLE}</dd> - <!-- ENDIF --> + {% endif %} </dl> <!-- ENDIF --> diff --git a/phpBB/adm/style/permissions.js b/phpBB/adm/style/permissions.js index 1c85fbd9ef..9178adab50 100644 --- a/phpBB/adm/style/permissions.js +++ b/phpBB/adm/style/permissions.js @@ -177,7 +177,7 @@ function swap_options(pmask, fmask, cat, adv, view) { var adv_block = document.getElementById('advanced' + pmask + fmask); if (adv_block.style.display === 'block' && adv === true) { - dE('advanced' + pmask + fmask, -1); + phpbb.toggleDisplay('advanced' + pmask + fmask, -1); reset_opacity(1); display_checkboxes(false); return; @@ -207,11 +207,11 @@ function swap_options(pmask, fmask, cat, adv, view) { return; } - dE('options' + active_option, -1); + phpbb.toggleDisplay('options' + active_option, -1); //hiding and showing the checkbox if (document.getElementById('checkbox' + active_pmask + active_fmask)) { - dE('checkbox' + pmask + fmask, -1); + phpbb.toggleDisplay('checkbox' + pmask + fmask, -1); if ((pmask + fmask) !== (active_pmask + active_fmask)) { document.getElementById('checkbox' + active_pmask + active_fmask).style.display = 'inline'; @@ -219,13 +219,13 @@ function swap_options(pmask, fmask, cat, adv, view) { } if (!view) { - dE('advanced' + active_pmask + active_fmask, -1); + phpbb.toggleDisplay('advanced' + active_pmask + active_fmask, -1); } if (!view) { - dE('advanced' + pmask + fmask, 1); + phpbb.toggleDisplay('advanced' + pmask + fmask, 1); } - dE('options' + id, 1); + phpbb.toggleDisplay('options' + id, 1); active_pmask = pmask; active_fmask = fmask; diff --git a/phpBB/adm/style/profilefields/url.html b/phpBB/adm/style/profilefields/url.html new file mode 100644 index 0000000000..8dd3a90de1 --- /dev/null +++ b/phpBB/adm/style/profilefields/url.html @@ -0,0 +1,3 @@ +<!-- BEGIN url --> +<input type="url" class="inputbox autowidth" name="{url.FIELD_IDENT}" id="{url.FIELD_IDENT}" size="{url.FIELD_LENGTH}" maxlength="{url.FIELD_MAXLEN}" value="{url.FIELD_VALUE}" /> +<!-- END url --> diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html index a559b25b72..08ee0a739f 100644 --- a/phpBB/adm/style/simple_footer.html +++ b/phpBB/adm/style/simple_footer.html @@ -17,8 +17,11 @@ </div> <script type="text/javascript" src="{T_JQUERY_LINK}"></script> -<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> +<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write('\x3Cscript src="{T_ASSETS_PATH}/javascript/jquery.min.js?assets_version={T_ASSETS_VERSION}">\x3C/script>');</script><!-- ENDIF --> +<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> + <!-- EVENT acp_simple_footer_after --> +{$SCRIPTS} </body> </html> diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html index 0ca751cd7e..f62a7a900e 100644 --- a/phpBB/adm/style/simple_header.html +++ b/phpBB/adm/style/simple_header.html @@ -2,6 +2,7 @@ <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> <meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- IF META -->{META}<!-- ENDIF --> <title>{PAGE_TITLE}</title> @@ -49,25 +50,6 @@ function jumpto() } /** -* Set display of page element -* s[-1,0,1] = hide,toggle display,show -*/ -function dE(n, s, type) -{ - if (!type) - { - type = 'block'; - } - - var e = document.getElementById(n); - if (!s) - { - s = (e.style.display == '') ? -1 : 1; - } - e.style.display = (s == 1) ? type : 'none'; -} - -/** * Mark/unmark checkboxes * id = ID of parent container, name = name prefix, state = state [true/false] */ @@ -102,8 +84,12 @@ function find_username(url) // ]]> </script> <!-- EVENT acp_simple_header_head_append --> +{$STYLESHEETS} +<!-- EVENT acp_simple_header_stylesheets_after --> </head> -<body class="{S_CONTENT_DIRECTION}"> +<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}"> + +<!-- EVENT acp_simple_header_body_before --> <div id="page-body" class="simple-page-body"> diff --git a/phpBB/adm/style/timezone_option.html b/phpBB/adm/style/timezone_option.html index 7a799b69c6..acfff30184 100644 --- a/phpBB/adm/style/timezone_option.html +++ b/phpBB/adm/style/timezone_option.html @@ -1,17 +1,25 @@ <dl> <dt><label for="timezone">{L_BOARD_TIMEZONE}{L_COLON}</label></dt> - <!-- IF S_TZ_DATE_OPTIONS --> + <!-- IF .timezone_date --> <dd id="tz_select_date" style="display: none;"> <select name="tz_date" id="tz_date" class="autowidth tz_select"> <option value="">{L_SELECT_CURRENT_TIME}</option> - {S_TZ_DATE_OPTIONS} + <!-- BEGIN timezone_date --> + <option value="{timezone_date.VALUE}"<!-- IF timezone_date.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_date.TITLE}</option> + <!-- END timezone_date --> </select> </dd> <!-- ENDIF --> <dd> <select name="tz" id="timezone" class="autowidth tz_select"> <option value="">{L_SELECT_TIMEZONE}</option> - {S_TZ_OPTIONS} + <!-- BEGIN timezone_select --> + <optgroup label="{timezone_select.LABEL}" data-tz-value="{timezone_select.VALUE}"> + <!-- BEGIN timezone_options --> + <option title="{timezone_select.timezone_options.TITLE}" value="{timezone_select.timezone_options.VALUE}"<!-- IF timezone_select.timezone_options.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_select.timezone_options.LABEL}</option> + <!-- END timezone_options --> + </optgroup> + <!-- END timezone_select --> </select> <!-- INCLUDEJS timezone.js --> diff --git a/phpBB/adm/style/tooltip.js b/phpBB/adm/style/tooltip.js index 3a89008706..68964034f0 100644 --- a/phpBB/adm/style/tooltip.js +++ b/phpBB/adm/style/tooltip.js @@ -10,206 +10,196 @@ phpBB Development Team: - further adjustements */ -var head_text, tooltip_mode; +(function($) { // Avoid conflicts with other libraries -/** -* Enable tooltip replacements for links -*/ -function enable_tooltips_link(id, headline, sub_id) { - var links, i, hold; - - head_text = headline; - - if (!document.getElementById || !document.getElementsByTagName) { - return; - } - - hold = document.createElement('span'); - hold.id = '_tooltip_container'; - hold.setAttribute('id', '_tooltip_container'); - hold.style.position = 'absolute'; +'use strict'; - document.getElementsByTagName('body')[0].appendChild(hold); - - if (id === null) { - links = document.getElementsByTagName('a'); - } else { - links = document.getElementById(id).getElementsByTagName('a'); - } - - for (i = 0; i < links.length; i++) { - if (sub_id) { - if (links[i].id.substr(0, sub_id.length) === sub_id) { - prepare(links[i]); - } - } else { - prepare(links[i]); - } - } - - tooltip_mode = 'link'; -} +var tooltips = []; /** -* Enable tooltip replacements for selects + * Enable tooltip replacements for selects + * @param {string} id ID tag of select + * @param {string} headline Text that should appear on top of tooltip + * @param {string} [subId] Sub ID that should only be using tooltips (optional) */ -function enable_tooltips_select(id, headline, sub_id) { - var links, i, hold; - - head_text = headline; - - if (!document.getElementById || !document.getElementsByTagName) { - return; - } +phpbb.enableTooltipsSelect = function (id, headline, subId) { + var $links, hold; - hold = document.createElement('span'); - hold.id = '_tooltip_container'; - hold.setAttribute('id', '_tooltip_container'); - hold.style.position = 'absolute'; + hold = $('<span />', { + id: '_tooltip_container', + css: { + position: 'absolute' + } + }); - document.getElementsByTagName('body')[0].appendChild(hold); + $('body').append(hold); - if (id === null) { - links = document.getElementsByTagName('option'); + if (!id) { + $links = $('.roles-options li'); } else { - links = document.getElementById(id).getElementsByTagName('option'); + $links = $('.roles-options li', '#' + id); } - for (i = 0; i < links.length; i++) { - if (sub_id) { - if (links[i].parentNode.id.substr(0, sub_id.length) === sub_id) { - prepare(links[i]); + $links.each(function () { + var $this = $(this); + + if (subId) { + if ($this.parent().attr('id').substr(0, subId.length) === subId) { + phpbb.prepareTooltips($this, headline); } } else { - prepare(links[i]); + phpbb.prepareTooltips($this, headline); } - } - - tooltip_mode = 'select'; -} + }); +}; /** -* Prepare elements to replace + * Prepare elements to replace + * + * @param {jQuery} $element Element to prepare for tooltips + * @param {string} headText Text heading to display */ -function prepare(element) { - var tooltip, text, desc, title; +phpbb.prepareTooltips = function ($element, headText) { + var $tooltip, text, $desc, $title; - text = element.getAttribute('title'); + text = $element.attr('data-title'); if (text === null || text.length === 0) { return; } - element.removeAttribute('title'); - tooltip = create_element('span', 'tooltip'); - - title = create_element('span', 'top'); - title.appendChild(document.createTextNode(head_text)); - tooltip.appendChild(title); - - desc = create_element('span', 'bottom'); - desc.innerHTML = text; - tooltip.appendChild(desc); - - set_opacity(tooltip); + $title = $('<span />', { + class: 'top', + css: { + display: 'block' + } + }) + .append(document.createTextNode(headText)); + + $desc = $('<span />', { + class: 'bottom', + html: text, + css: { + display: 'block' + } + }); - element.tooltip = tooltip; - element.onmouseover = show_tooltip; - element.onmouseout = hide_tooltip; + $tooltip = $('<span />', { + class: 'tooltip', + css: { + display: 'block' + } + }) + .append($title) + .append($desc); - if (tooltip_mode === 'link') { - element.onmousemove = locate; - } -} + tooltips[$element.attr('data-id')] = $tooltip; + $element.on('mouseover', phpbb.showTooltip); + $element.on('mouseout', phpbb.hideTooltip); +}; /** -* Show tooltip + * Show tooltip + * + * @param {object} $element Element passed by .on() */ -function show_tooltip(e) { - document.getElementById('_tooltip_container').appendChild(this.tooltip); - locate(this); -} +phpbb.showTooltip = function ($element) { + var $this = $($element.target); + $('#_tooltip_container').append(tooltips[$this.attr('data-id')]); + phpbb.positionTooltip($this); +}; /** -* Hide tooltip + * Hide tooltip */ -function hide_tooltip(e) { +phpbb.hideTooltip = function () { var d = document.getElementById('_tooltip_container'); if (d.childNodes.length > 0) { d.removeChild(d.firstChild); } -} +}; /** -* Set opacity on tooltip element + * Correct positioning of tooltip container + * + * @param {jQuery} $element Tooltip element that should be positioned */ -function set_opacity(element) { - element.style.filter = 'alpha(opacity:95)'; - element.style.KHTMLOpacity = '0.95'; - element.style.MozOpacity = '0.95'; - element.style.opacity = '0.95'; -} +phpbb.positionTooltip = function ($element) { + var offset; -/** -* Create new element -*/ -function create_element(tag, c) { - var x = document.createElement(tag); - x.className = c; - x.style.display = 'block'; - return x; -} - -/** -* Correct positioning of tooltip container -*/ -function locate(e) { - var posx = 0; - var posy = 0; + $element = $element.parent(); + offset = $element.offset(); - e = e.parentNode; + $('#_tooltip_container').css({ + top: offset.top + 30, + left: offset.left - 205 + }); +}; - if (e.offsetParent) { - for (posx = 0, posy = 0; e.offsetParent; e = e.offsetParent) { - posx += e.offsetLeft; - posy += e.offsetTop; +/** + * Prepare roles drop down select + */ +phpbb.prepareRolesDropdown = function () { + var $options = $('.roles-options li'); + var $rolesOptions = $options.closest('.roles-options'); + var $span = $rolesOptions.children('span'); + + // Prepare highlighting of select options and settings update + $options.each(function () { + var $this = $(this); + + // Correctly show selected option + if (typeof $this.attr('data-selected') !== 'undefined') { + $rolesOptions.closest('.roles-options') + .children('span') + .text($this.text()) + .attr('data-default', $this.text()) + .attr('data-default-val', $this.attr('data-id')); } - } else { - posx = e.offsetLeft; - posy = e.offsetTop; - } - if (tooltip_mode === 'link') { - document.getElementById('_tooltip_container').style.top=(posy+20) + 'px'; - document.getElementById('_tooltip_container').style.left=(posx-20) + 'px'; - } else { - document.getElementById('_tooltip_container').style.top=(posy+30) + 'px'; - document.getElementById('_tooltip_container').style.left=(posx-205) + 'px'; + $this.on('mouseover', function () { + var $this = $(this); + $options.removeClass('roles-highlight'); + $this.addClass('roles-highlight'); + }).on('click', function () { + var $this = $(this); + + // Update settings + set_role_settings($this.attr('data-id'), $this.attr('data-target-id')); + init_colours($this.attr('data-target-id').replace('advanced', '')); + + // Set selected setting + $rolesOptions.children('span') + .text($this.text()); + $rolesOptions.children('input[type=hidden]') + .val($this.attr('data-id')); + + // Trigger hiding of selection options + $('body').trigger('click'); + }); + }); + + // Save default text of drop down if there is no default set yet + if (typeof $span.attr('data-default') === 'undefined') { + $span.attr('data-default', $span.text()); } -/* - if (e == null) - { - e = window.event; - } + // Prepare resetting drop down on form reset + $options.closest('form').on('reset', function () { + $span.text($span.attr('data-default')); + $rolesOptions.children('input[type=hidden]') + .val($span.attr('data-id')); + }); - if (e.pageX || e.pageY) - { - posx = e.pageX; - posy = e.pageY; - } - else if (e.clientX || e.clientY) - { - if (document.documentElement.scrollTop) - { - posx = e.clientX+document.documentElement.scrollLeft; - posy = e.clientY+document.documentElement.scrollTop; - } - else - { - posx = e.clientX+document.body.scrollLeft; - posy = e.clientY+document.body.scrollTop; - } - } -*/ -} +}; + +// Run onload functions for RolesDropdown and tooltips +$(function() { + // Enable tooltips + phpbb.enableTooltipsSelect('set-permissions', $('#set-permissions').attr('data-role-description'), 'role'); + + // Prepare dropdown + phpbb.prepareRolesDropdown(); +}); + +})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/app.php b/phpBB/app.php index 7dc778e3a8..4873fb10c3 100644 --- a/phpBB/app.php +++ b/phpBB/app.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,14 +21,16 @@ define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); -include($phpbb_root_path . 'includes/functions_url_matcher.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup('app'); +/* @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel */ $http_kernel = $phpbb_container->get('http_kernel'); + +/* @var $symfony_request \phpbb\symfony_request */ $symfony_request = $phpbb_container->get('symfony_request'); $response = $http_kernel->handle($symfony_request); $response->send(); diff --git a/phpBB/assets/css/font-awesome.min.css b/phpBB/assets/css/font-awesome.min.css new file mode 100644 index 0000000000..9c24364d62 --- /dev/null +++ b/phpBB/assets/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.4.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.4.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.4.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.4.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.4.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.4.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}
\ No newline at end of file diff --git a/phpBB/assets/fonts/FontAwesome.otf b/phpBB/assets/fonts/FontAwesome.otf Binary files differnew file mode 100644 index 0000000000..681bdd4d4c --- /dev/null +++ b/phpBB/assets/fonts/FontAwesome.otf diff --git a/phpBB/assets/fonts/fontawesome-webfont.eot b/phpBB/assets/fonts/fontawesome-webfont.eot Binary files differnew file mode 100644 index 0000000000..a30335d748 --- /dev/null +++ b/phpBB/assets/fonts/fontawesome-webfont.eot diff --git a/phpBB/assets/fonts/fontawesome-webfont.svg b/phpBB/assets/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000000..6fd19abcb9 --- /dev/null +++ b/phpBB/assets/fonts/fontawesome-webfont.svg @@ -0,0 +1,640 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> +<metadata></metadata> +<defs> +<font id="fontawesomeregular" horiz-adv-x="1536" > +<font-face units-per-em="1792" ascent="1536" descent="-256" /> +<missing-glyph horiz-adv-x="448" /> +<glyph unicode=" " horiz-adv-x="448" /> +<glyph unicode="	" horiz-adv-x="448" /> +<glyph unicode=" " horiz-adv-x="448" /> +<glyph unicode="¨" horiz-adv-x="1792" /> +<glyph unicode="©" horiz-adv-x="1792" /> +<glyph unicode="®" horiz-adv-x="1792" /> +<glyph unicode="´" horiz-adv-x="1792" /> +<glyph unicode="Æ" horiz-adv-x="1792" /> +<glyph unicode="Ø" horiz-adv-x="1792" /> +<glyph unicode=" " horiz-adv-x="768" /> +<glyph unicode=" " horiz-adv-x="1537" /> +<glyph unicode=" " horiz-adv-x="768" /> +<glyph unicode=" " horiz-adv-x="1537" /> +<glyph unicode=" " horiz-adv-x="512" /> +<glyph unicode=" " horiz-adv-x="384" /> +<glyph unicode=" " horiz-adv-x="256" /> +<glyph unicode=" " horiz-adv-x="256" /> +<glyph unicode=" " horiz-adv-x="192" /> +<glyph unicode=" " horiz-adv-x="307" /> +<glyph unicode=" " horiz-adv-x="85" /> +<glyph unicode=" " horiz-adv-x="307" /> +<glyph unicode=" " horiz-adv-x="384" /> +<glyph unicode="™" horiz-adv-x="1792" /> +<glyph unicode="∞" horiz-adv-x="1792" /> +<glyph unicode="≠" horiz-adv-x="1792" /> +<glyph unicode="◼" horiz-adv-x="500" d="M0 0z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1699 1350q0 -35 -43 -78l-632 -632v-768h320q26 0 45 -19t19 -45t-19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45t45 19h320v768l-632 632q-43 43 -43 78q0 23 18 36.5t38 17.5t43 4h1408q23 0 43 -4t38 -17.5t18 -36.5z" /> +<glyph unicode="" d="M1536 1312v-1120q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v537l-768 -237v-709q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89 t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v967q0 31 19 56.5t49 35.5l832 256q12 4 28 4q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -52 -38 -90t-90 -38q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5 t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 32v768q-32 -36 -69 -66q-268 -206 -426 -338q-51 -43 -83 -67t-86.5 -48.5t-102.5 -24.5h-1h-1q-48 0 -102.5 24.5t-86.5 48.5t-83 67q-158 132 -426 338q-37 30 -69 66v-768q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1664 1083v11v13.5t-0.5 13 t-3 12.5t-5.5 9t-9 7.5t-14 2.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5q0 -168 147 -284q193 -152 401 -317q6 -5 35 -29.5t46 -37.5t44.5 -31.5t50.5 -27.5t43 -9h1h1q20 0 43 9t50.5 27.5t44.5 31.5t46 37.5t35 29.5q208 165 401 317q54 43 100.5 115.5t46.5 131.5z M1792 1120v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 -128q-26 0 -44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124t127 -344q0 -221 -229 -450l-623 -600 q-18 -18 -44 -18z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -21 -10.5 -35.5t-30.5 -14.5q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455 l502 -73q56 -9 56 -46z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1137 532l306 297l-422 62l-189 382l-189 -382l-422 -62l306 -297l-73 -421l378 199l377 -199zM1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -50 -41 -50q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500 l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455l502 -73q56 -9 56 -46z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 131q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t111.5 20q9 0 42 -21.5t74.5 -48t108 -48t133.5 -21.5t133.5 21.5t108 48t74.5 48t42 21.5q61 0 111.5 -20t85.5 -53.5t62 -81 t43 -97.5t26.5 -108.5t14 -109t3.5 -103.5zM1088 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M384 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 320v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 704v128q0 26 -19 45t-45 19h-128 q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 -64v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM384 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45 t45 -19h128q26 0 45 19t19 45zM1792 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 704v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1792 320v128 q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1792 704v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1792 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19 t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1920 1248v-1344q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1344q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 512v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM768 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 512v-384q0 -52 -38 -90t-90 -38 h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 288v-192q0 -40 -28 -68t-68 -28h-320 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192 q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-960 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h960q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1671 970q0 -40 -28 -68l-724 -724l-136 -136q-28 -28 -68 -28t-68 28l-136 136l-362 362q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -295l656 657q28 28 68 28t68 -28l136 -136q28 -28 28 -68z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1298 214q0 -40 -28 -68l-136 -136q-28 -28 -68 -28t-68 28l-294 294l-294 -294q-28 -28 -68 -28t-68 28l-136 136q-28 28 -28 68t28 68l294 294l-294 294q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -294l294 294q28 28 68 28t68 -28l136 -136q28 -28 28 -68 t-28 -68l-294 -294l294 -294q28 -28 28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-224q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v224h-224q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h224v224q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5v-224h224 q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5 t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-576q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h576q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5z M1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z " /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61t-298 61t-245 164t-164 245t-61 298q0 182 80.5 343t226.5 270q43 32 95.5 25t83.5 -50q32 -42 24.5 -94.5t-49.5 -84.5q-98 -74 -151.5 -181t-53.5 -228q0 -104 40.5 -198.5t109.5 -163.5t163.5 -109.5 t198.5 -40.5t198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5q0 121 -53.5 228t-151.5 181q-42 32 -49.5 84.5t24.5 94.5q31 43 84 50t95 -25q146 -109 226.5 -270t80.5 -343zM896 1408v-640q0 -52 -38 -90t-90 -38t-90 38t-38 90v640q0 52 38 90t90 38t90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 96v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM640 224v-320q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1024 480v-576q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23 v576q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1408 864v-960q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 1376v-1472q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v1472q0 14 9 23t23 9h192q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1024 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1536 749v-222q0 -12 -8 -23t-20 -13l-185 -28q-19 -54 -39 -91q35 -50 107 -138q10 -12 10 -25t-9 -23q-27 -37 -99 -108t-94 -71q-12 0 -26 9l-138 108q-44 -23 -91 -38 q-16 -136 -29 -186q-7 -28 -36 -28h-222q-14 0 -24.5 8.5t-11.5 21.5l-28 184q-49 16 -90 37l-141 -107q-10 -9 -25 -9q-14 0 -25 11q-126 114 -165 168q-7 10 -7 23q0 12 8 23q15 21 51 66.5t54 70.5q-27 50 -41 99l-183 27q-13 2 -21 12.5t-8 23.5v222q0 12 8 23t19 13 l186 28q14 46 39 92q-40 57 -107 138q-10 12 -10 24q0 10 9 23q26 36 98.5 107.5t94.5 71.5q13 0 26 -10l138 -107q44 23 91 38q16 136 29 186q7 28 36 28h222q14 0 24.5 -8.5t11.5 -21.5l28 -184q49 -16 90 -37l142 107q9 9 24 9q13 0 25 -10q129 -119 165 -170q7 -8 7 -22 q0 -12 -8 -23q-15 -21 -51 -66.5t-54 -70.5q26 -50 41 -98l183 -28q13 -2 21 -12.5t8 -23.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM768 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1024 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1152 76v948h-896v-948q0 -22 7 -40.5t14.5 -27t10.5 -8.5h832q3 0 10.5 8.5t14.5 27t7 40.5zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832 q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 544v-480q0 -26 -19 -45t-45 -19h-384v384h-256v-384h-384q-26 0 -45 19t-19 45v480q0 1 0.5 3t0.5 3l575 474l575 -474q1 -2 1 -6zM1631 613l-62 -74q-8 -9 -21 -11h-3q-13 0 -21 7l-692 577l-692 -577q-12 -8 -24 -7q-13 2 -21 11l-62 74q-8 10 -7 23.5t11 21.5 l719 599q32 26 76 26t76 -26l244 -204v195q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-408l219 -182q10 -8 11 -21.5t-7 -23.5z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z " /> +<glyph unicode="" d="M896 992v-448q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1111 540v4l-24 320q-1 13 -11 22.5t-23 9.5h-186q-13 0 -23 -9.5t-11 -22.5l-24 -320v-4q-1 -12 8 -20t21 -8h244q12 0 21 8t8 20zM1870 73q0 -73 -46 -73h-704q13 0 22 9.5t8 22.5l-20 256q-1 13 -11 22.5t-23 9.5h-272q-13 0 -23 -9.5t-11 -22.5l-20 -256 q-1 -13 8 -22.5t22 -9.5h-704q-46 0 -46 73q0 54 26 116l417 1044q8 19 26 33t38 14h339q-13 0 -23 -9.5t-11 -22.5l-15 -192q-1 -14 8 -23t22 -9h166q13 0 22 9t8 23l-15 192q-1 13 -11 22.5t-23 9.5h339q20 0 38 -14t26 -33l417 -1044q26 -62 26 -116z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 416v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h465l135 -136 q58 -56 136 -56t136 56l136 136h464q40 0 68 -28t28 -68zM1339 985q17 -41 -14 -70l-448 -448q-18 -19 -45 -19t-45 19l-448 448q-31 29 -14 70q17 39 59 39h256v448q0 26 19 45t45 19h256q26 0 45 -19t19 -45v-448h256q42 0 59 -39z" /> +<glyph unicode="" d="M1120 608q0 -12 -10 -24l-319 -319q-11 -9 -23 -9t-23 9l-320 320q-15 16 -7 35q8 20 30 20h192v352q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-352h192q14 0 23 -9t9 -23zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273 t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1118 660q-8 -20 -30 -20h-192v-352q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v352h-192q-14 0 -23 9t-9 23q0 12 10 24l319 319q11 9 23 9t23 -9l320 -320q15 -16 7 -35zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198 t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1023 576h316q-1 3 -2.5 8t-2.5 8l-212 496h-708l-212 -496q-1 -2 -2.5 -8t-2.5 -8h316l95 -192h320zM1536 546v-482q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v482q0 62 25 123l238 552q10 25 36.5 42t52.5 17h832q26 0 52.5 -17t36.5 -42l238 -552 q25 -61 25 -123z" /> +<glyph unicode="" d="M1184 640q0 -37 -32 -55l-544 -320q-15 -9 -32 -9q-16 0 -32 8q-32 19 -32 56v640q0 37 32 56q33 18 64 -1l544 -320q32 -18 32 -55zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l138 138q-148 137 -349 137q-104 0 -198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5q119 0 225 52t179 147q7 10 23 12q14 0 25 -9 l137 -138q9 -8 9.5 -20.5t-7.5 -22.5q-109 -132 -264 -204.5t-327 -72.5q-156 0 -298 61t-245 164t-164 245t-61 298t61 298t164 245t245 164t298 61q147 0 284.5 -55.5t244.5 -156.5l130 129q29 31 70 14q39 -17 39 -59z" /> +<glyph unicode="" d="M1511 480q0 -5 -1 -7q-64 -268 -268 -434.5t-478 -166.5q-146 0 -282.5 55t-243.5 157l-129 -129q-19 -19 -45 -19t-45 19t-19 45v448q0 26 19 45t45 19h448q26 0 45 -19t19 -45t-19 -45l-137 -137q71 -66 161 -102t187 -36q134 0 250 65t186 179q11 17 53 117 q8 23 30 23h192q13 0 22.5 -9.5t9.5 -22.5zM1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-26 0 -45 19t-19 45t19 45l138 138q-148 137 -349 137q-134 0 -250 -65t-186 -179q-11 -17 -53 -117q-8 -23 -30 -23h-199q-13 0 -22.5 9.5t-9.5 22.5v7q65 268 270 434.5t480 166.5 q146 0 284 -55.5t245 -156.5l130 129q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M384 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1536 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5z M1536 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5zM1536 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5 t9.5 -22.5zM1664 160v832q0 13 -9.5 22.5t-22.5 9.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5v-832q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1792 1248v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47 t47 -113z" /> +<glyph unicode="" horiz-adv-x="1152" d="M320 768h512v192q0 106 -75 181t-181 75t-181 -75t-75 -181v-192zM1152 672v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h32v192q0 184 132 316t316 132t316 -132t132 -316v-192h32q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M320 1280q0 -72 -64 -110v-1266q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v1266q-64 38 -64 110q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -25 -12.5 -38.5t-39.5 -27.5q-215 -116 -369 -116q-61 0 -123.5 22t-108.5 48 t-115.5 48t-142.5 22q-192 0 -464 -146q-17 -9 -33 -9q-26 0 -45 19t-19 45v742q0 32 31 55q21 14 79 43q236 120 421 120q107 0 200 -29t219 -88q38 -19 88 -19q54 0 117.5 21t110 47t88 47t54.5 21q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 650q0 -166 -60 -314l-20 -49l-185 -33q-22 -83 -90.5 -136.5t-156.5 -53.5v-32q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-32q71 0 130 -35.5t93 -95.5l68 12q29 95 29 193q0 148 -88 279t-236.5 209t-315.5 78 t-315.5 -78t-236.5 -209t-88 -279q0 -98 29 -193l68 -12q34 60 93 95.5t130 35.5v32q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v32q-88 0 -156.5 53.5t-90.5 136.5l-185 33l-20 49q-60 148 -60 314q0 151 67 291t179 242.5 t266 163.5t320 61t320 -61t266 -163.5t179 -242.5t67 -291z" /> +<glyph unicode="" horiz-adv-x="768" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1152" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142zM1408 640q0 -153 -85 -282.5t-225 -188.5q-13 -5 -25 -5q-27 0 -46 19t-19 45q0 39 39 59q56 29 76 44q74 54 115.5 135.5t41.5 173.5t-41.5 173.5 t-115.5 135.5q-20 15 -76 44q-39 20 -39 59q0 26 19 45t45 19q13 0 26 -5q140 -59 225 -188.5t85 -282.5zM1664 640q0 -230 -127 -422.5t-338 -283.5q-13 -5 -26 -5q-26 0 -45 19t-19 45q0 36 39 59q7 4 22.5 10.5t22.5 10.5q46 25 82 51q123 91 192 227t69 289t-69 289 t-192 227q-36 26 -82 51q-7 4 -22.5 10.5t-22.5 10.5q-39 23 -39 59q0 26 19 45t45 19q13 0 26 -5q211 -91 338 -283.5t127 -422.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 384v-128h-128v128h128zM384 1152v-128h-128v128h128zM1152 1152v-128h-128v128h128zM128 129h384v383h-384v-383zM128 896h384v384h-384v-384zM896 896h384v384h-384v-384zM640 640v-640h-640v640h640zM1152 128v-128h-128v128h128zM1408 128v-128h-128v128h128z M1408 640v-384h-384v128h-128v-384h-128v640h384v-128h128v128h128zM640 1408v-640h-640v640h640zM1408 1408v-640h-640v640h640z" /> +<glyph unicode="" horiz-adv-x="1792" d="M63 0h-63v1408h63v-1408zM126 1h-32v1407h32v-1407zM220 1h-31v1407h31v-1407zM377 1h-31v1407h31v-1407zM534 1h-62v1407h62v-1407zM660 1h-31v1407h31v-1407zM723 1h-31v1407h31v-1407zM786 1h-31v1407h31v-1407zM943 1h-63v1407h63v-1407zM1100 1h-63v1407h63v-1407z M1226 1h-63v1407h63v-1407zM1352 1h-63v1407h63v-1407zM1446 1h-63v1407h63v-1407zM1635 1h-94v1407h94v-1407zM1698 1h-32v1407h32v-1407zM1792 0h-63v1408h63v-1408z" /> +<glyph unicode="" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1920" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91zM1899 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-36 0 -59 14t-53 45l470 470q37 37 37 90q0 52 -37 91l-715 714q-38 38 -102 64.5t-117 26.5h224q53 0 117 -26.5t102 -64.5l715 -714q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1639 1058q40 -57 18 -129l-275 -906q-19 -64 -76.5 -107.5t-122.5 -43.5h-923q-77 0 -148.5 53.5t-99.5 131.5q-24 67 -2 127q0 4 3 27t4 37q1 8 -3 21.5t-3 19.5q2 11 8 21t16.5 23.5t16.5 23.5q23 38 45 91.5t30 91.5q3 10 0.5 30t-0.5 28q3 11 17 28t17 23 q21 36 42 92t25 90q1 9 -2.5 32t0.5 28q4 13 22 30.5t22 22.5q19 26 42.5 84.5t27.5 96.5q1 8 -3 25.5t-2 26.5q2 8 9 18t18 23t17 21q8 12 16.5 30.5t15 35t16 36t19.5 32t26.5 23.5t36 11.5t47.5 -5.5l-1 -3q38 9 51 9h761q74 0 114 -56t18 -130l-274 -906 q-36 -119 -71.5 -153.5t-128.5 -34.5h-869q-27 0 -38 -15q-11 -16 -1 -43q24 -70 144 -70h923q29 0 56 15.5t35 41.5l300 987q7 22 5 57q38 -15 59 -43zM575 1056q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5 t-16.5 -22.5zM492 800q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5t-16.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289q0 34 19.5 62t52.5 41q21 9 44 9h1048z" /> +<glyph unicode="" horiz-adv-x="1664" d="M384 0h896v256h-896v-256zM384 640h896v384h-160q-40 0 -68 28t-28 68v160h-640v-640zM1536 576q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 576v-416q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-160q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68 v160h-224q-13 0 -22.5 9.5t-9.5 22.5v416q0 79 56.5 135.5t135.5 56.5h64v544q0 40 28 68t68 28h672q40 0 88 -20t76 -48l152 -152q28 -28 48 -76t20 -88v-256h64q79 0 135.5 -56.5t56.5 -135.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M960 864q119 0 203.5 -84.5t84.5 -203.5t-84.5 -203.5t-203.5 -84.5t-203.5 84.5t-84.5 203.5t84.5 203.5t203.5 84.5zM1664 1280q106 0 181 -75t75 -181v-896q0 -106 -75 -181t-181 -75h-1408q-106 0 -181 75t-75 181v896q0 106 75 181t181 75h224l51 136 q19 49 69.5 84.5t103.5 35.5h512q53 0 103.5 -35.5t69.5 -84.5l51 -136h224zM960 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M725 977l-170 -450q33 0 136.5 -2t160.5 -2q19 0 57 2q-87 253 -184 452zM0 -128l2 79q23 7 56 12.5t57 10.5t49.5 14.5t44.5 29t31 50.5l237 616l280 724h75h53q8 -14 11 -21l205 -480q33 -78 106 -257.5t114 -274.5q15 -34 58 -144.5t72 -168.5q20 -45 35 -57 q19 -15 88 -29.5t84 -20.5q6 -38 6 -57q0 -4 -0.5 -13t-0.5 -13q-63 0 -190 8t-191 8q-76 0 -215 -7t-178 -8q0 43 4 78l131 28q1 0 12.5 2.5t15.5 3.5t14.5 4.5t15 6.5t11 8t9 11t2.5 14q0 16 -31 96.5t-72 177.5t-42 100l-450 2q-26 -58 -76.5 -195.5t-50.5 -162.5 q0 -22 14 -37.5t43.5 -24.5t48.5 -13.5t57 -8.5t41 -4q1 -19 1 -58q0 -9 -2 -27q-58 0 -174.5 10t-174.5 10q-8 0 -26.5 -4t-21.5 -4q-80 -14 -188 -14z" /> +<glyph unicode="" horiz-adv-x="1408" d="M555 15q74 -32 140 -32q376 0 376 335q0 114 -41 180q-27 44 -61.5 74t-67.5 46.5t-80.5 25t-84 10.5t-94.5 2q-73 0 -101 -10q0 -53 -0.5 -159t-0.5 -158q0 -8 -1 -67.5t-0.5 -96.5t4.5 -83.5t12 -66.5zM541 761q42 -7 109 -7q82 0 143 13t110 44.5t74.5 89.5t25.5 142 q0 70 -29 122.5t-79 82t-108 43.5t-124 14q-50 0 -130 -13q0 -50 4 -151t4 -152q0 -27 -0.5 -80t-0.5 -79q0 -46 1 -69zM0 -128l2 94q15 4 85 16t106 27q7 12 12.5 27t8.5 33.5t5.5 32.5t3 37.5t0.5 34v35.5v30q0 982 -22 1025q-4 8 -22 14.5t-44.5 11t-49.5 7t-48.5 4.5 t-30.5 3l-4 83q98 2 340 11.5t373 9.5q23 0 68.5 -0.5t67.5 -0.5q70 0 136.5 -13t128.5 -42t108 -71t74 -104.5t28 -137.5q0 -52 -16.5 -95.5t-39 -72t-64.5 -57.5t-73 -45t-84 -40q154 -35 256.5 -134t102.5 -248q0 -100 -35 -179.5t-93.5 -130.5t-138 -85.5t-163.5 -48.5 t-176 -14q-44 0 -132 3t-132 3q-106 0 -307 -11t-231 -12z" /> +<glyph unicode="" horiz-adv-x="1024" d="M0 -126l17 85q6 2 81.5 21.5t111.5 37.5q28 35 41 101q1 7 62 289t114 543.5t52 296.5v25q-24 13 -54.5 18.5t-69.5 8t-58 5.5l19 103q33 -2 120 -6.5t149.5 -7t120.5 -2.5q48 0 98.5 2.5t121 7t98.5 6.5q-5 -39 -19 -89q-30 -10 -101.5 -28.5t-108.5 -33.5 q-8 -19 -14 -42.5t-9 -40t-7.5 -45.5t-6.5 -42q-27 -148 -87.5 -419.5t-77.5 -355.5q-2 -9 -13 -58t-20 -90t-16 -83.5t-6 -57.5l1 -18q17 -4 185 -31q-3 -44 -16 -99q-11 0 -32.5 -1.5t-32.5 -1.5q-29 0 -87 10t-86 10q-138 2 -206 2q-51 0 -143 -9t-121 -11z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1744 128q33 0 42 -18.5t-11 -44.5l-126 -162q-20 -26 -49 -26t-49 26l-126 162q-20 26 -11 44.5t42 18.5h80v1024h-80q-33 0 -42 18.5t11 44.5l126 162q20 26 49 26t49 -26l126 -162q20 -26 11 -44.5t-42 -18.5h-80v-1024h80zM81 1407l54 -27q12 -5 211 -5q44 0 132 2 t132 2q36 0 107.5 -0.5t107.5 -0.5h293q6 0 21 -0.5t20.5 0t16 3t17.5 9t15 17.5l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 48t-14.5 73.5t-7.5 35.5q-6 8 -12 12.5t-15.5 6t-13 2.5t-18 0.5t-16.5 -0.5 q-17 0 -66.5 0.5t-74.5 0.5t-64 -2t-71 -6q-9 -81 -8 -136q0 -94 2 -388t2 -455q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q19 42 19 383q0 101 -3 303t-3 303v117q0 2 0.5 15.5t0.5 25t-1 25.5t-3 24t-5 14q-11 12 -162 12q-33 0 -93 -12t-80 -26q-19 -13 -34 -72.5t-31.5 -111t-42.5 -53.5q-42 26 -56 44v383z" /> +<glyph unicode="" d="M81 1407l54 -27q12 -5 211 -5q44 0 132 2t132 2q70 0 246.5 1t304.5 0.5t247 -4.5q33 -1 56 31l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 47.5t-15 73.5t-7 36q-10 13 -27 19q-5 2 -66 2q-30 0 -93 1t-103 1 t-94 -2t-96 -7q-9 -81 -8 -136l1 -152v52q0 -55 1 -154t1.5 -180t0.5 -153q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q7 16 11.5 74t6 145.5t1.5 155t-0.5 153.5t-0.5 89q0 7 -2.5 21.5t-2.5 22.5q0 7 0.5 44t1 73t0 76.5t-3 67.5t-6.5 32q-11 12 -162 12q-41 0 -163 -13.5t-138 -24.5q-19 -12 -34 -71.5t-31.5 -111.5t-42.5 -54q-42 26 -56 44v383zM1310 125q12 0 42 -19.5t57.5 -41.5 t59.5 -49t36 -30q26 -21 26 -49t-26 -49q-4 -3 -36 -30t-59.5 -49t-57.5 -41.5t-42 -19.5q-13 0 -20.5 10.5t-10 28.5t-2.5 33.5t1.5 33t1.5 19.5h-1024q0 -2 1.5 -19.5t1.5 -33t-2.5 -33.5t-10 -28.5t-20.5 -10.5q-12 0 -42 19.5t-57.5 41.5t-59.5 49t-36 30q-26 21 -26 49 t26 49q4 3 36 30t59.5 49t57.5 41.5t42 19.5q13 0 20.5 -10.5t10 -28.5t2.5 -33.5t-1.5 -33t-1.5 -19.5h1024q0 2 -1.5 19.5t-1.5 33t2.5 33.5t10 28.5t20.5 10.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h896q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45t-45 -19 h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-640q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h640q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM256 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5 t9.5 -22.5zM256 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344 q13 0 22.5 -9.5t9.5 -22.5zM256 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5 t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192 q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 992v-576q0 -13 -9.5 -22.5t-22.5 -9.5q-14 0 -23 9l-288 288q-9 9 -9 23t9 23l288 288q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M352 704q0 -14 -9 -23l-288 -288q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v576q0 13 9.5 22.5t22.5 9.5q14 0 23 -9l288 -288q9 -9 9 -23zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 1184v-1088q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-403 403v-166q0 -119 -84.5 -203.5t-203.5 -84.5h-704q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h704q119 0 203.5 -84.5t84.5 -203.5v-165l403 402q18 19 45 19q12 0 25 -5 q39 -17 39 -59z" /> +<glyph unicode="" horiz-adv-x="1920" d="M640 960q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1664 576v-448h-1408v192l320 320l160 -160l512 512zM1760 1280h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-1216q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5v1216 q0 13 -9.5 22.5t-22.5 9.5zM1920 1248v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" d="M363 0l91 91l-235 235l-91 -91v-107h128v-128h107zM886 928q0 22 -22 22q-10 0 -17 -7l-542 -542q-7 -7 -7 -17q0 -22 22 -22q10 0 17 7l542 542q7 7 7 17zM832 1120l416 -416l-832 -832h-416v416zM1515 1024q0 -53 -37 -90l-166 -166l-416 416l166 165q36 38 90 38 q53 0 91 -38l235 -234q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1024" d="M768 896q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1024 896q0 -109 -33 -179l-364 -774q-16 -33 -47.5 -52t-67.5 -19t-67.5 19t-46.5 52l-365 774q-33 70 -33 179q0 212 150 362t362 150t362 -150t150 -362z" /> +<glyph unicode="" d="M768 96v1088q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 384q0 36 -20 69q-1 1 -15.5 22.5t-25.5 38t-25 44t-21 50.5q-4 16 -21 16t-21 -16q-7 -23 -21 -50.5t-25 -44t-25.5 -38t-15.5 -22.5q-20 -33 -20 -69q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 512q0 -212 -150 -362t-362 -150t-362 150t-150 362 q0 145 81 275q6 9 62.5 90.5t101 151t99.5 178t83 201.5q9 30 34 47t51 17t51.5 -17t33.5 -47q28 -93 83 -201.5t99.5 -178t101 -151t62.5 -90.5q81 -127 81 -275z" /> +<glyph unicode="" horiz-adv-x="1792" d="M888 352l116 116l-152 152l-116 -116v-56h96v-96h56zM1328 1072q-16 16 -33 -1l-350 -350q-17 -17 -1 -33t33 1l350 350q17 17 1 33zM1408 478v-190q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-14 -14 -32 -8q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v126q0 13 9 22l64 64q15 15 35 7t20 -29zM1312 1216l288 -288l-672 -672h-288v288zM1756 1084l-92 -92 l-288 288l92 92q28 28 68 28t68 -28l152 -152q28 -28 28 -68t-28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 547v-259q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h255v0q13 0 22.5 -9.5t9.5 -22.5q0 -27 -26 -32q-77 -26 -133 -60q-10 -4 -16 -4h-112q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832 q66 0 113 47t47 113v214q0 19 18 29q28 13 54 37q16 16 35 8q21 -9 21 -29zM1645 1043l-384 -384q-18 -19 -45 -19q-12 0 -25 5q-39 17 -39 59v192h-160q-323 0 -438 -131q-119 -137 -74 -473q3 -23 -20 -34q-8 -2 -12 -2q-16 0 -26 13q-10 14 -21 31t-39.5 68.5t-49.5 99.5 t-38.5 114t-17.5 122q0 49 3.5 91t14 90t28 88t47 81.5t68.5 74t94.5 61.5t124.5 48.5t159.5 30.5t196.5 11h160v192q0 42 39 59q13 5 25 5q26 0 45 -19l384 -384q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 606v-318q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-10 -10 -23 -10q-3 0 -9 2q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832 q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v254q0 13 9 22l64 64q10 10 23 10q6 0 12 -3q20 -8 20 -29zM1639 1095l-814 -814q-24 -24 -57 -24t-57 24l-430 430q-24 24 -24 57t24 57l110 110q24 24 57 24t57 -24l263 -263l647 647q24 24 57 24t57 -24l110 -110 q24 -24 24 -57t-24 -57z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-384v-384h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v384h-384v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45 t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h384v384h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45t-19 -45t-45 -19h-128v-384h384v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M979 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1747 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19l710 710 q19 19 32 13t13 -32v-710q4 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1619 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-8 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-19 19 -19 45t19 45l710 710q19 19 32 13t13 -32v-710q5 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1384 609l-1328 -738q-23 -13 -39.5 -3t-16.5 36v1472q0 26 16.5 36t39.5 -3l1328 -738q23 -13 23 -31t-23 -31z" /> +<glyph unicode="" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45zM640 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q19 -19 19 -45t-19 -45l-710 -710q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1792" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19l-710 -710 q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1024" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1538" d="M14 557l710 710q19 19 45 19t45 -19l710 -710q19 -19 13 -32t-32 -13h-1472q-26 0 -32 13t13 32zM1473 0h-1408q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1408q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1171 1235l-531 -531l531 -531q19 -19 19 -45t-19 -45l-166 -166q-19 -19 -45 -19t-45 19l-742 742q-19 19 -19 45t19 45l742 742q19 19 45 19t45 -19l166 -166q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1107 659l-742 -742q-19 -19 -45 -19t-45 19l-166 166q-19 19 -19 45t19 45l531 531l-531 531q-19 19 -19 45t19 45l166 166q19 19 45 19t45 -19l742 -742q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" d="M1216 576v128q0 26 -19 45t-45 19h-256v256q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-256h-256q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h256v-256q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v256h256q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5 t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1216 576v128q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5 t103 -385.5z" /> +<glyph unicode="" d="M1149 414q0 26 -19 45l-181 181l181 181q19 19 19 45q0 27 -19 46l-90 90q-19 19 -46 19q-26 0 -45 -19l-181 -181l-181 181q-19 19 -45 19q-27 0 -46 -19l-90 -90q-19 -19 -19 -46q0 -26 19 -45l181 -181l-181 -181q-19 -19 -19 -45q0 -27 19 -46l90 -90q19 -19 46 -19 q26 0 45 19l181 181l181 -181q19 -19 45 -19q27 0 46 19l90 90q19 19 19 46zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 802q0 28 -18 46l-91 90q-19 19 -45 19t-45 -19l-408 -407l-226 226q-19 19 -45 19t-45 -19l-91 -90q-18 -18 -18 -46q0 -27 18 -45l362 -362q19 -19 45 -19q27 0 46 19l543 543q18 18 18 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M896 160v192q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h192q14 0 23 9t9 23zM1152 832q0 88 -55.5 163t-138.5 116t-170 41q-243 0 -371 -213q-15 -24 8 -42l132 -100q7 -6 19 -6q16 0 25 12q53 68 86 92q34 24 86 24q48 0 85.5 -26t37.5 -59 q0 -38 -20 -61t-68 -45q-63 -28 -115.5 -86.5t-52.5 -125.5v-36q0 -14 9 -23t23 -9h192q14 0 23 9t9 23q0 19 21.5 49.5t54.5 49.5q32 18 49 28.5t46 35t44.5 48t28 60.5t12.5 81zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1024 160v160q0 14 -9 23t-23 9h-96v512q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h96v-320h-96q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h448q14 0 23 9t9 23zM896 1056v160q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23 t23 -9h192q14 0 23 9t9 23zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1197 512h-109q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h109q-32 108 -112.5 188.5t-188.5 112.5v-109q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v109q-108 -32 -188.5 -112.5t-112.5 -188.5h109q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-109 q32 -108 112.5 -188.5t188.5 -112.5v109q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-109q108 32 188.5 112.5t112.5 188.5zM1536 704v-128q0 -26 -19 -45t-45 -19h-143q-37 -161 -154.5 -278.5t-278.5 -154.5v-143q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v143 q-161 37 -278.5 154.5t-154.5 278.5h-143q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h143q37 161 154.5 278.5t278.5 154.5v143q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-143q161 -37 278.5 -154.5t154.5 -278.5h143q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1097 457l-146 -146q-10 -10 -23 -10t-23 10l-137 137l-137 -137q-10 -10 -23 -10t-23 10l-146 146q-10 10 -10 23t10 23l137 137l-137 137q-10 10 -10 23t10 23l146 146q10 10 23 10t23 -10l137 -137l137 137q10 10 23 10t23 -10l146 -146q10 -10 10 -23t-10 -23 l-137 -137l137 -137q10 -10 10 -23t-10 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5 t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1171 723l-422 -422q-19 -19 -45 -19t-45 19l-294 294q-19 19 -19 45t19 45l102 102q19 19 45 19t45 -19l147 -147l275 275q19 19 45 19t45 -19l102 -102q19 -19 19 -45t-19 -45zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198 t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1312 643q0 161 -87 295l-754 -753q137 -89 297 -89q111 0 211.5 43.5t173.5 116.5t116 174.5t43 212.5zM313 344l755 754q-135 91 -300 91q-148 0 -273 -73t-198 -199t-73 -274q0 -162 89 -299zM1536 643q0 -157 -61 -300t-163.5 -246t-245 -164t-298.5 -61t-298.5 61 t-245 164t-163.5 246t-61 300t61 299.5t163.5 245.5t245 164t298.5 61t298.5 -61t245 -164t163.5 -245.5t61 -299.5z" /> +<glyph unicode="" d="M1536 640v-128q0 -53 -32.5 -90.5t-84.5 -37.5h-704l293 -294q38 -36 38 -90t-38 -90l-75 -76q-37 -37 -90 -37q-52 0 -91 37l-651 652q-37 37 -37 90q0 52 37 91l651 650q38 38 91 38q52 0 90 -38l75 -74q38 -38 38 -91t-38 -91l-293 -293h704q52 0 84.5 -37.5 t32.5 -90.5z" /> +<glyph unicode="" d="M1472 576q0 -54 -37 -91l-651 -651q-39 -37 -91 -37q-51 0 -90 37l-75 75q-38 38 -38 91t38 91l293 293h-704q-52 0 -84.5 37.5t-32.5 90.5v128q0 53 32.5 90.5t84.5 37.5h704l-293 294q-38 36 -38 90t38 90l75 75q38 38 90 38q53 0 91 -38l651 -651q37 -35 37 -90z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1611 565q0 -51 -37 -90l-75 -75q-38 -38 -91 -38q-54 0 -90 38l-294 293v-704q0 -52 -37.5 -84.5t-90.5 -32.5h-128q-53 0 -90.5 32.5t-37.5 84.5v704l-294 -293q-36 -38 -90 -38t-90 38l-75 75q-38 38 -38 90q0 53 38 91l651 651q35 37 90 37q54 0 91 -37l651 -651 q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1611 704q0 -53 -37 -90l-651 -652q-39 -37 -91 -37q-53 0 -90 37l-651 652q-38 36 -38 90q0 53 38 91l74 75q39 37 91 37q53 0 90 -37l294 -294v704q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-704l294 294q37 37 90 37q52 0 91 -37l75 -75q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 896q0 -26 -19 -45l-512 -512q-19 -19 -45 -19t-45 19t-19 45v256h-224q-98 0 -175.5 -6t-154 -21.5t-133 -42.5t-105.5 -69.5t-80 -101t-48.5 -138.5t-17.5 -181q0 -55 5 -123q0 -6 2.5 -23.5t2.5 -26.5q0 -15 -8.5 -25t-23.5 -10q-16 0 -28 17q-7 9 -13 22 t-13.5 30t-10.5 24q-127 285 -127 451q0 199 53 333q162 403 875 403h224v256q0 26 19 45t45 19t45 -19l512 -512q19 -19 19 -45z" /> +<glyph unicode="" d="M755 480q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23zM1536 1344v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332 q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M768 576v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45zM1523 1248q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45 t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-416v-416q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v416h-416q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h416v416q0 40 28 68t68 28h192q40 0 68 -28t28 -68v-416h416q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-1216q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h1216q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1482 486q46 -26 59.5 -77.5t-12.5 -97.5l-64 -110q-26 -46 -77.5 -59.5t-97.5 12.5l-266 153v-307q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v307l-266 -153q-46 -26 -97.5 -12.5t-77.5 59.5l-64 110q-26 46 -12.5 97.5t59.5 77.5l266 154l-266 154 q-46 26 -59.5 77.5t12.5 97.5l64 110q26 46 77.5 59.5t97.5 -12.5l266 -153v307q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-307l266 153q46 26 97.5 12.5t77.5 -59.5l64 -110q26 -46 12.5 -97.5t-59.5 -77.5l-266 -154z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM896 161v190q0 14 -9 23.5t-22 9.5h-192q-13 0 -23 -10t-10 -23v-190q0 -13 10 -23t23 -10h192 q13 0 22 9.5t9 23.5zM894 505l18 621q0 12 -10 18q-10 8 -24 8h-220q-14 0 -24 -8q-10 -6 -10 -18l17 -621q0 -10 10 -17.5t24 -7.5h185q14 0 23.5 7.5t10.5 17.5z" /> +<glyph unicode="" d="M928 180v56v468v192h-320v-192v-468v-56q0 -25 18 -38.5t46 -13.5h192q28 0 46 13.5t18 38.5zM472 1024h195l-126 161q-26 31 -69 31q-40 0 -68 -28t-28 -68t28 -68t68 -28zM1160 1120q0 40 -28 68t-68 28q-43 0 -69 -31l-125 -161h194q40 0 68 28t28 68zM1536 864v-320 q0 -14 -9 -23t-23 -9h-96v-416q0 -40 -28 -68t-68 -28h-1088q-40 0 -68 28t-28 68v416h-96q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h440q-93 0 -158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5q107 0 168 -77l128 -165l128 165q61 77 168 77q93 0 158.5 -65.5t65.5 -158.5 t-65.5 -158.5t-158.5 -65.5h440q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 832q0 26 -19 45t-45 19q-172 0 -318 -49.5t-259.5 -134t-235.5 -219.5q-19 -21 -19 -45q0 -26 19 -45t45 -19q24 0 45 19q27 24 74 71t67 66q137 124 268.5 176t313.5 52q26 0 45 19t19 45zM1792 1030q0 -95 -20 -193q-46 -224 -184.5 -383t-357.5 -268 q-214 -108 -438 -108q-148 0 -286 47q-15 5 -88 42t-96 37q-16 0 -39.5 -32t-45 -70t-52.5 -70t-60 -32q-30 0 -51 11t-31 24t-27 42q-2 4 -6 11t-5.5 10t-3 9.5t-1.5 13.5q0 35 31 73.5t68 65.5t68 56t31 48q0 4 -14 38t-16 44q-9 51 -9 104q0 115 43.5 220t119 184.5 t170.5 139t204 95.5q55 18 145 25.5t179.5 9t178.5 6t163.5 24t113.5 56.5l29.5 29.5t29.5 28t27 20t36.5 16t43.5 4.5q39 0 70.5 -46t47.5 -112t24 -124t8 -96z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 -160v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1152 896q0 -78 -24.5 -144t-64 -112.5t-87.5 -88t-96 -77.5t-87.5 -72t-64 -81.5t-24.5 -96.5q0 -96 67 -224l-4 1l1 -1 q-90 41 -160 83t-138.5 100t-113.5 122.5t-72.5 150.5t-27.5 184q0 78 24.5 144t64 112.5t87.5 88t96 77.5t87.5 72t64 81.5t24.5 96.5q0 94 -66 224l3 -1l-1 1q90 -41 160 -83t138.5 -100t113.5 -122.5t72.5 -150.5t27.5 -184z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 576q-152 236 -381 353q61 -104 61 -225q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 121 61 225q-229 -117 -381 -353q133 -205 333.5 -326.5t434.5 -121.5t434.5 121.5t333.5 326.5zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5 t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1792 576q0 -34 -20 -69q-140 -230 -376.5 -368.5t-499.5 -138.5t-499.5 139t-376.5 368q-20 35 -20 69t20 69q140 229 376.5 368t499.5 139t499.5 -139t376.5 -368q20 -35 20 -69z" /> +<glyph unicode="" horiz-adv-x="1792" d="M555 201l78 141q-87 63 -136 159t-49 203q0 121 61 225q-229 -117 -381 -353q167 -258 427 -375zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1307 1151q0 -7 -1 -9 q-105 -188 -315 -566t-316 -567l-49 -89q-10 -16 -28 -16q-12 0 -134 70q-16 10 -16 28q0 12 44 87q-143 65 -263.5 173t-208.5 245q-20 31 -20 69t20 69q153 235 380 371t496 136q89 0 180 -17l54 97q10 16 28 16q5 0 18 -6t31 -15.5t33 -18.5t31.5 -18.5t19.5 -11.5 q16 -10 16 -27zM1344 704q0 -139 -79 -253.5t-209 -164.5l280 502q8 -45 8 -84zM1792 576q0 -35 -20 -69q-39 -64 -109 -145q-150 -172 -347.5 -267t-419.5 -95l74 132q212 18 392.5 137t301.5 307q-115 179 -282 294l63 112q95 -64 182.5 -153t144.5 -184q20 -34 20 -69z " /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 161v190q0 14 -9.5 23.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -23.5v-190q0 -14 9.5 -23.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 23.5zM1022 535l18 459q0 12 -10 19q-13 11 -24 11h-220q-11 0 -24 -11q-10 -7 -10 -21l17 -457q0 -10 10 -16.5t24 -6.5h185 q14 0 23.5 6.5t10.5 16.5zM1008 1469l768 -1408q35 -63 -2 -126q-17 -29 -46.5 -46t-63.5 -17h-1536q-34 0 -63.5 17t-46.5 46q-37 63 -2 126l768 1408q17 31 47 49t65 18t65 -18t47 -49z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1376 1376q44 -52 12 -148t-108 -172l-161 -161l160 -696q5 -19 -12 -33l-128 -96q-7 -6 -19 -6q-4 0 -7 1q-15 3 -21 16l-279 508l-259 -259l53 -194q5 -17 -8 -31l-96 -96q-9 -9 -23 -9h-2q-15 2 -24 13l-189 252l-252 189q-11 7 -13 23q-1 13 9 25l96 97q9 9 23 9 q6 0 8 -1l194 -53l259 259l-508 279q-14 8 -17 24q-2 16 9 27l128 128q14 13 30 8l665 -159l160 160q76 76 172 108t148 -12z" /> +<glyph unicode="" horiz-adv-x="1664" d="M128 -128h288v288h-288v-288zM480 -128h320v288h-320v-288zM128 224h288v320h-288v-320zM480 224h320v320h-320v-320zM128 608h288v288h-288v-288zM864 -128h320v288h-320v-288zM480 608h320v288h-320v-288zM1248 -128h288v288h-288v-288zM864 224h320v320h-320v-320z M512 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1248 224h288v320h-288v-320zM864 608h320v288h-320v-288zM1248 608h288v288h-288v-288zM1280 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64 q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47 h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M666 1055q-60 -92 -137 -273q-22 45 -37 72.5t-40.5 63.5t-51 56.5t-63 35t-81.5 14.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q250 0 410 -225zM1792 256q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v192q-32 0 -85 -0.5t-81 -1t-73 1 t-71 5t-64 10.5t-63 18.5t-58 28.5t-59 40t-55 53.5t-56 69.5q59 93 136 273q22 -45 37 -72.5t40.5 -63.5t51 -56.5t63 -35t81.5 -14.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23zM1792 1152q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5 v192h-256q-48 0 -87 -15t-69 -45t-51 -61.5t-45 -77.5q-32 -62 -78 -171q-29 -66 -49.5 -111t-54 -105t-64 -100t-74 -83t-90 -68.5t-106.5 -42t-128 -16.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q48 0 87 15t69 45t51 61.5t45 77.5q32 62 78 171q29 66 49.5 111 t54 105t64 100t74 83t90 68.5t106.5 42t128 16.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22q-17 -2 -30.5 9t-17.5 29v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51t27 59t26 76q-157 89 -247.5 220t-90.5 281 q0 130 71 248.5t191 204.5t286 136.5t348 50.5q244 0 450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" d="M1536 704v-128q0 -201 -98.5 -362t-274 -251.5t-395.5 -90.5t-395.5 90.5t-274 251.5t-98.5 362v128q0 26 19 45t45 19h384q26 0 45 -19t19 -45v-128q0 -52 23.5 -90t53.5 -57t71 -30t64 -13t44 -2t44 2t64 13t71 30t53.5 57t23.5 90v128q0 26 19 45t45 19h384 q26 0 45 -19t19 -45zM512 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45zM1536 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1683 205l-166 -165q-19 -19 -45 -19t-45 19l-531 531l-531 -531q-19 -19 -45 -19t-45 19l-166 165q-19 19 -19 45.5t19 45.5l742 741q19 19 45 19t45 -19l742 -741q19 -19 19 -45.5t-19 -45.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1683 728l-742 -741q-19 -19 -45 -19t-45 19l-742 741q-19 19 -19 45.5t19 45.5l166 165q19 19 45 19t45 -19l531 -531l531 531q19 19 45 19t45 -19l166 -165q19 -19 19 -45.5t-19 -45.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 32q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-8 0 -13.5 2t-9 7t-5.5 8t-3 11.5t-1 11.5v13v11v160v416h-192q-26 0 -45 19t-19 45q0 24 15 41l320 384q19 22 49 22t49 -22l320 -384q15 -17 15 -41q0 -26 -19 -45t-45 -19h-192v-384h576q16 0 25 -11l160 -192q7 -11 7 -21 zM1920 448q0 -24 -15 -41l-320 -384q-20 -23 -49 -23t-49 23l-320 384q-15 17 -15 41q0 26 19 45t45 19h192v384h-576q-16 0 -25 12l-160 192q-7 9 -7 20q0 13 9.5 22.5t22.5 9.5h960q8 0 13.5 -2t9 -7t5.5 -8t3 -11.5t1 -11.5v-13v-11v-160v-416h192q26 0 45 -19t19 -45z " /> +<glyph unicode="" horiz-adv-x="1664" d="M640 0q0 -52 -38 -90t-90 -38t-90 38t-38 90t38 90t90 38t90 -38t38 -90zM1536 0q0 -52 -38 -90t-90 -38t-90 38t-38 90t38 90t90 38t90 -38t38 -90zM1664 1088v-512q0 -24 -16.5 -42.5t-40.5 -21.5l-1044 -122q13 -60 13 -70q0 -16 -24 -64h920q26 0 45 -19t19 -45 t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 11 8 31.5t16 36t21.5 40t15.5 29.5l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t19.5 -15.5t13 -24.5t8 -26t5.5 -29.5t4.5 -26h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 928v-704q0 -92 -66 -158t-158 -66h-1216q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h672q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1879 584q0 -31 -31 -66l-336 -396q-43 -51 -120.5 -86.5t-143.5 -35.5h-1088q-34 0 -60.5 13t-26.5 43q0 31 31 66l336 396q43 51 120.5 86.5t143.5 35.5h1088q34 0 60.5 -13t26.5 -43zM1536 928v-160h-832q-94 0 -197 -47.5t-164 -119.5l-337 -396l-5 -6q0 4 -0.5 12.5 t-0.5 12.5v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h544q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="768" d="M704 1216q0 -26 -19 -45t-45 -19h-128v-1024h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v1024h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-1024v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h1024v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M640 640v-512h-256v512h256zM1024 1152v-1024h-256v1024h256zM2048 0v-128h-2048v1536h128v-1408h1920zM1408 896v-768h-256v768h256zM1792 1280v-1152h-256v1152h256z" /> +<glyph unicode="" d="M1280 926q-56 -25 -121 -34q68 40 93 117q-65 -38 -134 -51q-61 66 -153 66q-87 0 -148.5 -61.5t-61.5 -148.5q0 -29 5 -48q-129 7 -242 65t-192 155q-29 -50 -29 -106q0 -114 91 -175q-47 1 -100 26v-2q0 -75 50 -133.5t123 -72.5q-29 -8 -51 -8q-13 0 -39 4 q21 -63 74.5 -104t121.5 -42q-116 -90 -261 -90q-26 0 -50 3q148 -94 322 -94q112 0 210 35.5t168 95t120.5 137t75 162t24.5 168.5q0 18 -1 27q63 45 105 109zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5 t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-188v595h199l30 232h-229v148q0 56 23.5 84t91.5 28l122 1v207q-63 9 -178 9q-136 0 -217.5 -80t-81.5 -226v-171h-200v-232h200v-595h-532q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960z" /> +<glyph unicode="" horiz-adv-x="1792" d="M928 704q0 14 -9 23t-23 9q-66 0 -113 -47t-47 -113q0 -14 9 -23t23 -9t23 9t9 23q0 40 28 68t68 28q14 0 23 9t9 23zM1152 574q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM128 0h1536v128h-1536v-128zM1280 574q0 159 -112.5 271.5 t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5zM256 1216h384v128h-384v-128zM128 1024h1536v118v138h-828l-64 -128h-644v-128zM1792 1280v-1280q0 -53 -37.5 -90.5t-90.5 -37.5h-1536q-53 0 -90.5 37.5t-37.5 90.5v1280 q0 53 37.5 90.5t90.5 37.5h1536q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M832 1024q0 80 -56 136t-136 56t-136 -56t-56 -136q0 -42 19 -83q-41 19 -83 19q-80 0 -136 -56t-56 -136t56 -136t136 -56t136 56t56 136q0 42 -19 83q41 -19 83 -19q80 0 136 56t56 136zM1683 320q0 -17 -49 -66t-66 -49q-9 0 -28.5 16t-36.5 33t-38.5 40t-24.5 26 l-96 -96l220 -220q28 -28 28 -68q0 -42 -39 -81t-81 -39q-40 0 -68 28l-671 671q-176 -131 -365 -131q-163 0 -265.5 102.5t-102.5 265.5q0 160 95 313t248 248t313 95q163 0 265.5 -102.5t102.5 -265.5q0 -189 -131 -365l355 -355l96 96q-3 3 -26 24.5t-40 38.5t-33 36.5 t-16 28.5q0 17 49 66t66 49q13 0 23 -10q6 -6 46 -44.5t82 -79.5t86.5 -86t73 -78t28.5 -41z" /> +<glyph unicode="" horiz-adv-x="1920" d="M896 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1664 128q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 1152q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5zM1280 731v-185q0 -10 -7 -19.5t-16 -10.5l-155 -24q-11 -35 -32 -76q34 -48 90 -115q7 -10 7 -20q0 -12 -7 -19q-23 -30 -82.5 -89.5t-78.5 -59.5q-11 0 -21 7l-115 90q-37 -19 -77 -31q-11 -108 -23 -155q-7 -24 -30 -24h-186q-11 0 -20 7.5t-10 17.5 l-23 153q-34 10 -75 31l-118 -89q-7 -7 -20 -7q-11 0 -21 8q-144 133 -144 160q0 9 7 19q10 14 41 53t47 61q-23 44 -35 82l-152 24q-10 1 -17 9.5t-7 19.5v185q0 10 7 19.5t16 10.5l155 24q11 35 32 76q-34 48 -90 115q-7 11 -7 20q0 12 7 20q22 30 82 89t79 59q11 0 21 -7 l115 -90q34 18 77 32q11 108 23 154q7 24 30 24h186q11 0 20 -7.5t10 -17.5l23 -153q34 -10 75 -31l118 89q8 7 20 7q11 0 21 -8q144 -133 144 -160q0 -9 -7 -19q-12 -16 -42 -54t-45 -60q23 -48 34 -82l152 -23q10 -2 17 -10.5t7 -19.5zM1920 198v-140q0 -16 -149 -31 q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20 t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31zM1920 1222v-140q0 -16 -149 -31q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68 q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70 q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1408 768q0 -139 -94 -257t-256.5 -186.5t-353.5 -68.5q-86 0 -176 16q-124 -88 -278 -128q-36 -9 -86 -16h-3q-11 0 -20.5 8t-11.5 21q-1 3 -1 6.5t0.5 6.5t2 6l2.5 5t3.5 5.5t4 5t4.5 5t4 4.5q5 6 23 25t26 29.5t22.5 29t25 38.5t20.5 44q-124 72 -195 177t-71 224 q0 139 94 257t256.5 186.5t353.5 68.5t353.5 -68.5t256.5 -186.5t94 -257zM1792 512q0 -120 -71 -224.5t-195 -176.5q10 -24 20.5 -44t25 -38.5t22.5 -29t26 -29.5t23 -25q1 -1 4 -4.5t4.5 -5t4 -5t3.5 -5.5l2.5 -5t2 -6t0.5 -6.5t-1 -6.5q-3 -14 -13 -22t-22 -7 q-50 7 -86 16q-154 40 -278 128q-90 -16 -176 -16q-271 0 -472 132q58 -4 88 -4q161 0 309 45t264 129q125 92 192 212t67 254q0 77 -23 152q129 -71 204 -178t75 -230z" /> +<glyph unicode="" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 768q0 51 -39 89.5t-89 38.5h-352q0 58 48 159.5t48 160.5q0 98 -32 145t-128 47q-26 -26 -38 -85t-30.5 -125.5t-59.5 -109.5q-22 -23 -77 -91q-4 -5 -23 -30t-31.5 -41t-34.5 -42.5 t-40 -44t-38.5 -35.5t-40 -27t-35.5 -9h-32v-640h32q13 0 31.5 -3t33 -6.5t38 -11t35 -11.5t35.5 -12.5t29 -10.5q211 -73 342 -73h121q192 0 192 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5q32 1 53.5 47t21.5 81zM1536 769 q0 -89 -49 -163q9 -33 9 -69q0 -77 -38 -144q3 -21 3 -43q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5h-36h-93q-96 0 -189.5 22.5t-216.5 65.5q-116 40 -138 40h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h274q36 24 137 155q58 75 107 128 q24 25 35.5 85.5t30.5 126.5t62 108q39 37 90 37q84 0 151 -32.5t102 -101.5t35 -186q0 -93 -48 -192h176q104 0 180 -76t76 -179z" /> +<glyph unicode="" d="M256 1088q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 512q0 35 -21.5 81t-53.5 47q15 17 25 47.5t10 55.5q0 69 -53 119q18 32 18 69t-17.5 73.5t-47.5 52.5q5 30 5 56q0 85 -49 126t-136 41h-128q-131 0 -342 -73q-5 -2 -29 -10.5 t-35.5 -12.5t-35 -11.5t-38 -11t-33 -6.5t-31.5 -3h-32v-640h32q16 0 35.5 -9t40 -27t38.5 -35.5t40 -44t34.5 -42.5t31.5 -41t23 -30q55 -68 77 -91q41 -43 59.5 -109.5t30.5 -125.5t38 -85q96 0 128 47t32 145q0 59 -48 160.5t-48 159.5h352q50 0 89 38.5t39 89.5z M1536 511q0 -103 -76 -179t-180 -76h-176q48 -99 48 -192q0 -118 -35 -186q-35 -69 -102 -101.5t-151 -32.5q-51 0 -90 37q-34 33 -54 82t-25.5 90.5t-17.5 84.5t-31 64q-48 50 -107 127q-101 131 -137 155h-274q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5 h288q22 0 138 40q128 44 223 66t200 22h112q140 0 226.5 -79t85.5 -216v-5q60 -77 60 -178q0 -22 -3 -43q38 -67 38 -144q0 -36 -9 -69q49 -74 49 -163z" /> +<glyph unicode="" horiz-adv-x="896" d="M832 1504v-1339l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 940q0 81 -21.5 143t-55 98.5t-81.5 59.5t-94 31t-98 8t-112 -25.5t-110.5 -64t-86.5 -72t-60 -61.5q-18 -22 -49 -22t-49 22q-24 28 -60 61.5t-86.5 72t-110.5 64t-112 25.5t-98 -8t-94 -31t-81.5 -59.5t-55 -98.5t-21.5 -143q0 -168 187 -355l581 -560l580 559 q188 188 188 356zM1792 940q0 -221 -229 -450l-623 -600q-18 -18 -44 -18t-44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5 q224 0 351 -124t127 -344z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 96q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h320q13 0 22.5 -9.5t9.5 -22.5q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-66 0 -113 -47t-47 -113v-704 q0 -66 47 -113t113 -47h288h11h13t11.5 -1t11.5 -3t8 -5.5t7 -9t2 -13.5zM1568 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45z" /> +<glyph unicode="" d="M237 122h231v694h-231v-694zM483 1030q-1 52 -36 86t-93 34t-94.5 -34t-36.5 -86q0 -51 35.5 -85.5t92.5 -34.5h1q59 0 95 34.5t36 85.5zM1068 122h231v398q0 154 -73 233t-193 79q-136 0 -209 -117h2v101h-231q3 -66 0 -694h231v388q0 38 7 56q15 35 45 59.5t74 24.5 q116 0 116 -157v-371zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1152" d="M480 672v448q0 14 -9 23t-23 9t-23 -9t-9 -23v-448q0 -14 9 -23t23 -9t23 9t9 23zM1152 320q0 -26 -19 -45t-45 -19h-429l-51 -483q-2 -12 -10.5 -20.5t-20.5 -8.5h-1q-27 0 -32 27l-76 485h-404q-26 0 -45 19t-19 45q0 123 78.5 221.5t177.5 98.5v512q-52 0 -90 38 t-38 90t38 90t90 38h640q52 0 90 -38t38 -90t-38 -90t-90 -38v-512q99 0 177.5 -98.5t78.5 -221.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1408 608v-320q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h704q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v320 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1792 1472v-512q0 -26 -19 -45t-45 -19t-45 19l-176 176l-652 -652q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l652 652l-176 176q-19 19 -19 45t19 45t45 19h512q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1184 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45zM1536 992v-704q0 -119 -84.5 -203.5t-203.5 -84.5h-320q-13 0 -22.5 9.5t-9.5 22.5 q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q66 0 113 47t47 113v704q0 66 -47 113t-113 47h-288h-11h-13t-11.5 1t-11.5 3t-8 5.5t-7 9t-2 13.5q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M458 653q-74 162 -74 371h-256v-96q0 -78 94.5 -162t235.5 -113zM1536 928v96h-256q0 -209 -74 -371q141 29 235.5 113t94.5 162zM1664 1056v-128q0 -71 -41.5 -143t-112 -130t-173 -97.5t-215.5 -44.5q-42 -54 -95 -95q-38 -34 -52.5 -72.5t-14.5 -89.5q0 -54 30.5 -91 t97.5 -37q75 0 133.5 -45.5t58.5 -114.5v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v64q0 69 58.5 114.5t133.5 45.5q67 0 97.5 37t30.5 91q0 51 -14.5 89.5t-52.5 72.5q-53 41 -95 95q-113 5 -215.5 44.5t-173 97.5t-112 130t-41.5 143v128q0 40 28 68t68 28h288v96 q0 66 47 113t113 47h576q66 0 113 -47t47 -113v-96h288q40 0 68 -28t28 -68z" /> +<glyph unicode="" d="M394 184q-8 -9 -20 3q-13 11 -4 19q8 9 20 -3q12 -11 4 -19zM352 245q9 -12 0 -19q-8 -6 -17 7t0 18q9 7 17 -6zM291 305q-5 -7 -13 -2q-10 5 -7 12q3 5 13 2q10 -5 7 -12zM322 271q-6 -7 -16 3q-9 11 -2 16q6 6 16 -3q9 -11 2 -16zM451 159q-4 -12 -19 -6q-17 4 -13 15 t19 7q16 -5 13 -16zM514 154q0 -11 -16 -11q-17 -2 -17 11q0 11 16 11q17 2 17 -11zM572 164q2 -10 -14 -14t-18 8t14 15q16 2 18 -9zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-224q-16 0 -24.5 1t-19.5 5t-16 14.5t-5 27.5v239q0 97 -52 142q57 6 102.5 18t94 39 t81 66.5t53 105t20.5 150.5q0 121 -79 206q37 91 -8 204q-28 9 -81 -11t-92 -44l-38 -24q-93 26 -192 26t-192 -26q-16 11 -42.5 27t-83.5 38.5t-86 13.5q-44 -113 -7 -204q-79 -85 -79 -206q0 -85 20.5 -150t52.5 -105t80.5 -67t94 -39t102.5 -18q-40 -36 -49 -103 q-21 -10 -45 -15t-57 -5t-65.5 21.5t-55.5 62.5q-19 32 -48.5 52t-49.5 24l-20 3q-21 0 -29 -4.5t-5 -11.5t9 -14t13 -12l7 -5q22 -10 43.5 -38t31.5 -51l10 -23q13 -38 44 -61.5t67 -30t69.5 -7t55.5 3.5l23 4q0 -38 0.5 -103t0.5 -68q0 -22 -11 -33.5t-22 -13t-33 -1.5 h-224q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 288v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h427q21 -56 70.5 -92 t110.5 -36h256q61 0 110.5 36t70.5 92h427q40 0 68 -28t28 -68zM1339 936q-17 -40 -59 -40h-256v-448q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v448h-256q-42 0 -59 40q-17 39 14 69l448 448q18 19 45 19t45 -19l448 -448q31 -30 14 -69z" /> +<glyph unicode="" d="M1407 710q0 44 -7 113.5t-18 96.5q-12 30 -17 44t-9 36.5t-4 48.5q0 23 5 68.5t5 67.5q0 37 -10 55q-4 1 -13 1q-19 0 -58 -4.5t-59 -4.5q-60 0 -176 24t-175 24q-43 0 -94.5 -11.5t-85 -23.5t-89.5 -34q-137 -54 -202 -103q-96 -73 -159.5 -189.5t-88 -236t-24.5 -248.5 q0 -40 12.5 -120t12.5 -121q0 -23 -11 -66.5t-11 -65.5t12 -36.5t34 -14.5q24 0 72.5 11t73.5 11q57 0 169.5 -15.5t169.5 -15.5q181 0 284 36q129 45 235.5 152.5t166 245.5t59.5 275zM1535 712q0 -165 -70 -327.5t-196 -288t-281 -180.5q-124 -44 -326 -44 q-57 0 -170 14.5t-169 14.5q-24 0 -72.5 -14.5t-73.5 -14.5q-73 0 -123.5 55.5t-50.5 128.5q0 24 11 68t11 67q0 40 -12.5 120.5t-12.5 121.5q0 111 18 217.5t54.5 209.5t100.5 194t150 156q78 59 232 120q194 78 316 78q60 0 175.5 -24t173.5 -24q19 0 57 5t58 5 q81 0 118 -50.5t37 -134.5q0 -23 -5 -68t-5 -68q0 -10 1 -18.5t3 -17t4 -13.5t6.5 -16t6.5 -17q16 -40 25 -118.5t9 -136.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 296q0 -27 -10 -70.5t-21 -68.5q-21 -50 -122 -106q-94 -51 -186 -51q-27 0 -52.5 3.5t-57.5 12.5t-47.5 14.5t-55.5 20.5t-49 18q-98 35 -175 83q-128 79 -264.5 215.5t-215.5 264.5q-48 77 -83 175q-3 9 -18 49t-20.5 55.5t-14.5 47.5t-12.5 57.5t-3.5 52.5 q0 92 51 186q56 101 106 122q25 11 68.5 21t70.5 10q14 0 21 -3q18 -6 53 -76q11 -19 30 -54t35 -63.5t31 -53.5q3 -4 17.5 -25t21.5 -35.5t7 -28.5q0 -20 -28.5 -50t-62 -55t-62 -53t-28.5 -46q0 -9 5 -22.5t8.5 -20.5t14 -24t11.5 -19q76 -137 174 -235t235 -174 q2 -1 19 -11.5t24 -14t20.5 -8.5t22.5 -5q18 0 46 28.5t53 62t55 62t50 28.5q14 0 28.5 -7t35.5 -21.5t25 -17.5q25 -15 53.5 -31t63.5 -35t54 -30q70 -35 76 -53q3 -7 3 -21z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1120 1280h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v832q0 66 -47 113t-113 47zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 1280h-1024v-1242l423 406l89 85l89 -85l423 -406v1242zM1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289 q0 34 19.5 62t52.5 41q21 9 44 9h1048z" /> +<glyph unicode="" d="M1280 343q0 11 -2 16q-3 8 -38.5 29.5t-88.5 49.5l-53 29q-5 3 -19 13t-25 15t-21 5q-18 0 -47 -32.5t-57 -65.5t-44 -33q-7 0 -16.5 3.5t-15.5 6.5t-17 9.5t-14 8.5q-99 55 -170.5 126.5t-126.5 170.5q-2 3 -8.5 14t-9.5 17t-6.5 15.5t-3.5 16.5q0 13 20.5 33.5t45 38.5 t45 39.5t20.5 36.5q0 10 -5 21t-15 25t-13 19q-3 6 -15 28.5t-25 45.5t-26.5 47.5t-25 40.5t-16.5 18t-16 2q-48 0 -101 -22q-46 -21 -80 -94.5t-34 -130.5q0 -16 2.5 -34t5 -30.5t9 -33t10 -29.5t12.5 -33t11 -30q60 -164 216.5 -320.5t320.5 -216.5q6 -2 30 -11t33 -12.5 t29.5 -10t33 -9t30.5 -5t34 -2.5q57 0 130.5 34t94.5 80q22 53 22 101zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1620 1128q-67 -98 -162 -167q1 -14 1 -42q0 -130 -38 -259.5t-115.5 -248.5t-184.5 -210.5t-258 -146t-323 -54.5q-271 0 -496 145q35 -4 78 -4q225 0 401 138q-105 2 -188 64.5t-114 159.5q33 -5 61 -5q43 0 85 11q-112 23 -185.5 111.5t-73.5 205.5v4q68 -38 146 -41 q-66 44 -105 115t-39 154q0 88 44 163q121 -149 294.5 -238.5t371.5 -99.5q-8 38 -8 74q0 134 94.5 228.5t228.5 94.5q140 0 236 -102q109 21 205 78q-37 -115 -142 -178q93 10 186 50z" /> +<glyph unicode="" horiz-adv-x="1024" d="M959 1524v-264h-157q-86 0 -116 -36t-30 -108v-189h293l-39 -296h-254v-759h-306v759h-255v296h255v218q0 186 104 288.5t277 102.5q147 0 228 -12z" /> +<glyph unicode="" d="M1536 640q0 -251 -146.5 -451.5t-378.5 -277.5q-27 -5 -39.5 7t-12.5 30v211q0 97 -52 142q57 6 102.5 18t94 39t81 66.5t53 105t20.5 150.5q0 121 -79 206q37 91 -8 204q-28 9 -81 -11t-92 -44l-38 -24q-93 26 -192 26t-192 -26q-16 11 -42.5 27t-83.5 38.5t-86 13.5 q-44 -113 -7 -204q-79 -85 -79 -206q0 -85 20.5 -150t52.5 -105t80.5 -67t94 -39t102.5 -18q-40 -36 -49 -103q-21 -10 -45 -15t-57 -5t-65.5 21.5t-55.5 62.5q-19 32 -48.5 52t-49.5 24l-20 3q-21 0 -29 -4.5t-5 -11.5t9 -14t13 -12l7 -5q22 -10 43.5 -38t31.5 -51l10 -23 q13 -38 44 -61.5t67 -30t69.5 -7t55.5 3.5l23 4q0 -38 0.5 -89t0.5 -54q0 -18 -13 -30t-40 -7q-232 77 -378.5 277.5t-146.5 451.5q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 960v-256q0 -26 -19 -45t-45 -19h-64q-26 0 -45 19t-19 45v256q0 106 -75 181t-181 75t-181 -75t-75 -181v-192h96q40 0 68 -28t28 -68v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h672v192q0 185 131.5 316.5t316.5 131.5 t316.5 -131.5t131.5 -316.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1760 1408q66 0 113 -47t47 -113v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600zM160 1280q-13 0 -22.5 -9.5t-9.5 -22.5v-224h1664v224q0 13 -9.5 22.5t-22.5 9.5h-1600zM1760 0q13 0 22.5 9.5t9.5 22.5v608h-1664v-608 q0 -13 9.5 -22.5t22.5 -9.5h1600zM256 128v128h256v-128h-256zM640 128v128h384v-128h-384z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 192q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM896 69q2 -28 -17 -48q-18 -21 -47 -21h-135q-25 0 -43 16.5t-20 41.5q-22 229 -184.5 391.5t-391.5 184.5q-25 2 -41.5 20t-16.5 43v135q0 29 21 47q17 17 43 17h5q160 -13 306 -80.5 t259 -181.5q114 -113 181.5 -259t80.5 -306zM1408 67q2 -27 -18 -47q-18 -20 -46 -20h-143q-26 0 -44.5 17.5t-19.5 42.5q-12 215 -101 408.5t-231.5 336t-336 231.5t-408.5 102q-25 1 -42.5 19.5t-17.5 43.5v143q0 28 20 46q18 18 44 18h3q262 -13 501.5 -120t425.5 -294 q187 -186 294 -425.5t120 -501.5z" /> +<glyph unicode="" d="M1040 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1296 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1408 160v320q0 13 -9.5 22.5t-22.5 9.5 h-1216q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h1216q13 0 22.5 9.5t9.5 22.5zM178 640h1180l-157 482q-4 13 -16 21.5t-26 8.5h-782q-14 0 -26 -8.5t-16 -21.5zM1536 480v-320q0 -66 -47 -113t-113 -47h-1216q-66 0 -113 47t-47 113v320q0 25 16 75 l197 606q17 53 63 86t101 33h782q55 0 101 -33t63 -86l197 -606q16 -50 16 -75z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 896q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5v-384q0 -52 -38 -90t-90 -38q-417 347 -812 380q-58 -19 -91 -66t-31 -100.5t40 -92.5q-20 -33 -23 -65.5t6 -58t33.5 -55t48 -50t61.5 -50.5q-29 -58 -111.5 -83t-168.5 -11.5t-132 55.5q-7 23 -29.5 87.5 t-32 94.5t-23 89t-15 101t3.5 98.5t22 110.5h-122q-66 0 -113 47t-47 113v192q0 66 47 113t113 47h480q435 0 896 384q52 0 90 -38t38 -90v-384zM1536 292v954q-394 -302 -768 -343v-270q377 -42 768 -341z" /> +<glyph unicode="" horiz-adv-x="1792" d="M912 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM246 128h1300q-266 300 -266 832q0 51 -24 105t-69 103t-121.5 80.5t-169.5 31.5t-169.5 -31.5t-121.5 -80.5t-69 -103t-24 -105q0 -532 -266 -832z M1728 128q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -90 38t-38 90q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q190 -28 307 -158.5 t117 -282.5q0 -139 19.5 -260t50 -206t74.5 -158.5t85 -119.5t91 -88z" /> +<glyph unicode="" d="M1376 640l138 -135q30 -28 20 -70q-12 -41 -52 -51l-188 -48l53 -186q12 -41 -19 -70q-29 -31 -70 -19l-186 53l-48 -188q-10 -40 -51 -52q-12 -2 -19 -2q-31 0 -51 22l-135 138l-135 -138q-28 -30 -70 -20q-41 11 -51 52l-48 188l-186 -53q-41 -12 -70 19q-31 29 -19 70 l53 186l-188 48q-40 10 -52 51q-10 42 20 70l138 135l-138 135q-30 28 -20 70q12 41 52 51l188 48l-53 186q-12 41 19 70q29 31 70 19l186 -53l48 188q10 41 51 51q41 12 70 -19l135 -139l135 139q29 30 70 19q41 -10 51 -51l48 -188l186 53q41 12 70 -19q31 -29 19 -70 l-53 -186l188 -48q40 -10 52 -51q10 -42 -20 -70z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 768q0 51 -39 89.5t-89 38.5h-576q0 20 15 48.5t33 55t33 68t15 84.5q0 67 -44.5 97.5t-115.5 30.5q-24 0 -90 -139q-24 -44 -37 -65q-40 -64 -112 -145q-71 -81 -101 -106 q-69 -57 -140 -57h-32v-640h32q72 0 167 -32t193.5 -64t179.5 -32q189 0 189 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5h331q52 0 90 38t38 90zM1792 769q0 -105 -75.5 -181t-180.5 -76h-169q-4 -62 -37 -119q3 -21 3 -43 q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5q-133 0 -322 69q-164 59 -223 59h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h288q10 0 21.5 4.5t23.5 14t22.5 18t24 22.5t20.5 21.5t19 21.5t14 17q65 74 100 129q13 21 33 62t37 72t40.5 63t55 49.5 t69.5 17.5q125 0 206.5 -67t81.5 -189q0 -68 -22 -128h374q104 0 180 -76t76 -179z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1376 128h32v640h-32q-35 0 -67.5 12t-62.5 37t-50 46t-49 54q-2 3 -3.5 4.5t-4 4.5t-4.5 5q-72 81 -112 145q-14 22 -38 68q-1 3 -10.5 22.5t-18.5 36t-20 35.5t-21.5 30.5t-18.5 11.5q-71 0 -115.5 -30.5t-44.5 -97.5q0 -43 15 -84.5t33 -68t33 -55t15 -48.5h-576 q-50 0 -89 -38.5t-39 -89.5q0 -52 38 -90t90 -38h331q-15 -17 -25 -47.5t-10 -55.5q0 -69 53 -119q-18 -32 -18 -69t17.5 -73.5t47.5 -52.5q-4 -24 -4 -56q0 -85 48.5 -126t135.5 -41q84 0 183 32t194 64t167 32zM1664 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45 t45 -19t45 19t19 45zM1792 768v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-288q-59 0 -223 -59q-190 -69 -317 -69q-142 0 -230 77.5t-87 217.5l1 5q-61 76 -61 178q0 22 3 43q-33 57 -37 119h-169q-105 0 -180.5 76t-75.5 181q0 103 76 179t180 76h374q-22 60 -22 128 q0 122 81.5 189t206.5 67q38 0 69.5 -17.5t55 -49.5t40.5 -63t37 -72t33 -62q35 -55 100 -129q2 -3 14 -17t19 -21.5t20.5 -21.5t24 -22.5t22.5 -18t23.5 -14t21.5 -4.5h288q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" d="M1280 -64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 700q0 189 -167 189q-26 0 -56 -5q-16 30 -52.5 47.5t-73.5 17.5t-69 -18q-50 53 -119 53q-25 0 -55.5 -10t-47.5 -25v331q0 52 -38 90t-90 38q-51 0 -89.5 -39t-38.5 -89v-576 q-20 0 -48.5 15t-55 33t-68 33t-84.5 15q-67 0 -97.5 -44.5t-30.5 -115.5q0 -24 139 -90q44 -24 65 -37q64 -40 145 -112q81 -71 106 -101q57 -69 57 -140v-32h640v32q0 72 32 167t64 193.5t32 179.5zM1536 705q0 -133 -69 -322q-59 -164 -59 -223v-288q0 -53 -37.5 -90.5 t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5v288q0 10 -4.5 21.5t-14 23.5t-18 22.5t-22.5 24t-21.5 20.5t-21.5 19t-17 14q-74 65 -129 100q-21 13 -62 33t-72 37t-63 40.5t-49.5 55t-17.5 69.5q0 125 67 206.5t189 81.5q68 0 128 -22v374q0 104 76 180t179 76 q105 0 181 -75.5t76 -180.5v-169q62 -4 119 -37q21 3 43 3q101 0 178 -60q139 1 219.5 -85t80.5 -227z" /> +<glyph unicode="" d="M1408 576q0 84 -32 183t-64 194t-32 167v32h-640v-32q0 -35 -12 -67.5t-37 -62.5t-46 -50t-54 -49q-9 -8 -14 -12q-81 -72 -145 -112q-22 -14 -68 -38q-3 -1 -22.5 -10.5t-36 -18.5t-35.5 -20t-30.5 -21.5t-11.5 -18.5q0 -71 30.5 -115.5t97.5 -44.5q43 0 84.5 15t68 33 t55 33t48.5 15v-576q0 -50 38.5 -89t89.5 -39q52 0 90 38t38 90v331q46 -35 103 -35q69 0 119 53q32 -18 69 -18t73.5 17.5t52.5 47.5q24 -4 56 -4q85 0 126 48.5t41 135.5zM1280 1344q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 580 q0 -142 -77.5 -230t-217.5 -87l-5 1q-76 -61 -178 -61q-22 0 -43 3q-54 -30 -119 -37v-169q0 -105 -76 -180.5t-181 -75.5q-103 0 -179 76t-76 180v374q-54 -22 -128 -22q-121 0 -188.5 81.5t-67.5 206.5q0 38 17.5 69.5t49.5 55t63 40.5t72 37t62 33q55 35 129 100 q3 2 17 14t21.5 19t21.5 20.5t22.5 24t18 22.5t14 23.5t4.5 21.5v288q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-288q0 -59 59 -223q69 -190 69 -317z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-502l189 189q19 19 19 45t-19 45l-91 91q-18 18 -45 18t-45 -18l-362 -362l-91 -91q-18 -18 -18 -45t18 -45l91 -91l362 -362q18 -18 45 -18t45 18l91 91q18 18 18 45t-18 45l-189 189h502q26 0 45 19t19 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1285 640q0 27 -18 45l-91 91l-362 362q-18 18 -45 18t-45 -18l-91 -91q-18 -18 -18 -45t18 -45l189 -189h-502q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h502l-189 -189q-19 -19 -19 -45t19 -45l91 -91q18 -18 45 -18t45 18l362 362l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 641q0 27 -18 45l-362 362l-91 91q-18 18 -45 18t-45 -18l-91 -91l-362 -362q-18 -18 -18 -45t18 -45l91 -91q18 -18 45 -18t45 18l189 189v-502q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v502l189 -189q19 -19 45 -19t45 19l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 639q0 27 -18 45l-91 91q-18 18 -45 18t-45 -18l-189 -189v502q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-502l-189 189q-19 19 -45 19t-45 -19l-91 -91q-18 -18 -18 -45t18 -45l362 -362l91 -91q18 -18 45 -18t45 18l91 91l362 362q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM1042 887q-2 -1 -9.5 -9.5t-13.5 -9.5q2 0 4.5 5t5 11t3.5 7q6 7 22 15q14 6 52 12q34 8 51 -11 q-2 2 9.5 13t14.5 12q3 2 15 4.5t15 7.5l2 22q-12 -1 -17.5 7t-6.5 21q0 -2 -6 -8q0 7 -4.5 8t-11.5 -1t-9 -1q-10 3 -15 7.5t-8 16.5t-4 15q-2 5 -9.5 10.5t-9.5 10.5q-1 2 -2.5 5.5t-3 6.5t-4 5.5t-5.5 2.5t-7 -5t-7.5 -10t-4.5 -5q-3 2 -6 1.5t-4.5 -1t-4.5 -3t-5 -3.5 q-3 -2 -8.5 -3t-8.5 -2q15 5 -1 11q-10 4 -16 3q9 4 7.5 12t-8.5 14h5q-1 4 -8.5 8.5t-17.5 8.5t-13 6q-8 5 -34 9.5t-33 0.5q-5 -6 -4.5 -10.5t4 -14t3.5 -12.5q1 -6 -5.5 -13t-6.5 -12q0 -7 14 -15.5t10 -21.5q-3 -8 -16 -16t-16 -12q-5 -8 -1.5 -18.5t10.5 -16.5 q2 -2 1.5 -4t-3.5 -4.5t-5.5 -4t-6.5 -3.5l-3 -2q-11 -5 -20.5 6t-13.5 26q-7 25 -16 30q-23 8 -29 -1q-5 13 -41 26q-25 9 -58 4q6 1 0 15q-7 15 -19 12q3 6 4 17.5t1 13.5q3 13 12 23q1 1 7 8.5t9.5 13.5t0.5 6q35 -4 50 11q5 5 11.5 17t10.5 17q9 6 14 5.5t14.5 -5.5 t14.5 -5q14 -1 15.5 11t-7.5 20q12 -1 3 17q-5 7 -8 9q-12 4 -27 -5q-8 -4 2 -8q-1 1 -9.5 -10.5t-16.5 -17.5t-16 5q-1 1 -5.5 13.5t-9.5 13.5q-8 0 -16 -15q3 8 -11 15t-24 8q19 12 -8 27q-7 4 -20.5 5t-19.5 -4q-5 -7 -5.5 -11.5t5 -8t10.5 -5.5t11.5 -4t8.5 -3 q14 -10 8 -14q-2 -1 -8.5 -3.5t-11.5 -4.5t-6 -4q-3 -4 0 -14t-2 -14q-5 5 -9 17.5t-7 16.5q7 -9 -25 -6l-10 1q-4 0 -16 -2t-20.5 -1t-13.5 8q-4 8 0 20q1 4 4 2q-4 3 -11 9.5t-10 8.5q-46 -15 -94 -41q6 -1 12 1q5 2 13 6.5t10 5.5q34 14 42 7l5 5q14 -16 20 -25 q-7 4 -30 1q-20 -6 -22 -12q7 -12 5 -18q-4 3 -11.5 10t-14.5 11t-15 5q-16 0 -22 -1q-146 -80 -235 -222q7 -7 12 -8q4 -1 5 -9t2.5 -11t11.5 3q9 -8 3 -19q1 1 44 -27q19 -17 21 -21q3 -11 -10 -18q-1 2 -9 9t-9 4q-3 -5 0.5 -18.5t10.5 -12.5q-7 0 -9.5 -16t-2.5 -35.5 t-1 -23.5l2 -1q-3 -12 5.5 -34.5t21.5 -19.5q-13 -3 20 -43q6 -8 8 -9q3 -2 12 -7.5t15 -10t10 -10.5q4 -5 10 -22.5t14 -23.5q-2 -6 9.5 -20t10.5 -23q-1 0 -2.5 -1t-2.5 -1q3 -7 15.5 -14t15.5 -13q1 -3 2 -10t3 -11t8 -2q2 20 -24 62q-15 25 -17 29q-3 5 -5.5 15.5 t-4.5 14.5q2 0 6 -1.5t8.5 -3.5t7.5 -4t2 -3q-3 -7 2 -17.5t12 -18.5t17 -19t12 -13q6 -6 14 -19.5t0 -13.5q9 0 20 -10t17 -20q5 -8 8 -26t5 -24q2 -7 8.5 -13.5t12.5 -9.5l16 -8t13 -7q5 -2 18.5 -10.5t21.5 -11.5q10 -4 16 -4t14.5 2.5t13.5 3.5q15 2 29 -15t21 -21 q36 -19 55 -11q-2 -1 0.5 -7.5t8 -15.5t9 -14.5t5.5 -8.5q5 -6 18 -15t18 -15q6 4 7 9q-3 -8 7 -20t18 -10q14 3 14 32q-31 -15 -49 18q0 1 -2.5 5.5t-4 8.5t-2.5 8.5t0 7.5t5 3q9 0 10 3.5t-2 12.5t-4 13q-1 8 -11 20t-12 15q-5 -9 -16 -8t-16 9q0 -1 -1.5 -5.5t-1.5 -6.5 q-13 0 -15 1q1 3 2.5 17.5t3.5 22.5q1 4 5.5 12t7.5 14.5t4 12.5t-4.5 9.5t-17.5 2.5q-19 -1 -26 -20q-1 -3 -3 -10.5t-5 -11.5t-9 -7q-7 -3 -24 -2t-24 5q-13 8 -22.5 29t-9.5 37q0 10 2.5 26.5t3 25t-5.5 24.5q3 2 9 9.5t10 10.5q2 1 4.5 1.5t4.5 0t4 1.5t3 6q-1 1 -4 3 q-3 3 -4 3q7 -3 28.5 1.5t27.5 -1.5q15 -11 22 2q0 1 -2.5 9.5t-0.5 13.5q5 -27 29 -9q3 -3 15.5 -5t17.5 -5q3 -2 7 -5.5t5.5 -4.5t5 0.5t8.5 6.5q10 -14 12 -24q11 -40 19 -44q7 -3 11 -2t4.5 9.5t0 14t-1.5 12.5l-1 8v18l-1 8q-15 3 -18.5 12t1.5 18.5t15 18.5q1 1 8 3.5 t15.5 6.5t12.5 8q21 19 15 35q7 0 11 9q-1 0 -5 3t-7.5 5t-4.5 2q9 5 2 16q5 3 7.5 11t7.5 10q9 -12 21 -2q7 8 1 16q5 7 20.5 10.5t18.5 9.5q7 -2 8 2t1 12t3 12q4 5 15 9t13 5l17 11q3 4 0 4q18 -2 31 11q10 11 -6 20q3 6 -3 9.5t-15 5.5q3 1 11.5 0.5t10.5 1.5 q15 10 -7 16q-17 5 -43 -12zM879 10q206 36 351 189q-3 3 -12.5 4.5t-12.5 3.5q-18 7 -24 8q1 7 -2.5 13t-8 9t-12.5 8t-11 7q-2 2 -7 6t-7 5.5t-7.5 4.5t-8.5 2t-10 -1l-3 -1q-3 -1 -5.5 -2.5t-5.5 -3t-4 -3t0 -2.5q-21 17 -36 22q-5 1 -11 5.5t-10.5 7t-10 1.5t-11.5 -7 q-5 -5 -6 -15t-2 -13q-7 5 0 17.5t2 18.5q-3 6 -10.5 4.5t-12 -4.5t-11.5 -8.5t-9 -6.5t-8.5 -5.5t-8.5 -7.5q-3 -4 -6 -12t-5 -11q-2 4 -11.5 6.5t-9.5 5.5q2 -10 4 -35t5 -38q7 -31 -12 -48q-27 -25 -29 -40q-4 -22 12 -26q0 -7 -8 -20.5t-7 -21.5q0 -6 2 -16z" /> +<glyph unicode="" horiz-adv-x="1664" d="M384 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1028 484l-682 -682q-37 -37 -90 -37q-52 0 -91 37l-106 108q-38 36 -38 90q0 53 38 91l681 681q39 -98 114.5 -173.5t173.5 -114.5zM1662 919q0 -39 -23 -106q-47 -134 -164.5 -217.5 t-258.5 -83.5q-185 0 -316.5 131.5t-131.5 316.5t131.5 316.5t316.5 131.5q58 0 121.5 -16.5t107.5 -46.5q16 -11 16 -28t-16 -28l-293 -169v-224l193 -107q5 3 79 48.5t135.5 81t70.5 35.5q15 0 23.5 -10t8.5 -25z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 128h640v128h-640v-128zM640 640h1024v128h-1024v-128zM1280 1152h384v128h-384v-128zM1792 320v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 832v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19 t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 1344v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1403 1241q17 -41 -14 -70l-493 -493v-742q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-256 256q-19 19 -19 45v486l-493 493q-31 29 -14 70q17 39 59 39h1280q42 0 59 -39z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1280h512v128h-512v-128zM1792 640v-480q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v480h672v-160q0 -26 19 -45t45 -19h320q26 0 45 19t19 45v160h672zM1024 640v-128h-256v128h256zM1792 1120v-384h-1792v384q0 66 47 113t113 47h352v160q0 40 28 68 t68 28h576q40 0 68 -28t28 -68v-160h352q66 0 113 -47t47 -113z" /> +<glyph unicode="" d="M1283 995l-355 -355l355 -355l144 144q29 31 70 14q39 -17 39 -59v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l144 144l-355 355l-355 -355l144 -144q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l144 -144 l355 355l-355 355l-144 -144q-19 -19 -45 -19q-12 0 -24 5q-40 17 -40 59v448q0 26 19 45t45 19h448q42 0 59 -40q17 -39 -14 -69l-144 -144l355 -355l355 355l-144 144q-31 30 -14 69q17 40 59 40h448q26 0 45 -19t19 -45v-448q0 -42 -39 -59q-13 -5 -25 -5q-26 0 -45 19z " /> +<glyph unicode="" horiz-adv-x="1920" d="M593 640q-162 -5 -265 -128h-134q-82 0 -138 40.5t-56 118.5q0 353 124 353q6 0 43.5 -21t97.5 -42.5t119 -21.5q67 0 133 23q-5 -37 -5 -66q0 -139 81 -256zM1664 3q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5 t43 97.5t62 81t85.5 53.5t111.5 20q10 0 43 -21.5t73 -48t107 -48t135 -21.5t135 21.5t107 48t73 48t43 21.5q61 0 111.5 -20t85.5 -53.5t62 -81t43 -97.5t26.5 -108.5t14 -109t3.5 -103.5zM640 1280q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75 t75 -181zM1344 896q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5zM1920 671q0 -78 -56 -118.5t-138 -40.5h-134q-103 123 -265 128q81 117 81 256q0 29 -5 66q66 -23 133 -23q59 0 119 21.5t97.5 42.5 t43.5 21q124 0 124 -353zM1792 1280q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1456 320q0 40 -28 68l-208 208q-28 28 -68 28q-42 0 -72 -32q3 -3 19 -18.5t21.5 -21.5t15 -19t13 -25.5t3.5 -27.5q0 -40 -28 -68t-68 -28q-15 0 -27.5 3.5t-25.5 13t-19 15t-21.5 21.5t-18.5 19q-33 -31 -33 -73q0 -40 28 -68l206 -207q27 -27 68 -27q40 0 68 26 l147 146q28 28 28 67zM753 1025q0 40 -28 68l-206 207q-28 28 -68 28q-39 0 -68 -27l-147 -146q-28 -28 -28 -67q0 -40 28 -68l208 -208q27 -27 68 -27q42 0 72 31q-3 3 -19 18.5t-21.5 21.5t-15 19t-13 25.5t-3.5 27.5q0 40 28 68t68 28q15 0 27.5 -3.5t25.5 -13t19 -15 t21.5 -21.5t18.5 -19q33 31 33 73zM1648 320q0 -120 -85 -203l-147 -146q-83 -83 -203 -83q-121 0 -204 85l-206 207q-83 83 -83 203q0 123 88 209l-88 88q-86 -88 -208 -88q-120 0 -204 84l-208 208q-84 84 -84 204t85 203l147 146q83 83 203 83q121 0 204 -85l206 -207 q83 -83 83 -203q0 -123 -88 -209l88 -88q86 88 208 88q120 0 204 -84l208 -208q84 -84 84 -204z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088q-185 0 -316.5 131.5t-131.5 316.5q0 132 71 241.5t187 163.5q-2 28 -2 43q0 212 150 362t362 150q158 0 286.5 -88t187.5 -230q70 62 166 62q106 0 181 -75t75 -181q0 -75 -41 -138q129 -30 213 -134.5t84 -239.5z " /> +<glyph unicode="" horiz-adv-x="1664" d="M1527 88q56 -89 21.5 -152.5t-140.5 -63.5h-1152q-106 0 -140.5 63.5t21.5 152.5l503 793v399h-64q-26 0 -45 19t-19 45t19 45t45 19h512q26 0 45 -19t19 -45t-19 -45t-45 -19h-64v-399zM748 813l-272 -429h712l-272 429l-20 31v37v399h-128v-399v-37z" /> +<glyph unicode="" horiz-adv-x="1792" d="M960 640q26 0 45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45t19 45t45 19zM1260 576l507 -398q28 -20 25 -56q-5 -35 -35 -51l-128 -64q-13 -7 -29 -7q-17 0 -31 8l-690 387l-110 -66q-8 -4 -12 -5q14 -49 10 -97q-7 -77 -56 -147.5t-132 -123.5q-132 -84 -277 -84 q-136 0 -222 78q-90 84 -79 207q7 76 56 147t131 124q132 84 278 84q83 0 151 -31q9 13 22 22l122 73l-122 73q-13 9 -22 22q-68 -31 -151 -31q-146 0 -278 84q-82 53 -131 124t-56 147q-5 59 15.5 113t63.5 93q85 79 222 79q145 0 277 -84q83 -52 132 -123t56 -148 q4 -48 -10 -97q4 -1 12 -5l110 -66l690 387q14 8 31 8q16 0 29 -7l128 -64q30 -16 35 -51q3 -36 -25 -56zM579 836q46 42 21 108t-106 117q-92 59 -192 59q-74 0 -113 -36q-46 -42 -21 -108t106 -117q92 -59 192 -59q74 0 113 36zM494 91q81 51 106 117t-21 108 q-39 36 -113 36q-100 0 -192 -59q-81 -51 -106 -117t21 -108q39 -36 113 -36q100 0 192 59zM672 704l96 -58v11q0 36 33 56l14 8l-79 47l-26 -26q-3 -3 -10 -11t-12 -12q-2 -2 -4 -3.5t-3 -2.5zM896 480l96 -32l736 576l-128 64l-768 -431v-113l-160 -96l9 -8q2 -2 7 -6 q4 -4 11 -12t11 -12l26 -26zM1600 64l128 64l-520 408l-177 -138q-2 -3 -13 -7z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1696 1152q40 0 68 -28t28 -68v-1216q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v288h-544q-40 0 -68 28t-28 68v672q0 40 20 88t48 76l408 408q28 28 76 48t88 20h416q40 0 68 -28t28 -68v-328q68 40 128 40h416zM1152 939l-299 -299h299v299zM512 1323l-299 -299 h299v299zM708 676l316 316v416h-384v-416q0 -40 -28 -68t-68 -28h-416v-640h512v256q0 40 20 88t48 76zM1664 -128v1152h-384v-416q0 -40 -28 -68t-68 -28h-416v-640h896z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1404 151q0 -117 -79 -196t-196 -79q-135 0 -235 100l-777 776q-113 115 -113 271q0 159 110 270t269 111q158 0 273 -113l605 -606q10 -10 10 -22q0 -16 -30.5 -46.5t-46.5 -30.5q-13 0 -23 10l-606 607q-79 77 -181 77q-106 0 -179 -75t-73 -181q0 -105 76 -181 l776 -777q63 -63 145 -63q64 0 106 42t42 106q0 82 -63 145l-581 581q-26 24 -60 24q-29 0 -48 -19t-19 -48q0 -32 25 -59l410 -410q10 -10 10 -22q0 -16 -31 -47t-47 -31q-12 0 -22 10l-410 410q-63 61 -63 149q0 82 57 139t139 57q88 0 149 -63l581 -581q100 -98 100 -235 z" /> +<glyph unicode="" d="M384 0h768v384h-768v-384zM1280 0h128v896q0 14 -10 38.5t-20 34.5l-281 281q-10 10 -34 20t-39 10v-416q0 -40 -28 -68t-68 -28h-576q-40 0 -68 28t-28 68v416h-128v-1280h128v416q0 40 28 68t68 28h832q40 0 68 -28t28 -68v-416zM896 928v320q0 13 -9.5 22.5t-22.5 9.5 h-192q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 22.5zM1536 896v-928q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h928q40 0 88 -20t76 -48l280 -280q28 -28 48 -76t20 -88z" /> +<glyph unicode="" d="M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1536 192v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 704v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 1216v-128q0 -26 -19 -45 t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 128q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM384 640q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5 t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5zM384 1152q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1792 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z M1792 1248v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M381 -84q0 -80 -54.5 -126t-135.5 -46q-106 0 -172 66l57 88q49 -45 106 -45q29 0 50.5 14.5t21.5 42.5q0 64 -105 56l-26 56q8 10 32.5 43.5t42.5 54t37 38.5v1q-16 0 -48.5 -1t-48.5 -1v-53h-106v152h333v-88l-95 -115q51 -12 81 -49t30 -88zM383 543v-159h-362 q-6 36 -6 54q0 51 23.5 93t56.5 68t66 47.5t56.5 43.5t23.5 45q0 25 -14.5 38.5t-39.5 13.5q-46 0 -81 -58l-85 59q24 51 71.5 79.5t105.5 28.5q73 0 123 -41.5t50 -112.5q0 -50 -34 -91.5t-75 -64.5t-75.5 -50.5t-35.5 -52.5h127v60h105zM1792 224v-192q0 -13 -9.5 -22.5 t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 14 9 23t23 9h1216q13 0 22.5 -9.5t9.5 -22.5zM384 1123v-99h-335v99h107q0 41 0.5 122t0.5 121v12h-2q-8 -17 -50 -54l-71 76l136 127h106v-404h108zM1792 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5 t-9.5 22.5v192q0 14 9 23t23 9h1216q13 0 22.5 -9.5t9.5 -22.5zM1792 1248v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1760 640q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1728q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h1728zM483 704q-28 35 -51 80q-48 97 -48 188q0 181 134 309q133 127 393 127q50 0 167 -19q66 -12 177 -48q10 -38 21 -118q14 -123 14 -183q0 -18 -5 -45l-12 -3l-84 6 l-14 2q-50 149 -103 205q-88 91 -210 91q-114 0 -182 -59q-67 -58 -67 -146q0 -73 66 -140t279 -129q69 -20 173 -66q58 -28 95 -52h-743zM990 448h411q7 -39 7 -92q0 -111 -41 -212q-23 -55 -71 -104q-37 -35 -109 -81q-80 -48 -153 -66q-80 -21 -203 -21q-114 0 -195 23 l-140 40q-57 16 -72 28q-8 8 -8 22v13q0 108 -2 156q-1 30 0 68l2 37v44l102 2q15 -34 30 -71t22.5 -56t12.5 -27q35 -57 80 -94q43 -36 105 -57q59 -22 132 -22q64 0 139 27q77 26 122 86q47 61 47 129q0 84 -81 157q-34 29 -137 71z" /> +<glyph unicode="" d="M48 1313q-37 2 -45 4l-3 88q13 1 40 1q60 0 112 -4q132 -7 166 -7q86 0 168 3q116 4 146 5q56 0 86 2l-1 -14l2 -64v-9q-60 -9 -124 -9q-60 0 -79 -25q-13 -14 -13 -132q0 -13 0.5 -32.5t0.5 -25.5l1 -229l14 -280q6 -124 51 -202q35 -59 96 -92q88 -47 177 -47 q104 0 191 28q56 18 99 51q48 36 65 64q36 56 53 114q21 73 21 229q0 79 -3.5 128t-11 122.5t-13.5 159.5l-4 59q-5 67 -24 88q-34 35 -77 34l-100 -2l-14 3l2 86h84l205 -10q76 -3 196 10l18 -2q6 -38 6 -51q0 -7 -4 -31q-45 -12 -84 -13q-73 -11 -79 -17q-15 -15 -15 -41 q0 -7 1.5 -27t1.5 -31q8 -19 22 -396q6 -195 -15 -304q-15 -76 -41 -122q-38 -65 -112 -123q-75 -57 -182 -89q-109 -33 -255 -33q-167 0 -284 46q-119 47 -179 122q-61 76 -83 195q-16 80 -16 237v333q0 188 -17 213q-25 36 -147 39zM1536 -96v64q0 14 -9 23t-23 9h-1472 q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h1472q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M512 160v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM512 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 160v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23 v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM512 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 160v192 q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192 q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1664 1248v-1088q0 -66 -47 -113t-113 -47h-1344q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1344q66 0 113 -47t47 -113 z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1190 955l293 293l-107 107l-293 -293zM1637 1248q0 -27 -18 -45l-1286 -1286q-18 -18 -45 -18t-45 18l-198 198q-18 18 -18 45t18 45l1286 1286q18 18 45 18t45 -18l198 -198q18 -18 18 -45zM286 1438l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98zM636 1276 l196 -60l-196 -60l-60 -196l-60 196l-196 60l196 60l60 196zM1566 798l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98zM926 1438l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 128q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM256 640h384v256h-158q-13 0 -22 -9l-195 -195q-9 -9 -9 -22v-30zM1536 128q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM1792 1216v-1024q0 -15 -4 -26.5t-13.5 -18.5 t-16.5 -11.5t-23.5 -6t-22.5 -2t-25.5 0t-22.5 0.5q0 -106 -75 -181t-181 -75t-181 75t-75 181h-384q0 -106 -75 -181t-181 -75t-181 75t-75 181h-64q-3 0 -22.5 -0.5t-25.5 0t-22.5 2t-23.5 6t-16.5 11.5t-13.5 18.5t-4 26.5q0 26 19 45t45 19v320q0 8 -0.5 35t0 38 t2.5 34.5t6.5 37t14 30.5t22.5 30l198 198q19 19 50.5 32t58.5 13h160v192q0 26 19 45t45 19h1024q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103q-111 0 -218 32q59 93 78 164q9 34 54 211q20 -39 73 -67.5t114 -28.5q121 0 216 68.5t147 188.5t52 270q0 114 -59.5 214t-172.5 163t-255 63q-105 0 -196 -29t-154.5 -77t-109 -110.5t-67 -129.5t-21.5 -134 q0 -104 40 -183t117 -111q30 -12 38 20q2 7 8 31t8 30q6 23 -11 43q-51 61 -51 151q0 151 104.5 259.5t273.5 108.5q151 0 235.5 -82t84.5 -213q0 -170 -68.5 -289t-175.5 -119q-61 0 -98 43.5t-23 104.5q8 35 26.5 93.5t30 103t11.5 75.5q0 50 -27 83t-77 33 q-62 0 -105 -57t-43 -142q0 -73 25 -122l-99 -418q-17 -70 -13 -177q-206 91 -333 281t-127 423q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-725q85 122 108 210q9 34 53 209q21 -39 73.5 -67t112.5 -28q181 0 295.5 147.5t114.5 373.5q0 84 -35 162.5t-96.5 139t-152.5 97t-197 36.5q-104 0 -194.5 -28.5t-153 -76.5 t-107.5 -109.5t-66.5 -128t-21.5 -132.5q0 -102 39.5 -180t116.5 -110q13 -5 23.5 0t14.5 19q10 44 15 61q6 23 -11 42q-50 62 -50 150q0 150 103.5 256.5t270.5 106.5q149 0 232.5 -81t83.5 -210q0 -168 -67.5 -286t-173.5 -118q-60 0 -97 43.5t-23 103.5q8 34 26.5 92.5 t29.5 102t11 74.5q0 49 -26.5 81.5t-75.5 32.5q-61 0 -103.5 -56.5t-42.5 -139.5q0 -72 24 -121l-98 -414q-24 -100 -7 -254h-183q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960z" /> +<glyph unicode="" d="M829 318q0 -76 -58.5 -112.5t-139.5 -36.5q-41 0 -80.5 9.5t-75.5 28.5t-58 53t-22 78q0 46 25 80t65.5 51.5t82 25t84.5 7.5q20 0 31 -2q2 -1 23 -16.5t26 -19t23 -18t24.5 -22t19 -22.5t17 -26t9 -26.5t4.5 -31.5zM755 863q0 -60 -33 -99.5t-92 -39.5q-53 0 -93 42.5 t-57.5 96.5t-17.5 106q0 61 32 104t92 43q53 0 93.5 -45t58 -101t17.5 -107zM861 1120l88 64h-265q-85 0 -161 -32t-127.5 -98t-51.5 -153q0 -93 64.5 -154.5t158.5 -61.5q22 0 43 3q-13 -29 -13 -54q0 -44 40 -94q-175 -12 -257 -63q-47 -29 -75.5 -73t-28.5 -95 q0 -43 18.5 -77.5t48.5 -56.5t69 -37t77.5 -21t76.5 -6q60 0 120.5 15.5t113.5 46t86 82.5t33 117q0 49 -20 89.5t-49 66.5t-58 47.5t-49 44t-20 44.5t15.5 42.5t37.5 39.5t44 42t37.5 59.5t15.5 82.5q0 60 -22.5 99.5t-72.5 90.5h83zM1152 672h128v64h-128v128h-64v-128 h-128v-64h128v-160h64v160zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M735 740q0 -36 32 -70.5t77.5 -68t90.5 -73.5t77 -104t32 -142q0 -90 -48 -173q-72 -122 -211 -179.5t-298 -57.5q-132 0 -246.5 41.5t-171.5 137.5q-37 60 -37 131q0 81 44.5 150t118.5 115q131 82 404 100q-32 42 -47.5 74t-15.5 73q0 36 21 85q-46 -4 -68 -4 q-148 0 -249.5 96.5t-101.5 244.5q0 82 36 159t99 131q77 66 182.5 98t217.5 32h418l-138 -88h-131q74 -63 112 -133t38 -160q0 -72 -24.5 -129.5t-59 -93t-69.5 -65t-59.5 -61.5t-24.5 -66zM589 836q38 0 78 16.5t66 43.5q53 57 53 159q0 58 -17 125t-48.5 129.5 t-84.5 103.5t-117 41q-42 0 -82.5 -19.5t-65.5 -52.5q-47 -59 -47 -160q0 -46 10 -97.5t31.5 -103t52 -92.5t75 -67t96.5 -26zM591 -37q58 0 111.5 13t99 39t73 73t27.5 109q0 25 -7 49t-14.5 42t-27 41.5t-29.5 35t-38.5 34.5t-36.5 29t-41.5 30t-36.5 26q-16 2 -48 2 q-53 0 -105 -7t-107.5 -25t-97 -46t-68.5 -74.5t-27 -105.5q0 -70 35 -123.5t91.5 -83t119 -44t127.5 -14.5zM1401 839h213v-108h-213v-219h-105v219h-212v108h212v217h105v-217z" /> +<glyph unicode="" horiz-adv-x="1920" d="M768 384h384v96h-128v448h-114l-148 -137l77 -80q42 37 55 57h2v-288h-128v-96zM1280 640q0 -70 -21 -142t-59.5 -134t-101.5 -101t-138 -39t-138 39t-101.5 101t-59.5 134t-21 142t21 142t59.5 134t101.5 101t138 39t138 -39t101.5 -101t59.5 -134t21 -142zM1792 384 v512q-106 0 -181 75t-75 181h-1152q0 -106 -75 -181t-181 -75v-512q106 0 181 -75t75 -181h1152q0 106 75 181t181 75zM1920 1216v-1152q0 -26 -19 -45t-45 -19h-1792q-26 0 -45 19t-19 45v1152q0 26 19 45t45 19h1792q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 320q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M640 1088v-896q0 -26 -19 -45t-45 -19t-45 19l-448 448q-19 19 -19 45t19 45l448 448q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M576 640q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19t-19 45v896q0 26 19 45t45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M160 0h608v1152h-640v-1120q0 -13 9.5 -22.5t22.5 -9.5zM1536 32v1120h-640v-1152h608q13 0 22.5 9.5t9.5 22.5zM1664 1248v-1216q0 -66 -47 -113t-113 -47h-1344q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1344q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 448q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45zM1024 832q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 448q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 826v-794q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v794q44 -49 101 -87q362 -246 497 -345q57 -42 92.5 -65.5t94.5 -48t110 -24.5h1h1q51 0 110 24.5t94.5 48t92.5 65.5q170 123 498 345q57 39 100 87zM1792 1120q0 -79 -49 -151t-122 -123 q-376 -261 -468 -325q-10 -7 -42.5 -30.5t-54 -38t-52 -32.5t-57.5 -27t-50 -9h-1h-1q-23 0 -50 9t-57.5 27t-52 32.5t-54 38t-42.5 30.5q-91 64 -262 182.5t-205 142.5q-62 42 -117 115.5t-55 136.5q0 78 41.5 130t118.5 52h1472q65 0 112.5 -47t47.5 -113z" /> +<glyph unicode="" d="M349 911v-991h-330v991h330zM370 1217q1 -73 -50.5 -122t-135.5 -49h-2q-82 0 -132 49t-50 122q0 74 51.5 122.5t134.5 48.5t133 -48.5t51 -122.5zM1536 488v-568h-329v530q0 105 -40.5 164.5t-126.5 59.5q-63 0 -105.5 -34.5t-63.5 -85.5q-11 -30 -11 -81v-553h-329 q2 399 2 647t-1 296l-1 48h329v-144h-2q20 32 41 56t56.5 52t87 43.5t114.5 15.5q171 0 275 -113.5t104 -332.5z" /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61q-172 0 -327 72.5t-264 204.5q-7 10 -6.5 22.5t8.5 20.5l137 138q10 9 25 9q16 -2 23 -12q73 -95 179 -147t225 -52q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5 t-163.5 109.5t-198.5 40.5q-98 0 -188 -35.5t-160 -101.5l137 -138q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l130 -129q107 101 244.5 156.5t284.5 55.5q156 0 298 -61t245 -164t164 -245t61 -298z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1771 0q0 -53 -37 -90l-107 -108q-39 -37 -91 -37q-53 0 -90 37l-363 364q-38 36 -38 90q0 53 43 96l-256 256l-126 -126q-14 -14 -34 -14t-34 14q2 -2 12.5 -12t12.5 -13t10 -11.5t10 -13.5t6 -13.5t5.5 -16.5t1.5 -18q0 -38 -28 -68q-3 -3 -16.5 -18t-19 -20.5 t-18.5 -16.5t-22 -15.5t-22 -9t-26 -4.5q-40 0 -68 28l-408 408q-28 28 -28 68q0 13 4.5 26t9 22t15.5 22t16.5 18.5t20.5 19t18 16.5q30 28 68 28q10 0 18 -1.5t16.5 -5.5t13.5 -6t13.5 -10t11.5 -10t13 -12.5t12 -12.5q-14 14 -14 34t14 34l348 348q14 14 34 14t34 -14 q-2 2 -12.5 12t-12.5 13t-10 11.5t-10 13.5t-6 13.5t-5.5 16.5t-1.5 18q0 38 28 68q3 3 16.5 18t19 20.5t18.5 16.5t22 15.5t22 9t26 4.5q40 0 68 -28l408 -408q28 -28 28 -68q0 -13 -4.5 -26t-9 -22t-15.5 -22t-16.5 -18.5t-20.5 -19t-18 -16.5q-30 -28 -68 -28 q-10 0 -18 1.5t-16.5 5.5t-13.5 6t-13.5 10t-11.5 10t-13 12.5t-12 12.5q14 -14 14 -34t-14 -34l-126 -126l256 -256q43 43 96 43q52 0 91 -37l363 -363q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM576 832q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1004 351l101 382q6 26 -7.5 48.5t-38.5 29.5 t-48 -6.5t-30 -39.5l-101 -382q-60 -5 -107 -43.5t-63 -98.5q-20 -77 20 -146t117 -89t146 20t89 117q16 60 -6 117t-72 91zM1664 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 1024q0 53 -37.5 90.5 t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1472 832q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1792 384q0 -261 -141 -483q-19 -29 -54 -29h-1402q-35 0 -54 29 q-141 221 -141 483q0 182 71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1152q-204 0 -381.5 -69.5t-282 -187.5t-104.5 -255q0 -112 71.5 -213.5t201.5 -175.5l87 -50l-27 -96q-24 -91 -70 -172q152 63 275 171l43 38l57 -6q69 -8 130 -8q204 0 381.5 69.5t282 187.5t104.5 255t-104.5 255t-282 187.5t-381.5 69.5zM1792 640 q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22h-5q-15 0 -27 10.5t-16 27.5v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51t27 59t26 76q-157 89 -247.5 220t-90.5 281q0 174 120 321.5 t326 233t450 85.5t450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M704 1152q-153 0 -286 -52t-211.5 -141t-78.5 -191q0 -82 53 -158t149 -132l97 -56l-35 -84q34 20 62 39l44 31l53 -10q78 -14 153 -14q153 0 286 52t211.5 141t78.5 191t-78.5 191t-211.5 141t-286 52zM704 1280q191 0 353.5 -68.5t256.5 -186.5t94 -257t-94 -257 t-256.5 -186.5t-353.5 -68.5q-86 0 -176 16q-124 -88 -278 -128q-36 -9 -86 -16h-3q-11 0 -20.5 8t-11.5 21q-1 3 -1 6.5t0.5 6.5t2 6l2.5 5t3.5 5.5t4 5t4.5 5t4 4.5q5 6 23 25t26 29.5t22.5 29t25 38.5t20.5 44q-124 72 -195 177t-71 224q0 139 94 257t256.5 186.5 t353.5 68.5zM1526 111q10 -24 20.5 -44t25 -38.5t22.5 -29t26 -29.5t23 -25q1 -1 4 -4.5t4.5 -5t4 -5t3.5 -5.5l2.5 -5t2 -6t0.5 -6.5t-1 -6.5q-3 -14 -13 -22t-22 -7q-50 7 -86 16q-154 40 -278 128q-90 -16 -176 -16q-271 0 -472 132q58 -4 88 -4q161 0 309 45t264 129 q125 92 192 212t67 254q0 77 -23 152q129 -71 204 -178t75 -230q0 -120 -71 -224.5t-195 -176.5z" /> +<glyph unicode="" horiz-adv-x="896" d="M885 970q18 -20 7 -44l-540 -1157q-13 -25 -42 -25q-4 0 -14 2q-17 5 -25.5 19t-4.5 30l197 808l-406 -101q-4 -1 -12 -1q-18 0 -31 11q-18 15 -13 39l201 825q4 14 16 23t28 9h328q19 0 32 -12.5t13 -29.5q0 -8 -5 -18l-171 -463l396 98q8 2 12 2q19 0 34 -15z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 288v-320q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192h-512v-192h96q40 0 68 -28t28 -68v-320q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192h-512v-192h96q40 0 68 -28t28 -68v-320 q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192q0 52 38 90t90 38h512v192h-96q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h320q40 0 68 -28t28 -68v-320q0 -40 -28 -68t-68 -28h-96v-192h512q52 0 90 -38t38 -90v-192h96q40 0 68 -28t28 -68 z" /> +<glyph unicode="" horiz-adv-x="1664" d="M896 708v-580q0 -104 -76 -180t-180 -76t-180 76t-76 180q0 26 19 45t45 19t45 -19t19 -45q0 -50 39 -89t89 -39t89 39t39 89v580q33 11 64 11t64 -11zM1664 681q0 -13 -9.5 -22.5t-22.5 -9.5q-11 0 -23 10q-49 46 -93 69t-102 23q-68 0 -128 -37t-103 -97 q-7 -10 -17.5 -28t-14.5 -24q-11 -17 -28 -17q-18 0 -29 17q-4 6 -14.5 24t-17.5 28q-43 60 -102.5 97t-127.5 37t-127.5 -37t-102.5 -97q-7 -10 -17.5 -28t-14.5 -24q-11 -17 -29 -17q-17 0 -28 17q-4 6 -14.5 24t-17.5 28q-43 60 -103 97t-128 37q-58 0 -102 -23t-93 -69 q-12 -10 -23 -10q-13 0 -22.5 9.5t-9.5 22.5q0 5 1 7q45 183 172.5 319.5t298 204.5t360.5 68q140 0 274.5 -40t246.5 -113.5t194.5 -187t115.5 -251.5q1 -2 1 -7zM896 1408v-98q-42 2 -64 2t-64 -2v98q0 26 19 45t45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M768 -128h896v640h-416q-40 0 -68 28t-28 68v416h-384v-1152zM1024 1312v64q0 13 -9.5 22.5t-22.5 9.5h-704q-13 0 -22.5 -9.5t-9.5 -22.5v-64q0 -13 9.5 -22.5t22.5 -9.5h704q13 0 22.5 9.5t9.5 22.5zM1280 640h299l-299 299v-299zM1792 512v-672q0 -40 -28 -68t-68 -28 h-960q-40 0 -68 28t-28 68v160h-544q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1088q40 0 68 -28t28 -68v-328q21 -13 36 -28l408 -408q28 -28 48 -76t20 -88z" /> +<glyph unicode="" horiz-adv-x="1024" d="M736 960q0 -13 -9.5 -22.5t-22.5 -9.5t-22.5 9.5t-9.5 22.5q0 46 -54 71t-106 25q-13 0 -22.5 9.5t-9.5 22.5t9.5 22.5t22.5 9.5q50 0 99.5 -16t87 -54t37.5 -90zM896 960q0 72 -34.5 134t-90 101.5t-123 62t-136.5 22.5t-136.5 -22.5t-123 -62t-90 -101.5t-34.5 -134 q0 -101 68 -180q10 -11 30.5 -33t30.5 -33q128 -153 141 -298h228q13 145 141 298q10 11 30.5 33t30.5 33q68 79 68 180zM1024 960q0 -155 -103 -268q-45 -49 -74.5 -87t-59.5 -95.5t-34 -107.5q47 -28 47 -82q0 -37 -25 -64q25 -27 25 -64q0 -52 -45 -81q13 -23 13 -47 q0 -46 -31.5 -71t-77.5 -25q-20 -44 -60 -70t-87 -26t-87 26t-60 70q-46 0 -77.5 25t-31.5 71q0 24 13 47q-45 29 -45 81q0 37 25 64q-25 27 -25 64q0 54 47 82q-4 50 -34 107.5t-59.5 95.5t-74.5 87q-103 113 -103 268q0 99 44.5 184.5t117 142t164 89t186.5 32.5 t186.5 -32.5t164 -89t117 -142t44.5 -184.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 352v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5q-12 0 -24 10l-319 320q-9 9 -9 22q0 14 9 23l320 320q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5v-192h1376q13 0 22.5 -9.5t9.5 -22.5zM1792 896q0 -14 -9 -23l-320 -320q-9 -9 -23 -9 q-13 0 -22.5 9.5t-9.5 22.5v192h-1376q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1376v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 608q0 14 -9 23t-23 9h-224v352q0 13 -9.5 22.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -22.5v-352h-224q-13 0 -22.5 -9.5t-9.5 -22.5q0 -14 9 -23l352 -352q9 -9 23 -9t23 9l351 351q10 12 10 24zM1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088 q-185 0 -316.5 131.5t-131.5 316.5q0 130 70 240t188 165q-2 30 -2 43q0 212 150 362t362 150q156 0 285.5 -87t188.5 -231q71 62 166 62q106 0 181 -75t75 -181q0 -76 -41 -138q130 -31 213.5 -135.5t83.5 -238.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 672q0 14 -9 23l-352 352q-9 9 -23 9t-23 -9l-351 -351q-10 -12 -10 -24q0 -14 9 -23t23 -9h224v-352q0 -13 9.5 -22.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 22.5v352h224q13 0 22.5 9.5t9.5 22.5zM1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088 q-185 0 -316.5 131.5t-131.5 316.5q0 130 70 240t188 165q-2 30 -2 43q0 212 150 362t362 150q156 0 285.5 -87t188.5 -231q71 62 166 62q106 0 181 -75t75 -181q0 -76 -41 -138q130 -31 213.5 -135.5t83.5 -238.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 192q0 -26 -19 -45t-45 -19t-45 19t-19 45t19 45t45 19t45 -19t19 -45zM1408 131q0 -121 -73 -190t-194 -69h-874q-121 0 -194 69t-73 190q0 68 5.5 131t24 138t47.5 132.5t81 103t120 60.5q-22 -52 -22 -120v-203q-58 -20 -93 -70t-35 -111q0 -80 56 -136t136 -56 t136 56t56 136q0 61 -35.5 111t-92.5 70v203q0 62 25 93q132 -104 295 -104t295 104q25 -31 25 -93v-64q-106 0 -181 -75t-75 -181v-89q-32 -29 -32 -71q0 -40 28 -68t68 -28t68 28t28 68q0 42 -32 71v89q0 52 38 90t90 38t90 -38t38 -90v-89q-32 -29 -32 -71q0 -40 28 -68 t68 -28t68 28t28 68q0 42 -32 71v89q0 68 -34.5 127.5t-93.5 93.5q0 10 0.5 42.5t0 48t-2.5 41.5t-7 47t-13 40q68 -15 120 -60.5t81 -103t47.5 -132.5t24 -138t5.5 -131zM1088 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5 t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1280 832q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 832q0 -62 -35.5 -111t-92.5 -70v-395q0 -159 -131.5 -271.5t-316.5 -112.5t-316.5 112.5t-131.5 271.5v132q-164 20 -274 128t-110 252v512q0 26 19 45t45 19q6 0 16 -2q17 30 47 48 t65 18q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5q-33 0 -64 18v-402q0 -106 94 -181t226 -75t226 75t94 181v402q-31 -18 -64 -18q-53 0 -90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5q35 0 65 -18t47 -48q10 2 16 2q26 0 45 -19t19 -45v-512q0 -144 -110 -252 t-274 -128v-132q0 -106 94 -181t226 -75t226 75t94 181v395q-57 21 -92.5 70t-35.5 111q0 80 56 136t136 56t136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1152h512v128h-512v-128zM288 1152v-1280h-64q-92 0 -158 66t-66 158v832q0 92 66 158t158 66h64zM1408 1152v-1280h-1024v1280h128v160q0 40 28 68t68 28h576q40 0 68 -28t28 -68v-160h128zM1792 928v-832q0 -92 -66 -158t-158 -66h-64v1280h64q92 0 158 -66 t66 -158z" /> +<glyph unicode="" horiz-adv-x="1792" d="M912 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM1728 128q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -90 38t-38 90q50 42 91 88t85 119.5t74.5 158.5 t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q190 -28 307 -158.5t117 -282.5q0 -139 19.5 -260t50 -206t74.5 -158.5t85 -119.5t91 -88z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1664 896q0 80 -56 136t-136 56h-64v-384h64q80 0 136 56t56 136zM0 128h1792q0 -106 -75 -181t-181 -75h-1280q-106 0 -181 75t-75 181zM1856 896q0 -159 -112.5 -271.5t-271.5 -112.5h-64v-32q0 -92 -66 -158t-158 -66h-704q-92 0 -158 66t-66 158v736q0 26 19 45 t45 19h1152q159 0 271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M640 1472v-640q0 -61 -35.5 -111t-92.5 -70v-779q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v779q-57 20 -92.5 70t-35.5 111v640q0 26 19 45t45 19t45 -19t19 -45v-416q0 -26 19 -45t45 -19t45 19t19 45v416q0 26 19 45t45 19t45 -19t19 -45v-416q0 -26 19 -45 t45 -19t45 19t19 45v416q0 26 19 45t45 19t45 -19t19 -45zM1408 1472v-1600q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v512h-224q-13 0 -22.5 9.5t-9.5 22.5v800q0 132 94 226t226 94h256q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M384 736q0 14 9 23t23 9h704q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-14 0 -23 9t-9 23v64zM1120 512q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h704zM1120 256q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704 q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h704z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 -128h384v1536h-1152v-1536h384v224q0 13 9.5 22.5t22.5 9.5h320q13 0 22.5 -9.5t9.5 -22.5v-224zM1408 1472v-1664q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h1280q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 -128h384v1152h-256v-32q0 -40 -28 -68t-68 -28h-448q-40 0 -68 28t-28 68v32h-256v-1152h384v224q0 13 9.5 22.5t22.5 9.5h320q13 0 22.5 -9.5t9.5 -22.5v-224zM896 1056v320q0 13 -9.5 22.5t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-96h-128v96q0 13 -9.5 22.5 t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5v96h128v-96q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1408 1088v-1280q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1280q0 26 19 45t45 19h320 v288q0 40 28 68t68 28h448q40 0 68 -28t28 -68v-288h320q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1920" d="M640 128q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM256 640h384v256h-158q-14 -2 -22 -9l-195 -195q-7 -12 -9 -22v-30zM1536 128q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5zM1664 800v192q0 14 -9 23t-23 9h-224v224q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-224h-224q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h224v-224q0 -14 9 -23t23 -9h192q14 0 23 9t9 23v224h224q14 0 23 9t9 23zM1920 1344v-1152 q0 -26 -19 -45t-45 -19h-192q0 -106 -75 -181t-181 -75t-181 75t-75 181h-384q0 -106 -75 -181t-181 -75t-181 75t-75 181h-128q-26 0 -45 19t-19 45t19 45t45 19v416q0 26 13 58t32 51l198 198q19 19 51 32t58 13h160v320q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 416v192q0 14 -9 23t-23 9h-224v224q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-224h-224q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h224v-224q0 -14 9 -23t23 -9h192q14 0 23 9t9 23v224h224q14 0 23 9t9 23zM640 1152h512v128h-512v-128zM256 1152v-1280h-32 q-92 0 -158 66t-66 158v832q0 92 66 158t158 66h32zM1440 1152v-1280h-1088v1280h160v160q0 40 28 68t68 28h576q40 0 68 -28t28 -68v-160h160zM1792 928v-832q0 -92 -66 -158t-158 -66h-32v1280h32q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1920 576q-1 -32 -288 -96l-352 -32l-224 -64h-64l-293 -352h69q26 0 45 -4.5t19 -11.5t-19 -11.5t-45 -4.5h-96h-160h-64v32h64v416h-160l-192 -224h-96l-32 32v192h32v32h128v8l-192 24v128l192 24v8h-128v32h-32v192l32 32h96l192 -224h160v416h-64v32h64h160h96 q26 0 45 -4.5t19 -11.5t-19 -11.5t-45 -4.5h-69l293 -352h64l224 -64l352 -32q261 -58 287 -93z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 640v384h-256v-256q0 -53 37.5 -90.5t90.5 -37.5h128zM1664 192v-192h-1152v192l128 192h-128q-159 0 -271.5 112.5t-112.5 271.5v320l-64 64l32 128h480l32 128h960l32 -192l-64 -32v-800z" /> +<glyph unicode="" d="M1280 192v896q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-512v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-896q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h512v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-320v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-320q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h320v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h320q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M627 160q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23zM1011 160q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23 t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M595 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23zM979 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23 l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 224q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23zM1075 608q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393 q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 672q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23zM1075 1056q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23 t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="640" d="M627 992q0 -13 -10 -23l-393 -393l393 -393q10 -10 10 -23t-10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="640" d="M595 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 352q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 800q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1792 544v832q0 13 -9.5 22.5t-22.5 9.5h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-832q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5zM1920 1376v-1088q0 -66 -47 -113t-113 -47h-544q0 -37 16 -77.5t32 -71t16 -43.5q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19 t-19 45q0 14 16 44t32 70t16 78h-544q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1920" d="M416 256q-66 0 -113 47t-47 113v704q0 66 47 113t113 47h1088q66 0 113 -47t47 -113v-704q0 -66 -47 -113t-113 -47h-1088zM384 1120v-704q0 -13 9.5 -22.5t22.5 -9.5h1088q13 0 22.5 9.5t9.5 22.5v704q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5z M1760 192h160v-96q0 -40 -47 -68t-113 -28h-1600q-66 0 -113 28t-47 68v96h160h1600zM1040 96q16 0 16 16t-16 16h-160q-16 0 -16 -16t16 -16h160z" /> +<glyph unicode="" horiz-adv-x="1152" d="M640 128q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1024 288v960q0 13 -9.5 22.5t-22.5 9.5h-832q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h832q13 0 22.5 9.5t9.5 22.5zM1152 1248v-1088q0 -66 -47 -113t-113 -47h-832 q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h832q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="768" d="M464 128q0 33 -23.5 56.5t-56.5 23.5t-56.5 -23.5t-23.5 -56.5t23.5 -56.5t56.5 -23.5t56.5 23.5t23.5 56.5zM672 288v704q0 13 -9.5 22.5t-22.5 9.5h-512q-13 0 -22.5 -9.5t-9.5 -22.5v-704q0 -13 9.5 -22.5t22.5 -9.5h512q13 0 22.5 9.5t9.5 22.5zM480 1136 q0 16 -16 16h-160q-16 0 -16 -16t16 -16h160q16 0 16 16zM768 1152v-1024q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v1024q0 52 38 90t90 38h512q52 0 90 -38t38 -90z" /> +<glyph unicode="" d="M768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103 t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 -181v-32q0 -40 28 -68t68 -28h224q80 0 136 -56t56 -136z M1664 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 -181v-32q0 -40 28 -68t68 -28h224q80 0 136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 1216v-704q0 -104 -40.5 -198.5t-109.5 -163.5t-163.5 -109.5t-198.5 -40.5h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64q106 0 181 75t75 181v32q0 40 -28 68t-68 28h-224q-80 0 -136 56t-56 136v384q0 80 56 136t136 56h384q80 0 136 -56t56 -136zM1664 1216 v-704q0 -104 -40.5 -198.5t-109.5 -163.5t-163.5 -109.5t-198.5 -40.5h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64q106 0 181 75t75 181v32q0 40 -28 68t-68 28h-224q-80 0 -136 56t-56 136v384q0 80 56 136t136 56h384q80 0 136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1792" d="M526 142q0 -53 -37.5 -90.5t-90.5 -37.5q-52 0 -90 38t-38 90q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1024 -64q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM320 640q0 -53 -37.5 -90.5t-90.5 -37.5 t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1522 142q0 -52 -38 -90t-90 -38q-53 0 -90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM558 1138q0 -66 -47 -113t-113 -47t-113 47t-47 113t47 113t113 47t113 -47t47 -113z M1728 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1088 1344q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1618 1138q0 -93 -66 -158.5t-158 -65.5q-93 0 -158.5 65.5t-65.5 158.5 q0 92 65.5 158t158.5 66q92 0 158 -66t66 -158z" /> +<glyph unicode="" d="M1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 416q0 -166 -127 -451q-3 -7 -10.5 -24t-13.5 -30t-13 -22q-12 -17 -28 -17q-15 0 -23.5 10t-8.5 25q0 9 2.5 26.5t2.5 23.5q5 68 5 123q0 101 -17.5 181t-48.5 138.5t-80 101t-105.5 69.5t-133 42.5t-154 21.5t-175.5 6h-224v-256q0 -26 -19 -45t-45 -19t-45 19 l-512 512q-19 19 -19 45t19 45l512 512q19 19 45 19t45 -19t19 -45v-256h224q713 0 875 -403q53 -134 53 -333z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 320q0 -40 -12.5 -82t-43 -76t-72.5 -34t-72.5 34t-43 76t-12.5 82t12.5 82t43 76t72.5 34t72.5 -34t43 -76t12.5 -82zM1280 320q0 -40 -12.5 -82t-43 -76t-72.5 -34t-72.5 34t-43 76t-12.5 82t12.5 82t43 76t72.5 34t72.5 -34t43 -76t12.5 -82zM1440 320 q0 120 -69 204t-187 84q-41 0 -195 -21q-71 -11 -157 -11t-157 11q-152 21 -195 21q-118 0 -187 -84t-69 -204q0 -88 32 -153.5t81 -103t122 -60t140 -29.5t149 -7h168q82 0 149 7t140 29.5t122 60t81 103t32 153.5zM1664 496q0 -207 -61 -331q-38 -77 -105.5 -133t-141 -86 t-170 -47.5t-171.5 -22t-167 -4.5q-78 0 -142 3t-147.5 12.5t-152.5 30t-137 51.5t-121 81t-86 115q-62 123 -62 331q0 237 136 396q-27 82 -27 170q0 116 51 218q108 0 190 -39.5t189 -123.5q147 35 309 35q148 0 280 -32q105 82 187 121t189 39q51 -102 51 -218 q0 -87 -27 -168q136 -160 136 -398z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1536 224v704q0 40 -28 68t-68 28h-704q-40 0 -68 28t-28 68v64q0 40 -28 68t-68 28h-320q-40 0 -68 -28t-28 -68v-960q0 -40 28 -68t68 -28h1216q40 0 68 28t28 68zM1664 928v-704q0 -92 -66 -158t-158 -66h-1216q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320 q92 0 158 -66t66 -158v-32h672q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1781 605q0 35 -53 35h-1088q-40 0 -85.5 -21.5t-71.5 -52.5l-294 -363q-18 -24 -18 -40q0 -35 53 -35h1088q40 0 86 22t71 53l294 363q18 22 18 39zM640 768h768v160q0 40 -28 68t-68 28h-576q-40 0 -68 28t-28 68v64q0 40 -28 68t-68 28h-320q-40 0 -68 -28t-28 -68 v-853l256 315q44 53 116 87.5t140 34.5zM1909 605q0 -62 -46 -120l-295 -363q-43 -53 -116 -87.5t-140 -34.5h-1088q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h544q92 0 158 -66t66 -158v-160h192q54 0 99 -24.5t67 -70.5q15 -32 15 -68z " /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" d="M1134 461q-37 -121 -138 -195t-228 -74t-228 74t-138 195q-8 25 4 48.5t38 31.5q25 8 48.5 -4t31.5 -38q25 -80 92.5 -129.5t151.5 -49.5t151.5 49.5t92.5 129.5q8 26 32 38t49 4t37 -31.5t4 -48.5zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5 t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1134 307q8 -25 -4 -48.5t-37 -31.5t-49 4t-32 38q-25 80 -92.5 129.5t-151.5 49.5t-151.5 -49.5t-92.5 -129.5q-8 -26 -31.5 -38t-48.5 -4q-26 8 -38 31.5t-4 48.5q37 121 138 195t228 74t228 -74t138 -195zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204 t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1152 448q0 -26 -19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h640q26 0 45 -19t19 -45zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M832 448v128q0 14 -9 23t-23 9h-192v192q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-192h-192q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h192v-192q0 -14 9 -23t23 -9h128q14 0 23 9t9 23v192h192q14 0 23 9t9 23zM1408 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1920 512q0 -212 -150 -362t-362 -150q-192 0 -338 128h-220q-146 -128 -338 -128q-212 0 -362 150 t-150 362t150 362t362 150h896q212 0 362 -150t150 -362z" /> +<glyph unicode="" horiz-adv-x="1920" d="M384 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM512 624v-96q0 -16 -16 -16h-224q-16 0 -16 16v96q0 16 16 16h224q16 0 16 -16zM384 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1408 368v-96q0 -16 -16 -16 h-864q-16 0 -16 16v96q0 16 16 16h864q16 0 16 -16zM768 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM640 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1024 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16 h96q16 0 16 -16zM896 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1280 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1664 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1152 880v-96 q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1408 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1664 880v-352q0 -16 -16 -16h-224q-16 0 -16 16v96q0 16 16 16h112v240q0 16 16 16h96q16 0 16 -16zM1792 128v896h-1664v-896 h1664zM1920 1024v-896q0 -53 -37.5 -90.5t-90.5 -37.5h-1664q-53 0 -90.5 37.5t-37.5 90.5v896q0 53 37.5 90.5t90.5 37.5h1664q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 491v616q-169 -91 -306 -91q-82 0 -145 32q-100 49 -184 76.5t-178 27.5q-173 0 -403 -127v-599q245 113 433 113q55 0 103.5 -7.5t98 -26t77 -31t82.5 -39.5l28 -14q44 -22 101 -22q120 0 293 92zM320 1280q0 -35 -17.5 -64t-46.5 -46v-1266q0 -14 -9 -23t-23 -9 h-64q-14 0 -23 9t-9 23v1266q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -39 -35 -57q-10 -5 -17 -9q-218 -116 -369 -116q-88 0 -158 35l-28 14q-64 33 -99 48t-91 29t-114 14q-102 0 -235.5 -44t-228.5 -102 q-15 -9 -33 -9q-16 0 -32 8q-32 19 -32 56v742q0 35 31 55q35 21 78.5 42.5t114 52t152.5 49.5t155 19q112 0 209 -31t209 -86q38 -19 89 -19q122 0 310 112q22 12 31 17q31 16 62 -2q31 -20 31 -55z" /> +<glyph unicode="" horiz-adv-x="1792" d="M832 536v192q-181 -16 -384 -117v-185q205 96 384 110zM832 954v197q-172 -8 -384 -126v-189q215 111 384 118zM1664 491v184q-235 -116 -384 -71v224q-20 6 -39 15q-5 3 -33 17t-34.5 17t-31.5 15t-34.5 15.5t-32.5 13t-36 12.5t-35 8.5t-39.5 7.5t-39.5 4t-44 2 q-23 0 -49 -3v-222h19q102 0 192.5 -29t197.5 -82q19 -9 39 -15v-188q42 -17 91 -17q120 0 293 92zM1664 918v189q-169 -91 -306 -91q-45 0 -78 8v-196q148 -42 384 90zM320 1280q0 -35 -17.5 -64t-46.5 -46v-1266q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v1266 q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -39 -35 -57q-10 -5 -17 -9q-218 -116 -369 -116q-88 0 -158 35l-28 14q-64 33 -99 48t-91 29t-114 14q-102 0 -235.5 -44t-228.5 -102q-15 -9 -33 -9q-16 0 -32 8 q-32 19 -32 56v742q0 35 31 55q35 21 78.5 42.5t114 52t152.5 49.5t155 19q112 0 209 -31t209 -86q38 -19 89 -19q122 0 310 112q22 12 31 17q31 16 62 -2q31 -20 31 -55z" /> +<glyph unicode="" horiz-adv-x="1664" d="M585 553l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23t-10 -23zM1664 96v-64q0 -14 -9 -23t-23 -9h-960q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h960q14 0 23 -9 t9 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M617 137l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23t-10 -23zM1208 1204l-373 -1291q-4 -13 -15.5 -19.5t-23.5 -2.5l-62 17q-13 4 -19.5 15.5t-2.5 24.5 l373 1291q4 13 15.5 19.5t23.5 2.5l62 -17q13 -4 19.5 -15.5t2.5 -24.5zM1865 553l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23t-10 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 454v-70q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-512 512q-19 19 -19 45t19 45l512 512q29 31 70 14q39 -17 39 -59v-69l-397 -398q-19 -19 -19 -45t19 -45zM1792 416q0 -58 -17 -133.5t-38.5 -138t-48 -125t-40.5 -90.5l-20 -40q-8 -17 -28 -17q-6 0 -9 1 q-25 8 -23 34q43 400 -106 565q-64 71 -170.5 110.5t-267.5 52.5v-251q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-512 512q-19 19 -19 45t19 45l512 512q29 31 70 14q39 -17 39 -59v-262q411 -28 599 -221q169 -173 169 -509z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1186 579l257 250l-356 52l-66 10l-30 60l-159 322v-963l59 -31l318 -168l-60 355l-12 66zM1638 841l-363 -354l86 -500q5 -33 -6 -51.5t-34 -18.5q-17 0 -40 12l-449 236l-449 -236q-23 -12 -40 -12q-23 0 -34 18.5t-6 51.5l86 500l-364 354q-32 32 -23 59.5t54 34.5 l502 73l225 455q20 41 49 41q28 0 49 -41l225 -455l502 -73q45 -7 54 -34.5t-24 -59.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1401 1187l-640 -1280q-17 -35 -57 -35q-5 0 -15 2q-22 5 -35.5 22.5t-13.5 39.5v576h-576q-22 0 -39.5 13.5t-22.5 35.5t4 42t29 30l1280 640q13 7 29 7q27 0 45 -19q15 -14 18.5 -34.5t-6.5 -39.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M557 256h595v595zM512 301l595 595h-595v-595zM1664 224v-192q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v224h-864q-14 0 -23 9t-9 23v864h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224v224q0 14 9 23t23 9h192q14 0 23 -9t9 -23 v-224h851l246 247q10 9 23 9t23 -9q9 -10 9 -23t-9 -23l-247 -246v-851h224q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M288 64q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM288 1216q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM928 1088q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1024 1088q0 -52 -26 -96.5t-70 -69.5 q-2 -287 -226 -414q-68 -38 -203 -81q-128 -40 -169.5 -71t-41.5 -100v-26q44 -25 70 -69.5t26 -96.5q0 -80 -56 -136t-136 -56t-136 56t-56 136q0 52 26 96.5t70 69.5v820q-44 25 -70 69.5t-26 96.5q0 80 56 136t136 56t136 -56t56 -136q0 -52 -26 -96.5t-70 -69.5v-497 q54 26 154 57q55 17 87.5 29.5t70.5 31t59 39.5t40.5 51t28 69.5t8.5 91.5q-44 25 -70 69.5t-26 96.5q0 80 56 136t136 56t136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1664" d="M439 265l-256 -256q-10 -9 -23 -9q-12 0 -23 9q-9 10 -9 23t9 23l256 256q10 9 23 9t23 -9q9 -10 9 -23t-9 -23zM608 224v-320q0 -14 -9 -23t-23 -9t-23 9t-9 23v320q0 14 9 23t23 9t23 -9t9 -23zM384 448q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23t9 23t23 9h320 q14 0 23 -9t9 -23zM1648 320q0 -120 -85 -203l-147 -146q-83 -83 -203 -83q-121 0 -204 85l-334 335q-21 21 -42 56l239 18l273 -274q27 -27 68 -27.5t68 26.5l147 146q28 28 28 67q0 40 -28 68l-274 275l18 239q35 -21 56 -42l336 -336q84 -86 84 -204zM1031 1044l-239 -18 l-273 274q-28 28 -68 28q-39 0 -68 -27l-147 -146q-28 -28 -28 -67q0 -40 28 -68l274 -274l-18 -240q-35 21 -56 42l-336 336q-84 86 -84 204q0 120 85 203l147 146q83 83 203 83q121 0 204 -85l334 -335q21 -21 42 -56zM1664 960q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9 t-9 23t9 23t23 9h320q14 0 23 -9t9 -23zM1120 1504v-320q0 -14 -9 -23t-23 -9t-23 9t-9 23v320q0 14 9 23t23 9t23 -9t9 -23zM1527 1353l-256 -256q-11 -9 -23 -9t-23 9q-9 10 -9 23t9 23l256 256q10 9 23 9t23 -9q9 -10 9 -23t-9 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M704 280v-240q0 -16 -12 -28t-28 -12h-240q-16 0 -28 12t-12 28v240q0 16 12 28t28 12h240q16 0 28 -12t12 -28zM1020 880q0 -54 -15.5 -101t-35 -76.5t-55 -59.5t-57.5 -43.5t-61 -35.5q-41 -23 -68.5 -65t-27.5 -67q0 -17 -12 -32.5t-28 -15.5h-240q-15 0 -25.5 18.5 t-10.5 37.5v45q0 83 65 156.5t143 108.5q59 27 84 56t25 76q0 42 -46.5 74t-107.5 32q-65 0 -108 -29q-35 -25 -107 -115q-13 -16 -31 -16q-12 0 -25 8l-164 125q-13 10 -15.5 25t5.5 28q160 266 464 266q80 0 161 -31t146 -83t106 -127.5t41 -158.5z" /> +<glyph unicode="" horiz-adv-x="640" d="M640 192v-128q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64v384h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h384q26 0 45 -19t19 -45v-576h64q26 0 45 -19t19 -45zM512 1344v-192q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v192 q0 26 19 45t45 19h256q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M512 288v-224q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v224q0 26 19 45t45 19h256q26 0 45 -19t19 -45zM542 1344l-28 -768q-1 -26 -20.5 -45t-45.5 -19h-256q-26 0 -45.5 19t-20.5 45l-28 768q-1 26 17.5 45t44.5 19h320q26 0 44.5 -19t17.5 -45z" /> +<glyph unicode="" d="M897 167v-167h-248l-159 252l-24 42q-8 9 -11 21h-3l-9 -21q-10 -20 -25 -44l-155 -250h-258v167h128l197 291l-185 272h-137v168h276l139 -228q2 -4 23 -42q8 -9 11 -21h3q3 9 11 21l25 42l140 228h257v-168h-125l-184 -267l204 -296h109zM1534 846v-206h-514l-3 27 q-4 28 -4 46q0 64 26 117t65 86.5t84 65t84 54.5t65 54t26 64q0 38 -29.5 62.5t-70.5 24.5q-51 0 -97 -39q-14 -11 -36 -38l-105 92q26 37 63 66q83 65 188 65q110 0 178 -59.5t68 -158.5q0 -56 -24.5 -103t-62 -76.5t-81.5 -58.5t-82 -50.5t-65.5 -51.5t-30.5 -63h232v80 h126z" /> +<glyph unicode="" d="M897 167v-167h-248l-159 252l-24 42q-8 9 -11 21h-3l-9 -21q-10 -20 -25 -44l-155 -250h-258v167h128l197 291l-185 272h-137v168h276l139 -228q2 -4 23 -42q8 -9 11 -21h3q3 9 11 21l25 42l140 228h257v-168h-125l-184 -267l204 -296h109zM1536 -50v-206h-514l-4 27 q-3 45 -3 46q0 64 26 117t65 86.5t84 65t84 54.5t65 54t26 64q0 38 -29.5 62.5t-70.5 24.5q-51 0 -97 -39q-14 -11 -36 -38l-105 92q26 37 63 66q80 65 188 65q110 0 178 -59.5t68 -158.5q0 -66 -34.5 -118.5t-84 -86t-99.5 -62.5t-87 -63t-41 -73h232v80h126z" /> +<glyph unicode="" horiz-adv-x="1920" d="M896 128l336 384h-768l-336 -384h768zM1909 1205q15 -34 9.5 -71.5t-30.5 -65.5l-896 -1024q-38 -44 -96 -44h-768q-38 0 -69.5 20.5t-47.5 54.5q-15 34 -9.5 71.5t30.5 65.5l896 1024q38 44 96 44h768q38 0 69.5 -20.5t47.5 -54.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 438q0 -81 -44.5 -135t-123.5 -54q-41 0 -77.5 17.5t-59 38t-56.5 38t-71 17.5q-110 0 -110 -124q0 -39 16 -115t15 -115v-5q-22 0 -33 -1q-34 -3 -97.5 -11.5t-115.5 -13.5t-98 -5q-61 0 -103 26.5t-42 83.5q0 37 17.5 71t38 56.5t38 59t17.5 77.5q0 79 -54 123.5 t-135 44.5q-84 0 -143 -45.5t-59 -127.5q0 -43 15 -83t33.5 -64.5t33.5 -53t15 -50.5q0 -45 -46 -89q-37 -35 -117 -35q-95 0 -245 24q-9 2 -27.5 4t-27.5 4l-13 2q-1 0 -3 1q-2 0 -2 1v1024q2 -1 17.5 -3.5t34 -5t21.5 -3.5q150 -24 245 -24q80 0 117 35q46 44 46 89 q0 22 -15 50.5t-33.5 53t-33.5 64.5t-15 83q0 82 59 127.5t144 45.5q80 0 134 -44.5t54 -123.5q0 -41 -17.5 -77.5t-38 -59t-38 -56.5t-17.5 -71q0 -57 42 -83.5t103 -26.5q64 0 180 15t163 17v-2q-1 -2 -3.5 -17.5t-5 -34t-3.5 -21.5q-24 -150 -24 -245q0 -80 35 -117 q44 -46 89 -46q22 0 50.5 15t53 33.5t64.5 33.5t83 15q82 0 127.5 -59t45.5 -143z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1152 832v-128q0 -221 -147.5 -384.5t-364.5 -187.5v-132h256q26 0 45 -19t19 -45t-19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h256v132q-217 24 -364.5 187.5t-147.5 384.5v128q0 26 19 45t45 19t45 -19t19 -45v-128q0 -185 131.5 -316.5t316.5 -131.5 t316.5 131.5t131.5 316.5v128q0 26 19 45t45 19t45 -19t19 -45zM896 1216v-512q0 -132 -94 -226t-226 -94t-226 94t-94 226v512q0 132 94 226t226 94t226 -94t94 -226z" /> +<glyph unicode="" horiz-adv-x="1408" d="M271 591l-101 -101q-42 103 -42 214v128q0 26 19 45t45 19t45 -19t19 -45v-128q0 -53 15 -113zM1385 1193l-361 -361v-128q0 -132 -94 -226t-226 -94q-55 0 -109 19l-96 -96q97 -51 205 -51q185 0 316.5 131.5t131.5 316.5v128q0 26 19 45t45 19t45 -19t19 -45v-128 q0 -221 -147.5 -384.5t-364.5 -187.5v-132h256q26 0 45 -19t19 -45t-19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h256v132q-125 13 -235 81l-254 -254q-10 -10 -23 -10t-23 10l-82 82q-10 10 -10 23t10 23l1234 1234q10 10 23 10t23 -10l82 -82q10 -10 10 -23 t-10 -23zM1005 1325l-621 -621v512q0 132 94 226t226 94q102 0 184.5 -59t116.5 -152z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1088 576v640h-448v-1137q119 63 213 137q235 184 235 360zM1280 1344v-768q0 -86 -33.5 -170.5t-83 -150t-118 -127.5t-126.5 -103t-121 -77.5t-89.5 -49.5t-42.5 -20q-12 -6 -26 -6t-26 6q-16 7 -42.5 20t-89.5 49.5t-121 77.5t-126.5 103t-118 127.5t-83 150 t-33.5 170.5v768q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280 q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 1344q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 1376v-320q0 -16 -12 -25q-8 -7 -20 -7q-4 0 -7 1l-448 96q-11 2 -18 11t-7 20h-256v-102q111 -23 183.5 -111t72.5 -203v-800q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v800 q0 106 62.5 190.5t161.5 114.5v111h-32q-59 0 -115 -23.5t-91.5 -53t-66 -66.5t-40.5 -53.5t-14 -24.5q-17 -35 -57 -35q-16 0 -29 7q-23 12 -31.5 37t3.5 49q5 10 14.5 26t37.5 53.5t60.5 70t85 67t108.5 52.5q-25 42 -25 86q0 66 47 113t113 47t113 -47t47 -113 q0 -33 -14 -64h302q0 11 7 20t18 11l448 96q3 1 7 1q12 0 20 -7q12 -9 12 -25z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1440 1088q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1664 1376q0 -249 -75.5 -430.5t-253.5 -360.5q-81 -80 -195 -176l-20 -379q-2 -16 -16 -26l-384 -224q-7 -4 -16 -4q-12 0 -23 9l-64 64q-13 14 -8 32l85 276l-281 281l-276 -85q-3 -1 -9 -1 q-14 0 -23 9l-64 64q-17 19 -5 39l224 384q10 14 26 16l379 20q96 114 176 195q188 187 358 258t431 71q14 0 24 -9.5t10 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1745 763l-164 -763h-334l178 832q13 56 -15 88q-27 33 -83 33h-169l-204 -953h-334l204 953h-286l-204 -953h-334l204 953l-153 327h1276q101 0 189.5 -40.5t147.5 -113.5q60 -73 81 -168.5t0 -194.5z" /> +<glyph unicode="" d="M909 141l102 102q19 19 19 45t-19 45l-307 307l307 307q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-454 -454q-19 -19 -19 -45t19 -45l454 -454q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M717 141l454 454q19 19 19 45t-19 45l-454 454q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l307 -307l-307 -307q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1165 397l102 102q19 19 19 45t-19 45l-454 454q-19 19 -45 19t-45 -19l-454 -454q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19l307 307l307 -307q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M813 237l454 454q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-307 -307l-307 307q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l454 -454q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1130 939l16 175h-884l47 -534h612l-22 -228l-197 -53l-196 53l-13 140h-175l22 -278l362 -100h4v1l359 99l50 544h-644l-15 181h674zM0 1408h1408l-128 -1438l-578 -162l-574 162z" /> +<glyph unicode="" horiz-adv-x="1792" d="M275 1408h1505l-266 -1333l-804 -267l-698 267l71 356h297l-29 -147l422 -161l486 161l68 339h-1208l58 297h1209l38 191h-1208z" /> +<glyph unicode="" horiz-adv-x="1792" d="M960 1280q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1792 352v-352q0 -22 -20 -30q-8 -2 -12 -2q-13 0 -23 9l-93 93q-119 -143 -318.5 -226.5t-429.5 -83.5t-429.5 83.5t-318.5 226.5l-93 -93q-9 -9 -23 -9q-4 0 -12 2q-20 8 -20 30v352 q0 14 9 23t23 9h352q22 0 30 -20q8 -19 -7 -35l-100 -100q67 -91 189.5 -153.5t271.5 -82.5v647h-192q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h192v163q-58 34 -93 92.5t-35 128.5q0 106 75 181t181 75t181 -75t75 -181q0 -70 -35 -128.5t-93 -92.5v-163h192q26 0 45 -19 t19 -45v-128q0 -26 -19 -45t-45 -19h-192v-647q149 20 271.5 82.5t189.5 153.5l-100 100q-15 16 -7 35q8 20 30 20h352q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1056 768q40 0 68 -28t28 -68v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h32v320q0 185 131.5 316.5t316.5 131.5t316.5 -131.5t131.5 -316.5q0 -26 -19 -45t-45 -19h-64q-26 0 -45 19t-19 45q0 106 -75 181t-181 75t-181 -75t-75 -181 v-320h736z" /> +<glyph unicode="" d="M1024 640q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM1152 640q0 159 -112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5zM1280 640q0 -212 -150 -362t-362 -150t-362 150 t-150 362t150 362t362 150t362 -150t150 -362zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM896 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM1408 800v-192q0 -40 -28 -68t-68 -28h-192 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="384" d="M384 288v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM384 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM384 1312v-192q0 -40 -28 -68t-68 -28h-192 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68z" /> +<glyph unicode="" d="M512 256q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM863 162q-13 232 -177 396t-396 177q-14 1 -24 -9t-10 -23v-128q0 -13 8.5 -22t21.5 -10q154 -11 264 -121t121 -264q1 -13 10 -21.5t22 -8.5h128q13 0 23 10 t9 24zM1247 161q-5 154 -56 297.5t-139.5 260t-205 205t-260 139.5t-297.5 56q-14 1 -23 -9q-10 -10 -10 -23v-128q0 -13 9 -22t22 -10q204 -7 378 -111.5t278.5 -278.5t111.5 -378q1 -13 10 -22t22 -9h128q13 0 23 10q11 9 9 23zM1536 1120v-960q0 -119 -84.5 -203.5 t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM1152 585q32 18 32 55t-32 55l-544 320q-31 19 -64 1q-32 -19 -32 -56v-640q0 -37 32 -56 q16 -8 32 -8q17 0 32 9z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 1084l316 -316l-572 -572l-316 316zM813 105l618 618q19 19 19 45t-19 45l-362 362q-18 18 -45 18t-45 -18l-618 -618q-19 -19 -19 -45t19 -45l362 -362q18 -18 45 -18t45 18zM1702 742l-907 -908q-37 -37 -90.5 -37t-90.5 37l-126 126q56 56 56 136t-56 136 t-136 56t-136 -56l-125 126q-37 37 -37 90.5t37 90.5l907 906q37 37 90.5 37t90.5 -37l125 -125q-56 -56 -56 -136t56 -136t136 -56t136 56l126 -125q37 -37 37 -90.5t-37 -90.5z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h896q26 0 45 19t19 45zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1152 736v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h832q14 0 23 -9t9 -23zM1280 288v832q0 66 -47 113t-113 47h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113zM1408 1120v-832q0 -119 -84.5 -203.5 t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1018 933q-18 -37 -58 -37h-192v-864q0 -14 -9 -23t-23 -9h-704q-21 0 -29 18q-8 20 4 35l160 192q9 11 25 11h320v640h-192q-40 0 -58 37q-17 37 9 68l320 384q18 22 49 22t49 -22l320 -384q27 -32 9 -68z" /> +<glyph unicode="" horiz-adv-x="1024" d="M32 1280h704q13 0 22.5 -9.5t9.5 -23.5v-863h192q40 0 58 -37t-9 -69l-320 -384q-18 -22 -49 -22t-49 22l-320 384q-26 31 -9 69q18 37 58 37h192v640h-320q-14 0 -25 11l-160 192q-13 14 -4 34q9 19 29 19z" /> +<glyph unicode="" d="M685 237l614 614q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-467 -467l-211 211q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l358 -358q19 -19 45 -19t45 19zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5 t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M404 428l152 -152l-52 -52h-56v96h-96v56zM818 818q14 -13 -3 -30l-291 -291q-17 -17 -30 -3q-14 13 3 30l291 291q17 17 30 3zM544 128l544 544l-288 288l-544 -544v-288h288zM1152 736l92 92q28 28 28 68t-28 68l-152 152q-28 28 -68 28t-68 -28l-92 -92zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1280 608v480q0 26 -19 45t-45 19h-480q-42 0 -59 -39q-17 -41 14 -70l144 -144l-534 -534q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19l534 534l144 -144q18 -19 45 -19q12 0 25 5q39 17 39 59zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960 q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1005 435l352 352q19 19 19 45t-19 45l-352 352q-30 31 -69 14q-40 -17 -40 -59v-160q-119 0 -216 -19.5t-162.5 -51t-114 -79t-76.5 -95.5t-44.5 -109t-21.5 -111.5t-5 -110.5q0 -181 167 -404q10 -12 25 -12q7 0 13 3q22 9 19 33q-44 354 62 473q46 52 130 75.5 t224 23.5v-160q0 -42 40 -59q12 -5 24 -5q26 0 45 19zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M640 448l256 128l-256 128v-256zM1024 1039v-542l-512 -256v542zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1145 861q18 -35 -5 -66l-320 -448q-19 -27 -52 -27t-52 27l-320 448q-23 31 -5 66q17 35 57 35h640q40 0 57 -35zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1145 419q-17 -35 -57 -35h-640q-40 0 -57 35q-18 35 5 66l320 448q19 27 52 27t52 -27l320 -448q23 -31 5 -66zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1088 640q0 -33 -27 -52l-448 -320q-31 -23 -66 -5q-35 17 -35 57v640q0 40 35 57q35 18 66 -5l448 -320q27 -19 27 -52zM1280 160v960q0 14 -9 23t-23 9h-960q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h960q14 0 23 9t9 23zM1536 1120v-960q0 -119 -84.5 -203.5 t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M976 229l35 -159q3 -12 -3 -22.5t-17 -14.5l-5 -1q-4 -2 -10.5 -3.5t-16 -4.5t-21.5 -5.5t-25.5 -5t-30 -5t-33.5 -4.5t-36.5 -3t-38.5 -1q-234 0 -409 130.5t-238 351.5h-95q-13 0 -22.5 9.5t-9.5 22.5v113q0 13 9.5 22.5t22.5 9.5h66q-2 57 1 105h-67q-14 0 -23 9 t-9 23v114q0 14 9 23t23 9h98q67 210 243.5 338t400.5 128q102 0 194 -23q11 -3 20 -15q6 -11 3 -24l-43 -159q-3 -13 -14 -19.5t-24 -2.5l-4 1q-4 1 -11.5 2.5l-17.5 3.5t-22.5 3.5t-26 3t-29 2.5t-29.5 1q-126 0 -226 -64t-150 -176h468q16 0 25 -12q10 -12 7 -26 l-24 -114q-5 -26 -32 -26h-488q-3 -37 0 -105h459q15 0 25 -12q9 -12 6 -27l-24 -112q-2 -11 -11 -18.5t-20 -7.5h-387q48 -117 149.5 -185.5t228.5 -68.5q18 0 36 1.5t33.5 3.5t29.5 4.5t24.5 5t18.5 4.5l12 3l5 2q13 5 26 -2q12 -7 15 -21z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1020 399v-367q0 -14 -9 -23t-23 -9h-956q-14 0 -23 9t-9 23v150q0 13 9.5 22.5t22.5 9.5h97v383h-95q-14 0 -23 9.5t-9 22.5v131q0 14 9 23t23 9h95v223q0 171 123.5 282t314.5 111q185 0 335 -125q9 -8 10 -20.5t-7 -22.5l-103 -127q-9 -11 -22 -12q-13 -2 -23 7 q-5 5 -26 19t-69 32t-93 18q-85 0 -137 -47t-52 -123v-215h305q13 0 22.5 -9t9.5 -23v-131q0 -13 -9.5 -22.5t-22.5 -9.5h-305v-379h414v181q0 13 9 22.5t23 9.5h162q14 0 23 -9.5t9 -22.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M978 351q0 -153 -99.5 -263.5t-258.5 -136.5v-175q0 -14 -9 -23t-23 -9h-135q-13 0 -22.5 9.5t-9.5 22.5v175q-66 9 -127.5 31t-101.5 44.5t-74 48t-46.5 37.5t-17.5 18q-17 21 -2 41l103 135q7 10 23 12q15 2 24 -9l2 -2q113 -99 243 -125q37 -8 74 -8q81 0 142.5 43 t61.5 122q0 28 -15 53t-33.5 42t-58.5 37.5t-66 32t-80 32.5q-39 16 -61.5 25t-61.5 26.5t-62.5 31t-56.5 35.5t-53.5 42.5t-43.5 49t-35.5 58t-21 66.5t-8.5 78q0 138 98 242t255 134v180q0 13 9.5 22.5t22.5 9.5h135q14 0 23 -9t9 -23v-176q57 -6 110.5 -23t87 -33.5 t63.5 -37.5t39 -29t15 -14q17 -18 5 -38l-81 -146q-8 -15 -23 -16q-14 -3 -27 7q-3 3 -14.5 12t-39 26.5t-58.5 32t-74.5 26t-85.5 11.5q-95 0 -155 -43t-60 -111q0 -26 8.5 -48t29.5 -41.5t39.5 -33t56 -31t60.5 -27t70 -27.5q53 -20 81 -31.5t76 -35t75.5 -42.5t62 -50 t53 -63.5t31.5 -76.5t13 -94z" /> +<glyph unicode="" horiz-adv-x="898" d="M898 1066v-102q0 -14 -9 -23t-23 -9h-168q-23 -144 -129 -234t-276 -110q167 -178 459 -536q14 -16 4 -34q-8 -18 -29 -18h-195q-16 0 -25 12q-306 367 -498 571q-9 9 -9 22v127q0 13 9.5 22.5t22.5 9.5h112q132 0 212.5 43t102.5 125h-427q-14 0 -23 9t-9 23v102 q0 14 9 23t23 9h413q-57 113 -268 113h-145q-13 0 -22.5 9.5t-9.5 22.5v133q0 14 9 23t23 9h832q14 0 23 -9t9 -23v-102q0 -14 -9 -23t-23 -9h-233q47 -61 64 -144h171q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1027" d="M603 0h-172q-13 0 -22.5 9t-9.5 23v330h-288q-13 0 -22.5 9t-9.5 23v103q0 13 9.5 22.5t22.5 9.5h288v85h-288q-13 0 -22.5 9t-9.5 23v104q0 13 9.5 22.5t22.5 9.5h214l-321 578q-8 16 0 32q10 16 28 16h194q19 0 29 -18l215 -425q19 -38 56 -125q10 24 30.5 68t27.5 61 l191 420q8 19 29 19h191q17 0 27 -16q9 -14 1 -31l-313 -579h215q13 0 22.5 -9.5t9.5 -22.5v-104q0 -14 -9.5 -23t-22.5 -9h-290v-85h290q13 0 22.5 -9.5t9.5 -22.5v-103q0 -14 -9.5 -23t-22.5 -9h-290v-330q0 -13 -9.5 -22.5t-22.5 -9.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1043 971q0 100 -65 162t-171 62h-320v-448h320q106 0 171 62t65 162zM1280 971q0 -193 -126.5 -315t-326.5 -122h-340v-118h505q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9h-505v-192q0 -14 -9.5 -23t-22.5 -9h-167q-14 0 -23 9t-9 23v192h-224q-14 0 -23 9t-9 23v128 q0 14 9 23t23 9h224v118h-224q-14 0 -23 9t-9 23v149q0 13 9 22.5t23 9.5h224v629q0 14 9 23t23 9h539q200 0 326.5 -122t126.5 -315z" /> +<glyph unicode="" horiz-adv-x="1792" d="M514 341l81 299h-159l75 -300q1 -1 1 -3t1 -3q0 1 0.5 3.5t0.5 3.5zM630 768l35 128h-292l32 -128h225zM822 768h139l-35 128h-70zM1271 340l78 300h-162l81 -299q0 -1 0.5 -3.5t1.5 -3.5q0 1 0.5 3t0.5 3zM1382 768l33 128h-297l34 -128h230zM1792 736v-64q0 -14 -9 -23 t-23 -9h-213l-164 -616q-7 -24 -31 -24h-159q-24 0 -31 24l-166 616h-209l-167 -616q-7 -24 -31 -24h-159q-11 0 -19.5 7t-10.5 17l-160 616h-208q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h175l-33 128h-142q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h109l-89 344q-5 15 5 28 q10 12 26 12h137q26 0 31 -24l90 -360h359l97 360q7 24 31 24h126q24 0 31 -24l98 -360h365l93 360q5 24 31 24h137q16 0 26 -12q10 -13 5 -28l-91 -344h111q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-145l-34 -128h179q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1167 896q18 -182 -131 -258q117 -28 175 -103t45 -214q-7 -71 -32.5 -125t-64.5 -89t-97 -58.5t-121.5 -34.5t-145.5 -15v-255h-154v251q-80 0 -122 1v-252h-154v255q-18 0 -54 0.5t-55 0.5h-200l31 183h111q50 0 58 51v402h16q-6 1 -16 1v287q-13 68 -89 68h-111v164 l212 -1q64 0 97 1v252h154v-247q82 2 122 2v245h154v-252q79 -7 140 -22.5t113 -45t82.5 -78t36.5 -114.5zM952 351q0 36 -15 64t-37 46t-57.5 30.5t-65.5 18.5t-74 9t-69 3t-64.5 -1t-47.5 -1v-338q8 0 37 -0.5t48 -0.5t53 1.5t58.5 4t57 8.5t55.5 14t47.5 21t39.5 30 t24.5 40t9.5 51zM881 827q0 33 -12.5 58.5t-30.5 42t-48 28t-55 16.5t-61.5 8t-58 2.5t-54 -1t-39.5 -0.5v-307q5 0 34.5 -0.5t46.5 0t50 2t55 5.5t51.5 11t48.5 18.5t37 27t27 38.5t9 51z" /> +<glyph unicode="" d="M1024 1024v472q22 -14 36 -28l408 -408q14 -14 28 -36h-472zM896 992q0 -40 28 -68t68 -28h544v-1056q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h800v-544z" /> +<glyph unicode="" d="M1468 1060q14 -14 28 -36h-472v472q22 -14 36 -28zM992 896h544v-1056q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h800v-544q0 -40 28 -68t68 -28zM1152 160v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704 q14 0 23 9t9 23zM1152 416v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704q14 0 23 9t9 23zM1152 672v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1191 1128h177l-72 218l-12 47q-2 16 -2 20h-4l-3 -20q0 -1 -3.5 -18t-7.5 -29zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1572 -23 v-233h-584v90l369 529q12 18 21 27l11 9v3q-2 0 -6.5 -0.5t-7.5 -0.5q-12 -3 -30 -3h-232v-115h-120v229h567v-89l-369 -530q-6 -8 -21 -26l-11 -11v-2l14 2q9 2 30 2h248v119h121zM1661 874v-106h-288v106h75l-47 144h-243l-47 -144h75v-106h-287v106h70l230 662h162 l230 -662h70z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1191 104h177l-72 218l-12 47q-2 16 -2 20h-4l-3 -20q0 -1 -3.5 -18t-7.5 -29zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1661 -150 v-106h-288v106h75l-47 144h-243l-47 -144h75v-106h-287v106h70l230 662h162l230 -662h70zM1572 1001v-233h-584v90l369 529q12 18 21 27l11 9v3q-2 0 -6.5 -0.5t-7.5 -0.5q-12 -3 -30 -3h-232v-115h-120v229h567v-89l-369 -530q-6 -8 -21 -26l-11 -10v-3l14 3q9 1 30 1h248 v119h121z" /> +<glyph unicode="" horiz-adv-x="1792" d="M736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1792 -32v-192q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h832 q14 0 23 -9t9 -23zM1600 480v-192q0 -14 -9 -23t-23 -9h-640q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h640q14 0 23 -9t9 -23zM1408 992v-192q0 -14 -9 -23t-23 -9h-448q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h448q14 0 23 -9t9 -23zM1216 1504v-192q0 -14 -9 -23t-23 -9h-256 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h256q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1216 -32v-192q0 -14 -9 -23t-23 -9h-256q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h256q14 0 23 -9t9 -23zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192 q14 0 23 -9t9 -23zM1408 480v-192q0 -14 -9 -23t-23 -9h-448q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h448q14 0 23 -9t9 -23zM1600 992v-192q0 -14 -9 -23t-23 -9h-640q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h640q14 0 23 -9t9 -23zM1792 1504v-192q0 -14 -9 -23t-23 -9h-832 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h832q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1346 223q0 63 -44 116t-103 53q-52 0 -83 -37t-31 -94t36.5 -95t104.5 -38q50 0 85 27t35 68zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23 zM1486 165q0 -62 -13 -121.5t-41 -114t-68 -95.5t-98.5 -65.5t-127.5 -24.5q-62 0 -108 16q-24 8 -42 15l39 113q15 -7 31 -11q37 -13 75 -13q84 0 134.5 58.5t66.5 145.5h-2q-21 -23 -61.5 -37t-84.5 -14q-106 0 -173 71.5t-67 172.5q0 105 72 178t181 73q123 0 205 -94.5 t82 -252.5zM1456 882v-114h-469v114h167v432q0 7 0.5 19t0.5 17v16h-2l-7 -12q-8 -13 -26 -31l-62 -58l-82 86l192 185h123v-654h165z" /> +<glyph unicode="" d="M1346 1247q0 63 -44 116t-103 53q-52 0 -83 -37t-31 -94t36.5 -95t104.5 -38q50 0 85 27t35 68zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9 t9 -23zM1456 -142v-114h-469v114h167v432q0 7 0.5 19t0.5 17v16h-2l-7 -12q-8 -13 -26 -31l-62 -58l-82 86l192 185h123v-654h165zM1486 1189q0 -62 -13 -121.5t-41 -114t-68 -95.5t-98.5 -65.5t-127.5 -24.5q-62 0 -108 16q-24 8 -42 15l39 113q15 -7 31 -11q37 -13 75 -13 q84 0 134.5 58.5t66.5 145.5h-2q-21 -23 -61.5 -37t-84.5 -14q-106 0 -173 71.5t-67 172.5q0 105 72 178t181 73q123 0 205 -94.5t82 -252.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M256 192q0 26 -19 45t-45 19q-27 0 -45.5 -19t-18.5 -45q0 -27 18.5 -45.5t45.5 -18.5q26 0 45 18.5t19 45.5zM416 704v-640q0 -26 -19 -45t-45 -19h-288q-26 0 -45 19t-19 45v640q0 26 19 45t45 19h288q26 0 45 -19t19 -45zM1600 704q0 -86 -55 -149q15 -44 15 -76 q3 -76 -43 -137q17 -56 0 -117q-15 -57 -54 -94q9 -112 -49 -181q-64 -76 -197 -78h-36h-76h-17q-66 0 -144 15.5t-121.5 29t-120.5 39.5q-123 43 -158 44q-26 1 -45 19.5t-19 44.5v641q0 25 18 43.5t43 20.5q24 2 76 59t101 121q68 87 101 120q18 18 31 48t17.5 48.5 t13.5 60.5q7 39 12.5 61t19.5 52t34 50q19 19 45 19q46 0 82.5 -10.5t60 -26t40 -40.5t24 -45t12 -50t5 -45t0.5 -39q0 -38 -9.5 -76t-19 -60t-27.5 -56q-3 -6 -10 -18t-11 -22t-8 -24h277q78 0 135 -57t57 -135z" /> +<glyph unicode="" horiz-adv-x="1664" d="M256 960q0 -26 -19 -45t-45 -19q-27 0 -45.5 19t-18.5 45q0 27 18.5 45.5t45.5 18.5q26 0 45 -18.5t19 -45.5zM416 448v640q0 26 -19 45t-45 19h-288q-26 0 -45 -19t-19 -45v-640q0 -26 19 -45t45 -19h288q26 0 45 19t19 45zM1545 597q55 -61 55 -149q-1 -78 -57.5 -135 t-134.5 -57h-277q4 -14 8 -24t11 -22t10 -18q18 -37 27 -57t19 -58.5t10 -76.5q0 -24 -0.5 -39t-5 -45t-12 -50t-24 -45t-40 -40.5t-60 -26t-82.5 -10.5q-26 0 -45 19q-20 20 -34 50t-19.5 52t-12.5 61q-9 42 -13.5 60.5t-17.5 48.5t-31 48q-33 33 -101 120q-49 64 -101 121 t-76 59q-25 2 -43 20.5t-18 43.5v641q0 26 19 44.5t45 19.5q35 1 158 44q77 26 120.5 39.5t121.5 29t144 15.5h17h76h36q133 -2 197 -78q58 -69 49 -181q39 -37 54 -94q17 -61 0 -117q46 -61 43 -137q0 -32 -15 -76z" /> +<glyph unicode="" d="M919 233v157q0 50 -29 50q-17 0 -33 -16v-224q16 -16 33 -16q29 0 29 49zM1103 355h66v34q0 51 -33 51t-33 -51v-34zM532 621v-70h-80v-423h-74v423h-78v70h232zM733 495v-367h-67v40q-39 -45 -76 -45q-33 0 -42 28q-6 16 -6 54v290h66v-270q0 -24 1 -26q1 -15 15 -15 q20 0 42 31v280h67zM985 384v-146q0 -52 -7 -73q-12 -42 -53 -42q-35 0 -68 41v-36h-67v493h67v-161q32 40 68 40q41 0 53 -42q7 -21 7 -74zM1236 255v-9q0 -29 -2 -43q-3 -22 -15 -40q-27 -40 -80 -40q-52 0 -81 38q-21 27 -21 86v129q0 59 20 86q29 38 80 38t78 -38 q21 -28 21 -86v-76h-133v-65q0 -51 34 -51q24 0 30 26q0 1 0.5 7t0.5 16.5v21.5h68zM785 1079v-156q0 -51 -32 -51t-32 51v156q0 52 32 52t32 -52zM1318 366q0 177 -19 260q-10 44 -43 73.5t-76 34.5q-136 15 -412 15q-275 0 -411 -15q-44 -5 -76.5 -34.5t-42.5 -73.5 q-20 -87 -20 -260q0 -176 20 -260q10 -43 42.5 -73t75.5 -35q137 -15 412 -15t412 15q43 5 75.5 35t42.5 73q20 84 20 260zM563 1017l90 296h-75l-51 -195l-53 195h-78l24 -69t23 -69q35 -103 46 -158v-201h74v201zM852 936v130q0 58 -21 87q-29 38 -78 38q-51 0 -78 -38 q-21 -29 -21 -87v-130q0 -58 21 -87q27 -38 78 -38q49 0 78 38q21 27 21 87zM1033 816h67v370h-67v-283q-22 -31 -42 -31q-15 0 -16 16q-1 2 -1 26v272h-67v-293q0 -37 6 -55q11 -27 43 -27q36 0 77 45v-40zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960 q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M971 292v-211q0 -67 -39 -67q-23 0 -45 22v301q22 22 45 22q39 0 39 -67zM1309 291v-46h-90v46q0 68 45 68t45 -68zM343 509h107v94h-312v-94h105v-569h100v569zM631 -60h89v494h-89v-378q-30 -42 -57 -42q-18 0 -21 21q-1 3 -1 35v364h-89v-391q0 -49 8 -73 q12 -37 58 -37q48 0 102 61v-54zM1060 88v197q0 73 -9 99q-17 56 -71 56q-50 0 -93 -54v217h-89v-663h89v48q45 -55 93 -55q54 0 71 55q9 27 9 100zM1398 98v13h-91q0 -51 -2 -61q-7 -36 -40 -36q-46 0 -46 69v87h179v103q0 79 -27 116q-39 51 -106 51q-68 0 -107 -51 q-28 -37 -28 -116v-173q0 -79 29 -116q39 -51 108 -51q72 0 108 53q18 27 21 54q2 9 2 58zM790 1011v210q0 69 -43 69t-43 -69v-210q0 -70 43 -70t43 70zM1509 260q0 -234 -26 -350q-14 -59 -58 -99t-102 -46q-184 -21 -555 -21t-555 21q-58 6 -102.5 46t-57.5 99 q-26 112 -26 350q0 234 26 350q14 59 58 99t103 47q183 20 554 20t555 -20q58 -7 102.5 -47t57.5 -99q26 -112 26 -350zM511 1536h102l-121 -399v-271h-100v271q-14 74 -61 212q-37 103 -65 187h106l71 -263zM881 1203v-175q0 -81 -28 -118q-37 -51 -106 -51q-67 0 -105 51 q-28 38 -28 118v175q0 80 28 117q38 51 105 51q69 0 106 -51q28 -37 28 -117zM1216 1365v-499h-91v55q-53 -62 -103 -62q-46 0 -59 37q-8 24 -8 75v394h91v-367q0 -33 1 -35q3 -22 21 -22q27 0 57 43v381h91z" /> +<glyph unicode="" horiz-adv-x="1408" d="M597 869q-10 -18 -257 -456q-27 -46 -65 -46h-239q-21 0 -31 17t0 36l253 448q1 0 0 1l-161 279q-12 22 -1 37q9 15 32 15h239q40 0 66 -45zM1403 1511q11 -16 0 -37l-528 -934v-1l336 -615q11 -20 1 -37q-10 -15 -32 -15h-239q-42 0 -66 45l-339 622q18 32 531 942 q25 45 64 45h241q22 0 31 -15z" /> +<glyph unicode="" d="M685 771q0 1 -126 222q-21 34 -52 34h-184q-18 0 -26 -11q-7 -12 1 -29l125 -216v-1l-196 -346q-9 -14 0 -28q8 -13 24 -13h185q31 0 50 36zM1309 1268q-7 12 -24 12h-187q-30 0 -49 -35l-411 -729q1 -2 262 -481q20 -35 52 -35h184q18 0 25 12q8 13 -1 28l-260 476v1 l409 723q8 16 0 28zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 640q0 37 -30 54l-512 320q-31 20 -65 2q-33 -18 -33 -56v-640q0 -38 33 -56q16 -8 31 -8q20 0 34 10l512 320q30 17 30 54zM1792 640q0 -96 -1 -150t-8.5 -136.5t-22.5 -147.5q-16 -73 -69 -123t-124 -58q-222 -25 -671 -25t-671 25q-71 8 -124.5 58t-69.5 123 q-14 65 -21.5 147.5t-8.5 136.5t-1 150t1 150t8.5 136.5t22.5 147.5q16 73 69 123t124 58q222 25 671 25t671 -25q71 -8 124.5 -58t69.5 -123q14 -65 21.5 -147.5t8.5 -136.5t1 -150z" /> +<glyph unicode="" horiz-adv-x="1792" d="M402 829l494 -305l-342 -285l-490 319zM1388 274v-108l-490 -293v-1l-1 1l-1 -1v1l-489 293v108l147 -96l342 284v2l1 -1l1 1v-2l343 -284zM554 1418l342 -285l-494 -304l-338 270zM1390 829l338 -271l-489 -319l-343 285zM1239 1418l489 -319l-338 -270l-494 304z" /> +<glyph unicode="" horiz-adv-x="1408" d="M928 135v-151l-707 -1v151zM1169 481v-701l-1 -35v-1h-1132l-35 1h-1v736h121v-618h928v618h120zM241 393l704 -65l-13 -150l-705 65zM309 709l683 -183l-39 -146l-683 183zM472 1058l609 -360l-77 -130l-609 360zM832 1389l398 -585l-124 -85l-399 584zM1285 1536 l121 -697l-149 -26l-121 697z" /> +<glyph unicode="" d="M1362 110v648h-135q20 -63 20 -131q0 -126 -64 -232.5t-174 -168.5t-240 -62q-197 0 -337 135.5t-140 327.5q0 68 20 131h-141v-648q0 -26 17.5 -43.5t43.5 -17.5h1069q25 0 43 17.5t18 43.5zM1078 643q0 124 -90.5 211.5t-218.5 87.5q-127 0 -217.5 -87.5t-90.5 -211.5 t90.5 -211.5t217.5 -87.5q128 0 218.5 87.5t90.5 211.5zM1362 1003v165q0 28 -20 48.5t-49 20.5h-174q-29 0 -49 -20.5t-20 -48.5v-165q0 -29 20 -49t49 -20h174q29 0 49 20t20 49zM1536 1211v-1142q0 -81 -58 -139t-139 -58h-1142q-81 0 -139 58t-58 139v1142q0 81 58 139 t139 58h1142q81 0 139 -58t58 -139z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM698 640q0 88 -62 150t-150 62t-150 -62t-62 -150t62 -150t150 -62t150 62t62 150zM1262 640q0 88 -62 150 t-150 62t-150 -62t-62 -150t62 -150t150 -62t150 62t62 150z" /> +<glyph unicode="" d="M768 914l201 -306h-402zM1133 384h94l-459 691l-459 -691h94l104 160h522zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M815 677q8 -63 -50.5 -101t-111.5 -6q-39 17 -53.5 58t-0.5 82t52 58q36 18 72.5 12t64 -35.5t27.5 -67.5zM926 698q-14 107 -113 164t-197 13q-63 -28 -100.5 -88.5t-34.5 -129.5q4 -91 77.5 -155t165.5 -56q91 8 152 84t50 168zM1165 1240q-20 27 -56 44.5t-58 22 t-71 12.5q-291 47 -566 -2q-43 -7 -66 -12t-55 -22t-50 -43q30 -28 76 -45.5t73.5 -22t87.5 -11.5q228 -29 448 -1q63 8 89.5 12t72.5 21.5t75 46.5zM1222 205q-8 -26 -15.5 -76.5t-14 -84t-28.5 -70t-58 -56.5q-86 -48 -189.5 -71.5t-202 -22t-201.5 18.5q-46 8 -81.5 18 t-76.5 27t-73 43.5t-52 61.5q-25 96 -57 292l6 16l18 9q223 -148 506.5 -148t507.5 148q21 -6 24 -23t-5 -45t-8 -37zM1403 1166q-26 -167 -111 -655q-5 -30 -27 -56t-43.5 -40t-54.5 -31q-252 -126 -610 -88q-248 27 -394 139q-15 12 -25.5 26.5t-17 35t-9 34t-6 39.5 t-5.5 35q-9 50 -26.5 150t-28 161.5t-23.5 147.5t-22 158q3 26 17.5 48.5t31.5 37.5t45 30t46 22.5t48 18.5q125 46 313 64q379 37 676 -50q155 -46 215 -122q16 -20 16.5 -51t-5.5 -54z" /> +<glyph unicode="" d="M848 666q0 43 -41 66t-77 1q-43 -20 -42.5 -72.5t43.5 -70.5q39 -23 81 4t36 72zM928 682q8 -66 -36 -121t-110 -61t-119 40t-56 113q-2 49 25.5 93t72.5 64q70 31 141.5 -10t81.5 -118zM1100 1073q-20 -21 -53.5 -34t-53 -16t-63.5 -8q-155 -20 -324 0q-44 6 -63 9.5 t-52.5 16t-54.5 32.5q13 19 36 31t40 15.5t47 8.5q198 35 408 1q33 -5 51 -8.5t43 -16t39 -31.5zM1142 327q0 7 5.5 26.5t3 32t-17.5 16.5q-161 -106 -365 -106t-366 106l-12 -6l-5 -12q26 -154 41 -210q47 -81 204 -108q249 -46 428 53q34 19 49 51.5t22.5 85.5t12.5 71z M1272 1020q9 53 -8 75q-43 55 -155 88q-216 63 -487 36q-132 -12 -226 -46q-38 -15 -59.5 -25t-47 -34t-29.5 -54q8 -68 19 -138t29 -171t24 -137q1 -5 5 -31t7 -36t12 -27t22 -28q105 -80 284 -100q259 -28 440 63q24 13 39.5 23t31 29t19.5 40q48 267 80 473zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M944 207l80 -237q-23 -35 -111 -66t-177 -32q-104 -2 -190.5 26t-142.5 74t-95 106t-55.5 120t-16.5 118v544h-168v215q72 26 129 69.5t91 90t58 102t34 99t15 88.5q1 5 4.5 8.5t7.5 3.5h244v-424h333v-252h-334v-518q0 -30 6.5 -56t22.5 -52.5t49.5 -41.5t81.5 -14 q78 2 134 29z" /> +<glyph unicode="" d="M1136 75l-62 183q-44 -22 -103 -22q-36 -1 -62 10.5t-38.5 31.5t-17.5 40.5t-5 43.5v398h257v194h-256v326h-188q-8 0 -9 -10q-5 -44 -17.5 -87t-39 -95t-77 -95t-118.5 -68v-165h130v-418q0 -57 21.5 -115t65 -111t121 -85.5t176.5 -30.5q69 1 136.5 25t85.5 50z M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="768" d="M765 237q8 -19 -5 -35l-350 -384q-10 -10 -23 -10q-14 0 -24 10l-355 384q-13 16 -5 35q9 19 29 19h224v1248q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1248h224q21 0 29 -19z" /> +<glyph unicode="" horiz-adv-x="768" d="M765 1043q-9 -19 -29 -19h-224v-1248q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v1248h-224q-21 0 -29 19t5 35l350 384q10 10 23 10q14 0 24 -10l355 -384q13 -16 5 -35z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 736v-192q0 -14 -9 -23t-23 -9h-1248v-224q0 -21 -19 -29t-35 5l-384 350q-10 10 -10 23q0 14 10 24l384 354q16 14 35 6q19 -9 19 -29v-224h1248q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1728 643q0 -14 -10 -24l-384 -354q-16 -14 -35 -6q-19 9 -19 29v224h-1248q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h1248v224q0 21 19 29t35 -5l384 -350q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1393 321q-39 -125 -123 -250q-129 -196 -257 -196q-49 0 -140 32q-86 32 -151 32q-61 0 -142 -33q-81 -34 -132 -34q-152 0 -301 259q-147 261 -147 503q0 228 113 374q112 144 284 144q72 0 177 -30q104 -30 138 -30q45 0 143 34q102 34 173 34q119 0 213 -65 q52 -36 104 -100q-79 -67 -114 -118q-65 -94 -65 -207q0 -124 69 -223t158 -126zM1017 1494q0 -61 -29 -136q-30 -75 -93 -138q-54 -54 -108 -72q-37 -11 -104 -17q3 149 78 257q74 107 250 148q1 -3 2.5 -11t2.5 -11q0 -4 0.5 -10t0.5 -10z" /> +<glyph unicode="" horiz-adv-x="1664" d="M682 530v-651l-682 94v557h682zM682 1273v-659h-682v565zM1664 530v-786l-907 125v661h907zM1664 1408v-794h-907v669z" /> +<glyph unicode="" horiz-adv-x="1408" d="M493 1053q16 0 27.5 11.5t11.5 27.5t-11.5 27.5t-27.5 11.5t-27 -11.5t-11 -27.5t11 -27.5t27 -11.5zM915 1053q16 0 27 11.5t11 27.5t-11 27.5t-27 11.5t-27.5 -11.5t-11.5 -27.5t11.5 -27.5t27.5 -11.5zM103 869q42 0 72 -30t30 -72v-430q0 -43 -29.5 -73t-72.5 -30 t-73 30t-30 73v430q0 42 30 72t73 30zM1163 850v-666q0 -46 -32 -78t-77 -32h-75v-227q0 -43 -30 -73t-73 -30t-73 30t-30 73v227h-138v-227q0 -43 -30 -73t-73 -30q-42 0 -72 30t-30 73l-1 227h-74q-46 0 -78 32t-32 78v666h918zM931 1255q107 -55 171 -153.5t64 -215.5 h-925q0 117 64 215.5t172 153.5l-71 131q-7 13 5 20q13 6 20 -6l72 -132q95 42 201 42t201 -42l72 132q7 12 20 6q12 -7 5 -20zM1408 767v-430q0 -43 -30 -73t-73 -30q-42 0 -72 30t-30 73v430q0 43 30 72.5t72 29.5q43 0 73 -29.5t30 -72.5z" /> +<glyph unicode="" d="M663 1125q-11 -1 -15.5 -10.5t-8.5 -9.5q-5 -1 -5 5q0 12 19 15h10zM750 1111q-4 -1 -11.5 6.5t-17.5 4.5q24 11 32 -2q3 -6 -3 -9zM399 684q-4 1 -6 -3t-4.5 -12.5t-5.5 -13.5t-10 -13q-7 -10 -1 -12q4 -1 12.5 7t12.5 18q1 3 2 7t2 6t1.5 4.5t0.5 4v3t-1 2.5t-3 2z M1254 325q0 18 -55 42q4 15 7.5 27.5t5 26t3 21.5t0.5 22.5t-1 19.5t-3.5 22t-4 20.5t-5 25t-5.5 26.5q-10 48 -47 103t-72 75q24 -20 57 -83q87 -162 54 -278q-11 -40 -50 -42q-31 -4 -38.5 18.5t-8 83.5t-11.5 107q-9 39 -19.5 69t-19.5 45.5t-15.5 24.5t-13 15t-7.5 7 q-14 62 -31 103t-29.5 56t-23.5 33t-15 40q-4 21 6 53.5t4.5 49.5t-44.5 25q-15 3 -44.5 18t-35.5 16q-8 1 -11 26t8 51t36 27q37 3 51 -30t4 -58q-11 -19 -2 -26.5t30 -0.5q13 4 13 36v37q-5 30 -13.5 50t-21 30.5t-23.5 15t-27 7.5q-107 -8 -89 -134q0 -15 -1 -15 q-9 9 -29.5 10.5t-33 -0.5t-15.5 5q1 57 -16 90t-45 34q-27 1 -41.5 -27.5t-16.5 -59.5q-1 -15 3.5 -37t13 -37.5t15.5 -13.5q10 3 16 14q4 9 -7 8q-7 0 -15.5 14.5t-9.5 33.5q-1 22 9 37t34 14q17 0 27 -21t9.5 -39t-1.5 -22q-22 -15 -31 -29q-8 -12 -27.5 -23.5 t-20.5 -12.5q-13 -14 -15.5 -27t7.5 -18q14 -8 25 -19.5t16 -19t18.5 -13t35.5 -6.5q47 -2 102 15q2 1 23 7t34.5 10.5t29.5 13t21 17.5q9 14 20 8q5 -3 6.5 -8.5t-3 -12t-16.5 -9.5q-20 -6 -56.5 -21.5t-45.5 -19.5q-44 -19 -70 -23q-25 -5 -79 2q-10 2 -9 -2t17 -19 q25 -23 67 -22q17 1 36 7t36 14t33.5 17.5t30 17t24.5 12t17.5 2.5t8.5 -11q0 -2 -1 -4.5t-4 -5t-6 -4.5t-8.5 -5t-9 -4.5t-10 -5t-9.5 -4.5q-28 -14 -67.5 -44t-66.5 -43t-49 -1q-21 11 -63 73q-22 31 -25 22q-1 -3 -1 -10q0 -25 -15 -56.5t-29.5 -55.5t-21 -58t11.5 -63 q-23 -6 -62.5 -90t-47.5 -141q-2 -18 -1.5 -69t-5.5 -59q-8 -24 -29 -3q-32 31 -36 94q-2 28 4 56q4 19 -1 18l-4 -5q-36 -65 10 -166q5 -12 25 -28t24 -20q20 -23 104 -90.5t93 -76.5q16 -15 17.5 -38t-14 -43t-45.5 -23q8 -15 29 -44.5t28 -54t7 -70.5q46 24 7 92 q-4 8 -10.5 16t-9.5 12t-2 6q3 5 13 9.5t20 -2.5q46 -52 166 -36q133 15 177 87q23 38 34 30q12 -6 10 -52q-1 -25 -23 -92q-9 -23 -6 -37.5t24 -15.5q3 19 14.5 77t13.5 90q2 21 -6.5 73.5t-7.5 97t23 70.5q15 18 51 18q1 37 34.5 53t72.5 10.5t60 -22.5zM626 1152 q3 17 -2.5 30t-11.5 15q-9 2 -9 -7q2 -5 5 -6q10 0 7 -15q-3 -20 8 -20q3 0 3 3zM1045 955q-2 8 -6.5 11.5t-13 5t-14.5 5.5q-5 3 -9.5 8t-7 8t-5.5 6.5t-4 4t-4 -1.5q-14 -16 7 -43.5t39 -31.5q9 -1 14.5 8t3.5 20zM867 1168q0 11 -5 19.5t-11 12.5t-9 3q-14 -1 -7 -7l4 -2 q14 -4 18 -31q0 -3 8 2zM921 1401q0 2 -2.5 5t-9 7t-9.5 6q-15 15 -24 15q-9 -1 -11.5 -7.5t-1 -13t-0.5 -12.5q-1 -4 -6 -10.5t-6 -9t3 -8.5q4 -3 8 0t11 9t15 9q1 1 9 1t15 2t9 7zM1486 60q20 -12 31 -24.5t12 -24t-2.5 -22.5t-15.5 -22t-23.5 -19.5t-30 -18.5 t-31.5 -16.5t-32 -15.5t-27 -13q-38 -19 -85.5 -56t-75.5 -64q-17 -16 -68 -19.5t-89 14.5q-18 9 -29.5 23.5t-16.5 25.5t-22 19.5t-47 9.5q-44 1 -130 1q-19 0 -57 -1.5t-58 -2.5q-44 -1 -79.5 -15t-53.5 -30t-43.5 -28.5t-53.5 -11.5q-29 1 -111 31t-146 43q-19 4 -51 9.5 t-50 9t-39.5 9.5t-33.5 14.5t-17 19.5q-10 23 7 66.5t18 54.5q1 16 -4 40t-10 42.5t-4.5 36.5t10.5 27q14 12 57 14t60 12q30 18 42 35t12 51q21 -73 -32 -106q-32 -20 -83 -15q-34 3 -43 -10q-13 -15 5 -57q2 -6 8 -18t8.5 -18t4.5 -17t1 -22q0 -15 -17 -49t-14 -48 q3 -17 37 -26q20 -6 84.5 -18.5t99.5 -20.5q24 -6 74 -22t82.5 -23t55.5 -4q43 6 64.5 28t23 48t-7.5 58.5t-19 52t-20 36.5q-121 190 -169 242q-68 74 -113 40q-11 -9 -15 15q-3 16 -2 38q1 29 10 52t24 47t22 42q8 21 26.5 72t29.5 78t30 61t39 54q110 143 124 195 q-12 112 -16 310q-2 90 24 151.5t106 104.5q39 21 104 21q53 1 106 -13.5t89 -41.5q57 -42 91.5 -121.5t29.5 -147.5q-5 -95 30 -214q34 -113 133 -218q55 -59 99.5 -163t59.5 -191q8 -49 5 -84.5t-12 -55.5t-20 -22q-10 -2 -23.5 -19t-27 -35.5t-40.5 -33.5t-61 -14 q-18 1 -31.5 5t-22.5 13.5t-13.5 15.5t-11.5 20.5t-9 19.5q-22 37 -41 30t-28 -49t7 -97q20 -70 1 -195q-10 -65 18 -100.5t73 -33t85 35.5q59 49 89.5 66.5t103.5 42.5q53 18 77 36.5t18.5 34.5t-25 28.5t-51.5 23.5q-33 11 -49.5 48t-15 72.5t15.5 47.5q1 -31 8 -56.5 t14.5 -40.5t20.5 -28.5t21 -19t21.5 -13t16.5 -9.5z" /> +<glyph unicode="" d="M1024 36q-42 241 -140 498h-2l-2 -1q-16 -6 -43 -16.5t-101 -49t-137 -82t-131 -114.5t-103 -148l-15 11q184 -150 418 -150q132 0 256 52zM839 643q-21 49 -53 111q-311 -93 -673 -93q-1 -7 -1 -21q0 -124 44 -236.5t124 -201.5q50 89 123.5 166.5t142.5 124.5t130.5 81 t99.5 48l37 13q4 1 13 3.5t13 4.5zM732 855q-120 213 -244 378q-138 -65 -234 -186t-128 -272q302 0 606 80zM1416 536q-210 60 -409 29q87 -239 128 -469q111 75 185 189.5t96 250.5zM611 1277q-1 0 -2 -1q1 1 2 1zM1201 1132q-185 164 -433 164q-76 0 -155 -19 q131 -170 246 -382q69 26 130 60.5t96.5 61.5t65.5 57t37.5 40.5zM1424 647q-3 232 -149 410l-1 -1q-9 -12 -19 -24.5t-43.5 -44.5t-71 -60.5t-100 -65t-131.5 -64.5q25 -53 44 -95q2 -6 6.5 -17.5t7.5 -16.5q36 5 74.5 7t73.5 2t69 -1.5t64 -4t56.5 -5.5t48 -6.5t36.5 -6 t25 -4.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1173 473q0 50 -19.5 91.5t-48.5 68.5t-73 49t-82.5 34t-87.5 23l-104 24q-30 7 -44 10.5t-35 11.5t-30 16t-16.5 21t-7.5 30q0 77 144 77q43 0 77 -12t54 -28.5t38 -33.5t40 -29t48 -12q47 0 75.5 32t28.5 77q0 55 -56 99.5t-142 67.5t-182 23q-68 0 -132 -15.5 t-119.5 -47t-89 -87t-33.5 -128.5q0 -61 19 -106.5t56 -75.5t80 -48.5t103 -32.5l146 -36q90 -22 112 -36q32 -20 32 -60q0 -39 -40 -64.5t-105 -25.5q-51 0 -91.5 16t-65 38.5t-45.5 45t-46 38.5t-54 16q-50 0 -75.5 -30t-25.5 -75q0 -92 122 -157.5t291 -65.5 q73 0 140 18.5t122.5 53.5t88.5 93.5t33 131.5zM1536 256q0 -159 -112.5 -271.5t-271.5 -112.5q-130 0 -234 80q-77 -16 -150 -16q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5q0 73 16 150q-80 104 -80 234q0 159 112.5 271.5t271.5 112.5q130 0 234 -80 q77 16 150 16q143 0 273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -73 -16 -150q80 -104 80 -234z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1000 1102l37 194q5 23 -9 40t-35 17h-712q-23 0 -38.5 -17t-15.5 -37v-1101q0 -7 6 -1l291 352q23 26 38 33.5t48 7.5h239q22 0 37 14.5t18 29.5q24 130 37 191q4 21 -11.5 40t-36.5 19h-294q-29 0 -48 19t-19 48v42q0 29 19 47.5t48 18.5h346q18 0 35 13.5t20 29.5z M1227 1324q-15 -73 -53.5 -266.5t-69.5 -350t-35 -173.5q-6 -22 -9 -32.5t-14 -32.5t-24.5 -33t-38.5 -21t-58 -10h-271q-13 0 -22 -10q-8 -9 -426 -494q-22 -25 -58.5 -28.5t-48.5 5.5q-55 22 -55 98v1410q0 55 38 102.5t120 47.5h888q95 0 127 -53t10 -159zM1227 1324 l-158 -790q4 17 35 173.5t69.5 350t53.5 266.5z" /> +<glyph unicode="" d="M704 192v1024q0 14 -9 23t-23 9h-480q-14 0 -23 -9t-9 -23v-1024q0 -14 9 -23t23 -9h480q14 0 23 9t9 23zM1376 576v640q0 14 -9 23t-23 9h-480q-14 0 -23 -9t-9 -23v-640q0 -14 9 -23t23 -9h480q14 0 23 9t9 23zM1536 1344v-1408q0 -26 -19 -45t-45 -19h-1408 q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1280 480q0 -40 -28 -68t-68 -28q-51 0 -80 43l-227 341h-45v-132l247 -411q9 -15 9 -33q0 -26 -19 -45t-45 -19h-192v-272q0 -46 -33 -79t-79 -33h-160q-46 0 -79 33t-33 79v272h-192q-26 0 -45 19t-19 45q0 18 9 33l247 411v132h-45l-227 -341q-29 -43 -80 -43 q-40 0 -68 28t-28 68q0 29 16 53l256 384q73 107 176 107h384q103 0 176 -107l256 -384q16 -24 16 -53zM864 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832v-416q0 -40 -28 -68t-68 -28t-68 28t-28 68v352h-64v-912q0 -46 -33 -79t-79 -33t-79 33t-33 79v464h-64v-464q0 -46 -33 -79t-79 -33t-79 33t-33 79v912h-64v-352q0 -40 -28 -68t-68 -28t-68 28t-28 68v416q0 80 56 136t136 56h640q80 0 136 -56t56 -136z M736 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" d="M773 234l350 473q16 22 24.5 59t-6 85t-61.5 79q-40 26 -83 25.5t-73.5 -17.5t-54.5 -45q-36 -40 -96 -40q-59 0 -95 40q-24 28 -54.5 45t-73.5 17.5t-84 -25.5q-46 -31 -60.5 -79t-6 -85t24.5 -59zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1472 640q0 117 -45.5 223.5t-123 184t-184 123t-223.5 45.5t-223.5 -45.5t-184 -123t-123 -184t-45.5 -223.5t45.5 -223.5t123 -184t184 -123t223.5 -45.5t223.5 45.5t184 123t123 184t45.5 223.5zM1748 363q-4 -15 -20 -20l-292 -96v-306q0 -16 -13 -26q-15 -10 -29 -4 l-292 94l-180 -248q-10 -13 -26 -13t-26 13l-180 248l-292 -94q-14 -6 -29 4q-13 10 -13 26v306l-292 96q-16 5 -20 20q-5 17 4 29l180 248l-180 248q-9 13 -4 29q4 15 20 20l292 96v306q0 16 13 26q15 10 29 4l292 -94l180 248q9 12 26 12t26 -12l180 -248l292 94 q14 6 29 -4q13 -10 13 -26v-306l292 -96q16 -5 20 -20q5 -16 -4 -29l-180 -248l180 -248q9 -12 4 -29z" /> +<glyph unicode="" d="M1262 233q-54 -9 -110 -9q-182 0 -337 90t-245 245t-90 337q0 192 104 357q-201 -60 -328.5 -229t-127.5 -384q0 -130 51 -248.5t136.5 -204t204 -136.5t248.5 -51q144 0 273.5 61.5t220.5 171.5zM1465 318q-94 -203 -283.5 -324.5t-413.5 -121.5q-156 0 -298 61 t-245 164t-164 245t-61 298q0 153 57.5 292.5t156 241.5t235.5 164.5t290 68.5q44 2 61 -39q18 -41 -15 -72q-86 -78 -131.5 -181.5t-45.5 -218.5q0 -148 73 -273t198 -198t273 -73q118 0 228 51q41 18 72 -13q14 -14 17.5 -34t-4.5 -38z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1088 704q0 26 -19 45t-45 19h-256q-26 0 -45 -19t-19 -45t19 -45t45 -19h256q26 0 45 19t19 45zM1664 896v-960q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v960q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1728 1344v-256q0 -26 -19 -45t-45 -19h-1536 q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1536q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1632 576q0 -26 -19 -45t-45 -19h-224q0 -171 -67 -290l208 -209q19 -19 19 -45t-19 -45q-18 -19 -45 -19t-45 19l-198 197q-5 -5 -15 -13t-42 -28.5t-65 -36.5t-82 -29t-97 -13v896h-128v-896q-51 0 -101.5 13.5t-87 33t-66 39t-43.5 32.5l-15 14l-183 -207 q-20 -21 -48 -21q-24 0 -43 16q-19 18 -20.5 44.5t15.5 46.5l202 227q-58 114 -58 274h-224q-26 0 -45 19t-19 45t19 45t45 19h224v294l-173 173q-19 19 -19 45t19 45t45 19t45 -19l173 -173h844l173 173q19 19 45 19t45 -19t19 -45t-19 -45l-173 -173v-294h224q26 0 45 -19 t19 -45zM1152 1152h-640q0 133 93.5 226.5t226.5 93.5t226.5 -93.5t93.5 -226.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1917 1016q23 -64 -150 -294q-24 -32 -65 -85q-78 -100 -90 -131q-17 -41 14 -81q17 -21 81 -82h1l1 -1l1 -1l2 -2q141 -131 191 -221q3 -5 6.5 -12.5t7 -26.5t-0.5 -34t-25 -27.5t-59 -12.5l-256 -4q-24 -5 -56 5t-52 22l-20 12q-30 21 -70 64t-68.5 77.5t-61 58 t-56.5 15.5q-3 -1 -8 -3.5t-17 -14.5t-21.5 -29.5t-17 -52t-6.5 -77.5q0 -15 -3.5 -27.5t-7.5 -18.5l-4 -5q-18 -19 -53 -22h-115q-71 -4 -146 16.5t-131.5 53t-103 66t-70.5 57.5l-25 24q-10 10 -27.5 30t-71.5 91t-106 151t-122.5 211t-130.5 272q-6 16 -6 27t3 16l4 6 q15 19 57 19l274 2q12 -2 23 -6.5t16 -8.5l5 -3q16 -11 24 -32q20 -50 46 -103.5t41 -81.5l16 -29q29 -60 56 -104t48.5 -68.5t41.5 -38.5t34 -14t27 5q2 1 5 5t12 22t13.5 47t9.5 81t0 125q-2 40 -9 73t-14 46l-6 12q-25 34 -85 43q-13 2 5 24q17 19 38 30q53 26 239 24 q82 -1 135 -13q20 -5 33.5 -13.5t20.5 -24t10.5 -32t3.5 -45.5t-1 -55t-2.5 -70.5t-1.5 -82.5q0 -11 -1 -42t-0.5 -48t3.5 -40.5t11.5 -39t22.5 -24.5q8 -2 17 -4t26 11t38 34.5t52 67t68 107.5q60 104 107 225q4 10 10 17.5t11 10.5l4 3l5 2.5t13 3t20 0.5l288 2 q39 5 64 -2.5t31 -16.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M675 252q21 34 11 69t-45 50q-34 14 -73 1t-60 -46q-22 -34 -13 -68.5t43 -50.5t74.5 -2.5t62.5 47.5zM769 373q8 13 3.5 26.5t-17.5 18.5q-14 5 -28.5 -0.5t-21.5 -18.5q-17 -31 13 -45q14 -5 29 0.5t22 18.5zM943 266q-45 -102 -158 -150t-224 -12 q-107 34 -147.5 126.5t6.5 187.5q47 93 151.5 139t210.5 19q111 -29 158.5 -119.5t2.5 -190.5zM1255 426q-9 96 -89 170t-208.5 109t-274.5 21q-223 -23 -369.5 -141.5t-132.5 -264.5q9 -96 89 -170t208.5 -109t274.5 -21q223 23 369.5 141.5t132.5 264.5zM1563 422 q0 -68 -37 -139.5t-109 -137t-168.5 -117.5t-226 -83t-270.5 -31t-275 33.5t-240.5 93t-171.5 151t-65 199.5q0 115 69.5 245t197.5 258q169 169 341.5 236t246.5 -7q65 -64 20 -209q-4 -14 -1 -20t10 -7t14.5 0.5t13.5 3.5l6 2q139 59 246 59t153 -61q45 -63 0 -178 q-2 -13 -4.5 -20t4.5 -12.5t12 -7.5t17 -6q57 -18 103 -47t80 -81.5t34 -116.5zM1489 1046q42 -47 54.5 -108.5t-6.5 -117.5q-8 -23 -29.5 -34t-44.5 -4q-23 8 -34 29.5t-4 44.5q20 63 -24 111t-107 35q-24 -5 -45 8t-25 37q-5 24 8 44.5t37 25.5q60 13 119 -5.5t101 -65.5z M1670 1209q87 -96 112.5 -222.5t-13.5 -241.5q-9 -27 -34 -40t-52 -4t-40 34t-5 52q28 82 10 172t-80 158q-62 69 -148 95.5t-173 8.5q-28 -6 -52 9.5t-30 43.5t9.5 51.5t43.5 29.5q123 26 244 -11.5t208 -134.5z" /> +<glyph unicode="" d="M1133 -34q-171 -94 -368 -94q-196 0 -367 94q138 87 235.5 211t131.5 268q35 -144 132.5 -268t235.5 -211zM638 1394v-485q0 -252 -126.5 -459.5t-330.5 -306.5q-181 215 -181 495q0 187 83.5 349.5t229.5 269.5t325 137zM1536 638q0 -280 -181 -495 q-204 99 -330.5 306.5t-126.5 459.5v485q179 -30 325 -137t229.5 -269.5t83.5 -349.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1402 433q-32 -80 -76 -138t-91 -88.5t-99 -46.5t-101.5 -14.5t-96.5 8.5t-86.5 22t-69.5 27.5t-46 22.5l-17 10q-113 -228 -289.5 -359.5t-384.5 -132.5q-19 0 -32 13t-13 32t13 31.5t32 12.5q173 1 322.5 107.5t251.5 294.5q-36 -14 -72 -23t-83 -13t-91 2.5t-93 28.5 t-92 59t-84.5 100t-74.5 146q114 47 214 57t167.5 -7.5t124.5 -56.5t88.5 -77t56.5 -82q53 131 79 291q-7 -1 -18 -2.5t-46.5 -2.5t-69.5 0.5t-81.5 10t-88.5 23t-84 42.5t-75 65t-54.5 94.5t-28.5 127.5q70 28 133.5 36.5t112.5 -1t92 -30t73.5 -50t56 -61t42 -63t27.5 -56 t16 -39.5l4 -16q12 122 12 195q-8 6 -21.5 16t-49 44.5t-63.5 71.5t-54 93t-33 112.5t12 127t70 138.5q73 -25 127.5 -61.5t84.5 -76.5t48 -85t20.5 -89t-0.5 -85.5t-13 -76.5t-19 -62t-17 -42l-7 -15q1 -5 1 -50.5t-1 -71.5q3 7 10 18.5t30.5 43t50.5 58t71 55.5t91.5 44.5 t112 14.5t132.5 -24q-2 -78 -21.5 -141.5t-50 -104.5t-69.5 -71.5t-81.5 -45.5t-84.5 -24t-80 -9.5t-67.5 1t-46.5 4.5l-17 3q-23 -147 -73 -283q6 7 18 18.5t49.5 41t77.5 52.5t99.5 42t117.5 20t129 -23.5t137 -77.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1259 283v-66q0 -85 -57.5 -144.5t-138.5 -59.5h-57l-260 -269v269h-529q-81 0 -138.5 59.5t-57.5 144.5v66h1238zM1259 609v-255h-1238v255h1238zM1259 937v-255h-1238v255h1238zM1259 1077v-67h-1238v67q0 84 57.5 143.5t138.5 59.5h846q81 0 138.5 -59.5t57.5 -143.5z " /> +<glyph unicode="" d="M1152 640q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v192h-352q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h352v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198 t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1152 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-352v-192q0 -14 -9 -23t-23 -9q-12 0 -24 10l-319 319q-9 9 -9 23t9 23l320 320q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5v-192h352q13 0 22.5 -9.5t9.5 -22.5zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198 t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1024 960v-640q0 -26 -19 -45t-45 -19q-20 0 -37 12l-448 320q-27 19 -27 52t27 52l448 320q17 12 37 12q26 0 45 -19t19 -45zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5z M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1024 640q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5 t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1023 349l102 -204q-58 -179 -210 -290t-339 -111q-156 0 -288.5 77.5t-210 210t-77.5 288.5q0 181 104.5 330t274.5 211l17 -131q-122 -54 -195 -165.5t-73 -244.5q0 -185 131.5 -316.5t316.5 -131.5q126 0 232.5 65t165 175.5t49.5 236.5zM1571 249l58 -114l-256 -128 q-13 -7 -29 -7q-40 0 -57 35l-239 477h-472q-24 0 -42.5 16.5t-21.5 40.5l-96 779q-2 16 6 42q14 51 57 82.5t97 31.5q66 0 113 -47t47 -113q0 -69 -52 -117.5t-120 -41.5l37 -289h423v-128h-407l16 -128h455q40 0 57 -35l228 -455z" /> +<glyph unicode="" d="M1292 898q10 216 -161 222q-231 8 -312 -261q44 19 82 19q85 0 74 -96q-4 -57 -74 -167t-105 -110q-43 0 -82 169q-13 54 -45 255q-30 189 -160 177q-59 -7 -164 -100l-81 -72l-81 -72l52 -67q76 52 87 52q57 0 107 -179q15 -55 45 -164.5t45 -164.5q68 -179 164 -179 q157 0 383 294q220 283 226 444zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1152 704q0 -191 -94.5 -353t-256.5 -256.5t-353 -94.5h-160q-14 0 -23 9t-9 23v611l-215 -66q-3 -1 -9 -1q-10 0 -19 6q-13 10 -13 26v128q0 23 23 31l233 71v93l-215 -66q-3 -1 -9 -1q-10 0 -19 6q-13 10 -13 26v128q0 23 23 31l233 71v250q0 14 9 23t23 9h160 q14 0 23 -9t9 -23v-181l375 116q15 5 28 -5t13 -26v-128q0 -23 -23 -31l-393 -121v-93l375 116q15 5 28 -5t13 -26v-128q0 -23 -23 -31l-393 -121v-487q188 13 318 151t130 328q0 14 9 23t23 9h160q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1152 736v-64q0 -14 -9 -23t-23 -9h-352v-352q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v352h-352q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h352v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-352h352q14 0 23 -9t9 -23zM1280 288v832q0 66 -47 113t-113 47h-832 q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2176" d="M620 416q-110 -64 -268 -64h-128v64h-64q-13 0 -22.5 23.5t-9.5 56.5q0 24 7 49q-58 2 -96.5 10.5t-38.5 20.5t38.5 20.5t96.5 10.5q-7 25 -7 49q0 33 9.5 56.5t22.5 23.5h64v64h128q158 0 268 -64h1113q42 -7 106.5 -18t80.5 -14q89 -15 150 -40.5t83.5 -47.5t22.5 -40 t-22.5 -40t-83.5 -47.5t-150 -40.5q-16 -3 -80.5 -14t-106.5 -18h-1113zM1739 668q53 -36 53 -92t-53 -92l81 -30q68 48 68 122t-68 122zM625 400h1015q-217 -38 -456 -80q-57 0 -113 -24t-83 -48l-28 -24l-288 -288q-26 -26 -70.5 -45t-89.5 -19h-96l-93 464h29 q157 0 273 64zM352 816h-29l93 464h96q46 0 90 -19t70 -45l288 -288q4 -4 11 -10.5t30.5 -23t48.5 -29t61.5 -23t72.5 -10.5l456 -80h-1015q-116 64 -273 64z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1519 760q62 0 103.5 -40.5t41.5 -101.5q0 -97 -93 -130l-172 -59l56 -167q7 -21 7 -47q0 -59 -42 -102t-101 -43q-47 0 -85.5 27t-53.5 72l-55 165l-310 -106l55 -164q8 -24 8 -47q0 -59 -42 -102t-102 -43q-47 0 -85 27t-53 72l-55 163l-153 -53q-29 -9 -50 -9 q-61 0 -101.5 40t-40.5 101q0 47 27.5 85t71.5 53l156 53l-105 313l-156 -54q-26 -8 -48 -8q-60 0 -101 40.5t-41 100.5q0 47 27.5 85t71.5 53l157 53l-53 159q-8 24 -8 47q0 60 42 102.5t102 42.5q47 0 85 -27t53 -72l54 -160l310 105l-54 160q-8 24 -8 47q0 59 42.5 102 t101.5 43q47 0 85.5 -27.5t53.5 -71.5l53 -161l162 55q21 6 43 6q60 0 102.5 -39.5t42.5 -98.5q0 -45 -30 -81.5t-74 -51.5l-157 -54l105 -316l164 56q24 8 46 8zM725 498l310 105l-105 315l-310 -107z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM1280 352v436q-31 -35 -64 -55q-34 -22 -132.5 -85t-151.5 -99q-98 -69 -164 -69v0v0q-66 0 -164 69 q-46 32 -141.5 92.5t-142.5 92.5q-12 8 -33 27t-31 27v-436q0 -40 28 -68t68 -28h832q40 0 68 28t28 68zM1280 925q0 41 -27.5 70t-68.5 29h-832q-40 0 -68 -28t-28 -68q0 -37 30.5 -76.5t67.5 -64.5q47 -32 137.5 -89t129.5 -83q3 -2 17 -11.5t21 -14t21 -13t23.5 -13 t21.5 -9.5t22.5 -7.5t20.5 -2.5t20.5 2.5t22.5 7.5t21.5 9.5t23.5 13t21 13t21 14t17 11.5l267 174q35 23 66.5 62.5t31.5 73.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M127 640q0 163 67 313l367 -1005q-196 95 -315 281t-119 411zM1415 679q0 -19 -2.5 -38.5t-10 -49.5t-11.5 -44t-17.5 -59t-17.5 -58l-76 -256l-278 826q46 3 88 8q19 2 26 18.5t-2.5 31t-28.5 13.5l-205 -10q-75 1 -202 10q-12 1 -20.5 -5t-11.5 -15t-1.5 -18.5t9 -16.5 t19.5 -8l80 -8l120 -328l-168 -504l-280 832q46 3 88 8q19 2 26 18.5t-2.5 31t-28.5 13.5l-205 -10q-7 0 -23 0.5t-26 0.5q105 160 274.5 253.5t367.5 93.5q147 0 280.5 -53t238.5 -149h-10q-55 0 -92 -40.5t-37 -95.5q0 -12 2 -24t4 -21.5t8 -23t9 -21t12 -22.5t12.5 -21 t14.5 -24t14 -23q63 -107 63 -212zM909 573l237 -647q1 -6 5 -11q-126 -44 -255 -44q-112 0 -217 32zM1570 1009q95 -174 95 -369q0 -209 -104 -385.5t-279 -278.5l235 678q59 169 59 276q0 42 -6 79zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286 t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM896 -215q173 0 331.5 68t273 182.5t182.5 273t68 331.5t-68 331.5t-182.5 273t-273 182.5t-331.5 68t-331.5 -68t-273 -182.5t-182.5 -273t-68 -331.5t68 -331.5t182.5 -273 t273 -182.5t331.5 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1086 1536v-1536l-272 -128q-228 20 -414 102t-293 208.5t-107 272.5q0 140 100.5 263.5t275 205.5t391.5 108v-172q-217 -38 -356.5 -150t-139.5 -255q0 -152 154.5 -267t388.5 -145v1360zM1755 954l37 -390l-525 114l147 83q-119 70 -280 99v172q277 -33 481 -157z" /> +<glyph unicode="" horiz-adv-x="2048" d="M960 1536l960 -384v-128h-128q0 -26 -20.5 -45t-48.5 -19h-1526q-28 0 -48.5 19t-20.5 45h-128v128zM256 896h256v-768h128v768h256v-768h128v768h256v-768h128v768h256v-768h59q28 0 48.5 -19t20.5 -45v-64h-1664v64q0 26 20.5 45t48.5 19h59v768zM1851 -64 q28 0 48.5 -19t20.5 -45v-128h-1920v128q0 26 20.5 45t48.5 19h1782z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1774 700l18 -316q4 -69 -82 -128t-235 -93.5t-323 -34.5t-323 34.5t-235 93.5t-82 128l18 316l574 -181q22 -7 48 -7t48 7zM2304 1024q0 -23 -22 -31l-1120 -352q-4 -1 -10 -1t-10 1l-652 206q-43 -34 -71 -111.5t-34 -178.5q63 -36 63 -109q0 -69 -58 -107l58 -433 q2 -14 -8 -25q-9 -11 -24 -11h-192q-15 0 -24 11q-10 11 -8 25l58 433q-58 38 -58 107q0 73 65 111q11 207 98 330l-333 104q-22 8 -22 31t22 31l1120 352q4 1 10 1t10 -1l1120 -352q22 -8 22 -31z" /> +<glyph unicode="" d="M859 579l13 -707q-62 11 -105 11q-41 0 -105 -11l13 707q-40 69 -168.5 295.5t-216.5 374.5t-181 287q58 -15 108 -15q43 0 111 15q63 -111 133.5 -229.5t167 -276.5t138.5 -227q37 61 109.5 177.5t117.5 190t105 176t107 189.5q54 -14 107 -14q56 0 114 14v0 q-28 -39 -60 -88.5t-49.5 -78.5t-56.5 -96t-49 -84q-146 -248 -353 -610z" /> +<glyph unicode="" horiz-adv-x="1280" d="M981 197q0 25 -7 49t-14.5 42t-27 41.5t-29.5 35t-38.5 34.5t-36.5 29t-41.5 30t-36.5 26q-16 2 -49 2q-53 0 -104.5 -7t-107 -25t-97 -46t-68.5 -74.5t-27 -105.5q0 -56 23.5 -102t61 -75.5t87 -50t100 -29t101.5 -8.5q58 0 111.5 13t99 39t73 73t27.5 109zM864 1055 q0 59 -17 125.5t-48 129t-84 103.5t-117 41q-42 0 -82.5 -19.5t-66.5 -52.5q-46 -59 -46 -160q0 -46 10 -97.5t31.5 -103t52 -92.5t75 -67t96.5 -26q37 0 77.5 16.5t65.5 43.5q53 56 53 159zM752 1536h417l-137 -88h-132q75 -63 113 -133t38 -160q0 -72 -24.5 -129.5 t-59.5 -93t-69.5 -65t-59 -61.5t-24.5 -66q0 -36 32 -70.5t77 -68t90.5 -73.5t77.5 -104t32 -142q0 -91 -49 -173q-71 -122 -209.5 -179.5t-298.5 -57.5q-132 0 -246.5 41.5t-172.5 137.5q-36 59 -36 131q0 81 44.5 150t118.5 115q131 82 404 100q-32 41 -47.5 73.5 t-15.5 73.5q0 40 21 85q-46 -4 -68 -4q-148 0 -249.5 96.5t-101.5 244.5q0 82 36 159t99 131q76 66 182 98t218 32z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1095 369q16 -16 0 -31q-62 -62 -199 -62t-199 62q-16 15 0 31q6 6 15 6t15 -6q48 -49 169 -49q120 0 169 49q6 6 15 6t15 -6zM788 550q0 -37 -26 -63t-63 -26t-63.5 26t-26.5 63q0 38 26.5 64t63.5 26t63 -26.5t26 -63.5zM1183 550q0 -37 -26.5 -63t-63.5 -26t-63 26 t-26 63t26 63.5t63 26.5t63.5 -26t26.5 -64zM1434 670q0 49 -35 84t-85 35t-86 -36q-130 90 -311 96l63 283l200 -45q0 -37 26 -63t63 -26t63.5 26.5t26.5 63.5t-26.5 63.5t-63.5 26.5q-54 0 -80 -50l-221 49q-19 5 -25 -16l-69 -312q-180 -7 -309 -97q-35 37 -87 37 q-50 0 -85 -35t-35 -84q0 -35 18.5 -64t49.5 -44q-6 -27 -6 -56q0 -142 140 -243t337 -101q198 0 338 101t140 243q0 32 -7 57q30 15 48 43.5t18 63.5zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191 t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" d="M939 407q13 -13 0 -26q-53 -53 -171 -53t-171 53q-13 13 0 26q5 6 13 6t13 -6q42 -42 145 -42t145 42q5 6 13 6t13 -6zM676 563q0 -31 -23 -54t-54 -23t-54 23t-23 54q0 32 22.5 54.5t54.5 22.5t54.5 -22.5t22.5 -54.5zM1014 563q0 -31 -23 -54t-54 -23t-54 23t-23 54 q0 32 22.5 54.5t54.5 22.5t54.5 -22.5t22.5 -54.5zM1229 666q0 42 -30 72t-73 30q-42 0 -73 -31q-113 78 -267 82l54 243l171 -39q1 -32 23.5 -54t53.5 -22q32 0 54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5q-48 0 -69 -43l-189 42q-17 5 -21 -13l-60 -268q-154 -6 -265 -83 q-30 32 -74 32q-43 0 -73 -30t-30 -72q0 -30 16 -55t42 -38q-5 -25 -5 -48q0 -122 120 -208.5t289 -86.5q170 0 290 86.5t120 208.5q0 25 -6 49q25 13 40.5 37.5t15.5 54.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M866 697l90 27v62q0 79 -58 135t-138 56t-138 -55.5t-58 -134.5v-283q0 -20 -14 -33.5t-33 -13.5t-32.5 13.5t-13.5 33.5v120h-151v-122q0 -82 57.5 -139t139.5 -57q81 0 138.5 56.5t57.5 136.5v280q0 19 13.5 33t33.5 14q19 0 32.5 -14t13.5 -33v-54zM1199 502v122h-150 v-126q0 -20 -13.5 -33.5t-33.5 -13.5q-19 0 -32.5 14t-13.5 33v123l-90 -26l-60 28v-123q0 -80 58 -137t139 -57t138.5 57t57.5 139zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103 t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1062 824v118q0 42 -30 72t-72 30t-72 -30t-30 -72v-612q0 -175 -126 -299t-303 -124q-178 0 -303.5 125.5t-125.5 303.5v266h328v-262q0 -43 30 -72.5t72 -29.5t72 29.5t30 72.5v620q0 171 126.5 292t301.5 121q176 0 302 -122t126 -294v-136l-195 -58zM1592 602h328 v-266q0 -178 -125.5 -303.5t-303.5 -125.5q-177 0 -303 124.5t-126 300.5v268l131 -61l195 58v-270q0 -42 30 -71.5t72 -29.5t72 29.5t30 71.5v275z" /> +<glyph unicode="" d="M1472 160v480h-704v704h-480q-93 0 -158.5 -65.5t-65.5 -158.5v-480h704v-704h480q93 0 158.5 65.5t65.5 158.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M328 1254h204v-983h-532v697h328v286zM328 435v369h-123v-369h123zM614 968v-697h205v697h-205zM614 1254v-204h205v204h-205zM901 968h533v-942h-533v163h328v82h-328v697zM1229 435v369h-123v-369h123zM1516 968h532v-942h-532v163h327v82h-327v697zM1843 435v369h-123 v-369h123z" /> +<glyph unicode="" d="M1046 516q0 -64 -38 -109t-91 -45q-43 0 -70 15v277q28 17 70 17q53 0 91 -45.5t38 -109.5zM703 944q0 -64 -38 -109.5t-91 -45.5q-43 0 -70 15v277q28 17 70 17q53 0 91 -45t38 -109zM1265 513q0 134 -88 229t-213 95q-20 0 -39 -3q-23 -78 -78 -136q-87 -95 -211 -101 v-636l211 41v206q51 -19 117 -19q125 0 213 95t88 229zM922 940q0 134 -88.5 229t-213.5 95q-74 0 -141 -36h-186v-840l211 41v206q55 -19 116 -19q125 0 213.5 95t88.5 229zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2038" d="M1222 607q75 3 143.5 -20.5t118 -58.5t101 -94.5t84 -108t75.5 -120.5q33 -56 78.5 -109t75.5 -80.5t99 -88.5q-48 -30 -108.5 -57.5t-138.5 -59t-114 -47.5q-44 37 -74 115t-43.5 164.5t-33 180.5t-42.5 168.5t-72.5 123t-122.5 48.5l-10 -2l-6 -4q4 -5 13 -14 q6 -5 28 -23.5t25.5 -22t19 -18t18 -20.5t11.5 -21t10.5 -27.5t4.5 -31t4 -40.5l1 -33q1 -26 -2.5 -57.5t-7.5 -52t-12.5 -58.5t-11.5 -53q-35 1 -101 -9.5t-98 -10.5q-39 0 -72 10q-2 16 -2 47q0 74 3 96q2 13 31.5 41.5t57 59t26.5 51.5q-24 2 -43 -24 q-36 -53 -111.5 -99.5t-136.5 -46.5q-25 0 -75.5 63t-106.5 139.5t-84 96.5q-6 4 -27 30q-482 -112 -513 -112q-16 0 -28 11t-12 27q0 15 8.5 26.5t22.5 14.5l486 106q-8 14 -8 25t5.5 17.5t16 11.5t20 7t23 4.5t18.5 4.5q4 1 15.5 7.5t17.5 6.5q15 0 28 -16t20 -33 q163 37 172 37q17 0 29.5 -11t12.5 -28q0 -15 -8.5 -26t-23.5 -14l-182 -40l-1 -16q-1 -26 81.5 -117.5t104.5 -91.5q47 0 119 80t72 129q0 36 -23.5 53t-51 18.5t-51 11.5t-23.5 34q0 16 10 34l-68 19q43 44 43 117q0 26 -5 58q82 16 144 16q44 0 71.5 -1.5t48.5 -8.5 t31 -13.5t20.5 -24.5t15.5 -33.5t17 -47.5t24 -60l50 25q-3 -40 -23 -60t-42.5 -21t-40 -6.5t-16.5 -20.5zM1282 842q-5 5 -13.5 15.5t-12 14.5t-10.5 11.5t-10 10.5l-8 8t-8.5 7.5t-8 5t-8.5 4.5q-7 3 -14.5 5t-20.5 2.5t-22 0.5h-32.5h-37.5q-126 0 -217 -43 q16 30 36 46.5t54 29.5t65.5 36t46 36.5t50 55t43.5 50.5q12 -9 28 -31.5t32 -36.5t38 -13l12 1v-76l22 -1q247 95 371 190q28 21 50 39t42.5 37.5t33 31t29.5 34t24 31t24.5 37t23 38t27 47.5t29.5 53l7 9q-2 -53 -43 -139q-79 -165 -205 -264t-306 -142q-14 -3 -42 -7.5 t-50 -9.5t-39 -14q3 -19 24.5 -46t21.5 -34q0 -11 -26 -30zM1061 -79q39 26 131.5 47.5t146.5 21.5q9 0 22.5 -15.5t28 -42.5t26 -50t24 -51t14.5 -33q-121 -45 -244 -45q-61 0 -125 11zM822 568l48 12l109 -177l-73 -48zM1323 51q3 -15 3 -16q0 -7 -17.5 -14.5t-46 -13 t-54 -9.5t-53.5 -7.5t-32 -4.5l-7 43q21 2 60.5 8.5t72 10t60.5 3.5h14zM866 679l-96 -20l-6 17q10 1 32.5 7t34.5 6q19 0 35 -10zM1061 45h31l10 -83l-41 -12v95zM1950 1535v1v-1zM1950 1535l-1 -5l-2 -2l1 3zM1950 1535l1 1z" /> +<glyph unicode="" d="M1167 -50q-5 19 -24 5q-30 -22 -87 -39t-131 -17q-129 0 -193 49q-5 4 -13 4q-11 0 -26 -12q-7 -6 -7.5 -16t7.5 -20q34 -32 87.5 -46t102.5 -12.5t99 4.5q41 4 84.5 20.5t65 30t28.5 20.5q12 12 7 29zM1128 65q-19 47 -39 61q-23 15 -76 15q-47 0 -71 -10 q-29 -12 -78 -56q-26 -24 -12 -44q9 -8 17.5 -4.5t31.5 23.5q3 2 10.5 8.5t10.5 8.5t10 7t11.5 7t12.5 5t15 4.5t16.5 2.5t20.5 1q27 0 44.5 -7.5t23 -14.5t13.5 -22q10 -17 12.5 -20t12.5 1q23 12 14 34zM1483 346q0 22 -5 44.5t-16.5 45t-34 36.5t-52.5 14 q-33 0 -97 -41.5t-129 -83.5t-101 -42q-27 -1 -63.5 19t-76 49t-83.5 58t-100 49t-111 19q-115 -1 -197 -78.5t-84 -178.5q-2 -112 74 -164q29 -20 62.5 -28.5t103.5 -8.5q57 0 132 32.5t134 71t120 70.5t93 31q26 -1 65 -31.5t71.5 -67t68 -67.5t55.5 -32q35 -3 58.5 14 t55.5 63q28 41 42.5 101t14.5 106zM1536 506q0 -164 -62 -304.5t-166 -236t-242.5 -149.5t-290.5 -54t-293 57.5t-247.5 157t-170.5 241.5t-64 302q0 89 19.5 172.5t49 145.5t70.5 118.5t78.5 94t78.5 69.5t64.5 46.5t42.5 24.5q14 8 51 26.5t54.5 28.5t48 30t60.5 44 q36 28 58 72.5t30 125.5q129 -155 186 -193q44 -29 130 -68t129 -66q21 -13 39 -25t60.5 -46.5t76 -70.5t75 -95t69 -122t47 -148.5t19.5 -177.5z" /> +<glyph unicode="" d="M1070 463l-160 -160l-151 -152l-30 -30q-65 -64 -151.5 -87t-171.5 -2q-16 -70 -72 -115t-129 -45q-85 0 -145 60.5t-60 145.5q0 72 44.5 128t113.5 72q-22 86 1 173t88 152l12 12l151 -152l-11 -11q-37 -37 -37 -89t37 -90q37 -37 89 -37t89 37l30 30l151 152l161 160z M729 1145l12 -12l-152 -152l-12 12q-37 37 -89 37t-89 -37t-37 -89.5t37 -89.5l29 -29l152 -152l160 -160l-151 -152l-161 160l-151 152l-30 30q-68 67 -90 159.5t5 179.5q-70 15 -115 71t-45 129q0 85 60 145.5t145 60.5q76 0 133.5 -49t69.5 -123q84 20 169.5 -3.5 t149.5 -87.5zM1536 78q0 -85 -60 -145.5t-145 -60.5q-74 0 -131 47t-71 118q-86 -28 -179.5 -6t-161.5 90l-11 12l151 152l12 -12q37 -37 89 -37t89 37t37 89t-37 89l-30 30l-152 152l-160 160l152 152l160 -160l152 -152l29 -30q64 -64 87.5 -150.5t2.5 -171.5 q76 -11 126.5 -68.5t50.5 -134.5zM1534 1202q0 -77 -51 -135t-127 -69q26 -85 3 -176.5t-90 -158.5l-12 -12l-151 152l12 12q37 37 37 89t-37 89t-89 37t-89 -37l-30 -30l-152 -152l-160 -160l-152 152l161 160l152 152l29 30q67 67 159 89.5t178 -3.5q11 75 68.5 126 t135.5 51q85 0 145 -60.5t60 -145.5z" /> +<glyph unicode="" d="M654 458q-1 -3 -12.5 0.5t-31.5 11.5l-20 9q-44 20 -87 49q-7 5 -41 31.5t-38 28.5q-67 -103 -134 -181q-81 -95 -105 -110q-4 -2 -19.5 -4t-18.5 0q6 4 82 92q21 24 85.5 115t78.5 118q17 30 51 98.5t36 77.5q-8 1 -110 -33q-8 -2 -27.5 -7.5t-34.5 -9.5t-17 -5 q-2 -2 -2 -10.5t-1 -9.5q-5 -10 -31 -15q-23 -7 -47 0q-18 4 -28 21q-4 6 -5 23q6 2 24.5 5t29.5 6q58 16 105 32q100 35 102 35q10 2 43 19.5t44 21.5q9 3 21.5 8t14.5 5.5t6 -0.5q2 -12 -1 -33q0 -2 -12.5 -27t-26.5 -53.5t-17 -33.5q-25 -50 -77 -131l64 -28 q12 -6 74.5 -32t67.5 -28q4 -1 10.5 -25.5t4.5 -30.5zM449 944q3 -15 -4 -28q-12 -23 -50 -38q-30 -12 -60 -12q-26 3 -49 26q-14 15 -18 41l1 3q3 -3 19.5 -5t26.5 0t58 16q36 12 55 14q17 0 21 -17zM1147 815l63 -227l-139 42zM39 15l694 232v1032l-694 -233v-1031z M1280 332l102 -31l-181 657l-100 31l-216 -536l102 -31l45 110l211 -65zM777 1294l573 -184v380zM1088 -29l158 -13l-54 -160l-40 66q-130 -83 -276 -108q-58 -12 -91 -12h-84q-79 0 -199.5 39t-183.5 85q-8 7 -8 16q0 8 5 13.5t13 5.5q4 0 18 -7.5t30.5 -16.5t20.5 -11 q73 -37 159.5 -61.5t157.5 -24.5q95 0 167 14.5t157 50.5q15 7 30.5 15.5t34 19t28.5 16.5zM1536 1050v-1079l-774 246q-14 -6 -375 -127.5t-368 -121.5q-13 0 -18 13q0 1 -1 3v1078q3 9 4 10q5 6 20 11q106 35 149 50v384l558 -198q2 0 160.5 55t316 108.5t161.5 53.5 q20 0 20 -21v-418z" /> +<glyph unicode="" horiz-adv-x="1792" d="M288 1152q66 0 113 -47t47 -113v-1088q0 -66 -47 -113t-113 -47h-128q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h128zM1664 989q58 -34 93 -93t35 -128v-768q0 -106 -75 -181t-181 -75h-864q-66 0 -113 47t-47 113v1536q0 40 28 68t68 28h672q40 0 88 -20t76 -48 l152 -152q28 -28 48 -76t20 -88v-163zM928 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM928 256v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM928 512v128q0 14 -9 23 t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1184 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1184 256v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128 q14 0 23 9t9 23zM1184 512v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 256v128q0 14 -9 23t-23 9h-128 q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 512v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1536 896v256h-160q-40 0 -68 28t-28 68v160h-640v-512h896z" /> +<glyph unicode="" d="M1344 1536q26 0 45 -19t19 -45v-1664q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h1280zM512 1248v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 992v-64q0 -14 9 -23t23 -9h64q14 0 23 9 t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 736v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 480v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM384 160v64 q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64 q14 0 23 9t9 23zM384 928v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 -96v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9 t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM896 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 928v64 q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 160v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64 q14 0 23 9t9 23zM1152 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 928v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9 t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1188 988l-292 -292v-824q0 -46 -33 -79t-79 -33t-79 33t-33 79v384h-64v-384q0 -46 -33 -79t-79 -33t-79 33t-33 79v824l-292 292q-28 28 -28 68t28 68t68 28t68 -28l228 -228h368l228 228q28 28 68 28t68 -28t28 -68t-28 -68zM864 1152q0 -93 -65.5 -158.5 t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M780 1064q0 -60 -19 -113.5t-63 -92.5t-105 -39q-76 0 -138 57.5t-92 135.5t-30 151q0 60 19 113.5t63 92.5t105 39q77 0 138.5 -57.5t91.5 -135t30 -151.5zM438 581q0 -80 -42 -139t-119 -59q-76 0 -141.5 55.5t-100.5 133.5t-35 152q0 80 42 139.5t119 59.5 q76 0 141.5 -55.5t100.5 -134t35 -152.5zM832 608q118 0 255 -97.5t229 -237t92 -254.5q0 -46 -17 -76.5t-48.5 -45t-64.5 -20t-76 -5.5q-68 0 -187.5 45t-182.5 45q-66 0 -192.5 -44.5t-200.5 -44.5q-183 0 -183 146q0 86 56 191.5t139.5 192.5t187.5 146t193 59zM1071 819 q-61 0 -105 39t-63 92.5t-19 113.5q0 74 30 151.5t91.5 135t138.5 57.5q61 0 105 -39t63 -92.5t19 -113.5q0 -73 -30 -151t-92 -135.5t-138 -57.5zM1503 923q77 0 119 -59.5t42 -139.5q0 -74 -35 -152t-100.5 -133.5t-141.5 -55.5q-77 0 -119 59t-42 139q0 74 35 152.5 t100.5 134t141.5 55.5z" /> +<glyph unicode="" horiz-adv-x="768" d="M704 1008q0 -145 -57 -243.5t-152 -135.5l45 -821q2 -26 -16 -45t-44 -19h-192q-26 0 -44 19t-16 45l45 821q-95 37 -152 135.5t-57 243.5q0 128 42.5 249.5t117.5 200t160 78.5t160 -78.5t117.5 -200t42.5 -249.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 -93l640 349v636l-640 -233v-752zM832 772l698 254l-698 254l-698 -254zM1664 1024v-768q0 -35 -18 -65t-49 -47l-704 -384q-28 -16 -61 -16t-61 16l-704 384q-31 17 -49 47t-18 65v768q0 40 23 73t61 47l704 256q22 8 44 8t44 -8l704 -256q38 -14 61 -47t23 -73z " /> +<glyph unicode="" horiz-adv-x="2304" d="M640 -96l384 192v314l-384 -164v-342zM576 358l404 173l-404 173l-404 -173zM1664 -96l384 192v314l-384 -164v-342zM1600 358l404 173l-404 173l-404 -173zM1152 651l384 165v266l-384 -164v-267zM1088 1030l441 189l-441 189l-441 -189zM2176 512v-416q0 -36 -19 -67 t-52 -47l-448 -224q-25 -14 -57 -14t-57 14l-448 224q-5 2 -7 4q-2 -2 -7 -4l-448 -224q-25 -14 -57 -14t-57 14l-448 224q-33 16 -52 47t-19 67v416q0 38 21.5 70t56.5 48l434 186v400q0 38 21.5 70t56.5 48l448 192q23 10 50 10t50 -10l448 -192q35 -16 56.5 -48t21.5 -70 v-400l434 -186q36 -16 57 -48t21 -70z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1848 1197h-511v-124h511v124zM1596 771q-90 0 -146 -52.5t-62 -142.5h408q-18 195 -200 195zM1612 186q63 0 122 32t76 87h221q-100 -307 -427 -307q-214 0 -340.5 132t-126.5 347q0 208 130.5 345.5t336.5 137.5q138 0 240.5 -68t153 -179t50.5 -248q0 -17 -2 -47h-658 q0 -111 57.5 -171.5t166.5 -60.5zM277 236h296q205 0 205 167q0 180 -199 180h-302v-347zM277 773h281q78 0 123.5 36.5t45.5 113.5q0 144 -190 144h-260v-294zM0 1282h594q87 0 155 -14t126.5 -47.5t90 -96.5t31.5 -154q0 -181 -172 -263q114 -32 172 -115t58 -204 q0 -75 -24.5 -136.5t-66 -103.5t-98.5 -71t-121 -42t-134 -13h-611v1260z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM499 1041h-371v-787h382q117 0 197 57.5t80 170.5q0 158 -143 200q107 52 107 164q0 57 -19.5 96.5 t-56.5 60.5t-79 29.5t-97 8.5zM477 723h-176v184h163q119 0 119 -90q0 -94 -106 -94zM486 388h-185v217h189q124 0 124 -113q0 -104 -128 -104zM1136 356q-68 0 -104 38t-36 107h411q1 10 1 30q0 132 -74.5 220.5t-203.5 88.5q-128 0 -210 -86t-82 -216q0 -135 79 -217 t213 -82q205 0 267 191h-138q-11 -34 -47.5 -54t-75.5 -20zM1126 722q113 0 124 -122h-254q4 56 39 89t91 33zM964 988h319v-77h-319v77z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1582 954q0 -101 -71.5 -172.5t-172.5 -71.5t-172.5 71.5t-71.5 172.5t71.5 172.5t172.5 71.5t172.5 -71.5t71.5 -172.5zM812 212q0 104 -73 177t-177 73q-27 0 -54 -6l104 -42q77 -31 109.5 -106.5t1.5 -151.5q-31 -77 -107 -109t-152 -1q-21 8 -62 24.5t-61 24.5 q32 -60 91 -96.5t130 -36.5q104 0 177 73t73 177zM1642 953q0 126 -89.5 215.5t-215.5 89.5q-127 0 -216.5 -89.5t-89.5 -215.5q0 -127 89.5 -216t216.5 -89q126 0 215.5 89t89.5 216zM1792 953q0 -189 -133.5 -322t-321.5 -133l-437 -319q-12 -129 -109 -218t-229 -89 q-121 0 -214 76t-118 192l-230 92v429l389 -157q79 48 173 48q13 0 35 -2l284 407q2 187 135.5 319t320.5 132q188 0 321.5 -133.5t133.5 -321.5z" /> +<glyph unicode="" d="M1242 889q0 80 -57 136.5t-137 56.5t-136.5 -57t-56.5 -136q0 -80 56.5 -136.5t136.5 -56.5t137 56.5t57 136.5zM632 301q0 -83 -58 -140.5t-140 -57.5q-56 0 -103 29t-72 77q52 -20 98 -40q60 -24 120 1.5t85 86.5q24 60 -1.5 120t-86.5 84l-82 33q22 5 42 5 q82 0 140 -57.5t58 -140.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v153l172 -69q20 -92 93.5 -152t168.5 -60q104 0 181 70t87 173l345 252q150 0 255.5 105.5t105.5 254.5q0 150 -105.5 255.5t-255.5 105.5 q-148 0 -253 -104.5t-107 -252.5l-225 -322q-9 1 -28 1q-75 0 -137 -37l-297 119v468q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5zM1289 887q0 -100 -71 -170.5t-171 -70.5t-170.5 70.5t-70.5 170.5t70.5 171t170.5 71q101 0 171.5 -70.5t70.5 -171.5z " /> +<glyph unicode="" horiz-adv-x="1792" d="M836 367l-15 -368l-2 -22l-420 29q-36 3 -67 31.5t-47 65.5q-11 27 -14.5 55t4 65t12 55t21.5 64t19 53q78 -12 509 -28zM449 953l180 -379l-147 92q-63 -72 -111.5 -144.5t-72.5 -125t-39.5 -94.5t-18.5 -63l-4 -21l-190 357q-17 26 -18 56t6 47l8 18q35 63 114 188 l-140 86zM1680 436l-188 -359q-12 -29 -36.5 -46.5t-43.5 -20.5l-18 -4q-71 -7 -219 -12l8 -164l-230 367l211 362l7 -173q170 -16 283 -5t170 33zM895 1360q-47 -63 -265 -435l-317 187l-19 12l225 356q20 31 60 45t80 10q24 -2 48.5 -12t42 -21t41.5 -33t36 -34.5 t36 -39.5t32 -35zM1550 1053l212 -363q18 -37 12.5 -76t-27.5 -74q-13 -20 -33 -37t-38 -28t-48.5 -22t-47 -16t-51.5 -14t-46 -12q-34 72 -265 436l313 195zM1407 1279l142 83l-220 -373l-419 20l151 86q-34 89 -75 166t-75.5 123.5t-64.5 80t-47 46.5l-17 13l405 -1 q31 3 58 -10.5t39 -28.5l11 -15q39 -61 112 -190z" /> +<glyph unicode="" horiz-adv-x="2048" d="M480 448q0 66 -47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47t113 47t47 113zM516 768h1016l-89 357q-2 8 -14 17.5t-21 9.5h-768q-9 0 -21 -9.5t-14 -17.5zM1888 448q0 66 -47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47t113 47t47 113zM2048 544v-384 q0 -14 -9 -23t-23 -9h-96v-128q0 -80 -56 -136t-136 -56t-136 56t-56 136v128h-1024v-128q0 -80 -56 -136t-136 -56t-136 56t-56 136v128h-96q-14 0 -23 9t-9 23v384q0 93 65.5 158.5t158.5 65.5h28l105 419q23 94 104 157.5t179 63.5h768q98 0 179 -63.5t104 -157.5 l105 -419h28q93 0 158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1824 640q93 0 158.5 -65.5t65.5 -158.5v-384q0 -14 -9 -23t-23 -9h-96v-64q0 -80 -56 -136t-136 -56t-136 56t-56 136v64h-1024v-64q0 -80 -56 -136t-136 -56t-136 56t-56 136v64h-96q-14 0 -23 9t-9 23v384q0 93 65.5 158.5t158.5 65.5h28l105 419q23 94 104 157.5 t179 63.5h128v224q0 14 9 23t23 9h448q14 0 23 -9t9 -23v-224h128q98 0 179 -63.5t104 -157.5l105 -419h28zM320 160q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47zM516 640h1016l-89 357q-2 8 -14 17.5t-21 9.5h-768q-9 0 -21 -9.5t-14 -17.5z M1728 160q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47z" /> +<glyph unicode="" d="M1504 64q0 -26 -19 -45t-45 -19h-462q1 -17 6 -87.5t5 -108.5q0 -25 -18 -42.5t-43 -17.5h-320q-25 0 -43 17.5t-18 42.5q0 38 5 108.5t6 87.5h-462q-26 0 -45 19t-19 45t19 45l402 403h-229q-26 0 -45 19t-19 45t19 45l402 403h-197q-26 0 -45 19t-19 45t19 45l384 384 q19 19 45 19t45 -19l384 -384q19 -19 19 -45t-19 -45t-45 -19h-197l402 -403q19 -19 19 -45t-19 -45t-45 -19h-229l402 -403q19 -19 19 -45z" /> +<glyph unicode="" d="M1127 326q0 32 -30 51q-193 115 -447 115q-133 0 -287 -34q-42 -9 -42 -52q0 -20 13.5 -34.5t35.5 -14.5q5 0 37 8q132 27 243 27q226 0 397 -103q19 -11 33 -11q19 0 33 13.5t14 34.5zM1223 541q0 40 -35 61q-237 141 -548 141q-153 0 -303 -42q-48 -13 -48 -64 q0 -25 17.5 -42.5t42.5 -17.5q7 0 37 8q122 33 251 33q279 0 488 -124q24 -13 38 -13q25 0 42.5 17.5t17.5 42.5zM1331 789q0 47 -40 70q-126 73 -293 110.5t-343 37.5q-204 0 -364 -47q-23 -7 -38.5 -25.5t-15.5 -48.5q0 -31 20.5 -52t51.5 -21q11 0 40 8q133 37 307 37 q159 0 309.5 -34t253.5 -95q21 -12 40 -12q29 0 50.5 20.5t21.5 51.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 1233l-303 -582l24 -31h279v-415h-507l-44 -30l-142 -273l-30 -30h-301v303l303 583l-24 30h-279v415h507l44 30l142 273l30 30h301v-303z" /> +<glyph unicode="" horiz-adv-x="2304" d="M784 164l16 241l-16 523q-1 10 -7.5 17t-16.5 7q-9 0 -16 -7t-7 -17l-14 -523l14 -241q1 -10 7.5 -16.5t15.5 -6.5q22 0 24 23zM1080 193l11 211l-12 586q0 16 -13 24q-8 5 -16 5t-16 -5q-13 -8 -13 -24l-1 -6l-10 -579q0 -1 11 -236v-1q0 -10 6 -17q9 -11 23 -11 q11 0 20 9q9 7 9 20zM35 533l20 -128l-20 -126q-2 -9 -9 -9t-9 9l-17 126l17 128q2 9 9 9t9 -9zM121 612l26 -207l-26 -203q-2 -9 -10 -9q-9 0 -9 10l-23 202l23 207q0 9 9 9q8 0 10 -9zM401 159zM213 650l25 -245l-25 -237q0 -11 -11 -11q-10 0 -12 11l-21 237l21 245 q2 12 12 12q11 0 11 -12zM307 657l23 -252l-23 -244q-2 -13 -14 -13q-13 0 -13 13l-21 244l21 252q0 13 13 13q12 0 14 -13zM401 639l21 -234l-21 -246q-2 -16 -16 -16q-6 0 -10.5 4.5t-4.5 11.5l-20 246l20 234q0 6 4.5 10.5t10.5 4.5q14 0 16 -15zM784 164zM495 785 l21 -380l-21 -246q0 -7 -5 -12.5t-12 -5.5q-16 0 -18 18l-18 246l18 380q2 18 18 18q7 0 12 -5.5t5 -12.5zM589 871l19 -468l-19 -244q0 -8 -5.5 -13.5t-13.5 -5.5q-18 0 -20 19l-16 244l16 468q2 19 20 19q8 0 13.5 -5.5t5.5 -13.5zM687 911l18 -506l-18 -242 q-2 -21 -22 -21q-19 0 -21 21l-16 242l16 506q0 9 6.5 15.5t14.5 6.5q9 0 15 -6.5t7 -15.5zM1079 169v0v0zM881 915l15 -510l-15 -239q0 -10 -7.5 -17.5t-17.5 -7.5t-17 7t-8 18l-14 239l14 510q0 11 7.5 18t17.5 7t17.5 -7t7.5 -18zM980 896l14 -492l-14 -236q0 -11 -8 -19 t-19 -8t-19 8t-9 19l-12 236l12 492q1 12 9 20t19 8t18.5 -8t8.5 -20zM1192 404l-14 -231v0q0 -13 -9 -22t-22 -9t-22 9t-10 22l-6 114l-6 117l12 636v3q2 15 12 24q9 7 20 7q8 0 15 -5q14 -8 16 -26zM2304 423q0 -117 -83 -199.5t-200 -82.5h-786q-13 2 -22 11t-9 22v899 q0 23 28 33q85 34 181 34q195 0 338 -131.5t160 -323.5q53 22 110 22q117 0 200 -83t83 -201z" /> +<glyph unicode="" d="M768 768q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127t443 -43zM768 0q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127 t443 -43zM768 384q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127t443 -43zM768 1536q208 0 385 -34.5t280 -93.5t103 -128v-128q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5 t-103 128v128q0 69 103 128t280 93.5t385 34.5z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M894 465q33 -26 84 -56q59 7 117 7q147 0 177 -49q16 -22 2 -52q0 -1 -1 -2l-2 -2v-1q-6 -38 -71 -38q-48 0 -115 20t-130 53q-221 -24 -392 -83q-153 -262 -242 -262q-15 0 -28 7l-24 12q-1 1 -6 5q-10 10 -6 36q9 40 56 91.5t132 96.5q14 9 23 -6q2 -2 2 -4q52 85 107 197 q68 136 104 262q-24 82 -30.5 159.5t6.5 127.5q11 40 42 40h21h1q23 0 35 -15q18 -21 9 -68q-2 -6 -4 -8q1 -3 1 -8v-30q-2 -123 -14 -192q55 -164 146 -238zM318 54q52 24 137 158q-51 -40 -87.5 -84t-49.5 -74zM716 974q-15 -42 -2 -132q1 7 7 44q0 3 7 43q1 4 4 8 q-1 1 -1 2t-0.5 1.5t-0.5 1.5q-1 22 -13 36q0 -1 -1 -2v-2zM592 313q135 54 284 81q-2 1 -13 9.5t-16 13.5q-76 67 -127 176q-27 -86 -83 -197q-30 -56 -45 -83zM1238 329q-24 24 -140 24q76 -28 124 -28q14 0 18 1q0 1 -2 3z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M233 768v-107h70l164 -661h159l128 485q7 20 10 46q2 16 2 24h4l3 -24q1 -3 3.5 -20t5.5 -26l128 -485h159l164 661h70v107h-300v-107h90l-99 -438q-5 -20 -7 -46l-2 -21h-4l-3 21q-1 5 -4 21t-5 25l-144 545h-114l-144 -545q-2 -9 -4.5 -24.5t-3.5 -21.5l-4 -21h-4l-2 21 q-2 26 -7 46l-99 438h90v107h-300z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M429 106v-106h281v106h-75l103 161q5 7 10 16.5t7.5 13.5t3.5 4h2q1 -4 5 -10q2 -4 4.5 -7.5t6 -8t6.5 -8.5l107 -161h-76v-106h291v106h-68l-192 273l195 282h67v107h-279v-107h74l-103 -159q-4 -7 -10 -16.5t-9 -13.5l-2 -3h-2q-1 4 -5 10q-6 11 -17 23l-106 159h76v107 h-290v-107h68l189 -272l-194 -283h-68z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M416 106v-106h327v106h-93v167h137q76 0 118 15q67 23 106.5 87t39.5 146q0 81 -37 141t-100 87q-48 19 -130 19h-368v-107h92v-555h-92zM769 386h-119v268h120q52 0 83 -18q56 -33 56 -115q0 -89 -62 -120q-31 -15 -78 -15z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M1280 320v-320h-1024v192l192 192l128 -128l384 384zM448 512q-80 0 -136 56t-56 136t56 136t136 56t136 -56t56 -136t-56 -136t-136 -56z" /> +<glyph unicode="" d="M640 1152v128h-128v-128h128zM768 1024v128h-128v-128h128zM640 896v128h-128v-128h128zM768 768v128h-128v-128h128zM1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400 v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-128v-128h-128v128h-512v-1536h1280zM781 593l107 -349q8 -27 8 -52q0 -83 -72.5 -137.5t-183.5 -54.5t-183.5 54.5t-72.5 137.5q0 25 8 52q21 63 120 396v128h128v-128h79 q22 0 39 -13t23 -34zM640 128q53 0 90.5 19t37.5 45t-37.5 45t-90.5 19t-90.5 -19t-37.5 -45t37.5 -45t90.5 -19z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M620 686q20 -8 20 -30v-544q0 -22 -20 -30q-8 -2 -12 -2q-12 0 -23 9l-166 167h-131q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h131l166 167q16 15 35 7zM1037 -3q31 0 50 24q129 159 129 363t-129 363q-16 21 -43 24t-47 -14q-21 -17 -23.5 -43.5t14.5 -47.5 q100 -123 100 -282t-100 -282q-17 -21 -14.5 -47.5t23.5 -42.5q18 -15 40 -15zM826 145q27 0 47 20q87 93 87 219t-87 219q-18 19 -45 20t-46 -17t-20 -44.5t18 -46.5q52 -57 52 -131t-52 -131q-19 -20 -18 -46.5t20 -44.5q20 -17 44 -17z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M768 768q52 0 90 -38t38 -90v-384q0 -52 -38 -90t-90 -38h-384q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h384zM1260 766q20 -8 20 -30v-576q0 -22 -20 -30q-8 -2 -12 -2q-14 0 -23 9l-265 266v90l265 266q9 9 23 9q4 0 12 -2z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M480 768q8 11 21 12.5t24 -6.5l51 -38q11 -8 12.5 -21t-6.5 -24l-182 -243l182 -243q8 -11 6.5 -24t-12.5 -21l-51 -38q-11 -8 -24 -6.5t-21 12.5l-226 301q-14 19 0 38zM1282 467q14 -19 0 -38l-226 -301q-8 -11 -21 -12.5t-24 6.5l-51 38q-11 8 -12.5 21t6.5 24l182 243 l-182 243q-8 11 -6.5 24t12.5 21l51 38q11 8 24 6.5t21 -12.5zM662 6q-13 2 -20.5 13t-5.5 24l138 831q2 13 13 20.5t24 5.5l63 -10q13 -2 20.5 -13t5.5 -24l-138 -831q-2 -13 -13 -20.5t-24 -5.5z" /> +<glyph unicode="" d="M1497 709v-198q-101 -23 -198 -23q-65 -136 -165.5 -271t-181.5 -215.5t-128 -106.5q-80 -45 -162 3q-28 17 -60.5 43.5t-85 83.5t-102.5 128.5t-107.5 184t-105.5 244t-91.5 314.5t-70.5 390h283q26 -218 70 -398.5t104.5 -317t121.5 -235.5t140 -195q169 169 287 406 q-142 72 -223 220t-81 333q0 192 104 314.5t284 122.5q178 0 273 -105.5t95 -297.5q0 -159 -58 -286q-7 -1 -19.5 -3t-46 -2t-63 6t-62 25.5t-50.5 51.5q31 103 31 184q0 87 -29 132t-79 45q-53 0 -85 -49.5t-32 -140.5q0 -186 105 -293.5t267 -107.5q62 0 121 14z" /> +<glyph unicode="" horiz-adv-x="1792" d="M216 367l603 -402v359l-334 223zM154 511l193 129l-193 129v-258zM973 -35l603 402l-269 180l-334 -223v-359zM896 458l272 182l-272 182l-272 -182zM485 733l334 223v359l-603 -402zM1445 640l193 -129v258zM1307 733l269 180l-603 402v-359zM1792 913v-546 q0 -41 -34 -64l-819 -546q-21 -13 -43 -13t-43 13l-819 546q-34 23 -34 64v546q0 41 34 64l819 546q21 13 43 13t43 -13l819 -546q34 -23 34 -64z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1800 764q111 -46 179.5 -145.5t68.5 -221.5q0 -164 -118 -280.5t-285 -116.5q-4 0 -11.5 0.5t-10.5 0.5h-1209h-1h-2h-5q-170 10 -288 125.5t-118 280.5q0 110 55 203t147 147q-12 39 -12 82q0 115 82 196t199 81q95 0 172 -58q75 154 222.5 248t326.5 94 q166 0 306 -80.5t221.5 -218.5t81.5 -301q0 -6 -0.5 -18t-0.5 -18zM468 498q0 -122 84 -193t208 -71q137 0 240 99q-16 20 -47.5 56.5t-43.5 50.5q-67 -65 -144 -65q-55 0 -93.5 33.5t-38.5 87.5q0 53 38.5 87t91.5 34q44 0 84.5 -21t73 -55t65 -75t69 -82t77 -75t97 -55 t121.5 -21q121 0 204.5 71.5t83.5 190.5q0 121 -84 192t-207 71q-143 0 -241 -97q14 -16 29.5 -34t34.5 -40t29 -34q66 64 142 64q52 0 92 -33t40 -84q0 -57 -37 -91.5t-94 -34.5q-43 0 -82.5 21t-72 55t-65.5 75t-69.5 82t-77.5 75t-96.5 55t-118.5 21q-122 0 -207 -70.5 t-85 -189.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM896 1408q-190 0 -361 -90l194 -194q82 28 167 28t167 -28l194 194q-171 90 -361 90zM218 279l194 194 q-28 82 -28 167t28 167l-194 194q-90 -171 -90 -361t90 -361zM896 -128q190 0 361 90l-194 194q-82 -28 -167 -28t-167 28l-194 -194q171 -90 361 -90zM896 256q159 0 271.5 112.5t112.5 271.5t-112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5 t271.5 -112.5zM1380 473l194 -194q90 171 90 361t-90 361l-194 -194q28 -82 28 -167t-28 -167z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348q0 222 101 414.5t276.5 317t390.5 155.5v-260q-221 -45 -366.5 -221t-145.5 -406q0 -130 51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5 q0 230 -145.5 406t-366.5 221v260q215 -31 390.5 -155.5t276.5 -317t101 -414.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M19 662q8 217 116 406t305 318h5q0 -1 -1 -3q-8 -8 -28 -33.5t-52 -76.5t-60 -110.5t-44.5 -135.5t-14 -150.5t39 -157.5t108.5 -154q50 -50 102 -69.5t90.5 -11.5t69.5 23.5t47 32.5l16 16q39 51 53 116.5t6.5 122.5t-21 107t-26.5 80l-14 29q-10 25 -30.5 49.5t-43 41 t-43.5 29.5t-35 19l-13 6l104 115q39 -17 78 -52t59 -61l19 -27q1 48 -18.5 103.5t-40.5 87.5l-20 31l161 183l160 -181q-33 -46 -52.5 -102.5t-22.5 -90.5l-4 -33q22 37 61.5 72.5t67.5 52.5l28 17l103 -115q-44 -14 -85 -50t-60 -65l-19 -29q-31 -56 -48 -133.5t-7 -170 t57 -156.5q33 -45 77.5 -60.5t85 -5.5t76 26.5t57.5 33.5l21 16q60 53 96.5 115t48.5 121.5t10 121.5t-18 118t-37 107.5t-45.5 93t-45 72t-34.5 47.5l-13 17q-14 13 -7 13l10 -3q40 -29 62.5 -46t62 -50t64 -58t58.5 -65t55.5 -77t45.5 -88t38 -103t23.5 -117t10.5 -136 q3 -259 -108 -465t-312 -321t-456 -115q-185 0 -351 74t-283.5 198t-184 293t-60.5 353z" /> +<glyph unicode="" horiz-adv-x="1792" d="M874 -102v-66q-208 6 -385 109.5t-283 275.5l58 34q29 -49 73 -99l65 57q148 -168 368 -212l-17 -86q65 -12 121 -13zM276 428l-83 -28q22 -60 49 -112l-57 -33q-98 180 -98 385t98 385l57 -33q-30 -56 -49 -112l82 -28q-35 -100 -35 -212q0 -109 36 -212zM1528 251 l58 -34q-106 -172 -283 -275.5t-385 -109.5v66q56 1 121 13l-17 86q220 44 368 212l65 -57q44 50 73 99zM1377 805l-233 -80q14 -42 14 -85t-14 -85l232 -80q-31 -92 -98 -169l-185 162q-57 -67 -147 -85l48 -241q-52 -10 -98 -10t-98 10l48 241q-90 18 -147 85l-185 -162 q-67 77 -98 169l232 80q-14 42 -14 85t14 85l-233 80q33 93 99 169l185 -162q59 68 147 86l-48 240q44 10 98 10t98 -10l-48 -240q88 -18 147 -86l185 162q66 -76 99 -169zM874 1448v-66q-65 -2 -121 -13l17 -86q-220 -42 -368 -211l-65 56q-38 -42 -73 -98l-57 33 q106 172 282 275.5t385 109.5zM1705 640q0 -205 -98 -385l-57 33q27 52 49 112l-83 28q36 103 36 212q0 112 -35 212l82 28q-19 56 -49 112l57 33q98 -180 98 -385zM1585 1063l-57 -33q-35 56 -73 98l-65 -56q-148 169 -368 211l17 86q-56 11 -121 13v66q209 -6 385 -109.5 t282 -275.5zM1748 640q0 173 -67.5 331t-181.5 272t-272 181.5t-331 67.5t-331 -67.5t-272 -181.5t-181.5 -272t-67.5 -331t67.5 -331t181.5 -272t272 -181.5t331 -67.5t331 67.5t272 181.5t181.5 272t67.5 331zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71 t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" d="M582 228q0 -66 -93 -66q-107 0 -107 63q0 64 98 64q102 0 102 -61zM546 694q0 -85 -74 -85q-77 0 -77 84q0 90 77 90q36 0 55 -25.5t19 -63.5zM712 769v125q-78 -29 -135 -29q-50 29 -110 29q-86 0 -145 -57t-59 -143q0 -50 29.5 -102t73.5 -67v-3q-38 -17 -38 -85 q0 -53 41 -77v-3q-113 -37 -113 -139q0 -45 20 -78.5t54 -51t72 -25.5t81 -8q224 0 224 188q0 67 -48 99t-126 46q-27 5 -51.5 20.5t-24.5 39.5q0 44 49 52q77 15 122 70t45 134q0 24 -10 52q37 9 49 13zM771 350h137q-2 27 -2 82v387q0 46 2 69h-137q3 -23 3 -71v-392 q0 -50 -3 -75zM1280 366v121q-30 -21 -68 -21q-53 0 -53 82v225h52q9 0 26.5 -1t26.5 -1v117h-105q0 82 3 102h-140q4 -24 4 -55v-47h-60v-117q36 3 37 3q3 0 11 -0.5t12 -0.5v-2h-2v-217q0 -37 2.5 -64t11.5 -56.5t24.5 -48.5t43.5 -31t66 -12q64 0 108 24zM924 1072 q0 36 -24 63.5t-60 27.5t-60.5 -27t-24.5 -64q0 -36 25 -62.5t60 -26.5t59.5 27t24.5 62zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M595 22q0 100 -165 100q-158 0 -158 -104q0 -101 172 -101q151 0 151 105zM536 777q0 61 -30 102t-89 41q-124 0 -124 -145q0 -135 124 -135q119 0 119 137zM805 1101v-202q-36 -12 -79 -22q16 -43 16 -84q0 -127 -73 -216.5t-197 -112.5q-40 -8 -59.5 -27t-19.5 -58 q0 -31 22.5 -51.5t58 -32t78.5 -22t86 -25.5t78.5 -37.5t58 -64t22.5 -98.5q0 -304 -363 -304q-69 0 -130 12.5t-116 41t-87.5 82t-32.5 127.5q0 165 182 225v4q-67 41 -67 126q0 109 63 137v4q-72 24 -119.5 108.5t-47.5 165.5q0 139 95 231.5t235 92.5q96 0 178 -47 q98 0 218 47zM1123 220h-222q4 45 4 134v609q0 94 -4 128h222q-4 -33 -4 -124v-613q0 -89 4 -134zM1724 442v-196q-71 -39 -174 -39q-62 0 -107 20t-70 50t-39.5 78t-18.5 92t-4 103v351h2v4q-7 0 -19 1t-18 1q-21 0 -59 -6v190h96v76q0 54 -6 89h227q-6 -41 -6 -165h171 v-190q-15 0 -43.5 2t-42.5 2h-85v-365q0 -131 87 -131q61 0 109 33zM1148 1389q0 -58 -39 -101.5t-96 -43.5q-58 0 -98 43.5t-40 101.5q0 59 39.5 103t98.5 44q58 0 96.5 -44.5t38.5 -102.5z" /> +<glyph unicode="" d="M809 532l266 499h-112l-157 -312q-24 -48 -44 -92l-42 92l-155 312h-120l263 -493v-324h101v318zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M842 964q0 -80 -57 -136.5t-136 -56.5q-60 0 -111 35q-62 -67 -115 -146q-247 -371 -202 -859q1 -22 -12.5 -38.5t-34.5 -18.5h-5q-20 0 -35 13.5t-17 33.5q-14 126 -3.5 247.5t29.5 217t54 186t69 155.5t74 125q61 90 132 165q-16 35 -16 77q0 80 56.5 136.5t136.5 56.5 t136.5 -56.5t56.5 -136.5zM1223 953q0 -158 -78 -292t-212.5 -212t-292.5 -78q-64 0 -131 14q-21 5 -32.5 23.5t-6.5 39.5q5 20 23 31.5t39 7.5q51 -13 108 -13q97 0 186 38t153 102t102 153t38 186t-38 186t-102 153t-153 102t-186 38t-186 -38t-153 -102t-102 -153 t-38 -186q0 -114 52 -218q10 -20 3.5 -40t-25.5 -30t-39.5 -3t-30.5 26q-64 123 -64 265q0 119 46.5 227t124.5 186t186 124t226 46q158 0 292.5 -78t212.5 -212.5t78 -292.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M270 730q-8 19 -8 52q0 20 11 49t24 45q-1 22 7.5 53t22.5 43q0 139 92.5 288.5t217.5 209.5q139 66 324 66q133 0 266 -55q49 -21 90 -48t71 -56t55 -68t42 -74t32.5 -84.5t25.5 -89.5t22 -98l1 -5q55 -83 55 -150q0 -14 -9 -40t-9 -38q0 -1 1.5 -3.5t3.5 -5t2 -3.5 q77 -114 120.5 -214.5t43.5 -208.5q0 -43 -19.5 -100t-55.5 -57q-9 0 -19.5 7.5t-19 17.5t-19 26t-16 26.5t-13.5 26t-9 17.5q-1 1 -3 1l-5 -4q-59 -154 -132 -223q20 -20 61.5 -38.5t69 -41.5t35.5 -65q-2 -4 -4 -16t-7 -18q-64 -97 -302 -97q-53 0 -110.5 9t-98 20 t-104.5 30q-15 5 -23 7q-14 4 -46 4.5t-40 1.5q-41 -45 -127.5 -65t-168.5 -20q-35 0 -69 1.5t-93 9t-101 20.5t-74.5 40t-32.5 64q0 40 10 59.5t41 48.5q11 2 40.5 13t49.5 12q4 0 14 2q2 2 2 4l-2 3q-48 11 -108 105.5t-73 156.5l-5 3q-4 0 -12 -20q-18 -41 -54.5 -74.5 t-77.5 -37.5h-1q-4 0 -6 4.5t-5 5.5q-23 54 -23 100q0 275 252 466z" /> +<glyph unicode="" horiz-adv-x="2048" d="M580 1075q0 41 -25 66t-66 25q-43 0 -76 -25.5t-33 -65.5q0 -39 33 -64.5t76 -25.5q41 0 66 24.5t25 65.5zM1323 568q0 28 -25.5 50t-65.5 22q-27 0 -49.5 -22.5t-22.5 -49.5q0 -28 22.5 -50.5t49.5 -22.5q40 0 65.5 22t25.5 51zM1087 1075q0 41 -24.5 66t-65.5 25 q-43 0 -76 -25.5t-33 -65.5q0 -39 33 -64.5t76 -25.5q41 0 65.5 24.5t24.5 65.5zM1722 568q0 28 -26 50t-65 22q-27 0 -49.5 -22.5t-22.5 -49.5q0 -28 22.5 -50.5t49.5 -22.5q39 0 65 22t26 51zM1456 965q-31 4 -70 4q-169 0 -311 -77t-223.5 -208.5t-81.5 -287.5 q0 -78 23 -152q-35 -3 -68 -3q-26 0 -50 1.5t-55 6.5t-44.5 7t-54.5 10.5t-50 10.5l-253 -127l72 218q-290 203 -290 490q0 169 97.5 311t264 223.5t363.5 81.5q176 0 332.5 -66t262 -182.5t136.5 -260.5zM2048 404q0 -117 -68.5 -223.5t-185.5 -193.5l55 -181l-199 109 q-150 -37 -218 -37q-169 0 -311 70.5t-223.5 191.5t-81.5 264t81.5 264t223.5 191.5t311 70.5q161 0 303 -70.5t227.5 -192t85.5 -263.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1764 1525q33 -24 27 -64l-256 -1536q-5 -29 -32 -45q-14 -8 -31 -8q-11 0 -24 5l-453 185l-242 -295q-18 -23 -49 -23q-13 0 -22 4q-19 7 -30.5 23.5t-11.5 36.5v349l864 1059l-1069 -925l-395 162q-37 14 -40 55q-2 40 32 59l1664 960q15 9 32 9q20 0 36 -11z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1764 1525q33 -24 27 -64l-256 -1536q-5 -29 -32 -45q-14 -8 -31 -8q-11 0 -24 5l-527 215l-298 -327q-18 -21 -47 -21q-14 0 -23 4q-19 7 -30 23.5t-11 36.5v452l-472 193q-37 14 -40 55q-3 39 32 59l1664 960q35 21 68 -2zM1422 26l221 1323l-1434 -827l336 -137 l863 639l-478 -797z" /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61q-172 0 -327 72.5t-264 204.5q-7 10 -6.5 22.5t8.5 20.5l137 138q10 9 25 9q16 -2 23 -12q73 -95 179 -147t225 -52q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5 t-163.5 109.5t-198.5 40.5q-98 0 -188 -35.5t-160 -101.5l137 -138q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l130 -129q107 101 244.5 156.5t284.5 55.5q156 0 298 -61t245 -164t164 -245t61 -298zM896 928v-448q0 -14 -9 -23 t-23 -9h-320q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M768 1280q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5t-51 248.5t-136.5 204t-204 136.5t-248.5 51zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1682 -128q-44 0 -132.5 3.5t-133.5 3.5q-44 0 -132 -3.5t-132 -3.5q-24 0 -37 20.5t-13 45.5q0 31 17 46t39 17t51 7t45 15q33 21 33 140l-1 391q0 21 -1 31q-13 4 -50 4h-675q-38 0 -51 -4q-1 -10 -1 -31l-1 -371q0 -142 37 -164q16 -10 48 -13t57 -3.5t45 -15 t20 -45.5q0 -26 -12.5 -48t-36.5 -22q-47 0 -139.5 3.5t-138.5 3.5q-43 0 -128 -3.5t-127 -3.5q-23 0 -35.5 21t-12.5 45q0 30 15.5 45t36 17.5t47.5 7.5t42 15q33 23 33 143l-1 57v813q0 3 0.5 26t0 36.5t-1.5 38.5t-3.5 42t-6.5 36.5t-11 31.5t-16 18q-15 10 -45 12t-53 2 t-41 14t-18 45q0 26 12 48t36 22q46 0 138.5 -3.5t138.5 -3.5q42 0 126.5 3.5t126.5 3.5q25 0 37.5 -22t12.5 -48q0 -30 -17 -43.5t-38.5 -14.5t-49.5 -4t-43 -13q-35 -21 -35 -160l1 -320q0 -21 1 -32q13 -3 39 -3h699q25 0 38 3q1 11 1 32l1 320q0 139 -35 160 q-18 11 -58.5 12.5t-66 13t-25.5 49.5q0 26 12.5 48t37.5 22q44 0 132 -3.5t132 -3.5q43 0 129 3.5t129 3.5q25 0 37.5 -22t12.5 -48q0 -30 -17.5 -44t-40 -14.5t-51.5 -3t-44 -12.5q-35 -23 -35 -161l1 -943q0 -119 34 -140q16 -10 46 -13.5t53.5 -4.5t41.5 -15.5t18 -44.5 q0 -26 -12 -48t-36 -22z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1278 1347v-73q0 -29 -18.5 -61t-42.5 -32q-50 0 -54 -1q-26 -6 -32 -31q-3 -11 -3 -64v-1152q0 -25 -18 -43t-43 -18h-108q-25 0 -43 18t-18 43v1218h-143v-1218q0 -25 -17.5 -43t-43.5 -18h-108q-26 0 -43.5 18t-17.5 43v496q-147 12 -245 59q-126 58 -192 179 q-64 117 -64 259q0 166 88 286q88 118 209 159q111 37 417 37h479q25 0 43 -18t18 -43z" /> +<glyph unicode="" d="M352 128v-128h-352v128h352zM704 256q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM864 640v-128h-864v128h864zM224 1152v-128h-224v128h224zM1536 128v-128h-736v128h736zM576 1280q26 0 45 -19t19 -45v-256 q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM1216 768q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM1536 640v-128h-224v128h224zM1536 1152v-128h-864v128h864z" /> +<glyph unicode="" d="M1216 512q133 0 226.5 -93.5t93.5 -226.5t-93.5 -226.5t-226.5 -93.5t-226.5 93.5t-93.5 226.5q0 12 2 34l-360 180q-92 -86 -218 -86q-133 0 -226.5 93.5t-93.5 226.5t93.5 226.5t226.5 93.5q126 0 218 -86l360 180q-2 22 -2 34q0 133 93.5 226.5t226.5 93.5 t226.5 -93.5t93.5 -226.5t-93.5 -226.5t-226.5 -93.5q-126 0 -218 86l-360 -180q2 -22 2 -34t-2 -34l360 -180q92 86 218 86z" /> +<glyph unicode="" d="M1280 341q0 88 -62.5 151t-150.5 63q-84 0 -145 -58l-241 120q2 16 2 23t-2 23l241 120q61 -58 145 -58q88 0 150.5 63t62.5 151t-62.5 150.5t-150.5 62.5t-151 -62.5t-63 -150.5q0 -7 2 -23l-241 -120q-62 57 -145 57q-88 0 -150.5 -62.5t-62.5 -150.5t62.5 -150.5 t150.5 -62.5q83 0 145 57l241 -120q-2 -16 -2 -23q0 -88 63 -150.5t151 -62.5t150.5 62.5t62.5 150.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M571 947q-10 25 -34 35t-49 0q-108 -44 -191 -127t-127 -191q-10 -25 0 -49t35 -34q13 -5 24 -5q42 0 60 40q34 84 98.5 148.5t148.5 98.5q25 11 35 35t0 49zM1513 1303l46 -46l-244 -243l68 -68q19 -19 19 -45.5t-19 -45.5l-64 -64q89 -161 89 -343q0 -143 -55.5 -273.5 t-150 -225t-225 -150t-273.5 -55.5t-273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5q182 0 343 -89l64 64q19 19 45.5 19t45.5 -19l68 -68zM1521 1359q-10 -10 -22 -10q-13 0 -23 10l-91 90q-9 10 -9 23t9 23q10 9 23 9t23 -9l90 -91 q10 -9 10 -22.5t-10 -22.5zM1751 1129q-11 -9 -23 -9t-23 9l-90 91q-10 9 -10 22.5t10 22.5q9 10 22.5 10t22.5 -10l91 -90q9 -10 9 -23t-9 -23zM1792 1312q0 -14 -9 -23t-23 -9h-96q-14 0 -23 9t-9 23t9 23t23 9h96q14 0 23 -9t9 -23zM1600 1504v-96q0 -14 -9 -23t-23 -9 t-23 9t-9 23v96q0 14 9 23t23 9t23 -9t9 -23zM1751 1449l-91 -90q-10 -10 -22 -10q-13 0 -23 10q-10 9 -10 22.5t10 22.5l90 91q10 9 23 9t23 -9q9 -10 9 -23t-9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M609 720l287 208l287 -208l-109 -336h-355zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM1515 186q149 203 149 454v3l-102 -89l-240 224l63 323 l134 -12q-150 206 -389 282l53 -124l-287 -159l-287 159l53 124q-239 -76 -389 -282l135 12l62 -323l-240 -224l-102 89v-3q0 -251 149 -454l30 132l326 -40l139 -298l-116 -69q117 -39 240 -39t240 39l-116 69l139 298l326 40z" /> +<glyph unicode="" horiz-adv-x="1792" d="M448 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM256 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM832 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23 v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM640 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM66 768q-28 0 -47 19t-19 46v129h514v-129q0 -27 -19 -46t-46 -19h-383zM1216 224v-192q0 -14 -9 -23t-23 -9h-192 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1024 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1600 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23 zM1408 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 1016v-13h-514v10q0 104 -382 102q-382 -1 -382 -102v-10h-514v13q0 17 8.5 43t34 64t65.5 75.5t110.5 76t160 67.5t224 47.5t293.5 18.5t293 -18.5t224 -47.5 t160.5 -67.5t110.5 -76t65.5 -75.5t34 -64t8.5 -43zM1792 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 962v-129q0 -27 -19 -46t-46 -19h-384q-27 0 -46 19t-19 46v129h514z" /> +<glyph unicode="" horiz-adv-x="1792" d="M704 1216v-768q0 -26 -19 -45t-45 -19v-576q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v512l249 873q7 23 31 23h424zM1024 1216v-704h-256v704h256zM1792 320v-512q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v576q-26 0 -45 19t-19 45v768h424q24 0 31 -23z M736 1504v-224h-352v224q0 14 9 23t23 9h288q14 0 23 -9t9 -23zM1408 1504v-224h-352v224q0 14 9 23t23 9h288q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1755 1083q37 -37 37 -90t-37 -91l-401 -400l150 -150l-160 -160q-163 -163 -389.5 -186.5t-411.5 100.5l-362 -362h-181v181l362 362q-124 185 -100.5 411.5t186.5 389.5l160 160l150 -150l400 401q38 37 91 37t90 -37t37 -90.5t-37 -90.5l-400 -401l234 -234l401 400 q38 37 91 37t90 -37z" /> +<glyph unicode="" horiz-adv-x="1792" d="M873 796q0 -83 -63.5 -142.5t-152.5 -59.5t-152.5 59.5t-63.5 142.5q0 84 63.5 143t152.5 59t152.5 -59t63.5 -143zM1375 796q0 -83 -63 -142.5t-153 -59.5q-89 0 -152.5 59.5t-63.5 142.5q0 84 63.5 143t152.5 59q90 0 153 -59t63 -143zM1600 616v667q0 87 -32 123.5 t-111 36.5h-1112q-83 0 -112.5 -34t-29.5 -126v-673q43 -23 88.5 -40t81 -28t81 -18.5t71 -11t70 -4t58.5 -0.5t56.5 2t44.5 2q68 1 95 -27q6 -6 10 -9q26 -25 61 -51q7 91 118 87q5 0 36.5 -1.5t43 -2t45.5 -1t53 1t54.5 4.5t61 8.5t62 13.5t67 19.5t67.5 27t72 34.5z M1763 621q-121 -149 -372 -252q84 -285 -23 -465q-66 -113 -183 -148q-104 -32 -182 15q-86 51 -82 164l-1 326v1q-8 2 -24.5 6t-23.5 5l-1 -338q4 -114 -83 -164q-79 -47 -183 -15q-117 36 -182 150q-105 180 -22 463q-251 103 -372 252q-25 37 -4 63t60 -1q3 -2 11 -7 t11 -8v694q0 72 47 123t114 51h1257q67 0 114 -51t47 -123v-694l21 15q39 27 60 1t-4 -63z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1102v-434h-145v434h145zM1294 1102v-434h-145v434h145zM1294 342l253 254v795h-1194v-1049h326v-217l217 217h398zM1692 1536v-1013l-434 -434h-326l-217 -217h-217v217h-398v1158l109 289h1483z" /> +<glyph unicode="" d="M773 217v-127q-1 -292 -6 -305q-12 -32 -51 -40q-54 -9 -181.5 38t-162.5 89q-13 15 -17 36q-1 12 4 26q4 10 34 47t181 216q1 0 60 70q15 19 39.5 24.5t49.5 -3.5q24 -10 37.5 -29t12.5 -42zM624 468q-3 -55 -52 -70l-120 -39q-275 -88 -292 -88q-35 2 -54 36 q-12 25 -17 75q-8 76 1 166.5t30 124.5t56 32q13 0 202 -77q70 -29 115 -47l84 -34q23 -9 35.5 -30.5t11.5 -48.5zM1450 171q-7 -54 -91.5 -161t-135.5 -127q-37 -14 -63 7q-14 10 -184 287l-47 77q-14 21 -11.5 46t19.5 46q35 43 83 26q1 -1 119 -40q203 -66 242 -79.5 t47 -20.5q28 -22 22 -61zM778 803q5 -102 -54 -122q-58 -17 -114 71l-378 598q-8 35 19 62q41 43 207.5 89.5t224.5 31.5q40 -10 49 -45q3 -18 22 -305.5t24 -379.5zM1440 695q3 -39 -26 -59q-15 -10 -329 -86q-67 -15 -91 -23l1 2q-23 -6 -46 4t-37 32q-30 47 0 87 q1 1 75 102q125 171 150 204t34 39q28 19 65 2q48 -23 123 -133.5t81 -167.5v-3z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1024 1024h-384v-384h384v384zM1152 384v-128h-640v128h640zM1152 1152v-640h-640v640h640zM1792 384v-128h-512v128h512zM1792 640v-128h-512v128h512zM1792 896v-128h-512v128h512zM1792 1152v-128h-512v128h512zM256 192v960h-128v-960q0 -26 19 -45t45 -19t45 19 t19 45zM1920 192v1088h-1536v-1088q0 -33 -11 -64h1483q26 0 45 19t19 45zM2048 1408v-1216q0 -80 -56 -136t-136 -56h-1664q-80 0 -136 56t-56 136v1088h256v128h1792z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1024 13q-20 0 -93 73.5t-73 93.5q0 32 62.5 54t103.5 22t103.5 -22t62.5 -54q0 -20 -73 -93.5t-93 -73.5zM1294 284q-2 0 -40 25t-101.5 50t-128.5 25t-128.5 -25t-101 -50t-40.5 -25q-18 0 -93.5 75t-75.5 93q0 13 10 23q78 77 196 121t233 44t233 -44t196 -121 q10 -10 10 -23q0 -18 -75.5 -93t-93.5 -75zM1567 556q-11 0 -23 8q-136 105 -252 154.5t-268 49.5q-85 0 -170.5 -22t-149 -53t-113.5 -62t-79 -53t-31 -22q-17 0 -92 75t-75 93q0 12 10 22q132 132 320 205t380 73t380 -73t320 -205q10 -10 10 -22q0 -18 -75 -93t-92 -75z M1838 827q-11 0 -22 9q-179 157 -371.5 236.5t-420.5 79.5t-420.5 -79.5t-371.5 -236.5q-11 -9 -22 -9q-17 0 -92.5 75t-75.5 93q0 13 10 23q187 186 445 288t527 102t527 -102t445 -288q10 -10 10 -23q0 -18 -75.5 -93t-92.5 -75z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM384 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1152 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5 t37.5 90.5zM384 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1152 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 768q0 53 -37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1536 0v384q0 52 -38 90t-90 38t-90 -38t-38 -90v-384q0 -52 38 -90t90 -38t90 38t38 90zM1152 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5z M1536 1088v256q0 26 -19 45t-45 19h-1280q-26 0 -45 -19t-19 -45v-256q0 -26 19 -45t45 -19h1280q26 0 45 19t19 45zM1536 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 1408v-1536q0 -52 -38 -90t-90 -38 h-1408q-52 0 -90 38t-38 90v1536q0 52 38 90t90 38h1408q52 0 90 -38t38 -90z" /> +<glyph unicode="" d="M1519 890q18 -84 -4 -204q-87 -444 -565 -444h-44q-25 0 -44 -16.5t-24 -42.5l-4 -19l-55 -346l-2 -15q-5 -26 -24.5 -42.5t-44.5 -16.5h-251q-21 0 -33 15t-9 36q9 56 26.5 168t26.5 168t27 167.5t27 167.5q5 37 43 37h131q133 -2 236 21q175 39 287 144q102 95 155 246 q24 70 35 133q1 6 2.5 7.5t3.5 1t6 -3.5q79 -59 98 -162zM1347 1172q0 -107 -46 -236q-80 -233 -302 -315q-113 -40 -252 -42q0 -1 -90 -1l-90 1q-100 0 -118 -96q-2 -8 -85 -530q-1 -10 -12 -10h-295q-22 0 -36.5 16.5t-11.5 38.5l232 1471q5 29 27.5 48t51.5 19h598 q34 0 97.5 -13t111.5 -32q107 -41 163.5 -123t56.5 -196z" /> +<glyph unicode="" horiz-adv-x="1792" d="M602 949q19 -61 31 -123.5t17 -141.5t-14 -159t-62 -145q-21 81 -67 157t-95.5 127t-99 90.5t-78.5 57.5t-33 19q-62 34 -81.5 100t14.5 128t101 81.5t129 -14.5q138 -83 238 -177zM927 1236q11 -25 20.5 -46t36.5 -100.5t42.5 -150.5t25.5 -179.5t0 -205.5t-47.5 -209.5 t-105.5 -208.5q-51 -72 -138 -72q-54 0 -98 31q-57 40 -69 109t28 127q60 85 81 195t13 199.5t-32 180.5t-39 128t-22 52q-31 63 -8.5 129.5t85.5 97.5q34 17 75 17q47 0 88.5 -25t63.5 -69zM1248 567q-17 -160 -72 -311q-17 131 -63 246q25 174 -5 361q-27 178 -94 342 q114 -90 212 -211q9 -37 15 -80q26 -179 7 -347zM1520 1440q9 -17 23.5 -49.5t43.5 -117.5t50.5 -178t34 -227.5t5 -269t-47 -300t-112.5 -323.5q-22 -48 -66 -75.5t-95 -27.5q-39 0 -74 16q-67 31 -92.5 100t4.5 136q58 126 90 257.5t37.5 239.5t-3.5 213.5t-26.5 180.5 t-38.5 138.5t-32.5 90t-15.5 32.5q-34 65 -11.5 135.5t87.5 104.5q37 20 81 20q49 0 91.5 -25.5t66.5 -70.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1975 546h-138q14 37 66 179l3 9q4 10 10 26t9 26l12 -55zM531 611l-58 295q-11 54 -75 54h-268l-2 -13q311 -79 403 -336zM710 960l-162 -438l-17 89q-26 70 -85 129.5t-131 88.5l135 -510h175l261 641h-176zM849 318h166l104 642h-166zM1617 944q-69 27 -149 27 q-123 0 -201 -59t-79 -153q-1 -102 145 -174q48 -23 67 -41t19 -39q0 -30 -30 -46t-69 -16q-86 0 -156 33l-22 11l-23 -144q74 -34 185 -34q130 -1 208.5 59t80.5 160q0 106 -140 174q-49 25 -71 42t-22 38q0 22 24.5 38.5t70.5 16.5q70 1 124 -24l15 -8zM2042 960h-128 q-65 0 -87 -54l-246 -588h174l35 96h212q5 -22 20 -96h154zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M671 603h-13q-47 0 -47 -32q0 -22 20 -22q17 0 28 15t12 39zM1066 639h62v3q1 4 0.5 6.5t-1 7t-2 8t-4.5 6.5t-7.5 5t-11.5 2q-28 0 -36 -38zM1606 603h-12q-48 0 -48 -32q0 -22 20 -22q17 0 28 15t12 39zM1925 629q0 41 -30 41q-19 0 -31 -20t-12 -51q0 -42 28 -42 q20 0 32.5 20t12.5 52zM480 770h87l-44 -262h-56l32 201l-71 -201h-39l-4 200l-34 -200h-53l44 262h81l2 -163zM733 663q0 -6 -4 -42q-16 -101 -17 -113h-47l1 22q-20 -26 -58 -26q-23 0 -37.5 16t-14.5 42q0 39 26 60.5t73 21.5q14 0 23 -1q0 3 0.5 5.5t1 4.5t0.5 3 q0 20 -36 20q-29 0 -59 -10q0 4 7 48q38 11 67 11q74 0 74 -62zM889 721l-8 -49q-22 3 -41 3q-27 0 -27 -17q0 -8 4.5 -12t21.5 -11q40 -19 40 -60q0 -72 -87 -71q-34 0 -58 6q0 2 7 49q29 -8 51 -8q32 0 32 19q0 7 -4.5 11.5t-21.5 12.5q-43 20 -43 59q0 72 84 72 q30 0 50 -4zM977 721h28l-7 -52h-29q-2 -17 -6.5 -40.5t-7 -38.5t-2.5 -18q0 -16 19 -16q8 0 16 2l-8 -47q-21 -7 -40 -7q-43 0 -45 47q0 12 8 56q3 20 25 146h55zM1180 648q0 -23 -7 -52h-111q-3 -22 10 -33t38 -11q30 0 58 14l-9 -54q-30 -8 -57 -8q-95 0 -95 95 q0 55 27.5 90.5t69.5 35.5q35 0 55.5 -21t20.5 -56zM1319 722q-13 -23 -22 -62q-22 2 -31 -24t-25 -128h-56l3 14q22 130 29 199h51l-3 -33q14 21 25.5 29.5t28.5 4.5zM1506 763l-9 -57q-28 14 -50 14q-31 0 -51 -27.5t-20 -70.5q0 -30 13.5 -47t38.5 -17q21 0 48 13 l-10 -59q-28 -8 -50 -8q-45 0 -71.5 30.5t-26.5 82.5q0 70 35.5 114.5t91.5 44.5q26 0 61 -13zM1668 663q0 -18 -4 -42q-13 -79 -17 -113h-46l1 22q-20 -26 -59 -26q-23 0 -37 16t-14 42q0 39 25.5 60.5t72.5 21.5q15 0 23 -1q2 7 2 13q0 20 -36 20q-29 0 -59 -10q0 4 8 48 q38 11 67 11q73 0 73 -62zM1809 722q-14 -24 -21 -62q-23 2 -31.5 -23t-25.5 -129h-56l3 14q19 104 29 199h52q0 -11 -4 -33q15 21 26.5 29.5t27.5 4.5zM1950 770h56l-43 -262h-53l3 19q-23 -23 -52 -23q-31 0 -49.5 24t-18.5 64q0 53 27.5 92t64.5 39q31 0 53 -29z M2061 640q0 148 -72.5 273t-198 198t-273.5 73q-181 0 -328 -110q127 -116 171 -284h-50q-44 150 -158 253q-114 -103 -158 -253h-50q44 168 171 284q-147 110 -328 110q-148 0 -273.5 -73t-198 -198t-72.5 -273t72.5 -273t198 -198t273.5 -73q181 0 328 110 q-120 111 -165 264h50q46 -138 152 -233q106 95 152 233h50q-45 -153 -165 -264q147 -110 328 -110q148 0 273.5 73t198 198t72.5 273zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M313 759q0 -51 -36 -84q-29 -26 -89 -26h-17v220h17q61 0 89 -27q36 -31 36 -83zM2089 824q0 -52 -64 -52h-19v101h20q63 0 63 -49zM380 759q0 74 -50 120.5t-129 46.5h-95v-333h95q74 0 119 38q60 51 60 128zM410 593h65v333h-65v-333zM730 694q0 40 -20.5 62t-75.5 42 q-29 10 -39.5 19t-10.5 23q0 16 13.5 26.5t34.5 10.5q29 0 53 -27l34 44q-41 37 -98 37q-44 0 -74 -27.5t-30 -67.5q0 -35 18 -55.5t64 -36.5q37 -13 45 -19q19 -12 19 -34q0 -20 -14 -33.5t-36 -13.5q-48 0 -71 44l-42 -40q44 -64 115 -64q51 0 83 30.5t32 79.5zM1008 604 v77q-37 -37 -78 -37q-49 0 -80.5 32.5t-31.5 82.5q0 48 31.5 81.5t77.5 33.5q43 0 81 -38v77q-40 20 -80 20q-74 0 -125.5 -50.5t-51.5 -123.5t51 -123.5t125 -50.5q42 0 81 19zM2240 0v527q-65 -40 -144.5 -84t-237.5 -117t-329.5 -137.5t-417.5 -134.5t-504 -118h1569 q26 0 45 19t19 45zM1389 757q0 75 -53 128t-128 53t-128 -53t-53 -128t53 -128t128 -53t128 53t53 128zM1541 584l144 342h-71l-90 -224l-89 224h-71l142 -342h35zM1714 593h184v56h-119v90h115v56h-115v74h119v57h-184v-333zM2105 593h80l-105 140q76 16 76 94q0 47 -31 73 t-87 26h-97v-333h65v133h9zM2304 1274v-1268q0 -56 -38.5 -95t-93.5 -39h-2040q-55 0 -93.5 39t-38.5 95v1268q0 56 38.5 95t93.5 39h2040q55 0 93.5 -39t38.5 -95z" /> +<glyph unicode="" horiz-adv-x="2304" d="M119 854h89l-45 108zM740 328l74 79l-70 79h-163v-49h142v-55h-142v-54h159zM898 406l99 -110v217zM1186 453q0 33 -40 33h-84v-69h83q41 0 41 36zM1475 457q0 29 -42 29h-82v-61h81q43 0 43 32zM1197 923q0 29 -42 29h-82v-60h81q43 0 43 31zM1656 854h89l-44 108z M699 1009v-271h-66v212l-94 -212h-57l-94 212v-212h-132l-25 60h-135l-25 -60h-70l116 271h96l110 -257v257h106l85 -184l77 184h108zM1255 453q0 -20 -5.5 -35t-14 -25t-22.5 -16.5t-26 -10t-31.5 -4.5t-31.5 -1t-32.5 0.5t-29.5 0.5v-91h-126l-80 90l-83 -90h-256v271h260 l80 -89l82 89h207q109 0 109 -89zM964 794v-56h-217v271h217v-57h-152v-49h148v-55h-148v-54h152zM2304 235v-229q0 -55 -38.5 -94.5t-93.5 -39.5h-2040q-55 0 -93.5 39.5t-38.5 94.5v678h111l25 61h55l25 -61h218v46l19 -46h113l20 47v-47h541v99l10 1q10 0 10 -14v-86h279 v23q23 -12 55 -18t52.5 -6.5t63 0.5t51.5 1l25 61h56l25 -61h227v58l34 -58h182v378h-180v-44l-25 44h-185v-44l-23 44h-249q-69 0 -109 -22v22h-172v-22q-24 22 -73 22h-628l-43 -97l-43 97h-198v-44l-22 44h-169l-78 -179v391q0 55 38.5 94.5t93.5 39.5h2040 q55 0 93.5 -39.5t38.5 -94.5v-678h-120q-51 0 -81 -22v22h-177q-55 0 -78 -22v22h-316v-22q-31 22 -87 22h-209v-22q-23 22 -91 22h-234l-54 -58l-50 58h-349v-378h343l55 59l52 -59h211v89h21q59 0 90 13v-102h174v99h8q8 0 10 -2t2 -10v-87h529q57 0 88 24v-24h168 q60 0 95 17zM1546 469q0 -23 -12 -43t-34 -29q25 -9 34 -26t9 -46v-54h-65v45q0 33 -12 43.5t-46 10.5h-69v-99h-65v271h154q48 0 77 -15t29 -58zM1269 936q0 -24 -12.5 -44t-33.5 -29q26 -9 34.5 -25.5t8.5 -46.5v-53h-65q0 9 0.5 26.5t0 25t-3 18.5t-8.5 16t-17.5 8.5 t-29.5 3.5h-70v-98h-64v271l153 -1q49 0 78 -14.5t29 -57.5zM1798 327v-56h-216v271h216v-56h-151v-49h148v-55h-148v-54zM1372 1009v-271h-66v271h66zM2065 357q0 -86 -102 -86h-126v58h126q34 0 34 25q0 16 -17 21t-41.5 5t-49.5 3.5t-42 22.5t-17 55q0 39 26 60t66 21 h130v-57h-119q-36 0 -36 -25q0 -16 17.5 -20.5t42 -4t49 -2.5t42 -21.5t17.5 -54.5zM2304 407v-101q-24 -35 -88 -35h-125v58h125q33 0 33 25q0 13 -12.5 19t-31 5.5t-40 2t-40 8t-31 24t-12.5 48.5q0 39 26.5 60t66.5 21h129v-57h-118q-36 0 -36 -25q0 -20 29 -22t68.5 -5 t56.5 -26zM2139 1008v-270h-92l-122 203v-203h-132l-26 60h-134l-25 -60h-75q-129 0 -129 133q0 138 133 138h63v-59q-7 0 -28 1t-28.5 0.5t-23 -2t-21.5 -6.5t-14.5 -13.5t-11.5 -23t-3 -33.5q0 -38 13.5 -58t49.5 -20h29l92 213h97l109 -256v256h99l114 -188v188h66z" /> +<glyph unicode="" horiz-adv-x="2304" d="M745 630q0 -37 -25.5 -61.5t-62.5 -24.5q-29 0 -46.5 16t-17.5 44q0 37 25 62.5t62 25.5q28 0 46.5 -16.5t18.5 -45.5zM1530 779q0 -42 -22 -57t-66 -15l-32 -1l17 107q2 11 13 11h18q22 0 35 -2t25 -12.5t12 -30.5zM1881 630q0 -36 -25.5 -61t-61.5 -25q-29 0 -47 16 t-18 44q0 37 25 62.5t62 25.5q28 0 46.5 -16.5t18.5 -45.5zM513 801q0 59 -38.5 85.5t-100.5 26.5h-160q-19 0 -21 -19l-65 -408q-1 -6 3 -11t10 -5h76q20 0 22 19l18 110q1 8 7 13t15 6.5t17 1.5t19 -1t14 -1q86 0 135 48.5t49 134.5zM822 489l41 261q1 6 -3 11t-10 5h-76 q-14 0 -17 -33q-27 40 -95 40q-72 0 -122.5 -54t-50.5 -127q0 -59 34.5 -94t92.5 -35q28 0 58 12t48 32q-4 -12 -4 -21q0 -16 13 -16h69q19 0 22 19zM1269 752q0 5 -4 9.5t-9 4.5h-77q-11 0 -18 -10l-106 -156l-44 150q-5 16 -22 16h-75q-5 0 -9 -4.5t-4 -9.5q0 -2 19.5 -59 t42 -123t23.5 -70q-82 -112 -82 -120q0 -13 13 -13h77q11 0 18 10l255 368q2 2 2 7zM1649 801q0 59 -38.5 85.5t-100.5 26.5h-159q-20 0 -22 -19l-65 -408q-1 -6 3 -11t10 -5h82q12 0 16 13l18 116q1 8 7 13t15 6.5t17 1.5t19 -1t14 -1q86 0 135 48.5t49 134.5zM1958 489 l41 261q1 6 -3 11t-10 5h-76q-14 0 -17 -33q-26 40 -95 40q-72 0 -122.5 -54t-50.5 -127q0 -59 34.5 -94t92.5 -35q29 0 59 12t47 32q0 -1 -2 -9t-2 -12q0 -16 13 -16h69q19 0 22 19zM2176 898v1q0 14 -13 14h-74q-11 0 -13 -11l-65 -416l-1 -2q0 -5 4 -9.5t10 -4.5h66 q19 0 21 19zM392 764q-5 -35 -26 -46t-60 -11l-33 -1l17 107q2 11 13 11h19q40 0 58 -11.5t12 -48.5zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1597 633q0 -69 -21 -106q-19 -35 -52 -35q-23 0 -41 9v224q29 30 57 30q57 0 57 -122zM2035 669h-110q6 98 56 98q51 0 54 -98zM476 534q0 59 -33 91.5t-101 57.5q-36 13 -52 24t-16 25q0 26 38 26q58 0 124 -33l18 112q-67 32 -149 32q-77 0 -123 -38q-48 -39 -48 -109 q0 -58 32.5 -90.5t99.5 -56.5q39 -14 54.5 -25.5t15.5 -27.5q0 -31 -48 -31q-29 0 -70 12.5t-72 30.5l-18 -113q72 -41 168 -41q81 0 129 37q51 41 51 117zM771 749l19 111h-96v135l-129 -21l-18 -114l-46 -8l-17 -103h62v-219q0 -84 44 -120q38 -30 111 -30q32 0 79 11v118 q-32 -7 -44 -7q-42 0 -42 50v197h77zM1087 724v139q-15 3 -28 3q-32 0 -55.5 -16t-33.5 -46l-10 56h-131v-471h150v306q26 31 82 31q16 0 26 -2zM1124 389h150v471h-150v-471zM1746 638q0 122 -45 179q-40 52 -111 52q-64 0 -117 -56l-8 47h-132v-645l150 25v151 q36 -11 68 -11q83 0 134 56q61 65 61 202zM1278 986q0 33 -23 56t-56 23t-56 -23t-23 -56t23 -56.5t56 -23.5t56 23.5t23 56.5zM2176 629q0 113 -48 176q-50 64 -144 64q-96 0 -151.5 -66t-55.5 -180q0 -128 63 -188q55 -55 161 -55q101 0 160 40l-16 103q-57 -31 -128 -31 q-43 0 -63 19q-23 19 -28 66h248q2 14 2 52zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1558 684q61 -356 298 -556q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-180.5 74.5t-75.5 180.5zM1024 -176q16 0 16 16t-16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5zM2026 1424q8 -10 7.5 -23.5t-10.5 -22.5 l-1872 -1622q-10 -8 -23.5 -7t-21.5 11l-84 96q-8 10 -7.5 23.5t10.5 21.5l186 161q-19 32 -19 66q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q124 -18 219 -82.5t148 -157.5 l418 363q10 8 23.5 7t21.5 -11z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1040 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM503 315l877 760q-42 88 -132.5 146.5t-223.5 58.5q-93 0 -169.5 -31.5t-121.5 -80.5t-69 -103t-24 -105q0 -384 -137 -645zM1856 128 q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-180.5 74.5t-75.5 180.5l149 129h757q-166 187 -227 459l111 97q61 -356 298 -556zM1942 1520l84 -96q8 -10 7.5 -23.5t-10.5 -22.5l-1872 -1622q-10 -8 -23.5 -7t-21.5 11l-84 96q-8 10 -7.5 23.5t10.5 21.5l186 161 q-19 32 -19 66q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q124 -18 219 -82.5t148 -157.5l418 363q10 8 23.5 7t21.5 -11z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM768 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1024 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704 q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167 q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1150 462v-109q0 -50 -36.5 -89t-94 -60.5t-118 -32.5t-117.5 -11q-205 0 -342.5 139t-137.5 346q0 203 136 339t339 136q34 0 75.5 -4.5t93 -18t92.5 -34t69 -56.5t28 -81v-109q0 -16 -16 -16h-118q-16 0 -16 16v70q0 43 -65.5 67.5t-137.5 24.5q-140 0 -228.5 -91.5 t-88.5 -237.5q0 -151 91.5 -249.5t233.5 -98.5q68 0 138 24t70 66v70q0 7 4.5 11.5t10.5 4.5h119q6 0 11 -4.5t5 -11.5zM768 1280q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5 t-51 248.5t-136.5 204t-204 136.5t-248.5 51zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M972 761q0 108 -53.5 169t-147.5 61q-63 0 -124 -30.5t-110 -84.5t-79.5 -137t-30.5 -180q0 -112 53.5 -173t150.5 -61q96 0 176 66.5t122.5 166t42.5 203.5zM1536 640q0 -111 -37 -197t-98.5 -135t-131.5 -74.5t-145 -27.5q-6 0 -15.5 -0.5t-16.5 -0.5q-95 0 -142 53 q-28 33 -33 83q-52 -66 -131.5 -110t-173.5 -44q-161 0 -249.5 95.5t-88.5 269.5q0 157 66 290t179 210.5t246 77.5q87 0 155 -35.5t106 -99.5l2 19l11 56q1 6 5.5 12t9.5 6h118q5 0 13 -11q5 -5 3 -16l-120 -614q-5 -24 -5 -48q0 -39 12.5 -52t44.5 -13q28 1 57 5.5t73 24 t77 50t57 89.5t24 137q0 292 -174 466t-466 174q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51q228 0 405 144q11 9 24 8t21 -12l41 -49q8 -12 7 -24q-2 -13 -12 -22q-102 -83 -227.5 -128t-258.5 -45q-156 0 -298 61 t-245 164t-164 245t-61 298t61 298t164 245t245 164t298 61q344 0 556 -212t212 -556z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1698 1442q94 -94 94 -226.5t-94 -225.5l-225 -223l104 -104q10 -10 10 -23t-10 -23l-210 -210q-10 -10 -23 -10t-23 10l-105 105l-603 -603q-37 -37 -90 -37h-203l-256 -128l-64 64l128 256v203q0 53 37 90l603 603l-105 105q-10 10 -10 23t10 23l210 210q10 10 23 10 t23 -10l104 -104l223 225q93 94 225.5 94t226.5 -94zM512 64l576 576l-192 192l-576 -576v-192h192z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1615 1536q70 0 122.5 -46.5t52.5 -116.5q0 -63 -45 -151q-332 -629 -465 -752q-97 -91 -218 -91q-126 0 -216.5 92.5t-90.5 219.5q0 128 92 212l638 579q59 54 130 54zM706 502q39 -76 106.5 -130t150.5 -76l1 -71q4 -213 -129.5 -347t-348.5 -134q-123 0 -218 46.5 t-152.5 127.5t-86.5 183t-29 220q7 -5 41 -30t62 -44.5t59 -36.5t46 -17q41 0 55 37q25 66 57.5 112.5t69.5 76t88 47.5t103 25.5t125 10.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 128v-384h-1792v384q45 0 85 14t59 27.5t47 37.5q30 27 51.5 38t56.5 11t55.5 -11t52.5 -38q29 -25 47 -38t58 -27t86 -14q45 0 85 14.5t58 27t48 37.5q21 19 32.5 27t31 15t43.5 7q35 0 56.5 -11t51.5 -38q28 -24 47 -37.5t59 -27.5t85 -14t85 14t59 27.5t47 37.5 q30 27 51.5 38t56.5 11q34 0 55.5 -11t51.5 -38q28 -24 47 -37.5t59 -27.5t85 -14zM1792 448v-192q-35 0 -55.5 11t-52.5 38q-29 25 -47 38t-58 27t-85 14q-46 0 -86 -14t-58 -27t-47 -38q-22 -19 -33 -27t-31 -15t-44 -7q-35 0 -56.5 11t-51.5 38q-29 25 -47 38t-58 27 t-86 14q-45 0 -85 -14.5t-58 -27t-48 -37.5q-21 -19 -32.5 -27t-31 -15t-43.5 -7q-35 0 -56.5 11t-51.5 38q-28 24 -47 37.5t-59 27.5t-85 14q-46 0 -86 -14t-58 -27t-47 -38q-30 -27 -51.5 -38t-56.5 -11v192q0 80 56 136t136 56h64v448h256v-448h256v448h256v-448h256v448 h256v-448h64q80 0 136 -56t56 -136zM512 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150zM1024 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51 t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150zM1536 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 0v-128h-2048v1536h128v-1408h1920zM1664 1024l256 -896h-1664v576l448 576l576 -576z" /> +<glyph unicode="" horiz-adv-x="1792" d="M768 646l546 -546q-106 -108 -247.5 -168t-298.5 -60q-209 0 -385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103v-762zM955 640h773q0 -157 -60 -298.5t-168 -247.5zM1664 768h-768v768q209 0 385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 0v-128h-2048v1536h128v-1408h1920zM1920 1248v-435q0 -21 -19.5 -29.5t-35.5 7.5l-121 121l-633 -633q-10 -10 -23 -10t-23 10l-233 233l-416 -416l-192 192l585 585q10 10 23 10t23 -10l233 -233l464 464l-121 121q-16 16 -7.5 35.5t29.5 19.5h435q14 0 23 -9 t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1292 832q0 -6 10 -41q10 -29 25 -49.5t41 -34t44 -20t55 -16.5q325 -91 325 -332q0 -146 -105.5 -242.5t-254.5 -96.5q-59 0 -111.5 18.5t-91.5 45.5t-77 74.5t-63 87.5t-53.5 103.5t-43.5 103t-39.5 106.5t-35.5 95q-32 81 -61.5 133.5t-73.5 96.5t-104 64t-142 20 q-96 0 -183 -55.5t-138 -144.5t-51 -185q0 -160 106.5 -279.5t263.5 -119.5q177 0 258 95q56 63 83 116l84 -152q-15 -34 -44 -70l1 -1q-131 -152 -388 -152q-147 0 -269.5 79t-190.5 207.5t-68 274.5q0 105 43.5 206t116 176.5t172 121.5t204.5 46q87 0 159 -19t123.5 -50 t95 -80t72.5 -99t58.5 -117t50.5 -124.5t50 -130.5t55 -127q96 -200 233 -200q81 0 138.5 48.5t57.5 128.5q0 42 -19 72t-50.5 46t-72.5 31.5t-84.5 27t-87.5 34t-81 52t-65 82t-39 122.5q-3 16 -3 33q0 110 87.5 192t198.5 78q78 -3 120.5 -14.5t90.5 -53.5h-1 q12 -11 23 -24.5t26 -36t19 -27.5l-129 -99q-26 49 -54 70v1q-23 21 -97 21q-49 0 -84 -33t-35 -83z" /> +<glyph unicode="" d="M1432 484q0 173 -234 239q-35 10 -53 16.5t-38 25t-29 46.5q0 2 -2 8.5t-3 12t-1 7.5q0 36 24.5 59.5t60.5 23.5q54 0 71 -15h-1q20 -15 39 -51l93 71q-39 54 -49 64q-33 29 -67.5 39t-85.5 10q-80 0 -142 -57.5t-62 -137.5q0 -7 2 -23q16 -96 64.5 -140t148.5 -73 q29 -8 49 -15.5t45 -21.5t38.5 -34.5t13.5 -46.5v-5q1 -58 -40.5 -93t-100.5 -35q-97 0 -167 144q-23 47 -51.5 121.5t-48 125.5t-54 110.5t-74 95.5t-103.5 60.5t-147 24.5q-101 0 -192 -56t-144 -148t-50 -192v-1q4 -108 50.5 -199t133.5 -147.5t196 -56.5q186 0 279 110 q20 27 31 51l-60 109q-42 -80 -99 -116t-146 -36q-115 0 -191 87t-76 204q0 105 82 189t186 84q112 0 170 -53.5t104 -172.5q8 -21 25.5 -68.5t28.5 -76.5t31.5 -74.5t38.5 -74t45.5 -62.5t55.5 -53.5t66 -33t80 -13.5q107 0 183 69.5t76 174.5zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1152 640q0 104 -40.5 198.5t-109.5 163.5t-163.5 109.5t-198.5 40.5t-198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5t198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5zM1920 640q0 104 -40.5 198.5 t-109.5 163.5t-163.5 109.5t-198.5 40.5h-386q119 -90 188.5 -224t69.5 -288t-69.5 -288t-188.5 -224h386q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5zM2048 640q0 -130 -51 -248.5t-136.5 -204t-204 -136.5t-248.5 -51h-768q-130 0 -248.5 51t-204 136.5 t-136.5 204t-51 248.5t51 248.5t136.5 204t204 136.5t248.5 51h768q130 0 248.5 -51t204 -136.5t136.5 -204t51 -248.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M0 640q0 130 51 248.5t136.5 204t204 136.5t248.5 51h768q130 0 248.5 -51t204 -136.5t136.5 -204t51 -248.5t-51 -248.5t-136.5 -204t-204 -136.5t-248.5 -51h-768q-130 0 -248.5 51t-204 136.5t-136.5 204t-51 248.5zM1408 128q104 0 198.5 40.5t163.5 109.5 t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5t-163.5 109.5t-198.5 40.5t-198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M762 384h-314q-40 0 -57.5 35t6.5 67l188 251q-65 31 -137 31q-132 0 -226 -94t-94 -226t94 -226t226 -94q115 0 203 72.5t111 183.5zM576 512h186q-18 85 -75 148zM1056 512l288 384h-480l-99 -132q105 -103 126 -252h165zM2176 448q0 132 -94 226t-226 94 q-60 0 -121 -24l174 -260q15 -23 10 -49t-27 -40q-15 -11 -36 -11q-35 0 -53 29l-174 260q-93 -95 -93 -225q0 -132 94 -226t226 -94t226 94t94 226zM2304 448q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 97 39.5 183.5t109.5 149.5l-65 98l-353 -469 q-18 -26 -51 -26h-197q-23 -164 -149 -274t-294 -110q-185 0 -316.5 131.5t-131.5 316.5t131.5 316.5t316.5 131.5q114 0 215 -55l137 183h-224q-26 0 -45 19t-19 45t19 45t45 19h384v-128h435l-85 128h-222q-26 0 -45 19t-19 45t19 45t45 19h256q33 0 53 -28l267 -400 q91 44 192 44q185 0 316.5 -131.5t131.5 -316.5z" /> +<glyph unicode="" d="M384 320q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1408 320q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1362 716l-72 384q-5 23 -22.5 37.5t-40.5 14.5 h-918q-23 0 -40.5 -14.5t-22.5 -37.5l-72 -384q-5 -30 14 -53t49 -23h1062q30 0 49 23t14 53zM1136 1328q0 20 -14 34t-34 14h-640q-20 0 -34 -14t-14 -34t14 -34t34 -14h640q20 0 34 14t14 34zM1536 603v-603h-128v-128q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5v128h-768v-128q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5v128h-128v603q0 112 25 223l103 454q9 78 97.5 137t230 89t312.5 30t312.5 -30t230 -89t97.5 -137l105 -454q23 -102 23 -223z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1463 704q0 -35 -25 -60.5t-61 -25.5h-702q-36 0 -61 25.5t-25 60.5t25 60.5t61 25.5h702q36 0 61 -25.5t25 -60.5zM1677 704q0 86 -23 170h-982q-36 0 -61 25t-25 60q0 36 25 61t61 25h908q-88 143 -235 227t-320 84q-177 0 -327.5 -87.5t-238 -237.5t-87.5 -327 q0 -86 23 -170h982q36 0 61 -25t25 -60q0 -36 -25 -61t-61 -25h-908q88 -143 235.5 -227t320.5 -84q132 0 253 51.5t208 139t139 208t52 253.5zM2048 959q0 -35 -25 -60t-61 -25h-131q17 -85 17 -170q0 -167 -65.5 -319.5t-175.5 -263t-262.5 -176t-319.5 -65.5 q-246 0 -448.5 133t-301.5 350h-189q-36 0 -61 25t-25 61q0 35 25 60t61 25h132q-17 85 -17 170q0 167 65.5 319.5t175.5 263t262.5 176t320.5 65.5q245 0 447.5 -133t301.5 -350h188q36 0 61 -25t25 -61z" /> +<glyph unicode="" horiz-adv-x="1280" d="M953 1158l-114 -328l117 -21q165 451 165 518q0 56 -38 56q-57 0 -130 -225zM654 471l33 -88q37 42 71 67l-33 5.5t-38.5 7t-32.5 8.5zM362 1367q0 -98 159 -521q18 10 49 10q15 0 75 -5l-121 351q-75 220 -123 220q-19 0 -29 -17.5t-10 -37.5zM283 608q0 -36 51.5 -119 t117.5 -153t100 -70q14 0 25.5 13t11.5 27q0 24 -32 102q-13 32 -32 72t-47.5 89t-61.5 81t-62 32q-20 0 -45.5 -27t-25.5 -47zM125 273q0 -41 25 -104q59 -145 183.5 -227t281.5 -82q227 0 382 170q152 169 152 427q0 43 -1 67t-11.5 62t-30.5 56q-56 49 -211.5 75.5 t-270.5 26.5q-37 0 -49 -11q-12 -5 -12 -35q0 -34 21.5 -60t55.5 -40t77.5 -23.5t87.5 -11.5t85 -4t70 0h23q24 0 40 -19q15 -19 19 -55q-28 -28 -96 -54q-61 -22 -93 -46q-64 -46 -108.5 -114t-44.5 -137q0 -31 18.5 -88.5t18.5 -87.5l-3 -12q-4 -12 -4 -14 q-137 10 -146 216q-8 -2 -41 -2q2 -7 2 -21q0 -53 -40.5 -89.5t-94.5 -36.5q-82 0 -166.5 78t-84.5 159q0 34 33 67q52 -64 60 -76q77 -104 133 -104q12 0 26.5 8.5t14.5 20.5q0 34 -87.5 145t-116.5 111q-43 0 -70 -44.5t-27 -90.5zM11 264q0 101 42.5 163t136.5 88 q-28 74 -28 104q0 62 61 123t122 61q29 0 70 -15q-163 462 -163 567q0 80 41 130.5t119 50.5q131 0 325 -581q6 -17 8 -23q6 16 29 79.5t43.5 118.5t54 127.5t64.5 123t70.5 86.5t76.5 36q71 0 112 -49t41 -122q0 -108 -159 -550q61 -15 100.5 -46t58.5 -78t26 -93.5 t7 -110.5q0 -150 -47 -280t-132 -225t-211 -150t-278 -55q-111 0 -223 42q-149 57 -258 191.5t-109 286.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M785 528h207q-14 -158 -98.5 -248.5t-214.5 -90.5q-162 0 -254.5 116t-92.5 316q0 194 93 311.5t233 117.5q148 0 232 -87t97 -247h-203q-5 64 -35.5 99t-81.5 35q-57 0 -88.5 -60.5t-31.5 -177.5q0 -48 5 -84t18 -69.5t40 -51.5t66 -18q95 0 109 139zM1497 528h206 q-14 -158 -98 -248.5t-214 -90.5q-162 0 -254.5 116t-92.5 316q0 194 93 311.5t233 117.5q148 0 232 -87t97 -247h-204q-4 64 -35 99t-81 35q-57 0 -88.5 -60.5t-31.5 -177.5q0 -48 5 -84t18 -69.5t39.5 -51.5t65.5 -18q49 0 76.5 38t33.5 101zM1856 647q0 207 -15.5 307 t-60.5 161q-6 8 -13.5 14t-21.5 15t-16 11q-86 63 -697 63q-625 0 -710 -63q-5 -4 -17.5 -11.5t-21 -14t-14.5 -14.5q-45 -60 -60 -159.5t-15 -308.5q0 -208 15 -307.5t60 -160.5q6 -8 15 -15t20.5 -14t17.5 -12q44 -33 239.5 -49t470.5 -16q610 0 697 65q5 4 17 11t20.5 14 t13.5 16q46 60 61 159t15 309zM2048 1408v-1536h-2048v1536h2048z" /> +<glyph unicode="" d="M992 912v-496q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v496q0 112 -80 192t-192 80h-272v-1152q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v1344q0 14 9 23t23 9h464q135 0 249 -66.5t180.5 -180.5t66.5 -249zM1376 1376v-880q0 -135 -66.5 -249t-180.5 -180.5 t-249 -66.5h-464q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h160q14 0 23 -9t9 -23v-768h272q112 0 192 80t80 192v880q0 14 9 23t23 9h160q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1311 694v-114q0 -24 -13.5 -38t-37.5 -14h-202q-24 0 -38 14t-14 38v114q0 24 14 38t38 14h202q24 0 37.5 -14t13.5 -38zM821 464v250q0 53 -32.5 85.5t-85.5 32.5h-133q-68 0 -96 -52q-28 52 -96 52h-130q-53 0 -85.5 -32.5t-32.5 -85.5v-250q0 -22 21 -22h55 q22 0 22 22v230q0 24 13.5 38t38.5 14h94q24 0 38 -14t14 -38v-230q0 -22 21 -22h54q22 0 22 22v230q0 24 14 38t38 14h97q24 0 37.5 -14t13.5 -38v-230q0 -22 22 -22h55q21 0 21 22zM1410 560v154q0 53 -33 85.5t-86 32.5h-264q-53 0 -86 -32.5t-33 -85.5v-410 q0 -21 22 -21h55q21 0 21 21v180q31 -42 94 -42h191q53 0 86 32.5t33 85.5zM1536 1176v-1072q0 -96 -68 -164t-164 -68h-1072q-96 0 -164 68t-68 164v1072q0 96 68 164t164 68h1072q96 0 164 -68t68 -164z" /> +<glyph unicode="" d="M915 450h-294l147 551zM1001 128h311l-324 1024h-440l-324 -1024h311l383 314zM1536 1120v-960q0 -118 -85 -203t-203 -85h-960q-118 0 -203 85t-85 203v960q0 118 85 203t203 85h960q118 0 203 -85t85 -203z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 641q0 -21 -13 -36.5t-33 -19.5l-205 -356q3 -9 3 -18q0 -20 -12.5 -35.5t-32.5 -19.5l-193 -337q3 -8 3 -16q0 -23 -16.5 -40t-40.5 -17q-25 0 -41 18h-400q-17 -20 -43 -20t-43 20h-399q-17 -20 -43 -20q-23 0 -40 16.5t-17 40.5q0 8 4 20l-193 335 q-20 4 -32.5 19.5t-12.5 35.5q0 9 3 18l-206 356q-20 5 -32.5 20.5t-12.5 35.5q0 21 13.5 36.5t33.5 19.5l199 344q0 1 -0.5 3t-0.5 3q0 36 34 51l209 363q-4 10 -4 18q0 24 17 40.5t40 16.5q26 0 44 -21h396q16 21 43 21t43 -21h398q18 21 44 21q23 0 40 -16.5t17 -40.5 q0 -6 -4 -18l207 -358q23 -1 39 -17.5t16 -38.5q0 -13 -7 -27l187 -324q19 -4 31.5 -19.5t12.5 -35.5zM1063 -158h389l-342 354h-143l-342 -354h360q18 16 39 16t39 -16zM112 654q1 -4 1 -13q0 -10 -2 -15l208 -360q2 0 4.5 -1t5.5 -2.5l5 -2.5l188 199v347l-187 194 q-13 -8 -29 -10zM986 1438h-388l190 -200l554 200h-280q-16 -16 -38 -16t-38 16zM1689 226q1 6 5 11l-64 68l-17 -79h76zM1583 226l22 105l-252 266l-296 -307l63 -64h463zM1495 -142l16 28l65 310h-427l333 -343q8 4 13 5zM578 -158h5l342 354h-373v-335l4 -6q14 -5 22 -13 zM552 226h402l64 66l-309 321l-157 -166v-221zM359 226h163v189l-168 -177q4 -8 5 -12zM358 1051q0 -1 0.5 -2t0.5 -2q0 -16 -8 -29l171 -177v269zM552 1121v-311l153 -157l297 314l-223 236zM556 1425l-4 -8v-264l205 74l-191 201q-6 -2 -10 -3zM1447 1438h-16l-621 -224 l213 -225zM1023 946l-297 -315l311 -319l296 307zM688 634l-136 141v-284zM1038 270l-42 -44h85zM1374 618l238 -251l132 624l-3 5l-1 1zM1718 1018q-8 13 -8 29v2l-216 376q-5 1 -13 5l-437 -463l310 -327zM522 1142v223l-163 -282zM522 196h-163l163 -283v283zM1607 196 l-48 -227l130 227h-82zM1729 266l207 361q-2 10 -2 14q0 1 3 16l-171 296l-129 -612l77 -82q5 3 15 7z" /> +<glyph unicode="" d="M0 856q0 131 91.5 226.5t222.5 95.5h742l352 358v-1470q0 -132 -91.5 -227t-222.5 -95h-780q-131 0 -222.5 95t-91.5 227v790zM1232 102l-176 180v425q0 46 -32 79t-78 33h-484q-46 0 -78 -33t-32 -79v-492q0 -46 32.5 -79.5t77.5 -33.5h770z" /> +<glyph unicode="" d="M934 1386q-317 -121 -556 -362.5t-358 -560.5q-20 89 -20 176q0 208 102.5 384.5t278.5 279t384 102.5q82 0 169 -19zM1203 1267q93 -65 164 -155q-389 -113 -674.5 -400.5t-396.5 -676.5q-93 72 -155 162q112 386 395 671t667 399zM470 -67q115 356 379.5 622t619.5 384 q40 -92 54 -195q-292 -120 -516 -345t-343 -518q-103 14 -194 52zM1536 -125q-193 50 -367 115q-135 -84 -290 -107q109 205 274 370.5t369 275.5q-21 -152 -101 -284q65 -175 115 -370z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1893 1144l155 -1272q-131 0 -257 57q-200 91 -393 91q-226 0 -374 -148q-148 148 -374 148q-193 0 -393 -91q-128 -57 -252 -57h-5l155 1272q224 127 482 127q233 0 387 -106q154 106 387 106q258 0 482 -127zM1398 157q129 0 232 -28.5t260 -93.5l-124 1021 q-171 78 -368 78q-224 0 -374 -141q-150 141 -374 141q-197 0 -368 -78l-124 -1021q105 43 165.5 65t148.5 39.5t178 17.5q202 0 374 -108q172 108 374 108zM1438 191l-55 907q-211 -4 -359 -155q-152 155 -374 155q-176 0 -336 -66l-114 -941q124 51 228.5 76t221.5 25 q209 0 374 -102q172 107 374 102z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1500 165v733q0 21 -15 36t-35 15h-93q-20 0 -35 -15t-15 -36v-733q0 -20 15 -35t35 -15h93q20 0 35 15t15 35zM1216 165v531q0 20 -15 35t-35 15h-101q-20 0 -35 -15t-15 -35v-531q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM924 165v429q0 20 -15 35t-35 15h-101 q-20 0 -35 -15t-15 -35v-429q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM632 165v362q0 20 -15 35t-35 15h-101q-20 0 -35 -15t-15 -35v-362q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM2048 311q0 -166 -118 -284t-284 -118h-1244q-166 0 -284 118t-118 284 q0 116 63 214.5t168 148.5q-10 34 -10 73q0 113 80.5 193.5t193.5 80.5q102 0 180 -67q45 183 194 300t338 117q149 0 275 -73.5t199.5 -199.5t73.5 -275q0 -66 -14 -122q135 -33 221 -142.5t86 -247.5z" /> +<glyph unicode="" d="M0 1536h1536v-1392l-776 -338l-760 338v1392zM1436 209v926h-1336v-926l661 -294zM1436 1235v201h-1336v-201h1336zM181 937v-115h-37v115h37zM181 789v-115h-37v115h37zM181 641v-115h-37v115h37zM181 493v-115h-37v115h37zM181 345v-115h-37v115h37zM207 202l15 34 l105 -47l-15 -33zM343 142l15 34l105 -46l-15 -34zM478 82l15 34l105 -46l-15 -34zM614 23l15 33l104 -46l-15 -34zM797 10l105 46l15 -33l-105 -47zM932 70l105 46l15 -34l-105 -46zM1068 130l105 46l15 -34l-105 -46zM1203 189l105 47l15 -34l-105 -46zM259 1389v-36h-114 v36h114zM421 1389v-36h-115v36h115zM583 1389v-36h-115v36h115zM744 1389v-36h-114v36h114zM906 1389v-36h-114v36h114zM1068 1389v-36h-115v36h115zM1230 1389v-36h-115v36h115zM1391 1389v-36h-114v36h114zM181 1049v-79h-37v115h115v-36h-78zM421 1085v-36h-115v36h115z M583 1085v-36h-115v36h115zM744 1085v-36h-114v36h114zM906 1085v-36h-114v36h114zM1068 1085v-36h-115v36h115zM1230 1085v-36h-115v36h115zM1355 970v79h-78v36h115v-115h-37zM1355 822v115h37v-115h-37zM1355 674v115h37v-115h-37zM1355 526v115h37v-115h-37zM1355 378 v115h37v-115h-37zM1355 230v115h37v-115h-37zM760 265q-129 0 -221 91.5t-92 221.5q0 129 92 221t221 92q130 0 221.5 -92t91.5 -221q0 -130 -91.5 -221.5t-221.5 -91.5zM595 646q0 -36 19.5 -56.5t49.5 -25t64 -7t64 -2t49.5 -9t19.5 -30.5q0 -49 -112 -49q-97 0 -123 51 h-3l-31 -63q67 -42 162 -42q29 0 56.5 5t55.5 16t45.5 33t17.5 53q0 46 -27.5 69.5t-67.5 27t-79.5 3t-67 5t-27.5 25.5q0 21 20.5 33t40.5 15t41 3q34 0 70.5 -11t51.5 -34h3l30 58q-3 1 -21 8.5t-22.5 9t-19.5 7t-22 7t-20 4.5t-24 4t-23 1q-29 0 -56.5 -5t-54 -16.5 t-43 -34t-16.5 -53.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M863 504q0 112 -79.5 191.5t-191.5 79.5t-191 -79.5t-79 -191.5t79 -191t191 -79t191.5 79t79.5 191zM1726 505q0 112 -79 191t-191 79t-191.5 -79t-79.5 -191q0 -113 79.5 -192t191.5 -79t191 79.5t79 191.5zM2048 1314v-1348q0 -44 -31.5 -75.5t-76.5 -31.5h-1832 q-45 0 -76.5 31.5t-31.5 75.5v1348q0 44 31.5 75.5t76.5 31.5h431q44 0 76 -31.5t32 -75.5v-161h754v161q0 44 32 75.5t76 31.5h431q45 0 76.5 -31.5t31.5 -75.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1430 953zM1690 749q148 0 253 -98.5t105 -244.5q0 -157 -109 -261.5t-267 -104.5q-85 0 -162 27.5t-138 73.5t-118 106t-109 126.5t-103.5 132.5t-108.5 126t-117 106t-136 73.5t-159 27.5q-154 0 -251.5 -91.5t-97.5 -244.5q0 -157 104 -250t263 -93q100 0 208 37.5 t193 98.5q5 4 21 18.5t30 24t22 9.5q14 0 24.5 -10.5t10.5 -24.5q0 -24 -60 -77q-101 -88 -234.5 -142t-260.5 -54q-133 0 -245.5 58t-180 165t-67.5 241q0 205 141.5 341t347.5 136q120 0 226.5 -43.5t185.5 -113t151.5 -153t139 -167.5t133.5 -153.5t149.5 -113 t172.5 -43.5q102 0 168.5 61.5t66.5 162.5q0 95 -64.5 159t-159.5 64q-30 0 -81.5 -18.5t-68.5 -18.5q-20 0 -35.5 15t-15.5 35q0 18 8.5 57t8.5 59q0 159 -107.5 263t-266.5 104q-58 0 -111.5 -18.5t-84 -40.5t-55.5 -40.5t-33 -18.5q-15 0 -25.5 10.5t-10.5 25.5 q0 19 25 46q59 67 147 103.5t182 36.5q191 0 318 -125.5t127 -315.5q0 -37 -4 -66q57 15 115 15z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1216 832q0 26 -19 45t-45 19h-128v128q0 26 -19 45t-45 19t-45 -19t-19 -45v-128h-128q-26 0 -45 -19t-19 -45t19 -45t45 -19h128v-128q0 -26 19 -45t45 -19t45 19t19 45v128h128q26 0 45 19t19 45zM640 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1536 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1664 1088v-512q0 -24 -16 -42.5t-41 -21.5l-1044 -122q1 -7 4.5 -21.5t6 -26.5t2.5 -22q0 -16 -24 -64h920 q26 0 45 -19t19 -45t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 14 11 39.5t29.5 59.5t20.5 38l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t20 -15.5t13 -24.5t7.5 -26.5t5.5 -29.5t4.5 -25.5h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 832q0 26 -19 45t-45 19t-45 -19l-147 -146v293q0 26 -19 45t-45 19t-45 -19t-19 -45v-293l-147 146q-19 19 -45 19t-45 -19t-19 -45t19 -45l256 -256q19 -19 45 -19t45 19l256 256q19 19 19 45zM640 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1536 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1664 1088v-512q0 -24 -16 -42.5t-41 -21.5l-1044 -122q1 -7 4.5 -21.5t6 -26.5t2.5 -22q0 -16 -24 -64h920 q26 0 45 -19t19 -45t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 14 11 39.5t29.5 59.5t20.5 38l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t20 -15.5t13 -24.5t7.5 -26.5t5.5 -29.5t4.5 -25.5h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M212 768l623 -665l-300 665h-323zM1024 -4l349 772h-698zM538 896l204 384h-262l-288 -384h346zM1213 103l623 665h-323zM683 896h682l-204 384h-274zM1510 896h346l-288 384h-262zM1651 1382l384 -512q14 -18 13 -41.5t-17 -40.5l-960 -1024q-18 -20 -47 -20t-47 20 l-960 1024q-16 17 -17 40.5t13 41.5l384 512q18 26 51 26h1152q33 0 51 -26z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1811 -19q19 19 45 19t45 -19l128 -128l-90 -90l-83 83l-83 -83q-18 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83 q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-128 128l90 90l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83 q19 19 45 19t45 -19l83 -83zM237 19q-19 -19 -45 -19t-45 19l-128 128l90 90l83 -82l83 82q19 19 45 19t45 -19l83 -82l64 64v293l-210 314q-17 26 -7 56.5t40 40.5l177 58v299h128v128h256v128h256v-128h256v-128h128v-299l177 -58q30 -10 40 -40.5t-7 -56.5l-210 -314 v-293l19 18q19 19 45 19t45 -19l83 -82l83 82q19 19 45 19t45 -19l128 -128l-90 -90l-83 83l-83 -83q-18 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83 q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83zM640 1152v-128l384 128l384 -128v128h-128v128h-512v-128h-128z" /> +<glyph unicode="" d="M576 0l96 448l-96 128l-128 64zM832 0l128 640l-128 -64l-96 -128zM992 1010q-2 4 -4 6q-10 8 -96 8q-70 0 -167 -19q-7 -2 -21 -2t-21 2q-97 19 -167 19q-86 0 -96 -8q-2 -2 -4 -6q2 -18 4 -27q2 -3 7.5 -6.5t7.5 -10.5q2 -4 7.5 -20.5t7 -20.5t7.5 -17t8.5 -17t9 -14 t12 -13.5t14 -9.5t17.5 -8t20.5 -4t24.5 -2q36 0 59 12.5t32.5 30t14.5 34.5t11.5 29.5t17.5 12.5h12q11 0 17.5 -12.5t11.5 -29.5t14.5 -34.5t32.5 -30t59 -12.5q13 0 24.5 2t20.5 4t17.5 8t14 9.5t12 13.5t9 14t8.5 17t7.5 17t7 20.5t7.5 20.5q2 7 7.5 10.5t7.5 6.5 q2 9 4 27zM1408 131q0 -121 -73 -190t-194 -69h-874q-121 0 -194 69t-73 190q0 61 4.5 118t19 125.5t37.5 123.5t63.5 103.5t93.5 74.5l-90 220h214q-22 64 -22 128q0 12 2 32q-194 40 -194 96q0 57 210 99q17 62 51.5 134t70.5 114q32 37 76 37q30 0 84 -31t84 -31t84 31 t84 31q44 0 76 -37q36 -42 70.5 -114t51.5 -134q210 -42 210 -99q0 -56 -194 -96q7 -81 -20 -160h214l-82 -225q63 -33 107.5 -96.5t65.5 -143.5t29 -151.5t8 -148.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2301 500q12 -103 -22 -198.5t-99 -163.5t-158.5 -106t-196.5 -31q-161 11 -279.5 125t-134.5 274q-12 111 27.5 210.5t118.5 170.5l-71 107q-96 -80 -151 -194t-55 -244q0 -27 -18.5 -46.5t-45.5 -19.5h-256h-69q-23 -164 -149 -274t-294 -110q-185 0 -316.5 131.5 t-131.5 316.5t131.5 316.5t316.5 131.5q76 0 152 -27l24 45q-123 110 -304 110h-64q-26 0 -45 19t-19 45t19 45t45 19h128q78 0 145 -13.5t116.5 -38.5t71.5 -39.5t51 -36.5h512h115l-85 128h-222q-30 0 -49 22.5t-14 52.5q4 23 23 38t43 15h253q33 0 53 -28l70 -105 l114 114q19 19 46 19h101q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-179l115 -172q131 63 275 36q143 -26 244 -134.5t118 -253.5zM448 128q115 0 203 72.5t111 183.5h-314q-35 0 -55 31q-18 32 -1 63l147 277q-47 13 -91 13q-132 0 -226 -94t-94 -226t94 -226 t226 -94zM1856 128q132 0 226 94t94 226t-94 226t-226 94q-60 0 -121 -24l174 -260q15 -23 10 -49t-27 -40q-15 -11 -36 -11q-35 0 -53 29l-174 260q-93 -95 -93 -225q0 -132 94 -226t226 -94z" /> +<glyph unicode="" d="M1408 0q0 -63 -61.5 -113.5t-164 -81t-225 -46t-253.5 -15.5t-253.5 15.5t-225 46t-164 81t-61.5 113.5q0 49 33 88.5t91 66.5t118 44.5t131 29.5q26 5 48 -10.5t26 -41.5q5 -26 -10.5 -48t-41.5 -26q-58 -10 -106 -23.5t-76.5 -25.5t-48.5 -23.5t-27.5 -19.5t-8.5 -12 q3 -11 27 -26.5t73 -33t114 -32.5t160.5 -25t201.5 -10t201.5 10t160.5 25t114 33t73 33.5t27 27.5q-1 4 -8.5 11t-27.5 19t-48.5 23.5t-76.5 25t-106 23.5q-26 4 -41.5 26t-10.5 48q4 26 26 41.5t48 10.5q71 -12 131 -29.5t118 -44.5t91 -66.5t33 -88.5zM1024 896v-384 q0 -26 -19 -45t-45 -19h-64v-384q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v384h-64q-26 0 -45 19t-19 45v384q0 53 37.5 90.5t90.5 37.5h384q53 0 90.5 -37.5t37.5 -90.5zM928 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5 t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 512h305q-5 -6 -10 -10.5t-9 -7.5l-3 -4l-623 -600q-18 -18 -44 -18t-44 18l-624 602q-5 2 -21 20h369q22 0 39.5 13.5t22.5 34.5l70 281l190 -667q6 -20 23 -33t39 -13q21 0 38 13t23 33l146 485l56 -112q18 -35 57 -35zM1792 940q0 -145 -103 -300h-369l-111 221 q-8 17 -25.5 27t-36.5 8q-45 -5 -56 -46l-129 -430l-196 686q-6 20 -23.5 33t-39.5 13t-39 -13.5t-22 -34.5l-116 -464h-423q-103 155 -103 300q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124 t127 -344z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 960q0 -221 -147.5 -384.5t-364.5 -187.5v-260h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v260q-150 16 -271.5 103t-186 224t-52.5 292 q11 134 80.5 249t182 188t245.5 88q170 19 319 -54t236 -212t87 -306zM128 960q0 -185 131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5z" /> +<glyph unicode="" d="M1472 1408q26 0 45 -19t19 -45v-416q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v262l-382 -383q126 -156 126 -359q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123t223.5 45.5 q203 0 359 -126l382 382h-261q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h416zM576 0q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M830 1220q145 -72 233.5 -210.5t88.5 -305.5q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-217 24 -364.5 187.5 t-147.5 384.5q0 167 88.5 305.5t233.5 210.5q-165 96 -228 273q-6 16 3.5 29.5t26.5 13.5h69q21 0 29 -20q44 -106 140 -171t214 -65t214 65t140 171q8 20 37 20h61q17 0 26.5 -13.5t3.5 -29.5q-63 -177 -228 -273zM576 256q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" d="M1024 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q126 -158 126 -359q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64 q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-149 16 -270.5 103t-186.5 223.5t-53 291.5q16 204 160 353.5t347 172.5q118 14 228 -19t198 -103l255 254h-134q-14 0 -23 9t-9 23v64zM576 256q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q126 -158 126 -359q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64 q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-217 24 -364.5 187.5t-147.5 384.5q0 201 126 359l-52 53l-101 -111q-9 -10 -22 -10.5t-23 7.5l-48 44q-10 8 -10.5 21.5t8.5 23.5l105 115l-111 112v-134q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9 t-9 23v288q0 26 19 45t45 19h288q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-133l106 -107l86 94q9 10 22 10.5t23 -7.5l48 -44q10 -8 10.5 -21.5t-8.5 -23.5l-90 -99l57 -56q158 126 359 126t359 -126l255 254h-134q-14 0 -23 9t-9 23v64zM832 256q185 0 316.5 131.5 t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1790 1007q12 -155 -52.5 -292t-186 -224t-271.5 -103v-260h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-512v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23 t23 9h224v260q-150 16 -271.5 103t-186 224t-52.5 292q17 206 164.5 356.5t352.5 169.5q206 21 377 -94q171 115 377 94q205 -19 352.5 -169.5t164.5 -356.5zM896 647q128 131 128 313t-128 313q-128 -131 -128 -313t128 -313zM576 512q115 0 218 57q-154 165 -154 391 q0 224 154 391q-103 57 -218 57q-185 0 -316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5zM1152 128v260q-137 15 -256 94q-119 -79 -256 -94v-260h512zM1216 512q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5q-115 0 -218 -57q154 -167 154 -391 q0 -226 -154 -391q103 -57 218 -57z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1536 1120q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q76 -95 107.5 -214t9.5 -247q-31 -182 -166 -312t-318 -156q-210 -29 -384.5 80t-241.5 300q-117 6 -221 57.5t-177.5 133t-113.5 192.5t-32 230 q9 135 78 252t182 191.5t248 89.5q118 14 227.5 -19t198.5 -103l255 254h-134q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q59 -74 93 -169q182 -9 328 -124l255 254h-134q-14 0 -23 9 t-9 23v64zM1024 704q0 20 -4 58q-162 -25 -271 -150t-109 -292q0 -20 4 -58q162 25 271 150t109 292zM128 704q0 -168 111 -294t276 -149q-3 29 -3 59q0 210 135 369.5t338 196.5q-53 120 -163.5 193t-245.5 73q-185 0 -316.5 -131.5t-131.5 -316.5zM1088 -128 q185 0 316.5 131.5t131.5 316.5q0 168 -111 294t-276 149q3 -29 3 -59q0 -210 -135 -369.5t-338 -196.5q53 -120 163.5 -193t245.5 -73z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1664 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q76 -95 107.5 -214t9.5 -247q-32 -180 -164.5 -310t-313.5 -157q-223 -34 -409 90q-117 -78 -256 -93v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23 t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-155 17 -279.5 109.5t-187 237.5t-39.5 307q25 187 159.5 322.5t320.5 164.5q224 34 410 -90q146 97 320 97q201 0 359 -126l255 254h-134q-14 0 -23 9 t-9 23v64zM896 391q128 131 128 313t-128 313q-128 -131 -128 -313t128 -313zM128 704q0 -185 131.5 -316.5t316.5 -131.5q117 0 218 57q-154 167 -154 391t154 391q-101 57 -218 57q-185 0 -316.5 -131.5t-131.5 -316.5zM1216 256q185 0 316.5 131.5t131.5 316.5 t-131.5 316.5t-316.5 131.5q-117 0 -218 -57q154 -167 154 -391t-154 -391q101 -57 218 -57z" /> +<glyph unicode="" d="M1472 1408q26 0 45 -19t19 -45v-416q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v262l-213 -214l140 -140q9 -10 9 -23t-9 -22l-46 -46q-9 -9 -22 -9t-23 9l-140 141l-78 -79q126 -156 126 -359q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5 t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123t223.5 45.5q203 0 359 -126l78 78l-172 172q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l172 -172l213 213h-261q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h416zM576 0q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M640 892q217 -24 364.5 -187.5t147.5 -384.5q0 -167 -87 -306t-236 -212t-319 -54q-133 15 -245.5 88t-182 188t-80.5 249q-12 155 52.5 292t186 224t271.5 103v132h-160q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h160v165l-92 -92q-10 -9 -23 -9t-22 9l-46 46q-9 9 -9 22 t9 23l202 201q19 19 45 19t45 -19l202 -201q9 -10 9 -23t-9 -22l-46 -46q-9 -9 -22 -9t-23 9l-92 92v-165h160q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-160v-132zM576 -128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5 t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1901 621q19 -19 19 -45t-19 -45l-294 -294q-9 -10 -22.5 -10t-22.5 10l-45 45q-10 9 -10 22.5t10 22.5l185 185h-294v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-132q-24 -217 -187.5 -364.5t-384.5 -147.5q-167 0 -306 87t-212 236t-54 319q15 133 88 245.5 t188 182t249 80.5q155 12 292 -52.5t224 -186t103 -271.5h132v224q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-224h294l-185 185q-10 9 -10 22.5t10 22.5l45 45q9 10 22.5 10t22.5 -10zM576 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5 t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 960q0 -221 -147.5 -384.5t-364.5 -187.5v-612q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v612q-217 24 -364.5 187.5t-147.5 384.5q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5zM576 512q185 0 316.5 131.5 t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1024 576q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1152 576q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123 t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5z" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" d="M1451 1408q35 0 60 -25t25 -60v-1366q0 -35 -25 -60t-60 -25h-391v595h199l30 232h-229v148q0 56 23.5 84t91.5 28l122 1v207q-63 9 -178 9q-136 0 -217.5 -80t-81.5 -226v-171h-200v-232h200v-595h-735q-35 0 -60 25t-25 60v1366q0 35 25 60t60 25h1366z" /> +<glyph unicode="" horiz-adv-x="1280" d="M0 939q0 108 37.5 203.5t103.5 166.5t152 123t185 78t202 26q158 0 294 -66.5t221 -193.5t85 -287q0 -96 -19 -188t-60 -177t-100 -149.5t-145 -103t-189 -38.5q-68 0 -135 32t-96 88q-10 -39 -28 -112.5t-23.5 -95t-20.5 -71t-26 -71t-32 -62.5t-46 -77.5t-62 -86.5 l-14 -5l-9 10q-15 157 -15 188q0 92 21.5 206.5t66.5 287.5t52 203q-32 65 -32 169q0 83 52 156t132 73q61 0 95 -40.5t34 -102.5q0 -66 -44 -191t-44 -187q0 -63 45 -104.5t109 -41.5q55 0 102 25t78.5 68t56 95t38 110.5t20 111t6.5 99.5q0 173 -109.5 269.5t-285.5 96.5 q-200 0 -334 -129.5t-134 -328.5q0 -44 12.5 -85t27 -65t27 -45.5t12.5 -30.5q0 -28 -15 -73t-37 -45q-2 0 -17 3q-51 15 -90.5 56t-61 94.5t-32.5 108t-11 106.5z" /> +<glyph unicode="" d="M985 562q13 0 97.5 -44t89.5 -53q2 -5 2 -15q0 -33 -17 -76q-16 -39 -71 -65.5t-102 -26.5q-57 0 -190 62q-98 45 -170 118t-148 185q-72 107 -71 194v8q3 91 74 158q24 22 52 22q6 0 18 -1.5t19 -1.5q19 0 26.5 -6.5t15.5 -27.5q8 -20 33 -88t25 -75q0 -21 -34.5 -57.5 t-34.5 -46.5q0 -7 5 -15q34 -73 102 -137q56 -53 151 -101q12 -7 22 -7q15 0 54 48.5t52 48.5zM782 32q127 0 243.5 50t200.5 134t134 200.5t50 243.5t-50 243.5t-134 200.5t-200.5 134t-243.5 50t-243.5 -50t-200.5 -134t-134 -200.5t-50 -243.5q0 -203 120 -368l-79 -233 l242 77q158 -104 345 -104zM782 1414q153 0 292.5 -60t240.5 -161t161 -240.5t60 -292.5t-60 -292.5t-161 -240.5t-240.5 -161t-292.5 -60q-195 0 -365 94l-417 -134l136 405q-108 178 -108 389q0 153 60 292.5t161 240.5t240.5 161t292.5 60z" /> +<glyph unicode="" horiz-adv-x="1792" d="M128 128h1024v128h-1024v-128zM128 640h1024v128h-1024v-128zM1696 192q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM128 1152h1024v128h-1024v-128zM1696 704q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1696 1216 q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1792 384v-384h-1792v384h1792zM1792 896v-384h-1792v384h1792zM1792 1408v-384h-1792v384h1792z" /> +<glyph unicode="" horiz-adv-x="2048" d="M704 640q-159 0 -271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5zM1664 512h352q13 0 22.5 -9.5t9.5 -22.5v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-352v-352q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5 t-9.5 22.5v352h-352q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h352v352q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5v-352zM928 288q0 -52 38 -90t90 -38h256v-238q-68 -50 -171 -50h-874q-121 0 -194 69t-73 190q0 53 3.5 103.5t14 109t26.5 108.5 t43 97.5t62 81t85.5 53.5t111.5 20q19 0 39 -17q79 -61 154.5 -91.5t164.5 -30.5t164.5 30.5t154.5 91.5q20 17 39 17q132 0 217 -96h-223q-52 0 -90 -38t-38 -90v-192z" /> +<glyph unicode="" horiz-adv-x="2048" d="M704 640q-159 0 -271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5zM1781 320l249 -249q9 -9 9 -23q0 -13 -9 -22l-136 -136q-9 -9 -22 -9q-14 0 -23 9l-249 249l-249 -249q-9 -9 -23 -9q-13 0 -22 9l-136 136 q-9 9 -9 22q0 14 9 23l249 249l-249 249q-9 9 -9 23q0 13 9 22l136 136q9 9 22 9q14 0 23 -9l249 -249l249 249q9 9 23 9q13 0 22 -9l136 -136q9 -9 9 -22q0 -14 -9 -23zM1283 320l-181 -181q-37 -37 -37 -91q0 -53 37 -90l83 -83q-21 -3 -44 -3h-874q-121 0 -194 69 t-73 190q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t111.5 20q19 0 39 -17q154 -122 319 -122t319 122q20 17 39 17q28 0 57 -6q-28 -27 -41 -50t-13 -56q0 -54 37 -91z" /> +<glyph unicode="" horiz-adv-x="2048" d="M256 512h1728q26 0 45 -19t19 -45v-448h-256v256h-1536v-256h-256v1216q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-704zM832 832q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM2048 576v64q0 159 -112.5 271.5t-271.5 112.5h-704 q-26 0 -45 -19t-19 -45v-384h1152z" /> +<glyph unicode="" d="M1536 1536l-192 -448h192v-192h-274l-55 -128h329v-192h-411l-357 -832l-357 832h-411v192h329l-55 128h-274v192h192l-192 448h256l323 -768h378l323 768h256zM768 320l108 256h-216z" /> +<glyph unicode="" d="M1088 1536q185 0 316.5 -93.5t131.5 -226.5v-896q0 -130 -125.5 -222t-305.5 -97l213 -202q16 -15 8 -35t-30 -20h-1056q-22 0 -30 20t8 35l213 202q-180 5 -305.5 97t-125.5 222v896q0 133 131.5 226.5t316.5 93.5h640zM768 192q80 0 136 56t56 136t-56 136t-136 56 t-136 -56t-56 -136t56 -136t136 -56zM1344 768v512h-1152v-512h1152z" /> +<glyph unicode="" d="M1088 1536q185 0 316.5 -93.5t131.5 -226.5v-896q0 -130 -125.5 -222t-305.5 -97l213 -202q16 -15 8 -35t-30 -20h-1056q-22 0 -30 20t8 35l213 202q-180 5 -305.5 97t-125.5 222v896q0 133 131.5 226.5t316.5 93.5h640zM288 224q66 0 113 47t47 113t-47 113t-113 47 t-113 -47t-47 -113t47 -113t113 -47zM704 768v512h-544v-512h544zM1248 224q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47zM1408 768v512h-576v-512h576z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 204v-209h-642v209h134v926h-6l-314 -1135h-243l-310 1135h-8v-926h135v-209h-538v209h69q21 0 43 19.5t22 37.5v881q0 18 -22 40t-43 22h-69v209h672l221 -821h6l223 821h670v-209h-71q-19 0 -41 -22t-22 -40v-881q0 -18 21.5 -37.5t41.5 -19.5h71z" /> +<glyph unicode="" d="M809 532l266 499h-112l-157 -312q-24 -48 -44 -92l-42 92l-155 312h-120l263 -493v-324h101v318zM1536 1408v-1536h-1536v1536h1536z" /> +<glyph unicode="" horiz-adv-x="2296" d="M478 -139q-8 -16 -27 -34.5t-37 -25.5q-25 -9 -51.5 3.5t-28.5 31.5q-1 22 40 55t68 38q23 4 34 -21.5t2 -46.5zM1819 -139q7 -16 26 -34.5t38 -25.5q25 -9 51.5 3.5t27.5 31.5q2 22 -39.5 55t-68.5 38q-22 4 -33 -21.5t-2 -46.5zM1867 -30q13 -27 56.5 -59.5t77.5 -41.5 q45 -13 82 4.5t37 50.5q0 46 -67.5 100.5t-115.5 59.5q-40 5 -63.5 -37.5t-6.5 -76.5zM428 -30q-13 -27 -56 -59.5t-77 -41.5q-45 -13 -82 4.5t-37 50.5q0 46 67.5 100.5t115.5 59.5q40 5 63 -37.5t6 -76.5zM1158 1094h1q-41 0 -76 -15q27 -8 44 -30.5t17 -49.5 q0 -35 -27 -60t-65 -25q-52 0 -80 43q-5 -23 -5 -42q0 -74 56 -126.5t135 -52.5q80 0 136 52.5t56 126.5t-56 126.5t-136 52.5zM1462 1312q-99 109 -220.5 131.5t-245.5 -44.5q27 60 82.5 96.5t118 39.5t121.5 -17t99.5 -74.5t44.5 -131.5zM2212 73q8 -11 -11 -42 q7 -23 7 -40q1 -56 -44.5 -112.5t-109.5 -91.5t-118 -37q-48 -2 -92 21.5t-66 65.5q-687 -25 -1259 0q-23 -41 -66.5 -65t-92.5 -22q-86 3 -179.5 80.5t-92.5 160.5q2 22 7 40q-19 31 -11 42q6 10 31 1q14 22 41 51q-7 29 2 38q11 10 39 -4q29 20 59 34q0 29 13 37 q23 12 51 -16q35 5 61 -2q18 -4 38 -19v73q-11 0 -18 2q-53 10 -97 44.5t-55 87.5q-9 38 0 81q15 62 93 95q2 17 19 35.5t36 23.5t33 -7.5t19 -30.5h13q46 -5 60 -23q3 -3 5 -7q10 1 30.5 3.5t30.5 3.5q-15 11 -30 17q-23 40 -91 43q0 6 1 10q-62 2 -118.5 18.5t-84.5 47.5 q-32 36 -42.5 92t-2.5 112q16 126 90 179q23 16 52 4.5t32 -40.5q0 -1 1.5 -14t2.5 -21t3 -20t5.5 -19t8.5 -10q27 -14 76 -12q48 46 98 74q-40 4 -162 -14l47 46q61 58 163 111q145 73 282 86q-20 8 -41 15.5t-47 14t-42.5 10.5t-47.5 11t-43 10q595 126 904 -139 q98 -84 158 -222q85 -10 121 9h1q5 3 8.5 10t5.5 19t3 19.5t3 21.5l1 14q3 28 32 40t52 -5q73 -52 91 -178q7 -57 -3.5 -113t-42.5 -91q-28 -32 -83.5 -48.5t-115.5 -18.5v-10q-71 -2 -95 -43q-14 -5 -31 -17q11 -1 32 -3.5t30 -3.5q1 4 5 8q16 18 60 23h13q5 18 19 30t33 8 t36 -23t19 -36q79 -32 93 -95q9 -40 1 -81q-12 -53 -56 -88t-97 -44q-10 -2 -17 -2q0 -49 -1 -73q20 15 38 19q26 7 61 2q28 28 51 16q14 -9 14 -37q33 -16 59 -34q27 13 38 4q10 -10 2 -38q28 -30 41 -51q23 8 31 -1zM1937 1025q0 -29 -9 -54q82 -32 112 -132 q4 37 -9.5 98.5t-41.5 90.5q-20 19 -36 17t-16 -20zM1859 925q35 -42 47.5 -108.5t-0.5 -124.5q67 13 97 45q13 14 18 28q-3 64 -31 114.5t-79 66.5q-15 -15 -52 -21zM1822 921q-30 0 -44 1q42 -115 53 -239q21 0 43 3q16 68 1 135t-53 100zM258 839q30 100 112 132 q-9 25 -9 54q0 18 -16.5 20t-35.5 -17q-28 -29 -41.5 -90.5t-9.5 -98.5zM294 737q29 -31 97 -45q-13 58 -0.5 124.5t47.5 108.5v0q-37 6 -52 21q-51 -16 -78.5 -66t-31.5 -115q9 -17 18 -28zM471 683q14 124 73 235q-19 -4 -55 -18l-45 -19v1q-46 -89 -20 -196q25 -3 47 -3z M1434 644q8 -38 16.5 -108.5t11.5 -89.5q3 -18 9.5 -21.5t23.5 4.5q40 20 62 85.5t23 125.5q-24 2 -146 4zM1152 1285q-116 0 -199 -82.5t-83 -198.5q0 -117 83 -199.5t199 -82.5t199 82.5t83 199.5q0 116 -83 198.5t-199 82.5zM1380 646q-106 2 -211 0v1q-1 -27 2.5 -86 t13.5 -66q29 -14 93.5 -14.5t95.5 10.5q9 3 11 39t-0.5 69.5t-4.5 46.5zM1112 447q8 4 9.5 48t-0.5 88t-4 63v1q-212 -3 -214 -3q-4 -20 -7 -62t0 -83t14 -46q34 -15 101 -16t101 10zM718 636q-16 -59 4.5 -118.5t77.5 -84.5q15 -8 24 -5t12 21q3 16 8 90t10 103 q-69 -2 -136 -6zM591 510q3 -23 -34 -36q132 -141 271.5 -240t305.5 -154q172 49 310.5 146t293.5 250q-33 13 -30 34l3 9v1v-1q-17 2 -50 5.5t-48 4.5q-26 -90 -82 -132q-51 -38 -82 1q-5 6 -9 14q-7 13 -17 62q-2 -5 -5 -9t-7.5 -7t-8 -5.5t-9.5 -4l-10 -2.5t-12 -2 l-12 -1.5t-13.5 -1t-13.5 -0.5q-106 -9 -163 11q-4 -17 -10 -26.5t-21 -15t-23 -7t-36 -3.5q-2 0 -3 -0.5t-3 -0.5h-3q-179 -17 -203 40q-2 -63 -56 -54q-47 8 -91 54q-12 13 -20 26q-17 29 -26 65q-58 -6 -87 -10q1 -2 4 -10zM507 -118q3 14 3 30q-17 71 -51 130t-73 70 q-41 12 -101.5 -14.5t-104.5 -80t-39 -107.5q35 -53 100 -93t119 -42q51 -2 94 28t53 79zM510 53q23 -63 27 -119q195 113 392 174q-98 52 -180.5 120t-179.5 165q-6 -4 -29 -13q0 -2 -1 -5t-1 -4q31 -18 22 -37q-12 -23 -56 -34q-10 -13 -29 -24h-1q-2 -83 1 -150 q19 -34 35 -73zM579 -113q532 -21 1145 0q-254 147 -428 196q-76 -35 -156 -57q-8 -3 -16 0q-65 21 -129 49q-208 -60 -416 -188h-1v-1q1 0 1 1zM1763 -67q4 54 28 120q14 38 33 71l-1 -1q3 77 3 153q-15 8 -30 25q-42 9 -56 33q-9 20 22 38q-2 4 -2 9q-16 4 -28 12 q-204 -190 -383 -284q198 -59 414 -176zM2155 -90q5 54 -39 107.5t-104 80t-102 14.5q-38 -11 -72.5 -70.5t-51.5 -129.5q0 -16 3 -30q10 -49 53 -79t94 -28q54 2 119 42t100 93z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1524 -25q0 -68 -48 -116t-116 -48t-116.5 48t-48.5 116t48.5 116.5t116.5 48.5t116 -48.5t48 -116.5zM775 -25q0 -68 -48.5 -116t-116.5 -48t-116 48t-48 116t48 116.5t116 48.5t116.5 -48.5t48.5 -116.5zM0 1469q57 -60 110.5 -104.5t121 -82t136 -63t166 -45.5 t200 -31.5t250 -18.5t304 -9.5t372.5 -2.5q139 0 244.5 -5t181 -16.5t124 -27.5t71 -39.5t24 -51.5t-19.5 -64t-56.5 -76.5t-89.5 -91t-116 -104.5t-139 -119q-185 -157 -286 -247q29 51 76.5 109t94 105.5t94.5 98.5t83 91.5t54 80.5t13 70t-45.5 55.5t-116.5 41t-204 23.5 t-304 5q-168 -2 -314 6t-256 23t-204.5 41t-159.5 51.5t-122.5 62.5t-91.5 66.5t-68 71.5t-50.5 69.5t-40 68t-36.5 59.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1472q-169 0 -323 -66t-265.5 -177.5t-177.5 -265.5t-66 -323t66 -323t177.5 -265.5t265.5 -177.5t323 -66t323 66t265.5 177.5t177.5 265.5t66 323t-66 323t-177.5 265.5t-265.5 177.5t-323 66zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348 t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM496 704q16 0 16 -16v-480q0 -16 -16 -16h-32q-16 0 -16 16v480q0 16 16 16h32zM896 640q53 0 90.5 -37.5t37.5 -90.5q0 -35 -17.5 -64t-46.5 -46v-114q0 -14 -9 -23 t-23 -9h-64q-14 0 -23 9t-9 23v114q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5zM896 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM544 928v-96 q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v96q0 93 65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5v-96q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v96q0 146 -103 249t-249 103t-249 -103t-103 -249zM1408 192v512q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-512 q0 -26 19 -45t45 -19h896q26 0 45 19t19 45z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1920 1024v-768h-1664v768h1664zM2048 448h128v384h-128v288q0 14 -9 23t-23 9h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288zM2304 832v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113 v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h1280v-768h-1280zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h896v-768h-896zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h512v-768h-512zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9h-1856q-14 0 -23 -9t-9 -23 v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1133 493q31 -30 14 -69q-17 -40 -59 -40h-382l201 -476q10 -25 0 -49t-34 -35l-177 -75q-25 -10 -49 0t-35 34l-191 452l-312 -312q-19 -19 -45 -19q-12 0 -24 5q-40 17 -40 59v1504q0 42 40 59q12 5 24 5q27 0 45 -19z" /> +<glyph unicode="" horiz-adv-x="1024" d="M832 1408q-320 0 -320 -224v-416h128v-128h-128v-544q0 -224 320 -224h64v-128h-64q-272 0 -384 146q-112 -146 -384 -146h-64v128h64q320 0 320 224v544h-128v128h128v416q0 224 -320 224h-64v128h64q272 0 384 -146q112 146 384 146h64v-128h-64z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 1152h-128v-1024h128v-384h-384v128h-1280v-128h-384v384h128v1024h-128v384h384v-128h1280v128h384v-384zM1792 1408v-128h128v128h-128zM128 1408v-128h128v128h-128zM256 -128v128h-128v-128h128zM1664 0v128h128v1024h-128v128h-1280v-128h-128v-1024h128v-128 h1280zM1920 -128v128h-128v-128h128zM1280 896h384v-768h-896v256h-384v768h896v-256zM512 512h640v512h-640v-512zM1536 256v512h-256v-384h-384v-128h640z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2304 768h-128v-640h128v-384h-384v128h-896v-128h-384v384h128v128h-384v-128h-384v384h128v640h-128v384h384v-128h896v128h384v-384h-128v-128h384v128h384v-384zM2048 1024v-128h128v128h-128zM1408 1408v-128h128v128h-128zM128 1408v-128h128v128h-128zM256 256 v128h-128v-128h128zM1536 384h-128v-128h128v128zM384 384h896v128h128v640h-128v128h-896v-128h-128v-640h128v-128zM896 -128v128h-128v-128h128zM2176 -128v128h-128v-128h128zM2048 128v640h-128v128h-384v-384h128v-384h-384v128h-384v-128h128v-128h896v128h128z" /> +<glyph unicode="" d="M1024 288v-416h-928q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1344q40 0 68 -28t28 -68v-928h-416q-40 0 -68 -28t-28 -68zM1152 256h381q-15 -82 -65 -132l-184 -184q-50 -50 -132 -65v381z" /> +<glyph unicode="" d="M1400 256h-248v-248q29 10 41 22l185 185q12 12 22 41zM1120 384h288v896h-1280v-1280h896v288q0 40 28 68t68 28zM1536 1312v-1024q0 -40 -20 -88t-48 -76l-184 -184q-28 -28 -76 -48t-88 -20h-1024q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1344q40 0 68 -28t28 -68 z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1951 538q0 -26 -15.5 -44.5t-38.5 -23.5q-8 -2 -18 -2h-153v140h153q10 0 18 -2q23 -5 38.5 -23.5t15.5 -44.5zM1933 751q0 -25 -15 -42t-38 -21q-3 -1 -15 -1h-139v129h139q3 0 8.5 -0.5t6.5 -0.5q23 -4 38 -21.5t15 -42.5zM728 587v308h-228v-308q0 -58 -38 -94.5 t-105 -36.5q-108 0 -229 59v-112q53 -15 121 -23t109 -9l42 -1q328 0 328 217zM1442 403v113q-99 -52 -200 -59q-108 -8 -169 41t-61 142t61 142t169 41q101 -7 200 -58v112q-48 12 -100 19.5t-80 9.5l-28 2q-127 6 -218.5 -14t-140.5 -60t-71 -88t-22 -106t22 -106t71 -88 t140.5 -60t218.5 -14q101 4 208 31zM2176 518q0 54 -43 88.5t-109 39.5v3q57 8 89 41.5t32 79.5q0 55 -41 88t-107 36q-3 0 -12 0.5t-14 0.5h-455v-510h491q74 0 121.5 36.5t47.5 96.5zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90 t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M858 295v693q-106 -41 -172 -135.5t-66 -211.5t66 -211.5t172 -134.5zM1362 641q0 117 -66 211.5t-172 135.5v-694q106 41 172 135.5t66 211.5zM1577 641q0 -159 -78.5 -294t-213.5 -213.5t-294 -78.5q-119 0 -227.5 46.5t-187 125t-125 187t-46.5 227.5q0 159 78.5 294 t213.5 213.5t294 78.5t294 -78.5t213.5 -213.5t78.5 -294zM1960 634q0 139 -55.5 261.5t-147.5 205.5t-213.5 131t-252.5 48h-301q-176 0 -323.5 -81t-235 -230t-87.5 -335q0 -171 87 -317.5t236 -231.5t323 -85h301q129 0 251.5 50.5t214.5 135t147.5 202.5t55.5 246z M2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 -96v1088q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5v-1088q0 -13 9.5 -22.5t22.5 -9.5h1088q13 0 22.5 9.5t9.5 22.5zM1792 992v-1088q0 -66 -47 -113t-113 -47h-1088q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1088q66 0 113 -47t47 -113 zM1408 1376v-160h-128v160q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5v-1088q0 -13 9.5 -22.5t22.5 -9.5h160v-128h-160q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1088q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1728 1088l-384 -704h768zM448 1088l-384 -704h768zM1269 1280q-14 -40 -45.5 -71.5t-71.5 -45.5v-1291h608q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1344q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h608v1291q-40 14 -71.5 45.5t-45.5 71.5h-491q-14 0 -23 9t-9 23v64 q0 14 9 23t23 9h491q21 57 70 92.5t111 35.5t111 -35.5t70 -92.5h491q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-491zM1088 1264q33 0 56.5 23.5t23.5 56.5t-23.5 56.5t-56.5 23.5t-56.5 -23.5t-23.5 -56.5t23.5 -56.5t56.5 -23.5zM2176 384q0 -73 -46.5 -131t-117.5 -91 t-144.5 -49.5t-139.5 -16.5t-139.5 16.5t-144.5 49.5t-117.5 91t-46.5 131q0 11 35 81t92 174.5t107 195.5t102 184t56 100q18 33 56 33t56 -33q4 -7 56 -100t102 -184t107 -195.5t92 -174.5t35 -81zM896 384q0 -73 -46.5 -131t-117.5 -91t-144.5 -49.5t-139.5 -16.5 t-139.5 16.5t-144.5 49.5t-117.5 91t-46.5 131q0 11 35 81t92 174.5t107 195.5t102 184t56 100q18 33 56 33t56 -33q4 -7 56 -100t102 -184t107 -195.5t92 -174.5t35 -81z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM874 700q77 29 149 92.5t129.5 152.5t92.5 210t35 253h-1024q0 -132 35 -253t92.5 -210t129.5 -152.5t149 -92.5q19 -7 30.5 -23.5t11.5 -36.5t-11.5 -36.5t-30.5 -23.5q-77 -29 -149 -92.5 t-129.5 -152.5t-92.5 -210t-35 -253h1024q0 132 -35 253t-92.5 210t-129.5 152.5t-149 92.5q-19 7 -30.5 23.5t-11.5 36.5t11.5 36.5t30.5 23.5z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM1280 1408h-1024q0 -66 9 -128h1006q9 61 9 128zM1280 -128q0 130 -34 249.5t-90.5 208t-126.5 152t-146 94.5h-230q-76 -31 -146 -94.5t-126.5 -152t-90.5 -208t-34 -249.5h1024z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM1280 1408h-1024q0 -206 85 -384h854q85 178 85 384zM1223 192q-54 141 -145.5 241.5t-194.5 142.5h-230q-103 -42 -194.5 -142.5t-145.5 -241.5h910z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM874 700q77 29 149 92.5t129.5 152.5t92.5 210t35 253h-1024q0 -132 35 -253t92.5 -210t129.5 -152.5t149 -92.5q19 -7 30.5 -23.5t11.5 -36.5t-11.5 -36.5t-30.5 -23.5q-137 -51 -244 -196 h700q-107 145 -244 196q-19 7 -30.5 23.5t-11.5 36.5t11.5 36.5t30.5 23.5z" /> +<glyph unicode="" d="M1504 -64q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v128q0 14 9 23t23 9h1472zM130 0q3 55 16 107t30 95t46 87t53.5 76t64.5 69.5t66 60t70.5 55t66.5 47.5t65 43q-43 28 -65 43t-66.5 47.5t-70.5 55t-66 60t-64.5 69.5t-53.5 76t-46 87 t-30 95t-16 107h1276q-3 -55 -16 -107t-30 -95t-46 -87t-53.5 -76t-64.5 -69.5t-66 -60t-70.5 -55t-66.5 -47.5t-65 -43q43 -28 65 -43t66.5 -47.5t70.5 -55t66 -60t64.5 -69.5t53.5 -76t46 -87t30 -95t16 -107h-1276zM1504 1536q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9 h-1472q-14 0 -23 9t-9 23v128q0 14 9 23t23 9h1472z" /> +<glyph unicode="" d="M768 1152q-53 0 -90.5 -37.5t-37.5 -90.5v-128h-32v93q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-429l-32 30v172q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-224q0 -47 35 -82l310 -296q39 -39 39 -102q0 -26 19 -45t45 -19h640q26 0 45 19t19 45v25 q0 41 10 77l108 436q10 36 10 77v246q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-32h-32v125q0 40 -25 72.5t-64 40.5q-14 2 -23 2q-46 0 -79 -33t-33 -79v-128h-32v122q0 51 -32.5 89.5t-82.5 43.5q-5 1 -13 1zM768 1280q84 0 149 -50q57 34 123 34q59 0 111 -27 t86 -76q27 7 59 7q100 0 170 -71.5t70 -171.5v-246q0 -51 -13 -108l-109 -436q-6 -24 -6 -71q0 -80 -56 -136t-136 -56h-640q-84 0 -138 58.5t-54 142.5l-308 296q-76 73 -76 175v224q0 99 70.5 169.5t169.5 70.5q11 0 16 -1q6 95 75.5 160t164.5 65q52 0 98 -21 q72 69 174 69z" /> +<glyph unicode="" horiz-adv-x="1792" d="M880 1408q-46 0 -79 -33t-33 -79v-656h-32v528q0 46 -33 79t-79 33t-79 -33t-33 -79v-528v-256l-154 205q-38 51 -102 51q-53 0 -90.5 -37.5t-37.5 -90.5q0 -43 26 -77l384 -512q38 -51 102 -51h688q34 0 61 22t34 56l76 405q5 32 5 59v498q0 46 -33 79t-79 33t-79 -33 t-33 -79v-272h-32v528q0 46 -33 79t-79 33t-79 -33t-33 -79v-528h-32v656q0 46 -33 79t-79 33zM880 1536q68 0 125.5 -35.5t88.5 -96.5q19 4 42 4q99 0 169.5 -70.5t70.5 -169.5v-17q105 6 180.5 -64t75.5 -175v-498q0 -40 -8 -83l-76 -404q-14 -79 -76.5 -131t-143.5 -52 h-688q-60 0 -114.5 27.5t-90.5 74.5l-384 512q-51 68 -51 154q0 106 75 181t181 75q78 0 128 -34v434q0 99 70.5 169.5t169.5 70.5q23 0 42 -4q31 61 88.5 96.5t125.5 35.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1073 -128h-177q-163 0 -226 141q-23 49 -23 102v5q-62 30 -98.5 88.5t-36.5 127.5q0 38 5 48h-261q-106 0 -181 75t-75 181t75 181t181 75h113l-44 17q-74 28 -119.5 93.5t-45.5 145.5q0 106 75 181t181 75q46 0 91 -17l628 -239h401q106 0 181 -75t75 -181v-668 q0 -88 -54 -157.5t-140 -90.5l-339 -85q-92 -23 -186 -23zM1024 583l-155 -71l-163 -74q-30 -14 -48 -41.5t-18 -60.5q0 -46 33 -79t79 -33q26 0 46 10l338 154q-49 10 -80.5 50t-31.5 90v55zM1344 272q0 46 -33 79t-79 33q-26 0 -46 -10l-290 -132q-28 -13 -37 -17 t-30.5 -17t-29.5 -23.5t-16 -29t-8 -40.5q0 -50 31.5 -82t81.5 -32q20 0 38 9l352 160q30 14 48 41.5t18 60.5zM1112 1024l-650 248q-24 8 -46 8q-53 0 -90.5 -37.5t-37.5 -90.5q0 -40 22.5 -73t59.5 -47l526 -200v-64h-640q-53 0 -90.5 -37.5t-37.5 -90.5t37.5 -90.5 t90.5 -37.5h535l233 106v198q0 63 46 106l111 102h-69zM1073 0q82 0 155 19l339 85q43 11 70 45.5t27 78.5v668q0 53 -37.5 90.5t-90.5 37.5h-308l-136 -126q-36 -33 -36 -82v-296q0 -46 33 -77t79 -31t79 35t33 81v208h32v-208q0 -70 -57 -114q52 -8 86.5 -48.5t34.5 -93.5 q0 -42 -23 -78t-61 -53l-310 -141h91z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1151 1536q61 0 116 -28t91 -77l572 -781q118 -159 118 -359v-355q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v177l-286 143h-546q-80 0 -136 56t-56 136v32q0 119 84.5 203.5t203.5 84.5h420l42 128h-686q-100 0 -173.5 67.5t-81.5 166.5q-65 79 -65 182v32 q0 80 56 136t136 56h959zM1920 -64v355q0 157 -93 284l-573 781q-39 52 -103 52h-959q-26 0 -45 -19t-19 -45q0 -32 1.5 -49.5t9.5 -40.5t25 -43q10 31 35.5 50t56.5 19h832v-32h-832q-26 0 -45 -19t-19 -45q0 -44 3 -58q8 -44 44 -73t81 -29h640h91q40 0 68 -28t28 -68 q0 -15 -5 -30l-64 -192q-10 -29 -35 -47.5t-56 -18.5h-443q-66 0 -113 -47t-47 -113v-32q0 -26 19 -45t45 -19h561q16 0 29 -7l317 -158q24 -13 38.5 -36t14.5 -50v-197q0 -26 19 -45t45 -19h384q26 0 45 19t19 45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M816 1408q-48 0 -79.5 -34t-31.5 -82q0 -14 3 -28l150 -624h-26l-116 482q-9 38 -39.5 62t-69.5 24q-47 0 -79 -34t-32 -81q0 -11 4 -29q3 -13 39 -161t68 -282t32 -138v-227l-307 230q-34 26 -77 26q-52 0 -89.5 -36.5t-37.5 -88.5q0 -67 56 -110l507 -379 q34 -26 76 -26h694q33 0 59 20.5t34 52.5l100 401q8 30 10 88t9 86l116 478q3 12 3 26q0 46 -33 79t-80 33q-38 0 -69 -25.5t-40 -62.5l-99 -408h-26l132 547q3 14 3 28q0 47 -32 80t-80 33q-38 0 -68.5 -24t-39.5 -62l-145 -602h-127l-164 682q-9 38 -39.5 62t-68.5 24z M1461 -256h-694q-85 0 -153 51l-507 380q-50 38 -78.5 94t-28.5 118q0 105 75 179t180 74q25 0 49.5 -5.5t41.5 -11t41 -20.5t35 -23t38.5 -29.5t37.5 -28.5l-123 512q-7 35 -7 59q0 93 60 162t152 79q14 87 80.5 144.5t155.5 57.5q83 0 148 -51.5t85 -132.5l103 -428 l83 348q20 81 85 132.5t148 51.5q87 0 152.5 -54t82.5 -139q93 -10 155 -78t62 -161q0 -30 -7 -57l-116 -477q-5 -22 -5 -67q0 -51 -13 -108l-101 -401q-19 -75 -79.5 -122.5t-137.5 -47.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1408q-53 0 -90.5 -37.5t-37.5 -90.5v-512v-384l-151 202q-41 54 -107 54q-52 0 -89 -38t-37 -90q0 -43 26 -77l384 -512q38 -51 102 -51h718q22 0 39.5 13.5t22.5 34.5l92 368q24 96 24 194v217q0 41 -28 71t-68 30t-68 -28t-28 -68h-32v61q0 48 -32 81.5t-80 33.5 q-46 0 -79 -33t-33 -79v-64h-32v90q0 55 -37 94.5t-91 39.5q-53 0 -90.5 -37.5t-37.5 -90.5v-96h-32v570q0 55 -37 94.5t-91 39.5zM640 1536q107 0 181.5 -77.5t74.5 -184.5v-220q22 2 32 2q99 0 173 -69q47 21 99 21q113 0 184 -87q27 7 56 7q94 0 159 -67.5t65 -161.5 v-217q0 -116 -28 -225l-92 -368q-16 -64 -68 -104.5t-118 -40.5h-718q-60 0 -114.5 27.5t-90.5 74.5l-384 512q-51 68 -51 154q0 105 74.5 180.5t179.5 75.5q71 0 130 -35v547q0 106 75 181t181 75zM768 128v384h-32v-384h32zM1024 128v384h-32v-384h32zM1280 128v384h-32 v-384h32z" /> +<glyph unicode="" d="M1288 889q60 0 107 -23q141 -63 141 -226v-177q0 -94 -23 -186l-85 -339q-21 -86 -90.5 -140t-157.5 -54h-668q-106 0 -181 75t-75 181v401l-239 628q-17 45 -17 91q0 106 75 181t181 75q80 0 145.5 -45.5t93.5 -119.5l17 -44v113q0 106 75 181t181 75t181 -75t75 -181 v-261q27 5 48 5q69 0 127.5 -36.5t88.5 -98.5zM1072 896q-33 0 -60.5 -18t-41.5 -48l-74 -163l-71 -155h55q50 0 90 -31.5t50 -80.5l154 338q10 20 10 46q0 46 -33 79t-79 33zM1293 761q-22 0 -40.5 -8t-29 -16t-23.5 -29.5t-17 -30.5t-17 -37l-132 -290q-10 -20 -10 -46 q0 -46 33 -79t79 -33q33 0 60.5 18t41.5 48l160 352q9 18 9 38q0 50 -32 81.5t-82 31.5zM128 1120q0 -22 8 -46l248 -650v-69l102 111q43 46 106 46h198l106 233v535q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5v-640h-64l-200 526q-14 37 -47 59.5t-73 22.5 q-53 0 -90.5 -37.5t-37.5 -90.5zM1180 -128q44 0 78.5 27t45.5 70l85 339q19 73 19 155v91l-141 -310q-17 -38 -53 -61t-78 -23q-53 0 -93.5 34.5t-48.5 86.5q-44 -57 -114 -57h-208v32h208q46 0 81 33t35 79t-31 79t-77 33h-296q-49 0 -82 -36l-126 -136v-308 q0 -53 37.5 -90.5t90.5 -37.5h668z" /> +<glyph unicode="" horiz-adv-x="1973" d="M857 992v-117q0 -13 -9.5 -22t-22.5 -9h-298v-812q0 -13 -9 -22.5t-22 -9.5h-135q-13 0 -22.5 9t-9.5 23v812h-297q-13 0 -22.5 9t-9.5 22v117q0 14 9 23t23 9h793q13 0 22.5 -9.5t9.5 -22.5zM1895 995l77 -961q1 -13 -8 -24q-10 -10 -23 -10h-134q-12 0 -21 8.5 t-10 20.5l-46 588l-189 -425q-8 -19 -29 -19h-120q-20 0 -29 19l-188 427l-45 -590q-1 -12 -10 -20.5t-21 -8.5h-135q-13 0 -23 10q-9 10 -9 24l78 961q1 12 10 20.5t21 8.5h142q20 0 29 -19l220 -520q10 -24 20 -51q3 7 9.5 24.5t10.5 26.5l221 520q9 19 29 19h141 q13 0 22 -8.5t10 -20.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1042 833q0 88 -60 121q-33 18 -117 18h-123v-281h162q66 0 102 37t36 105zM1094 548l205 -373q8 -17 -1 -31q-8 -16 -27 -16h-152q-20 0 -28 17l-194 365h-155v-350q0 -14 -9 -23t-23 -9h-134q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h294q128 0 190 -24q85 -31 134 -109 t49 -180q0 -92 -42.5 -165.5t-115.5 -109.5q6 -10 9 -16zM896 1376q-150 0 -286 -58.5t-234.5 -157t-157 -234.5t-58.5 -286t58.5 -286t157 -234.5t234.5 -157t286 -58.5t286 58.5t234.5 157t157 234.5t58.5 286t-58.5 286t-157 234.5t-234.5 157t-286 58.5zM1792 640 q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M605 303q153 0 257 104q14 18 3 36l-45 82q-6 13 -24 17q-16 2 -27 -11l-4 -3q-4 -4 -11.5 -10t-17.5 -13t-23.5 -14.5t-28.5 -13.5t-33.5 -9.5t-37.5 -3.5q-76 0 -125 50t-49 127q0 76 48 125.5t122 49.5q37 0 71.5 -14t50.5 -28l16 -14q11 -11 26 -10q16 2 24 14l53 78 q13 20 -2 39q-3 4 -11 12t-30 23.5t-48.5 28t-67.5 22.5t-86 10q-148 0 -246 -96.5t-98 -240.5q0 -146 97 -241.5t247 -95.5zM1235 303q153 0 257 104q14 18 4 36l-45 82q-8 14 -25 17q-16 2 -27 -11l-4 -3q-4 -4 -11.5 -10t-17.5 -13t-23.5 -14.5t-28.5 -13.5t-33.5 -9.5 t-37.5 -3.5q-76 0 -125 50t-49 127q0 76 48 125.5t122 49.5q37 0 71.5 -14t50.5 -28l16 -14q11 -11 26 -10q16 2 24 14l53 78q13 20 -2 39q-3 4 -11 12t-30 23.5t-48.5 28t-67.5 22.5t-86 10q-147 0 -245.5 -96.5t-98.5 -240.5q0 -146 97 -241.5t247 -95.5zM896 1376 q-150 0 -286 -58.5t-234.5 -157t-157 -234.5t-58.5 -286t58.5 -286t157 -234.5t234.5 -157t286 -58.5t286 58.5t234.5 157t157 234.5t58.5 286t-58.5 286t-157 234.5t-234.5 157t-286 58.5zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191 t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71z" /> +<glyph unicode="" horiz-adv-x="2048" d="M736 736l384 -384l-384 -384l-672 672l672 672l168 -168l-96 -96l-72 72l-480 -480l480 -480l193 193l-289 287zM1312 1312l672 -672l-672 -672l-168 168l96 96l72 -72l480 480l-480 480l-193 -193l289 -287l-96 -96l-384 384z" /> +<glyph unicode="" horiz-adv-x="1792" d="M717 182l271 271l-279 279l-88 -88l192 -191l-96 -96l-279 279l279 279l40 -40l87 87l-127 128l-454 -454zM1075 190l454 454l-454 454l-271 -271l279 -279l88 88l-192 191l96 96l279 -279l-279 -279l-40 40l-87 -88zM1792 640q0 -182 -71 -348t-191 -286t-286 -191 t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="2304" d="M651 539q0 -39 -27.5 -66.5t-65.5 -27.5q-39 0 -66.5 27.5t-27.5 66.5q0 38 27.5 65.5t66.5 27.5q38 0 65.5 -27.5t27.5 -65.5zM1805 540q0 -39 -27.5 -66.5t-66.5 -27.5t-66.5 27.5t-27.5 66.5t27.5 66t66.5 27t66.5 -27t27.5 -66zM765 539q0 79 -56.5 136t-136.5 57 t-136.5 -56.5t-56.5 -136.5t56.5 -136.5t136.5 -56.5t136.5 56.5t56.5 136.5zM1918 540q0 80 -56.5 136.5t-136.5 56.5q-79 0 -136 -56.5t-57 -136.5t56.5 -136.5t136.5 -56.5t136.5 56.5t56.5 136.5zM850 539q0 -116 -81.5 -197.5t-196.5 -81.5q-116 0 -197.5 82t-81.5 197 t82 196.5t197 81.5t196.5 -81.5t81.5 -196.5zM2004 540q0 -115 -81.5 -196.5t-197.5 -81.5q-115 0 -196.5 81.5t-81.5 196.5t81.5 196.5t196.5 81.5q116 0 197.5 -81.5t81.5 -196.5zM1040 537q0 191 -135.5 326.5t-326.5 135.5q-125 0 -231 -62t-168 -168.5t-62 -231.5 t62 -231.5t168 -168.5t231 -62q191 0 326.5 135.5t135.5 326.5zM1708 1110q-254 111 -556 111q-319 0 -573 -110q117 0 223 -45.5t182.5 -122.5t122 -183t45.5 -223q0 115 43.5 219.5t118 180.5t177.5 123t217 50zM2187 537q0 191 -135 326.5t-326 135.5t-326.5 -135.5 t-135.5 -326.5t135.5 -326.5t326.5 -135.5t326 135.5t135 326.5zM1921 1103h383q-44 -51 -75 -114.5t-40 -114.5q110 -151 110 -337q0 -156 -77 -288t-209 -208.5t-287 -76.5q-133 0 -249 56t-196 155q-47 -56 -129 -179q-11 22 -53.5 82.5t-74.5 97.5 q-80 -99 -196.5 -155.5t-249.5 -56.5q-155 0 -287 76.5t-209 208.5t-77 288q0 186 110 337q-9 51 -40 114.5t-75 114.5h365q149 100 355 156.5t432 56.5q224 0 421 -56t348 -157z" /> +<glyph unicode="" horiz-adv-x="1280" d="M640 629q-188 0 -321 133t-133 320q0 188 133 321t321 133t321 -133t133 -321q0 -187 -133 -320t-321 -133zM640 1306q-92 0 -157.5 -65.5t-65.5 -158.5q0 -92 65.5 -157.5t157.5 -65.5t157.5 65.5t65.5 157.5q0 93 -65.5 158.5t-157.5 65.5zM1163 574q13 -27 15 -49.5 t-4.5 -40.5t-26.5 -38.5t-42.5 -37t-61.5 -41.5q-115 -73 -315 -94l73 -72l267 -267q30 -31 30 -74t-30 -73l-12 -13q-31 -30 -74 -30t-74 30q-67 68 -267 268l-267 -268q-31 -30 -74 -30t-73 30l-12 13q-31 30 -31 73t31 74l267 267l72 72q-203 21 -317 94 q-39 25 -61.5 41.5t-42.5 37t-26.5 38.5t-4.5 40.5t15 49.5q10 20 28 35t42 22t56 -2t65 -35q5 -4 15 -11t43 -24.5t69 -30.5t92 -24t113 -11q91 0 174 25.5t120 50.5l38 25q33 26 65 35t56 2t42 -22t28 -35z" /> +<glyph unicode="" d="M927 956q0 -66 -46.5 -112.5t-112.5 -46.5t-112.5 46.5t-46.5 112.5t46.5 112.5t112.5 46.5t112.5 -46.5t46.5 -112.5zM1141 593q-10 20 -28 32t-47.5 9.5t-60.5 -27.5q-10 -8 -29 -20t-81 -32t-127 -20t-124 18t-86 36l-27 18q-31 25 -60.5 27.5t-47.5 -9.5t-28 -32 q-22 -45 -2 -74.5t87 -73.5q83 -53 226 -67l-51 -52q-142 -142 -191 -190q-22 -22 -22 -52.5t22 -52.5l9 -9q22 -22 52.5 -22t52.5 22l191 191q114 -115 191 -191q22 -22 52.5 -22t52.5 22l9 9q22 22 22 52.5t-22 52.5l-191 190l-52 52q141 14 225 67q67 44 87 73.5t-2 74.5 zM1092 956q0 134 -95 229t-229 95t-229 -95t-95 -229t95 -229t229 -95t229 95t95 229zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1720" d="M1565 1408q65 0 110 -45.5t45 -110.5v-519q0 -176 -68 -336t-182.5 -275t-274 -182.5t-334.5 -67.5q-176 0 -335.5 67.5t-274.5 182.5t-183 275t-68 336v519q0 64 46 110t110 46h1409zM861 344q47 0 82 33l404 388q37 35 37 85q0 49 -34.5 83.5t-83.5 34.5q-47 0 -82 -33 l-323 -310l-323 310q-35 33 -81 33q-49 0 -83.5 -34.5t-34.5 -83.5q0 -51 36 -85l405 -388q33 -33 81 -33z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1494 -103l-295 695q-25 -49 -158.5 -305.5t-198.5 -389.5q-1 -1 -27.5 -0.5t-26.5 1.5q-82 193 -255.5 587t-259.5 596q-21 50 -66.5 107.5t-103.5 100.5t-102 43q0 5 -0.5 24t-0.5 27h583v-50q-39 -2 -79.5 -16t-66.5 -43t-10 -64q26 -59 216.5 -499t235.5 -540 q31 61 140 266.5t131 247.5q-19 39 -126 281t-136 295q-38 69 -201 71v50l513 -1v-47q-60 -2 -93.5 -25t-12.5 -69q33 -70 87 -189.5t86 -187.5q110 214 173 363q24 55 -10 79.5t-129 26.5q1 7 1 25v24q64 0 170.5 0.5t180 1t92.5 0.5v-49q-62 -2 -119 -33t-90 -81 l-213 -442q13 -33 127.5 -290t121.5 -274l441 1017q-14 38 -49.5 62.5t-65 31.5t-55.5 8v50l460 -4l1 -2l-1 -44q-139 -4 -201 -145q-526 -1216 -559 -1291h-49z" /> +<glyph unicode="" horiz-adv-x="1792" d="M949 643q0 -26 -16.5 -45t-41.5 -19q-26 0 -45 16.5t-19 41.5q0 26 17 45t42 19t44 -16.5t19 -41.5zM964 585l350 581q-9 -8 -67.5 -62.5t-125.5 -116.5t-136.5 -127t-117 -110.5t-50.5 -51.5l-349 -580q7 7 67 62t126 116.5t136 127t117 111t50 50.5zM1611 640 q0 -201 -104 -371q-3 2 -17 11t-26.5 16.5t-16.5 7.5q-13 0 -13 -13q0 -10 59 -44q-74 -112 -184.5 -190.5t-241.5 -110.5l-16 67q-1 10 -15 10q-5 0 -8 -5.5t-2 -9.5l16 -68q-72 -15 -146 -15q-199 0 -372 105q1 2 13 20.5t21.5 33.5t9.5 19q0 13 -13 13q-6 0 -17 -14.5 t-22.5 -34.5t-13.5 -23q-113 75 -192 187.5t-110 244.5l69 15q10 3 10 15q0 5 -5.5 8t-10.5 2l-68 -15q-14 72 -14 139q0 206 109 379q2 -1 18.5 -12t30 -19t17.5 -8q13 0 13 12q0 6 -12.5 15.5t-32.5 21.5l-20 12q77 112 189 189t244 107l15 -67q2 -10 15 -10q5 0 8 5.5 t2 10.5l-15 66q71 13 134 13q204 0 379 -109q-39 -56 -39 -65q0 -13 12 -13q11 0 48 64q111 -75 187.5 -186t107.5 -241l-56 -12q-10 -2 -10 -16q0 -5 5.5 -8t9.5 -2l57 13q14 -72 14 -140zM1696 640q0 163 -63.5 311t-170.5 255t-255 170.5t-311 63.5t-311 -63.5 t-255 -170.5t-170.5 -255t-63.5 -311t63.5 -311t170.5 -255t255 -170.5t311 -63.5t311 63.5t255 170.5t170.5 255t63.5 311zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191 t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M893 1536q240 2 451 -120q232 -134 352 -372l-742 39q-160 9 -294 -74.5t-185 -229.5l-276 424q128 159 311 245.5t383 87.5zM146 1131l337 -663q72 -143 211 -217t293 -45l-230 -451q-212 33 -385 157.5t-272.5 316t-99.5 411.5q0 267 146 491zM1732 962 q58 -150 59.5 -310.5t-48.5 -306t-153 -272t-246 -209.5q-230 -133 -498 -119l405 623q88 131 82.5 290.5t-106.5 277.5zM896 942q125 0 213.5 -88.5t88.5 -213.5t-88.5 -213.5t-213.5 -88.5t-213.5 88.5t-88.5 213.5t88.5 213.5t213.5 88.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M903 -256q-283 0 -504.5 150.5t-329.5 398.5q-58 131 -67 301t26 332.5t111 312t179 242.5l-11 -281q11 14 68 15.5t70 -15.5q42 81 160.5 138t234.5 59q-54 -45 -119.5 -148.5t-58.5 -163.5q25 -8 62.5 -13.5t63 -7.5t68 -4t50.5 -3q15 -5 9.5 -45.5t-30.5 -75.5 q-5 -7 -16.5 -18.5t-56.5 -35.5t-101 -34l15 -189l-139 67q-18 -43 -7.5 -81.5t36 -66.5t65.5 -41.5t81 -6.5q51 9 98 34.5t83.5 45t73.5 17.5q61 -4 89.5 -33t19.5 -65q-1 -2 -2.5 -5.5t-8.5 -12.5t-18 -15.5t-31.5 -10.5t-46.5 -1q-60 -95 -144.5 -135.5t-209.5 -29.5 q74 -61 162.5 -82.5t168.5 -6t154.5 52t128 87.5t80.5 104q43 91 39 192.5t-37.5 188.5t-78.5 125q87 -38 137 -79.5t77 -112.5q15 170 -57.5 343t-209.5 284q265 -77 412 -279.5t151 -517.5q2 -127 -40.5 -255t-123.5 -238t-189 -196t-247.5 -135.5t-288.5 -49.5z" /> +<glyph unicode="" d="M768 -92q77 0 139.5 63t100.5 166t59 234.5t21 268.5t-21 268.5t-59 234.5t-100.5 166t-139.5 63t-139.5 -63t-100.5 -166t-59 -234.5t-21 -268.5t21 -268.5t59 -234.5t100.5 -166t139.5 -63zM768 -256q-184 0 -333 77t-240 203t-141 287t-50 329t50 329t141 287t240 203 t333 77q148 0 274 -50t214.5 -136t151.5 -201t92.5 -244t29.5 -265t-29.5 -265t-92.5 -244t-151.5 -201t-214.5 -136t-274 -50z" /> +<glyph unicode="" horiz-adv-x="1792" d="M716 -69q-143 35 -261.5 114t-197.5 191q-139 -300 -17 -398q26 -21 85 -24.5t127.5 9.5t141 41.5t122.5 66.5zM693 762h452q0 108 -61.5 169t-168.5 61q-103 0 -162.5 -62.5t-59.5 -167.5zM1724 1137h-34q26 102 22.5 170t-25 110t-63.5 57t-93.5 11t-115 -26.5 t-128.5 -56.5t-134 -79q129 -37 238.5 -113.5t185 -179t110 -231.5t15.5 -262h-1005q0 -60 10 -106t34 -85t69.5 -60t112.5 -21q87 0 142.5 44t72.5 122h540q-71 -230 -281.5 -377t-477.5 -147q-83 0 -159 15q-35 -40 -151 -94t-248 -78t-219 35q-78 60 -100 159t7 214 t88 242t143.5 248t173.5 226.5t177.5 183.5t156.5 112v24q-120 -37 -258.5 -137.5t-240.5 -207t-159 -195.5q4 106 34 201t80 169t118 135.5t147.5 100.5t168 65.5t180.5 29.5t185 -8q310 186 503 189h7q57 0 103 -18q80 -30 98 -132.5t-30 -248.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1792 288v960q0 13 -9.5 22.5t-22.5 9.5h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5zM1920 1248v-960q0 -66 -47 -113t-113 -47h-736v-128h352q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23 v64q0 14 9 23t23 9h352v128h-736q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1792" d="M138 1408h197q-70 -64 -126 -149q-36 -56 -59 -115t-30 -125.5t-8.5 -120t10.5 -132t21 -126t28 -136.5q4 -19 6 -28q51 -238 81 -329q57 -171 152 -275h-272q-48 0 -82 34t-34 82v1304q0 48 34 82t82 34zM1346 1408h308q48 0 82 -34t34 -82v-1304q0 -48 -34 -82t-82 -34 h-178q212 210 196 565l-469 -101q-2 -45 -12 -82t-31 -72t-59.5 -59.5t-93.5 -36.5q-123 -26 -199 40q-32 27 -53 61t-51.5 129t-64.5 258q-35 163 -45.5 263t-5.5 139t23 77q20 41 62.5 73t102.5 45q45 12 83.5 6.5t67 -17t54 -35t43 -48t34.5 -56.5l468 100 q-68 175 -180 287z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1391 390v0l-1 1q-15 18 -34.5 37.5t-62.5 57.5t-93.5 62t-95.5 24q-48 0 -83 -21.5t-51 -54t-23 -59t-7 -47.5v0v0q0 -21 7 -48t23 -59t51 -53.5t83 -21.5q45 0 95.5 24t94 62.5t62 57t34.5 37.5zM2103 390q0 21 -7 47.5t-23 59t-51 54t-83 21.5q-45 0 -95.5 -24 t-94 -62.5t-62 -57t-34.5 -37.5l-1 -1v0v0l1 -1q15 -18 34.5 -37.5t62.5 -57.5t93.5 -62t95.5 -24q48 0 83 21.5t51 53.5t23 59t7 48zM2304 393q0 -69 -24 -137.5t-68 -126t-116 -93.5t-159 -36q-68 0 -134 24t-113.5 58.5t-84.5 69.5t-59.5 59t-25.5 24t-22.5 -24 t-54.5 -58.5t-81.5 -69.5t-115 -59t-143.5 -24q-65 0 -123.5 22.5t-96.5 54t-66.5 66.5t-41 59.5t-12.5 32.5q0 -8 -8.5 -26.5t-25 -45.5t-47 -55t-69 -52.5t-96.5 -40t-125 -15.5q-71 0 -130 15.5t-98.5 39.5t-70.5 56.5t-48 63.5t-27.5 63.5t-14 54t-3.5 36.5h217 q0 -55 49 -107.5t126 -52.5q79 0 134.5 67t55.5 148q0 80 -52 136.5t-138 56.5q-5 0 -13 -0.5t-31 -5t-43 -12t-42 -24.5t-34 -40h-195l102 583h602v-174h-445q-27 -159 -41 -248q4 0 16.5 13t31.5 28.5t65 28.5t108 13t114 -20.5t82.5 -49.5t51.5 -58.5t31 -50t11 -20.5 t13 25t36.5 60.5t60.5 71.5t97 61t133 25t140.5 -25t115.5 -60.5t83.5 -71.5t56.5 -61t21 -25q2 0 22 25t56 60.5t83.5 71.5t115.5 61t140 25q92 0 164.5 -35t115.5 -93t65 -125t22 -137z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1551 60q15 6 26 3t11 -17.5t-15 -33.5q-13 -16 -44 -43.5t-95.5 -68t-141 -74t-188 -58t-229.5 -24.5q-119 0 -238 31t-209 76.5t-172.5 104t-132.5 105t-84 87.5q-8 9 -10 16.5t1 12t8 7t11.5 2t11.5 -4.5q192 -117 300 -166q389 -176 799 -90q190 40 391 135z M1758 175q11 -16 2.5 -69.5t-28.5 -102.5q-34 -83 -85 -124q-17 -14 -26 -9t0 24q21 45 44.5 121.5t6.5 98.5q-5 7 -15.5 11.5t-27 6t-29.5 2.5t-35 0t-31.5 -2t-31 -3t-22.5 -2q-6 -1 -13 -1.5t-11 -1t-8.5 -1t-7 -0.5h-5.5h-4.5t-3 0.5t-2 1.5l-1.5 3q-6 16 47 40t103 30 q46 7 108 1t76 -24zM1364 618q0 -31 13.5 -64t32 -58t37.5 -46t33 -32l13 -11l-227 -224q-40 37 -79 75.5t-58 58.5l-19 20q-11 11 -25 33q-38 -59 -97.5 -102.5t-127.5 -63.5t-140 -23t-137.5 21t-117.5 65.5t-83 113t-31 162.5q0 84 28 154t72 116.5t106.5 83t122.5 57 t130 34.5t119.5 18.5t99.5 6.5v127q0 65 -21 97q-34 53 -121 53q-6 0 -16.5 -1t-40.5 -12t-56 -29.5t-56 -59.5t-48 -96l-294 27q0 60 22 119t67 113t108 95t151.5 65.5t190.5 24.5q100 0 181 -25t129.5 -61.5t81 -83t45 -86t12.5 -73.5v-589zM692 597q0 -86 70 -133 q66 -44 139 -22q84 25 114 123q14 45 14 101v162q-59 -2 -111 -12t-106.5 -33.5t-87 -71t-32.5 -114.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1536 1280q52 0 90 -38t38 -90v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128zM1152 1376v-288q0 -14 9 -23t23 -9 h64q14 0 23 9t9 23v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM384 1376v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM1536 -128v1024h-1408v-1024h1408zM896 448h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224 v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v224q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-224z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1152 416v-64q0 -14 -9 -23t-23 -9h-576q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h576q14 0 23 -9t9 -23zM128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23 t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47 t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1111 151l-46 -46q-9 -9 -22 -9t-23 9l-188 189l-188 -189q-10 -9 -23 -9t-22 9l-46 46q-9 9 -9 22t9 23l189 188l-189 188q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l188 -188l188 188q10 9 23 9t22 -9l46 -46q9 -9 9 -22t-9 -23l-188 -188l188 -188q9 -10 9 -23t-9 -22z M128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280 q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1303 572l-512 -512q-10 -9 -23 -9t-23 9l-288 288q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l220 -220l444 444q10 9 23 9t22 -9l46 -46q9 -9 9 -22t-9 -23zM128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23 t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47 t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M448 1536q26 0 45 -19t19 -45v-891l536 429q17 14 40 14q26 0 45 -19t19 -45v-379l536 429q17 14 40 14q26 0 45 -19t19 -45v-1152q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h384z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 448q66 0 128 15v-655q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v655q61 -15 128 -15zM512 1536q212 0 362 -150t150 -362t-150 -362t-362 -150t-362 150t-150 362t150 362t362 150zM512 1312q14 0 23 9t9 23t-9 23t-23 9q-146 0 -249 -103t-103 -249 q0 -14 9 -23t23 -9t23 9t9 23q0 119 84.5 203.5t203.5 84.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1745 1239q10 -10 10 -23t-10 -23l-141 -141q-28 -28 -68 -28h-1344q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h576v64q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-64h512q40 0 68 -28zM768 320h256v-512q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v512zM1600 768 q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-1344q-40 0 -68 28l-141 141q-10 10 -10 23t10 23l141 141q28 28 68 28h512v192h256v-192h576z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2020 1525q28 -20 28 -53v-1408q0 -20 -11 -36t-29 -23l-640 -256q-24 -11 -48 0l-616 246l-616 -246q-10 -5 -24 -5q-19 0 -36 11q-28 20 -28 53v1408q0 20 11 36t29 23l640 256q24 11 48 0l616 -246l616 246q32 13 60 -6zM736 1390v-1270l576 -230v1270zM128 1173 v-1270l544 217v1270zM1920 107v1270l-544 -217v-1270z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 1536q13 0 22.5 -9.5t9.5 -22.5v-1472q0 -20 -17 -28l-480 -256q-7 -4 -15 -4q-13 0 -22.5 9.5t-9.5 22.5v1472q0 20 17 28l480 256q7 4 15 4zM1760 1536q13 0 22.5 -9.5t9.5 -22.5v-1472q0 -20 -17 -28l-480 -256q-7 -4 -15 -4q-13 0 -22.5 9.5t-9.5 22.5v1472 q0 20 17 28l480 256q7 4 15 4zM640 1536q8 0 14 -3l512 -256q18 -10 18 -29v-1472q0 -13 -9.5 -22.5t-22.5 -9.5q-8 0 -14 3l-512 256q-18 10 -18 29v1472q0 13 9.5 22.5t22.5 9.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1408 640q0 53 -37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-110 0 -211 18q-173 -173 -435 -229q-52 -10 -86 -13q-12 -1 -22 6t-13 18q-4 15 20 37q5 5 23.5 21.5t25.5 23.5t23.5 25.5t24 31.5t20.5 37 t20 48t14.5 57.5t12.5 72.5q-146 90 -229.5 216.5t-83.5 269.5q0 174 120 321.5t326 233t450 85.5t450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1024 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 -53 -37.5 -90.5t-90.5 -37.5 t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM896 1152q-204 0 -381.5 -69.5t-282 -187.5t-104.5 -255q0 -112 71.5 -213.5t201.5 -175.5l87 -50l-27 -96q-24 -91 -70 -172q152 63 275 171l43 38l57 -6q69 -8 130 -8q204 0 381.5 69.5t282 187.5 t104.5 255t-104.5 255t-282 187.5t-381.5 69.5zM1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22h-5q-15 0 -27 10.5t-16 27.5v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51 t27 59t26 76q-157 89 -247.5 220t-90.5 281q0 130 71 248.5t191 204.5t286 136.5t348 50.5t348 -50.5t286 -136.5t191 -204.5t71 -248.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 345l512 295v-591l-512 -296v592zM0 640v-591l512 296zM512 1527v-591l-512 -296v591zM512 936l512 295v-591z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1709 1018q-10 -236 -332 -651q-333 -431 -562 -431q-142 0 -240 263q-44 160 -132 482q-72 262 -157 262q-18 0 -127 -76l-77 98q24 21 108 96.5t130 115.5q156 138 241 146q95 9 153 -55.5t81 -203.5q44 -287 66 -373q55 -249 120 -249q51 0 154 161q101 161 109 246 q13 139 -109 139q-57 0 -121 -26q120 393 459 382q251 -8 236 -326z" /> +<glyph unicode="" d="M0 1408h1536v-1536h-1536v1536zM1085 293l-221 631l221 297h-634l221 -297l-221 -631l317 -304z" /> +<glyph unicode="" d="M0 1408h1536v-1536h-1536v1536zM908 1088l-12 -33l75 -83l-31 -114l25 -25l107 57l107 -57l25 25l-31 114l75 83l-12 33h-95l-53 96h-32l-53 -96h-95zM641 925q32 0 44.5 -16t11.5 -63l174 21q0 55 -17.5 92.5t-50.5 56t-69 25.5t-85 7q-133 0 -199 -57.5t-66 -182.5v-72 h-96v-128h76q20 0 20 -8v-382q0 -14 -5 -20t-18 -7l-73 -7v-88h448v86l-149 14q-6 1 -8.5 1.5t-3.5 2.5t-0.5 4t1 7t0.5 10v387h191l38 128h-231q-6 0 -2 6t4 9v80q0 27 1.5 40.5t7.5 28t19.5 20t36.5 5.5zM1248 96v86l-54 9q-7 1 -9.5 2.5t-2.5 3t1 7.5t1 12v520h-275 l-23 -101l83 -22q23 -7 23 -27v-370q0 -14 -6 -18.5t-20 -6.5l-70 -9v-86h352z" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +</font> +</defs></svg>
\ No newline at end of file diff --git a/phpBB/assets/fonts/fontawesome-webfont.ttf b/phpBB/assets/fonts/fontawesome-webfont.ttf Binary files differnew file mode 100644 index 0000000000..d7994e1308 --- /dev/null +++ b/phpBB/assets/fonts/fontawesome-webfont.ttf diff --git a/phpBB/assets/fonts/fontawesome-webfont.woff b/phpBB/assets/fonts/fontawesome-webfont.woff Binary files differnew file mode 100644 index 0000000000..6fd4ede0f3 --- /dev/null +++ b/phpBB/assets/fonts/fontawesome-webfont.woff diff --git a/phpBB/assets/fonts/fontawesome-webfont.woff2 b/phpBB/assets/fonts/fontawesome-webfont.woff2 Binary files differnew file mode 100644 index 0000000000..5560193ccc --- /dev/null +++ b/phpBB/assets/fonts/fontawesome-webfont.woff2 diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 4657af90ab..91f5521c7a 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -1,39 +1,53 @@ +/* global bbfontstyle */ + var phpbb = {}; phpbb.alertTime = 100; (function($) { // Avoid conflicts with other libraries -"use strict"; +'use strict'; // define a couple constants for keydown functions. var keymap = { + TAB: 9, ENTER: 13, ESC: 27 }; -var dark = $('#darkenwrapper'); -var loadingIndicator = $('#loading_indicator'); +var $dark = $('#darkenwrapper'); +var $loadingIndicator; var phpbbAlertTimer = null; -var isTouch = (window && typeof window.ontouchstart !== 'undefined'); +phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined'); /** * Display a loading screen * - * @returns object Returns loadingIndicator. + * @returns {object} Returns loadingIndicator. */ phpbb.loadingIndicator = function() { - if (!loadingIndicator.is(':visible')) { - loadingIndicator.fadeIn(phpbb.alertTime); + if (!$loadingIndicator) { + $loadingIndicator = $('<div />', { + id: 'loading_indicator', + class: 'loading_indicator', + }); + $loadingIndicator.appendTo('#page-footer'); + } + + if (!$loadingIndicator.is(':visible')) { + $loadingIndicator.fadeIn(phpbb.alertTime); // Wait fifteen seconds and display an error if nothing has been returned by then. + phpbb.clearLoadingTimeout(); phpbbAlertTimer = setTimeout(function() { - if (loadingIndicator.is(':visible')) { - phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req')); + var $alert = $('#phpbb_alert'); + + if ($loadingIndicator.is(':visible')) { + phpbb.alert($alert.attr('data-l-err'), $alert.attr('data-l-timeout-processing-req')); } }, 15000); } - return loadingIndicator; + return $loadingIndicator; }; /** @@ -46,73 +60,100 @@ phpbb.clearLoadingTimeout = function() { } }; + +/** +* Close popup alert after a specified delay +* +* @param {int} delay Delay in ms until darkenwrapper's click event is triggered +*/ +phpbb.closeDarkenWrapper = function(delay) { + phpbbAlertTimer = setTimeout(function() { + $('#darkenwrapper').trigger('click'); + }, delay); +}; + /** * 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. + * @param {string} title Title of the message, eg "Information" (HTML). + * @param {string} msg Message to display (HTML). * - * @returns object Returns the div created. + * @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); +phpbb.alert = function(title, msg) { + var $alert = $('#phpbb_alert'); + $alert.find('.alert_title').html(title); + $alert.find('.alert_text').html(msg); - if (!dark.is(':visible')) { - dark.fadeIn(phpbb.alertTime); + $(document).on('keydown.phpbb.alert', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + phpbb.alert.close($alert, true); + e.preventDefault(); + e.stopPropagation(); + } + }); + phpbb.alert.open($alert); + + return $alert; +}; + +/** +* Handler for opening an alert box. +* +* @param {jQuery} $alert jQuery object. +*/ +phpbb.alert.open = function($alert) { + if (!$dark.is(':visible')) { + $dark.fadeIn(phpbb.alertTime); + } + + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime, function() { + $dark.append($alert); + $alert.fadeIn(phpbb.alertTime); + }); + } else if ($dark.is(':visible')) { + $dark.append($alert); + $alert.fadeIn(phpbb.alertTime); + } else { + $dark.append($alert); + $alert.show(); + $dark.fadeIn(phpbb.alertTime); } - div.bind('click', function(e) { + $alert.on('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.alertTime, function() { - div.hide(); - }); + $dark.one('click', function(e) { + phpbb.alert.close($alert, true); 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(); - } + $alert.find('.alert_close').one('click', function(e) { + phpbb.alert.close($alert, true); + e.preventDefault(); }); +}; - div.find('.alert_close').one('click', function(e) { - dark.trigger('click'); +/** +* Handler for closing an alert box. +* +* @param {jQuery} $alert jQuery object. +* @param {bool} fadedark Whether to remove dark background. +*/ +phpbb.alert.close = function($alert, fadedark) { + var $fade = (fadedark) ? $dark : $alert; - e.preventDefault(); + $fade.fadeOut(phpbb.alertTime, function() { + $alert.hide(); }); - if (loadingIndicator.is(':visible')) { - loadingIndicator.fadeOut(phpbb.alertTime, function() { - dark.append(div); - div.fadeIn(phpbb.alertTime); - }); - } else if (dark.is(':visible')) { - dark.append(div); - div.fadeIn(phpbb.alertTime); - } else { - dark.append(div); - div.show(); - dark.fadeIn(phpbb.alertTime); - } - - return div; + $alert.find('.alert_close').off('click'); + $(document).off('keydown.phpbb.alert'); }; /** @@ -120,97 +161,52 @@ phpbb.alert = function(title, msg, fadedark) { * * 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 + * @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 + * @param {bool} fadedark Remove the dark background when done? Defaults * to yes. * - * @returns object Returns the div created. + * @returns {object} Returns the div created. */ phpbb.confirm = function(msg, callback, fadedark) { - var div = $('#phpbb_confirm'); - div.find('.alert_text').html(msg); - - if (!dark.is(':visible')) { - dark.fadeIn(phpbb.alertTime); - } - - div.bind('click', function(e) { - e.stopPropagation(); - }); + var $confirmDiv = $('#phpbb_confirm'); + $confirmDiv.find('.alert_text').html(msg); + fadedark = fadedark || true; - var clickHandler = function(e) { - var res = this.name === 'confirm'; - var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark; - fade.fadeOut(phpbb.alertTime, function() { - div.hide(); - }); - div.find('input[type="button"]').unbind('click', clickHandler); - callback(res); + $(document).on('keydown.phpbb.alert', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + var name = (e.keyCode === keymap.ENTER) ? 'confirm' : 'cancel'; - if (e) { + $('input[name="' + name + '"]').trigger('click'); e.preventDefault(); e.stopPropagation(); } - }; - div.find('input[type="button"]').one('click', clickHandler); - - dark.one('click', function(e) { - div.find('.alert_close').unbind('click'); - dark.fadeOut(phpbb.alertTime, function() { - div.hide(); - }); - callback(false); - - e.preventDefault(); - e.stopPropagation(); }); - $(document).bind('keydown', function(e) { - if (e.keyCode === keymap.ENTER) { - $('input[name="confirm"]').trigger('click'); - e.preventDefault(); - e.stopPropagation(); - } else if (e.keyCode === keymap.ESC) { - $('input[name="cancel"]').trigger('click'); - e.preventDefault(); - e.stopPropagation(); - } - }); + $confirmDiv.find('input[type="button"]').one('click.phpbb.confirmbox', function(e) { + var confirmed = this.name === 'confirm'; - div.find('.alert_close').one('click', function(e) { - var fade = (typeof fadedark !== 'undefined' && fadedark) ? div : dark; - fade.fadeOut(phpbb.alertTime, function() { - div.hide(); - }); - callback(false); + if (confirmed) { + callback(true); + } + $confirmDiv.find('input[type="button"]').off('click.phpbb.confirmbox'); + phpbb.alert.close($confirmDiv, fadedark || !confirmed); e.preventDefault(); + e.stopPropagation(); }); - if (loadingIndicator.is(':visible')) { - loadingIndicator.fadeOut(phpbb.alertTime, function() { - dark.append(div); - div.fadeIn(phpbb.alertTime); - }); - } else if (dark.is(':visible')) { - dark.append(div); - div.fadeIn(phpbb.alertTime); - } else { - dark.append(div); - div.show(); - dark.fadeIn(phpbb.alertTime); - } + phpbb.alert.open($confirmDiv); - return div; + return $confirmDiv; }; /** * Turn a querystring into an array. * - * @argument string string The querystring to parse. - * @returns object The object created. + * @argument {string} string The querystring to parse. + * @returns {object} The object created. */ phpbb.parseQuerystring = function(string) { var params = {}, i, split; @@ -235,22 +231,26 @@ phpbb.parseQuerystring = function(string) { * 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. + * @param {object} options Options. */ phpbb.ajaxify = function(options) { - var elements = $(options.selector), + var $elements = $(options.selector), refresh = options.refresh, callback = options.callback, overlay = (typeof options.overlay !== 'undefined') ? options.overlay : true, - isForm = elements.is('form'), - eventName = isForm ? 'submit' : 'click'; + isForm = $elements.is('form'), + isText = $elements.is('input[type="text"], textarea'), + eventName; - elements.bind(eventName, function(event) { + if (isForm) { + eventName = 'submit'; + } else if (isText) { + eventName = 'keyup'; + } else { + eventName = 'click'; + } + + $elements.on(eventName, function(event) { var action, method, data, submit, that = this, $this = $(this); if ($this.find('input[type="submit"][data-clicked]').attr('data-ajax') === 'false') { @@ -261,20 +261,26 @@ phpbb.ajaxify = function(options) { * Handler for AJAX errors */ function errorHandler(jqXHR, textStatus, errorThrown) { - if (console && console.log) { + if (typeof console !== 'undefined' && console.log) { console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); } phpbb.clearLoadingTimeout(); - var errorText = false; - if (typeof errorThrown === 'string' && errorThrown.length > 0) { + var responseText, errorText = false; + try { + responseText = JSON.parse(jqXHR.responseText); + responseText = responseText.message; + } catch (e) {} + if (typeof responseText === 'string' && responseText.length > 0) { + errorText = responseText; + } else if (typeof errorThrown === 'string' && errorThrown.length > 0) { errorText = errorThrown; + } else { + errorText = $dark.attr('data-ajax-error-text-' + textStatus); + if (typeof errorText !== 'string' || !errorText.length) { + errorText = $dark.attr('data-ajax-error-text'); + } } - else { - errorText = dark.attr('data-ajax-error-text-' + textStatus); - if (typeof errorText !== 'string' || !errorText.length) - errorText = dark.attr('data-ajax-error-text'); - } - phpbb.alert(dark.attr('data-ajax-error-title'), errorText); + phpbb.alert($dark.attr('data-ajax-error-title'), errorText); } /** @@ -285,7 +291,7 @@ phpbb.ajaxify = function(options) { * 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. + * @param {object} res The object sent back by the server. */ function returnHandler(res) { var alert; @@ -299,7 +305,11 @@ phpbb.ajaxify = function(options) { if (typeof res.MESSAGE_TITLE !== 'undefined') { alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); } else { - dark.fadeOut(phpbb.alertTime); + $dark.fadeOut(phpbb.alertTime); + + if ($loadingIndicator) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } } if (typeof phpbb.ajaxCallbacks[callback] === 'function') { @@ -315,32 +325,36 @@ phpbb.ajaxify = function(options) { refresh = false; } - setTimeout(function() { + phpbbAlertTimer = 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.alertTime, function() { - alert.hide(); + $dark.fadeOut(phpbb.alertTime, function() { + if (typeof alert !== 'undefined') { + alert.hide(); + } }); }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds } } else { // If confirmation is required, display a dialog to the user. phpbb.confirm(res.MESSAGE_BODY, function(del) { - if (del) { - phpbb.loadingIndicator(); - data = $('<form>' + res.S_HIDDEN_FIELDS + '</form>').serialize(); - $.ajax({ - url: res.S_CONFIRM_ACTION, - type: 'POST', - data: data + '&confirm=' + res.YES_VALUE + '&' + $('#phpbb_confirm form').serialize(), - success: returnHandler, - error: errorHandler - }); + if (!del) { + return; } + + phpbb.loadingIndicator(); + data = $('<form>' + res.S_HIDDEN_FIELDS + '</form>').serialize(); + $.ajax({ + url: res.S_CONFIRM_ACTION, + type: 'POST', + data: data + '&confirm=' + res.YES_VALUE + '&' + $('form', '#phpbb_confirm').serialize(), + success: returnHandler, + error: errorHandler + }); }, false); } } @@ -348,6 +362,7 @@ phpbb.ajaxify = function(options) { // If the element is a form, POST must be used and some extra data must // be taken from the form. var runFilter = (typeof options.filter === 'function'); + data = {}; if (isForm) { action = $this.attr('action').replace('&', '&'); @@ -361,41 +376,56 @@ phpbb.ajaxify = function(options) { value: submit.val() }); } + } else if (isText) { + var name = $this.attr('data-name') || this.name; + action = $this.attr('data-url').replace('&', '&'); + data[name] = this.value; + method = 'POST'; } else { action = this.href; data = null; method = 'GET'; } + var sendRequest = function() { + var dataOverlay = $this.attr('data-overlay'); + if (overlay && (typeof dataOverlay === 'undefined' || dataOverlay === 'true')) { + phpbb.loadingIndicator(); + } + + var request = $.ajax({ + url: action, + type: method, + data: data, + success: returnHandler, + error: errorHandler, + cache: false + }); + + request.always(function() { + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + }); + }; + // If filter function returns false, cancel the AJAX functionality, // and return true (meaning that the HTTP request will be sent normally). - if (runFilter && !options.filter.call(this, data)) { + if (runFilter && !options.filter.call(this, data, event, sendRequest)) { return; } - if (overlay && (typeof $this.attr('data-overlay') === 'undefined' || $this.attr('data-overlay') === 'true')) { - phpbb.loadingIndicator(); - } - - var request = $.ajax({ - url: action, - type: method, - data: data, - success: returnHandler, - error: errorHandler - }); - request.always(function() { - loadingIndicator.fadeOut(phpbb.alertTime); - }); - + sendRequest(); event.preventDefault(); }); if (isForm) { - elements.find('input:submit').click(function () { + $elements.find('input:submit').click(function () { var $this = $(this); - $this.siblings('[data-clicked]').removeAttr('data-clicked'); + // Remove data-clicked attribute from any submit button of form + $this.parents('form:first').find('input:submit[data-clicked]').removeAttr('data-clicked'); + $this.attr('data-clicked', 'true'); }); } @@ -403,42 +433,384 @@ phpbb.ajaxify = function(options) { return this; }; +phpbb.search = { + cache: { + data: [] + }, + tpl: [], + container: [] +}; + +/** + * Get cached search data. + * + * @param {string} id Search ID. + * @returns {bool|object} Cached data object. Returns false if no data exists. + */ +phpbb.search.cache.get = function(id) { + if (this.data[id]) { + return this.data[id]; + } + return false; +}; + +/** + * Set search cache data value. + * + * @param {string} id Search ID. + * @param {string} key Data key. + * @param {string} value Data value. + */ +phpbb.search.cache.set = function(id, key, value) { + if (!this.data[id]) { + this.data[id] = { results: [] }; + } + this.data[id][key] = value; +}; + +/** + * Cache search result. + * + * @param {string} id Search ID. + * @param {string} keyword Keyword. + * @param {Array} results Search results. + */ +phpbb.search.cache.setResults = function(id, keyword, results) { + this.data[id].results[keyword] = results; +}; + +/** + * Trim spaces from keyword and lower its case. + * + * @param {string} keyword Search keyword to clean. + * @returns {string} Cleaned string. + */ +phpbb.search.cleanKeyword = function(keyword) { + return $.trim(keyword).toLowerCase(); +}; + +/** + * Get clean version of search keyword. If textarea supports several keywords + * (one per line), it fetches the current keyword based on the caret position. + * + * @param {jQuery} $input Search input|textarea. + * @param {string} keyword Input|textarea value. + * @param {bool} multiline Whether textarea supports multiple search keywords. + * + * @returns string Clean string. + */ +phpbb.search.getKeyword = function($input, keyword, multiline) { + if (multiline) { + var line = phpbb.search.getKeywordLine($input); + keyword = keyword.split('\n').splice(line, 1); + } + return phpbb.search.cleanKeyword(keyword); +}; + +/** + * Get the textarea line number on which the keyword resides - for textareas + * that support multiple keywords (one per line). + * + * @param {jQuery} $textarea Search textarea. + * @returns {int} The line number. + */ +phpbb.search.getKeywordLine = function ($textarea) { + var selectionStart = $textarea.get(0).selectionStart; + return $textarea.val().substr(0, selectionStart).split('\n').length - 1; +}; + +/** + * Set the value on the input|textarea. If textarea supports multiple + * keywords, only the active keyword is replaced. + * + * @param {jQuery} $input Search input|textarea. + * @param {string} value Value to set. + * @param {bool} multiline Whether textarea supports multiple search keywords. + */ +phpbb.search.setValue = function($input, value, multiline) { + if (multiline) { + var line = phpbb.search.getKeywordLine($input), + lines = $input.val().split('\n'); + lines[line] = value; + value = lines.join('\n'); + } + $input.val(value); +}; + +/** + * Sets the onclick event to set the value on the input|textarea to the + * selected search result. + * + * @param {jQuery} $input Search input|textarea. + * @param {object} value Result object. + * @param {jQuery} $row Result element. + * @param {jQuery} $container jQuery object for the search container. + */ +phpbb.search.setValueOnClick = function($input, value, $row, $container) { + $row.click(function() { + phpbb.search.setValue($input, value.result, $input.attr('data-multiline')); + $container.hide(); + }); +}; + +/** + * Runs before the AJAX search request is sent and determines whether + * there is a need to contact the server. If there are cached results + * already, those are displayed instead. Executes the AJAX request function + * itself due to the need to use a timeout to limit the number of requests. + * + * @param {Array} data Data to be sent to the server. + * @param {object} event Onkeyup event object. + * @param {function} sendRequest Function to execute AJAX request. + * + * @returns {bool} Returns false. + */ +phpbb.search.filter = function(data, event, sendRequest) { + var $this = $(this), + dataName = ($this.attr('data-name') !== undefined) ? $this.attr('data-name') : $this.attr('name'), + minLength = parseInt($this.attr('data-min-length'), 10), + searchID = $this.attr('data-results'), + keyword = phpbb.search.getKeyword($this, data[dataName], $this.attr('data-multiline')), + cache = phpbb.search.cache.get(searchID), + proceed = true; + data[dataName] = keyword; + + if (cache.timeout) { + clearTimeout(cache.timeout); + } + + var timeout = setTimeout(function() { + // Check min length and existence of cache. + if (minLength > keyword.length) { + proceed = false; + } else if (cache.lastSearch) { + // Has the keyword actually changed? + if (cache.lastSearch === keyword) { + proceed = false; + } else { + // Do we already have results for this? + if (cache.results[keyword]) { + var response = { + keyword: keyword, + results: cache.results[keyword] + }; + phpbb.search.handleResponse(response, $this, true); + proceed = false; + } + + // If the previous search didn't yield results and the string only had characters added to it, + // then we won't bother sending a request. + if (keyword.indexOf(cache.lastSearch) === 0 && cache.results[cache.lastSearch].length === 0) { + phpbb.search.cache.set(searchID, 'lastSearch', keyword); + phpbb.search.cache.setResults(searchID, keyword, []); + proceed = false; + } + } + } + + if (proceed) { + sendRequest.call(this); + } + }, 350); + phpbb.search.cache.set(searchID, 'timeout', timeout); + + return false; +}; + +/** + * Handle search result response. + * + * @param {object} res Data received from server. + * @param {jQuery} $input Search input|textarea. + * @param {bool} fromCache Whether the results are from the cache. + * @param {function} callback Optional callback to run when assigning each search result. + */ +phpbb.search.handleResponse = function(res, $input, fromCache, callback) { + if (typeof res !== 'object') { + return; + } + + var searchID = $input.attr('data-results'), + $container = $(searchID); + + if (this.cache.get(searchID).callback) { + callback = this.cache.get(searchID).callback; + } else if (typeof callback === 'function') { + this.cache.set(searchID, 'callback', callback); + } + + if (!fromCache) { + this.cache.setResults(searchID, res.keyword, res.results); + } + + this.cache.set(searchID, 'lastSearch', res.keyword); + this.showResults(res.results, $input, $container, callback); +}; + +/** + * Show search results. + * + * @param {Array} results Search results. + * @param {jQuery} $input Search input|textarea. + * @param {jQuery} $container Search results container element. + * @param {function} callback Optional callback to run when assigning each search result. + */ +phpbb.search.showResults = function(results, $input, $container, callback) { + var $resultContainer = $('.search-results', $container); + this.clearResults($resultContainer); + + if (!results.length) { + $container.hide(); + return; + } + + var searchID = $container.attr('id'), + tpl, + row; + + if (!this.tpl[searchID]) { + tpl = $('.search-result-tpl', $container); + this.tpl[searchID] = tpl.clone().removeClass('search-result-tpl'); + tpl.remove(); + } + tpl = this.tpl[searchID]; + + $.each(results, function(i, item) { + row = tpl.clone(); + row.find('.search-result').html(item.display); + + if (typeof callback === 'function') { + callback.call(this, $input, item, row, $container); + } + row.appendTo($resultContainer).show(); + }); + $container.show(); +}; + +/** + * Clear search results. + * + * @param {jQuery} $container Search results container. + */ +phpbb.search.clearResults = function($container) { + $container.children(':not(.search-result-tpl)').remove(); +}; + +$('#phpbb').click(function() { + var $this = $(this); + + if (!$this.is('.live-search') && !$this.parents().is('.live-search')) { + $('.live-search').hide(); + } +}); + +phpbb.history = {}; + +/** +* Check whether a method in the native history object is supported. +* +* @param {string} fn Method name. +* @returns {bool} Returns true if the method is supported. +*/ +phpbb.history.isSupported = function(fn) { + return !(typeof history === 'undefined' || typeof history[fn] === 'undefined'); +}; + +/** +* Wrapper for the pushState and replaceState methods of the +* native history object. +* +* @param {string} mode Mode. Either push or replace. +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.alterUrl = function(mode, url, title, obj) { + var fn = mode + 'State'; + + if (!url || !phpbb.history.isSupported(fn)) { + return; + } + if (!title) { + title = document.title; + } + if (!obj) { + obj = null; + } + + history[fn](obj, title, url); +}; + +/** +* Wrapper for the native history.replaceState method. +* +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.replaceUrl = function(url, title, obj) { + phpbb.history.alterUrl('replace', url, title, obj); +}; + +/** +* Wrapper for the native history.pushState method. +* +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.pushUrl = function(url, title, obj) { + phpbb.history.alterUrl('push', url, title, obj); +}; + /** * Hide the optgroups that are not the selected timezone * -* @param bool keepSelection Shall we keep the value selected, or shall the user be forced to repick one. +* @param {bool} keepSelection Shall we keep the value selected, or shall the +* user be forced to repick one. */ phpbb.timezoneSwitchDate = function(keepSelection) { - if ($('#timezone_copy').length === 0) { + var $timezoneCopy = $('#timezone_copy'); + var $timezone = $('#timezone'); + var $tzDate = $('#tz_date'); + var $tzSelectDateSuggest = $('#tz_select_date_suggest'); + + if ($timezoneCopy.length === 0) { // We make a backup of the original dropdown, so we can remove optgroups // instead of setting display to none, because IE and chrome will not // hide options inside of optgroups and selects via css - $('#timezone').clone().attr('id', 'timezone_copy').css('display', 'none').attr('name', 'tz_copy').insertAfter('#timezone'); + $timezone.clone() + .attr('id', 'timezone_copy') + .css('display', 'none') + .attr('name', 'tz_copy') + .insertAfter('#timezone'); } else { // Copy the content of our backup, so we can remove all unneeded options - $('#timezone').replaceWith($('#timezone_copy').clone().attr('id', 'timezone').css('display', 'block').attr('name', 'tz')); + $timezone.html($timezoneCopy.html()); } - if ($('#tz_date').val() !== '') { - $('#timezone > optgroup').remove(":not([label='" + $('#tz_date').val() + "'])"); + if ($tzDate.val() !== '') { + $timezone.children('optgroup').remove(':not([data-tz-value="' + $tzDate.val() + '"])'); } - if ($('#tz_date').val() === $('#tz_select_date_suggest').attr('data-suggested-tz')) { - $('#tz_select_date_suggest').css('display', 'none'); + if ($tzDate.val() === $tzSelectDateSuggest.attr('data-suggested-tz')) { + $tzSelectDateSuggest.css('display', 'none'); } else { - $('#tz_select_date_suggest').css('display', 'inline'); + $tzSelectDateSuggest.css('display', 'inline'); } - if ($("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option").size() === 1) { + var $tzOptions = $timezone.children('optgroup[data-tz-value="' + $tzDate.val() + '"]').children('option'); + + if ($tzOptions.length === 1) { // If there is only one timezone for the selected date, we just select that automatically. - $("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option:first").attr('selected', true); + $tzOptions.prop('selected', true); keepSelection = true; } if (typeof keepSelection !== 'undefined' && !keepSelection) { - var timezoneOptions = $('#timezone > optgroup option'); - if (timezoneOptions.filter(':selected').length <= 0) { - timezoneOptions.filter(':first').attr('selected', true); + var $timezoneOptions = $timezone.find('optgroup option'); + if ($timezoneOptions.filter(':selected').length <= 0) { + $timezoneOptions.filter(':first').prop('selected', true); } } }; @@ -453,12 +825,11 @@ phpbb.timezoneEnableDateSelection = function() { /** * Preselect a date/time or suggest one, if it is not picked. * -* @param bool forceSelector Shall we select the suggestion? +* @param {bool} forceSelector Shall we select the suggestion? */ phpbb.timezonePreselectSelect = function(forceSelector) { // The offset returned here is in minutes and negated. - // http://www.w3schools.com/jsref/jsref_getTimezoneOffset.asp var offset = (new Date()).getTimezoneOffset(); var sign = '-'; @@ -482,11 +853,13 @@ phpbb.timezonePreselectSelect = function(forceSelector) { minutes = minutes.toString(); } - var prefix = 'GMT' + sign + hours + ':' + minutes; + var prefix = 'UTC' + sign + hours + ':' + minutes; var prefixLength = prefix.length; - var selectorOptions = $('#tz_date > option'); + var selectorOptions = $('option', '#tz_date'); var i; + var $tzSelectDateSuggest = $('#tz_select_date_suggest'); + for (i = 0; i < selectorOptions.length; ++i) { var option = selectorOptions[i]; @@ -495,16 +868,18 @@ phpbb.timezonePreselectSelect = function(forceSelector) { // We do not select the option for the user, but notify him, // that we would suggest a different setting. phpbb.timezoneSwitchDate(true); - $('#tz_select_date_suggest').css('display', 'inline'); + $tzSelectDateSuggest.css('display', 'inline'); } else { option.selected = true; phpbb.timezoneSwitchDate(!forceSelector); - $('#tz_select_date_suggest').css('display', 'none'); + $tzSelectDateSuggest.css('display', 'none'); } - $('#tz_select_date_suggest').attr('title', $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML)); - $('#tz_select_date_suggest').attr('value', $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML.substring(0, 9))); - $('#tz_select_date_suggest').attr('data-suggested-tz', option.innerHTML); + var suggestion = $tzSelectDateSuggest.attr('data-l-suggestion'); + + $tzSelectDateSuggest.attr('title', suggestion.replace('%s', option.innerHTML)); + $tzSelectDateSuggest.attr('value', suggestion.replace('%s', option.innerHTML.substring(0, 9))); + $tzSelectDateSuggest.attr('data-suggested-tz', option.innerHTML); // Found the suggestion, there cannot be more, so return from here. return; @@ -512,19 +887,6 @@ phpbb.timezonePreselectSelect = function(forceSelector) { } }; -// Toggle notification list -$('#notification_list_button').click(function(e) { - $('#notification_list').toggle(); - e.preventDefault(); -}); -$('#phpbb').click(function(e) { - var target = $(e.target); - - if (!target.is('#notification_list, #notification_list_button') && !target.parents().is('#notification_list, #notification_list_button')) { - $('#notification_list').hide(); - } -}); - phpbb.ajaxCallbacks = {}; /** @@ -532,8 +894,8 @@ phpbb.ajaxCallbacks = {}; * * 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. + * @param {string} id The name of the callback. + * @param {function} callback The callback to be called. */ phpbb.addAjaxCallback = function(id, callback) { if (typeof callback === 'function') { @@ -542,6 +904,12 @@ phpbb.addAjaxCallback = function(id, callback) { return this; }; +/** + * This callback handles live member searches. + */ +phpbb.addAjaxCallback('member_search', function(res) { + phpbb.search.handleResponse(res, $(this), false, phpbb.getFunctionByName('phpbb.search.setValueOnClick')); +}); /** * This callback alternates text - it replaces the current text with the text in @@ -549,13 +917,23 @@ phpbb.addAjaxCallback = function(id, callback) { * current text so that the process can be repeated. */ phpbb.addAjaxCallback('alt_text', function() { - var el = $(this), + var $anchor, + updateAll = $(this).data('update-all'), altText; - altText = el.attr('data-alt-text'); - el.attr('data-alt-text', el.text()); - el.attr('title', altText); - el.text(altText); + if (updateAll !== undefined && updateAll.length) { + $anchor = $(updateAll); + } else { + $anchor = $(this); + } + + $anchor.each(function() { + var $this = $(this); + altText = $this.attr('data-alt-text'); + $this.attr('data-alt-text', $this.text()); + $this.attr('title', $.trim(altText)); + $this.text(altText); + }); }); /** @@ -568,27 +946,37 @@ phpbb.addAjaxCallback('alt_text', function() { * and changes the link itself. */ phpbb.addAjaxCallback('toggle_link', function() { - var el = $(this), + var $anchor, + updateAll = $(this).data('update-all') , toggleText, toggleUrl, toggleClass; - // Toggle link text + if (updateAll !== undefined && updateAll.length) { + $anchor = $(updateAll); + } else { + $anchor = $(this); + } + + $anchor.each(function() { + var $this = $(this); - toggleText = el.attr('data-toggle-text'); - el.attr('data-toggle-text', el.text()); - el.attr('title', toggleText); - el.text(toggleText); + // Toggle link url + toggleUrl = $this.attr('data-toggle-url'); + $this.attr('data-toggle-url', $this.attr('href')); + $this.attr('href', toggleUrl); - // Toggle link url - toggleUrl = el.attr('data-toggle-url'); - el.attr('data-toggle-url', el.attr('href')); - el.attr('href', toggleUrl); + // Toggle class of link parent + toggleClass = $this.attr('data-toggle-class'); + $this.attr('data-toggle-class', $this.children().attr('class')); + $this.children('.icon').attr('class', toggleClass); - // Toggle class of link parent - toggleClass = el.attr('data-toggle-class'); - el.attr('data-toggle-class', el.parent().attr('class')); - el.parent().attr('class', toggleClass); + // Toggle link text + toggleText = $this.attr('data-toggle-text'); + $this.attr('data-toggle-text', $this.children('span').text()); + $this.attr('title', $.trim(toggleText)); + $this.children('span').text(toggleText); + }); }); /** @@ -597,8 +985,8 @@ phpbb.addAjaxCallback('toggle_link', function() { * This function automatically resizes textarea elements when user * types text. * -* @param {jQuery} items jQuery object(s) to resize -* @param {object} options Optional parameter that adjusts default +* @param {jQuery} $items jQuery object(s) to resize +* @param {object} [options] Optional parameter that adjusts default * configuration. See configuration variable * * Optional parameters: @@ -613,38 +1001,41 @@ phpbb.addAjaxCallback('toggle_link', function() { * this points to DOM object * item is a jQuery object, same as this */ -phpbb.resizeTextArea = function(items, options) { +phpbb.resizeTextArea = function($items, options) { // Configuration var configuration = { minWindowHeight: 500, minHeight: 200, maxHeight: 500, heightDiff: 200, - resizeCallback: function(item) { }, - resetCallback: function(item) { } + resizeCallback: function() {}, + resetCallback: function() {} }; - if (isTouch) return; + if (phpbb.isTouch) { + return; + } if (arguments.length > 1) { configuration = $.extend(configuration, options); } - function resetAutoResize(item) - { + function resetAutoResize(item) { var $item = $(item); if ($item.hasClass('auto-resized')) { - $(item).css({height: '', resize: ''}).removeClass('auto-resized'); + $(item) + .css({ height: '', resize: '' }) + .removeClass('auto-resized'); configuration.resetCallback.call(item, $item); } } - function autoResize(item) - { - function setHeight(height) - { - height += parseInt($item.css('height')) - $item.height(); - $item.css({height: height + 'px', resize: 'none'}).addClass('auto-resized'); + function autoResize(item) { + function setHeight(height) { + height += parseInt($item.css('height'), 10) - $item.height(); + $item + .css({ height: height + 'px', resize: 'none' }) + .addClass('auto-resized'); configuration.resizeCallback.call(item, $item); } @@ -655,9 +1046,12 @@ phpbb.resizeTextArea = function(items, options) { return; } - var maxHeight = Math.min(Math.max(windowHeight - configuration.heightDiff, configuration.minHeight), configuration.maxHeight), + var maxHeight = Math.min( + Math.max(windowHeight - configuration.heightDiff, configuration.minHeight), + configuration.maxHeight + ), $item = $(item), - height = parseInt($item.height()), + height = parseInt($item.height(), 10), scrollHeight = (item.scrollHeight) ? item.scrollHeight : 0; if (height < 0) { @@ -666,20 +1060,19 @@ phpbb.resizeTextArea = function(items, options) { if (height > maxHeight) { setHeight(maxHeight); - } - else if (scrollHeight > (height + 5)) { + } else if (scrollHeight > (height + 5)) { setHeight(Math.min(maxHeight, scrollHeight)); } } - items.bind('focus change keyup', function() { + $items.on('focus change keyup', function() { $(this).each(function() { autoResize(this); }); }).change(); $(window).resize(function() { - items.each(function() { + $items.each(function() { if ($(this).hasClass('auto-resized')) { autoResize(this); } @@ -696,7 +1089,7 @@ phpbb.resizeTextArea = function(items, options) { * @param {Array} endTags List of end tags to look for * For example, Array('[/code]') * -* @return {boolean} True if cursor is in bbcode tag +* @returns {boolean} True if cursor is in bbcode tag */ phpbb.inBBCodeTag = function(textarea, startTags, endTags) { var start = textarea.selectionStart, @@ -717,7 +1110,9 @@ phpbb.inBBCodeTag = function(textarea, startTags, endTags) { lastStart = Math.max(lastStart, index); } } - if (lastStart == -1) return false; + if (lastStart === -1) { + return false; + } if (start > 0) { for (i = 0; i < endTags.length; i++) { @@ -727,7 +1122,7 @@ phpbb.inBBCodeTag = function(textarea, startTags, endTags) { } return (lastEnd < lastStart); -} +}; /** @@ -766,12 +1161,12 @@ phpbb.applyCodeEditor = function(textarea) { * @param {boolean} stripCodeStart If true, only part of line * after [code] tag will be returned. * - * @return {string} Line of text + * @returns {string} Line of text */ function getLastLine(stripCodeStart) { var start = textarea.selectionStart, value = textarea.value, - index = value.lastIndexOf("\n", start - 1); + index = value.lastIndexOf('\n', start - 1); value = value.substring(index + 1, start); @@ -782,7 +1177,7 @@ phpbb.applyCodeEditor = function(textarea) { var tagLength = startTags[i].length; value = value.substring(index + tagLength); - if (startTags[i].lastIndexOf(startTagsEnd) != tagLength) { + if (startTags[i].lastIndexOf(startTagsEnd) !== tagLength) { index = value.indexOf(startTagsEnd); if (index >= 0) { @@ -799,7 +1194,7 @@ phpbb.applyCodeEditor = function(textarea) { /** * Append text at cursor position * - * @param {string} Text Text to append + * @param {string} text Text to append */ function appendText(text) { var start = textarea.selectionStart, @@ -814,24 +1209,27 @@ phpbb.applyCodeEditor = function(textarea) { var key = event.keyCode || event.which; // intercept tabs - if (key == 9) { + if (key === keymap.TAB && + !event.ctrlKey && + !event.shiftKey && + !event.altKey && + !event.metaKey) { if (inTag()) { - appendText("\t"); + appendText('\t'); event.preventDefault(); return; } } // intercept new line characters - if (key == 13) { + if (key === keymap.ENTER) { if (inTag()) { var lastLine = getLastLine(true), code = '' + /^\s*/g.exec(lastLine); if (code.length > 0) { - appendText("\n" + code); + appendText('\n' + code); event.preventDefault(); - return; } } } @@ -839,6 +1237,31 @@ phpbb.applyCodeEditor = function(textarea) { }; /** + * Show drag and drop animation when textarea is present + * + * This function will enable the drag and drop animation for a specified + * textarea. + * + * @param {HTMLElement} textarea Textarea DOM object to apply editor to + */ +phpbb.showDragNDrop = function(textarea) { + if (!textarea) { + return; + } + + $('body').on('dragenter dragover', function () { + $(textarea).addClass('drag-n-drop'); + }).on('dragleave dragout dragend drop', function() { + $(textarea).removeClass('drag-n-drop'); + }); + $(textarea).on('dragenter dragover', function () { + $(textarea).addClass('drag-n-drop-highlight'); + }).on('dragleave dragout dragend drop', function() { + $(textarea).removeClass('drag-n-drop-highlight'); + }); +}; + +/** * List of classes that toggle dropdown menu, * list of classes that contain visible dropdown menu * @@ -856,50 +1279,49 @@ phpbb.toggleDropdown = function() { var $this = $(this), options = $this.data('dropdown-options'), parent = options.parent, - visible = parent.hasClass('dropdown-visible'); + visible = parent.hasClass('dropdown-visible'), + direction; if (!visible) { // Hide other dropdown menus $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); // Figure out direction of dropdown - var direction = options.direction, - verticalDirection = options.verticalDirection, + direction = options.direction; + var verticalDirection = options.verticalDirection, offset = $this.offset(); - if (direction == 'auto') { + if (direction === 'auto') { if (($(window).width() - $this.outerWidth(true)) / 2 > offset.left) { direction = 'right'; - } - else { + } else { direction = 'left'; } } - parent.toggleClass(options.leftClass, direction == 'left').toggleClass(options.rightClass, direction == 'right'); + parent.toggleClass(options.leftClass, direction === 'left') + .toggleClass(options.rightClass, direction === 'right'); - if (verticalDirection == 'auto') { + if (verticalDirection === 'auto') { var height = $(window).height(), top = offset.top - $(window).scrollTop(); - if (top < height * 0.7) { - verticalDirection = 'down'; - } - else { - verticalDirection = 'up'; - } + verticalDirection = (top < height * 0.7) ? 'down' : 'up'; } - parent.toggleClass(options.upClass, verticalDirection == 'up').toggleClass(options.downClass, verticalDirection == 'down'); + parent.toggleClass(options.upClass, verticalDirection === 'up') + .toggleClass(options.downClass, verticalDirection === 'down'); } options.dropdown.toggle(); - parent.toggleClass(options.visibleClass, !visible).toggleClass('dropdown-visible', !visible); + parent.toggleClass(options.visibleClass, !visible) + .toggleClass('dropdown-visible', !visible); // Check dimensions when showing dropdown // !visible because variable shows state of dropdown before it was toggled if (!visible) { + var windowWidth = $(window).width(); + options.dropdown.find('.dropdown-contents').each(function() { - var $this = $(this), - windowWidth = $(window).width(); + var $this = $(this); $this.css({ marginLeft: 0, @@ -912,11 +1334,38 @@ phpbb.toggleDropdown = function() { if (offset < 2) { $this.css('left', (2 - offset) + 'px'); - } - else if ((offset + width + 2) > windowWidth) { + } else if ((offset + width + 2) > windowWidth) { $this.css('margin-left', (windowWidth - offset - width - 2) + 'px'); } + + // Check whether the vertical scrollbar is present. + $this.toggleClass('dropdown-nonscroll', this.scrollHeight === $this.innerHeight()); + }); + var freeSpace = parent.offset().left - 4; + + if (direction === 'left') { + options.dropdown.css('margin-left', '-' + freeSpace + 'px'); + + // Try to position the notification dropdown correctly in RTL-responsive mode + if (options.dropdown.hasClass('dropdown-extended')) { + var contentWidth, + fullFreeSpace = freeSpace + parent.outerWidth(); + + options.dropdown.find('.dropdown-contents').each(function() { + contentWidth = parseInt($(this).outerWidth(), 10); + $(this).css({ marginLeft: 0, left: 0 }); + }); + + var maxOffset = Math.min(contentWidth, fullFreeSpace) + 'px'; + options.dropdown.css({ + width: maxOffset, + marginLeft: -maxOffset + }); + } + } else { + options.dropdown.css('margin-right', '-' + (windowWidth + freeSpace) + 'px'); + } } // Prevent event propagation @@ -925,8 +1374,7 @@ phpbb.toggleDropdown = function() { var e = arguments[0]; e.preventDefault(); e.stopPropagation(); - } - catch (error) { } + } catch (error) { } } return false; }; @@ -937,7 +1385,7 @@ phpbb.toggleDropdown = function() { phpbb.toggleSubmenu = function(e) { $(this).siblings('.dropdown-submenu').toggle(); e.preventDefault(); -} +}; /** * Register dropdown menu @@ -947,8 +1395,7 @@ phpbb.toggleSubmenu = function(e) { * @param {jQuery} dropdown Dropdown menu. * @param {Object} options List of options. Optional. */ -phpbb.registerDropdown = function(toggle, dropdown, options) -{ +phpbb.registerDropdown = function(toggle, dropdown, options) { var ops = { parent: toggle.parent(), // Parent item to add classes to direction: 'auto', // Direction of dropdown menu. Possible values: auto, left, right @@ -976,14 +1423,12 @@ phpbb.registerDropdown = function(toggle, dropdown, options) /** * Get the HTML for a color palette table. * -* @param string dir Palette direction - either v or h -* @param int width Palette cell width. -* @param int height Palette cell height. +* @param {string} dir Palette direction - either v or h +* @param {int} width Palette cell width. +* @param {int} height Palette cell height. */ phpbb.colorPalette = function(dir, width, height) { - var r = 0, - g = 0, - b = 0, + var r, g, b, numberList = new Array(6), color = '', html = ''; @@ -994,43 +1439,44 @@ phpbb.colorPalette = function(dir, width, height) { numberList[3] = 'BF'; numberList[4] = 'FF'; - var table_class = (dir == 'h') ? 'horizontal-palette' : 'vertical-palette'; - html += '<table class="not-responsive colour-palette ' + table_class + '" style="width: auto;">'; + var tableClass = (dir === 'h') ? 'horizontal-palette' : 'vertical-palette'; + html += '<table class="not-responsive colour-palette ' + tableClass + '" style="width: auto;">'; for (r = 0; r < 5; r++) { - if (dir == 'h') { + if (dir === 'h') { html += '<tr>'; } for (g = 0; g < 5; g++) { - if (dir == 'v') { + if (dir === 'v') { html += '<tr>'; } for (b = 0; b < 5; b++) { - color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - html += '<td style="background-color: #' + color + '; width: ' + width + 'px; height: ' + height + 'px;">'; - html += '<a href="#" data-color="' + color + '" style="display: block; width: ' + width + 'px; height: ' + height + 'px; " alt="#' + color + '" title="#' + color + '"></a>'; + color = '' + numberList[r] + numberList[g] + numberList[b]; + html += '<td style="background-color: #' + color + '; width: ' + width + 'px; height: ' + + height + 'px;"><a href="#" data-color="' + color + '" style="display: block; width: ' + + width + 'px; height: ' + height + 'px; " alt="#' + color + '" title="#' + color + '"></a>'; html += '</td>'; } - if (dir == 'v') { + if (dir === 'v') { html += '</tr>'; } } - if (dir == 'h') { + if (dir === 'h') { html += '</tr>'; } } html += '</table>'; return html; -} +}; /** * Register a color palette. * -* @param object el jQuery object for the palette container. +* @param {jQuery} el jQuery object for the palette container. */ phpbb.registerPalette = function(el) { var orientation = el.attr('data-orientation'), @@ -1059,27 +1505,160 @@ phpbb.registerPalette = function(el) { } e.preventDefault(); }); -} +}; /** -* Apply code editor to all textarea elements with data-bbcode attribute +* Set display of page element +* +* @param {string} id The ID of the element to change +* @param {int} action Set to 0 if element display should be toggled, -1 for +* hiding the element, and 1 for showing it. +* @param {string} type Display type that should be used, e.g. inline, block or +* other CSS "display" types */ -$(document).ready(function() { - $('textarea[data-bbcode]').each(function() { - phpbb.applyCodeEditor(this); +phpbb.toggleDisplay = function(id, action, type) { + if (!type) { + type = 'block'; + } + + var $element = $('#' + id); + + var display = $element.css('display'); + if (!action) { + action = (display === '' || display === type) ? -1 : 1; + } + $element.css('display', ((action === 1) ? type : 'none')); +}; + +/** +* Toggle additional settings based on the selected +* option of select element. +* +* @param {jQuery} el jQuery select element object. +*/ +phpbb.toggleSelectSettings = function(el) { + el.children().each(function() { + var $this = $(this), + $setting = $($this.data('toggle-setting')); + $setting.toggle($this.is(':selected')); + }); +}; + +/** +* Get function from name. +* Based on http://stackoverflow.com/a/359910 +* +* @param {string} functionName Function to get. +* @returns function +*/ +phpbb.getFunctionByName = function (functionName) { + var namespaces = functionName.split('.'), + func = namespaces.pop(), + context = window; + + for (var i = 0; i < namespaces.length; i++) { + context = context[namespaces[i]]; + } + return context[func]; +}; + +/** +* Register page dropdowns. +*/ +phpbb.registerPageDropdowns = function() { + var $body = $('body'); + + $body.find('.dropdown-container').each(function() { + var $this = $(this), + $trigger = $this.find('.dropdown-trigger:first'), + $contents = $this.find('.dropdown'), + options = { + direction: 'auto', + verticalDirection: 'auto' + }, + data; + + if (!$trigger.length) { + data = $this.attr('data-dropdown-trigger'); + $trigger = data ? $this.children(data) : $this.children('a:first'); + } + + if (!$contents.length) { + data = $this.attr('data-dropdown-contents'); + $contents = data ? $this.children(data) : $this.children('div:first'); + } + + if (!$trigger.length || !$contents.length) { + return; + } + + if ($this.hasClass('dropdown-up')) { + options.verticalDirection = 'up'; + } + if ($this.hasClass('dropdown-down')) { + options.verticalDirection = 'down'; + } + if ($this.hasClass('dropdown-left')) { + options.direction = 'left'; + } + if ($this.hasClass('dropdown-right')) { + options.direction = 'right'; + } + + phpbb.registerDropdown($trigger, $contents, options); }); // Hide active dropdowns when click event happens outside - $('body').click(function(e) { - var parents = $(e.target).parents(); - if (!parents.is(phpbb.dropdownVisibleContainers)) { + $body.click(function(e) { + var $parents = $(e.target).parents(); + if (!$parents.is(phpbb.dropdownVisibleContainers)) { $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); } }); +}; + +/** + * Handle avatars to be lazy loaded. + */ +phpbb.lazyLoadAvatars = function loadAvatars() { + $('.avatar[data-src]').each(function () { + var $avatar = $(this); + + $avatar + .attr('src', $avatar.data('src')) + .removeAttr('data-src'); + }); +}; + +$(window).load(phpbb.lazyLoadAvatars); + +/** +* Apply code editor to all textarea elements with data-bbcode attribute +*/ +$(function() { + $('textarea[data-bbcode]').each(function() { + phpbb.applyCodeEditor(this); + }); + + phpbb.registerPageDropdowns(); $('#color_palette_placeholder').each(function() { phpbb.registerPalette($(this)); }); + + // Update browser history URL to point to specific post in viewtopic.php + // when using view=unread#unread link. + phpbb.history.replaceUrl($('#unread[data-url]').data('url')); + + // Hide settings that are not selected via select element. + $('select[data-togglable-settings]').each(function() { + var $this = $(this); + + $this.change(function() { + phpbb.toggleSelectSettings($this); + }); + phpbb.toggleSelectSettings($this); + }); }); })(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js index dfc7dab525..df353bc29d 100644 --- a/phpBB/assets/javascript/editor.js +++ b/phpBB/assets/javascript/editor.js @@ -111,7 +111,6 @@ function bbfontstyle(bbopen, bbclose) { } textarea.focus(); - return; } /** @@ -159,7 +158,7 @@ function insert_text(text, spaces, popup) { /** * Add inline attachment at position */ -function attach_inline(index, filename) { +function attachInline(index, filename) { insert_text('[attachment=' + index + ']' + filename + '[/attachment]'); document.forms[form_name].elements[text_name].focus(); } @@ -167,7 +166,7 @@ function attach_inline(index, filename) { /** * Add quote text to message */ -function addquote(post_id, username, l_wrote) { +function addquote(post_id, username, l_wrote, attributes) { var message_name = 'message_' + post_id; var theSelection = ''; var divarea = false; @@ -177,6 +176,9 @@ function addquote(post_id, username, l_wrote) { // Backwards compatibility l_wrote = 'wrote'; } + if (typeof attributes !== 'object') { + attributes = {}; + } if (document.all) { divarea = document.all[message_name]; @@ -213,7 +215,8 @@ function addquote(post_id, username, l_wrote) { if (theSelection) { if (bbcodeEnabled) { - insert_text('[quote="' + username + '"]' + theSelection + '[/quote]'); + attributes.author = username; + insert_text(generateQuote(theSelection, attributes)); } else { insert_text(username + ' ' + l_wrote + ':' + '\n'); var lines = split_lines(theSelection); @@ -222,8 +225,61 @@ function addquote(post_id, username, l_wrote) { } } } +} - return; +/** +* Create a quote block for given text +* +* Possible attributes: +* - author: author's name (usually a username) +* - post_id: post_id of the post being quoted +* - user_id: user_id of the user being quoted +* - time: timestamp of the original message +* +* @param {!string} text Quote's text +* @param {!Object} attributes Quote's attributes +* @return {!string} Quote block to be used in a new post/text +*/ +function generateQuote(text, attributes) { + text = text.replace(/^\s+/, '').replace(/\s+$/, ''); + var quote = '[quote'; + if (attributes.author) { + // Add the author as the BBCode's default attribute + quote += '=' + formatAttributeValue(attributes.author); + delete attributes.author; + } + for (var name in attributes) { + if (attributes.hasOwnProperty(name)) { + var value = attributes[name]; + quote += ' ' + name + '=' + formatAttributeValue(value.toString()); + } + } + quote += ']'; + var newline = ((quote + text + '[/quote]').length > 80 || text.indexOf('\n') > -1) ? '\n' : ''; + quote += newline + text + newline + '[/quote]'; + + return quote; +} + +/** +* Format given string to be used as an attribute value +* +* Will return the string as-is if it can be used in a BBCode without quotes. Otherwise, +* it will use either single- or double- quotes depending on whichever requires less escaping. +* Quotes and backslashes are escaped with backslashes where necessary +* +* @param {!string} str Original string +* @return {!string} Same string if possible, escaped string within quotes otherwise +*/ +function formatAttributeValue(str) { + if (!/[ "'\\\]]/.test(str)) { + // Return as-is if it contains none of: space, ' " \ or ] + return str; + } + var singleQuoted = "'" + str.replace(/[\\']/g, '\\$&') + "'", + doubleQuoted = '"' + str.replace(/[\\"]/g, '\\$&') + '"'; + + return (singleQuoted.length < doubleQuoted.length) ? singleQuoted : doubleQuoted; } function split_lines(text) { @@ -266,10 +322,6 @@ function mozWrap(txtarea, open, close) { var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd === 1 || selEnd === 2) { - selEnd = selLength; - } - var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd); var s3 = (txtarea.value).substring(selEnd, selLength); @@ -359,6 +411,9 @@ function getCaretPosition(txtarea) { textarea = doc.forms[form_name].elements[text_name]; phpbb.applyCodeEditor(textarea); + if ($('#attach-panel').length) { + phpbb.showDragNDrop(textarea); + } }); })(jQuery); diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js new file mode 100644 index 0000000000..c5909556c6 --- /dev/null +++ b/phpBB/assets/javascript/installer.js @@ -0,0 +1,515 @@ +/** + * Installer's AJAX frontend handler + */ + +(function($) { // Avoid conflicts with other libraries + 'use strict'; + + // Installer variables + var pollTimer = null; + var nextReadPosition = 0; + var progressBarTriggered = false; + var progressTimer = null; + var currentProgress = 0; + var refreshRequested = false; + + // Template related variables + var $contentWrapper = $('.install-body').find('.main'); + + // Intercept form submits + interceptFormSubmit($('#install_install')); + + /** + * Creates an XHR object + * + * jQuery cannot be used as the response is streamed, and + * as of now, jQuery does not provide access to the response until + * the connection is not closed. + * + * @return XMLHttpRequest + */ + function createXhrObject() { + return new XMLHttpRequest(); + } + + /** + * Displays error, warning and log messages + * + * @param type + * @param messages + */ + function addMessage(type, messages) { + // Get message containers + var $errorContainer = $('#error-container'); + var $warningContainer = $('#warning-container'); + var $logContainer = $('#log-container'); + + var $title, $description, $msgElement, arraySize = messages.length; + for (var i = 0; i < arraySize; i++) { + $msgElement = $('<div />'); + $title = $('<strong />'); + $title.text(messages[i].title); + $msgElement.append($title); + + if (messages[i].hasOwnProperty('description')) { + $description = $('<p />'); + $description.html(messages[i].description); + $msgElement.append($description); + } + + switch (type) { + case 'error': + $msgElement.addClass('errorbox'); + $errorContainer.append($msgElement); + break; + case 'warning': + $msgElement.addClass('warningbox'); + $warningContainer.append($msgElement); + break; + case 'log': + $msgElement.addClass('log'); + $logContainer.prepend($msgElement); + $logContainer.addClass('show_log_container'); + break; + case 'success': + $msgElement.addClass('successbox'); + $errorContainer.prepend($msgElement); + break; + } + } + } + + /** + * Render a download box + */ + function addDownloadBox(downloadArray) + { + var $downloadContainer = $('#download-wrapper'); + var $downloadBox, $title, $content, $link; + + for (var i = 0; i < downloadArray.length; i++) { + $downloadBox = $('<div />'); + $downloadBox.addClass('download-box'); + + $title = $('<strong />'); + $title.text(downloadArray[i].title); + $downloadBox.append($title); + + if (downloadArray[i].hasOwnProperty('msg')) { + $content = $('<p />'); + $content.text(downloadArray[i].msg); + $downloadBox.append($content); + } + + $link = $('<a />'); + $link.addClass('button1'); + $link.attr('href', downloadArray[i].href); + $link.text(downloadArray[i].download); + $downloadBox.append($link); + + $downloadContainer.append($downloadBox); + } + } + + /** + * Render update files' status + */ + function addUpdateFileStatus(fileStatus) + { + var $statusContainer = $('#file-status-wrapper'); + $statusContainer.html(fileStatus); + } + + /** + * Displays a form from the response + * + * @param formHtml + */ + function addForm(formHtml) { + var $formContainer = $('#form-wrapper'); + $formContainer.html(formHtml); + var $form = $('#install_install'); + interceptFormSubmit($form); + } + + /** + * Handles navigation status updates + * + * @param navObj + */ + function updateNavbarStatus(navObj) { + var navID, $stage, $stageListItem, $active; + $active = $('#activemenu'); + + if (navObj.hasOwnProperty('finished')) { + // This should be an Array + var navItems = navObj.finished; + + for (var i = 0; i < navItems.length; i++) { + navID = 'installer-stage-' + navItems[i]; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && $active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stage.addClass('completed'); + } + } + + if (navObj.hasOwnProperty('active')) { + navID = 'installer-stage-' + navObj.active; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && !$active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stageListItem.attr('id', 'activemenu'); + } + } + + /** + * Renders progress bar + * + * @param progressObject + */ + function setProgress(progressObject) { + var $statusText, $progressBar, $progressText, $progressFiller; + + if (progressObject.task_name.length) { + if (!progressBarTriggered) { + // Create progress bar + var $progressBarWrapper = $('#progress-bar-container'); + + // Create progress bar elements + $progressBar = $('<div />'); + $progressBar.attr('id', 'progress-bar'); + $progressText = $('<p />'); + $progressText.attr('id', 'progress-bar-text'); + $progressFiller = $('<span />'); + $progressFiller.attr('id', 'progress-bar-filler'); + $progressFiller.html($progressText); + + $statusText = $('<p />'); + $statusText.attr('id', 'progress-status-text'); + + $progressBar.append($progressFiller); + + $progressBarWrapper.append($statusText); + $progressBarWrapper.append($progressBar); + + progressBarTriggered = true; + } else if (progressObject.hasOwnProperty('restart')) { + clearInterval(progressTimer); + + $progressFiller = $('#progress-bar-filler'); + $progressText = $('#progress-bar-text'); + $statusText = $('#progress-status-text'); + + $progressText.text('0%'); + $progressFiller.css('width', '0%'); + + currentProgress = 0; + } else { + $statusText = $('#progress-status-text'); + } + + // Update progress bar + $statusText.text(progressObject.task_name + '…'); + incrementProgressBar(Math.round(progressObject.task_num / progressObject.task_count * 100)); + } + } + + // Set cookies + function setCookies(cookies) { + var cookie; + + for (var i = 0; i < cookies.length; i++) { + // Set cookie name and value + cookie = encodeURIComponent(cookies[i].name) + '=' + encodeURIComponent(cookies[i].value); + // Set path + cookie += '; path=/'; + document.cookie = cookie; + } + } + + /** + * Parse messages from the response object + * + * @param messageJSON + */ + function parseMessage(messageJSON) { + $('#loading_indicator').css('display', 'none'); + var responseObject; + + try { + responseObject = JSON.parse(messageJSON); + } catch (err) { + if (window.console) { + console.log('Failed to parse JSON object\n\nMessage: ' + err.message + '\n\nServer Response: ' + messageJSON); + } else { + alert('Failed to parse JSON object\n\nMessage: ' + err.message + '\n\nServer Response: ' + messageJSON); + } + + resetPolling(); + return; + } + + // Parse object + if (responseObject.hasOwnProperty('errors')) { + addMessage('error', responseObject.errors); + } + + if (responseObject.hasOwnProperty('warnings')) { + addMessage('warning', responseObject.warnings); + } + + if (responseObject.hasOwnProperty('logs')) { + addMessage('log', responseObject.logs); + } + + if (responseObject.hasOwnProperty('success')) { + addMessage('success', responseObject.success); + } + + if (responseObject.hasOwnProperty('form')) { + addForm(responseObject.form); + } + + if (responseObject.hasOwnProperty('progress')) { + setProgress(responseObject.progress); + } + + if (responseObject.hasOwnProperty('download')) { + addDownloadBox(responseObject.download); + } + + if (responseObject.hasOwnProperty('file_status')) { + addUpdateFileStatus(responseObject.file_status); + } + + if (responseObject.hasOwnProperty('nav')) { + updateNavbarStatus(responseObject.nav); + } + + if (responseObject.hasOwnProperty('cookies')) { + setCookies(responseObject.cookies); + } + + if (responseObject.hasOwnProperty('refresh')) { + refreshRequested = true; + } + } + + /** + * Process updates in streamed response + * + * @param xhReq XHR object + */ + function pollContent(xhReq) { + var messages = xhReq.responseText; + var msgSeparator = '}\n\n'; + var unprocessed, messageEndIndex, endOfMessageIndex, message; + + do { + unprocessed = messages.substring(nextReadPosition); + messageEndIndex = unprocessed.indexOf(msgSeparator); + + if (messageEndIndex !== -1) { + endOfMessageIndex = messageEndIndex + msgSeparator.length; + message = unprocessed.substring(0, endOfMessageIndex); + parseMessage($.trim(message)); + nextReadPosition += endOfMessageIndex; + } + } while (messageEndIndex !== -1); + + if (xhReq.readyState === 4) { + $('#loading_indicator').css('display', 'none'); + resetPolling(); + + if (refreshRequested) { + refreshRequested = false; + doRefresh(); + } + } + } + + /** + * Animates the progress bar + * + * @param $progressText + * @param $progressFiller + * @param progressLimit + */ + function incrementFiller($progressText, $progressFiller, progressLimit) { + if (currentProgress >= progressLimit || currentProgress >= 100) { + clearInterval(progressTimer); + return; + } + + currentProgress++; + $progressText.text(currentProgress + '%'); + $progressFiller.css('width', currentProgress + '%'); + } + + /** + * Wrapper function for progress bar rendering and animating + * + * @param progressLimit + */ + function incrementProgressBar(progressLimit) { + var $progressFiller = $('#progress-bar-filler'); + var $progressText = $('#progress-bar-text'); + var progressStart = $progressFiller.width() / $progressFiller.offsetParent().width() * 100; + currentProgress = Math.floor(progressStart); + + clearInterval(progressTimer); + progressTimer = setInterval(function() { + incrementFiller($progressText, $progressFiller, progressLimit); + }, 10); + } + + /** + * Resets the polling timer + */ + function resetPolling() { + clearInterval(pollTimer); + nextReadPosition = 0; + } + + /** + * Sets up timer for processing the streamed HTTP response + * + * @param xhReq + */ + function startPolling(xhReq) { + resetPolling(); + pollTimer = setInterval(function () { + pollContent(xhReq); + }, 250); + } + + /** + * Refresh page + */ + function doRefresh() { + resetPolling(); + + var xhReq = createXhrObject(); + xhReq.open('GET', $(location).attr('pathname'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.send(); + + startPolling(xhReq); + } + + /** + * Renders the AJAX UI layout + */ + function setupAjaxLayout() { + progressBarTriggered = false; + + // Clear content + $contentWrapper.html(''); + + var $header = $('<div />'); + $header.attr('id', 'header-container'); + $contentWrapper.append($header); + + var $description = $('<div />'); + $description.attr('id', 'description-container'); + $contentWrapper.append($description); + + var $errorContainer = $('<div />'); + $errorContainer.attr('id', 'error-container'); + $contentWrapper.append($errorContainer); + + var $warningContainer = $('<div />'); + $warningContainer.attr('id', 'warning-container'); + $contentWrapper.append($warningContainer); + + var $progressContainer = $('<div />'); + $progressContainer.attr('id', 'progress-bar-container'); + $contentWrapper.append($progressContainer); + + var $logContainer = $('<div />'); + $logContainer.attr('id', 'log-container'); + $contentWrapper.append($logContainer); + + var $installerContentWrapper = $('<div />'); + $installerContentWrapper.attr('id', 'content-container'); + $contentWrapper.append($installerContentWrapper); + + var $installerDownloadWrapper = $('<div />'); + $installerDownloadWrapper.attr('id', 'download-wrapper'); + $installerContentWrapper.append($installerDownloadWrapper); + + var $updaterFileStatusWrapper = $('<div />'); + $updaterFileStatusWrapper.attr('id', 'file-status-wrapper'); + $installerContentWrapper.append($updaterFileStatusWrapper); + + var $formWrapper = $('<div />'); + $formWrapper.attr('id', 'form-wrapper'); + $installerContentWrapper.append($formWrapper); + + var $spinner = $('<div />'); + $spinner.attr('id', 'loading_indicator'); + $spinner.html(' '); + $contentWrapper.append($spinner); + } + + // Submits a form + function submitForm($form, $submitBtn) { + $form.css('display', 'none'); + + var xhReq = createXhrObject(); + xhReq.open('POST', $form.attr('action'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhReq.send(getFormFields($form, $submitBtn)); + + // Disable language selector + $('#language_selector :input, label').css('display', 'none'); + + // Clear content + setupAjaxLayout(); + $('#loading_indicator').css('display', 'block'); + + startPolling(xhReq); + } + + /** + * Add submit button to the POST information + * + * @param $form + * @param $submitBtn + * + * @returns {*} + */ + function getFormFields($form, $submitBtn) { + var formData = $form.serialize(); + formData += ((formData.length) ? '&' : '') + encodeURIComponent($submitBtn.attr('name')) + '='; + formData += encodeURIComponent($submitBtn.attr('value')); + + return formData; + } + + /** + * Intercept form submit events and determine the submit button used + * + * @param $form + */ + function interceptFormSubmit($form) { + if (!$form.length) { + return; + } + + $form.find(':submit').bind('click', function (event) { + event.preventDefault(); + submitForm($form, $(this)); + }); + } +})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/assets/javascript/jquery.js b/phpBB/assets/javascript/jquery.js deleted file mode 100644 index 83589daa70..0000000000 --- a/phpBB/assets/javascript/jquery.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v1.8.3 jquery.com | jquery.org/license */
-(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
\ No newline at end of file diff --git a/phpBB/assets/javascript/jquery.min.js b/phpBB/assets/javascript/jquery.min.js new file mode 100644 index 0000000000..73f33fb3aa --- /dev/null +++ b/phpBB/assets/javascript/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f +}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=$.test(e)?this.mouseHooks:Z.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||z),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||z,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==db()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===db()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=z.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===L&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault())?bb:cb):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:cb,isPropagationStopped:cb,isImmediatePropagationStopped:cb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=bb,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=bb,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submitBubbles||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?b.form:void 0;c&&!n._data(c,"submitBubbles")&&(n.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),n._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.changeBubbles||(n.event.special.change={setup:function(){return Y.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),n.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),n.event.simulate("change",this,a,!0)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;Y.test(b.nodeName)&&!n._data(b,"changeBubbles")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a,!0)}),n._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!Y.test(this.nodeName)}}),l.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=cb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return n().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=cb),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});function eb(a){var b=fb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var fb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gb=/ jQuery\d+="(?:null|\d+)"/g,hb=new RegExp("<(?:"+fb+")[\\s/>]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/<tbody/i,mb=/<|&#?\w+;/,nb=/<(?:script|style|link)/i,ob=/checked\s*(?:[^=]|=\s*.checked.)/i,pb=/^$|\/(?:java|ecma)script/i,qb=/^true\/(.*)/,rb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,sb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1></$2>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?"<table>"!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Db[0].contentWindow||Db[0].contentDocument).document,b.write(),b.close(),c=Fb(a,b),Db.detach()),Eb[a]=c),c}!function(){var a,b,c=z.createElement("div"),d="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],a.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(a.style.opacity),l.cssFloat=!!a.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===c.style.backgroundClip,a=c=null,l.shrinkWrapBlocks=function(){var a,c,e,f;if(null==b){if(a=z.getElementsByTagName("body")[0],!a)return;f="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",c=z.createElement("div"),e=z.createElement("div"),a.appendChild(c).appendChild(e),b=!1,typeof e.style.zoom!==L&&(e.style.cssText=d+";width:1px;padding:1px;zoom:1",e.innerHTML="<div></div>",e.firstChild.style.width="5px",b=3!==e.offsetWidth),a.removeChild(c),a=c=e=null}return b}}();var Hb=/^margin/,Ib=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Jb,Kb,Lb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Jb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),Ib.test(g)&&Hb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):z.documentElement.currentStyle&&(Jb=function(a){return a.currentStyle},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ib.test(g)&&!Lb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Mb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h=z.createElement("div"),i="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",j="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",b=h.getElementsByTagName("a")[0],b.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(b.style.opacity),l.cssFloat=!!b.style.cssFloat,h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,b=h=null,n.extend(l,{reliableHiddenOffsets:function(){if(null!=c)return c;var a,b,d,e=z.createElement("div"),f=z.getElementsByTagName("body")[0];if(f)return e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=z.createElement("div"),a.style.cssText=i,f.appendChild(a).appendChild(e),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=e.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",d=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display="none",c=d&&0===b[0].offsetHeight,f.removeChild(a),e=f=null,c},boxSizing:function(){return null==d&&k(),d},boxSizingReliable:function(){return null==e&&k(),e},pixelPosition:function(){return null==f&&k(),f},reliableMarginRight:function(){var b,c,d,e;if(null==g&&a.getComputedStyle){if(b=z.getElementsByTagName("body")[0],!b)return;c=z.createElement("div"),d=z.createElement("div"),c.style.cssText=i,b.appendChild(c).appendChild(d),e=d.appendChild(z.createElement("div")),e.style.cssText=d.style.cssText=j,e.style.marginRight=e.style.width="0",d.style.width="1px",g=!parseFloat((a.getComputedStyle(e,null)||{}).marginRight),b.removeChild(c)}return g}});function k(){var b,c,h=z.getElementsByTagName("body")[0];h&&(b=z.createElement("div"),c=z.createElement("div"),b.style.cssText=i,h.appendChild(b).appendChild(c),c.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",n.swap(h,null!=h.style.zoom?{zoom:1}:{},function(){d=4===c.offsetWidth}),e=!0,f=!1,g=!0,a.getComputedStyle&&(f="1%"!==(a.getComputedStyle(c,null)||{}).top,e="4px"===(a.getComputedStyle(c,null)||{width:"4px"}).width),h.removeChild(b),c=h=null)}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Nb=/alpha\([^)]*\)/i,Ob=/opacity\s*=\s*([^)]*)/,Pb=/^(none|table(?!-c[ea]).+)/,Qb=new RegExp("^("+T+")(.*)$","i"),Rb=new RegExp("^([+-])=("+T+")","i"),Sb={position:"absolute",visibility:"hidden",display:"block"},Tb={letterSpacing:0,fontWeight:400},Ub=["Webkit","O","Moz","ms"];function Vb(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ub.length;while(e--)if(b=Ub[e]+c,b in a)return b;return d}function Wb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=n._data(d,"olddisplay",Gb(d.nodeName)))):f[g]||(e=V(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Xb(a,b,c){var d=Qb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Yb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Zb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Jb(a),g=l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Kb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ib.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Yb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Kb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=Vb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Rb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]="",i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Vb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Kb(a,b,d)),"normal"===f&&b in Tb&&(f=Tb[b]),""===c||c?(e=parseFloat(f),c===!0||n.isNumeric(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Pb.test(n.css(a,"display"))?n.swap(a,Sb,function(){return Zb(a,b,d)}):Zb(a,b,d):void 0},set:function(a,c,d){var e=d&&Jb(a);return Xb(a,c,d?Yb(a,b,d,l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Ob.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Nb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Nb.test(f)?f.replace(Nb,e):f+" "+e)}}),n.cssHooks.marginRight=Mb(l.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},Kb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Hb.test(a)||(n.cssHooks[a+b].set=Xb)}),n.fn.extend({css:function(a,b){return W(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Jb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b) +},a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:_b||gc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(kc(k,j.opts.specialEasing);g>f;f++)if(d=ec[f].call(j,a,k,j.opts))return d;return n.map(k,ic,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(lc,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],fc[c]=fc[c]||[],fc[c].unshift(b)},prefilter:function(a,b){b?ec.unshift(a):ec.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=lc(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&dc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(hc(b,!0),a,d,e)}}),n.each({slideDown:hc("show"),slideUp:hc("hide"),slideToggle:hc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(_b=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),_b=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ac||(ac=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(ac),ac=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e=z.createElement("div");e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=e.getElementsByTagName("a")[0],c=z.createElement("select"),d=c.appendChild(z.createElement("option")),b=e.getElementsByTagName("input")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==e.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=d.selected,l.enctype=!!z.createElement("form").enctype,c.disabled=!0,l.optDisabled=!d.disabled,b=z.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value,a=b=c=d=e=null}();var mc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.text(a)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nc,oc,pc=n.expr.attrHandle,qc=/^(?:checked|selected)$/i,rc=l.getSetAttribute,sc=l.input;n.fn.extend({attr:function(a,b){return W(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===L?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?oc:nc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(F);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?sc&&rc||!qc.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(rc?c:d)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),oc={set:function(a,b,c){return b===!1?n.removeAttr(a,c):sc&&rc||!qc.test(c)?a.setAttribute(!rc&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=pc[b]||n.find.attr;pc[b]=sc&&rc||!qc.test(b)?function(a,b,d){var e,f;return d||(f=pc[b],pc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,pc[b]=f),e}:function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),sc&&rc||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):nc&&nc.set(a,b,c)}}),rc||(nc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},pc.id=pc.name=pc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:nc.set},n.attrHooks.contenteditable={set:function(a,b,c){nc.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var tc=/^(?:input|select|textarea|button|object)$/i,uc=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return W(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):tc.test(a.nodeName)||uc.test(a.nodeName)&&a.href?0:-1}}}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var vc=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(F)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===L||"boolean"===c)&&(this.className&&n._data(this,"__className__",this.className),this.className=this.className||a===!1?"":n._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(vc," ").indexOf(b)>=0)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var wc=n.now(),xc=/\?/,yc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(yc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var zc,Ac,Bc=/#.*$/,Cc=/([?&])_=[^&]*/,Dc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ec=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fc=/^(?:GET|HEAD)$/,Gc=/^\/\//,Hc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ic={},Jc={},Kc="*/".concat("*");try{Ac=location.href}catch(Lc){Ac=z.createElement("a"),Ac.href="",Ac=Ac.href}zc=Hc.exec(Ac.toLowerCase())||[];function Mc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(F)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nc(a,b,c,d){var e={},f=a===Jc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Oc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Pc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Qc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ac,type:"GET",isLocal:Ec.test(zc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Oc(Oc(a,n.ajaxSettings),b):Oc(n.ajaxSettings,a)},ajaxPrefilter:Mc(Ic),ajaxTransport:Mc(Jc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Dc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||Ac)+"").replace(Bc,"").replace(Gc,zc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(F)||[""],null==k.crossDomain&&(c=Hc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===zc[1]&&c[2]===zc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(zc[3]||("http:"===zc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),Nc(Ic,k,b,v),2===t)return v;h=k.global,h&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Fc.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(xc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Cc.test(e)?e.replace(Cc,"$1_="+wc++):e+(xc.test(e)?"&":"?")+"_="+wc++)),k.ifModified&&(n.lastModified[e]&&v.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&v.setRequestHeader("If-None-Match",n.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Kc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Nc(Jc,k,b,v)){v.readyState=1,h&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Pc(k,v,c)),u=Qc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(n.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!l.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||n.css(a,"display"))},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var Rc=/%20/g,Sc=/\[\]$/,Tc=/\r?\n/g,Uc=/^(?:submit|button|image|reset|file)$/i,Vc=/^(?:input|select|textarea|keygen)/i;function Wc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Sc.test(a)?d(a,e):Wc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Wc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Wc(c,a[c],b,e);return d.join("&").replace(Rc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Vc.test(this.nodeName)&&!Uc.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Tc,"\r\n")}}):{name:b.name,value:c.replace(Tc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&$c()||_c()}:$c;var Xc=0,Yc={},Zc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Yc)Yc[a](void 0,!0)}),l.cors=!!Zc&&"withCredentials"in Zc,Zc=l.ajax=!!Zc,Zc&&n.ajaxTransport(function(a){if(!a.crossDomain||l.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Xc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Yc[g],b=void 0,f.onreadystatechange=n.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Yc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function $c(){try{return new a.XMLHttpRequest}catch(b){}}function _c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=z.head||n("head")[0]||z.documentElement;return{send:function(d,e){b=z.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var ad=[],bd=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=ad.pop()||n.expando+"_"+wc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(bd.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&bd.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(bd,"$1"+e):b.jsonp!==!1&&(b.url+=(xc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,ad.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||z;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var cd=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&cd)return cd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h,a.length),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&n.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n}); diff --git a/phpBB/assets/javascript/plupload.js b/phpBB/assets/javascript/plupload.js index 3c2fc5c3cb..8b3543880f 100644 --- a/phpBB/assets/javascript/plupload.js +++ b/phpBB/assets/javascript/plupload.js @@ -1,26 +1,26 @@ +/* global phpbb, plupload, attachInline */ + plupload.addI18n(phpbb.plupload.i18n); phpbb.plupload.ids = []; (function($) { // Avoid conflicts with other libraries -"use strict"; +'use strict'; /** * Set up the uploader. - * - * @return undefined */ phpbb.plupload.initialize = function() { // Initialize the Plupload uploader. - uploader.init(); + phpbb.plupload.uploader.init(); // Set attachment data. phpbb.plupload.setData(phpbb.plupload.data); phpbb.plupload.updateMultipartParams(phpbb.plupload.getSerializedData()); // Only execute if Plupload initialized successfully. - uploader.bind('Init', function() { - phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0], + phpbb.plupload.uploader.bind('Init', function() { + phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0]; phpbb.plupload.rowTpl = $('#attach-row-tpl')[0].outerHTML; // Hide the basic upload panel and remove the attach row template. @@ -29,48 +29,51 @@ phpbb.plupload.initialize = function() { $('#attach-panel-multi').show(); }); - uploader.bind('PostInit', function() { + phpbb.plupload.uploader.bind('PostInit', function() { // Point out the drag-and-drop zone if it's supported. - if (uploader.features.dragdrop) { + if (phpbb.plupload.uploader.features.dragdrop) { $('#drag-n-drop-message').show(); } + + // Ensure "Add files" button position is correctly calculated. + if ($('#attach-panel-multi').is(':visible')) { + phpbb.plupload.uploader.refresh(); + } + $('[data-subpanel="attach-panel"]').one('click', function() { + phpbb.plupload.uploader.refresh(); + }); }); }; /** * Unsets all elements in the object uploader.settings.multipart_params whose keys * begin with 'attachment_data[' - * - * @return undefined */ phpbb.plupload.clearParams = function() { - var obj = uploader.settings.multipart_params; + var obj = phpbb.plupload.uploader.settings.multipart_params; for (var key in obj) { if (!obj.hasOwnProperty(key) || key.indexOf('attachment_data[') !== 0) { continue; } - delete uploader.settings.multipart_params[key]; + delete phpbb.plupload.uploader.settings.multipart_params[key]; } }; /** * Update uploader.settings.multipart_params object with new data. * - * @param object obj - * @return undefined + * @param {object} obj */ phpbb.plupload.updateMultipartParams = function(obj) { - uploader.settings.multipart_params = $.extend( - uploader.settings.multipart_params, - obj - ); + var settings = phpbb.plupload.uploader.settings; + settings.multipart_params = $.extend(settings.multipart_params, obj); }; /** * Convert the array of attachment objects into an object that PHP would expect as POST data. * - * @return object An object in the form 'attachment_data[i][key]': value as + * @returns {object} An object in the form 'attachment_data[i][key]': value as * expected by the server */ phpbb.plupload.getSerializedData = function() { @@ -92,22 +95,19 @@ phpbb.plupload.getSerializedData = function() { * Get the index from the phpbb.plupload.data array where the given * attachment id appears. * - * @param int attach_id The attachment id of the file. - * @return bool Returns false if the id cannot be found. - * @return int Returns the index of the file if it exists. + * @param {int} attachId The attachment id of the file. + * @returns {bool|int} Index of the file if exists, otherwise false. */ -phpbb.plupload.getIndex = function(attach_id) { - var index = $.inArray(Number(attach_id), phpbb.plupload.ids); +phpbb.plupload.getIndex = function(attachId) { + var index = $.inArray(Number(attachId), phpbb.plupload.ids); return (index !== -1) ? index : false; }; /** * Set the data in phpbb.plupload.data and phpbb.plupload.ids arrays. - * - * @param array data Array containing the new data to use. In the form of - * array(index => object(property: value). Requires attach_id to be one of the object properties. * - * @return undefined + * @param {Array} data Array containing the new data to use. In the form of + * array(index => object(property: value). Requires attach_id to be one of the object properties. */ phpbb.plupload.setData = function(data) { // Make sure that the array keys are reset. @@ -121,12 +121,11 @@ phpbb.plupload.setData = function(data) { /** * Update the attachment data in the HTML and the phpbb & phpbb.plupload objects. - * - * @param array data Array containing the new data to use. - * @param string action The action that required the update. Used to update the inline attachment bbcodes. - * @param int index The index from phpbb.plupload_ids that was affected by the action. - * @param array downloadUrl Optional array of download urls to update. - * @return undefined + * + * @param {Array} data Array containing the new data to use. + * @param {string} action The action that required the update. Used to update the inline attachment bbcodes. + * @param {int} index The index from phpbb.plupload_ids that was affected by the action. + * @param {Array} downloadUrl Optional array of download urls to update. */ phpbb.plupload.update = function(data, action, index, downloadUrl) { @@ -139,9 +138,8 @@ phpbb.plupload.update = function(data, action, index, downloadUrl) { /** * Update the relevant elements and hidden data for all attachments. - * - * @param array downloadUrl Optional array of download urls to update. - * @return undefined + * + * @param {Array} downloadUrl Optional array of download urls to update. */ phpbb.plupload.updateRows = function(downloadUrl) { for (var i = 0; i < phpbb.plupload.ids.length; i++) { @@ -154,9 +152,8 @@ phpbb.plupload.updateRows = function(downloadUrl) { * using the id "attach-row-tpl" to be present. This snippet is cloned and the * data for the file inserted into it. The row is then appended or prepended to * #file-list based on the attach_order setting. - * - * @param object file Plupload file object for the new attachment. - * @return undefined + * + * @param {object} file Plupload file object for the new attachment. */ phpbb.plupload.insertRow = function(file) { var row = $(phpbb.plupload.rowTpl); @@ -165,7 +162,7 @@ phpbb.plupload.insertRow = function(file) { row.find('.file-name').html(plupload.xmlEncode(file.name)); row.find('.file-size').html(plupload.formatSize(file.size)); - if (phpbb.plupload.order == 'desc') { + if (phpbb.plupload.order === 'desc') { $('#file-list').prepend(row); } else { $('#file-list').append(row); @@ -174,10 +171,9 @@ phpbb.plupload.insertRow = function(file) { /** * Update the relevant elements and hidden data for an attachment. - * - * @param int index The index from phpbb.plupload.ids of the attachment to edit. - * @param array downloadUrl Optional array of download urls to update. - * @return undefined + * + * @param {int} index The index from phpbb.plupload.ids of the attachment to edit. + * @param {Array} downloadUrl Optional array of download urls to update. */ phpbb.plupload.updateRow = function(index, downloadUrl) { var attach = phpbb.plupload.data[index], @@ -189,7 +185,7 @@ phpbb.plupload.updateRow = function(index, downloadUrl) { link = $('<a></a>'); link.attr('href', url).html(attach.real_filename); - row.find('.file-name').html(link) + row.find('.file-name').html(link); } row.find('textarea').attr('name', 'comment_list[' + index + ']'); @@ -199,18 +195,21 @@ phpbb.plupload.updateRow = function(index, downloadUrl) { /** * Update hidden input data for an attachment. * - * @param object row jQuery object for the attachment row. - * @param object attach Attachment data object from phpbb.plupload.data - * @param int index Attachment index from phpbb.plupload.ids - * @return undefined + * @param {object} row jQuery object for the attachment row. + * @param {object} attach Attachment data object from phpbb.plupload.data + * @param {int} index Attachment index from phpbb.plupload.ids */ phpbb.plupload.updateHiddenData = function(row, attach, index) { row.find('input[type="hidden"]').remove(); for (var key in attach) { + if (!attach.hasOwnProperty(key)) { + return; + } + var input = $('<input />') .attr('type', 'hidden') - .attr('name', 'attachment_data[' + index + '][' + key +']') + .attr('name', 'attachment_data[' + index + '][' + key + ']') .attr('value', attach[key]); $('textarea', row).after(input); } @@ -222,16 +221,14 @@ phpbb.plupload.updateHiddenData = function(row, attach, index) { * responds with the updated attachment data list so that any future * uploads can maintain state with the server * - * @param object row jQuery object for the attachment row. - * @param int attachId Attachment id of the file to be removed. - * - * @return undefined + * @param {object} row jQuery object for the attachment row. + * @param {int} attachId Attachment id of the file to be removed. */ phpbb.plupload.deleteFile = function(row, attachId) { // If there's no attach id, then the file hasn't been uploaded. Simply delete the row. if (typeof attachId === 'undefined') { - var file = uploader.getFile(row.attr('id')); - uploader.removeFile(file); + var file = phpbb.plupload.uploader.getFile(row.attr('id')); + phpbb.plupload.uploader.removeFile(file); row.slideUp(100, function() { row.remove(); @@ -253,16 +250,13 @@ phpbb.plupload.deleteFile = function(row, attachId) { }; var done = function(response) { - var json = {}; - try { - json = $.parseJSON(response); - } catch (e) { + if (typeof response !== 'object') { return; } // trigger_error() was called which likely means a permission error was encountered. if (typeof response.title !== 'undefined') { - uploader.trigger('Error', {message: response.message}); + phpbb.plupload.uploader.trigger('Error', { message: response.message }); // We will have to assume that the deletion failed. So leave the file status as uploaded. row.find('.file-status').toggleClass('file-uploaded'); @@ -273,21 +267,21 @@ phpbb.plupload.deleteFile = function(row, attachId) { phpbb.plupload.handleMaxFilesReached(); if (row.attr('id')) { - var file = uploader.getFile(row.attr('id')); - uploader.removeFile(file); + var file = phpbb.plupload.uploader.getFile(row.attr('id')); + phpbb.plupload.uploader.removeFile(file); } row.slideUp(100, function() { row.remove(); // Hide the file list if it's empty now. phpbb.plupload.hideEmptyList(); }); - uploader.trigger('FilesRemoved'); + phpbb.plupload.uploader.trigger('FilesRemoved'); }; $.ajax(phpbb.plupload.config.url, { type: 'POST', data: $.extend(fields, phpbb.plupload.getSerializedData()), - headers: {'X-PHPBB-USING-PLUPLOAD': '1', 'X-Requested-With': 'XMLHttpRequest'} + headers: phpbb.plupload.config.headers }) .always(always) .done(done); @@ -295,25 +289,21 @@ phpbb.plupload.deleteFile = function(row, attachId) { /** * Check the attachment list and hide its container if it's empty. - * - * @return undefined */ phpbb.plupload.hideEmptyList = function() { if (!$('#file-list').children().length) { $('#file-list-container').slideUp(100); } -} +}; /** - * Update the indices used in inline attachment bbcodes. This ensures that the bbcodes - * correspond to the correct file after a file is added or removed. This should be called - * before the phpbb.plupload,data and phpbb.plupload.ids arrays are updated, otherwise it will - * not work correctly. + * Update the indices used in inline attachment bbcodes. This ensures that the + * bbcodes correspond to the correct file after a file is added or removed. + * This should be called before the phpbb.plupload,data and phpbb.plupload.ids + * arrays are updated, otherwise it will not work correctly. * - * @param string action The action that occurred -- either "addition" or "removal" - * @param int index The index of the attachment from phpbb.plupload.ids that was affected. - * - * @return undefined + * @param {string} action The action that occurred -- either "addition" or "removal" + * @param {int} index The index of the attachment from phpbb.plupload.ids that was affected. */ phpbb.plupload.updateBbcode = function(action, index) { var textarea = $('#message', phpbb.plupload.form), @@ -325,64 +315,59 @@ phpbb.plupload.updateBbcode = function(action, index) { return; } - // Private function used to replace the bbcode. - var updateBbcode = function(match, fileName) { - // Remove the bbcode if the file was removed. - if (removal && index === i) { - return ''; - } - var newIndex = i + ((removal) ? -1 : 1); - return '[attachment=' + newIndex +']' + fileName + '[/attachment]'; - }; - - // Private function used to generate search regexp - var searchRegexp = function(index) { - return new RegExp('\\[attachment=' + index + '\\](.*?)\\[\\/attachment\\]', 'g'); + function runUpdate(i) { + var regex = new RegExp('\\[attachment=' + i + '\\](.*?)\\[\\/attachment\\]', 'g'); + text = text.replace(regex, function updateBbcode(_, fileName) { + // Remove the bbcode if the file was removed. + if (removal && index === i) { + return ''; + } + var newIndex = i + ((removal) ? -1 : 1); + return '[attachment=' + newIndex + ']' + fileName + '[/attachment]'; + }); } - // The update order of the indices is based on the action taken to ensure that we don't corrupt - // the bbcode index by updating it several times as we move through the loop. - // Removal loop starts at the removed index and moves to the end of the array. - // Addition loop starts at the end of the array and moves to the added index at 0. - var searchLoop = function() { - if (typeof i === 'undefined') { - i = (removal) ? index : phpbb.plupload.ids.length - 1; + + // Loop forwards when removing and backwards when adding ensures we don't + // corrupt the bbcode index. + var i; + if (removal) { + for (i = index; i < phpbb.plupload.ids.length; i++) { + runUpdate(i); + } + } else { + for (i = phpbb.plupload.ids.length - 1; i >= index; i--) { + runUpdate(i); } - return (removal) ? (i < phpbb.plupload.ids.length): (i >= index); } - var i; - while (searchLoop()) { - text = text.replace(searchRegexp(i), updateBbcode); - (removal) ? i++ : i--; - } textarea.val(text); }; /** * Get Plupload file objects based on their upload status. * - * @param int status Plupload status - plupload.DONE, plupload.FAILED, plupload.QUEUED, - * plupload.STARTED, plupload.STOPPED + * @param {int} status Plupload status - plupload.DONE, plupload.FAILED, + * plupload.QUEUED, plupload.STARTED, plupload.STOPPED * - * @return Returns an array of the Plupload file objects matching the status. + * @returns {Array} The Plupload file objects matching the status. */ phpbb.plupload.getFilesByStatus = function(status) { var files = []; - $.each(uploader.files, function(i, file) { + $.each(phpbb.plupload.uploader.files, function(i, file) { if (file.status === status) { files.push(file); } }); return files; -} +}; /** * Check whether the user has reached the maximun number of files that he's allowed * to upload. If so, disables the uploader and marks the queued files as failed. Otherwise * makes sure that the uploader is enabled. * - * @return bool Returns true if the limit has been reached. False if otherwise. + * @returns {bool} True if the limit has been reached. False if otherwise. */ phpbb.plupload.handleMaxFilesReached = function() { // If there is no limit, the user is an admin or moderator. @@ -395,41 +380,36 @@ phpbb.plupload.handleMaxFilesReached = function() { phpbb.plupload.markQueuedFailed(phpbb.plupload.lang.TOO_MANY_ATTACHMENTS); // Disable the uploader. phpbb.plupload.disableUploader(); - uploader.trigger('Error', {message: phpbb.plupload.lang.TOO_MANY_ATTACHMENTS}); + phpbb.plupload.uploader.trigger('Error', { message: phpbb.plupload.lang.TOO_MANY_ATTACHMENTS }); return true; - } else if(phpbb.plupload.maxFiles > phpbb.plupload.ids.length) { + } else if (phpbb.plupload.maxFiles > phpbb.plupload.ids.length) { // Enable the uploader if the user is under the limit phpbb.plupload.enableUploader(); } return false; -} +}; /** * Disable the uploader - * - * @return undefined */ phpbb.plupload.disableUploader = function() { $('#add_files').addClass('disabled'); - uploader.disableBrowse(); -} + phpbb.plupload.uploader.disableBrowse(); +}; /** * Enable the uploader - * - * @return undefined */ phpbb.plupload.enableUploader = function() { $('#add_files').removeClass('disabled'); - uploader.disableBrowse(false); -} + phpbb.plupload.uploader.disableBrowse(false); +}; /** * Mark all queued files as failed. * - * @param string error Error message to present to the user. - * @return undefined + * @param {string} error Error message to present to the user. */ phpbb.plupload.markQueuedFailed = function(error) { var files = phpbb.plupload.getFilesByStatus(plupload.QUEUED); @@ -438,48 +418,49 @@ phpbb.plupload.markQueuedFailed = function(error) { $('#' + file.id).find('.file-progress').hide(); phpbb.plupload.fileError(file, error); }); -} +}; /** * Marks a file as failed and sets the error message for it. * - * @param object file Plupload file object that failed. - * @param string error Error message to present to the user. - * @return undefined + * @param {object} file Plupload file object that failed. + * @param {string} error Error message to present to the user. */ phpbb.plupload.fileError = function(file, error) { file.status = plupload.FAILED; file.error = error; - $('#' + file.id).find('.file-status').addClass('file-error').attr({'data-error-title': phpbb.plupload.lang.ERROR, 'data-error-message': error}); -} - - + $('#' + file.id).find('.file-status') + .addClass('file-error') + .attr({ + 'data-error-title': phpbb.plupload.lang.ERROR, + 'data-error-message': error + }); +}; /** * Set up the Plupload object and get some basic data. */ -var uploader = new plupload.Uploader(phpbb.plupload.config); +phpbb.plupload.uploader = new plupload.Uploader(phpbb.plupload.config); phpbb.plupload.initialize(); - - +var $fileList = $('#file-list'); /** * Insert inline attachment bbcode. */ - $('#file-list').on('click', '.file-inline-bbcode', function(e) { +$fileList.on('click', '.file-inline-bbcode', function(e) { var attachId = $(this).parents('.attach-row').attr('data-attach-id'), index = phpbb.plupload.getIndex(attachId); - attach_inline(index, phpbb.plupload.data[index].real_filename); + attachInline(index, phpbb.plupload.data[index].real_filename); e.preventDefault(); }); /** * Delete a file. */ -$('#file-list').on('click', '.file-delete', function(e) { +$fileList.on('click', '.file-delete', function(e) { var row = $(this).parents('.attach-row'), attachId = row.attr('data-attach-id'); @@ -490,7 +471,7 @@ $('#file-list').on('click', '.file-delete', function(e) { /** * Display the error message for a particular file when the error icon is clicked. */ -$('#file-list').on('click', '.file-error', function(e) { +$fileList.on('click', '.file-error', function(e) { phpbb.alert($(this).attr('data-error-title'), $(this).attr('data-error-message')); e.preventDefault(); }); @@ -498,7 +479,7 @@ $('#file-list').on('click', '.file-error', function(e) { /** * Fires when an error occurs. */ -uploader.bind('Error', function(up, error) { +phpbb.plupload.uploader.bind('Error', function(up, error) { error.file.name = plupload.xmlEncode(error.file.name); // The error message that Plupload provides for these is vague, so we'll be more specific. @@ -515,18 +496,15 @@ uploader.bind('Error', function(up, error) { * send the real filename along with the chunk. This is necessary because * for some reason the filename is set to 'blob' whenever a file is chunked * - * @param object up The plupload.Uploader object - * @param object file The plupload.File object that is about to be - * uploaded - * - * @return undefined + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object that is about to be uploaded */ -uploader.bind('BeforeUpload', function(up, file) { +phpbb.plupload.uploader.bind('BeforeUpload', function(up, file) { if (phpbb.plupload.handleMaxFilesReached()) { return; } - phpbb.plupload.updateMultipartParams({'real_filename': file.name}); + phpbb.plupload.updateMultipartParams({ real_filename: file.name }); }); /** @@ -534,14 +512,12 @@ uploader.bind('BeforeUpload', function(up, file) { * response from the server and checks for an error. If an error occurs it * is reported to the user and the upload of this particular file is halted * - * @param object up The plupload.Uploader object - * @param object file The plupload.File object whose chunk has just + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object whose chunk has just * been uploaded - * @param object response The response object from the server - * - * @return undefined + * @param {object} response The response object from the server */ -uploader.bind('ChunkUploaded', function(up, file, response) { +phpbb.plupload.uploader.bind('ChunkUploaded', function(up, file, response) { if (response.chunk >= response.chunks - 1) { return; } @@ -562,7 +538,7 @@ uploader.bind('ChunkUploaded', function(up, file, response) { // If trigger_error() was called, then a permission error likely occurred. if (typeof json.title !== 'undefined') { - json.error = {message: json.message}; + json.error = { message: json.message }; } if (json.error) { @@ -579,19 +555,23 @@ uploader.bind('ChunkUploaded', function(up, file, response) { /** * Fires when files are added to the queue. - * - * @return undefined */ -uploader.bind('FilesAdded', function(up, files) { +phpbb.plupload.uploader.bind('FilesAdded', function(up, files) { // Prevent unnecessary requests to the server if the user already uploaded // the maximum number of files allowed. if (phpbb.plupload.handleMaxFilesReached()) { return; } + // Switch the active tab if the style supports it + if (typeof activateSubPanel === 'function') { + activateSubPanel('attach-panel'); // jshint ignore: line + } + // Show the file list if there aren't any files currently. - if (!$('#file-list-container').is(':visible')) { - $('#file-list-container').show(100); + var $fileListContainer = $('#file-list-container'); + if (!$fileListContainer.is(':visible')) { + $fileListContainer.show(100); } $.each(files, function(i, file) { @@ -599,7 +579,7 @@ uploader.bind('FilesAdded', function(up, files) { }); up.bind('UploadProgress', function(up, file) { - $('#' + file.id + " .file-progress-bar").css('width', file.percent + '%'); + $('.file-progress-bar', '#' + file.id).css('width', file.percent + '%'); $('#file-total-progress-bar').css('width', up.total.percent + '%'); }); @@ -617,14 +597,12 @@ uploader.bind('FilesAdded', function(up, files) { * appends it to the next file upload so that the server can maintain state * with regards to the attachments in a given post * - * @param object up The plupload.Uploader object - * @param object file The plupload.File object that has just been + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object that has just been * uploaded - * @param string response The response string from the server - * - * @return undefined + * @param {string} response The response string from the server */ -uploader.bind('FileUploaded', function(up, file, response) { +phpbb.plupload.uploader.bind('FileUploaded', function(up, file, response) { var json = {}, row = $('#' + file.id), error; @@ -633,7 +611,7 @@ uploader.bind('FileUploaded', function(up, file, response) { row.find('.file-progress').hide(); try { - json = $.parseJSON(response.response); + json = JSON.parse(response.response); } catch (e) { error = 'Error parsing server response.'; } @@ -641,7 +619,7 @@ uploader.bind('FileUploaded', function(up, file, response) { // If trigger_error() was called, then a permission error likely occurred. if (typeof json.title !== 'undefined') { error = json.message; - up.trigger('Error', {message: error}); + up.trigger('Error', { message: error }); // The rest of the queue will fail. phpbb.plupload.markQueuedFailed(error); @@ -652,25 +630,19 @@ uploader.bind('FileUploaded', function(up, file, response) { if (typeof error !== 'undefined') { phpbb.plupload.fileError(file, error); } else if (file.status === plupload.DONE) { - file.attachment_data = json['data'][0]; + file.attachment_data = json.data[0]; row.attr('data-attach-id', file.attachment_data.attach_id); row.find('.file-inline-bbcode').show(); row.find('.file-status').addClass('file-uploaded'); - phpbb.plupload.update(json['data'], 'addition', 0, [json['download_url']]); + phpbb.plupload.update(json.data, 'addition', 0, [json.download_url]); } }); /** - * Fires when the entire queue of files have been uploaded. - * - * @param object up The plupload.Uploader object - * @param array files An array of plupload.File objects that have just - * been uploaded as part of a queue - * - * @return undefined + * Fires when the entire queue of files have been uploaded. */ -uploader.bind('UploadComplete', function(up, files) { +phpbb.plupload.uploader.bind('UploadComplete', function() { // Hide the progress bar setTimeout(function() { $('#file-total-progress-bar').fadeOut(500, function() { diff --git a/phpBB/assets/plupload/plupload.full.min.js b/phpBB/assets/plupload/plupload.full.min.js index 69d6ad120c..2af434de4f 100644 --- a/phpBB/assets/plupload/plupload.full.min.js +++ b/phpBB/assets/plupload/plupload.full.min.js @@ -1,6 +1,6 @@ /** * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill - * v1.2.0 + * v1.3.4 * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. @@ -8,14 +8,15 @@ * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * - * Date: 2014-01-16 + * Date: 2015-07-18 */ -!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r<e.length;++r){if(n=s[e[r]]||o(e[r]),!n)throw"module definition dependecy not found: "+e[r];i.push(n)}t.apply(null,i)}function i(e,i,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(i===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";n(i,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var n=e,i=t.split(/[.\/]/),r=0;r<i.length;++r){if(!n[i[r]])return;n=n[i[r]]}return n}function a(n){for(var i=0;i<n.length;i++){for(var r=e,o=n[i],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={},u="moxie/core/utils/Basic",c="moxie/core/I18n",l="moxie/core/utils/Mime",d="moxie/core/utils/Env",f="moxie/core/utils/Dom",p="moxie/core/Exceptions",h="moxie/core/EventTarget",m="moxie/core/utils/Encode",g="moxie/runtime/Runtime",v="moxie/runtime/RuntimeClient",y="moxie/file/Blob",w="moxie/file/File",E="moxie/file/FileInput",_="moxie/file/FileDrop",x="moxie/runtime/RuntimeTarget",R="moxie/file/FileReader",b="moxie/core/utils/Url",T="moxie/file/FileReaderSync",S="moxie/xhr/FormData",A="moxie/xhr/XMLHttpRequest",O="moxie/runtime/Transporter",I="moxie/image/Image",D="moxie/runtime/html5/Runtime",N="moxie/runtime/html5/file/Blob",L="moxie/core/utils/Events",M="moxie/runtime/html5/file/FileInput",C="moxie/runtime/html5/file/FileDrop",F="moxie/runtime/html5/file/FileReader",H="moxie/runtime/html5/xhr/XMLHttpRequest",P="moxie/runtime/html5/utils/BinaryReader",k="moxie/runtime/html5/image/JPEGHeaders",U="moxie/runtime/html5/image/ExifParser",B="moxie/runtime/html5/image/JPEG",z="moxie/runtime/html5/image/PNG",G="moxie/runtime/html5/image/ImageInfo",q="moxie/runtime/html5/image/MegaPixel",X="moxie/runtime/html5/image/Image",j="moxie/runtime/flash/Runtime",V="moxie/runtime/flash/file/Blob",W="moxie/runtime/flash/file/FileInput",Y="moxie/runtime/flash/file/FileReader",$="moxie/runtime/flash/file/FileReaderSync",J="moxie/runtime/flash/xhr/XMLHttpRequest",Z="moxie/runtime/flash/runtime/Transporter",K="moxie/runtime/flash/image/Image",Q="moxie/runtime/silverlight/Runtime",et="moxie/runtime/silverlight/file/Blob",tt="moxie/runtime/silverlight/file/FileInput",nt="moxie/runtime/silverlight/file/FileDrop",it="moxie/runtime/silverlight/file/FileReader",rt="moxie/runtime/silverlight/file/FileReaderSync",ot="moxie/runtime/silverlight/xhr/XMLHttpRequest",at="moxie/runtime/silverlight/runtime/Transporter",st="moxie/runtime/silverlight/image/Image",ut="moxie/runtime/html4/Runtime",ct="moxie/runtime/html4/file/FileInput",lt="moxie/runtime/html4/file/FileReader",dt="moxie/runtime/html4/xhr/XMLHttpRequest",ft="moxie/runtime/html4/image/Image";i(u,[],function(){var e=function(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},t=function(i){var r;return n(arguments,function(o,s){s>0&&n(o,function(n,o){n!==r&&(e(i[o])===e(n)&&~a(e(n),["array","object"])?t(i[o],n):i[o]=n)})}),i},n=function(e,t){var n,i,r,o;if(e){try{n=e.length}catch(a){n=o}if(n===o){for(i in e)if(e.hasOwnProperty(i)&&t(e[i],i)===!1)return}else for(r=0;n>r;r++)if(t(e[r],r)===!1)return}},i=function(t){var n;if(!t||"object"!==e(t))return!0;for(n in t)return!1;return!0},r=function(t,n){function i(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?i(r):n(e)})}var r=0,o=t.length;"function"!==e(n)&&(n=function(){}),t&&t.length||n(),i(r)},o=function(e,t){var i=0,r=e.length,o=new Array(r);n(e,function(e,n){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),o[n]=a,i++,i===r&&(o.unshift(null),t.apply(this,o))})})},a=function(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return n}return-1},s=function(t,n){var i=[];"array"!==e(t)&&(t=[t]),"array"!==e(n)&&(n=[n]);for(var r in t)-1===a(t[r],n)&&i.push(t[r]);return i.length?i:!1},u=function(e,t){var i=[];return n(e,function(e){-1!==a(e,t)&&i.push(e)}),i.length?i:null},c=function(e){var t,n=[];for(t=0;t<e.length;t++)n[t]=e[t];return n},l=function(){var e=0;return function(t){var n=(new Date).getTime().toString(32),i;for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}(),d=function(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e},f=function(e){if("string"!=typeof e)return e;var t={t:1099511627776,g:1073741824,m:1048576,k:1024},n;return e=/^([0-9]+)([mgk]?)$/.exec(e.toLowerCase().replace(/[^0-9mkg]/g,"")),n=e[2],e=+e[1],t.hasOwnProperty(n)&&(e*=t[n]),e};return{guid:l,typeOf:e,extend:t,each:n,isEmptyObj:i,inSeries:r,inParallel:o,inArray:a,arrayDiff:s,arrayIntersect:u,toArray:c,trim:d,parseSizeStr:f}}),i(c,[u],function(e){var t={};return{addI18n:function(n){return e.extend(t,n)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var n=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=n.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),i(l,[u,c],function(e,t){var n="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",i={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,i,r;for(n=0;n<t.length;n+=2){for(r=t[n+1].split(/ /),i=0;i<r.length;i++)this.mimes[r[i]]=t[n];this.extensions[t[n]]=r}},extList2mimes:function(t,n){var i=this,r,o,a,s,u=[];for(o=0;o<t.length;o++)for(r=t[o].extensions.split(/\s*,\s*/),a=0;a<r.length;a++){if("*"===r[a])return[];if(s=i.mimes[r[a]])-1===e.inArray(s,u)&&u.push(s);else{if(!n||!/^\w+$/.test(r[a]))return[];u.push("."+r[a])}}return u},mimes2exts:function(t){var n=this,i=[];return e.each(t,function(t){if("*"===t)return i=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(n.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(i,n.extensions[t])}):n.extensions[t]&&[].push.apply(i,n.extensions[t]))}),i},mimes2extList:function(n){var i=[],r=[];return"string"===e.typeOf(n)&&(n=e.trim(n).split(/\s*,\s*/)),r=this.mimes2exts(n),i.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),i.mimes=n,i},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return i.addMimeType(n),i}),i(d,[u],function(e){function t(e,t,n){var i=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),i=0;r>i;i++)if(e[i]!=t[i]){if(e[i]=u(e[i]),t[i]=u(t[i]),e[i]<t[i]){o=-1;break}if(e[i]>t[i]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",n="?",i="function",r="undefined",o="object",a="major",s="model",u="name",c="type",l="vendor",d="version",f="architecture",p="console",h="mobile",m="tablet",g={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},v={rgx:function(){for(var t,n=0,a,s,u,c,l,d,f=arguments;n<f.length;n+=2){var p=f[n],h=f[n+1];if(typeof t===r){t={};for(u in h)c=h[u],typeof c===o?t[c[0]]=e:t[c]=e}for(a=s=0;a<p.length;a++)if(l=p[a].exec(this.getUA())){for(u=0;u<h.length;u++)d=l[++s],c=h[u],typeof c===o&&c.length>0?2==c.length?t[c[0]]=typeof c[1]==i?c[1].call(this,d):c[1]:3==c.length?t[c[0]]=typeof c[1]!==i||c[1].exec&&c[1].test?d?d.replace(c[1],c[2]):e:d?c[1].call(this,d,c[2]):e:4==c.length&&(t[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):e):t[c]=d?d:e;break}if(l)break}return t},str:function(t,i){for(var r in i)if(typeof i[r]===o&&i[r].length>0){for(var a=0;a<i[r].length;a++)if(g.has(i[r][a],t))return r===n?e:r}else if(g.has(i[r],t))return r===n?e:r;return t}},y={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},w={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i],[u,d,a],[/\s(opr)\/((\d+)?[\w\.]+)/i],[[u,"Opera"],d,a],[/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i,/(rekonq)((?:\/)[\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i],[u,d,a],[/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i],[[u,"IE"],d,a],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[[u,"Yandex"],d,a],[/(comodo_dragon)\/((\d+)?[\w\.]+)/i],[[u,/_/g," "],d,a],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],[u,d,a],[/(dolfin)\/((\d+)?[\w\.]+)/i],[[u,"Dolphin"],d,a],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[[u,"Chrome"],d,a],[/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i],[[u,"Android Browser"],d,a],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],[d,a,[u,"Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],[d,a,u],[/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],[u,[a,v.str,y.browser.oldsafari.major],[d,v.str,y.browser.oldsafari.version]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(webkit|khtml)\/((\d+)?[\w\.]+)/i],[u,d,a],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[[u,"Netscape"],d,a],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,/(links)\s\(((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],[u,d,a]],engine:[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,d],[/rv\:([\w\.]+).*(gecko)/i],[d,u]],os:[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[d,v.str,y.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[d,v.str,y.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],d],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],[u,d],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[u,"Symbian"],d],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],d],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[u,d],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],d],[/(sunos)\s?([\w\.]+\d)*/i],[[u,"Solaris"],d],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[u,d],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[u,"iOS"],[d,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],[u,[d,/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,/(unix)\s?([\w\.]+)*/i],[u,d]]},E=function(e){var n=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return v.rgx.apply(this,w.browser)},this.getEngine=function(){return v.rgx.apply(this,w.engine)},this.getOS=function(){return v.rgx.apply(this,w.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this.setUA(n)};return(new E).getResult()}(),i=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var n=new XMLHttpRequest;if(n.open("get","/"),"responseType"in n)return n.responseType=t,n.responseType!==t?!1:!0}}catch(i){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==r.browser||r.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(n){var i=[].slice.call(arguments);return i.shift(),"function"===e.typeOf(t[n])?t[n].apply(this,i):!!t[n]}}(),r={can:i,browser:n.browser.name,version:parseFloat(n.browser.major),os:n.os.name,osVersion:n.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return r.OS=r.os,r}),i(f,[d],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},n=function(e,t){if(!e.className)return!1;var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return n.test(e.className)},i=function(e,t){n(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return" "===t&&" "===n?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,n){function i(e){var t,n,i=0,r=0;return e&&(n=e.getBoundingClientRect(),t="CSS1Compat"===s.compatMode?s.documentElement:s.body,i=n.left+t.scrollLeft,r=n.top+t.scrollTop),{x:i,y:r}}var r=0,o=0,a,s=document,u,c;if(t=t,n=n||s.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!s.documentMode||s.documentMode<8))return u=i(t),c=i(n),{x:u.x-c.x,y:u.y-c.y};for(a=t;a&&a!=n&&a.nodeType;)r+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=t.parentNode;a&&a!=n&&a.nodeType;)r-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode;return{x:r,y:o}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:i,removeClass:r,getStyle:o,getPos:a,getSize:s}}),i(p,[u],function(e){function t(e,t){var n;for(n in e)if(e[n]===t)return n;return null}return{RuntimeError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": RuntimeError "+this.code}var i={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(n,i),n.prototype=Error.prototype,n}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": ImageError "+this.code}var i={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2};return e.extend(n,i),n.prototype=Error.prototype,n}(),FileException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": FileException "+this.code}var i={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(n,i),n.prototype=Error.prototype,n}(),DOMException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": DOMException "+this.code}var i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(n,i),n.prototype=Error.prototype,n}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),i(h,[p,u],function(e,t){function n(){var n={};t.extend(this,{uid:null,init:function(){this.uid||(this.uid=t.guid("uid_"))},addEventListener:function(e,i,r,o){var a=this,s;return e=t.trim(e),/\s/.test(e)?(t.each(e.split(/\s+/),function(e){a.addEventListener(e,i,r,o)}),void 0):(e=e.toLowerCase(),r=parseInt(r,10)||0,s=n[this.uid]&&n[this.uid][e]||[],s.push({fn:i,priority:r,scope:o||this}),n[this.uid]||(n[this.uid]={}),n[this.uid][e]=s,void 0)},hasEventListener:function(e){return e?!(!n[this.uid]||!n[this.uid][e]):!!n[this.uid]},removeEventListener:function(e,i){e=e.toLowerCase();var r=n[this.uid]&&n[this.uid][e],o;if(r){if(i){for(o=r.length-1;o>=0;o--)if(r[o].fn===i){r.splice(o,1);break}}else r=[];r.length||(delete n[this.uid][e],t.isEmptyObj(n[this.uid])&&delete n[this.uid])}},removeAllEventListeners:function(){n[this.uid]&&delete n[this.uid]},dispatchEvent:function(i){var r,o,a,s,u={},c=!0,l;if("string"!==t.typeOf(i)){if(s=i,"string"!==t.typeOf(s.type))throw new e.EventException(e.EventException.UNSPECIFIED_EVENT_TYPE_ERR);i=s.type,s.total!==l&&s.loaded!==l&&(u.total=s.total,u.loaded=s.loaded),u.async=s.async||!1}if(-1!==i.indexOf("::")?function(e){r=e[0],i=e[1]}(i.split("::")):r=this.uid,i=i.toLowerCase(),o=n[r]&&n[r][i]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),u.type=i,a.unshift(u);var d=[];t.each(o,function(e){a[0].target=e.scope,u.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&t.inSeries(d,function(e){c=!e})}return c},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},convertEventPropsToHandlers:function(e){var n;"array"!==t.typeOf(e)&&(e=[e]);for(var i=0;i<e.length;i++)n="on"+e[i],"function"===t.typeOf(this[n])?this.addEventListener(e[i],this[n]):"undefined"===t.typeOf(this[n])&&(this[n]=null)}})}return n.instance=new n,n}),i(m,[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},n=function(e,n){if("function"==typeof window.atob)return n?t(window.atob(e)):window.atob(e);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!e)return e;e+="";do s=i.indexOf(e.charAt(f++)),u=i.indexOf(e.charAt(f++)),c=i.indexOf(e.charAt(f++)),l=i.indexOf(e.charAt(f++)),d=s<<18|u<<12|c<<6|l,r=255&d>>16,o=255&d>>8,a=255&d,m[p++]=64==c?String.fromCharCode(r):64==l?String.fromCharCode(r,o):String.fromCharCode(r,o,a);while(f<e.length);return h=m.join(""),n?t(h):h},i=function(t,n){if(n&&e(t),"function"==typeof window.btoa)return window.btoa(t);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!t)return t;do r=t.charCodeAt(f++),o=t.charCodeAt(f++),a=t.charCodeAt(f++),d=r<<16|o<<8|a,s=63&d>>18,u=63&d>>12,c=63&d>>6,l=63&d,m[p++]=i.charAt(s)+i.charAt(u)+i.charAt(c)+i.charAt(l);while(f<t.length);h=m.join("");var g=t.length%3;return(g?h.slice(0,g-3):h)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:n,btoa:i}}),i(g,[u,f,h],function(e,t,n){function i(n,r,a,s,u){var c=this,l,d=e.guid(r+"_"),f=u||"browser";n=n||{},o[d]=this,a=e.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},a),n.preferred_caps&&(f=i.getMode(s,n.preferred_caps,f)),l=function(){var t={};return{exec:function(e,n,i,r){return l[n]&&(t[e]||(t[e]={context:this,instance:new l[n]}),t[e].instance[i])?t[e].instance[i].apply(this,r):void 0},removeInstance:function(e){delete t[e]},removeAllInstances:function(){var n=this;e.each(t,function(t,i){"function"===e.typeOf(t.instance.destroy)&&t.instance.destroy.call(t.context),n.removeInstance(i)})}}}(),e.extend(this,{initialized:!1,uid:d,type:r,mode:i.getMode(s,n.required_caps,f),shimid:d+"_container",clients:0,options:n,can:function(t,n){var r=arguments[2]||a;if("string"===e.typeOf(t)&&"undefined"===e.typeOf(n)&&(t=i.parseCaps(t)),"object"===e.typeOf(t)){for(var o in t)if(!this.can(o,t[o],r))return!1;return!0}return"function"===e.typeOf(r[t])?r[t].call(this,n):n===r[t]},getShimContainer:function(){var n,i=t.get(this.shimid);return i||(n=this.options.container?t.get(this.options.container):document.body,i=document.createElement("div"),i.id=this.shimid,i.className="moxie-shim moxie-shim-"+this.type,e.extend(i.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),n.appendChild(i),n=null),i},getShim:function(){return l},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);return c[e]&&c[e][t]?c[e][t].apply(this,n):c.shimExec.apply(this,arguments)},destroy:function(){if(c){var e=t.get(this.shimid);e&&e.parentNode.removeChild(e),l&&l.removeAllInstances(),this.unbindAll(),delete o[this.uid],this.uid=null,d=c=l=e=null}}}),this.mode&&n.required_caps&&!this.can(n.required_caps)&&(this.mode=!1)}var r={},o={};return i.order="html5,flash,silverlight,html4",i.getRuntime=function(e){return o[e]?o[e]:!1},i.addConstructor=function(e,t){t.prototype=n.instance,r[e]=t},i.getConstructor=function(e){return r[e]||null},i.getInfo=function(e){var t=i.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},i.parseCaps=function(t){var n={};return"string"!==e.typeOf(t)?t||{}:(e.each(t.split(","),function(e){n[e]=!0}),n)},i.can=function(e,t){var n,r=i.getConstructor(e),o;return r?(n=new r({required_caps:t}),o=n.mode,n.destroy(),!!o):!1},i.thatCan=function(e,t){var n=(t||i.order).split(/\s*,\s*/);for(var r in n)if(i.can(n[r],e))return n[r];return null},i.getMode=function(t,n,i){var r=null;if("undefined"===e.typeOf(i)&&(i="browser"),n&&!e.isEmptyObj(t)){if(e.each(n,function(n,i){if(t.hasOwnProperty(i)){var o=t[i](n);if("string"==typeof o&&(o=[o]),r){if(!(r=e.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==e.inArray(i,r)?i:r[0];if(r===!1)return!1}return i},i.capTrue=function(){return!0},i.capFalse=function(){return!1},i.capTest=function(e){return function(){return!!e}},i}),i(v,[p,u,g],function(e,t,n){return function i(){var i;t.extend(this,{connectRuntime:function(r){function o(t){var s,u;return t.length?(s=t.shift(),(u=n.getConstructor(s))?(i=new u(r),i.bind("Init",function(){i.initialized=!0,setTimeout(function(){i.clients++,a.trigger("RuntimeInit",i)},1)}),i.bind("Error",function(){i.destroy(),o(t)}),i.mode?(i.init(),void 0):(i.trigger("Error"),void 0)):(o(t),void 0)):(a.trigger("RuntimeError",new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)),i=null,void 0)}var a=this,s;if("string"===t.typeOf(r)?s=r:"string"===t.typeOf(r.ruid)&&(s=r.ruid),s){if(i=n.getRuntime(s))return i.clients++,i;throw new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},getRuntime:function(){return i&&i.uid?i:(i=null,null)},disconnectRuntime:function(){i&&--i.clients<=0&&(i.destroy(),i=null)}})}}),i(y,[u,m,v],function(e,t,n){function i(o,a){function s(t,n,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new i(null,{type:o,size:n-t}),a.detach(s.substr(t,a.size)),a):null}n.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,n){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,n)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy",r[this.uid]),this.disconnectRuntime(),this.ruid=null),e=e||"";var n=e.match(/^data:([^;]*);base64,/);n&&(this.type=n[1],e=t.atob(e.substring(e.indexOf("base64,")+7))),this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return i}),i(w,[u,l,y],function(e,t,n){function i(i,r){var o,a;if(r||(r={}),a=r.type&&""!==r.type?r.type:t.getFileMime(r.name),r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else{var s=a.split("/")[0];o=e.guid((""!==s?s:"file")+"_"),t.extensions[a]&&(o+="."+t.extensions[a][0])}n.apply(this,arguments),e.extend(this,{type:a||"",name:o||e.guid("file_"),lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return i.prototype=n.prototype,i}),i(E,[u,l,f,p,h,c,w,g,v],function(e,t,n,i,r,o,a,s,u){function c(r){var c=this,d,f,p;if(-1!==e.inArray(e.typeOf(r),["string","node"])&&(r={browse_button:r}),f=n.get(r.browse_button),!f)throw new i.DOMException(i.DOMException.NOT_FOUND_ERR);p={accept:[{title:o.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:f.parentNode||document.body},r=e.extend({},p,r),"string"==typeof r.required_caps&&(r.required_caps=s.parseCaps(r.required_caps)),"string"==typeof r.accept&&(r.accept=t.mimes2extList(r.accept)),d=n.get(r.container),d||(d=document.body),"static"===n.getStyle(d,"position")&&(d.style.position="relative"),d=f=null,u.call(c),e.extend(c,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){c.convertEventPropsToHandlers(l),c.bind("RuntimeInit",function(t,i){c.ruid=i.uid,c.shimid=i.shimid,c.bind("Ready",function(){c.trigger("Refresh")},999),c.bind("Change",function(){var t=i.exec.call(c,"FileInput","getFiles");c.files=[],e.each(t,function(e){return 0===e.size?!0:(c.files.push(new a(c.ruid,e)),void 0)})},999),c.bind("Refresh",function(){var t,o,a,s;a=n.get(r.browse_button),s=n.get(i.shimid),a&&(t=n.getPos(a,n.get(r.container)),o=n.getSize(a),s&&e.extend(s.style,{top:t.y+"px",left:t.x+"px",width:o.w+"px",height:o.h+"px"})),s=a=null}),i.exec.call(c,"FileInput","init",r)}),c.connectRuntime(e.extend({},r,{required_caps:{select_file:!0}}))},disable:function(t){var n=this.getRuntime();n&&n.exec.call(this,"FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){c.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null}})}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=r.instance,c}),i(_,[c,f,p,u,w,v,h,l],function(e,t,n,i,r,o,a,s){function u(n){var a=this,u;"string"==typeof n&&(n={drop_zone:n}),u={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},n="object"==typeof n?i.extend({},u,n):u,n.container=t.get(n.drop_zone)||document.body,"static"===t.getStyle(n.container,"position")&&(n.container.style.position="relative"),"string"==typeof n.accept&&(n.accept=s.mimes2extList(n.accept)),o.call(a),i.extend(a,{uid:i.guid("uid_"),ruid:null,files:null,init:function(){a.convertEventPropsToHandlers(c),a.bind("RuntimeInit",function(e,t){a.ruid=t.uid,a.bind("Drop",function(){var e=t.exec.call(a,"FileDrop","getFiles");a.files=[],i.each(e,function(e){a.files.push(new r(a.ruid,e))})},999),t.exec.call(a,"FileDrop","init",n),a.dispatchEvent("ready")}),a.connectRuntime(n)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null}})}var c=["ready","dragenter","dragleave","drop","error"];return u.prototype=a.instance,u}),i(x,[u,v,h],function(e,t,n){function i(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return i.prototype=n.instance,i}),i(R,[u,m,p,h,y,w,x],function(e,t,n,i,r,o,a){function s(){function i(e,i){function l(e){o.readyState=s.DONE,o.error=e,o.trigger("error"),d()}function d(){c.destroy(),c=null,o.trigger("loadend")}function f(t){c.bind("Error",function(e,t){l(t)}),c.bind("Progress",function(e){o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e)}),c.bind("Load",function(e){o.readyState=s.DONE,o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e),d()}),t.exec.call(c,"FileReader","read",e,i)}if(c=new a,this.convertEventPropsToHandlers(u),this.readyState===s.LOADING)return l(new n.DOMException(n.DOMException.INVALID_STATE_ERR));if(this.readyState=s.LOADING,this.trigger("loadstart"),i instanceof r)if(i.isDetached()){var p=i.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=p;break;case"readAsDataURL":this.result="data:"+i.type+";base64,"+t.btoa(p)}this.readyState=s.DONE,this.trigger("load"),d()}else f(c.connectRuntime(i.ruid));else l(new n.DOMException(n.DOMException.NOT_FOUND_ERR))}var o=this,c;e.extend(this,{uid:e.guid("uid_"),readyState:s.EMPTY,result:null,error:null,readAsBinaryString:function(e){i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){i.call(this,"readAsDataURL",e)},readAsText:function(e){i.call(this,"readAsText",e) -},abort:function(){this.result=null,-1===e.inArray(this.readyState,[s.EMPTY,s.DONE])&&(this.readyState===s.LOADING&&(this.readyState=s.DONE),c&&c.getRuntime().exec.call(this,"FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),c&&(c.getRuntime().exec.call(this,"FileReader","destroy"),c.disconnectRuntime()),o=c=null}})}var u=["loadstart","progress","load","abort","error","loadend"];return s.EMPTY=0,s.LOADING=1,s.DONE=2,s.prototype=i.instance,s}),i(b,[],function(){var e=function(t,n){for(var i=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=i.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[i[r]]=u[r]);if(!a.scheme){n&&"string"!=typeof n||(n=e(n||document.location.href)),a.scheme=n.scheme,a.host=n.host,a.port=n.port;var c="";/^[^\/]/.test(a.path)&&(c=n.path,/(\/|\/[^\.]+)$/.test(c)?c+="/":c=c.replace(/\/[^\/]+$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var n={http:80,https:443},i=e(t);return i.scheme+"://"+i.host+(i.port!==n[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}}),i(T,[u,v,m],function(e,t,n){return function(){function i(e,t){if(!t.isDetached()){var i=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),i}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+n.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return i.call(this,"readAsDataURL",e)},readAsText:function(e){return i.call(this,"readAsText",e)}})}}),i(S,[p,u,y],function(e,t,n){function i(){var e,i=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof n?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):i.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(n){t.each(i,function(e){n(e.value,e.name)}),e&&n(e.value,e.name)},destroy:function(){e=null,i=[]}})}return i}),i(A,[u,p,h,m,b,g,x,y,T,S,d,l],function(e,t,n,i,r,o,a,s,u,c,l,d){function f(){this.uid=e.guid("uid_")}function p(){function n(e,t){return y.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?y[e]:v[e]:(l.can("define_property")?y[e]=t:v[e]=t,void 0):void 0}function u(t){function i(){k.destroy(),k=null,s.dispatchEvent("loadend"),s=null}function r(r){k.bind("LoadStart",function(e){n("readyState",p.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),I&&s.upload.dispatchEvent(e)}),k.bind("Progress",function(e){n("readyState")!==p.LOADING&&(n("readyState",p.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),k.bind("UploadProgress",function(e){I&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),k.bind("Load",function(t){n("readyState",p.DONE),n("status",Number(r.exec.call(k,"XMLHttpRequest","getStatus")||0)),n("statusText",h[n("status")]||""),n("response",r.exec.call(k,"XMLHttpRequest","getResponse",n("responseType"))),~e.inArray(n("responseType"),["text",""])?n("responseText",n("response")):"document"===n("responseType")&&n("responseXML",n("response")),U=r.exec.call(k,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),n("status")>0?(I&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(N=!0,s.dispatchEvent("error")),i()}),k.bind("Abort",function(e){s.dispatchEvent(e),i()}),k.bind("Error",function(e){N=!0,n("readyState",p.DONE),s.dispatchEvent("readystatechange"),D=!0,s.dispatchEvent(e),i()}),r.exec.call(k,"XMLHttpRequest","send",{url:E,method:_,async:w,user:R,password:b,headers:x,mimeType:S,encoding:T,responseType:s.responseType,withCredentials:s.withCredentials,options:P},t)}var s=this;M=(new Date).getTime(),k=new a,"string"==typeof P.required_caps&&(P.required_caps=o.parseCaps(P.required_caps)),P.required_caps=e.extend({},P.required_caps,{return_response_type:s.responseType}),t instanceof c&&(P.required_caps.send_multipart=!0),L||(P.required_caps.do_cors=!0),P.ruid?r(k.connectRuntime(P)):(k.bind("RuntimeInit",function(e,t){r(t)}),k.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),k.connectRuntime(P))}function g(){n("responseText",""),n("responseXML",null),n("response",null),n("status",0),n("statusText",""),M=C=null}var v=this,y={timeout:0,readyState:p.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},w=!0,E,_,x={},R,b,T=null,S=null,A=!1,O=!1,I=!1,D=!1,N=!1,L=!1,M,C,F=null,H=null,P={},k,U="",B;e.extend(this,y,{uid:e.guid("uid_"),upload:new f,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||i.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(_=o.toUpperCase()),~e.inArray(_,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=i.utf8_encode(a),l=r.parseUrl(a),L=r.hasSameOrigin(l),E=r.resolveUrl(a),(u||c)&&!L)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(R=u||l.user,b=c||l.pass,w=s||!0,w===!1&&(n("timeout")||n("withCredentials")||""!==n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);A=!w,O=!1,x={},g.call(this),n("readyState",p.OPENED),this.convertEventPropsToHandlers(["readystatechange"]),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(n("readyState")!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||i.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(x[r]?x[r]+=", "+o:x[r]=o,!0)},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),N||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(B||(B={},e.each(U.split(/\r\n/),function(t){var n=t.split(/:\s+/);2===n.length&&(n[0]=e.trim(n[0]),B[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])})})),B.hasOwnProperty(t))?B[t].header+": "+B[t].value:null},overrideMimeType:function(i){var r,o;if(~e.inArray(n("readyState"),[p.LOADING,p.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i=e.trim(i.toLowerCase()),/;/.test(i)&&(r=i.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(i=r[1],r[2]&&(o=r[2])),!d.mimes[i])throw new t.DOMException(t.DOMException.SYNTAX_ERR);F=i,H=o},send:function(n,r){if(P="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.convertEventPropsToHandlers(m),this.upload.convertEventPropsToHandlers(m),this.readyState!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n instanceof s)P.ruid=n.ruid,S=n.type||"application/octet-stream";else if(n instanceof c){if(n.hasBlob()){var o=n.getBlob();P.ruid=o.ruid,S=o.type||"application/octet-stream"}}else"string"==typeof n&&(T="UTF-8",S="text/plain;charset=UTF-8",n=i.utf8_encode(n));this.withCredentials||(this.withCredentials=P.required_caps&&P.required_caps.send_browser_cookies&&!L),I=!A&&this.upload.hasEventListener(),N=!1,D=!n,A||(O=!0),u.call(this,n)},abort:function(){if(N=!0,A=!1,~e.inArray(n("readyState"),[p.UNSENT,p.OPENED,p.DONE]))n("readyState",p.UNSENT);else{if(n("readyState",p.DONE),O=!1,!k)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);k.getRuntime().exec.call(k,"XMLHttpRequest","abort",D),D=!0}},destroy:function(){k&&("function"===e.typeOf(k.destroy)&&k.destroy(),k=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}})}var h={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};f.prototype=n.instance;var m=["loadstart","progress","abort","error","load","timeout","loadend"],g=1,v=2;return p.UNSENT=0,p.OPENED=1,p.HEADERS_RECEIVED=2,p.LOADING=3,p.DONE=4,p.prototype=n.instance,p}),i(O,[u,m,v,h],function(e,t,n,i){function r(){function i(){l=d=0,c=this.result=null}function o(t,n){var i=this;u=n,i.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(i.state,[r.IDLE,r.DONE])&&a.call(i)},999),i.bind("TransportingComplete",function(){d=l,i.state=r.DONE,c=null,i.result=u.exec.call(i,"Transporter","getAsBlob",t||"")},999),i.state=r.BUSY,i.trigger("TransportingStarted"),a.call(i)}function a(){var e=this,n,i=l-d;f>i&&(f=i),n=t.btoa(c.substr(d,f)),u.exec.call(e,"Transporter","receive",n,l)}var s,u,c,l,d,f;n.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,n,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),f=r.chunk_size,i.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,n,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,n,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),i.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),i.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=i.instance,r}),i(I,[u,f,p,T,A,g,v,O,d,h,y,w,m],function(e,t,n,i,r,o,a,s,u,c,l,d,f){function p(){function i(e){e||(e=this.getRuntime().exec.call(this,"Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name)}function c(t){var i=e.typeOf(t);try{if(t instanceof p){if(!t.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);m.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new n.ImageError(n.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(i,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===i)/^data:[^;]*;base64,/.test(t)?c.call(this,new l(null,{data:t}),arguments[1]):v.apply(this,arguments);else{if("node"!==i||"img"!==t.nodeName.toLowerCase())throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r)}}function m(t,n){var i=this.connectRuntime(t.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(n)?!0:n)}function g(t,n){function i(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){i(t)}),n&&"string"==typeof n.required_caps&&(n.required_caps=o.parseCaps(n.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},n))):i(this.connectRuntime(t.ruid))}function v(e,t){var n=this,i;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){this.bind("Load Resize",function(){i.call(this)},999),this.convertEventPropsToHandlers(h),c.apply(this,arguments)},downsize:function(t,i,r,o){try{if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);(!t&&!i||"undefined"===e.typeOf(r))&&(r=!1),t=t||this.width,i=i||this.height,o="undefined"===e.typeOf(o)?!0:!!o,this.getRuntime().exec.call(this,"Image","downsize",t,i,r,o)}catch(a){this.trigger("error",a)}},crop:function(e,t,n){this.downsize(e,t,!0,n)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return e||(e="image/jpeg"),"image/jpeg"!==e||t||(t=90),this.getRuntime().exec.call(this,"Image","getAsBlob",e,t)},getAsDataURL:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.getRuntime().exec.call(this,"Image","getAsDataURL",e,t)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return f.atob(n.substring(n.indexOf("base64,")+7))},embed:function(i){function r(){if(u.can("create_canvas")){var t=a.getAsCanvas();if(t)return i.appendChild(t),t=null,a.destroy(),o.trigger("embedded"),void 0}var r=a.getAsDataURL(c,l);if(!r)throw new n.ImageError(n.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",r.length))i.innerHTML='<img src="'+r+'" width="'+a.width+'" height="'+a.height+'" />',a.destroy(),o.trigger("embedded");else{var d=new s;d.bind("TransportingComplete",function(){v=o.connectRuntime(this.result.ruid),o.bind("Embedded",function(){e.extend(v.getShimContainer().style,{top:"0px",left:"0px",width:a.width+"px",height:a.height+"px"}),v=null},999),v.exec.call(o,"ImageView","display",this.result.uid,m,g),a.destroy()}),d.transport(f.atob(r.substring(r.indexOf("base64,")+7)),c,e.extend({},h,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:i}))}}var o=this,a,c,l,d,h=arguments[1]||{},m=this.width,g=this.height,v;try{if(!(i=t.get(i)))throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);if(c=h.type||this.type||"image/jpeg",l=h.quality||90,d="undefined"!==e.typeOf(h.crop)?h.crop:!1,h.width)m=h.width,g=h.height||m;else{var y=t.getSize(i);y.w&&y.h&&(m=y.w,g=y.h)}return a=new p,a.bind("Resize",function(){r.call(o)}),a.bind("Load",function(){a.downsize(m,g,d,!1)}),a.clone(this,!1),a}catch(w){this.trigger("error",w)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}})}var h=["progress","load","error","resize","embedded"];return p.MAX_RESIZE_WIDTH=6500,p.MAX_RESIZE_HEIGHT=6500,p.prototype=c.instance,p}),i(D,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue,c=e.extend({access_binary:s(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return r.can("access_binary")&&!!a.Image},display_media:s(i.can("create_canvas")||i.can("use_data_uri_over32kb")),do_cors:s(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:s(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==i.browser||i.version>9)}()),filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),return_response_headers:u,return_response_type:function(e){return"json"===e&&window.JSON?!0:i.can("return_response_type",e)},return_status_code:u,report_upload_progress:s(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return r.can("access_binary")&&i.can("create_canvas")},select_file:function(){return i.can("use_fileinput")&&window.File},select_folder:function(){return r.can("select_file")&&"Chrome"===i.browser&&i.version>=21},select_multiple:function(){return!(!r.can("select_file")||"Safari"===i.browser&&"Windows"===i.os||"iOS"===i.os&&i.verComp(i.osVersion,"7.0.4","<"))},send_binary_string:s(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:s(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||r.can("send_binary_string")},slice_blob:s(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return r.can("slice_blob")&&r.can("send_multipart")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||"IE"===i.browser&&i.version>=10||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u},arguments[2]);n.call(this,t,arguments[1]||o,c),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html5",a={};return n.addConstructor(o,r),a}),i(N,[D,y],function(e,t){function n(){function e(e,t,n){var i;if(!window.File.prototype.slice)return(i=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?i.call(e,t,n):null;try{return e.slice(),e.slice(t,n)}catch(r){return e.slice(t,n-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n}),i(L,[u],function(e){function t(){this.returnValue=!1}function n(){this.cancelBubble=!0}var i={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=n,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),i.hasOwnProperty(o[r])||(i[o[r]]={}),l=i[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,n,o){var a,s;if(n=n.toLowerCase(),t[r]&&i[t[r]]&&i[t[r]][n]){a=i[t[r]][n];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(n,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+n,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete i[t[r]][n],e.isEmptyObj(i[t[r]])){delete i[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,n){t&&t[r]&&e.each(i[t[r]],function(e,i){a(t,i,n)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),i(M,[D,u,f,L,l,d],function(e,t,n,i,r,o){function a(){var e=[],a;t.extend(this,{init:function(s){var u=this,c=u.getRuntime(),l,d,f,p,h,m;a=s,e=[],f=a.accept.mimes||r.extList2mimes(a.accept,c.can("filter_by_extension")),d=c.getShimContainer(),d.innerHTML='<input id="'+c.uid+'" type="file" style="font-size:999px;opacity:0;"'+(a.multiple&&c.can("select_multiple")?"multiple":"")+(a.directory&&c.can("select_folder")?"webkitdirectory directory":"")+(f?' accept="'+f.join(",")+'"':"")+" />",l=n.get(c.uid),t.extend(l.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),p=n.get(a.browse_button),c.can("summon_file_dialog")&&("static"===n.getStyle(p,"position")&&(p.style.position="relative"),h=parseInt(n.getStyle(p,"z-index"),10)||1,p.style.zIndex=h,d.style.zIndex=h-1,i.addEvent(p,"click",function(e){var t=n.get(c.uid);t&&!t.disabled&&t.click(),e.preventDefault()},u.uid)),m=c.can("summon_file_dialog")?p:d,i.addEvent(m,"mouseover",function(){u.trigger("mouseenter")},u.uid),i.addEvent(m,"mouseout",function(){u.trigger("mouseleave")},u.uid),i.addEvent(m,"mousedown",function(){u.trigger("mousedown")},u.uid),i.addEvent(n.get(a.container),"mouseup",function(){u.trigger("mouseup")},u.uid),l.onchange=function g(){if(e=[],a.directory?t.each(this.files,function(t){"."!==t.name&&e.push(t)}):e=[].slice.call(this.files),"IE"!==o.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=g}u.trigger("change")},u.trigger({type:"ready",async:!0}),d=null},getFiles:function(){return e},disable:function(e){var t=this.getRuntime(),i;(i=n.get(t.uid))&&(i.disabled=!!e)},destroy:function(){var t=this.getRuntime(),r=t.getShim(),o=t.getShimContainer();i.removeAllEvents(o,this.uid),i.removeAllEvents(a&&n.get(a.container),this.uid),i.removeAllEvents(a&&n.get(a.browse_button),this.uid),o&&(o.innerHTML=""),r.removeInstance(this.uid),e=a=o=r=null}})}return e.FileInput=a}),i(C,[D,u,f,L,l],function(e,t,n,i,r){function o(){function e(e){for(var n=[],i=0;i<e.length;i++)[].push.apply(n,e[i].extensions.split(/\s*,\s*/));return-1===t.inArray("*",n)?n:[]}function o(e){var n=r.getFileExtension(e.name);return!n||!d.length||-1!==t.inArray(n,d)}function a(e,n){var i=[];t.each(e,function(e){var t=e.webkitGetAsEntry();if(t)if(t.isFile){var n=e.getAsFile();o(n)&&l.push(n)}else i.push(t)}),i.length?s(i,n):n()}function s(e,n){var i=[];t.each(e,function(e){i.push(function(t){u(e,t)})}),t.inSeries(i,function(){n()})}function u(e,t){e.isFile?e.file(function(e){o(e)&&l.push(e),t()},function(){t()}):e.isDirectory?c(e,t):t()}function c(e,t){function n(e){r.readEntries(function(t){t.length?([].push.apply(i,t),n(e)):e()},e)}var i=[],r=e.createReader();n(function(){s(i,t)})}var l=[],d=[],f;t.extend(this,{init:function(n){var r=this,s;f=n,d=e(f.accept),s=f.container,i.addEvent(s,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},r.uid),i.addEvent(s,"drop",function(e){e.preventDefault(),e.stopPropagation(),l=[],e.dataTransfer.items&&e.dataTransfer.items[0].webkitGetAsEntry?a(e.dataTransfer.items,function(){r.trigger("drop")}):(t.each(e.dataTransfer.files,function(e){o(e)&&l.push(e)}),r.trigger("drop"))},r.uid),i.addEvent(s,"dragenter",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragenter")},r.uid),i.addEvent(s,"dragleave",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragleave")},r.uid)},getFiles:function(){return l},destroy:function(){i.removeAllEvents(f&&n.get(f.container),this.uid),l=d=f=null}})}return e.FileDrop=o}),i(F,[D,m,u],function(e,t,n){function i(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var i,r=!1;n.extend(this,{read:function(e,t){var o=this;i=new window.FileReader,i.addEventListener("progress",function(e){o.trigger(e)}),i.addEventListener("load",function(e){o.trigger(e)}),i.addEventListener("error",function(e){o.trigger(e,i.error)}),i.addEventListener("loadend",function(){i=null}),"function"===n.typeOf(i[e])?(r=!1,i[e](t.getSource())):"readAsBinaryString"===e&&(r=!0,i.readAsDataURL(t.getSource()))},getResult:function(){return i&&i.result?r?e(i.result):i.result:null},abort:function(){i&&i.abort()},destroy:function(){i=null}})}return e.FileReader=i}),i(H,[D,u,l,b,w,y,S,p,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(e,t){var n=this,i,r;i=t.getBlob().getSource(),r=new window.FileReader,r.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:r.result})),f.send.call(n,e,t)},r.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.version<8?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(n){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,n=e.responseText;return"IE"===u.browser&&n&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(n)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),n="--",i="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return p.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?n+t+i+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+i+"Content-Type: "+(e.type||"application/octet-stream")+i+i+e.getSource()+i:n+t+i+'Content-Disposition: form-data; name="'+a+'"'+i+i+unescape(encodeURIComponent(e))+i}),r+=n+t+n+i}var f=this,p,h;t.extend(this,{send:function(n,r){var s=this,l="Mozilla"===u.browser&&u.version>=4&&u.version<7,f="Android Browser"===u.browser,m=!1;if(h=n.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),p=c(),p.open(n.method,n.url,n.async,n.user,n.password),r instanceof o)r.isDetached()&&(m=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),m=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,n,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}p.upload?(n.withCredentials&&(p.withCredentials=!0),p.addEventListener("load",function(e){s.trigger(e)}),p.addEventListener("error",function(e){s.trigger(e)}),p.addEventListener("progress",function(e){s.trigger(e)}),p.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):p.onreadystatechange=function v(){switch(p.readyState){case 1:break;case 2:break;case 3:var e,t;try{i.hasSameOrigin(n.url)&&(e=p.getResponseHeader("Content-Length")||0),p.responseText&&(t=p.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:p.onreadystatechange=function(){},0===p.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(n.headers)||t.each(n.headers,function(e,t){p.setRequestHeader(t,e)}),""!==n.responseType&&"responseType"in p&&(p.responseType="json"!==n.responseType||u.can("return_response_type","json")?n.responseType:"text"),m?p.sendAsBinary?p.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);p.send(e.buffer)}():p.send(r),s.trigger("loadstart")},getStatus:function(){try{if(p)return p.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var i=new r(t.uid,p.response),o=p.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return i.name=h,i.type||(i.type=n.getFileMime(h)),i;case"json":return u.can("return_response_type","json")?p.response:200===p.status&&window.JSON?JSON.parse(p.responseText):null;case"document":return l(p);default:return""!==p.responseText?p.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return p.getAllResponseHeaders()}catch(e){}return""},abort:function(){p&&p.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),i(P,[],function(){return function(){function e(e,t){var n=r?0:-8*(t-1),i=0,a;for(a=0;t>a;a++)i|=o.charCodeAt(e+a)<<Math.abs(n+8*a);return i}function n(e,t,n){n=3===arguments.length?n:o.length-t-1,o=o.substr(0,t)+e+o.substr(n+t)}function i(e,t,i){var o="",a=r?0:-8*(i-1),s;for(s=0;i>s;s++)o+=String.fromCharCode(255&t>>Math.abs(a+8*s));n(o,e,i)}var r=!1,o;return{II:function(e){return e===t?r:(r=e,void 0)},init:function(e){r=!1,o=e},SEGMENT:function(e,t,i){switch(arguments.length){case 1:return o.substr(e,o.length-e-1);case 2:return o.substr(e,t);case 3:n(i,e,t);break;default:return o}},BYTE:function(t){return e(t,1)},SHORT:function(t){return e(t,2)},LONG:function(n,r){return r===t?e(n,4):(i(n,r,4),void 0)},SLONG:function(t){var n=e(t,4);return n>2147483647?n-4294967296:n},STRING:function(t,n){var i="";for(n+=t;n>t;t++)i+=String.fromCharCode(e(t,1));return i}}}}),i(k,[P],function(e){return function t(n){var i=[],r,o,a,s=0;if(r=new e,r.init(n),65496===r.SHORT(0)){for(o=2;o<=n.length;)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;s=r.SHORT(o+2)+2,a>=65505&&65519>=a&&i.push({hex:a,name:"APP"+(15&a),start:o,length:s,segment:r.SEGMENT(o,s)}),o+=s}return r.init(null),{headers:i,restore:function(e){var t,n;for(r.init(e),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,t=i.length;t>n;n++)r.SEGMENT(o,0,i[n].segment),o+=i[n].length;return e=r.SEGMENT(),r.init(null),e},strip:function(e){var n,i,o;for(i=new t(e),n=i.headers,i.purge(),r.init(e),o=n.length;o--;)r.SEGMENT(n[o].start,n[o].length,"");return e=r.SEGMENT(),r.init(null),e},get:function(e){for(var t=[],n=0,r=i.length;r>n;n++)i[n].name===e.toUpperCase()&&t.push(i[n].segment);return t},set:function(e,t){var n=[],r,o,a;for("string"==typeof t?n.push(t):n=t,r=o=0,a=i.length;a>r&&(i[r].name===e.toUpperCase()&&(i[r].segment=n[o],i[r].length=n[o].length,o++),!(o>=n.length));r++);},purge:function(){i=[],r.init(null),r=null}}}}}),i(U,[u,P],function(e,n){return function i(){function i(e,n){var i=a.SHORT(e),r,o,s,u,d,f,p,h,m=[],g={};for(r=0;i>r;r++)if(p=f=e+12*r+2,s=n[a.SHORT(p)],s!==t){switch(u=a.SHORT(p+=2),d=a.LONG(p+=2),p+=4,m=[],u){case 1:case 7:for(d>4&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.BYTE(p+o);break;case 2:d>4&&(p=a.LONG(p)+c.tiffHeader),g[s]=a.STRING(p,d-1);continue;case 3:for(d>2&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.SHORT(p+2*o);break;case 4:for(d>1&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.LONG(p+4*o);break;case 5:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.LONG(p+4*o)/a.LONG(p+4*o+4);break;case 9:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o);break;case 10:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o)/a.SLONG(p+4*o+4);break;default:continue}h=1==d?m[0]:m,g[s]=l.hasOwnProperty(s)&&"object"!=typeof h?l[s][h]:h}return g}function r(){var e=c.tiffHeader;return a.II(18761==a.SHORT(e)),42!==a.SHORT(e+=2)?!1:(c.IFD0=c.tiffHeader+a.LONG(e+=2),u=i(c.IFD0,s.tiff),"ExifIFDPointer"in u&&(c.exifIFD=c.tiffHeader+u.ExifIFDPointer,delete u.ExifIFDPointer),"GPSInfoIFDPointer"in u&&(c.gpsIFD=c.tiffHeader+u.GPSInfoIFDPointer,delete u.GPSInfoIFDPointer),!0)}function o(e,t,n){var i,r,o,u=0;if("string"==typeof t){var l=s[e.toLowerCase()];for(var d in l)if(l[d]===t){t=d;break}}i=c[e.toLowerCase()+"IFD"],r=a.SHORT(i);for(var f=0;r>f;f++)if(o=i+12*f+2,a.SHORT(o)==t){u=o+8;break}return u?(a.LONG(u,n),!0):!1}var a,s,u,c={},l;return a=new n,s={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},{init:function(e){return c={tiffHeader:10},e!==t&&e.length?(a.init(e),65505===a.SHORT(0)&&"EXIF\0"===a.STRING(4,5).toUpperCase()?r():!1):!1 -},TIFF:function(){return u},EXIF:function(){var t;if(t=i(c.exifIFD,s.exif),t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}return t},GPS:function(){var t;return t=i(c.gpsIFD,s.gps),t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join(".")),t},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:o("exif",e,t)},getBinary:function(){return a.SEGMENT()},purge:function(){a.init(null),a=u=null,c={}}}}}),i(B,[u,p,k,P,U],function(e,t,n,i,r){function o(o){function a(){for(var e=0,t,n;e<=u.length;){if(t=c.SHORT(e+=2),t>=65472&&65475>=t)return e+=5,{height:c.SHORT(e),width:c.SHORT(e+=2)};n=c.SHORT(e+=2),e+=n-2}return null}function s(){d&&l&&c&&(d.purge(),l.purge(),c.init(null),u=f=l=d=c=null)}var u,c,l,d,f,p;if(u=o,c=new i,c.init(u),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new n(o),d=new r,p=!!d.init(l.get("app1")[0]),f=a.call(this),e.extend(this,{type:"image/jpeg",size:u.length,width:f&&f.width||0,height:f&&f.height||0,setExif:function(t,n){return p?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,n),l.set("app1",d.getBinary()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):u=l.restore(u)},stripHeaders:function(e){return l.strip(e)},purge:function(){s.call(this)}}),p&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS()})}return o}),i(z,[p,u,P],function(e,t,n){function i(i){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:u.LONG(t),height:u.LONG(t+=4)}):null}function o(){u&&(u.init(null),s=d=c=l=u=null)}function a(e){var t,n,i,r;return t=u.LONG(e),n=u.STRING(e+=4,4),i=e+=4,r=u.LONG(e+t),{length:t,type:n,start:i,CRC:r}}var s,u,c,l,d;s=i,u=new n,u.init(s),function(){var t=0,n=0,i=[35152,20039,3338,6666];for(n=0;n<i.length;n++,t+=2)if(i[n]!=u.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),d=r.call(this),t.extend(this,{type:"image/png",size:s.length,width:d.width,height:d.height,purge:function(){o.call(this)}}),o.call(this)}return i}),i(G,[u,p,B,z],function(e,t,n,i){return function(r){var o=[n,i],a;a=function(){for(var e=0;e<o.length;e++)try{return new o[e](r)}catch(n){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){}}),e.extend(this,a),this.purge=function(){a.purge(),a=null}}}),i(q,[],function(){function e(e,i,r){var o=e.naturalWidth,a=e.naturalHeight,s=r.width,u=r.height,c=r.x||0,l=r.y||0,d=i.getContext("2d");t(e)&&(o/=2,a/=2);var f=1024,p=document.createElement("canvas");p.width=p.height=f;for(var h=p.getContext("2d"),m=n(e,o,a),g=0;a>g;){for(var v=g+f>a?a-g:f,y=0;o>y;){var w=y+f>o?o-y:f;h.clearRect(0,0,f,f),h.drawImage(e,-y,-g);var E=y*s/o+c<<0,_=Math.ceil(w*s/o),x=g*u/a/m+l<<0,R=Math.ceil(v*u/a/m);d.drawImage(p,0,0,w,v,E,x,_,R),y+=f}g+=f}p=h=null}function t(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1048576){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");return r.drawImage(e,-t+1,0),0===r.getImageData(0,0,1,1).data[3]}return!1}function n(e,t,n){var i=document.createElement("canvas");i.width=1,i.height=n;var r=i.getContext("2d");r.drawImage(e,0,0);for(var o=r.getImageData(0,0,1,n).data,a=0,s=n,u=n;u>a;){var c=o[4*(u-1)+3];0===c?s=u:a=u,u=s+a>>1}i=null;var l=u/n;return 0===l?1:l}return{isSubsampled:t,renderTo:e}}),i(X,[D,u,p,m,w,G,q,l,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(){if(!E&&!y)throw new n.ImageError(n.DOMException.INVALID_STATE_ERR);return E||y}function c(e){return i.atob(e.substring(e.indexOf("base64,")+7))}function l(e,t){return"data:"+(t||"")+";base64,"+i.btoa(e)}function d(e){var t=this;y=new Image,y.onerror=function(){g.call(this),t.trigger("error",new n.ImageError(n.ImageError.WRONG_FORMAT))},y.onload=function(){t.trigger("load")},y.src=/^data:[^;]*;base64,/.test(e)?e:l(e,x.type)}function f(e,t){var i=this,r;return window.FileReader?(r=new FileReader,r.onload=function(){t(this.result)},r.onerror=function(){i.trigger("error",new n.FileException(n.FileException.NOT_READABLE_ERR))},r.readAsDataURL(e),void 0):t(e.getAsDataURL())}function p(n,i,r,o){var a=this,s,u,c=0,l=0,d,f,p,g;if(b=o,g=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,-1!==t.inArray(g,[5,6,7,8])){var v=n;n=i,i=v}return d=e(),u=r?Math.max:Math.min,s=u(n/d.width,i/d.height),s>1&&(!r||o)?(this.trigger("Resize"),void 0):(E||(E=document.createElement("canvas")),f=Math.round(d.width*s),p=Math.round(d.height*s),r?(E.width=n,E.height=i,f>n&&(c=Math.round((f-n)/2)),p>i&&(l=Math.round((p-i)/2))):(E.width=f,E.height=p),b||m(E.width,E.height,g),h.call(this,d,E,-c,-l,f,p),this.width=E.width,this.height=E.height,R=!0,a.trigger("Resize"),void 0)}function h(e,t,n,i,r,o){if("iOS"===u.OS)a.renderTo(e,t,{width:r,height:o,x:n,y:i});else{var s=t.getContext("2d");s.drawImage(e,n,i,r,o)}}function m(e,t,n){switch(n){case 5:case 6:case 7:case 8:E.width=t,E.height=e;break;default:E.width=e,E.height=t}var i=E.getContext("2d");switch(n){case 2:i.translate(e,0),i.scale(-1,1);break;case 3:i.translate(e,t),i.rotate(Math.PI);break;case 4:i.translate(0,t),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-t);break;case 7:i.rotate(.5*Math.PI),i.translate(e,-t),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-e,0)}}function g(){w&&(w.purge(),w=null),_=y=E=x=null,R=!1}var v=this,y,w,E,_,x,R=!1,b=!0;t.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!i.can("access_binary"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);return x=e,e.isDetached()?(_=e.getSource(),d.call(this,_),void 0):(f.call(this,e.getSource(),function(e){r&&(_=c(e)),d.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,x=new r(null,{name:e.name,size:e.size,type:e.type}),d.call(this,t?_=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t=this.getRuntime(),n;return!w&&_&&t.can("access_image_binary")&&(w=new o(_)),n={width:e().width||0,height:e().height||0,type:x.type||s.getFileMime(x.name),size:_&&_.length||x.size||0,name:x.name||"",meta:w&&w.meta||this.meta||{}}},downsize:function(){p.apply(this,arguments)},getAsCanvas:function(){return E&&(E.id=this.uid+"_canvas"),E},getAsBlob:function(e,t){return e!==this.type&&p.call(this,this.width,this.height,!1),new r(null,{name:x.name||"",type:e,data:v.getAsBinaryString.call(this,e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!R)return y.src;if("image/jpeg"!==e)return E.toDataURL("image/png");try{return E.toDataURL("image/jpeg",t/100)}catch(n){return E.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!R)return _||(_=c(v.getAsDataURL(e,t))),_;if("image/jpeg"!==e)_=c(v.getAsDataURL(e,t));else{var n;t||(t=90);try{n=E.toDataURL("image/jpeg",t/100)}catch(i){n=E.toDataURL("image/jpeg")}_=c(n),w&&(_=w.stripHeaders(_),b&&(w.meta&&w.meta.exif&&w.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),_=w.writeHeaders(_)),w.purge(),w=null)}return R=!1,_},destroy:function(){v=null,g.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),i(j,[u,d,f,p,g],function(e,t,n,i,r){function o(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(n){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function a(a){var c=this,l;a=e.extend({swf_url:t.swf_url},a),r.call(this,a,s,{access_binary:function(e){return e&&"browser"===c.mode},access_image_binary:function(e){return e&&"browser"===c.mode},display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===c.mode},resize_image:r.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===c.mode},return_status_code:function(t){return"browser"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:function(e){return e&&"browser"===c.mode},send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"browser"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:function(e){return e&&"browser"===c.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===c.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),o()<10&&(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var n,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),n='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+a.swf_url+'" ',"IE"===t.browser&&(n+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),n+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+a.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=n,r=o=null):o.innerHTML=n,l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="flash",u={};return r.addConstructor(s,a),u}),i(V,[j,y],function(e,t){var n={slice:function(e,n,i,r){var o=this.getRuntime();return 0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),e=o.shimExec.call(this,"Blob","slice",n,i,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=n}),i(W,[j],function(e){var t={init:function(e){this.getRuntime().shimExec.call(this,"FileInput","init",{name:e.name,accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=t}),i(Y,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i="",r={read:function(e,t){var r=this,o=r.getRuntime();return"readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"),r.bind("Progress",function(t,r){r&&(i+=n(r,e))}),o.shimExec.call(this,"FileReader","readAsBase64",t.uid)},getResult:function(){return i},destroy:function(){i=null}};return e.FileReader=r}),i($,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i,r=this.getRuntime();return(i=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"+i),n(i,e,t.type)):null}};return e.FileReaderSync=i}),i(J,[j,u,y,w,T,S,O],function(e,t,n,i,r,o,a){var s={send:function(e,i){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,i)}function s(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),i=null,r()}function u(e,t){var n=new a;n.bind("TransportingComplete",function(){t(this.result)}),n.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),i instanceof o){var d;if(i.each(function(e,t){e instanceof n?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),i.hasBlob()){var f=i.getBlob();f.isDetached()?u(f,function(e){f.destroy(),s(d,e)}):s(d,f)}else i=null,r()}else i instanceof n?i.isDetached()?u(i,function(e){i.destroy(),i=e.uid,r()}):(i=i.uid,r()):r()},getResponse:function(e){var n,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new i(a.uid,o),"blob"===e)return o;try{if(n=new r,~t.inArray(e,["","text"]))return n.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(n.readAsText(o))}finally{o.destroy()}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=s}),i(Z,[j,y],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),i=n.shimExec.call(this,"Transporter","getAsBlob",e);return i?new t(n.uid,i):null}};return e.Transporter=n}),i(K,[j,u,O,y,T],function(e,t,n,i,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(i,"Image","loadFromBlob",e.uid),i=r=null}var i=this,r=i.getRuntime();if(e.isDetached()){var o=new n;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getAsBlob:function(e,t){var n=this.getRuntime(),r=n.shimExec.call(this,"Image","getAsBlob",e,t);return r?new i(n.uid,r):null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;return t?(n=new r,n.readAsDataURL(t)):null}};return e.Image=o}),i(Q,[u,d,f,p,g],function(e,t,n,i,r){function o(e){var t=!1,n=null,i,r,o,a,s,u=0;try{try{n=new ActiveXObject("AgControl.AgControl"),n.IsVersionSupported(e)&&(t=!0),n=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(i=l.description,"1.0.30226.2"===i&&(i="2.0.30226.2"),r=i.split(".");r.length>3;)r.pop();for(;r.length<4;)r.push(0);for(o=e.split(".");o.length>4;)o.pop();do a=parseInt(o[u],10),s=parseInt(r[u],10),u++;while(u<o.length&&a===s);s>=a&&!isNaN(a)&&(t=!0)}}}catch(d){t=!1}return t}function a(a){var c=this,l;a=e.extend({xap_url:t.xap_url},a),r.call(this,a,s,{access_binary:r.capTrue,access_image_binary:r.capTrue,display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:r.capTrue,resize_image:r.capTrue,return_response_headers:function(e){return e&&"client"===c.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:r.capTrue,send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"client"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:r.capTrue,use_http_method:function(t){return"client"===c.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),o("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid).content.Moxie},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+a.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="silverlight",u={};return r.addConstructor(s,a),u}),i(et,[Q,u,V],function(e,t,n){return e.Blob=t.extend({},n)}),i(tt,[Q],function(e){var t={init:function(e){function t(e){for(var t="",n=0;n<e.length;n++)t+=(""!==t?"|":"")+e[n].title+" | *."+e[n].extensions.replace(/,/g,";*.");return t}this.getRuntime().shimExec.call(this,"FileInput","init",t(e.accept),e.name,e.multiple),this.trigger("ready")}};return e.FileInput=t}),i(nt,[Q,f,L],function(e,t,n){var i={init:function(){var e=this,i=e.getRuntime(),r;return r=i.getShimContainer(),n.addEvent(r,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},e.uid),n.addEvent(r,"dragenter",function(e){e.preventDefault();var n=t.get(i.uid).dragEnter(e);n&&e.stopPropagation()},e.uid),n.addEvent(r,"drop",function(e){e.preventDefault();var n=t.get(i.uid).dragDrop(e);n&&e.stopPropagation()},e.uid),i.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=i}),i(it,[Q,u,Y],function(e,t,n){return e.FileReader=t.extend({},n)}),i(rt,[Q,u,$],function(e,t,n){return e.FileReaderSync=t.extend({},n)}),i(ot,[Q,u,J],function(e,t,n){return e.XMLHttpRequest=t.extend({},n)}),i(at,[Q,u,Z],function(e,t,n){return e.Transporter=t.extend({},n)}),i(st,[Q,u,K],function(e,t,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps"],i={meta:{}},r=e.shimExec.call(this,"Image","getInfo");return r.meta&&t.each(n,function(e){var t=r.meta[e],n,o,a,s;if(t&&t.keys)for(i.meta[e]={},o=0,a=t.keys.length;a>o;o++)n=t.keys[o],s=t[n],s&&(/^(\d|[1-9]\d+)$/.test(s)?s=parseInt(s,10):/^\d*\.\d+$/.test(s)&&(s=parseFloat(s)),i.meta[e][n]=s)}),i.width=parseInt(r.width,10),i.height=parseInt(r.height,10),i.size=parseInt(r.size,10),i.type=r.type,i.name=r.name,i}})}),i(ut,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue;n.call(this,t,o,{access_binary:s(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:s(a.Image&&(i.can("create_canvas")||i.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),resize_image:function(){return a.Image&&r.can("access_binary")&&i.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return i.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return r.can("select_file")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html4",a={};return n.addConstructor(o,r),a}),i(ct,[ut,u,f,L,l,d],function(e,t,n,i,r,o){function a(){function e(){var r=this,l=r.getRuntime(),d,f,p,h,m,g;g=t.guid("uid_"),d=l.getShimContainer(),a&&(p=n.get(a+"_form"),p&&t.extend(p.style,{top:"100%"})),h=document.createElement("form"),h.setAttribute("id",g+"_form"),h.setAttribute("method","post"),h.setAttribute("enctype","multipart/form-data"),h.setAttribute("encoding","multipart/form-data"),t.extend(h.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=document.createElement("input"),m.setAttribute("id",g),m.setAttribute("type","file"),m.setAttribute("name",c.name||"Filedata"),m.setAttribute("accept",u.join(",")),t.extend(m.style,{fontSize:"999px",opacity:0}),h.appendChild(m),d.appendChild(h),t.extend(m.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===o.browser&&o.version<10&&t.extend(m.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),m.onchange=function(){var t;this.value&&(t=this.files?this.files[0]:{name:this.value},s=[t],this.onchange=function(){},e.call(r),r.bind("change",function i(){var e=n.get(g),t=n.get(g+"_form"),o;r.unbind("change",i),r.files.length&&e&&t&&(o=r.files[0],e.setAttribute("id",o.uid),t.setAttribute("id",o.uid+"_form"),t.setAttribute("target",o.uid+"_iframe")),e=t=null},998),m=h=null,r.trigger("change"))},l.can("summon_file_dialog")&&(f=n.get(c.browse_button),i.removeEvent(f,"click",r.uid),i.addEvent(f,"click",function(e){m&&!m.disabled&&m.click(),e.preventDefault()},r.uid)),a=g,d=p=f=null}var a,s=[],u=[],c;t.extend(this,{init:function(t){var o=this,a=o.getRuntime(),s;c=t,u=t.accept.mimes||r.extList2mimes(t.accept,a.can("filter_by_extension")),s=a.getShimContainer(),function(){var e,r,u;e=n.get(t.browse_button),a.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),r=parseInt(n.getStyle(e,"z-index"),10)||1,e.style.zIndex=r,s.style.zIndex=r-1),u=a.can("summon_file_dialog")?e:s,i.addEvent(u,"mouseover",function(){o.trigger("mouseenter")},o.uid),i.addEvent(u,"mouseout",function(){o.trigger("mouseleave")},o.uid),i.addEvent(u,"mousedown",function(){o.trigger("mousedown")},o.uid),i.addEvent(n.get(t.container),"mouseup",function(){o.trigger("mouseup")},o.uid),e=null}(),e.call(this),s=null,o.trigger({type:"ready",async:!0})},getFiles:function(){return s},disable:function(e){var t;(t=n.get(a))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),r=e.getShimContainer();i.removeAllEvents(r,this.uid),i.removeAllEvents(c&&n.get(c.container),this.uid),i.removeAllEvents(c&&n.get(c.browse_button),this.uid),r&&(r.innerHTML=""),t.removeInstance(this.uid),a=s=u=c=r=t=null}})}return e.FileInput=a}),i(lt,[ut,F],function(e,t){return e.FileReader=t}),i(dt,[ut,u,f,b,p,L,y,S],function(e,t,n,i,r,o,a,s){function u(){function e(e){var t=this,i,r,a,s,u=!1;if(l){if(i=l.id.replace(/_iframe$/,""),r=n.get(i+"_form")){for(a=r.getElementsByTagName("input"),s=a.length;s--;)switch(a[s].getAttribute("type")){case"hidden":a[s].parentNode.removeChild(a[s]);break;case"file":u=!0}a=[],u||r.parentNode.removeChild(r),r=null}setTimeout(function(){o.removeEvent(l,"load",t.uid),l.parentNode&&l.parentNode.removeChild(l);var n=t.getRuntime().getShimContainer();n.children.length||n.parentNode.removeChild(n),n=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,f){function p(){var n=m.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+g+'_iframe" name="'+g+'_iframe" src="javascript:""" style="display:none"></iframe>',l=r.firstChild,n.appendChild(l),o.addEvent(l,"load",function(){var n;try{n=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(n.title)?u=n.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(n.body.innerHTML),h.trigger({type:"progress",loaded:c.length,total:c.length}),w&&h.trigger({type:"uploadprogress",loaded:w.size||1025,total:w.size||1025}))}catch(r){if(!i.hasSameOrigin(d.url))return e.call(h,function(){h.trigger("error")}),void 0;u=404}e.call(h,function(){h.trigger("load")})},h.uid)}var h=this,m=h.getRuntime(),g,v,y,w;if(u=c=null,f instanceof s&&f.hasBlob()){if(w=f.getBlob(),g=w.uid,y=n.get(g),v=n.get(g+"_form"),!v)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else g=t.guid("uid_"),v=document.createElement("form"),v.setAttribute("id",g+"_form"),v.setAttribute("method",d.method),v.setAttribute("enctype","multipart/form-data"),v.setAttribute("encoding","multipart/form-data"),v.setAttribute("target",g+"_iframe"),m.getShimContainer().appendChild(v);f instanceof s&&f.each(function(e,n){if(e instanceof a)y&&y.setAttribute("name",n);else{var i=document.createElement("input");t.extend(i,{type:"hidden",name:n,value:e}),y?v.insertBefore(i,y):v.appendChild(i)}}),v.setAttribute("action",d.url),p(),v.submit(),h.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(n){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),i(ft,[ut,X],function(e,t){return e.Image=t}),a([u,c,l,d,f,p,h,m,g,v,y,w,E,_,x,R,b,T,S,A,O,I,L])}(this);;(function(){"use strict";var e={},t=moxie.core.utils.Basic.inArray;return function n(r){var i,s;for(i in r)s=typeof r[i],s==="object"&&!~t(i,["Exceptions","Env","Mime"])?n(r[i]):s==="function"&&(e[i]=r[i])}(window.moxie),e.Env=window.moxie.core.utils.Env,e.Mime=window.moxie.core.utils.Mime,e.Exceptions=window.moxie.core.Exceptions,window.mOxie=e,window.o||(window.o=e),e})(); +!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r<e.length;++r){if(n=s[e[r]]||o(e[r]),!n)throw"module definition dependecy not found: "+e[r];i.push(n)}t.apply(null,i)}function i(e,i,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(i===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";n(i,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var n=e,i=t.split(/[.\/]/),r=0;r<i.length;++r){if(!n[i[r]])return;n=n[i[r]]}return n}function a(n){for(var i=0;i<n.length;i++){for(var r=e,o=n[i],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={},u="moxie/core/utils/Basic",c="moxie/core/utils/Env",l="moxie/core/I18n",d="moxie/core/utils/Mime",h="moxie/core/utils/Dom",f="moxie/core/Exceptions",p="moxie/core/EventTarget",m="moxie/runtime/Runtime",g="moxie/runtime/RuntimeClient",v="moxie/file/FileInput",w="moxie/core/utils/Encode",y="moxie/file/Blob",E="moxie/file/File",_="moxie/file/FileDrop",b="moxie/file/FileReader",x="moxie/core/utils/Url",R="moxie/runtime/RuntimeTarget",A="moxie/file/FileReaderSync",I="moxie/xhr/FormData",T="moxie/xhr/XMLHttpRequest",S="moxie/runtime/Transporter",O="moxie/image/Image",D="moxie/runtime/html5/Runtime",N="moxie/core/utils/Events",L="moxie/runtime/html5/file/FileInput",C="moxie/runtime/html5/file/Blob",M="moxie/runtime/html5/file/FileDrop",F="moxie/runtime/html5/file/FileReader",P="moxie/runtime/html5/xhr/XMLHttpRequest",H="moxie/runtime/html5/utils/BinaryReader",B="moxie/runtime/html5/image/JPEGHeaders",k="moxie/runtime/html5/image/ExifParser",U="moxie/runtime/html5/image/JPEG",G="moxie/runtime/html5/image/PNG",z="moxie/runtime/html5/image/ImageInfo",q="moxie/runtime/html5/image/MegaPixel",j="moxie/runtime/html5/image/Image",X="moxie/runtime/flash/Runtime",V="moxie/runtime/flash/file/FileInput",W="moxie/runtime/flash/file/Blob",Y="moxie/runtime/flash/file/FileReader",$="moxie/runtime/flash/file/FileReaderSync",J="moxie/runtime/flash/xhr/XMLHttpRequest",Z="moxie/runtime/flash/runtime/Transporter",K="moxie/runtime/flash/image/Image",Q="moxie/runtime/silverlight/Runtime",ee="moxie/runtime/silverlight/file/FileInput",te="moxie/runtime/silverlight/file/Blob",ne="moxie/runtime/silverlight/file/FileDrop",ie="moxie/runtime/silverlight/file/FileReader",re="moxie/runtime/silverlight/file/FileReaderSync",oe="moxie/runtime/silverlight/xhr/XMLHttpRequest",ae="moxie/runtime/silverlight/runtime/Transporter",se="moxie/runtime/silverlight/image/Image",ue="moxie/runtime/html4/Runtime",ce="moxie/runtime/html4/file/FileInput",le="moxie/runtime/html4/file/FileReader",de="moxie/runtime/html4/xhr/XMLHttpRequest",he="moxie/runtime/html4/image/Image";i(u,[],function(){var e=function(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},t=function(i){var r;return n(arguments,function(o,s){s>0&&n(o,function(n,o){n!==r&&(e(i[o])===e(n)&&~a(e(n),["array","object"])?t(i[o],n):i[o]=n)})}),i},n=function(t,n){var i,r,o,a;if(t)if("number"===e(t.length)){for(o=0,i=t.length;i>o;o++)if(n(t[o],o)===!1)return}else if("object"===e(t))for(r in t)if(t.hasOwnProperty(r)&&n(t[r],r)===!1)return},i=function(t){var n;if(!t||"object"!==e(t))return!0;for(n in t)return!1;return!0},r=function(t,n){function i(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?i(r):n(e)})}var r=0,o=t.length;"function"!==e(n)&&(n=function(){}),t&&t.length||n(),i(r)},o=function(e,t){var i=0,r=e.length,o=new Array(r);n(e,function(e,n){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),o[n]=a,i++,i===r&&(o.unshift(null),t.apply(this,o))})})},a=function(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return n}return-1},s=function(t,n){var i=[];"array"!==e(t)&&(t=[t]),"array"!==e(n)&&(n=[n]);for(var r in t)-1===a(t[r],n)&&i.push(t[r]);return i.length?i:!1},u=function(e,t){var i=[];return n(e,function(e){-1!==a(e,t)&&i.push(e)}),i.length?i:null},c=function(e){var t,n=[];for(t=0;t<e.length;t++)n[t]=e[t];return n},l=function(){var e=0;return function(t){var n=(new Date).getTime().toString(32),i;for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}(),d=function(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e},h=function(e){if("string"!=typeof e)return e;var t={t:1099511627776,g:1073741824,m:1048576,k:1024},n;return e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),n=e[2],e=+e[1],t.hasOwnProperty(n)&&(e*=t[n]),Math.floor(e)},f=function(t){var n=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=n.shift();return"undefined"!==e(t)?t:""})};return{guid:l,typeOf:e,extend:t,each:n,isEmptyObj:i,inSeries:r,inParallel:o,inArray:a,arrayDiff:s,arrayIntersect:u,toArray:c,trim:d,sprintf:f,parseSizeStr:h}}),i(c,[u],function(e){function t(e,t,n){var i=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),i=0;r>i;i++)if(e[i]!=t[i]){if(e[i]=u(e[i]),t[i]=u(t[i]),e[i]<t[i]){o=-1;break}if(e[i]>t[i]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",n="?",i="function",r="undefined",o="object",a="major",s="model",u="name",c="type",l="vendor",d="version",h="architecture",f="console",p="mobile",m="tablet",g={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},v={rgx:function(){for(var t,n=0,a,s,u,c,l,d,h=arguments;n<h.length;n+=2){var f=h[n],p=h[n+1];if(typeof t===r){t={};for(u in p)c=p[u],typeof c===o?t[c[0]]=e:t[c]=e}for(a=s=0;a<f.length;a++)if(l=f[a].exec(this.getUA())){for(u=0;u<p.length;u++)d=l[++s],c=p[u],typeof c===o&&c.length>0?2==c.length?typeof c[1]==i?t[c[0]]=c[1].call(this,d):t[c[0]]=c[1]:3==c.length?typeof c[1]!==i||c[1].exec&&c[1].test?t[c[0]]=d?d.replace(c[1],c[2]):e:t[c[0]]=d?c[1].call(this,d,c[2]):e:4==c.length&&(t[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):e):t[c]=d?d:e;break}if(l)break}return t},str:function(t,i){for(var r in i)if(typeof i[r]===o&&i[r].length>0){for(var a=0;a<i[r].length;a++)if(g.has(i[r][a],t))return r===n?e:r}else if(g.has(i[r],t))return r===n?e:r;return t}},w={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},y={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[u,d],[/\s(opr)\/([\w\.]+)/i],[[u,"Opera"],d],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[u,d],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[u,"IE"],d],[/(edge)\/((\d+)?[\w\.]+)/i],[u,d],[/(yabrowser)\/([\w\.]+)/i],[[u,"Yandex"],d],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],d],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[u,d],[/(dolfin)\/([\w\.]+)/i],[[u,"Dolphin"],d],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[u,"Chrome"],d],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[d,[u,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[d,[u,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[d,[u,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[d,[u,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[d,u],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[u,[d,v.str,w.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[u,d],[/(navigator|netscape)\/([\w\.-]+)/i],[[u,"Netscape"],d],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[u,d]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[d,[u,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,d],[/rv\:([\w\.]+).*(gecko)/i],[d,u]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[u,d],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[d,v.str,w.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[d,v.str,w.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],d],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[u,d],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[u,"Symbian"],d],[/\((series40);/i],[u],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],d],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[u,d],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],d],[/(sunos)\s?([\w\.]+\d)*/i],[[u,"Solaris"],d],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[u,d],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[u,"iOS"],[d,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[u,"Mac OS"],[d,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[u,d]]},E=function(e){var n=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return v.rgx.apply(this,y.browser)},this.getEngine=function(){return v.rgx.apply(this,y.engine)},this.getOS=function(){return v.rgx.apply(this,y.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this.setUA(n)};return E}(),i=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var n=new XMLHttpRequest;if(n.open("get","/"),"responseType"in n)return n.responseType=t,n.responseType!==t?!1:!0}}catch(i){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==o.browser||o.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(n){var i=[].slice.call(arguments);return i.shift(),"function"===e.typeOf(t[n])?t[n].apply(this,i):!!t[n]}}(),r=(new n).getResult(),o={can:i,uaParser:n,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return o.OS=o.os,o}),i(l,[u],function(e){var t={};return{addI18n:function(n){return e.extend(t,n)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var n=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=n.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),i(d,[u,l],function(e,t){var n="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",i={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,i,r;for(n=0;n<t.length;n+=2){for(r=t[n+1].split(/ /),i=0;i<r.length;i++)this.mimes[r[i]]=t[n];this.extensions[t[n]]=r}},extList2mimes:function(t,n){var i=this,r,o,a,s,u=[];for(o=0;o<t.length;o++)for(r=t[o].extensions.split(/\s*,\s*/),a=0;a<r.length;a++){if("*"===r[a])return[];if(s=i.mimes[r[a]],s&&-1===e.inArray(s,u)&&u.push(s),n&&/^\w+$/.test(r[a]))u.push("."+r[a]);else if(!s)return[]}return u},mimes2exts:function(t){var n=this,i=[];return e.each(t,function(t){if("*"===t)return i=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(n.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(i,n.extensions[t])}):n.extensions[t]&&[].push.apply(i,n.extensions[t]))}),i},mimes2extList:function(n){var i=[],r=[];return"string"===e.typeOf(n)&&(n=e.trim(n).split(/\s*,\s*/)),r=this.mimes2exts(n),i.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),i.mimes=n,i},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return i.addMimeType(n),i}),i(h,[c],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},n=function(e,t){if(!e.className)return!1;var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return n.test(e.className)},i=function(e,t){n(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return" "===t&&" "===n?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,n){function i(e){var t,n,i=0,r=0;return e&&(n=e.getBoundingClientRect(),t="CSS1Compat"===s.compatMode?s.documentElement:s.body,i=n.left+t.scrollLeft,r=n.top+t.scrollTop),{x:i,y:r}}var r=0,o=0,a,s=document,u,c;if(t=t,n=n||s.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!s.documentMode||s.documentMode<8))return u=i(t),c=i(n),{x:u.x-c.x,y:u.y-c.y};for(a=t;a&&a!=n&&a.nodeType;)r+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=t.parentNode;a&&a!=n&&a.nodeType;)r-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode;return{x:r,y:o}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:i,removeClass:r,getStyle:o,getPos:a,getSize:s}}),i(f,[u],function(e){function t(e,t){var n;for(n in e)if(e[n]===t)return n;return null}return{RuntimeError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": RuntimeError "+this.code}var i={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(n,i),n.prototype=Error.prototype,n}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": ImageError "+this.code}var i={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(n,i),n.prototype=Error.prototype,n}(),FileException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": FileException "+this.code}var i={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(n,i),n.prototype=Error.prototype,n}(),DOMException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": DOMException "+this.code}var i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(n,i),n.prototype=Error.prototype,n}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),i(p,[c,f,u],function(e,t,n){function i(){var e={};n.extend(this,{uid:null,init:function(){this.uid||(this.uid=n.guid("uid_"))},addEventListener:function(t,i,r,o){var a=this,s;return this.hasOwnProperty("uid")||(this.uid=n.guid("uid_")),t=n.trim(t),/\s/.test(t)?void n.each(t.split(/\s+/),function(e){a.addEventListener(e,i,r,o)}):(t=t.toLowerCase(),r=parseInt(r,10)||0,s=e[this.uid]&&e[this.uid][t]||[],s.push({fn:i,priority:r,scope:o||this}),e[this.uid]||(e[this.uid]={}),void(e[this.uid][t]=s))},hasEventListener:function(t){var n=t?e[this.uid]&&e[this.uid][t]:e[this.uid];return n?n:!1},removeEventListener:function(t,i){t=t.toLowerCase();var r=e[this.uid]&&e[this.uid][t],o;if(r){if(i){for(o=r.length-1;o>=0;o--)if(r[o].fn===i){r.splice(o,1);break}}else r=[];r.length||(delete e[this.uid][t],n.isEmptyObj(e[this.uid])&&delete e[this.uid])}},removeAllEventListeners:function(){e[this.uid]&&delete e[this.uid]},dispatchEvent:function(i){var r,o,a,s,u={},c=!0,l;if("string"!==n.typeOf(i)){if(s=i,"string"!==n.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);i=s.type,s.total!==l&&s.loaded!==l&&(u.total=s.total,u.loaded=s.loaded),u.async=s.async||!1}if(-1!==i.indexOf("::")?!function(e){r=e[0],i=e[1]}(i.split("::")):r=this.uid,i=i.toLowerCase(),o=e[r]&&e[r][i]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),u.type=i,a.unshift(u);var d=[];n.each(o,function(e){a[0].target=e.scope,d.push(u.async?function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}:function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&n.inSeries(d,function(e){c=!e})}return c},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===n.typeOf(this[t])&&this[t].apply(this,arguments)}),n.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===n.typeOf(t[e])&&(t[e]=null)})}})}return i.instance=new i,i}),i(m,[c,u,h,p],function(e,t,n,i){function r(e,i,o,s,u){var c=this,l,d=t.guid(i+"_"),h=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(h=r.getMode(s,e.preferred_caps,h)),l=function(){var e={};return{exec:function(t,n,i,r){return l[n]&&(e[t]||(e[t]={context:this,instance:new l[n]}),e[t].instance[i])?e[t].instance[i].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var n=this;t.each(e,function(e,i){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),n.removeInstance(i)})}}}(),t.extend(this,{initialized:!1,uid:d,type:i,mode:r.getMode(s,e.required_caps,h),shimid:d+"_container",clients:0,options:e,can:function(e,n){var i=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(n)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],i))return!1;return!0}return"function"===t.typeOf(i[e])?i[e].call(this,n):n===i[e]},getShimContainer:function(){var e,i=n.get(this.shimid);return i||(e=this.options.container?n.get(this.options.container):document.body,i=document.createElement("div"),i.id=this.shimid,i.className="moxie-shim moxie-shim-"+this.type,t.extend(i.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(i),e=null),i},getShim:function(){return l},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);return c[e]&&c[e][t]?c[e][t].apply(this,n):c.shimExec.apply(this,arguments)},destroy:function(){if(c){var e=n.get(this.shimid);e&&e.parentNode.removeChild(e),l&&l.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=c=l=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=i.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var n={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){n[e]=!0}),n)},r.can=function(e,t){var n,i=r.getConstructor(e),o;return i?(n=new i({required_caps:t}),o=n.mode,n.destroy(),!!o):!1},r.thatCan=function(e,t){var n=(t||r.order).split(/\s*,\s*/);for(var i in n)if(r.can(n[i],e))return n[i];return null},r.getMode=function(e,n,i){var r=null;if("undefined"===t.typeOf(i)&&(i="browser"),n&&!t.isEmptyObj(e)){if(t.each(n,function(n,i){if(e.hasOwnProperty(i)){var o=e[i](n);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(i,r)?i:r[0];if(r===!1)return!1}return i},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),i(g,[c,f,u,m],function(e,t,n,i){return function r(){var e;n.extend(this,{connectRuntime:function(r){function o(n){var s,u;return n.length?(s=n.shift().toLowerCase(),(u=i.getConstructor(s))?(e=new u(r),e.bind("Init",function(){e.initialized=!0,setTimeout(function(){e.clients++,a.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){e.destroy(),o(n)}),e.mode?void e.init():void e.trigger("Error")):void o(n)):(a.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),void(e=null))}var a=this,s;if("string"===n.typeOf(r)?s=r:"string"===n.typeOf(r.ruid)&&(s=r.ruid),s){if(e=i.getRuntime(s))return e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||i.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null}})}}),i(v,[u,c,d,h,f,p,l,m,g],function(e,t,n,i,r,o,a,s,u){function c(t){var o=this,c,d,h;if(-1!==e.inArray(e.typeOf(t),["string","node"])&&(t={browse_button:t}),d=i.get(t.browse_button),!d)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);h={accept:[{title:a.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:d.parentNode||document.body},t=e.extend({},h,t),"string"==typeof t.required_caps&&(t.required_caps=s.parseCaps(t.required_caps)),"string"==typeof t.accept&&(t.accept=n.mimes2extList(t.accept)),c=i.get(t.container),c||(c=document.body),"static"===i.getStyle(c,"position")&&(c.style.position="relative"),c=d=null,u.call(o),e.extend(o,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){o.bind("RuntimeInit",function(n,r){o.ruid=r.uid,o.shimid=r.shimid,o.bind("Ready",function(){o.trigger("Refresh")},999),o.bind("Refresh",function(){var n,o,a,s;a=i.get(t.browse_button),s=i.get(r.shimid),a&&(n=i.getPos(a,i.get(t.container)),o=i.getSize(a),s&&e.extend(s.style,{top:n.y+"px",left:n.x+"px",width:o.w+"px",height:o.h+"px"})),s=a=null}),r.exec.call(o,"FileInput","init",t)}),o.connectRuntime(e.extend({},t,{required_caps:{select_file:!0}}))},disable:function(t){var n=this.getRuntime();n&&n.exec.call(this,"FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){o.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=o.instance,c}),i(w,[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},n=function(e,n){if("function"==typeof window.atob)return n?t(window.atob(e)):window.atob(e);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,h=0,f=0,p="",m=[];if(!e)return e;e+="";do s=i.indexOf(e.charAt(h++)),u=i.indexOf(e.charAt(h++)),c=i.indexOf(e.charAt(h++)),l=i.indexOf(e.charAt(h++)),d=s<<18|u<<12|c<<6|l,r=d>>16&255,o=d>>8&255,a=255&d,64==c?m[f++]=String.fromCharCode(r):64==l?m[f++]=String.fromCharCode(r,o):m[f++]=String.fromCharCode(r,o,a);while(h<e.length);return p=m.join(""),n?t(p):p},i=function(t,n){if(n&&(t=e(t)),"function"==typeof window.btoa)return window.btoa(t);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,h=0,f=0,p="",m=[];if(!t)return t;do r=t.charCodeAt(h++),o=t.charCodeAt(h++),a=t.charCodeAt(h++),d=r<<16|o<<8|a,s=d>>18&63,u=d>>12&63,c=d>>6&63,l=63&d,m[f++]=i.charAt(s)+i.charAt(u)+i.charAt(c)+i.charAt(l);while(h<t.length);p=m.join("");var g=t.length%3;return(g?p.slice(0,g-3):p)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:n,btoa:i}}),i(y,[u,w,g],function(e,t,n){function i(o,a){function s(t,n,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new i(null,{type:o,size:n-t}),a.detach(s.substr(t,a.size)),a):null}n.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,n){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,n)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var n=e.indexOf(";base64,");this.type=e.substring(5,n),e=t.atob(e.substring(n+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return i}),i(E,[u,d,y],function(e,t,n){function i(i,r){r||(r={}),n.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return i.prototype=n.prototype,i}),i(_,[l,h,f,u,c,E,g,p,d],function(e,t,n,i,r,o,a,s,u){function c(n){var r=this,o;"string"==typeof n&&(n={drop_zone:n}),o={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},n="object"==typeof n?i.extend({},o,n):o,n.container=t.get(n.drop_zone)||document.body,"static"===t.getStyle(n.container,"position")&&(n.container.style.position="relative"),"string"==typeof n.accept&&(n.accept=u.mimes2extList(n.accept)),a.call(r),i.extend(r,{uid:i.guid("uid_"),ruid:null,files:null,init:function(){r.bind("RuntimeInit",function(e,t){r.ruid=t.uid,t.exec.call(r,"FileDrop","init",n),r.dispatchEvent("ready")}),r.connectRuntime(n)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),i(b,[u,w,f,p,y,g],function(e,t,n,i,r,o){function a(){function i(e,i){var o=this;if(this.trigger("loadstart"),this.readyState===a.LOADING)return this.trigger("error",new n.DOMException(n.DOMException.INVALID_STATE_ERR)),void this.trigger("loadend");if(!(i instanceof r))return this.trigger("error",new n.DOMException(n.DOMException.NOT_FOUND_ERR)),void this.trigger("loadend");if(this.result=null,this.readyState=a.LOADING,i.isDetached()){var s=i.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=s;break;case"readAsDataURL":this.result="data:"+i.type+";base64,"+t.btoa(s)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(i.ruid),this.exec("FileReader","read",e,i)}o.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){i.call(this,"readAsDataURL",e)},readAsText:function(e){i.call(this,"readAsText",e); +},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(e){this.readyState=a.DONE},999)}var s=["loadstart","progress","load","abort","error","loadend"];return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=i.instance,a}),i(x,[],function(){var e=function(t,n){for(var i=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=i.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[i[r]]=u[r]);if(!a.scheme){n&&"string"!=typeof n||(n=e(n||document.location.href)),a.scheme=n.scheme,a.host=n.host,a.port=n.port;var c="";/^[^\/]/.test(a.path)&&(c=n.path,c=/\/[^\/]*\.[^\/]*$/.test(c)?c.replace(/\/[^\/]+$/,"/"):c.replace(/\/?$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var n={http:80,https:443},i="object"==typeof t?t:e(t);return i.scheme+"://"+i.host+(i.port!==n[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}}),i(R,[u,g,p],function(e,t,n){function i(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return i.prototype=n.instance,i}),i(A,[u,g,w],function(e,t,n){return function(){function i(e,t){if(!t.isDetached()){var i=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),i}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+n.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return i.call(this,"readAsDataURL",e)},readAsText:function(e){return i.call(this,"readAsText",e)}})}}),i(I,[f,u,y],function(e,t,n){function i(){var e,i=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof n?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):i.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(n){t.each(i,function(e){n(e.value,e.name)}),e&&n(e.value,e.name)},destroy:function(){e=null,i=[]}})}return i}),i(T,[u,f,p,w,x,m,R,y,A,I,c,d],function(e,t,n,i,r,o,a,s,u,c,l,d){function h(){this.uid=e.guid("uid_")}function f(){function n(e,t){return w.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?w[e]:v[e]:void(l.can("define_property")?w[e]=t:v[e]=t):void 0}function u(t){function i(){B&&(B.destroy(),B=null),s.dispatchEvent("loadend"),s=null}function r(r){B.bind("LoadStart",function(e){n("readyState",f.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),O&&s.upload.dispatchEvent(e)}),B.bind("Progress",function(e){n("readyState")!==f.LOADING&&(n("readyState",f.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),B.bind("UploadProgress",function(e){O&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),B.bind("Load",function(t){n("readyState",f.DONE),n("status",Number(r.exec.call(B,"XMLHttpRequest","getStatus")||0)),n("statusText",p[n("status")]||""),n("response",r.exec.call(B,"XMLHttpRequest","getResponse",n("responseType"))),~e.inArray(n("responseType"),["text",""])?n("responseText",n("response")):"document"===n("responseType")&&n("responseXML",n("response")),k=r.exec.call(B,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),n("status")>0?(O&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(N=!0,s.dispatchEvent("error")),i()}),B.bind("Abort",function(e){s.dispatchEvent(e),i()}),B.bind("Error",function(e){N=!0,n("readyState",f.DONE),s.dispatchEvent("readystatechange"),D=!0,s.dispatchEvent(e),i()}),r.exec.call(B,"XMLHttpRequest","send",{url:E,method:_,async:y,user:x,password:R,headers:b,mimeType:I,encoding:A,responseType:s.responseType,withCredentials:s.withCredentials,options:H},t)}var s=this;C=(new Date).getTime(),B=new a,"string"==typeof H.required_caps&&(H.required_caps=o.parseCaps(H.required_caps)),H.required_caps=e.extend({},H.required_caps,{return_response_type:s.responseType}),t instanceof c&&(H.required_caps.send_multipart=!0),e.isEmptyObj(b)||(H.required_caps.send_custom_headers=!0),L||(H.required_caps.do_cors=!0),H.ruid?r(B.connectRuntime(H)):(B.bind("RuntimeInit",function(e,t){r(t)}),B.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),B.connectRuntime(H))}function g(){n("responseText",""),n("responseXML",null),n("response",null),n("status",0),n("statusText",""),C=M=null}var v=this,w={timeout:0,readyState:f.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},y=!0,E,_,b={},x,R,A=null,I=null,T=!1,S=!1,O=!1,D=!1,N=!1,L=!1,C,M,F=null,P=null,H={},B,k="",U;e.extend(this,w,{uid:e.guid("uid_"),upload:new h,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||i.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(_=o.toUpperCase()),~e.inArray(_,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=i.utf8_encode(a),l=r.parseUrl(a),L=r.hasSameOrigin(l),E=r.resolveUrl(a),(u||c)&&!L)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(x=u||l.user,R=c||l.pass,y=s||!0,y===!1&&(n("timeout")||n("withCredentials")||""!==n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);T=!y,S=!1,b={},g.call(this),n("readyState",f.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(n("readyState")!==f.OPENED||S)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||i.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(b[r]?b[r]+=", "+o:b[r]=o,!0)},getAllResponseHeaders:function(){return k||""},getResponseHeader:function(t){return t=t.toLowerCase(),N||~e.inArray(t,["set-cookie","set-cookie2"])?null:k&&""!==k&&(U||(U={},e.each(k.split(/\r\n/),function(t){var n=t.split(/:\s+/);2===n.length&&(n[0]=e.trim(n[0]),U[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])})})),U.hasOwnProperty(t))?U[t].header+": "+U[t].value:null},overrideMimeType:function(i){var r,o;if(~e.inArray(n("readyState"),[f.LOADING,f.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i=e.trim(i.toLowerCase()),/;/.test(i)&&(r=i.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(i=r[1],r[2]&&(o=r[2])),!d.mimes[i])throw new t.DOMException(t.DOMException.SYNTAX_ERR);F=i,P=o},send:function(n,r){if(H="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==f.OPENED||S)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n instanceof s)H.ruid=n.ruid,I=n.type||"application/octet-stream";else if(n instanceof c){if(n.hasBlob()){var o=n.getBlob();H.ruid=o.ruid,I=o.type||"application/octet-stream"}}else"string"==typeof n&&(A="UTF-8",I="text/plain;charset=UTF-8",n=i.utf8_encode(n));this.withCredentials||(this.withCredentials=H.required_caps&&H.required_caps.send_browser_cookies&&!L),O=!T&&this.upload.hasEventListener(),N=!1,D=!n,T||(S=!0),u.call(this,n)},abort:function(){if(N=!0,T=!1,~e.inArray(n("readyState"),[f.UNSENT,f.OPENED,f.DONE]))n("readyState",f.UNSENT);else{if(n("readyState",f.DONE),S=!1,!B)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);B.getRuntime().exec.call(B,"XMLHttpRequest","abort",D),D=!0}},destroy:function(){B&&("function"===e.typeOf(B.destroy)&&B.destroy(),B=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(m.concat(["readystatechange"])),this.upload.handleEventProps(m)}var p={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};h.prototype=n.instance;var m=["loadstart","progress","abort","error","load","timeout","loadend"],g=1,v=2;return f.UNSENT=0,f.OPENED=1,f.HEADERS_RECEIVED=2,f.LOADING=3,f.DONE=4,f.prototype=n.instance,f}),i(S,[u,w,g,p],function(e,t,n,i){function r(){function i(){l=d=0,c=this.result=null}function o(t,n){var i=this;u=n,i.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(i.state,[r.IDLE,r.DONE])&&a.call(i)},999),i.bind("TransportingComplete",function(){d=l,i.state=r.DONE,c=null,i.result=u.exec.call(i,"Transporter","getAsBlob",t||"")},999),i.state=r.BUSY,i.trigger("TransportingStarted"),a.call(i)}function a(){var e=this,n,i=l-d;h>i&&(h=i),n=t.btoa(c.substr(d,h)),u.exec.call(e,"Transporter","receive",n,l)}var s,u,c,l,d,h;n.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,n,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),h=r.chunk_size,i.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,n,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,n,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),i.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),i.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=i.instance,r}),i(O,[u,h,f,A,T,m,g,S,c,p,y,E,w],function(e,t,n,i,r,o,a,s,u,c,l,d,h){function f(){function i(e){e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name)}function c(t){var i=e.typeOf(t);try{if(t instanceof f){if(!t.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);m.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new n.ImageError(n.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(i,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===i)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):v.apply(this,arguments);else{if("node"!==i||"img"!==t.nodeName.toLowerCase())throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function m(t,n){var i=this.connectRuntime(t.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(n)?!0:n)}function g(t,n){function i(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){i(t)}),n&&"string"==typeof n.required_caps&&(n.required_caps=o.parseCaps(n.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},n))):i(this.connectRuntime(t.ruid))}function v(e,t){var n=this,i;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},downsize:function(t){var i={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:!1};t="object"==typeof t?e.extend(i,t):e.extend(i,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]});try{if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>f.MAX_RESIZE_WIDTH||this.height>f.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);this.exec("Image","downsize",t.width,t.height,t.crop,t.preserveHeaders)}catch(r){this.trigger("error",r.code)}},crop:function(e,t,n){this.downsize(e,t,!0,n)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return h.atob(n.substring(n.indexOf("base64,")+7))},embed:function(i,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return i.appendChild(l),l=null,o.destroy(),void a.trigger("embedded")}var d=o.getAsDataURL(t,r);if(!d)throw new n.ImageError(n.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))i.innerHTML='<img src="'+d+'" width="'+o.width+'" height="'+o.height+'" />',o.destroy(),a.trigger("embedded");else{var f=new s;f.bind("TransportingComplete",function(){c=a.connectRuntime(this.result.ruid),a.bind("Embedded",function(){e.extend(c.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),c=null},999),c.exec.call(a,"ImageView","display",this.result.uid,width,height),o.destroy()}),f.transport(h.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:i})}}var a=this,c;r=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},r||{});try{if(!(i=t.get(i)))throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);this.width>f.MAX_RESIZE_WIDTH||this.height>f.MAX_RESIZE_HEIGHT;var l=new f;return l.bind("Resize",function(){o.call(this,r.type,r.quality)}),l.bind("Load",function(){l.downsize(r)}),this.meta.thumb&&this.meta.thumb.width>=r.width&&this.meta.thumb.height>=r.height?l.load(this.meta.thumb.data):l.clone(this,!1),l}catch(d){this.trigger("error",d.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}}),this.handleEventProps(p),this.bind("Load Resize",function(){i.call(this)},999)}var p=["progress","load","error","resize","embedded"];return f.MAX_RESIZE_WIDTH=8192,f.MAX_RESIZE_HEIGHT=8192,f.prototype=c.instance,f}),i(D,[u,f,m,c],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue,c=e.extend({access_binary:s(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return r.can("access_binary")&&!!a.Image},display_media:s(i.can("create_canvas")||i.can("use_data_uri_over32kb")),do_cors:s(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:s(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==i.browser||i.verComp(i.version,9,">"))}()),filter_by_extension:s(function(){return"Chrome"===i.browser&&i.verComp(i.version,28,">=")||"IE"===i.browser&&i.verComp(i.version,10,">=")||"Safari"===i.browser&&i.verComp(i.version,7,">=")}()),return_response_headers:u,return_response_type:function(e){return"json"===e&&window.JSON?!0:i.can("return_response_type",e)},return_status_code:u,report_upload_progress:s(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return r.can("access_binary")&&i.can("create_canvas")},select_file:function(){return i.can("use_fileinput")&&window.File},select_folder:function(){return r.can("select_file")&&"Chrome"===i.browser&&i.verComp(i.version,21,">=")},select_multiple:function(){return!(!r.can("select_file")||"Safari"===i.browser&&"Windows"===i.os||"iOS"===i.os&&i.verComp(i.osVersion,"7.0.0",">")&&i.verComp(i.osVersion,"8.0.0","<"))},send_binary_string:s(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:s(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||r.can("send_binary_string")},slice_blob:s(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return r.can("slice_blob")&&r.can("send_multipart")},summon_file_dialog:function(){return r.can("select_file")&&("Firefox"===i.browser&&i.verComp(i.version,4,">=")||"Opera"===i.browser&&i.verComp(i.version,12,">=")||"IE"===i.browser&&i.verComp(i.version,10,">=")||!!~e.inArray(i.browser,["Chrome","Safari"]))},upload_filesize:u},arguments[2]);n.call(this,t,arguments[1]||o,c),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html5",a={};return n.addConstructor(o,r),a}),i(N,[u],function(e){function t(){this.returnValue=!1}function n(){this.cancelBubble=!0}var i={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=n,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),i.hasOwnProperty(o[r])||(i[o[r]]={}),l=i[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,n,o){var a,s;if(n=n.toLowerCase(),t[r]&&i[t[r]]&&i[t[r]][n]){a=i[t[r]][n];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(n,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+n,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete i[t[r]][n],e.isEmptyObj(i[t[r]])){delete i[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,n){t&&t[r]&&e.each(i[t[r]],function(e,i){a(t,i,n)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),i(L,[D,E,u,h,N,d,c],function(e,t,n,i,r,o,a){function s(){var e;n.extend(this,{init:function(s){var u=this,c=u.getRuntime(),l,d,h,f,p,m;e=s,h=e.accept.mimes||o.extList2mimes(e.accept,c.can("filter_by_extension")),d=c.getShimContainer(),d.innerHTML='<input id="'+c.uid+'" type="file" style="font-size:999px;opacity:0;"'+(e.multiple&&c.can("select_multiple")?"multiple":"")+(e.directory&&c.can("select_folder")?"webkitdirectory directory":"")+(h?' accept="'+h.join(",")+'"':"")+" />",l=i.get(c.uid),n.extend(l.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),f=i.get(e.browse_button),c.can("summon_file_dialog")&&("static"===i.getStyle(f,"position")&&(f.style.position="relative"),p=parseInt(i.getStyle(f,"z-index"),10)||1,f.style.zIndex=p,d.style.zIndex=p-1,r.addEvent(f,"click",function(e){var t=i.get(c.uid);t&&!t.disabled&&t.click(),e.preventDefault()},u.uid)),m=c.can("summon_file_dialog")?f:d,r.addEvent(m,"mouseover",function(){u.trigger("mouseenter")},u.uid),r.addEvent(m,"mouseout",function(){u.trigger("mouseleave")},u.uid),r.addEvent(m,"mousedown",function(){u.trigger("mousedown")},u.uid),r.addEvent(i.get(e.container),"mouseup",function(){u.trigger("mouseup")},u.uid),l.onchange=function g(i){if(u.files=[],n.each(this.files,function(n){var i="";return e.directory&&"."==n.name?!0:(n.webkitRelativePath&&(i="/"+n.webkitRelativePath.replace(/^\//,"")),n=new t(c.uid,n),n.relativePath=i,void u.files.push(n))}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var r=this.cloneNode(!0);this.parentNode.replaceChild(r,this),r.onchange=g}u.files.length&&u.trigger("change")},u.trigger({type:"ready",async:!0}),d=null},disable:function(e){var t=this.getRuntime(),n;(n=i.get(t.uid))&&(n.disabled=!!e)},destroy:function(){var t=this.getRuntime(),n=t.getShim(),o=t.getShimContainer();r.removeAllEvents(o,this.uid),r.removeAllEvents(e&&i.get(e.container),this.uid),r.removeAllEvents(e&&i.get(e.browse_button),this.uid),o&&(o.innerHTML=""),n.removeInstance(this.uid),e=o=n=null}})}return e.FileInput=s}),i(C,[D,y],function(e,t){function n(){function e(e,t,n){var i;if(!window.File.prototype.slice)return(i=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?i.call(e,t,n):null;try{return e.slice(),e.slice(t,n)}catch(r){return e.slice(t,n-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n}),i(M,[D,E,u,h,N,d],function(e,t,n,i,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=n.toArray(e.dataTransfer.types||[]);return-1!==n.inArray("Files",t)||-1!==n.inArray("public.file-url",t)||-1!==n.inArray("application/x-moz-file",t)}function a(e,n){if(u(e)){var i=new t(g,e);i.relativePath=n||"",f.push(i)}}function s(e){for(var t=[],i=0;i<e.length;i++)[].push.apply(t,e[i].extensions.split(/\s*,\s*/));return-1===n.inArray("*",t)?t:[]}function u(e){if(!p.length)return!0;var t=o.getFileExtension(e.name);return!t||-1!==n.inArray(t,p)}function c(e,t){var i=[];n.each(e,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?a(e.getAsFile(),t.fullPath):i.push(t))}),i.length?l(i,t):t()}function l(e,t){var i=[];n.each(e,function(e){i.push(function(t){d(e,t)})}),n.inSeries(i,function(){t()})}function d(e,t){e.isFile?e.file(function(n){a(n,e.fullPath),t()},function(){t()}):e.isDirectory?h(e,t):t()}function h(e,t){function n(e){r.readEntries(function(t){t.length?([].push.apply(i,t),n(e)):e()},e)}var i=[],r=e.createReader();n(function(){l(i,t)})}var f=[],p=[],m,g;n.extend(this,{init:function(t){var i=this,o;m=t,g=i.ruid,p=s(m.accept),o=m.container,r.addEvent(o,"dragover",function(t){e(t)&&(t.preventDefault(),t.dataTransfer.dropEffect="copy")},i.uid),r.addEvent(o,"drop",function(t){e(t)&&(t.preventDefault(),f=[],t.dataTransfer.items&&t.dataTransfer.items[0].webkitGetAsEntry?c(t.dataTransfer.items,function(){i.files=f,i.trigger("drop")}):(n.each(t.dataTransfer.files,function(e){a(e)}),i.files=f,i.trigger("drop")))},i.uid),r.addEvent(o,"dragenter",function(e){i.trigger("dragenter")},i.uid),r.addEvent(o,"dragleave",function(e){i.trigger("dragleave")},i.uid)},destroy:function(){r.removeAllEvents(m&&i.get(m.container),this.uid),g=f=p=m=null}})}return e.FileDrop=a}),i(F,[D,w,u],function(e,t,n){function i(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var i,r=!1;n.extend(this,{read:function(t,o){var a=this;a.result="",i=new window.FileReader,i.addEventListener("progress",function(e){a.trigger(e)}),i.addEventListener("load",function(t){a.result=r?e(i.result):i.result,a.trigger(t)}),i.addEventListener("error",function(e){a.trigger(e,i.error)}),i.addEventListener("loadend",function(e){i=null,a.trigger(e)}),"function"===n.typeOf(i[t])?(r=!1,i[t](o.getSource())):"readAsBinaryString"===t&&(r=!0,i.readAsDataURL(o.getSource()))},abort:function(){i&&i.abort()},destroy:function(){i=null}})}return e.FileReader=i}),i(P,[D,u,d,x,E,y,I,f,c],function(e,t,n,i,r,o,a,s,u){function c(){function e(e,t){var n=this,i,r;i=t.getBlob().getSource(),r=new window.FileReader,r.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:r.result})),h.send.call(n,e,t)},r.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.verComp(u.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(n){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,n=e.responseText;return"IE"===u.browser&&n&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(n)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),n="--",i="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return f.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?n+t+i+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+i+"Content-Type: "+(e.type||"application/octet-stream")+i+i+e.getSource()+i:n+t+i+'Content-Disposition: form-data; name="'+a+'"'+i+i+unescape(encodeURIComponent(e))+i}),r+=n+t+n+i}var h=this,f,p;t.extend(this,{send:function(n,r){var s=this,l="Mozilla"===u.browser&&u.verComp(u.version,4,">=")&&u.verComp(u.version,7,"<"),h="Android Browser"===u.browser,m=!1;if(p=n.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),f=c(),f.open(n.method,n.url,n.async,n.user,n.password),r instanceof o)r.isDetached()&&(m=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),m=!0;else if((l||h)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return void e.call(s,n,r);if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}f.upload?(n.withCredentials&&(f.withCredentials=!0),f.addEventListener("load",function(e){s.trigger(e)}),f.addEventListener("error",function(e){s.trigger(e)}),f.addEventListener("progress",function(e){s.trigger(e)}),f.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):f.onreadystatechange=function v(){switch(f.readyState){case 1:break;case 2:break;case 3:var e,t;try{i.hasSameOrigin(n.url)&&(e=f.getResponseHeader("Content-Length")||0),f.responseText&&(t=f.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:f.onreadystatechange=function(){},s.trigger(0===f.status?"error":"load")}},t.isEmptyObj(n.headers)||t.each(n.headers,function(e,t){f.setRequestHeader(t,e)}),""!==n.responseType&&"responseType"in f&&("json"!==n.responseType||u.can("return_response_type","json")?f.responseType=n.responseType:f.responseType="text"),m?f.sendAsBinary?f.sendAsBinary(r):!function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);f.send(e.buffer)}():f.send(r),s.trigger("loadstart")},getStatus:function(){try{if(f)return f.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var i=new r(t.uid,f.response),o=f.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(p=a[2])}return i.name=p,i.type||(i.type=n.getFileMime(p)),i;case"json":return u.can("return_response_type","json")?f.response:200===f.status&&window.JSON?JSON.parse(f.responseText):null;case"document":return l(f);default:return""!==f.responseText?f.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return f.getAllResponseHeaders()}catch(e){}return""},abort:function(){f&&f.abort()},destroy:function(){h=p=null}})}return e.XMLHttpRequest=c}),i(H,[u],function(e){function t(e){e instanceof ArrayBuffer?n.apply(this,arguments):i.apply(this,arguments)}function n(t){var n=new DataView(t);e.extend(this,{readByteAt:function(e){return n.getUint8(e)},writeByteAt:function(e,t){n.setUint8(e,t)},SEGMENT:function(e,i,r){switch(arguments.length){case 2:return t.slice(e,e+i);case 1:return t.slice(e);case 3:if(null===r&&(r=new ArrayBuffer),r instanceof ArrayBuffer){var o=new Uint8Array(this.length()-i+r.byteLength);e>0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+i)),e+r.byteLength),this.clear(),t=o.buffer,n=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){n=t=null}})}function i(t){function n(e,n,i){i=3===arguments.length?i:t.length-n-1,t=t.substr(0,n)+e+t.substr(i+n)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){n(String.fromCharCode(t),e,1)},SEGMENT:function(e,i,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,i);case 3:n(null!==r?r:"",e,i);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var n,i,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(i=this.littleEndian?0:-8*(t-1),r=0,n=0;t>r;r++)n|=this.readByteAt(e+r)<<Math.abs(i+8*r);return n},write:function(e,t,n){var i,r,o="";if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(i=this.littleEndian?0:-8*(n-1),r=0;n>r;r++)this.writeByteAt(e+r,t>>Math.abs(i+8*r)&255)},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,n){for(var i=[],r=0;n>r;r++)i[r]=this[e](t+r);return i}}),t}),i(B,[H,f],function(e,t){return function n(i){var r=[],o,a,s,u=0;if(o=new e(i),65496!==o.SHORT(0))throw o.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(a=2;a<=o.length();)if(s=o.SHORT(a),s>=65488&&65495>=s)a+=2;else{if(65498===s||65497===s)break;u=o.SHORT(a+2)+2,s>=65505&&65519>=s&&r.push({hex:s,name:"APP"+(15&s),start:a,length:u,segment:o.SEGMENT(a,u)}),a+=u}return o.clear(),{headers:r,restore:function(t){var n,i,o;for(o=new e(t),a=65504==o.SHORT(2)?4+o.SHORT(4):2,i=0,n=r.length;n>i;i++)o.SEGMENT(a,0,r[i].segment),a+=r[i].length;return t=o.SEGMENT(),o.clear(),t},strip:function(t){var i,r,o,a;for(o=new n(t),r=o.headers,o.purge(),i=new e(t),a=r.length;a--;)i.SEGMENT(r[a].start,r[a].length,"");return t=i.SEGMENT(),i.clear(),t},get:function(e){for(var t=[],n=0,i=r.length;i>n;n++)r[n].name===e.toUpperCase()&&t.push(r[n].segment);return t}, +set:function(e,t){var n=[],i,o,a;for("string"==typeof t?n.push(t):n=t,i=o=0,a=r.length;a>i&&(r[i].name===e.toUpperCase()&&(r[i].segment=n[o],r[i].length=n[o].length,o++),!(o>=n.length));i++);},purge:function(){this.headers=r=[]}}}}),i(k,[u,H,f],function(e,n,i){function r(o){function a(n,r){var o=this,a,s,u,c,h,f,p,m,g=[],v={},w={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},y={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(a=o.SHORT(n),s=0;a>s;s++)if(g=[],p=n+2+12*s,u=r[o.SHORT(p)],u!==t){if(c=w[o.SHORT(p+=2)],h=o.LONG(p+=2),f=y[c],!f)throw new i.ImageError(i.ImageError.INVALID_META_ERR);if(p+=4,f*h>4&&(p=o.LONG(p)+d.tiffHeader),p+f*h>=this.length())throw new i.ImageError(i.ImageError.INVALID_META_ERR);"ASCII"!==c?(g=o.asArray(c,p,h),m=1==h?g[0]:g,l.hasOwnProperty(u)&&"object"!=typeof m?v[u]=l[u][m]:v[u]=m):v[u]=e.trim(o.STRING(p,h).replace(/\0$/,""))}return v}function s(e,t,n){var i,r,o,a=0;if("string"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}i=d[e.toLowerCase()+"IFD"],r=this.SHORT(i);for(var l=0;r>l;l++)if(o=i+12*l+2,this.SHORT(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,n,4)}catch(h){return!1}return!0}var u,c,l,d,h,f;if(n.call(this,o),c={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},d={tiffHeader:10},h=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new i.ImageError(i.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new i.ImageError(i.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return f||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=a.call(this,d.exifIFD,c.exif)}catch(n){return null}if(t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var i=0,r="";i<t.ExifVersion.length;i++)r+=String.fromCharCode(t.ExifVersion[i]);t.ExifVersion=r}}return t},GPS:function(){var t=null;if(d.gpsIFD){try{t=a.call(this,d.gpsIFD,c.gps)}catch(n){return null}t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join("."))}return t},thumb:function(){if(d.IFD1)try{var e=a.call(this,d.IFD1,c.thumb);if("JPEGInterchangeFormat"in e)return this.SEGMENT(d.tiffHeader+e.JPEGInterchangeFormat,e.JPEGInterchangeFormatLength)}catch(t){}return null},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:s.call(this,"exif",e,t)},clear:function(){u.clear(),o=c=l=f=d=u=null}}),65505!==this.SHORT(0)||"EXIF\x00"!==this.STRING(4,5).toUpperCase())throw new i.ImageError(i.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(h),42!==this.SHORT(h+=2))throw new i.ImageError(i.ImageError.INVALID_META_ERR);d.IFD0=d.tiffHeader+this.LONG(h+=2),f=a.call(this,d.IFD0,c.tiff),"ExifIFDPointer"in f&&(d.exifIFD=d.tiffHeader+f.ExifIFDPointer,delete f.ExifIFDPointer),"GPSInfoIFDPointer"in f&&(d.gpsIFD=d.tiffHeader+f.GPSInfoIFDPointer,delete f.GPSInfoIFDPointer),e.isEmptyObj(f)&&(f=null);var p=this.LONG(d.IFD0+12*this.SHORT(d.IFD0)+2);p&&(d.IFD1=d.tiffHeader+p)}return r.prototype=n.prototype,r}),i(U,[u,f,B,H,k],function(e,t,n,i,r){function o(o){function a(e){var t=0,n,i;for(e||(e=c);t<=e.length();){if(n=e.SHORT(t+=2),n>=65472&&65475>=n)return t+=5,{height:e.SHORT(t),width:e.SHORT(t+=2)};i=e.SHORT(t+=2),t+=i-2}return null}function s(){var e=d.thumb(),t,n;return e&&(t=new i(e),n=a(t),t.clear(),n)?(n.data=e,n):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),h=l=d=c=null)}var c,l,d,h;if(c=new i(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new n(o);try{d=new r(l.get("app1")[0])}catch(f){}h=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:h&&h.width||0,height:h&&h.height||0,setExif:function(t,n){return d?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,n),void l.set("app1",d.SEGMENT())):!1},writeHeaders:function(){return l.restore(arguments.length?arguments[0]:o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),i(G,[f,u,H],function(e,t,n){function i(i){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),i=l=u=c=s=null)}function a(e){var t,n,i,r;return t=s.LONG(e),n=s.STRING(e+=4,4),i=e+=4,r=s.LONG(e+t),{length:t,type:n,start:i,CRC:r}}var s,u,c,l;s=new n(i),function(){var t=0,n=0,i=[35152,20039,3338,6666];for(n=0;n<i.length;n++,t+=2)if(i[n]!=s.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),l=r.call(this),t.extend(this,{type:"image/png",size:s.length(),width:l.width,height:l.height,purge:function(){o.call(this)}}),o.call(this)}return i}),i(z,[u,f,U,G],function(e,t,n,i){return function(r){var o=[n,i],a;a=function(){for(var e=0;e<o.length;e++)try{return new o[e](r)}catch(n){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){r=null}}),e.extend(this,a),this.purge=function(){a.purge(),a=null}}}),i(q,[],function(){function e(e,i,r){var o=e.naturalWidth,a=e.naturalHeight,s=r.width,u=r.height,c=r.x||0,l=r.y||0,d=i.getContext("2d");t(e)&&(o/=2,a/=2);var h=1024,f=document.createElement("canvas");f.width=f.height=h;for(var p=f.getContext("2d"),m=n(e,o,a),g=0;a>g;){for(var v=g+h>a?a-g:h,w=0;o>w;){var y=w+h>o?o-w:h;p.clearRect(0,0,h,h),p.drawImage(e,-w,-g);var E=w*s/o+c<<0,_=Math.ceil(y*s/o),b=g*u/a/m+l<<0,x=Math.ceil(v*u/a/m);d.drawImage(f,0,0,y,v,E,b,_,x),w+=h}g+=h}f=p=null}function t(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1048576){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");return r.drawImage(e,-t+1,0),0===r.getImageData(0,0,1,1).data[3]}return!1}function n(e,t,n){var i=document.createElement("canvas");i.width=1,i.height=n;var r=i.getContext("2d");r.drawImage(e,0,0);for(var o=r.getImageData(0,0,1,n).data,a=0,s=n,u=n;u>a;){var c=o[4*(u-1)+3];0===c?s=u:a=u,u=s+a>>1}i=null;var l=u/n;return 0===l?1:l}return{isSubsampled:t,renderTo:e}}),i(j,[D,u,f,w,y,E,z,q,d,c],function(e,t,n,i,r,o,a,s,u,c){function l(){function e(){if(!_&&!y)throw new n.ImageError(n.DOMException.INVALID_STATE_ERR);return _||y}function l(e){return i.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+i.btoa(e)}function h(e){var t=this;y=new Image,y.onerror=function(){v.call(this),t.trigger("error",n.ImageError.WRONG_FORMAT)},y.onload=function(){t.trigger("load")},y.src="data:"==e.substr(0,5)?e:d(e,x.type)}function f(e,t){var i=this,r;return window.FileReader?(r=new FileReader,r.onload=function(){t(this.result)},r.onerror=function(){i.trigger("error",n.ImageError.WRONG_FORMAT)},r.readAsDataURL(e),void 0):t(e.getAsDataURL())}function p(n,i,r,o){var a=this,s,u,c=0,l=0,d,h,f,p;if(A=o,p=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,-1!==t.inArray(p,[5,6,7,8])){var v=n;n=i,i=v}return d=e(),r?(n=Math.min(n,d.width),i=Math.min(i,d.height),s=Math.max(n/d.width,i/d.height)):s=Math.min(n/d.width,i/d.height),s>1&&!r&&o?void this.trigger("Resize"):(_||(_=document.createElement("canvas")),h=Math.round(d.width*s),f=Math.round(d.height*s),r?(_.width=n,_.height=i,h>n&&(c=Math.round((h-n)/2)),f>i&&(l=Math.round((f-i)/2))):(_.width=h,_.height=f),A||g(_.width,_.height,p),m.call(this,d,_,-c,-l,h,f),this.width=_.width,this.height=_.height,R=!0,void a.trigger("Resize"))}function m(e,t,n,i,r,o){if("iOS"===c.OS)s.renderTo(e,t,{width:r,height:o,x:n,y:i});else{var a=t.getContext("2d");a.drawImage(e,n,i,r,o)}}function g(e,t,n){switch(n){case 5:case 6:case 7:case 8:_.width=t,_.height=e;break;default:_.width=e,_.height=t}var i=_.getContext("2d");switch(n){case 2:i.translate(e,0),i.scale(-1,1);break;case 3:i.translate(e,t),i.rotate(Math.PI);break;case 4:i.translate(0,t),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-t);break;case 7:i.rotate(.5*Math.PI),i.translate(e,-t),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-e,0)}}function v(){E&&(E.purge(),E=null),b=y=_=x=null,R=!1}var w=this,y,E,_,b,x,R=!1,A=!0;t.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!i.can("access_binary"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);return x=e,e.isDetached()?(b=e.getSource(),void h.call(this,b)):void f.call(this,e.getSource(),function(e){r&&(b=l(e)),h.call(t,e)})},loadFromImage:function(e,t){this.meta=e.meta,x=new o(null,{name:e.name,size:e.size,type:e.type}),h.call(this,t?b=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t=this.getRuntime(),n;return!E&&b&&t.can("access_image_binary")&&(E=new a(b)),n={width:e().width||0,height:e().height||0,type:x.type||u.getFileMime(x.name),size:b&&b.length||x.size||0,name:x.name||"",meta:E&&E.meta||this.meta||{}},!n.meta||!n.meta.thumb||n.meta.thumb.data instanceof r||(n.meta.thumb.data=new r(null,{type:"image/jpeg",data:n.meta.thumb.data})),n},downsize:function(){p.apply(this,arguments)},getAsCanvas:function(){return _&&(_.id=this.uid+"_canvas"),_},getAsBlob:function(e,t){return e!==this.type&&p.call(this,this.width,this.height,!1),new o(null,{name:x.name||"",type:e,data:w.getAsBinaryString.call(this,e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!R)return y.src;if("image/jpeg"!==e)return _.toDataURL("image/png");try{return _.toDataURL("image/jpeg",t/100)}catch(n){return _.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!R)return b||(b=l(w.getAsDataURL(e,t))),b;if("image/jpeg"!==e)b=l(w.getAsDataURL(e,t));else{var n;t||(t=90);try{n=_.toDataURL("image/jpeg",t/100)}catch(i){n=_.toDataURL("image/jpeg")}b=l(n),E&&(b=E.stripHeaders(b),A&&(E.meta&&E.meta.exif&&E.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),b=E.writeHeaders(b)),E.purge(),E=null)}return R=!1,b},destroy:function(){w=null,v.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=l}),i(X,[u,c,h,f,m],function(e,t,n,i,r){function o(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(n){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function a(e){var i=n.get(e);i&&"OBJECT"==i.nodeName&&("IE"===t.browser?(i.style.display="none",function r(){4==i.readyState?s(e):setTimeout(r,10)}()):i.parentNode.removeChild(i))}function s(e){var t=n.get(e);if(t){for(var i in t)"function"==typeof t[i]&&(t[i]=null);t.parentNode.removeChild(t)}}function u(s){var u=this,d;s=e.extend({swf_url:t.swf_url},s),r.call(this,s,c,{access_binary:function(e){return e&&"browser"===u.mode},access_image_binary:function(e){return e&&"browser"===u.mode},display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===u.mode},resize_image:r.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===u.mode},return_status_code:function(t){return"browser"===u.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:function(e){return e&&"browser"===u.mode},send_browser_cookies:function(e){return e&&"browser"===u.mode},send_custom_headers:function(e){return e&&"browser"===u.mode},send_multipart:r.capTrue,slice_blob:function(e){return e&&"browser"===u.mode},stream_upload:function(e){return e&&"browser"===u.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===u.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),o()<10&&(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return u.getShim().exec(this.uid,e,t,n)},init:function(){var n,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),n='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+s.swf_url+'" ',"IE"===t.browser&&(n+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),n+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+s.swf_url+'" /><param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>',"IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=n,r=o=null):o.innerHTML=n,d=setTimeout(function(){u&&!u.initialized&&u.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){a(u.uid),e.call(u),clearTimeout(d),s=d=e=u=null}}(this.destroy)},l)}var c="flash",l={};return r.addConstructor(c,u),l}),i(V,[X,E,u],function(e,t,n){var i={init:function(e){var i=this,r=this.getRuntime();this.bind("Change",function(){var e=r.shimExec.call(i,"FileInput","getFiles");i.files=[],n.each(e,function(e){i.files.push(new t(r.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{name:e.name,accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=i}),i(W,[X,y],function(e,t){var n={slice:function(e,n,i,r){var o=this.getRuntime();return 0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),e=o.shimExec.call(this,"Blob","slice",n,i,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=n}),i(Y,[X,w],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i=this;return i.result="","readAsDataURL"===e&&(i.result="data:"+(t.type||"")+";base64,"),i.bind("Progress",function(t,r){r&&(i.result+=n(r,e))},999),i.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=i}),i($,[X,w],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i,r=this.getRuntime();return(i=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"+i),n(i,e,t.type)):null}};return e.FileReaderSync=i}),i(J,[X,u,y,E,A,I,S],function(e,t,n,i,r,o,a){var s={send:function(e,i){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,i)}function s(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),i=null,r()}function u(e,t){var n=new a;n.bind("TransportingComplete",function(){t(this.result)}),n.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),i instanceof o){var d;if(i.each(function(e,t){e instanceof n?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),i.hasBlob()){var h=i.getBlob();h.isDetached()?u(h,function(e){h.destroy(),s(d,e)}):s(d,h)}else i=null,r()}else i instanceof n?i.isDetached()?u(i,function(e){i.destroy(),i=e.uid,r()}):(i=i.uid,r()):r()},getResponse:function(e){var n,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new i(a.uid,o),"blob"===e)return o;try{if(n=new r,~t.inArray(e,["","text"]))return n.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(n.readAsText(o))}finally{o.destroy()}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=s}),i(Z,[X,y],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),i=n.shimExec.call(this,"Transporter","getAsBlob",e);return i?new t(n.uid,i):null}};return e.Transporter=n}),i(K,[X,u,S,y,A],function(e,t,n,i,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(i,"Image","loadFromBlob",e.uid),i=r=null}var i=this,r=i.getRuntime();if(e.isDetached()){var o=new n;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof i||(t.meta.thumb.data=new i(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var n=this.getRuntime(),r=n.shimExec.call(this,"Image","getAsBlob",e,t);return r?new i(n.uid,r):null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;return t?(n=new r,n.readAsDataURL(t)):null}};return e.Image=o}),i(Q,[u,c,h,f,m],function(e,t,n,i,r){function o(e){var t=!1,n=null,i,r,o,a,s,u=0;try{try{n=new ActiveXObject("AgControl.AgControl"),n.IsVersionSupported(e)&&(t=!0),n=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(i=l.description,"1.0.30226.2"===i&&(i="2.0.30226.2"),r=i.split(".");r.length>3;)r.pop();for(;r.length<4;)r.push(0);for(o=e.split(".");o.length>4;)o.pop();do a=parseInt(o[u],10),s=parseInt(r[u],10),u++;while(u<o.length&&a===s);s>=a&&!isNaN(a)&&(t=!0)}}}catch(d){t=!1}return t}function a(a){var c=this,l;a=e.extend({xap_url:t.xap_url},a),r.call(this,a,s,{access_binary:r.capTrue,access_image_binary:r.capTrue,display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:r.capTrue,resize_image:r.capTrue,return_response_headers:function(e){return e&&"client"===c.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:r.capTrue,send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"client"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:r.capTrue,use_http_method:function(t){return"client"===c.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),o("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid).content.Moxie},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;"><param name="source" value="'+a.xap_url+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="enablehtmlaccess" value="true"/><param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/></object>',l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="silverlight",u={};return r.addConstructor(s,a),u}),i(ee,[Q,E,u],function(e,t,n){var i={init:function(e){function i(e){for(var t="",n=0;n<e.length;n++)t+=(""!==t?"|":"")+e[n].title+" | *."+e[n].extensions.replace(/,/g,";*.");return t}var r=this,o=this.getRuntime();this.bind("Change",function(){var e=o.shimExec.call(r,"FileInput","getFiles");r.files=[],n.each(e,function(e){r.files.push(new t(o.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",i(e.accept),e.name,e.multiple),this.trigger("ready")}};return e.FileInput=i}),i(te,[Q,u,W],function(e,t,n){return e.Blob=t.extend({},n)}),i(ne,[Q,h,N],function(e,t,n){var i={init:function(){var e=this,i=e.getRuntime(),r;return r=i.getShimContainer(),n.addEvent(r,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},e.uid),n.addEvent(r,"dragenter",function(e){e.preventDefault();var n=t.get(i.uid).dragEnter(e);n&&e.stopPropagation()},e.uid),n.addEvent(r,"drop",function(e){e.preventDefault();var n=t.get(i.uid).dragDrop(e);n&&e.stopPropagation()},e.uid),i.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=i}),i(ie,[Q,u,Y],function(e,t,n){return e.FileReader=t.extend({},n)}),i(re,[Q,u,$],function(e,t,n){return e.FileReaderSync=t.extend({},n)}),i(oe,[Q,u,J],function(e,t,n){return e.XMLHttpRequest=t.extend({},n)}),i(ae,[Q,u,Z],function(e,t,n){return e.Transporter=t.extend({},n)}),i(se,[Q,u,y,K],function(e,t,n,i){return e.Image=t.extend({},i,{getInfo:function(){var e=this.getRuntime(),i=["tiff","exif","gps","thumb"],r={meta:{}},o=e.shimExec.call(this,"Image","getInfo");return o.meta&&(t.each(i,function(e){var t=o.meta[e],n,i,a,s;if(t&&t.keys)for(r.meta[e]={},i=0,a=t.keys.length;a>i;i++)n=t.keys[i],s=t[n],s&&(/^(\d|[1-9]\d+)$/.test(s)?s=parseInt(s,10):/^\d*\.\d+$/.test(s)&&(s=parseFloat(s)),r.meta[e][n]=s)}),!r.meta||!r.meta.thumb||r.meta.thumb.data instanceof n||(r.meta.thumb.data=new n(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r}})}),i(ue,[u,f,m,c],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue;n.call(this,t,o,{access_binary:s(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:s(a.Image&&(i.can("create_canvas")||i.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:s(function(){return"Chrome"===i.browser&&i.verComp(i.version,28,">=")||"IE"===i.browser&&i.verComp(i.version,10,">=")||"Safari"===i.browser&&i.verComp(i.version,7,">=")}()),resize_image:function(){return a.Image&&r.can("access_binary")&&i.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return i.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return r.can("select_file")},summon_file_dialog:function(){return r.can("select_file")&&("Firefox"===i.browser&&i.verComp(i.version,4,">=")||"Opera"===i.browser&&i.verComp(i.version,12,">=")||"IE"===i.browser&&i.verComp(i.version,10,">=")||!!~e.inArray(i.browser,["Chrome","Safari"]))},upload_filesize:u,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html4",a={};return n.addConstructor(o,r),a}),i(ce,[ue,E,u,h,N,d,c],function(e,t,n,i,r,o,a){function s(){function e(){var o=this,l=o.getRuntime(),d,h,f,p,m,g;g=n.guid("uid_"),d=l.getShimContainer(),s&&(f=i.get(s+"_form"),f&&n.extend(f.style,{top:"100%"})),p=document.createElement("form"),p.setAttribute("id",g+"_form"),p.setAttribute("method","post"),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),n.extend(p.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=document.createElement("input"),m.setAttribute("id",g),m.setAttribute("type","file"),m.setAttribute("name",c.name||"Filedata"),m.setAttribute("accept",u.join(",")),n.extend(m.style,{fontSize:"999px",opacity:0}),p.appendChild(m),d.appendChild(p),n.extend(m.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===a.browser&&a.verComp(a.version,10,"<")&&n.extend(m.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),m.onchange=function(){var n;if(this.value){if(this.files){if(n=this.files[0],0===n.size)return void p.parentNode.removeChild(p)}else n={name:this.value};n=new t(l.uid,n),this.onchange=function(){},e.call(o),o.files=[n],m.setAttribute("id",n.uid),p.setAttribute("id",n.uid+"_form"),o.trigger("change"),m=p=null}},l.can("summon_file_dialog")&&(h=i.get(c.browse_button),r.removeEvent(h,"click",o.uid),r.addEvent(h,"click",function(e){m&&!m.disabled&&m.click(),e.preventDefault()},o.uid)),s=g,d=f=h=null}var s,u=[],c;n.extend(this,{init:function(t){var n=this,a=n.getRuntime(),s;c=t,u=t.accept.mimes||o.extList2mimes(t.accept,a.can("filter_by_extension")),s=a.getShimContainer(),function(){var e,o,u;e=i.get(t.browse_button),a.can("summon_file_dialog")&&("static"===i.getStyle(e,"position")&&(e.style.position="relative"),o=parseInt(i.getStyle(e,"z-index"),10)||1,e.style.zIndex=o,s.style.zIndex=o-1),u=a.can("summon_file_dialog")?e:s,r.addEvent(u,"mouseover",function(){n.trigger("mouseenter")},n.uid),r.addEvent(u,"mouseout",function(){n.trigger("mouseleave")},n.uid),r.addEvent(u,"mousedown",function(){n.trigger("mousedown")},n.uid),r.addEvent(i.get(t.container),"mouseup",function(){n.trigger("mouseup")},n.uid),e=null}(),e.call(this),s=null,n.trigger({type:"ready",async:!0})},disable:function(e){var t;(t=i.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),n=e.getShimContainer();r.removeAllEvents(n,this.uid),r.removeAllEvents(c&&i.get(c.container),this.uid),r.removeAllEvents(c&&i.get(c.browse_button),this.uid),n&&(n.innerHTML=""),t.removeInstance(this.uid),s=u=c=n=t=null}})}return e.FileInput=s}),i(le,[ue,F],function(e,t){return e.FileReader=t}),i(de,[ue,u,h,x,f,N,y,I],function(e,t,n,i,r,o,a,s){function u(){function e(e){var t=this,i,r,a,s,u=!1;if(l){if(i=l.id.replace(/_iframe$/,""),r=n.get(i+"_form")){for(a=r.getElementsByTagName("input"),s=a.length;s--;)switch(a[s].getAttribute("type")){case"hidden":a[s].parentNode.removeChild(a[s]);break;case"file":u=!0}a=[],u||r.parentNode.removeChild(r),r=null}setTimeout(function(){o.removeEvent(l,"load",t.uid),l.parentNode&&l.parentNode.removeChild(l);var n=t.getRuntime().getShimContainer();n.children.length||n.parentNode.removeChild(n),n=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,h){function f(){var n=m.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+g+'_iframe" name="'+g+'_iframe" src="javascript:""" style="display:none"></iframe>',l=r.firstChild,n.appendChild(l),o.addEvent(l,"load",function(){var n;try{n=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(n.title)?u=n.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(n.body.innerHTML),p.trigger({type:"progress",loaded:c.length,total:c.length}),y&&p.trigger({type:"uploadprogress",loaded:y.size||1025,total:y.size||1025}))}catch(r){if(!i.hasSameOrigin(d.url))return void e.call(p,function(){p.trigger("error")});u=404}e.call(p,function(){p.trigger("load")})},p.uid)}var p=this,m=p.getRuntime(),g,v,w,y;if(u=c=null,h instanceof s&&h.hasBlob()){if(y=h.getBlob(),g=y.uid,w=n.get(g),v=n.get(g+"_form"),!v)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else g=t.guid("uid_"),v=document.createElement("form"),v.setAttribute("id",g+"_form"),v.setAttribute("method",d.method),v.setAttribute("enctype","multipart/form-data"),v.setAttribute("encoding","multipart/form-data"),m.getShimContainer().appendChild(v);v.setAttribute("target",g+"_iframe"),h instanceof s&&h.each(function(e,n){if(e instanceof a)w&&w.setAttribute("name",n);else{var i=document.createElement("input");t.extend(i,{type:"hidden",name:n,value:e}),w?v.insertBefore(i,w):v.appendChild(i)}}),v.setAttribute("action",d.url),f(),v.submit(),p.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{ +return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(n){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),i(he,[ue,j],function(e,t){return e.Image=t}),a([u,c,l,d,h,f,p,m,g,v,w,y,E,_,b,x,R,A,I,T,S,O,N])}(this);;(function(e){"use strict";var t={},n=e.moxie.core.utils.Basic.inArray;return function r(e){var i,s;for(i in e)s=typeof e[i],s==="object"&&!~n(i,["Exceptions","Env","Mime"])?r(e[i]):s==="function"&&(t[i]=e[i])}(e.moxie),t.Env=e.moxie.core.utils.Env,t.Mime=e.moxie.core.utils.Mime,t.Exceptions=e.moxie.core.Exceptions,e.mOxie=t,e.o||(e.o=t),t})(this); /** * Plupload - multi-runtime File Uploader - * v2.1.1 + * v2.1.8 * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. @@ -23,6 +24,6 @@ * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * - * Date: 2014-01-16 + * Date: 2015-07-21 */ -;(function(e,t,n){function s(e){function r(e,t,r){var i={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};i[e]?n[i[e]]=t:r||(n[e]=t)}var t=e.required_features,n={};return typeof t=="string"?o.each(t.split(/\s*,\s*/),function(e){r(e,!0)}):typeof t=="object"?o.each(t,function(e,t){r(t,e)}):t===!0&&(e.multipart||(n.send_binary_string=!0),e.chunk_size>0&&(n.slice_blob=!0),e.resize.enabled&&(n.send_binary_string=!0),o.each(e,function(e,t){r(t,!!e,!0)})),n}var r=e.setTimeout,i={},o={VERSION:"2.1.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:t.mimes,ua:t.ua,typeOf:t.typeOf,extend:t.extend,guid:t.guid,get:function(n){var r=[],i;t.typeOf(n)!=="array"&&(n=[n]);var s=n.length;while(s--)i=t.get(n[s]),i&&r.push(i);return r.length?r:null},each:t.each,getPos:t.getPos,getSize:t.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:t.toArray,inArray:t.inArray,addI18n:t.addI18n,translate:t.translate,isEmptyObj:t.isEmptyObj,hasClass:t.hasClass,addClass:t.addClass,removeClass:t.removeClass,getStyle:t.getStyle,addEvent:t.addEvent,removeEvent:t.removeEvent,removeAllEvents:t.removeAllEvents,cleanName:function(e){var t,n;n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(t=0;t<n.length;t+=2)e=e.replace(n[t],n[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,""),e},buildUrl:function(e,t){var n="";return o.each(t,function(e,t){n+=(n?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===n||/\D/.test(e))return o.translate("N/A");var r=Math.pow(1024,4);return e>r?t(e/r,1)+" "+o.translate("tb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("gb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("mb"):e>1024?Math.round(e/1024)+" "+o.translate("kb"):e+" "+o.translate("b")},parseSize:t.parseSizeStr,predictRuntime:function(e,n){var r,i;return r=new o.Uploader(e),i=t.Runtime.thatCan(r.getOption().required_features,n||e.runtimes),r.destroy(),i},addFileFilter:function(e,t){i[e]=t}};o.addFileFilter("mime_types",function(e,t,n){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:o.FILE_EXTENSION_ERROR,message:o.translate("File extension error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("max_file_size",function(e,t,n){var r;e=o.parseSize(e),t.size!==r&&e&&t.size>e?(this.trigger("Error",{code:o.FILE_SIZE_ERROR,message:o.translate("File size error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("prevent_duplicates",function(e,t,n){if(e){var r=this.files.length;while(r--)if(t.name===this.files[r].name&&t.size===this.files[r].size){this.trigger("Error",{code:o.FILE_DUPLICATE_ERROR,message:o.translate("Duplicate file error."),file:t}),n(!1);return}}n(!0)}),o.Uploader=function(e){function g(){var e,t=0,n;if(this.state==o.STARTED){for(n=0;n<f.length;n++)!e&&f[n].status==o.QUEUED?(e=f[n],this.trigger("BeforeUpload",e)&&(e.status=o.UPLOADING,this.trigger("UploadFile",e))):t++;t==f.length&&(this.state!==o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",f))}}function y(e){e.percent=e.size>0?Math.ceil(e.loaded/e.size*100):100,b()}function b(){var e,t;d.reset();for(e=0;e<f.length;e++)t=f[e],t.size!==n?(d.size+=t.origSize,d.loaded+=t.loaded*t.origSize/t.size):d.size=n,t.status==o.DONE?d.uploaded++:t.status==o.FAILED?d.failed++:d.queued++;d.size===n?d.percent=f.length>0?Math.ceil(d.uploaded/f.length*100):0:(d.bytesPerSec=Math.ceil(d.loaded/((+(new Date)-p||1)/1e3)),d.percent=d.size>0?Math.ceil(d.loaded/d.size*100):0)}function w(){var e=c[0]||h[0];return e?e.getRuntime().uid:!1}function E(e,n){if(e.ruid){var r=t.Runtime.getInfo(e.ruid);if(r)return r.can(n)}return!1}function S(){this.bind("FilesAdded",C),this.bind("CancelUpload",M),this.bind("BeforeUpload",k),this.bind("UploadFile",L),this.bind("UploadProgress",A),this.bind("StateChanged",O),this.bind("QueueChanged",b),this.bind("Error",D),this.bind("FileUploaded",_),this.bind("Destroy",P)}function x(e,n){var r=this,i=0,s=[],u={accept:e.filters.mime_types,runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:l,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};o.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(u[t]=e[t])}),e.browse_button&&o.each(e.browse_button,function(n){s.push(function(s){var a=new t.FileInput(o.extend({},u,{name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:n}));a.onready=function(){var e=t.Runtime.getInfo(this.ruid);t.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),i++,c.push(this),s()},a.onchange=function(){r.addFile(this.files)},a.bind("mouseenter mouseleave mousedown mouseup",function(r){v||(e.browse_button_hover&&("mouseenter"===r.type?t.addClass(n,e.browse_button_hover):"mouseleave"===r.type&&t.removeClass(n,e.browse_button_hover)),e.browse_button_active&&("mousedown"===r.type?t.addClass(n,e.browse_button_active):"mouseup"===r.type&&t.removeClass(n,e.browse_button_active)))}),a.bind("error runtimeerror",function(){a=null,s()}),a.init()})}),e.drop_element&&o.each(e.drop_element,function(e){s.push(function(n){var s=new t.FileDrop(o.extend({},u,{drop_zone:e}));s.onready=function(){var e=t.Runtime.getInfo(this.ruid);r.features.dragdrop=e.can("drag_and_drop"),i++,h.push(this),n()},s.ondrop=function(){r.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,n()}),s.init()})}),t.inSeries(s,function(){typeof n=="function"&&n(i)})}function T(e,n,r){var i=new t.Image;try{i.onload=function(){i.downsize(n.width,n.height,n.crop,n.preserve_headers)},i.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},i.onerror=function(){r(e)},i.load(e)}catch(s){r(e)}}function N(e,n,r){function f(e,t,n){var r=a[e];switch(e){case"max_file_size":e==="max_file_size"&&(a.max_file_size=a.filters.max_file_size=t);break;case"chunk_size":if(t=o.parseSize(t))a[e]=t;break;case"filters":o.typeOf(t)==="array"&&(t={mime_types:t}),n?o.extend(a.filters,t):a.filters=t,t.mime_types&&(a.filters.mime_types.regexp=function(e){var t=[];return o.each(e,function(e){o.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(a.filters.mime_types));break;case"resize":n?o.extend(a.resize,t,{enabled:!0}):a.resize=t;break;case"prevent_duplicates":a.prevent_duplicates=a.filters.prevent_duplicates=!!t;break;case"browse_button":case"drop_element":t=o.get(t);case"container":case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":a[e]=t,n||(u=!0);break;default:a[e]=t}n||i.trigger("OptionChanged",e,t,r)}var i=this,u=!1;typeof e=="object"?o.each(e,function(e,t){f(t,e,r)}):f(e,n,r),r?(a.required_features=s(o.extend({},a)),l=s(o.extend({},a,{required_features:!0}))):u&&(i.trigger("Destroy"),x.call(i,a,function(e){e?(i.runtime=t.Runtime.getInfo(w()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})}))}function C(e,t){[].push.apply(f,t),e.trigger("QueueChanged"),e.refresh()}function k(e,t){if(a.unique_names){var n=t.name.match(/\.([^.]+)$/),r="part";n&&(r=n[1]),t.target_name=t.id+"."+r}}function L(e,n){function h(){u-->0?r(p,1e3):(n.loaded=f,e.trigger("Error",{code:o.HTTP_ERROR,message:o.translate("HTTP Error."),file:n,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}))}function p(){var d,v,g,y;if(n.status==o.DONE||n.status==o.FAILED||e.state==o.STOPPED)return;g={name:n.target_name||n.name},s&&a.chunks&&c.size>s?(y=Math.min(s,c.size-f),d=c.slice(f,f+y)):(y=c.size,d=c),s&&a.chunks&&(e.settings.send_chunk_number?(g.chunk=Math.ceil(f/s),g.chunks=Math.ceil(c.size/s)):(g.offset=f,g.total=c.size)),m=new t.XMLHttpRequest,m.upload&&(m.upload.onprogress=function(t){n.loaded=Math.min(n.size,f+t.loaded),e.trigger("UploadProgress",n)}),m.onload=function(){if(m.status>=400){h();return}u=e.settings.max_retries,y<c.size?(d.destroy(),f+=y,n.loaded=Math.min(f,c.size),e.trigger("ChunkUploaded",n,{offset:n.loaded,total:c.size,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}),t.Env.browser==="Android Browser"&&e.trigger("UploadProgress",n)):n.loaded=n.size,d=v=null,!f||f>=c.size?(n.size!=n.origSize&&(c.destroy(),c=null),e.trigger("UploadProgress",n),n.status=o.DONE,e.trigger("FileUploaded",n,{response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()})):r(p,1)},m.onerror=function(){h()},m.onloadend=function(){this.destroy(),m=null},e.settings.multipart&&a.multipart?(g.name=n.target_name||n.name,m.open("post",i,!0),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),v=new t.FormData,o.each(o.extend(g,e.settings.multipart_params),function(e,t){v.append(t,e)}),v.append(e.settings.file_data_name,d),m.send(v,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(i=o.buildUrl(e.settings.url,o.extend(g,e.settings.multipart_params)),m.open("post",i,!0),m.setRequestHeader("Content-Type","application/octet-stream"),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),m.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var i=e.settings.url,s=e.settings.chunk_size,u=e.settings.max_retries,a=e.features,f=0,c;n.loaded&&(f=n.loaded=s*Math.floor(n.loaded/s)),c=n.getSource(),e.settings.resize.enabled&&E(c,"send_binary_string")&&!!~t.inArray(c.type,["image/jpeg","image/png"])?T.call(this,c,e.settings.resize,function(e){c=e,n.size=e.size,p()}):p()}function A(e,t){y(t)}function O(e){if(e.state==o.STARTED)p=+(new Date);else if(e.state==o.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==o.UPLOADING&&(e.files[t].status=o.QUEUED,b())}function M(){m&&m.abort()}function _(e){b(),r(function(){g.call(e)},1)}function D(e,t){t.file&&(t.file.status=o.FAILED,y(t.file),e.state==o.STARTED&&(e.trigger("CancelUpload"),r(function(){g.call(e)},1)))}function P(e){e.stop(),o.each(f,function(e){e.destroy()}),f=[],c.length&&(o.each(c,function(e){e.destroy()}),c=[]),h.length&&(o.each(h,function(e){e.destroy()}),h=[]),l={},v=!1,p=m=null,d.reset()}var u=o.guid(),a,f=[],l={},c=[],h=[],p,d,v=!1,m;a={runtimes:t.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_chunk_number:!0},N.call(this,e,null,!0),d=new o.QueueProgress,o.extend(this,{id:u,uid:u,state:o.STOPPED,features:{},runtime:null,files:f,settings:a,total:d,init:function(){var e=this;typeof a.preinit=="function"?a.preinit(e):o.each(a.preinit,function(t,n){e.bind(n,t)});if(!a.browse_button||!a.url){this.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")});return}S.call(this),x.call(this,a,function(n){typeof a.init=="function"?a.init(e):o.each(a.init,function(t,n){e.bind(n,t)}),n?(e.runtime=t.Runtime.getInfo(w()).type,e.trigger("Init",{runtime:e.runtime}),e.trigger("PostInit")):e.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})})},setOption:function(e,t){N.call(this,e,t,!this.runtime)},getOption:function(e){return e?a[e]:a},refresh:function(){c.length&&o.each(c,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=o.STARTED&&(this.state=o.STARTED,this.trigger("StateChanged"),g.call(this))},stop:function(){this.state!=o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){v=arguments[0]!==n?arguments[0]:!0,c.length&&o.each(c,function(e){e.disable(v)}),this.trigger("DisableBrowse",v)},getFile:function(e){var t;for(t=f.length-1;t>=0;t--)if(f[t].id===e)return f[t]},addFile:function(e,n){function l(e,n){var r=[];t.each(s.settings.filters,function(t,n){i[n]&&r.push(function(r){i[n].call(s,t,e,function(e){r(!e)})})}),t.inSeries(r,n)}function c(e){var i=t.typeOf(e);if(e instanceof t.File){if(!e.ruid&&!e.isDetached()){if(!f)return!1;e.ruid=f,e.connectRuntime(f)}c(new o.File(e))}else e instanceof t.Blob?(c(e.getSource()),e.destroy()):e instanceof o.File?(n&&(e.name=n),u.push(function(t){l(e,function(n){n||(a.push(e),s.trigger("FileFiltered",e)),r(t,1)})})):t.inArray(i,["file","blob"])!==-1?c(new t.File(null,e)):i==="node"&&t.typeOf(e.files)==="filelist"?t.each(e.files,c):i==="array"&&(n=null,t.each(e,c))}var s=this,u=[],a=[],f;f=w(),c(e),u.length&&t.inSeries(u,function(){a.length&&s.trigger("FilesAdded",a)})},removeFile:function(e){var t=typeof e=="string"?e:e.id;for(var n=f.length-1;n>=0;n--)if(f[n].id===t)return this.splice(n,1)[0]},splice:function(e,t){var r=f.splice(e===n?0:e,t===n?f.length:t),i=!1;return this.state==o.STARTED&&(i=!0,this.stop()),this.trigger("FilesRemoved",r),o.each(r,function(e){e.destroy()}),this.trigger("QueueChanged"),this.refresh(),i&&this.start(),r},bind:function(e,t,n){var r=this;o.Uploader.prototype.bind.call(this,e,function(){var e=[].slice.call(arguments);return e.splice(0,1,r),t.apply(this,e)},0,n)},destroy:function(){this.trigger("Destroy"),a=d=null,this.unbindAll()}})},o.Uploader.prototype=t.EventTarget.instance,o.File=function(){function n(n){o.extend(this,{id:o.guid(),name:n.name||n.fileName,type:n.type||"",size:n.size||n.fileSize,origSize:n.size||n.fileSize,loaded:0,percent:0,status:o.QUEUED,lastModifiedDate:n.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return t.inArray(t.typeOf(e),["blob","file"])!==-1?e:null},getSource:function(){return e[this.id]?e[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete e[this.id])}}),e[this.id]=n}var e={};return n}(),o.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=o})(window,mOxie);
\ No newline at end of file +;(function(e,t,n){function s(e){function r(e,t,r){var i={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};i[e]?n[i[e]]=t:r||(n[e]=t)}var t=e.required_features,n={};if(typeof t=="string")o.each(t.split(/\s*,\s*/),function(e){r(e,!0)});else if(typeof t=="object")o.each(t,function(e,t){r(t,e)});else if(t===!0){e.chunk_size>0&&(n.slice_blob=!0);if(e.resize.enabled||!e.multipart)n.send_binary_string=!0;o.each(e,function(e,t){r(t,!!e,!0)})}return n}var r=e.setTimeout,i={},o={VERSION:"2.1.8",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:t.mimes,ua:t.ua,typeOf:t.typeOf,extend:t.extend,guid:t.guid,get:function(n){var r=[],i;t.typeOf(n)!=="array"&&(n=[n]);var s=n.length;while(s--)i=t.get(n[s]),i&&r.push(i);return r.length?r:null},each:t.each,getPos:t.getPos,getSize:t.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:t.toArray,inArray:t.inArray,addI18n:t.addI18n,translate:t.translate,isEmptyObj:t.isEmptyObj,hasClass:t.hasClass,addClass:t.addClass,removeClass:t.removeClass,getStyle:t.getStyle,addEvent:t.addEvent,removeEvent:t.removeEvent,removeAllEvents:t.removeAllEvents,cleanName:function(e){var t,n;n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(t=0;t<n.length;t+=2)e=e.replace(n[t],n[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,""),e},buildUrl:function(e,t){var n="";return o.each(t,function(e,t){n+=(n?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===n||/\D/.test(e))return o.translate("N/A");var r=Math.pow(1024,4);return e>r?t(e/r,1)+" "+o.translate("tb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("gb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("mb"):e>1024?Math.round(e/1024)+" "+o.translate("kb"):e+" "+o.translate("b")},parseSize:t.parseSizeStr,predictRuntime:function(e,n){var r,i;return r=new o.Uploader(e),i=t.Runtime.thatCan(r.getOption().required_features,n||e.runtimes),r.destroy(),i},addFileFilter:function(e,t){i[e]=t}};o.addFileFilter("mime_types",function(e,t,n){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:o.FILE_EXTENSION_ERROR,message:o.translate("File extension error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("max_file_size",function(e,t,n){var r;e=o.parseSize(e),t.size!==r&&e&&t.size>e?(this.trigger("Error",{code:o.FILE_SIZE_ERROR,message:o.translate("File size error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("prevent_duplicates",function(e,t,n){if(e){var r=this.files.length;while(r--)if(t.name===this.files[r].name&&t.size===this.files[r].size){this.trigger("Error",{code:o.FILE_DUPLICATE_ERROR,message:o.translate("Duplicate file error."),file:t}),n(!1);return}}n(!0)}),o.Uploader=function(e){function g(){var e,t=0,n;if(this.state==o.STARTED){for(n=0;n<f.length;n++)!e&&f[n].status==o.QUEUED?(e=f[n],this.trigger("BeforeUpload",e)&&(e.status=o.UPLOADING,this.trigger("UploadFile",e))):t++;t==f.length&&(this.state!==o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",f))}}function y(e){e.percent=e.size>0?Math.ceil(e.loaded/e.size*100):100,b()}function b(){var e,t;d.reset();for(e=0;e<f.length;e++)t=f[e],t.size!==n?(d.size+=t.origSize,d.loaded+=t.loaded*t.origSize/t.size):d.size=n,t.status==o.DONE?d.uploaded++:t.status==o.FAILED?d.failed++:d.queued++;d.size===n?d.percent=f.length>0?Math.ceil(d.uploaded/f.length*100):0:(d.bytesPerSec=Math.ceil(d.loaded/((+(new Date)-p||1)/1e3)),d.percent=d.size>0?Math.ceil(d.loaded/d.size*100):0)}function w(){var e=c[0]||h[0];return e?e.getRuntime().uid:!1}function E(e,n){if(e.ruid){var r=t.Runtime.getInfo(e.ruid);if(r)return r.can(n)}return!1}function S(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",O),this.bind("BeforeUpload",C),this.bind("UploadFile",k),this.bind("UploadProgress",L),this.bind("StateChanged",A),this.bind("QueueChanged",b),this.bind("Error",_),this.bind("FileUploaded",M),this.bind("Destroy",D)}function x(e,n){var r=this,i=0,s=[],u={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:l,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};o.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(u[t]=e[t])}),e.browse_button&&o.each(e.browse_button,function(n){s.push(function(s){var a=new t.FileInput(o.extend({},u,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:n}));a.onready=function(){var e=t.Runtime.getInfo(this.ruid);t.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),i++,c.push(this),s()},a.onchange=function(){r.addFile(this.files)},a.bind("mouseenter mouseleave mousedown mouseup",function(r){v||(e.browse_button_hover&&("mouseenter"===r.type?t.addClass(n,e.browse_button_hover):"mouseleave"===r.type&&t.removeClass(n,e.browse_button_hover)),e.browse_button_active&&("mousedown"===r.type?t.addClass(n,e.browse_button_active):"mouseup"===r.type&&t.removeClass(n,e.browse_button_active)))}),a.bind("mousedown",function(){r.trigger("Browse")}),a.bind("error runtimeerror",function(){a=null,s()}),a.init()})}),e.drop_element&&o.each(e.drop_element,function(e){s.push(function(n){var s=new t.FileDrop(o.extend({},u,{drop_zone:e}));s.onready=function(){var e=t.Runtime.getInfo(this.ruid);r.features.dragdrop=e.can("drag_and_drop"),i++,h.push(this),n()},s.ondrop=function(){r.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,n()}),s.init()})}),t.inSeries(s,function(){typeof n=="function"&&n(i)})}function T(e,r,i){var s=new t.Image;try{s.onload=function(){if(r.width>this.width&&r.height>this.height&&r.quality===n&&r.preserve_headers&&!r.crop)return this.destroy(),i(e);s.downsize(r.width,r.height,r.crop,r.preserve_headers)},s.onresize=function(){i(this.getAsBlob(e.type,r.quality)),this.destroy()},s.onerror=function(){i(e)},s.load(e)}catch(o){i(e)}}function N(e,n,r){function f(e,t,n){var r=a[e];switch(e){case"max_file_size":e==="max_file_size"&&(a.max_file_size=a.filters.max_file_size=t);break;case"chunk_size":if(t=o.parseSize(t))a[e]=t,a.send_file_name=!0;break;case"multipart":a[e]=t,t||(a.send_file_name=!0);break;case"unique_names":a[e]=t,t&&(a.send_file_name=!0);break;case"filters":o.typeOf(t)==="array"&&(t={mime_types:t}),n?o.extend(a.filters,t):a.filters=t,t.mime_types&&(a.filters.mime_types.regexp=function(e){var t=[];return o.each(e,function(e){o.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(a.filters.mime_types));break;case"resize":n?o.extend(a.resize,t,{enabled:!0}):a.resize=t;break;case"prevent_duplicates":a.prevent_duplicates=a.filters.prevent_duplicates=!!t;break;case"browse_button":case"drop_element":t=o.get(t);case"container":case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":a[e]=t,n||(u=!0);break;default:a[e]=t}n||i.trigger("OptionChanged",e,t,r)}var i=this,u=!1;typeof e=="object"?o.each(e,function(e,t){f(t,e,r)}):f(e,n,r),r?(a.required_features=s(o.extend({},a)),l=s(o.extend({},a,{required_features:!0}))):u&&(i.trigger("Destroy"),x.call(i,a,function(e){e?(i.runtime=t.Runtime.getInfo(w()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})}))}function C(e,t){if(e.settings.unique_names){var n=t.name.match(/\.([^.]+)$/),r="part";n&&(r=n[1]),t.target_name=t.id+"."+r}}function k(e,n){function h(){u-->0?r(p,1e3):(n.loaded=f,e.trigger("Error",{code:o.HTTP_ERROR,message:o.translate("HTTP Error."),file:n,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}))}function p(){var d,v,g={},y;if(n.status!==o.UPLOADING||e.state===o.STOPPED)return;e.settings.send_file_name&&(g.name=n.target_name||n.name),s&&a.chunks&&c.size>s?(y=Math.min(s,c.size-f),d=c.slice(f,f+y)):(y=c.size,d=c),s&&a.chunks&&(e.settings.send_chunk_number?(g.chunk=Math.ceil(f/s),g.chunks=Math.ceil(c.size/s)):(g.offset=f,g.total=c.size)),m=new t.XMLHttpRequest,m.upload&&(m.upload.onprogress=function(t){n.loaded=Math.min(n.size,f+t.loaded),e.trigger("UploadProgress",n)}),m.onload=function(){if(m.status>=400){h();return}u=e.settings.max_retries,y<c.size?(d.destroy(),f+=y,n.loaded=Math.min(f,c.size),e.trigger("ChunkUploaded",n,{offset:n.loaded,total:c.size,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}),t.Env.browser==="Android Browser"&&e.trigger("UploadProgress",n)):n.loaded=n.size,d=v=null,!f||f>=c.size?(n.size!=n.origSize&&(c.destroy(),c=null),e.trigger("UploadProgress",n),n.status=o.DONE,e.trigger("FileUploaded",n,{response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()})):r(p,1)},m.onerror=function(){h()},m.onloadend=function(){this.destroy(),m=null},e.settings.multipart&&a.multipart?(m.open("post",i,!0),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),v=new t.FormData,o.each(o.extend(g,e.settings.multipart_params),function(e,t){v.append(t,e)}),v.append(e.settings.file_data_name,d),m.send(v,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(i=o.buildUrl(e.settings.url,o.extend(g,e.settings.multipart_params)),m.open("post",i,!0),m.setRequestHeader("Content-Type","application/octet-stream"),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),m.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var i=e.settings.url,s=e.settings.chunk_size,u=e.settings.max_retries,a=e.features,f=0,c;n.loaded&&(f=n.loaded=s?s*Math.floor(n.loaded/s):0),c=n.getSource(),e.settings.resize.enabled&&E(c,"send_binary_string")&&!!~t.inArray(c.type,["image/jpeg","image/png"])?T.call(this,c,e.settings.resize,function(e){c=e,n.size=e.size,p()}):p()}function L(e,t){y(t)}function A(e){if(e.state==o.STARTED)p=+(new Date);else if(e.state==o.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==o.UPLOADING&&(e.files[t].status=o.QUEUED,b())}function O(){m&&m.abort()}function M(e){b(),r(function(){g.call(e)},1)}function _(e,t){t.code===o.INIT_ERROR?e.destroy():t.code===o.HTTP_ERROR&&(t.file.status=o.FAILED,y(t.file),e.state==o.STARTED&&(e.trigger("CancelUpload"),r(function(){g.call(e)},1)))}function D(e){e.stop(),o.each(f,function(e){e.destroy()}),f=[],c.length&&(o.each(c,function(e){e.destroy()}),c=[]),h.length&&(o.each(h,function(e){e.destroy()}),h=[]),l={},v=!1,p=m=null,d.reset()}var u=o.guid(),a,f=[],l={},c=[],h=[],p,d,v=!1,m;a={runtimes:t.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_file_name:!0,send_chunk_number:!0},N.call(this,e,null,!0),d=new o.QueueProgress,o.extend(this,{id:u,uid:u,state:o.STOPPED,features:{},runtime:null,files:f,settings:a,total:d,init:function(){var e=this;typeof a.preinit=="function"?a.preinit(e):o.each(a.preinit,function(t,n){e.bind(n,t)}),S.call(this);if(!a.browse_button||!a.url){this.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")});return}x.call(this,a,function(n){typeof a.init=="function"?a.init(e):o.each(a.init,function(t,n){e.bind(n,t)}),n?(e.runtime=t.Runtime.getInfo(w()).type,e.trigger("Init",{runtime:e.runtime}),e.trigger("PostInit")):e.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})})},setOption:function(e,t){N.call(this,e,t,!this.runtime)},getOption:function(e){return e?a[e]:a},refresh:function(){c.length&&o.each(c,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=o.STARTED&&(this.state=o.STARTED,this.trigger("StateChanged"),g.call(this))},stop:function(){this.state!=o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){v=arguments[0]!==n?arguments[0]:!0,c.length&&o.each(c,function(e){e.disable(v)}),this.trigger("DisableBrowse",v)},getFile:function(e){var t;for(t=f.length-1;t>=0;t--)if(f[t].id===e)return f[t]},addFile:function(e,n){function c(e,n){var r=[];t.each(s.settings.filters,function(t,n){i[n]&&r.push(function(r){i[n].call(s,t,e,function(e){r(!e)})})}),t.inSeries(r,n)}function h(e){var i=t.typeOf(e);if(e instanceof t.File){if(!e.ruid&&!e.isDetached()){if(!l)return!1;e.ruid=l,e.connectRuntime(l)}h(new o.File(e))}else e instanceof t.Blob?(h(e.getSource()),e.destroy()):e instanceof o.File?(n&&(e.name=n),u.push(function(t){c(e,function(n){n||(f.push(e),a.push(e),s.trigger("FileFiltered",e)),r(t,1)})})):t.inArray(i,["file","blob"])!==-1?h(new t.File(null,e)):i==="node"&&t.typeOf(e.files)==="filelist"?t.each(e.files,h):i==="array"&&(n=null,t.each(e,h))}var s=this,u=[],a=[],l;l=w(),h(e),u.length&&t.inSeries(u,function(){a.length&&s.trigger("FilesAdded",a)})},removeFile:function(e){var t=typeof e=="string"?e:e.id;for(var n=f.length-1;n>=0;n--)if(f[n].id===t)return this.splice(n,1)[0]},splice:function(e,t){var r=f.splice(e===n?0:e,t===n?f.length:t),i=!1;return this.state==o.STARTED&&(o.each(r,function(e){if(e.status===o.UPLOADING)return i=!0,!1}),i&&this.stop()),this.trigger("FilesRemoved",r),o.each(r,function(e){e.destroy()}),i&&this.start(),r},dispatchEvent:function(e){var t,n,r;e=e.toLowerCase(),t=this.hasEventListener(e);if(t){t.sort(function(e,t){return t.priority-e.priority}),n=[].slice.call(arguments),n.shift(),n.unshift(this);for(var i=0;i<t.length;i++)if(t[i].fn.apply(t[i].scope,n)===!1)return!1}return!0},bind:function(e,t,n,r){o.Uploader.prototype.bind.call(this,e,t,r,n)},destroy:function(){this.trigger("Destroy"),a=d=null,this.unbindAll()}})},o.Uploader.prototype=t.EventTarget.instance,o.File=function(){function n(n){o.extend(this,{id:o.guid(),name:n.name||n.fileName,type:n.type||"",size:n.size||n.fileSize,origSize:n.size||n.fileSize,loaded:0,percent:0,status:o.QUEUED,lastModifiedDate:n.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return t.inArray(t.typeOf(e),["blob","file"])!==-1?e:null},getSource:function(){return e[this.id]?e[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete e[this.id])}}),e[this.id]=n}var e={};return n}(),o.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=o})(window,mOxie);
\ No newline at end of file diff --git a/phpBB/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php index 49f4ca13e7..e1f81662d2 100755 --- a/phpBB/bin/phpbbcli.php +++ b/phpBB/bin/phpbbcli.php @@ -2,12 +2,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +use Symfony\Component\Console\Input\ArgvInput; + if (php_sapi_name() != 'cli') { echo 'This program must be run from the command line.' . PHP_EOL; @@ -15,22 +21,62 @@ if (php_sapi_name() != 'cli') } define('IN_PHPBB', true); + $phpbb_root_path = __DIR__ . '/../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); require($phpbb_root_path . 'includes/startup.' . $phpEx); -require($phpbb_root_path . 'config.' . $phpEx); -require($phpbb_root_path . 'includes/constants.' . $phpEx); -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_container.' . $phpEx); require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); -$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); -$phpbb_class_loader_ext->register(); -$phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, "$phpbb_root_path/config"); +$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); +extract($phpbb_config_php_file->get_all()); + +if (!defined('PHPBB_ENVIRONMENT')) +{ + @define('PHPBB_ENVIRONMENT', 'production'); +} + +require($phpbb_root_path . 'includes/constants.' . $phpEx); +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + +$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +$phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file); + +$input = new ArgvInput(); + +if ($input->hasParameterOption(array('--env'))) +{ + $phpbb_container_builder->with_environment($input->getParameterOption('--env')); +} + +if ($input->hasParameterOption(array('--safe-mode'))) +{ + $phpbb_container_builder->without_extensions(); + $phpbb_container_builder->without_cache(); +} +else +{ + $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); + $phpbb_class_loader_ext->register(); +} + +$phpbb_container = $phpbb_container_builder->get_container(); +$phpbb_container->get('request')->enable_super_globals(); +require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx); + +/* @var $user \phpbb\user */ +$user = $phpbb_container->get('user'); +$user->add_lang('acp/common'); +$user->add_lang('cli'); + +/* @var $lang \phpbb\language\language */ +$lang = $phpbb_container->get('language'); -$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION); -$application->register_container_commands($phpbb_container); -$application->run(); +$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $lang); +$application->setDispatcher($phpbb_container->get('dispatcher')); +$application->register_container_commands($phpbb_container->get('console.command_collection')); +$application->run($input); diff --git a/phpBB/common.php b/phpBB/common.php index b1da2215fb..48bd13e80d 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -1,25 +1,37 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * -* Minimum Requirement: PHP 5.3.3 */ /** +* Minimum Requirement: PHP 5.3.9 */ + if (!defined('IN_PHPBB')) { exit; } require($phpbb_root_path . 'includes/startup.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); -if (file_exists($phpbb_root_path . 'config.' . $phpEx)) +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); + +$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); +extract($phpbb_config_php_file->get_all()); + +if (!defined('PHPBB_ENVIRONMENT')) { - require($phpbb_root_path . 'config.' . $phpEx); + @define('PHPBB_ENVIRONMENT', 'production'); } if (!defined('PHPBB_INSTALLED')) @@ -40,14 +52,14 @@ if (!defined('PHPBB_INSTALLED')) } // $phpbb_root_path accounts for redirects from e.g. /adm - $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx; + $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx; // Replace any number of consecutive backslashes and/or slashes with a single slash // (could happen on some proxy setups and/or Windows servers) $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); // Eliminate . and .. from the path require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx); - $phpbb_filesystem = new phpbb\filesystem(); + $phpbb_filesystem = new phpbb\filesystem\filesystem(); $script_path = $phpbb_filesystem->clean_path($script_path); $url = (($secure) ? 'https://' : 'http://') . $server_name; @@ -71,63 +83,56 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files -require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); - require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); -require($phpbb_root_path . 'includes/functions_container.' . $phpEx); include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +if (PHPBB_ENVIRONMENT === 'development') +{ + \phpbb\debug\debug::enable(); +} +else +{ + set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +} -// Setup class loader first -$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); -$phpbb_class_loader->register(); $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); // Set up container -$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); +try +{ + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container(); +} +catch (InvalidArgumentException $e) +{ + if (PHPBB_ENVIRONMENT !== 'development') + { + trigger_error( + 'The requested environment ' . PHPBB_ENVIRONMENT . ' is not available.', + E_USER_ERROR + ); + } + else + { + throw $e; + } +} $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); -// set up caching -$cache = $phpbb_container->get('cache'); - -// Instantiate some basic classes -$phpbb_dispatcher = $phpbb_container->get('dispatcher'); -$request = $phpbb_container->get('request'); -$user = $phpbb_container->get('user'); -$auth = $phpbb_container->get('auth'); -$db = $phpbb_container->get('dbal.conn'); - -// make sure request_var uses this request instance -request_var('', 0, false, false, $request); // "dependency injection" for a function - -// Grab global variables, re-cache if necessary -$config = $phpbb_container->get('config'); -set_config(null, null, null, $config); -set_config_count(null, null, null, $config); - -$phpbb_log = $phpbb_container->get('log'); -$symfony_request = $phpbb_container->get('symfony_request'); -$phpbb_filesystem = $phpbb_container->get('filesystem'); -$phpbb_path_helper = $phpbb_container->get('path_helper'); - -// load extensions -$phpbb_extension_manager = $phpbb_container->get('ext.manager'); -$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); - -$template = $phpbb_container->get('template'); +require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx); // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); -$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('\phpbb\template\template', 'display'))); +$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); + +/* @var $phpbb_hook_finder \phpbb\hook\finder */ $phpbb_hook_finder = $phpbb_container->get('hook_finder'); foreach ($phpbb_hook_finder->find() as $hook) @@ -135,11 +140,6 @@ foreach ($phpbb_hook_finder->find() as $hook) @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); } -if (!$config['use_system_cron']) -{ - $cron = $phpbb_container->get('cron.manager'); -} - /** * Main event which is triggered on every page * @@ -151,6 +151,6 @@ if (!$config['use_system_cron']) * please use the core.user_setup event instead! * * @event core.common -* @since 3.1-A1 +* @since 3.1.0-a1 */ $phpbb_dispatcher->dispatch('core.common'); diff --git a/phpBB/composer.json b/phpBB/composer.json index 3cf83a8fe9..1b2625c593 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -1,21 +1,66 @@ { - "minimum-stability": "beta", + "name": "phpbb/phpbb", + "description": "phpBB Forum Software application", + "type": "project", + "keywords": ["phpbb", "forum"], + "homepage": "https://www.phpbb.com", + "license": "GPL-2.0", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "support": { + "issues": "https://tracker.phpbb.com", + "forum": "https://www.phpbb.com/community/", + "wiki": "https://wiki.phpbb.com", + "irc": "irc://irc.freenode.org/phpbb" + }, + "scripts": { + "post-update-cmd": "echo 'You MUST manually modify the clean-vendor-dir target in build/build.xml when adding or upgrading dependencies.'" + }, + "replace": { + "phpbb/phpbb-core": "self.version" + }, "require": { - "lusitanian/oauth": "0.2.*", - "symfony/config": "2.3.*", - "symfony/console": "2.3.*", - "symfony/dependency-injection": "2.3.*", - "symfony/event-dispatcher": "2.3.*", - "symfony/http-kernel": "2.3.*", - "symfony/routing": "2.3.*", - "symfony/yaml": "2.3.*", - "twig/twig": "1.13.*" + "php": ">=5.4,<7.1", + "bantu/ini-get-wrapper": "1.0.*", + "google/recaptcha": "~1.1", + "lusitanian/oauth": "^0.8.1", + "marc1706/fast-image-size": "1.1.*", + "patchwork/utf8": "1.1.*", + "s9e/text-formatter": "^0.4.2", + "symfony/config": "2.8.*", + "symfony/console": "2.8.*", + "symfony/debug": "2.8.*", + "symfony/dependency-injection": "2.8.*", + "symfony/event-dispatcher": "2.8.*", + "symfony/filesystem": "2.8.*", + "symfony/finder": "2.8.*", + "symfony/http-foundation": "2.8.*", + "symfony/http-kernel": "2.8.*", + "symfony/routing": "2.8.*", + "symfony/twig-bridge": "2.8.*", + "symfony/yaml": "2.8.*", + "twig/twig": "1.*" }, "require-dev": { "fabpot/goutte": "1.0.*", - "phpunit/dbunit": "1.2.*", - "phpunit/phpunit": "3.7.*", + "guzzle/guzzle": "3.9.*", "phing/phing": "2.4.*", - "squizlabs/php_codesniffer": "1.*" + "phpunit/dbunit": "1.3.*", + "phpunit/phpunit": "4.1.*", + "sami/sami": "1.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/browser-kit": "2.8.*", + "symfony/css-selector": "2.8.*", + "symfony/dom-crawler": "2.8.*" + }, + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } } } diff --git a/phpBB/composer.lock b/phpBB/composer.lock index c0eb7afcbb..c5789e90e8 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -1,22 +1,99 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], - "hash": "cc83663b780856890f787b9b4d6ea474", + "hash": "bcebf4613c2d6273c6d92494b8d08ad6", + "content-hash": "5b630fa42608a550e8dfbd9346893b6b", "packages": [ { + "name": "bantu/ini-get-wrapper", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/bantuXorg/php-ini-get-wrapper.git", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bantuXorg/php-ini-get-wrapper/zipball/4770c7feab370c62e23db4f31c112b7c6d90aee2", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "bantu\\IniGetWrapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Convenience wrapper around ini_get()", + "time": "2014-09-15 13:12:35" + }, + { + "name": "google/recaptcha", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/google/recaptcha.git", + "reference": "2b7e00566afca82a38a1d3adb8e42c118006296e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/recaptcha/zipball/2b7e00566afca82a38a1d3adb8e42c118006296e", + "reference": "2b7e00566afca82a38a1d3adb8e42c118006296e", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.5.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.", + "homepage": "http://www.google.com/recaptcha/", + "keywords": [ + "Abuse", + "captcha", + "recaptcha", + "spam" + ], + "time": "2015-09-02 17:23:59" + }, + { "name": "lusitanian/oauth", - "version": "v0.2.1", + "version": "v0.8.6", "source": { "type": "git", "url": "https://github.com/Lusitanian/PHPoAuthLib.git", - "reference": "00c667d93058e983fc1b7d3d1cebdb1bc03fb043" + "reference": "769fea1bb53845c7b03cca97cbdd0708e9ec26da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/00c667d93058e983fc1b7d3d1cebdb1bc03fb043", - "reference": "00c667d93058e983fc1b7d3d1cebdb1bc03fb043", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/769fea1bb53845c7b03cca97cbdd0708e9ec26da", + "reference": "769fea1bb53845c7b03cca97cbdd0708e9ec26da", "shasum": "" }, "require": { @@ -25,9 +102,11 @@ "require-dev": { "phpunit/phpunit": "3.7.*", "predis/predis": "0.8.*@dev", + "squizlabs/php_codesniffer": "2.*", "symfony/http-foundation": "~2.1" }, "suggest": { + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.", "predis/predis": "Allows using the Redis storage backend.", "symfony/http-foundation": "Allows using the Symfony Session storage backend." }, @@ -53,10 +132,12 @@ "email": "david@daviddesberg.com" }, { + "name": "Elliot Chance", + "email": "elliotchance@gmail.com" + }, + { "name": "Pieter Hordijk", - "email": "info@pieterhordijk.com", - "homepage": "https://pieterhordijk.com", - "role": "developer" + "email": "info@pieterhordijk.com" } ], "description": "PHP 5.3+ oAuth 1/2 Library", @@ -66,7 +147,109 @@ "oauth", "security" ], - "time": "2013-08-29 21:40:04" + "time": "2015-12-21 00:06:34" + }, + { + "name": "marc1706/fast-image-size", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/marc1706/fast-image-size.git", + "reference": "27467cfeca8fb2afd7ef3ffeea6d28a84f79df41" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/27467cfeca8fb2afd7ef3ffeea6d28a84f79df41", + "reference": "27467cfeca8fb2afd7ef3ffeea6d28a84f79df41", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastImageSize\\": "lib", + "FastImageSize\\tests\\": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marc Alexander", + "email": "admin@m-a-styles.de", + "homepage": "https://www.m-a-styles.de", + "role": "Developer" + } + ], + "description": "fast-image-size is a PHP library that does almost everything PHP's getimagesize() does but without the large overhead of downloading the complete file.", + "homepage": "https://www.m-a-styles.de", + "keywords": [ + "fast", + "getimagesize", + "image", + "imagesize", + "php", + "size" + ], + "time": "2015-08-21 11:40:30" + }, + { + "name": "patchwork/utf8", + "version": "v1.1.31", + "source": { + "type": "git", + "url": "https://github.com/tchwork/utf8.git", + "reference": "84da29ef77c422d83126534cb5bb03ba6e20f319" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tchwork/utf8/zipball/84da29ef77c422d83126534cb5bb03ba6e20f319", + "reference": "84da29ef77c422d83126534cb5bb03ba6e20f319", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.3", + "php": ">=5.3.0" + }, + "suggest": { + "ext-iconv": "Use iconv for best performance", + "ext-intl": "Use Intl for best performance", + "ext-mbstring": "Use Mbstring for best performance" + }, + "type": "library", + "autoload": { + "psr-0": { + "Patchwork": "class/", + "Normalizer": "class/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "(Apache-2.0 or GPL-2.0)" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + } + ], + "description": "Portable and performant UTF-8, Unicode and Grapheme Clusters for PHP", + "homepage": "https://github.com/tchwork/utf8", + "keywords": [ + "grapheme", + "i18n", + "unicode", + "utf-8", + "utf8" + ], + "time": "2015-12-15 15:29:47" }, { "name": "psr/log", @@ -88,7 +271,7 @@ "Psr\\Log\\": "" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -107,36 +290,97 @@ "time": "2012-12-21 11:40:51" }, { + "name": "s9e/text-formatter", + "version": "0.4.6", + "source": { + "type": "git", + "url": "https://github.com/s9e/TextFormatter.git", + "reference": "da255f4be12d9b192063b2e4c9de580faee180a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/da255f4be12d9b192063b2e4c9de580faee180a8", + "reference": "da255f4be12d9b192063b2e4c9de580faee180a8", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-filter": "*", + "lib-pcre": ">=7.2", + "php": ">=5.3.3" + }, + "suggest": { + "ext-intl": "Allows international URLs to be accepted by the URL filter", + "ext-json": "Enables the generation of a JavaScript parser", + "ext-mbstring": "Enables some optimizations in the PHP renderer", + "ext-tokenizer": "Enables optimizations in the PHP renderer", + "ext-xsl": "Enables the XSLT renderer", + "ext-zlib": "Enables gzip compression when scraping content via the MediaEmbed plugin" + }, + "type": "library", + "autoload": { + "psr-4": { + "s9e\\TextFormatter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Multi-purpose text formatting and markup library. Plugins offer support for BBCodes, Markdown, emoticons, HTML, embedding media (YouTube, etc...), enhanced typography and more.", + "homepage": "https://github.com/s9e/TextFormatter/", + "keywords": [ + "bbcode", + "bbcodes", + "blog", + "censor", + "embed", + "emoji", + "emoticons", + "engine", + "forum", + "html", + "markdown", + "markup", + "media", + "parser", + "shortcodes" + ], + "time": "2015-12-21 11:07:20" + }, + { "name": "symfony/config", - "version": "v2.3.4", - "target-dir": "Symfony/Component/Config", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/Config.git", - "reference": "65a927c15ca5a911ba2fa277a5457fa8129505b0" + "url": "https://github.com/symfony/config.git", + "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/65a927c15ca5a911ba2fa277a5457fa8129505b0", - "reference": "65a927c15ca5a911ba2fa277a5457fa8129505b0", + "url": "https://api.github.com/repos/symfony/config/zipball/17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", + "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/filesystem": "~2.3" + "php": ">=5.3.9", + "symfony/filesystem": "~2.3|~3.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Config\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -147,47 +391,54 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Config Component", - "homepage": "http://symfony.com", - "time": "2013-08-06 05:49:23" + "homepage": "https://symfony.com", + "time": "2015-12-26 13:37:56" }, { "name": "symfony/console", - "version": "v2.3.6", - "target-dir": "Symfony/Component/Console", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "f880062d56edefb25b36f2defa65aafe65959dc7" + "url": "https://github.com/symfony/console.git", + "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/f880062d56edefb25b36f2defa65aafe65959dc7", - "reference": "f880062d56edefb25b36f2defa65aafe65959dc7", + "url": "https://api.github.com/repos/symfony/console/zipball/2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", + "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { - "symfony/event-dispatcher": "~2.1" + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" }, "suggest": { - "symfony/event-dispatcher": "" + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Console\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -200,52 +451,53 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2013-09-25 06:04:15" + "homepage": "https://symfony.com", + "time": "2015-12-22 10:25:57" }, { "name": "symfony/debug", - "version": "v2.3.4", - "target-dir": "Symfony/Component/Debug", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/Debug.git", - "reference": "729f6d19cfc401c4942e43fcc1059103bd6df130" + "url": "https://github.com/symfony/debug.git", + "reference": "83e51a0e8940ed5e85788ba6bfa022634aa07869" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Debug/zipball/729f6d19cfc401c4942e43fcc1059103bd6df130", - "reference": "729f6d19cfc401c4942e43fcc1059103bd6df130", + "url": "https://api.github.com/repos/symfony/debug/zipball/83e51a0e8940ed5e85788ba6bfa022634aa07869", + "reference": "83e51a0e8940ed5e85788ba6bfa022634aa07869", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "psr/log": "~1.0" }, - "require-dev": { - "symfony/http-foundation": "~2.1", - "symfony/http-kernel": "~2.1" + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, - "suggest": { - "symfony/class-loader": "", - "symfony/http-foundation": "", - "symfony/http-kernel": "" + "require-dev": { + "symfony/class-loader": "~2.2|~3.0.0", + "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2|~3.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Debug\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -256,34 +508,37 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Debug Component", - "homepage": "http://symfony.com", - "time": "2013-08-08 14:16:10" + "homepage": "https://symfony.com", + "time": "2015-12-26 13:37:56" }, { "name": "symfony/dependency-injection", - "version": "v2.3.4", - "target-dir": "Symfony/Component/DependencyInjection", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "3678aa969e5bfeb8515a1f3047c63e8104723f5c" + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "c5086d186f538c2711b9af6f727be7b0446979cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/3678aa969e5bfeb8515a1f3047c63e8104723f5c", - "reference": "3678aa969e5bfeb8515a1f3047c63e8104723f5c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c5086d186f538c2711b9af6f727be7b0446979cd", + "reference": "c5086d186f538c2711b9af6f727be7b0446979cd", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "conflict": { + "symfony/expression-language": "<2.6" }, "require-dev": { - "symfony/config": "~2.2", - "symfony/yaml": "~2.0" + "symfony/config": "~2.2|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/yaml": "~2.1|~3.0.0" }, "suggest": { "symfony/config": "", @@ -293,15 +548,18 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -312,33 +570,36 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony DependencyInjection Component", - "homepage": "http://symfony.com", - "time": "2013-07-25 17:13:25" + "homepage": "https://symfony.com", + "time": "2015-12-26 13:37:56" }, { "name": "symfony/event-dispatcher", - "version": "v2.3.4", - "target-dir": "Symfony/Component/EventDispatcher", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "41c9826457c65fa3cf746f214985b7ca9cba42f8" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/41c9826457c65fa3cf746f214985b7ca9cba42f8", - "reference": "41c9826457c65fa3cf746f214985b7ca9cba42f8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc", + "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "require-dev": { - "symfony/dependency-injection": "~2.0" + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" }, "suggest": { "symfony/dependency-injection": "", @@ -347,13 +608,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -366,43 +630,45 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "homepage": "https://symfony.com", + "time": "2015-10-30 20:15:42" }, { "name": "symfony/filesystem", - "version": "v2.3.4", - "target-dir": "Symfony/Component/Filesystem", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3" + "url": "https://github.com/symfony/filesystem.git", + "reference": "a7ad724530a764d70c168d321ac226ba3d2f10fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/87acbbef6d35ba649f96f09cc572c45119b360c3", - "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a7ad724530a764d70c168d321ac226ba3d2f10fc", + "reference": "a7ad724530a764d70c168d321ac226ba3d2f10fc", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Filesystem\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -413,46 +679,98 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "homepage": "https://symfony.com", + "time": "2015-12-22 10:25:57" + }, + { + "name": "symfony/finder", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "dd41ae57f4f737be271d944a0cc5f5f21203a7c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/dd41ae57f4f737be271d944a0cc5f5f21203a7c6", + "reference": "dd41ae57f4f737be271d944a0cc5f5f21203a7c6", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2015-12-05 11:09:21" }, { "name": "symfony/http-foundation", - "version": "v2.3.4", - "target-dir": "Symfony/Component/HttpFoundation", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "fdf130fe65457aedbc4639a22f4ef9d3be5c002c" + "url": "https://github.com/symfony/http-foundation.git", + "reference": "dc5172ce2d01965f50b6c51bccc5ae243709b3c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/fdf130fe65457aedbc4639a22f4ef9d3be5c002c", - "reference": "fdf130fe65457aedbc4639a22f4ef9d3be5c002c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/dc5172ce2d01965f50b6c51bccc5ae243709b3c2", + "reference": "dc5172ce2d01965f50b6c51bccc5ae243709b3c2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/polyfill-php54": "~1.0" + }, + "require-dev": { + "symfony/expression-language": "~2.4|~3.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, - "classmap": [ - "Symfony/Component/HttpFoundation/Resources/stubs" + "exclude-from-classmap": [ + "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -463,46 +781,53 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony HttpFoundation Component", - "homepage": "http://symfony.com", - "time": "2013-08-26 05:49:51" + "homepage": "https://symfony.com", + "time": "2015-12-18 15:38:35" }, { "name": "symfony/http-kernel", - "version": "v2.3.4", - "target-dir": "Symfony/Component/HttpKernel", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/HttpKernel.git", - "reference": "9d35da40f07bbe7a4f8dfbc41555d2b69de674bf" + "url": "https://github.com/symfony/http-kernel.git", + "reference": "f276fb5049b7ec3918f37ead373b4219b5d4ce0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/9d35da40f07bbe7a4f8dfbc41555d2b69de674bf", - "reference": "9d35da40f07bbe7a4f8dfbc41555d2b69de674bf", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f276fb5049b7ec3918f37ead373b4219b5d4ce0e", + "reference": "f276fb5049b7ec3918f37ead373b4219b5d4ce0e", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.9", "psr/log": "~1.0", - "symfony/debug": "~2.3", - "symfony/event-dispatcher": "~2.1", - "symfony/http-foundation": "~2.2" + "symfony/debug": "~2.6,>=2.6.2", + "symfony/event-dispatcher": "~2.6,>=2.6.7|~3.0.0", + "symfony/http-foundation": "~2.5,>=2.5.4|~3.0.0" + }, + "conflict": { + "symfony/config": "<2.7" }, "require-dev": { - "symfony/browser-kit": "~2.2", - "symfony/class-loader": "~2.1", - "symfony/config": "~2.0", - "symfony/console": "~2.2", - "symfony/dependency-injection": "~2.0", - "symfony/finder": "~2.0", - "symfony/process": "~2.0", - "symfony/routing": "~2.2", - "symfony/stopwatch": "~2.2", - "symfony/templating": "~2.2" + "symfony/browser-kit": "~2.3|~3.0.0", + "symfony/class-loader": "~2.1|~3.0.0", + "symfony/config": "~2.8", + "symfony/console": "~2.3|~3.0.0", + "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.8|~3.0.0", + "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0", + "symfony/expression-language": "~2.4|~3.0.0", + "symfony/finder": "~2.0,>=2.0.5|~3.0.0", + "symfony/process": "~2.0,>=2.0.5|~3.0.0", + "symfony/routing": "~2.8|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0", + "symfony/templating": "~2.2|~3.0.0", + "symfony/translation": "~2.0,>=2.0.5|~3.0.0", + "symfony/var-dumper": "~2.6|~3.0.0" }, "suggest": { "symfony/browser-kit": "", @@ -510,20 +835,24 @@ "symfony/config": "", "symfony/console": "", "symfony/dependency-injection": "", - "symfony/finder": "" + "symfony/finder": "", + "symfony/var-dumper": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\HttpKernel\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -534,54 +863,181 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony HttpKernel Component", - "homepage": "http://symfony.com", - "time": "2013-08-27 08:58:24" + "homepage": "https://symfony.com", + "time": "2015-12-26 15:56:42" }, { - "name": "symfony/routing", - "version": "v2.3.4", - "target-dir": "Symfony/Component/Routing", + "name": "symfony/polyfill-mbstring", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/49ff736bd5d41f45240cec77b44967d76e0c3d25", + "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2015-11-20 09:19:13" + }, + { + "name": "symfony/polyfill-php54", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/Routing.git", - "reference": "69af3f07dbf3ae93dd513dbc373f561cb2e7f143" + "url": "https://github.com/symfony/polyfill-php54.git", + "reference": "2c9f6d98eb30dc04fe0b06f9cc92a55acea5bdcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/69af3f07dbf3ae93dd513dbc373f561cb2e7f143", - "reference": "69af3f07dbf3ae93dd513dbc373f561cb2e7f143", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/2c9f6d98eb30dc04fe0b06f9cc92a55acea5bdcc", + "reference": "2c9f6d98eb30dc04fe0b06f9cc92a55acea5bdcc", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php54\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2015-11-04 20:28:58" + }, + { + "name": "symfony/routing", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "b3261d88bad77de60e01f05706810413cc11367d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/b3261d88bad77de60e01f05706810413cc11367d", + "reference": "b3261d88bad77de60e01f05706810413cc11367d", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "conflict": { + "symfony/config": "<2.7" + }, "require-dev": { + "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0", - "symfony/config": "~2.2", - "symfony/yaml": "~2.0" + "symfony/config": "~2.7|~3.0.0", + "symfony/expression-language": "~2.4|~3.0.0", + "symfony/http-foundation": "~2.3|~3.0.0", + "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" }, "suggest": { - "doctrine/common": "", - "symfony/config": "", - "symfony/yaml": "" + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/yaml": "For using the YAML loader" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Routing\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -592,41 +1048,130 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Routing Component", - "homepage": "http://symfony.com", - "time": "2013-08-23 15:14:07" + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2015-12-23 07:56:26" + }, + { + "name": "symfony/twig-bridge", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bridge.git", + "reference": "39995c1dfe1d1fbfc6605df6d02774d33ac3ce3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/39995c1dfe1d1fbfc6605df6d02774d33ac3ce3d", + "reference": "39995c1dfe1d1fbfc6605df6d02774d33ac3ce3d", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "twig/twig": "~1.23|~2.0" + }, + "require-dev": { + "symfony/asset": "~2.7|~3.0.0", + "symfony/console": "~2.8|~3.0.0", + "symfony/expression-language": "~2.4|~3.0.0", + "symfony/finder": "~2.3|~3.0.0", + "symfony/form": "~2.8", + "symfony/http-kernel": "~2.8|~3.0.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/routing": "~2.2|~3.0.0", + "symfony/security": "~2.6|~3.0.0", + "symfony/security-acl": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.2|~3.0.0", + "symfony/templating": "~2.1|~3.0.0", + "symfony/translation": "~2.7|~3.0.0", + "symfony/var-dumper": "~2.6|~3.0.0", + "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" + }, + "suggest": { + "symfony/asset": "For using the AssetExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/finder": "", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/security": "For using the SecurityExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/templating": "For using the TwigEngine", + "symfony/translation": "For using the TranslationExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/yaml": "For using the YamlExtension" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Twig\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Twig Bridge", + "homepage": "https://symfony.com", + "time": "2015-12-07 21:56:39" }, { "name": "symfony/yaml", - "version": "v2.3.4", - "target-dir": "Symfony/Component/Yaml", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847" + "url": "https://github.com/symfony/yaml.git", + "reference": "ac84cbb98b68a6abbc9f5149eb96ccc7b07b8966" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/5a279f1b5f5e1045a6c432354d9ea727ff3a9847", - "reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847", + "url": "https://api.github.com/repos/symfony/yaml/zipball/ac84cbb98b68a6abbc9f5149eb96ccc7b07b8966", + "reference": "ac84cbb98b68a6abbc9f5149eb96ccc7b07b8966", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Yaml\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -639,34 +1184,38 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2013-08-24 15:26:22" + "homepage": "https://symfony.com", + "time": "2015-12-26 13:37:56" }, { "name": "twig/twig", - "version": "v1.13.2", + "version": "v1.23.1", "source": { "type": "git", - "url": "https://github.com/fabpot/Twig.git", - "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755" + "url": "https://github.com/twigphp/Twig.git", + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/6d6a1009427d1f398c9d40904147bf9f723d5755", - "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6", + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": ">=5.2.7" + }, + "require-dev": { + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.23-dev" } }, "autoload": { @@ -674,18 +1223,26 @@ "Twig_": "lib/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com" + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", @@ -693,27 +1250,27 @@ "keywords": [ "templating" ], - "time": "2013-08-03 15:35:31" + "time": "2015-11-05 12:49:06" } ], "packages-dev": [ { "name": "fabpot/goutte", - "version": "v1.0.3", + "version": "v1.0.7", "source": { "type": "git", - "url": "https://github.com/fabpot/Goutte.git", - "reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f" + "url": "https://github.com/FriendsOfPHP/Goutte.git", + "reference": "794b196e76bdd37b5155cdecbad311f0a3b07625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Goutte/zipball/75c9f23c4122caf4ea3e87a42a00b471366e707f", - "reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f", + "url": "https://api.github.com/repos/FriendsOfPHP/Goutte/zipball/794b196e76bdd37b5155cdecbad311f0a3b07625", + "reference": "794b196e76bdd37b5155cdecbad311f0a3b07625", "shasum": "" }, "require": { "ext-curl": "*", - "guzzle/http": ">=3.0.5,<3.8-dev", + "guzzle/http": "~3.1", "php": ">=5.3.0", "symfony/browser-kit": "~2.1", "symfony/css-selector": "~2.1", @@ -722,8 +1279,8 @@ "symfony/process": "~2.1" }, "require-dev": { - "guzzle/plugin-history": ">=3.0.5,<3.8-dev", - "guzzle/plugin-mock": ">=3.0.5,<3.8-dev" + "guzzle/plugin-history": "~3.1", + "guzzle/plugin-mock": "~3.1" }, "type": "application", "extra": { @@ -751,85 +1308,73 @@ "keywords": [ "scraper" ], - "time": "2013-08-16 06:03:22" + "time": "2014-10-09 15:52:51" }, { - "name": "guzzle/common", - "version": "v3.7.3", - "target-dir": "Guzzle/Common", + "name": "guzzle/guzzle", + "version": "v3.9.3", "source": { "type": "git", - "url": "https://github.com/guzzle/common.git", - "reference": "bf73c87375f60861f8c7ccc7b95878023ade5306" + "url": "https://github.com/guzzle/guzzle3.git", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/common/zipball/bf73c87375f60861f8c7ccc7b95878023ade5306", - "reference": "bf73c87375f60861f8c7ccc7b95878023ade5306", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", "shasum": "" }, "require": { - "php": ">=5.3.2", - "symfony/event-dispatcher": ">=2.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle\\Common": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Common libraries used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "collection", - "common", - "event", - "exception" - ], - "time": "2013-09-08 21:09:18" - }, - { - "name": "guzzle/http", - "version": "v3.7.3", - "target-dir": "Guzzle/Http", - "source": { - "type": "git", - "url": "https://github.com/guzzle/http.git", - "reference": "1034125dfd906b73119e535f03153a62fccb1989" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/http/zipball/1034125dfd906b73119e535f03153a62fccb1989", - "reference": "1034125dfd906b73119e535f03153a62fccb1989", - "shasum": "" + "ext-curl": "*", + "php": ">=5.3.3", + "symfony/event-dispatcher": "~2.1" }, - "require": { + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", "guzzle/parser": "self.version", - "guzzle/stream": "self.version", - "php": ">=5.3.2" + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/cache": "~1.3", + "monolog/monolog": "~1.0", + "phpunit/phpunit": "3.7.*", + "psr/log": "~1.0", + "symfony/class-loader": "~2.1", + "zendframework/zend-cache": "2.*,<2.3", + "zendframework/zend-log": "2.*,<2.3" }, "suggest": { - "ext-curl": "*" + "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.7-dev" + "dev-master": "3.9-dev" } }, "autoload": { "psr-0": { - "Guzzle\\Http": "" + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" } }, "notification-url": "https://packagist.org/downloads/", @@ -841,115 +1386,120 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" } ], - "description": "HTTP libraries used by Guzzle", + "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", "homepage": "http://guzzlephp.org/", "keywords": [ - "Guzzle", "client", "curl", + "framework", "http", - "http client" + "http client", + "rest", + "web service" ], - "time": "2013-09-06 11:34:26" + "time": "2015-03-18 18:23:50" }, { - "name": "guzzle/parser", - "version": "v3.7.3", - "target-dir": "Guzzle/Parser", + "name": "michelf/php-markdown", + "version": "1.6.0", "source": { "type": "git", - "url": "https://github.com/guzzle/parser.git", - "reference": "a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2" + "url": "https://github.com/michelf/php-markdown.git", + "reference": "156e56ee036505ec637d761ee62dc425d807183c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/parser/zipball/a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2", - "reference": "a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/156e56ee036505ec637d761ee62dc425d807183c", + "reference": "156e56ee036505ec637d761ee62dc425d807183c", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.7-dev" + "dev-lib": "1.4.x-dev" } }, "autoload": { "psr-0": { - "Guzzle\\Parser": "" + "Michelf": "" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], - "description": "Interchangeable parsers used by Guzzle", - "homepage": "http://guzzlephp.org/", + "authors": [ + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "https://michelf.ca/", + "role": "Developer" + }, + { + "name": "John Gruber", + "homepage": "https://daringfireball.net/" + } + ], + "description": "PHP Markdown", + "homepage": "https://michelf.ca/projects/php-markdown/", "keywords": [ - "URI Template", - "cookie", - "http", - "message", - "url" + "markdown" ], - "time": "2013-07-11 22:46:03" + "time": "2015-12-24 01:37:31" }, { - "name": "guzzle/stream", - "version": "v3.7.3", - "target-dir": "Guzzle/Stream", + "name": "nikic/php-parser", + "version": "v0.9.5", "source": { "type": "git", - "url": "https://github.com/guzzle/stream.git", - "reference": "a86111d9ac7db31d65a053c825869409fe8fc83f" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/stream/zipball/a86111d9ac7db31d65a053c825869409fe8fc83f", - "reference": "a86111d9ac7db31d65a053c825869409fe8fc83f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", "shasum": "" }, "require": { - "guzzle/common": "self.version", - "php": ">=5.3.2" - }, - "suggest": { - "guzzle/http": "To convert Guzzle request objects to PHP streams" + "ext-tokenizer": "*", + "php": ">=5.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.7-dev" + "dev-master": "0.9-dev" } }, "autoload": { "psr-0": { - "Guzzle\\Stream": "" + "PHPParser": "lib/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" + "name": "Nikita Popov" } ], - "description": "Guzzle stream wrapper component", - "homepage": "http://guzzlephp.org/", + "description": "A PHP parser written in PHP", "keywords": [ - "Guzzle", - "component", - "stream" + "parser", + "php" ], - "time": "2013-07-30 22:07:23" + "time": "2014-07-23 18:24:17" }, { "name": "phing/phing", @@ -987,7 +1537,8 @@ "authors": [ { "name": "Michiel Rook", - "email": "mrook@php.net" + "email": "mrook@php.net", + "role": "Lead" }, { "name": "Phing Community", @@ -1005,31 +1556,32 @@ }, { "name": "phpunit/dbunit", - "version": "1.2.3", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/dbunit.git", - "reference": "8386782a2d55153e44a06eb1a9d13d6ed35d9c2d" + "reference": "1507040c2541bdffd7fbd71fc792cecdea6a7c61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/8386782a2d55153e44a06eb1a9d13d6ed35d9c2d", - "reference": "8386782a2d55153e44a06eb1a9d13d6ed35d9c2d", + "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/1507040c2541bdffd7fbd71fc792cecdea6a7c61", + "reference": "1507040c2541bdffd7fbd71fc792cecdea6a7c61", "shasum": "" }, "require": { "ext-pdo": "*", "ext-simplexml": "*", "php": ">=5.3.3", - "phpunit/phpunit": ">=3.7.0@stable" + "phpunit/phpunit": "~3.7|~4.0", + "symfony/yaml": "~2.1" }, "bin": [ - "dbunit.php" + "composer/bin/dbunit" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1059,50 +1611,51 @@ "testing", "xunit" ], - "time": "2013-03-01 11:50:46" + "time": "2015-03-29 14:23:04" }, { "name": "phpunit/php-code-coverage", - "version": "1.2.13", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", - "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { "php": ">=5.3.3", - "phpunit/php-file-iterator": ">=1.3.0@stable", - "phpunit/php-text-template": ">=1.1.1@stable", - "phpunit/php-token-stream": ">=1.1.3@stable" + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" }, "require-dev": { - "phpunit/phpunit": "3.7.*@dev" + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" }, "suggest": { "ext-dom": "*", - "ext-xdebug": ">=2.0.5" + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -1120,20 +1673,20 @@ "testing", "xunit" ], - "time": "2013-09-10 08:14:32" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.3", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "16a78140ed2fc01b945cfa539665fadc6a038029" + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/16a78140ed2fc01b945cfa539665fadc6a038029", - "reference": "16a78140ed2fc01b945cfa539665fadc6a038029", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", "shasum": "" }, "require": { @@ -1160,25 +1713,25 @@ } ], "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "http://www.phpunit.de/", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ "filesystem", "iterator" ], - "time": "2012-10-11 11:44:38" + "time": "2013-10-10 15:34:57" }, { "name": "phpunit/php-text-template", - "version": "1.1.4", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23", - "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -1187,20 +1740,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1209,20 +1759,20 @@ "keywords": [ "template" ], - "time": "2012-10-31 18:15:28" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -1231,13 +1781,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -1253,49 +1800,48 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", - "version": "1.2.1", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e" + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", - "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.4-dev" } }, "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], "description": "Wrapper around PHP's tokenizer extension.", @@ -1303,56 +1849,56 @@ "keywords": [ "tokenizer" ], - "time": "2013-09-13 04:58:23" + "time": "2015-09-15 10:49:45" }, { "name": "phpunit/phpunit", - "version": "3.7.24", + "version": "4.1.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "af7b77ccb5c64458bdfca95665d29558d1df7d08" + "reference": "241116219bb7e3b8111a36ffd8f37546888738d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/af7b77ccb5c64458bdfca95665d29558d1df7d08", - "reference": "af7b77ccb5c64458bdfca95665d29558d1df7d08", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/241116219bb7e3b8111a36ffd8f37546888738d6", + "reference": "241116219bb7e3b8111a36ffd8f37546888738d6", "shasum": "" }, "require": { "ext-dom": "*", + "ext-json": "*", "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpunit/php-code-coverage": "~1.2.1", - "phpunit/php-file-iterator": ">=1.3.1", - "phpunit/php-text-template": ">=1.1.1", - "phpunit/php-timer": ">=1.0.4", - "phpunit/phpunit-mock-objects": "~1.2.0", + "phpunit/php-code-coverage": "~2.0", + "phpunit/php-file-iterator": "~1.3.1", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "~1.0.2", + "phpunit/phpunit-mock-objects": "2.1.5", + "sebastian/comparator": "~1.0", + "sebastian/diff": "~1.1", + "sebastian/environment": "~1.0", + "sebastian/exporter": "~1.0", + "sebastian/version": "~1.0", "symfony/yaml": "~2.0" }, - "require-dev": { - "pear-pear/pear": "1.9.4" - }, "suggest": { - "ext-json": "*", - "ext-simplexml": "*", - "ext-tokenizer": "*", - "phpunit/php-invoker": ">=1.1.0,<1.2.0" + "phpunit/php-invoker": "~1.1" }, "bin": [ - "composer/bin/phpunit" + "phpunit" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "3.7.x-dev" + "dev-master": "4.1.x-dev" } }, "autoload": { "classmap": [ - "PHPUnit/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1377,33 +1923,41 @@ "testing", "xunit" ], - "time": "2013-08-09 06:58:24" + "time": "2014-08-17 08:07:02" }, { "name": "phpunit/phpunit-mock-objects", - "version": "1.2.3", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" + "reference": "7878b9c41edb3afab92b85edf5f0981014a2713a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7878b9c41edb3afab92b85edf5f0981014a2713a", + "reference": "7878b9c41edb3afab92b85edf5f0981014a2713a", "shasum": "" }, "require": { "php": ">=5.3.3", - "phpunit/php-text-template": ">=1.1.1@stable" + "phpunit/php-text-template": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.1" }, "suggest": { "ext-soap": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, "autoload": { "classmap": [ - "PHPUnit/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1426,45 +1980,475 @@ "mock", "xunit" ], - "time": "2013-01-13 10:24:48" + "time": "2014-06-12 07:22:15" + }, + { + "name": "pimple/pimple", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", + "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2013-03-08 08:21:40" + }, + { + "name": "sami/sami", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/Sami.git", + "reference": "160018bfefffa730dc35a2c606691a45acbf41a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/Sami/zipball/160018bfefffa730dc35a2c606691a45acbf41a1", + "reference": "160018bfefffa730dc35a2c606691a45acbf41a1", + "shasum": "" + }, + "require": { + "michelf/php-markdown": "~1.3", + "nikic/php-parser": "0.9.*", + "php": ">=5.3.0", + "pimple/pimple": "1.0.*", + "symfony/console": "~2.1", + "symfony/filesystem": "~2.1", + "symfony/finder": "~2.1", + "symfony/process": "~2.1", + "symfony/yaml": "~2.1", + "twig/twig": "1.*" + }, + "bin": [ + "sami.php" + ], + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-0": { + "Sami": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Sami, an API documentation generator", + "homepage": "http://sami.sensiolabs.org", + "keywords": [ + "phpdoc" + ], + "time": "2015-06-05 03:36:34" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "6e7133793a8e5a5714a551a8324337374be209df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", + "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2015-12-02 08:37:27" + }, + { + "name": "sebastian/exporter", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-06-21 07:55:53" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" }, { "name": "squizlabs/php_codesniffer", - "version": "1.5.0RC4", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "146a9b54e4adeaca0a3ae073e0a8a03570d6cc43" + "reference": "e4fb41d5d0387d556e2c25534d630b3cce90ea67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/146a9b54e4adeaca0a3ae073e0a8a03570d6cc43", - "reference": "146a9b54e4adeaca0a3ae073e0a8a03570d6cc43", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e4fb41d5d0387d556e2c25534d630b3cce90ea67", + "reference": "e4fb41d5d0387d556e2c25534d630b3cce90ea67", "shasum": "" }, "require": { "ext-tokenizer": "*", + "ext-xmlwriter": "*", "php": ">=5.1.2" }, - "suggest": { - "phpunit/php-timer": "dev-master" + "require-dev": { + "phpunit/phpunit": "~4.0" }, "bin": [ - "scripts/phpcs" + "scripts/phpcs", + "scripts/phpcbf" ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "CodeSniffer.php", "CodeSniffer/CLI.php", "CodeSniffer/Exception.php", "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", "CodeSniffer/Report.php", "CodeSniffer/Reporting.php", "CodeSniffer/Sniff.php", "CodeSniffer/Tokens.php", "CodeSniffer/Reports/", - "CodeSniffer/CommentParser/", "CodeSniffer/Tokenizers/", "CodeSniffer/DocGenerators/", "CodeSniffer/Standards/AbstractPatternSniff.php", @@ -1490,36 +2474,35 @@ "role": "lead" } ], - "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", "homepage": "http://www.squizlabs.com/php-codesniffer", "keywords": [ "phpcs", "standards" ], - "time": "2013-09-26 00:14:02" + "time": "2015-12-11 00:12:46" }, { "name": "symfony/browser-kit", - "version": "v2.3.4", - "target-dir": "Symfony/Component/BrowserKit", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/BrowserKit.git", - "reference": "2639dc4eec81f92760e05396a93bb78000b4f5ca" + "url": "https://github.com/symfony/browser-kit.git", + "reference": "dd2cfb20fabd4efca14cf3b2345d40b3dd5e9aca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/2639dc4eec81f92760e05396a93bb78000b4f5ca", - "reference": "2639dc4eec81f92760e05396a93bb78000b4f5ca", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/dd2cfb20fabd4efca14cf3b2345d40b3dd5e9aca", + "reference": "dd2cfb20fabd4efca14cf3b2345d40b3dd5e9aca", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/dom-crawler": "~2.0" + "php": ">=5.3.9", + "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0" }, "require-dev": { - "symfony/css-selector": "~2.0", - "symfony/process": "~2.0" + "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0", + "symfony/process": "~2.3.34|~2.7,>=2.7.6|~3.0.0" }, "suggest": { "symfony/process": "" @@ -1527,13 +2510,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\BrowserKit\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1546,41 +2532,43 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony BrowserKit Component", - "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "homepage": "https://symfony.com", + "time": "2015-12-26 13:37:56" }, { "name": "symfony/css-selector", - "version": "v2.3.4", - "target-dir": "Symfony/Component/CssSelector", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/CssSelector.git", - "reference": "885544201cb24e79754da1dbd61bd779c2e4353e" + "url": "https://github.com/symfony/css-selector.git", + "reference": "eaa3320e32f09a01dc432c6efbe8051aee59cfef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/885544201cb24e79754da1dbd61bd779c2e4353e", - "reference": "885544201cb24e79754da1dbd61bd779c2e4353e", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/eaa3320e32f09a01dc432c6efbe8051aee59cfef", + "reference": "eaa3320e32f09a01dc432c6efbe8051aee59cfef", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\CssSelector\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1588,42 +2576,42 @@ ], "authors": [ { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { "name": "Fabien Potencier", "email": "fabien@symfony.com" }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony CssSelector Component", - "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "homepage": "https://symfony.com", + "time": "2015-12-05 17:37:59" }, { "name": "symfony/dom-crawler", - "version": "v2.3.4", - "target-dir": "Symfony/Component/DomCrawler", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/DomCrawler.git", - "reference": "e05e07fe8958a304b5e135f8e65d4ae6148cf59b" + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "a2712aff8b250d9601ad6bd23a2ff82a12730e8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/e05e07fe8958a304b5e135f8e65d4ae6148cf59b", - "reference": "e05e07fe8958a304b5e135f8e65d4ae6148cf59b", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/a2712aff8b250d9601ad6bd23a2ff82a12730e8e", + "reference": "a2712aff8b250d9601ad6bd23a2ff82a12730e8e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { - "symfony/css-selector": "~2.0" + "symfony/css-selector": "~2.8|~3.0.0" }, "suggest": { "symfony/css-selector": "" @@ -1631,60 +2619,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\DomCrawler\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony DomCrawler Component", - "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" - }, - { - "name": "symfony/finder", - "version": "v2.3.4", - "target-dir": "Symfony/Component/Finder", - "source": { - "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", - "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - } + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1697,41 +2641,43 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2013-08-13 20:18:00" + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com", + "time": "2015-12-23 17:16:29" }, { "name": "symfony/process", - "version": "v2.3.4", - "target-dir": "Symfony/Component/Process", + "version": "v2.8.1", "source": { "type": "git", - "url": "https://github.com/symfony/Process.git", - "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b" + "url": "https://github.com/symfony/process.git", + "reference": "62c254438b5040bc2217156e1570cf2206e8540c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", - "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", + "url": "https://api.github.com/repos/symfony/process/zipball/62c254438b5040bc2217156e1570cf2206e8540c", + "reference": "62c254438b5040bc2217156e1570cf2206e8540c", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Process\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1744,25 +2690,21 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Process Component", - "homepage": "http://symfony.com", - "time": "2013-08-22 06:42:25" + "homepage": "https://symfony.com", + "time": "2015-12-23 11:03:46" } ], - "aliases": [ - - ], - "minimum-stability": "beta", - "stability-flags": [ - - ], - "platform": [ - - ], - "platform-dev": [ - - ] + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4,<7.1" + }, + "platform-dev": [] } diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml deleted file mode 100644 index dac8b9d252..0000000000 --- a/phpBB/config/auth_providers.yml +++ /dev/null @@ -1,83 +0,0 @@ -services: - auth.provider_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: auth.provider } - auth.provider.db: - class: phpbb\auth\provider\db - arguments: - - @dbal.conn - - @config - - @passwords.manager - - @request - - @user - - %core.root_path% - - %core.php_ext% - tags: - - { name: auth.provider } - auth.provider.apache: - class: phpbb\auth\provider\apache - arguments: - - @dbal.conn - - @config - - @passwords.manager - - @request - - @user - - %core.root_path% - - %core.php_ext% - tags: - - { name: auth.provider } - auth.provider.ldap: - class: phpbb\auth\provider\ldap - arguments: - - @dbal.conn - - @config - - @passwords.manager - - @user - tags: - - { name: auth.provider } - auth.provider.oauth: - class: phpbb\auth\provider\oauth\oauth - arguments: - - @dbal.conn - - @config - - @passwords.manager - - @request - - @user - - %tables.auth_provider_oauth_token_storage% - - %tables.auth_provider_oauth_account_assoc% - - @auth.provider.oauth.service_collection - - %tables.users% - - %core.root_path% - - %core.php_ext% - tags: - - { name: auth.provider } - auth.provider.oauth.service_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: auth.provider.oauth.service } - auth.provider.oauth.service.bitly: - class: phpbb\auth\provider\oauth\service\bitly - arguments: - - @config - - @request - tags: - - { name: auth.provider.oauth.service } - auth.provider.oauth.service.facebook: - class: phpbb\auth\provider\oauth\service\facebook - arguments: - - @config - - @request - tags: - - { name: auth.provider.oauth.service } - auth.provider.oauth.service.google: - class: phpbb\auth\provider\oauth\service\google - arguments: - - @config - - @request - tags: - - { name: auth.provider.oauth.service } diff --git a/phpBB/config/avatars.yml b/phpBB/config/avatars.yml deleted file mode 100644 index d22a5db2ae..0000000000 --- a/phpBB/config/avatars.yml +++ /dev/null @@ -1,59 +0,0 @@ -services: - avatar.driver.gravatar: - class: phpbb\avatar\driver\gravatar - arguments: - - @config - - %core.root_path% - - %core.php_ext% - - @path_helper - - @cache.driver - calls: - - [set_name, [avatar.driver.gravatar]] - tags: - - { name: avatar.driver } - - avatar.driver.local: - class: phpbb\avatar\driver\local - arguments: - - @config - - %core.root_path% - - %core.php_ext% - - @path_helper - - @cache.driver - calls: - - [set_name, [avatar.driver.local]] - tags: - - { name: avatar.driver } - - avatar.driver.remote: - class: phpbb\avatar\driver\remote - arguments: - - @config - - %core.root_path% - - %core.php_ext% - - @path_helper - - @cache.driver - calls: - - [set_name, [avatar.driver.remote]] - tags: - - { name: avatar.driver } - - avatar.driver.upload: - class: phpbb\avatar\driver\upload - arguments: - - @config - - %core.root_path% - - %core.php_ext% - - @path_helper - - @cache.driver - calls: - - [set_name, [avatar.driver.upload]] - tags: - - { name: avatar.driver } - - avatar.driver_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: avatar.driver } diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml deleted file mode 100644 index a4aae75e40..0000000000 --- a/phpBB/config/console.yml +++ /dev/null @@ -1,70 +0,0 @@ -services: - console.command.config.delete: - class: phpbb\console\command\config\delete - arguments: - - @config - tags: - - { name: console.command } - - console.command.config.increment: - class: phpbb\console\command\config\increment - arguments: - - @config - tags: - - { name: console.command } - - console.command.config.get: - class: phpbb\console\command\config\get - arguments: - - @config - tags: - - { name: console.command } - - console.command.config.set: - class: phpbb\console\command\config\set - arguments: - - @config - tags: - - { name: console.command } - - console.command.config.set_atomic: - class: phpbb\console\command\config\set_atomic - arguments: - - @config - tags: - - { name: console.command } - - console.command.extension.disable: - class: phpbb\console\command\extension\disable - arguments: - - @ext.manager - tags: - - { name: console.command } - - console.command.extension.enable: - class: phpbb\console\command\extension\enable - arguments: - - @ext.manager - tags: - - { name: console.command } - - console.command.extension.purge: - class: phpbb\console\command\extension\purge - arguments: - - @ext.manager - tags: - - { name: console.command } - - console.command.extension.show: - class: phpbb\console\command\extension\show - arguments: - - @ext.manager - tags: - - { name: console.command } - - console.command.fixup.recalculate_email_hash: - class: phpbb\console\command\fixup\recalculate_email_hash - arguments: - - @dbal.conn - tags: - - { name: console.command } diff --git a/phpBB/config/cron_tasks.yml b/phpBB/config/cron_tasks.yml deleted file mode 100644 index fd3aea85dc..0000000000 --- a/phpBB/config/cron_tasks.yml +++ /dev/null @@ -1,111 +0,0 @@ -services: - cron.task.core.prune_all_forums: - class: phpbb\cron\task\core\prune_all_forums - arguments: - - %core.root_path% - - %core.php_ext% - - @config - - @dbal.conn - calls: - - [set_name, [cron.task.core.prune_all_forums]] - tags: - - { name: cron.task } - - cron.task.core.prune_forum: - class: phpbb\cron\task\core\prune_forum - arguments: - - %core.root_path% - - %core.php_ext% - - @config - - @dbal.conn - calls: - - [set_name, [cron.task.core.prune_forum]] - tags: - - { name: cron.task } - - cron.task.core.prune_notifications: - class: phpbb\cron\task\core\prune_notifications - arguments: - - @config - - @notification_manager - calls: - - [set_name, [cron.task.core.prune_notifications]] - tags: - - { name: cron.task } - - cron.task.core.queue: - class: phpbb\cron\task\core\queue - arguments: - - %core.root_path% - - %core.php_ext% - - @config - calls: - - [set_name, [cron.task.core.queue]] - tags: - - { name: cron.task } - - cron.task.core.tidy_cache: - class: phpbb\cron\task\core\tidy_cache - arguments: - - @config - - @cache.driver - calls: - - [set_name, [cron.task.core.tidy_cache]] - tags: - - { name: cron.task } - - cron.task.core.tidy_database: - class: phpbb\cron\task\core\tidy_database - arguments: - - %core.root_path% - - %core.php_ext% - - @config - calls: - - [set_name, [cron.task.core.tidy_database]] - tags: - - { name: cron.task } - - cron.task.core.tidy_plupload: - class: phpbb\cron\task\core\tidy_plupload - arguments: - - %core.root_path% - - @config - calls: - - [set_name, [cron.task.core.tidy_plupload]] - tags: - - { name: cron.task } - - cron.task.core.tidy_search: - class: phpbb\cron\task\core\tidy_search - arguments: - - %core.root_path% - - %core.php_ext% - - @auth - - @config - - @dbal.conn - - @user - calls: - - [set_name, [cron.task.core.tidy_search]] - tags: - - { name: cron.task } - - cron.task.core.tidy_sessions: - class: phpbb\cron\task\core\tidy_sessions - arguments: - - @config - - @user - calls: - - [set_name, [cron.task.core.tidy_sessions]] - tags: - - { name: cron.task } - - cron.task.core.tidy_warnings: - class: phpbb\cron\task\core\tidy_warnings - arguments: - - %core.root_path% - - %core.php_ext% - - @config - calls: - - [set_name, [cron.task.core.tidy_warnings]] - tags: - - { name: cron.task } diff --git a/phpBB/config/default/config.yml b/phpBB/config/default/config.yml new file mode 100644 index 0000000000..e8d0536287 --- /dev/null +++ b/phpBB/config/default/config.yml @@ -0,0 +1 @@ +# phpBB's config file (This line is needed because of the packager) diff --git a/phpBB/config/default/container/parameters.yml b/phpBB/config/default/container/parameters.yml new file mode 100644 index 0000000000..8ecc1428f4 --- /dev/null +++ b/phpBB/config/default/container/parameters.yml @@ -0,0 +1,20 @@ +parameters: + # Disable the usage of the super globals (_GET, _POST, _SERVER...) + core.disable_super_globals: true + + # Datetime class to use + datetime.class: \phpbb\datetime + + # Mimetype guesser priorities + mimetype.guesser.priority.lowest: -2 + mimetype.guesser.priority.low: -1 + mimetype.guesser.priority.default: 0 + mimetype.guesser.priority.high: 1 + mimetype.guesser.priority.highest: 2 + + # List of default password driver types + passwords.algorithms: + - passwords.driver.bcrypt_2y + - passwords.driver.bcrypt + - passwords.driver.salted_md5 + - passwords.driver.phpass diff --git a/phpBB/config/default/container/services.yml b/phpBB/config/default/container/services.yml new file mode 100644 index 0000000000..f5f85fbcad --- /dev/null +++ b/phpBB/config/default/container/services.yml @@ -0,0 +1,169 @@ +imports: + - { resource: services_attachment.yml } + - { resource: services_auth.yml } + - { resource: services_avatar.yml } + - { resource: services_captcha.yml } + - { resource: services_console.yml } + - { resource: services_content.yml } + - { resource: services_cron.yml } + - { resource: services_db.yml } + - { resource: services_event.yml } + - { resource: services_feed.yml } + - { resource: services_files.yml } + - { resource: services_filesystem.yml } + - { resource: services_help.yml } + - { resource: services_hook.yml } + - { resource: services_http.yml } + - { resource: services_language.yml } + - { resource: services_migrator.yml } + - { resource: services_mimetype_guesser.yml } + - { resource: services_module.yml } + - { resource: services_notification.yml } + - { resource: services_password.yml } + - { resource: services_php.yml } + - { resource: services_profilefield.yml } + - { resource: services_report.yml } + - { resource: services_routing.yml } + - { resource: services_text_formatter.yml } + - { resource: services_text_reparser.yml } + - { resource: services_twig.yml } + - { resource: services_user.yml } + + - { resource: tables.yml } + - { resource: parameters.yml } + +services: + cache: + class: phpbb\cache\service + arguments: + - '@cache.driver' + - '@config' + - '@dbal.conn' + - '%core.root_path%' + - '%core.php_ext%' + + cache.driver: + class: '%cache.driver.class%' + + class_loader: + class: phpbb\class_loader + arguments: + - phpbb\ + - '%core.root_path%includes/' + - '%core.php_ext%' + calls: + - [register, []] + - [set_cache, ['@cache.driver']] + + class_loader.ext: + class: phpbb\class_loader + arguments: + - \ + - '%core.root_path%ext/' + - '%core.php_ext%' + calls: + - [register, []] + - [set_cache, ['@cache.driver']] + + config: + class: phpbb\config\db + arguments: + - '@dbal.conn' + - '@cache.driver' + - '%tables.config%' + + config.php: + synthetic: true + + config_text: + class: phpbb\config\db_text + arguments: + - '@dbal.conn' + - '%tables.config_text%' + + controller.helper: + class: phpbb\controller\helper + arguments: + - '@template' + - '@user' + - '@config' + - '@symfony_request' + - '@request' + - '@routing.helper' + + controller.resolver: + class: phpbb\controller\resolver + arguments: + - '@service_container' + - '%core.root_path%' + - '@template' + + ext.manager: + class: phpbb\extension\manager + arguments: + - '@service_container' + - '@dbal.conn' + - '@config' + - '@filesystem' + - '%tables.ext%' + - '%core.root_path%' + - '%core.php_ext%' + - '@cache.driver' + + file_downloader: + class: phpbb\file_downloader + + file_locator: + class: phpbb\routing\file_locator + arguments: + - '@filesystem' + - '%core.root_path%' + + group_helper: + class: phpbb\group\helper + arguments: + - '@language' + + log: + class: phpbb\log\log + arguments: + - '@dbal.conn' + - '@user' + - '@auth' + - '@dispatcher' + - '%core.root_path%' + - '%core.adm_relative_path%' + - '%core.php_ext%' + - '%tables.log%' + + path_helper: + class: phpbb\path_helper + arguments: + - '@symfony_request' + - '@filesystem' + - '@request' + - '%core.root_path%' + - '%core.php_ext%' + - '%core.adm_relative_path%' + + plupload: + class: phpbb\plupload\plupload + arguments: + - '%core.root_path%' + - '@config' + - '@request' + - '@user' + - '@php_ini' + - '@mimetype.guesser' + + upload_imagesize: + class: FastImageSize\FastImageSize + + version_helper: + class: phpbb\version_helper + scope: prototype + arguments: + - '@cache' + - '@config' + - '@file_downloader' + - '@user' diff --git a/phpBB/config/default/container/services_attachment.yml b/phpBB/config/default/container/services_attachment.yml new file mode 100644 index 0000000000..f448367473 --- /dev/null +++ b/phpBB/config/default/container/services_attachment.yml @@ -0,0 +1,40 @@ +services: + attachment.delete: + class: phpbb\attachment\delete + scope: prototype + arguments: + - '@config' + - '@dbal.conn' + - '@dispatcher' + - '@filesystem' + - '@attachment.resync' + - '%core.root_path%' + + attachment.manager: + class: phpbb\attachment\manager + scope: prototype + arguments: + - '@attachment.delete' + - '@attachment.resync' + - '@attachment.upload' + + attachment.resync: + class: phpbb\attachment\resync + scope: prototype + arguments: + - '@dbal.conn' + + attachment.upload: + class: phpbb\attachment\upload + scope: prototype + arguments: + - '@auth' + - '@cache' + - '@config' + - '@files.upload' + - '@language' + - '@mimetype.guesser' + - '@dispatcher' + - '@plupload' + - '@user' + - '%core.root_path%' diff --git a/phpBB/config/default/container/services_auth.yml b/phpBB/config/default/container/services_auth.yml new file mode 100644 index 0000000000..5306644256 --- /dev/null +++ b/phpBB/config/default/container/services_auth.yml @@ -0,0 +1,101 @@ +services: +# ----- Auth management ----- + auth: + class: phpbb\auth\auth + +# ----- Auth providers ----- + auth.provider_collection: + class: phpbb\auth\provider_collection + arguments: + - '@service_container' + - '@config' + tags: + - { name: service_collection, tag: auth.provider } + + auth.provider.db: + class: phpbb\auth\provider\db + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@request' + - '@user' + - '@service_container' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + + auth.provider.apache: + class: phpbb\auth\provider\apache + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@request' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + + auth.provider.ldap: + class: phpbb\auth\provider\ldap + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@user' + tags: + - { name: auth.provider } + + auth.provider.oauth: + class: phpbb\auth\provider\oauth\oauth + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@request' + - '@user' + - '%tables.auth_provider_oauth_token_storage%' + - '%tables.auth_provider_oauth_states%' + - '%tables.auth_provider_oauth_account_assoc%' + - '@auth.provider.oauth.service_collection' + - '%tables.users%' + - '@service_container' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + +# ----- OAuth services providers ----- + auth.provider.oauth.service_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: auth.provider.oauth.service } + + auth.provider.oauth.service.bitly: + class: phpbb\auth\provider\oauth\service\bitly + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.facebook: + class: phpbb\auth\provider\oauth\service\facebook + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.google: + class: phpbb\auth\provider\oauth\service\google + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } diff --git a/phpBB/config/default/container/services_avatar.yml b/phpBB/config/default/container/services_avatar.yml new file mode 100644 index 0000000000..6cc38516ae --- /dev/null +++ b/phpBB/config/default/container/services_avatar.yml @@ -0,0 +1,72 @@ +services: + avatar.manager: + class: phpbb\avatar\manager + arguments: + - '@config' + - '@avatar.driver_collection' + +# ----- Avatar drivers ----- + avatar.driver_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: avatar.driver } + + avatar.driver.gravatar: + class: phpbb\avatar\driver\gravatar + arguments: + - '@config' + - '@upload_imagesize' + - '%core.root_path%' + - '%core.php_ext%' + - '@path_helper' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.gravatar]] + tags: + - { name: avatar.driver } + + avatar.driver.local: + class: phpbb\avatar\driver\local + arguments: + - '@config' + - '@upload_imagesize' + - '%core.root_path%' + - '%core.php_ext%' + - '@path_helper' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.local]] + tags: + - { name: avatar.driver } + + avatar.driver.remote: + class: phpbb\avatar\driver\remote + arguments: + - '@config' + - '@upload_imagesize' + - '%core.root_path%' + - '%core.php_ext%' + - '@path_helper' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.remote]] + tags: + - { name: avatar.driver } + + avatar.driver.upload: + class: phpbb\avatar\driver\upload + arguments: + - '@config' + - '%core.root_path%' + - '%core.php_ext%' + - '@filesystem' + - '@path_helper' + - '@dispatcher' + - '@files.factory' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.upload]] + tags: + - { name: avatar.driver } diff --git a/phpBB/config/default/container/services_captcha.yml b/phpBB/config/default/container/services_captcha.yml new file mode 100644 index 0000000000..a1d063ada8 --- /dev/null +++ b/phpBB/config/default/container/services_captcha.yml @@ -0,0 +1,59 @@ +services: + captcha.factory: + class: phpbb\captcha\factory + arguments: + - '@service_container' + - '@captcha.plugins.service_collection' + +# ----- Captcha plugins ----- +# Scope MUST be prototype for all the plugins to work. + captcha.plugins.service_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: captcha.plugins } + + core.captcha.plugins.gd: + class: phpbb\captcha\plugins\gd + scope: prototype + calls: + - [set_name, [core.captcha.plugins.gd]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.gd_wave: + class: phpbb\captcha\plugins\gd_wave + scope: prototype + calls: + - [set_name, [core.captcha.plugins.gd_wave]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.nogd: + class: phpbb\captcha\plugins\nogd + scope: prototype + calls: + - [set_name, [core.captcha.plugins.nogd]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.qa: + class: phpbb\captcha\plugins\qa + scope: prototype + arguments: + - '%tables.captcha_qa_questions%' + - '%tables.captcha_qa_answers%' + - '%tables.captcha_qa_confirm%' + calls: + - [set_name, [core.captcha.plugins.qa]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.recaptcha: + class: phpbb\captcha\plugins\recaptcha + scope: prototype + calls: + - [set_name, [core.captcha.plugins.recaptcha]] + tags: + - { name: captcha.plugins } diff --git a/phpBB/config/default/container/services_console.yml b/phpBB/config/default/container/services_console.yml new file mode 100644 index 0000000000..2055fb68c5 --- /dev/null +++ b/phpBB/config/default/container/services_console.yml @@ -0,0 +1,221 @@ +services: + console.exception_subscriber: + class: phpbb\console\exception_subscriber + arguments: + - '@language' + - '%debug.exceptions%' + tags: + - { name: kernel.event_subscriber } + + console.command_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: console.command } + + console.command.cache.purge: + class: phpbb\console\command\cache\purge + arguments: + - '@user' + - '@cache.driver' + - '@dbal.conn' + - '@auth' + - '@log' + - '@config' + tags: + - { name: console.command } + + console.command.config.delete: + class: phpbb\console\command\config\delete + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.increment: + class: phpbb\console\command\config\increment + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.get: + class: phpbb\console\command\config\get + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.set: + class: phpbb\console\command\config\set + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.set_atomic: + class: phpbb\console\command\config\set_atomic + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.cron.list: + class: phpbb\console\command\cron\cron_list + arguments: + - '@user' + - '@cron.manager' + tags: + - { name: console.command } + + console.command.cron.run: + class: phpbb\console\command\cron\run + arguments: + - '@user' + - '@cron.manager' + - '@cron.lock_db' + tags: + - { name: console.command } + + console.command.db.list: + class: phpbb\console\command\db\list_command + arguments: + - '@user' + - '@migrator' + - '@ext.manager' + - '@config' + - '@cache' + tags: + - { name: console.command } + + console.command.db.migrate: + class: phpbb\console\command\db\migrate + arguments: + - '@user' + - '@language' + - '@migrator' + - '@ext.manager' + - '@config' + - '@cache' + - '@log' + - '@filesystem' + - '%core.root_path%' + tags: + - { name: console.command } + + console.command.db.revert: + class: phpbb\console\command\db\revert + arguments: + - '@user' + - '@language' + - '@migrator' + - '@ext.manager' + - '@config' + - '@cache' + - '@filesystem' + - '%core.root_path%' + tags: + - { name: console.command } + + console.command.dev.migration_tips: + class: phpbb\console\command\dev\migration_tips + arguments: + - '@user' + - '@ext.manager' + tags: + - { name: console.command } + + console.command.extension.disable: + class: phpbb\console\command\extension\disable + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.enable: + class: phpbb\console\command\extension\enable + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.purge: + class: phpbb\console\command\extension\purge + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.show: + class: phpbb\console\command\extension\show + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.fixup.recalculate_email_hash: + class: phpbb\console\command\fixup\recalculate_email_hash + arguments: + - '@user' + - '@dbal.conn' + tags: + - { name: console.command } + + console.command.reparser.list: + class: phpbb\console\command\reparser\list_all + arguments: + - '@user' + - '@text_reparser_collection' + tags: + - { name: console.command } + + console.command.reparser.reparse: + class: phpbb\console\command\reparser\reparse + arguments: + - '@user' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + tags: + - { name: console.command } + + console.command.thumbnail.delete: + class: phpbb\console\command\thumbnail\delete + arguments: + - '@user' + - '@dbal.conn' + - '%core.root_path%' + tags: + - { name: console.command } + + console.command.thumbnail.generate: + class: phpbb\console\command\thumbnail\generate + arguments: + - '@user' + - '@dbal.conn' + - '@cache' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.thumbnail.recreate: + class: phpbb\console\command\thumbnail\recreate + arguments: + - '@user' + tags: + - { name: console.command } diff --git a/phpBB/config/default/container/services_content.yml b/phpBB/config/default/container/services_content.yml new file mode 100644 index 0000000000..602fd25f4e --- /dev/null +++ b/phpBB/config/default/container/services_content.yml @@ -0,0 +1,72 @@ +services: + content.visibility: + class: phpbb\content_visibility + arguments: + - '@auth' + - '@config' + - '@dispatcher' + - '@dbal.conn' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.forums%' + - '%tables.posts%' + - '%tables.topics%' + - '%tables.users%' + + groupposition.legend: + class: phpbb\groupposition\legend + arguments: + - '@dbal.conn' + - '@user' + + groupposition.teampage: + class: phpbb\groupposition\teampage + arguments: + - '@dbal.conn' + - '@user' + - '@cache.driver' + + message.form.admin: + class: phpbb\message\admin_form + arguments: + - '@auth' + - '@config' + - '@config_text' + - '@dbal.conn' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + message.form.topic: + class: phpbb\message\topic_form + arguments: + - '@auth' + - '@config' + - '@dbal.conn' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + message.form.user: + class: phpbb\message\user_form + arguments: + - '@auth' + - '@config' + - '@dbal.conn' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + pagination: + class: phpbb\pagination + arguments: + - '@template' + - '@user' + - '@controller.helper' + - '@dispatcher' + + viewonline_helper: + class: phpbb\viewonline_helper + arguments: + - '@filesystem' diff --git a/phpBB/config/default/container/services_cron.yml b/phpBB/config/default/container/services_cron.yml new file mode 100644 index 0000000000..eb7df540d7 --- /dev/null +++ b/phpBB/config/default/container/services_cron.yml @@ -0,0 +1,218 @@ +services: + cron.manager: + class: phpbb\cron\manager + arguments: + - '@cron.task_collection' + - '%core.root_path%' + - '%core.php_ext%' + + cron.lock_db: + class: phpbb\lock\db + arguments: + - cron_lock + - '@config' + - '@dbal.conn' + +# ----- Cron tasks ----- + cron.task_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: cron.task } + + cron.task.core.prune_all_forums: + class: phpbb\cron\task\core\prune_all_forums + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + calls: + - [set_name, [cron.task.core.prune_all_forums]] + tags: + - { name: cron.task } + + cron.task.core.prune_forum: + class: phpbb\cron\task\core\prune_forum + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + calls: + - [set_name, [cron.task.core.prune_forum]] + tags: + - { name: cron.task } + + cron.task.core.prune_shadow_topics: + class: phpbb\cron\task\core\prune_shadow_topics + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + - '@log' + - '@user' + calls: + - [set_name, [cron.task.core.prune_shadow_topics]] + tags: + - { name: cron.task } + + cron.task.core.prune_notifications: + class: phpbb\cron\task\core\prune_notifications + arguments: + - '@config' + - '@notification_manager' + calls: + - [set_name, [cron.task.core.prune_notifications]] + tags: + - { name: cron.task } + + cron.task.core.queue: + class: phpbb\cron\task\core\queue + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + calls: + - [set_name, [cron.task.core.queue]] + tags: + - { name: cron.task } + + cron.task.core.tidy_cache: + class: phpbb\cron\task\core\tidy_cache + arguments: + - '@config' + - '@cache.driver' + calls: + - [set_name, [cron.task.core.tidy_cache]] + tags: + - { name: cron.task } + + cron.task.core.tidy_database: + class: phpbb\cron\task\core\tidy_database + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + calls: + - [set_name, [cron.task.core.tidy_database]] + tags: + - { name: cron.task } + + cron.task.core.tidy_plupload: + class: phpbb\cron\task\core\tidy_plupload + arguments: + - '%core.root_path%' + - '@config' + calls: + - [set_name, [cron.task.core.tidy_plupload]] + tags: + - { name: cron.task } + + cron.task.core.tidy_search: + class: phpbb\cron\task\core\tidy_search + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@auth' + - '@config' + - '@dbal.conn' + - '@user' + - '@dispatcher' + calls: + - [set_name, [cron.task.core.tidy_search]] + tags: + - { name: cron.task } + + cron.task.core.tidy_sessions: + class: phpbb\cron\task\core\tidy_sessions + arguments: + - '@config' + - '@user' + calls: + - [set_name, [cron.task.core.tidy_sessions]] + tags: + - { name: cron.task } + + cron.task.core.tidy_warnings: + class: phpbb\cron\task\core\tidy_warnings + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + calls: + - [set_name, [cron.task.core.tidy_warnings]] + tags: + - { name: cron.task } + + cron.task.text_reparser.pm_text: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.pm_text]] + - [set_reparser, [text_reparser.pm_text]] + tags: + - { name: cron.task } + + cron.task.text_reparser.poll_option: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.poll_option]] + - [set_reparser, [text_reparser.poll_option]] + tags: + - { name: cron.task } + + cron.task.text_reparser.poll_title: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.poll_title]] + - [set_reparser, [text_reparser.poll_title]] + tags: + - { name: cron.task } + + cron.task.text_reparser.post_text: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.post_text]] + - [set_reparser, [text_reparser.post_text]] + tags: + - { name: cron.task } + + cron.task.text_reparser.user_signature: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.user_signature]] + - [set_reparser, [text_reparser.user_signature]] + tags: + - { name: cron.task } diff --git a/phpBB/config/default/container/services_db.yml b/phpBB/config/default/container/services_db.yml new file mode 100644 index 0000000000..20b3426e7e --- /dev/null +++ b/phpBB/config/default/container/services_db.yml @@ -0,0 +1,81 @@ +services: + dbal.conn: + class: phpbb\db\driver\factory + arguments: + - '@service_container' + + dbal.conn.driver: + class: '%dbal.driver.class%' + calls: + - [sql_connect, ['%dbal.dbhost%', '%dbal.dbuser%', '%dbal.dbpasswd%', '%dbal.dbname%', '%dbal.dbport%', false, '%dbal.new_link%']] + +# ----- DB Tools ----- + dbal.tools.factory: + class: phpbb\db\tools\factory + + dbal.tools: + class: phpbb\db\tools\tools_interface + factory: ['@dbal.tools.factory', get] + arguments: + - '@dbal.conn.driver' + +# ----- DB Extractor ----- + dbal.extractor.factory: + class: phpbb\db\extractor\factory + arguments: + - '@dbal.conn.driver' + - '@service_container' + + dbal.extractor: + class: phpbb\db\extractor\extractor_interface + factory: ['@dbal.extractor.factory', get] + +# ----- DB Extractors for different drivers ----- +# Scope MUST be prototype for all the handlers to work correctly. + dbal.extractor.extractors.mssql_extractor: + class: phpbb\db\extractor\mssql_extractor + scope: prototype + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.mysql_extractor: + class: phpbb\db\extractor\mysql_extractor + scope: prototype + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.oracle_extractor: + class: phpbb\db\extractor\oracle_extractor + scope: prototype + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.postgres_extractor: + class: phpbb\db\extractor\postgres_extractor + scope: prototype + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.sqlite3_extractor: + class: phpbb\db\extractor\sqlite3_extractor + scope: prototype + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.sqlite_extractor: + class: phpbb\db\extractor\sqlite_extractor + scope: prototype + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' diff --git a/phpBB/config/default/container/services_event.yml b/phpBB/config/default/container/services_event.yml new file mode 100644 index 0000000000..8a55b933ac --- /dev/null +++ b/phpBB/config/default/container/services_event.yml @@ -0,0 +1,25 @@ +services: + dispatcher: + class: phpbb\event\dispatcher + arguments: + - '@service_container' + + kernel_exception_subscriber: + class: phpbb\event\kernel_exception_subscriber + arguments: + - '@template' + - '@language' + tags: + - { name: kernel.event_subscriber } + + kernel_terminate_subscriber: + class: phpbb\event\kernel_terminate_subscriber + tags: + - { name: kernel.event_subscriber } + + symfony_response_listener: + class: Symfony\Component\HttpKernel\EventListener\ResponseListener + arguments: + - UTF-8 + tags: + - { name: kernel.event_subscriber } diff --git a/phpBB/config/default/container/services_feed.yml b/phpBB/config/default/container/services_feed.yml new file mode 100644 index 0000000000..443016160b --- /dev/null +++ b/phpBB/config/default/container/services_feed.yml @@ -0,0 +1,113 @@ +services: + phpbb.feed.controller: + class: phpbb\feed\controller\feed + arguments: + - '@template.twig.environment' + - '@symfony_request' + - '@controller.helper' + - '@config' + - '@dbal.conn' + - '@service_container' + - '@feed.helper' + - '@user' + - '@auth' + - '%core.php_ext%' + + feed.helper: + class: phpbb\feed\helper + arguments: + - '@config' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + feed.forum: + class: phpbb\feed\forum + scope: prototype + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '%core.php_ext%' + + feed.forums: + class: phpbb\feed\forums + scope: prototype + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '%core.php_ext%' + + feed.news: + class: phpbb\feed\news + scope: prototype + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '%core.php_ext%' + + feed.overall: + class: phpbb\feed\overall + scope: prototype + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '%core.php_ext%' + + feed.topic: + class: phpbb\feed\topic + scope: prototype + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '%core.php_ext%' + + feed.topics: + class: phpbb\feed\topics + scope: prototype + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '%core.php_ext%' + + feed.topics_active: + class: phpbb\feed\topics_active + scope: prototype + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '%core.php_ext%' diff --git a/phpBB/config/default/container/services_files.yml b/phpBB/config/default/container/services_files.yml new file mode 100644 index 0000000000..39277bcd9d --- /dev/null +++ b/phpBB/config/default/container/services_files.yml @@ -0,0 +1,56 @@ +services: + files.factory: + class: phpbb\files\factory + arguments: + - '@service_container' + + files.filespec: + class: phpbb\files\filespec + scope: prototype + arguments: + - '@filesystem' + - '@language' + - '@php_ini' + - '@upload_imagesize' + - '%core.root_path%' + - '@mimetype.guesser' + - '@plupload' + + files.upload: + class: phpbb\files\upload + scope: prototype + arguments: + - '@filesystem' + - '@files.factory' + - '@language' + - '@php_ini' + - '@request' + + files.types.form: + class: phpbb\files\types\form + scope: prototype + arguments: + - '@files.factory' + - '@language' + - '@php_ini' + - '@plupload' + - '@request' + + files.types.local: + class: phpbb\files\types\form + scope: prototype + arguments: + - '@files.factory' + - '@language' + - '@php_ini' + - '@request' + + files.types.remote: + class: phpbb\files\types\remote + scope: prototype + arguments: + - '@files.factory' + - '@language' + - '@php_ini' + - '@request' + - '%core.root_path%' diff --git a/phpBB/config/default/container/services_filesystem.yml b/phpBB/config/default/container/services_filesystem.yml new file mode 100644 index 0000000000..828f9076dd --- /dev/null +++ b/phpBB/config/default/container/services_filesystem.yml @@ -0,0 +1,3 @@ +services: + filesystem: + class: phpbb\filesystem\filesystem diff --git a/phpBB/config/default/container/services_help.yml b/phpBB/config/default/container/services_help.yml new file mode 100644 index 0000000000..1bff001523 --- /dev/null +++ b/phpBB/config/default/container/services_help.yml @@ -0,0 +1,27 @@ +services: + phpbb.help.manager: + class: phpbb\help\manager + arguments: + - '@dispatcher' + - '@language' + - '@template' + + phpbb.help.controller.bbcode: + class: phpbb\help\controller\bbcode + arguments: + - '@controller.helper' + - '@phpbb.help.manager' + - '@template' + - '@language' + - '%core.root_path%' + - '%core.php_ext%' + + phpbb.help.controller.faq: + class: phpbb\help\controller\faq + arguments: + - '@controller.helper' + - '@phpbb.help.manager' + - '@template' + - '@language' + - '%core.root_path%' + - '%core.php_ext%' diff --git a/phpBB/config/default/container/services_hook.yml b/phpBB/config/default/container/services_hook.yml new file mode 100644 index 0000000000..10a84184a0 --- /dev/null +++ b/phpBB/config/default/container/services_hook.yml @@ -0,0 +1,7 @@ +services: + hook_finder: + class: phpbb\hook\finder + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@cache.driver' diff --git a/phpBB/config/default/container/services_http.yml b/phpBB/config/default/container/services_http.yml new file mode 100644 index 0000000000..49cfbf5b84 --- /dev/null +++ b/phpBB/config/default/container/services_http.yml @@ -0,0 +1,23 @@ +services: + http_kernel: + class: Symfony\Component\HttpKernel\HttpKernel + arguments: + - '@dispatcher' + - '@controller.resolver' + - '@request_stack' + + # WARNING: The Symfony request does not escape the input and should be used very carefully + # prefer the phpbb request (service @request) as possible + symfony_request: + class: phpbb\symfony_request + arguments: + - '@request' + + request_stack: + class: Symfony\Component\HttpFoundation\RequestStack + + request: + class: phpbb\request\request + arguments: + - null + - '%core.disable_super_globals%' diff --git a/phpBB/config/default/container/services_language.yml b/phpBB/config/default/container/services_language.yml new file mode 100644 index 0000000000..8201fbf9b6 --- /dev/null +++ b/phpBB/config/default/container/services_language.yml @@ -0,0 +1,22 @@ +services: + language.helper.language_file: + class: phpbb\language\language_file_helper + arguments: + - '%core.root_path%' + + language: + class: phpbb\language\language + arguments: + - '@language.loader' + + language.loader_abstract: + abstract: true + class: phpbb\language\language_file_loader + arguments: + - '%core.root_path%' + - '%core.php_ext%' + + language.loader: + parent: language.loader_abstract + calls: + - [set_extension_manager, ['@ext.manager']] diff --git a/phpBB/config/default/container/services_migrator.yml b/phpBB/config/default/container/services_migrator.yml new file mode 100644 index 0000000000..c63b087adb --- /dev/null +++ b/phpBB/config/default/container/services_migrator.yml @@ -0,0 +1,64 @@ +services: +# ----- Migrator ----- + migrator: + class: phpbb\db\migrator + arguments: + - '@service_container' + - '@config' + - '@dbal.conn' + - '@dbal.tools' + - '%tables.migrations%' + - '%core.root_path%' + - '%core.php_ext%' + - '%core.table_prefix%' + - '@migrator.tool_collection' + - '@migrator.helper' + + migrator.helper: + class: phpbb\db\migration\helper + +# ----- Migrator's tools ----- + migrator.tool_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: migrator.tool } + + migrator.tool.config: + class: phpbb\db\migration\tool\config + arguments: + - '@config' + tags: + - { name: migrator.tool } + + migrator.tool.config_text: + class: phpbb\db\migration\tool\config_text + arguments: + - '@config_text' + tags: + - { name: migrator.tool } + + migrator.tool.module: + class: phpbb\db\migration\tool\module + arguments: + - '@dbal.conn' + - '@cache' + - '@user' + - '@module.manager' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.modules%' + tags: + - { name: migrator.tool } + + migrator.tool.permission: + class: phpbb\db\migration\tool\permission + arguments: + - '@dbal.conn' + - '@cache' + - '@auth' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: migrator.tool } diff --git a/phpBB/config/default/container/services_mimetype_guesser.yml b/phpBB/config/default/container/services_mimetype_guesser.yml new file mode 100644 index 0000000000..432470d40c --- /dev/null +++ b/phpBB/config/default/container/services_mimetype_guesser.yml @@ -0,0 +1,36 @@ +services: + mimetype.guesser_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: mimetype.guessers } + + mimetype.fileinfo_mimetype_guesser: + class: Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser + tags: + - { name: mimetype.guessers } + + mimetype.filebinary_mimetype_guesser: + class: Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser + tags: + - { name: mimetype.guessers } + + mimetype.content_guesser: + class: phpbb\mimetype\content_guesser + calls: + - [set_priority, ['%mimetype.guesser.priority.low%']] + tags: + - { name: mimetype.guessers } + + mimetype.extension_guesser: + class: phpbb\mimetype\extension_guesser + calls: + - [set_priority, ['%mimetype.guesser.priority.lowest%']] + tags: + - { name: mimetype.guessers } + + mimetype.guesser: + class: phpbb\mimetype\guesser + arguments: + - '@mimetype.guesser_collection' diff --git a/phpBB/config/default/container/services_module.yml b/phpBB/config/default/container/services_module.yml new file mode 100644 index 0000000000..a057e55239 --- /dev/null +++ b/phpBB/config/default/container/services_module.yml @@ -0,0 +1,10 @@ +services: + module.manager: + class: phpbb\module\module_manager + arguments: + - '@cache.driver' + - '@dbal.conn' + - '@ext.manager' + - '%tables.modules%' + - '%core.root_path%' + - '%core.php_ext%' diff --git a/phpBB/config/default/container/services_notification.yml b/phpBB/config/default/container/services_notification.yml new file mode 100644 index 0000000000..0cf64f7f24 --- /dev/null +++ b/phpBB/config/default/container/services_notification.yml @@ -0,0 +1,224 @@ +services: + notification_manager: + class: phpbb\notification\manager + arguments: + - '@notification.type_collection' + - '@notification.method_collection' + - '@service_container' + - '@user_loader' + - '@dispatcher' + - '@dbal.conn' + - '@cache' + - '@language' + - '@user' + - '%tables.notification_types%' + - '%tables.user_notifications%' + +# ----- Notification's types ----- +# Scope MUST be prototype for all the plugins to work. + notification.type_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: notification.type } + + notification.type.base: + abstract: true + arguments: + - '@dbal.conn' + - '@language' + - '@user' + - '@auth' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.user_notifications%' + + notification.type.admin_activate_user: + class: phpbb\notification\type\admin_activate_user + scope: prototype + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.approve_post: + class: phpbb\notification\type\approve_post + scope: prototype + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.approve_topic: + class: phpbb\notification\type\approve_topic + scope: prototype + parent: notification.type.topic + tags: + - { name: notification.type } + + notification.type.bookmark: + class: phpbb\notification\type\bookmark + scope: prototype + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.disapprove_post: + class: phpbb\notification\type\disapprove_post + scope: prototype + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.disapprove_topic: + class: phpbb\notification\type\disapprove_topic + scope: prototype + parent: notification.type.topic + tags: + - { name: notification.type } + + notification.type.group_request: + class: phpbb\notification\type\group_request + scope: prototype + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + tags: + - { name: notification.type } + + notification.type.group_request_approved: + class: phpbb\notification\type\group_request_approved + scope: prototype + parent: notification.type.base + tags: + - { name: notification.type } + + notification.type.pm: + class: phpbb\notification\type\pm + scope: prototype + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.post: + class: phpbb\notification\type\post + scope: prototype + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.post_in_queue: + class: phpbb\notification\type\post_in_queue + scope: prototype + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.quote: + class: phpbb\notification\type\quote + scope: prototype + parent: notification.type.post + calls: + - [set_utils, ['@text_formatter.utils']] + tags: + - { name: notification.type } + + notification.type.report_pm: + class: phpbb\notification\type\report_pm + scope: prototype + parent: notification.type.pm + tags: + - { name: notification.type } + + notification.type.report_pm_closed: + class: phpbb\notification\type\report_pm_closed + scope: prototype + parent: notification.type.pm + tags: + - { name: notification.type } + + notification.type.report_post: + class: phpbb\notification\type\report_post + scope: prototype + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.report_post_closed: + class: phpbb\notification\type\report_post_closed + scope: prototype + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.topic: + class: phpbb\notification\type\topic + scope: prototype + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.topic_in_queue: + class: phpbb\notification\type\topic_in_queue + scope: prototype + parent: notification.type.topic + tags: + - { name: notification.type } + +# ----- Notification's methods ----- +# Scope MUST be prototype for all the plugins to work. + notification.method_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: notification.method } + + notification.method.board: + class: phpbb\notification\method\board + scope: prototype # scope MUST be prototype for this to work! + arguments: + - '@user_loader' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@config' + - '%tables.notification_types%' + - '%tables.notifications%' + tags: + - { name: notification.method } + + notification.method.email: + class: phpbb\notification\method\email + scope: prototype + arguments: + - '@user_loader' + - '@user' + - '@config' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: notification.method } + + notification.method.jabber: + class: phpbb\notification\method\jabber + scope: prototype + arguments: + - '@user_loader' + - '@user' + - '@config' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: notification.method } diff --git a/phpBB/config/default/container/services_password.yml b/phpBB/config/default/container/services_password.yml new file mode 100644 index 0000000000..82850dc2a7 --- /dev/null +++ b/phpBB/config/default/container/services_password.yml @@ -0,0 +1,124 @@ +services: +# ----- Password management ----- + passwords.manager: + class: phpbb\passwords\manager + arguments: + - '@config' + - '@passwords.driver_collection' + - '@passwords.helper' + - '%passwords.algorithms%' + + passwords.helper: + class: phpbb\passwords\helper + + passwords.driver_helper: + class: phpbb\passwords\driver\helper + arguments: + - '@config' + +# ----- Password's drivers ----- + passwords.driver_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: passwords.driver } + + passwords.driver.bcrypt: + class: phpbb\passwords\driver\bcrypt + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.bcrypt_2y: + class: phpbb\passwords\driver\bcrypt_2y + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.bcrypt_wcf2: + class: phpbb\passwords\driver\bcrypt_wcf2 + arguments: + - '@passwords.driver.bcrypt' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.salted_md5: + class: phpbb\passwords\driver\salted_md5 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.phpass: + class: phpbb\passwords\driver\phpass + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.convert_password: + class: phpbb\passwords\driver\convert_password + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1_smf: + class: phpbb\passwords\driver\sha1_smf + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1_wcf1: + class: phpbb\passwords\driver\sha1_wcf1 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1: + class: phpbb\passwords\driver\sha1 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.md5_phpbb2: + class: phpbb\passwords\driver\md5_phpbb2 + arguments: + - '@request' + - '@passwords.driver.salted_md5' + - '@passwords.driver_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: passwords.driver } + + passwords.driver.md5_mybb: + class: phpbb\passwords\driver\md5_mybb + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.md5_vb: + class: phpbb\passwords\driver\md5_vb + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } diff --git a/phpBB/config/default/container/services_php.yml b/phpBB/config/default/container/services_php.yml new file mode 100644 index 0000000000..29349960f3 --- /dev/null +++ b/phpBB/config/default/container/services_php.yml @@ -0,0 +1,3 @@ +services: + php_ini: + class: bantu\IniGetWrapper\IniGetWrapper diff --git a/phpBB/config/default/container/services_profilefield.yml b/phpBB/config/default/container/services_profilefield.yml new file mode 100644 index 0000000000..90b22836e5 --- /dev/null +++ b/phpBB/config/default/container/services_profilefield.yml @@ -0,0 +1,102 @@ +services: + profilefields.manager: + class: phpbb\profilefields\manager + arguments: + - '@auth' + - '@dbal.conn' + - '@dispatcher' + - '@request' + - '@template' + - '@profilefields.type_collection' + - '@user' + - '%tables.profile_fields%' + - '%tables.profile_fields_language%' + - '%tables.profile_fields_data%' + + profilefields.lang_helper: + class: phpbb\profilefields\lang_helper + arguments: + - '@dbal.conn' + - '%tables.profile_fields_options_language%' + +# ----- Profile fields types ----- + profilefields.type_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: profilefield.type } + + profilefields.type.bool: + class: phpbb\profilefields\type\type_bool + arguments: + - '@profilefields.lang_helper' + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.date: + class: phpbb\profilefields\type\type_date + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.dropdown: + class: phpbb\profilefields\type\type_dropdown + arguments: + - '@profilefields.lang_helper' + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.googleplus: + class: phpbb\profilefields\type\type_googleplus + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.int: + class: phpbb\profilefields\type\type_int + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.string: + class: phpbb\profilefields\type\type_string + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.text: + class: phpbb\profilefields\type\type_text + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.url: + class: phpbb\profilefields\type\type_url + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } diff --git a/phpBB/config/default/container/services_report.yml b/phpBB/config/default/container/services_report.yml new file mode 100644 index 0000000000..eaaf6ae4c4 --- /dev/null +++ b/phpBB/config/default/container/services_report.yml @@ -0,0 +1,53 @@ +services: +# ----- Report controller ----- + phpbb.report.controller: + class: phpbb\report\controller\report + arguments: + - '@config' + - '@user' + - '@template' + - '@controller.helper' + - '@request' + - '@captcha.factory' + - '@phpbb.report.handler_factory' + - '@phpbb.report.report_reason_list_provider' + - '%core.root_path%' + - '%core.php_ext%' + +# ----- Report handler factory ----- + phpbb.report.handler_factory: + class: phpbb\report\handler_factory + arguments: + - '@service_container' + +# ----- Report UI provider ----- + phpbb.report.report_reason_list_provider: + class: phpbb\report\report_reason_list_provider + arguments: + - '@dbal.conn.driver' + - '@template' + - '@user' + +# ----- Report handlers ----- +# Scope MUST be prototype for all the handlers to work correctly. + phpbb.report.handlers.report_handler_pm: + class: phpbb\report\report_handler_pm + scope: prototype + arguments: + - '@dbal.conn.driver' + - '@dispatcher' + - '@config' + - '@auth' + - '@user' + - '@notification_manager' + + phpbb.report.handlers.report_handler_post: + class: phpbb\report\report_handler_post + scope: prototype + arguments: + - '@dbal.conn.driver' + - '@dispatcher' + - '@config' + - '@auth' + - '@user' + - '@notification_manager' diff --git a/phpBB/config/default/container/services_routing.yml b/phpBB/config/default/container/services_routing.yml new file mode 100644 index 0000000000..3cb74ca2b1 --- /dev/null +++ b/phpBB/config/default/container/services_routing.yml @@ -0,0 +1,80 @@ +services: + router: + class: phpbb\routing\router + arguments: + - '@service_container' + - '@routing.chained_resources_locator' + - '@routing.delegated_loader' + - '%core.root_path%' + - '%core.php_ext%' + - '%core.environment%' + + router.listener: + class: Symfony\Component\HttpKernel\EventListener\RouterListener + arguments: + - '@router' + - null + - null + - '@request_stack' + tags: + - { name: kernel.event_subscriber } + + routing.helper: + class: phpbb\routing\helper + arguments: + - '@config' + - '@router' + - '@symfony_request' + - '@request' + - '@filesystem' + - '%core.root_path%' + - '%core.php_ext%' + +# ---- Route loaders ---- + + routing.delegated_loader: + class: Symfony\Component\Config\Loader\DelegatingLoader + arguments: + - '@routing.resolver' + + routing.resolver: + class: phpbb\routing\loader_resolver + arguments: + - '@routing.loader.collection' + + routing.loader.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: routing.loader } + + routing.loader.yaml: + class: Symfony\Component\Routing\Loader\YamlFileLoader + arguments: + - '@file_locator' + tags: + - { name: routing.loader } + +# ---- Resources Locators ---- + + routing.chained_resources_locator: + class: phpbb\routing\resources_locator\chained_resources_locator + arguments: + - '@routing.resources_locator.collection' + + routing.resources_locator.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: routing.resources_locator } + + routing.resources_locator.default: + class: phpbb\routing\resources_locator\default_resources_locator + arguments: + - '%core.root_path%' + - '%core.environment%' + - '@ext.manager' + tags: + - { name: routing.resources_locator } diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml new file mode 100644 index 0000000000..943a79cd65 --- /dev/null +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -0,0 +1,73 @@ +parameters: + text_formatter.cache.dir: '%core.root_path%cache/%core.environment%/' + text_formatter.cache.parser.key: _text_formatter_parser + text_formatter.cache.renderer.key: _text_formatter_renderer + +services: + text_formatter.cache: + alias: text_formatter.s9e.factory + + text_formatter.data_access: + class: phpbb\textformatter\data_access + arguments: + - '@dbal.conn' + - '%tables.bbcodes%' + - '%tables.smilies%' + - '%tables.styles%' + - '%tables.words%' + - '%core.root_path%styles/' + + text_formatter.parser: + alias: text_formatter.s9e.parser + + text_formatter.renderer: + alias: text_formatter.s9e.renderer + + text_formatter.utils: + alias: text_formatter.s9e.utils + + text_formatter.s9e.factory: + class: phpbb\textformatter\s9e\factory + arguments: + - '@text_formatter.data_access' + - '@cache.driver' + - '@dispatcher' + - '@config' + - '@text_formatter.s9e.link_helper' + - '%text_formatter.cache.dir%' + - '%text_formatter.cache.parser.key%' + - '%text_formatter.cache.renderer.key%' + + text_formatter.s9e.link_helper: + class: phpbb\textformatter\s9e\link_helper + + text_formatter.s9e.parser: + class: phpbb\textformatter\s9e\parser + arguments: + - '@cache.driver' + - '%text_formatter.cache.parser.key%' + - '@text_formatter.s9e.factory' + - '@dispatcher' + + text_formatter.s9e.quote_helper: + class: phpbb\textformatter\s9e\quote_helper + arguments: + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + text_formatter.s9e.renderer: + class: phpbb\textformatter\s9e\renderer + arguments: + - '@cache.driver' + - '%text_formatter.cache.dir%' + - '%text_formatter.cache.renderer.key%' + - '@text_formatter.s9e.factory' + - '@dispatcher' + calls: + - [configure_quote_helper, ['@text_formatter.s9e.quote_helper']] + - [configure_smilies_path, ['@config', '@path_helper']] + - [configure_user, ['@user', '@config', '@auth']] + + text_formatter.s9e.utils: + class: phpbb\textformatter\s9e\utils diff --git a/phpBB/config/default/container/services_text_reparser.yml b/phpBB/config/default/container/services_text_reparser.yml new file mode 100644 index 0000000000..6b0353cf5b --- /dev/null +++ b/phpBB/config/default/container/services_text_reparser.yml @@ -0,0 +1,91 @@ +services: + text_reparser.manager: + class: phpbb\textreparser\manager + arguments: + - '@config' + - '@config_text' + - '@text_reparser_collection' + + text_reparser.lock: + class: phpbb\lock\db + arguments: + - reparse_lock + - '@config' + - '@dbal.conn' + + text_reparser_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: text_reparser.plugin } + + text_reparser.contact_admin_info: + class: phpbb\textreparser\plugins\contact_admin_info + arguments: + - '@config_text' + tags: + - { name: text_reparser.plugin } + + text_reparser.forum_description: + class: phpbb\textreparser\plugins\forum_description + arguments: + - '@dbal.conn' + - '%tables.forums%' + tags: + - { name: text_reparser.plugin } + + text_reparser.forum_rules: + class: phpbb\textreparser\plugins\forum_rules + arguments: + - '@dbal.conn' + - '%tables.forums%' + tags: + - { name: text_reparser.plugin } + + text_reparser.group_description: + class: phpbb\textreparser\plugins\group_description + arguments: + - '@dbal.conn' + - '%tables.groups%' + tags: + - { name: text_reparser.plugin } + + text_reparser.pm_text: + class: phpbb\textreparser\plugins\pm_text + arguments: + - '@dbal.conn' + - '%tables.privmsgs%' + tags: + - { name: text_reparser.plugin } + + text_reparser.poll_option: + class: phpbb\textreparser\plugins\poll_option + arguments: + - '@dbal.conn' + tags: + - { name: text_reparser.plugin } + + text_reparser.poll_title: + class: phpbb\textreparser\plugins\poll_title + arguments: + - '@dbal.conn' + - '%tables.topics%' + tags: + - { name: text_reparser.plugin } + + text_reparser.post_text: + class: phpbb\textreparser\plugins\post_text + arguments: + - '@dbal.conn' + - '%tables.posts%' + tags: + - { name: text_reparser.plugin } + + text_reparser.user_signature: + class: phpbb\textreparser\plugins\user_signature + arguments: + - '@dbal.conn' + - '%tables.users%' + tags: + - { name: text_reparser.plugin } diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml new file mode 100644 index 0000000000..2dbf444e0c --- /dev/null +++ b/phpBB/config/default/container/services_twig.yml @@ -0,0 +1,65 @@ +parameters: + core.template.cache_path: '%core.root_path%cache/%core.environment%/twig/' + +services: + template.twig.environment: + class: phpbb\template\twig\environment + arguments: + - '@config' + - '@filesystem' + - '@path_helper' + - '@service_container' + - '%core.template.cache_path%' + - '@ext.manager' + - '@template.twig.loader' + - [] + + template.twig.lexer: + class: phpbb\template\twig\lexer + arguments: + - '@template.twig.environment' + + template.twig.loader: + class: phpbb\template\twig\loader + arguments: + - '@filesystem' + + template.twig.extensions.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: twig.extension } + + template.twig.extensions.phpbb: + class: phpbb\template\twig\extension + arguments: + - '@template_context' + - '@language' + tags: + - { name: twig.extension } + + template.twig.extensions.routing: + class: phpbb\template\twig\extension\routing + arguments: + - '@routing.helper' + tags: + - { name: twig.extension } + + template.twig.extensions.debug: + class: Twig_Extension_Debug + + template: + class: phpbb\template\twig\twig + arguments: + - '@path_helper' + - '@config' + - '@template_context' + - '@template.twig.environment' + - '%core.template.cache_path%' + - '@user' + - '@template.twig.extensions.collection' + - '@ext.manager' + + template_context: + class: phpbb\template\context diff --git a/phpBB/config/default/container/services_user.yml b/phpBB/config/default/container/services_user.yml new file mode 100644 index 0000000000..7e634c60c3 --- /dev/null +++ b/phpBB/config/default/container/services_user.yml @@ -0,0 +1,20 @@ +services: + acl.permissions: + class: phpbb\permissions + arguments: + - '@dispatcher' + - '@user' + + user: + class: phpbb\user + arguments: + - '@language' + - '%datetime.class%' + + user_loader: + class: phpbb\user_loader + arguments: + - '@dbal.conn' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.users%' diff --git a/phpBB/config/default/container/tables.yml b/phpBB/config/default/container/tables.yml new file mode 100644 index 0000000000..4aed35710b --- /dev/null +++ b/phpBB/config/default/container/tables.yml @@ -0,0 +1,78 @@ +parameters: + tables.acl_groups: '%core.table_prefix%acl_groups' + tables.acl_options: '%core.table_prefix%acl_options' + tables.acl_roles: '%core.table_prefix%acl_roles' + tables.acl_roles_data: '%core.table_prefix%acl_roles_data' + tables.acl_users: '%core.table_prefix%acl_users' + tables.attachments: '%core.table_prefix%attachments' + tables.auth_provider_oauth_token_storage: '%core.table_prefix%oauth_tokens' + tables.auth_provider_oauth_states: '%core.table_prefix%oauth_states' + tables.auth_provider_oauth_account_assoc: '%core.table_prefix%oauth_accounts' + tables.banlist: '%core.table_prefix%banlist' + tables.bbcodes: '%core.table_prefix%bbcodes' + tables.bookmarks: '%core.table_prefix%bookmarks' + tables.bots: '%core.table_prefix%bots' + tables.captcha_qa_questions: '%core.table_prefix%captcha_questions' + tables.captcha_qa_answers: '%core.table_prefix%captcha_answers' + tables.captcha_qa_confirm: '%core.table_prefix%qa_confirm' + tables.config: '%core.table_prefix%config' + tables.config_text: '%core.table_prefix%config_text' + tables.confirm: '%core.table_prefix%confirm' + tables.disallow: '%core.table_prefix%disallow' + tables.drafts: '%core.table_prefix%drafts' + tables.ext: '%core.table_prefix%ext' + tables.extensions: '%core.table_prefix%extensions' + tables.extension_groups: '%core.table_prefix%extension_groups' + tables.forums: '%core.table_prefix%forums' + tables.forums_access: '%core.table_prefix%forums_access' + tables.forums_track: '%core.table_prefix%forums_track' + tables.forums_watch: '%core.table_prefix%forums_watch' + tables.groups: '%core.table_prefix%groups' + tables.icons: '%core.table_prefix%icons' + tables.lang: '%core.table_prefix%lang' + tables.log: '%core.table_prefix%log' + tables.login_attempts: '%core.table_prefix%login_attempts' + tables.migrations: '%core.table_prefix%migrations' + tables.moderator_cache: '%core.table_prefix%moderator_cache' + tables.modules: '%core.table_prefix%modules' + tables.notification_types: '%core.table_prefix%notification_types' + tables.notifications: '%core.table_prefix%notifications' + tables.poll_options: '%core.table_prefix%poll_options' + tables.poll_votes: '%core.table_prefix%poll_votes' + tables.posts: '%core.table_prefix%posts' + tables.privmsgs: '%core.table_prefix%privmsgs' + tables.privmsgs_folder: '%core.table_prefix%privmsgs_folder' + tables.privmsgs_rules: '%core.table_prefix%privmsgs_rules' + tables.privmsgs_to: '%core.table_prefix%privmsgs_to' + tables.profile_fields: '%core.table_prefix%profile_fields' + tables.profile_fields_data: '%core.table_prefix%profile_fields_data' + tables.profile_fields_options_language: '%core.table_prefix%profile_fields_lang' + tables.profile_fields_language: '%core.table_prefix%profile_lang' + tables.ranks: '%core.table_prefix%ranks' + tables.reports: '%core.table_prefix%reports' + tables.reports_reasons: '%core.table_prefix%reports_reasons' + tables.search_results: '%core.table_prefix%search_results' + tables.search_wordlist: '%core.table_prefix%search_wordlist' + tables.search_wordmatch: '%core.table_prefix%search_wordmatch' + tables.sessions: '%core.table_prefix%sessions' + tables.sessions_keys: '%core.table_prefix%sessions_keys' + tables.sitelist: '%core.table_prefix%sitelist' + tables.smilies: '%core.table_prefix%smilies' + tables.sphinx: '%core.table_prefix%sphinx' + tables.styles: '%core.table_prefix%styles' + tables.styles_template: '%core.table_prefix%styles_template' + tables.styles_template_data: '%core.table_prefix%styles_template_data' + tables.styles_theme: '%core.table_prefix%styles_theme' + tables.styles_imageset: '%core.table_prefix%styles_imageset' + tables.styles_imageset_data: '%core.table_prefix%styles_imageset_data' + tables.teampage: '%core.table_prefix%teampage' + tables.topics: '%core.table_prefix%topics' + tables.topics_posted: '%core.table_prefix%topics_posted' + tables.topics_track: '%core.table_prefix%topics_track' + tables.topics_watch: '%core.table_prefix%topics_watch' + tables.user_group: '%core.table_prefix%user_group' + tables.user_notifications: '%core.table_prefix%user_notifications' + tables.users: '%core.table_prefix%users' + tables.warnings: '%core.table_prefix%warnings' + tables.words: '%core.table_prefix%words' + tables.zebra: '%core.table_prefix%zebra' diff --git a/phpBB/config/default/routing/feed.yml b/phpBB/config/default/routing/feed.yml new file mode 100644 index 0000000000..22c9ea5755 --- /dev/null +++ b/phpBB/config/default/routing/feed.yml @@ -0,0 +1,35 @@ +phpbb_feed_forums: + path: /forums + defaults: { _controller: phpbb.feed.controller:forums } + +phpbb_feed_news: + path: /news + defaults: { _controller: phpbb.feed.controller:news } + +phpbb_feed_topics: + path: /topics + defaults: { _controller: phpbb.feed.controller:topics } + +phpbb_feed_topics_active: + path: /topics_active + defaults: { _controller: phpbb.feed.controller:topics_active } + +phpbb_feed_topics_new: + path: /topics_new + defaults: { _controller: phpbb.feed.controller:topics_new } + +phpbb_feed_forum: + path: /forum/{forum_id} + defaults: { _controller: phpbb.feed.controller:forum } + requirements: + forum_id: \d+ + +phpbb_feed_topic: + path: /topic/{topic_id} + defaults: { _controller: phpbb.feed.controller:topic } + requirements: + topic_id: \d+ + +phpbb_feed_overall: + path: /{mode} + defaults: { _controller: phpbb.feed.controller:overall } diff --git a/phpBB/config/default/routing/help.yml b/phpBB/config/default/routing/help.yml new file mode 100644 index 0000000000..8d43839d1e --- /dev/null +++ b/phpBB/config/default/routing/help.yml @@ -0,0 +1,7 @@ +phpbb_help_bbcode_controller: + path: /bbcode + defaults: { _controller: phpbb.help.controller.bbcode:handle } + +phpbb_help_faq_controller: + path: /faq + defaults: { _controller: phpbb.help.controller.faq:handle } diff --git a/phpBB/config/default/routing/report.yml b/phpBB/config/default/routing/report.yml new file mode 100644 index 0000000000..c386770e42 --- /dev/null +++ b/phpBB/config/default/routing/report.yml @@ -0,0 +1,17 @@ +phpbb_report_pm_controller: + path: /pm/{id}/report + methods: [GET, POST] + defaults: + _controller: phpbb.report.controller:handle + mode: 'pm' + requirements: + id: \d+ + +phpbb_report_post_controller: + path: /post/{id}/report + methods: [GET, POST] + defaults: + _controller: phpbb.report.controller:handle + mode: 'post' + requirements: + id: \d+ diff --git a/phpBB/config/default/routing/routing.yml b/phpBB/config/default/routing/routing.yml new file mode 100644 index 0000000000..f381f024ad --- /dev/null +++ b/phpBB/config/default/routing/routing.yml @@ -0,0 +1,24 @@ +# Structure: +# +# foo_controller: +# path: /foo +# defaults: { _controller: foo_sevice:method } +# +# The above will be accessed via app.php?controller=foo and it will +# instantiate the 'foo_service' service and call the 'method' method. +# + +phpbb_feed_routing: + resource: feed.yml + prefix: /feed + +phpbb_feed_index: + path: /feed + defaults: { _controller: phpbb.feed.controller:overall } + +phpbb_help_routing: + resource: help.yml + prefix: /help + +phpbb_report_routing: + resource: report.yml diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml new file mode 100644 index 0000000000..f39eb52e73 --- /dev/null +++ b/phpBB/config/development/config.yml @@ -0,0 +1,13 @@ +imports: + - { resource: ../default/config.yml } + +core: + require_dev_dependencies: true + + debug: + exceptions: true + + twig: + debug: true + auto_reload: true + enable_debug_extension: true diff --git a/phpBB/config/development/container/environment.yml b/phpBB/config/development/container/environment.yml new file mode 100644 index 0000000000..40a3c7a683 --- /dev/null +++ b/phpBB/config/development/container/environment.yml @@ -0,0 +1,3 @@ +imports: + - { resource: services.yml } + - { resource: parameters.yml } diff --git a/phpBB/config/development/container/parameters.yml b/phpBB/config/development/container/parameters.yml new file mode 100644 index 0000000000..0447646806 --- /dev/null +++ b/phpBB/config/development/container/parameters.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/parameters.yml } diff --git a/phpBB/config/development/container/services.yml b/phpBB/config/development/container/services.yml new file mode 100644 index 0000000000..b302f0f966 --- /dev/null +++ b/phpBB/config/development/container/services.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/services.yml } diff --git a/phpBB/config/development/routing/environment.yml b/phpBB/config/development/routing/environment.yml new file mode 100644 index 0000000000..301183bbae --- /dev/null +++ b/phpBB/config/development/routing/environment.yml @@ -0,0 +1,2 @@ +core.default: + resource: ../../default/routing/routing.yml diff --git a/phpBB/config/feed.yml b/phpBB/config/feed.yml deleted file mode 100644 index 7712a832f3..0000000000 --- a/phpBB/config/feed.yml +++ /dev/null @@ -1,105 +0,0 @@ -services: - feed.helper: - class: phpbb\feed\helper - arguments: - - @config - - @user - - %core.root_path% - - feed.factory: - class: phpbb\feed\factory - arguments: - - @service_container - - @config - - @dbal.conn - - feed.forum: - class: phpbb\feed\forum - scope: prototype - arguments: - - @feed.helper - - @config - - @dbal.conn - - @cache.driver - - @user - - @auth - - @content.visibility - - %core.php_ext% - - feed.forums: - class: phpbb\feed\forums - scope: prototype - arguments: - - @feed.helper - - @config - - @dbal.conn - - @cache.driver - - @user - - @auth - - @content.visibility - - %core.php_ext% - - feed.news: - class: phpbb\feed\news - scope: prototype - arguments: - - @feed.helper - - @config - - @dbal.conn - - @cache.driver - - @user - - @auth - - @content.visibility - - %core.php_ext% - - feed.overall: - class: phpbb\feed\overall - scope: prototype - arguments: - - @feed.helper - - @config - - @dbal.conn - - @cache.driver - - @user - - @auth - - @content.visibility - - %core.php_ext% - - feed.topic: - class: phpbb\feed\topic - scope: prototype - arguments: - - @feed.helper - - @config - - @dbal.conn - - @cache.driver - - @user - - @auth - - @content.visibility - - %core.php_ext% - - feed.topics: - class: phpbb\feed\topics - scope: prototype - arguments: - - @feed.helper - - @config - - @dbal.conn - - @cache.driver - - @user - - @auth - - @content.visibility - - %core.php_ext% - - feed.topics_active: - class: phpbb\feed\topics_active - scope: prototype - arguments: - - @feed.helper - - @config - - @dbal.conn - - @cache.driver - - @user - - @auth - - @content.visibility - - %core.php_ext% diff --git a/phpBB/config/installer/config.yml b/phpBB/config/installer/config.yml new file mode 100644 index 0000000000..979dbbcdd9 --- /dev/null +++ b/phpBB/config/installer/config.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../default/config.yml } diff --git a/phpBB/config/installer/container/environment.yml b/phpBB/config/installer/container/environment.yml new file mode 100644 index 0000000000..40a3c7a683 --- /dev/null +++ b/phpBB/config/installer/container/environment.yml @@ -0,0 +1,3 @@ +imports: + - { resource: services.yml } + - { resource: parameters.yml } diff --git a/phpBB/config/installer/container/parameters.yml b/phpBB/config/installer/container/parameters.yml new file mode 100644 index 0000000000..f11f7e2d84 --- /dev/null +++ b/phpBB/config/installer/container/parameters.yml @@ -0,0 +1,5 @@ +imports: + - { resource: ../../default/container/parameters.yml } + +parameters: + installer.create_config_file.options: [] diff --git a/phpBB/config/installer/container/services.yml b/phpBB/config/installer/container/services.yml new file mode 100644 index 0000000000..16782dec10 --- /dev/null +++ b/phpBB/config/installer/container/services.yml @@ -0,0 +1,94 @@ +imports: + - { resource: services_installer.yml } + - { resource: ../../default/container/services_event.yml } + - { resource: ../../default/container/services_filesystem.yml } + - { resource: ../../default/container/services_http.yml } + - { resource: ../../default/container/services_language.yml } + - { resource: ../../default/container/services_php.yml } + - { resource: ../../default/container/services_routing.yml } + - { resource: ../../default/container/services_twig.yml } + +services: + cache.driver: + class: '%cache.driver.class%' + arguments: + - '%core.root_path%/cache/installer/' + + config: + class: phpbb\config\config + arguments: + - [] + + controller.resolver: + class: phpbb\controller\resolver + arguments: + - '@service_container' + - '%core.root_path%' + - '@template' + + file_locator: + class: phpbb\routing\file_locator + arguments: + - '@filesystem' + - '%core.root_path%' + + kernel_exception_subscriber: + class: phpbb\install\event\kernel_exception_subscriber + arguments: + - '@phpbb.installer.controller.helper' + - '@language' + - '@template' + tags: + - { name: kernel.event_subscriber } + + language.loader: + parent: language.loader_abstract + + path_helper: + class: phpbb\path_helper + arguments: + - '@symfony_request' + - '@filesystem' + - '@request' + - '%core.root_path%' + - '%core.php_ext%' + + routing.resources_locator.default: + class: phpbb\routing\resources_locator\installer_resources_locator + arguments: + - '@filesystem' + - '%core.root_path%' + - '%core.environment%' + tags: + - { name: routing.resources_locator } + + template: + class: phpbb\template\twig\twig + arguments: + - '@path_helper' + - '@config' + - '@template_context' + - '@template.twig.environment' + - '%core.template.cache_path%' + - null + - '@template.twig.extensions.collection' + + template.twig.environment: + class: phpbb\template\twig\environment + arguments: + - '@config' + - '@filesystem' + - '@path_helper' + - '@service_container' + - '%core.template.cache_path%' + - null + - '@template.twig.loader' + - [] + + console.exception_subscriber: + class: phpbb\console\exception_subscriber + arguments: + - '@language' + - '%debug.exceptions%' + tags: + - { name: kernel.event_subscriber } diff --git a/phpBB/config/installer/container/services_file_updater.yml b/phpBB/config/installer/container/services_file_updater.yml new file mode 100644 index 0000000000..9d39bb8b89 --- /dev/null +++ b/phpBB/config/installer/container/services_file_updater.yml @@ -0,0 +1,38 @@ +services: + installer.file_updater.factory: + class: phpbb\install\helper\file_updater\factory + arguments: + - '@installer.file_updater.collection' + + installer.file_updater.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: file_updater } + + installer.file_updater.compress: + class: phpbb\install\helper\file_updater\compression_file_updater + arguments: + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: file_updater } + + installer.file_updater.ftp: + class: phpbb\install\helper\file_updater\ftp_file_updater + arguments: + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: file_updater } + + installer.file_updater.file: + class: phpbb\install\helper\file_updater\file_updater + arguments: + - '@filesystem' + - '%core.root_path%' + tags: + - { name: file_updater } diff --git a/phpBB/config/installer/container/services_install_console.yml b/phpBB/config/installer/container/services_install_console.yml new file mode 100644 index 0000000000..73c804d9ff --- /dev/null +++ b/phpBB/config/installer/container/services_install_console.yml @@ -0,0 +1,36 @@ +services: + console.installer.command_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: console.installer.command } + + console.installer.command.install: + class: phpbb\install\console\command\install\install + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + - '@installer.installer.install' + - '@installer.helper.install_helper' + tags: + - { name: console.installer.command } + + console.installer.command.config.show: + class: phpbb\install\console\command\install\config\show + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + - '@installer.installer.install' + tags: + - { name: console.installer.command } + + + console.installer.command.config.validate: + class: phpbb\install\console\command\install\config\validate + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + - '@installer.installer.install' + tags: + - { name: console.installer.command } diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml new file mode 100644 index 0000000000..5be28c5746 --- /dev/null +++ b/phpBB/config/installer/container/services_install_controller.yml @@ -0,0 +1,51 @@ +services: + phpbb.installer.controller.welcome: + class: phpbb\install\controller\installer_index + arguments: + - '@phpbb.installer.controller.helper' + - '@language' + - '@template' + - '%core.root_path%' + + phpbb.installer.controller.helper: + class: phpbb\install\controller\helper + arguments: + - '@installer.helper.config' + - '@language' + - '@language.helper.language_file' + - '@installer.navigation.provider' + - '@template' + - '@path_helper' + - '@request' + - '@symfony_request' + - '@router' + - '%core.root_path%' + + phpbb.installer.controller.install: + class: phpbb\install\controller\install + arguments: + - '@phpbb.installer.controller.helper' + - '@installer.helper.iohandler_factory' + - '@installer.navigation.provider' + - '@language' + - '@template' + - '@request' + - '@installer.installer.install' + - '@installer.helper.install_helper' + + phpbb.installer.controller.update: + class: phpbb\install\controller\update + arguments: + - '@phpbb.installer.controller.helper' + - '@installer.installer.update' + - '@installer.helper.install_helper' + - '@installer.helper.iohandler_factory' + - '@language' + - '@installer.navigation.provider' + - '@request' + - '@template' + + phpbb.installer.controller.file_downloader: + class: phpbb\install\controller\archive_download + arguments: + - '@installer.helper.config' diff --git a/phpBB/config/installer/container/services_install_data.yml b/phpBB/config/installer/container/services_install_data.yml new file mode 100644 index 0000000000..d119ba6ebb --- /dev/null +++ b/phpBB/config/installer/container/services_install_data.yml @@ -0,0 +1,44 @@ +services: + installer.install_data.add_bots: + class: phpbb\install\module\install_data\task\add_bots + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: install_data_install, order: 20 } + + installer.install_data.add_languages: + class: phpbb\install\module\install_data\task\add_languages + arguments: + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language.helper.language_file' + tags: + - { name: install_data_install, order: 10 } + + installer.install_data.add_modules: + class: phpbb\install\module\install_data\task\add_modules + arguments: + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + tags: + - { name: install_data_install, order: 30 } + + installer.module.data_install_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_data_install, class_name_aware: true } + + installer.module.data_install: + class: phpbb\install\module\install_data\module + parent: installer.module_base + arguments: + - '@installer.module.data_install_collection' + tags: + - { name: installer_install_module, order: 50 } diff --git a/phpBB/config/installer/container/services_install_database.yml b/phpBB/config/installer/container/services_install_database.yml new file mode 100644 index 0000000000..8324cd6086 --- /dev/null +++ b/phpBB/config/installer/container/services_install_database.yml @@ -0,0 +1,51 @@ +services: + installer.install_database.create_schema: + class: phpbb\install\module\install_database\task\create_schema + arguments: + - '@installer.helper.config' + - '@installer.helper.database' + - '@filesystem' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: install_database_install, order: 10 } + + installer.install_database.add_default_data: + class: phpbb\install\module\install_database\task\add_default_data + arguments: + - '@installer.helper.database' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language' + - '%core.root_path%' + tags: + - { name: install_database_install, order: 20 } + + installer.install_database.add_config_settings: + class: phpbb\install\module\install_database\task\add_config_settings + arguments: + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language' + - '%core.root_path%' + tags: + - { name: install_database_install, order: 30 } + + installer.module.install_database_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_database_install, class_name_aware: true } + + installer.module.database_install: + class: phpbb\install\module\install_database\module + parent: installer.module_base + arguments: + - '@installer.module.install_database_collection' + tags: + - { name: installer_install_module, order: 40 } diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml new file mode 100644 index 0000000000..65b2a6eddd --- /dev/null +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -0,0 +1,28 @@ +services: + installer.install_filesystem.create_config_file: + class: phpbb\install\module\install_filesystem\task\create_config_file + arguments: + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.database' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + - '%installer.create_config_file.options%' + tags: + - { name: install_filesystem_install, order: 10 } + + installer.module.install_filesystem_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_filesystem_install, class_name_aware: true } + + installer.module.filesystem_install: + class: phpbb\install\module\install_filesystem\module + parent: installer.module_base + arguments: + - '@installer.module.install_filesystem_collection' + tags: + - { name: installer_install_module, order: 30 } diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml new file mode 100644 index 0000000000..854b129b69 --- /dev/null +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -0,0 +1,33 @@ +services: + installer.install_finish.populate_migrations: + class: phpbb\install\module\install_finish\task\populate_migrations + arguments: + - '@installer.helper.container_factory' + tags: + - { name: install_finish, order: 10 } + + installer.install_finish.notify_user: + class: phpbb\install\module\install_finish\task\notify_user + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: install_finish, order: 20 } + + installer.module.install_finish_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_finish, class_name_aware: true } + + installer.module.finish_install: + class: phpbb\install\module\install_filesystem\module + parent: installer.module_base + arguments: + - '@installer.module.install_finish_collection' + tags: + - { name: installer_install_module, order: 60 } diff --git a/phpBB/config/installer/container/services_install_navigation.yml b/phpBB/config/installer/container/services_install_navigation.yml new file mode 100644 index 0000000000..301d6f3434 --- /dev/null +++ b/phpBB/config/installer/container/services_install_navigation.yml @@ -0,0 +1,35 @@ +services: + installer.navigation.provider: + class: phpbb\install\helper\navigation\navigation_provider + arguments: + - '@installer.navigation.service_collection' + + installer.navigation.service_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer.navigation } + + installer.navigation.main_navigation: + class: phpbb\install\helper\navigation\main_navigation + scope: prototype + tags: + - { name: installer.navigation } + + installer.navigation.install_navigation: + class: phpbb\install\helper\navigation\install_navigation + arguments: + - '@installer.helper.install_helper' + scope: prototype + tags: + - { name: installer.navigation } + + installer.navigation.update_navigation: + class: phpbb\install\helper\navigation\update_navigation + arguments: + - '@installer.helper.install_helper' + scope: prototype + tags: + - { name: installer.navigation } + diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml new file mode 100644 index 0000000000..cd8d0c8072 --- /dev/null +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -0,0 +1,66 @@ +services: + installer.obtain_data.obtain_admin_data: + class: phpbb\install\module\obtain_data\task\obtain_admin_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 10 } + + installer.obtain_data.obtain_board_data: + class: phpbb\install\module\obtain_data\task\obtain_board_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@language.helper.language_file' + tags: + - { name: install_obtain_data, order: 50 } + + installer.obtain_data.obtain_database_data: + class: phpbb\install\module\obtain_data\task\obtain_database_data + arguments: + - '@installer.helper.database' + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 20 } + + installer.obtain_data.obtain_email_data: + class: phpbb\install\module\obtain_data\task\obtain_email_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 40 } + + installer.obtain_data.obtain_imagick_path: + class: phpbb\install\module\obtain_data\task\obtain_imagick_path + arguments: + - '@installer.helper.config' + tags: + - { name: install_obtain_data, order: 60 } + + installer.obtain_data.obtain_server_data: + class: phpbb\install\module\obtain_data\task\obtain_server_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 30 } + + installer.module.install_obtain_data_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_obtain_data, class_name_aware: true } + + installer.module.obtain_data_install: + class: phpbb\install\module\obtain_data\install_module + parent: installer.module_base + arguments: + - '@installer.module.install_obtain_data_collection' + - true + - false + tags: + - { name: installer_install_module, order: 20 } diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml new file mode 100644 index 0000000000..c03eb1fb93 --- /dev/null +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -0,0 +1,37 @@ +services: + installer.requirements.check_filesystem: + class: phpbb\install\module\requirements\task\check_filesystem + arguments: + - '@filesystem' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: installer_requirements, order: 10 } + + installer.requirements.check_server_environment: + class: phpbb\install\module\requirements\task\check_server_environment + arguments: + - '@installer.helper.database' + - '@installer.helper.iohandler' + tags: + - { name: installer_requirements, order: 20 } + - { name: update_requirements, order: 20 } + + installer.module.install_requirements_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer_requirements, class_name_aware: true } + +# Please note, that the name of this module is hard coded in the installer service + installer.module.requirements_install: + class: phpbb\install\module\requirements\install_module + parent: installer.module_base + arguments: + - '@installer.module.install_requirements_collection' + - true + - false + tags: + - { name: installer_install_module, order: 10 } diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml new file mode 100644 index 0000000000..bf9d28ec65 --- /dev/null +++ b/phpBB/config/installer/container/services_installer.yml @@ -0,0 +1,115 @@ +imports: + - { resource: services_file_updater.yml } + - { resource: services_install_console.yml } + - { resource: services_install_controller.yml } + - { resource: services_install_data.yml } + - { resource: services_install_database.yml } + - { resource: services_install_filesystem.yml } + - { resource: services_install_finish.yml } + - { resource: services_install_navigation.yml } + - { resource: services_install_obtain_data.yml } + - { resource: services_install_requirements.yml } + - { resource: services_update_database.yml } + - { resource: services_update_filesystem.yml } + - { resource: services_update_obtain_data.yml } + - { resource: services_update_requirements.yml } + +services: +# -------- Installer helpers ------------------------ + installer.helper.config: + class: phpbb\install\helper\config + arguments: + - '@filesystem' + - '@php_ini' + - '%core.root_path%' + + installer.helper.database: + class: phpbb\install\helper\database + arguments: + - '@filesystem' + - '%core.root_path%' + + installer.helper.iohandler_factory: + class: phpbb\install\helper\iohandler\factory + arguments: + - '@service_container' + + installer.helper.iohandler_abstract: + abstract: true + calls: + - [set_language, ['@language']] + + installer.helper.iohandler_ajax: + class: phpbb\install\helper\iohandler\ajax_iohandler + parent: installer.helper.iohandler_abstract + arguments: + - '@path_helper' + - '@request' + - '@template' + - '@router' + + installer.helper.iohandler_cli: + class: phpbb\install\helper\iohandler\cli_iohandler + parent: installer.helper.iohandler_abstract + + installer.helper.iohandler: + class: phpbb\install\helper\iohandler\iohandler_interface + factory: ['@installer.helper.iohandler_factory', get] + + installer.helper.container_factory: + class: phpbb\install\helper\container_factory + arguments: + - '@language' + - '@request' + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + + installer.helper.install_helper: + class: phpbb\install\helper\install_helper + arguments: + - '%core.root_path%' + - '%core.php_ext%' + + installer.helper.update_helper: + class: phpbb\install\helper\update_helper + arguments: + - '%core.root_path%' + +# -------- Installer -------------------------------- + installer.module_base: + abstract: true + calls: + - [setup, ['@installer.helper.config', '@installer.helper.iohandler']] + + installer.installer.abstract: + class: phpbb\install\installer + abstract: true + arguments: + - '@cache.driver' + - '@installer.helper.config' + - '@path_helper' + + installer.install.module_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer_install_module } + + installer.update.module_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer_update_module } + + installer.installer.install: + parent: installer.installer.abstract + calls: + - [set_modules, ['@installer.install.module_collection']] + + installer.installer.update: + parent: installer.installer.abstract + calls: + - [set_modules, ['@installer.update.module_collection']] diff --git a/phpBB/config/installer/container/services_update_database.yml b/phpBB/config/installer/container/services_update_database.yml new file mode 100644 index 0000000000..9cb9cb9abf --- /dev/null +++ b/phpBB/config/installer/container/services_update_database.yml @@ -0,0 +1,29 @@ +services: + installer.update_database.update_task: + class: phpbb\install\module\update_database\task\update + arguments: + - '@installer.helper.container_factory' + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@language' + - '%core.root_path%' + tags: + - { name: update_database_task, order: 10 } + + installer.module.update_database_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_database_task, class_name_aware: true } + + installer.module.update_database: + class: phpbb\install\module\update_database\module + parent: installer.module_base + arguments: + - '@installer.module.update_database_collection' + - true + - false + tags: + - { name: installer_update_module, order: 40 } diff --git a/phpBB/config/installer/container/services_update_filesystem.yml b/phpBB/config/installer/container/services_update_filesystem.yml new file mode 100644 index 0000000000..c0a04676f6 --- /dev/null +++ b/phpBB/config/installer/container/services_update_filesystem.yml @@ -0,0 +1,72 @@ +services: + installer.update_filesystem.check_task: + class: phpbb\install\module\update_filesystem\task\file_check + arguments: + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.root_path%' + tags: + - { name: update_filesystem, order: 10 } + + installer.update_filesystem.diff_files: + class: phpbb\install\module\update_filesystem\task\diff_files + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: update_filesystem, order: 20 } + + installer.update_filesystem.show_file_status: + class: phpbb\install\module\update_filesystem\task\show_file_status + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@filesystem' + - '@installer.file_updater.factory' + tags: + - { name: update_filesystem, order: 30 } + + installer.update_filesystem.update_files: + class: phpbb\install\module\update_filesystem\task\update_files + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.file_updater.factory' + - '@installer.helper.update_helper' + - '%core.root_path%' + tags: + - { name: update_filesystem, order: 40 } + + installer.update_filesystem.download_updated_files: + class: phpbb\install\module\update_filesystem\task\download_updated_files + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@filesystem' + tags: + - { name: update_filesystem, order: 50 } + + installer.module.update_filesystem_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_filesystem, class_name_aware: true } + + installer.module.filesystem_update: + class: phpbb\install\module\update_filesystem\module + parent: installer.module_base + arguments: + - '@installer.module.update_filesystem_collection' + - true + - false + tags: + - { name: installer_update_module, order: 30 } diff --git a/phpBB/config/installer/container/services_update_obtain_data.yml b/phpBB/config/installer/container/services_update_obtain_data.yml new file mode 100644 index 0000000000..999976aed0 --- /dev/null +++ b/phpBB/config/installer/container/services_update_obtain_data.yml @@ -0,0 +1,53 @@ +services: + installer.obtain_data.update_options: + class: phpbb\install\module\obtain_data\task\obtain_update_settings + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: update_obtain_data, order: 10 } + + installer.obtain_data.file_updater_method: + class: phpbb\install\module\obtain_data\task\obtain_file_updater_method + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: update_obtain_data, order: 20 } + + installer.obtain_data.update_files: + class: phpbb\install\module\obtain_data\task\obtain_update_files + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: update_obtain_data, order: 30 } + + installer.obtain_data.update_ftp_settings: + class: phpbb\install\module\obtain_data\task\obtain_update_ftp_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.php_ext%' + tags: + - { name: update_obtain_data, order: 40 } + + installer.module.update_obtain_data_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_obtain_data, class_name_aware: true } + + installer.module.obtain_data_update: + class: phpbb\install\module\obtain_data\update_module + parent: installer.module_base + arguments: + - '@installer.module.update_obtain_data_collection' + - true + - false + tags: + - { name: installer_update_module, order: 20 } diff --git a/phpBB/config/installer/container/services_update_requirements.yml b/phpBB/config/installer/container/services_update_requirements.yml new file mode 100644 index 0000000000..c5272ef549 --- /dev/null +++ b/phpBB/config/installer/container/services_update_requirements.yml @@ -0,0 +1,40 @@ +services: + installer.requirements.check_filesystem_update: + class: phpbb\install\module\requirements\task\check_filesystem + arguments: + - '@filesystem' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + - false + tags: + - { name: update_requirements, order: 10 } + + installer.requirements.update_requirements: + class: phpbb\install\module\requirements\task\check_update + arguments: + - '@installer.helper.container_factory' + - '@filesystem' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: update_requirements, order: 30 } + + installer.module.update_requirements_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_requirements, class_name_aware: true } + + installer.module.requirements_update: + class: phpbb\install\module\requirements\update_module + parent: installer.module_base + arguments: + - '@installer.module.update_requirements_collection' + - true + - false + tags: + - { name: installer_update_module, order: 10 } diff --git a/phpBB/config/installer/routing/environment.yml b/phpBB/config/installer/routing/environment.yml new file mode 100644 index 0000000000..7a1f588fa1 --- /dev/null +++ b/phpBB/config/installer/routing/environment.yml @@ -0,0 +1,2 @@ +core.default: + resource: installer.yml diff --git a/phpBB/config/installer/routing/installer.yml b/phpBB/config/installer/routing/installer.yml new file mode 100644 index 0000000000..6190799737 --- /dev/null +++ b/phpBB/config/installer/routing/installer.yml @@ -0,0 +1,37 @@ +phpbb_installer_index: + path: / + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: 'intro' + +phpbb_installer_license: + path: /license + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: 'license' + +phpbb_installer_support: + path: /support + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: 'support' + +phpbb_installer_install: + path: /install + defaults: + _controller: phpbb.installer.controller.install:handle + +phpbb_installer_update: + path: /update + defaults: + _controller: phpbb.installer.controller.update:handle + +phpbb_installer_update_file_download: + path: /download/updated + defaults: + _controller: phpbb.installer.controller.file_downloader:update_archive + +phpbb_installer_update_conflict_download: + path: /download/conflict + defaults: + _controller: phpbb.installer.controller.file_downloader:conflict_archive diff --git a/phpBB/config/migrator.yml b/phpBB/config/migrator.yml deleted file mode 100644 index 202421c09f..0000000000 --- a/phpBB/config/migrator.yml +++ /dev/null @@ -1,53 +0,0 @@ -services: - migrator: - class: phpbb\db\migrator - arguments: - - @config - - @dbal.conn - - @dbal.tools - - %tables.migrations% - - %core.root_path% - - %core.php_ext% - - %core.table_prefix% - - @migrator.tool_collection - - @migrator.helper - - migrator.helper: - class: phpbb\db\migration\helper - - migrator.tool_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: migrator.tool } - - migrator.tool.config: - class: phpbb\db\migration\tool\config - arguments: - - @config - tags: - - { name: migrator.tool } - - migrator.tool.module: - class: phpbb\db\migration\tool\module - arguments: - - @dbal.conn - - @cache - - @user - - %core.root_path% - - %core.php_ext% - - %tables.modules% - tags: - - { name: migrator.tool } - - migrator.tool.permission: - class: phpbb\db\migration\tool\permission - arguments: - - @dbal.conn - - @cache - - @auth - - %core.root_path% - - %core.php_ext% - tags: - - { name: migrator.tool } diff --git a/phpBB/config/mimetype_guessers.yml b/phpBB/config/mimetype_guessers.yml deleted file mode 100644 index 0115146deb..0000000000 --- a/phpBB/config/mimetype_guessers.yml +++ /dev/null @@ -1,43 +0,0 @@ -parameters: - mimetype.guesser.priority.lowest: -2 - mimetype.guesser.priority.low: -1 - mimetype.guesser.priority.default: 0 - mimetype.guesser.priority.high: 1 - mimetype.guesser.priority.highest: 2 - -services: - mimetype.fileinfo_mimetype_guesser: - class: Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser - tags: - - { name: mimetype.guessers } - - mimetype.filebinary_mimetype_guesser: - class: Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser - tags: - - { name: mimetype.guessers } - - mimetype.content_guesser: - class: phpbb\mimetype\content_guesser - calls: - - [set_priority, [%mimetype.guesser.priority.low%]] - tags: - - { name: mimetype.guessers } - - mimetype.extension_guesser: - class: phpbb\mimetype\extension_guesser - calls: - - [set_priority, [%mimetype.guesser.priority.lowest%]] - tags: - - { name: mimetype.guessers } - - mimetype.guesser_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: mimetype.guessers } - - mimetype.guesser: - class: phpbb\mimetype\guesser - arguments: - - @mimetype.guesser_collection diff --git a/phpBB/config/notifications.yml b/phpBB/config/notifications.yml deleted file mode 100644 index 5675e76a99..0000000000 --- a/phpBB/config/notifications.yml +++ /dev/null @@ -1,368 +0,0 @@ -services: - notification.type_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: notification.type } - - notification.method_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: notification.method } - - notification.type.approve_post: - class: phpbb\notification\type\approve_post - scope: prototype # scope MUST be prototype for this to work! # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.approve_topic: - class: phpbb\notification\type\approve_topic - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.bookmark: - class: phpbb\notification\type\bookmark - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.disapprove_post: - class: phpbb\notification\type\disapprove_post - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.disapprove_topic: - class: phpbb\notification\type\disapprove_topic - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.group_request: - class: phpbb\notification\type\group_request - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.group_request_approved: - class: phpbb\notification\type\group_request_approved - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.pm: - class: phpbb\notification\type\pm - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.post: - class: phpbb\notification\type\post - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.post_in_queue: - class: phpbb\notification\type\post_in_queue - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.quote: - class: phpbb\notification\type\quote - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.report_pm: - class: phpbb\notification\type\report_pm - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.report_pm_closed: - class: phpbb\notification\type\report_pm_closed - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.report_post: - class: phpbb\notification\type\report_post - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.report_post_closed: - class: phpbb\notification\type\report_post_closed - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.topic: - class: phpbb\notification\type\topic - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.topic_in_queue: - class: phpbb\notification\type\topic_in_queue - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.type.admin_activate_user: - class: phpbb\notification\type\admin_activate_user - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - tags: - - { name: notification.type } - - notification.method.email: - class: phpbb\notification\method\email - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - tags: - - { name: notification.method } - - notification.method.jabber: - class: phpbb\notification\method\jabber - scope: prototype # scope MUST be prototype for this to work! - arguments: - - @user_loader - - @dbal.conn - - @cache.driver - - @user - - @auth - - @config - - %core.root_path% - - %core.php_ext% - tags: - - { name: notification.method } diff --git a/phpBB/config/passwords.yml b/phpBB/config/passwords.yml deleted file mode 100644 index 9e249a2c12..0000000000 --- a/phpBB/config/passwords.yml +++ /dev/null @@ -1,62 +0,0 @@ -parameters: - passwords.algorithms: - - passwords.driver.bcrypt_2y - - passwords.driver.bcrypt - - passwords.driver.salted_md5 - - passwords.driver.phpass - -services: - passwords.driver.bcrypt: - class: phpbb\passwords\driver\bcrypt - arguments: - - @config - - @passwords.driver_helper - tags: - - { name: passwords.driver } - - passwords.driver.bcrypt_2y: - class: phpbb\passwords\driver\bcrypt_2y - arguments: - - @config - - @passwords.driver_helper - tags: - - { name: passwords.driver } - - passwords.driver.salted_md5: - class: phpbb\passwords\driver\salted_md5 - arguments: - - @config - - @passwords.driver_helper - tags: - - { name: passwords.driver } - - passwords.driver.phpass: - class: phpbb\passwords\driver\phpass - arguments: - - @config - - @passwords.driver_helper - tags: - - { name: passwords.driver } - - passwords.driver_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: passwords.driver } - - passwords.driver_helper: - class: phpbb\passwords\driver\helper - arguments: - - @config - - passwords.manager: - class: phpbb\passwords\manager - arguments: - - @config - - @passwords.driver_collection - - @passwords.helper - - %passwords.algorithms% - - passwords.helper: - class: phpbb\passwords\helper diff --git a/phpBB/config/production/config.yml b/phpBB/config/production/config.yml new file mode 100644 index 0000000000..979dbbcdd9 --- /dev/null +++ b/phpBB/config/production/config.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../default/config.yml } diff --git a/phpBB/config/production/container/environment.yml b/phpBB/config/production/container/environment.yml new file mode 100644 index 0000000000..40a3c7a683 --- /dev/null +++ b/phpBB/config/production/container/environment.yml @@ -0,0 +1,3 @@ +imports: + - { resource: services.yml } + - { resource: parameters.yml } diff --git a/phpBB/config/production/container/parameters.yml b/phpBB/config/production/container/parameters.yml new file mode 100644 index 0000000000..0447646806 --- /dev/null +++ b/phpBB/config/production/container/parameters.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/parameters.yml } diff --git a/phpBB/config/production/container/services.yml b/phpBB/config/production/container/services.yml new file mode 100644 index 0000000000..b302f0f966 --- /dev/null +++ b/phpBB/config/production/container/services.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/services.yml } diff --git a/phpBB/config/production/routing/environment.yml b/phpBB/config/production/routing/environment.yml new file mode 100644 index 0000000000..301183bbae --- /dev/null +++ b/phpBB/config/production/routing/environment.yml @@ -0,0 +1,2 @@ +core.default: + resource: ../../default/routing/routing.yml diff --git a/phpBB/config/profilefields.yml b/phpBB/config/profilefields.yml deleted file mode 100644 index 5a861a4b56..0000000000 --- a/phpBB/config/profilefields.yml +++ /dev/null @@ -1,82 +0,0 @@ -services: - profilefields.manager: - class: phpbb\profilefields\manager - arguments: - - @auth - - @dbal.conn - - @request - - @template - - @profilefields.type_collection - - @user - - %tables.profile_fields% - - %tables.profile_fields_language% - - %tables.profile_fields_data% - - profilefields.lang_helper: - class: phpbb\profilefields\lang_helper - arguments: - - @dbal.conn - - %tables.profile_fields_options_language% - - profilefields.type_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: profilefield.type } - - profilefields.type.bool: - class: phpbb\profilefields\type\type_bool - arguments: - - @profilefields.lang_helper - - @request - - @template - - @user - tags: - - { name: profilefield.type } - - profilefields.type.date: - class: phpbb\profilefields\type\type_date - arguments: - - @request - - @template - - @user - tags: - - { name: profilefield.type } - - profilefields.type.dropdown: - class: phpbb\profilefields\type\type_dropdown - arguments: - - @profilefields.lang_helper - - @request - - @template - - @user - tags: - - { name: profilefield.type } - - profilefields.type.int: - class: phpbb\profilefields\type\type_int - arguments: - - @request - - @template - - @user - tags: - - { name: profilefield.type } - - profilefields.type.string: - class: phpbb\profilefields\type\type_string - arguments: - - @request - - @template - - @user - tags: - - { name: profilefield.type } - - profilefields.type.text: - class: phpbb\profilefields\type\type_text - arguments: - - @request - - @template - - @user - tags: - - { name: profilefield.type } diff --git a/phpBB/config/routing.yml b/phpBB/config/routing.yml deleted file mode 100644 index d8e890d063..0000000000 --- a/phpBB/config/routing.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Structure: -# -# foo_controller: -# pattern: /foo -# defaults: { _controller: foo_sevice:method } -# -# The above will be accessed via app.php?controller=foo and it will -# instantiate the "foo_service" service and call the "method" method. -# diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml deleted file mode 100644 index 735626810f..0000000000 --- a/phpBB/config/services.yml +++ /dev/null @@ -1,317 +0,0 @@ -imports: - - { resource: tables.yml } - - { resource: cron_tasks.yml } - - { resource: notifications.yml } - - { resource: migrator.yml } - - { resource: avatars.yml } - - { resource: feed.yml } - - { resource: auth_providers.yml } - - { resource: console.yml } - - { resource: mimetype_guessers.yml } - - { resource: passwords.yml } - - { resource: profilefields.yml } - -services: - acl.permissions: - class: phpbb\permissions - arguments: - - @dispatcher - - @user - - auth: - class: phpbb\auth\auth - - avatar.manager: - class: phpbb\avatar\manager - arguments: - - @config - - @avatar.driver_collection - - cache: - class: phpbb\cache\service - arguments: - - @cache.driver - - @config - - @dbal.conn - - %core.root_path% - - %core.php_ext% - - cache.driver: - class: %cache.driver.class% - - cache.driver.install: - class: phpbb\cache\driver\file - - class_loader: - class: phpbb\class_loader - arguments: - - phpbb\ - - %core.root_path%includes/ - - %core.php_ext% - calls: - - [register, []] - - [set_cache, [@cache.driver]] - - class_loader.ext: - class: phpbb\class_loader - arguments: - - \ - - %core.root_path%ext/ - - %core.php_ext% - calls: - - [register, []] - - [set_cache, [@cache.driver]] - - config: - class: phpbb\config\db - arguments: - - @dbal.conn - - @cache.driver - - %tables.config% - - config_text: - class: phpbb\config\db_text - arguments: - - @dbal.conn - - %tables.config_text% - - content.visibility: - class: phpbb\content_visibility - arguments: - - @auth - - @dbal.conn - - @user - - %core.root_path% - - %core.php_ext% - - %tables.forums% - - %tables.posts% - - %tables.topics% - - %tables.users% - - controller.helper: - class: phpbb\controller\helper - arguments: - - @template - - @user - - @config - - %core.root_path% - - %core.php_ext% - - controller.resolver: - class: phpbb\controller\resolver - arguments: - - @user - - @service_container - - @template - - cron.task_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: cron.task } - - cron.manager: - class: phpbb\cron\manager - arguments: - - @cron.task_collection - - %core.root_path% - - %core.php_ext% - - cron.lock_db: - class: phpbb\lock\db - arguments: - - cron_lock - - @config - - @dbal.conn - - dispatcher: - class: phpbb\event\dispatcher - arguments: - - @service_container - - dbal.conn: - class: %dbal.driver.class% - calls: - - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] - - dbal.tools: - class: phpbb\db\tools - arguments: - - @dbal.conn - - event.subscriber_loader: - class: phpbb\event\extension_subscriber_loader - arguments: - - @dispatcher - - @event.listener_collection - calls: - - [load, []] - - event.listener_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: event.listener } - - ext.manager: - class: phpbb\extension\manager - arguments: - - @service_container - - @dbal.conn - - @config - - @filesystem - - %tables.ext% - - %core.root_path% - - %core.php_ext% - - @cache.driver - - ext.finder: - class: phpbb\extension\finder - arguments: - - @ext.manager - - @filesystem - - %core.root_path% - - @cache.driver - - %core.php_ext% - - _ext_finder - - filesystem: - class: phpbb\filesystem - - groupposition.legend: - class: phpbb\groupposition\legend - arguments: - - @dbal.conn - - @user - - groupposition.teampage: - class: phpbb\groupposition\teampage - arguments: - - @dbal.conn - - @user - - @cache.driver - - http_kernel: - class: Symfony\Component\HttpKernel\HttpKernel - arguments: - - @dispatcher - - @controller.resolver - - hook_finder: - class: phpbb\hook\finder - arguments: - - %core.root_path% - - %core.php_ext% - - @cache.driver - - kernel_request_subscriber: - class: phpbb\event\kernel_request_subscriber - arguments: - - @ext.finder - - %core.root_path% - - %core.php_ext% - tags: - - { name: kernel.event_subscriber } - - kernel_exception_subscriber: - class: phpbb\event\kernel_exception_subscriber - arguments: - - @template - - @user - tags: - - { name: kernel.event_subscriber } - - kernel_terminate_subscriber: - class: phpbb\event\kernel_terminate_subscriber - tags: - - { name: kernel.event_subscriber } - - log: - class: phpbb\log\log - arguments: - - @dbal.conn - - @user - - @auth - - @dispatcher - - %core.root_path% - - %core.adm_relative_path% - - %core.php_ext% - - %tables.log% - - notification_manager: - class: phpbb\notification\manager - arguments: - - @notification.type_collection - - @notification.method_collection - - @service_container - - @user_loader - - @config - - @dbal.conn - - @cache - - @user - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - - pagination: - class: phpbb\pagination - arguments: - - @template - - @user - - path_helper: - class: phpbb\path_helper - arguments: - - @symfony_request - - @filesystem - - %core.root_path% - - %core.php_ext% - - %core.adm_relative_path% - - php_ini: - class: phpbb\php\ini - - plupload: - class: phpbb\plupload\plupload - arguments: - - %core.root_path% - - @config - - @request - - @user - - @php_ini - - @mimetype.guesser - - request: - class: phpbb\request\request - - symfony_request: - class: phpbb\symfony_request - arguments: - - @request - - template: - class: phpbb\template\twig\twig - arguments: - - @path_helper - - @config - - @user - - @template_context - - @ext.manager - - template_context: - class: phpbb\template\context - - user: - class: phpbb\user - - user_loader: - class: phpbb\user_loader - arguments: - - @dbal.conn - - %core.root_path% - - %core.php_ext% - - %tables.users% diff --git a/phpBB/config/tables.yml b/phpBB/config/tables.yml deleted file mode 100644 index e4f7bda89b..0000000000 --- a/phpBB/config/tables.yml +++ /dev/null @@ -1,20 +0,0 @@ -parameters: - tables.auth_provider_oauth_token_storage: %core.table_prefix%oauth_tokens - tables.auth_provider_oauth_account_assoc: %core.table_prefix%oauth_accounts - tables.config: %core.table_prefix%config - tables.config_text: %core.table_prefix%config_text - tables.ext: %core.table_prefix%ext - tables.forums: %core.table_prefix%forums - tables.log: %core.table_prefix%log - tables.migrations: %core.table_prefix%migrations - tables.modules: %core.table_prefix%modules - tables.notification_types: %core.table_prefix%notification_types - tables.notifications: %core.table_prefix%notifications - tables.profile_fields: %core.table_prefix%profile_fields - tables.profile_fields_data: %core.table_prefix%profile_fields_data - tables.profile_fields_options_language: %core.table_prefix%profile_fields_lang - tables.profile_fields_language: %core.table_prefix%profile_lang - tables.posts: %core.table_prefix%posts - tables.topics: %core.table_prefix%topics - tables.user_notifications: %core.table_prefix%user_notifications - tables.users: %core.table_prefix%users diff --git a/phpBB/config/test/config.yml b/phpBB/config/test/config.yml new file mode 100644 index 0000000000..1c17b08931 --- /dev/null +++ b/phpBB/config/test/config.yml @@ -0,0 +1,5 @@ +imports: + - { resource: ../default/config.yml } + +core: + require_dev_dependencies: true diff --git a/phpBB/config/test/container/environment.yml b/phpBB/config/test/container/environment.yml new file mode 100644 index 0000000000..40a3c7a683 --- /dev/null +++ b/phpBB/config/test/container/environment.yml @@ -0,0 +1,3 @@ +imports: + - { resource: services.yml } + - { resource: parameters.yml } diff --git a/phpBB/config/test/container/parameters.yml b/phpBB/config/test/container/parameters.yml new file mode 100644 index 0000000000..0447646806 --- /dev/null +++ b/phpBB/config/test/container/parameters.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/parameters.yml } diff --git a/phpBB/config/test/container/services.yml b/phpBB/config/test/container/services.yml new file mode 100644 index 0000000000..b302f0f966 --- /dev/null +++ b/phpBB/config/test/container/services.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/services.yml } diff --git a/phpBB/config/test/routing/environment.yml b/phpBB/config/test/routing/environment.yml new file mode 100644 index 0000000000..301183bbae --- /dev/null +++ b/phpBB/config/test/routing/environment.yml @@ -0,0 +1,2 @@ +core.default: + resource: ../../default/routing/routing.yml diff --git a/phpBB/cron.php b/phpBB/cron.php index 787183f689..e134dbbe4c 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -33,75 +37,36 @@ function output_image() flush(); } -function do_cron($cron_lock, $run_tasks) -{ - global $config; - - foreach ($run_tasks as $task) - { - if (defined('DEBUG') && $config['use_system_cron']) - { - echo "[phpBB cron] Running task '{$task->get_name()}'\n"; - } - - $task->run(); - } - - // Unloading cache and closing db after having done the dirty work. - $cron_lock->release(); - garbage_collection(); -} - // Thanks to various fatal errors and lack of try/finally, it is quite easy to leave // the cron lock locked, especially when working on cron-related code. // // Attempt to alleviate the problem by doing setup outside of the lock as much as possible. -// -// If DEBUG is defined and cron lock cannot be obtained, a message will be printed. -if ($config['use_system_cron']) -{ - $cron = $phpbb_container->get('cron.manager'); -} -else -{ - $cron_type = request_var('cron_type', ''); +$cron_type = $request->variable('cron_type', ''); - // Comment this line out for debugging so the page does not return an image. - output_image(); -} +// Comment this line out for debugging so the page does not return an image. +output_image(); +/* @var $cron_lock \phpbb\lock\db */ $cron_lock = $phpbb_container->get('cron.lock_db'); if ($cron_lock->acquire()) { - if ($config['use_system_cron']) - { - $run_tasks = $cron->find_all_ready_tasks(); - } - else + /* @var $cron \phpbb\cron\manager */ + $cron = $phpbb_container->get('cron.manager'); + + $task = $cron->find_task($cron_type); + if ($task) { - // If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing - $run_tasks = array(); - $task = $cron->find_task($cron_type); - if ($task) + if ($task->is_parametrized()) { - if ($task->is_parametrized()) - { - $task->parse_parameters($request); - } - if ($task->is_ready()) - { - $run_tasks = array($task); - } + $task->parse_parameters($request); + } + if ($task->is_ready()) + { + $task->run(); } } - - do_cron($cron_lock, $run_tasks); -} -else -{ - if (defined('DEBUG')) - { - echo "Could not obtain cron lock.\n"; - } + $cron_lock->release(); } + +garbage_collection(); diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php index 449d931507..a6fc8d686c 100644 --- a/phpBB/develop/add_permissions.php +++ b/phpBB/develop/add_permissions.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2004 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -60,6 +64,7 @@ $f_permissions = array( 'f_vote' => array(1, 0), 'f_votechg' => array(1, 0), 'f_announce'=> array(1, 0), + 'f_announce_global' => array(1, 0), 'f_sticky' => array(1, 0), 'f_attach' => array(1, 0), 'f_download'=> array(1, 0), @@ -194,9 +199,9 @@ $prefixes = array('f_', 'a_', 'm_', 'u_'); foreach ($prefixes as $prefix) { $var = $prefix . 'permissions'; - if (sizeof($$var)) + if (sizeof(${$var})) { - foreach ($$var as $auth_option => $l_ary) + foreach (${$var} as $auth_option => $l_ary) { $sql_ary = array( 'auth_option' => $auth_option, @@ -367,7 +372,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting) switch ($sql_type) { case 'insert': - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': @@ -376,6 +381,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting) case 'mssql': case 'sqlite': + case 'sqlite3': $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); break; @@ -383,7 +389,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting) foreach ($sql_subary as $sql) { $sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) VALUES ($sql)"; - $result = $db->sql_query($sql); + $db->sql_query($sql); $sql = ''; } } @@ -391,7 +397,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting) if ($sql != '') { $sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) $sql"; - $result = $db->sql_query($sql); + $db->sql_query($sql); } break; @@ -399,7 +405,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting) case 'delete': foreach ($sql_subary as $sql) { - $result = $db->sql_query($sql); + $db->sql_query($sql); $sql = ''; } break; diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php index d5eaed3bc7..631b7d05ca 100644 --- a/phpBB/develop/benchmark.php +++ b/phpBB/develop/benchmark.php @@ -143,7 +143,7 @@ function filldb($newposts) if ((rand(0,30) < 1) || ($forum_topic_count[$forum] == 0)) { // create a new topic 1 in 30 times (or when there are none); - $topic = make_topic($userid, "Testing topic $i", $forum); + make_topic($userid, "Testing topic $i", $forum); $forum_topic_count[$forum]++; } else @@ -313,7 +313,7 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m else { // Rollback - if($db->sql_layer == "mysql") + if($db->get_sql_layer() == "mysql") { $sql = "DELETE FROM " . POSTS_TABLE . " WHERE post_id = $new_post_id"; @@ -366,15 +366,10 @@ function make_user($username) $password = md5("benchpass"); $email = "nobody@localhost"; - $icq = "12345678"; - $website = "http://www.phpbb.com"; $signature = "$username: phpBB tester."; $signature_bbcode_uid = ""; $avatar_filename = ""; $viewemail = 0; - $aim = 0; - $yim = 0; - $msn = 0; $attachsig = 1; $allowsmilies = 1; $allowhtml = 1; @@ -419,8 +414,8 @@ function make_user($username) } - $sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey) - VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$icq', '$website', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, "; + $sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey) + VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, "; $sql .= "1, '')"; diff --git a/phpBB/develop/calc_email_hash.php b/phpBB/develop/calc_email_hash.php index c73fd26e17..740f9158cf 100644 --- a/phpBB/develop/calc_email_hash.php +++ b/phpBB/develop/calc_email_hash.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2004 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/develop/change_smiley_ref.php b/phpBB/develop/change_smiley_ref.php index 0a3108947a..a2315bc382 100644 --- a/phpBB/develop/change_smiley_ref.php +++ b/phpBB/develop/change_smiley_ref.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2003 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php index 5946f685b8..5dc112bfc0 100644 --- a/phpBB/develop/check_flash_bbcodes.php +++ b/phpBB/develop/check_flash_bbcodes.php @@ -1,14 +1,20 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2009, 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * -* This script will check your database for potentially dangerous flash BBCode tags +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +/** +* This script will check your database for potentially dangerous flash BBCode tags +*/ + // // Security message: // @@ -134,8 +140,12 @@ function html_entity_decode_utf8($string) static $trans_tbl; // replace numeric entities - $string = preg_replace('~&#x([0-9a-f]+);~ei', 'code2utf8(hexdec("\\1"))', $string); - $string = preg_replace('~&#([0-9]+);~e', 'code2utf8(\\1)', $string); + $string = preg_replace_callback('~&#x([0-9a-f]+);~i', function ($match) { + return code2utf8(hexdec($match[1])); + }, $string); + $string = preg_replace_callback('~&#([0-9]+);~', function ($match) { + return code2utf8($match[1]); + }, $string); // replace literal entities if (!isset($trans_tbl)) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 5ef278d493..09bc4c4085 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1,10 +1,17 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** * This file creates new schema files for every database. * The filenames will be prefixed with an underscore to not overwrite the current schema files. * @@ -12,6 +19,15 @@ */ $schema_path = dirname(__FILE__) . '/../install/schemas/'; +$supported_dbms = array( + 'mssql', + 'mysql_40', + 'mysql_41', + 'oracle', + 'postgres', + 'sqlite', +); +$table_prefix = 'phpbb_'; if (!is_writable($schema_path)) { @@ -19,700 +35,29 @@ if (!is_writable($schema_path)) } define('IN_PHPBB', true); +$phpbb_root_path = dirname(__FILE__) . '/../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); -require(dirname(__FILE__) . '/../includes/db/schema_data.php'); -require(dirname(__FILE__) . '/../phpbb/db/tools.php'); - -$dbms_type_map = phpbb\db\tools::get_dbms_type_map(); - -// A list of types being unsigned for better reference in some db's -$unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); -$supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); - -foreach ($supported_dbms as $dbms) -{ - $fp = fopen($schema_path . $dbms . '_schema.sql', 'wb'); - - $line = ''; - - // Write Header - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - case 'firebird': - case 'sqlite': - fwrite($fp, "# DO NOT EDIT THIS FILE, IT IS GENERATED\n"); - fwrite($fp, "#\n"); - fwrite($fp, "# To change the contents of this file, edit\n"); - fwrite($fp, "# phpBB/develop/create_schema_files.php and\n"); - fwrite($fp, "# run it.\n"); - break; - - case 'mssql': - case 'oracle': - case 'postgres': - fwrite($fp, "/*\n"); - fwrite($fp, " * DO NOT EDIT THIS FILE, IT IS GENERATED\n"); - fwrite($fp, " *\n"); - fwrite($fp, " * To change the contents of this file, edit\n"); - fwrite($fp, " * phpBB/develop/create_schema_files.php and\n"); - fwrite($fp, " * run it.\n"); - fwrite($fp, " */\n\n"); - break; - } - - switch ($dbms) - { - case 'firebird': - $line .= custom_data('firebird') . "\n"; - break; - - case 'sqlite': - $line .= "BEGIN TRANSACTION;\n\n"; - break; - - case 'oracle': - $line .= custom_data('oracle') . "\n"; - break; - - case 'postgres': - $line .= "BEGIN;\n\n"; - $line .= custom_data('postgres') . "\n"; - break; - } - - fwrite($fp, $line); - - foreach ($schema_data as $table_name => $table_data) - { - // Write comment about table - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - case 'firebird': - case 'sqlite': - fwrite($fp, "# Table: '{$table_name}'\n"); - break; - - case 'mssql': - case 'oracle': - case 'postgres': - fwrite($fp, "/*\n\tTable: '{$table_name}'\n*/\n"); - break; - } - - // Create Table statement - $generator = $textimage = false; - $line = ''; - - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - case 'firebird': - case 'oracle': - case 'sqlite': - case 'postgres': - $line = "CREATE TABLE {$table_name} (\n"; - break; - - case 'mssql': - $line = "CREATE TABLE [{$table_name}] (\n"; - break; - } - - // Table specific so we don't get overlap - $modded_array = array(); - - // Write columns one by one... - foreach ($table_data['COLUMNS'] as $column_name => $column_data) - { - if (strlen($column_name) > 30) - { - trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); - } - if (isset($column_data[2]) && $column_data[2] == 'auto_increment' && strlen($column_name) > 26) // "${column_name}_gen" - { - trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); - } - - // Get type - if (strpos($column_data[0], ':') !== false) - { - list($orig_column_type, $column_length) = explode(':', $column_data[0]); - if (!is_array($dbms_type_map[$dbms][$orig_column_type . ':'])) - { - $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'], $column_length); - } - else - { - if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['rule'])) - { - switch ($dbms_type_map[$dbms][$orig_column_type . ':']['rule'][0]) - { - case 'div': - $column_length /= $dbms_type_map[$dbms][$orig_column_type . ':']['rule'][1]; - $column_length = ceil($column_length); - $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); - break; - } - } - - if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['limit'])) - { - switch ($dbms_type_map[$dbms][$orig_column_type . ':']['limit'][0]) - { - case 'mult': - $column_length *= $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][1]; - if ($column_length > $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][2]) - { - $column_type = $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][3]; - $modded_array[$column_name] = $column_type; - } - else - { - $column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); - } - break; - } - } - } - $orig_column_type .= ':'; - } - else - { - $orig_column_type = $column_data[0]; - $column_type = $dbms_type_map[$dbms][$column_data[0]]; - if ($column_type == 'text' || $column_type == 'blob') - { - $modded_array[$column_name] = $column_type; - } - } - - // Adjust default value if db-dependent specified - if (is_array($column_data[1])) - { - $column_data[1] = (isset($column_data[1][$dbms])) ? $column_data[1][$dbms] : $column_data[1]['default']; - } - - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - $line .= "\t{$column_name} {$column_type} "; - - // For hexadecimal values do not use single quotes - if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') - { - $line .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; - } - $line .= 'NOT NULL'; - - if (isset($column_data[2])) - { - if ($column_data[2] == 'auto_increment') - { - $line .= ' auto_increment'; - } - else if ($dbms === 'mysql_41' && $column_data[2] == 'true_sort') - { - $line .= ' COLLATE utf8_unicode_ci'; - } - } - - $line .= ",\n"; - break; - - case 'sqlite': - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $line .= "\t{$column_name} INTEGER PRIMARY KEY "; - $generator = $column_name; - } - else - { - $line .= "\t{$column_name} {$column_type} "; - } - - $line .= 'NOT NULL '; - $line .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; - $line .= ",\n"; - break; - - case 'firebird': - $line .= "\t{$column_name} {$column_type} "; - - if (!is_null($column_data[1])) - { - $line .= 'DEFAULT ' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' '; - } - - $line .= 'NOT NULL'; - - // This is a UNICODE column and thus should be given it's fair share - if (preg_match('/^X?STEXT_UNI|VCHAR_(CI|UNI:?)/', $column_data[0])) - { - $line .= ' COLLATE UNICODE'; - } - - $line .= ",\n"; - - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $generator = $column_name; - } - break; - - case 'mssql': - if ($column_type == '[text]') - { - $textimage = true; - } - - $line .= "\t[{$column_name}] {$column_type} "; - - if (!is_null($column_data[1])) - { - // For hexadecimal values do not use single quotes - if (strpos($column_data[1], '0x') === 0) - { - $line .= 'DEFAULT (' . $column_data[1] . ') '; - } - else - { - $line .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; - } - } - - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $line .= 'IDENTITY (1, 1) '; - } - - $line .= 'NOT NULL'; - $line .= " ,\n"; - break; - - case 'oracle': - $line .= "\t{$column_name} {$column_type} "; - $line .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; - - // In Oracle empty strings ('') are treated as NULL. - // Therefore in oracle we allow NULL's for all DEFAULT '' entries - $line .= ($column_data[1] === '') ? ",\n" : "NOT NULL,\n"; - - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $generator = $column_name; - } - break; - - case 'postgres': - $line .= "\t{$column_name} {$column_type} "; - - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $line .= "DEFAULT nextval('{$table_name}_seq'),\n"; - - // Make sure the sequence will be created before creating the table - $line = "CREATE SEQUENCE {$table_name}_seq;\n\n" . $line; - } - else - { - $line .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; - $line .= "NOT NULL"; - - // Unsigned? Then add a CHECK contraint - if (in_array($orig_column_type, $unsigned_types)) - { - $line .= " CHECK ({$column_name} >= 0)"; - } - - $line .= ",\n"; - } - break; - } - } - - switch ($dbms) - { - case 'firebird': - // Remove last line delimiter... - $line = substr($line, 0, -2); - $line .= "\n);;\n\n"; - break; - - case 'mssql': - $line = substr($line, 0, -2); - $line .= "\n) ON [PRIMARY]" . (($textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : '') . "\n"; - $line .= "GO\n\n"; - break; - } - - // Write primary key - if (isset($table_data['PRIMARY_KEY'])) - { - if (!is_array($table_data['PRIMARY_KEY'])) - { - $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); - } - - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - case 'postgres': - $line .= "\tPRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . "),\n"; - break; - - case 'firebird': - $line .= "ALTER TABLE {$table_name} ADD PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ");;\n\n"; - break; +include($phpbb_root_path . 'vendor/autoload.php'); +include($phpbb_root_path . 'includes/constants.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); - case 'sqlite': - if ($generator === false || !in_array($generator, $table_data['PRIMARY_KEY'])) - { - $line .= "\tPRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . "),\n"; - } - break; +$finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path); +$classes = $finder->core_path('phpbb/') + ->directory('/db/migration/data') + ->get_classes(); - case 'mssql': - $line .= "ALTER TABLE [{$table_name}] WITH NOCHECK ADD \n"; - $line .= "\tCONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED \n"; - $line .= "\t(\n"; - $line .= "\t\t[" . implode("],\n\t\t[", $table_data['PRIMARY_KEY']) . "]\n"; - $line .= "\t) ON [PRIMARY] \n"; - $line .= "GO\n\n"; - break; +$db = new \phpbb\db\driver\sqlite(); +$factory = new \phpbb\db\tools\factory(); +$db_tools = $factory->get($db, true); - case 'oracle': - $line .= "\tCONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . "),\n"; - break; - } - } +$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix); +$schema_data = $schema_generator->get_schema(); - switch ($dbms) - { - case 'oracle': - // UNIQUE contrains to be added? - if (isset($table_data['KEYS'])) - { - foreach ($table_data['KEYS'] as $key_name => $key_data) - { - if (!is_array($key_data[1])) - { - $key_data[1] = array($key_data[1]); - } - - if ($key_data[0] == 'UNIQUE') - { - $line .= "\tCONSTRAINT u_phpbb_{$key_name} UNIQUE (" . implode(', ', $key_data[1]) . "),\n"; - } - } - } - - // Remove last line delimiter... - $line = substr($line, 0, -2); - $line .= "\n)\n/\n\n"; - break; - - case 'postgres': - // Remove last line delimiter... - $line = substr($line, 0, -2); - $line .= "\n);\n\n"; - break; - - case 'sqlite': - // Remove last line delimiter... - $line = substr($line, 0, -2); - $line .= "\n);\n\n"; - break; - } - - // Write Keys - if (isset($table_data['KEYS'])) - { - foreach ($table_data['KEYS'] as $key_name => $key_data) - { - if (!is_array($key_data[1])) - { - $key_data[1] = array($key_data[1]); - } - - if (strlen($table_name . $key_name) > 30) - { - trigger_error("Index name '${table_name}_$key_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); - } - - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - $line .= ($key_data[0] == 'INDEX') ? "\tKEY" : ''; - $line .= ($key_data[0] == 'UNIQUE') ? "\tUNIQUE" : ''; - foreach ($key_data[1] as $key => $col_name) - { - if (isset($modded_array[$col_name])) - { - switch ($modded_array[$col_name]) - { - case 'text': - case 'blob': - $key_data[1][$key] = $col_name . '(255)'; - break; - } - } - } - $line .= ' ' . $key_name . ' (' . implode(', ', $key_data[1]) . "),\n"; - break; - - case 'firebird': - $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; - $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; - - $line .= ' ' . $table_name . '_' . $key_name . ' ON ' . $table_name . '(' . implode(', ', $key_data[1]) . ");;\n"; - break; - - case 'mssql': - $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; - $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; - $line .= " [{$key_name}] ON [{$table_name}]([" . implode('], [', $key_data[1]) . "]) ON [PRIMARY]\n"; - $line .= "GO\n\n"; - break; - - case 'oracle': - if ($key_data[0] == 'UNIQUE') - { - continue; - } - - $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; - - $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ")\n"; - $line .= "/\n"; - break; - - case 'sqlite': - $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; - $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; - - $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ");\n"; - break; - - case 'postgres': - $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : ''; - $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : ''; - - $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ");\n"; - break; - } - } - } - - switch ($dbms) - { - case 'mysql_40': - // Remove last line delimiter... - $line = substr($line, 0, -2); - $line .= "\n);\n\n"; - break; - - case 'mysql_41': - // Remove last line delimiter... - $line = substr($line, 0, -2); - $line .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;\n\n"; - break; - - // Create Generator - case 'firebird': - if ($generator !== false) - { - $line .= "\nCREATE GENERATOR {$table_name}_gen;;\n"; - $line .= 'SET GENERATOR ' . $table_name . "_gen TO 0;;\n\n"; - - $line .= 'CREATE TRIGGER t_' . $table_name . ' FOR ' . $table_name . "\n"; - $line .= "BEFORE INSERT\nAS\nBEGIN\n"; - $line .= "\tNEW.{$generator} = GEN_ID({$table_name}_gen, 1);\nEND;;\n\n"; - } - break; - - case 'oracle': - if ($generator !== false) - { - $line .= "\nCREATE SEQUENCE {$table_name}_seq\n/\n\n"; - - $line .= "CREATE OR REPLACE TRIGGER t_{$table_name}\n"; - $line .= "BEFORE INSERT ON {$table_name}\n"; - $line .= "FOR EACH ROW WHEN (\n"; - $line .= "\tnew.{$generator} IS NULL OR new.{$generator} = 0\n"; - $line .= ")\nBEGIN\n"; - $line .= "\tSELECT {$table_name}_seq.nextval\n"; - $line .= "\tINTO :new.{$generator}\n"; - $line .= "\tFROM dual;\nEND;\n/\n\n"; - } - break; - } - - fwrite($fp, $line . "\n"); - } - - $line = ''; - - // Write custom function at the end for some db's - switch ($dbms) - { - case 'mssql': - // No need to do this, no transaction support for schema changes - //$line = "\nCOMMIT\nGO\n\n"; - break; - - case 'sqlite': - $line = "\nCOMMIT;"; - break; - - case 'postgres': - $line = "\nCOMMIT;"; - break; - } - - fwrite($fp, $line); - fclose($fp); -} - -/** -* Data put into the header for various dbms -*/ -function custom_data($dbms) -{ - switch ($dbms) - { - case 'oracle': - return <<<EOF -/* - This first section is optional, however its probably the best method - of running phpBB on Oracle. If you already have a tablespace and user created - for phpBB you can leave this section commented out! - - The first set of statements create a phpBB tablespace and a phpBB user, - make sure you change the password of the phpBB user before you run this script!! -*/ - -/* -CREATE TABLESPACE "PHPBB" - LOGGING - DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora' - SIZE 10M - AUTOEXTEND ON NEXT 10M - MAXSIZE 100M; - -CREATE USER "PHPBB" - PROFILE "DEFAULT" - IDENTIFIED BY "phpbb_password" - DEFAULT TABLESPACE "PHPBB" - QUOTA UNLIMITED ON "PHPBB" - ACCOUNT UNLOCK; - -GRANT ANALYZE ANY TO "PHPBB"; -GRANT CREATE SEQUENCE TO "PHPBB"; -GRANT CREATE SESSION TO "PHPBB"; -GRANT CREATE TABLE TO "PHPBB"; -GRANT CREATE TRIGGER TO "PHPBB"; -GRANT CREATE VIEW TO "PHPBB"; -GRANT "CONNECT" TO "PHPBB"; - -COMMIT; -DISCONNECT; - -CONNECT phpbb/phpbb_password; -*/ -EOF; - - break; - - case 'postgres': - return <<<EOF -/* - Domain definition -*/ -CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying; - -/* - Operation Functions -*/ -CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT; -CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT; - -/* - Operators -*/ -CREATE OPERATOR <( - PROCEDURE = _varchar_ci_less_than, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = >, - NEGATOR = >=, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel); - -CREATE OPERATOR <=( - PROCEDURE = _varchar_ci_less_equal, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = >=, - NEGATOR = >, - RESTRICT = scalarltsel, - JOIN = scalarltjoinsel); - -CREATE OPERATOR >( - PROCEDURE = _varchar_ci_greater_than, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = <, - NEGATOR = <=, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel); - -CREATE OPERATOR >=( - PROCEDURE = _varchar_ci_greater_equals, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = <=, - NEGATOR = <, - RESTRICT = scalargtsel, - JOIN = scalargtjoinsel); - -CREATE OPERATOR <>( - PROCEDURE = _varchar_ci_not_equal, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = <>, - NEGATOR = =, - RESTRICT = neqsel, - JOIN = neqjoinsel); - -CREATE OPERATOR =( - PROCEDURE = _varchar_ci_equal, - LEFTARG = varchar_ci, - RIGHTARG = varchar_ci, - COMMUTATOR = =, - NEGATOR = <>, - RESTRICT = eqsel, - JOIN = eqjoinsel, - HASHES, - MERGES, - SORT1= <); - -EOF; - break; - } - - return ''; -} +$fp = fopen($schema_path . 'schema.json', 'wb'); +fwrite($fp, json_encode($schema_data, JSON_PRETTY_PRINT)); +fclose($fp); -echo 'done'; +echo 'Successfully created schema file'; diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php index f329b805a0..6ef200699c 100644 --- a/phpBB/develop/create_search_index.php +++ b/phpBB/develop/create_search_index.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -128,7 +132,7 @@ else $search->tidy(); -add_log('admin', 'LOG_SEARCH_INDEX_CREATED', $search_name); +$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_CREATED', false, array($search_name)); echo $user->lang['SEARCH_INDEX_CREATED'] . "\n"; echo 'Peak Memory Usage: ' . get_formatted_filesize(memory_get_peak_usage()) . "\n"; diff --git a/phpBB/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php index e65de130b3..ace2e4d953 100644 --- a/phpBB/develop/create_variable_overview.php +++ b/phpBB/develop/create_variable_overview.php @@ -1,13 +1,19 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2003 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** * This script generates an index of some template vars and their use within the templates. * It writes down all language variables used by various templates. -* */ // @@ -77,7 +83,7 @@ $html_skeleton .= '<br><br><a name="ref"></a><b>References: </b>{SEE_FILES}'; $html_skeleton .= ' <br><br> -<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group</div> +<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited</div> <br clear="all" /></td> </tr> @@ -399,7 +405,7 @@ $html_data .= '<br><li><a href="./lang_index.html" class="gen">Appendix A: Langu $html_data .= ' </ol><br><br> -<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group</div> +<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited</div> <br clear="all" /></td> </tr> @@ -522,7 +528,7 @@ foreach ($lang_fp as $filepointer) $html_data .= ' <br><br> -<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group</div> +<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited</div> <br clear="all" /></td> </tr> diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php index b276b4c5fa..be16e5e7cd 100644 --- a/phpBB/develop/export_events_for_wiki.php +++ b/phpBB/develop/export_events_for_wiki.php @@ -1,8 +1,13 @@ <?php /** * -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,294 +18,120 @@ if (php_sapi_name() != 'cli') $phpEx = substr(strrchr(__FILE__, '.'), 1); $phpbb_root_path = __DIR__ . '/../'; +define('IN_PHPBB', true); function usage() { - echo "Usage: export_events_for_wiki.php COMMAND\n"; + echo "Usage: export_events_for_wiki.php COMMAND [VERSION] [EXTENSION]\n"; + echo "\n"; + echo "COMMAND:\n"; + echo " all:\n"; + echo " Generate the complete wikipage for https://wiki.phpbb.com/Event_List\n"; + echo "\n"; + echo " diff:\n"; + echo " Generate the Event Diff for the release highlights\n"; + echo "\n"; + echo " php:\n"; + echo " Generate the PHP event section of Event_List\n"; + echo "\n"; + echo " adm:\n"; + echo " Generate the ACP Template event section of Event_List\n"; echo "\n"; - echo "acp:\n"; - echo " Export all events for files in the acp style.\n"; + echo " styles:\n"; + echo " Generate the Styles Template event section of Event_List\n"; echo "\n"; - echo "styles:\n"; - echo " Export all events for files in the prosilver and subsilver2 styles.\n"; + echo "VERSION (diff only):\n"; + echo " Filter events (minimum version)\n"; + echo "\n"; + echo "EXTENSION (Optional):\n"; + echo " If not given, only core events will be exported.\n"; + echo " Otherwise only events from the extension will be exported.\n"; echo "\n"; - echo "php:\n"; - echo " Export all events for php-files.\n"; exit(2); } -function export_from_eventsmd($phpbb_root_path, $filter) +function validate_argument_count($arguments, $count) { - $file_content = file_get_contents($phpbb_root_path . 'docs/events.md'); - - $events = explode("\n\n", $file_content); - foreach ($events as $event) + if ($arguments <= $count) { - // Last row of the file - if (strpos($event, "\n===\n") === false) continue; + usage(); + } +} - list($event_name, $details) = explode("\n===\n", $event); +validate_argument_count($argc, 1); - if ($filter == 'acp' && strpos($event_name, 'acp_') !== 0) continue; - if ($filter == 'styles' && strpos($event_name, 'acp_') === 0) continue; +$action = $argv[1]; +$extension = isset($argv[2]) ? $argv[2] : null; +$min_version = null; +require __DIR__ . '/../phpbb/event/php_exporter.' . $phpEx; +require __DIR__ . '/../phpbb/event/md_exporter.' . $phpEx; +require __DIR__ . '/../includes/functions.' . $phpEx; +require __DIR__ . '/../phpbb/event/recursive_event_filter_iterator.' . $phpEx; +require __DIR__ . '/../phpbb/recursive_dot_prefix_filter_iterator.' . $phpEx; - list($file_details, $details) = explode("\n* Since: ", $details); - list($version, $explanition) = explode("\n* Purpose: ", $details); +switch ($action) +{ - echo "|- id=\"{$event_name}\"\n"; - echo "| [[#{$event_name}|{$event_name}]] || "; + case 'diff': + echo '== Event changes ==' . "\n"; + $min_version = $extension; + $extension = isset($argv[3]) ? $argv[3] : null; - if (strpos($file_details, "* Locations:\n + ") === 0) - { - $file_details = substr($file_details, strlen("* Locations:\n + ")); - $files = explode("\n + ", $file_details); - $prosilver = $subsilver2 = array(); - foreach ($files as $file) - { - if (strpos($file, 'styles/prosilver/template/') === 0) - { - $prosilver[] = substr($file, strlen('styles/prosilver/template/')); - } - if (strpos($file, 'styles/subsilver2/template/') === 0) - { - $subsilver2[] = substr($file, strlen('styles/subsilver2/template/')); - } - } - echo implode(', ', $prosilver) . ' || ' . implode(', ', $subsilver2); - } - else if ($filter == 'acp') + case 'all': + if ($action === 'all') { - echo substr($file_details, strlen("* Location: adm/style/")); + echo '__FORCETOC__' . "\n"; } - echo " || {$version} || " . str_replace("\n", ' ', $explanition) . "\n"; - } -} -function export_from_php($phpbb_root_path) -{ - $files = get_file_list($phpbb_root_path); - $events = array(); - foreach ($files as $file) - { - $file_events = check_for_events($phpbb_root_path, $file); - if (!empty($file_events)) + case 'php': + $exporter = new \phpbb\event\php_exporter($phpbb_root_path, $extension, $min_version); + $exporter->crawl_phpbb_directory_php(); + echo $exporter->export_events_for_wiki($action); + + if ($action === 'php') { - $events = array_merge($events, $file_events); + break; } - } - - ksort($events); + echo "\n"; + // no break; - foreach ($events as $event) - { - echo '|- id="' . $event['event'] . '"' . "\n"; - echo '| [[#' . $event['event'] . '|' . $event['event'] . ']] || ' . $event['file'] . ' || ' . implode(', ', $event['arguments']) . ' || ' . $event['since'] . ' || ' . $event['description'] . "\n"; - } -} - -function check_for_events($phpbb_root_path, $file) -{ - $events = array(); - $content = file_get_contents($phpbb_root_path . $file); - - if (strpos($content, "phpbb_dispatcher->trigger_event('") || strpos($content, "phpbb_dispatcher->dispatch('")) - { - $lines = explode("\n", $content); - for ($i = 0, $num_lines = sizeof($lines); $i < $num_lines; $i++) + case 'styles': + $exporter = new \phpbb\event\md_exporter($phpbb_root_path, $extension, $min_version); + if ($min_version && $action === 'diff') { - $event_line = 0; - if ($found_trigger_event = strpos($lines[$i], "phpbb_dispatcher->trigger_event('")) - { - $event_line = $i; - $event_name = $lines[$event_line]; - $event_name = substr($event_name, $found_trigger_event + strlen("phpbb_dispatcher->trigger_event('")); - $event_name = substr($event_name, 0, strpos($event_name, "'")); - - // Find $vars array lines - $find_varsarray_line = 1; - while (strpos($lines[$event_line - $find_varsarray_line], "vars = array('") === false) - { - $find_varsarray_line++; - - if ($find_varsarray_line > min(50, $event_line)) - { - throw new LogicException('Can not find "$vars = array()"-line for event "' . $event_name . '" in file "' . $file . '"'); - } - } - $varsarray = substr(trim($lines[$event_line - $find_varsarray_line]), strlen("\$vars = array('"), -3); - $arguments = explode("', '", $varsarray); - - // Validate $vars array with @var - $find_vars_line = 3; - $doc_vars = array(); - while (strpos(trim($lines[$event_line - $find_vars_line]), '*') === 0) - { - $var_line = trim($lines[$event_line - $find_vars_line]); - $var_line = preg_replace('!\s+!', ' ', $var_line); - if (strpos($var_line, '* @var ') === 0) - { - $doc_line = explode(' ', $var_line); - if (isset($doc_line[3])) - { - $doc_vars[] = $doc_line[3]; - } - } - $find_vars_line++; - } - if (sizeof($arguments) !== sizeof($doc_vars) && array_intersect($arguments, $doc_vars)) - { - throw new LogicException('$vars array does not match the list of @var tags for event "' . $event_name . '" in file "' . $file . '"'); - } - } - else if ($found_trigger_event = strpos($lines[$i], "phpbb_dispatcher->dispatch('")) - { - $event_line = $i; - $event_name = $lines[$event_line]; - $event_name = substr($event_name, $found_trigger_event + strlen("phpbb_dispatcher->dispatch('")); - $event_name = substr($event_name, 0, strpos($event_name, "'")); - $arguments = array(); - } - - if ($event_line) - { - // Validate @event name - $find_event_line = 1; - while (strpos($lines[$event_line - $find_event_line], '* @event ') === false) - { - $find_event_line++; - - if ($find_event_line > min(50, $event_line)) - { - throw new LogicException('Can not find @event tag for event "' . $event_name . '" in file "' . $file . '"'); - } - } - $event_name_tag = substr(trim($lines[$event_line - $find_event_line]), strlen('* @event ')); - if ($event_name_tag !== $event_name) - { - throw new LogicException('Event name does not match @event tag for event "' . $event_name . '" in file "' . $file . '"'); - } - - // Find @since - $find_since_line = 1; - while (strpos($lines[$event_line - $find_since_line], '* @since ') === false) - { - $find_since_line++; - - if ($find_since_line > min(50, $event_line)) - { - throw new LogicException('Can not find @since tag for event "' . $event_name . '" in file "' . $file . '"'); - } - } - $since = substr(trim($lines[$event_line - $find_since_line]), strlen('* @since ')); - $since = ($since == '3.1-A1') ? '3.1.0-a1' : $since; - - // Find event description line - $find_description_line = 3; - while (strpos(trim($lines[$event_line - $find_description_line]), '*') === 0) - { - $find_description_line++; - - if ($find_description_line > min(50, $event_line)) - { - throw new LogicException('Can not find description-line for event "' . $event_name . '" in file "' . $file . '"'); - } - } - $description = substr(trim($lines[$event_line - $find_description_line + 1]), strlen('* ')); - - $events[$event_name] = array( - 'event' => $event_name, - 'file' => $file, - 'arguments' => $arguments, - 'since' => $since, - 'description' => $description, - ); - } + $exporter->crawl_eventsmd('docs/events.md', 'styles'); } - } - - return $events; -} - -/** -* Returns a list of files in that directory -* -* Works recursive with any depth -* -* @param string $dir Directory to go through -* @return array List of files (including directories from within $dir -*/ -function get_file_list($dir, $path = '') -{ - try - { - $iterator = new \DirectoryIterator($dir); - } - catch (Exception $e) - { - return array(); - } - - $files = array(); - foreach ($iterator as $file_info) - { - if ($file_info->isDot()) + else { - continue; + $exporter->crawl_phpbb_directory_styles('docs/events.md'); } + echo $exporter->export_events_for_wiki($action); - // Do not scan some directories - if ($file_info->isDir() && ( - ($path == '' && in_array($file_info->getFilename(), array('cache', 'develop', 'ext', 'files', 'language', 'store', 'vendor'))) - || ($path == '/includes' && in_array($file_info->getFilename(), array('utf'))) - || ($path == '/phpbb/db/migration' && in_array($file_info->getFilename(), array('data'))) - || ($path == '/phpbb' && in_array($file_info->getFilename(), array('event'))) - )) + if ($action === 'styles') { - continue; + break; } - else if ($file_info->isDir()) + echo "\n"; + // no break; + + case 'adm': + $exporter = new \phpbb\event\md_exporter($phpbb_root_path, $extension, $min_version); + if ($min_version && $action === 'diff') { - $sub_dir = get_file_list($file_info->getPath() . '/' . $file_info->getFilename(), $path . '/' . $file_info->getFilename()); - foreach ($sub_dir as $file) - { - $files[] = $file_info->getFilename() . '/' . $file; - } + $exporter->crawl_eventsmd('docs/events.md', 'adm'); } - else if ($file_info->getExtension() == 'php') + else { - $files[] = $file_info->getFilename(); + $exporter->crawl_phpbb_directory_adm('docs/events.md'); } - } - - return $files; -} - -function validate_argument_count($arguments, $count) -{ - if ($arguments <= $count) - { - usage(); - } -} - -validate_argument_count($argc, 1); + echo $exporter->export_events_for_wiki($action); -$action = $argv[1]; - -switch ($action) -{ - case 'acp': - export_from_eventsmd($phpbb_root_path, 'acp'); - break; - - case 'styles': - export_from_eventsmd($phpbb_root_path, 'styles'); - break; - - case 'php': - export_from_php($phpbb_root_path); - break; + if ($action === 'all') + { + echo "\n" . '[[Category:Events and Listeners]]' . "\n"; + } + break; default: usage(); diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index 696b1e31c0..2aaafe1e38 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2001, 2003 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -38,8 +42,8 @@ $posts_per_topic = 500; // general vars -$mode = request_var('mode', 'generate'); -$start = request_var('start', 0); +$mode = $request->variable('mode', 'generate'); +$start = $request->variable('start', 0); switch ($mode) { diff --git a/phpBB/develop/generate_utf_casefold.php b/phpBB/develop/generate_utf_casefold.php index ad511a6153..3412ddd106 100644 --- a/phpBB/develop/generate_utf_casefold.php +++ b/phpBB/develop/generate_utf_casefold.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/develop/generate_utf_confusables.php b/phpBB/develop/generate_utf_confusables.php index 763d8ee875..9c9109259b 100644 --- a/phpBB/develop/generate_utf_confusables.php +++ b/phpBB/develop/generate_utf_confusables.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/develop/generate_utf_tables.php b/phpBB/develop/generate_utf_tables.php index e5d907d6a5..888c07676d 100644 --- a/phpBB/develop/generate_utf_tables.php +++ b/phpBB/develop/generate_utf_tables.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -28,262 +32,11 @@ $phpbb_root_path = '../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); echo "Checking for required files\n"; -download('http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt'); -download('http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt'); download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt'); echo "\n"; -require_once($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); -$file_contents = array(); - /** -* Generate some Hangul/Jamo stuff -*/ -echo "\nGenerating Hangul and Jamo tables\n"; -for ($i = 0; $i < UNICODE_HANGUL_LCOUNT; ++$i) -{ - $utf_char = cp_to_utf(UNICODE_HANGUL_LBASE + $i); - $file_contents['utf_normalizer_common']['utf_jamo_index'][$utf_char] = $i * UNICODE_HANGUL_VCOUNT * UNICODE_HANGUL_TCOUNT + UNICODE_HANGUL_SBASE; - $file_contents['utf_normalizer_common']['utf_jamo_type'][$utf_char] = UNICODE_JAMO_L; -} - -for ($i = 0; $i < UNICODE_HANGUL_VCOUNT; ++$i) -{ - $utf_char = cp_to_utf(UNICODE_HANGUL_VBASE + $i); - $file_contents['utf_normalizer_common']['utf_jamo_index'][$utf_char] = $i * UNICODE_HANGUL_TCOUNT; - $file_contents['utf_normalizer_common']['utf_jamo_type'][$utf_char] = UNICODE_JAMO_V; -} - -for ($i = 0; $i < UNICODE_HANGUL_TCOUNT; ++$i) -{ - $utf_char = cp_to_utf(UNICODE_HANGUL_TBASE + $i); - $file_contents['utf_normalizer_common']['utf_jamo_index'][$utf_char] = $i; - $file_contents['utf_normalizer_common']['utf_jamo_type'][$utf_char] = UNICODE_JAMO_T; -} - -/** -* Load the CompositionExclusions table -*/ -echo "Loading CompositionExclusion\n"; -$fp = fopen('CompositionExclusions.txt', 'rt'); - -$exclude = array(); -while (!feof($fp)) -{ - $line = fgets($fp, 1024); - - if (!strpos(' 0123456789ABCDEFabcdef', $line[0])) - { - continue; - } - - $cp = strtok($line, ' '); - - if ($pos = strpos($cp, '..')) - { - $start = hexdec(substr($cp, 0, $pos)); - $end = hexdec(substr($cp, $pos + 2)); - - for ($i = $start; $i < $end; ++$i) - { - $exclude[$i] = 1; - } - } - else - { - $exclude[hexdec($cp)] = 1; - } -} -fclose($fp); - -/** -* Load QuickCheck tables -*/ -echo "Generating QuickCheck tables\n"; -$fp = fopen('DerivedNormalizationProps.txt', 'rt'); - -while (!feof($fp)) -{ - $line = fgets($fp, 1024); - - if (!strpos(' 0123456789ABCDEFabcdef', $line[0])) - { - continue; - } - - $p = array_map('trim', explode(';', strtok($line, '#'))); - - /** - * Capture only NFC_QC, NFKC_QC - */ - if (!preg_match('#^NFK?C_QC$#', $p[1])) - { - continue; - } - - if ($pos = strpos($p[0], '..')) - { - $start = hexdec(substr($p[0], 0, $pos)); - $end = hexdec(substr($p[0], $pos + 2)); - } - else - { - $start = $end = hexdec($p[0]); - } - - if ($start >= UTF8_HANGUL_FIRST && $end <= UTF8_HANGUL_LAST) - { - /** - * We do not store Hangul syllables in the array - */ - continue; - } - - if ($p[2] == 'M') - { - $val = UNICODE_QC_MAYBE; - } - else - { - $val = UNICODE_QC_NO; - } - - if ($p[1] == 'NFKC_QC') - { - $file = 'utf_nfkc_qc'; - } - else - { - $file = 'utf_nfc_qc'; - } - - for ($i = $start; $i <= $end; ++$i) - { - /** - * The vars have the same name as the file: $utf_nfc_qc is in utf_nfc_qc.php - */ - $file_contents[$file][$file][cp_to_utf($i)] = $val; - } -} -fclose($fp); - -/** -* Do mappings -*/ -echo "Loading Unicode decomposition mappings\n"; -$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt'); - -$map = array(); -while (!feof($fp)) -{ - $p = explode(';', fgets($fp, 1024)); - $cp = hexdec($p[0]); - - if (!empty($p[3])) - { - /** - * Store combining class > 0 - */ - $file_contents['utf_normalizer_common']['utf_combining_class'][cp_to_utf($cp)] = (int) $p[3]; - } - - if (!isset($p[5]) || !preg_match_all('#[0-9A-F]+#', strip_tags($p[5]), $m)) - { - continue; - } - - if (strpos($p[5], '>')) - { - $map['NFKD'][$cp] = implode(' ', array_map('hexdec', $m[0])); - } - else - { - $map['NFD'][$cp] = $map['NFKD'][$cp] = implode(' ', array_map('hexdec', $m[0])); - } -} -fclose($fp); - -/** -* Build the canonical composition table -*/ -echo "Generating the Canonical Composition table\n"; -foreach ($map['NFD'] as $cp => $decomp_seq) -{ - if (!strpos($decomp_seq, ' ') || isset($exclude[$cp])) - { - /** - * Singletons are excluded from canonical composition - */ - continue; - } - - $utf_seq = implode('', array_map('cp_to_utf', explode(' ', $decomp_seq))); - - if (!isset($file_contents['utf_canonical_comp']['utf_canonical_comp'][$utf_seq])) - { - $file_contents['utf_canonical_comp']['utf_canonical_comp'][$utf_seq] = cp_to_utf($cp); - } -} - -/** -* Decompose the NF[K]D mappings recursively and prepare the file contents -*/ -echo "Generating the Canonical and Compatibility Decomposition tables\n\n"; -foreach ($map as $type => $decomp_map) -{ - foreach ($decomp_map as $cp => $decomp_seq) - { - $decomp_map[$cp] = decompose($decomp_map, $decomp_seq); - } - unset($decomp_seq); - - if ($type == 'NFKD') - { - $file = 'utf_compatibility_decomp'; - $var = 'utf_compatibility_decomp'; - } - else - { - $file = 'utf_canonical_decomp'; - $var = 'utf_canonical_decomp'; - } - - /** - * Generate the corresponding file - */ - foreach ($decomp_map as $cp => $decomp_seq) - { - $file_contents[$file][$var][cp_to_utf($cp)] = implode('', array_map('cp_to_utf', explode(' ', $decomp_seq))); - } -} - -/** -* Generate and/or alter the files -*/ -foreach ($file_contents as $file => $contents) -{ - /** - * Generate a new file - */ - echo "Writing to $file.$phpEx\n"; - - if (!$fp = fopen($phpbb_root_path . 'includes/utf/data/' . $file . '.' . $phpEx, 'wb')) - { - trigger_error('Cannot open ' . $file . ' for write'); - } - - fwrite($fp, '<?php'); - foreach ($contents as $var => $val) - { - fwrite($fp, "\n\$GLOBALS[" . my_var_export($var) . ']=' . my_var_export($val) . ";"); - } - fclose($fp); -} - -echo "\n*** UTF-8 normalization tables done\n\n"; - -/** -* Now we'll generate the files needed by the search indexer +* Generate the files needed by the search indexer */ echo "Generating search indexer tables\n"; @@ -421,32 +174,6 @@ die("\nAll done!\n"); //////////////////////////////////////////////////////////////////////////////// /** -* Decompose a sequence recusively -* -* @param array $decomp_map Decomposition mapping, passed by reference -* @param string $decomp_seq Decomposition sequence as decimal codepoints separated with a space -* @return string Decomposition sequence, fully decomposed -*/ -function decompose(&$decomp_map, $decomp_seq) -{ - $ret = array(); - foreach (explode(' ', $decomp_seq) as $cp) - { - if (isset($decomp_map[$cp])) - { - $ret[] = decompose($decomp_map, $decomp_map[$cp]); - } - else - { - $ret[] = $cp; - } - } - - return implode(' ', $ret); -} - - -/** * Return a parsable string representation of a variable * * This is function is limited to array/strings/integers @@ -534,17 +261,6 @@ function hex_to_utf($hex) } /** -* Return a UTF string formed from a sequence of codepoints in hexadecimal -* -* @param string $seq Sequence of codepoints, separated with a space -* @return string UTF-8 string -*/ -function hexseq_to_utf($seq) -{ - return implode('', array_map('hex_to_utf', explode(' ', $seq))); -} - -/** * Convert a codepoint to a UTF-8 char * * @param integer $cp Unicode codepoint diff --git a/phpBB/develop/imageset_to_css.php b/phpBB/develop/imageset_to_css.php index d49fe9c741..bbe7c31c83 100644 --- a/phpBB/develop/imageset_to_css.php +++ b/phpBB/develop/imageset_to_css.php @@ -7,7 +7,7 @@ */ $phpbb_root_path = '../'; -$style = 'subsilver2'; +$style = 'prosilver'; $imageset_path = $phpbb_root_path . 'styles/' . $style . '/imageset'; $theme_path = $phpbb_root_path . 'styles/' . $style . '/theme'; diff --git a/phpBB/develop/lang_duplicates.php b/phpBB/develop/lang_duplicates.php index 02852798b6..7a74b1088a 100644 --- a/phpBB/develop/lang_duplicates.php +++ b/phpBB/develop/lang_duplicates.php @@ -15,8 +15,11 @@ die("Please read the first lines of this script for instructions on how to enabl // ------------------------------------------------------------- // -// @copyright (c) 2005 phpBB Group -// @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +// @copyright (c) phpBB Limited <https://www.phpbb.com> +// @license GNU General Public License, version 2 (GPL-2.0) +// +// For full copyright and license information, please see +// the docs/CREDITS.txt file. // // ------------------------------------------------------------- // Thanks to arod-1 @@ -26,7 +29,7 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1); $phpbb_root_path='./../'; include($phpbb_root_path . 'common.'.$phpEx); -$mode = request_var('mode', ''); +$mode = $request->variable('mode', ''); $modules = find_modules($phpbb_root_path . 'language/en'); diff --git a/phpBB/develop/lang_migrate_help_lang.php b/phpBB/develop/lang_migrate_help_lang.php new file mode 100644 index 0000000000..81b71398e1 --- /dev/null +++ b/phpBB/develop/lang_migrate_help_lang.php @@ -0,0 +1,307 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +define('LANGUAGE_TO_MIGRATE', 'en'); + +# NO CHANGES BELOW THIS LINE + +define('IN_PHPBB', true); +$phpEx = substr(strrchr(__FILE__, '.'), 1); +$phpbb_root_path = './../'; +include($phpbb_root_path . 'common.'.$phpEx); + +$help_bbcode = load_help('bbcode'); +$lang_bbcode = array( + 'HELP_BBCODE_BLOCK_INTRO' => $help_bbcode[0][1], + 'HELP_BBCODE_INTRO_BBCODE_QUESTION' => $help_bbcode[1][0], + 'HELP_BBCODE_INTRO_BBCODE_ANSWER' => $help_bbcode[1][1], + + 'HELP_BBCODE_BLOCK_TEXT' => $help_bbcode[2][1], + 'HELP_BBCODE_TEXT_BASIC_QUESTION' => $help_bbcode[3][0], + 'HELP_BBCODE_TEXT_BASIC_ANSWER' => $help_bbcode[3][1], + 'HELP_BBCODE_TEXT_COLOR_QUESTION' => $help_bbcode[4][0], + 'HELP_BBCODE_TEXT_COLOR_ANSWER' => $help_bbcode[4][1], + 'HELP_BBCODE_TEXT_COMBINE_QUESTION' => $help_bbcode[5][0], + 'HELP_BBCODE_TEXT_COMBINE_ANSWER' => $help_bbcode[5][1], + + 'HELP_BBCODE_BLOCK_QUOTES' => $help_bbcode[6][1], + 'HELP_BBCODE_QUOTES_TEXT_QUESTION' => $help_bbcode[7][0], + 'HELP_BBCODE_QUOTES_TEXT_ANSWER' => $help_bbcode[7][1], + 'HELP_BBCODE_QUOTES_CODE_QUESTION' => $help_bbcode[8][0], + 'HELP_BBCODE_QUOTES_CODE_ANSWER' => $help_bbcode[8][1], + + 'HELP_BBCODE_BLOCK_LISTS' => $help_bbcode[9][1], + 'HELP_BBCODE_LISTS_UNORDERER_QUESTION' => $help_bbcode[10][0], + 'HELP_BBCODE_LISTS_UNORDERER_ANSWER' => $help_bbcode[10][1], + 'HELP_BBCODE_LISTS_ORDERER_QUESTION' => $help_bbcode[11][0], + 'HELP_BBCODE_LISTS_ORDERER_ANSWER' => $help_bbcode[11][1], + + 'HELP_BBCODE_BLOCK_LINKS' => $help_bbcode[13][1], + 'HELP_BBCODE_LINKS_BASIC_QUESTION' => $help_bbcode[14][0], + 'HELP_BBCODE_LINKS_BASIC_ANSWER' => $help_bbcode[14][1], + + 'HELP_BBCODE_BLOCK_IMAGES' => $help_bbcode[15][1], + 'HELP_BBCODE_IMAGES_BASIC_QUESTION' => $help_bbcode[16][0], + 'HELP_BBCODE_IMAGES_BASIC_ANSWER' => $help_bbcode[16][1], + 'HELP_BBCODE_IMAGES_ATTACHMENT_QUESTION' => $help_bbcode[17][0], + 'HELP_BBCODE_IMAGES_ATTACHMENT_ANSWER' => $help_bbcode[17][1], + + 'HELP_BBCODE_BLOCK_OTHERS' => $help_bbcode[18][1], + 'HELP_BBCODE_OTHERS_CUSTOM_QUESTION' => $help_bbcode[19][0], + 'HELP_BBCODE_OTHERS_CUSTOM_ANSWER' => $help_bbcode[19][1], +); +write_help('bbcode', $lang_bbcode); + +$help_phpbb = load_help('faq'); +$lang_phpbb = array( + 'HELP_FAQ_BLOCK_LOGIN' => $help_phpbb[0][1], + 'HELP_FAQ_LOGIN_REGISTER_QUESTION' => $help_phpbb[1][0], + 'HELP_FAQ_LOGIN_REGISTER_ANSWER' => $help_phpbb[1][1], + 'HELP_FAQ_LOGIN_COPPA_QUESTION' => $help_phpbb[2][0], + 'HELP_FAQ_LOGIN_COPPA_ANSWER' => $help_phpbb[2][1], + 'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => $help_phpbb[3][0], + 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER' => $help_phpbb[3][1], + 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => $help_phpbb[4][0], + 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER' => $help_phpbb[4][1], + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => $help_phpbb[5][0], + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER' => $help_phpbb[5][1], + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => $help_phpbb[6][0], + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER' => $help_phpbb[6][1], + 'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => $help_phpbb[7][0], + 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER' => $help_phpbb[7][1], + 'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => $help_phpbb[8][0], + 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER' => $help_phpbb[8][1], + 'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => $help_phpbb[9][0], + 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER' => $help_phpbb[9][1], + + 'HELP_FAQ_BLOCK_USERSETTINGS' => $help_phpbb[10][1], + 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_QUESTION' => $help_phpbb[11][0], + 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_ANSWER' => $help_phpbb[11][1], + 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_QUESTION' => $help_phpbb[12][0], + 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_ANSWER' => $help_phpbb[12][1], + 'HELP_FAQ_USERSETTINGS_TIMEZONE_QUESTION' => $help_phpbb[13][0], + 'HELP_FAQ_USERSETTINGS_TIMEZONE_ANSWER' => $help_phpbb[13][1], + 'HELP_FAQ_USERSETTINGS_SERVERTIME_QUESTION' => $help_phpbb[14][0], + 'HELP_FAQ_USERSETTINGS_SERVERTIME_ANSWER' => $help_phpbb[14][1], + 'HELP_FAQ_USERSETTINGS_LANGUAGE_QUESTION' => $help_phpbb[15][0], + 'HELP_FAQ_USERSETTINGS_LANGUAGE_ANSWER' => $help_phpbb[15][1], + 'HELP_FAQ_USERSETTINGS_AVATAR_QUESTION' => $help_phpbb[16][0], + 'HELP_FAQ_USERSETTINGS_AVATAR_ANSWER' => $help_phpbb[16][1], + 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_QUESTION' => $help_phpbb[17][0], + 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_ANSWER' => $help_phpbb[17][1], + 'HELP_FAQ_USERSETTINGS_RANK_QUESTION' => $help_phpbb[18][0], + 'HELP_FAQ_USERSETTINGS_RANK_ANSWER' => $help_phpbb[18][1], + 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_QUESTION' => $help_phpbb[19][0], + 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_ANSWER' => $help_phpbb[19][1], + + 'HELP_FAQ_BLOCK_POSTING' => $help_phpbb[20][1], + 'HELP_FAQ_POSTING_CREATE_QUESTION' => $help_phpbb[21][0], + 'HELP_FAQ_POSTING_CREATE_ANSWER' => $help_phpbb[21][1], + 'HELP_FAQ_POSTING_EDIT_DELETE_QUESTION' => $help_phpbb[22][0], + 'HELP_FAQ_POSTING_EDIT_DELETE_ANSWER' => $help_phpbb[22][1], + 'HELP_FAQ_POSTING_SIGNATURE_QUESTION' => $help_phpbb[23][0], + 'HELP_FAQ_POSTING_SIGNATURE_ANSWER' => $help_phpbb[23][1], + 'HELP_FAQ_POSTING_POLL_CREATE_QUESTION' => $help_phpbb[24][0], + 'HELP_FAQ_POSTING_POLL_CREATE_ANSWER' => $help_phpbb[24][1], + 'HELP_FAQ_POSTING_POLL_ADD_QUESTION' => $help_phpbb[25][0], + 'HELP_FAQ_POSTING_POLL_ADD_ANSWER' => $help_phpbb[25][1], + 'HELP_FAQ_POSTING_POLL_EDIT_QUESTION' => $help_phpbb[26][0], + 'HELP_FAQ_POSTING_POLL_EDIT_ANSWER' => $help_phpbb[26][1], + 'HELP_FAQ_POSTING_FORUM_RESTRICTED_QUESTION' => $help_phpbb[27][0], + 'HELP_FAQ_POSTING_FORUM_RESTRICTED_ANSWER' => $help_phpbb[27][1], + 'HELP_FAQ_POSTING_NO_ATTACHMENTS_QUESTION' => $help_phpbb[28][0], + 'HELP_FAQ_POSTING_NO_ATTACHMENTS_ANSWER' => $help_phpbb[28][1], + 'HELP_FAQ_POSTING_WARNING_QUESTION' => $help_phpbb[29][0], + 'HELP_FAQ_POSTING_WARNING_ANSWER' => $help_phpbb[29][1], + 'HELP_FAQ_POSTING_REPORT_QUESTION' => $help_phpbb[30][0], + 'HELP_FAQ_POSTING_REPORT_ANSWER' => $help_phpbb[30][1], + 'HELP_FAQ_POSTING_DRAFT_QUESTION' => $help_phpbb[31][0], + 'HELP_FAQ_POSTING_DRAFT_ANSWER' => $help_phpbb[31][1], + 'HELP_FAQ_POSTING_QUEUE_QUESTION' => $help_phpbb[32][0], + 'HELP_FAQ_POSTING_QUEUE_ANSWER' => $help_phpbb[32][1], + 'HELP_FAQ_POSTING_BUMP_QUESTION' => $help_phpbb[33][0], + 'HELP_FAQ_POSTING_BUMP_ANSWER' => $help_phpbb[33][1], + + 'HELP_FAQ_BLOCK_FORMATTING' => $help_phpbb[34][1], + 'HELP_FAQ_FORMATTING_BBOCDE_QUESTION' => $help_phpbb[35][0], + 'HELP_FAQ_FORMATTING_BBOCDE_ANSWER' => $help_phpbb[35][1], + 'HELP_FAQ_FORMATTING_HTML_QUESTION' => $help_phpbb[36][0], + 'HELP_FAQ_FORMATTING_HTML_ANSWER' => $help_phpbb[36][1], + 'HELP_FAQ_FORMATTING_SMILIES_QUESTION' => $help_phpbb[37][0], + 'HELP_FAQ_FORMATTING_SMILIES_ANSWER' => $help_phpbb[37][1], + 'HELP_FAQ_FORMATTING_IMAGES_QUESTION' => $help_phpbb[38][0], + 'HELP_FAQ_FORMATTING_IMAGES_ANSWER' => $help_phpbb[38][1], + 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_QUESTION' => $help_phpbb[39][0], + 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_ANSWER' => $help_phpbb[39][1], + 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_QUESTION' => $help_phpbb[40][0], + 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_ANSWER' => $help_phpbb[40][1], + 'HELP_FAQ_FORMATTING_STICKIES_QUESTION' => $help_phpbb[41][0], + 'HELP_FAQ_FORMATTING_STICKIES_ANSWER' => $help_phpbb[41][1], + 'HELP_FAQ_FORMATTING_LOCKED_QUESTION' => $help_phpbb[42][0], + 'HELP_FAQ_FORMATTING_LOCKED_ANSWER' => $help_phpbb[42][1], + 'HELP_FAQ_FORMATTING_ICONS_QUESTION' => $help_phpbb[43][0], + 'HELP_FAQ_FORMATTING_ICONS_ANSWER' => $help_phpbb[43][1], + + 'HELP_FAQ_BLOCK_GROUPS' => $help_phpbb[45][1], + 'HELP_FAQ_GROUPS_ADMINISTRATORS_QUESTION' => $help_phpbb[46][0], + 'HELP_FAQ_GROUPS_ADMINISTRATORS_ANSWER' => $help_phpbb[46][1], + 'HELP_FAQ_GROUPS_MODERATORS_QUESTION' => $help_phpbb[47][0], + 'HELP_FAQ_GROUPS_MODERATORS_ANSWER' => $help_phpbb[47][1], + 'HELP_FAQ_GROUPS_USERGROUPS_QUESTION' => $help_phpbb[48][0], + 'HELP_FAQ_GROUPS_USERGROUPS_ANSWER' => $help_phpbb[48][1], + 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_QUESTION' => $help_phpbb[49][0], + 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_ANSWER' => $help_phpbb[49][1], + 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_QUESTION' => $help_phpbb[50][0], + 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_ANSWER' => $help_phpbb[50][1], + 'HELP_FAQ_GROUPS_COLORS_QUESTION' => $help_phpbb[51][0], + 'HELP_FAQ_GROUPS_COLORS_ANSWER' => $help_phpbb[51][1], + 'HELP_FAQ_GROUPS_DEFAULT_QUESTION' => $help_phpbb[52][0], + 'HELP_FAQ_GROUPS_DEFAULT_ANSWER' => $help_phpbb[52][1], + 'HELP_FAQ_GROUPS_TEAM_QUESTION' => $help_phpbb[53][0], + 'HELP_FAQ_GROUPS_TEAM_ANSWER' => $help_phpbb[53][1], + + 'HELP_FAQ_BLOCK_PMS' => $help_phpbb[54][1], + 'HELP_FAQ_PMS_CANNOT_SEND_QUESTION' => $help_phpbb[55][0], + 'HELP_FAQ_PMS_CANNOT_SEND_ANSWER' => $help_phpbb[55][1], + 'HELP_FAQ_PMS_UNWANTED_QUESTION' => $help_phpbb[56][0], + 'HELP_FAQ_PMS_UNWANTED_ANSWER' => $help_phpbb[56][1], + 'HELP_FAQ_PMS_SPAM_QUESTION' => $help_phpbb[57][0], + 'HELP_FAQ_PMS_SPAM_ANSWER' => $help_phpbb[57][1], + + 'HELP_FAQ_BLOCK_FRIENDS' => $help_phpbb[58][1], + 'HELP_FAQ_FRIENDS_BASIC_QUESTION' => $help_phpbb[59][0], + 'HELP_FAQ_FRIENDS_BASIC_ANSWER' => $help_phpbb[59][1], + 'HELP_FAQ_FRIENDS_MANAGE_QUESTION' => $help_phpbb[60][0], + 'HELP_FAQ_FRIENDS_MANAGE_ANSWER' => $help_phpbb[60][1], + + 'HELP_FAQ_BLOCK_SEARCH' => $help_phpbb[61][1], + 'HELP_FAQ_SEARCH_FORUM_QUESTION' => $help_phpbb[62][0], + 'HELP_FAQ_SEARCH_FORUM_ANSWER' => $help_phpbb[62][1], + 'HELP_FAQ_SEARCH_NO_RESULT_QUESTION' => $help_phpbb[63][0], + 'HELP_FAQ_SEARCH_NO_RESULT_ANSWER' => $help_phpbb[63][1], + 'HELP_FAQ_SEARCH_BLANK_QUESTION' => $help_phpbb[64][0], + 'HELP_FAQ_SEARCH_BLANK_ANSWER' => $help_phpbb[64][1], + 'HELP_FAQ_SEARCH_MEMBERS_QUESTION' => $help_phpbb[65][0], + 'HELP_FAQ_SEARCH_MEMBERS_ANSWER' => $help_phpbb[65][1], + 'HELP_FAQ_SEARCH_OWN_QUESTION' => $help_phpbb[66][0], + 'HELP_FAQ_SEARCH_OWN_ANSWER' => $help_phpbb[66][1], + + 'HELP_FAQ_BLOCK_BOOKMARKS' => $help_phpbb[67][1], + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_QUESTION' => $help_phpbb[68][0], + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER' => $help_phpbb[68][1], + 'HELP_FAQ_BOOKMARKS_TOPIC_QUESTION' => $help_phpbb[69][0], + 'HELP_FAQ_BOOKMARKS_TOPIC_ANSWER' => $help_phpbb[69][1], + 'HELP_FAQ_BOOKMARKS_FORUM_QUESTION' => $help_phpbb[70][0], + 'HELP_FAQ_BOOKMARKS_FORUM_ANSWER' => $help_phpbb[70][1], + 'HELP_FAQ_BOOKMARKS_REMOVE_QUESTION' => $help_phpbb[71][0], + 'HELP_FAQ_BOOKMARKS_REMOVE_ANSWER' => $help_phpbb[71][1], + + 'HELP_FAQ_BLOCK_ATTACHMENTS' => $help_phpbb[72][1], + 'HELP_FAQ_ATTACHMENTS_ALLOWED_QUESTION' => $help_phpbb[73][0], + 'HELP_FAQ_ATTACHMENTS_ALLOWED_ANSWER' => $help_phpbb[73][1], + 'HELP_FAQ_ATTACHMENTS_OWN_QUESTION' => $help_phpbb[74][0], + 'HELP_FAQ_ATTACHMENTS_OWN_ANSWER' => $help_phpbb[74][1], + + 'HELP_FAQ_BLOCK_ISSUES' => $help_phpbb[75][1], + 'HELP_FAQ_ISSUES_WHOIS_PHPBB_QUESTION' => $help_phpbb[76][0], + 'HELP_FAQ_ISSUES_WHOIS_PHPBB_ANSWER' => $help_phpbb[76][1], + 'HELP_FAQ_ISSUES_FEATURE_QUESTION' => $help_phpbb[77][0], + 'HELP_FAQ_ISSUES_FEATURE_ANSWER' => $help_phpbb[77][1], + 'HELP_FAQ_ISSUES_LEGAL_QUESTION' => $help_phpbb[78][0], + 'HELP_FAQ_ISSUES_LEGAL_ANSWER' => $help_phpbb[78][1], + 'HELP_FAQ_ISSUES_ADMIN_QUESTION' => $help_phpbb[79][0], + 'HELP_FAQ_ISSUES_ADMIN_ANSWER' => $help_phpbb[79][1], + +); +write_help('faq', $lang_phpbb); + +trigger_error('Successfully migrated help_bbcode and help_faq to help/bbcode and help/phpbb'); + +/** + * @param string $help + * @return array + */ +function load_help($help) +{ + global $phpbb_root_path; + include($phpbb_root_path . 'language/' . LANGUAGE_TO_MIGRATE . '/help_' . $help . '.php'); + return $help; +} + +/** + * @param string $help + * @param array $lang + */ +function write_help($help, array $lang) +{ + global $phpbb_root_path; + $fp = fopen($phpbb_root_path . 'language/' . LANGUAGE_TO_MIGRATE . '/help/' . $help . '.php', 'wb'); + fwrite($fp, get_language_file_header()); + fwrite($fp, '$lang = array_merge($lang, array(' . "\n"); + + $last_key = ''; + ksort($lang); + foreach ($lang as $key => $translation) + { + $key_sections = explode('_', $key, 4); + unset($key_sections[3]); + $key_start = implode('_', $key_sections); + + if ($last_key !== '' && $key_start !== $last_key) + { + fwrite($fp, "\n"); + } + fwrite($fp, "\t'" . $key . "'\t=> '" . $translation . "',\n"); + $last_key = $key_start; + } + + fwrite($fp, '));' . "\n"); + #fwrite($fp, $lang); + fclose($fp); +} + +/** + * @return string + */ +function get_language_file_header() +{ + return <<<EOT +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * DO NOT CHANGE + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty(\$lang) || !is_array(\$lang)) +{ + \$lang = array(); +} + + +EOT; +} diff --git a/phpBB/develop/merge_attachment_tables.php b/phpBB/develop/merge_attachment_tables.php index a66a395afa..dd6e12172e 100644 --- a/phpBB/develop/merge_attachment_tables.php +++ b/phpBB/develop/merge_attachment_tables.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2001, 2003 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -44,7 +48,7 @@ $sql = "CREATE TABLE {$table_prefix}attachments AND a.post_id = p.post_id"; $db->sql_query($sql); -switch ($db->sql_layer) +switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': diff --git a/phpBB/develop/merge_post_tables.php b/phpBB/develop/merge_post_tables.php index d687a292f2..9e81917108 100644 --- a/phpBB/develop/merge_post_tables.php +++ b/phpBB/develop/merge_post_tables.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2003 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -42,7 +46,7 @@ $sql = "CREATE TABLE {$table_prefix}posts WHERE pt.post_id = p.post_id"; $db->sql_query($sql); -switch ($db->sql_layer) +switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': @@ -138,7 +142,7 @@ while ($row = $db->sql_fetchrow($result)) } $db->sql_freeresult($result); -switch ($db->sql_layer) +switch ($db->get_sql_layer()) { case 'oracle': $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id diff --git a/phpBB/develop/migration_tips.php b/phpBB/develop/migration_tips.php deleted file mode 100644 index 51a579bdb5..0000000000 --- a/phpBB/develop/migration_tips.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -// This is to help with creating migration files for new versions -// Use this to find what migrations are not depended on by any other migration -// (the current migration tree tips) - -define('IN_PHPBB', true); -$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -include($phpbb_root_path . 'common.' . $phpEx); - -$phpbb_extension_manager = $phpbb_container->get('ext.manager'); -$finder = $phpbb_extension_manager->get_finder(); - -$migrations = $finder - ->core_path('phpbb/db/migration/data/') - ->get_classes(); -$tips = $migrations; - -foreach ($migrations as $migration_class) -{ - foreach ($migration_class::depends_on() as $dependency) - { - if (($tips_key = array_search($dependency, $tips)) !== false) - { - unset($tips[$tips_key]); - } - } -} - -foreach ($tips as $migration) -{ - echo "\t\t\t'{$migration}',\n"; -} - diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index eb34034826..276c010e84 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -1,14 +1,20 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * -* This file creates SQL statements to upgrade phpBB on MySQL 3.x/4.0.x to 4.1.x/5.x +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +/** +* This file creates SQL statements to upgrade phpBB on MySQL 3.x/4.0.x to 4.1.x/5.x +*/ + // // Security message: // @@ -56,10 +62,17 @@ echo "USE $dbname;$newline$newline"; @set_time_limit(0); -require($phpbb_root_path . 'includes/db/schema_data.' . $phpEx); -require($phpbb_root_path . 'phpbb/db/tools.' . $phpEx); +$finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path); +$classes = $finder->core_path('phpbb/') + ->directory('/db/migration/data') + ->get_classes(); + +$factory = new \phpbb\db\tools\factory(); +$db_tools = $factory->get($db, true); -$dbms_type_map = phpbb\db\tools::get_dbms_type_map(); +$schema_generator = new \phpbb\db\migration\schema_generator($classes, $config, $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix); +$schema_data = $schema_generator->get_schema(); +$dbms_type_map = \phpbb\db\tools\tools::get_dbms_type_map(); foreach ($schema_data as $table_name => $table_data) { diff --git a/phpBB/develop/namespacify.php b/phpBB/develop/namespacify.php index 4e460eead8..447e87905e 100644 --- a/phpBB/develop/namespacify.php +++ b/phpBB/develop/namespacify.php @@ -1,8 +1,13 @@ <?php /** * -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/develop/regex_idn.php b/phpBB/develop/regex_idn.php new file mode 100644 index 0000000000..d871695c50 --- /dev/null +++ b/phpBB/develop/regex_idn.php @@ -0,0 +1,151 @@ +<?php +// +// Security message: +// +// This script is potentially dangerous. +// Remove or comment the next line (die(".... ) to enable this script. +// Do NOT FORGET to either remove this script or disable it after you have used it. +// +die("Please read the first lines of this script for instructions on how to enable it"); + +// IP regular expressions + +$dec_octet = '(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])'; +$h16 = '[\dA-F]{1,4}'; +$ipv4 = "(?:$dec_octet\.){3}$dec_octet"; +$ls32 = "(?:$h16:$h16|$ipv4)"; + +$ipv6_construct = array( + array(false, '', '{6}', $ls32), + array(false, '::', '{0,5}', "(?:$h16(?::$h16)?|$ipv4)"), + array('', ':', '{4}', $ls32), + array('{1,2}', ':', '{3}', $ls32), + array('{1,3}', ':', '{2}', $ls32), + array('{1,4}', ':', '', $ls32), + array('{1,5}', ':', false, $ls32), + array('{1,6}', ':', false, $h16), + array('{1,7}', ':', false, ''), + array(false, '::', false, '') +); + +$ipv6 = '(?:'; +foreach ($ipv6_construct as $ip_type) +{ + $ipv6 .= '(?:'; + if ($ip_type[0] !== false) + { + $ipv6 .= "(?:$h16:)" . $ip_type[0]; + } + $ipv6 .= $ip_type[1]; + if ($ip_type[2] !== false) + { + $ipv6 .= "(?:$h16:)" . $ip_type[2]; + } + $ipv6 .= $ip_type[3] . ')|'; +} +$ipv6 = substr($ipv6, 0, -1) . ')'; + +echo 'IPv4: ' . $ipv4 . "<br /><br />\n\nIPv6: " . $ipv6 . "<br /><br />\n\n"; + +// URL regular expressions + +/* IDN2008 characters derivation +** http://unicode.org/faq/idn.html#33 - IDN FAQ: derivation of valid characters in terms of Unicode properties +** http://unicode.org/reports/tr46/ - Unicode Technical Standard #46. Unicode IDNA Compatibility Processing +** http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt - Unicode Character Database +*/ +/* +** Remove Control Characters and Whitespace (as in IDNA2003) +*/ +$no_cc = '\p{C}\p{Z}'; +/* +** Remove Symbols, Punctuation, non-decimal Numbers, and Enclosing Marks +*/ +$no_symbol = '\p{S}\p{P}\p{Nl}\p{No}\p{Me}'; +/* +** Remove characters used for archaic Hangul (Korean) - \p{HST=L} and \p{HST=V} +** as per http://unicode.org/Public/UNIDATA/HangulSyllableType.txt +*/ +$no_hangul = '\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}'; +/* +** Remove three blocks of technical or archaic symbols. +*/ +$no_cdm = '\x{20D0}-\x{20FF}'; // \p{block=Combining_Diacritical_Marks_For_Symbols} +$no_musical = '\x{1D100}-\x{1D1FF}'; // \p{block=Musical_Symbols} +$no_ancient_greek_musical = '\x{1D200}-\x{1D24F}'; // \p{block=Ancient_Greek_Musical_Notation} +/* Remove certain exceptions: +** U+0640 ARABIC TATWEEL +** U+07FA NKO LAJANYALAN +** U+302E HANGUL SINGLE DOT TONE MARK +** U+302F HANGUL DOUBLE DOT TONE MARK +** U+3031 VERTICAL KANA REPEAT MARK +** U+3032 VERTICAL KANA REPEAT WITH VOICED SOUND MARK +** .. +** U+3035 VERTICAL KANA REPEAT MARK LOWER HALF +** U+303B VERTICAL IDEOGRAPHIC ITERATION MARK +*/ +$no_certain_exceptions = '\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}'; +/* Add certain exceptions: +** U+00B7 MIDDLE DOT +** U+0375 GREEK LOWER NUMERAL SIGN +** U+05F3 HEBREW PUNCTUATION GERESH +** U+05F4 HEBREW PUNCTUATION GERSHAYIM +** U+30FB KATAKANA MIDDLE DOT +** U+002D HYPHEN-MINUS +** U+06FD ARABIC SIGN SINDHI AMPERSAND +** U+06FE ARABIC SIGN SINDHI POSTPOSITION MEN +** U+0F0B TIBETAN MARK INTERSYLLABIC TSHEG +** U+3007 IDEOGRAPHIC NUMBER ZERO +*/ +$add_certain_exceptions = '\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}'; +/* Add special exceptions (Deviations): +** U+00DF LATIN SMALL LETTER SHARP S +** U+03C2 GREEK SMALL LETTER FINAL SIGMA +** U+200C ZERO WIDTH NON-JOINER +** U+200D ZERO WIDTH JOINER +*/ +$add_deviations = '\x{00DF}\x{03C2}\x{200C}\x{200D}'; + +// Concatenate remove/add regexes respectively +$remove_chars = "$no_cc$no_symbol$no_hangul$no_cdm$no_musical$no_ancient_greek_musical$no_certain_exceptions"; +$add_chars = "$add_certain_exceptions$add_deviations"; + +// Initialize inline mode +$inline = false; + +do +{ + $inline = !$inline; + + $pct_encoded = "%[\dA-F]{2}"; + $unreserved = "$add_chars\pL0-9\-._~"; + $sub_delims = ($inline) ? '!$&\'(*+,;=' : '!$&\'()*+,;='; + $scheme = ($inline) ? '[a-z][a-z\d+]*': '[a-z][a-z\d+\-.]*' ; // avoid automatic parsing of "word" in "last word.http://..." + $pchar = "(?:[^$remove_chars]*[$unreserved$sub_delims:@|]+|$pct_encoded)"; // rfc: no "|" + + $reg_name = "(?:[^$remove_chars]*[$unreserved$sub_delims:@|]+|$pct_encoded)+"; // rfc: * instead of + and no "|" and no "@" and no ":" (included instead of userinfo) + //$userinfo = "(?:(?:[$unreserved$sub_delims:]+|$pct_encoded))*"; + $ipv4_simple = '[0-9.]+'; + $ipv6_simple = '\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\]'; + $host = "(?:$reg_name|$ipv4_simple|$ipv6_simple)"; + $port = '\d*'; + //$authority = "(?:$userinfo@)?$host(?::$port)?"; + $authority = "$host(?::$port)?"; + $segment = "$pchar*"; + $path_abempty = "(?:/$segment)*"; + $hier_part = "/{2}$authority$path_abempty"; + $query = "(?:[^$remove_chars]*[$unreserved$sub_delims:@/?|]+|$pct_encoded)*"; // pchar | "/" | "?", rfc: no "|" + $fragment = $query; + + $url = "$scheme:$hier_part(?:\?$query)?(?:\#$fragment)?"; + echo (($inline) ? 'URL inline: ' : 'URL: ') . $url . "<br /><br />\n\n"; + + // no scheme, shortened authority, but host has to start with www. + $www_url = "www\.$reg_name(?::$port)?$path_abempty(?:\?$query)?(?:\#$fragment)?"; + echo (($inline) ? 'www.URL_inline: ' : 'www.URL: ') . $www_url . "<br /><br />\n\n"; + + // no schema and no authority + $relative_url = "$segment$path_abempty(?:\?$query)?(?:\#$fragment)?"; + echo (($inline) ? 'relative URL inline: ' : 'relative URL: ') . $relative_url . "<br /><br />\n\n"; +} +while ($inline); diff --git a/phpBB/develop/rename_interfaces.php b/phpBB/develop/rename_interfaces.php index 11989350bb..90bf9cc205 100644 --- a/phpBB/develop/rename_interfaces.php +++ b/phpBB/develop/rename_interfaces.php @@ -1,8 +1,13 @@ <?php /** * -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 2a4dfb212c..07c4024b2f 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -40,7 +40,7 @@ if (!class_exists($search_type)) } $error = false; -$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); +$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); if ($error) { diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh new file mode 100755 index 0000000000..b11a63616b --- /dev/null +++ b/phpBB/develop/strip_icc_profiles.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# + +if [ "$#" -ne 1 ] +then + SCRIPT=$(basename "$0") + echo "Description: Finds and strips ICC Profiles from given image file." >&2 + echo "Usage: $SCRIPT /path/to/image/file" >&2 + echo "Exit Status: 0 if no ICC profiles have been stripped, otherwise 1." >&2 + echo "Requires: exiftool" >&2 + exit 1 +fi + +FILE=$1 +HASH_OLD=$(md5sum "$FILE") +exiftool -icc_profile"-<=" -overwrite_original_in_place "$FILE" > /dev/null 2>&1 +HASH_NEW=$(md5sum "$FILE") + +if [ "$HASH_OLD" != "$HASH_NEW" ] +then + echo "Stripped ICC Profile from $FILE." + exit 1 +fi diff --git a/phpBB/develop/unicode_testing.php b/phpBB/develop/unicode_testing.php index ec3c71d078..01586ca09b 100644 --- a/phpBB/develop/unicode_testing.php +++ b/phpBB/develop/unicode_testing.php @@ -19,7 +19,7 @@ if (!headers_sent()) function unicode_to_utf8($string) { $utf8 = ''; - $chars = array(); + for ($i = 0; $i < strlen($string); $i++) { if (isset($string[$i + 5]) && substr($string, $i, 2) == '\\u' && ctype_xdigit(substr($string, $i + 2, 4))) @@ -81,38 +81,3 @@ function utf8_to_unicode_callback($m) { return '\u' . str_pad(base_convert(utf8_ord($m[0]), 10, 16), 4, '0', STR_PAD_LEFT) . ''; } - -/** -* A wrapper function for the normalizer which takes care of including the class if required and modifies the passed strings -* to be in NFKC -* -* @param mixed $strings a string or an array of strings to normalize -* @return mixed the normalized content, preserving array keys if array given. -*/ -function utf8_normalize_nfkc($strings) -{ - if (empty($strings)) - { - return $strings; - } - - if (!class_exists('utf_normalizer')) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); - } - - if (!is_array($strings)) - { - utf_normalizer::nfkc($strings); - } - else if (is_array($strings)) - { - foreach ($strings as $key => $string) - { - utf_normalizer::nfkc($strings[$key]); - } - } - - return $strings; -} diff --git a/phpBB/develop/update_email_hash.php b/phpBB/develop/update_email_hash.php index 57aebe3ca0..c149900d64 100644 --- a/phpBB/develop/update_email_hash.php +++ b/phpBB/develop/update_email_hash.php @@ -19,7 +19,7 @@ $user->session_begin(); $auth->acl($user->data); $user->setup(); -$start = request_var('start', 0); +$start = $request->variable('start', 0); $num_items = 1000; echo '<br />Updating user email hashes' . "\n"; diff --git a/phpBB/develop/utf_normalizer_test.php b/phpBB/develop/utf_normalizer_test.php deleted file mode 100644 index af8556507f..0000000000 --- a/phpBB/develop/utf_normalizer_test.php +++ /dev/null @@ -1,390 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -if (php_sapi_name() != 'cli') -{ - die("This program must be run from the command line.\n"); -} - -// -// Security message: -// -// This script is potentially dangerous. -// Remove or comment the next line (die(".... ) to enable this script. -// Do NOT FORGET to either remove this script or disable it after you have used it. -// -die("Please read the first lines of this script for instructions on how to enable it"); - -set_time_limit(0); -error_reporting(E_ALL); - -define('IN_PHPBB', true); -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); - - -/** -* Let's download some files we need -*/ -download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt'); -download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt'); - -/** -* Those are the tests we run -*/ -$test_suite = array( - /** - * NFC - * c2 == NFC(c1) == NFC(c2) == NFC(c3) - * c4 == NFC(c4) == NFC(c5) - */ - 'NFC' => array( - 'c2' => array('c1', 'c2', 'c3'), - 'c4' => array('c4', 'c5') - ), - - /** - * NFD - * c3 == NFD(c1) == NFD(c2) == NFD(c3) - * c5 == NFD(c4) == NFD(c5) - */ - 'NFD' => array( - 'c3' => array('c1', 'c2', 'c3'), - 'c5' => array('c4', 'c5') - ), - - /** - * NFKC - * c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5) - */ - 'NFKC' => array( - 'c4' => array('c1', 'c2', 'c3', 'c4', 'c5') - ), - - /** - * NFKD - * c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5) - */ - 'NFKD' => array( - 'c5' => array('c1', 'c2', 'c3', 'c4', 'c5') - ) -); - -require_once($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); - -$i = $n = 0; -$failed = false; -$tested_chars = array(); - -$fp = fopen($phpbb_root_path . 'develop/NormalizationTest.txt', 'rb'); -while (!feof($fp)) -{ - $line = fgets($fp); - ++$n; - - if ($line[0] == '@') - { - if ($i) - { - echo "done\n"; - } - - $i = 0; - echo "\n", substr($line, 1), "\n\n"; - continue; - } - - if (!strpos(' 0123456789ABCDEF', $line[0])) - { - continue; - } - - if (++$i % 100 == 0) - { - echo $i, ' '; - } - - list($c1, $c2, $c3, $c4, $c5) = explode(';', $line); - - if (!strpos($c1, ' ')) - { - /** - * We are currently testing a single character, we add it to the list of - * characters we have processed so that we can exclude it when testing - * for invariants - */ - $tested_chars[$c1] = 1; - } - - foreach ($test_suite as $form => $serie) - { - foreach ($serie as $expected => $tests) - { - $hex_expected = ${$expected}; - $utf_expected = hexseq_to_utf($hex_expected); - - foreach ($tests as $test) - { - $utf_result = $utf_expected; - call_user_func(array('utf_normalizer', $form), $utf_result); - - if (strcmp($utf_expected, $utf_result)) - { - $failed = true; - $hex_result = utf_to_hexseq($utf_result); - - echo "\nFAILED $expected == $form($test) ($hex_expected != $hex_result)"; - } - } - } - - if ($failed) - { - die("\n\nFailed at line $n\n"); - } - } -} -fclose($fp); - -/** -* Test for invariants -*/ -echo "\n\nTesting for invariants...\n\n"; - -$fp = fopen($phpbb_root_path . 'develop/UnicodeData.txt', 'rt'); - -$n = 0; -while (!feof($fp)) -{ - if (++$n % 100 == 0) - { - echo $n, ' '; - } - - $line = fgets($fp, 1024); - - if (!$pos = strpos($line, ';')) - { - continue; - } - - $hex_tested = $hex_expected = substr($line, 0, $pos); - - if (isset($tested_chars[$hex_tested])) - { - continue; - } - - $utf_expected = hex_to_utf($hex_expected); - - if ($utf_expected >= UTF8_SURROGATE_FIRST - && $utf_expected <= UTF8_SURROGATE_LAST) - { - /** - * Surrogates are illegal on their own, we expect the normalizer - * to return a replacement char - */ - $utf_expected = UTF8_REPLACEMENT; - $hex_expected = utf_to_hexseq($utf_expected); - } - - foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form) - { - $utf_result = $utf_expected; - utf_normalizer::$form($utf_result); - $hex_result = utf_to_hexseq($utf_result); -// echo "$form($utf_expected) == $utf_result\n"; - - if (strcmp($utf_expected, $utf_result)) - { - $failed = 1; - - echo "\nFAILED $hex_expected == $form($hex_tested) ($hex_expected != $hex_result)"; - } - } - - if ($failed) - { - die("\n\nFailed at line $n\n"); - } -} -fclose($fp); - -die("\n\nALL TESTS PASSED SUCCESSFULLY\n"); - -/** -* Download a file to the develop/ dir -* -* @param string $url URL of the file to download -* @return null -*/ -function download($url) -{ - global $phpbb_root_path; - - if (file_exists($phpbb_root_path . 'develop/' . basename($url))) - { - return; - } - - echo 'Downloading from ', $url, ' '; - - if (!$fpr = fopen($url, 'rb')) - { - die("Can't download from $url\nPlease download it yourself and put it in the develop/ dir, kthxbai"); - } - - if (!$fpw = fopen($phpbb_root_path . 'develop/' . basename($url), 'wb')) - { - die("Can't open develop/" . basename($url) . " for output... please check your permissions or something"); - } - - $i = 0; - $chunk = 32768; - $done = ''; - - while (!feof($fpr)) - { - $i += fwrite($fpw, fread($fpr, $chunk)); - echo str_repeat("\x08", strlen($done)); - - $done = ($i >> 10) . ' KiB'; - echo $done; - } - fclose($fpr); - fclose($fpw); - - echo "\n"; -} - -/** -* Convert a UTF string to a sequence of codepoints in hexadecimal -* -* @param string $utf UTF string -* @return integer Unicode codepoints in hex -*/ -function utf_to_hexseq($str) -{ - $pos = 0; - $len = strlen($str); - $ret = array(); - - while ($pos < $len) - { - $c = $str[$pos]; - switch ($c & "\xF0") - { - case "\xC0": - case "\xD0": - $utf_char = substr($str, $pos, 2); - $pos += 2; - break; - - case "\xE0": - $utf_char = substr($str, $pos, 3); - $pos += 3; - break; - - case "\xF0": - $utf_char = substr($str, $pos, 4); - $pos += 4; - break; - - default: - $utf_char = $c; - ++$pos; - } - - $hex = dechex(utf_to_cp($utf_char)); - - if (!isset($hex[3])) - { - $hex = substr('000' . $hex, -4); - } - - $ret[] = $hex; - } - - return strtr(implode(' ', $ret), 'abcdef', 'ABCDEF'); -} - -/** -* Convert a UTF-8 char to its codepoint -* -* @param string $utf_char UTF-8 char -* @return integer Unicode codepoint -*/ -function utf_to_cp($utf_char) -{ - switch (strlen($utf_char)) - { - case 1: - return ord($utf_char); - - case 2: - return ((ord($utf_char[0]) & 0x1F) << 6) | (ord($utf_char[1]) & 0x3F); - - case 3: - return ((ord($utf_char[0]) & 0x0F) << 12) | ((ord($utf_char[1]) & 0x3F) << 6) | (ord($utf_char[2]) & 0x3F); - - case 4: - return ((ord($utf_char[0]) & 0x07) << 18) | ((ord($utf_char[1]) & 0x3F) << 12) | ((ord($utf_char[2]) & 0x3F) << 6) | (ord($utf_char[3]) & 0x3F); - - default: - die('UTF-8 chars can only be 1-4 bytes long'); - } -} - -/** -* Return a UTF string formed from a sequence of codepoints in hexadecimal -* -* @param string $seq Sequence of codepoints, separated with a space -* @return string UTF-8 string -*/ -function hexseq_to_utf($seq) -{ - return implode('', array_map('hex_to_utf', explode(' ', $seq))); -} - -/** -* Convert a codepoint in hexadecimal to a UTF-8 char -* -* @param string $hex Codepoint, in hexadecimal -* @return string UTF-8 char -*/ -function hex_to_utf($hex) -{ - return cp_to_utf(hexdec($hex)); -} - -/** -* Convert a codepoint to a UTF-8 char -* -* @param integer $cp Unicode codepoint -* @return string UTF-8 string -*/ -function cp_to_utf($cp) -{ - if ($cp > 0xFFFF) - { - return chr(0xF0 | ($cp >> 18)) . chr(0x80 | (($cp >> 12) & 0x3F)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); - } - else if ($cp > 0x7FF) - { - return chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); - } - else if ($cp > 0x7F) - { - return chr(0xC0 | ($cp >> 6)) . chr(0x80 | ($cp & 0x3F)); - } - else - { - return chr($cp); - } -} diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS deleted file mode 100644 index 5ca52c19c0..0000000000 --- a/phpBB/docs/AUTHORS +++ /dev/null @@ -1,92 +0,0 @@ -/** -* -* phpBB3 © Copyright phpBB Group -* http://www.phpbb.com -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, version 2 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://opensource.org/licenses/gpl-2.0.php> -* -*/ - -Please see: http://www.phpbb.com/about/team/ for a list of all the people currently -involved in phpBB. - -phpBB Lead Developer: naderman (Nils Adermann) - -phpBB Developers: bantu (Andreas Fischer) - dhruv.goel92 (Dhruv Goel) - EXreaction (Nathan Guse) - imkingdavid (David King) - nickvergessen (Joas Schilling) - prototech (Cesar Gallegos) - -Contributions by: leviatan21 (Gabriel Vazquez) - Raimon (Raimon Meuldijk) - Xore (Robert Hetzler) - - --- Former Contributors -- - -phpBB Project Manager: theFinn (James Atkinson) [Founder - 04/2007] - SHS` (Jonathan Stanley) - -phpBB Lead Developer: Acyd Burn (Meik Sievertsen) [09/2005 - 01/2010] - psoTFX (Paul S. Owen) [2001 - 09/2005] - -phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010] - Acyd Burn (Meik Sievertsen) [02/2003 - 09/2005] - APTX (Marek A. RuszczyÅ„ski) [12/2007 - 04/2011] - Arty (Vjacheslav Trushkin) [02/2012 - 07/2012] - Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006] - BartVB (Bart van Bragt) [11/2000 - 03/2006] - ckwalsh (Cullen Walsh) [01/2010 - 07/2011] - DavidMJ (David M.) [12/2005 - 08/2009] - dhn (Dominik Dröscher) [05/2007 - 01/2011] - GrahamJE (Graham Eames) [09/2005 - 11/2006] - kellanved (Henry Sudhof) [04/2007 - 03/2011] - igorw (Igor Wiedler) [08/2010 - 02/2013] - Oleg (Oleg Pudeyev) [01/2011 - 05/2013] - rxu (Ruslan Uzdenov) [04/2010 - 12/2012] - TerraFrost (Jim Wigginton) [04/2009 - 01/2011] - ToonArmy (Chris Smith) [06/2008 - 11/2011] - Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009] - --- Copyrights -- - -Visual Confirmation: Xore (Robert Hetzler) - -Original subSilver by subBlue Design, Tom Beddard, (c) 2001 phpBB Group -prosilver by subBlue Design, Tom Beddard, (c) 2004 phpBB Group -subsilver2 by subBlue Design, Tom Beddard, (c) 2004 phpBB Group - -phpBB3 contains code from the following applications: - -LGPL licenced: -Smarty (c) 2001, 2002 by ispi of Lincoln, Inc, http://smarty.php.net/ - -GPL licenced: -phpMyAdmin (c) 2001,2003 phpMyAdmin Devel team, http://www.phpmyadmin.net/ -Jabber Class (c) 2006 Flyspray.org, http://www.flyspray.org/ -Chora (c) 2000-2006, The Horde Project. http://horde.org/chora/ -Horde Project (c) 2000-2006, The Horde Project. http://horde.org/ -jQuery (c) 2011, John Resig. http://jquery.com/ -Sphinx Technologies Inc (c) 2001-2012 Andrew Aksyonoff, http://sphinxsearch.com/ -Plupload (c) 2010-2013 Moxiecode Systems AB, http://www.plupload.com/ - -PHP License, version 3.0: -Pear (c) 2001-2004 PHP Group, http://pear.php.net - -Text_Diff-0.2.1 http://pear.php.net/package/Text_Diff - -MIT licenced: -Symfony2 (c) 2004-2011 Fabien Potencier, http://symfony.com/ - diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 1ce5f29a72..b77af13d08 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -4,9 +4,9 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Changelog" /> -<title>phpBB3 • Changelog</title> +<title>phpBB • Changelog</title> -<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -16,15 +16,15 @@ <a id="top" name="top" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div id="doc-description"> - <a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a> + <a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a> <h1>phpBB 3.1.x Changelog</h1> <p style="display: none;"><a href="#start_here">Skip</a></p> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> </div> @@ -34,21 +34,49 @@ <!-- BEGIN DOCUMENT --> -<p>This is a non-exhaustive (but still near complete) changelog for phpBB 3.1.x including release candidate versions. Our thanks to all those people who've contributed bug reports and code fixes.</p> +<p class="paragraph main-description"> + This is a non-exhaustive (but still near complete) changelog for phpBB 3.1.x including release candidate versions. + Our thanks to all those people who've contributed bug reports and code fixes. +</p> <h1>Changelog</h1> <div class="paragraph menu"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> <ol> <li><a href="#changelog">Changelog</a> - <ol style="list-style-type: lower-roman;"> + <ul> + <li><a href="#v320a1">Changes since 3.2.0-a1</a></li> + <li><a href="#v31x">Changes since 3.1.x</a></li> + <li><a href="#v317">Changes since 3.1.7</a></li> + <li><a href="#v316">Changes since 3.1.6</a></li> + <li><a href="#v315">Changes since 3.1.5</a></li> + <li><a href="#v314">Changes since 3.1.4</a></li> + <li><a href="#v313">Changes since 3.1.3</a></li> + <li><a href="#v313rc1">Changes since 3.1.3-RC1</a></li> + <li><a href="#v312">Changes since 3.1.2</a></li> + <li><a href="#v311">Changes since 3.1.1</a></li> + <li><a href="#v310">Changes since 3.1.0</a></li> + <li><a href="#v310RC6">Changes since 3.1.0-RC6</a></li> + <li><a href="#v310RC5">Changes since 3.1.0-RC5</a></li> + <li><a href="#v310RC4">Changes since 3.1.0-RC4</a></li> + <li><a href="#v310RC3">Changes since 3.1.0-RC3</a></li> + <li><a href="#v310RC2">Changes since 3.1.0-RC2</a></li> + <li><a href="#v310RC1">Changes since 3.1.0-RC1</a></li> + <li><a href="#v310b4">Changes since 3.1.0-b4</a></li> + <li><a href="#v310b3">Changes since 3.1.0-b3</a></li> + <li><a href="#v310b2">Changes since 3.1.0-b2</a></li> + <li><a href="#v310b1">Changes since 3.1.0-b1</a></li> + <li><a href="#v310a3">Changes since 3.1.0-a3</a></li> <li><a href="#v310a2">Changes since 3.1.0-a2</a></li> <li><a href="#v310a1">Changes since 3.1.0-a1</a></li> <li><a href="#v30x">Changes since 3.0.x</a></li> + <li><a href="#v3013-PL1">Changes since 3.0.13-PL1</a></li> + <li><a href="#v3013">Changes since 3.0.13</a></li> + <li><a href="#v3012">Changes since 3.0.12</a></li> <li><a href="#v3011">Changes since 3.0.11</a></li> <li><a href="#v3010">Changes since 3.0.10</a></li> <li><a href="#v309">Changes since 3.0.9</a></li> @@ -70,14 +98,14 @@ <li><a href="#v30rc3">Changes since RC-3</a></li> <li><a href="#v30rc2">Changes since RC-2</a></li> <li><a href="#v30rc1">Changes since RC-1</a></li> - </ol> + </ul> </li> <li><a href="#disclaimer">Copyright and disclaimer</a></li> </ol> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -85,11 +113,1929 @@ <a name="changelog"></a><h2>1. Changelog</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <a name="v310a2"></a><h3>1.i. Changes since 3.1.0-a2</h3> + <a name="v320a1"></a><h3>Changes since 3.2.0-a1</h3><h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9791">PHPBB3-9791</a>] - invalid [] - chars on search URI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13451">PHPBB3-13451</a>] - A very long string inside message crashes PHP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14273">PHPBB3-14273</a>] - Unnecessary core.root_path dependency in files.upload service</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14293">PHPBB3-14293</a>] - Responsive .postbody width not expanding</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14295">PHPBB3-14295</a>] - Icon on left side of "Post awaiting approval" inside messages is missing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14311">PHPBB3-14311</a>] - Installer error messages not being reported back to client properly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14317">PHPBB3-14317</a>] - Run lang_migrate_help_lang script on master</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14320">PHPBB3-14320</a>] - Language selector is broken in the installer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14325">PHPBB3-14325</a>] - Renamed Event Variables Backwards Incompatible</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14326">PHPBB3-14326</a>] - Diffed files are not decoded at update</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14339">PHPBB3-14339</a>] - State support for PHP 7.0 in docs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14344">PHPBB3-14344</a>] - Improve formatting of errors during install</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14345">PHPBB3-14345</a>] - Check if message description exists in install cli iohandler</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14349">PHPBB3-14349</a>] - Improve error messages and remove output of suppressed messages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14350">PHPBB3-14350</a>] - Remove duplicate semi-colon from functions_user</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14358">PHPBB3-14358</a>] - Fatal error when running create_schema_files.php (missing composer autoloader)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14359">PHPBB3-14359</a>] - Wrong service definition for console.command.reparser.reparse</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12649">PHPBB3-12649</a>] - Change sort & display options in footers to dropdown menu</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14257">PHPBB3-14257</a>] - Reparse after update</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14269">PHPBB3-14269</a>] - Use http_exceptions instead of die() in installer controllers</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14310">PHPBB3-14310</a>] - Progress bar in new installer not very clear</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14340">PHPBB3-14340</a>] - Revert the workaround fix for segmentation fault error on phpBB 3.2 PHP 7 tests</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14247">PHPBB3-14247</a>] - Usage of @ at begining of an unquoted string in a yaml file is deprecated</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14341">PHPBB3-14341</a>] - Update to Symfony 2.8</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14348">PHPBB3-14348</a>] - Add an index.html to the install folder</li> + </ul> + + <a name="v31x"></a><h3>Changes since 3.1.x</h3> + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-6466">PHPBB3-6466</a>] - Permission Role Tooltips do not display in Safari</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-7187">PHPBB3-7187</a>] - Quote smilies error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-7275">PHPBB3-7275</a>] - Custom bbodes trim('${1}')</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8064">PHPBB3-8064</a>] - forum author sort not using username_clean</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8419">PHPBB3-8419</a>] - custom tag eats up space character</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8420">PHPBB3-8420</a>] - emoticon removes space before itself when using preview</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8613">PHPBB3-8613</a>] - BBCode_uid- and censor-bug</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9073">PHPBB3-9073</a>] - Word censoring in URLs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9109">PHPBB3-9109</a>] - Maximum allowed recepients restriction precedence</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9377">PHPBB3-9377</a>] - Custom BB Code Nesting</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10002">PHPBB3-10002</a>] - (incomplete) BBCode usage of [quote] - and [list] - forces closing [/list] - and [/quote] -s, ultimately breaking HTML/Design</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10388">PHPBB3-10388</a>] - Template engine should use json_encode() to properly escape JS properties</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10572">PHPBB3-10572</a>] - Unguarded includes in acp/</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10989">PHPBB3-10989</a>] - Bug in BBCode</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11444">PHPBB3-11444</a>] - Unnecessary notify column in phpbb_user_notifications table</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11967">PHPBB3-11967</a>] - Notification settings are not respected</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12143">PHPBB3-12143</a>] - Untranslated group name from index if not special group</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12195">PHPBB3-12195</a>] - Double-slash URLs not supported</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12387">PHPBB3-12387</a>] - mysqli_free_result is called with false value</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12554">PHPBB3-12554</a>] - Quotes do not display correctly as list elements</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12698">PHPBB3-12698</a>] - Replace all instances of magic numbers with constants in javascript</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12957">PHPBB3-12957</a>] - The template engine is not constructed properly in install/index</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12974">PHPBB3-12974</a>] - Update nightly version of develop to 3.2.0-a1-dev</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13101">PHPBB3-13101</a>] - Remove WLM contact from profile</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13238">PHPBB3-13238</a>] - \phpbb\db\migration\data\v310\mysql_fulltext_drop tries to drop non existent indexes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13359">PHPBB3-13359</a>] - Develop tests fail due to wrong template set up in tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13362">PHPBB3-13362</a>] - The whole cache dir (excluding the .htaccess and index.html files) should be ignored by git</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13371">PHPBB3-13371</a>] - Lang vars not loaded during install process</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13372">PHPBB3-13372</a>] - Environment Bug - Routing broken for extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13377">PHPBB3-13377</a>] - Function decode_message() incorrectly decodes www type URLs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13425">PHPBB3-13425</a>] - Smiley code at start of text being quoted doesn't show smiley image in quote</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13513">PHPBB3-13513</a>] - Mixed routing file paths in the router</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13555">PHPBB3-13555</a>] - Poll options preview rendered incorrectly by <br /> collision</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13619">PHPBB3-13619</a>] - Remove unneeded folders/files from vendor folder in release package</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13638">PHPBB3-13638</a>] - INCLUDECSS and INCLUDEJS Broken in 3.2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13670">PHPBB3-13670</a>] - Fix fatal function name must be a string in functional tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13680">PHPBB3-13680</a>] - Notification for a quote within a quote</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13718">PHPBB3-13718</a>] - Spambot countermeasures/CAPTCHA admin panel won't load</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13749">PHPBB3-13749</a>] - Add missing slash to base uri in helper route tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13766">PHPBB3-13766</a>] - Missing style_parent_id in textformater's data_access::get_styles()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13769">PHPBB3-13769</a>] - bin/phpbbcli.php ignores PHPBB_ENVIRONMENT constant from config.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13772">PHPBB3-13772</a>] - Error in @param variable type for phpbb\passwords\manager</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13782">PHPBB3-13782</a>] - ACM null caching driver class is named with the reserved word 'null'</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13792">PHPBB3-13792</a>] - Travis fails installing hhvm-nigthly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13814">PHPBB3-13814</a>] - phpbb_is_writable() method of the new filesystem class truncates files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13825">PHPBB3-13825</a>] - create_thumbnail() incorrectly calls phpbb\filesystem::phpbb_chmod</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13828">PHPBB3-13828</a>] - Rename null driver to dummy for PHP7 compatibility in tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13829">PHPBB3-13829</a>] - Router requires cache directory to be writable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13839">PHPBB3-13839</a>] - Failing test when the phpBB root directory isn't named phpbb</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13849">PHPBB3-13849</a>] - Development environment broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13860">PHPBB3-13860</a>] - Array to string conversion in parser service</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13871">PHPBB3-13871</a>] - Call to a member function realpath() on a non-object in functions.php on line 3474</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13875">PHPBB3-13875</a>] - Lint test should ignore cache, ext, and store folder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13890">PHPBB3-13890</a>] - Failling tests in master</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13896">PHPBB3-13896</a>] - Coding style issue in master</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13897">PHPBB3-13897</a>] - Non-existent environment causes fatal error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13906">PHPBB3-13906</a>] - BBCodes in signatures are not correctly parsed in post preview</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13990">PHPBB3-13990</a>] - Reparse markup inside of forum rules/description</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13993">PHPBB3-13993</a>] - Signature Editing Broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14008">PHPBB3-14008</a>] - Do not add a user_id value to quotes from guests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14033">PHPBB3-14033</a>] - Correct docblock errors</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14034">PHPBB3-14034</a>] - Fix reparser names that contain "text_reparser" in the middle</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14036">PHPBB3-14036</a>] - Replace path_helper with a mock</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14052">PHPBB3-14052</a>] - New installer - The commands are not translated</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14074">PHPBB3-14074</a>] - Not possible to clear notification (mark as read)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14076">PHPBB3-14076</a>] - Notifications settings are not correctly handled when a non default setting is set</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14078">PHPBB3-14078</a>] - Notification related sql general error on submission of editing post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14079">PHPBB3-14079</a>] - Cannot mark notification as read from the dropdown</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14094">PHPBB3-14094</a>] - Current master branch is getting segmentation fault error on PHP 7 tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14128">PHPBB3-14128</a>] - Image posting overflow regression</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14137">PHPBB3-14137</a>] - Fix Notification Menu Settings spacing issue caused by new jump-box improvements</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14138">PHPBB3-14138</a>] - Use span tags instead of abbr tags in the footer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14165">PHPBB3-14165</a>] - Fix layout of ucp/mcp after 14139</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14178">PHPBB3-14178</a>] - Installer database helper tests fail if sqlite3 is not present</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14180">PHPBB3-14180</a>] - Use unix line ending in files classes tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14182">PHPBB3-14182</a>] - Move the v310\notifications_board migration to v320\notifications_board</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14183">PHPBB3-14183</a>] - Remove deprecated max-device-width</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14193">PHPBB3-14193</a>] - Custom BBCode Buttons Broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14194">PHPBB3-14194</a>] - Responsive Quick Links Menu Broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14195">PHPBB3-14195</a>] - Plupload Attachments Not Quite Working</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14199">PHPBB3-14199</a>] - We need to hide icons from screen readers</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14202">PHPBB3-14202</a>] - Add missing sr-only classes to icons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14216">PHPBB3-14216</a>] - Do not run thumbnail test if gd is not enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14221">PHPBB3-14221</a>] - Fix viewforum header issue</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14222">PHPBB3-14222</a>] - ACP users page tries to cast deactivated_super_global to int</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14225">PHPBB3-14225</a>] - Inject the resolver in routing loaders when using them</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14230">PHPBB3-14230</a>] - Unread posts' icons don't have different color in viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14234">PHPBB3-14234</a>] - Do not use references in trigger_event()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14235">PHPBB3-14235</a>] - Font Awesome not available with simple_header.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14240">PHPBB3-14240</a>] - Always include all config files in the update package</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14274">PHPBB3-14274</a>] - New installer has weak inclusion of user functions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14277">PHPBB3-14277</a>] - Don't use user_id in migrations as it is not defined</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14278">PHPBB3-14278</a>] - Don't use user_id in installer if not available</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8672">PHPBB3-8672</a>] - No file size limit in getimagesize() and remote upload</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8708">PHPBB3-8708</a>] - Splitting global announcements from f_announce</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9485">PHPBB3-9485</a>] - Please include link to specific post in moderator's activity logs.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10268">PHPBB3-10268</a>] - extend function make_clickable() to also recognize semicolons as leading URL borders</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10620">PHPBB3-10620</a>] - Quote tag improvement</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10922">PHPBB3-10922</a>] - Allow parameters for [email] - BBCode content instead of addresses only</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11649">PHPBB3-11649</a>] - Move construction of twig environment to DIC</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11742">PHPBB3-11742</a>] - BBCode 'code' doesn't support tabs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12466">PHPBB3-12466</a>] - Move classes from acp_database.php to their own files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12487">PHPBB3-12487</a>] - Update PHP code</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12608">PHPBB3-12608</a>] - Improve notifications drop-down menu styling in header</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12654">PHPBB3-12654</a>] - Improve header search-box styling</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12681">PHPBB3-12681</a>] - Cache the compiled routes and dump the url_generator</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12719">PHPBB3-12719</a>] - Convert to Normalize & SUITCSS - base for reset</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12745">PHPBB3-12745</a>] - Allow Emoji characters in posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12769">PHPBB3-12769</a>] - Add and use Font-Awesome to handle proSilver icons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12821">PHPBB3-12821</a>] - Use CSS instead of images for gradients</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12958">PHPBB3-12958</a>] - Remove subsilver2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13063">PHPBB3-13063</a>] - Move functions_url_matcher to a proper class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13132">PHPBB3-13132</a>] - Twig: move the loops content from loops. to the root context</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13137">PHPBB3-13137</a>] - Remove schema.json from repository</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13178">PHPBB3-13178</a>] - Allow posting Emoji characters if the database supports it</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13206">PHPBB3-13206</a>] - DEBUG mode should automatically recompile stale style components</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13266">PHPBB3-13266</a>] - Enabling twig dump function if DEBUG is defined</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13388">PHPBB3-13388</a>] - Integrate routing and di parameters resolution</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13450">PHPBB3-13450</a>] - Type-hint return value of $phpbb_container->get()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13455">PHPBB3-13455</a>] - Change request_var() calls with $request->variable()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13468">PHPBB3-13468</a>] - Change add_log() calls with $phpbb_log->add()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13494">PHPBB3-13494</a>] - Replace set_config() calls with $config->set()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13496">PHPBB3-13496</a>] - Replace set_config_count() calls with $config->increment()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13497">PHPBB3-13497</a>] - Change get_tables() calls with $db_tools->sql_list_tables()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13498">PHPBB3-13498</a>] - Change get_user_avatar() calls with phpbb_get_avatar()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13499">PHPBB3-13499</a>] - Move get_remote_file() to functions_compatibility.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13595">PHPBB3-13595</a>] - Remove unused instances of the bbcode class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13614">PHPBB3-13614</a>] - Remove phpbb_pcre_utf8_support() and assume Unicode is supported by PCRE</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13652">PHPBB3-13652</a>] - Extend SQL query builder functionality</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13697">PHPBB3-13697</a>] - Rewriting/moving file system functions to filesystem class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13740">PHPBB3-13740</a>] - Refactoring installer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13762">PHPBB3-13762</a>] - Moving translation loading and language related functions into a service</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13770">PHPBB3-13770</a>] - Make DI Container builder constructor dependency free</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13789">PHPBB3-13789</a>] - Implement Googles noCAPTCHA reCAPTCHA</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13801">PHPBB3-13801</a>] - Decouple the user object from the text_formatter.s9e.parser service</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13803">PHPBB3-13803</a>] - Implement a generic and scalable way to reparse rich text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13805">PHPBB3-13805</a>] - Make generate_text_for_storage() match the signature and feature set of message_parser::parse()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13844">PHPBB3-13844</a>] - Replace help_ language magic with a help manager and normal language files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13847">PHPBB3-13847</a>] - Move quote generation to text_formatter.utils</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13891">PHPBB3-13891</a>] - Add CLI commands for reparsing text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13901">PHPBB3-13901</a>] - Give quotes more whitespace in the posting form for readability</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13902">PHPBB3-13902</a>] - Increase the CSS margin around blockquote</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13904">PHPBB3-13904</a>] - Refactor attachment upload functions into service</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13921">PHPBB3-13921</a>] - Try harder to fix block elements BBCodes used inside of inline elements BBCodes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13946">PHPBB3-13946</a>] - Increase the CSS margin around [code] - and [list] -</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13970">PHPBB3-13970</a>] - Save the value of the optional parameter in [code] - BBCode</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13986">PHPBB3-13986</a>] - Add --resume option to reparser CLI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13987">PHPBB3-13987</a>] - Add --dry-run option to reparser CLI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14000">PHPBB3-14000</a>] - Make it possible to use emojis in posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14097">PHPBB3-14097</a>] - Catch and show all exceptions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14107">PHPBB3-14107</a>] - dropdown rendering on rtl</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14124">PHPBB3-14124</a>] - Automatically translate exception in CLI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14139">PHPBB3-14139</a>] - stop styling IDs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14157">PHPBB3-14157</a>] - Allow administrators to set an alt attribute for topic icons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14162">PHPBB3-14162</a>] - Add CLI commands to manage migrations</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14168">PHPBB3-14168</a>] - Refactor attachment management functions into classes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14174">PHPBB3-14174</a>] - issues in language\en\install_new.php </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14175">PHPBB3-14175</a>] - Refactor responsive implementation for easier manipulation</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14206">PHPBB3-14206</a>] - Fix jumpbox incosistencies</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14220">PHPBB3-14220</a>] - Adding routing file locator and route loader services</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14231">PHPBB3-14231</a>] - Fix double home icon in breadcrumbs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14237">PHPBB3-14237</a>] - Use language class in the notifications component</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14264">PHPBB3-14264</a>] - Don't use constants in textreparser plugins</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10165">PHPBB3-10165</a>] - Send test email feature on email settings ACP page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11768">PHPBB3-11768</a>] - Integrate s9e\TextFormatter</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12516">PHPBB3-12516</a>] - Always preview signature in UCP/ACP module</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12620">PHPBB3-12620</a>] - Allow the user to define multiples environments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12692">PHPBB3-12692</a>] - Add a console command to manage the thumbnail</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13329">PHPBB3-13329</a>] - Rely on Intl and mbstring, use patchwork/utf8 as fallback</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13641">PHPBB3-13641</a>] - problem with custom BBCode</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13961">PHPBB3-13961</a>] - Add orderable service collections</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14125">PHPBB3-14125</a>] - Add --env option to all CLI commands</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14158">PHPBB3-14158</a>] - Add a lang_array function to the language service to avoid using call_user_func</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12577">PHPBB3-12577</a>] - Use a lazy service to delay the construction of the passwords_manager</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12581">PHPBB3-12581</a>] - Use the proxy pattern for the template lexer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12632">PHPBB3-12632</a>] - Use a twig.debug environment config value to enable Twig debug</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12633">PHPBB3-12633</a>] - Add debug.template.events</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12699">PHPBB3-12699</a>] - Replace instances in the message textarea keydown callback</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13421">PHPBB3-13421</a>] - Create an interface for db\tools.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13487">PHPBB3-13487</a>] - Add factory for db tool class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13645">PHPBB3-13645</a>] - Moving feeds to controllers</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13647">PHPBB3-13647</a>] - Move FAQ to controller</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13654">PHPBB3-13654</a>] - Moving reports to controller</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13881">PHPBB3-13881</a>] - Unify quote removal in 3.1 and 3.2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13935">PHPBB3-13935</a>] - Allow more admin-configurable schemes in post links</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14039">PHPBB3-14039</a>] - Refactoring the updater</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14044">PHPBB3-14044</a>] - Deduplicate the installers</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9457">PHPBB3-9457</a>] - [Accessibility] - Add WAI-ARIA landmarks to the Prosilver template files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11528">PHPBB3-11528</a>] - Use mink for acceptance tests involving javascript execution</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12384">PHPBB3-12384</a>] - Run Travis CI HHVM tests against MySQLi instead of MySQL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12505">PHPBB3-12505</a>] - Remove outdated media handling in attachment.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12564">PHPBB3-12564</a>] - Remove obsolete version definitions from module info files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12916">PHPBB3-12916</a>] - Add separate nightly builds for 3.1 and 3.2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13130">PHPBB3-13130</a>] - Update dependencies to Symfony 2.5</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13139">PHPBB3-13139</a>] - Update Twig to 1.18.0</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13363">PHPBB3-13363</a>] - Replace phpbb\php\ini with composer package bantu/ini-get-wrapper</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13407">PHPBB3-13407</a>] - Update Symfony Components to 2.7.x</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13572">PHPBB3-13572</a>] - Upgrade composer to 1.0.0-alpha9</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13634">PHPBB3-13634</a>] - Update README to show new branch names</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13725">PHPBB3-13725</a>] - Coding guidelines: static public</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13767">PHPBB3-13767</a>] - Remove .git from vendor/s9e/text-formatter</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13768">PHPBB3-13768</a>] - Update to Symfony 2.8@dev</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13774">PHPBB3-13774</a>] - Update s9e\TextFormatter</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13777">PHPBB3-13777</a>] - Move acp/modules module handling code into a service</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13793">PHPBB3-13793</a>] - Remove message translation from exceptions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13800">PHPBB3-13800</a>] - Make extension manager an optional dependency for the router</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13804">PHPBB3-13804</a>] - Make template's user dependency optional</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13832">PHPBB3-13832</a>] - Replace use of deprecated e modifier of preg_replace in bbcode functions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13985">PHPBB3-13985</a>] - Update s9e\TextFormatter</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14015">PHPBB3-14015</a>] - Update Symfony to the latest 2.8@dev</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14053">PHPBB3-14053</a>] - Remove @covers annotations from installer config test</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14056">PHPBB3-14056</a>] - Keep install schema resources in the install folder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14096">PHPBB3-14096</a>] - Update Symfony to the latest 2.8@dev</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14140">PHPBB3-14140</a>] - Update Symfony to benefit from improvement to the console component</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14150">PHPBB3-14150</a>] - Update fast-image-size to newest release</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14205">PHPBB3-14205</a>] - Bump PHP requirement to 5.4</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14238">PHPBB3-14238</a>] - Update Symfony to the latest 2.8@dev</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14243">PHPBB3-14243</a>] - Exclude every .git directory from the pakages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14256">PHPBB3-14256</a>] - Remove PHP7 from the allowed failures</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14265">PHPBB3-14265</a>] - Make all tables available in the container</li> + </ul> + + <a name="v317"></a><h3>Changes since 3.1.7</h3> + + <h4>Security Issue</h4> + <ul> + <li>[SECURITY-188] - Check form key in acp_bbcodes</li> + </ul> + <h4>Bug</h4> + <ul> + <li>[<a href="https://tracker.phpbb.com/browse/PHPBB3-14343">PHPBB3-14343</a>] - Undefined variable $phpbb_dispatcher when (un-)locking a topic or post</li> + </ul> + + <a name="v316"></a><h3>Changes since 3.1.6</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8839">PHPBB3-8839</a>] - Wrong new status of subforumlink on index</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8920">PHPBB3-8920</a>] - PM-Report for every moderator</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9153">PHPBB3-9153</a>] - New member can delete pm just in one way</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9252">PHPBB3-9252</a>] - Conflict when (dis)approving a post by two moderators at the same time</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11468">PHPBB3-11468</a>] - Controllers can not set additional parameters of page_header()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11971">PHPBB3-11971</a>] - Validating not correctly in Spambot countermeasures</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12616">PHPBB3-12616</a>] - Report notification is not removed when post is disapproved or deleted</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13202">PHPBB3-13202</a>] - dead code in sessions.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13423">PHPBB3-13423</a>] - Driver sqlite3 failed periodically</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13636">PHPBB3-13636</a>] - Unexpect return to previous page behaviour</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13656">PHPBB3-13656</a>] - database_upgrade.php fails when database password contains a % character</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13748">PHPBB3-13748</a>] - Wrong tooltip after poll vote change</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13759">PHPBB3-13759</a>] - submit_post doesn't take $data['post_time'] - into account</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13799">PHPBB3-13799</a>] - Avatar gallery subfolders paths are handled incorrectly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13831">PHPBB3-13831</a>] - Post deletion reason is not appearing on moderation logs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13835">PHPBB3-13835</a>] - File upload of large files where filename contains umlauts fails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13846">PHPBB3-13846</a>] - Permissions around soft deleting are inconsistently handled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13851">PHPBB3-13851</a>] - "Can ignore flood limit" permission not taking effect</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13892">PHPBB3-13892</a>] - "Someone reports a post" notification setting has no effect</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13945">PHPBB3-13945</a>] - Account re-activation does not create a notification</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13950">PHPBB3-13950</a>] - If disabled extension - no hidden permission set</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13960">PHPBB3-13960</a>] - Profile field validation may break</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13976">PHPBB3-13976</a>] - Fix comment typo in salted_md5 driver</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13988">PHPBB3-13988</a>] - Atom feeds use relative links for image attachments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13992">PHPBB3-13992</a>] - Fix html5 error from output on w3.org its new validator</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14058">PHPBB3-14058</a>] - subsilver2 Contact us form doesn't have an email subject field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14070">PHPBB3-14070</a>] - Disabled avatar types is still displayed on the forum</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14106">PHPBB3-14106</a>] - Sorting is unworkable while moderating forum (merge topics)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14114">PHPBB3-14114</a>] - Inconsistency in install.html in 3.1.x Automatic uopdate package</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14127">PHPBB3-14127</a>] - Error in the BBCode FAQ in 'Linking to another site'</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14142">PHPBB3-14142</a>] - Remove unused ignore_configs from avatar drivers</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14143">PHPBB3-14143</a>] - Flush the in-memory mail queue when writing it to the disk</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14153">PHPBB3-14153</a>] - Notifications dropdown header doesn't clear floats</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14159">PHPBB3-14159</a>] - Not accessible link on main ACP page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14161">PHPBB3-14161</a>] - The core.download_file_send_to_browser_before - $vars - 'extension' it does not exist</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14163">PHPBB3-14163</a>] - Select All in code bug in Edge</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14181">PHPBB3-14181</a>] - Custom report/denial reason not shown in user notifications</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14186">PHPBB3-14186</a>] - Incorrect string concatenation in phpbb_mcp_sorting()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14200">PHPBB3-14200</a>] - Allow hidden users to see theself on viewonline</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14215">PHPBB3-14215</a>] - [ticket/14212] - Adding event after users have been removed to a group</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14217">PHPBB3-14217</a>] - [ticket/13591] - Change SQL query into array to allow</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14224">PHPBB3-14224</a>] - Fix trailing whitespaces</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14228">PHPBB3-14228</a>] - Vertical align of numbers in polls</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14236">PHPBB3-14236</a>] - Race condition in the functional tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14242">PHPBB3-14242</a>] - Fix on memberlist the sort method.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14249">PHPBB3-14249</a>] - Online list isn't sorted anymore</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14258">PHPBB3-14258</a>] - Add event in auth::Login</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14271">PHPBB3-14271</a>] - Update nginx sample config</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14276">PHPBB3-14276</a>] - Function get_folder_status not setup for use of plurals</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14287">PHPBB3-14287</a>] - Loading indicator not removed after confirming action that does not produce a message</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14297">PHPBB3-14297</a>] - Uppercase and lowercase when sorting topics</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14334">PHPBB3-14334</a>] - Do not use deprecated function get_user_avatar() in user_loader</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14339">PHPBB3-14339</a>] - State support for PHP 7.0 in docs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14346">PHPBB3-14346</a>] - Improve version check output when phpbb.com is unreachable</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-7362">PHPBB3-7362</a>] - Title/Post Icons Need Attribute Text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8800">PHPBB3-8800</a>] - Add "mark topics read" link to "View unread posts"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10343">PHPBB3-10343</a>] - ACP: searching for users does not show inactive accounts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13684">PHPBB3-13684</a>] - Only resize attached file comments vertically</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13934">PHPBB3-13934</a>] - Enctype clause for forms may be needed for profile fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14066">PHPBB3-14066</a>] - Add template events to search_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14073">PHPBB3-14073</a>] - Add core events to the several places in includes/functions_admin.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14075">PHPBB3-14075</a>] - Event in posting preview</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14080">PHPBB3-14080</a>] - Add template events to viewforum_body.html before/after/append/prepend the topic row</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14088">PHPBB3-14088</a>] - Add core events to the search.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14089">PHPBB3-14089</a>] - [Template] - posting_topic_title_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14098">PHPBB3-14098</a>] - Add core events to the search backends (fulltext_*.php)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14102">PHPBB3-14102</a>] - Add core event to the mcp_topic.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14113">PHPBB3-14113</a>] - Add core events to the memberlist.php for customizing members search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14117">PHPBB3-14117</a>] - Add core events to index.php to allow modifying birthdays list</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14123">PHPBB3-14123</a>] - Add more descriptive help to the CLI commands</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14126">PHPBB3-14126</a>] - Add viewtopic_topic_title_after template event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14133">PHPBB3-14133</a>] - Comment fix for phpbb_get_user_rank()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14154">PHPBB3-14154</a>] - Include "Clean Name" for disabled Extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14155">PHPBB3-14155</a>] - Add row highlighting to extensions and style management</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14156">PHPBB3-14156</a>] - Add the Symfony ResponseListener</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14164">PHPBB3-14164</a>] - Helpful instructions for database updates</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14170">PHPBB3-14170</a>] - Fix mcp_change_poster_after event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14201">PHPBB3-14201</a>] - Add ACP template events</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14213">PHPBB3-14213</a>] - [PHP] - core.group_add_user_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14219">PHPBB3-14219</a>] - Add email address into inactive user display in ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14261">PHPBB3-14261</a>] - Pages served from app.php can't disable the update of session_page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14283">PHPBB3-14283</a>] - Add a "Manage Group" link on a group page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14313">PHPBB3-14313</a>] - Don't display quote button on unapproved posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14343">PHPBB3-14343</a>] - Add event when locking/unlocking posts/topics</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14144">PHPBB3-14144</a>] - [Template] - quickreply_editor_subject_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14146">PHPBB3-14146</a>] - [Template] - viewtopic_body_post_subject_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14187">PHPBB3-14187</a>] - [ACP Template] - acp_styles_before_table</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14188">PHPBB3-14188</a>] - [PHP] - core.acp_styles_action_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14191">PHPBB3-14191</a>] - [PHP] - core.get_gravatar_url_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14192">PHPBB3-14192</a>] - [PHP] - core.memberlist_memberrow_before</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14140">PHPBB3-14140</a>] - Update Symfony to benefit from improvement to the console component</li> + </ul> + + <a name="v315"></a><h3>Changes since 3.1.5</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10711">PHPBB3-10711</a>] - SQL error DUPLICATE for KEY in FORUMS_TRACK_TABLE </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13711">PHPBB3-13711</a>] - disabled accounts receive mails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13815">PHPBB3-13815</a>] - Event parameters in posting do not affect behavior as expected</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13903">PHPBB3-13903</a>] - Container naming doesn't allow Windows' semicolon</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13930">PHPBB3-13930</a>] - Check for correct spacing between keyword & parenthesis in codesniffer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13941">PHPBB3-13941</a>] - One test is blocked in an inifinite loop on php 5.5+ and with sqlite3</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13948">PHPBB3-13948</a>] - Only reports top level WHOIS IP for a user in ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13949">PHPBB3-13949</a>] - Replace colon with colon lang key in memberlist search page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13951">PHPBB3-13951</a>] - Jump to page function does not work since 3.1.5 upgrade</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13952">PHPBB3-13952</a>] - Fulltext Native errors from tidy_search cron task</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13955">PHPBB3-13955</a>] - 3.1.5 not loading CDN resources</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13962">PHPBB3-13962</a>] - Forum dropdown in MCP queue could expand beyond screen size</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13966">PHPBB3-13966</a>] - Change post's author --> error message</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13967">PHPBB3-13967</a>] - BBCode guide - loading phpBB logo image breaks https</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13980">PHPBB3-13980</a>] - Current avatar not removed when uploading with different extension</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13984">PHPBB3-13984</a>] - AJAX Loading Indicator broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14037">PHPBB3-14037</a>] - Memberlist profile fields headlines not computed from same way as data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14049">PHPBB3-14049</a>] - Plupload delete request should use config headers</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14069">PHPBB3-14069</a>] - Incorrect sql_fetchfield call in style_update_p1 migration</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14077">PHPBB3-14077</a>] - Select all code not work in Microsoft Edge</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14082">PHPBB3-14082</a>] - Fix wrong variables in fulltext native search for keyworded results</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14083">PHPBB3-14083</a>] - Fix wrong variables in fulltext mysql search for author search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14093">PHPBB3-14093</a>] - Hardcoded language in ucp_pm_viewfolder.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14103">PHPBB3-14103</a>] - Underline in abbreviations in Firefox 40</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14104">PHPBB3-14104</a>] - Fix missing variable in fulltext native search query for total results for author</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14115">PHPBB3-14115</a>] - Microdata is not valid in prosilver</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11530">PHPBB3-11530</a>] - Remove quotes that are too deep automatically</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12952">PHPBB3-12952</a>] - Display HTTP Output along with Status code in case assertion fails in functional tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13598">PHPBB3-13598</a>] - Add an option to post a locked topic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13786">PHPBB3-13786</a>] - Add core events to add MCP post options</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13818">PHPBB3-13818</a>] - Browse Extensions Database link in Extension Manager</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13843">PHPBB3-13843</a>] - Add templates events to insert custom panel-tab into posting editor</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13863">PHPBB3-13863</a>] - [Template] - topiclist_row_append/topiclist_row_prepend in mcp_forum.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13879">PHPBB3-13879</a>] - We're using px most places but ems in others</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13882">PHPBB3-13882</a>] - Avatars in notifications should be lazy loaded</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13899">PHPBB3-13899</a>] - Add items to core.search_results_modify_search_title</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13911">PHPBB3-13911</a>] - Add configuration options to profile fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13931">PHPBB3-13931</a>] - Wrong order in docs/events.md</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13968">PHPBB3-13968</a>] - [PHP] - core.user_setup_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13971">PHPBB3-13971</a>] - Add draft_id variable to event core.posting_modify_template_vars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13981">PHPBB3-13981</a>] - Events to intercept uploaded avatar deletion</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13995">PHPBB3-13995</a>] - Invalid HTML using Projection Media Type</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14002">PHPBB3-14002</a>] - Add template events before/after user details in ucp_main_front.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14005">PHPBB3-14005</a>] - Allow extensions control post buttons displaying</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14014">PHPBB3-14014</a>] - [PHP] - mcp_forum_view_actions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14064">PHPBB3-14064</a>] - Add template events to ucp_pm_history.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14065">PHPBB3-14065</a>] - Add template events to attachment.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14067">PHPBB3-14067</a>] - Add template events to overall_header.html around feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14068">PHPBB3-14068</a>] - New events around poll panel in viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14072">PHPBB3-14072</a>] - Add core event to the function format_display()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14085">PHPBB3-14085</a>] - [Template] - posting_topic_title_prepend</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14086">PHPBB3-14086</a>] - [Template] - Add mcp_forum_topic_title_*</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14090">PHPBB3-14090</a>] - [Template] - mcp_topic_topic_title_*</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14091">PHPBB3-14091</a>] - [Template] - mcp_topic_subject_*</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14101">PHPBB3-14101</a>] - Add core event to the download/file.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14116">PHPBB3-14116</a>] - sql_affectedrows has no arguments</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12692">PHPBB3-12692</a>] - Add a console command to manage the thumbnail</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13311">PHPBB3-13311</a>] - Add php event to acp manage_forums when deleting content</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13974">PHPBB3-13974</a>] - Add php event for altering data when changing a post's poster</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13997">PHPBB3-13997</a>] - [Template] - posting_editor_submit_buttons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14006">PHPBB3-14006</a>] - [PHP] - core.ucp_register_agreement</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14041">PHPBB3-14041</a>] - [Template] - viewtopic_dropdown_top_custom</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14042">PHPBB3-14042</a>] - [Template] - viewtopic_dropdown_bottom_custom</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14043">PHPBB3-14043</a>] - [PHP] - core.get_avatar_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14087">PHPBB3-14087</a>] - Add an event to ucp_activate.php.</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13694">PHPBB3-13694</a>] - Allow modifying the Postgres author search query for results</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13947">PHPBB3-13947</a>] - Add CHItA to developer list</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14010">PHPBB3-14010</a>] - Update Plupload to 2.1.8</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14099">PHPBB3-14099</a>] - Update Twig to 1.20</li> + </ul> + + + <a name="v314"></a><h3>Changes since 3.1.4</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9563">PHPBB3-9563</a>] - Empty categories showing up on index</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11521">PHPBB3-11521</a>] - Missing language string when migration is invalid</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11532">PHPBB3-11532</a>] - acp_users_overview.html autocompletes "confirm email" and "password" fields in chrome</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13516">PHPBB3-13516</a>] - icc-profiler check should skip extensions vendor</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13564">PHPBB3-13564</a>] - User is not removed from oauth tables upon deletion</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13664">PHPBB3-13664</a>] - Allow changing total list for unapproved posts in mcp_front</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13755">PHPBB3-13755</a>] - uploading attachments results in error: parsing server response. </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13763">PHPBB3-13763</a>] - Language Spelling Error: Completly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13771">PHPBB3-13771</a>] - AJAX responses do not support exceptions messages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13772">PHPBB3-13772</a>] - Error in @param variable type for phpbb\passwords\manager</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13779">PHPBB3-13779</a>] - Permission set migration tool grants regular users heightened permissions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13787">PHPBB3-13787</a>] - Duplicate entry of poll_delete in prosilver template</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13792">PHPBB3-13792</a>] - Travis fails installing hhvm-nigthly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13819">PHPBB3-13819</a>] - Add missing sql_freeresult() to files in includes/</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13822">PHPBB3-13822</a>] - Permissions are in the wrong category</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13823">PHPBB3-13823</a>] - Update package is missing file with inline whitespace changes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13827">PHPBB3-13827</a>] - controller\helper::message does not return JSON object for AJAX requests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13830">PHPBB3-13830</a>] - phpcs doesn't detect class using in catch blocks</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13833">PHPBB3-13833</a>] - Submit a lot of messages without timeout between messages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13838">PHPBB3-13838</a>] - Add a sniff to ensure that the opening brace of a control statement is on the line after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13852">PHPBB3-13852</a>] - Inconsistent tab navigation when login in</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13861">PHPBB3-13861</a>] - Old styles are not removed by style update migration</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13868">PHPBB3-13868</a>] - Adding multiple language files for acp/mcp/ucp modules is incorrectly handled for extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13873">PHPBB3-13873</a>] - Remove broken print stylesheet in preference of &view=print</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13875">PHPBB3-13875</a>] - Lint test should ignore cache, ext, and store folder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13878">PHPBB3-13878</a>] - Properly display background images when printing with webkit browser</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13888">PHPBB3-13888</a>] - "Couldn't fetch mysqli_result" error on username search and egosearch</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13913">PHPBB3-13913</a>] - Post subject of password protected and list-only forums shown on board index</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13922">PHPBB3-13922</a>] - Whitespace found at end of line phpBB/includes/functions_admin.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13928">PHPBB3-13928</a>] - Fix build_cfg_template_test after ticket/sec-184 </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13939">PHPBB3-13939</a>] - phpBB no longer shows error messages when uploading files with drag/drop</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13942">PHPBB3-13942</a>] - phpbb\user::set_lang() adds extra path and PHP extension to ext lang files</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12101">PHPBB3-12101</a>] - Redirect for Microsoft servers in /includes/functions.php:redirect()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12542">PHPBB3-12542</a>] - Highlight textarea when files are dragged over it</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12717">PHPBB3-12717</a>] - Improve the code sniffer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13200">PHPBB3-13200</a>] - Add autocomplete="off" to additional password fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13648">PHPBB3-13648</a>] - Allow extensions using custom bbcode validation methods</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13699">PHPBB3-13699</a>] - Add template events in viewforum_body.html before and after the title</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13745">PHPBB3-13745</a>] - Add veiwtopic.php core event to allow manipulating poll data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13750">PHPBB3-13750</a>] - Add generate_forum_nav() core event to allow modifying navlinks text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13752">PHPBB3-13752</a>] - Add viewonline.php core event to allow modifying forum data SQL query</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13753">PHPBB3-13753</a>] - Add template events to forum category header</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13778">PHPBB3-13778</a>] - Misleading instruction text for recaptcha plugin</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13790">PHPBB3-13790</a>] - Update phpcs to 2.3.2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13791">PHPBB3-13791</a>] - Add more post buttons template events to viewtopic_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13808">PHPBB3-13808</a>] - Add event before and after the search form</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13809">PHPBB3-13809</a>] - Test php parsing on php7 on travis</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13841">PHPBB3-13841</a>] - Add event when topics are moved</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13858">PHPBB3-13858</a>] - Make the Plupload uploader instance available in the global namespace</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13872">PHPBB3-13872</a>] - Allow template events to have a changed tag</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13876">PHPBB3-13876</a>] - Use async webfontloader to load webfont from googles CDN</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13905">PHPBB3-13905</a>] - loading.gif loaded before document load when it isn't needed</li> + </ul> + <h4>Security Issue</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13917">PHPBB3-13917</a>] - Use hash_equals() if possible in password driver helper</li> + <li>[SECURITY-184] - Do not output passwords to HTML input fields</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13660">PHPBB3-13660</a>] - Allow changing the query for total reports in mcp_front</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13661">PHPBB3-13661</a>] - Allow changing how and which logs are retrieved</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13668">PHPBB3-13668</a>] - Allow modifying the query to get details from the post report</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13672">PHPBB3-13672</a>] - Allow changing the query to obtain the user-submitted report.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13685">PHPBB3-13685</a>] - Allow modifying the keywords search query for mysql fulltext search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13686">PHPBB3-13686</a>] - Allow modifying the fulltext native search query for total results before before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13689">PHPBB3-13689</a>] - Allow modifying the Postgres native search query for results</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13691">PHPBB3-13691</a>] - Allow modifying the fulltext native search query for total results for author</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13693">PHPBB3-13693</a>] - Allow modifying the MySQL author search query for results</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13807">PHPBB3-13807</a>] - Extend event exporter to filter by min or max version to allow generating event diffs for releases</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13887">PHPBB3-13887</a>] - JS could use some refactoring</li> + </ul> + + + <a name="v313"></a><h3>Changes since 3.1.3</h3> + + <h4>Security</h4> + <ul> + <li>[SECURITY-180] - An insufficient check allowed users of the Google Chrome browser to be redirected to external domains (e.g. on login)</li> + </ul> + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8050">PHPBB3-8050</a>] - Avatar & Long PM recipients list break out of template</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8250">PHPBB3-8250</a>] - Forum selections in MCP queue not working</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8494">PHPBB3-8494</a>] - Cannot install two boards on the same postgresql database</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11424">PHPBB3-11424</a>] - Quick-Mod Tools race condition results in NO_MODE</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12368">PHPBB3-12368</a>] - Updating database fails in upgrade from 3.0 when trying twice without purging the cache</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13348">PHPBB3-13348</a>] - sql_freeresult() should be called in feed base class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13414">PHPBB3-13414</a>] - download/file.php 304 Not Modified bug</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13433">PHPBB3-13433</a>] - A dot in email address leads to unwanted extraneous dot</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13463">PHPBB3-13463</a>] - Mark read icon displays on wrong side in RTL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13469">PHPBB3-13469</a>] - Soft delete fails with error message</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13472">PHPBB3-13472</a>] - Notification for admin activation of user doesn't get pruned after the user is deleted</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13477">PHPBB3-13477</a>] - File caching of extensions' version check file doesn't work</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13493">PHPBB3-13493</a>] - $helper->route gives wrong path for guests with trailing slashes and mod_rewrite disabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13522">PHPBB3-13522</a>] - Q&A Captcha ACP, admins can add blank answers</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13538">PHPBB3-13538</a>] - Add tests for pagination in nested loops</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13542">PHPBB3-13542</a>] - Add $error to core UCP event for better validating of new UCP options</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13550">PHPBB3-13550</a>] - Invalid JSON response returned when plupload dir is not writable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13551">PHPBB3-13551</a>] - Authentication method- LDAP- entered value 'ldap base dn' does not display</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13555">PHPBB3-13555</a>] - Poll options preview rendered incorrectly by <br /> collision</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13563">PHPBB3-13563</a>] - No Private Message button shown in memberlist for subsilver2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13568">PHPBB3-13568</a>] - Imagick path validated as relative path although ACP asks for absolute path</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13569">PHPBB3-13569</a>] - Use sql_freeresult for $result assignments and remove unneeded $result assignments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13570">PHPBB3-13570</a>] - Mysqli extension supports persistent connection since PHP 5.3.0</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13577">PHPBB3-13577</a>] - Skip tests requiring fileinfo if fileinfo is not enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13586">PHPBB3-13586</a>] - Allow '0' as username with Jabber notifications</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13587">PHPBB3-13587</a>] - SQL syntax errors in get_prune_users()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13588">PHPBB3-13588</a>] - Information message for disabled fsockopen() is not displayed correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13590">PHPBB3-13590</a>] - Remember me login keys should be centered</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13597">PHPBB3-13597</a>] - Modify variable-variable syntax to be compatible with PHP7</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13612">PHPBB3-13612</a>] - Functional test of extension fails if ext requires page refresh</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13615">PHPBB3-13615</a>] - Avatar Gallery shows categories but no images in subsilver2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13617">PHPBB3-13617</a>] - Bot session continuation with invalid f= query paramter causes SQL error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13618">PHPBB3-13618</a>] - Small grammatical typo in the English FAQ regarding COPPA</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13631">PHPBB3-13631</a>] - Fix variable name in core.phpbb_content_visibility_get_global_visibility_before event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13639">PHPBB3-13639</a>] - Unused class icon-search-advanced references nonexistent image</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13644">PHPBB3-13644</a>] - Type hint dispatcher_interface instead of dispatcher</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13649">PHPBB3-13649</a>] - Subforum tooltip always displays "no unread posts" on viewforum.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13655">PHPBB3-13655</a>] - $phpbb_dispatcher undefined in phpbb_mcp_sorting()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13657">PHPBB3-13657</a>] - Start testing against PHP7</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13666">PHPBB3-13666</a>] - data-clicked attribute is not always removed on ajax form submissions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13667">PHPBB3-13667</a>] - Big buttons are incorrectly aligned in Chrome on Windows</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13670">PHPBB3-13670</a>] - Fix fatal function name must be a string in functional tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13698">PHPBB3-13698</a>] - Incorrect password message shows unparsed "Board Administrator"-link</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13702">PHPBB3-13702</a>] - Page is zoomed in by default on iOS devices in landscape mode</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13703">PHPBB3-13703</a>] - Uploaded avatars are not loading correctly when passing through the events</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13719">PHPBB3-13719</a>] - Remove superfluous $search_options in acp_search.php </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13721">PHPBB3-13721</a>] - URL Rewriting doesn't work on IIS7</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13723">PHPBB3-13723</a>] - Update docs/AUTHORS for 3.1.4-RC1</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13726">PHPBB3-13726</a>] - Responsive breadcrumbs JavaScript incorrectly calculates width of hidden items</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13727">PHPBB3-13727</a>] - Responsive breadcrumbs JavaScript doesn't reset wrap- classes when resizing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13732">PHPBB3-13732</a>] - Update composer for PHP7 compatibility</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13736">PHPBB3-13736</a>] - Replace colons with colon lang keys in Contact us page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13738">PHPBB3-13738</a>] - Sami still refers to develop-* branches</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13741">PHPBB3-13741</a>] - Remove outdated comments in CSS files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13742">PHPBB3-13742</a>] - Local avatar driver is not generating correct urls on index</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13743">PHPBB3-13743</a>] - Missing global vars $phpbb_root_path and $phpEx in message_parser.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13747">PHPBB3-13747</a>] - Fix test_validate_path_linux method</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13749">PHPBB3-13749</a>] - Add missing slash to base uri in helper route tests</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13313">PHPBB3-13313</a>] - Add a core php event to the mass email form</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13467">PHPBB3-13467</a>] - Add a CONTRIBUTING file to the project on Github</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13510">PHPBB3-13510</a>] - Add template event before/after the pagination on viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13512">PHPBB3-13512</a>] - Add template events to viewtopic_body.html before/after the post details</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13518">PHPBB3-13518</a>] - Add core event to markread() in functions.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13532">PHPBB3-13532</a>] - Add core event to get_unread_topics() in functions.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13533">PHPBB3-13533</a>] - Add template events to the header of search_results.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13535">PHPBB3-13535</a>] - Add ucp_profile.php core event to allow modifying account settings on editing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13536">PHPBB3-13536</a>] - Add UCP/ACP core events to allow modifying user profile data on editing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13537">PHPBB3-13537</a>] - Add core events on mcp_queue for approval and disapproval</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13540">PHPBB3-13540</a>] - Add events to the topic review while posting and moderating posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13578">PHPBB3-13578</a>] - Add ucp_register.php core event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13591">PHPBB3-13591</a>] - Add functions.php core event to the function obtain_users_online_string()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13595">PHPBB3-13595</a>] - Remove unused instances of the bbcode class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13596">PHPBB3-13596</a>] - Add display_forums() core event to allow modifying forums list data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13600">PHPBB3-13600</a>] - Add core event to allow extensions to create a custom help page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13602">PHPBB3-13602</a>] - Add template event overall_header_navbar_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13628">PHPBB3-13628</a>] - Add template events into ucp profile html files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13635">PHPBB3-13635</a>] - Add sql_ary to UCP profile event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13637">PHPBB3-13637</a>] - Add php event for modifying the data when composing a PM</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13643">PHPBB3-13643</a>] - kernel_terminate_subscriber should have a very low priority</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13650">PHPBB3-13650</a>] - New core event for UCP profile mode</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13658">PHPBB3-13658</a>] - [Event] - Before and after deletion of topics</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13675">PHPBB3-13675</a>] - Add validate to acp_profile event and add template events</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13679">PHPBB3-13679</a>] - Add template event overall_header_searchbox_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13701">PHPBB3-13701</a>] - New posting_pm_layout.html template events to wrap "include posting_pm_header.html"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13710">PHPBB3-13710</a>] - Add template events around smilies display</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13336">PHPBB3-13336</a>] - New core events for user activation</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13142">PHPBB3-13142</a>] - [Event] - Before query to list unapproved and deleted posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13592">PHPBB3-13592</a>] - Add core event to allow changing get_visibility_sql's result</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13621">PHPBB3-13621</a>] - Fix event phpbb_content_visibility_get_forums_visibility_before to get where_sql working as specified</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13625">PHPBB3-13625</a>] - Add more variables to core.viewforum_get_topic_data</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9457">PHPBB3-9457</a>] - [Accessibility] - Add WAI-ARIA landmarks to the Prosilver template files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12599">PHPBB3-12599</a>] - Update documentation styling</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13572">PHPBB3-13572</a>] - Upgrade composer to 1.0.0-alpha9</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13626">PHPBB3-13626</a>] - Add branch aliases</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13634">PHPBB3-13634</a>] - Update README to show new branch names</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13640">PHPBB3-13640</a>] - Rearrange order of color css rules</li> + </ul> + + <a name="v313rc1"></a><h3>Changes since 3.1.3-RC1</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12933">PHPBB3-12933</a>] - The search operator for partial matches does not work</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13544">PHPBB3-13544</a>] - Migrations' "permission.permission_unset" deletes all permissions instead of just the one stated</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13556">PHPBB3-13556</a>] - Translated exceptions from file_downloader are handled incorrectly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13557">PHPBB3-13557</a>] - Migrations for 3.0.13 and PL1 are missing</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13553">PHPBB3-13553</a>] - Controller helper needs a message handler to replace error handler</li> + </ul> + + <a name="v312"></a><h3>Changes since 3.1.2</h3> + + <h4>Security</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13519">PHPBB3-13519</a>] - Correctly validate imagick path as path and not string</li> + </ul> + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9100">PHPBB3-9100</a>] - Inline attachments are not being inserted at the cursor</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11613">PHPBB3-11613</a>] - Cookies do not work for netbios domain</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12089">PHPBB3-12089</a>] - Make HTTP status code error messages more informative</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12642">PHPBB3-12642</a>] - Custom profile field isn't displayed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12698">PHPBB3-12698</a>] - Replace all instances of magic numbers with constants in javascript</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12866">PHPBB3-12866</a>] - Wrong profile field validation options</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13098">PHPBB3-13098</a>] - Repair Yahoo contact field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13192">PHPBB3-13192</a>] - confirm_box() action contains app.php when enable_mod_rewrite is set</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13238">PHPBB3-13238</a>] - \phpbb\db\migration\data\v310\mysql_fulltext_drop tries to drop non existent indexes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13272">PHPBB3-13272</a>] - Changed Files packages do not include vendor directory</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13282">PHPBB3-13282</a>] - PostgreSQL error when creating boolean/dropdown custom profile fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13302">PHPBB3-13302</a>] - ACP links to docs need to be updated to 3.1 URLs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13307">PHPBB3-13307</a>] - develop/mysql_upgrader.php does not work anymore</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13319">PHPBB3-13319</a>] - Icons/smilies table improperly formed when no images present</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13346">PHPBB3-13346</a>] - Missing space in posting_editor.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13357">PHPBB3-13357</a>] - LOG_MOVED_TOPIC Language var missing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13358">PHPBB3-13358</a>] - Add class for retrieving remote file data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13362">PHPBB3-13362</a>] - The whole cache dir (excluding the .htaccess and index.html files) should be ignored by git</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13366">PHPBB3-13366</a>] - Dynamic config for "plupload_last_gc" is static</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13381">PHPBB3-13381</a>] - Code Sniffer complains about 3.1.2 migration</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13385">PHPBB3-13385</a>] - Add free result after running update query in $config->set_atomic()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13391">PHPBB3-13391</a>] - subsilver2 poll options must have a setting of 1 when editing a post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13393">PHPBB3-13393</a>] - Invalid parameters passed to call_user_func_array in version_helper.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13396">PHPBB3-13396</a>] - Multibyte chars cause attachment upload to fail</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13400">PHPBB3-13400</a>] - Add a new message for high server loads during search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13405">PHPBB3-13405</a>] - A typo in style_update_p1.php migration may prevent updating in some circumstances</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13406">PHPBB3-13406</a>] - ADD INDEX syntax may cause an error in earlier MySQL versions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13420">PHPBB3-13420</a>] - Prune users bug - filter all with 0 posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13427">PHPBB3-13427</a>] - Add template events to MCP front before/after each list</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13431">PHPBB3-13431</a>] - Wrong margin-left for RTL sites in Internet Explorer mobile view</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13432">PHPBB3-13432</a>] - Migrator module tool does not add the needed module language file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13441">PHPBB3-13441</a>] - functions_convert fails to set global moderators default group</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13442">PHPBB3-13442</a>] - UTF-8 symbols for database host</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13448">PHPBB3-13448</a>] - \phpbb\messenger->template can't find email templates in extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13453">PHPBB3-13453</a>] - Sort params in Canonical URL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13470">PHPBB3-13470</a>] - Mass email says "user doesn't exist" when all users is selected</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13486">PHPBB3-13486</a>] - Call to undefined method phpbb\db\driver\factory::sql_escpape() on database update</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13489">PHPBB3-13489</a>] - Allow the migrations to use the DI container</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13490">PHPBB3-13490</a>] - Unicode chars are broken in edit message after preview</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13492">PHPBB3-13492</a>] - Custom BBCode URL tokens do not support IDN</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13504">PHPBB3-13504</a>] - "Array" is displayed when searching, or when unanswered posts or active topics are selected</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13507">PHPBB3-13507</a>] - Large images in posts can cause horizontal scrollbars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13511">PHPBB3-13511</a>] - The "Unused Use" Sniff is broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13530">PHPBB3-13530</a>] - Fix undefined variables in migrations and tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13534">PHPBB3-13534</a>] - Non-existent path in attachment settings causes travis failure</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13543">PHPBB3-13543</a>] - Slow tests fail on 3.1 and 3.2</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11033">PHPBB3-11033</a>] - FULLTEXT_SPHINX_NO_CONFIG_DATA references unrequired field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12567">PHPBB3-12567</a>] - [proSilver] - viewtopic_body.html: Change 'back2top' anchor in to '#top'</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12926">PHPBB3-12926</a>] - Support for IDN (IRI)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13266">PHPBB3-13266</a>] - Enabling twig dump function if DEBUG is defined</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13306">PHPBB3-13306</a>] - Add error level to the error collector</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13312">PHPBB3-13312</a>] - [event] - Add core event to the mass email form</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13368">PHPBB3-13368</a>] - Add the forum_data var to the core.viewforum_get_topic_ids_data event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13370">PHPBB3-13370</a>] - Add ability to call class methods more easily in the convertor framework</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13389">PHPBB3-13389</a>] - Replace pattern with path in routing.yml</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13402">PHPBB3-13402</a>] - Code Sniffer, unused use, check the function doc blocks</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13409">PHPBB3-13409</a>] - Add event to modify search parameters before searching</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13419">PHPBB3-13419</a>] - Add template event at the end of the file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13422">PHPBB3-13422</a>] - Add new events in save custom cookies and set custom ban type</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13428">PHPBB3-13428</a>] - Add core events to memberlist.php for teampage</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13430">PHPBB3-13430</a>] - Add event for modifying prune SQL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13435">PHPBB3-13435</a>] - Add core event to modify submit_post() sql data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13437">PHPBB3-13437</a>] - [Template] - viewtopic_body_post_author_before/after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13439">PHPBB3-13439</a>] - [event] - Add event to run code at beginning of ACP users overview</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13440">PHPBB3-13440</a>] - [event] - Add event to process when a user fails a login attempt</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13449">PHPBB3-13449</a>] - Add viewforum.php core event after the topic data has been assigned to template </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13466">PHPBB3-13466</a>] - Add bbcode_uid and bitfield to event core.message_parser_check_message</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13478">PHPBB3-13478</a>] - Add core event core.bbcode_cache_init_end</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13141">PHPBB3-13141</a>] - Add an event to allow applying additional permissions to MCP access besides f_read</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13146">PHPBB3-13146</a>] - Add an event to allow changing the result of calling get_forums_visibility_sql()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13147">PHPBB3-13147</a>] - Add an event to change get_global_visibility_sql()'s results</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13148">PHPBB3-13148</a>] - Add an event to creating a final way to modify edit logs output</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13154">PHPBB3-13154</a>] - Add an event to edit user list for notifications</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13158">PHPBB3-13158</a>] - Add an event to allow adding extra auth checks when the user is posting</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13159">PHPBB3-13159</a>] - Add an event to allow extra auth checks when reporting posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13160">PHPBB3-13160</a>] - Add an event to viewtopic before viewing permissions</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12924">PHPBB3-12924</a>] - Meta tags should be self-closing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13528">PHPBB3-13528</a>] - Boolean checkbox profile fields display "1" instead of selected value</li> + </ul> + + + <a name="v311"></a><h3>Changes since 3.1.1</h3> + + <h4>Security</h4> + <ul> + <li>[SECURITY-171] - Version helper does not properly escape version info</li> + <li>[SECURITY-169] - AJAX request with unexpected referrer causes infinite loop</li> + </ul> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10442">PHPBB3-10442</a>] - XHTML is invalid when a forum link without redirect counter is present</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10744">PHPBB3-10744</a>] - Prevent user from installing styles with reserved directory names</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11863">PHPBB3-11863</a>] - User registration settings show incorrectly as disabled when board-wide emails are disabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12703">PHPBB3-12703</a>] - Notification System sends exact same SQL query multiple times</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13083">PHPBB3-13083</a>] - Language correction in NO_ENTRIES in acp_logs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13100">PHPBB3-13100</a>] - Don't display "delete reason" dialog for shadow-topics</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13193">PHPBB3-13193</a>] - Post counts in Private Messages should link to the user's posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13197">PHPBB3-13197</a>] - Group Avatar not deleted from users</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13204">PHPBB3-13204</a>] - Login flood control error supresses incorrect credential error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13209">PHPBB3-13209</a>] - Boolean (Yes/No) custom profile field doesn't show given name</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13216">PHPBB3-13216</a>] - Datetime tests fail randomly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13228">PHPBB3-13228</a>] - "Code: Select all" font-size too big in Private Messages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13239">PHPBB3-13239</a>] - Can´t upload Attachments on iOS</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13241">PHPBB3-13241</a>] - Topics are being duplicated in multipage forums</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13242">PHPBB3-13242</a>] - Validation error in Contact a Board Administrator</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13243">PHPBB3-13243</a>] - Debug error when clicking Re-check all versions on ACP manage extensions page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13251">PHPBB3-13251</a>] - Database password containing special characters no longer accepted after upgrade to 3.1.0</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13253">PHPBB3-13253</a>] - MCP queue link in active topics search is missing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13265">PHPBB3-13265</a>] - "Edit profile" link on view-own-profile page should only show if user has permission to edit</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13270">PHPBB3-13270</a>] - Upgrading from 3.0.12 to 3.1.1 does not display moderator soft delete permissions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13277">PHPBB3-13277</a>] - Move Up & Down does not take work in Internet Explorer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13280">PHPBB3-13280</a>] - $user->page['page'] - is invalid resulting in confirm_box() not working correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13284">PHPBB3-13284</a>] - Message body not included in email topic message </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13298">PHPBB3-13298</a>] - Use mysql_free_result to free result sets which were requested using mysql_query()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13300">PHPBB3-13300</a>] - Jabber field still shown in profile when feature is disabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13301">PHPBB3-13301</a>] - Apache Authentication is probably broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13303">PHPBB3-13303</a>] - Migrator caught in loop calculating dependencies</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13315">PHPBB3-13315</a>] - Upgrade from 3.0.12 to 3.1.1 resets CAPTCHA selection</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13316">PHPBB3-13316</a>] - reCAPTCHA does not work on secured connection</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13318">PHPBB3-13318</a>] - login_username doesn't have multibyte parameter set to true</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13323">PHPBB3-13323</a>] - posting.php can pass invalid auth option to acl_get()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13332">PHPBB3-13332</a>] - Insufficient information passed to password drivers for converted boards</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13337">PHPBB3-13337</a>] - Mark subforums read triggers error if subforums contain no topics</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13338">PHPBB3-13338</a>] - Some tests fail when run on their own</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13342">PHPBB3-13342</a>] - 310/captcha_plugins migration changes recaptcha to nogd</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13349">PHPBB3-13349</a>] - Incorrect entities used for breadcrumb separator in CSS</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13354">PHPBB3-13354</a>] - Unknown column 'topic_logs' in 'where clause' when deleting topic log in MCP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13376">PHPBB3-13376</a>] - deregister_globals() does not work correctly when $_COOKIE['GLOBALS'] is specified</li> + </ul> + + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12681">PHPBB3-12681</a>] - Cache the compiled routes and dump the url_generator</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12885">PHPBB3-12885</a>] - Wrong index page title when using Board Index text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13023">PHPBB3-13023</a>] - [event] - Add Event posting_editor_buttons_custom_tags_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13133">PHPBB3-13133</a>] - Allow @vendor_extname in INCLUDECSS</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13182">PHPBB3-13182</a>] - [event] - Add posting.php core event to allow modifying the message before parsing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13220">PHPBB3-13220</a>] - [event] - Add template events to memberlist_search.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13290">PHPBB3-13290</a>] - [event] - Add template event index_body_forumlist_body_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13294">PHPBB3-13294</a>] - [event] - Add message_parser.php core event for additional message handling before parsing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13297">PHPBB3-13297</a>] - Add unicode modifier to url/email regular expression patterns</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13309">PHPBB3-13309</a>] - [event] - Add ACP template event acp_email_options_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13310">PHPBB3-13310</a>] - [event] - Add core event core.acp_email_modify_sql</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13326">PHPBB3-13326</a>] - Add viewtopic_url variable to a viewtopic event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13328">PHPBB3-13328</a>] - [event] - Add event core.mcp_view_forum_modify_sql</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13347">PHPBB3-13347</a>] - [event] - Add new template events to acp_forums.html</li> + </ul> + + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12962">PHPBB3-12962</a>] - Use phantomjs and webdriver for UI testing</li> + </ul> + + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13324">PHPBB3-13324</a>] - Composer no longer downloads sami/sami and fabpot/goutte</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13325">PHPBB3-13325</a>] - Make installing dependencies for tests more user friendly or optional</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13331">PHPBB3-13331</a>] - Sami run as part of phing MUST NOT switch branches</li> + </ul> + + + <a name="v310"></a><h3>Changes since 3.1.0</h3> + + <h4>Security</h4> + <ul> + <li>[SECURITY-164] - Cross Site Scripting via PATH_INFO in page_name variable</li> + </ul> + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13248">PHPBB3-13248</a>] - Login functions need to use provider collection for retrieving provider</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13267">PHPBB3-13267</a>] - Automatic Update instructions indicate that only the install folder is necessary</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13268">PHPBB3-13268</a>] - MSSQL's get_existing_indexes() function improperly appends ternary result</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13271">PHPBB3-13271</a>] - Anonymous users can CC themselves on emails sent to admin via contact form</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13262">PHPBB3-13262</a>] - Add note to docs about htaccess file when upgrading 3.0 to 3.1</li> + </ul> + + <a name="v310RC6"></a><h3>Changes since 3.1.0-RC6</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13126">PHPBB3-13126</a>] - More detailed output for migrations needed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13208">PHPBB3-13208</a>] - Security issues are not pulled into the changelog</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13210">PHPBB3-13210</a>] - Queue Cron Job checks for wrong config variable queue_interval_config</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13211">PHPBB3-13211</a>] - Add possibility to save migrations output to log</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13221">PHPBB3-13221</a>] - Can't upgrade to 3.1 from 3.0.11 and older</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13223">PHPBB3-13223</a>] - Using get_username_string() for email template variables causes HTML markup in emails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13225">PHPBB3-13225</a>] - phpbb_hash() undefined in phpbb\db\migration\data\v30x\release_3_0_5_rc1.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13226">PHPBB3-13226</a>] - Stray $rank_img in memberlist.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13227">PHPBB3-13227</a>] - Remote avatars do not work with cURL wrapper</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13229">PHPBB3-13229</a>] - Memberlist is getting overloaded with redundant SQL queries</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13230">PHPBB3-13230</a>] - Deprecated phpbb_clean_path() does not work anymore</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13231">PHPBB3-13231</a>] - The migration contact_admin_form must depends on config_db_text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13232">PHPBB3-13232</a>] - Email queue does not get run</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13234">PHPBB3-13234</a>] - Remember me cookie gets unset by admin reauthentication</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13207">PHPBB3-13207</a>] - Default subscription notification setting for new users does not include email</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13215">PHPBB3-13215</a>] - Update Symfony Components to 2.3.21</li> + </ul> + + <a name="v310RC5"></a><h3>Changes since 3.1.0-RC5</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12530">PHPBB3-12530</a>] - Visual confirmation is breaking layout in prosilver's mobile mode</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12568">PHPBB3-12568</a>] - docs/README.html references MODs instead of extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13124">PHPBB3-13124</a>] - PHP event extractor too strict on doc blocks</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13138">PHPBB3-13138</a>] - Banned users cause infinite recursion</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13140">PHPBB3-13140</a>] - Header links don't re-appear on window size increase</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13161">PHPBB3-13161</a>] - PHP Warnings issued from phpbb database test case</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13163">PHPBB3-13163</a>] - Header Navbar Responsiveness Broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13164">PHPBB3-13164</a>] - Data sent to core.submit_post_end event does not include fresh post_visibility</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13168">PHPBB3-13168</a>] - Warning displayed in PHP 5.6 for mbstring.http_input</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13169">PHPBB3-13169</a>] - Responsive forms not displaying correctly in RTL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13171">PHPBB3-13171</a>] - Can not delete posts and soft delete topics in MCP topic view</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13174">PHPBB3-13174</a>] - Minor HTML error in ucp_pm_viewmessage.html (needs closing </div>)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13177">PHPBB3-13177</a>] - Post count-based ranks do not display in viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13181">PHPBB3-13181</a>] - Sphinx config template should use place holders for database credentials</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13186">PHPBB3-13186</a>] - Do not link post count to author search if search disabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13187">PHPBB3-13187</a>] - INSTALL.html is not valid HTML</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13188">PHPBB3-13188</a>] - Sphinx index() function triggers slow queries that time out replies</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13190">PHPBB3-13190</a>] - phpbb_session_login_keys_test::test_reset_keys fails on develop-ascraeus</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13194">PHPBB3-13194</a>] - BBCode isn't parsed when issuing a warning for a post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13203">PHPBB3-13203</a>] - Use constant time comparison method for comparing password hashes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13217">PHPBB3-13217</a>] - Remember me cookie leak</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13218">PHPBB3-13218</a>] - Missing token check in acp_styles</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13221">PHPBB3-13221</a>] - Can't upgrade to 3.1 from 3.0.11 and older</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13223">PHPBB3-13223</a>] - Using get_username_string() for email template variables causes HTML markup in emails</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12796">PHPBB3-12796</a>] - View own Profile should have an edit button</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12799">PHPBB3-12799</a>] - Place the events for f_brunoais_read_other</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13041">PHPBB3-13041</a>] - help_faq.php language file needs to be revised</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13205">PHPBB3-13205</a>] - Add mark all PMs read button</li> + </ul> + + + <a name="v310RC4"></a><h3>Changes since 3.1.0-RC4</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10729">PHPBB3-10729</a>] - Post editor information is not updated when user being deleted with posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11224">PHPBB3-11224</a>] - SQL cache destroy does not destroy queries to tables joined</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12368">PHPBB3-12368</a>] - Updating database fails in upgrade from 3.0 when trying twice without purging the cache</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12489">PHPBB3-12489</a>] - Description for Contact link in custom profile fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12657">PHPBB3-12657</a>] - Add a test file for cli command cache:purge</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12858">PHPBB3-12858</a>] - 'GMT' is hard coded and not pulled from language files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12889">PHPBB3-12889</a>] - multi-select element in unban email-adresses not limited in width</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13011">PHPBB3-13011</a>] - Javascript bug when selecting first one or two characters of a post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13027">PHPBB3-13027</a>] - PM folder full percentage could be a bit more accurate</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13033">PHPBB3-13033</a>] - Duplicate entry SQL error thrown when running notifications_use_full_name migration</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13045">PHPBB3-13045</a>] - Pragma header not specified as response header by RFC2616</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13048">PHPBB3-13048</a>] - AJAX requests are being stored to session_page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13055">PHPBB3-13055</a>] - String profile fields validation limits content to latin chars only</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13070">PHPBB3-13070</a>] - Wrong hook name is registered for array(template, display)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13071">PHPBB3-13071</a>] - total_match_count is used before core.search_get_posts_data event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13080">PHPBB3-13080</a>] - Responsive design - language variable to long</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13082">PHPBB3-13082</a>] - Search box does not displayed proper in admin cp when no logs listed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13085">PHPBB3-13085</a>] - Fix typo in oauth.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13086">PHPBB3-13086</a>] - Update ACP_MASS_EMAIL_EXPLAIN language key</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13087">PHPBB3-13087</a>] - WLM link is empty in viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13097">PHPBB3-13097</a>] - Fix missing unit type in forms.css</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13104">PHPBB3-13104</a>] - Responsive tabs display bug in IE11</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13105">PHPBB3-13105</a>] - Future dates are displayed as "Tomorrow" with relative date format</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13111">PHPBB3-13111</a>] - Debug output when editing DropDown Custom Fields with multiple languages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13113">PHPBB3-13113</a>] - The routes are not always generated for the good app.php file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13116">PHPBB3-13116</a>] - Topic and post approval notifications got interchanged</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13117">PHPBB3-13117</a>] - Installation fails on MySQL 5.7 because auto_increment columns can be NULL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13118">PHPBB3-13118</a>] - datetime.class parameter not used in user class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13120">PHPBB3-13120</a>] - phpbb_load_extensions_autoloaders() doesn't work very well with the extensions behind a symlink</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13121">PHPBB3-13121</a>] - Customise Purge Cache always returns user to Styles page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13125">PHPBB3-13125</a>] - Uploaded avatars are not displayed in IE <= 7</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12408">PHPBB3-12408</a>] - Add quick setting for "default guest style" to ACP board settings</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12985">PHPBB3-12985</a>] - Add event to modify the redirect after a successful login</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12993">PHPBB3-12993</a>] - Add event to get_user_rank() function</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13025">PHPBB3-13025</a>] - Add template events for buttons on viewforum and viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13059">PHPBB3-13059</a>] - Add core event to generate_page_link() to allow modifying pagination URLs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13072">PHPBB3-13072</a>] - Add total_match_count to core.search_get_topic_data event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13077">PHPBB3-13077</a>] - Change module order in Customise tab for better usability</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13094">PHPBB3-13094</a>] - Remove the search box if there are no new posts to search for</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13107">PHPBB3-13107</a>] - Add template events to forum row in forumlist_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13108">PHPBB3-13108</a>] - Add core event to the parse_attachments() function to allow modifying files info</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13110">PHPBB3-13110</a>] - Add core event to the page_footer() function to allow handling overall output</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13122">PHPBB3-13122</a>] - phpbb_wrapper_gmgetdate_test intermittently fails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13134">PHPBB3-13134</a>] - Add core event to the root of the function display_forums()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13137">PHPBB3-13137</a>] - Remove schema.json from repository</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12929">PHPBB3-12929</a>] - Add an event when getting the information for PM composal</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12930">PHPBB3-12930</a>] - Add an event to the query getting the post for quoting in a PM</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10794">PHPBB3-10794</a>] - Make schema available at runtime</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12987">PHPBB3-12987</a>] - Cleanup the services.yml file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13106">PHPBB3-13106</a>] - Remove the \phpbb\di\pass\kernel_pass class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13119">PHPBB3-13119</a>] - Add events to mcp and acp ban modules</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13123">PHPBB3-13123</a>] - Add events to allow post blocking and post pre/past processing</li> + </ul> + + <a name="v310RC3"></a><h3>Changes since 3.1.0-RC3</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10472">PHPBB3-10472</a>] - ACP "add multiple smilies" page is unusable on 1024x768 resolution</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11909">PHPBB3-11909</a>] - phpbb/db/migrator::load_migrations is never called</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12258">PHPBB3-12258</a>] - Add attachment: error alert popup on "empty.png" does not show up</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12506">PHPBB3-12506</a>] - Long post titles bump the username down an extra row beneath the edit/quote/delete buttons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12658">PHPBB3-12658</a>] - Add tests for config:* cli commands</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12661">PHPBB3-12661</a>] - Extensions templates not loaded from "all" by helper/render()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12734">PHPBB3-12734</a>] - Custom profile manager should not suppress errors when inserting user rows</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12765">PHPBB3-12765</a>] - acp_profile.php should use db/tools</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12852">PHPBB3-12852</a>] - \phpbb\path_helper get_url_parts does not handle get variable with no value</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12856">PHPBB3-12856</a>] - plupload images are not integrated into style-path</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12862">PHPBB3-12862</a>] - Smiley and Whos Onlike pop-up boxes are making styling difficult</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12949">PHPBB3-12949</a>] - Undefined function mime_content_type()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12966">PHPBB3-12966</a>] - Undefined sorting of posts with same post_time on postgres</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12975">PHPBB3-12975</a>] - Catchable fatal error after update to RC3</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12976">PHPBB3-12976</a>] - Pagination of UCP manage attachments page in prosilver does not support plural forms</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12983">PHPBB3-12983</a>] - UCP preferences, Display posts ordering by: input is not properly validated</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12984">PHPBB3-12984</a>] - Index page: blank line when no forum description shown</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12986">PHPBB3-12986</a>] - Wrong functions call order breaks detection of common words in search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12990">PHPBB3-12990</a>] - The prefix for the notification's services is harcoded</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12996">PHPBB3-12996</a>] - tests/lock/flock_test.php should use microtime() instead of time()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12998">PHPBB3-12998</a>] - Undefined $lang in mcp_warn.php::add_warning()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13004">PHPBB3-13004</a>] - Topic tools button is displayed even if dropdown is empty</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13008">PHPBB3-13008</a>] - Importing a resource in routing.yml breaks download/file.php and ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13009">PHPBB3-13009</a>] - Cleanup Tweaks CSS, Remove outdated browser support</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13018">PHPBB3-13018</a>] - Key binding on AJAX popups are not unbound upon close/cancel</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13019">PHPBB3-13019</a>] - Don't display "Soft delete reason" dialog when moderator cannot soft-delete</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13022">PHPBB3-13022</a>] - "Return to advanced search" wrong assumption </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13031">PHPBB3-13031</a>] - Impossible to properly upload image if no proper mimetype guessers enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13035">PHPBB3-13035</a>] - Empty meta tags in header</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13040">PHPBB3-13040</a>] - W3C validator warning in overral_footer.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13042">PHPBB3-13042</a>] - Unused var in login_box()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13044">PHPBB3-13044</a>] - Expires header violates RFC 2616</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13046">PHPBB3-13046</a>] - In download/avatar we don't load the vendors added by the extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13050">PHPBB3-13050</a>] - Allow topic/forum subscription when email and jabber are off</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13051">PHPBB3-13051</a>] - Fix broken viewonline core event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13052">PHPBB3-13052</a>] - Remove additional parameters from check_form_key()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13057">PHPBB3-13057</a>] - Fatal error on previous page link after closing a report</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13065">PHPBB3-13065</a>] - Unknown column 'user_pass_convert' in 'field list' [code] - => 1054 </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13068">PHPBB3-13068</a>] - Language correction in FIELD_IS_CONTACT_EXPLAIN</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13069">PHPBB3-13069</a>] - Timezone selector does not filter locations on change</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12416">PHPBB3-12416</a>] - WhoIs Pop Up Page Details</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12598">PHPBB3-12598</a>] - Improve action-bar search box styling</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12653">PHPBB3-12653</a>] - Caches the informations about the listeners to be able to not load them everytime</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12900">PHPBB3-12900</a>] - 3.1.0 avatar scaling</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12943">PHPBB3-12943</a>] - Add core.phpbb_generate_debug_output core event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12961">PHPBB3-12961</a>] - Add link in anti-spam ACP page which links directly to captchas in titania</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12969">PHPBB3-12969</a>] - Add template event around the find username link on composing pm</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12982">PHPBB3-12982</a>] - JS in 3.1 is nasty</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12989">PHPBB3-12989</a>] - Remove unused "created_by.jpg" from prosilver</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12991">PHPBB3-12991</a>] - Have events after/before "add warning" field - user and post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12994">PHPBB3-12994</a>] - Add core event to viewtopic.php before sending vars to template</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13003">PHPBB3-13003</a>] - Missing language keys in command "extension:show"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13005">PHPBB3-13005</a>] - Add core event to display_forums() to modify category template data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13006">PHPBB3-13006</a>] - Add variables to the 'core.modify_quickmod_actions' event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13010">PHPBB3-13010</a>] - phpbb_get_avatar() incorrectly refers to \phpbb\avatar\driver\driver::clean_row()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13020">PHPBB3-13020</a>] - Add var to core.viewforum_get_topic_data event to allow modifying forum template data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13024">PHPBB3-13024</a>] - Template event viewtopic_body_postrow_post_content_footer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13026">PHPBB3-13026</a>] - Add template vars array to core.viewonline_overwrite_location to allow modifying/adding template vars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13034">PHPBB3-13034</a>] - Add ability to access extensions outside the phpBB root</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13036">PHPBB3-13036</a>] - Controller helper route method should be able to generate absolute URL's</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13038">PHPBB3-13038</a>] - Link user post tally to their posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13047">PHPBB3-13047</a>] - Add $post_list array to core.viewtopic_modify_page_title core event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13056">PHPBB3-13056</a>] - Move the arguments of the request class to the DI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13058">PHPBB3-13058</a>] - The "jump to page" input does not have a min attribute.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13061">PHPBB3-13061</a>] - Use a compiler pass to replace the service event.subscriber_loader</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13062">PHPBB3-13062</a>] - Add viewforum.php core event to allow modifying sql query to select topic ids</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13066">PHPBB3-13066</a>] - Add common search results core event to modify search title</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12951">PHPBB3-12951</a>] - Add .editorconfig</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12928">PHPBB3-12928</a>] - [Event] - core.mcp_reports_gather_query_before</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12999">PHPBB3-12999</a>] - Remove @author tag from the doc block</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13032">PHPBB3-13032</a>] - Update Symfony Components to 2.3.19</li> + </ul> + + + <a name="v310RC2"></a><h3>Changes since 3.1.0-RC2</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11148">PHPBB3-11148</a>] - Fix uploading attachments from Android 4 powered devices</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11480">PHPBB3-11480</a>] - Prevent Private Message system from returning "Unknown folder" when inbox folder is full</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11520">PHPBB3-11520</a>] - Post count not incremented when you fork a topic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11854">PHPBB3-11854</a>] - Captcha code is still in includes/</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12232">PHPBB3-12232</a>] - MCP Banning: Max execution time exceeded</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12448">PHPBB3-12448</a>] - Migration tools don't allow adding columns with default == NULL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12492">PHPBB3-12492</a>] - DB_TEST: Special chars are not supported.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12535">PHPBB3-12535</a>] - The profile link should be better adjusted to the avatar image it surrounds in viewtopic.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12685">PHPBB3-12685</a>] - CLI doesn't load extension commands</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12710">PHPBB3-12710</a>] - phpBB 3.0.12 on Oracle fails to upgrade to 3.1.0</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12718">PHPBB3-12718</a>] - Hard Deleting Post does not Decrease Post Count</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12742">PHPBB3-12742</a>] - Notifications duplicate code that requires an event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12744">PHPBB3-12744</a>] - RTL board header is one line higher than LTR</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12748">PHPBB3-12748</a>] - UCP Terms of Use Typo</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12770">PHPBB3-12770</a>] - search_wordmatch unique key name is too long</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12776">PHPBB3-12776</a>] - docs/INSTALL.html is missing 3.0 to 3.1 update instructions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12789">PHPBB3-12789</a>] - Cached directories are not deleted when the cache is purged (with ACM memory enabled).</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12791">PHPBB3-12791</a>] - String profile fields do not use links, smilies and line breaks in memberlist</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12792">PHPBB3-12792</a>] - Profile field type strings function get_profile_contact_value duplicates raw()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12793">PHPBB3-12793</a>] - String '0' does not display for string profile fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12794">PHPBB3-12794</a>] - Google+ profile field validation is too strict</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12809">PHPBB3-12809</a>] - RTL styling issues with new jump-box dropdown</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12814">PHPBB3-12814</a>] - Error while trying to setup LDAP Authentication in ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12822">PHPBB3-12822</a>] - Preselect avatar type if only 1 type is enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12837">PHPBB3-12837</a>] - Viewing contact form displays "VIEWING_MEMBERS" on viewonline</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12842">PHPBB3-12842</a>] - Out of memory issue in code sniffer call for extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12843">PHPBB3-12843</a>] - When you click on "Mark forums read" in the browser, a console error occurs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12844">PHPBB3-12844</a>] - $dbpasswd is cleared too early in connection manager</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12845">PHPBB3-12845</a>] - HTML5 Invalid using role="navigation"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12846">PHPBB3-12846</a>] - SQLite3 bug in profilefield_base_migration.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12849">PHPBB3-12849</a>] - ReferenceError in core.js</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12851">PHPBB3-12851</a>] - Font colour button title is not consistent with other buttons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12853">PHPBB3-12853</a>] - Problems with ACP/MCP links in mobile design with other translations</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12854">PHPBB3-12854</a>] - Admin contact page should not be used when board emails are disabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12855">PHPBB3-12855</a>] - Container is being recompiled on every page request although DEBUG_CONTAINER is not set</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12859">PHPBB3-12859</a>] - Missing post button events from view pm template</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12870">PHPBB3-12870</a>] - Console database migrate function can not update from 3.0.12 to 3.1</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12873">PHPBB3-12873</a>] - Wrong identifier tested in \db\tools\sql_create_(unique_)index()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12875">PHPBB3-12875</a>] - Extension's info_acp_lang files don't fallback correctly when the user's language is not included in the extension</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12881">PHPBB3-12881</a>] - Debug error - Undefined index: mark_time</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12882">PHPBB3-12882</a>] - $config['search_type'] - is not correctly updated when updating from 3.0 to 3.1</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12883">PHPBB3-12883</a>] - Do not use basename() to get the search class in phpbb\cron\task\core\tidy_search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12886">PHPBB3-12886</a>] - Redundant lock and unlock expressions for QuickMod in viewtopic.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12887">PHPBB3-12887</a>] - Typo in timezone handling code: 'offest' should be 'offset'</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12891">PHPBB3-12891</a>] - Long page generation time when banlist is long</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12895">PHPBB3-12895</a>] - ?style=1 appended to url after using the UCP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12898">PHPBB3-12898</a>] - In cron.php we try to release the lock after the call to garbage_collection()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12901">PHPBB3-12901</a>] - Wrong type hint in show_available_child_styles() doc block</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12902">PHPBB3-12902</a>] - Remove duplicate entry in build_cfg_template() switch statement</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12903">PHPBB3-12903</a>] - Remove unused method in phpBB/phpbb/extension/metadata_manager.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12908">PHPBB3-12908</a>] - Fix broken operator assignment in increment.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12909">PHPBB3-12909</a>] - Use correct lang vars in cli extension enable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12910">PHPBB3-12910</a>] - Profile fields: Two "simple text field" in dropdown menu</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12912">PHPBB3-12912</a>] - Undefined index when adding logs from extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12918">PHPBB3-12918</a>] - Functional Tests Suite does not run on its own</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12919">PHPBB3-12919</a>] - Allow using class names as module identifier for extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12922">PHPBB3-12922</a>] - Posts per page in MCP should have a minimum value of zero</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12931">PHPBB3-12931</a>] - General error on user registration when domain name is not set</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12932">PHPBB3-12932</a>] - Easy support of non-gregorian calendars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12937">PHPBB3-12937</a>] - Without config file, extract($phpbb_config_php_file->get_all()); breaks</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12938">PHPBB3-12938</a>] - Board floods "store"-directory with packed attachments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12940">PHPBB3-12940</a>] - Unused 'use' statements in download/file.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12950">PHPBB3-12950</a>] - Functional tests can not be run anymore if another language is present</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12954">PHPBB3-12954</a>] - Nginx setup on travis returns wrong SCRIPT_NAME info</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12956">PHPBB3-12956</a>] - Unknown column 'field_is_contact' in 'field list'</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12964">PHPBB3-12964</a>] - Undefined $row in download/file.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12967">PHPBB3-12967</a>] - Undefined variable: phpbb_dispatcher in mcp_queue.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12970">PHPBB3-12970</a>] - chema.json is not up to date with migration files</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9165">PHPBB3-9165</a>] - Extend template loop to allow iteration step modification</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10073">PHPBB3-10073</a>] - Contact page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12051">PHPBB3-12051</a>] - Optimise Composer Autoloader on Build</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12560">PHPBB3-12560</a>] - Add methods to set upload and temp paths in Plupload class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12656">PHPBB3-12656</a>] - Translate existing CLI commands</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12663">PHPBB3-12663</a>] - Extract Command Line Interface language strings into their own file.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12671">PHPBB3-12671</a>] - Possibility to use NOT LIKE expression</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12693">PHPBB3-12693</a>] - Add a travis test that checks file permissions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12738">PHPBB3-12738</a>] - Move related code from functions_posting into remove_post_from_statistic()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12778">PHPBB3-12778</a>] - The automatic updater should have an option to automatically delete removed files during update</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12828">PHPBB3-12828</a>] - Add includes/ucp/ucp_prefs.php common core event to allow additional actions before the page load</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12832">PHPBB3-12832</a>] - Add footer links to the Quick Links menu</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12836">PHPBB3-12836</a>] - [Event] - core.functions.redirect</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12841">PHPBB3-12841</a>] - Allow extensions to position new config vars in an array</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12847">PHPBB3-12847</a>] - Allow extensions to define if they can be enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12857">PHPBB3-12857</a>] - Add template events overall_header_breadcrumbs_before/after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12864">PHPBB3-12864</a>] - Have an EVENT tag after STYLESHEETS in overall_header</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12871">PHPBB3-12871</a>] - Add PHPBB_DISPLAY_LOAD_TIME constant to config.php on installation</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12872">PHPBB3-12872</a>] - Add poster_id to viewtopic_modify_post_row</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12884">PHPBB3-12884</a>] - Add core event to the function upload_attachment()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12892">PHPBB3-12892</a>] - S_NUM_ROWS does not scale</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12896">PHPBB3-12896</a>] - Add event in acp_main to allow php checks for admin notices</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12906">PHPBB3-12906</a>] - Add rel="help" to FAQ link</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12913">PHPBB3-12913</a>] - Add more parameters to core.submit_post_end event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12942">PHPBB3-12942</a>] - Add core.add_form_key core event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12944">PHPBB3-12944</a>] - Add core.login_forum_box core event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12953">PHPBB3-12953</a>] - Page title not updated when notifications are marked as read</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12800">PHPBB3-12800</a>] - [Event] - Create core.functions_display.display_user_activity.actives_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12801">PHPBB3-12801</a>] - [Event] - core.functions_posting.load_drafts_draft_list_results</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12876">PHPBB3-12876</a>] - [Event] - core.mcp_mcp_front.mcp_front_view_queue_postid_list_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12880">PHPBB3-12880</a>] - [Event] - core.mcp_queue_!is_topics_query_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12927">PHPBB3-12927</a>] - [Event] - core.mcp_queue_get_posts2_query_before</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10404">PHPBB3-10404</a>] - Remove create_function from includes/acp/auth.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12557">PHPBB3-12557</a>] - Fix doc block errors found by Sami</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12826">PHPBB3-12826</a>] - Investigate "catch (Exception"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12860">PHPBB3-12860</a>] - Add template events to mcp_ban.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12861">PHPBB3-12861</a>] - Add event before assigning the posts to the template</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12917">PHPBB3-12917</a>] - Move commit check and file executable checks to 5.3.3 build on travis</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12920">PHPBB3-12920</a>] - Create composer installable app and core packages with subtree split</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12941">PHPBB3-12941</a>] - Check for Sami documentation errors on Travis CI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12948">PHPBB3-12948</a>] - Remove Travis CI "broken opcache on PHP 5.5.7 and 5.5.8" workaround.</li> + </ul> + + <a name="v310RC1"></a><h3>Changes since 3.1.0-RC1</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9801">PHPBB3-9801</a>] - Users on custom pages outside the board directory are being displayed on Index page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11392">PHPBB3-11392</a>] - "Make normal" in quickmod tool does not ajaxify correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12325">PHPBB3-12325</a>] - Automatic update should notify about outdated files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12420">PHPBB3-12420</a>] - Reduce config.php inclusions in DIC code</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12446">PHPBB3-12446</a>] - Unnecessary db connect - function phpbb_bootstrap_enabled_exts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12462">PHPBB3-12462</a>] - Do not use string "None" for different avatar options</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12515">PHPBB3-12515</a>] - FULLTEXT_POSTGRES_TS_NOT_USABLE and FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN redundant</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12605">PHPBB3-12605</a>] - Make dropdowns uniform</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12674">PHPBB3-12674</a>] - Last edited by in PMs doesn't show user colour</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12680">PHPBB3-12680</a>] - Contact icons in viewtopic are missing alternative text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12695">PHPBB3-12695</a>] - Undefined index: MISSING_INLINE_ATTACHMENT notice given when viewing post details</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12716">PHPBB3-12716</a>] - Wrong method call in phpbb\auth\provider\oauth\token_storage</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12759">PHPBB3-12759</a>] - Profile fields lang value db queries can cause query flood</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12760">PHPBB3-12760</a>] - Post approval icon for wrong topics in Last Post column</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12764">PHPBB3-12764</a>] - Wrong error message on install if mysqli is selected and the credentials are wrong</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12766">PHPBB3-12766</a>] - Event exporter does not like RCx as version</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12768">PHPBB3-12768</a>] - 'NOTIFICATION_REPORT_CLOSED' entry has wrong indentation</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12771">PHPBB3-12771</a>] - Bug in \phpbb\db\migration\profilefield_base_migration when used in extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12772">PHPBB3-12772</a>] - Fatal error when "Email topic" is used in topic tools</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12773">PHPBB3-12773</a>] - Fix language variable name in cli extension enable command</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12774">PHPBB3-12774</a>] - Undefined variable $phpbb_adm_relative_path in phpbb_create_install_container()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12781">PHPBB3-12781</a>] - Template regex for DEFINE has problems when enclosed by other template conditionals</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12783">PHPBB3-12783</a>] - Remove require: phpbb/phpbb from Extensions composer.json files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12787">PHPBB3-12787</a>] - Incorrect generated url when using ajax and routing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12788">PHPBB3-12788</a>] - Update Symfony suite from 2.3.12 to 2.3.16</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12790">PHPBB3-12790</a>] - Always use the interface when available (and not directly the class)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12802">PHPBB3-12802</a>] - Properly handle connection errors in SQLite3</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12808">PHPBB3-12808</a>] - Small gap between username and drop-down arrow</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12810">PHPBB3-12810</a>] - In acp_forums the displayed value for prune_shadow_freq is the value of prune_freq</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12811">PHPBB3-12811</a>] - Margin Bottom not taking effect in Safari with 101% height on same element</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12815">PHPBB3-12815</a>] - Members list link hidden from guests who have permission to view members list page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12816">PHPBB3-12816</a>] - Fix comment about logs in user_ban function</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12818">PHPBB3-12818</a>] - Deleting a log entry in MCP produces a General error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12819">PHPBB3-12819</a>] - Wrong text on hover over "Jump to page" field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12825">PHPBB3-12825</a>] - Allow the extensions to be tested with the sniffer and skip the vendors</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12830">PHPBB3-12830</a>] - .postlink is in colours.css doubled, one should be deleted</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12834">PHPBB3-12834</a>] - Viewonline only matches routes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12839">PHPBB3-12839</a>] - Missing stylesheet when it is not updated</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12013">PHPBB3-12013</a>] - Quickmod tools and jumpbox should use new dropdown</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12099">PHPBB3-12099</a>] - path_helper returns wrong web root path for ajax requests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12196">PHPBB3-12196</a>] - Referer vs Referrer in language files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12197">PHPBB3-12197</a>] - Fix misleading FAQ entries</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12334">PHPBB3-12334</a>] - Add raw values of profile fields to template</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12562">PHPBB3-12562</a>] - Prosilver has no max-width</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12645">PHPBB3-12645</a>] - Update support links to 3.1 forums</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12662">PHPBB3-12662</a>] - Reorganize and modernize the header navbar</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12735">PHPBB3-12735</a>] - Remove all :link, :visited, :active link states</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12777">PHPBB3-12777</a>] - Rename extension status functions and add is_configured()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12779">PHPBB3-12779</a>] - Change order of file lists on automatic update</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12782">PHPBB3-12782</a>] - Use an interface for the phpbb event_dispatcher</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12784">PHPBB3-12784</a>] - Allow the extensions to add a custom auto loader</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12786">PHPBB3-12786</a>] - Extend profilefield_base_migration.php class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12812">PHPBB3-12812</a>] - Add a migrator tool for config_text database changes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12813">PHPBB3-12813</a>] - Improve responsive pagination location and fix page-jump title</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12823">PHPBB3-12823</a>] - Remove trailing whitespace from CSS files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12824">PHPBB3-12824</a>] - Move ACP & MCP links in the header to the end of the link list</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12827">PHPBB3-12827</a>] - Reorder quick-links</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12775">PHPBB3-12775</a>] - Refactor functions_container into class container_builder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12829">PHPBB3-12829</a>] - Remove check for pgsql 8.3/8.2</li> + </ul> + + <a name="v310b4"></a><h3>Changes since 3.1.0-b4</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8610">PHPBB3-8610</a>] - Splitting and merging topics does not handle subscriptions and bookmarks correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10899">PHPBB3-10899</a>] - Using Delete All in log viewer with keyword search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11331">PHPBB3-11331</a>] - Inform admin of incorrect avatar path instead of stripping unexpected parts from destination path</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11445">PHPBB3-11445</a>] - Suboptimal number of query complexity in phpbb_notification_manager::get_global_subscriptions()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11467">PHPBB3-11467</a>] - phpbb_extension_metadata_manager uses hard coded language for exceptions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11659">PHPBB3-11659</a>] - Information about file_upload is missing from the requirement page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11942">PHPBB3-11942</a>] - Delete post/topic reason should be added to the generated log entry</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12109">PHPBB3-12109</a>] - Bug when setting users forum permissions with "Select all users" checkbox</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12209">PHPBB3-12209</a>] - OAuth Authentication in ACP does not explain that it allows regular login too</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12332">PHPBB3-12332</a>] - Attachments with long file names break the Uploader layout</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12352">PHPBB3-12352</a>] - The service definition "auth.provider.smf" does not exist.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12443">PHPBB3-12443</a>] - Responsive tabs broken in IE</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12457">PHPBB3-12457</a>] - Gallery avatar category "Main" is empty</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12508">PHPBB3-12508</a>] - phpbb\finder (currently phpbb\extension\finder) should not depend on extension manager</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12521">PHPBB3-12521</a>] - When selecting the target to merge two topics, the last column is pushed on a new line</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12552">PHPBB3-12552</a>] - [RTL] - Forum list content forced into single char column when responsive</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12553">PHPBB3-12553</a>] - Right-to-left language bugs in prosilver</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12566">PHPBB3-12566</a>] - "Private messages" in viewtopic.php should be "Send pivate message"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12589">PHPBB3-12589</a>] - The finder should search directly in $directory if it's an absolute sub-path</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12612">PHPBB3-12612</a>] - Front-facing files should not contain functions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12615">PHPBB3-12615</a>] - Improper clearing of .topic-actions leads to float problems</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12637">PHPBB3-12637</a>] - coding-guidelines.html contains invalid HTML</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12638">PHPBB3-12638</a>] - Call to undefined function phpbb\db\migration\data\v30x\phpbb_require_updated() when not using autoupdate package</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12639">PHPBB3-12639</a>] - Delete entry in admin-log leads to mysql-error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12640">PHPBB3-12640</a>] - Posting editor tab "attachments" is unclicked in IE8</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12641">PHPBB3-12641</a>] - With IE8 logged in to ACP error message appears in the browser</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12643">PHPBB3-12643</a>] - Cannot convert SQLite DB from 3.0.12 to 3.1.0</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12652">PHPBB3-12652</a>] - Deleting marked log entries leads to MySQL Error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12660">PHPBB3-12660</a>] - Undefined offset error when phpinfo() disabled and debug enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12665">PHPBB3-12665</a>] - develop/migration_tips.php should not find extension tips</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12667">PHPBB3-12667</a>] - New posts in a topic cause undesirable results when clicking topic title or page button</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12672">PHPBB3-12672</a>] - Make <Tab> inside [code] - more user friendly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12673">PHPBB3-12673</a>] - PLUPLOAD fails due missing constant IMAGETYPE_SWC</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12675">PHPBB3-12675</a>] - Fix code sniffer complaints in 3.1.0-b5-dev code</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12682">PHPBB3-12682</a>] - Code Sniffer does not work correctly on Travis CI.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12688">PHPBB3-12688</a>] - Rank images do not work on routes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12694">PHPBB3-12694</a>] - Remove whitespace at end of line from acp_groups</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12697">PHPBB3-12697</a>] - Database Test Case Must Purge Extension Schema When Done</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12705">PHPBB3-12705</a>] - make_clickable is using static variables incorrectly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12707">PHPBB3-12707</a>] - \phpbb\db\driver\phpbb\db\driver\mysql is tried being loaded</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12708">PHPBB3-12708</a>] - [ROOT] -/install/install_main.php still uses docs/COPYING</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12709">PHPBB3-12709</a>] - Duplicate entries in the posting attachments tab</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12711">PHPBB3-12711</a>] - Contact form migration fails on MSSQL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12712">PHPBB3-12712</a>] - Password conversion migration fails on MSSQL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12715">PHPBB3-12715</a>] - Mistakes in the doc blocks</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12720">PHPBB3-12720</a>] - Git commit hook should not require commit message to start with a capital letter</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12728">PHPBB3-12728</a>] - Enforce box-model for image attachments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12741">PHPBB3-12741</a>] - Functional tests on Travis fail since php update last night</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12746">PHPBB3-12746</a>] - Failing test: tests/content_visibility/delete_post_test.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12747">PHPBB3-12747</a>] - Drop Firebird support</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12750">PHPBB3-12750</a>] - Install/Update footer is not centered anymore</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12752">PHPBB3-12752</a>] - Cron list tests fail on windows with ansi support</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12753">PHPBB3-12753</a>] - FIELD_INVALID_CHARS_ALPHA_PUNCTUATION is not localized</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12755">PHPBB3-12755</a>] - Remote upload stuck in infinite loop if server sends keep-alive</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12756">PHPBB3-12756</a>] - Fatal error with mysqli_fetch_assoc on hhvm</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12761">PHPBB3-12761</a>] - Remove the execute bit from functions_user.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12762">PHPBB3-12762</a>] - Make ext.php optional for extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12763">PHPBB3-12763</a>] - Do not unnecessarily rewrite install/schemas/*_schema.sql when updating schema.json file</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11266">PHPBB3-11266</a>] - Use our own error message when composer is not set up</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12532">PHPBB3-12532</a>] - Add header_navbar_username_prepend/append template events.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12541">PHPBB3-12541</a>] - Activate attachments tab when files are dropped into textarea</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12563">PHPBB3-12563</a>] - Language key names in ACP styles are misleading</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12606">PHPBB3-12606</a>] - PHP events in /includes/acp/acp_groups.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12608">PHPBB3-12608</a>] - Improve notifications drop-down menu styling in header</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12613">PHPBB3-12613</a>] - Improve pagination styling and jump-to-page dialog</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12646">PHPBB3-12646</a>] - Add data attribute to breadcrumb links</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12648">PHPBB3-12648</a>] - Improve UCP/MCP/Posting tabs styling & problems</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12655">PHPBB3-12655</a>] - Allow the CLI to be used as a shell</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12664">PHPBB3-12664</a>] - Refactor develop/migration_tips.php into a console command</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12666">PHPBB3-12666</a>] - Use "None" for images in gallery avatar path root and rename lang key</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12668">PHPBB3-12668</a>] - Add ability to modify subforums template data for core.display_forums_modify_template_vars event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12669">PHPBB3-12669</a>] - Add core event to the function display_forums() for additional template data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12677">PHPBB3-12677</a>] - Remove comment about ‘threading’</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12687">PHPBB3-12687</a>] - Add a constant to dissociate the displaying of the load time from DEBUG</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12690">PHPBB3-12690</a>] - Add core.submit_pm_after event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12691">PHPBB3-12691</a>] - Add core.delete_pm to funtion delete_pm.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12704">PHPBB3-12704</a>] - Improve the load time information in the footer when enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12706">PHPBB3-12706</a>] - Ignore additional languages and styles from git</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12714">PHPBB3-12714</a>] - Better align the description of radio buttons to avoid confusion with the forum list in attachments settings</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12740">PHPBB3-12740</a>] - Stop Using IDs as CSS selectors</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12758">PHPBB3-12758</a>] - Add 'show_results' mode var to event core.search_modify_rowset</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12597">PHPBB3-12597</a>] - Command for executing all available cron tasks</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12602">PHPBB3-12602</a>] - Add command to print the cron list</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12607">PHPBB3-12607</a>] - CLI command for running a specific cron task</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12575">PHPBB3-12575</a>] - Use a proxy pattern in \phpbb\di\service_collection</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12699">PHPBB3-12699</a>] - Replace instances in the message textarea keydown callback</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12721">PHPBB3-12721</a>] - Simple rules</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12722">PHPBB3-12722</a>] - Add rule Generic.Formatting.SpaceAfterCast</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12724">PHPBB3-12724</a>] - Add rule Squiz.PHP.Eval</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12729">PHPBB3-12729</a>] - Add Facebook profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12730">PHPBB3-12730</a>] - Add Google+ profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12731">PHPBB3-12731</a>] - Add YouTube profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12732">PHPBB3-12732</a>] - Add Skype profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12733">PHPBB3-12733</a>] - Add Twitter profile field</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11528">PHPBB3-11528</a>] - Use mink for acceptance tests involving javascript execution</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12514">PHPBB3-12514</a>] - Add additional tests for custom profile fields type</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12696">PHPBB3-12696</a>] - Add events to ucp_register.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12701">PHPBB3-12701</a>] - Add events to user_add function</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12723">PHPBB3-12723</a>] - Add Code Sniffer sniff ensuring PHP files use the correct file header</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12726">PHPBB3-12726</a>] - Add Code Sniffer sniff ensuring PHP files do not contain any unused use statements</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12757">PHPBB3-12757</a>] - Add a Code Sniffer ruleset for PHP files of phpBB extensions</li> + </ul> + + + <a name="v310b3"></a><h3>Changes since 3.1.0-b3</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10176">PHPBB3-10176</a>] - Imageset Appearance Problem with Google Chrome Browser. </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11226">PHPBB3-11226</a>] - filespec::move_file() from functions_upload.php does not error correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11232">PHPBB3-11232</a>] - prosilver ajax.js does not respect PHPBB_USE_BOARD_URL_PATH</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11366">PHPBB3-11366</a>] - Add "MOD Version Check" for extensions to the core</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11497">PHPBB3-11497</a>] - The extension finder keeps state, so should be instantiated on each container request, not reset manually</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12025">PHPBB3-12025</a>] - Post Preview no longer shows UNAUTHORISED_BBCODE warning for disallowed BBcodes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12074">PHPBB3-12074</a>] - Enabling/Disabling/Data deleting of an extension should generate a log entry</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12174">PHPBB3-12174</a>] - "Download all attachments" link displayed when the topic has attachments in hidden posts only</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12185">PHPBB3-12185</a>] - Topic header in viewforum too small for translation</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12270">PHPBB3-12270</a>] - Approving a topic triggers wrong notification</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12275">PHPBB3-12275</a>] - core.modify_username_string is not triggered everytime</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12332">PHPBB3-12332</a>] - Attachments with long file names break the Uploader layout</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12357">PHPBB3-12357</a>] - generate_smilies() does not work for routes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12402">PHPBB3-12402</a>] - CAPTCHA plugin migration fails to detect missing plugins</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12415">PHPBB3-12415</a>] - Use private message instead of "pm" accronym in cpf visibility options</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12421">PHPBB3-12421</a>] - We try to display attachments in feed even for users who don't have the right to see them</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12428">PHPBB3-12428</a>] - Incorrect from version in database update log entry</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12434">PHPBB3-12434</a>] - No error message with Plupload except for files without extension</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12435">PHPBB3-12435</a>] - purge_notifications() fails for disabled extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12440">PHPBB3-12440</a>] - Change URL in browsers addressbar when a view=unread#unread link was used</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12451">PHPBB3-12451</a>] - posting.php TOO_FEW_CHARS_LIMIT should be split for plurals</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12459">PHPBB3-12459</a>] - Unapproved posts/topics are not correctly handled in feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12460">PHPBB3-12460</a>] - Soft deleted posts/topics are not correctly handled in feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12461">PHPBB3-12461</a>] - Statistics are wrong for topic's based feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12476">PHPBB3-12476</a>] - purge_cache should increase asset version</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12486">PHPBB3-12486</a>] - "Risky" tests from phpunit 4.1</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12491">PHPBB3-12491</a>] - Conflict between USERNAME_FULL in functions.php and mcp_notes.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12493">PHPBB3-12493</a>] - User can not send PMs to users with PMs disabled, but PM button is visible on posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12498">PHPBB3-12498</a>] - IE8 displays avatar in header with wrong width</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12499">PHPBB3-12499</a>] - Incorrect call to phpbb\log\log::add() in db:migrate console command</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12500">PHPBB3-12500</a>] - user.img does not set a title attribute for resulting span</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12501">PHPBB3-12501</a>] - Weird post attachment behavior in MCP report details</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12503">PHPBB3-12503</a>] - All test cases should extend phpbb_test_case instead of PHPUnit_Framework_TestCase</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12504">PHPBB3-12504</a>] - Avatar manager test is using undefined variables</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12509">PHPBB3-12509</a>] - Extentions can't send email with new notification system</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12510">PHPBB3-12510</a>] - build_url() is not encoding url entities</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12511">PHPBB3-12511</a>] - Missing language strings in memberlist group view for mobile prosilver</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12513">PHPBB3-12513</a>] - simple_headers do not support extension loaded CSS stylesheets</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12517">PHPBB3-12517</a>] - Missing argument in call to log.add() in prune_shadow_topics.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12519">PHPBB3-12519</a>] - m_approve language update from soft delete patch got nucked by a merge conflict</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12520">PHPBB3-12520</a>] - Can not move text with the mouse anymore in post-box when attachments are allowed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12522">PHPBB3-12522</a>] - Add parameter description in guesser_interface</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12525">PHPBB3-12525</a>] - CONTACT_USER used with username</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12526">PHPBB3-12526</a>] - "Undefined index: filesize" error thrown when editing a PM with attachments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12527">PHPBB3-12527</a>] - Remove translation editor from ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12529">PHPBB3-12529</a>] - phpbb\controller\resolver::getController doesn't use $phpbb_root_path to check if the template dir exist</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12533">PHPBB3-12533</a>] - The notification link should fill the parent li-container in the notifications dialog</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12534">PHPBB3-12534</a>] - Enabling and disabling extensions should not abuse the red errorbox</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12536">PHPBB3-12536</a>] - Get Versions Should Not Require Both Stable and Unstable Branches</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12540">PHPBB3-12540</a>] - WRONG_FILESIZE contains broken placeholders</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12543">PHPBB3-12543</a>] - Enter key no longer works in posting when attachment error is triggered</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12547">PHPBB3-12547</a>] - Rename jquery.js to jquery.min.js in assets directory</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12548">PHPBB3-12548</a>] - [RTL] - Posting button icons should display on left side of text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12549">PHPBB3-12549</a>] - [RTL] - Forumlist/topiclist <dfn> tags should not be visible</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12550">PHPBB3-12550</a>] - [RTL] - Last post column breaks into second line</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12551">PHPBB3-12551</a>] - [RTL] - Breadcrumb separator does not display correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12561">PHPBB3-12561</a>] - Create_schema_files.php should process colum "after" instead of adding it to the JSON</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12570">PHPBB3-12570</a>] - db_text throws an error, when set() is called with the current value</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12572">PHPBB3-12572</a>] - JavaScript console throws error when alert message title is not defined (core.js bug)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12580">PHPBB3-12580</a>] - :link Pseudo causing over specificity issues in the theme</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12586">PHPBB3-12586</a>] - \phpbb\extension\manager::all_available() should only locate ext files two levels deep and ignore dot-files/folders</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12594">PHPBB3-12594</a>] - File headers, credit lines, etc. should reflect updated legal info</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12600">PHPBB3-12600</a>] - The cli command extension:show is broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12604">PHPBB3-12604</a>] - Notifications Dropdown Padding Broken When Empty</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12611">PHPBB3-12611</a>] - phpBB Group copyright notice should be removed from all images</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12614">PHPBB3-12614</a>] - Do not hide post buttons before hovering over post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12621">PHPBB3-12621</a>] - schema.json is not up to date with migration files</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9388">PHPBB3-9388</a>] - use DOM scripting to hide unnecessary input fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11163">PHPBB3-11163</a>] - Include ext/ directory in installation and update packages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12155">PHPBB3-12155</a>] - Use CSS instead of translated images for the mini post buttons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12407">PHPBB3-12407</a>] - Allow changing of post_data and other variables with core.posting_modify_template_vars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12431">PHPBB3-12431</a>] - Add has_poll icon to topiclists</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12433">PHPBB3-12433</a>] - QUOTE_DEPTH_EXCEEDED needs a different string for '1'</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12488">PHPBB3-12488</a>] - Add user warning indication to viewtopic posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12507">PHPBB3-12507</a>] - Add console command to purge the cache</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12518">PHPBB3-12518</a>] - Allow extensions to overwrite CANNOT_EDIT_* checks in posting.php and viewtopic.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12523">PHPBB3-12523</a>] - Add search_results.html template events search_results_topic_(before/after)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12524">PHPBB3-12524</a>] - Add search.php core event to modify search results rowset</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12531">PHPBB3-12531</a>] - Restore default topic title links in subsilver2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12555">PHPBB3-12555</a>] - Make use of canonical urls to avoid duplicate content</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12583">PHPBB3-12583</a>] - Add event core.mcp_warn_post_before/after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12584">PHPBB3-12584</a>] - Add event core.mcp_warn_user_before/after</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12576">PHPBB3-12576</a>] - Remove cron from common.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12585">PHPBB3-12585</a>] - Don't check the cron on each page load</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10839">PHPBB3-10839</a>] - Remove phpunit.xml.functional and always include functional tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12384">PHPBB3-12384</a>] - Run Travis CI HHVM tests against MySQLi instead of MySQL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12495">PHPBB3-12495</a>] - Add Sami to composer dependencies and build script</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12544">PHPBB3-12544</a>] - Update Plupload to 2.1.2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12582">PHPBB3-12582</a>] - Strip away copyrighted ICC profile from images</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12592">PHPBB3-12592</a>] - Run mysql driver on Travis CI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12603">PHPBB3-12603</a>] - Remove hook_system.html from docs</li> + </ul> + + + <a name="v310b2"></a><h3>Changes since 3.1.0-b2</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-7707">PHPBB3-7707</a>] - Missing occurrences of get_username_string</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8323">PHPBB3-8323</a>] - Banned User (PMs and Mails)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8558">PHPBB3-8558</a>] - Board Emails not setting a correct email header</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8700">PHPBB3-8700</a>] - Language file "acp/styles.php" contains many unused language entries</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8960">PHPBB3-8960</a>] - Allow changing allow_avatar_remote when images/avatars/upload is not writable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10423">PHPBB3-10423</a>] - Searching for the term "test *" will highlight nearly every word and displays htmlspecialchars as htmlentities.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10687">PHPBB3-10687</a>] - UNABLE_GET_IMAGE_SIZE text misleading for remote avatars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10851">PHPBB3-10851</a>] - HTML files containing certain tags being rejected as possible attack vectors with "Check attachment file" set to "No"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11098">PHPBB3-11098</a>] - New persistent login keys list should have (un)select all and order options.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11339">PHPBB3-11339</a>] - Using AJAX calls one after another</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11352">PHPBB3-11352</a>] - Disapproving topic takes you to quick reply for that topic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11431">PHPBB3-11431</a>] - All topic notifications are deleted if one reply is edited and needs to be approved</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11508">PHPBB3-11508</a>] - General error "not allowed as quickmod" when changing the forum while merging two topics</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11772">PHPBB3-11772</a>] - New topic notification triggered when editing an existing post with post-approval enabled</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11860">PHPBB3-11860</a>] - .htaccess not working for Apache 2.4</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11881">PHPBB3-11881</a>] - Timezone migration can take a long time</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11917">PHPBB3-11917</a>] - "Manage external account" shows when not activated</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11978">PHPBB3-11978</a>] - Text field for topic-search</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12004">PHPBB3-12004</a>] - Support empty routes to app.php/ in path_helper</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12012">PHPBB3-12012</a>] - DB Tools should correctly remove columns that are part of indexes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12043">PHPBB3-12043</a>] - Sort Extensions by Name in ACP Ext Mgr</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12052">PHPBB3-12052</a>] - Post edited by user on moderation queue is not marked as unapproved.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12083">PHPBB3-12083</a>] - "Select all" selects nothing in Webkit Browsers with only one character in [code] -</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12097">PHPBB3-12097</a>] - The validate_data() function doesn't work with class method</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12113">PHPBB3-12113</a>] - Deleting warnings does not use plurals correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12121">PHPBB3-12121</a>] - Update process doesn't preserve total redirects for links</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12130">PHPBB3-12130</a>] - Bullet character disappears on mouse-over in IE8</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12186">PHPBB3-12186</a>] - MCP should open "Reported posts" instead of PM Reports</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12191">PHPBB3-12191</a>] - UCP should open with global settings instead of notification settings</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12193">PHPBB3-12193</a>] - Broken HTML when an SQL error occurs during migration</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12211">PHPBB3-12211</a>] - Attachment file names are run through htmlspecialchars twice</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12254">PHPBB3-12254</a>] - Language switching on Registration page doesn't work for Extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12265">PHPBB3-12265</a>] - Contact profile fields icons should be hidden in a dropdown</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12286">PHPBB3-12286</a>] - Fix coding guidelines</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12331">PHPBB3-12331</a>] - Fix DB error in update_profile_field_data() with disabled fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12342">PHPBB3-12342</a>] - Javascript Bugs and Fixes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12348">PHPBB3-12348</a>] - Make create_schema_files.php runnable when phpBB is not installed yet</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12350">PHPBB3-12350</a>] - tests/extension/modules_test.php can not be run alone</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12351">PHPBB3-12351</a>] - Ajax "Mark topics read" does not give feedback</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12353">PHPBB3-12353</a>] - User attachments in ACP are not displaying every attachment</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12354">PHPBB3-12354</a>] - passwords_manager_test::test_unique_id fails from time to time</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12355">PHPBB3-12355</a>] - Topic Tools not updated fully updated when subscribing/bookmarking</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12356">PHPBB3-12356</a>] - Plupload does not load in PM editor</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12358">PHPBB3-12358</a>] - data-refresh not working as expected for routes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12359">PHPBB3-12359</a>] - Day and Month of Birthday Misaligned When Editing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12360">PHPBB3-12360</a>] - User is displayed twice in online list after second login</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12362">PHPBB3-12362</a>] - Infinite loop in schema generator if dependency can't be resolved</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12367">PHPBB3-12367</a>] - Travis fails in phpbb_wrapper_gmgetdate_test::test_gmgetdate()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12372">PHPBB3-12372</a>] - dE() function does not toggle in ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12373">PHPBB3-12373</a>] - Add to/from forum ids to LOG_MOVE entries </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12375">PHPBB3-12375</a>] - Attachment deletion broken after jQuery update</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12378">PHPBB3-12378</a>] - Prosilver common.css has duplicate entries</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12379">PHPBB3-12379</a>] - Plupload labels duplicated when responsive</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12380">PHPBB3-12380</a>] - “Remember Me†login keys are not sorted in UCP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12381">PHPBB3-12381</a>] - Broken error message when selecting invalid DB driver</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12382">PHPBB3-12382</a>] - Template event listners can not access subloops when loop is defined in the original file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12386">PHPBB3-12386</a>] - Add DEBUG_EXTRA again and use it for container creation</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12388">PHPBB3-12388</a>] - Log entries without log_data display language key instead of translated string</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12391">PHPBB3-12391</a>] - core.posting_modify_template_vars pass some variables to listeners</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12395">PHPBB3-12395</a>] - Pagination tests fail on travis with postgresql</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12397">PHPBB3-12397</a>] - db_tools::sql_unique_index_exists() has wrong doc block</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12398">PHPBB3-12398</a>] - Prune shadow topics tests fail due to wrong forum_last_post_id</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12405">PHPBB3-12405</a>] - create_user() in functional tests uses invalid timezone and no dateformat</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12406">PHPBB3-12406</a>] - Fix description of page_title var in core.viewtopic_modify_page_title</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12412">PHPBB3-12412</a>] - Styling issue with pagination numbering for smilies and icons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12413">PHPBB3-12413</a>] - Fatal error "Call to undefined method phpbb\feed\*::fetch_attachments()" for topic based feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12418">PHPBB3-12418</a>] - Notice displayed for feed.php </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12422">PHPBB3-12422</a>] - Log searches error due to plural arrays in language files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12429">PHPBB3-12429</a>] - Update phpunit to 3.8+</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12432">PHPBB3-12432</a>] - Migrator should not automatically revert custom functions defined in update_data()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12436">PHPBB3-12436</a>] - Functional test framework's add_style() should not use sql_multi_insert()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12444">PHPBB3-12444</a>] - The logs message aren't filled correctly when some values are missing.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12455">PHPBB3-12455</a>] - Remove unused strings EXTENSION_CONTROLLER_MISSING and EXTENSION_CLASS_WRONG_TYPE from common.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12456">PHPBB3-12456</a>] - Missing new lines at the end of file in language files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12467">PHPBB3-12467</a>] - Add config_*.php and tests_config_*.php to .gitignore</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12469">PHPBB3-12469</a>] - Convert Timezone test fails because of outdated schema</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12470">PHPBB3-12470</a>] - Move commands from .travis.yml to separate files to allow reuse</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12472">PHPBB3-12472</a>] - Set fast finish for .travis.yml</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12474">PHPBB3-12474</a>] - The console command for updating/migrating the db should display the error with the <error> tag</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12475">PHPBB3-12475</a>] - Undefined variable $log in db:migrate console command</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12477">PHPBB3-12477</a>] - PM link no longer displays in viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12478">PHPBB3-12478</a>] - ucp_pm_viewmessage_contact_fields_before/after missing in PM page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12480">PHPBB3-12480</a>] - \phpbb\extension\finder is finding too many routing files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12482">PHPBB3-12482</a>] - Undefined variable: data in viewtopic when not logged in</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12485">PHPBB3-12485</a>] - Broken tests due to absolute exclude</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12494">PHPBB3-12494</a>] - Undefined index: user_type on viewtopic.php</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9758">PHPBB3-9758</a>] - Make users avatar available to the template</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10521">PHPBB3-10521</a>] - Override Board Language via URL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11962">PHPBB3-11962</a>] - Resize images to 100% with in viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12150">PHPBB3-12150</a>] - Automatically prune shadow topics</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12201">PHPBB3-12201</a>] - Clean up ACP attachment management page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12273">PHPBB3-12273</a>] - Add a test to run the event exporter on travis</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12282">PHPBB3-12282</a>] - Add an interface for dbal driver to ensure that functions are there</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12283">PHPBB3-12283</a>] - Online status on posting review page.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12322">PHPBB3-12322</a>] - Add CSS classes for post-profile <dd> elements</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12323">PHPBB3-12323</a>] - Add Template Event search_results_author_prepend</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12327">PHPBB3-12327</a>] - Changing poll result-bars width from absolute % to relative</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12328">PHPBB3-12328</a>] - Add Template Event index_body_stat_blocks_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12329">PHPBB3-12329</a>] - Add <div> container to index blocks (online-list, birthday-list, statistics)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12333">PHPBB3-12333</a>] - Add Template Event overall_header_page_body_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12335">PHPBB3-12335</a>] - Add Events to phpbb\profilefields\manager (grab & show)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12336">PHPBB3-12336</a>] - Add functions_module.php core events to allow adjusting parameters for custom ACP, MCP, UCP modules</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12337">PHPBB3-12337</a>] - Update jQuery to version 1.11.0</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12338">PHPBB3-12338</a>] - Add Template Event overall_footer_page_body_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12339">PHPBB3-12339</a>] - Add Event core.page_header_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12344">PHPBB3-12344</a>] - Add event to submit_pm()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12345">PHPBB3-12345</a>] - Improve search flood interval message</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12346">PHPBB3-12346</a>] - Add Template Event overall_header_navlink_append/prepend</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12347">PHPBB3-12347</a>] - Move breadcrumb seperator from template to CSS</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12361">PHPBB3-12361</a>] - Replace the Google logo with the phpBB logo in the BBCode FAQ</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12364">PHPBB3-12364</a>] - Add template identifier var to all missing pages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12365">PHPBB3-12365</a>] - Do not crop image attachment heights at 350px</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12366">PHPBB3-12366</a>] - Add Event core.search_get_posts_data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12369">PHPBB3-12369</a>] - Add template variable for extensions to add classes to <body> element without JS</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12374">PHPBB3-12374</a>] - Add Template events index_body_block_<blockname>_append</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12376">PHPBB3-12376</a>] - Add template events viewtopic_body_polls</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12377">PHPBB3-12377</a>] - Move navbars to separate template files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12389">PHPBB3-12389</a>] - Move "print topic" & "email topic" icons (and PM versions) to topic tools</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12392">PHPBB3-12392</a>] - Include $profile_fields in core.memberlist_view_profile event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12396">PHPBB3-12396</a>] - Add Template events viewforum_forum_name_append/prepend</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12400">PHPBB3-12400</a>] - Add viewforum.php core event to allow modifying topics data before display the page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12401">PHPBB3-12401</a>] - Add $topic_data array to core.viewtopic_modify_post_row event in viewtopic.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12403">PHPBB3-12403</a>] - Add template events to acp_users_prefs.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12409">PHPBB3-12409</a>] - Add acp_users.php core events to modify users preferences data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12410">PHPBB3-12410</a>] - Add Template events search_results_post_before/after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12411">PHPBB3-12411</a>] - Expand dispatch vars of event: core.search_modify_tpl_ary</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12419">PHPBB3-12419</a>] - Improve font size in notifications drop-down</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12437">PHPBB3-12437</a>] - Clean up redundant "clear" elements & "corners"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12438">PHPBB3-12438</a>] - Add Template event memberlist_view_content_prepend</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12442">PHPBB3-12442</a>] - Add CSS classes to heading elements</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12473">PHPBB3-12473</a>] - Add console command for updating/migrating database</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12484">PHPBB3-12484</a>] - Template event ucp_agreement_terms_before/after</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9728">PHPBB3-9728</a>] - Support for sqlite version 3</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12349">PHPBB3-12349</a>] - License in migrations header not linking to version 2 of GNU GPL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12370">PHPBB3-12370</a>] - Editing a post removes topic notifications</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12371">PHPBB3-12371</a>] - Notifications are incorrectly updated when a post is deleted or moved to ModerationQueue</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12071">PHPBB3-12071</a>] - Test suite fails if Fileinfo isn't installed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12199">PHPBB3-12199</a>] - Move deprecated functions to functions_compatibility.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12318">PHPBB3-12318</a>] - Correctly setup HHVM functional tests on Travis CI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12320">PHPBB3-12320</a>] - No longer allow Travis CI HHVM environment to fail</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12341">PHPBB3-12341</a>] - Add tests for get_username_string()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12390">PHPBB3-12390</a>] - Released packages MUST NOT contain vendor tests or other non-library code</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12417">PHPBB3-12417</a>] - hhvm-nightly 2014.04.16~precise breaks tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12423">PHPBB3-12423</a>] - Increase composer minimum-stability from beta to stable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12424">PHPBB3-12424</a>] - Update Symfony Dependencies to latest 2.3 releaes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12458">PHPBB3-12458</a>] - Apply Squiz.WhiteSpace.SuperfluousWhitespace.* sniffs to legacy codebase</li> + </ul> + + + <a name="v310b1"></a><h3>Changes since 3.1.0-b1</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8309">PHPBB3-8309</a>] - Rename "Last visited" to "Last activity" on memberlist/viewprofile</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9040">PHPBB3-9040</a>] - Count HTML entities as single characters in Custom Profile fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9725">PHPBB3-9725</a>] - MSSQL Schema is not azure compatible</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10769">PHPBB3-10769</a>] - "ACP Access Denied" view includes ajax parts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11071">PHPBB3-11071</a>] - User selection of an invalid style causes a general error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11357">PHPBB3-11357</a>] - Invalid markup in installer</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11959">PHPBB3-11959</a>] - List of users in notifications should be trimmed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12031">PHPBB3-12031</a>] - Bug language Notification list should trim users</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12127">PHPBB3-12127</a>] - Possible NOTIFICATION_QUOTE_TRIMMED miswording</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12160">PHPBB3-12160</a>] - Convert Page throws "invalid dbms driver" when no phpBB installation is present</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12257">PHPBB3-12257</a>] - MySQL Fulltext Tests are not run on Travis CI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12281">PHPBB3-12281</a>] - Disable redis in travis setup on develop until redis fixes it</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12292">PHPBB3-12292</a>] - Buttons are mis-matched, unaligned in ACP Style Details</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12293">PHPBB3-12293</a>] - Core event listeners not working in log.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12294">PHPBB3-12294</a>] - phpbb_ in profile fields column names is incorrectly replaced with the table prefix</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12297">PHPBB3-12297</a>] - user_from column not deleted on update to b1</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12310">PHPBB3-12310</a>] - SMTP username and password should not autocomplete during install</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12311">PHPBB3-12311</a>] - Metadata Manager should require license instead of licence</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12314">PHPBB3-12314</a>] - HHVM SPL autoloader sometimes passes class name with leading backslash</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12315">PHPBB3-12315</a>] - NO_SEARCH_INDEX in language/en/acp/common.php uses invalid HTML</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12316">PHPBB3-12316</a>] - develop-ascraeus build status missing from "Automated Testing" section in README.md</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12317">PHPBB3-12317</a>] - Some notification tests fail on DBMS drivers using appropriate integer typing (MSSQL, Sqlite3, also MySQL on HHVM)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12321">PHPBB3-12321</a>] - Remove execute bit from file ucp_main_subscribed.html and buttons.png in prosilver</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12324">PHPBB3-12324</a>] - Can not update from b1 to b2 because of missing install/update/new/config/ folder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12326">PHPBB3-12326</a>] - Error while updating from b1 to b2 because of incomplete update files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12330">PHPBB3-12330</a>] - Installation fails on MSSQL</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10174">PHPBB3-10174</a>] - Rename "Ban usernames" to "Ban users" in ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10590">PHPBB3-10590</a>] - Skip confirmation page after successful posting of an approved post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11169">PHPBB3-11169</a>] - Move prune users from security to users category</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11230">PHPBB3-11230</a>] - Use @inheritdoc in docblocks in cache drivers</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11239">PHPBB3-11239</a>] - Include username before the Overview title.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11336">PHPBB3-11336</a>] - Rename mode parameter from "leaders" to something more accurate for the "The team" page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11360">PHPBB3-11360</a>] - page_header() argument "display_online_list" should be FALSE by default</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11666">PHPBB3-11666</a>] - POST_DELETED should refer to posts instead of messages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12035">PHPBB3-12035</a>] - Add a link to user's posts in the ACP user overview page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12198">PHPBB3-12198</a>] - Unused ERR_TEMPLATE_EVENT_* language strings in en/common.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12268">PHPBB3-12268</a>] - Extension finder should not crawl through .git/ of extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12269">PHPBB3-12269</a>] - Delete "mods" folder from the language folder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12274">PHPBB3-12274</a>] - Updater is using old version of adm/style/admin.css</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12276">PHPBB3-12276</a>] - Expand core.memberlist_view_profile event to include Zebra state</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12278">PHPBB3-12278</a>] - Add mcp.php core event to allow setting display options for custom MCP modules</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12284">PHPBB3-12284</a>] - Make Extension Details page more readable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12289">PHPBB3-12289</a>] - Add viewtopic_body.html template event to allow custom post notices</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12300">PHPBB3-12300</a>] - Revert and Reimagine Link to last read posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12304">PHPBB3-12304</a>] - Add CSS class to rules-link container</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12308">PHPBB3-12308</a>] - Add Template Event forumlist_body_last_row_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12309">PHPBB3-12309</a>] - Add Template Event quickreply_editor_panel_before/after</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-7580">PHPBB3-7580</a>] - Allow isset() check in IF template syntax</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12298">PHPBB3-12298</a>] - Template Event memberlist_view_contact_before/after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12301">PHPBB3-12301</a>] - Template Event overall_header_body_before</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11459">PHPBB3-11459</a>] - Deduplicate database schema definiton</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11904">PHPBB3-11904</a>] - Revisit ALLOW_CDN_EXPLAIN wording</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12302">PHPBB3-12302</a>] - Upgrade composer.phar to 1.0.0-alpha8</li> + </ul> + + <a name="v310a3"></a><h3>Changes since 3.1.0-a3</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8041">PHPBB3-8041</a>] - Do not concatenate the destination to L_RETURN_TO to allow better translations</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8122">PHPBB3-8122</a>] - Reviewing topics/posts - not correctly displayed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8785">PHPBB3-8785</a>] - PM recipients/bcc list looks bad</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8919">PHPBB3-8919</a>] - Localisation imageset being refreshed too frequently causing broken images</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9106">PHPBB3-9106</a>] - Upload fails to complete for large files.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9420">PHPBB3-9420</a>] - BBCode - Unable to use a proper URI token</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9459">PHPBB3-9459</a>] - Visiting ACP with screen resolution 800x600px</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10175">PHPBB3-10175</a>] - Class loader cannot find a/b_foo.php when a/b/bar.php exists</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10338">PHPBB3-10338</a>] - Attachments list is displayed incorrectly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10722">PHPBB3-10722</a>] - Code Coverage generation fails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11038">PHPBB3-11038</a>] - Does not correctly find module info classes using new naming conventions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11146">PHPBB3-11146</a>] - MCP topic/post approval error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11151">PHPBB3-11151</a>] - Can use negative start for memberlist.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11218">PHPBB3-11218</a>] - File upload functional test fails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11255">PHPBB3-11255</a>] - Some tests do not run standalone due to dbal dependency on global $cache</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11271">PHPBB3-11271</a>] - Images in ATOM feed display, but attached inline images do not.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11288">PHPBB3-11288</a>] - "Fulltext native" search fooled by hyphens</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11364">PHPBB3-11364</a>] - Add an easy-to-switch system for app.php?controller= vs mod-rewrite usage in append_sid</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11429">PHPBB3-11429</a>] - Extensions should increment assets number on enable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11581">PHPBB3-11581</a>] - General Error in UCP if PMs are disabled in ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11625">PHPBB3-11625</a>] - General Error accessing MCP from Global Announcement</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11648">PHPBB3-11648</a>] - Test suite creates files in phpBB directory</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11787">PHPBB3-11787</a>] - Permission language strings use samp for highlight instead of strong</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11880">PHPBB3-11880</a>] - Schema changes can take too long and cause a timeout</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11938">PHPBB3-11938</a>] - Use of deprecated sql_attr_str2ordinal in sphinx.conf</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12003">PHPBB3-12003</a>] - ACP broken when error thrown</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12072">PHPBB3-12072</a>] - Missing word "send" in comment in schema_data.sql</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12078">PHPBB3-12078</a>] - "Can permanently delete own posts" permission has no effect</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12080">PHPBB3-12080</a>] - Responsive design in ACP / User Administration / Signature needs fixing</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12093">PHPBB3-12093</a>] - IE 11 javascript selection is no longer supported</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12126">PHPBB3-12126</a>] - Alert box is aligned to the left instead of center in IE</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12132">PHPBB3-12132</a>] - viewtopic_print_head_append template event is missing in subsilver2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12134">PHPBB3-12134</a>] - ucp_pm_viewmessage_print_head_append template event is missing in subsilver2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12136">PHPBB3-12136</a>] - Call to undefined function generate_pagination() in functions_posting.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12138">PHPBB3-12138</a>] - Information and pagination of filtered attachments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12139">PHPBB3-12139</a>] - Spaces missing after $show_guests in viewonline.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12141">PHPBB3-12141</a>] - Travis tests fail on 5.5</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12149">PHPBB3-12149</a>] - Division by zero in [ROOT] -/phpbb/pagination.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12153">PHPBB3-12153</a>] - PAGE_NUMBER should be assigned by pagination.generate_template_pagination()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12158">PHPBB3-12158</a>] - pagination.validate_start() returns negative value when $num_items = 0</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12168">PHPBB3-12168</a>] - Nav Header Links Alignment Issues without small-icon</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12170">PHPBB3-12170</a>] - Migration helper replaces table name with 0 when creating tables</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12171">PHPBB3-12171</a>] - Attachments from soft-deleted posts are still downloadable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12172">PHPBB3-12172</a>] - "Download all attachments" feature leaks post/pm attachments when being able to download one of them</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12175">PHPBB3-12175</a>] - Fix and run functional upload tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12176">PHPBB3-12176</a>] - No error shown when attempting to delete a founder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12183">PHPBB3-12183</a>] - Update user_newpasswd column in users table for passwords manager</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12184">PHPBB3-12184</a>] - Undefined variable tpl_fields in profile field manager on memberlist</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12188">PHPBB3-12188</a>] - Add php 5.6 to travis tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12192">PHPBB3-12192</a>] - Avatars in PM report closed notifications are broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12194">PHPBB3-12194</a>] - Unknown column 'field_show_novalue' in 'field list' [1054] -</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12200">PHPBB3-12200</a>] - Profile field template files missing in adm/style</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12202">PHPBB3-12202</a>] - Variables read from style.cfg etc. should be htmlspecialchared</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12203">PHPBB3-12203</a>] - user_occ does not have a default value when registering</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12205">PHPBB3-12205</a>] - Custom Profile Field display bug</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12206">PHPBB3-12206</a>] - Errors in plupload doesn't pull lang vars right</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12207">PHPBB3-12207</a>] - prosilver layout breaks when error outputted before <html></li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12208">PHPBB3-12208</a>] - Plupload uploads files even if they were deleted from queue</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12210">PHPBB3-12210</a>] - dbtools::sql_create_table incorrectly throws error related to auto-increment length on non auto-increment fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12212">PHPBB3-12212</a>] - HTML in attachment file name rendered before upload</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12216">PHPBB3-12216</a>] - Undefined index: lang_options when creating date profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12220">PHPBB3-12220</a>] - Debug message if no unread messages are present</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12222">PHPBB3-12222</a>] - Replace hardoded comma with translatable separator in forumlist_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12223">PHPBB3-12223</a>] - Pagination displayes additional &bull; when PAGE_NUMBER is empty</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12226">PHPBB3-12226</a>] - Incorrectly used plurals in ucp.php MOVE_PM_ERROR and FOLDER_MESSAGE_STATUS</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12227">PHPBB3-12227</a>] - "X from Y messages" should be "X out of Y messages"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12243">PHPBB3-12243</a>] - subsilver2 is missing profile field files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12245">PHPBB3-12245</a>] - "Invalid id refernce" for label "joined" and "group_id" in acp_prune_users.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12249">PHPBB3-12249</a>] - Undefined variable: row when editing profile</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12250">PHPBB3-12250</a>] - Remove deprecated phpbb_clean_path function</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12251">PHPBB3-12251</a>] - Clean up and Enhancement of Custom Profile Fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12256">PHPBB3-12256</a>] - phpbb\notification\type\admin_activate_user uses $sql as fetchrow parameter</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12261">PHPBB3-12261</a>] - Login redirect from extension front controllers broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12263">PHPBB3-12263</a>] - \phpbb\db\migration\tool\module.php contains several errors</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12267">PHPBB3-12267</a>] - Functional testcase method get_extension_manager() uses undefined variable php_ext</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12271">PHPBB3-12271</a>] - Decouple dropdown header/footer from #notification_list</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12272">PHPBB3-12272</a>] - Hardcoded colon in subforums list</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9255">PHPBB3-9255</a>] - Friends Sidebar has scability issues..</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9479">PHPBB3-9479</a>] - Empty paragraphs for vertical spacing are rather old-fashioned</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9709">PHPBB3-9709</a>] - Missing language files for MCP could be substituted by default / english ones</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9871">PHPBB3-9871</a>] - Update version check file to use json format</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10288">PHPBB3-10288</a>] - Templates including other templates in loop can't access variables</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10549">PHPBB3-10549</a>] - Languages variables should be used, not hardcoded</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10555">PHPBB3-10555</a>] - Copyright notice in overall_header.html is not translatable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10945">PHPBB3-10945</a>] - Show entered search query in the search box when no results are found.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11019">PHPBB3-11019</a>] - Ability to store array of data in a log</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11022">PHPBB3-11022</a>] - Add "Tahoma" to used font families in css files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11040">PHPBB3-11040</a>] - PostgreSQL fulltext search improvement</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11111">PHPBB3-11111</a>] - Allow only vertical resize on the textarea.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11179">PHPBB3-11179</a>] - change the start parameter in search when out of bounds to display last(or first) page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11201">PHPBB3-11201</a>] - MSNM / WLM closing - redundant profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11254">PHPBB3-11254</a>] - Check CRLF line endings in the test suite</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11297">PHPBB3-11297</a>] - Running tests doc should mention dbunit dependency</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11610">PHPBB3-11610</a>] - Use a more secure hashing method like bcrypt</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11645">PHPBB3-11645</a>] - Rename ".MODs" tab in the ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11693">PHPBB3-11693</a>] - Change phpbb_db_driver::sql_build_array() to support DELETE</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11716">PHPBB3-11716</a>] - Migration to convert soft delete/trash bin mods to 3.1 soft delete</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12029">PHPBB3-12029</a>] - Module names in the ACP should not be truncated when they are too long</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12073">PHPBB3-12073</a>] - Small text size in ACP between <samp></samp> and <code></code> tags</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12106">PHPBB3-12106</a>] - Document exceptions to "Disable Board" in ACP.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12114">PHPBB3-12114</a>] - Convert current profile fields to custom-profile-field system</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12117">PHPBB3-12117</a>] - Nested Set Tree Classes Should be able to get all roots</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12166">PHPBB3-12166</a>] - Add template event "quickreply_editor_message_box_before"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12167">PHPBB3-12167</a>] - Allow users to change style via style parameter by default</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12190">PHPBB3-12190</a>] - Add core event "core.modify_submit_post_data"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12217">PHPBB3-12217</a>] - Add template events to viewtopic_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12224">PHPBB3-12224</a>] - Add template method to assign block arrays</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12231">PHPBB3-12231</a>] - Add template events to forumlist_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12238">PHPBB3-12238</a>] - There is no cancel input type.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12239">PHPBB3-12239</a>] - Move deprecated password functions to compatibility file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12240">PHPBB3-12240</a>] - Adding specific class names to buttons in posting_buttons.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12241">PHPBB3-12241</a>] - Event to add and/or modify acp_board configurations</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12244">PHPBB3-12244</a>] - Remove ambiguity between Extension Tab and Extensions Management links</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12248">PHPBB3-12248</a>] - Extension Details Homepage should be a clickable link</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12259">PHPBB3-12259</a>] - Too many redundant tests are run on Travis</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12260">PHPBB3-12260</a>] - Add core event to delete_posts() function</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12262">PHPBB3-12262</a>] - Adjust a script to export the events in wiki format</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12115">PHPBB3-12115</a>] - Convert occupation/interests profile field to custom field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12169">PHPBB3-12169</a>] - Convert location user field to profile field </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12187">PHPBB3-12187</a>] - Convert website user field to profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12233">PHPBB3-12233</a>] - Allowing CPF to be have an icon on viewtopic and be listed in the contact section of the profile</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12234">PHPBB3-12234</a>] - Convert ICQ user field to profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12235">PHPBB3-12235</a>] - Convert MSN/WLM user field to profile field </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12236">PHPBB3-12236</a>] - Convert AOL user field to profile field</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12237">PHPBB3-12237</a>] - Convert Yahoo user field to profile field</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10763">PHPBB3-10763</a>] - Audit code for non-static functions called statically</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10793">PHPBB3-10793</a>] - Use db_tools in create_schema_files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11509">PHPBB3-11509</a>] - Travis should check commit message format</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11764">PHPBB3-11764</a>] - Remove Subsilver2 from installation packages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12177">PHPBB3-12177</a>] - Add event ucp_zebra_friend_list_before/after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12180">PHPBB3-12180</a>] - CodeSniffer: Ensure each file ends with a single newline</li> + </ul> + + + <a name="v310a2"></a><h3>Changes since 3.1.0-a2</h3> <h4>Bug</h4> <ul> @@ -197,7 +2143,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12147">PHPBB3-12147</a>] - Remove Travis CI notification configuration</li> </ul> - <a name="v310a1"></a><h3>1.ii. Changes since 3.1.0-a1</h3> + <a name="v310a1"></a><h3>Changes since 3.1.0-a1</h3> <h4>Bug</h4> <ul> @@ -273,7 +2219,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11998">PHPBB3-11998</a>] - Add console / command line client environment </li> </ul> - <a name="v30x"></a><h3>1.iii. Changes since 3.0.x</h3> + <a name="v30x"></a><h3>Changes since 3.0.x</h3> <h4>Bug</h4> <ul> @@ -954,7 +2900,181 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11913">PHPBB3-11913</a>] - Apply reorganisation of download.phpbb.com to build_announcement.php</li> </ul> - <a name="v3011"></a><h3>1.iv. Changes since 3.0.11</h3> + <a name="v3013-PL1"></a><h3>Changes since 3.0.13-PL1</h3> + +<h4>Security</h4> +<ul> +<li>[SECURITY-180] - An insufficient check allowed users of the Google Chrome browser to be redirected to external domains (e.g. on login)</li> +</ul> +<h4>Bug</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13348">PHPBB3-13348</a>] - sql_freeresult() should be called in feed base class</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13414">PHPBB3-13414</a>] - download/file.php sends Content-Length header even when issuing 304 Not Modified</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13555">PHPBB3-13555</a>] - Poll options preview rendered incorrectly by <br /> collision</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13568">PHPBB3-13568</a>] - Imagick path validated as relative path although ACP asks for absolute path</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13617">PHPBB3-13617</a>] - Bot session continuation with invalid f= query parameter causes SQL error</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13738">PHPBB3-13738</a>] - Sami still refers to develop-* branches</li> +</ul> +<h4>Improvement</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12089">PHPBB3-12089</a>] - Make HTTP status code assertion failure messages more informative</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13765">PHPBB3-13765</a>] - Verify that SERVER_PROTOCOL has the expected format</li> +</ul> +<h4>Task</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11539">PHPBB3-11539</a>] - Add unit tests for several functions in functions.php</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13572">PHPBB3-13572</a>] - Upgrade composer to 1.0.0-alpha9</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13599">PHPBB3-13599</a>] - Remove PHP 5.2 Travis environment</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13634">PHPBB3-13634</a>] - Update README to show new branch names</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13723">PHPBB3-13723</a>] - Update docs/AUTHORS for 3.0.14-RC1 / 3.1.4-RC1</li> +</ul> + + <a name="v3013"></a><h3>Changes since 3.0.13</h3> + +<h4>Bug</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12933">PHPBB3-12933</a>] - The search operator for partial matches does not work</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13549">PHPBB3-13549</a>] - Compare ORIG_PATH_INFO with SCRIPT_NAME for checking trailing paths</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13554">PHPBB3-13554</a>] - Advertisement of feature release in red indicates a problem</li> +</ul> + + <a name="v3012"></a><h3>Changes since 3.0.12</h3> + +<h4>Security</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13531">PHPBB3-13531</a>] - Disallow trailing paths (e.g. using the PATH_INFO feature) to prevent path-relative CSS injection</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13526">PHPBB3-13526</a>] - Correctly validate ucp_pm_options form key</li> +</ul> +<h4>Bug</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-6703">PHPBB3-6703</a>] - Problem with russian letter while converting from 2.0.x</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8960">PHPBB3-8960</a>] - Allow changing allow_avatar_remote when images/avatars/upload is not writable</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9420">PHPBB3-9420</a>] - BBCode - Unable to use a proper URI token</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9724">PHPBB3-9724</a>] - Wrong return "Return to ACP"</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9725">PHPBB3-9725</a>] - MSSQL Schema is not azure compatible</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10023">PHPBB3-10023</a>] - Password change requirement notification in UCP is not noticable</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10423">PHPBB3-10423</a>] - Searching for the term "test *" will highlight nearly every word and displays htmlspecialchars as htmlentities.</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10442">PHPBB3-10442</a>] - XHTML is invalid when a forum link without redirect counter is present</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10687">PHPBB3-10687</a>] - UNABLE_GET_IMAGE_SIZE text misleading for remote avatars</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10729">PHPBB3-10729</a>] - Post editor information is not updated when user being deleted with posts</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10776">PHPBB3-10776</a>] - Grammar errors in docs/README.html</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10796">PHPBB3-10796</a>] - SQL Azure does not allow SELECT FROM sysfiles</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10851">PHPBB3-10851</a>] - HTML files containing certain tags being rejected as possible attack vectors with "Check attachment file" set to "No"</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10863">PHPBB3-10863</a>] - Permission mask does not accurately show some forum permissions if user has MOD parmissions</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10917">PHPBB3-10917</a>] - Updater notice "Update files are out of date..." when updating to unreleased version</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10985">PHPBB3-10985</a>] - Error bbcode.html not found when updating with custom style inheriting from prosilver</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11062">PHPBB3-11062</a>] - In Automatic Update, new language strings from install.php are only loaded from English</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11224">PHPBB3-11224</a>] - SQL cache destroy does not destroy queries to tables joined</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11288">PHPBB3-11288</a>] - "Fulltext native" search fooled by hyphens</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11480">PHPBB3-11480</a>] - Prevent Private Message system from returning "Unknown folder" when inbox folder is full</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11613">PHPBB3-11613</a>] - Cookies do not work for netbios domain</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11686">PHPBB3-11686</a>] - Not checking for phpBB Debug errors on functional tests</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11699">PHPBB3-11699</a>] - PHP Lint Test should exclude selected subdirectories of the build directory.</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11726">PHPBB3-11726</a>] - Don't run lint tests on Travis on postgres</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11762">PHPBB3-11762</a>] - generate_text_for_display() treats "0" as an empty string</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11789">PHPBB3-11789</a>] - Inline css with color value in subsilver2</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11794">PHPBB3-11794</a>] - Coding Guidelines document says to place a comma after every array element, but fails to do so itself</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11799">PHPBB3-11799</a>] - Anti Abuse Headers missing for sendpassword</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11811">PHPBB3-11811</a>] - Chrome 30 adds outline to focused elements</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11821">PHPBB3-11821</a>] - Wrong comma usage "You are receiving this notification"</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11823">PHPBB3-11823</a>] - Travis-CI webserver not matching PHP files with anything after the .php</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11829">PHPBB3-11829</a>] - Closed reports may seem open in detailed view</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11860">PHPBB3-11860</a>] - .htaccess not working for Apache 2.4</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11864">PHPBB3-11864</a>] - Do not call exit after display_progress_bar in acp_forums</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11879">PHPBB3-11879</a>] - Compatibility error in forum_fn.js: .live should be replaced with .on</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11968">PHPBB3-11968</a>] - Travis Image are broken due to repository rename</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12037">PHPBB3-12037</a>] - acp_inactive.html has hard-coded text</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12048">PHPBB3-12048</a>] - Custom BBCodes Fail to Render Language Strings with a Number</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12061">PHPBB3-12061</a>] - Keyboard shortcut alt+h doesn't work properly in firefox</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12072">PHPBB3-12072</a>] - Missing word "send" in comment in schema_data.sql</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12093">PHPBB3-12093</a>] - IE 11 javascript selection is no longer supported</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12118">PHPBB3-12118</a>] - Add noindex meta tag to subsilver2 pm/topic view-print template</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12119">PHPBB3-12119</a>] - Remove keywords and description meta tags from prosilver view-print templates</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12120">PHPBB3-12120</a>] - Update docs/AUTHORS for 3.0.13-RC1</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12140">PHPBB3-12140</a>] - Avoid endless loop in build script</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12161">PHPBB3-12161</a>] - build/save directories are no longer created</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12162">PHPBB3-12162</a>] - Binary files missing from update packages</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12176">PHPBB3-12176</a>] - No error shown when attempting to delete a founder</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12186">PHPBB3-12186</a>] - MCP should open "Reported posts" instead of PM Reports</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12188">PHPBB3-12188</a>] - Add php 5.6 to travis tests</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12202">PHPBB3-12202</a>] - Variables read from style.cfg etc. should be htmlspecialchared</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12205">PHPBB3-12205</a>] - Custom Profile Field display bug</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12210">PHPBB3-12210</a>] - dbtools::sql_create_table incorrectly throws error related to auto-increment length on non auto-increment fields</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12310">PHPBB3-12310</a>] - SMTP username and password should not autocomplete during install</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12316">PHPBB3-12316</a>] - develop-ascraeus build status missing from "Automated Testing" section in README.md</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12353">PHPBB3-12353</a>] - User attachments in ACP are not displaying every attachment</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12359">PHPBB3-12359</a>] - Day and Month of Birthday Misaligned When Editing</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12381">PHPBB3-12381</a>] - Broken error message when selecting invalid DB driver</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12397">PHPBB3-12397</a>] - db_tools::sql_unique_index_exists() has wrong doc block</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12429">PHPBB3-12429</a>] - Update phpunit to 3.8+</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12467">PHPBB3-12467</a>] - Add config_*.php and tests_config_*.php to .gitignore</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12472">PHPBB3-12472</a>] - Set fast finish for .travis.yml</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12485">PHPBB3-12485</a>] - Broken tests due to absolute exclude</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12492">PHPBB3-12492</a>] - DB_TEST: Special chars are not supported.</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12540">PHPBB3-12540</a>] - WRONG_FILESIZE contains broken placeholders</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12660">PHPBB3-12660</a>] - Undefined offset error when phpinfo() disabled and debug enabled</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12695">PHPBB3-12695</a>] - Undefined index: MISSING_INLINE_ATTACHMENT notice given when viewing post details</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12720">PHPBB3-12720</a>] - Git commit hook should not require commit message to start with a capital letter</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12741">PHPBB3-12741</a>] - Functional tests on Travis fail since php update last night</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12755">PHPBB3-12755</a>] - Remote upload stuck in infinite loop if server sends keep-alive</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13086">PHPBB3-13086</a>] - Update ACP_MASS_EMAIL_EXPLAIN language key</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13096">PHPBB3-13096</a>] - ldap_escape() added to PHP 5.6.0</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13138">PHPBB3-13138</a>] - Banned users cause infinite recursion</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13168">PHPBB3-13168</a>] - Warning displayed in PHP 5.6 for mbstring.http_input</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13234">PHPBB3-13234</a>] - Remember me cookie gets unset by admin reauthentication</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13341">PHPBB3-13341</a>] - Tests fail when generating coverage report</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13376">PHPBB3-13376</a>] - deregister_globals() does not work correctly when $_COOKIE['GLOBALS'] - is specified</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13519">PHPBB3-13519</a>] - Correctly validate imagick path as path and not string</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13523">PHPBB3-13523</a>] - PHP 5.2 Unit Tests no longer work due to deprecated PHPUnit PEAR channel</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13527">PHPBB3-13527</a>] - Escape information received from version server</li> +</ul> +<h4>Improvement</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10037">PHPBB3-10037</a>] - Add Smiley Buttons in Signature Editor</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10174">PHPBB3-10174</a>] - Rename "Ban usernames" to "Ban users" in ACP</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10549">PHPBB3-10549</a>] - Languages variables should be used, not hardcoded</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10555">PHPBB3-10555</a>] - Copyright notice in overall_header.html is not translatable</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10945">PHPBB3-10945</a>] - Show entered search query in the search box when no results are found.</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11254">PHPBB3-11254</a>] - Check CRLF line endings in the test suite</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11295">PHPBB3-11295</a>] - Drop tables for postgres in the test suite</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11297">PHPBB3-11297</a>] - Running tests doc should mention dbunit dependency</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11704">PHPBB3-11704</a>] - phing build script does not include vendor folder, even if there are dependencies</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11766">PHPBB3-11766</a>] - Remove Quote and Edit button when topic is lock</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11801">PHPBB3-11801</a>] - missing semi colons in css</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11814">PHPBB3-11814</a>] - Topic reply notification email text change</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12035">PHPBB3-12035</a>] - Add a link to user's posts in the ACP user overview page</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12106">PHPBB3-12106</a>] - Document exceptions to "Disable Board" in ACP.</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12146">PHPBB3-12146</a>] - Add color demo when editing a group from the UCP</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12247">PHPBB3-12247</a>] - include poster's username in email notifications of posts that get approved by moderators</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12259">PHPBB3-12259</a>] - Too many redundant tests are run on Travis</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12468">PHPBB3-12468</a>] - Allow mbstring.http_input='' besides 'pass' for PHP 5.6 compatibility</li> +</ul> +<h4>Task</h4> +<ul> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10839">PHPBB3-10839</a>] - Remove phpunit.xml.functional and always include functional tests</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11509">PHPBB3-11509</a>] - Travis should check commit message format</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11876">PHPBB3-11876</a>] - Upgrade package checksums from MD5 to SHA256</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11877">PHPBB3-11877</a>] - Create package download links and checksums for announcement via script</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11920">PHPBB3-11920</a>] - Add MariaDB tests to Travis-CI</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11951">PHPBB3-11951</a>] - Add MariaDB to supported RDBMS list</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11970">PHPBB3-11970</a>] - Use 'set -x' in Travis CI setup scripts</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12046">PHPBB3-12046</a>] - Use PHP_BINARY environment variable in lint unit test</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12056">PHPBB3-12056</a>] - Make sure each unit test runs on its own</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12147">PHPBB3-12147</a>] - Remove Travis CI notification configuration</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12302">PHPBB3-12302</a>] - Upgrade composer.phar to 1.0.0-alpha8</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12318">PHPBB3-12318</a>] - Correctly setup HHVM functional tests on Travis CI</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12319">PHPBB3-12319</a>] - Backport Travis CI HHVM environment enabling to develop-olympus.</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12320">PHPBB3-12320</a>] - No longer allow Travis CI HHVM environment to fail</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12341">PHPBB3-12341</a>] - Add tests for get_username_string()</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12384">PHPBB3-12384</a>] - Run Travis CI HHVM tests against MySQLi instead of MySQL</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12417">PHPBB3-12417</a>] - hhvm-nightly 2014.04.16~precise breaks tests</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12495">PHPBB3-12495</a>] - Add Sami to composer dependencies and build script</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12582">PHPBB3-12582</a>] - Strip away copyrighted ICC profile from images</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12917">PHPBB3-12917</a>] - Move commit check and file executable checks to 5.3.3 build on travis</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13324">PHPBB3-13324</a>] - Composer no longer downloads sami/sami and fabpot/goutte</li> +</ul> + + <a name="v3011"></a><h3>Changes since 3.0.11</h3> <h4>Bug</h4> <ul> @@ -1109,7 +3229,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11753">PHPBB3-11753</a>] - Upgrade mysql_upgrader.php schema data.</li> </ul> - <a name="v3010"></a><h3>1.v. Changes since 3.0.10</h3> + <a name="v3010"></a><h3>Changes since 3.0.10</h3> <h4>Bug</h4> <ul> @@ -1234,7 +3354,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10909">PHPBB3-10909</a>] - Update Travis Test Configuration: Travis no longer supports PHP 5.3.2</li> </ul> - <a name="v309"></a><h3>1.vi. Changes since 3.0.9</h3> + <a name="v309"></a><h3>Changes since 3.0.9</h3> <h4>Bug</h4> <ul> @@ -1370,7 +3490,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10480">PHPBB3-10480</a>] - Automate changelog building</li> </ul> - <a name="v308"></a><h3>1.vii. Changes since 3.0.8</h3> + <a name="v308"></a><h3>Changes since 3.0.8</h3> <h4> Bug </h4> @@ -1435,7 +3555,7 @@ </li> <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9924'>PHPBB3-9924</a>] - $template->display hook does not pass $template instance </li> -<li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9925'>PHPBB3-9925</a>] - prosilver logo margin bug in IE 6-7-8 +<li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9925'>PHPBB3-9925</a>] - prosilver logo margin bug in IE 6-7-8 </li> <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9928'>PHPBB3-9928</a>] - Do not link "login to your board" to the "send statistics" page after completed update. </li> @@ -1443,7 +3563,7 @@ </li> <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9932'>PHPBB3-9932</a>] - The Bing bot is not added when converting. </li> -<li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9933'>PHPBB3-9933</a>] - Wrong handling of consecutive multiple asterisks in word censor +<li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9933'>PHPBB3-9933</a>] - Wrong handling of consecutive multiple asterisks in word censor </li> <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9934'>PHPBB3-9934</a>] - Mass Mail missing under the system tab on a fresh install </li> @@ -1455,7 +3575,7 @@ </li> <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9948'>PHPBB3-9948</a>] - Inline quicktime files won't display </li> -<li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9949'>PHPBB3-9949</a>] - $user->lang() is not handling arguments as per documentation +<li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9949'>PHPBB3-9949</a>] - $user->lang() is not handling arguments as per documentation </li> <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-9950'>PHPBB3-9950</a>] - Problem with localized button images after uprading from 3.0.7-PL1 to 3.0.8 </li> @@ -1618,7 +3738,7 @@ <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-10250'>PHPBB3-10250</a>] - phpBB Logo needs the Registered Trademark Symbol </li> </ul> - + <h4> Improvement </h4> <ul> @@ -1675,7 +3795,7 @@ <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-10186'>PHPBB3-10186</a>] - UCP signature panel displays when not authed for signatures </li> </ul> - + <h4> New Feature </h4> <ul> @@ -1686,7 +3806,7 @@ <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-10110'>PHPBB3-10110</a>] - Redis caching module </li> </ul> - + <h4> Task </h4> <ul> @@ -1725,7 +3845,7 @@ <li>[<a href='http://tracker.phpbb.com/browse/PHPBB3-10107'>PHPBB3-10107</a>] - Improve docs for non-apache webserver configuration </li> </ul> - + <h4> Sub-task </h4> <ul> @@ -1737,8 +3857,8 @@ </li> </ul> + <a name="v307-PL1"></a><h3>Changes since 3.0.7-PL1</h3> - <a name="v307-PL1"></a><h3>1.viii. Changes since 3.0.7-PL1</h3> <h4> Security </h4> <ul> @@ -2195,14 +4315,13 @@ </li> </ul> - - <a name="v307"></a><h3>1.ix. Changes since 3.0.7</h3> + <a name="v307"></a><h3>Changes since 3.0.7</h3> <ul> <li>[Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)</li> </ul> - <a name="v306"></a><h3>1.x. Changes since 3.0.6</h3> + <a name="v306"></a><h3>Changes since 3.0.6</h3> <ul> <li>[Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)</li> @@ -2306,7 +4425,7 @@ </ul> - <a name="v305"></a><h3>1.xi. Changes since 3.0.5</h3> + <a name="v305"></a><h3>Changes since 3.0.5</h3> <ul> <li>[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)</li> @@ -2528,7 +4647,7 @@ <li>[Feature] Send anonymous statistical information to phpBB on installation and update (optional).</li> </ul> - <a name="v304"></a><h3>1.xii. Changes since 3.0.4</h3> + <a name="v304"></a><h3>Changes since 3.0.4</h3> <ul> <li>[Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)</li> @@ -2617,7 +4736,7 @@ <li>[Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)</li> </ul> - <a name="v303"></a><h3>1.xiii. Changes since 3.0.3</h3> + <a name="v303"></a><h3>Changes since 3.0.3</h3> <ul> <li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li> @@ -2649,7 +4768,7 @@ <li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li> </ul> - <a name="v302"></a><h3>1.xiv. Changes since 3.0.2</h3> + <a name="v302"></a><h3>Changes since 3.0.2</h3> <ul> <li>[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)</li> @@ -2748,7 +4867,7 @@ <li>[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)</li> </ul> - <a name="v301"></a><h3>1.xv. Changes since 3.0.1</h3> + <a name="v301"></a><h3>Changes since 3.0.1</h3> <ul> <li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li> @@ -2796,7 +4915,7 @@ <li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li> </ul> - <a name="v300"></a><h3>1.xvi. Changes since 3.0.0</h3> + <a name="v300"></a><h3>Changes since 3.0.0</h3> <ul> <li>[Change] Validate birthdays (Bug #15004)</li> @@ -2867,7 +4986,7 @@ <li>[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)</li> </ul> - <a name="v30rc8"></a><h3>1.xvii. Changes since 3.0.RC8</h3> + <a name="v30rc8"></a><h3>Changes since 3.0.RC8</h3> <ul> <li>[Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)</li> @@ -2876,7 +4995,7 @@ <li>[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)</li> </ul> - <a name="v30rc7"></a><h3>1.xviii. Changes since 3.0.RC7</h3> + <a name="v30rc7"></a><h3>Changes since 3.0.RC7</h3> <ul> <li>[Fix] Fixed MSSQL related bug in the update system</li> @@ -2911,7 +5030,7 @@ <li>[Fix] No duplication of active topics (Bug #15474)</li> </ul> - <a name="v30rc6"></a><h3>1.xix. Changes since 3.0.RC6</h3> + <a name="v30rc6"></a><h3>Changes since 3.0.RC6</h3> <ul> <li>[Fix] Submitting language changes using acp_language (Bug #14736)</li> @@ -2921,7 +5040,7 @@ <li>[Fix] Able to request new password (Bug #14743)</li> </ul> - <a name="v30rc5"></a><h3>1.xx. Changes since 3.0.RC5</h3> + <a name="v30rc5"></a><h3>Changes since 3.0.RC5</h3> <ul> <li>[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.</li> @@ -2984,7 +5103,7 @@ <li>[Sec] New password hashing mechanism for storing passwords (#i42)</li> </ul> - <a name="v30rc4"></a><h3>1.xxi. Changes since 3.0.RC4</h3> + <a name="v30rc4"></a><h3>Changes since 3.0.RC4</h3> <ul> <li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li> @@ -3035,7 +5154,7 @@ <li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li> </ul> - <a name="v30rc3"></a><h3>1.xxii. Changes since 3.0.RC3</h3> + <a name="v30rc3"></a><h3>Changes since 3.0.RC3</h3> <ul> <li>[Fix] Fixing some subsilver2 and prosilver style issues</li> @@ -3144,7 +5263,7 @@ </ul> - <a name="v30rc2"></a><h3>1.xxiii. Changes since 3.0.RC2</h3> + <a name="v30rc2"></a><h3>Changes since 3.0.RC2</h3> <ul> <li>[Fix] Re-allow searching within the memberlist</li> @@ -3190,7 +5309,7 @@ </ul> - <a name="v30rc1"></a><h3>1.xxiv. Changes since 3.0.RC1</h3> + <a name="v30rc1"></a><h3>Changes since 3.0.RC1</h3> <ul> <li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li> @@ -3313,7 +5432,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -3321,17 +5440,17 @@ <a name="disclaimer"></a><h2>2. Copyright and disclaimer</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>phpBB is free software, released under the terms of the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License, version 2 (GPL-2.0)</a>. Copyright © <a href="https://www.phpbb.com">phpBB Limited</a>. For full copyright and license information, please see the docs/CREDITS.txt file.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- END DOCUMENT --> @@ -3342,7 +5461,7 @@ </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt new file mode 100644 index 0000000000..deb36339b0 --- /dev/null +++ b/phpBB/docs/CREDITS.txt @@ -0,0 +1,101 @@ +/** +* +* phpBB © Copyright phpBB Limited 2003-2014 +* http://www.phpbb.com +* +* phpBB is free software. You can redistribute it and/or modify it +* under the terms of the GNU General Public License, version 2 (GPL-2.0) +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* A copy of the license can be viewed in the docs/LICENSE.txt file. +* The same can be viewed at <http://opensource.org/licenses/gpl-2.0.php> +* +*/ + + +phpBB Project Manager: Marshalrusty (Yuriy Rusko) + +phpBB Lead Developer: naderman (Nils Adermann) + +phpBB Developers: bantu (Andreas Fischer) + CHItA (Máté Bartus) + dhruv.goel92 (Dhruv Goel) + Elsensee (Oliver Schramm) + marc1706 (Marc Alexander) + nickvergessen (Joas Schilling) + Nicofuma (Tristan Darricau) + prototech (Cesar Gallegos) + +For a list of phpBB Team members, please see: +http://www.phpbb.com/about/team/ + +For a full list of phpBB code contributors, please see: +https://github.com/phpbb/phpbb/graphs/contributors + +-- Former Developers -- + +phpBB Project Manager: theFinn (James Atkinson) [Founder - 04/2007] + SHS` (Jonathan Stanley) + +phpBB Lead Developer: Acyd Burn (Meik Sievertsen) [09/2005 - 01/2010] + psoTFX (Paul S. Owen) [2001 - 09/2005] + +phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010] + Acyd Burn (Meik Sievertsen) [02/2003 - 09/2005] + APTX (Marek A. RuszczyÅ„ski) [12/2007 - 04/2011] + Arty (Vjacheslav Trushkin) [02/2012 - 07/2012] + Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006] + BartVB (Bart van Bragt) [11/2000 - 03/2006] + ckwalsh (Cullen Walsh) [01/2010 - 07/2011] + DavidMJ (David M.) [12/2005 - 08/2009] + dhn (Dominik Dröscher) [05/2007 - 01/2011] + EXreaction (Nathan Guse) [07/2012 - 05/2014] + GrahamJE (Graham Eames) [09/2005 - 11/2006] + igorw (Igor Wiedler) [08/2010 - 02/2013] + imkingdavid (David King) [11/2012 - 06/2014] + kellanved (Henry Sudhof) [04/2007 - 03/2011] + Oleg (Oleg Pudeyev) [01/2011 - 05/2013] + rxu (Ruslan Uzdenov) [04/2010 - 12/2012] + TerraFrost (Jim Wigginton) [04/2009 - 01/2011] + ToonArmy (Chris Smith) [06/2008 - 11/2011] + Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009] + +Major contributions by: leviatan21 (Gabriel Vazquez) + NeoThermic (Ashley Pinner) + Raimon (Raimon Meuldijk) + Xore (Robert Hetzler) + +-- Copyrights -- + +Visual Confirmation: Xore (Robert Hetzler) + +Original subSilver by subBlue Design, Tom Beddard, (c) 2001 phpBB Limited +prosilver by subBlue Design, Tom Beddard, (c) 2004 phpBB Limited +subsilver2 by subBlue Design, Tom Beddard, (c) 2004 phpBB Limited + +phpBB contains code from the following applications: + +LGPL licenced: +Smarty (c) 2001, 2002 by ispi of Lincoln, Inc, http://smarty.php.net/ + +GPL licenced: +phpMyAdmin (c) 2001, 2003 phpMyAdmin Devel team, http://www.phpmyadmin.net/ +Jabber Class (c) 2006 Flyspray.org, http://www.flyspray.org/ +Chora (c) 2000-2006, The Horde Project. http://horde.org/chora/ +Horde Project (c) 2000-2006, The Horde Project. http://horde.org/ +jQuery (c) 2011, John Resig. http://jquery.com/ +Sphinx Technologies Inc (c) 2001-2012 Andrew Aksyonoff, http://sphinxsearch.com/ +Plupload (c) 2010-2013 Moxiecode Systems AB, http://www.plupload.com/ + +PHP License, version 3.0: +Pear (c) 2001-2004 PHP Group, http://pear.php.net + +Text_Diff-0.2.1 http://pear.php.net/package/Text_Diff + +MIT licenced: +Symfony2 (c) 2004-2011 Fabien Potencier, http://symfony.com/ diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html index a76b6be72a..4786d8d796 100644 --- a/phpBB/docs/FAQ.html +++ b/phpBB/docs/FAQ.html @@ -4,9 +4,9 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x frequently asked questions" /> -<title>phpBB3 • FAQ</title> +<title>phpBB • FAQ</title> -<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -16,16 +16,16 @@ <a id="top" name="top" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div id="doc-description"> - <a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a> + <a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a> <h1>phpBB 3.1.x FAQ</h1> <p>phpBB 3.1.x frequently asked questions</p> <p style="display: none;"><a href="#start_here">Skip</a></p> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> </div> @@ -35,12 +35,17 @@ <!-- BEGIN DOCUMENT --> - <p>This is a very basic Frequently Asked Questions (FAQ) page which attempts to answer some of the more commonly asked questions. It is by no means exhaustive and should be used in combination with the 'built-in' User FAQ within phpBB3, the community forums and our IRC channel (see <a href="README.html">README</a> for details).</p> + <p class="paragraph main-description"> + This is a very basic Frequently Asked Questions (FAQ) page which attempts to answer some of the + more commonly asked questions. It is by no means exhaustive and should be used in combination with + the 'built-in' User FAQ within phpBB3, the community forums and our IRC channel + (see <a href="README.html">README</a> for details). + </p> <h1>FAQ</h1> <div class="paragraph menu"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -66,7 +71,7 @@ </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -74,11 +79,11 @@ <a name="install"></a><h2>I am finding phpBB too difficult to install. Will you do it for me?</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> -<p>Simple answer, no we will not. We are not being difficult when we say this we are actually trying to help you. phpBB has a reputation for being easy to install, that reputation is we believe well deserved. It is a simple process of unarchiving a single file, uploading the resulting directory/files to their intended location and entering some data in a web based form. The sequence of events, what to type where, etc. is covered in detail in the accompanying <a href="INSTALL.html">INSTALL.html</a> documentation. If you cannot install phpBB3 the chances are you will be unable to administer or update it.</p> +<p>Simple answer, no we will not. We are not being difficult when we say this we are actually trying to help you. phpBB has a reputation for being easy to install, that reputation is we believe well deserved. It is a simple process of unarchiving a single file, uploading the resulting directory/files to their intended location and entering some data in a web based form. The sequence of events, what to type where, etc. is covered in detail in the accompanying <a href="INSTALL.html">INSTALL.html</a> documentation. If you cannot install phpBB the chances are you will be unable to administer or update it.</p> <p>There are people, companies (unrelated to your hosting provider), etc. that will install your forum, either for free or for a payment. We do not recommend you make use of these offers. Unless the service is provided by your hosting company you will have to divulge passwords and other sensitive details. If you did not know how to use an ATM would you give a passer-by your bank card and PIN and ask them to show you what to do? No, probably not! The same applies to your hosting account details!</p> @@ -88,7 +93,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -99,7 +104,7 @@ A board is dealing in warez/porn/etc., you need to prevent them doing this!<br / I want to sue you because i think you host an illegal board!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -111,7 +116,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -119,7 +124,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="viewonline"></a><h2>According to viewonline a user is doing/reading something they should not be able to!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -131,7 +136,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -139,7 +144,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="mail"></a><h2>I keep getting Mail sending errors when I (or my users) post/send PM's/etc.!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -151,7 +156,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -159,7 +164,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="mail_language"></a><h2>My users are complaining that emails are not in their selected language!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -171,7 +176,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -179,7 +184,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="aol_browser"></a><h2>My AOL based users keep getting logged out!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -187,13 +192,13 @@ I want to sue you because i think you host an illegal board!</h2> <p>Unfortunately this only works when the users IP is constant as they browse the board. For most users this will be the case. However certain providers route their users via a cluster of proxys. In some cases, particularly the AOL browser, this results in different IPs being forwarded as the user moves between pages. We take account of this by not checking the entire IP by default but only the first "three quads" (<samp>A.B.C</samp>). Again in most cases this will be fine. However again AOL uses IPs which can vary so much that checking only the first two quads results in a fairly static IP being available for session validation.</p> -<p>If you are experiencing problems related to this you can set the Session IP validation parameter found in <code>Admin->General->Server Configuration->Security Settings</code> to <samp>A.B</samp>. Please note that reducing the IP validation length does potentially increase the risk of sessions being hijacked (this is something for you to consider, phpBB Group takes no responsibility should anything happen!). We suggest to at least additionally enable the browser validation.</p> +<p>If you are experiencing problems related to this you can set the Session IP validation parameter found in <code>Admin->General->Server Configuration->Security Settings</code> to <samp>A.B</samp>. Please note that reducing the IP validation length does potentially increase the risk of sessions being hijacked (this is something for you to consider, phpBB Limited takes no responsibility should anything happen!). We suggest to at least additionally enable the browser validation.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -201,7 +206,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="avatars"></a><h2>I am unable to upload avatars from my computer, regardless of the settings.</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -213,7 +218,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -221,7 +226,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="gallery_avatars"></a><h2>I just cannot get gallery avatars to appear!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -231,7 +236,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -239,17 +244,17 @@ I want to sue you because i think you host an illegal board!</h2> <a name="permissions"></a><h2>How do I use/set permissions?</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> -<p>Please read the paragraph about permissions in our extensive <a href="https://www.phpbb.com/support/documentation/3.0/">online documentation</a>.</p> +<p>Please read the paragraph about permissions in our extensive <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">online documentation</a>.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -257,7 +262,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="login_issues"></a><h2>I (or my users) cannot stay logged in to the forum!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -269,7 +274,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -277,7 +282,7 @@ I want to sue you because i think you host an illegal board!</h2> <a name="logout_issues"></a><h2>My users are complaining about being logged out too quickly!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -287,7 +292,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -295,11 +300,11 @@ I want to sue you because i think you host an illegal board!</h2> <a name="not_answered"></a><h2>My question isn't answered here!</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> -<p>Please read our <a href="https://www.phpbb.com/support/documentation/3.0/">extensive user documentation</a> first, it may just explain what you want to know.</p> +<p>Please read our <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">extensive user documentation</a> first, it may just explain what you want to know.</p> <p>Feel free to search our community forum for the information you require. <strong>PLEASE DO NOT</strong> post your question without having first used search, chances are someone has already asked and answered your question. You can find our board here:</p> @@ -309,7 +314,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -317,17 +322,17 @@ I want to sue you because i think you host an illegal board!</h2> <a name="disclaimer"></a><h2>Copyright and disclaimer</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>phpBB is free software, released under the terms of the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License, version 2 (GPL-2.0)</a>. Copyright © <a href="https://www.phpbb.com">phpBB Limited</a>. For full copyright and license information, please see the docs/CREDITS.txt file.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- END DOCUMENT --> @@ -338,7 +343,7 @@ I want to sue you because i think you host an illegal board!</h2> </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 01eeea6540..86b320d197 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -4,9 +4,9 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Installation, updating and conversion informations" /> -<title>phpBB3 • Install</title> +<title>phpBB • Install</title> -<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -16,16 +16,16 @@ <a id="top" name="top" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div id="doc-description"> - <a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a> + <a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a> <h1>phpBB 3.1.x Install</h1> <p>phpBB 3.1.x Installation, updating and conversion informations</p> <p style="display: none;"><a href="#start_here">Skip</a></p> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> </div> @@ -35,16 +35,22 @@ <!-- BEGIN DOCUMENT --> -<p><strong>Please read this document completely before proceeding with installation, updating or converting.</strong></p> - -<p>This document will walk you through the basics on installing, updating and converting the forum software.</p> +<div class="paragraph"> + <p><strong>Please read this document completely before proceeding with installation, updating or converting.</strong></p> -<p>A basic overview of running phpBB3 can be found in the accompanying <a href="README.html">README</a> file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB3 you should read <a href="https://www.phpbb.com/support/documentation/3.0/">the documentation</a> available online.</p> + <p>This document will walk you through the basics on installing, updating and converting the forum software.</p> + <p> + A basic overview of running phpBB can be found in the accompanying <a href="README.html">README</a> file. + Please ensure you read that document in addition to this! For more detailed information on using, installing, + updating and converting phpBB you should read <a href="https://www.phpbb.com/support/docs/en/3.1/ug/">the documentation</a> + available online. + </p> +</div> <h1>Install</h1> <div class="paragraph menu"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -61,6 +67,7 @@ <li><a href="#update_all">All package types</a></li> </ol> </li> + <li><a href="#update30">Updating from phpBB 3.0.x to phpBB 3.1.x</a></li> <li><a href="#convert">Conversion from phpBB 2.0.x to phpBB 3.1.x</a> <ol style="list-style-type: lower-roman;"> <li><a href="#prereq">Requirements before converting</a></li> @@ -81,7 +88,7 @@ </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -89,7 +96,7 @@ <a name="quickinstall"></a><h2>1. Quick install</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -113,7 +120,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -121,7 +128,7 @@ <a name="require"></a><h2>2. Requirements</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -134,17 +141,18 @@ <li>MySQL 3.23 or above (MySQLi supported)</li> <li>MariaDB 5.1 or above</li> <li>PostgreSQL 8.3+</li> - <li>SQLite 2.8.2+ (SQLite 3 is not supported)</li> - <li>Firebird 2.1+</li> + <li>SQLite 2.8.2+</li> + <li>SQLite 3.6.15+</li> <li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li> <li>Oracle</li> </ul> </li> - <li><strong>PHP 5.3.3+</strong> with support for the database you intend to use.</li> - <li>The following PHP modules are required:</li> + <li><strong>PHP 5.4.0+</strong> and <strong>PHP < 7.1</strong> with support for the database you intend to use.</li> + <li>The following PHP modules are required: <ul> <li>json</li> </ul> + </li> <li>getimagesize() function must be enabled.</li> <li>Presence of the following modules within PHP will provide access to additional features, but they are not required: <ul> @@ -163,7 +171,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -171,27 +179,27 @@ <a name="install"></a><h2>3. New installation</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>Installation of phpBB3 will vary according to your server and database. If you have <em>shell access</em> to your account (via telnet or ssh for example) you may want to upload the entire phpBB3 archive (in binary mode!) to a directory on your host and unarchive it there.</p> + <p>Installation of phpBB will vary according to your server and database. If you have <em>shell access</em> to your account (via telnet or ssh for example) you may want to upload the entire phpBB archive (in binary mode!) to a directory on your host and unarchive it there.</p> - <p>If you do not have shell access or do not wish to use it, you will need to decompress the phpBB3 archive to a local directory on your system using your favourite compression program, e.g. winzip, rar, zip, etc. From there you must FTP <strong>ALL</strong> the files it contains (being sure to retain the directory structure and filenames) to your host. Please ensure that the cases of filenames are retained, do <strong>NOT</strong> force filenames to all lower or upper case as doing so will cause errors later.</p> + <p>If you do not have shell access or do not wish to use it, you will need to decompress the phpBB archive to a local directory on your system using your favourite compression program, e.g. winzip, rar, zip, etc. From there you must FTP <strong>ALL</strong> the files it contains (being sure to retain the directory structure and filenames) to your host. Please ensure that the cases of filenames are retained, do <strong>NOT</strong> force filenames to all lower or upper case as doing so will cause errors later.</p> <p>All .php, .sql, .cfg, .css, .js, .html, .htaccess and .txt files should be uploaded in <strong>ASCII</strong> mode, while all graphics should be uploaded in <strong>BINARY</strong> mode. If you are unfamiliar with what this means please refer to your FTP client documentation. In most cases this is all handled transparantly by your ftp client, but if you encounter problems later you should be sure the files were uploaded correctly as described here.</p> - <p>phpBB3 comes supplied with British English as its standard language. However, a number of separate packs for different languages are available. If you are not a native English speaker you may wish to install one or more of these packages before continuing. The installation process below will allow you to select a default language from those available (you can, of course, change this default at a later stage). For more details on language packs, where to obtain them and how to install them please see the <a href="README.html#i18n">README</a>.</p> + <p>phpBB comes supplied with British English as its standard language. However, a number of separate packs for different languages are available. If you are not a native English speaker you may wish to install one or more of these packages before continuing. The installation process below will allow you to select a default language from those available (you can, of course, change this default at a later stage). For more details on language packs, where to obtain them and how to install them please see the <a href="README.html#i18n">README</a>.</p> - <p>Once all the files have been uploaded to your site, you should point your browser at this location with the addition of <code>/install/</code>. For example, if your domain name is <code>www.example.com</code> and you placed the phpBB3 files in the directory <code>/phpBB3</code> off your web root you would enter <code>http://www.example.com/phpBB3/install/</code> or (alternatively) <code>http://www.example.com/phpBB3/install/index.php</code> into your browser. When you have done this, you should see the <strong><em>phpBB3 Introduction</em></strong> screen appear.</p> + <p>Once all the files have been uploaded to your site, you should point your browser at this location with the addition of <code>/install/</code>. For example, if your domain name is <code>www.example.com</code> and you placed the phpBB files in the directory <code>/phpBB3</code> off your web root you would enter <code>http://www.example.com/phpBB3/install/</code> or (alternatively) <code>http://www.example.com/phpBB3/install/index.php</code> into your browser. When you have done this, you should see the <strong><em>phpBB Introduction</em></strong> screen appear.</p> <h4>Introduction:</h4> - <p>The initial screen gives you a short introduction into phpBB. It allows you to read the license phpBB3 is released under (General Public License v2) and provides information about how you can receive support. To start the installation, use the <strong><em>INSTALL</em></strong> tab.</p> + <p>The initial screen gives you a short introduction into phpBB. It allows you to read the license phpBB is released under (General Public License v2) and provides information about how you can receive support. To start the installation, use the <strong><em>INSTALL</em></strong> tab.</p> <h4>Requirements</h4> - <p>The first page you will see after starting the installation is the Requirements list. phpBB3 automatically checks whether everything that it needs to run properly is installed on your server. You need to have at least the minimum PHP version installed, and at least one database available to continue the installation. Also important, is that all shown folders are available and have the correct permissions. Please see the description of each section to find out whether they are optional or required for phpBB3 to run. If everything is in order, you can continue the installation with <em>Start Install</em>.</p> + <p>The first page you will see after starting the installation is the Requirements list. phpBB automatically checks whether everything that it needs to run properly is installed on your server. You need to have at least the minimum PHP version installed, and at least one database available to continue the installation. Also important, is that all shown folders are available and have the correct permissions. Please see the description of each section to find out whether they are optional or required for phpBB to run. If everything is in order, you can continue the installation with <em>Start Install</em>.</p> <h4>Database settings</h4> @@ -211,7 +219,7 @@ <p>You don't need to change the Prefix for tables in database setting, unless you plan on using multipe phpBB installations on one database. In this case, you can use a different prefix for each installation to make it work.</p> - <p>After you entered your details, you can continue with the <em>Proceed to next step</em> button. Now phpBB3 will check whether the data you entered will lead to a successful database connection and whether tables with the same prefix already exist.</p> + <p>After you entered your details, you can continue with the <em>Proceed to next step</em> button. Now phpBB will check whether the data you entered will lead to a successful database connection and whether tables with the same prefix already exist.</p> <p>A <em>Could not connect to the database</em> error means that you didn't enter the database data correctly and it is not possible for phpBB to connect. Make sure that everything you entered is in order and try again. Again, if you are unsure about your database settings, please contact your host.</p> @@ -221,7 +229,7 @@ <h4>Administrator details</h4> - <p>Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB3 installation, we only include British English. You can download further languages from <a href="https://www.phpbb.com/">www.phpbb.com</a>, and add them before installing or later.</p> + <p>Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB installation, we only include British English. You can download further languages from <a href="https://www.phpbb.com/">www.phpbb.com</a>, and add them before installing or later.</p> <h4>Configuration file</h4> @@ -235,7 +243,7 @@ <p>If the installation was successful, you can now use the <em>Login</em> button to visit the Administration Control Panel. Congratulations, you have installed phpBB successfully. But there is still work ahead!</p> - <p>If you are unable to get phpBB3 installed even after reading this guide, please look at the support section of the installer's introduction page to find out where you can ask for further assistance.</p> + <p>If you are unable to get phpBB installed even after reading this guide, please look at the support section of the installer's introduction page to find out where you can ask for further assistance.</p> <p>At this point if you are converting from phpBB 2.0.x, you should refer to the <a href="#convert">conversion steps</a> for further information. If not, you should remove the install directory from your server as you will only be able to access the Administration Control Panel whilst it is present.</p> @@ -243,7 +251,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -251,21 +259,21 @@ <a name="update"></a><h2>4. Updating from stable releases of phpBB 3.1.x</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> -<p>If you are currently using a stable release of phpBB3, updating to this version is straightforward. You would have downloaded one of four packages and your choice determines what you need to do. <strong>Note</strong>: Before updating, we heavily recommend you do a <em>full backup of your database and existing phpBB3 files</em>! If you are unsure how to achieve this please ask your hosting provider for advice.</p> +<p>If you are currently using a stable release of phpBB, updating to this version is straightforward. You would have downloaded one of four packages and your choice determines what you need to do. <strong>Note</strong>: Before updating, we heavily recommend you do a <em>full backup of your database and existing phpBB files</em>! If you are unsure how to achieve this please ask your hosting provider for advice.</p> -<p><strong>Please make sure you update your phpBB3 source files too, even if you run the <code>database_update.php</code> file.</strong></p> +<p><strong>Please make sure you update your phpBB source files too, even if you run the <code>database_update.php</code> file.</strong> If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p> <a name="update_full"></a><h3>4.i. Full package</h3> <p>The full package is normally meant for new installations only, but if you want to replace all source files, this package comes in handy.</p> - <p>First, you should make a copy of your existing <code>config.php</code> file; keep it in a safe place! Next, delete all the existing phpBB3 files, you may want to leave your <code>files/</code> and <code>images/</code> directorie in place. You can leave alternative styles in place too. With this complete, you can upload the new phpBB files (see <a href="#install">New installation</a> for details if necessary). Once complete, copy back your saved <code>config.php</code>, replacing the new one. Another method is to just <strong>replace</strong> the existing files with the files from the full package - though make sure you do <strong>not</strong> overwrite your config.php file.</p> + <p>First, you should make a copy of your existing <code>config.php</code> file; keep it in a safe place! Next, delete all the existing phpBB files, you may want to leave your <code>files/</code> and <code>images/</code> directories in place. You can leave alternative styles in place too. With this complete, you can upload the new phpBB files (see <a href="#install">New installation</a> for details if necessary). Once complete, copy back your saved <code>config.php</code>, replacing the new one. Another method is to just <strong>replace</strong> the existing files with the files from the full package - though make sure you do <strong>not</strong> overwrite your config.php file.</p> - <p>You should now run <code>install/database_update.php</code> which, depending on your previous version, will make a number of database changes. You may receive <em>FAILURES</em> during this procedure. They should not be a cause for concern unless you see an actual <em>ERROR</em>, in which case the script will stop (in this case you should seek help via our forums or bug tracker).</p> + <p>You should now run <code>install/database_update.php</code> which, depending on your previous version, will make a number of database changes. You may receive <em>FAILURES</em> during this procedure. They should not be a cause for concern unless you see an actual <em>ERROR</em>, in which case the script will stop (in this case you should seek help via our forums or bug tracker). If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p> <p>Once <code>install/database_update.php</code> has completed, you may proceed to the Administration Control Panel and then remove the install directory as advised.</p> @@ -277,7 +285,7 @@ <p>The directory structure has been preserved, enabling you (if you wish) to simply upload the uncompressed contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any modifications (MODs) these files will overwrite the originals, possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.</p> - <p>As for the other update procedures, you should run <code>install/database_update.php</code> after you have finished updating the files. This will update your database schema and increment the version number.</p> + <p>As for the other update procedures, you should run <code>install/database_update.php</code> after you have finished updating the files. This will update your database schema and increment the version number. If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p> <a name="update_patch"></a><h3>4.iii. Patch file</h3> @@ -289,20 +297,20 @@ <p>If you do get failures, you should look at using the <a href="#update_files">Changed Files</a> package to replace the files which failed to patch. Please note that you will need to manually re-add any MODs to these particular files. Alternatively, if you know how, you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.</p> - <p>You should, of course, delete the patch file (or files) after use. As for the other update procedures, you should run <code>install/database_update.php</code> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number.</p> + <p>You should, of course, delete the patch file (or files) after use. As for the other update procedures, you should run <code>install/database_update.php</code> after you have finished updating the files. This will update your database schema and data (if appropriate) and increment the version number. If you have shell access to your server, you may wish to update via the command line interface. From your board's root, execute the following command: <code>php bin/phpbbcli.php --safe-mode db:migrate</code>.</p> <a name="update_auto"></a><h3>4.iv. Automatic update package</h3> <p>This update method is the recommended method for updating. This package detects changed files automatically and merges in changes if needed.</p> - <p>The automatic update package will update the board from a given version to the latest version. A number of automatic update files are available, and you should choose the one that corresponds to the version of the board that you are currently running. For example, if your current version is <strong>3.0.10</strong>, you need the <code>phpBB-3.0.10_to_3.0.11.zip/tar.bz2</code> file.</p> + <p>The automatic update package will update the board from a given version to the latest version. A number of automatic update files are available, and you should choose the one that corresponds to the version of the board that you are currently running. For example, if your current version is <strong>3.1.5</strong>, you need the <code>phpBB-3.1.5_to_3.1.6.zip/tar.bz2</code> file.</p> <p>To perform the update, either follow the instructions from the <strong>Administration Control Panel->System</strong> Tab - this should point out that you are running an outdated version and will guide you through the update - or follow the instructions listed below.</p> <ul> <li>Go to the <a href="https://www.phpbb.com/downloads/">downloads page</a> and download the latest update package listed there, matching your current version.</li> - <li>Upload the uncompressed archive contents to your phpBB installation - only the install folder is required. Upload the whole install folder, retaining the file structure.</li> - <li>After the install folder is present, phpBB3 will go offline automatically.</li> + <li>Upload the uncompressed archive contents to your phpBB installation - only the <code>install/</code> and <code>vendor/</code> folders are required. Upload these folders in their entirety, retaining the file structure.</li> + <li>After the install folder is present, phpBB will go offline automatically.</li> <li>Point your browser to the install directory, for example <code>http://www.example.com/phpBB3/install/</code></li> <li>Choose the "Update" Tab and follow the instructions</li> </ul> @@ -313,24 +321,58 @@ <p>If you have non-English language packs installed, you may want to see if a new version has been made available. A number of missing strings may have been added which, though not essential, may be beneficial to users. Please note that at this time not all language packs have been updated so you should be prepared to periodically check for updates.</p> - <p>These update methods will only update the standard styles, <code>prosilver</code> and <code>subsilver2</code>, any other styles you have installed for your board will usually also need to be updated.</p> + <p>These update methods will only update the standard style <code>prosilver</code>, any other styles you have installed for your board will usually also need to be updated.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> - <a name="convert"></a><h2>5. Conversion from phpBB 2.0.x to phpBB 3.1.x</h2> + <a name="update30"></a><h2>5. Updating from phpBB 3.0.x to phpBB 3.1.x</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> <div class="content"> + <p>Updating from phpBB 3.0.x to 3.1.x is just the same as <a href="#update">updating from stable releases of phpBB 3.1.x</a></p> + + <p>However you can also start with a new set of phpBB 3.1.x files.</p> + + <ol> + <li>Delete all files <strong>EXCEPT</strong> for the following: + + <ul> + <li>The <code>config.php</code> file</li> + <li>The <code>images/</code> directory</li> + <li>The <code>files/</code> directory</li> + <li>The <code>store/</code> directory</li> + </ul></li> + + <li>Upload the contents of the 3.1.x Full Package into your forum's directory. Make sure the root level .htaccess file is included in the upload.</li> + <li>Browse to install/database_update.php</li> + <li>Delete the <code>install/</code> directory</li> + </ol> + </div> + + <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> + + <span class="corners-bottom"><span></span></span></div> + </div> + + <hr /> + + <a name="convert"></a><h2>6. Conversion from phpBB 2.0.x to phpBB 3.1.x</h2> + + <div class="paragraph"> + <div class="inner"> + + <div class="content"> + <p>This paragraph explains the steps necessary to convert your existing phpBB2 installation to phpBB3.</p> <a name="prereq"></a><h3>5.i. Requirements before converting</h3> @@ -382,25 +424,25 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> - <a name="postinstall"></a><h2>6. Important (security related) post-Install tasks for all installation methods</h2> + <a name="postinstall"></a><h2>7. Important (security related) post-Install tasks for all installation methods</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>Once you have successfully installed phpBB3 you <strong>MUST</strong> ensure you remove the entire <code>install/</code> directory. Leaving the install directory in place is a <em>very serious potential security issue</em> which may lead to deletion or alteration of files, etc. Please note that until this directory is removed, phpBB will not operate and a warning message will be displayed. Beyond this <strong>essential</strong> deletion, you may also wish to delete the docs/ directory if you wish.</p> + <p>Once you have successfully installed phpBB you <strong>MUST</strong> ensure you remove the entire <code>install/</code> directory. Leaving the install directory in place is a <em>very serious potential security issue</em> which may lead to deletion or alteration of files, etc. Please note that until this directory is removed, phpBB will not operate and a warning message will be displayed. Beyond this <strong>essential</strong> deletion, you may also wish to delete the docs/ directory if you wish.</p> <p>With these directories deleted, you should proceed to the administration panel. Depending on how the installation completed, you may have been directed there automatically. If not, login as the administrator you specified during install/conversion and click the <strong>Administration Control Panel</strong> link at the bottom of any page. Ensure that details specified on the <strong>General</strong> tab are correct!</p> <a name="avatars"></a><h3>6.i. Uploadable avatars</h3> - <p>phpBB3 supports several methods for allowing users to select their own <em>avatar</em> (an avatar is a small image generally unique to a user and displayed just below their username in posts).</p> + <p>phpBB supports several methods for allowing users to select their own <em>avatar</em> (an avatar is a small image generally unique to a user and displayed just below their username in posts).</p> <p>Two of these options allow users to upload an avatar from their machine or a remote location (via a URL). If you wish to enable this function you should first ensure the correct path for uploadable avatars is set in <strong>Administration Control Panel -> General -> Board Configuration -> Avatar settings</strong>. By default this is <code>images/avatars/uploads</code>, but you can set it to whatever you like, just ensure the configuration setting is updated. You must also ensure this directory can be written to by the webserver. Usually this means you have to alter its permissions to allow anyone to read and write to it. Exactly how you should do this depends on your FTP client or server operating system.</p> @@ -420,15 +462,15 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> -<a name="anti_spam"></a><h2>7. Anti-Spam Measures</h2> - +<a name="anti_spam"></a><h2>8. Anti-Spam Measures</h2> + <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> <p>Like any online site that allows user input, your board could be subject to unwanted posts; often referred to as <a href="http://en.wikipedia.org/wiki/Forum_spam">forum spam</a>. The vast majority of these attacks will be from automated computer programs known as <a href="http://en.wikipedia.org/wiki/Spambot">spambots</a>. The attacks, generally, are not personal as the spammers are just trying to find accessible targets. phpBB has a number of anti-spam measures built in, including a range of CAPTCHAs. However, administrators are strongly urged to read and follow the advice for <a href="https://www.phpbb.com/support/spam/">Preventing Spam in phpBB</a> as soon as possible after completing the installation of your board.</p> @@ -436,25 +478,25 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> -<a name="disclaimer"></a><h2>8. Copyright and disclaimer</h2> +<a name="disclaimer"></a><h2>9. Copyright and disclaimer</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see the source code and <code>docs/</code> directory for more details. This package and its contents are Copyright © <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>phpBB is free software, released under the terms of the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License, version 2 (GPL-2.0)</a>. Copyright © <a href="https://www.phpbb.com">phpBB Limited</a>. For full copyright and license information, please see the docs/CREDITS.txt file.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- END DOCUMENT --> @@ -465,7 +507,7 @@ </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/COPYING b/phpBB/docs/LICENSE.txt index ce992b2ce7..ce992b2ce7 100644 --- a/phpBB/docs/COPYING +++ b/phpBB/docs/LICENSE.txt diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 27ace05169..96af78f48a 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -4,9 +4,9 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Readme" /> -<title>phpBB3 • Readme</title> +<title>phpBB • Readme</title> -<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -16,15 +16,15 @@ <a id="top" name="top" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div id="doc-description"> - <a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a> + <a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a> <h1>phpBB 3.1.x Readme</h1> <p style="display: none;"><a href="#start_here">Skip</a></p> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> </div> @@ -34,25 +34,29 @@ <!-- BEGIN DOCUMENT --> - <p>Thank you for downloading phpBB3. This README will guide you through the basics of installation and operation of phpBB3. Please ensure you read this and the accompanying documentation fully <strong>before</strong> proceeding with the installation.</p> + <p class="paragraph main-description"> + Thank you for downloading phpBB. This README will guide you through the basics of installation + and operation of phpBB. Please ensure you read this and the accompanying documentation fully + <strong>before</strong> proceeding with the installation. + </p> <h1>Readme</h1> <div class="paragraph menu"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> <ol> - <li><a href="#install">Installing phpBB3</a></li> - <li><a href="#run">Running phpBB3</a> + <li><a href="#install">Installing phpBB</a></li> + <li><a href="#run">Running phpBB</a> <ol style="list-style-type: lower-roman;"> <li><a href="#i18n">Languages (Internationalisation - i18n)</a></li> <li><a href="#styles">Styles</a></li> - <li><a href="#mods">Modifications</a></li> + <li><a href="#extensions">Extensions</a></li> </ol> </li> - <li><a href="#help">Getting help with phpBB3</a> + <li><a href="#help">Getting help with phpBB</a> <ol style="list-style-type: lower-roman;"> <li><a href="#docs">Documentation</a></li> <li><a href="#kb">Knowledge Base</a></li> @@ -73,15 +77,15 @@ </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> - <a name="install"></a><h2>1. Installing phpBB3</h2> + <a name="install"></a><h2>1. Installing phpBB</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> <p>Installation, update and conversion instructions can be found in the <a href="INSTALL.html">INSTALL</a> document in this directory. If you are intending on converting from a phpBB 2.0.x or 3.0.x installation we highly recommend that you backup any existing data before proceeding!</p> @@ -110,15 +114,15 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> - <a name="run"></a><h2>2. Running phpBB3</h2> + <a name="run"></a><h2>2. Running phpBB</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -132,55 +136,55 @@ <p>This is the <em>official</em> location for all supported language sets. If you download a package from a 3rd party site you do so with the understanding that we cannot offer support. Please do not ask for support if you download a language pack from a 3rd party site.</p> - <p>Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included <code>language</code> and <code>styles</code> folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: <code>System tab -> General Tasks -> Language packs</code>. A more detailed description of the process is in the Knowledge Base article, <a href="https://www.phpbb.com/kb/article/how-to-install-a-language-pack/">How to Install a Language Pack</a>.</p> + <p>Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included <code>language</code> and <code>styles</code> folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: <code>Customise tab -> Language management -> Language packs</code>. A more detailed description of the process is in the Knowledge Base article, <a href="https://www.phpbb.com/kb/article/how-to-install-a-language-pack/">How to Install a Language Pack</a>.</p> - <p>If your language is not available, please visit our <a href="https://www.phpbb.com/community/viewforum.php?f=66">[3.0.x] Translations</a> forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can <a href="https://www.phpbb.com/languages/apply.php">Apply to become a translator</a>.</p> + <p>If your language is not available, please visit our <a href="https://www.phpbb.com/community/viewforum.php?f=491">[3.1.x] Translations</a> forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can <a href="https://www.phpbb.com/languages/apply.php">Apply to become a translator</a>.</p> <a name="styles"></a><h3>2.ii. Styles</h3> - <p>Although the phpBB Group is rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB3 allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the <a href="https://www.phpbb.com/customise/db/styles-2/">Styles</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> + <p>Although we are rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the <a href="https://www.phpbb.com/customise/db/styles-2/">Styles</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> <p>For more information about styles, please see: <a href="https://www.phpbb.com/styles/">https://www.phpbb.com/styles/</a></p> <p><strong>Please note</strong> that 3rd party styles downloaded for versions of phpBB2 will <strong>not</strong> work in phpBB3. It is also important to ensure that the style is updated to match the current version of the phpBB software you are using.</p> - <p>Once you have downloaded a style, the usual next step is to unarchive (or upload the unarchived contents of) the package into your <code>styles/</code> directory. You then need to visit <code>Administration Control Panel -> Styles tab</code> where you should see the new style available. Click "Install" to install the style.</p> + <p>Once you have downloaded a style, the usual next step is to unarchive (or upload the unarchived contents of) the package into your <code>styles/</code> directory. You then need to visit <code>Administration Control Panel -> Customise tab -> Style management -> Install Styles</code> where you should see the new style available. Click "Install style" to install the style.</p> - <p><strong>Please note</strong> that to improve efficiency, the software caches certain data. For this reason, if you create your own style or modify existing ones, please remember to "Refresh" the appropriate style components <code>Administration Control Panel -> Styles tab -> Style Components</code> screen. You may also need to reload the page you have changed in your web browser to overcome browser caching. If the changed components are not refreshed you will not see your changes taking effect.</p> + <p><strong>Please note</strong> that to improve efficiency, the software caches certain data. For this reason, if you create your own style or modify existing ones, please remember to purge the board cache by clicking the <code>Run now</code> button next to the <code>Purge the cache</code> option in the index page of the Administration Control Panel. You may also need to reload the page you have changed in your web browser to overcome browser caching. If the cache is not purged, you will not see your changes taking effect.</p> - <a name="mods"></a><h3>2.iii. Modifications</h3> + <a name="extensions"></a><h3>2.iii. Extensions</h3> - <p>Although not officially supported by the phpBB Group, phpBB has a thriving modification scene. These third party modifications to the standard phpBB software, known as <strong>MODs</strong>, extend its capabilities still further. You can browse through many of the MODs in the <a href="https://www.phpbb.com/customise/db/modifications-1/">Modifications</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> + <p>We are proud to have a thriving extensions community. These third party extensions to the standard phpBB software, extend its capabilities still further. You can browse through many of the extensions in the <a href="https://www.phpbb.com/customise/db/extensions-36">Extensions</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> - <p>For more information about MODs, please see: <a href="https://www.phpbb.com/mods/">https://www.phpbb.com/mods/</a></p> + <p>For more information about extensions, please see: <a href="https://www.phpbb.com/extensions">https://www.phpbb.com/extensions</a></p> - <p><strong>Please remember</strong> that any bugs or other issues that occur after you have added any modification should <strong>NOT</strong> be reported to the bug tracker (see below). First remove the MOD and see if the problem is resolved. Any support for a MOD should only be sought in the "Discussion/Support" forum for that MOD.</p> + <p><strong>Please remember</strong> that any bugs or other issues that occur after you have added any extension should <strong>NOT</strong> be reported to the bug tracker (see below). First disable the extension and see if the problem is resolved. Any support for an extension should only be sought in the "Discussion/Support" forum for that extension.</p> - <p>Also remember that any modifications, particularly those which modify the database in any way, may render upgrading your forum to future versions more difficult. With all this said, many users have and continue to utilise many of the MODs already available with great success.</p> + <p>Also remember that any extensions which modify the database in any way, may render upgrading your forum to future versions more difficult.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> -<a name="help"></a><h2>3. Getting help with phpBB3</h2> +<a name="help"></a><h2>3. Getting help with phpBB</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>phpBB3 can sometimes seem a little daunting to new users, particularly with regards to the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a>, which covers a few basic getting started questions. If you need additional help there are several places you can find it.</p> + <p>phpBB can sometimes seem a little daunting to new users, particularly with regards to the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a>, which covers a few basic getting started questions. If you need additional help there are several places you can find it.</p> - <a name="docs"></a><h3>3.i. phpBB3 Documentation</h3> + <a name="docs"></a><h3>3.i. phpBB Documentation</h3> <p>Comprehensive documentation is now available on the phpBB website:</p> - <p><a href="https://www.phpbb.com/support/documentation/3.0/">https://www.phpbb.com/support/documentation/3.0/</a></p> + <p><a href="https://www.phpbb.com/support/docs/en/3.1/ug/">https://www.phpbb.com/support/docs/en/3.1/ug/</a></p> <p>This covers everything from installation to setting permissions and managing users.</p> @@ -192,7 +196,7 @@ <a name="website"></a><h3>3.iii. Community Forums</h3> - <p>The phpBB Group maintains a thriving community where a number of people have generously decided to donate their time to help support users. This site can be found at:</p> + <p>The phpBB project maintains a thriving community where a number of people have generously decided to donate their time to help support users. This site can be found at:</p> <p><a href="https://www.phpbb.com/community/">https://www.phpbb.com/community/</a></p> @@ -208,7 +212,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -216,7 +220,7 @@ <a name="status"></a><h2>4. Status of this version</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -232,7 +236,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -240,20 +244,20 @@ <a name="bugs"></a><h2>5. Reporting Bugs</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>The phpBB Group uses a bug tracking system to store, list and manage all reported bugs, it can be found at the location listed below. Please <strong>DO NOT</strong> post bug reports to our forums. In addition please <strong>DO NOT</strong> use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).</p> + <p>The phpBB developers use a bug tracking system to store, list and manage all reported bugs, it can be found at the location listed below. Please <strong>DO NOT</strong> post bug reports to our forums. In addition please <strong>DO NOT</strong> use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).</p> <p><a href="http://tracker.phpbb.com/browse/PHPBB3">http://tracker.phpbb.com/browse/PHPBB3</a></p> <p>While we very much appreciate receiving bug reports (the more reports the more stable phpBB will be) we ask you carry out a few steps before adding new entries:</p> <ul> - <li>First, determine if your bug is reproduceable; how to determine this depends on the bug in question. Only if the bug is reproduceable is it likely to be a problem with phpBB3 (or in some way connected). If something cannot be reproduced it may turn out to have been your hosting provider working on something, a user doing something silly, etc. Bug reports for non-reproduceable events can slow down our attempts to fix real, reproduceable issues<br /><br /></li> + <li>First, determine if your bug is reproduceable; how to determine this depends on the bug in question. Only if the bug is reproduceable is it likely to be a problem with phpBB (or in some way connected). If something cannot be reproduced it may turn out to have been your hosting provider working on something, a user doing something silly, etc. Bug reports for non-reproduceable events can slow down our attempts to fix real, reproduceable issues<br /><br /></li> <li>Next, please read or search through the existing bug reports to see if <em>your</em> bug (or one very similar to it) is already listed. If it is please add to that existing bug rather than creating a new duplicate entry (all this does is slow us down).<br /><br /></li> - <li>Check the forums (use search!) to see if people have discussed anything that sounds similar to what you are seeing. However, as noted above please <strong>DO NOT</strong> post your particular bug to the forum unless it's non-reproduceable or you are sure it’s related to something you have done rather than phpBB3<br /><br /></li> + <li>Check the forums (use search!) to see if people have discussed anything that sounds similar to what you are seeing. However, as noted above please <strong>DO NOT</strong> post your particular bug to the forum unless it's non-reproduceable or you are sure it’s related to something you have done rather than phpBB<br /><br /></li> <li>If no existing bug exists then please feel free to add it</li> </ul> @@ -261,13 +265,13 @@ <ul> <li>Your server type/version, e.g. Apache 2.2.3, IIS 7, Sambar, etc.</li> - <li>PHP version and mode of operation, e.g. PHP 5.3.3 as a module, PHP 5.4.0 running as CGI, etc.</li> + <li>PHP version and mode of operation, e.g. PHP 5.4.0 as a module, PHP 5.4.0 running as CGI, etc.</li> <li>DB type/version, e.g. MySQL 5.0.77, PostgreSQL 9.0.6, MSSQL Server 2000 SP1, etc.</li> </ul> <p>The relevant database type/version is listed within the administration control panel.</p> - <p>Please be as detailed as you can in your report, and if possible, list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request to our repository <a href="https://github.com/phpbb/phpbb3">on GitHub</a>.</p> + <p>Please be as detailed as you can in your report, and if possible, list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request to our repository <a href="https://github.com/phpbb/phpbb">on GitHub</a>.</p> <p>If you create a patch, it is very much appreciated (but not required) if you follow the phpBB coding guidelines. Please note that the coding guidelines are somewhat different between different versions of phpBB. For phpBB 3.1.x the coding guidelines may be found here: <a href="http://area51.phpbb.com/docs/31x/coding-guidelines.html">http://area51.phpbb.com/docs/31x/coding-guidelines.html</a></p> @@ -283,7 +287,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -291,7 +295,7 @@ <a name="curbugs"></a><h2>6. Overview of current bug list</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -307,7 +311,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -315,15 +319,15 @@ <a name="php"></a><h2>7. PHP compatibility issues</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>phpBB 3.1.x takes advantage of new features added in PHP 5.3. We recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 5.3.3.</p> + <p>phpBB 3.2.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.0 and the maximum supported version is PHP 7.0.</p> - <p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a development 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 development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB. If you are running a development 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, MariaDB 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 5.3.x to 5.4.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, MariaDB 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and SQLite 3. Versions of PHP used range from 5.4.x to 5.6.x without problem.</p> <a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3> @@ -333,7 +337,7 @@ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -341,17 +345,17 @@ <a name="disclaimer"></a><h2>8. Copyright and disclaimer</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright © <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>phpBB is free software, released under the terms of the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License, version 2 (GPL-2.0)</a>. Copyright © <a href="https://www.phpbb.com">phpBB Limited</a>. For full copyright and license information, please see the docs/CREDITS.txt file.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- END DOCUMENT --> @@ -362,7 +366,7 @@ </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/assets/css/stylesheet.css b/phpBB/docs/assets/css/stylesheet.css new file mode 100644 index 0000000000..192a6f9f79 --- /dev/null +++ b/phpBB/docs/assets/css/stylesheet.css @@ -0,0 +1,326 @@ +/* + The original "prosilver" theme for phpBB3 + Created by subBlue design :: http://www.subBlue.com +*/ + +* { margin: 0; padding: 0; } + +html { font-size: 100%; height: 100%; margin-bottom: 1px; } + +body { + font-family: Verdana, Helvetica, Arial, sans-serif; + color: #828282; + background-color: #FFFFFF; + font-size: 10px; + margin: 0; + padding: 12px 0; +} + +img { border-width: 0; } + +ul, ol { + font-size: 1.1em; +} + +ul ul, ol ol { + font-size: inherit; +} + +p { + line-height: 1.3em; + font-size: 1.1em; + margin-bottom: 1.5em; +} + +hr { + border: 0 none #FFFFFF; + border-top: 1px solid #CCCCCC; + height: 1px; + margin: 5px 0; + display: block; + clear: both; +} + +html, body { + color: #536482; + background-color: #FFFFFF; +} + +#doc-description h1 { + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + margin-right: 200px; + color: #FFFFFF; + margin-top: 15px; + font-weight: bold; + font-size: 2em; + color: #fff; +} + +h1 { + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + font-weight: normal; + color: #000; + font-size: 2em; + margin: 0.8em 0 0.2em 0; +} + +h2 { + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + font-weight: normal; + color: #28313F; + font-size: 1.5em; + margin: 0.8em 0 0.2em 0; +} + +h3 { + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + border-bottom: 1px solid #CCCCCC; + margin-bottom: 3px; + padding-bottom: 2px; + font-size: 1.1em; + color: #115098; + margin-top: 20px; +} + +h4 { + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + margin-bottom: 3px; + padding-bottom: 2px; + font-size: 1.1em; + color: #115098; + margin-top: 20px; +} + +.good { color: green; } +.bad { color: red; } + +.version { + margin-top: 20px; + text-align: left; + font-size: 70%; + color: #006600; + border-top: 1px solid #ccc; +} + +code { + color: #006600; + font-weight: normal; + font-family: 'Courier New', monospace; + border-color: #D1D7DC; + border-width: 1px; + border-style: solid; + background-color: #FAFAFA; + padding: 0 4px; +} + +#wrap { + padding: 0 20px; + min-width: 650px; +} + +#simple-wrap { + padding: 6px 10px; +} + +#page-body { + margin: 4px 0; + clear: both; +} + +#page-footer { + clear: both; +} + +#logo { + float: left; + width: auto; + padding: 10px 13px 0 10px; +} + +a#logo:hover { + text-decoration: none; +} + +#doc-description { + float: left; + width: 70%; +} + +#doc-description h1 { + margin-right: 0; +} + +.headerbar { + background: #ebebeb none repeat-x 0 0; + border-radius: 7px; + color: #FFFFFF; + margin-bottom: 4px; + padding: 5px; +} + +.paragraph { + border-radius: 7px; + font-size: 1.1em; + padding: 5px 10px; + margin-bottom: 4px; + background-repeat: no-repeat; + background-position: 100% 0; + background-color: #ECF3F7; +} + +.paragraph:target .content { + color: #000000; +} + +.paragraph:target h3 a { + color: #000000; +} + +.main-description { + font-size: 1.15em; +} + +.content { + color: #333333; +} + +.content h2, .panel h2 { + color: #115098; + border-bottom-color: #CCCCCC; +} + +a:link { color: #898989; text-decoration: none; } +a:visited { color: #898989; text-decoration: none; } +a:hover { color: #d3d3d3; text-decoration: underline; } +a:active { color: #d2d2d2; text-decoration: none; } + +hr { + border-color: #FFFFFF; + border-top-color: #CCCCCC; +} + +.menu { + background-color: #cadceb; +} + +.headerbar { + background-color: #12A3EB; + background-image: url("../images/bg_header.gif"); + color: #FFFFFF; +} + +.panel { + background-color: #ECF1F3; + color: #28313F; +} + +.error { + color: #BC2A4D; +} + +a:link { color: #105289; } +a:visited { color: #105289; } +a:hover { color: #D31141; } +a:active { color: #368AD2; } + +.content { + padding: 0; + line-height: 1.48em; + color: #333333; +} + +.content h2, .panel h2 { + color: #115098; + border-bottom-color: #CCCCCC; +} + +.notice { + border-top-color: #CCCCCC; +} + +.codebox { + padding: 3px; + background-color: #FFFFFF; + border: 1px solid #C9D2D8; + font-size: 1em; + margin-bottom: 10px; + display: block; + font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; + line-height: 1.3em; +} + +* html hr { margin: 0; } + +.top { + background: url("../images/icon_back_top.gif") no-repeat top left; + text-decoration: none; + width: 11px; + height: 11px; + display: block; + float: right; + overflow: hidden; + letter-spacing: 1000px; + text-indent: 11px; +} + +.content ol, .content ul { + margin-left: 25px; + margin-top: 0; +} + +.content ul + p, .content ul + div { + margin-top: 20px; +} + +.comment { + color: green; +} + +.indent { + margin-left: 20px; +} + +.paragraph table { + font-size: 8pt; + border-collapse: collapse; + border: 1px solid #cfcfcf; + margin-bottom: 20px; +} + +.paragraph table caption { + display: none; +} + +.paragraph table thead { + background-color: #cadceb; + color: #000; +} + +.paragraph table td, .paragraph table th { + border: 1px solid #006699; + padding: 0.5em; + background-color: #e1ebf2; +} + +.paragraph table th { + background-color: #cadceb; +} + +.paragraph table td dl { + margin: 0; + padding: 0; +} + +.paragraph table td dl dt { + float: left; + clear: both; + margin-right: 1em; +} + +.inner:after { + clear: both; + content: ''; + display: block; +} diff --git a/phpBB/docs/bg_header.gif b/phpBB/docs/assets/images/bg_header.gif Binary files differindex 351de9f46a..351de9f46a 100644 --- a/phpBB/docs/bg_header.gif +++ b/phpBB/docs/assets/images/bg_header.gif diff --git a/phpBB/styles/prosilver/theme/images/icon_back_top.gif b/phpBB/docs/assets/images/icon_back_top.gif Binary files differindex 4d2b8f3822..4d2b8f3822 100644 --- a/phpBB/styles/prosilver/theme/images/icon_back_top.gif +++ b/phpBB/docs/assets/images/icon_back_top.gif diff --git a/phpBB/docs/assets/images/site_logo.gif b/phpBB/docs/assets/images/site_logo.gif Binary files differnew file mode 100644 index 0000000000..2517fbedd6 --- /dev/null +++ b/phpBB/docs/assets/images/site_logo.gif diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index c68ae7821f..27d090c296 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -6,7 +6,7 @@ <meta name="description" content="This is an explanation of how to use the phpBB auth/acl API" /> <title>phpBB3 • Auth API</title> -<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -16,16 +16,16 @@ <a id="top" name="top" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div id="doc-description"> - <a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a> + <a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a> <h1>Auth API</h1> <p>This is an explanation of how to use the phpBB auth/acl API</p> <p style="display: none;"><a href="#start_here">Skip</a></p> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> </div> @@ -35,12 +35,12 @@ <!-- BEGIN DOCUMENT --> - <p>This is an explanation of how to use the phpBB auth/acl API.</p> + <p class="paragraph main-description">This is an explanation of how to use the phpBB auth/acl API.</p> <h1>Auth API</h1> <div class="paragraph menu"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -65,7 +65,7 @@ </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -73,7 +73,7 @@ <a name="intro"></a><h2>1. Introduction</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -86,8 +86,8 @@ <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> -$auth = new phpbb\auth\auth(); - </pre></div> +$auth = new phpbb\auth\auth();</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> @@ -95,7 +95,7 @@ $auth = new phpbb\auth\auth(); <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -103,19 +103,19 @@ $auth = new phpbb\auth\auth(); <a name="methods"></a><h2>2. Methods</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> <p>Following are the methods you are able to use.</p> <a name="acl"></a><h3>2.i. acl</h3> - + <p>The <code>acl</code> method is the initialisation routine for all the acl functions. If you intend calling any acl method you must first call this. The method takes as its one and only required parameter an associative array containing user information as stored in the database. This array must contain at least the following information; user_id, user_permissions and user_type. It is called in the following way:</p> <div class="codebox"><pre> -$auth->acl(<code>userdata</code>); - </pre></div> +$auth->acl(<code>userdata</code>);</pre> + </div> <p>Where userdata is the array containing the aforementioned data.</p> @@ -124,8 +124,8 @@ $auth->acl(<code>userdata</code>); <p>This method is the primary way of determining what a user can and cannot do for a given option globally or in a given forum. The method should be called in the following way:</p> <div class="codebox"><pre> -$result = $auth->acl_get(<code>option</code>[, <code>forum</code>]); - </pre></div> +$result = $auth->acl_get(<code>option</code>[, <code>forum</code>]);</pre> + </div> <p>Where option is a string representing the required option, e.g. 'f_list', 'm_edit', 'a_adduser', etc. By adding a ! in front of the option, e.g. '!f_list' the result of this method will be negated. The optional forum term is the integer forum_id.</p> @@ -142,8 +142,8 @@ $result = $auth->acl_get(<code>option</code>[, <code>forum</code>]); <p>The method should be called thus:</p> <div class="codebox"><pre> -$result = $auth->acl_gets(<code>option1</code>[, <code>option2</code>, ..., <code>optionN</code>, <code>forum</code>]); - </pre></div> +$result = $auth->acl_gets(<code>option1</code>[, <code>option2</code>, ..., <code>optionN</code>, <code>forum</code>]);</pre> + </div> <p>As with the <code>acl_get</code> method the options are strings representing the required permissions to check. The forum again is an integer representing a given forum_id.</p> @@ -154,16 +154,16 @@ $result = $auth->acl_gets(<code>option1</code>[, <code>option2</code>, ..., < <p>This method is used to find out in which forums a user is allowed to carry out an operation or to find out in which forums he is not allowed to carry out an operation. The method should be called in the following way:</p> <div class="codebox"><pre> -$result = $auth->acl_getf(<code>option</code>[, <code>clean</code>]); - </pre></div> +$result = $auth->acl_getf(<code>option</code>[, <code>clean</code>]);</pre> + </div> <p>Just like in the <code>acl_get</code> method the option is a string specifying the permission which has to be checked (negation using ! is allowed). The second parameter is a boolean. If it is set to false this method returns all forums with either zero or a positive integer. If it is set to true only those forums with a positive integer as the result will be returned.</p> <p>The method returns an associative array of the form:</p> <div class="codebox"><pre> -array(<em>forum_id1</em> => array(<em>option</em> => <em>integer</em>), <em>forum_id2</em> => ...) - </pre></div> +array(<em>forum_id1</em> => array(<em>option</em> => <em>integer</em>), <em>forum_id2</em> => ...)</pre> + </div> <p>Where option is the option passed to the method and integer is either zero or a positive integer and the same <code>acl_get(option, forum_id)</code> would return.</p> @@ -172,8 +172,8 @@ array(<em>forum_id1</em> => array(<em>option</em> => <em>integer</em>), <e <p>This method is used to find out whether a user has a permission in at least one forum or globally. This method is similar to checking whether <code>acl_getf(option, true)</code> returned one or more forums but it's faster. It should be called in the following way:</p> <div class="codebox"><pre> -$result = $auth->acl_getf_global(<code>option</code>) - </pre></div> +$result = $auth->acl_getf_global(<code>option</code>)</pre> + </div> <p>As with the previous methods option is a string specifying the permission which has to be checked.</p> @@ -230,7 +230,7 @@ $result = $auth->acl_get_list($user_id, $permissions, $forum_id); <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -238,7 +238,7 @@ $result = $auth->acl_get_list($user_id, $permissions, $forum_id); <a name="admin_related"></a><h2>3. Admin related functions</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -247,8 +247,8 @@ $result = $auth->acl_get_list($user_id, $permissions, $forum_id); <p>To use any methods this class contains it first needs to be instantiated separately from <code>auth</code>. This is achieved in the same way as <code>auth</code>:</p> <div class="codebox"><pre> -$auth_admin = new auth_admin(); - </pre></div> +$auth_admin = new auth_admin();</pre> + </div> <p>This instance gives you access to both the methods of this specific class and that of <code>auth</code>.</p> @@ -256,7 +256,7 @@ $auth_admin = new auth_admin(); <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -264,17 +264,17 @@ $auth_admin = new auth_admin(); <a name="disclaimer"></a><h2>4. Copyright and disclaimer</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>phpBB is free software, released under the terms of the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License, version 2 (GPL-2.0)</a>. Copyright © <a href="https://www.phpbb.com">phpBB Limited</a>. For full copyright and license information, please see the docs/CREDITS.txt file.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- END DOCUMENT --> @@ -285,7 +285,7 @@ $auth_admin = new auth_admin(); </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 6cd2627f43..26189235ef 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -6,7 +6,7 @@ <meta name="description" content="Ascraeus coding guidelines document" /> <title>phpBB3 • Coding Guidelines</title> -<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> +<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" /> </head> @@ -16,16 +16,16 @@ <a id="top" name="top" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div id="doc-description"> - <a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a> + <a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a> <h1>Coding Guidelines</h1> <p>Ascraeus coding guidelines document</p> <p style="display: none;"><a href="#start_here">Skip</a></p> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> </div> @@ -35,12 +35,14 @@ <!-- BEGIN DOCUMENT --> -<p>These are the phpBB Coding Guidelines for Ascraeus, all attempts should be made to follow them as closely as possible.</p> +<p class="paragraph main-description"> + These are the phpBB Coding Guidelines for Ascraeus, all attempts should be made to follow them as closely as possible. +</p> <h1>Coding Guidelines</h1> <div class="paragraph menu"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -79,6 +81,8 @@ <ol style="list-style-type: lower-roman;"> <li><a href="#standardisation">Standardisation</a></li> <li><a href="#otherconsiderations">Other considerations</a></li> + <li><a href="#placeholders">Working with placeholders</a></li> + <li><a href="#usingplurals">Using plurals</a></li> <li><a href="#writingstyle">Writing Style</a></li> </ol> </li> @@ -87,7 +91,7 @@ </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -95,7 +99,7 @@ <a name="defaults"></a><h2>1. Defaults</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -106,9 +110,9 @@ <p>Tabs in front of lines are no problem, but having them within the text can be a problem if you do not set it to the amount of spaces every one of us uses. Here is a short example of how it should look like:</p> <div class="codebox"><pre> -{TAB}$mode{TAB}{TAB}= request_var('mode', ''); -{TAB}$search_id{TAB}= request_var('search_id', ''); - </pre></div> +{TAB}$mode{TAB}{TAB}= $request->variable('mode', ''); +{TAB}$search_id{TAB}= $request->variable('search_id', '');</pre> + </div> <p>If entered with tabs (replace the {TAB}) both equal signs need to be on the same column.</p> @@ -123,12 +127,16 @@ <div class="codebox"><pre> /** * -* @package {PACKAGENAME} -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * -*/ - </pre></div> +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/</pre> + </div> <p>Please see the <a href="#locations">File Locations section</a> for the correct package name.</p> @@ -151,8 +159,8 @@ /** */ -{CODE} - </pre></div> +{CODE}</pre> + </div> <h4>Files containing only functions:</h4> @@ -179,8 +187,8 @@ Small code snipped, mostly one or two defines or an if statement /** * {DOCUMENTATION} */ -class ... - </pre></div> +class ...</pre> + </div> <a name="locations"></a><h3>1.iii. File Locations</h3> @@ -190,19 +198,12 @@ class ... <ul> <li><strong>phpBB3</strong><br />Core files and all files not assigned to a separate package</li> - <li><strong>acm</strong><br /><code>/includes/cache</code><br />Cache System</li> + <li><strong>acm</strong><br /><code>/phpbb/cache</code><br />Cache System</li> <li><strong>acp</strong><br /><code>/adm</code>, <code>/includes/acp</code>, <code>/includes/functions_admin.php</code><br />Administration Control Panel</li> - <li><strong>dbal</strong><br /><code>/includes/db</code><br />Database Abstraction Layer.<br />Base class is <code>dbal</code> + <li><strong>dbal</strong><br /><code>/phpbb/db</code>, <code>/includes/db</code><br />Database Abstraction Layer. <ul> - <li><code>/includes/db/dbal.php</code><br />Base DBAL class, defining the overall framework</li> - <li><code>/includes/db/firebird.php</code><br />Firebird/Interbase Database Abstraction Layer</li> - <li><code>/includes/db/msssql.php</code><br />MSSQL Database Abstraction Layer</li> - <li><code>/includes/db/mssql_odbc.php</code><br />MSSQL ODBC Database Abstraction Layer for MSSQL</li> - <li><code>/includes/db/mysql.php</code><br />MySQL Database Abstraction Layer for MySQL 3.x/4.0.x/4.1.x/5.x</li> - <li><code>/includes/db/mysqli.php</code><br />MySQLi Database Abstraction Layer</li> - <li><code>/includes/db/oracle.php</code><br />Oracle Database Abstraction Layer</li> - <li><code>/includes/db/postgres.php</code><br />PostgreSQL Database Abstraction Layer</li> - <li><code>/includes/db/sqlite.php</code><br />Sqlite Database Abstraction Layer</li> + <li><code>/phpbb/db/driver/</code><br />Database Abstraction Layer classes</li> + <li><code>/phpbb/db/migration/</code><br />Migrations are used for updating the database from one release to another</li> </ul> </li> <li><strong>diff</strong><br /><code>/includes/diff</code><br />Diff Engine</li> @@ -210,13 +211,13 @@ class ... <li><strong>images</strong><br /><code>/images</code><br />All global images not connected to styles</li> <li><strong>install</strong><br /><code>/install</code><br />Installation System</li> <li><strong>language</strong><br /><code>/language</code><br />All language files</li> - <li><strong>login</strong><br /><code>/includes/auth</code><br />Login Authentication Plugins</li> + <li><strong>login</strong><br /><code>/phpbb/auth</code><br />Login Authentication Plugins</li> <li><strong>VC</strong><br /><code>/includes/captcha</code><br />CAPTCHA</li> <li><strong>mcp</strong><br /><code>mcp.php</code>, <code>/includes/mcp</code>, <code>report.php</code><br />Moderator Control Panel</li> <li><strong>ucp</strong><br /><code>ucp.php</code>, <code>/includes/ucp</code><br />User Control Panel</li> <li><strong>utf</strong><br /><code>/includes/utf</code><br />UTF8-related functions/classes</li> - <li><strong>search</strong><br /><code>/includes/search</code>, <code>search.php</code><br />Search System</li> - <li><strong>styles</strong><br /><code>/styles</code>, <code>style.php</code><br />phpBB Styles/Templates/Themes/Imagesets</li> + <li><strong>search</strong><br /><code>/phpbb/search</code>, <code>search.php</code><br />Search System</li> + <li><strong>styles</strong><br /><code>/styles</code><br />phpBB Styles/Templates/Themes</li> </ul> <a name="constants"></a><h3>1.iv. Special Constants</h3> @@ -249,7 +250,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> <ul> - <li>/includes/user.php - phpbb_user::img()</li> + <li>/phpbb/user.php - \phpbb\user::img()</li> <li>/includes/functions_content.php - smiley_text()</li> </ul> @@ -260,8 +261,6 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c <li>{T_THEME_PATH} - styles/xxx/theme</li> <li>{T_TEMPLATE_PATH} - styles/xxx/template</li> <li>{T_SUPER_TEMPLATE_PATH} - styles/xxx/template</li> - <li>{T_IMAGESET_PATH} - styles/xxx/imageset</li> - <li>{T_IMAGESET_LANG_PATH} - styles/xxx/imageset/yy</li> <li>{T_IMAGES_PATH} - images/</li> <li>{T_SMILIES_PATH} - $config['smilies_path']/</li> <li>{T_AVATAR_PATH} - $config['avatar_path']/</li> @@ -269,7 +268,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c <li>{T_ICONS_PATH} - $config['icons_path']/</li> <li>{T_RANKS_PATH} - $config['ranks_path']/</li> <li>{T_UPLOAD_PATH} - $config['upload_path']/</li> - <li>{T_STYLESHEET_LINK} - styles/xxx/theme/stylesheet.css (or link to style.php if css is parsed dynamically)</li> + <li>{T_STYLESHEET_LINK} - styles/xxx/theme/stylesheet.css</li> <li>New template variable {BOARD_URL} for the board url + script path.</li> </ul> @@ -277,7 +276,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -285,7 +284,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c <a name="code"></a><h2>2. Code Layout/Guidelines</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -301,9 +300,9 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c <div class="indent"> <p><code>$current_user</code> is right, but <code>$currentuser</code> and <code> $currentUser</code> are not.</p> </div> - + <p>In JavaScript, variable names should use camel case:</p> - + <div class="indent"> <p><code>currentUser</code> is right, but <code>currentuser</code> and <code>current_user</code> are not.</p> </div> @@ -320,11 +319,11 @@ for ($i = 0; $i < $outer_size; $i++) { foo($i, $j); } -} - </pre></div> +}</pre> + </div> <h4>Function Names:</h4> - <p>Functions should also be named descriptively. We're not programming in C here, we don't want to write functions called things like "stristr()". Again, all lower-case names with words separated by a single underscore character in PHP, and camel caps in JavaScript. Function names should preferably have a verb in them somewhere. Good function names are <code>print_login_status()</code>, <code>get_user_data()</code>, etc. Constructor functions in JavaScript should begin with a capital letter.</p> + <p>Functions should also be named descriptively. We're not programming in C here, we don't want to write functions called things like "stristr()". Again, all lower-case names with words separated by a single underscore character in PHP, and camel caps in JavaScript. Function names should be prefixed with "phpbb_" and preferably have a verb in them somewhere. Good function names are <code>phpbb_print_login_status()</code>, <code>phpbb_get_user_data()</code>, etc. Constructor functions in JavaScript should begin with a capital letter.</p> <h4>Function Arguments:</h4> <p>Arguments are subject to the same guidelines as variable names. We don't want a bunch of functions like: <code>do_stuff($a, $b, $c)</code>. In most cases, we'd like to be able to tell how to use a function by just looking at its declaration. </p> @@ -334,33 +333,31 @@ for ($i = 0; $i < $outer_size; $i++) <p>Apart from following the rules for function names, all classes should meet the following conditions:</p> <ul> <li>Every class must be defined in a separate file.</li> - <li>The classes have to be located in a subdirectory of <code>includes/</code>.</li> - <li>Classnames to be prefixed with <code>phpbb_</code> to avoid name clashes, the filename should not contain the prefix.</li> - <li>Class names have to reflect the location of the file they are defined in. The longest list of prefixes, separated by underscores, which is a valid path must be the directory in which the file is located. So the directory names must not contain any underscores, but the filename may. If the filename would be empty the last directory name is used for the filename as well.</li> + <li>The classes have to be located in a subdirectory of <code>phpbb/</code>.</li> + <li>Classnames must be namespaced with <code>\phpbb\</code> to avoid name clashes.</li> + <li>Class names/namespaces have to reflect the location of the file they are defined in. The namespace must be the directory in which the file is located. So the directory names must not contain any underscores, but the filename may.</li> <li>Directories should typically be a singular noun (e.g. <code>dir</code> in the example below, not <code>dirs</code>.</li> </ul> <p>So given the following example directory structure you would result in the below listed lookups</p> <div class="codebox"><pre> -includes/ +phpbb/ class_name.php dir/ class_name.php - dir.php subdir/ - class_name.php - </pre></div> + class_name.php</pre> + </div> <div class="codebox"><pre> -phpbb_class_name - includes/class_name.php -phpbb_dir_class_name - includes/dir/class_name.php -phpbb_dir - includes/dir/dir.php -phpbb_dir_subdir_class_name - includes/dir/subdir/class_name.php - </pre></div> +\phpbb\class_name - phpbb/class_name.php +\phpbb\dir\class_name - phpbb/dir/class_name.php +\phpbb\dir\subdir\class_name - phpbb/dir/subdir/class_name.php</pre> + </div> <h4>Summary:</h4> - <p>The basic philosophy here is to not hurt code clarity for the sake of laziness. This has to be balanced by a little bit of common sense, though; <code>print_login_status_for_a_given_user()</code> goes too far, for example -- that function would be better named <code>print_user_login_status()</code>, or just <code>print_login_status()</code>.</p> + <p>The basic philosophy here is to not hurt code clarity for the sake of laziness. This has to be balanced by a little bit of common sense, though; <code>phpbb_print_login_status_for_a_given_user()</code> goes too far, for example -- that function would be better named <code>phpbb_print_user_login_status()</code>, or just <code>phpbb_print_login_status()</code>.</p> <h4>Special Namings: </h4> <p>For all emoticons use the term <code>smiley</code> in singular and <code>smilies</code> in plural. For emails we use the term <code>email</code> (without dash between “e†and “mâ€).</p> @@ -382,8 +379,8 @@ while (condition) do_stuff(); for ($i = 0; $i < size; $i++) - do_stuff($i); - </pre></div> + do_stuff($i);</pre> + </div> <p class="good">// These are all right. </p> <div class="codebox"><pre> @@ -400,8 +397,8 @@ while (condition) for ($i = 0; $i < size; $i++) { do_stuff(); -} - </pre></div> +}</pre> + </div> <h4>Where to put the braces:</h4> <p>In PHP code, braces always go on their own line. The closing brace should also always be at the same column as the corresponding opening brace, examples:</p> @@ -432,9 +429,9 @@ while (condition) function do_stuff() { ... -} - </pre></div> - +}</pre> + </div> + <p>In JavaScript code, braces always go on the same line:</p> <div class="codebox"><pre> @@ -456,8 +453,8 @@ while (condition) { function do_stuff() { ... -} - </pre></div> +}</pre> + </div> <h4>Use spaces between tokens:</h4> <p>This is another simple, easy step that helps keep code readable without much effort. Whenever you write an assignment, expression, etc.. Always leave <em>one</em> space between the tokens. Basically, write code as if it was English. Put spaces between variable names and operators. Don't put spaces just after an opening bracket or before a closing bracket. Don't put spaces just before a comma or a semicolon. This is best shown with a few examples, examples:</p> @@ -481,26 +478,26 @@ for($i=0; $i<$size; $i++) ... for ($i = 0; $i < $size; $i++) ... $i=($j < $size)?0:1; -$i = ($j < $size) ? 0 : 1; - </pre></div> +$i = ($j < $size) ? 0 : 1;</pre> + </div> <h4>Operator precedence:</h4> <p>Do you know the exact precedence of all the operators in PHP? Neither do I. Don't guess. Always make it obvious by using brackets to force the precedence of an equation so you know what it does. Remember to not over-use this, as it may harden the readability. Basically, do not enclose single expressions. Examples:</p> <p class="bad">// what's the result? who knows. </p> - <div class="codebox"><pre> -$bool = ($i < 7 && $j > 8 || $k == 4); - </pre></div> + <div class="codebox"> + <pre>$bool = ($i < 7 && $j > 8 || $k == 4);</pre> + </div> <p class="bad">// now you can be certain what I'm doing here.</p> - <div class="codebox"><pre> -$bool = (($i < 7) && (($j < 8) || ($k == 4))); - </pre></div> + <div class="codebox"> + <pre>$bool = (($i < 7) && (($j < 8) || ($k == 4)));</pre> + </div> <p class="good">// But this one is even better, because it is easier on the eye but the intention is preserved</p> - <div class="codebox"><pre> -$bool = ($i < 7 && ($j < 8 || $k == 4)); - </pre></div> + <div class="codebox"> + <pre>$bool = ($i < 7 && ($j < 8 || $k == 4));</pre> + </div> <h4>Quoting strings:</h4> <p>There are two different ways to quote strings in PHP - either with single quotes or with double quotes. The main difference is that the parser does variable interpolation in double-quoted strings, but not in single quoted strings. Because of this, you should <em>always</em> use single quotes <em>unless</em> you specifically need variable interpolation to be done on that string. This way, we can save the parser the trouble of parsing a bunch of strings where no interpolation needs to be done.</p> @@ -510,25 +507,25 @@ $bool = ($i < 7 && ($j < 8 || $k == 4)); <div class="codebox"><pre> $str = "This is a really long string with no variables for the parser to find."; -do_stuff("$str"); - </pre></div> +do_stuff("$str");</pre> + </div> <p class="good">// right</p> <div class="codebox"><pre> $str = 'This is a really long string with no variables for the parser to find.'; -do_stuff($str); - </pre></div> +do_stuff($str);</pre> + </div> <p class="bad">// Sometimes single quotes are just not right</p> <div class="codebox"><pre> -$post_url = $phpbb_root_path . 'posting.' . $phpEx . '?mode=' . $mode . '&amp;start=' . $start; - </pre></div> +$post_url = $phpbb_root_path . 'posting.' . $phpEx . '?mode=' . $mode . '&amp;start=' . $start;</pre> + </div> <p class="good">// Double quotes are sometimes needed to not overcrowd the line with concatenations.</p> <div class="codebox"><pre> -$post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start"; - </pre></div> +$post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start";</pre> + </div> <p>In SQL statements mixing single and double quotes is partly allowed (following the guidelines listed here about SQL formatting), else one should try to only use one method - mostly single quotes.</p> @@ -540,40 +537,40 @@ $post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&amp;start=$start"; $foo = array( 'bar' => 42, 'boo' => 23 -); - </pre></div> +);</pre> + </div> <p class="good">// right </p> <div class="codebox"><pre> $foo = array( 'bar' => 42, 'boo' => 23, -); - </pre></div> +);</pre> + </div> <h4>Associative array keys:</h4> <p>In PHP, it's legal to use a literal string as a key to an associative array without quoting that string. We don't want to do this -- the string should always be quoted to avoid confusion. Note that this is only when we're using a literal, not when we're using a variable, examples:</p> <p class="bad">// wrong</p> - <div class="codebox"><pre> -$foo = $assoc_array[blah]; - </pre></div> + <div class="codebox"> + <pre>$foo = $assoc_array[blah];</pre> + </div> <p class="good">// right </p> - <div class="codebox"><pre> -$foo = $assoc_array['blah']; - </pre></div> + <div class="codebox"> + <pre>$foo = $assoc_array['blah'];</pre> + </div> <p class="bad">// wrong</p> - <div class="codebox"><pre> -$foo = $assoc_array["$var"]; - </pre></div> + <div class="codebox"> + <pre>$foo = $assoc_array["$var"];</pre> + </div> <p class="good">// right </p> - <div class="codebox"><pre> -$foo = $assoc_array[$var]; - </pre></div> + <div class="codebox"> + <pre>$foo = $assoc_array[$var];</pre> + </div> <h4>Comments:</h4> <p>Each complex function should be preceded by a comment that tells a programmer everything they need to know to use that function. The meaning of every parameter, the expected input, and the output are required as a minimal comment. The function's behaviour in error conditions (and what those error conditions are) should also be present - but mostly included within the comment about the output.<br /><br />Especially important to document are any assumptions the code makes, or preconditions for its proper operation. Any one of the developers should be able to look at any part of the application and figure out what's going on in a reasonable amount of time.<br /><br />Avoid using <code>/* */</code> comment blocks for one-line comments, <code>//</code> should be used for one/two-liners.</p> @@ -587,8 +584,8 @@ $foo = $assoc_array[$var]; <p class="bad">// wrong </p> <div class="codebox"><pre> $array[++$i] = $j; -$array[$i++] = $k; - </pre></div> +$array[$i++] = $k;</pre> + </div> <p class="good">// right </p> <div class="codebox"><pre> @@ -596,39 +593,38 @@ $i++; $array[$i] = $j; $array[$i] = $k; -$i++; - </pre></div> +$i++;</pre> + </div> <h4>Inline conditionals:</h4> <p>Inline conditionals should only be used to do very simple things. Preferably, they will only be used to do assignments, and not for function calls or anything complex at all. They can be harmful to readability if used incorrectly, so don't fall in love with saving typing by using them, examples:</p> <p class="bad">// Bad place to use them</p> <div class="codebox"><pre> -($i < $size && $j > $size) ? do_stuff($foo) : do_stuff($bar); - </pre></div> +($i < $size && $j > $size) ? do_stuff($foo) : do_stuff($bar);</pre> + </div> <p class="good">// OK place to use them </p> <div class="codebox"><pre> -$min = ($i < $j) ? $i : $j; - </pre></div> +$min = ($i < $j) ? $i : $j;</pre> + </div> <h4>Don't use uninitialized variables.</h4> <p>For phpBB3, we intend to use a higher level of run-time error reporting. This will mean that the use of an uninitialized variable will be reported as a warning. These warnings can be avoided by using the built-in isset() function to check whether a variable has been set - but preferably the variable is always existing. For checking if an array has a key set this can come in handy though, examples:</p> <p class="bad">// Wrong </p> - <div class="codebox"><pre> -if ($forum) ... - </pre></div> + <div class="codebox"> + <pre>if ($forum) ...</pre> + </div> <p class="good">// Right </p> - <div class="codebox"><pre> -if (isset($forum)) ... - </pre></div> + <div class="codebox"> + <pre>if (isset($forum)) ...</pre></div> <p class="good">// Also possible</p> - <div class="codebox"><pre> -if (isset($forum) && $forum == 5) - </pre></div> + <div class="codebox"> + <pre>if (isset($forum) && $forum == 5)</pre> + </div> <p>The <code>empty()</code> function is useful if you want to check if a variable is not set or being empty (an empty string, 0 as an integer or string, NULL, false, an empty array or a variable declared, but without a value in a class). Therefore empty should be used in favor of <code>isset($array) && sizeof($array) > 0</code> - this can be written in a shorter way as <code>!empty($array)</code>.</p> @@ -645,8 +641,8 @@ switch ($mode) case 'mode2': // I am doing something completely different here break; -} - </pre></div> +}</pre> + </div> <p class="good">// Good </p> <div class="codebox"><pre> @@ -663,8 +659,8 @@ switch ($mode) default: // Always assume that a case was not caught break; -} - </pre></div> +}</pre> + </div> <p class="good">// Also good, if you have more code between the case and the break </p> <div class="codebox"><pre> @@ -687,8 +683,8 @@ switch ($mode) // Always assume that a case was not caught break; -} - </pre></div> +}</pre> + </div> <p>Even if the break for the default case is not needed, it is sometimes better to include it just for readability and completeness.</p> @@ -715,8 +711,8 @@ switch ($mode) // Always assume that a case was not caught break; -} - </pre></div> +}</pre> + </div> <h4>Class Members</h4> <p>Use the explicit visibility qualifiers <code>public</code>, <code>private</code> and <code>protected</code> for all properties instead of <code>var</code>. @@ -726,14 +722,14 @@ switch ($mode) <p class="bad">//Wrong </p> <div class="codebox"><pre> var $x; -private static function f() - </pre></div> +private static function f()</pre> + </div> <p class="good">// Right </p> <div class="codebox"><pre> public $x; -static private function f() - </pre></div> +static private function f()</pre> + </div> <h4>Constants</h4> <p>Prefer class constants over global constants created with <code>define()</code>.</p> @@ -741,7 +737,7 @@ static private function f() <a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3> <h4>Common SQL Guidelines: </h4> - <p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), Firebird, SQLite, Oracle8, ODBC (generalised if possible)).</p> + <p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), SQLite, Oracle8, ODBC (generalised if possible)).</p> <p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p> <h4>SQL code layout:</h4> @@ -753,8 +749,8 @@ $sql = 'SELECT * <-one tab->WHERE a = 1 <-two tabs->AND (b = 2 <-three tabs->OR b = 3) -<-one tab->ORDER BY b'; - </pre></div> +<-one tab->ORDER BY b';</pre> + </div> <p>Here the example with the tabs applied:</p> @@ -764,8 +760,8 @@ $sql = 'SELECT * WHERE a = 1 AND (b = 2 OR b = 3) - ORDER BY b'; - </pre></div> + ORDER BY b';</pre> + </div> <h4>SQL Quotes: </h4> <p>Use double quotes where applicable. (The variables in these examples are typecasted to integers beforehand.) Examples: </p> @@ -774,16 +770,16 @@ $sql = 'SELECT * <div class="codebox"><pre> "UPDATE " . SOME_TABLE . " SET something = something_else WHERE a = $b"; -'UPDATE ' . SOME_TABLE . ' SET something = ' . $user_id . ' WHERE a = ' . $something; - </pre></div> +'UPDATE ' . SOME_TABLE . ' SET something = ' . $user_id . ' WHERE a = ' . $something;</pre> + </div> <p class="good">// These are right. </p> <div class="codebox"><pre> 'UPDATE ' . SOME_TABLE . " SET something = something_else WHERE a = $b"; -'UPDATE ' . SOME_TABLE . " SET something = $user_id WHERE a = $something"; - </pre></div> +'UPDATE ' . SOME_TABLE . " SET something = $user_id WHERE a = $something";</pre> + </div> <p>In other words use single quotes where no variable substitution is required or where the variable involved shouldn't appear within double quotes. Otherwise use double quotes.</p> @@ -794,15 +790,15 @@ $sql = 'SELECT * <div class="codebox"><pre> $sql = 'SELECT * FROM ' . SOME_TABLE . ' - WHERE a != 2'; - </pre></div> + WHERE a != 2';</pre> + </div> <p class="good">// This is right. </p> <div class="codebox"><pre> $sql = 'SELECT * FROM ' . SOME_TABLE . ' - WHERE a <> 2'; - </pre></div> + WHERE a <> 2';</pre> + </div> <h4>Common DBAL methods: </h4> @@ -813,8 +809,8 @@ $sql = 'SELECT * <div class="codebox"><pre> $sql = 'SELECT * FROM ' . SOME_TABLE . " - WHERE username = '" . $db->sql_escape($username) . "'"; - </pre></div> + WHERE username = '" . $db->sql_escape($username) . "'";</pre> + </div> <h4>sql_query_limit():</h4> @@ -835,8 +831,8 @@ $sql_ary = array( 'moredata' => $another_int, ); -$db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - </pre></div> +$db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));</pre> + </div> <p>To complete the example, this is how an update statement would look like:</p> @@ -850,8 +846,8 @@ $sql_ary = array( $sql = 'UPDATE ' . SOME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . (int) $user_id; -$db->sql_query($sql); - </pre></div> +$db->sql_query($sql);</pre> + </div> <p>The <code>$db->sql_build_array()</code> function supports the following modes: <code>INSERT</code> (example above), <code>INSERT_SELECT</code> (building query for <code>INSERT INTO table (...) SELECT value, column ...</code> statements), <code>UPDATE</code> (example above) and <code>SELECT</code> (for building WHERE statement [AND logic]).</p> @@ -874,8 +870,8 @@ $sql_ary[] = array( 'moredata' => $another_int_2, ); -$db->sql_multi_insert(SOME_TABLE, $sql_ary); - </pre></div> +$db->sql_multi_insert(SOME_TABLE, $sql_ary);</pre> + </div> <h4>sql_in_set():</h4> @@ -885,22 +881,22 @@ $db->sql_multi_insert(SOME_TABLE, $sql_ary); $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids); -$db->sql_query($sql); - </pre></div> +$db->sql_query($sql);</pre> + </div> <p>Based on the number of values in $forum_ids, the query can look differently.</p> <p class="good">// SQL Statement if $forum_ids = array(1, 2, 3);</p> <div class="codebox"><pre> -SELECT FROM phpbb_forums WHERE forum_id IN (1, 2, 3) - </pre></div> +SELECT FROM phpbb_forums WHERE forum_id IN (1, 2, 3)</pre> + </div> <p class="good">// SQL Statement if $forum_ids = array(1) or $forum_ids = 1</p> <div class="codebox"><pre> -SELECT FROM phpbb_forums WHERE forum_id = 1 - </pre></div> +SELECT FROM phpbb_forums WHERE forum_id = 1</pre> + </div> <p>Of course the same is possible for doing a negative match against a number of values:</p> @@ -908,22 +904,22 @@ SELECT FROM phpbb_forums WHERE forum_id = 1 $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids, <strong>true</strong>); -$db->sql_query($sql); - </pre></div> +$db->sql_query($sql);</pre> + </div> <p>Based on the number of values in $forum_ids, the query can look differently here too.</p> <p class="good">// SQL Statement if $forum_ids = array(1, 2, 3);</p> <div class="codebox"><pre> -SELECT FROM phpbb_forums WHERE forum_id <strong>NOT</strong> IN (1, 2, 3) - </pre></div> +SELECT FROM phpbb_forums WHERE forum_id <strong>NOT</strong> IN (1, 2, 3)</pre> + </div> <p class="good">// SQL Statement if $forum_ids = array(1) or $forum_ids = 1</p> <div class="codebox"><pre> -SELECT FROM phpbb_forums WHERE forum_id <strong><></strong> 1 - </pre></div> +SELECT FROM phpbb_forums WHERE forum_id <strong><></strong> 1</pre> + </div> <p>If the given array is empty, an error will be produced.</p> @@ -953,8 +949,8 @@ $sql_array = array( 'ORDER_BY' => 'left_id', ); -$sql = $db->sql_build_query('SELECT', $sql_array); - </pre></div> +$sql = $db->sql_build_query('SELECT', $sql_array);</pre> + </div> <p>The possible first parameter for sql_build_query() is SELECT or SELECT_DISTINCT. As you can see, the logic is pretty self-explaining. For the LEFT_JOIN key, just add another array if you want to join on to tables for example. The added benefit of using this construct is that you are able to easily build the query statement based on conditions - for example the above LEFT_JOIN is only necessary if server side topic tracking is enabled; a slight adjustement would be:</p> @@ -989,8 +985,8 @@ else // Here we read the cookie data } -$sql = $db->sql_build_query('SELECT', $sql_array); - </pre></div> +$sql = $db->sql_build_query('SELECT', $sql_array);</pre> + </div> <a name="optimizing"></a><h3>2.iv. Optimizations</h3> @@ -1002,16 +998,16 @@ $sql = $db->sql_build_query('SELECT', $sql_array); for ($i = 0; $i < sizeof($post_data); $i++) { do_something(); -} - </pre></div> +}</pre> + </div> <p class="good">// You are able to assign the (not changing) result within the loop itself</p> <div class="codebox"><pre> for ($i = 0, $size = sizeof($post_data); $i < $size; $i++) { do_something(); -} - </pre></div> +}</pre> + </div> <h4>Use of in_array(): </h4> <p>Try to avoid using in_array() on huge arrays, and try to not place them into loops if the array to check consist of more than 20 entries. in_array() can be very time consuming and uses a lot of cpu processing time. For little checks it is not noticeable, but if checked against a huge array within a loop those checks alone can take several seconds. If you need this functionality, try using isset() on the arrays keys instead, actually shifting the values into keys and vice versa. A call to <code>isset($array[$var])</code> is a lot faster than <code>in_array($var, array_keys($array))</code> for example.</p> @@ -1027,35 +1023,35 @@ for ($i = 0, $size = sizeof($post_data); $i < $size; $i++) <p>No attempt should be made to remove any copyright information (either contained within the source or displayed interactively when the source is run/compiled), neither should the copyright information be altered in any way (it may be added to).</p> <h4>Variables: </h4> - <p>Make use of the <code>request_var()</code> function for anything except for submit or single checking params.</p> - <p>The request_var function determines the type to set from the second parameter (which determines the default value too). If you need to get a scalar variable type, you need to tell this the request_var function explicitly. Examples:</p> + <p>Make use of the <code>\phpbb\request\request</code> class for everything.</p> + <p>The $request->variable() method determines the type to set from the second parameter (which determines the default value too). If you need to get a scalar variable type, you need to tell this the variable() method explicitly. Examples:</p> <p class="bad">// Old method, do not use it</p> <div class="codebox"><pre> $start = (isset($HTTP_GET_VARS['start'])) ? intval($HTTP_GET_VARS['start']) : intval($HTTP_POST_VARS['start']); -$submit = (isset($HTTP_POST_VARS['submit'])) ? true : false; - </pre></div> +$submit = (isset($HTTP_POST_VARS['submit'])) ? true : false;</pre> + </div> <p class="good">// Use request var and define a default variable (use the correct type)</p> <div class="codebox"><pre> -$start = request_var('start', 0); -$submit = (isset($_POST['submit'])) ? true : false; - </pre></div> +$start = $request->variable('start', 0); +$submit = $request->is_set_post('submit');</pre> + </div> - <p class="bad">// $start is an int, the following use of request_var therefore is not allowed</p> + <p class="bad">// $start is an int, the following use of $request->variable() therefore is not allowed</p> <div class="codebox"><pre> -$start = request_var('start', '0'); - </pre></div> +$start = $request->variable('start', '0');</pre> + </div> <p class="good">// Getting an array, keys are integers, value defaults to 0</p> <div class="codebox"><pre> -$mark_array = request_var('mark', array(0)); - </pre></div> +$mark_array = $request->variable('mark', array(0));</pre> + </div> <p class="good">// Getting an array, keys are strings, value defaults to 0</p> <div class="codebox"><pre> -$action_ary = request_var('action', array('' => 0)); - </pre></div> +$action_ary = $request->variable('action', array('' => 0));</pre> + </div> <h4>Login checks/redirection: </h4> <p>To show a forum login box use <code>login_forum_box($forum_data)</code>, else use the <code>login_box()</code> function.</p> @@ -1078,8 +1074,8 @@ $action_ary = request_var('action', array('' => 0)); { trigger_error('FORM_INVALID'); } - } - </pre></div> + }</pre> + </div> <p>The string passed to <code>add_form_key()</code> needs to match the string passed to <code>check_form_key()</code>. Another requirement for this to work correctly is that all forms include the <code>{S_FORM_TOKEN}</code> template variable.</p> @@ -1090,8 +1086,8 @@ $action_ary = request_var('action', array('' => 0)); <div class="codebox"><pre> $user->session_begin(); $auth->acl($user->data); -$user->setup(); - </pre></div> +$user->setup();</pre> + </div> <p>The <code>$user->setup()</code> call can be used to pass on additional language definition and a custom style (used in viewforum).</p> @@ -1099,16 +1095,16 @@ $user->setup(); <p>All messages/errors should be outputted by calling <code>trigger_error()</code> using the appropriate message type and language string. Example:</p> <div class="codebox"><pre> -trigger_error('NO_FORUM'); - </pre></div> +trigger_error('NO_FORUM');</pre> + </div> <div class="codebox"><pre> -trigger_error($user->lang['NO_FORUM']); - </pre></div> +trigger_error($user->lang['NO_FORUM']);</pre> + </div> <div class="codebox"><pre> -trigger_error('NO_MODE', E_USER_ERROR); - </pre></div> +trigger_error('NO_MODE', E_USER_ERROR);</pre> + </div> <h4>Url formatting</h4> @@ -1117,8 +1113,8 @@ trigger_error('NO_MODE', E_USER_ERROR); <p>The <code>append_sid()</code> function from 2.0.x is available too, though it does not handle url alterations automatically. Please have a look at the code documentation if you want to get more details on how to use append_sid(). A sample call to append_sid() can look like this:</p> <div class="codebox"><pre> -append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) - </pre></div> +append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id'])</pre> + </div> <h4>General function usage: </h4> @@ -1162,18 +1158,26 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp; <p>The <strong>e</strong> modifier in <strong>preg_replace</strong> can be replaced by <strong>preg_replace_callback</strong> and objects to encapsulate state that is needed in the callback code.</p> + <h4>Other functions, operators, statements and keywords:</h4> + + <p>The following PHP statements should also not be used in phpBB:</p> + + <ul> + <li><strong>goto</strong></li> + </ul> + </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> <a name="styling"></a><h2>3. Styling</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> <a name="cfgfiles"></a><h3>3.i. Style Config Files</h3> @@ -1181,16 +1185,17 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp; <div class="codebox"><pre> # General Information about this style name = prosilver_duplicate -copyright = © phpBB Group, 2007 -version = 3.1.0 +copyright = © phpBB Limited, 2007 +style_version = 3.1.0 +phpbb_version = 3.1.0 # Defining a different template bitfield # 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> +parent = prosilver</pre> + </div> <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> @@ -1248,14 +1253,14 @@ parent = prosilver <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> <a name="templating"></a><h2>4. Templating</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> <a name="templates"></a><h3>4.i. General Templating</h3> @@ -1670,8 +1675,9 @@ div <div class="codebox"><pre> # General Information about this style name = Custom Style -copyright = &copy; phpBB Group, 2007 -version = 3.1.0 +copyright = © phpBB Limited, 2007 +style_version = 3.1.0-b1 +phpbb_version = 3.1.0-b1 # Defining a different template bitfield # template_bitfield = lNg= @@ -1689,13 +1695,15 @@ parent = prosilver <ul> <li>An event name must be all lowercase, with each word separated by an underscore.</li> <li>An event name must briefly describe the location and purpose of the event.</li> - <li>An event name must end with one of the following suffixes:</li> - <ul> - <li><code>_prepend</code> - This event adds an item to the beginning of a block of related items, or adds to the beginning of individual items in a block.</li> - <li><code>_append</code> - This event adds an item to the end of a block of related items, or adds to the end of individual items in a block.</li> - <li><code>_before</code> - This event adds content directly before the specified block</li> - <li><code>_after</code> - This event adds content directly after the specified block</li> - </ul> + <li> + An event name must end with one of the following suffixes: + <ul> + <li><code>_prepend</code> - This event adds an item to the beginning of a block of related items, or adds to the beginning of individual items in a block.</li> + <li><code>_append</code> - This event adds an item to the end of a block of related items, or adds to the end of individual items in a block.</li> + <li><code>_before</code> - This event adds content directly before the specified block</li> + <li><code>_after</code> - This event adds content directly after the specified block</li> + </ul> + </li> </ul> <h4>Template event documentation</h4> @@ -1707,6 +1715,7 @@ parent = prosilver * Location: styles/<style_name>/template/filename.html * Purpose: A brief description of what this event should be used for. This may span multiple lines. +* Since: Version since when the event was added </pre></div></li> <li>An event found in multiple template files: <div class="codebox"><pre>event_name @@ -1715,6 +1724,7 @@ This may span multiple lines. + first/file/path.html + second/file/path.html * Purpose: Same as above. +* Since: 3.1.0-b1 </pre></div> <li>An event that is found multiple times in a file should have the number of instances in parenthesis next to the filename. <div class="codebox"><pre>event_name @@ -1723,6 +1733,7 @@ This may span multiple lines. + first/file/path.html (2) + second/file/path.html * Purpose: Same as above. +* Since: 3.1.0-b1 </pre></div></li> <li>An actual example event documentation: <div class="codebox"><pre>forumlist_body_last_post_title_prepend @@ -1730,13 +1741,15 @@ This may span multiple lines. * Locations: + styles/prosilver/template/forumlist_body.html + styles/subsilver2/template/forumlist_body.html -* Purpose: Add content before the post title of the latest post in a forum on the forum list.</pre></div></ul><br /> +* Purpose: Add content before the post title of the latest post in a forum on the forum list. +* Since: 3.1.0-a1 +</pre></div></ul><br /> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -1746,7 +1759,7 @@ This may span multiple lines. <a name="charsets"></a><h2>5. Character Sets and Encodings</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -1760,16 +1773,16 @@ This may span multiple lines. <p>phpBB only uses the ASCII and the UTF-8 character encodings. Still all Strings are UTF-8 encoded because ASCII is a subset of UTF-8. The only exceptions to this rule are code sections which deal with external systems which use other encodings and character sets. Such external data should be converted to UTF-8 using the <code>utf8_recode()</code> function supplied with phpBB. It supports a variety of other character sets and encodings, a full list can be found below.</p> -<p>With <code>request_var()</code> you can either allow all UCS characters in user input or restrict user input to ASCII characters. This feature is controlled by the function's third parameter called <code>$multibyte</code>. You should allow multibyte characters in posts, PMs, topic titles, forum names, etc. but it's not necessary for internal uses like a <code>$mode</code> variable which should only hold a predefined list of ASCII strings anyway.</p> +<p>With <code>$request->variable()</code> you can either allow all UCS characters in user input or restrict user input to ASCII characters. This feature is controlled by the method's third parameter called <code>$multibyte</code>. You should allow multibyte characters in posts, PMs, topic titles, forum names, etc. but it's not necessary for internal uses like a <code>$mode</code> variable which should only hold a predefined list of ASCII strings anyway.</p> <div class="codebox"><pre> // an input string containing a multibyte character $_REQUEST['multibyte_string'] = 'Käse'; // print request variable as a UTF-8 string allowing multibyte characters -echo request_var('multibyte_string', '', true); +echo $request->variable('multibyte_string', '', true); // print request variable as ASCII string -echo request_var('multibyte_string', ''); +echo $request->variable('multibyte_string', ''); </pre></div> <p>This code snippet will generate the following output:</p> @@ -1779,19 +1792,6 @@ Käse K??se </pre></div> -<h4>Unicode Normalization</h4> - -<p>If you retrieve user input with multibyte characters you should additionally normalize the string using <code>utf8_normalize_nfc()</code> before you work with it. This is necessary to make sure that equal characters can only occur in one particular binary representation. For example the character Å can be represented either as <code>U+00C5</code> (LATIN CAPITAL LETTER A WITH RING ABOVE) or as <code>U+212B</code> (ANGSTROM SIGN). phpBB uses Normalization Form Canonical Composition (NFC) for all text. So the correct version of the above example would look like this:</p> - -<div class="codebox"><pre> -$_REQUEST['multibyte_string'] = 'Käse'; - -// normalize multibyte strings -echo utf8_normalize_nfc(request_var('multibyte_string', '', true)); -// ASCII strings do not need to be normalized -echo request_var('multibyte_string', ''); -</pre></div> - <h4>Case Folding</h4> <p>Case insensitive comparison of strings is no longer possible with <code>strtolower</code> or <code>strtoupper</code> as some characters have multiple lower case or multiple upper case forms depending on their position in a word. The <code>utf8_strtolower</code> and the <code>utf8_strtoupper</code> functions suffer from the same problem so they can only be used to display upper/lower case versions of a string but they cannot be used for case insensitive comparisons either. So instead you should use case folding which gives you a case insensitive version of the string which can be used for case insensitive comparisons. An NFC normalized string can be case folded using <code>utf8_case_fold_nfc()</code>.</p> @@ -1822,7 +1822,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -1830,7 +1830,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <a name="translation"></a><h2>6. Translation (<abbr title="Internationalisation">i18n</abbr>/<abbr title="Localisation">L10n</abbr>) Guidelines</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> @@ -2348,7 +2348,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <p>Within some cases, there may be mixed scripts of a left-to-right and right-to-left direction, so using <code>LRE</code> & <code>RLE</code> with <code>PDF</code> may be more appropriate. Lastly, in very rare instances where directionality must be forced, then use <code>LRO</code> & <code>RLO</code> with <code>PDF</code>.</p> <p>For further information on authoring techniques of bi-directional text, please see the W3C tutorial on <a href="http://www.w3.org/International/tutorials/bidi-xhtml/">authoring techniques for XHTML pages with bi-directional text</a>.</p> - <h4>Working with placeholders:</h4> + <a name="placeholders"></a><h3>6.iii. Working with placeholders</h3> <p>As phpBB is translated into languages with different ordering rules to that of English, it is possible to show specific values in any order deemed appropriate. Take for example the extremely simple "Page <em>X</em> of <em>Y</em>", whilst in English this could just be coded as:</p> @@ -2357,8 +2357,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) 'PAGE_OF' => 'Page %s of %s', /* Just grabbing the replacements as they come and hope they are in the right order */ - ... - </pre></div> + ...</pre> + </div> <p>… a clearer way to show explicit replacement ordering is to do:</p> @@ -2367,8 +2367,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) 'PAGE_OF' => 'Page %1$s of %2$s', /* Explicit ordering of the replacements, even if they are the same order as English */ - ... - </pre></div> + ...</pre> + </div> <p>Why bother at all? Because some languages, the string transliterated back to English might read something like:</p> @@ -2377,10 +2377,62 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) 'PAGE_OF' => 'Total of %2$s pages, currently on page %1$s', /* Explicit ordering of the replacements, reversed compared to English as the total comes first */ + ...</pre> + </div> + + <a name="usingplurals"></a><h3>6.iv. Using plurals</h3> + + <p> + The english language is very simple when it comes to plurals.<br /> + You have <code>0 elephants</code>, <code>1 elephant</code>, or <code>2+ elephants</code>. So basically you have 2 different forms: one singular and one plural.<br /> + But for some other languages this is quite more difficult. Let's take the Bosnian language as another example:<br /> + You have <code>[1/21/31] slon</code>, <code>[2/3/4] slona</code>, <code>[0/5/6] slonova</code> and <code>[7/8/9/11] ...</code> and some more difficult rules. + </p> + + <p>The <a href="https://wiki.phpbb.com/Plural_Rules">plural system</a> takes care of this and can be used as follows:</p> + + <p>The PHP code will basically look like this:</p> + + <div class="codebox"><pre> + ... + $user->lang('NUMBER_OF_ELEPHANTS', $number_of_elephants); + ...</pre> + </div> + + <p>And the English translation would be:</p> + + <div class="codebox"><pre> + ... + 'NUMBER_OF_ELEPHANTS' => array( + 0 => 'You have no elephants', // Optional special case for 0 + 1 => 'You have 1 elephant', // Singular + 2 => 'You have %d elephants', // Plural + ), + ...</pre> + </div> + + <p>While the Bosnian translation can have more cases:</p> + + <div class="codebox"><pre> ... - </pre></div> + 'NUMBER_OF_ELEPHANTS' => array( + 0 => 'You have no slonova', // Optional special case for 0 + 1 => 'You have %d slon', // Used for 1, 21, 31, .. + 2 => 'You have %d slona', // Used for 5, 6, + 3 => ... + ), + ...</pre> + </div> - <a name="writingstyle"></a><h3>6.iii. Writing Style</h3> + <p><strong>NOTE:</strong> It is okay to use plurals for an unknown number compared to a single item, when the number is not known and displayed:</p> + <div class="codebox"><pre> + ... + 'MODERATOR' => 'Moderator', // Your board has 1 moderator + 'MODERATORS' => 'Moderators', // Your board has multiple moderators + ...</pre> + </div> + + <a name="writingstyle"></a><h3>6.v. Writing Style</h3> <h4>Miscellaneous tips & hints:</h4> @@ -2392,8 +2444,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ... 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor['avatar_path'] to use %s.', - ... - </pre></div> + ...</pre> + </div> <p class="good">// Good - Literal straight quotes should be escaped with a backslash, ie: \</p> @@ -2401,8 +2453,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ... 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', - ... - </pre></div> + ...</pre> + </div> <p>However, because phpBB3 now uses UTF-8 as its sole encoding, we can actually use this to our advantage and not have to remember to escape a straight quote when we don't have to:</p> @@ -2411,24 +2463,24 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="codebox"><pre> ... 'USE_PERMISSIONS' => 'Test out user's permissions', - ... - </pre></div> + ...</pre> + </div> <p class="good">// Okay - However, non-programmers wouldn't type "user\'s" automatically</p> <div class="codebox"><pre> ... 'USE_PERMISSIONS' => 'Test out user\'s permissions', - ... - </pre></div> + ...</pre> + </div> <p class="good">// Best - Use the Unicode Right-Single-Quotation-Mark character</p> <div class="codebox"><pre> ... 'USE_PERMISSIONS' => 'Test out user’s permissions', - ... - </pre></div> + ...</pre> + </div> <p>The <code>"</code> (straight double quote), <code><</code> (less-than sign) and <code>></code> (greater-than sign) characters can all be used as displayed glyphs or as part of HTML markup, for example:</p> @@ -2438,8 +2490,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ... 'FOO_BAR' => 'PHP version < 5.3.3.<br /> Visit "Downloads" at <a href="http://www.php.net/">www.php.net</a>.', - ... - </pre></div> + ...</pre> + </div> <p class="good">// Okay - No more invalid HTML, but "&quot;" is rather clumsy</p> @@ -2447,8 +2499,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ... 'FOO_BAR' => 'PHP version &lt; 5.3.3.<br /> Visit &quot;Downloads&quot; at <a href="http://www.php.net/">www.php.net</a>.', - ... - </pre></div> + ...</pre> + </div> <p class="good">// Best - No more invalid HTML, and usage of correct typographical quotation marks</p> @@ -2456,8 +2508,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ... 'FOO_BAR' => 'PHP version &lt; 5.3.3.<br /> Visit “Downloads” at <a href="http://www.php.net/">www.php.net</a>.', - ... - </pre></div> + ...</pre> + </div> <p>Lastly, the <code>&</code> (ampersand) must always be entitised regardless of where it is used:</p> @@ -2466,16 +2518,16 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="codebox"><pre> ... 'FOO_BAR' => '<a href="http://somedomain.tld/?foo=1&bar=2">Foo & Bar</a>.', - ... - </pre></div> + ...</pre> + </div> <p class="good">// Good - Valid HTML, amperands are correctly entitised in all cases</p> <div class="codebox"><pre> ... 'FOO_BAR' => '<a href="http://somedomain.tld/?foo=1&amp;bar=2">Foo &amp; Bar</a>.', - ... - </pre></div> + ...</pre> + </div> <p>As for how these charcters are entered depends very much on choice of Operating System, current language locale/keyboard configuration and native abilities of the text editor used to edit phpBB language files. Please see <a href="http://en.wikipedia.org/wiki/Unicode#Input_methods">http://en.wikipedia.org/wiki/Unicode#Input_methods</a> for more information.</p> @@ -2487,7 +2539,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <hr /> @@ -2495,17 +2547,17 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <a name="disclaimer"></a><h2>7. Copyright and disclaimer</h2> <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> + <div class="inner"> <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>phpBB is free software, released under the terms of the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License, version 2 (GPL-2.0)</a>. Copyright © <a href="https://www.phpbb.com">phpBB Limited</a>. For full copyright and license information, please see the docs/CREDITS.txt file.</p> </div> <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- END DOCUMENT --> @@ -2516,7 +2568,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) </div></div> <div> - <a id="bottom" name="bottom" accesskey="z"></a> + <a id="bottom" accesskey="z"></a> </div> </body> diff --git a/phpBB/docs/corners_left.gif b/phpBB/docs/corners_left.gif Binary files differdeleted file mode 100644 index 206e50368d..0000000000 --- a/phpBB/docs/corners_left.gif +++ /dev/null diff --git a/phpBB/docs/corners_left.png b/phpBB/docs/corners_left.png Binary files differdeleted file mode 100644 index 256bde3daa..0000000000 --- a/phpBB/docs/corners_left.png +++ /dev/null diff --git a/phpBB/docs/corners_right.gif b/phpBB/docs/corners_right.gif Binary files differdeleted file mode 100644 index 0ba66d50b2..0000000000 --- a/phpBB/docs/corners_right.gif +++ /dev/null diff --git a/phpBB/docs/corners_right.png b/phpBB/docs/corners_right.png Binary files differdeleted file mode 100644 index df41823b4c..0000000000 --- a/phpBB/docs/corners_right.png +++ /dev/null diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index db7107b96d..f1dee8cee8 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -1,3 +1,15 @@ +acp_ban_cell_append +=== +* Location: adm/style/acp_ban.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the end of the ban cell area + +acp_ban_cell_prepend +=== +* Location: adm/style/acp_ban.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the start of the ban cell area + acp_bbcodes_actions_append === * Location: adm/style/acp_bbcodes.html @@ -16,11 +28,173 @@ acp_bbcodes_edit_fieldsets_after * Since: 3.1.0-a3 * Purpose: Add settings to BBCode add/edit form +acp_email_group_options_append +=== +* Location: adm/style/acp_email.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the end of the group options select box + +acp_email_group_options_prepend +=== +* Location: adm/style/acp_email.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the start of the group options select box + +acp_email_find_username_append +=== +* Location: adm/style/acp_email.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the end of the fimd username link + +acp_email_find_username_prepend +=== +* Location: adm/style/acp_email.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the start of the fimd username link + +acp_email_options_after +=== +* Location: adm/style/acp_email.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to mass email form + +acp_forums_custom_settings +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.6-RC1 +* Purpose: Add its own box (fieldset) for extension settings + +acp_forums_main_settings_append +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to forums at end of main settings section + +acp_forums_main_settings_prepend +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to forums before main settings section + acp_forums_normal_settings_append === * Location: adm/style/acp_forums.html * Since: 3.1.0-a1 -* Purpose: Add settings to forums +* Purpose: Add settings to forums at end of normal settings section + +acp_forums_normal_settings_prepend +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to forums before normal settings section + +acp_forums_prune_settings_append +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to forums at end of prune settings section + +acp_forums_prune_settings_prepend +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to forums before prune settings section + +acp_forums_quick_select_button_append +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the quick select forum submit button + +acp_forums_quick_select_button_prepend +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the quick select forum submit button + +acp_forums_rules_settings_append +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to forums at end of rules settings section + +acp_forums_rules_settings_prepend +=== +* Location: adm/style/acp_forums.html +* Since: 3.1.2-RC1 +* Purpose: Add settings to forums before rules settings section + +acp_group_options_before +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.0-b4 +* Purpose: Add addtional options to group settings (before GROUP_FOUNDER_MANAGE) + +acp_group_options_after +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.0-b4 +* Purpose: Add addtional options to group settings (after GROUP_RECEIVE_PM) + +acp_groups_find_username_append +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the end of the find username link + +acp_groups_find_username_prepend +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the start of the find username link + +acp_groups_manage_after +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the manage groups table + +acp_groups_manage_before +=== +* Location: adm/style/acp_groups.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the manage groups table + +acp_groups_position_legend_add_button_after +=== +* Location: adm/style/acp_groups_position.html +* Since: 3.1.7-RC1 +* Purpose: Add content after adding group to legend submit button + +acp_groups_position_legend_add_button_before +=== +* Location: adm/style/acp_groups_position.html +* Since: 3.1.7-RC1 +* Purpose: Add content before adding group to legend submit button + +acp_groups_position_teampage_add_button_after +=== +* Location: adm/style/acp_groups_position.html +* Since: 3.1.7-RC1 +* Purpose: Add content after adding group to teampage submit button + +acp_groups_position_teampage_add_button_before +=== +* Location: adm/style/acp_groups_position.html +* Since: 3.1.7-RC1 +* Purpose: Add content before adding group to teampage submit button + +acp_logs_quick_select_forum_button_append +=== +* Location: adm/style/acp_logs.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the quick forum select form submit button + +acp_logs_quick_select_forum_button_prepend +=== +* Location: adm/style/acp_logs.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the quick forum select form submit button acp_main_actions_append === @@ -40,81 +214,682 @@ acp_overall_footer_after * Since: 3.1.0-a1 * Purpose: Add content below the footer in the ACP +acp_overall_header_body_before +=== +* Location: adm/style/overall_header.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + acp_overall_header_head_append === * Location: adm/style/overall_header.html * Since: 3.1.0-a1 * Purpose: Add assets within the `<head>` tags in the ACP +acp_overall_header_stylesheets_after +=== +* Location: adm/style/overall_header.html +* Since: 3.1.0-RC3 +* Purpose: Add assets after stylesheets within the `<head>` tags in the ACP. +Note that INCLUDECSS will not work with this event. + +acp_permission_forum_copy_src_forum_append +=== +* Location: adm/style/permission_forum_copy.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the sourse forum select form + +acp_permission_forum_copy_src_forum_prepend +=== +* Location: adm/style/permission_forum_copy.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the sourse forum select form + +acp_permission_forum_copy_dest_forum_append +=== +* Location: adm/style/permission_forum_copy.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the destiny forum select form + +acp_permission_forum_copy_dest_forum_prepend +=== +* Location: adm/style/permission_forum_copy.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the destiny forum select form + +acp_permissions_add_group_options_append +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the group multiple select form + +acp_permissions_add_group_options_prepend +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the group multiple select form + +acp_permissions_find_username_append +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the find username link + +acp_permissions_find_username_prepend +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the find username link + +acp_permissions_select_forum_append +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the forum select form label + +acp_permissions_select_forum_prepend +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the forum select form label + +acp_permissions_select_group_after +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the group select form in usergroup view + +acp_permissions_select_group_append +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the group select form label + +acp_permissions_select_group_before +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the group select form in usergroup view + +acp_permissions_select_group_prepend +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the group select form label + +acp_permissions_select_multiple_forum_append +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the forum multiple select form label + +acp_permissions_select_multiple_forum_prepend +=== +* Location: adm/style/acp_permissions.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the forum multiple select form label + +acp_posting_buttons_after +=== +* Locations: + + adm/style/acp_posting_buttons.html +* Since: 3.1.0-b4 +* Purpose: Add content after BBCode posting buttons in the ACP + +acp_posting_buttons_before +=== +* Locations: + + adm/style/acp_posting_buttons.html +* Since: 3.1.0-b4 +* Purpose: Add content before BBCode posting buttons in the ACP + +acp_profile_contact_before +=== +* Locations: + + adm/style/acp_profile.html +* Since: 3.1.6-RC1 +* Purpose: Add extra options to custom profile field configuration in the ACP + +acp_prune_forums_append +=== +* Locations: + + adm/style/acp_prune_forums.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the forum select form label + +acp_prune_forums_prepend +=== +* Locations: + + adm/style/acp_prune_forums.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the forum select form label + +acp_prune_users_find_username_append +=== +* Locations: + + adm/style/acp_prune_users.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the find username link + +acp_prune_users_find_username_prepend +=== +* Locations: + + adm/style/acp_prune_users.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the find username link + +acp_ranks_edit_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content after the rank details when editing a rank in the ACP + +acp_ranks_edit_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the rank details when editing a rank in the ACP + +acp_ranks_list_column_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the first column in the ranks list in the ACP + +acp_ranks_list_column_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content after the last column (but before the action column) +in the ranks list in the ACP + +acp_ranks_list_header_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the first header-column in the ranks list in the ACP + +acp_ranks_list_header_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC3 +* Purpose: Add content after the last header-column (but before the action column) +in the ranks list in the ACP + +acp_styles_list_before +=== +* Locations: + + adm/style/acp_styles.html +* Since: 3.1.7-RC1 +* Purpose: Add content before list of styles + +acp_users_profile_before +=== +* Locations: + + adm/style/acp_users_profile.html +* Since: 3.1.4-RC1 +* Purpose: Add content before the profile details when editing a user in the ACP + +acp_users_profile_after +=== +* Locations: + + adm/style/acp_users_profile.html +* Since: 3.1.4-RC1 +* Purpose: Add content after the profile details but before the custom profile fields when editing a user in the ACP + +acp_users_profile_custom_after +=== +* Locations: + + adm/style/acp_users_profile.html +* Since: 3.1.4-RC1 +* Purpose: Add content after the the custom profile fields when editing a user in the ACP + acp_simple_footer_after === * Location: adm/style/simple_footer.html * Since: 3.1.0-a1 * Purpose: Add content below the simple footer in the ACP +acp_simple_header_body_before +=== +* Location: adm/style/simple_header.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + acp_simple_header_head_append === -* Location: adm/style/overall_header.html +* Location: adm/style/simple_header.html * Since: 3.1.0-a1 * Purpose: Add assets within the `<head>` tags in the simple header of the ACP +acp_simple_header_stylesheets_after +=== +* Location: adm/style/simple_header.html +* Since: 3.1.0-RC3 +* Purpose: Add assets after stylesheets within the `<head>` tags in the simple header +of the ACP. Note that INCLUDECSS will not work with this event. + acp_users_overview_options_append === -* Location: adm/style/acp_users.html +* Location: adm/style/acp_users_overview.html * Since: 3.1.0-a1 * Purpose: Add options and settings on user overview page -acp_users_signature_editor_buttons_after +acp_users_prefs_append +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the bottom of ACP users prefs settings + +acp_users_prefs_prepend +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the top of ACP users prefs settings + +acp_users_prefs_personal_append +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the bottom of ACP users personal prefs settings + +acp_users_prefs_personal_prepend +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the top of ACP users personal prefs settings + +acp_users_prefs_post_append +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the bottom of ACP users post prefs settings + +acp_users_prefs_post_prepend +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the top of ACP users post prefs settings + +acp_users_prefs_view_append +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the bottom of ACP users view prefs settings + +acp_users_prefs_view_prepend +=== +* Location: adm/style/acp_users_prefs.html +* Since: 3.1.0-b3 +* Purpose: Add user options fieldset to the top of ACP users view prefs settings + +acp_users_select_group_after +=== +* Location: adm/style/acp_users.html +* Since: 3.1.7-RC1 +* Purpose: Add content after group select form + +acp_users_select_group_before +=== +* Location: adm/style/acp_users.html +* Since: 3.1.7-RC1 +* Purpose: Add content before group select form + +attachment_file_after === * Locations: - + adm/style/acp_users_signature.html -* Since: 3.1.0-a3 -* Purpose: Add content after BBCode posting buttons in the ACP user signature + + styles/prosilver/template/attachment.html +* Since: 3.1.6-RC1 +* Purpose: Add content after the attachment. -acp_users_signature_editor_buttons_before +attachment_file_append === * Locations: - + adm/style/acp_users_signature.html -* Since: 3.1.0-a3 -* Purpose: Add content before BBCode posting buttons in the ACP user signature + + styles/prosilver/template/attachment.html +* Since: 3.1.6-RC1 +* Purpose: Add custom attachment types displaying to the bottom of attachment block. + +attachment_file_before +=== +* Locations: + + styles/prosilver/template/attachment.html +* Since: 3.1.6-RC1 +* Purpose: Add content before the attachment. + +attachment_file_prepend +=== +* Locations: + + styles/prosilver/template/attachment.html +* Since: 3.1.6-RC1 +* Purpose: Add custom attachment types displaying to the top of attachment block. + +forumlist_body_category_header_after +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-a4 +* Purpose: Add content after the header of the category on the forum list. + +forumlist_body_category_header_before +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-a4 +* Purpose: Add content before the header of the category on the forum list. + +forumlist_body_category_header_row_append +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.5-RC1 +* Purpose: Add content after the header row of the category on the forum list. + +forumlist_body_category_header_row_prepend +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.5-RC1 +* Purpose: Add content before the header row of the category on the forum list. + +forumlist_body_forum_row_after +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content after the forum list item. + +forumlist_body_forum_row_append +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content at the start of the forum list item. + +forumlist_body_forum_row_before +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content before the forum list item. + +forumlist_body_forum_row_prepend +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content at the end of the forum list item. forumlist_body_last_post_title_prepend -==== +=== * Locations: + styles/prosilver/template/forumlist_body.html - + styles/subsilver2/template/forumlist_body.html * Since: 3.1.0-a1 * Purpose: Add content before the post title of the latest post in a forum on the forum list. -index_body_linklist_after +forumlist_body_subforums_after +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-a4 +* Purpose: Add content after the list of subforums (if any) for each forum on the forum list. + +forumlist_body_subforums_before +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-a4 +* Purpose: Add content before the list of subforums (if any) for each forum on the forum list. + +forumlist_body_last_row_after +=== +* Locations: + + styles/prosilver/template/forumlist_body.html +* Since: 3.1.0-b2 +* Purpose: Add content after the very last row of the forum list. + +index_body_block_birthday_append === * Locations: + styles/prosilver/template/index_body.html - + styles/subsilver2/template/index_body.html -* Since: 3.1.0-a3 -* Purpose: Add content after the linklist above the forum list on Board index +* Since: 3.1.0-b3 +* Purpose: Append content to the birthday list on the Board index -index_body_linklist_before +index_body_block_birthday_prepend === * Locations: + styles/prosilver/template/index_body.html - + styles/subsilver2/template/index_body.html -* Since: 3.1.0-a3 -* Purpose: Add content before the linklist above the forum list on Board index +* Since: 3.1.0-b3 +* Purpose: Prepend content to the birthday list on the Board index + +index_body_block_online_append +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.0-b3 +* Purpose: Append content to the online list on the Board index + +index_body_block_online_prepend +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.0-b3 +* Purpose: Prepend content to the online list on the Board index + +index_body_block_stats_append +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.0-b3 +* Purpose: Append content to the statistics list on the Board index + +index_body_block_stats_prepend +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.0-b3 +* Purpose: Prepend content to the statistics list on the Board index + +index_body_forumlist_body_after +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.1 +* Purpose: Add content after the forum list body on the index page + +index_body_markforums_after +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.0-RC2 +* Purpose: Add content after the mark-read link above the forum list on Board index + +index_body_markforums_before +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.0-RC2 +* Purpose: Add content before the mark-read link above the forum list on Board index + +index_body_stat_blocks_after +=== +* Locations: + + styles/prosilver/template/index_body.html +* Since: 3.1.0-b3 +* Purpose: Add new statistic blocks below the Who Is Online and Board Statistics blocks index_body_stat_blocks_before === * Locations: + styles/prosilver/template/index_body.html - + styles/subsilver2/template/index_body.html * Since: 3.1.0-a1 * Purpose: Add new statistic blocks above the Who Is Online and Board Statistics blocks +mcp_ban_fields_after +=== +* Locations: + + styles/prosilver/template/mcp_ban.html +* Since: 3.1.0-RC3 +* Purpose: Add additional fields to the ban form in MCP + +mcp_ban_fields_before +=== +* Locations: + + styles/prosilver/template/mcp_ban.html +* Since: 3.1.0-RC3 +* Purpose: Add additional fields to the ban form in MCP + +mcp_ban_unban_after +=== +* Locations: + + styles/prosilver/template/mcp_ban.html +* Since: 3.1.0-RC3 +* Purpose: Add additional fields to the unban form in MCP + +mcp_ban_unban_before +=== +* Locations: + + styles/prosilver/template/mcp_ban.html +* Since: 3.1.0-RC3 +* Purpose: Add additional fields to the unban form in MCP + +mcp_forum_topic_title_before +=== +* Locations: + + styles/prosilver/template/mcp_forum.html +* Since: 3.1.6-RC1 +* Purpose: Add some information before the topic title + +mcp_forum_topic_title_after +=== +* Locations: + + styles/prosilver/template/mcp_forum.html +* Since: 3.1.6-RC1 +* Purpose: Add some information after the topic title + +mcp_front_latest_logs_after +=== +* Locations: + + styles/prosilver/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content after latest logs list + +mcp_front_latest_logs_before +=== +* Locations: + + styles/prosilver/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest logs list + +mcp_front_latest_reported_before +=== +* Locations: + + styles/prosilver/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest reported posts list + +mcp_front_latest_reported_pms_before +=== +* Locations: + + styles/prosilver/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest reported private messages list + +mcp_front_latest_unapproved_before +=== +* Locations: + + styles/prosilver/template/mcp_front.html +* Since: 3.1.3-RC1 +* Purpose: Add content before latest unapproved posts list + +mcp_post_additional_options +=== +* Locations: + + styles/prosilver/template/mcp_post.html +* Since: 3.1.5-RC1 +* Purpose: Add content within the list of post moderation actions + +mcp_topic_options_after +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.1.6-RC1 +* Purpose: Add some options (field, checkbox, ...) after the subject field when split a subject + +mcp_topic_options_before +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.1.6-RC1 +* Purpose: Add some options (field, checkbox, ...) before the subject field when split a subject + +mcp_topic_topic_title_after +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.1.6-RC1 +* Purpose: Add some information after the topic title + +mcp_topic_topic_title_before +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.1.6-RC1 +* Purpose: Add some information before the topic title + +mcp_warn_post_add_warning_field_after +=== +* Locations: + + styles/prosilver/template/mcp_warn_post.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning for a post - after add warning field. + +mcp_warn_post_add_warning_field_before +=== +* Locations: + + styles/prosilver/template/mcp_warn_post.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning for a post - before add warning field. + +mcp_warn_user_add_warning_field_after +=== +* Locations: + + styles/prosilver/template/mcp_warn_user.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning a user - after add warning field. + +mcp_warn_user_add_warning_field_before +=== +* Locations: + + styles/prosilver/template/mcp_warn_user.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning a user - before add warning field. + +memberlist_body_rank_append +=== +* Locations: + + styles/prosilver/template/memberlist_body.html +* Since: 3.1.6-RC1 +* Purpose: Add information after rank in memberlist. Works in +all display modes (leader, group and normal memberlist). + +memberlist_body_rank_prepend +=== +* Locations: + + styles/prosilver/template/memberlist_body.html +* Since: 3.1.6-RC1 +* Purpose: Add information before rank in memberlist. Works in +all display modes (leader, group and normal memberlist). + memberlist_body_username_append === * Locations: + styles/prosilver/template/memberlist_body.html - + styles/subsilver2/template/memberlist_body.html * Since: 3.1.0-a1 * Purpose: Add information after every username in the memberlist. Works in all display modes (leader, group and normal memberlist). @@ -123,16 +898,91 @@ memberlist_body_username_prepend === * Locations: + styles/prosilver/template/memberlist_body.html - + styles/subsilver2/template/memberlist_body.html * Since: 3.1.0-a1 * Purpose: Add information before every username in the memberlist. Works in all display modes (leader, group and normal memberlist). +memberlist_search_fields_after +=== +* Locations: + + styles/prosilver/template/memberlist_search.html +* Since: 3.1.2-RC1 +* Purpose: Add information after the search fields column. + +memberlist_search_fields_before +=== +* Locations: + + styles/prosilver/template/memberlist_search.html +* Since: 3.1.2-RC1 +* Purpose: Add information before the search fields column. + +memberlist_search_sorting_options_before +=== +* Locations: + + styles/prosilver/template/memberlist_search.html +* Since: 3.1.2-RC1 +* Purpose: Add information before the search sorting options field. + +memberlist_view_contact_after +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.0-b2 +* Purpose: Add content after the user contact part of any user profile + +memberlist_view_contact_before +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.0-b2 +* Purpose: Add content before the user contact part of any user profile + +memberlist_view_content_append +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.0-b2 +* Purpose: Add custom content to the user profile view after the main content + +memberlist_view_content_prepend +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.0-b3 +* Purpose: Add custom content to the user profile view before the main content + +memberlist_view_rank_avatar_after +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.6-RC1 +* Purpose: Add information after rank in memberlist (with avatar) + +memberlist_view_rank_avatar_before +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.6-RC1 +* Purpose: Add information before rank in memberlist (with avatar) + +memberlist_view_rank_no_avatar_after +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.6-RC1 +* Purpose: Add information after rank in memberlist (without avatar) + +memberlist_view_rank_no_avatar_before +=== +* Locations: + + styles/prosilver/template/memberlist_view.html +* Since: 3.1.6-RC1 +* Purpose: Add information before rank in memberlist (without avatar) + memberlist_view_user_statistics_after === * Locations: + styles/prosilver/template/memberlist_view.html - + styles/subsilver2/template/memberlist_view.html * Since: 3.1.0-a1 * Purpose: Add entries after the user statistics part of any user profile @@ -140,30 +990,90 @@ memberlist_view_user_statistics_before === * Locations: + styles/prosilver/template/memberlist_view.html - + styles/subsilver2/template/memberlist_view.html * Since: 3.1.0-a1 * Purpose: Add entries before the user statistics part of any user profile +navbar_header_logged_out_content +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC1 +* Purpose: Add text and HTML in place of the username when not logged in. + +navbar_header_profile_list_after +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC2 +* Purpose: Add links to the bottom of the profile drop-down menu in the header navbar + +navbar_header_profile_list_before +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC2 +* Purpose: Add links to the top of the profile drop-down menu in the header navbar + +navbar_header_quick_links_after +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC2 +* Purpose: Add links to the bottom of the quick-links drop-down menu in the header + +navbar_header_quick_links_before +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC2 +* Purpose: Add links to the top of the quick-links drop-down menu in the header + +navbar_header_username_append +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC1 +* Purpose: Add text and HTMl after the username shown in the navbar. + +navbar_header_username_prepend +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC1 +* Purpose: Add text and HTMl before the username shown in the navbar. + overall_footer_after === * Locations: + styles/prosilver/template/overall_footer.html - + styles/subsilver2/template/overall_footer.html * Since: 3.1.0-a1 * Purpose: Add content at the end of the file, directly prior to the `</body>` tag -overall_footer_breadcrumb_append +overall_footer_body_after === * Locations: + styles/prosilver/template/overall_footer.html +* Since: 3.1.3-RC1 +* Purpose: Add content before the `</body>` tag but after the $SCRIPTS var, i.e. after the js scripts have been loaded + +overall_footer_breadcrumb_append +=== +* Locations: + + styles/prosilver/template/navbar_footer.html * Since: 3.1.0-a1 * Purpose: Add links to the list of breadcrumbs in the footer +overall_footer_breadcrumb_prepend +=== +* Locations: + + styles/prosilver/template/navbar_footer.html +* Since: 3.1.0-RC3 +* Purpose: Add links to the list of breadcrumbs in the footer (after site-home, but before board-index) + overall_footer_content_after === * Locations: + styles/prosilver/template/overall_footer.html - + styles/subsilver2/template/overall_footer.html * Since: 3.1.0-a3 * Purpose: Add content on all pages after the main content, before the footer @@ -171,7 +1081,6 @@ overall_footer_copyright_append === * Locations: + styles/prosilver/template/overall_footer.html - + styles/subsilver2/template/overall_footer.html * Since: 3.1.0-a1 * Purpose: Add content after the copyright line (no new line by default), before the ACP link @@ -179,55 +1088,175 @@ overall_footer_copyright_prepend === * Locations: + styles/prosilver/template/overall_footer.html - + styles/subsilver2/template/overall_footer.html * Since: 3.1.0-a1 * Purpose: Add content before the copyright line -overall_header_breadcrumb_append +overall_footer_page_body_after +=== +* Locations: + + styles/prosilver/template/overall_footer.html +* Since: 3.1.0-b3 +* Purpose: Add content after the page-body, but before the footer + +overall_footer_teamlink_after +=== +* Locations: + + styles/prosilver/template/navbar_footer.html +* Since: 3.1.0-b3 +* Purpose: Add contents after the team-link in the footer + +overall_footer_teamlink_before +=== +* Locations: + + styles/prosilver/template/navbar_footer.html +* Since: 3.1.0-b3 +* Purpose: Add contents before the team-link in the footer + +overall_footer_timezone_after +=== +* Locations: + + styles/prosilver/template/navbar_footer.html +* Since: 3.1.0-b3 +* Purpose: Add content to the navbar in the page footer, after "Timezone" + +overall_footer_timezone_before +=== +* Locations: + + styles/prosilver/template/navbar_footer.html +* Since: 3.1.0-b3 +* Purpose: Add content to the navbar in the page footer, before "Timezone" + +overall_header_body_before === * Locations: + styles/prosilver/template/overall_header.html - + styles/subsilver2/template/breadcrumbs.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + +overall_header_breadcrumb_append +=== +* Locations: + + styles/prosilver/template/navbar_header.html * Since: 3.1.0-a1 * Purpose: Add links to the list of breadcrumbs in the header +overall_header_breadcrumb_prepend +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC3 +* Purpose: Add links to the list of breadcrumbs in the header (after site-home, but before board-index) + +overall_header_breadcrumbs_after +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC3 +* Purpose: Add content after the breadcrumbs (outside of the breadcrumbs container) + +overall_header_breadcrumbs_before +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the breadcrumbs (outside of the breadcrumbs container) + overall_header_content_before === * Locations: + styles/prosilver/template/overall_header.html - + styles/subsilver2/template/overall_header.html * Since: 3.1.0-a3 * Purpose: Add content on all pages before the main content, after the header +overall_header_feeds +=== +* Locations: + + styles/prosilver/template/overall_header.html +* Since: 3.1.6-RC1 +* Purpose: Add custom feeds + overall_header_head_append === * Locations: + styles/prosilver/template/overall_header.html - + styles/subsilver2/template/overall_header.html * Since: 3.1.0-a1 * Purpose: Add asset calls directly before the `</head>` tag -overall_header_navigation_append +overall_header_navbar_before === * Locations: + styles/prosilver/template/overall_header.html - + styles/subsilver2/template/overall_header.html +* Since: 3.1.4-RC1 +* Purpose: Add content before the navigation bar + +overall_header_navigation_append +=== +* Locations: + + styles/prosilver/template/navbar_header.html * Since: 3.1.0-a1 * Purpose: Add links after the navigation links in the header overall_header_navigation_prepend === * Locations: - + styles/prosilver/template/overall_header.html - + styles/subsilver2/template/overall_header.html + + styles/prosilver/template/navbar_header.html * Since: 3.1.0-a1 * Purpose: Add links before the navigation links in the header +overall_header_navlink_append +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-b3 +* Purpose: Add content after each individual navlink (breadcrumb) + +overall_header_navlink_prepend +=== +* Locations: + + styles/prosilver/template/navbar_header.html +* Since: 3.1.0-b3 +* Purpose: Add content before each individual navlink (breadcrumb) + +overall_header_page_body_before +=== +* Locations: + + styles/prosilver/template/overall_header.html +* Since: 3.1.0-b3 +* Purpose: Add content after the page-header, but before the page-body + +overall_header_searchbox_before +=== +* Locations: + + styles/prosilver/template/overall_header.html +* Since: 3.1.4-RC1 +* Purpose: Add content before the search box in the header + +overall_header_stylesheets_after +=== +* Locations: + + styles/prosilver/template/overall_header.html +* Since: 3.1.0-RC3 +* Purpose: Add asset calls after stylesheets within the `</head>` tag. +Note that INCLUDECSS will not work with this event. + +posting_editor_add_panel_tab +=== +* Locations: + + styles/prosilver/template/posting_editor.html +* Since: 3.1.6-RC1 +* Purpose: Add custom panel to post editor + +posting_editor_bbcode_status_after +=== +* Locations: + + styles/prosilver/template/posting_editor.html +* Since: 3.1.4-RC1 +* Purpose: Add content after bbcode status + posting_editor_buttons_after === * Locations: + styles/prosilver/template/posting_buttons.html - + styles/subsilver2/template/posting_buttons.html * Since: 3.1.0-a3 * Purpose: Add content after the BBCode posting buttons @@ -235,15 +1264,20 @@ posting_editor_buttons_before === * Locations: + styles/prosilver/template/posting_buttons.html - + styles/subsilver2/template/posting_buttons.html * Since: 3.1.0-a3 * Purpose: Add content before the BBCode posting buttons +posting_editor_buttons_custom_tags_before +=== +* Locations: + + styles/prosilver/template/posting_buttons.html +* Since: 3.1.2-RC1 +* Purpose: Add content inside the BBCode posting buttons and before the customs BBCode + posting_editor_message_after === * Locations: + styles/prosilver/template/posting_editor.html - + styles/subsilver2/template/posting_body.html * Since: 3.1.0-a2 * Purpose: Add field (e.g. textbox) to the posting screen after the message @@ -251,7 +1285,6 @@ posting_editor_message_before === * Locations: + styles/prosilver/template/posting_editor.html - + styles/subsilver2/template/posting_body.html * Since: 3.1.0-a2 * Purpose: Add field (e.g. textbox) to the posting screen before the message @@ -259,15 +1292,27 @@ posting_editor_options_prepend === * Locations: + styles/prosilver/template/posting_editor.html - + styles/subsilver2/template/posting_body.html * Since: 3.1.0-a1 * Purpose: Add posting options on the posting screen +posting_editor_smilies_after +=== +* Locations: + + styles/prosilver/template/posting_editor.html +* Since: 3.1.4-RC1 +* Purpose: Add content after smilies + +posting_editor_smilies_before +=== +* Locations: + + styles/prosilver/template/posting_editor.html +* Since: 3.1.4-RC1 +* Purpose: Add content before the smilies + posting_editor_subject_after === * Locations: + styles/prosilver/template/posting_editor.html - + styles/subsilver2/template/posting_body.html * Since: 3.1.0-a2 * Purpose: Add field (e.g. textbox) to the posting screen after the subject @@ -275,15 +1320,97 @@ posting_editor_subject_before === * Locations: + styles/prosilver/template/posting_editor.html - + styles/subsilver2/template/posting_body.html * Since: 3.1.0-a2 * Purpose: Add field (e.g. textbox) to the posting screen before the subject +posting_editor_submit_buttons +=== +* Locations: + + styles/prosilver/template/posting_editor.html +* Since: 3.1.6-RC1 +* Purpose: Add custom buttons in the posting editor + +posting_layout_include_panel_body +=== +* Locations: + + styles/prosilver/template/posting_layout.html +* Since: 3.1.6-RC1 +* Purpose: Add include of custom panel template body in posting editor + +posting_pm_header_find_username_after +=== +* Locations: + + styles/prosilver/template/posting_pm_header.html +* Since: 3.1.0-RC4 +* Purpose: Add content after the find username link on composing pm + +posting_pm_header_find_username_before +=== +* Locations: + + styles/prosilver/template/posting_pm_header.html +* Since: 3.1.0-RC4 +* Purpose: Add content before the find username link on composing pm + +posting_pm_layout_include_pm_header_after +=== +* Locations: + + styles/prosilver/template/posting_pm_layout.html +* Since: 3.1.4-RC1 +* Purpose: Add content after the include of posting_pm_header.html + +posting_pm_layout_include_pm_header_before +=== +* Locations: + + styles/prosilver/template/posting_pm_layout.html +* Since: 3.1.4-RC1 +* Purpose: Add content before the include of posting_pm_header.html + +posting_poll_body_options_after +=== +* Locations: + + styles/prosilver/template/posting_poll_body.html +* Since: 3.1.4-RC1 +* Purpose: Add content after the poll options on creating a poll + +posting_preview_poll_after +=== +* Locations: + + styles/prosilver/template/posting_preview.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the poll preview block + +posting_topic_title_after +=== +* Locations: + + styles/prosilver/template/posting_layout.html +* Since: 3.1.7-RC1 +* Purpose: Allows to add some information after the topic title in the posting form + +posting_topic_title_before +=== +* Locations: + + styles/prosilver/template/posting_layout.html +* Since: 3.1.6-RC1 +* Purpose: Allows to add some information on the left of the topic title in the posting form + +quickreply_editor_panel_after +=== +* Locations: + + styles/prosilver/template/quickreply_editor.html +* Since: 3.1.0-b2 +* Purpose: Add content after the quick reply panel (but inside the form) + +quickreply_editor_panel_before +=== +* Locations: + + styles/prosilver/template/quickreply_editor.html +* Since: 3.1.0-b2 +* Purpose: Add content before the quick reply panel (but inside the form) + quickreply_editor_message_after === * Locations: + styles/prosilver/template/quickreply_editor.html - + styles/subsilver2/template/quickreply_editor.html * Since: 3.1.0-a4 * Purpose: Add content after the quick reply textbox @@ -291,10 +1418,177 @@ quickreply_editor_message_before === * Locations: + styles/prosilver/template/quickreply_editor.html - + styles/subsilver2/template/quickreply_editor.html * Since: 3.1.0-a4 * Purpose: Add content before the quick reply textbox +quickreply_editor_subject_before +=== +* Locations: + + styles/prosilver/template/quickreply_editor.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the quick reply subject textbox + +search_body_form_after +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the search form + +search_body_form_before +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.5-RC1 +* Purpose: Add content before the search form + +search_body_recent_search_after +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the recent search queries list + +search_body_recent_search_before +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the recent search queries list + +search_body_search_display_options_append +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Put content at the bottom of the search query display options fields set + +search_body_search_display_options_prepend +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Put content at the top of the search query display options fields set + +search_body_search_options_after +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the search query options fields set + +search_body_search_options_append +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Put content at the bottom of the search query options fields set + +search_body_search_options_before +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the search query options fields set + +search_body_search_options_prepend +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Put content at the top of the search query options fields set + +search_body_search_query_after +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the search query fields set + +search_body_search_query_append +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Put content at the bottom of the search query fields set + +search_body_search_query_before +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the search query fields set + +search_body_search_query_prepend +=== +* Locations: + + styles/prosilver/template/search_body.html +* Since: 3.1.7-RC1 +* Purpose: Put content at the top of the search query fields set + +search_results_header_after +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.4-RC1 +* Purpose: Add content after the header of the search results + +search_results_header_before +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.4-RC1 +* Purpose: Add content before the header of the search results. + +search_results_post_after +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.0-b3 +* Purpose: Add data after search result posts + +search_results_post_before +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.0-b3 +* Purpose: Add data before search result posts + +search_results_postprofile_after +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.0-b3 +* Purpose: Add content after the post author and stats in search results (posts view mode) + +search_results_postprofile_before +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.0-b3 +* Purpose: Add content directly before the post author in search results (posts view mode) + +search_results_searchbox_after +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.4-RC1 +* Purpose: Add content right after the searchbox of the search results. + +search_results_topic_after +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.0-b4 +* Purpose: Add data after search result topics + +search_results_topic_before +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.0-b4 +* Purpose: Add data before search result topics + simple_footer_after === * Locations: @@ -302,14 +1596,36 @@ simple_footer_after * Since: 3.1.0-a1 * Purpose: Add content directly prior to the `</body>` tag of the simple footer +simple_header_body_before +=== +* Locations: + + styles/prosilver/template/simple_header.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + +simple_header_head_append +=== +* Locations: + + styles/prosilver/template/simple_header.html +* Since: 3.1.0-b4 +* Purpose: Add asset calls directly before the `</head>` tag + +simple_header_stylesheets_after +=== +* Locations: + + styles/prosilver/template/simple_header.html +* Since: 3.1.0-RC3 +* Purpose: Add asset calls after stylesheets within the `</head>` tag. +Note that INCLUDECSS will not work with this event. + topiclist_row_prepend === * Locations: + styles/prosilver/template/search_results.html + styles/prosilver/template/viewforum_body.html - + styles/subsilver2/template/search_results.html - + styles/subsilver2/template/viewforum_body.html + + styles/prosilver/template/mcp_forum.html * Since: 3.1.0-a1 +* Changed: 3.1.6-RC1 Added event to mcp_forum.html * Purpose: Add content into topic rows (inside the elements containing topic titles) topiclist_row_append @@ -317,11 +1633,115 @@ topiclist_row_append * Locations: + styles/prosilver/template/search_results.html + styles/prosilver/template/viewforum_body.html - + styles/subsilver2/template/search_results.html - + styles/subsilver2/template/viewforum_body.html + + styles/prosilver/template/mcp_forum.html * Since: 3.1.0-a1 +* Changed: 3.1.6-RC1 Added event to mcp_forum.html * Purpose: Add content into topic rows (inside the elements containing topic titles) +ucp_agreement_terms_after +=== +* Locations: + + styles/prosilver/template/ucp_agreement.html +* Since: 3.1.0-b3 +* Purpose: Add content after the terms of agreement text at user registration + +ucp_agreement_terms_before +=== +* Locations: + + styles/prosilver/template/ucp_agreement.html +* Since: 3.1.0-b3 +* Purpose: Add content before the terms of agreement text at user registration + +ucp_main_front_user_activity_after +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html +* Since: 3.1.6-RC1 +* Purpose: Add content right after the user activity info viewing UCP front page + +ucp_main_front_user_activity_before +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html +* Since: 3.1.6-RC1 +* Purpose: Add content right before the user activity info viewing UCP front page + +ucp_pm_history_post_buttons_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.1.6-RC1 +* Purpose: Add post button to private messages in history review (next to quote etc), at +the end of the list. + +ucp_pm_history_post_buttons_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.1.6-RC1 +* Purpose: Add post button to private messages in history review (next to quote etc), at +the start of the list. + +ucp_pm_history_post_buttons_list_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.1.6-RC1 +* Purpose: Add post button custom list to private messages in history review (next to quote etc), +after the original list. + +ucp_pm_history_post_buttons_list_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.1.6-RC1 +* Purpose: Add post button custom list to private messages in history review (next to quote etc), +before the original list. + +ucp_pm_history_review_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.1.6-RC1 +* Purpose: Add content after the private messages history review. + +ucp_pm_history_review_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.1.6-RC1 +* Purpose: Add content before the private messages history review. + +ucp_pm_viewmessage_avatar_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-RC3 +* Purpose: Add content right after the avatar when viewing a private message + +ucp_pm_viewmessage_avatar_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-RC3 +* Purpose: Add content right before the avatar when viewing a private message + +ucp_pm_viewmessage_contact_fields_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-b1 +* Purpose: Add data after the contact fields on the user profile when viewing +a private message + +ucp_pm_viewmessage_contact_fields_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-b1 +* Purpose: Add data before the contact fields on the user profile when viewing +a private message + ucp_pm_viewmessage_custom_fields_after === * Locations: @@ -338,19 +1758,65 @@ ucp_pm_viewmessage_custom_fields_before * Purpose: Add data before the custom fields on the user profile when viewing a private message +ucp_pm_viewmessage_post_buttons_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-RC3 +* Purpose: Add post button to private messages (next to edit, quote etc), at +the end of the list. + +ucp_pm_viewmessage_post_buttons_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.0-RC3 +* Purpose: Add post button to private messages (next to edit, quote etc), at +the start of the list. + +ucp_pm_viewmessage_post_buttons_list_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.6-RC1 +* Purpose: Add post button custom list to private messages (next to edit, quote etc), +after the original list. + +ucp_pm_viewmessage_post_buttons_list_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.6-RC1 +* Purpose: Add post button custom list to private messages (next to edit, quote etc), +before the original list. + ucp_pm_viewmessage_print_head_append === * Locations: + styles/prosilver/template/ucp_pm_viewmessage_print.html - + styles/subsilver2/template/ucp_pm_viewmessage_print.html * Since: 3.1.0-a1 * Purpose: Add asset calls directly before the `</head>` tag of the Print PM screen +ucp_pm_viewmessage_rank_after +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.6-RC1 +* Purpose: Add data after the rank on the user profile when viewing +a private message + +ucp_pm_viewmessage_rank_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.6-RC1 +* Purpose: Add data before the rank on the user profile when viewing +a private message + ucp_prefs_personal_prepend === * Locations: + styles/prosilver/template/ucp_prefs_personal.html - + styles/subsilver2/template/ucp_prefs_personal.html * Since: 3.1.0-a1 * Purpose: Add user options to the top of the Edit Global Settings block @@ -358,7 +1824,6 @@ ucp_prefs_personal_append === * Locations: + styles/prosilver/template/ucp_prefs_personal.html - + styles/subsilver2/template/ucp_prefs_personal.html * Since: 3.1.0-a1 * Purpose: Add user options to the bottom of the Edit Global Settings block @@ -366,7 +1831,6 @@ ucp_prefs_post_prepend === * Locations: + styles/prosilver/template/ucp_prefs_post.html - + styles/subsilver2/template/ucp_prefs_post.html * Since: 3.1.0-a1 * Purpose: Add user options to the top of the Edit Posting Defaults block @@ -374,7 +1838,6 @@ ucp_prefs_post_append === * Locations: + styles/prosilver/template/ucp_prefs_post.html - + styles/subsilver2/template/ucp_prefs_post.html * Since: 3.1.0-a1 * Purpose: Add user options to the bottom of the Edit Posting Defaults block @@ -382,77 +1845,351 @@ ucp_prefs_view_radio_buttons_prepend === * Locations: + styles/prosilver/template/ucp_prefs_view.html - + styles/subsilver2/template/ucp_prefs_view.html * Since: 3.1.0-a1 -* Purpose: Add options to the top of the radio buttons block of the Edit +* Purpose: Add options to the top of the radio buttons block of the Edit Display Options screen ucp_prefs_view_radio_buttons_append === * Locations: + styles/prosilver/template/ucp_prefs_view.html - + styles/subsilver2/template/ucp_prefs_view.html * Since: 3.1.0-a1 -* Purpose: Add options to the bottom of the radio buttons block of the Edit +* Purpose: Add options to the bottom of the radio buttons block of the Edit Display Options screen ucp_prefs_view_select_menu_prepend === * Locations: + styles/prosilver/template/ucp_prefs_view.html - + styles/subsilver2/template/ucp_prefs_view.html * Since: 3.1.0-a1 -* Purpose: Add options to the top of the drop-down lists block of the Edit +* Purpose: Add options to the top of the drop-down lists block of the Edit Display Options screen ucp_prefs_view_select_menu_append === * Locations: + styles/prosilver/template/ucp_prefs_view.html - + styles/subsilver2/template/ucp_prefs_view.html * Since: 3.1.0-a1 -* Purpose: Add options to the bottom of the drop-down lists block of the Edit +* Purpose: Add options to the bottom of the drop-down lists block of the Edit Display Options screen +ucp_profile_profile_info_before +=== +* Locations: + + styles/prosilver/template/ucp_profile_profile_info.html +* Since: 3.1.4-RC1 +* Purpose: Add options in profile page fieldset - before jabber field. + +ucp_profile_profile_info_after +=== +* Locations: + + styles/prosilver/template/ucp_profile_profile_info.html +* Since: 3.1.4-RC1 +* Purpose: Add options in profile page fieldset - after custom profile fields. + +ucp_profile_register_details_before +=== +* Locations: + + styles/prosilver/template/ucp_profile_reg_details.html +* Since: 3.1.4-RC1 +* Purpose: Add options in profile page fieldset - before first field. + +ucp_profile_register_details_after +=== +* Locations: + + styles/prosilver/template/ucp_profile_reg_details.html +* Since: 3.1.4-RC1 +* Purpose: Add options in profile page fieldset - after confirm password field. + +ucp_register_credentials_before +=== +* Locations: + + styles/prosilver/template/ucp_register.html +* Since: 3.1.0-b5 +* Purpose: Add options in registration page fieldset - before first field. + +ucp_register_profile_fields_after +=== +* Locations: + + styles/prosilver/template/ucp_register.html +* Since: 3.1.0-b5 +* Purpose: Add options in registration page fieldset - after last field. + +ucp_register_credentials_after +=== +* Locations: + + styles/prosilver/template/ucp_register.html +* Since: 3.1.0-b5 +* Purpose: Add options in registration page fieldset - after password field. + +ucp_register_options_before +=== +* Locations: + + styles/prosilver/template/ucp_register.html +* Since: 3.1.0-b5 +* Purpose: Add options in registration page fieldset - before language selector. + +ucp_register_profile_fields_before +=== +* Locations: + + styles/prosilver/template/ucp_register.html +* Since: 3.1.0-b5 +* Purpose: Add options in registration page fieldset - before profile fields. + ucp_friend_list_before === * Locations: - + styles/prosilver/template/ucp_zebra_friends.html - + styles/subsilver2/template/ucp_zebra_friends.html + + styles/prosilver/template/ucp_zebra_friends.html * Since: 3.1.0-a4 * Purpose: Add optional elements before list of friends in UCP ucp_friend_list_after === * Locations: - + styles/prosilver/template/ucp_zebra_friends.html - + styles/subsilver2/template/ucp_zebra_friends.html + + styles/prosilver/template/ucp_zebra_friends.html * Since: 3.1.0-a4 * Purpose: Add optional elements after list of friends in UCP +viewforum_body_topic_row_after +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content after the topic list item. + +viewforum_body_topic_row_append +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the start of the topic list item. + +viewforum_body_topic_row_before +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content before the topic list item. + +viewforum_body_topic_row_prepend +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content at the end of the topic list item. + +viewforum_buttons_bottom_before +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before New Topic button on the bottom of the topic's list + +viewforum_buttons_bottom_after +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after New Topic button on the bottom of the topic's list + +viewforum_buttons_top_before +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before New Topic button on the top of the topic's list + +viewforum_buttons_top_after +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after New Topic button on the top of the topic's list + +viewtopic_buttons_bottom_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before Post Reply button on the bottom of the posts's list + +viewtopic_buttons_bottom_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after Post Reply button on the bottom of the posts's list + +viewtopic_buttons_top_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before Post Reply button on the top of the posts's list + +viewtopic_buttons_top_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after Post Reply button on the top of the posts's list + +viewtopic_dropdown_bottom_custom +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.6-RC1 +* Purpose: Create a custom dropdown menu + +viewtopic_dropdown_top_custom +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.6-RC1 +* Purpose: Create a custom dropdown menu + +viewforum_forum_name_append +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.0-b3 +* Purpose: Add content directly after the forum name link on the View forum screen + +viewforum_forum_name_prepend +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.0-b3 +* Purpose: Add content directly before the forum name link on the View forum screen + +viewforum_forum_title_after +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.5-RC1 +* Purpose: Add content directly after the forum title on the View forum screen + +viewforum_forum_title_before +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.5-RC1 +* Purpose: Add content directly before the forum title on the View forum screen + viewtopic_print_head_append === * Locations: + styles/prosilver/template/viewtopic_print.html - + styles/subsilver2/template/viewtopic_print.html * Since: 3.1.0-a1 * Purpose: Add asset calls directly before the `</head>` tag of the Print Topic screen +viewtopic_body_pagination_top_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.4-RC1 +* Purpose: Add content after the pagination at top + +viewtopic_body_avatar_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-RC3 +* Purpose: Add content right after the avatar when viewing topics + +viewtopic_body_avatar_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-RC3 +* Purpose: Add content right before the avatar when viewing topics + +viewtopic_body_contact_fields_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b3 +* Purpose: Add data after the contact fields on the user profile when viewing +a post + +viewtopic_body_contact_fields_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b3 +* Purpose: Add data before the contact fields on the user profile when viewing +a post + viewtopic_body_footer_before === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a1 * Purpose: Add content to the bottom of the View topic screen below the posts -and quick reply, directly before the jumpbox in Prosilver, breadcrumbs in -Subsilver2. +and quick reply, directly before the jumpbox in Prosilver. + +viewtopic_body_poll_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.6-RC1 +* Purpose: Add content after the poll panel. + +viewtopic_body_poll_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.6-RC1 +* Purpose: Add content before the poll panel. + +viewtopic_body_poll_option_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b3 +* Purpose: Add content after the poll option +the list. + +viewtopic_body_poll_option_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b3 +* Purpose: Add content before the poll option +the list. + +viewtopic_body_poll_question_append +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b3 +* Purpose: Add content directly after the poll question on the View topic screen + +viewtopic_body_poll_question_prepend +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b3 +* Purpose: Add content directly before the poll question on the View topic screen + +viewtopic_body_post_author_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.3-RC1 +* Purpose: Add content directly after the post author on the view topic screen + +viewtopic_body_post_author_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.3-RC1 +* Purpose: Add content directly before the post author on the view topic screen viewtopic_body_post_buttons_after === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a1 * Purpose: Add post button to posts (next to edit, quote etc), at the end of the list. @@ -461,16 +2198,65 @@ viewtopic_body_post_buttons_before === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a1 * Purpose: Add post button to posts (next to edit, quote etc), at the start of the list. +viewtopic_body_post_buttons_list_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.5-RC1 +* Purpose: Add post button custom list to posts (next to edit, quote etc), +after the original list. + +viewtopic_body_post_buttons_list_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.5-RC1 +* Purpose: Add post button custom list to posts (next to edit, quote etc), +before the original list. + +viewtopic_body_post_subject_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.7-RC1 +* Purpose: Add data before post icon and subject + +viewtopic_body_postrow_back2top_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.8-RC1 +* Purpose: Add content to the post's bottom after the back to top link + +viewtopic_body_postrow_back2top_append +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.8-RC1 +* Purpose: Add content to the post's bottom directly before the back to top link + +viewtopic_body_postrow_back2top_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.8-RC1 +* Purpose: Add content to the post's bottom before the back to top link + +viewtopic_body_postrow_back2top_prepend +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.8-RC1 +* Purpose: Add content to the post's bottom directly before the back to top link + viewtopic_body_postrow_custom_fields_after === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a1 * Purpose: Add data after the custom fields on the user profile when viewing a post @@ -479,7 +2265,6 @@ viewtopic_body_postrow_custom_fields_before === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a1 * Purpose: Add data before the custom fields on the user profile when viewing a post @@ -488,7 +2273,6 @@ viewtopic_body_postrow_post_after === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a4 * Purpose: Add data after posts @@ -496,23 +2280,85 @@ viewtopic_body_postrow_post_before === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a4 * Purpose: Add data before posts +viewtopic_body_postrow_post_content_footer +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-RC4 +* Purpose: Add data at the end of the posts. + +viewtopic_body_postrow_post_details_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.4-RC1 +* Purpose: Add content after the post details + +viewtopic_body_postrow_post_details_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.4-RC1 +* Purpose: Add content before the post details + +viewtopic_body_postrow_post_notices_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b2 +* Purpose: Add posts specific custom notices at the notices bottom. + +viewtopic_body_postrow_post_notices_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b2 +* Purpose: Add posts specific custom notices at the notices top. + +viewtopic_body_postrow_rank_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.6-RC1 +* Purpose: Add data after the rank on the user profile when viewing +a post + +viewtopic_body_postrow_rank_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.6-RC1 +* Purpose: Add data before the rank on the user profile when viewing +a post + viewtopic_body_topic_actions_before === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a4 * Purpose: Add data before the topic actions buttons (after the posts sorting options) +viewtopic_topic_title_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.7-RC1 +* Purpose: Add content directly after the topic title link on the View topic screen (outside of the h2 HTML tag) + +viewtopic_topic_title_append +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.0-b3 +* Purpose: Add content directly after the topic title link on the View topic screen + viewtopic_topic_title_prepend === * Locations: + styles/prosilver/template/viewtopic_body.html - + styles/subsilver2/template/viewtopic_body.html * Since: 3.1.0-a1 * Purpose: Add content directly before the topic title link on the View topic screen diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html deleted file mode 100644 index 3f209b8a34..0000000000 --- a/phpBB/docs/hook_system.html +++ /dev/null @@ -1,883 +0,0 @@ -<!DOCTYPE html> -<html dir="ltr" lang="en"> -<head> -<meta charset="utf-8"> -<meta name="keywords" content="" /> -<meta name="description" content="Hook System explanation" /> -<title>phpBB3 • Hook System</title> - -<style type="text/css"> -/* <![CDATA[ */ - -/* - The original "prosilver" theme for phpBB3 - Created by subBlue design :: http://www.subBlue.com -*/ - -* { margin: 0; padding: 0; } - -html { font-size: 100%; height: 100%; margin-bottom: 1px; } - -body { - font-family: Verdana, Helvetica, Arial, sans-serif; - color: #828282; - background-color: #FFFFFF; - font-size: 12px; - margin: 0; - padding: 12px 0; -} - -img { border-width: 0; } - -p { - line-height: 1.3em; - font-size: 1.1em; - margin-bottom: 1.5em; -} - -hr { - border: 0 none #FFFFFF; - border-top: 1px solid #CCCCCC; - height: 1px; - margin: 5px 0; - display: block; - clear: both; -} - -html, body { - color: #536482; - background-color: #FFFFFF; -} - -#doc-description h1 { - font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - margin-right: 200px; - color: #FFFFFF; - margin-top: 15px; - font-weight: bold; - font-size: 2em; - color: #fff; -} - -h1 { - font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - font-weight: normal; - color: #000; - font-size: 2em; - margin: 0.8em 0 0.2em 0; -} - -h2 { - font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - font-weight: normal; - color: #28313F; - font-size: 1.5em; - margin: 0.8em 0 0.2em 0; -} - -h3 { - font-family: Arial, Helvetica, sans-serif; - font-weight: bold; - border-bottom: 1px solid #CCCCCC; - margin-bottom: 3px; - padding-bottom: 2px; - font-size: 1.05em; - color: #115098; - margin-top: 20px; -} - -.good { color: green; } -.bad { color: red; } - -.version { - margin-top: 20px; - text-align: left; - font-size: 70%; - color: #006600; - border-top: 1px solid #ccc; -} - -code { - color: #006600; - font-weight: normal; - font-family: 'Courier New', monospace; - border-color: #D1D7DC; - border-width: 1px; - border-style: solid; - background-color: #FAFAFA; -} - -#wrap { - padding: 0 20px; - min-width: 650px; -} - -#simple-wrap { - padding: 6px 10px; -} - -#page-body { - margin: 4px 0; - clear: both; -} - -#page-footer { - clear: both; -} - -#logo { - float: left; - width: auto; - padding: 10px 13px 0 10px; -} - -a#logo:hover { - text-decoration: none; -} - -#doc-description { - float: left; - width: 70%; -} - -#doc-description h1 { - margin-right: 0; -} - -.headerbar { - background: #ebebeb none repeat-x 0 0; - color: #FFFFFF; - margin-bottom: 4px; - padding: 0 5px; -} - -span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span { - font-size: 1px; - line-height: 1px; - display: block; - height: 5px; - background-repeat: no-repeat; -} - -span.corners-top { - background-image: none; - background-position: 0 0; - margin: 0 -5px; -} - -span.corners-top span { - background-image: none; - background-position: 100% 0; -} - -span.corners-bottom { - background-image: none; - background-position: 0 100%; - margin: 0 -5px; - clear: both; -} - -span.corners-bottom span { - background-image: none; - background-position: 100% 100%; -} - -.paragraph { - padding: 0 10px; - margin-bottom: 4px; - background-repeat: no-repeat; - background-position: 100% 0; - background-color: #ECF3F7; -} - -.paragraph:target .content { - color: #000000; -} - -.paragraph:target h3 a { - color: #000000; -} - -.content { - color: #333333; -} - -.content h2, .panel h2 { - color: #115098; - border-bottom-color: #CCCCCC; -} - -a:link { color: #898989; text-decoration: none; } -a:visited { color: #898989; text-decoration: none; } -a:hover { color: #d3d3d3; text-decoration: underline; } -a:active { color: #d2d2d2; text-decoration: none; } - -hr { - border-color: #FFFFFF; - border-top-color: #CCCCCC; -} - -.menu { - background-color: #cadceb; -} - -.headerbar { - background-color: #12A3EB; - background-image: url("bg_header.gif"); - color: #FFFFFF; -} - -.panel { - background-color: #ECF1F3; - color: #28313F; -} - - -span.corners-top { - background-image: url("corners_left.png"); -} - -span.corners-top span { - background-image: url("corners_right.png"); -} - -span.corners-bottom { - background-image: url("corners_left.png"); -} - -span.corners-bottom span { - background-image: url("corners_right.png"); -} - -.error { - color: #BC2A4D; -} - -a:link { color: #105289; } -a:visited { color: #105289; } -a:hover { color: #D31141; } -a:active { color: #368AD2; } - -.paragraph span.corners-top, .paragraph span.corners-bottom { - margin: 0 -10px; -} - -.content { - padding: 0; - line-height: 1.48em; - color: #333333; -} - -.content h2, .panel h2 { - color: #115098; - border-bottom-color: #CCCCCC; -} - -.notice { - border-top-color: #CCCCCC; -} - -.codebox { - padding: 3px; - background-color: #FFFFFF; - border: 1px solid #C9D2D8; - font-size: 1em; - margin-bottom: 10px; - display: block; - font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; - line-height: 1.3em; -} - -* html hr { margin: 0; } -* html span.corners-top, * html span.corners-bottom { background-image: url("corners_left.gif"); } -* html span.corners-top span, * html span.corners-bottom span { background-image: url("corners_right.gif"); } - -.back2top { - clear: both; - height: 11px; - text-align: right; -} - -.content ol { - margin-left: 25px; -} - -/* ]]> */ -</style> - -</head> - -<body id="phpbb" class="section-docs"> - -<div id="wrap"> - <a id="top" name="top" accesskey="t"></a> - <div id="page-header"> - <div class="headerbar"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div id="doc-description"> - <a href="../index.php" id="logo"><img src="site_logo.gif" alt="" /></a> - <h1>Hook System</h1> - <p>This is an explanation of how to use the phpBB3 hook system.</p> - <p style="display: none;"><a href="#start_here">Skip</a></p> - </div> - - <span class="corners-bottom"><span></span></span></div> - </div> - </div> - - <a name="start_here"></a> - - <div id="page-body"> - - <h1>Hook System</h1> - - <div class="paragraph menu"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div class="content"> - - <ol> - <li><a href="#intro">Introduction</a></li> - <li><a href="#use">Allow hooks in functions/methods</a></li> - <li><a href="#register">Registering hooks</a></li> - <li><a href="#return">Result returning</a></li> - <li><a href="#embed">Embedding your hook files/classes/methods</a></li> - <li><a href="#disclaimer">Copyright and disclaimer</a></li> - </ol> - - </div> - - <span class="corners-bottom"><span></span></span></div> - </div> - - <hr /> - - <a name="intro"></a><h2>1. Introduction</h2> - - <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div class="content"> - -<h3>What is it?</h3> - -<p>The hook system allows applicaton and mod developers to hook into phpBB's or their own functions.</p> - -<h3>Pre-defined hookable phpBB3 functions</h3> - -<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 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>$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> - -<p>Please note: The <code>$template->display</code> hook takes a <code>$template</code> argument, which is the template instance being used, which should be used instead of the global.</p> - -<p>There are also valid external constants you may want to use if you embed phpBB3 into your application:</p> - -<div class="codebox"><pre> -PHPBB_MSG_HANDLER (overwrite message handler) -PHPBB_DB_NEW_LINK (overwrite new_link parameter for sql_connect) -PHPBB_ROOT_PATH (overwrite $phpbb_root_path) -PHPBB_ADMIN_PATH (overwrite $phpbb_admin_path) -PHPBB_USE_BOARD_URL_PATH (use generate_board_url() for image paths instead of $phpbb_root_path) -</pre></div> - -<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> - <li>/includes/user.php - phpbb_user::img()</li> - <li>/includes/functions_content.php - smiley_text()</li> -</ul> - -<p>Path locations for the following template variables are affected by this too:</p> - -<ul> - <li>{T_ASSETS_PATH} - assets</li> - <li>{T_THEME_PATH} - styles/xxx/theme</li> - <li>{T_TEMPLATE_PATH} - styles/xxx/template</li> - <li>{T_SUPER_TEMPLATE_PATH} - styles/xxx/template</li> - <li>{T_IMAGESET_PATH} - styles/xxx/imageset</li> - <li>{T_IMAGESET_LANG_PATH} - styles/xxx/imageset/yy</li> - <li>{T_IMAGES_PATH} - images/</li> - <li>{T_SMILIES_PATH} - $config['smilies_path']/</li> - <li>{T_AVATAR_PATH} - $config['avatar_path']/</li> - <li>{T_AVATAR_GALLERY_PATH} - $config['avatar_gallery_path']/</li> - <li>{T_ICONS_PATH} - $config['icons_path']/</li> - <li>{T_RANKS_PATH} - $config['ranks_path']/</li> - <li>{T_UPLOAD_PATH} - $config['upload_path']/</li> - <li>{T_STYLESHEET_LINK} - styles/xxx/theme/stylesheet.css (or link to style.php if css is parsed dynamically)</li> - <li>New template variable {BOARD_URL} for the board url + script path.</li> -</ul> - - - </div> - - <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - - <span class="corners-bottom"><span></span></span></div> - </div> - - <a name="use"></a><h2>2. Allow hooks in functions/methods</h2> - - <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div class="content"> - -<p>The following examples explain how phpBB3 utilize the in-build hook system. You will be more interested in registering your hooks, but showing you this may help you understand the system better along the way.</p> - -<p>First of all, this is how a function need to be layed out if you want to allow it to be hookable...</p> - -<div class="codebox"><pre> -function my_own_function($my_first_parameter, $my_second_parameter) -{ - global $phpbb_hook; - - if ($phpbb_hook->call_hook(__FUNCTION__, $my_first_parameter, $my_second_parameter)) - { - if ($phpbb_hook->hook_return(__FUNCTION__)) - { - return $phpbb_hook->hook_return_result(__FUNCTION__); - } - } - - [YOUR CODE HERE] -} -</pre></div> - -<p>Above, the call_hook function should always be mapping your function call... in regard to the number of parameters passed.</p> - -<p>This is how you could make a method being hookable...</p> - -<div class="codebox"><pre> -class my_hookable_object -{ - function hook_me($my_first_parameter, $my_second_parameter) - { - global $phpbb_hook; - - if ($phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $my_first_parameter, $my_second_parameter)) - { - if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__))) - { - return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__)); - } - } - - [YOUR CODE HERE] - } -} -</pre></div> - -<p>The only difference about calling it is the way you define the first parameter. For a function it is only <code>__FUNCTION__</code>, for a method it is <code>array(__CLASS__, __FUNCTION__)</code>. In PHP4 __CLASS__ is always returning the class in lowercase.</p> - -<p>Now, in phpBB there are some pre-defined hooks available, but how do you make your own hookable function available (and therefore allowing others to hook into it)? For this, there is the add_hook() method:</p> - -<div class="codebox"><pre> -// Adding your own hookable function: -$phpbb_hook->add_hook('my_own_function'); - -// Adding your own hookable method: -$phpbb_hook->add_hook(array('my_hookable_object', 'hook_me')); -</pre></div> - -<p>You are also able to remove the possibility of hooking a function/method by calling <code>$phpbb_hook->remove_hook()</code> with the same parameters as add_hook().<br /> -This comes in handy if you want to force some hooks not to be called - at all.</p> - - </div> - - <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - - <span class="corners-bottom"><span></span></span></div> - </div> - - <a name="register"></a><h2>3. Registering hooks</h2> - - <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div class="content"> - - <h3>Registering hooks</h3> - -<p>Now to actually defining your functions which should be called. For this we take the append_sid() function as an example (this function is able to be hooked by default). We create two classes, one being static and a function:</p> - -<div class="codebox"><pre> -class my_append_sid_class -{ - // Our functions - function my_append_sid(&$hook, $url, $params = false, $is_amp = true, $session_id = false) - { - // Get possible previous results - $result = $hook->previous_hook_result('append_sid'); - - return $result['result'] . '<br />And i was the second one.'; - } -} - -// Yet another class :o -class my_second_append_sid_class -{ - function my_append_sid(&$hook, $url, $params = false, $is_amp = true, $session_id = false) - { - // Get possible previous results - $result = $hook->previous_hook_result('append_sid'); - - echo $result['result'] . '<br />I was called as the third one.'; - } -} - -// And a normal function -function my_append_sid(&$hook, $url, $params = false, $is_amp = true, $session_id = false) -{ - // Get possible previous results - $result = $hook->previous_hook_result('append_sid'); - - return 'I was called as the first one'; -} - -// Initializing the second class -$my_second_append_sid_class = new my_second_append_sid_class(); -</pre></div> - -<p>Make sure you add the same parameters to your function as is defined for the hookable function with one exception: The first variable is always <code>&$hook</code>... this is the hook object itself you are able to operate on.</p> - -<p>Now we register the hooks one by one with the <code>$phpbb_hook->register()</code> method:</p> - -<div class="codebox"><pre> -// Now, we register our append_sid "replacements" in a stacked way... -// Registering the function (this is called first) -$phpbb_hook->register('append_sid', 'my_append_sid'); - -// Registering the first class -$phpbb_hook->register('append_sid', array('my_append_sid_class', 'my_append_sid')); -$phpbb_hook->register('append_sid', array(&$my_second_append_sid_class, 'my_append_sid')); -</pre></div> - -<p>With this you are even able to make your own functions that are already hooked itself being hooked again...</p> - -<div class="codebox"><pre> -// Registering hook, which will be called -$phpbb_hook->register('append_sid', 'my_own_append_sid'); - -// Add hook to our called hook function -$phpbb_hook->add_hook('my_own_append_sid'); - -// Register added hook -$phpbb_hook->register('my_own_append_sid', 'also_my_own_append_sid'); -</pre></div> - - <h3>Special treatment/chains</h3> - - <p>The <code>register</code> method is able to take a third argument to specify a special 'chain' mode. The valid modes are <code>first</code>, <code>last</code> and <code>standalone</code></p> - - <p><code>$phpbb_hook->register('append_sid', 'my_own_append_sid', 'first')</code> would make sure that the function is called in the beginning of the chain. It is possible that more than one function is called within the first block - here the FIFO principle is used.</p> - - <p><code>$phpbb_hook->register('append_sid', 'my_own_append_sid', 'last')</code> would make sure that the function is called at the very end of the chain. It is possible that more than one function is called within the last block - here the FIFO principle is used.</p> - - <p><code>$phpbb_hook->register('append_sid', 'my_own_append_sid', 'standalone')</code> makes sure only the defined function is called. All other functions are removed from the chain and no other functions are added to it later on. If two applications try to trigger the standalone mode a PHP notice will be printed and the second function being discarded.</p> - - <h3>Only allowing hooks for some objects</h3> - - <p>Because the hook system is not able to differate between initialized objects and only operate on the class, you need to solve this on the code level.</p> - - <p>One possibility would be to use a property:</p> - - <div class="codebox"><pre> -class my_hookable_object -{ - function blabla() - { - } -} - -class my_hookable_object2 extends my_hookable_object -{ - var $call_hook = true; - - function hook_me($my_first_parameter, $my_second_parameter) - { - if ($this->call_hook) - { - global $phpbb_hook; - - if ($phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $my_first_parameter, $my_second_parameter)) - { - if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__))) - { - return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__)); - } - } - } - - return 'not hooked'; - } -} - -function hooking(&$hook, $first, $second) -{ - return 'hooked'; -} - -$first_object = new my_hookable_object2(); -$second_object = new my_hookable_object2(); - -$phpbb_hook->add_hook(array('my_hookable_object2', 'hook_me')); - -$phpbb_hook->register(array('my_hookable_object2', 'hook_me'), 'hooking'); - -// Do not call the hook for $first_object -$first_object->call_hook = false; - -echo $first_object->hook_me('first', 'second') . '<br />'; -echo $second_object->hook_me('first', 'second') . '<br />'; -</pre></div> - -<p>OUTPUT:</p> - -<div class="codebox"><pre> -not hooked -hooked -</pre></div> - - <p>A different possibility would be using a function variable (which could be left out on passing the function variables to the hook):</p> - - <div class="codebox"><pre> -class my_hookable_object -{ - function blabla() - { - } -} - -class my_hookable_object2 extends my_hookable_object -{ - function hook_me($my_first_parameter, $my_second_parameter, $hook_me = true) - { - if ($hook_me) - { - global $phpbb_hook; - - if ($phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $my_first_parameter, $my_second_parameter)) - { - if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__))) - { - return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__)); - } - } - } - - return 'not hooked'; - } -} - -function hooking(&$hook, $first, $second) -{ - return 'hooked'; -} - -$first_object = new my_hookable_object2(); -$second_object = new my_hookable_object2(); - -$phpbb_hook->add_hook(array('my_hookable_object2', 'hook_me')); - -$phpbb_hook->register(array('my_hookable_object2', 'hook_me'), 'hooking'); - -echo $first_object->hook_me('first', 'second', false) . '<br />'; -echo $second_object->hook_me('first', 'second') . '<br />'; - </pre></div> - - <p>OUTPUT:</p> - - <div class="codebox"><pre> -not hooked -hooked - </pre></div> - - </div> - - <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - - <span class="corners-bottom"><span></span></span></div> - </div> - - <a name="return"></a><h2>4. Result returning</h2> - - <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div class="content"> - -<p>Generally, the distinction has to be made if a function returns the result obtained from the called function or continue the execution. Based on the needs of the application this may differ. Therefore, the function returns the results only if the called hook function is returning a result.</p> - -<h3>Case 1 - Returning the result</h3> - -<p>Imagine the following function supporting hooks:</p> - -<div class="codebox"><pre> -function append_sid($url, $params = false, $is_amp = true, $session_id = false) -{ - global $_SID, $_EXTRA_URL, $phpbb_hook; - - // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly. - // They could mimick most of what is within this function - if ($phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id)) - { - if ($phpbb_hook->hook_return(__FUNCTION__)) - { - return $phpbb_hook->hook_return_result(__FUNCTION__); - } - } - - [...] -} -</pre></div> - -<p>Now, the following function is yours. Since you return a value, the append_sid() function itself is returning it as is:</p> - -<div class="codebox"><pre> -// The function called -function my_append_sid(&$hook, $url, $params = false, $is_amp = true, $session_id = false) -{ - // Get possible previous results - $result = $hook->previous_hook_result('append_sid'); - - return 'Since i return something the append_sid() function will return my result.'; -} -</pre></div> - -<p>To be able to get the results returned from functions higher in the change the <code>previous_hook_result()</code> method should always be used, it returns an <code>array('result' => [your result])</code> construct.</p> - -<h3>Case 2 - Not Returning any result</h3> - -<p>Sometimes applications want to return nothing and therefore force the underlying function to continue it's execution:</p> - -<div class="codebox"><pre> -function append_sid($url, $params = false, $is_amp = true, $session_id = false) -{ - global $_SID, $_EXTRA_URL, $phpbb_hook; - - // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly. - // They could mimick most of what is within this function - if ($phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id)) - { - if ($phpbb_hook->hook_return(__FUNCTION__)) - { - return $phpbb_hook->hook_return_result(__FUNCTION__); - } - } - - [...] -} - -// The function called -function my_append_sid(&$hook, $url, $params = false, $is_amp = true, $session_id = false) -{ - // Get possible previous results - $result = $hook->previous_hook_result('append_sid'); - - [...] - - // I only rewrite some variables, but return nothing. Therefore, the append_sid() function will not return my (non)result. -} -</pre></div> - -<p>Please Note: The decision to return or not return is solely made of the very last function call within the hook chain. An example:</p> - -<div class="codebox"><pre> -// The function called -function my_append_sid(&$hook, $url, $params = false, $is_amp = true, $session_id = false) -{ - // Get possible previous results - $result = $hook->previous_hook_result('append_sid'); - - // $result is not filled - - return 'FILLED'; -} - -// This function is registered too and gets executed after my_append_sid() -function my_own_append_sid(&$hook, $url, $params = false, $is_amp = true, $session_id = false) -{ - $result = $hook->previous_hook_result('append_sid'); - - // $result is actually filled with $result['result'] = 'FILLED' - // But i return nothing, therefore append_sid() continues it's execution. -} - -// The way both functions are registered. -$phpbb_hook->register('append_sid', 'my_append_sid'); -$phpbb_hook->register('append_sid', 'my_own_append_sid'); -</pre></div> - - </div> - - <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - - <span class="corners-bottom"><span></span></span></div> - </div> - - <a name="embed"></a><h2>5. Embedding your hook files/classes/methods</h2> - - <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div class="content"> - -<p>There are basically two methods you are able to choose from:</p> - -<p>1) Add a file to includes/hooks/. The file need to be prefixed by <code>hook_</code>. This file is included within common.php, you are able to register your hooks, include other files or functions, etc. It is advised to only include other files if needed (within a function call for example).</p> - -<p>Please be aware that you need to purge your cache within the ACP to make your newly placed file available to phpBB3.</p> - -<p>2) The second method is meant for those wanting to wrap phpBB3 without placing a custom file to the hooks directory. This is mostly done by including phpBB's files within the application file. To be able to register your hooks you need to create a function within your application:</p> - -<div class="codebox"><pre> -// My function which gets executed within the hooks constuctor -function phpbb_hook_register(&$hook) -{ - $hook->register('append_sid', 'my_append_sid'); -} - -[...] -</pre></div> - -<p>You should get the idea. ;)</p> - - </div> - - <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - - <span class="corners-bottom"><span></span></span></div> - </div> - - <a name="disclaimer"></a><h2>6. Copyright and disclaimer</h2> - - <div class="paragraph"> - <div class="inner"><span class="corners-top"><span></span></span> - - <div class="content"> - - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> - - </div> - - <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div> - - <span class="corners-bottom"><span></span></span></div> - </div> - - <div id="page-footer"> - <div class="version"> </div> - </div> -</div></div> - -<div> - <a id="bottom" name="bottom" accesskey="z"></a> -</div> - -</body> -</html> diff --git a/phpBB/docs/install-config.sample.yml b/phpBB/docs/install-config.sample.yml new file mode 100644 index 0000000000..d49e322a1f --- /dev/null +++ b/phpBB/docs/install-config.sample.yml @@ -0,0 +1,35 @@ +installer: + admin: + name: admin + password: adminadmin + email: admin@example.org + + board: + lang: en + name: My Board + description: My amazing new phpBB board + + database: + dbms: sqlite3 + dbhost: /tmp/phpbb.sqlite3 + dbport: ~ + dbuser: ~ + dbpasswd: ~ + dbname: ~ + table_prefix: phpbb_ + + email: + enabled: false + smtp_delivery : ~ + smtp_host: ~ + smtp_auth: ~ + smtp_user: ~ + smtp_pass: ~ + + server: + cookie_secure: false + server_protocol: http:// + force_server_vars: false + server_name: localhost + server_port: 80 + script_path: / diff --git a/phpBB/docs/nginx.sample.conf b/phpBB/docs/nginx.sample.conf index c82f5c8e49..2ead3552fd 100644 --- a/phpBB/docs/nginx.sample.conf +++ b/phpBB/docs/nginx.sample.conf @@ -64,6 +64,11 @@ http { location / { # phpbb uses index.htm index index.php index.html index.htm; + try_files $uri $uri/ @rewriteapp; + } + + location @rewriteapp { + rewrite ^(.*)$ /app.php/$1 last; } # Deny access to internal phpbb files. @@ -75,12 +80,16 @@ http { } # Pass the php scripts to fastcgi server specified in upstream declaration. - location ~ \.php$ { - fastcgi_pass php; - # Necessary for php. - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + location ~ \.php(/|$) { # Unmodified fastcgi_params from nginx distribution. include fastcgi_params; + # Necessary for php. + fastcgi_split_path_info ^(.+\.php)(/.*)$; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + try_files $uri $uri/ /app.php$is_args$args; + fastcgi_pass php; } # Deny access to version control system directories. diff --git a/phpBB/docs/site_logo.gif b/phpBB/docs/site_logo.gif Binary files differdeleted file mode 100644 index 909114c377..0000000000 --- a/phpBB/docs/site_logo.gif +++ /dev/null diff --git a/phpBB/docs/sphinx.sample.conf b/phpBB/docs/sphinx.sample.conf index 620ec25761..0a210ecd1a 100644 --- a/phpBB/docs/sphinx.sample.conf +++ b/phpBB/docs/sphinx.sample.conf @@ -38,7 +38,7 @@ source source_phpbb_{SPHINX_ID}_main sql_attr_bool = deleted sql_attr_timestamp = post_time sql_attr_timestamp = topic_last_post_time - sql_attr_str2ordinal = post_subject + sql_attr_string = post_subject } source source_phpbb_{SPHINX_ID}_delta : source_phpbb_{SPHINX_ID}_main { diff --git a/phpBB/docs/stylesheet.css b/phpBB/docs/stylesheet.css deleted file mode 100644 index 6b8f5994c0..0000000000 --- a/phpBB/docs/stylesheet.css +++ /dev/null @@ -1,352 +0,0 @@ -/* - The original "prosilver" theme for phpBB3 - Created by subBlue design :: http://www.subBlue.com -*/ - -* { margin: 0; padding: 0; } - -html { font-size: 100%; height: 100%; margin-bottom: 1px; } - -body { - font-family: Verdana, Helvetica, Arial, sans-serif; - color: #828282; - background-color: #FFFFFF; - font-size: 12px; - margin: 0; - padding: 12px 0; -} - -img { border-width: 0; } - -p { - line-height: 1.3em; - font-size: 1.1em; - margin-bottom: 1.5em; -} - -hr { - border: 0 none #FFFFFF; - border-top: 1px solid #CCCCCC; - height: 1px; - margin: 5px 0; - display: block; - clear: both; -} - -html, body { - color: #536482; - background-color: #FFFFFF; -} - -#doc-description h1 { - font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - margin-right: 200px; - color: #FFFFFF; - margin-top: 15px; - font-weight: bold; - font-size: 2em; - color: #fff; -} - -h1 { - font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - font-weight: normal; - color: #000; - font-size: 2em; - margin: 0.8em 0 0.2em 0; -} - -h2 { - font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - font-weight: normal; - color: #28313F; - font-size: 1.5em; - margin: 0.8em 0 0.2em 0; -} - -h3 { - font-family: Arial, Helvetica, sans-serif; - font-weight: bold; - border-bottom: 1px solid #CCCCCC; - margin-bottom: 3px; - padding-bottom: 2px; - font-size: 1.05em; - color: #115098; - margin-top: 20px; -} - -h4 { - font-family: Arial, Helvetica, sans-serif; - font-weight: bold; - margin-bottom: 3px; - padding-bottom: 2px; - font-size: 1.05em; - color: #115098; - margin-top: 20px; -} - -.good { color: green; } -.bad { color: red; } - -.version { - margin-top: 20px; - text-align: left; - font-size: 70%; - color: #006600; - border-top: 1px solid #ccc; -} - -code { - color: #006600; - font-weight: normal; - font-family: 'Courier New', monospace; - border-color: #D1D7DC; - border-width: 1px; - border-style: solid; - background-color: #FAFAFA; -} - -#wrap { - padding: 0 20px; - min-width: 650px; -} - -#simple-wrap { - padding: 6px 10px; -} - -#page-body { - margin: 4px 0; - clear: both; -} - -#page-footer { - clear: both; -} - -#logo { - float: left; - width: auto; - padding: 10px 13px 0 10px; -} - -a#logo:hover { - text-decoration: none; -} - -#doc-description { - float: left; - width: 70%; -} - -#doc-description h1 { - margin-right: 0; -} - -.headerbar { - background: #ebebeb none repeat-x 0 0; - color: #FFFFFF; - margin-bottom: 4px; - padding: 0 5px; -} - -span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span { - font-size: 1px; - line-height: 1px; - display: block; - height: 5px; - background-repeat: no-repeat; -} - -span.corners-top { - background-image: none; - background-position: 0 0; - margin: 0 -5px; -} - -span.corners-top span { - background-image: none; - background-position: 100% 0; -} - -span.corners-bottom { - background-image: none; - background-position: 0 100%; - margin: 0 -5px; - clear: both; -} - -span.corners-bottom span { - background-image: none; - background-position: 100% 100%; -} - -.paragraph { - padding: 0 10px; - margin-bottom: 4px; - background-repeat: no-repeat; - background-position: 100% 0; - background-color: #ECF3F7; -} - -.paragraph:target .content { - color: #000000; -} - -.paragraph:target h3 a { - color: #000000; -} - -.content { - color: #333333; -} - -.content h2, .panel h2 { - color: #115098; - border-bottom-color: #CCCCCC; -} - -a:link { color: #898989; text-decoration: none; } -a:visited { color: #898989; text-decoration: none; } -a:hover { color: #d3d3d3; text-decoration: underline; } -a:active { color: #d2d2d2; text-decoration: none; } - -hr { - border-color: #FFFFFF; - border-top-color: #CCCCCC; -} - -.menu { - background-color: #cadceb; -} - -.headerbar { - background-color: #12A3EB; - background-image: url("bg_header.gif"); - color: #FFFFFF; -} - -.panel { - background-color: #ECF1F3; - color: #28313F; -} - - -span.corners-top { - background-image: url("corners_left.png"); -} - -span.corners-top span { - background-image: url("corners_right.png"); -} - -span.corners-bottom { - background-image: url("corners_left.png"); -} - -span.corners-bottom span { - background-image: url("corners_right.png"); -} - -.error { - color: #BC2A4D; -} - -a:link { color: #105289; } -a:visited { color: #105289; } -a:hover { color: #D31141; } -a:active { color: #368AD2; } - -.paragraph span.corners-top, .paragraph span.corners-bottom { - margin: 0 -10px; -} - -.content { - padding: 0; - line-height: 1.48em; - color: #333333; -} - -.content h2, .panel h2 { - color: #115098; - border-bottom-color: #CCCCCC; -} - -.notice { - border-top-color: #CCCCCC; -} - -.codebox { - padding: 3px; - background-color: #FFFFFF; - border: 1px solid #C9D2D8; - font-size: 1em; - margin-bottom: 10px; - display: block; - font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; - line-height: 1.3em; -} - -* html hr { margin: 0; } -* html span.corners-top, * html span.corners-bottom { background-image: url("corners_left.gif"); } -* html span.corners-top span, * html span.corners-bottom span { background-image: url("corners_right.gif"); } - -.back2top { - clear: both; - height: 11px; - text-align: right; -} - -.content ol, .content ul { - margin-left: 25px; - margin-top: 0; -} - -.content ul + p, .content ul + div { - margin-top: 20px; -} - -.comment { - color: green; -} - -.indent { - margin-left: 20px; -} - -.paragraph table { - font-size: 8pt; - border-collapse: collapse; - border: 1px solid #cfcfcf; - margin-bottom: 20px; -} - -.paragraph table caption { - display: none; -} - -.paragraph table thead { - background-color: #cadceb; - color: #000; -} - -.paragraph table td, .paragraph table th { - border: 1px solid #006699; - padding: 0.5em; - background-color: #e1ebf2; -} - -.paragraph table th { - background-color: #cadceb; -} - -.paragraph table td dl { - margin: 0; - padding: 0; -} - -.paragraph table td dl dt { - float: left; - clear: both; - margin-right: 1em; -} diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 163ab673b9..7a20145968 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -1,16 +1,16 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; - /** * @ignore */ @@ -34,64 +34,72 @@ else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT' if (isset($_GET['avatar'])) { require($phpbb_root_path . 'includes/startup.' . $phpEx); - require($phpbb_root_path . 'config.' . $phpEx); + + require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); + $phpbb_class_loader->register(); + + $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); + extract($phpbb_config_php_file->get_all()); + + if (!defined('PHPBB_ENVIRONMENT')) + { + @define('PHPBB_ENVIRONMENT', 'production'); + } if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) { exit; } - require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); - require($phpbb_root_path . 'includes/functions_container.' . $phpEx); require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Setup class loader first - $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); - $phpbb_class_loader->register(); $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); // Set up container - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container(); $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); // set up caching + /* @var $cache \phpbb\cache\service */ $cache = $phpbb_container->get('cache'); + /* @var $phpbb_dispatcher \phpbb\event\dispatcher */ $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + + /* @var $request \phpbb\request\request_interface */ $request = $phpbb_container->get('request'); + + /* @var $db \phpbb\db\driver\driver_interface */ $db = $phpbb_container->get('dbal.conn'); + + /* @var $phpbb_log \phpbb\log\log_interface */ $phpbb_log = $phpbb_container->get('log'); - // Connect to DB - if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false)) - { - exit; - } unset($dbpasswd); - request_var('', 0, false, false, $request); - + /* @var $config \phpbb\config\config */ $config = $phpbb_container->get('config'); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); // load extensions + /* @var $phpbb_extension_manager \phpbb\extension\manager */ $phpbb_extension_manager = $phpbb_container->get('ext.manager'); - $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); // worst-case default $browser = strtolower($request->header('User-Agent', 'msie 6.0')); + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); - $filename = request_var('avatar', ''); + $filename = $request->variable('avatar', ''); $avatar_group = false; $exit = false; @@ -142,13 +150,9 @@ if (isset($_GET['avatar'])) include($phpbb_root_path . 'common.' . $phpEx); require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); -$download_id = request_var('id', 0); -$topic_id = $request->variable('topic_id', 0); -$post_id = $request->variable('post_id', 0); -$msg_id = $request->variable('msg_id', 0); -$archive = $request->variable('archive', '.tar'); -$mode = request_var('mode', ''); -$thumbnail = request_var('t', false); +$attach_id = $request->variable('id', 0); +$mode = $request->variable('mode', ''); +$thumbnail = $request->variable('t', false); // Start session management, do not update session page. $user->session_begin(false); @@ -161,27 +165,7 @@ if (!$config['allow_attachments'] && !$config['allow_pm_attach']) trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); } -if ($download_id) -{ - // Attachment id (only 1 attachment) - $sql_where = 'attach_id = ' . $download_id; -} -else if ($msg_id) -{ - // Private message id (multiple attachments) - $sql_where = 'is_orphan = 0 AND in_message = 1 AND post_msg_id = ' . $msg_id; -} -else if ($post_id) -{ - // Post id (multiple attachments) - $sql_where = 'is_orphan = 0 AND in_message = 0 AND post_msg_id = ' . $post_id; -} -else if ($topic_id) -{ - // Topic id (multiple attachments) - $sql_where = 'is_orphan = 0 AND topic_id = ' . $topic_id; -} -else +if (!$attach_id) { send_status_line(404, 'Not Found'); trigger_error('NO_ATTACHMENT_SELECTED'); @@ -189,25 +173,12 @@ else $sql = 'SELECT attach_id, post_msg_id, topic_id, in_message, poster_id, is_orphan, physical_filename, real_filename, extension, mimetype, filesize, filetime FROM ' . ATTACHMENTS_TABLE . " - WHERE $sql_where"; + WHERE attach_id = $attach_id"; $result = $db->sql_query($sql); - -$attachments = $attachment_ids = array(); -while ($row = $db->sql_fetchrow($result)) -{ - $attachment_id = (int) $row['attach_id']; - - $row['physical_filename'] = utf8_basename($row['physical_filename']); - - $attachment_ids[$attachment_id] = $attachment_id; - $attachments[$attachment_id] = $row; -} +$attachment = $db->sql_fetchrow($result); $db->sql_freeresult($result); -// Make $attachment the first of the attachments we fetched. -$attachment = current($attachments); - -if (empty($attachments)) +if (!$attachment) { send_status_line(404, 'Not Found'); trigger_error('ERROR_NO_ATTACHMENT'); @@ -217,9 +188,9 @@ else if (!download_allowed()) send_status_line(403, 'Forbidden'); trigger_error($user->lang['LINKAGE_FORBIDDEN']); } -else if ($download_id) +else { - // sizeof($attachments) == 1 + $attachment['physical_filename'] = utf8_basename($attachment['physical_filename']); if (!$attachment['in_message'] && !$config['allow_attachments'] || $attachment['in_message'] && !$config['allow_pm_attach']) { @@ -264,12 +235,12 @@ else if ($download_id) else { // Attachment is in a private message. - $row['forum_id'] = false; + $post_row = array('forum_id' => false); phpbb_download_handle_pm_auth($db, $auth, $user->data['user_id'], $attachment['post_msg_id']); } $extensions = array(); - if (!extension_allowed($row['forum_id'], $attachment['extension'], $extensions)) + if (!extension_allowed($post_row['forum_id'], $attachment['extension'], $extensions)) { send_status_line(403, 'Forbidden'); trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); @@ -289,6 +260,31 @@ else if ($download_id) $display_cat = ATTACHMENT_CATEGORY_NONE; } + /** + * Event to modify data before sending file to browser + * + * @event core.download_file_send_to_browser_before + * @var int attach_id The attachment ID + * @var array attachment Array with attachment data + * @var int display_cat Attachment category + * @var int download_mode File extension specific download mode + * @var array extensions Array with file extensions data + * @var string mode Download mode + * @var bool thumbnail Flag indicating if the file is a thumbnail + * @since 3.1.6-RC1 + * @change 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions") + */ + $vars = array( + 'attach_id', + 'attachment', + 'display_cat', + 'download_mode', + 'extensions', + 'mode', + 'thumbnail', + ); + extract($phpbb_dispatcher->trigger_event('core.download_file_send_to_browser_before', compact($vars))); + if ($thumbnail) { $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; @@ -326,142 +322,3 @@ else if ($download_id) } } } -else -{ - // sizeof($attachments) >= 1 - if ($attachment['in_message']) - { - phpbb_download_handle_pm_auth($db, $auth, $user->data['user_id'], $attachment['post_msg_id']); - } - else - { - phpbb_download_handle_forum_auth($db, $auth, $attachment['topic_id']); - } - - if (!class_exists('compress')) - { - require $phpbb_root_path . 'includes/functions_compress.' . $phpEx; - } - - if (!in_array($archive, compress::methods())) - { - $archive = '.tar'; - } - - $post_visibility = array(); - if ($msg_id) - { - $sql = 'SELECT message_subject AS attach_subject - FROM ' . PRIVMSGS_TABLE . " - WHERE msg_id = $msg_id"; - } - else if ($post_id) - { - $sql = 'SELECT post_subject AS attach_subject, forum_id, post_visibility - FROM ' . POSTS_TABLE . " - WHERE post_id = $post_id"; - } - else - { - $sql = 'SELECT post_id, post_visibility - FROM ' . POSTS_TABLE . " - WHERE topic_id = $topic_id - AND post_attachment = 1"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - $post_visibility[(int) $row['post_id']] = (int) $row['post_visibility']; - } - $db->sql_freeresult($result); - - $sql = 'SELECT topic_title AS attach_subject, forum_id - FROM ' . TOPICS_TABLE . " - WHERE topic_id = $topic_id"; - } - - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (empty($row)) - { - send_status_line(404, 'Not Found'); - trigger_error('ERROR_NO_ATTACHMENT'); - } - - $clean_name = phpbb_download_clean_filename($row['attach_subject']); - $suffix = '_' . (($msg_id) ? 'm' . $msg_id : (($post_id) ? 'p' . $post_id : 't' . $topic_id)) . '_' . $clean_name; - $archive_name = 'attachments' . $suffix; - - $store_name = 'att_' . time() . '_' . unique_id(); - $archive_path = "{$phpbb_root_path}store/{$store_name}{$archive}"; - - if ($archive === '.zip') - { - $compress = new compress_zip('w', $archive_path); - } - else - { - $compress = new compress_tar('w', $archive_path, $archive); - } - - $extensions = array(); - $files_added = 0; - $forum_id = ($attachment['in_message']) ? false : (int) $row['forum_id']; - $disallowed_extension = array(); - - foreach ($attachments as $attach) - { - if (!extension_allowed($forum_id, $attach['extension'], $extensions)) - { - $disallowed_extension[$attach['extension']] = $attach['extension']; - continue; - } - - if ($post_id && $row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id)) - { - // Attachment of a soft deleted post and the user is not allowed to see the post - continue; - } - - if ($topic_id && (!isset($post_visibility[$attach['post_msg_id']]) || $post_visibility[$attach['post_msg_id']] != ITEM_APPROVED) && !$auth->acl_get('m_approve', $forum_id)) - { - // Attachment of a soft deleted post and the user is not allowed to see the post - continue; - } - - $prefix = ''; - if ($topic_id) - { - $prefix = $attach['post_msg_id'] . '_'; - } - - $compress->add_custom_file("{$phpbb_root_path}files/{$attach['physical_filename']}", "{$prefix}{$attach['real_filename']}"); - $files_added++; - } - - $compress->close(); - - if ($files_added) - { - phpbb_increment_downloads($db, $attachment_ids); - $compress->download($store_name, $archive_name); - } - - unlink($archive_path); - - if (!$files_added && !empty($disallowed_extension)) - { - // None of the attachments had a valid extension - $disallowed_extension = implode($user->lang['COMMA_SEPARATOR'], $disallowed_extension); - send_status_line(403, 'Forbidden'); - trigger_error($user->lang('EXTENSION_DISABLED_AFTER_POSTING', $disallowed_extension)); - } - else if (!$files_added) - { - send_status_line(404, 'Not Found'); - trigger_error('ERROR_NO_ATTACHMENT'); - } - - file_gc(); -} diff --git a/phpBB/includes/db/index.htm b/phpBB/ext/index.htm index ee1f723a7d..ee1f723a7d 100644 --- a/phpBB/includes/db/index.htm +++ b/phpBB/ext/index.htm diff --git a/phpBB/faq.php b/phpBB/faq.php index 052f78816e..36a33c97a8 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,67 +24,13 @@ $user->session_begin(); $auth->acl($user->data); $user->setup(); -$mode = request_var('mode', ''); - -// Load the appropriate faq file -switch ($mode) -{ - case 'bbcode': - $l_title = $user->lang['BBCODE_GUIDE']; - $user->add_lang('bbcode', false, true); - break; - - default: - $l_title = $user->lang['FAQ_EXPLAIN']; - $user->add_lang('faq', false, true); - break; -} - -// Pull the array data from the lang pack -$switch_column = $found_switch = false; -$help_blocks = array(); -foreach ($user->help as $help_ary) -{ - if ($help_ary[0] == '--') - { - if ($help_ary[1] == '--') - { - $switch_column = true; - $found_switch = true; - continue; - } - - $template->assign_block_vars('faq_block', array( - 'BLOCK_TITLE' => $help_ary[1], - 'SWITCH_COLUMN' => $switch_column, - )); +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); - if ($switch_column) - { - $switch_column = false; - } - continue; - } - - $template->assign_block_vars('faq_block.faq_row', array( - 'FAQ_QUESTION' => $help_ary[0], - 'FAQ_ANSWER' => $help_ary[1]) - ); -} - -// Lets build a page ... -$template->assign_vars(array( - 'L_FAQ_TITLE' => $l_title, - 'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP'], - - 'SWITCH_COLUMN_MANUALLY' => (!$found_switch) ? true : false, -)); - -page_header($l_title, false); - -$template->set_filenames(array( - 'body' => 'faq_body.html') +$response = new \Symfony\Component\HttpFoundation\RedirectResponse( + $controller_helper->route( + $request->variable('mode', 'faq') === 'bbcode' ? 'phpbb_help_bbcode_controller' : 'phpbb_help_faq_controller' + ), + 301 ); -make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); - -page_footer(); +$response->send(); diff --git a/phpBB/feed.php b/phpBB/feed.php index 35cd7fda3f..1480867d6c 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -1,8 +1,13 @@ <?php /** -* @package phpBB3 -* @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * * Idea and original RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21 * Original MOD: http://www.phpbb.com/community/viewtopic.php?f=69&t=1214645 @@ -11,6 +16,9 @@ * **/ +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Routing\Exception\InvalidParameterException; + /** * @ignore **/ @@ -19,217 +27,32 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); -if (!$config['feed_enable']) -{ - trigger_error('NO_FEED_ENABLED'); -} - -// Start session -$user->session_begin(); - -if (!empty($config['feed_http_auth']) && request_var('auth', '') == 'http') -{ - phpbb_http_login(array( - 'auth_message' => 'Feed', - 'viewonline' => request_var('viewonline', true), - )); -} - -$auth->acl($user->data); -$user->setup(); - -// Initial var setup -$forum_id = request_var('f', 0); -$topic_id = request_var('t', 0); -$mode = request_var('mode', ''); - -// We do not use a template, therefore we simply define the global template variables here -$global_vars = $item_vars = array(); -$feed_updated_time = 0; - -// Generate params array for use in append_sid() to correctly link back to this page -$params = false; -if ($forum_id || $topic_id || $mode) -{ - $params = array( - 'f' => ($forum_id) ? $forum_id : NULL, - 't' => ($topic_id) ? $topic_id : NULL, - 'mode' => ($mode) ? $mode : NULL, - ); -} - -// This boards URL -$phpbb_feed_helper = $phpbb_container->get('feed.helper'); -$board_url = $phpbb_feed_helper->get_board_url(); - -// Get correct feed object -$phpbb_feed_factory = $phpbb_container->get('feed.factory'); -$feed = $phpbb_feed_factory->get_feed($mode, $forum_id, $topic_id); - -// No feed found -if ($feed === false) -{ - trigger_error('NO_FEED'); -} - -// Open Feed -$feed->open(); - -// Iterate through items -while ($row = $feed->get_item()) -{ - // BBCode options to correctly disable urls, smilies, bbcode... - if ($feed->get('options') === NULL) - { - // Allow all combinations - $options = 7; - - if ($feed->get('enable_bbcode') !== NULL && $feed->get('enable_smilies') !== NULL && $feed->get('enable_magic_url') !== NULL) - { - $options = (($row[$feed->get('enable_bbcode')]) ? OPTION_FLAG_BBCODE : 0) + (($row[$feed->get('enable_smilies')]) ? OPTION_FLAG_SMILIES : 0) + (($row[$feed->get('enable_magic_url')]) ? OPTION_FLAG_LINKS : 0); - } - } - else - { - $options = $row[$feed->get('options')]; - } - - $title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : ''); - - $published = ($feed->get('published') !== NULL) ? (int) $row[$feed->get('published')] : 0; - $updated = ($feed->get('updated') !== NULL) ? (int) $row[$feed->get('updated')] : 0; - - $item_row = array( - 'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '', - 'published' => ($published > 0) ? $phpbb_feed_helper->format_date($published) : '', - 'updated' => ($updated > 0) ? $phpbb_feed_helper->format_date($updated) : '', - 'link' => '', - 'title' => censor_text($title), - 'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '', - 'category_name' => ($config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '', - 'description' => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options)), - 'statistics' => '', - ); - - // Adjust items, fill link, etc. - $feed->adjust_item($item_row, $row); - - $item_vars[] = $item_row; - - $feed_updated_time = max($feed_updated_time, $published, $updated); -} - -// If we do not have any items at all, sending the current time is better than sending no time. -if (!$feed_updated_time) -{ - $feed_updated_time = time(); -} - -// Some default assignments -// FEED_IMAGE is not used (atom) -$global_vars = array_merge($global_vars, array( - 'FEED_IMAGE' => '', - 'SELF_LINK' => $phpbb_feed_helper->append_sid('feed.' . $phpEx, $params), - 'FEED_LINK' => $board_url . '/index.' . $phpEx, - 'FEED_TITLE' => $config['sitename'], - 'FEED_SUBTITLE' => $config['site_desc'], - 'FEED_UPDATED' => $phpbb_feed_helper->format_date($feed_updated_time), - 'FEED_LANG' => $user->lang['USER_LANG'], - 'FEED_AUTHOR' => $config['sitename'], -)); +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); -$feed->close(); +$forum_id = $request->variable('f', 0); +$topic_id = $request->variable('t', 0); +$mode = $request->variable('mode', ''); -// Output page - -// gzip_compression -if ($config['gzip_compress']) +if ($forum_id !== 0) { - if (@extension_loaded('zlib') && !headers_sent()) - { - ob_start('ob_gzhandler'); - } + $url = $controller_helper->route('phpbb_feed_forum', array('forum_id' => $forum_id)); } - -// IF debug extra is enabled and admin want to "explain" the page we need to set other headers... -if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_')) +else if ($topic_id !== 0) { - header('Content-type: text/html; charset=UTF-8'); - header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: 0'); - header('Pragma: no-cache'); - - $mtime = explode(' ', microtime()); - $totaltime = $mtime[0] + $mtime[1] - $starttime; - - if (method_exists($db, 'sql_report')) - { - $db->sql_report('display'); - } - - garbage_collection(); - exit_handler(); + $url = $controller_helper->route('phpbb_feed_topic', array('topic_id' => $topic_id)); } - -header("Content-Type: application/atom+xml; charset=UTF-8"); -header("Last-Modified: " . gmdate('D, d M Y H:i:s', $feed_updated_time) . ' GMT'); - -if (!empty($user->data['is_bot'])) +else { - // Let reverse proxies know we detected a bot. - header('X-PHPBB-IS-BOT: yes'); -} - -echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; -echo '<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="' . $global_vars['FEED_LANG'] . '">' . "\n"; -echo '<link rel="self" type="application/atom+xml" href="' . $global_vars['SELF_LINK'] . '" />' . "\n\n"; - -echo (!empty($global_vars['FEED_TITLE'])) ? '<title>' . $global_vars['FEED_TITLE'] . '</title>' . "\n" : ''; -echo (!empty($global_vars['FEED_SUBTITLE'])) ? '<subtitle>' . $global_vars['FEED_SUBTITLE'] . '</subtitle>' . "\n" : ''; -echo (!empty($global_vars['FEED_LINK'])) ? '<link href="' . $global_vars['FEED_LINK'] .'" />' . "\n" : ''; -echo '<updated>' . $global_vars['FEED_UPDATED'] . '</updated>' . "\n\n"; - -echo '<author><name><![CDATA[' . $global_vars['FEED_AUTHOR'] . ']]></name></author>' . "\n"; -echo '<id>' . $global_vars['SELF_LINK'] . '</id>' . "\n"; - -foreach ($item_vars as $row) -{ - echo '<entry>' . "\n"; - - if (!empty($row['author'])) + try { - echo '<author><name><![CDATA[' . $row['author'] . ']]></name></author>' . "\n"; + $url = $controller_helper->route('phpbb_feed_overall', array('mode' => $mode)); } - - echo '<updated>' . ((!empty($row['updated'])) ? $row['updated'] : $row['published']) . '</updated>' . "\n"; - - if (!empty($row['published'])) + catch (InvalidParameterException $e) { - echo '<published>' . $row['published'] . '</published>' . "\n"; + $url = $controller_helper->route('phpbb_feed_index'); } - - echo '<id>' . $row['link'] . '</id>' . "\n"; - echo '<link href="' . $row['link'] . '"/>' . "\n"; - echo '<title type="html"><![CDATA[' . $row['title'] . ']]></title>' . "\n\n"; - - if (!empty($row['category']) && isset($row['category_name']) && $row['category_name'] !== '') - { - echo '<category term="' . $row['category_name'] . '" scheme="' . $row['category'] . '" label="' . $row['category_name'] . '"/>' . "\n"; - } - - echo '<content type="html" xml:base="' . $row['link'] . '"><![CDATA[' . "\n"; - echo $row['description']; - - if (!empty($row['statistics'])) - { - echo '<p>' . $user->lang['STATISTICS'] . ': ' . $row['statistics'] . '</p>'; - } - - echo '<hr />' . "\n" . ']]></content>' . "\n"; - echo '</entry>' . "\n"; } -echo '</feed>'; - -garbage_collection(); -exit_handler(); +$response = new RedirectResponse($url, 301); +$response->send(); diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 958a6456c2..6e9360f599 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,12 +19,9 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_attachments { - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var \phpbb\config\config */ @@ -35,14 +36,20 @@ class acp_attachments /** @var \phpbb\user */ protected $user; + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \phpbb\attachment\manager */ + protected $attachment_manager; + public $id; public $u_action; protected $new_config; function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $phpbb_container; - global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; + global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_filesystem; + global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log, $request; $this->id = $id; $this->db = $db; @@ -50,12 +57,14 @@ class acp_attachments $this->template = $template; $this->user = $user; $this->phpbb_container = $phpbb_container; + $this->filesystem = $phpbb_filesystem; + $this->attachment_manager = $phpbb_container->get('attachment.manager'); $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); $error = $notify = array(); $submit = (isset($_POST['submit'])) ? true : false; - $action = request_var('action', ''); + $action = $request->variable('action', ''); $form_key = 'acp_attach'; add_form_key($form_key); @@ -105,7 +114,10 @@ class acp_attachments { case 'attach': - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + if (!function_exists('get_supported_image_types')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } $sql = 'SELECT group_name, cat_id FROM ' . EXTENSION_GROUPS_TABLE . ' @@ -147,20 +159,19 @@ class acp_attachments 'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'check_attachment_content' => array('lang' => 'CHECK_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'legend2' => $l_legend_cat_images, 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), - 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => ' <span>[ <a href="' . $this->u_action . '&action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'), + 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'absolute_path', 'type' => 'text:20:200', 'explain' => true, 'append' => ' <span>[ <a href="' . $this->u_action . '&action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'), 'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), ) ); $this->new_config = $config; - $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $this->new_config; + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => '')) : $this->new_config; $error = array(); // We validate the complete config if whished @@ -184,13 +195,13 @@ class acp_attachments if (in_array($config_name, array('attachment_quota', 'max_filesize', 'max_filesize_pm'))) { - $size_var = request_var($config_name, ''); + $size_var = $request->variable($config_name, ''); $this->new_config[$config_name] = $config_value = ($size_var == 'kb') ? round($config_value * 1024) : (($size_var == 'mb') ? round($config_value * 1048576) : $config_value); } if ($submit) { - set_config($config_name, $config_value); + $config->set($config_name, $config_value); } } @@ -198,7 +209,7 @@ class acp_attachments if ($submit) { - add_log('admin', 'LOG_CONFIG_ATTACH'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_ATTACH'); // Check Settings $this->test_upload($error, $this->new_config['upload_path'], false); @@ -334,8 +345,8 @@ class acp_attachments if ($submit) { // Change Extensions ? - $extension_change_list = request_var('extension_change_list', array(0)); - $group_select_list = request_var('group_select', array(0)); + $extension_change_list = $request->variable('extension_change_list', array(0)); + $group_select_list = $request->variable('group_select', array(0)); // Generate correct Change List $extensions = array(); @@ -359,13 +370,13 @@ class acp_attachments WHERE extension_id = ' . $row['extension_id']; $db->sql_query($sql); - add_log('admin', 'LOG_ATTACH_EXT_UPDATE', $row['extension']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_UPDATE', false, array($row['extension'])); } } $db->sql_freeresult($result); // Delete Extension? - $extension_id_list = request_var('extension_id_list', array(0)); + $extension_id_list = $request->variable('extension_id_list', array(0)); if (sizeof($extension_id_list)) { @@ -386,13 +397,13 @@ class acp_attachments WHERE ' . $db->sql_in_set('extension_id', $extension_id_list); $db->sql_query($sql); - add_log('admin', 'LOG_ATTACH_EXT_DEL', $extension_list); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_DEL', false, array($extension_list)); } } // Add Extension? - $add_extension = strtolower(request_var('add_extension', '')); - $add_extension_group = request_var('add_group_select', 0); + $add_extension = strtolower($request->variable('add_extension', '')); + $add_extension_group = $request->variable('add_group_select', 0); $add = (isset($_POST['add_extension_check'])) ? true : false; if ($add_extension && $add) @@ -418,7 +429,8 @@ class acp_attachments ); $db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - add_log('admin', 'LOG_ATTACH_EXT_ADD', $add_extension); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension)); } } } @@ -475,8 +487,8 @@ class acp_attachments if ($submit) { - $action = request_var('action', ''); - $group_id = request_var('g', 0); + $action = $request->variable('action', ''); + $group_id = $request->variable('g', 0); if ($action != 'add' && $action != 'edit') { @@ -507,7 +519,7 @@ class acp_attachments $ext_row = array(); } - $group_name = utf8_normalize_nfc(request_var('group_name', '', true)); + $group_name = $request->variable('group_name', '', true); $new_group_name = ($action == 'add') ? $group_name : (($ext_row['group_name'] != $group_name) ? $group_name : ''); if (!$group_name) @@ -537,12 +549,12 @@ class acp_attachments if (!sizeof($error)) { // Ok, build the update/insert array - $upload_icon = request_var('upload_icon', 'no_image'); - $size_select = request_var('size_select', 'b'); - $forum_select = request_var('forum_select', false); - $allowed_forums = request_var('allowed_forums', array(0)); + $upload_icon = $request->variable('upload_icon', 'no_image'); + $size_select = $request->variable('size_select', 'b'); + $forum_select = $request->variable('forum_select', false); + $allowed_forums = $request->variable('allowed_forums', array(0)); $allow_in_pm = (isset($_POST['allow_in_pm'])) ? true : false; - $max_filesize = request_var('max_filesize', 0); + $max_filesize = $request->variable('max_filesize', 0); $max_filesize = ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize); $allow_group = (isset($_POST['allow_group'])) ? true : false; @@ -558,7 +570,7 @@ class acp_attachments $group_ary = array( 'group_name' => $group_name, - 'cat_id' => request_var('special_category', ATTACHMENT_CATEGORY_NONE), + 'cat_id' => $request->variable('special_category', ATTACHMENT_CATEGORY_NONE), 'allow_group' => ($allow_group) ? 1 : 0, 'upload_icon' => ($upload_icon == 'no_image') ? '' : $upload_icon, 'max_filesize' => $max_filesize, @@ -583,10 +595,10 @@ class acp_attachments } $group_name = (isset($user->lang['EXT_GROUP_' . $group_name])) ? $user->lang['EXT_GROUP_' . $group_name] : $group_name; - add_log('admin', 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), $group_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), false, array($group_name)); } - $extension_list = request_var('extensions', array(0)); + $extension_list = $request->variable('extensions', array(0)); if ($action == 'edit' && sizeof($extension_list)) { @@ -615,13 +627,10 @@ class acp_attachments $cat_lang = array( ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'], ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], - ATTACHMENT_CATEGORY_QUICKTIME => $user->lang['CAT_QUICKTIME_FILES'], ); - $group_id = request_var('g', 0); + $group_id = $request->variable('g', 0); $action = (isset($_POST['add'])) ? 'add' : $action; switch ($action) @@ -648,7 +657,7 @@ class acp_attachments WHERE group_id = $group_id"; $db->sql_query($sql); - add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_DEL', false, array($group_name)); $cache->destroy('_extensions'); @@ -689,7 +698,7 @@ class acp_attachments if ($action == 'add') { $ext_group_row = array( - 'group_name' => utf8_normalize_nfc(request_var('group_name', '', true)), + 'group_name' => $request->variable('group_name', '', true), 'cat_id' => 0, 'allow_group' => 1, 'allow_in_pm' => 1, @@ -700,8 +709,6 @@ class acp_attachments $forum_ids = array(); } - $extensions = array(); - $sql = 'SELECT * FROM ' . EXTENSIONS_TABLE . " WHERE group_id = $group_id @@ -905,9 +912,9 @@ class acp_attachments if ($submit) { - $delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array(); - $add_files = (isset($_POST['add'])) ? array_keys(request_var('add', array('' => 0))) : array(); - $post_ids = request_var('post_id', array('' => 0)); + $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); + $add_files = (isset($_POST['add'])) ? array_keys($request->variable('add', array('' => 0))) : array(); + $post_ids = $request->variable('post_id', array('' => 0)); if (sizeof($delete_files)) { @@ -920,11 +927,11 @@ class acp_attachments $delete_files = array(); while ($row = $db->sql_fetchrow($result)) { - phpbb_unlink($row['physical_filename'], 'file'); + $this->attachment_manager->unlink($row['physical_filename'], 'file'); if ($row['thumbnail']) { - phpbb_unlink($row['physical_filename'], 'thumbnail'); + $this->attachment_manager->unlink($row['physical_filename'], 'thumbnail'); } $delete_files[$row['attach_id']] = $row['real_filename']; @@ -938,7 +945,7 @@ class acp_attachments WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files)); $db->sql_query($sql); - add_log('admin', 'LOG_ATTACH_ORPHAN_DEL', implode(', ', $delete_files)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_ORPHAN_DEL', false, array(implode(', ', $delete_files))); $notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode($user->lang['COMMA_SEPARATOR'], $delete_files)); } @@ -1029,14 +1036,14 @@ class acp_attachments $space_taken += $row['filesize']; $files_added++; - add_log('admin', 'LOG_ATTACH_FILEUPLOAD', $post_row['post_id'], $row['real_filename']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_FILEUPLOAD', false, array($post_row['post_id'], $row['real_filename'])); } $db->sql_freeresult($result); if ($files_added) { - set_config_count('upload_dir_size', $space_taken, true); - set_config_count('num_files', $files_added, true); + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); } } } @@ -1073,7 +1080,7 @@ class acp_attachments if ($submit) { - $delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array(); + $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); if (sizeof($delete_files)) { @@ -1089,13 +1096,14 @@ class acp_attachments } $db->sql_freeresult($result); - if ($num_deleted = delete_attachments('attach', $delete_files)) + if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files)) { if (sizeof($delete_files) != $num_deleted) { $error[] = $user->lang['FILES_GONE']; } - add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode(', ', $deleted_filenames)); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode(', ', $deleted_filenames))); $notify[] = sprintf($user->lang['LOG_ATTACHMENTS_DELETED'], implode($user->lang['COMMA_SEPARATOR'], $deleted_filenames)); } else @@ -1115,23 +1123,18 @@ class acp_attachments if ($stats_error) { $error[] = $stats_error; - - // Show option to resync stats - $this->template->assign_vars(array( - 'S_ACTION_OPTIONS' => $auth->acl_get('a_board'), - )); } $template->assign_vars(array( 'S_MANAGE' => true, )); - $start = request_var('start', 0); + $start = $request->variable('start', 0); // Sort keys - $sort_days = request_var('st', 0); - $sort_key = request_var('sk', 't'); - $sort_dir = request_var('sd', 'd'); + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); // Sorting $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); @@ -1152,6 +1155,7 @@ class acp_attachments $total_size = $stats['upload_dir_size']; // Make sure $start is set to the last page if it exceeds the amount + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); $start = $pagination->validate_start($start, $attachments_per_page, $num_files); @@ -1228,7 +1232,7 @@ class acp_attachments 'ATTACHMENT_POSTER' => get_username_string('full', (int) $row['poster_id'], (string) $row['username'], (string) $row['user_colour'], (string) $row['username']), 'FILESIZE' => get_formatted_filesize((int) $row['filesize']), 'FILETIME' => $user->format_date((int) $row['filetime']), - 'REAL_FILENAME' => (!$row['in_message']) ? utf8_wordwrap(utf8_basename((string) $row['real_filename']), 40, '<br />', true) : '', + 'REAL_FILENAME' => (!$row['in_message']) ? utf8_basename((string) $row['real_filename']) : '', 'PHYSICAL_FILENAME' => utf8_basename((string) $row['physical_filename']), 'EXT_GROUP_NAME' => (!empty($extensions[$row['extension']]['group_name'])) ? $user->lang['EXT_GROUP_' . $extensions[$row['extension']]['group_name']] : '', 'COMMENT' => $comment, @@ -1292,7 +1296,7 @@ class acp_attachments /** * Set config attachment stat values * - * @param $stats array Array of config key => value pairs to set. + * @param $stats array Array of config key => value pairs to set. * @return null */ public function set_attachment_stats($stats) @@ -1306,7 +1310,6 @@ class acp_attachments /** * Check accuracy of attachment statistics. * - * @param $resync bool Resync stats if they're incorrect. * @return bool|string Returns false if stats are correct or error message * otherwise. */ @@ -1317,11 +1320,19 @@ class acp_attachments // Get current files stats $num_files = (int) $this->config['num_files']; - $total_size = (float) $this->config['upload_dir_size']; + $total_size = (float) $this->config['upload_dir_size']; if (($num_files != $stats['num_files']) || ($total_size != $stats['upload_dir_size'])) { - return $this->user->lang('FILES_STATS_WRONG', (int) $stats['num_files'], get_formatted_filesize($stats['upload_dir_size'])); + $u_resync = $this->u_action . '&action=stats'; + + return $this->user->lang( + 'FILES_STATS_WRONG', + (int) $stats['num_files'], + get_formatted_filesize($stats['upload_dir_size']), + '<a href="' . $u_resync . '">', + '</a>' + ); } return false; } @@ -1344,6 +1355,8 @@ class acp_attachments else { $this->set_attachment_stats($this->get_attachment_stats()); + + /* @var $log \phpbb\log\log_interface */ $log = $this->phpbb_container->get('log'); $log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_RESYNC_FILES_STATS'); } @@ -1360,10 +1373,7 @@ class acp_attachments $types = array( ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'], ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], - ATTACHMENT_CATEGORY_QUICKTIME => $user->lang['CAT_QUICKTIME_FILES'], ); if ($group_id) @@ -1494,7 +1504,15 @@ class acp_attachments if (!file_exists($phpbb_root_path . $upload_dir)) { @mkdir($phpbb_root_path . $upload_dir, 0777); - phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE); + + try + { + $this->filesystem->phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } } } @@ -1510,7 +1528,7 @@ class acp_attachments return; } - if (!phpbb_is_writable($phpbb_root_path . $upload_dir)) + if (!$this->filesystem->is_writable($phpbb_root_path . $upload_dir)) { $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir); return; @@ -1522,13 +1540,12 @@ class acp_attachments */ function perform_site_list() { - global $db, $user; - global $request; + global $db, $user, $request, $phpbb_log; if (isset($_REQUEST['securesubmit'])) { // Grab the list of entries - $ips = request_var('ips', ''); + $ips = $request->variable('ips', ''); $ip_list = array_unique(explode("\n", $ips)); $ip_list_log = implode(', ', $ip_list); @@ -1553,7 +1570,6 @@ class acp_attachments if ($ip_2_counter == 0 && $ip_2_end == 254) { $ip_2_counter = 256; - $ip_2_fragment = 256; $iplist[] = "'$ip_1_counter.*'"; } @@ -1566,7 +1582,6 @@ class acp_attachments if ($ip_3_counter == 0 && $ip_3_end == 254) { $ip_3_counter = 256; - $ip_3_fragment = 256; $iplist[] = "'$ip_1_counter.$ip_2_counter.*'"; } @@ -1579,7 +1594,6 @@ class acp_attachments if ($ip_4_counter == 0 && $ip_4_end == 254) { $ip_4_counter = 256; - $ip_4_fragment = 256; $iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'"; } @@ -1674,14 +1688,14 @@ class acp_attachments { // Update log $log_entry = ($ip_exclude) ? 'LOG_DOWNLOAD_EXCLUDE_IP' : 'LOG_DOWNLOAD_IP'; - add_log('admin', $log_entry, $ip_list_log); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_entry, false, array($ip_list_log)); } trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); } else if (isset($_POST['unsecuresubmit'])) { - $unip_sql = request_var('unip', array(0)); + $unip_sql = $request->variable('unip', array(0)); if (sizeof($unip_sql)) { @@ -1703,7 +1717,7 @@ class acp_attachments WHERE ' . $db->sql_in_set('site_id', $unip_sql); $db->sql_query($sql); - add_log('admin', 'LOG_DOWNLOAD_REMOVE_IP', $l_unip_list); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DOWNLOAD_REMOVE_IP', false, array($l_unip_list)); } trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 3ed9c225f5..5aed78be08 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,23 +19,22 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_ban { var $u_action; function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; + global $user, $template, $request, $phpbb_dispatcher; + global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_ban')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } - $bansubmit = (isset($_POST['bansubmit'])) ? true : false; - $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; - $current_time = time(); + $bansubmit = $request->is_set_post('bansubmit'); + $unbansubmit = $request->is_set_post('unbansubmit'); $user->add_lang(array('acp/ban', 'acp/users')); $this->tpl_name = 'acp_ban'; @@ -47,23 +50,79 @@ class acp_ban if ($bansubmit) { // Grab the list of entries - $ban = utf8_normalize_nfc(request_var('ban', '', true)); - $ban_len = request_var('banlength', 0); - $ban_len_other = request_var('banlengthother', ''); - $ban_exclude = request_var('banexclude', 0); - $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true)); - $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true)); + $ban = $request->variable('ban', '', true); + $ban_length = $request->variable('banlength', 0); + $ban_length_other = $request->variable('banlengthother', ''); + $ban_exclude = $request->variable('banexclude', 0); + $ban_reason = $request->variable('banreason', '', true); + $ban_give_reason = $request->variable('bangivereason', '', true); if ($ban) { - user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason); + $abort_ban = false; + /** + * Use this event to modify the ban details before the ban is performed + * + * @event core.acp_ban_before + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @var mixed abort_ban Either false, or an error message that is displayed to the user. + * If a string is given the bans are not issued. + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + 'abort_ban', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_ban_before', compact($vars))); + + if ($abort_ban) + { + trigger_error($abort_ban . adm_back_link($this->u_action)); + } + user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason); + + /** + * Use this event to perform actions after the ban has been performed + * + * @event core.acp_ban_after + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_ban_after', compact($vars))); trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action)); } } else if ($unbansubmit) { - $ban = request_var('unban', array('')); + $ban = $request->variable('unban', array('')); if ($ban) { @@ -109,7 +168,7 @@ class acp_ban 'L_NO_BAN_CELL' => $l_no_ban_cell, 'S_USERNAME_BAN' => ($mode == 'user') ? true : false, - + 'U_ACTION' => $this->u_action, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_ban&field=ban'), )); @@ -136,7 +195,6 @@ class acp_ban case 'user': $field = 'username'; - $l_ban_cell = $user->lang['USERNAME']; $sql = 'SELECT b.*, u.user_id, u.username, u.username_clean FROM ' . BANLIST_TABLE . ' b, ' . USERS_TABLE . ' u @@ -149,7 +207,6 @@ class acp_ban case 'ip': $field = 'ban_ip'; - $l_ban_cell = $user->lang['IP_HOSTNAME']; $sql = 'SELECT * FROM ' . BANLIST_TABLE . ' @@ -162,7 +219,6 @@ class acp_ban case 'email': $field = 'ban_email'; - $l_ban_cell = $user->lang['EMAIL_ADDRESS']; $sql = 'SELECT * FROM ' . BANLIST_TABLE . ' @@ -175,8 +231,6 @@ class acp_ban $result = $db->sql_query($sql); $banned_options = $excluded_options = array(); - $ban_length = $ban_reasons = $ban_give_reasons = array(); - while ($row = $db->sql_fetchrow($result)) { $option = '<option value="' . $row['ban_id'] . '">' . $row[$field] . '</option>'; @@ -195,60 +249,31 @@ class acp_ban if ($time_length == 0) { // Banned permanently - $ban_length[$row['ban_id']] = $user->lang['PERMANENT']; + $ban_length = $user->lang['PERMANENT']; } else if (isset($ban_end_text[$time_length])) { // Banned for a given duration - $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DURATION'], $ban_end_text[$time_length], $user->format_date($row['ban_end'], false, true)); + $ban_length = $user->lang('BANNED_UNTIL_DURATION', $ban_end_text[$time_length], $user->format_date($row['ban_end'], false, true)); } else { // Banned until given date - $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DATE'], $user->format_date($row['ban_end'], false, true)); + $ban_length = $user->lang('BANNED_UNTIL_DATE', $user->format_date($row['ban_end'], false, true)); } - $ban_reasons[$row['ban_id']] = $row['ban_reason']; - $ban_give_reasons[$row['ban_id']] = $row['ban_give_reason']; + $template->assign_block_vars('bans', array( + 'BAN_ID' => (int) $row['ban_id'], + 'LENGTH' => $ban_length, + 'A_LENGTH' => addslashes($ban_length), + 'REASON' => $row['ban_reason'], + 'A_REASON' => addslashes($row['ban_reason']), + 'GIVE_REASON' => $row['ban_give_reason'], + 'A_GIVE_REASON' => addslashes($row['ban_give_reason']), + )); } $db->sql_freeresult($result); - if (sizeof($ban_length)) - { - foreach ($ban_length as $ban_id => $length) - { - $template->assign_block_vars('ban_length', array( - 'BAN_ID' => (int) $ban_id, - 'LENGTH' => $length, - 'A_LENGTH' => addslashes($length), - )); - } - } - - if (sizeof($ban_reasons)) - { - foreach ($ban_reasons as $ban_id => $reason) - { - $template->assign_block_vars('ban_reason', array( - 'BAN_ID' => $ban_id, - 'REASON' => $reason, - 'A_REASON' => addslashes($reason), - )); - } - } - - if (sizeof($ban_give_reasons)) - { - foreach ($ban_give_reasons as $ban_id => $reason) - { - $template->assign_block_vars('ban_give_reason', array( - 'BAN_ID' => $ban_id, - 'REASON' => $reason, - 'A_REASON' => addslashes($reason), - )); - } - } - $options = ''; if ($excluded_options) { diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 84382b6276..dab18289c7 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,23 +19,21 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_bbcodes { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $template, $cache, $request, $phpbb_dispatcher, $phpbb_container; + global $phpbb_log; $user->add_lang('acp/posting'); // Set up general vars - $action = request_var('action', ''); - $bbcode_id = request_var('bbcode', 0); + $action = $request->variable('action', ''); + $bbcode_id = $request->variable('bbcode', 0); + $submit = $request->is_set_post('submit'); $this->tpl_name = 'acp_bbcodes'; $this->page_title = 'ACP_BBCODES'; @@ -39,6 +41,11 @@ class acp_bbcodes add_form_key($form_key); + if ($submit && !check_form_key($form_key)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + // Set up mode-specific vars switch ($action) { @@ -82,11 +89,11 @@ class acp_bbcodes // No break here case 'create': - $display_on_posting = request_var('display_on_posting', 0); + $display_on_posting = $request->variable('display_on_posting', 0); - $bbcode_match = request_var('bbcode_match', ''); - $bbcode_tpl = htmlspecialchars_decode(utf8_normalize_nfc(request_var('bbcode_tpl', '', true))); - $bbcode_helpline = utf8_normalize_nfc(request_var('bbcode_helpline', '', true)); + $bbcode_match = $request->variable('bbcode_match', ''); + $bbcode_tpl = htmlspecialchars_decode($request->variable('bbcode_tpl', '', true)); + $bbcode_helpline = $request->variable('bbcode_helpline', '', true); break; } @@ -142,7 +149,7 @@ class acp_bbcodes case 'create': $sql_ary = $hidden_fields = array(); - + /** * Modify custom bbcode data before the modify/create action * @@ -159,7 +166,16 @@ class acp_bbcodes * submitting form when $warn_text is true * @since 3.1.0-a3 */ - $vars = array('action', 'sql_ary', 'bbcode_id', 'display_on_posting', 'bbcode_match', 'bbcode_tpl', 'bbcode_helpline', 'hidden_fields'); + $vars = array( + 'action', + 'sql_ary', + 'bbcode_id', + 'display_on_posting', + 'bbcode_match', + 'bbcode_tpl', + 'bbcode_helpline', + 'hidden_fields', + ); extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars))); $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl); @@ -210,7 +226,6 @@ class acp_bbcodes trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } - if (strlen($bbcode_helpline) > 255) { trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); @@ -260,6 +275,7 @@ class acp_bbcodes $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary)); $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); $lang = 'BBCODE_ADDED'; $log_action = 'LOG_BBCODE_ADD'; @@ -271,12 +287,13 @@ class acp_bbcodes WHERE bbcode_id = ' . $bbcode_id; $db->sql_query($sql); $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); $lang = 'BBCODE_EDITED'; $log_action = 'LOG_BBCODE_EDIT'; } - add_log('admin', $log_action, $data['bbcode_tag']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($data['bbcode_tag'])); trigger_error($user->lang[$lang] . adm_back_link($this->u_action)); } @@ -310,8 +327,9 @@ class acp_bbcodes { $db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"); $cache->destroy('sql', BBCODES_TABLE); - add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']); - + $phpbb_container->get('text_formatter.cache')->invalidate(); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($row['bbcode_tag'])); + if ($request->is_ajax()) { $json_response = new \phpbb\json_response; @@ -400,9 +418,9 @@ class acp_bbcodes { $bbcode_match = trim($bbcode_match); $bbcode_tpl = trim($bbcode_tpl); - $utf8 = strpos($bbcode_match, 'INTTEXT') !== false; - $utf8_pcre_properties = phpbb_pcre_utf8_support(); + // Allow unicode characters for URL|LOCAL_URL|RELATIVE_URL|INTTEXT tokens + $utf8 = preg_match('/(URL|LOCAL_URL|RELATIVE_URL|INTTEXT)/', $bbcode_match); $fp_match = preg_quote($bbcode_match, '!'); $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match); @@ -434,7 +452,7 @@ class acp_bbcodes '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" ), 'INTTEXT' => array( - ($utf8_pcre_properties) ? '!([\p{L}\p{N}\-+,_. ]+)!u' : '!([a-zA-Z0-9\-+,_. ]+)!u' => "$1" + '!([\p{L}\p{N}\-+,_. ]+)!u' => "$1" ), 'IDENTIFIER' => array( '!([a-zA-Z0-9-_]+)!' => "$1" @@ -454,7 +472,7 @@ class acp_bbcodes 'EMAIL' => '(' . get_preg_expression('email') . ')', 'TEXT' => '(.*?)', 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', - 'INTTEXT' => ($utf8_pcre_properties) ? '([\p{L}\p{N}\-+,_. ]+)' : '([a-zA-Z0-9\-+,_. ]+)', + 'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)', 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', 'NUMBER' => '([0-9]+)', @@ -462,7 +480,7 @@ class acp_bbcodes $pad = 0; $modifiers = 'i'; - $modifiers .= ($utf8 && $utf8_pcre_properties) ? 'u' : ''; + $modifiers .= ($utf8) ? 'u' : ''; if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m)) { @@ -477,7 +495,9 @@ class acp_bbcodes if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad)) { $repad = $pad + sizeof(array_unique($repad[0])); - $replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\${' . (\$1 + \$pad) . '}'", $replace); + $replace = preg_replace_callback('/(?<!\\\\)\$([0-9]+)/', function ($match) use ($pad) { + return '${' . ($match[1] + $pad) . '}'; + }, $replace); $pad = $repad; } @@ -542,10 +562,18 @@ class acp_bbcodes trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } - $fp_match = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $fp_match); - $fp_replace = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $fp_replace); - $sp_match = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $sp_match); - $sp_replace = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $sp_replace); + $fp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $fp_match); + $fp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $fp_replace); + $sp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $sp_match); + $sp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $sp_replace); return array( 'bbcode_tag' => $bbcode_tag, diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 10fbde8c9b..26663d2a62 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -1,10 +1,17 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** * @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc) */ @@ -16,9 +23,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_board { var $u_action; @@ -26,13 +30,12 @@ class acp_board function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - global $cache, $phpbb_container; + global $user, $template, $request; + global $config, $phpbb_root_path, $phpEx; + global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_log; $user->add_lang('acp/board'); - $action = request_var('action', ''); $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false; $form_key = 'acp_board'; @@ -61,13 +64,16 @@ class acp_board 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), - 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), + + 'legend2' => 'BOARD_STYLE', + 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true), + 'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'legend2' => 'WARNINGS', + 'legend3' => 'WARNINGS', 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), - 'legend3' => 'ACP_SUBMIT_CHANGES', + 'legend4' => 'ACP_SUBMIT_CHANGES', ) ); break; @@ -87,6 +93,7 @@ class acp_board 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_board_notifications' => array('lang' => 'ALLOW_BOARD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -108,6 +115,7 @@ class acp_board break; case 'avatar': + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $avatar_drivers = $phpbb_avatar_manager->get_all_drivers(); @@ -345,6 +353,7 @@ class acp_board 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_cdn' => array('lang' => 'ALLOW_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_live_searches' => array('lang' => 'ALLOW_LIVE_SEARCHES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'CUSTOM_PROFILE_FIELDS', 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), @@ -362,7 +371,7 @@ class acp_board 'title' => 'ACP_AUTH_SETTINGS', 'vars' => array( 'legend1' => 'ACP_AUTH_SETTINGS', - 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false), + 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false), ) ); break; @@ -405,7 +414,7 @@ class acp_board 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'referer_validation' => array('lang' => 'REFERER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), + 'referer_validation' => array('lang' => 'REFERRER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), @@ -434,9 +443,11 @@ class acp_board 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), + 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'send_test_email' => array('lang' => 'SEND_TEST_EMAIL', 'validate' => 'bool', 'type' => 'custom', 'method' => 'send_test_email', 'explain' => true), 'legend2' => 'SMTP_SETTINGS', 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -456,13 +467,25 @@ class acp_board break; } + /** + * Event to add and/or modify acp_board configurations + * + * @event core.acp_board_config_edit_add + * @var array display_vars Array of config values to display and process + * @var string mode Mode of the config page we are displaying + * @var boolean submit Do we display the form or process the submission + * @since 3.1.0-a4 + */ + $vars = array('display_vars', 'mode', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars))); + if (isset($display_vars['lang'])) { $user->add_lang($display_vars['lang']); } $this->new_config = $config; - $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config; + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : $this->new_config; $error = array(); // We validate the complete config if wished @@ -479,7 +502,7 @@ class acp_board } // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... - foreach ($display_vars['vars'] as $config_name => $null) + foreach ($display_vars['vars'] as $config_name => $data) { if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) { @@ -491,6 +514,15 @@ class acp_board continue; } + if ($config_name == 'guest_style') + { + if (isset($cfg_array[$config_name])) + { + $this->guest_style_set($cfg_array[$config_name]); + } + continue; + } + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; if ($config_name == 'email_function_name') @@ -502,7 +534,14 @@ class acp_board if ($submit) { - set_config($config_name, $config_value); + if (strpos($data['type'], 'password') === 0 && $config_value === '********') + { + // Do not update password fields if the content is ********, + // because that is the password replacement we use to not + // send the password to the output + continue; + } + $config->set($config_name, $config_value); if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) { @@ -524,12 +563,14 @@ class acp_board if ($mode == 'auth') { // Retrieve a list of auth plugins and check their config values + /* @var $auth_providers \phpbb\auth\provider_collection */ $auth_providers = $phpbb_container->get('auth.provider_collection'); $updated_auth_settings = false; $old_auth_config = array(); foreach ($auth_providers as $provider) { + /** @var \phpbb\auth\provider\provider_interface $provider */ if ($fields = $provider->acp()) { // Check if we need to create config fields for this plugin and save config when submit was pressed @@ -537,7 +578,7 @@ class acp_board { if (!isset($config[$field])) { - set_config($field, ''); + $config->set($field, ''); } if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) @@ -545,6 +586,14 @@ class acp_board continue; } + if (substr($field, -9) === '_password' && $cfg_array[$field] === '********') + { + // Do not update password fields if the content is ********, + // because that is the password replacement we use to not + // send the password to the output + continue; + } + $old_auth_config[$field] = $this->new_config[$field]; $config_value = $cfg_array[$field]; $this->new_config[$field] = $config_value; @@ -552,7 +601,7 @@ class acp_board if ($submit) { $updated_auth_settings = true; - set_config($field, $config_value); + $config->set($field, $config_value); } } } @@ -569,11 +618,11 @@ class acp_board { foreach ($old_auth_config as $config_name => $config_value) { - set_config($config_name, $config_value); + $config->set($config_name, $config_value); } trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); } - set_config('auth_method', basename($cfg_array['auth_method'])); + $config->set('auth_method', basename($cfg_array['auth_method'])); } else { @@ -582,11 +631,40 @@ class acp_board } } + if ($mode == 'email' && $request->is_set_post('send_test_email')) + { + if ($config['email_enable']) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + $messenger->template('test'); + $messenger->set_addresses($user->data); + $messenger->anti_abuse_headers($config, $user); + $messenger->send(NOTIFY_EMAIL); + + trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action)); + } + else + { + $user->add_lang('memberlist'); + trigger_error($user->lang('EMAIL_DISABLED') . adm_back_link($this->u_action), E_USER_WARNING); + } + } + if ($submit) { - add_log('admin', 'LOG_CONFIG_' . strtoupper($mode)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode)); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + $message = $user->lang('CONFIG_UPDATED'); + $message_type = E_USER_NOTICE; + if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) && + in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN))) + { + $message .= '<br /><br />' . $user->lang('ACC_ACTIVATION_WARNING'); + $message_type = E_USER_WARNING; + } + trigger_error($message . adm_back_link($this->u_action), $message_type); } $this->tpl_name = 'acp_board'; @@ -681,10 +759,11 @@ class acp_board */ function select_auth_method($selected_method, $key = '') { - global $phpbb_root_path, $phpEx, $phpbb_container; + global $phpbb_container; - $auth_plugins = array(); + /* @var $auth_providers \phpbb\auth\provider_collection */ $auth_providers = $phpbb_container->get('auth.provider_collection'); + $auth_plugins = array(); foreach ($auth_providers as $key => $value) { @@ -701,7 +780,7 @@ class acp_board foreach ($auth_plugins as $method) { $selected = ($selected_method == $method) ? ' selected="selected"' : ''; - $auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>'; + $auth_select .= "<option value=\"$method\"$selected data-toggle-setting=\"#auth_{$method}_settings\">" . ucfirst($method) . '</option>'; } return $auth_select; @@ -763,20 +842,19 @@ class acp_board global $user, $config; $act_ary = array( - 'ACC_DISABLE' => USER_ACTIVATION_DISABLE, - 'ACC_NONE' => USER_ACTIVATION_NONE, + 'ACC_DISABLE' => array(true, USER_ACTIVATION_DISABLE), + 'ACC_NONE' => array(true, USER_ACTIVATION_NONE), + 'ACC_USER' => array($config['email_enable'], USER_ACTIVATION_SELF), + 'ACC_ADMIN' => array($config['email_enable'], USER_ACTIVATION_ADMIN), ); - if ($config['email_enable']) - { - $act_ary['ACC_USER'] = USER_ACTIVATION_SELF; - $act_ary['ACC_ADMIN'] = USER_ACTIVATION_ADMIN; - } - $act_options = ''; - foreach ($act_ary as $key => $value) + $act_options = ''; + foreach ($act_ary as $key => $data) { + list($available, $value) = $data; $selected = ($selected_value == $value) ? ' selected="selected"' : ''; - $act_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$key] . '</option>'; + $class = (!$available) ? ' class="disabled-option"' : ''; + $act_options .= '<option value="' . $value . '"' . $selected . $class . '>' . $user->lang($key) . '</option>'; } return $act_options; @@ -861,8 +939,6 @@ class acp_board */ function board_disable($value, $key) { - global $user; - $radio_ary = array(1 => 'YES', 0 => 'NO'); return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />'; @@ -886,12 +962,44 @@ class acp_board */ function timezone_select($value, $key) { - global $user; + global $template, $user; + + $timezone_select = phpbb_timezone_select($template, $user, $value, true); + + return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select . '</select>'; + } + + /** + * Get guest style + */ + public function guest_style_get() + { + global $db; + + $sql = 'SELECT user_style + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . ANONYMOUS; + $result = $db->sql_query($sql); + + $style = (int) $db->sql_fetchfield('user_style'); + $db->sql_freeresult($result); - $timezone_select = phpbb_timezone_select($user, $value, true); - $timezone_select['tz_select']; + return $style; + } - return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select['tz_select'] . '</select>'; + /** + * Set guest style + * + * @param int $style_id The style ID + */ + public function guest_style_set($style_id) + { + global $db; + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $style_id . ' + WHERE user_id = ' . ANONYMOUS; + $db->sql_query($sql); } /** @@ -907,7 +1015,7 @@ class acp_board { $user->timezone = new DateTimeZone($config['board_timezone']); } - catch (Exception $e) + catch (\Exception $e) { // If the board timezone is invalid, we just use the users timezone. } @@ -940,8 +1048,6 @@ class acp_board */ function select_news_forums($value, $key) { - global $user, $config; - $forum_list = make_forum_select(false, false, true, true, true, false, true); // Build forum options @@ -959,8 +1065,6 @@ class acp_board function select_exclude_forums($value, $key) { - global $user, $config; - $forum_list = make_forum_select(false, false, true, true, true, false, true); // Build forum options @@ -978,10 +1082,10 @@ class acp_board function store_feed_forums($option, $key) { - global $db, $cache; + global $db, $cache, $request; // Get key - $values = request_var($key, array(0 => 0)); + $values = $request->variable($key, array(0 => 0)); // Empty option bit for all forums $sql = 'UPDATE ' . FORUMS_TABLE . ' @@ -1016,7 +1120,7 @@ class acp_board */ function enable_mod_rewrite($value, $key) { - global $user, $config; + global $user; // Determine whether mod_rewrite is enabled on the server // NOTE: This only works on Apache servers on which PHP is NOT @@ -1050,4 +1154,11 @@ class acp_board return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) . ($message !== false ? '<br /><span>' . $user->lang($message) . '</span>' : ''); } + + function send_test_email($value, $key) + { + global $user; + + return '<input class="button2" type="submit" id="' . $key . '" name="' . $key . '" value="' . $user->lang['SEND_TEST_EMAIL'] . '" />'; + } } diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index e28a8d6451..e89b16663c 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,22 +19,19 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_bots { var $u_action; function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache, $request; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; + global $config, $db, $user, $template, $cache, $request, $phpbb_log; + global $phpbb_root_path, $phpEx; - $action = request_var('action', ''); + $action = $request->variable('action', ''); $submit = (isset($_POST['submit'])) ? true : false; - $mark = request_var('mark', array(0)); - $bot_id = request_var('id', 0); + $mark = $request->variable('mark', array(0)); + $bot_id = $request->variable('id', 0); if (isset($_POST['add'])) { @@ -123,7 +124,7 @@ class acp_bots $cache->destroy('_bots'); - add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BOT_DELETE', false, array(implode(', ', $bot_name_ary))); trigger_error($user->lang['BOT_DELETED'] . adm_back_link($this->u_action)); } else @@ -140,15 +141,19 @@ class acp_bots case 'edit': case 'add': - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + + if (!function_exists('user_update_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $bot_row = array( - 'bot_name' => utf8_normalize_nfc(request_var('bot_name', '', true)), - 'bot_agent' => request_var('bot_agent', ''), - 'bot_ip' => request_var('bot_ip', ''), - 'bot_active' => request_var('bot_active', true), - 'bot_lang' => request_var('bot_lang', $config['default_lang']), - 'bot_style' => request_var('bot_style' , $config['default_style']), + 'bot_name' => $request->variable('bot_name', '', true), + 'bot_agent' => $request->variable('bot_agent', ''), + 'bot_ip' => $request->variable('bot_ip', ''), + 'bot_active' => $request->variable('bot_active', true), + 'bot_lang' => $request->variable('bot_lang', $config['default_lang']), + 'bot_style' => $request->variable('bot_style' , $config['default_style']), ); if ($submit) @@ -157,7 +162,7 @@ class acp_bots { $error[] = $user->lang['ERR_BOT_NO_MATCHES']; } - + if ($bot_row['bot_ip'] && !preg_match('#^[\d\.,:]+$#', $bot_row['bot_ip'])) { if (!$ip_list = gethostbynamel($bot_row['bot_ip'])) @@ -176,7 +181,7 @@ class acp_bots { $error[] = $user->lang['ERR_BOT_AGENT_MATCHES_UA']; } - + $bot_name = false; if ($bot_id) { @@ -201,7 +206,7 @@ class acp_bots { $error[] = $user->lang['BOT_NAME_TAKEN']; } - + if (!sizeof($error)) { // New bot? Create a new user and group entry @@ -219,7 +224,6 @@ class acp_bots { trigger_error($user->lang['NO_BOT_GROUP'] . adm_back_link($this->u_action . "&id=$bot_id&action=$action"), E_USER_WARNING); } - $user_id = user_add(array( 'user_type' => (int) USER_IGNORE, @@ -233,7 +237,7 @@ class acp_bots 'user_style' => (int) $bot_row['bot_style'], 'user_allow_massemail' => 0, )); - + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'user_id' => (int) $user_id, 'bot_name' => (string) $bot_row['bot_name'], @@ -242,7 +246,7 @@ class acp_bots 'bot_ip' => (string) $bot_row['bot_ip']) ); $db->sql_query($sql); - + $log = 'ADDED'; } else if ($bot_id) @@ -289,12 +293,12 @@ class acp_bots $log = 'UPDATED'; } - + $cache->destroy('_bots'); - - add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BOT_' . $log, false, array($bot_row['bot_name'])); trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action)); - + } } else if ($bot_id) @@ -335,11 +339,11 @@ class acp_bots 'U_ACTION' => $this->u_action . "&id=$bot_id&action=$action", 'U_BACK' => $this->u_action, 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', - + 'BOT_NAME' => $bot_row['bot_name'], 'BOT_IP' => $bot_row['bot_ip'], 'BOT_AGENT' => $bot_row['bot_agent'], - + 'S_EDIT_BOT' => true, 'S_ACTIVE_OPTIONS' => $s_active_options, 'S_STYLE_OPTIONS' => $style_select, @@ -352,7 +356,7 @@ class acp_bots break; } - + if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate')) { $json_response = new \phpbb\json_response; @@ -397,7 +401,7 @@ class acp_bots } $db->sql_freeresult($result); } - + /** * Validate bot name against username table */ @@ -417,7 +421,7 @@ class acp_bots $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - + return ($row) ? false : true; } } diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 1a083c20ac..b49c5ca0d3 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -1,9 +1,14 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* */ /** @@ -14,28 +19,24 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_captcha { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $user, $template, $phpbb_log, $request; + global $config, $phpbb_container; $user->add_lang('acp/board'); - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $factory = new phpbb_captcha_factory(); + /* @var $factory \phpbb\captcha\factory */ + $factory = $phpbb_container->get('captcha.factory'); $captchas = $factory->get_captcha_types(); - $selected = request_var('select_captcha', $config['captcha_plugin']); + $selected = $request->variable('select_captcha', $config['captcha_plugin']); $selected = (isset($captchas['available'][$selected]) || isset($captchas['unavailable'][$selected])) ? $selected : $config['captcha_plugin']; - $configure = request_var('configure', false); - + $configure = $request->variable('configure', false); // Oh, they are just here for the view if (isset($_GET['captcha_demo'])) @@ -46,17 +47,42 @@ class acp_captcha // Delegate if ($configure) { - $config_captcha = phpbb_captcha_factory::get_instance($selected); + $config_captcha = $factory->get_instance($selected); $config_captcha->acp_page($id, $this); } else { $config_vars = array( - 'enable_confirm' => array('tpl' => 'REG_ENABLE', 'default' => false), - 'enable_post_confirm' => array('tpl' => 'POST_ENABLE', 'default' => false), - 'confirm_refresh' => array('tpl' => 'CONFIRM_REFRESH', 'default' => false), - 'max_reg_attempts' => array('tpl' => 'REG_LIMIT', 'default' => 0), - 'max_login_attempts' => array('tpl' => 'MAX_LOGIN_ATTEMPTS', 'default' => 0), + 'enable_confirm' => array( + 'tpl' => 'REG_ENABLE', + 'default' => false, + 'validate' => 'bool', + 'lang' => 'VISUAL_CONFIRM_REG', + ), + 'enable_post_confirm' => array( + 'tpl' => 'POST_ENABLE', + 'default' => false, + 'validate' => 'bool', + 'lang' => 'VISUAL_CONFIRM_POST', + ), + 'confirm_refresh' => array( + 'tpl' => 'CONFIRM_REFRESH', + 'default' => false, + 'validate' => 'bool', + 'lang' => 'VISUAL_CONFIRM_REFRESH', + ), + 'max_reg_attempts' => array( + 'tpl' => 'REG_LIMIT', + 'default' => 0, + 'validate' => 'int:0:99999', + 'lang' => 'REG_LIMIT', + ), + 'max_login_attempts' => array( + 'tpl' => 'MAX_LOGIN_ATTEMPTS', + 'default' => 0, + 'validate' => 'int:0:99999', + 'lang' => 'MAX_LOGIN_ATTEMPTS', + ), ); $this->tpl_name = 'acp_captcha'; @@ -64,13 +90,32 @@ class acp_captcha $form_key = 'acp_captcha'; add_form_key($form_key); - $submit = request_var('main_submit', false); + $submit = $request->variable('main_submit', false); + $error = $cfg_array = array(); - if ($submit && check_form_key($form_key)) + if ($submit) { foreach ($config_vars as $config_var => $options) { - set_config($config_var, request_var($config_var, $options['default'])); + $cfg_array[$config_var] = $request->variable($config_var, $options['default']); + } + validate_config_vars($config_vars, $cfg_array, $error); + + if (!check_form_key($form_key)) + { + $error[] = $user->lang['FORM_INVALID']; + } + if ($error) + { + $submit = false; + } + } + + if ($submit) + { + foreach ($cfg_array as $key => $value) + { + $config->set($key, $value); } if ($selected !== $config['captcha_plugin']) @@ -78,14 +123,14 @@ class acp_captcha // sanity check if (isset($captchas['available'][$selected])) { - $old_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $old_captcha = $factory->get_instance($config['captcha_plugin']); $old_captcha->uninstall(); - set_config('captcha_plugin', $selected); - $new_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $config->set('captcha_plugin', $selected); + $new_captcha = $factory->get_instance($config['captcha_plugin']); $new_captcha->install(); - add_log('admin', 'LOG_CONFIG_VISUAL'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL'); } else { @@ -94,10 +139,6 @@ class acp_captcha } trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } - else if ($submit) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); - } else { $captcha_select = ''; @@ -113,17 +154,18 @@ class acp_captcha $captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang($title) . '</option>'; } - $demo_captcha = phpbb_captcha_factory::get_instance($selected); + $demo_captcha = $factory->get_instance($selected); foreach ($config_vars as $config_var => $options) { - $template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? request_var($config_var, $options['default']) : $config[$config_var]) ; + $template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? $request->variable($config_var, $options['default']) : $config[$config_var]) ; } $template->assign_vars(array( 'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id), 'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(), 'CAPTCHA_SELECT' => $captcha_select, + 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action, )); @@ -136,9 +178,9 @@ class acp_captcha */ function deliver_demo($selected) { - global $db, $user, $config; + global $phpbb_container; - $captcha = phpbb_captcha_factory::get_instance($selected); + $captcha = $phpbb_container->get('captcha.factory')->get_instance($selected); $captcha->init(CONFIRM_REG); $captcha->execute_demo(); diff --git a/phpBB/includes/acp/acp_contact.php b/phpBB/includes/acp/acp_contact.php new file mode 100644 index 0000000000..1a4d5b95a3 --- /dev/null +++ b/phpBB/includes/acp/acp_contact.php @@ -0,0 +1,138 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* @package acp +*/ +class acp_contact +{ + public $u_action; + + public function main($id, $mode) + { + global $user, $request, $template; + global $config, $phpbb_root_path, $phpEx, $phpbb_container; + + $user->add_lang(array('acp/board', 'posting')); + + $this->tpl_name = 'acp_contact'; + $this->page_title = 'ACP_CONTACT_SETTINGS'; + $form_name = 'acp_contact'; + add_form_key($form_name); + $error = ''; + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + if (!class_exists('parse_message')) + { + include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + } + + /* @var $config_text \phpbb\config\db_text */ + $config_text = $phpbb_container->get('config_text'); + + $contact_admin_data = $config_text->get_array(array( + 'contact_admin_info', + 'contact_admin_info_uid', + 'contact_admin_info_bitfield', + 'contact_admin_info_flags', + )); + + $contact_admin_info = $contact_admin_data['contact_admin_info']; + $contact_admin_info_uid = $contact_admin_data['contact_admin_info_uid']; + $contact_admin_info_bitfield= $contact_admin_data['contact_admin_info_bitfield']; + $contact_admin_info_flags = $contact_admin_data['contact_admin_info_flags']; + + if ($request->is_set_post('submit') || $request->is_set_post('preview')) + { + if (!check_form_key($form_name)) + { + $error = $user->lang('FORM_INVALID'); + } + + $contact_admin_info = $request->variable('contact_admin_info', '', true); + + generate_text_for_storage( + $contact_admin_info, + $contact_admin_info_uid, + $contact_admin_info_bitfield, + $contact_admin_info_flags, + !$request->variable('disable_bbcode', false), + !$request->variable('disable_magic_url', false), + !$request->variable('disable_smilies', false) + ); + + if (empty($error) && $request->is_set_post('submit')) + { + $config->set('contact_admin_form_enable', $request->variable('contact_admin_form_enable', false)); + + $config_text->set_array(array( + 'contact_admin_info' => $contact_admin_info, + 'contact_admin_info_uid' => $contact_admin_info_uid, + 'contact_admin_info_bitfield' => $contact_admin_info_bitfield, + 'contact_admin_info_flags' => $contact_admin_info_flags, + )); + + trigger_error($user->lang['CONTACT_US_INFO_UPDATED'] . adm_back_link($this->u_action)); + } + } + + $contact_admin_info_preview = ''; + if ($request->is_set_post('preview')) + { + $contact_admin_info_preview = generate_text_for_display($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_bitfield, $contact_admin_info_flags); + } + + $contact_admin_edit = generate_text_for_edit($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_flags); + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + $template->assign_vars(array( + 'ERRORS' => $error, + 'CONTACT_ENABLED' => $config['contact_admin_form_enable'], + + 'CONTACT_US_INFO' => $contact_admin_edit['text'], + 'CONTACT_US_INFO_PREVIEW' => $contact_admin_info_preview, + + 'S_BBCODE_DISABLE_CHECKED' => !$contact_admin_edit['allow_bbcode'], + 'S_SMILIES_DISABLE_CHECKED' => !$contact_admin_edit['allow_smilies'], + 'S_MAGIC_URL_DISABLE_CHECKED' => !$contact_admin_edit['allow_urls'], + + 'BBCODE_STATUS' => $user->lang('BBCODE_IS_ON', '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), + 'SMILIES_STATUS' => $user->lang['SMILIES_ARE_ON'], + 'IMG_STATUS' => $user->lang['IMAGES_ARE_ON'], + 'FLASH_STATUS' => $user->lang['FLASH_IS_ON'], + 'URL_STATUS' => $user->lang['URL_IS_ON'], + + 'S_BBCODE_ALLOWED' => true, + 'S_SMILIES_ALLOWED' => true, + 'S_BBCODE_IMG' => true, + 'S_BBCODE_FLASH' => true, + 'S_LINKS_ALLOWED' => true, + )); + + // Assigning custom bbcodes + display_custom_bbcodes(); + } +} diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 8afc3709b9..c9d24f9254 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_database { var $db_tools; @@ -25,18 +26,17 @@ class acp_database function main($id, $mode) { - global $cache, $db, $user, $auth, $template, $table_prefix; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $cache, $db, $user, $template, $table_prefix, $request; + global $phpbb_root_path, $phpbb_container, $phpbb_log; - $this->db_tools = new \phpbb\db\tools($db); + $this->db_tools = $phpbb_container->get('dbal.tools'); $user->add_lang('acp/database'); $this->tpl_name = 'acp_database'; $this->page_title = 'ACP_DATABASE'; - $action = request_var('action', ''); - $submit = (isset($_POST['submit'])) ? true : false; + $action = $request->variable('action', ''); $template->assign_vars(array( 'MODE' => $mode @@ -51,10 +51,10 @@ class acp_database switch ($action) { case 'download': - $type = request_var('type', ''); - $table = array_intersect($this->db_tools->sql_list_tables(), request_var('table', array(''))); - $format = request_var('method', ''); - $where = request_var('where', ''); + $type = $request->variable('type', ''); + $table = array_intersect($this->db_tools->sql_list_tables(), $request->variable('table', array(''))); + $format = $request->variable('method', ''); + $where = $request->variable('where', ''); if (!sizeof($table)) { @@ -89,36 +89,9 @@ class acp_database $time = time(); $filename = 'backup_' . $time . '_' . unique_id(); - switch ($db->sql_layer) - { - case 'mysqli': - case 'mysql4': - case 'mysql': - $extractor = new mysql_extractor($format, $filename, $time, $download, $store); - break; - case 'sqlite': - $extractor = new sqlite_extractor($format, $filename, $time, $download, $store); - break; - - case 'postgres': - $extractor = new postgres_extractor($format, $filename, $time, $download, $store); - break; - - case 'oracle': - $extractor = new oracle_extractor($format, $filename, $time, $download, $store); - break; - - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $extractor = new mssql_extractor($format, $filename, $time, $download, $store); - break; - - case 'firebird': - $extractor = new firebird_extractor($format, $filename, $time, $download, $store); - break; - } + $extractor = $phpbb_container->get('dbal.extractor'); + $extractor->init_extractor($format, $filename, $time, $download, $store); $extractor->write_start($table_prefix); @@ -132,10 +105,10 @@ class acp_database else { // We might wanna empty out all that junk :D - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': - case 'firebird': + case 'sqlite3': $extractor->flush('DELETE FROM ' . $table_name . ";\n"); break; @@ -164,7 +137,7 @@ class acp_database $extractor->write_end(); - add_log('admin', 'LOG_DB_BACKUP'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_BACKUP'); if ($download == true) { @@ -220,9 +193,9 @@ class acp_database switch ($action) { case 'submit': - $delete = request_var('delete', ''); - $file = request_var('file', ''); - $download = request_var('download', ''); + $delete = $request->variable('delete', ''); + $file = $request->variable('file', ''); + $download = $request->variable('download', ''); if (!preg_match('#^backup_\d{10,}_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches)) { @@ -241,7 +214,7 @@ class acp_database if (confirm_box(true)) { unlink($file_name); - add_log('admin', 'LOG_DB_DELETE'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_DELETE'); trigger_error($user->lang['BACKUP_DELETE'] . adm_back_link($this->u_action)); } else @@ -268,7 +241,7 @@ class acp_database break; } - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"$name\""); header("Content-disposition: attachment; filename=$name"); @@ -319,32 +292,19 @@ class acp_database break; } - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': case 'mysqli': case 'sqlite': + case 'sqlite3': while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false) { $db->sql_query($sql); } break; - case 'firebird': - $delim = ";\n"; - while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) - { - $query = trim($sql); - if (substr($query, 0, 8) === 'SET TERM') - { - $delim = $query[9] . "\n"; - continue; - } - $db->sql_query($query); - } - break; - case 'postgres': $delim = ";\n"; while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) @@ -377,10 +337,10 @@ class acp_database { trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); } - pg_put_line($db->db_connect_id, $sub . "\n"); + pg_put_line($db->get_db_connect_id(), $sub . "\n"); } - pg_put_line($db->db_connect_id, "\\.\n"); - pg_end_copy($db->db_connect_id); + pg_put_line($db->get_db_connect_id(), "\\.\n"); + pg_end_copy($db->get_db_connect_id()); } } break; @@ -407,7 +367,7 @@ class acp_database // Purge the cache due to updated data $cache->purge(); - add_log('admin', 'LOG_DB_RESTORE'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_RESTORE'); trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); break; } @@ -473,1785 +433,6 @@ class acp_database } } -/** -* @package acp -*/ -class base_extractor -{ - var $fh; - var $fp; - var $write; - var $close; - var $store; - var $download; - var $time; - var $format; - var $run_comp = false; - - function base_extractor($format, $filename, $time, $download = false, $store = false) - { - global $request; - - $this->download = $download; - $this->store = $store; - $this->time = $time; - $this->format = $format; - - switch ($format) - { - case 'text': - $ext = '.sql'; - $open = 'fopen'; - $this->write = 'fwrite'; - $this->close = 'fclose'; - $mimetype = 'text/x-sql'; - break; - case 'bzip2': - $ext = '.sql.bz2'; - $open = 'bzopen'; - $this->write = 'bzwrite'; - $this->close = 'bzclose'; - $mimetype = 'application/x-bzip2'; - break; - case 'gzip': - $ext = '.sql.gz'; - $open = 'gzopen'; - $this->write = 'gzwrite'; - $this->close = 'gzclose'; - $mimetype = 'application/x-gzip'; - break; - } - - if ($download == true) - { - $name = $filename . $ext; - header('Pragma: no-cache'); - header("Content-Type: $mimetype; name=\"$name\""); - header("Content-disposition: attachment; filename=$name"); - - switch ($format) - { - case 'bzip2': - ob_start(); - break; - - case 'gzip': - if (strpos($request->header('Accept-Encoding'), 'gzip') !== false && strpos(strtolower($request->header('User-Agent')), 'msie') === false) - { - ob_start('ob_gzhandler'); - } - else - { - $this->run_comp = true; - } - break; - } - } - - if ($store == true) - { - global $phpbb_root_path; - $file = $phpbb_root_path . 'store/' . $filename . $ext; - - $this->fp = $open($file, 'w'); - - if (!$this->fp) - { - trigger_error('FILE_WRITE_FAIL', E_USER_ERROR); - } - } - } - - function write_end() - { - static $close; - - if ($this->store) - { - if ($close === null) - { - $close = $this->close; - } - $close($this->fp); - } - - // bzip2 must be written all the way at the end - if ($this->download && $this->format === 'bzip2') - { - $c = ob_get_clean(); - echo bzcompress($c); - } - } - - function flush($data) - { - static $write; - if ($this->store === true) - { - if ($write === null) - { - $write = $this->write; - } - $write($this->fp, $data); - } - - if ($this->download === true) - { - if ($this->format === 'bzip2' || $this->format === 'text' || ($this->format === 'gzip' && !$this->run_comp)) - { - echo $data; - } - - // we can write the gzip data as soon as we get it - if ($this->format === 'gzip') - { - if ($this->run_comp) - { - echo gzencode($data); - } - else - { - ob_flush(); - flush(); - } - } - } - } -} - -/** -* @package acp -*/ -class mysql_extractor extends base_extractor -{ - function write_start($table_prefix) - { - $sql_data = "#\n"; - $sql_data .= "# phpBB Backup Script\n"; - $sql_data .= "# Dump of tables for $table_prefix\n"; - $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; - $sql_data .= "#\n"; - $this->flush($sql_data); - } - - function write_table($table_name) - { - global $db; - static $new_extract; - - if ($new_extract === null) - { - if ($db->sql_layer === 'mysqli' || version_compare($db->sql_server_info(true), '3.23.20', '>=')) - { - $new_extract = true; - } - else - { - $new_extract = false; - } - } - - if ($new_extract) - { - $this->new_write_table($table_name); - } - else - { - $this->old_write_table($table_name); - } - } - - function write_data($table_name) - { - global $db; - if ($db->sql_layer === 'mysqli') - { - $this->write_data_mysqli($table_name); - } - else - { - $this->write_data_mysql($table_name); - } - } - - function write_data_mysqli($table_name) - { - global $db; - $sql = "SELECT * - FROM $table_name"; - $result = mysqli_query($db->db_connect_id, $sql, MYSQLI_USE_RESULT); - if ($result != false) - { - $fields_cnt = mysqli_num_fields($result); - - // Get field information - $field = mysqli_fetch_fields($result); - $field_set = array(); - - for ($j = 0; $j < $fields_cnt; $j++) - { - $field_set[] = $field[$j]->name; - } - - $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); - $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); - $fields = implode(', ', $field_set); - $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; - $first_set = true; - $query_len = 0; - $max_len = get_usable_memory(); - - while ($row = mysqli_fetch_row($result)) - { - $values = array(); - if ($first_set) - { - $query = $sql_data . '('; - } - else - { - $query .= ',('; - } - - for ($j = 0; $j < $fields_cnt; $j++) - { - if (!isset($row[$j]) || is_null($row[$j])) - { - $values[$j] = 'NULL'; - } - else if (($field[$j]->flags & 32768) && !($field[$j]->flags & 1024)) - { - $values[$j] = $row[$j]; - } - else - { - $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; - } - } - $query .= implode(', ', $values) . ')'; - - $query_len += strlen($query); - if ($query_len > $max_len) - { - $this->flush($query . ";\n\n"); - $query = ''; - $query_len = 0; - $first_set = true; - } - else - { - $first_set = false; - } - } - mysqli_free_result($result); - - // check to make sure we have nothing left to flush - if (!$first_set && $query) - { - $this->flush($query . ";\n\n"); - } - } - } - - function write_data_mysql($table_name) - { - global $db; - $sql = "SELECT * - FROM $table_name"; - $result = mysql_unbuffered_query($sql, $db->db_connect_id); - - if ($result != false) - { - $fields_cnt = mysql_num_fields($result); - - // Get field information - $field = array(); - for ($i = 0; $i < $fields_cnt; $i++) - { - $field[] = mysql_fetch_field($result, $i); - } - $field_set = array(); - - for ($j = 0; $j < $fields_cnt; $j++) - { - $field_set[] = $field[$j]->name; - } - - $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); - $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); - $fields = implode(', ', $field_set); - $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; - $first_set = true; - $query_len = 0; - $max_len = get_usable_memory(); - - while ($row = mysql_fetch_row($result)) - { - $values = array(); - if ($first_set) - { - $query = $sql_data . '('; - } - else - { - $query .= ',('; - } - - for ($j = 0; $j < $fields_cnt; $j++) - { - if (!isset($row[$j]) || is_null($row[$j])) - { - $values[$j] = 'NULL'; - } - else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp')) - { - $values[$j] = $row[$j]; - } - else - { - $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; - } - } - $query .= implode(', ', $values) . ')'; - - $query_len += strlen($query); - if ($query_len > $max_len) - { - $this->flush($query . ";\n\n"); - $query = ''; - $query_len = 0; - $first_set = true; - } - else - { - $first_set = false; - } - } - mysql_free_result($result); - - // check to make sure we have nothing left to flush - if (!$first_set && $query) - { - $this->flush($query . ";\n\n"); - } - } - } - - function new_write_table($table_name) - { - global $db; - - $sql = 'SHOW CREATE TABLE ' . $table_name; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - - $sql_data = '# Table: ' . $table_name . "\n"; - $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; - $this->flush($sql_data . $row['Create Table'] . ";\n\n"); - - $db->sql_freeresult($result); - } - - function old_write_table($table_name) - { - global $db; - - $sql_data = '# Table: ' . $table_name . "\n"; - $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; - $sql_data .= "CREATE TABLE $table_name(\n"; - $rows = array(); - - $sql = "SHOW FIELDS - FROM $table_name"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $line = ' ' . $row['Field'] . ' ' . $row['Type']; - - if (!is_null($row['Default'])) - { - $line .= " DEFAULT '{$row['Default']}'"; - } - - if ($row['Null'] != 'YES') - { - $line .= ' NOT NULL'; - } - - if ($row['Extra'] != '') - { - $line .= ' ' . $row['Extra']; - } - - $rows[] = $line; - } - $db->sql_freeresult($result); - - $sql = "SHOW KEYS - FROM $table_name"; - - $result = $db->sql_query($sql); - - $index = array(); - while ($row = $db->sql_fetchrow($result)) - { - $kname = $row['Key_name']; - - if ($kname != 'PRIMARY') - { - if ($row['Non_unique'] == 0) - { - $kname = "UNIQUE|$kname"; - } - } - - if ($row['Sub_part']) - { - $row['Column_name'] .= '(' . $row['Sub_part'] . ')'; - } - $index[$kname][] = $row['Column_name']; - } - $db->sql_freeresult($result); - - foreach ($index as $key => $columns) - { - $line = ' '; - - if ($key == 'PRIMARY') - { - $line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')'; - } - else if (strpos($key, 'UNIQUE') === 0) - { - $line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')'; - } - else if (strpos($key, 'FULLTEXT') === 0) - { - $line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')'; - } - else - { - $line .= "KEY $key (" . implode(', ', $columns) . ')'; - } - - $rows[] = $line; - } - - $sql_data .= implode(",\n", $rows); - $sql_data .= "\n);\n\n"; - - $this->flush($sql_data); - } -} - -/** -* @package acp -*/ -class sqlite_extractor extends base_extractor -{ - function write_start($prefix) - { - $sql_data = "--\n"; - $sql_data .= "-- phpBB Backup Script\n"; - $sql_data .= "-- Dump of tables for $prefix\n"; - $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; - $sql_data .= "--\n"; - $sql_data .= "BEGIN TRANSACTION;\n"; - $this->flush($sql_data); - } - - function write_table($table_name) - { - global $db; - $sql_data = '-- Table: ' . $table_name . "\n"; - $sql_data .= "DROP TABLE $table_name;\n"; - - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '" . $db->sql_escape($table_name) . "' - ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - // Create Table - $sql_data .= $row['sql'] . ";\n"; - - $result = $db->sql_query("PRAGMA index_list('" . $db->sql_escape($table_name) . "');"); - - $ar = array(); - while ($row = $db->sql_fetchrow($result)) - { - $ar[] = $row; - } - $db->sql_freeresult($result); - - foreach ($ar as $value) - { - if (strpos($value['name'], 'autoindex') !== false) - { - continue; - } - - $result = $db->sql_query("PRAGMA index_info('" . $db->sql_escape($value['name']) . "');"); - - $fields = array(); - while ($row = $db->sql_fetchrow($result)) - { - $fields[] = $row['name']; - } - $db->sql_freeresult($result); - - $sql_data .= 'CREATE ' . ($value['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $value['name'] . ' on ' . $table_name . ' (' . implode(', ', $fields) . ");\n"; - } - - $this->flush($sql_data . "\n"); - } - - function write_data($table_name) - { - global $db; - - $col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name); - - $sql = "SELECT * - FROM $table_name"; - $result = sqlite_unbuffered_query($db->db_connect_id, $sql); - $rows = sqlite_fetch_all($result, SQLITE_ASSOC); - $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES ('; - foreach ($rows as $row) - { - foreach ($row as $column_name => $column_data) - { - if (is_null($column_data)) - { - $row[$column_name] = 'NULL'; - } - else if ($column_data == '') - { - $row[$column_name] = "''"; - } - else if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false) - { - $row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data)); - } - } - $this->flush($sql_insert . implode(', ', $row) . ");\n"); - } - } - - function write_end() - { - $this->flush("COMMIT;\n"); - parent::write_end(); - } -} - -/** -* @package acp -*/ -class postgres_extractor extends base_extractor -{ - function write_start($prefix) - { - $sql_data = "--\n"; - $sql_data .= "-- phpBB Backup Script\n"; - $sql_data .= "-- Dump of tables for $prefix\n"; - $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; - $sql_data .= "--\n"; - $sql_data .= "BEGIN TRANSACTION;\n"; - $this->flush($sql_data); - } - - function write_table($table_name) - { - global $db; - static $domains_created = array(); - - $sql = "SELECT a.domain_name, a.data_type, a.character_maximum_length, a.domain_default - FROM INFORMATION_SCHEMA.domains a, INFORMATION_SCHEMA.column_domain_usage b - WHERE a.domain_name = b.domain_name - AND b.table_name = '{$table_name}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if (empty($domains_created[$row['domain_name']])) - { - $domains_created[$row['domain_name']] = true; - //$sql_data = "DROP DOMAIN {$row['domain_name']};\n"; - $sql_data = "CREATE DOMAIN {$row['domain_name']} as {$row['data_type']}"; - if (!empty($row['character_maximum_length'])) - { - $sql_data .= '(' . $row['character_maximum_length'] . ')'; - } - $sql_data .= ' NOT NULL'; - if (!empty($row['domain_default'])) - { - $sql_data .= ' DEFAULT ' . $row['domain_default']; - } - $this->flush($sql_data . ";\n"); - } - } - - $sql_data = '-- Table: ' . $table_name . "\n"; - $sql_data .= "DROP TABLE $table_name;\n"; - // PGSQL does not "tightly" bind sequences and tables, we must guess... - $sql = "SELECT relname - FROM pg_class - WHERE relkind = 'S' - AND relname = '{$table_name}_seq'"; - $result = $db->sql_query($sql); - // We don't even care about storing the results. We already know the answer if we get rows back. - if ($db->sql_fetchrow($result)) - { - $sql_data .= "DROP SEQUENCE {$table_name}_seq;\n"; - $sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n"; - } - $db->sql_freeresult($result); - - $field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull - FROM pg_class c, pg_attribute a, pg_type t - WHERE c.relname = '" . $db->sql_escape($table_name) . "' - AND a.attnum > 0 - AND a.attrelid = c.oid - AND a.atttypid = t.oid - ORDER BY a.attnum"; - $result = $db->sql_query($field_query); - - $sql_data .= "CREATE TABLE $table_name(\n"; - $lines = array(); - while ($row = $db->sql_fetchrow($result)) - { - // Get the data from the table - $sql_get_default = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault - FROM pg_attrdef d, pg_class c - WHERE (c.relname = '" . $db->sql_escape($table_name) . "') - AND (c.oid = d.adrelid) - AND d.adnum = " . $row['attnum']; - $def_res = $db->sql_query($sql_get_default); - $def_row = $db->sql_fetchrow($def_res); - $db->sql_freeresult($def_res); - - if (empty($def_row)) - { - unset($row['rowdefault']); - } - else - { - $row['rowdefault'] = $def_row['rowdefault']; - } - - if ($row['type'] == 'bpchar') - { - // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement. - $row['type'] = 'char'; - } - - $line = ' ' . $row['field'] . ' ' . $row['type']; - - if (strpos($row['type'], 'char') !== false) - { - if ($row['lengthvar'] > 0) - { - $line .= '(' . ($row['lengthvar'] - 4) . ')'; - } - } - - if (strpos($row['type'], 'numeric') !== false) - { - $line .= '('; - $line .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff)); - $line .= ')'; - } - - if (isset($row['rowdefault'])) - { - $line .= ' DEFAULT ' . $row['rowdefault']; - } - - if ($row['notnull'] == 't') - { - $line .= ' NOT NULL'; - } - - $lines[] = $line; - } - $db->sql_freeresult($result); - - - // Get the listing of primary keys. - $sql_pri_keys = "SELECT ic.relname as index_name, bc.relname as tab_name, ta.attname as column_name, i.indisunique as unique_key, i.indisprimary as primary_key - FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (ia.attrelid = i.indexrelid) - AND (ta.attrelid = bc.oid) - AND (bc.relname = '" . $db->sql_escape($table_name) . "') - AND (ta.attrelid = i.indrelid) - AND (ta.attnum = i.indkey[ia.attnum-1]) - ORDER BY index_name, tab_name, column_name"; - - $result = $db->sql_query($sql_pri_keys); - - $index_create = $index_rows = $primary_key = array(); - - // We do this in two steps. It makes placing the comma easier - while ($row = $db->sql_fetchrow($result)) - { - if ($row['primary_key'] == 't') - { - $primary_key[] = $row['column_name']; - $primary_key_name = $row['index_name']; - } - else - { - // We have to store this all this info because it is possible to have a multi-column key... - // we can loop through it again and build the statement - $index_rows[$row['index_name']]['table'] = $table_name; - $index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? true : false; - $index_rows[$row['index_name']]['column_names'][] = $row['column_name']; - } - } - $db->sql_freeresult($result); - - if (!empty($index_rows)) - { - foreach ($index_rows as $idx_name => $props) - { - $index_create[] = 'CREATE ' . ($props['unique'] ? 'UNIQUE ' : '') . "INDEX $idx_name ON $table_name (" . implode(', ', $props['column_names']) . ");"; - } - } - - if (!empty($primary_key)) - { - $lines[] = " CONSTRAINT $primary_key_name PRIMARY KEY (" . implode(', ', $primary_key) . ")"; - } - - // Generate constraint clauses for CHECK constraints - $sql_checks = "SELECT conname as index_name, consrc - FROM pg_constraint, pg_class bc - WHERE conrelid = bc.oid - AND bc.relname = '" . $db->sql_escape($table_name) . "' - AND NOT EXISTS ( - SELECT * - FROM pg_constraint as c, pg_inherits as i - WHERE i.inhrelid = pg_constraint.conrelid - AND c.conname = pg_constraint.conname - AND c.consrc = pg_constraint.consrc - AND c.conrelid = i.inhparent - )"; - $result = $db->sql_query($sql_checks); - - // Add the constraints to the sql file. - while ($row = $db->sql_fetchrow($result)) - { - if (!is_null($row['consrc'])) - { - $lines[] = ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['consrc']; - } - } - $db->sql_freeresult($result); - - $sql_data .= implode(", \n", $lines); - $sql_data .= "\n);\n"; - - if (!empty($index_create)) - { - $sql_data .= implode("\n", $index_create) . "\n\n"; - } - $this->flush($sql_data); - } - - function write_data($table_name) - { - global $db; - // Grab all of the data from current table. - $sql = "SELECT * - FROM $table_name"; - $result = $db->sql_query($sql); - - $i_num_fields = pg_num_fields($result); - $seq = ''; - - for ($i = 0; $i < $i_num_fields; $i++) - { - $ary_type[] = pg_field_type($result, $i); - $ary_name[] = pg_field_name($result, $i); - - - $sql = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault - FROM pg_attrdef d, pg_class c - WHERE (c.relname = '{$table_name}') - AND (c.oid = d.adrelid) - AND d.adnum = " . strval($i + 1); - $result2 = $db->sql_query($sql); - if ($row = $db->sql_fetchrow($result2)) - { - // Determine if we must reset the sequences - if (strpos($row['rowdefault'], "nextval('") === 0) - { - $seq .= "SELECT SETVAL('{$table_name}_seq',(select case when max({$ary_name[$i]})>0 then max({$ary_name[$i]})+1 else 1 end FROM {$table_name}));\n"; - } - } - } - - $this->flush("COPY $table_name (" . implode(', ', $ary_name) . ') FROM stdin;' . "\n"); - while ($row = $db->sql_fetchrow($result)) - { - $schema_vals = array(); - - // Build the SQL statement to recreate the data. - for ($i = 0; $i < $i_num_fields; $i++) - { - $str_val = $row[$ary_name[$i]]; - - if (preg_match('#char|text|bool|bytea#i', $ary_type[$i])) - { - $str_val = str_replace(array("\n", "\t", "\r", "\b", "\f", "\v"), array('\n', '\t', '\r', '\b', '\f', '\v'), addslashes($str_val)); - $str_empty = ''; - } - else - { - $str_empty = '\N'; - } - - if (empty($str_val) && $str_val !== '0') - { - $str_val = $str_empty; - } - - $schema_vals[] = $str_val; - } - - // Take the ordered fields and their associated data and build it - // into a valid sql statement to recreate that field in the data. - $this->flush(implode("\t", $schema_vals) . "\n"); - } - $db->sql_freeresult($result); - $this->flush("\\.\n"); - - // Write out the sequence statements - $this->flush($seq); - } - - function write_end() - { - $this->flush("COMMIT;\n"); - parent::write_end(); - } -} - -/** -* @package acp -*/ -class mssql_extractor extends base_extractor -{ - function write_end() - { - $this->flush("COMMIT\nGO\n"); - parent::write_end(); - } - - function write_start($prefix) - { - $sql_data = "--\n"; - $sql_data .= "-- phpBB Backup Script\n"; - $sql_data .= "-- Dump of tables for $prefix\n"; - $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; - $sql_data .= "--\n"; - $sql_data .= "BEGIN TRANSACTION\n"; - $sql_data .= "GO\n"; - $this->flush($sql_data); - } - - function write_table($table_name) - { - global $db; - $sql_data = '-- Table: ' . $table_name . "\n"; - $sql_data .= "IF OBJECT_ID(N'$table_name', N'U') IS NOT NULL\n"; - $sql_data .= "DROP TABLE $table_name;\n"; - $sql_data .= "GO\n"; - $sql_data .= "\nCREATE TABLE [$table_name] (\n"; - $rows = array(); - - $text_flag = false; - - $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY - FROM INFORMATION_SCHEMA.COLUMNS - WHERE TABLE_NAME = '$table_name'"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]"; - - if ($row['DATA_TYPE'] == 'text') - { - $text_flag = true; - } - - if ($row['IS_IDENTITY']) - { - $line .= ' IDENTITY (1 , 1)'; - } - - if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text') - { - $line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')'; - } - - if ($row['IS_NULLABLE'] == 'YES') - { - $line .= ' NULL'; - } - else - { - $line .= ' NOT NULL'; - } - - if ($row['COLUMN_DEFAULT']) - { - $line .= ' DEFAULT ' . $row['COLUMN_DEFAULT']; - } - - $rows[] = $line; - } - $db->sql_freeresult($result); - - $sql_data .= implode(",\n", $rows); - $sql_data .= "\n) ON [PRIMARY]"; - - if ($text_flag) - { - $sql_data .= " TEXTIMAGE_ON [PRIMARY]"; - } - - $sql_data .= "\nGO\n\n"; - $rows = array(); - - $sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME - FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE - WHERE TABLE_NAME = '$table_name'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if (!sizeof($rows)) - { - $sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n"; - $sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY CLUSTERED \n\t(\n"; - } - $rows[] = "\t\t[{$row['COLUMN_NAME']}]"; - } - if (sizeof($rows)) - { - $sql_data .= implode(",\n", $rows); - $sql_data .= "\n\t) ON [PRIMARY] \nGO\n"; - } - $db->sql_freeresult($result); - - $index = array(); - $sql = "EXEC sp_statistics '$table_name'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - if ($row['TYPE'] == 3) - { - $index[$row['INDEX_NAME']][] = '[' . $row['COLUMN_NAME'] . ']'; - } - } - $db->sql_freeresult($result); - - foreach ($index as $index_name => $column_name) - { - $index[$index_name] = implode(', ', $column_name); - } - - foreach ($index as $index_name => $columns) - { - $sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n"; - } - $this->flush($sql_data); - } - - function write_data($table_name) - { - global $db; - - if ($db->sql_layer === 'mssql') - { - $this->write_data_mssql($table_name); - } - else if($db->sql_layer === 'mssqlnative') - { - $this->write_data_mssqlnative($table_name); - } - else - { - $this->write_data_odbc($table_name); - } - } - - function write_data_mssql($table_name) - { - global $db; - $ary_type = $ary_name = array(); - $ident_set = false; - $sql_data = ''; - - // Grab all of the data from current table. - $sql = "SELECT * - FROM $table_name"; - $result = $db->sql_query($sql); - - $retrieved_data = mssql_num_rows($result); - - $i_num_fields = mssql_num_fields($result); - - for ($i = 0; $i < $i_num_fields; $i++) - { - $ary_type[$i] = mssql_field_type($result, $i); - $ary_name[$i] = mssql_field_name($result, $i); - } - - if ($retrieved_data) - { - $sql = "SELECT 1 as has_identity - FROM INFORMATION_SCHEMA.COLUMNS - WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - if (!empty($row2['has_identity'])) - { - $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; - $ident_set = true; - } - $db->sql_freeresult($result2); - } - - while ($row = $db->sql_fetchrow($result)) - { - $schema_vals = $schema_fields = array(); - - // Build the SQL statement to recreate the data. - for ($i = 0; $i < $i_num_fields; $i++) - { - $str_val = $row[$ary_name[$i]]; - - if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) - { - $str_quote = ''; - $str_empty = "''"; - $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); - } - else if (preg_match('#date|timestamp#i', $ary_type[$i])) - { - if (empty($str_val)) - { - $str_quote = ''; - } - else - { - $str_quote = "'"; - } - } - else - { - $str_quote = ''; - $str_empty = 'NULL'; - } - - if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) - { - $str_val = $str_empty; - } - - $schema_vals[$i] = $str_quote . $str_val . $str_quote; - $schema_fields[$i] = $ary_name[$i]; - } - - // Take the ordered fields and their associated data and build it - // into a valid sql statement to recreate that field in the data. - $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; - - $this->flush($sql_data); - $sql_data = ''; - } - $db->sql_freeresult($result); - - if ($retrieved_data && $ident_set) - { - $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; - } - $this->flush($sql_data); - } - - function write_data_mssqlnative($table_name) - { - global $db; - $ary_type = $ary_name = array(); - $ident_set = false; - $sql_data = ''; - - // Grab all of the data from current table. - $sql = "SELECT * FROM $table_name"; - $db->mssqlnative_set_query_options(array('Scrollable' => SQLSRV_CURSOR_STATIC)); - $result = $db->sql_query($sql); - - $retrieved_data = $db->mssqlnative_num_rows($result); - - if (!$retrieved_data) - { - $db->sql_freeresult($result); - return; - } - - $sql = "SELECT COLUMN_NAME, DATA_TYPE - FROM INFORMATION_SCHEMA.COLUMNS - WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = '" . $db->sql_escape($table_name) . "'"; - $result_fields = $db->sql_query($sql); - - $i_num_fields = 0; - while ($row = $db->sql_fetchrow($result_fields)) - { - $ary_type[$i_num_fields] = $row['DATA_TYPE']; - $ary_name[$i_num_fields] = $row['COLUMN_NAME']; - $i_num_fields++; - } - $db->sql_freeresult($result_fields); - - $sql = "SELECT 1 as has_identity - FROM INFORMATION_SCHEMA.COLUMNS - WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - - if (!empty($row2['has_identity'])) - { - $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; - $ident_set = true; - } - $db->sql_freeresult($result2); - - while ($row = $db->sql_fetchrow($result)) - { - $schema_vals = $schema_fields = array(); - - // Build the SQL statement to recreate the data. - for ($i = 0; $i < $i_num_fields; $i++) - { - $str_val = $row[$ary_name[$i]]; - - // defaults to type number - better quote just to be safe, so check for is_int too - if (is_int($ary_type[$i]) || preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) - { - $str_quote = ''; - $str_empty = "''"; - $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); - } - else if (preg_match('#date|timestamp#i', $ary_type[$i])) - { - if (empty($str_val)) - { - $str_quote = ''; - } - else - { - $str_quote = "'"; - } - } - else - { - $str_quote = ''; - $str_empty = 'NULL'; - } - - if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) - { - $str_val = $str_empty; - } - - $schema_vals[$i] = $str_quote . $str_val . $str_quote; - $schema_fields[$i] = $ary_name[$i]; - } - - // Take the ordered fields and their associated data and build it - // into a valid sql statement to recreate that field in the data. - $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; - - $this->flush($sql_data); - $sql_data = ''; - } - $db->sql_freeresult($result); - - if ($ident_set) - { - $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; - } - $this->flush($sql_data); - } - - function write_data_odbc($table_name) - { - global $db; - $ary_type = $ary_name = array(); - $ident_set = false; - $sql_data = ''; - - // Grab all of the data from current table. - $sql = "SELECT * - FROM $table_name"; - $result = $db->sql_query($sql); - - $retrieved_data = odbc_num_rows($result); - - if ($retrieved_data) - { - $sql = "SELECT 1 as has_identity - FROM INFORMATION_SCHEMA.COLUMNS - WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - if (!empty($row2['has_identity'])) - { - $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; - $ident_set = true; - } - $db->sql_freeresult($result2); - } - - $i_num_fields = odbc_num_fields($result); - - for ($i = 0; $i < $i_num_fields; $i++) - { - $ary_type[$i] = odbc_field_type($result, $i + 1); - $ary_name[$i] = odbc_field_name($result, $i + 1); - } - - while ($row = $db->sql_fetchrow($result)) - { - $schema_vals = $schema_fields = array(); - - // Build the SQL statement to recreate the data. - for ($i = 0; $i < $i_num_fields; $i++) - { - $str_val = $row[$ary_name[$i]]; - - if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) - { - $str_quote = ''; - $str_empty = "''"; - $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); - } - else if (preg_match('#date|timestamp#i', $ary_type[$i])) - { - if (empty($str_val)) - { - $str_quote = ''; - } - else - { - $str_quote = "'"; - } - } - else - { - $str_quote = ''; - $str_empty = 'NULL'; - } - - if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) - { - $str_val = $str_empty; - } - - $schema_vals[$i] = $str_quote . $str_val . $str_quote; - $schema_fields[$i] = $ary_name[$i]; - } - - // Take the ordered fields and their associated data and build it - // into a valid sql statement to recreate that field in the data. - $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; - - $this->flush($sql_data); - - $sql_data = ''; - - } - $db->sql_freeresult($result); - - if ($retrieved_data && $ident_set) - { - $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; - } - $this->flush($sql_data); - } - -} - -/** -* @package acp -*/ -class oracle_extractor extends base_extractor -{ - function write_table($table_name) - { - global $db; - $sql_data = '-- Table: ' . $table_name . "\n"; - $sql_data .= "DROP TABLE $table_name\n/\n"; - $sql_data .= "\nCREATE TABLE $table_name (\n"; - - $sql = "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION, DATA_LENGTH, NULLABLE, DATA_DEFAULT - FROM ALL_TAB_COLS - WHERE table_name = '{$table_name}'"; - $result = $db->sql_query($sql); - - $rows = array(); - while ($row = $db->sql_fetchrow($result)) - { - $line = ' "' . $row['column_name'] . '" ' . $row['data_type']; - - if ($row['data_type'] !== 'CLOB') - { - if ($row['data_type'] !== 'VARCHAR2' && $row['data_type'] !== 'CHAR') - { - $line .= '(' . $row['data_precision'] . ')'; - } - else - { - $line .= '(' . $row['data_length'] . ')'; - } - } - - if (!empty($row['data_default'])) - { - $line .= ' DEFAULT ' . $row['data_default']; - } - - if ($row['nullable'] == 'N') - { - $line .= ' NOT NULL'; - } - $rows[] = $line; - } - $db->sql_freeresult($result); - - $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME - FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B - WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME - AND B.CONSTRAINT_TYPE = 'P' - AND A.TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); - - $primary_key = array(); - $contraint_name = ''; - while ($row = $db->sql_fetchrow($result)) - { - $constraint_name = '"' . $row['constraint_name'] . '"'; - $primary_key[] = '"' . $row['column_name'] . '"'; - } - $db->sql_freeresult($result); - - if (sizeof($primary_key)) - { - $rows[] = " CONSTRAINT {$constraint_name} PRIMARY KEY (" . implode(', ', $primary_key) . ')'; - } - - $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME - FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B - WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME - AND B.CONSTRAINT_TYPE = 'U' - AND A.TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); - - $unique = array(); - $contraint_name = ''; - while ($row = $db->sql_fetchrow($result)) - { - $constraint_name = '"' . $row['constraint_name'] . '"'; - $unique[] = '"' . $row['column_name'] . '"'; - } - $db->sql_freeresult($result); - - if (sizeof($unique)) - { - $rows[] = " CONSTRAINT {$constraint_name} UNIQUE (" . implode(', ', $unique) . ')'; - } - - $sql_data .= implode(",\n", $rows); - $sql_data .= "\n)\n/\n"; - - $sql = "SELECT A.REFERENCED_NAME, C.* - FROM USER_DEPENDENCIES A, USER_TRIGGERS B, USER_SEQUENCES C - WHERE A.REFERENCED_TYPE = 'SEQUENCE' - AND A.NAME = B.TRIGGER_NAME - AND B.TABLE_NAME = '{$table_name}' - AND C.SEQUENCE_NAME = A.REFERENCED_NAME"; - $result = $db->sql_query($sql); - - $type = request_var('type', ''); - - while ($row = $db->sql_fetchrow($result)) - { - $sql_data .= "\nDROP SEQUENCE \"{$row['referenced_name']}\"\n/\n"; - $sql_data .= "\nCREATE SEQUENCE \"{$row['referenced_name']}\""; - - if ($type == 'full') - { - $sql_data .= ' START WITH ' . $row['last_number']; - } - - $sql_data .= "\n/\n"; - } - $db->sql_freeresult($result); - - $sql = "SELECT DESCRIPTION, WHEN_CLAUSE, TRIGGER_BODY - FROM USER_TRIGGERS - WHERE TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - $sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\n/\n"; - } - $db->sql_freeresult($result); - - $sql = "SELECT A.INDEX_NAME, B.COLUMN_NAME - FROM USER_INDEXES A, USER_IND_COLUMNS B - WHERE A.UNIQUENESS = 'NONUNIQUE' - AND A.INDEX_NAME = B.INDEX_NAME - AND B.TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); - - $index = array(); - - while ($row = $db->sql_fetchrow($result)) - { - $index[$row['index_name']][] = $row['column_name']; - } - - foreach ($index as $index_name => $column_names) - { - $sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n/\n"; - } - $db->sql_freeresult($result); - $this->flush($sql_data); - } - - function write_data($table_name) - { - global $db; - $ary_type = $ary_name = array(); - - // Grab all of the data from current table. - $sql = "SELECT * - FROM $table_name"; - $result = $db->sql_query($sql); - - $i_num_fields = ocinumcols($result); - - for ($i = 0; $i < $i_num_fields; $i++) - { - $ary_type[$i] = ocicolumntype($result, $i + 1); - $ary_name[$i] = ocicolumnname($result, $i + 1); - } - - $sql_data = ''; - - while ($row = $db->sql_fetchrow($result)) - { - $schema_vals = $schema_fields = array(); - - // Build the SQL statement to recreate the data. - for ($i = 0; $i < $i_num_fields; $i++) - { - // Oracle uses uppercase - we use lowercase - $str_val = $row[strtolower($ary_name[$i])]; - - if (preg_match('#char|text|bool|raw|clob#i', $ary_type[$i])) - { - $str_quote = ''; - $str_empty = "''"; - $str_val = sanitize_data_oracle($str_val); - } - else if (preg_match('#date|timestamp#i', $ary_type[$i])) - { - if (empty($str_val)) - { - $str_quote = ''; - } - else - { - $str_quote = "'"; - } - } - else - { - $str_quote = ''; - $str_empty = 'NULL'; - } - - if (empty($str_val) && $str_val !== '0') - { - $str_val = $str_empty; - } - - $schema_vals[$i] = $str_quote . $str_val . $str_quote; - $schema_fields[$i] = '"' . $ary_name[$i] . '"'; - } - - // Take the ordered fields and their associated data and build it - // into a valid sql statement to recreate that field in the data. - $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ")\n/\n"; - - $this->flush($sql_data); - } - $db->sql_freeresult($result); - } - - function write_start($prefix) - { - $sql_data = "--\n"; - $sql_data .= "-- phpBB Backup Script\n"; - $sql_data .= "-- Dump of tables for $prefix\n"; - $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; - $sql_data .= "--\n"; - $this->flush($sql_data); - } -} - -/** -* @package acp -*/ -class firebird_extractor extends base_extractor -{ - function write_start($prefix) - { - $sql_data = "--\n"; - $sql_data .= "-- phpBB Backup Script\n"; - $sql_data .= "-- Dump of tables for $prefix\n"; - $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; - $sql_data .= "--\n"; - $this->flush($sql_data); - } - - function write_data($table_name) - { - global $db; - $ary_type = $ary_name = array(); - - // Grab all of the data from current table. - $sql = "SELECT * - FROM $table_name"; - $result = $db->sql_query($sql); - - $i_num_fields = ibase_num_fields($result); - - for ($i = 0; $i < $i_num_fields; $i++) - { - $info = ibase_field_info($result, $i); - $ary_type[$i] = $info['type']; - $ary_name[$i] = $info['name']; - } - - while ($row = $db->sql_fetchrow($result)) - { - $schema_vals = $schema_fields = array(); - - // Build the SQL statement to recreate the data. - for ($i = 0; $i < $i_num_fields; $i++) - { - $str_val = $row[strtolower($ary_name[$i])]; - - if (preg_match('#char|text|bool|varbinary|blob#i', $ary_type[$i])) - { - $str_quote = ''; - $str_empty = "''"; - $str_val = sanitize_data_generic(str_replace("'", "''", $str_val)); - } - else if (preg_match('#date|timestamp#i', $ary_type[$i])) - { - if (empty($str_val)) - { - $str_quote = ''; - } - else - { - $str_quote = "'"; - } - } - else - { - $str_quote = ''; - $str_empty = 'NULL'; - } - - if (empty($str_val) && $str_val !== '0') - { - $str_val = $str_empty; - } - - $schema_vals[$i] = $str_quote . $str_val . $str_quote; - $schema_fields[$i] = '"' . $ary_name[$i] . '"'; - } - - // Take the ordered fields and their associated data and build it - // into a valid sql statement to recreate that field in the data. - $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n"; - - $this->flush($sql_data); - } - $db->sql_freeresult($result); - } - - function write_table($table_name) - { - global $db; - - $sql_data = '-- Table: ' . $table_name . "\n"; - $sql_data .= "DROP TABLE $table_name;\n"; - - $data_types = array(7 => 'SMALLINT', 8 => 'INTEGER', 10 => 'FLOAT', 12 => 'DATE', 13 => 'TIME', 14 => 'CHARACTER', 27 => 'DOUBLE PRECISION', 35 => 'TIMESTAMP', 37 => 'VARCHAR', 40 => 'CSTRING', 261 => 'BLOB', 701 => 'DECIMAL', 702 => 'NUMERIC'); - - $sql_data .= "\nCREATE TABLE $table_name (\n"; - - $sql = 'SELECT DISTINCT R.RDB$FIELD_NAME as FNAME, R.RDB$NULL_FLAG as NFLAG, R.RDB$DEFAULT_SOURCE as DSOURCE, F.RDB$FIELD_TYPE as FTYPE, F.RDB$FIELD_SUB_TYPE as STYPE, F.RDB$FIELD_LENGTH as FLEN - FROM RDB$RELATION_FIELDS R - JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME - LEFT JOIN RDB$FIELD_DIMENSIONS D ON R.RDB$FIELD_SOURCE = D.RDB$FIELD_NAME - WHERE F.RDB$SYSTEM_FLAG = 0 - AND R.RDB$RELATION_NAME = \''. $table_name . '\' - ORDER BY R.RDB$FIELD_POSITION'; - $result = $db->sql_query($sql); - - $rows = array(); - while ($row = $db->sql_fetchrow($result)) - { - $line = "\t" . '"' . $row['fname'] . '" ' . $data_types[$row['ftype']]; - - if ($row['ftype'] == 261 && $row['stype'] == 1) - { - $line .= ' SUB_TYPE TEXT'; - } - - if ($row['ftype'] == 37 || $row['ftype'] == 14) - { - $line .= ' (' . $row['flen'] . ')'; - } - - if (!empty($row['dsource'])) - { - $line .= ' ' . $row['dsource']; - } - - if (!empty($row['nflag'])) - { - $line .= ' NOT NULL'; - } - $rows[] = $line; - } - $db->sql_freeresult($result); - - $sql_data .= implode(",\n", $rows); - $sql_data .= "\n);\n"; - $keys = array(); - - $sql = 'SELECT I.RDB$FIELD_NAME as NAME - FROM RDB$RELATION_CONSTRAINTS RC, RDB$INDEX_SEGMENTS I, RDB$INDICES IDX - WHERE (I.RDB$INDEX_NAME = RC.RDB$INDEX_NAME) - AND (IDX.RDB$INDEX_NAME = RC.RDB$INDEX_NAME) - AND (RC.RDB$RELATION_NAME = \''. $table_name . '\') - ORDER BY I.RDB$FIELD_POSITION'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $keys[] = $row['name']; - } - - if (sizeof($keys)) - { - $sql_data .= "\nALTER TABLE $table_name ADD PRIMARY KEY (" . implode(', ', $keys) . ');'; - } - - $db->sql_freeresult($result); - - $sql = 'SELECT I.RDB$INDEX_NAME as INAME, I.RDB$UNIQUE_FLAG as UFLAG, S.RDB$FIELD_NAME as FNAME - FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON S.RDB$INDEX_NAME=I.RDB$INDEX_NAME - WHERE (I.RDB$SYSTEM_FLAG IS NULL OR I.RDB$SYSTEM_FLAG=0) - AND I.RDB$FOREIGN_KEY IS NULL - AND I.RDB$RELATION_NAME = \''. $table_name . '\' - AND I.RDB$INDEX_NAME NOT STARTING WITH \'RDB$\' - ORDER BY S.RDB$FIELD_POSITION'; - $result = $db->sql_query($sql); - - $index = array(); - while ($row = $db->sql_fetchrow($result)) - { - $index[$row['iname']]['unique'] = !empty($row['uflag']); - $index[$row['iname']]['values'][] = $row['fname']; - } - - foreach ($index as $index_name => $data) - { - $sql_data .= "\nCREATE "; - if ($data['unique']) - { - $sql_data .= 'UNIQUE '; - } - $sql_data .= "INDEX $index_name ON $table_name(" . implode(', ', $data['values']) . ");"; - } - $sql_data .= "\n"; - - $db->sql_freeresult($result); - - $sql = 'SELECT D1.RDB$DEPENDENT_NAME as DNAME, D1.RDB$FIELD_NAME as FNAME, D1.RDB$DEPENDENT_TYPE, R1.RDB$RELATION_NAME - FROM RDB$DEPENDENCIES D1 - LEFT JOIN RDB$RELATIONS R1 ON ((D1.RDB$DEPENDENT_NAME = R1.RDB$RELATION_NAME) AND (NOT (R1.RDB$VIEW_BLR IS NULL))) - WHERE (D1.RDB$DEPENDED_ON_TYPE = 0) - AND (D1.RDB$DEPENDENT_TYPE <> 3) - AND (D1.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\') - UNION SELECT DISTINCT F2.RDB$RELATION_NAME, D2.RDB$FIELD_NAME, D2.RDB$DEPENDENT_TYPE, R2.RDB$RELATION_NAME FROM RDB$DEPENDENCIES D2, RDB$RELATION_FIELDS F2 - LEFT JOIN RDB$RELATIONS R2 ON ((F2.RDB$RELATION_NAME = R2.RDB$RELATION_NAME) AND (NOT (R2.RDB$VIEW_BLR IS NULL))) - WHERE (D2.RDB$DEPENDENT_TYPE = 3) - AND (D2.RDB$DEPENDENT_NAME = F2.RDB$FIELD_SOURCE) - AND (D2.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\') - ORDER BY 1, 2'; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) - { - $sql = 'SELECT T1.RDB$DEPENDED_ON_NAME as GEN, T1.RDB$FIELD_NAME, T1.RDB$DEPENDED_ON_TYPE - FROM RDB$DEPENDENCIES T1 - WHERE (T1.RDB$DEPENDENT_NAME = \'' . $row['dname'] . '\') - AND (T1.RDB$DEPENDENT_TYPE = 2 AND T1.RDB$DEPENDED_ON_TYPE = 14) - UNION ALL SELECT DISTINCT D.RDB$DEPENDED_ON_NAME, D.RDB$FIELD_NAME, D.RDB$DEPENDED_ON_TYPE - FROM RDB$DEPENDENCIES D, RDB$RELATION_FIELDS F - WHERE (D.RDB$DEPENDENT_TYPE = 3) - AND (D.RDB$DEPENDENT_NAME = F.RDB$FIELD_SOURCE) - AND (F.RDB$RELATION_NAME = \'' . $row['dname'] . '\') - ORDER BY 1,2'; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - $db->sql_freeresult($result2); - $gen_name = $row2['gen']; - - $sql_data .= "\nDROP GENERATOR " . $gen_name . ";"; - $sql_data .= "\nSET TERM ^ ;"; - $sql_data .= "\nCREATE GENERATOR " . $gen_name . "^"; - $sql_data .= "\nSET GENERATOR " . $gen_name . " TO 0^\n"; - $sql_data .= "\nCREATE TRIGGER {$row['dname']} FOR $table_name"; - $sql_data .= "\nBEFORE INSERT\nAS\nBEGIN"; - $sql_data .= "\n NEW.{$row['fname']} = GEN_ID(" . $gen_name . ", 1);"; - $sql_data .= "\nEND^\n"; - $sql_data .= "\nSET TERM ; ^\n"; - } - - $this->flush($sql_data); - - $db->sql_freeresult($result); - } -} - // get how much space we allow for a chunk of data, very similar to phpMyAdmin's way of doing things ;-) (hey, we only do this for MySQL anyway :P) function get_usable_memory() { diff --git a/phpBB/includes/acp/acp_disallow.php b/phpBB/includes/acp/acp_disallow.php index f613fa325d..70eb398d07 100644 --- a/phpBB/includes/acp/acp_disallow.php +++ b/phpBB/includes/acp/acp_disallow.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,19 +19,13 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_disallow { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + global $db, $user, $template, $cache, $phpbb_log, $request; $user->add_lang('acp/posting'); @@ -48,7 +46,7 @@ class acp_disallow if ($disallow) { - $disallowed_user = str_replace('*', '%', utf8_normalize_nfc(request_var('disallowed_user', '', true))); + $disallowed_user = str_replace('*', '%', $request->variable('disallowed_user', '', true)); if (!$disallowed_user) { @@ -73,13 +71,13 @@ class acp_disallow $cache->destroy('_disallowed_usernames'); $message = $user->lang['DISALLOW_SUCCESSFUL']; - add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DISALLOW_ADD', false, array(str_replace('%', '*', $disallowed_user))); trigger_error($message . adm_back_link($this->u_action)); } else if ($allow) { - $disallowed_id = request_var('disallowed_id', 0); + $disallowed_id = $request->variable('disallowed_id', 0); if (!$disallowed_id) { @@ -92,7 +90,7 @@ class acp_disallow $cache->destroy('_disallowed_usernames'); - add_log('admin', 'LOG_DISALLOW_DELETE'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DISALLOW_DELETE'); trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action)); } diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index c9d149b6d7..57eefad02d 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,17 +19,14 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_email { var $u_action; function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; + global $config, $db, $user, $template, $phpbb_log, $request; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_dispatcher; $user->add_lang('acp/email'); $this->tpl_name = 'acp_email'; @@ -38,10 +39,11 @@ class acp_email $submit = (isset($_POST['submit'])) ? true : false; $error = array(); - $usernames = request_var('usernames', '', true); - $group_id = request_var('g', 0); - $subject = utf8_normalize_nfc(request_var('subject', '', true)); - $message = utf8_normalize_nfc(request_var('message', '', true)); + $usernames = $request->variable('usernames', '', true); + $usernames = (!empty($usernames)) ? explode("\n", $usernames) : array(); + $group_id = $request->variable('g', 0); + $subject = $request->variable('subject', '', true); + $message = $request->variable('message', '', true); // Do the job ... if ($submit) @@ -49,7 +51,7 @@ class acp_email // Error checking needs to go here ... if no subject and/or no message then skip // over the send and return to the form $use_queue = (isset($_POST['send_immediately'])) ? false : true; - $priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY); + $priority = $request->variable('mail_priority_flag', MAIL_NORMAL_PRIORITY); if (!check_form_key($form_key)) { @@ -68,14 +70,18 @@ class acp_email if (!sizeof($error)) { - if ($usernames) + if (!empty($usernames)) { // If giving usernames the admin is able to email inactive users too... - $sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang - FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', explode("\n", $usernames))) . ' - AND user_allow_massemail = 1 - ORDER BY user_lang, user_notify_type'; // , SUBSTRING(user_email FROM INSTR(user_email, '@')) + $sql_ary = array( + 'SELECT' => 'username, user_email, user_jabber, user_notify_type, user_lang', + 'FROM' => array( + USERS_TABLE => '', + ), + 'WHERE' => $db->sql_in_set('username_clean', array_map('utf8_clean_string', $usernames)) . ' + AND user_allow_massemail = 1', + 'ORDER_BY' => 'user_lang, user_notify_type', + ); } else { @@ -122,8 +128,18 @@ class acp_email ), ); } - $sql = $db->sql_build_query('SELECT', $sql_ary); } + /** + * Modify sql query to change the list of users the email is sent to + * + * @event core.acp_email_modify_sql + * @var array sql_ary Array which is used to build the sql query + * @since 3.1.2-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_email_modify_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -173,12 +189,52 @@ class acp_email $db->sql_freeresult($result); // Send the messages - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } + + if (!function_exists('get_group_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $messenger = new messenger($use_queue); $errored = false; + $email_template = 'admin_send_email'; + $template_data = array( + 'CONTACT_EMAIL' => phpbb_get_board_contact($config, $phpEx), + 'MESSAGE' => htmlspecialchars_decode($message), + ); + $generate_log_entry = true; + + /** + * Modify email template data before the emails are sent + * + * @event core.acp_email_send_before + * @var string email_template The template to be used for sending the email + * @var string subject The subject of the email + * @var array template_data Array with template data assigned to email template + * @var bool generate_log_entry If false, no log entry will be created + * @var array usernames Usernames which will be displayed in log entry, if it will be created + * @var int group_id The group this email will be sent to + * @var bool use_queue If true, email queue will be used for sending + * @var int priority Priority of sent emails + * @since 3.1.3-RC1 + */ + $vars = array( + 'email_template', + 'subject', + 'template_data', + 'generate_log_entry', + 'usernames', + 'group_id', + 'use_queue', + 'priority', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_email_send_before', compact($vars))); + for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) { $used_lang = $email_list[$i][0]['lang']; @@ -192,17 +248,14 @@ class acp_email $messenger->im($email_row['jabber'], $email_row['name']); } - $messenger->template('admin_send_email', $used_lang); + $messenger->template($email_template, $used_lang); $messenger->anti_abuse_headers($config, $user); $messenger->subject(htmlspecialchars_decode($subject)); $messenger->set_mail_priority($priority); - $messenger->assign_vars(array( - 'CONTACT_EMAIL' => $config['board_contact'], - 'MESSAGE' => htmlspecialchars_decode($message)) - ); + $messenger->assign_vars($template_data); if (!($messenger->send($used_method))) { @@ -213,24 +266,26 @@ class acp_email $messenger->save_queue(); - if ($usernames) - { - $usernames = explode("\n", $usernames); - add_log('admin', 'LOG_MASS_EMAIL', implode(', ', utf8_normalize_nfc($usernames))); - } - else + if ($generate_log_entry) { - if ($group_id) + if (!empty($usernames)) { - $group_name = get_group_name($group_id); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MASS_EMAIL', false, array(implode(', ', utf8_normalize_nfc($usernames)))); } else { - // Not great but the logging routine doesn't cope well with localising on the fly - $group_name = $user->lang['ALL_USERS']; - } + if ($group_id) + { + $group_name = get_group_name($group_id); + } + else + { + // Not great but the logging routine doesn't cope well with localising on the fly + $group_name = $user->lang['ALL_USERS']; + } - add_log('admin', 'LOG_MASS_EMAIL', $group_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MASS_EMAIL', false, array($group_name)); + } } if (!$errored) @@ -266,17 +321,31 @@ class acp_email $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>'; $s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>'; - $template->assign_vars(array( + $template_data = array( 'S_WARNING' => (sizeof($error)) ? true : false, 'WARNING_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', 'U_ACTION' => $this->u_action, 'S_GROUP_OPTIONS' => $select_list, - 'USERNAMES' => $usernames, + 'USERNAMES' => implode("\n", $usernames), 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_email&field=usernames'), 'SUBJECT' => $subject, 'MESSAGE' => $message, - 'S_PRIORITY_OPTIONS' => $s_priority_options) + 'S_PRIORITY_OPTIONS' => $s_priority_options, ); + /** + * Modify custom email template data before we display the form + * + * @event core.acp_email_display + * @var array template_data Array with template data assigned to email template + * @var array exclude Array with groups which are excluded from group selection + * @var array usernames Usernames which will be displayed in form + * + * @since 3.1.4-RC1 + */ + $vars = array('template_data', 'exclude', 'usernames'); + extract($phpbb_dispatcher->trigger_event('core.acp_email_display', compact($vars))); + + $template->assign_vars($template_data); } } diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 2ff479d824..9fbf2f20f1 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_extensions { var $u_action; @@ -26,16 +27,22 @@ class acp_extensions private $config; private $template; private $user; + private $cache; + private $log; + private $request; function main() { // Start the page - global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx; + global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpbb_log, $cache; $this->db = $db; $this->config = $config; $this->template = $template; $this->user = $user; + $this->cache = $cache; + $this->request = $request; + $this->log = $phpbb_log; $user->add_lang(array('install', 'acp/extensions', 'migrator')); @@ -69,21 +76,52 @@ class acp_extensions { $md_manager->get_metadata('all'); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { - trigger_error($e, E_USER_WARNING); + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + trigger_error($message, E_USER_WARNING); } } // What are we doing? switch ($action) { + case 'set_config_version_check_force_unstable': + $force_unstable = $this->request->variable('force_unstable', false); + + if ($force_unstable) + { + $s_hidden_fields = build_hidden_fields(array( + 'force_unstable' => $force_unstable, + )); + + confirm_box(false, $user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields); + } + else + { + $config->set('extension_force_unstable', false); + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + break; + case 'list': default: + if (confirm_box(true)) + { + $config->set('extension_force_unstable', true); + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + $this->list_enabled_exts($phpbb_extension_manager); $this->list_disabled_exts($phpbb_extension_manager); $this->list_available_exts($phpbb_extension_manager); + $this->template->assign_vars(array( + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=list&versioncheck_force=1', + 'FORCE_UNSTABLE' => $config['extension_force_unstable'], + 'U_ACTION' => $this->u_action, + )); + $this->tpl_name = 'acp_ext_list'; break; @@ -98,7 +136,13 @@ class acp_extensions trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } - if ($phpbb_extension_manager->enabled($ext_name)) + $extension = $phpbb_extension_manager->get_extension($ext_name); + if (!$extension->is_enableable()) + { + trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if ($phpbb_extension_manager->is_enabled($ext_name)) { redirect($this->u_action); } @@ -123,6 +167,12 @@ class acp_extensions trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } + $extension = $phpbb_extension_manager->get_extension($ext_name); + if (!$extension->is_enableable()) + { + trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + try { while ($phpbb_extension_manager->enable_step($ext_name)) @@ -135,6 +185,7 @@ class acp_extensions meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name)); } } + $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name)); } catch (\phpbb\db\migration\exception $e) { @@ -149,7 +200,7 @@ class acp_extensions break; case 'disable_pre': - if (!$phpbb_extension_manager->enabled($ext_name)) + if (!$phpbb_extension_manager->is_enabled($ext_name)) { redirect($this->u_action); } @@ -164,6 +215,11 @@ class acp_extensions break; case 'disable': + if (!$phpbb_extension_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + while ($phpbb_extension_manager->disable_step($ext_name)) { // Are we approaching the time limit? If so we want to pause the update and continue after refreshing @@ -174,6 +230,7 @@ class acp_extensions meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name)); } } + $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name)); $this->tpl_name = 'acp_ext_disable'; @@ -183,7 +240,7 @@ class acp_extensions break; case 'delete_data_pre': - if ($phpbb_extension_manager->enabled($ext_name)) + if ($phpbb_extension_manager->is_enabled($ext_name)) { redirect($this->u_action); } @@ -197,6 +254,11 @@ class acp_extensions break; case 'delete_data': + if ($phpbb_extension_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + try { while ($phpbb_extension_manager->purge_step($ext_name)) @@ -209,6 +271,7 @@ class acp_extensions meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name)); } } + $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_PURGE', time(), array($ext_name)); } catch (\phpbb\db\migration\exception $e) { @@ -226,7 +289,33 @@ class acp_extensions // Output it to the template $md_manager->output_template_data(); - $template->assign_var('U_BACK', $this->u_action . '&action=list'); + try + { + $updates_available = $this->version_check($md_manager, $request->variable('versioncheck_force', false)); + + $template->assign_vars(array( + 'S_UP_TO_DATE' => empty($updates_available), + 'S_VERSIONCHECK' => true, + 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), + )); + + foreach ($updates_available as $branch => $version_data) + { + $template->assign_block_vars('updates_available', $version_data); + } + } + catch (\RuntimeException $e) + { + $template->assign_vars(array( + 'S_VERSIONCHECK_STATUS' => $e->getCode(), + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', + )); + } + + $template->assign_vars(array( + 'U_BACK' => $this->u_action . '&action=list', + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')), + )); $this->tpl_name = 'acp_ext_details'; break; @@ -234,104 +323,179 @@ class acp_extensions } /** - * Lists all the enabled extensions and dumps to the template - * - * @param $phpbb_extension_manager An instance of the extension manager - * @return null - */ + * Lists all the enabled extensions and dumps to the template + * + * @param $phpbb_extension_manager An instance of the extension manager + * @return null + */ public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager) { + $enabled_extension_meta_data = array(); + foreach ($phpbb_extension_manager->all_enabled() as $name => $location) { $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); try { - $this->template->assign_block_vars('enabled', array( - 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), - - 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name), - )); - - $this->output_actions('enabled', array( - 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($name), - )); + $meta = $md_manager->get_metadata('all'); + $enabled_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->version_check($md_manager, $force_update, !$force_update); + + $enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); $this->template->assign_block_vars('disabled', array( - 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, )); } + catch (\RuntimeException $e) + { + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + + uasort($enabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($enabled_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('enabled', $block_vars); + + $this->output_actions('enabled', array( + 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($name), + )); } } /** - * Lists all the disabled extensions and dumps to the template - * - * @param $phpbb_extension_manager An instance of the extension manager - * @return null - */ + * Lists all the disabled extensions and dumps to the template + * + * @param $phpbb_extension_manager An instance of the extension manager + * @return null + */ public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager) { + $disabled_extension_meta_data = array(); + foreach ($phpbb_extension_manager->all_disabled() as $name => $location) { $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); try { - $this->template->assign_block_vars('disabled', array( - 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), - - 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name), - )); - - $this->output_actions('disabled', array( - 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), - 'DELETE_DATA' => $this->u_action . '&action=delete_data_pre&ext_name=' . urlencode($name), - )); + $meta = $md_manager->get_metadata('all'); + $disabled_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->version_check($md_manager, $force_update, !$force_update); + + $disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); $this->template->assign_block_vars('disabled', array( - 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, )); } + catch (\RuntimeException $e) + { + $disabeld_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + + uasort($disabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($disabled_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); + + $this->output_actions('disabled', array( + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), + 'DELETE_DATA' => $this->u_action . '&action=delete_data_pre&ext_name=' . urlencode($name), + )); } } /** - * Lists all the available extensions and dumps to the template - * - * @param $phpbb_extension_manager An instance of the extension manager - * @return null - */ + * Lists all the available extensions and dumps to the template + * + * @param $phpbb_extension_manager An instance of the extension manager + * @return null + */ public function list_available_exts(\phpbb\extension\manager $phpbb_extension_manager) { $uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured()); + $available_extension_meta_data = array(); + foreach ($uninstalled as $name => $location) { $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); try { - $this->template->assign_block_vars('disabled', array( - 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), - - 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name), - )); - - $this->output_actions('disabled', array( - 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), - )); + $meta = $md_manager->get_metadata('all'); + $available_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->version_check($md_manager, $force_update, !$force_update); + + $available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); $this->template->assign_block_vars('disabled', array( - 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, )); } + catch (\RuntimeException $e) + { + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + + uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($available_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); + + $this->output_actions('disabled', array( + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), + )); } } @@ -352,4 +516,40 @@ class acp_extensions )); } } + + /** + * Check the version and return the available updates. + * + * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string + * @throws RuntimeException + */ + protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false) + { + $meta = $md_manager->get_metadata('all'); + + if (!isset($meta['extra']['version-check'])) + { + throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1); + } + + $version_check = $meta['extra']['version-check']; + + $version_helper = new \phpbb\version_helper($this->cache, $this->config, new \phpbb\file_downloader(), $this->user); + $version_helper->set_current_version($meta['version']); + $version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false); + $version_helper->force_stability($this->config['extension_force_unstable'] ? 'unstable' : null); + + return $updates = $version_helper->get_suggested_updates($force_update, $force_cache); + } + + /** + * Sort helper for the table containing the metadata about the extensions. + */ + protected function sort_extension_meta_data_table($val1, $val2) + { + return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']); + } } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index a1af8c489d..c5d2d0ea09 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_forums { var $u_action; @@ -26,7 +27,7 @@ class acp_forums function main($id, $mode) { global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; - global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; + global $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log; $user->add_lang('acp/forums'); $this->tpl_name = 'acp_forums'; @@ -35,11 +36,11 @@ class acp_forums $form_key = 'acp_forums'; add_form_key($form_key); - $action = request_var('action', ''); + $action = $request->variable('action', ''); $update = (isset($_POST['update'])) ? true : false; - $forum_id = request_var('f', 0); + $forum_id = $request->variable('f', 0); - $this->parent_id = request_var('parent_id', 0); + $this->parent_id = $request->variable('parent_id', 0); $forum_data = $errors = array(); if ($update && !check_form_key($form_key)) { @@ -51,8 +52,8 @@ class acp_forums switch ($action) { case 'progress_bar': - $start = request_var('start', 0); - $total = request_var('total', 0); + $start = $request->variable('start', 0); + $total = $request->variable('total', 0); $this->display_progress_bar($start, $total); break; @@ -82,10 +83,10 @@ class acp_forums switch ($action) { case 'delete': - $action_subforums = request_var('action_subforums', ''); - $subforums_to_id = request_var('subforums_to_id', 0); - $action_posts = request_var('action_posts', ''); - $posts_to_id = request_var('posts_to_id', 0); + $action_subforums = $request->variable('action_subforums', ''); + $subforums_to_id = $request->variable('subforums_to_id', 0); + $action_posts = $request->variable('action_posts', ''); + $posts_to_id = $request->variable('posts_to_id', 0); $errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id); @@ -111,42 +112,45 @@ class acp_forums case 'add': $forum_data += array( - 'parent_id' => request_var('forum_parent_id', $this->parent_id), - 'forum_type' => request_var('forum_type', FORUM_POST), - 'type_action' => request_var('type_action', ''), - 'forum_status' => request_var('forum_status', ITEM_UNLOCKED), + 'parent_id' => $request->variable('forum_parent_id', $this->parent_id), + 'forum_type' => $request->variable('forum_type', FORUM_POST), + 'type_action' => $request->variable('type_action', ''), + 'forum_status' => $request->variable('forum_status', ITEM_UNLOCKED), 'forum_parents' => '', - 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), - 'forum_link' => request_var('forum_link', ''), - 'forum_link_track' => request_var('forum_link_track', false), - 'forum_desc' => utf8_normalize_nfc(request_var('forum_desc', '', true)), + 'forum_name' => $request->variable('forum_name', '', true), + 'forum_link' => $request->variable('forum_link', ''), + 'forum_link_track' => $request->variable('forum_link_track', false), + 'forum_desc' => $request->variable('forum_desc', '', true), 'forum_desc_uid' => '', 'forum_desc_options' => 7, 'forum_desc_bitfield' => '', - 'forum_rules' => utf8_normalize_nfc(request_var('forum_rules', '', true)), + 'forum_rules' => $request->variable('forum_rules', '', true), 'forum_rules_uid' => '', 'forum_rules_options' => 7, 'forum_rules_bitfield' => '', - 'forum_rules_link' => request_var('forum_rules_link', ''), - 'forum_image' => request_var('forum_image', ''), - 'forum_style' => request_var('forum_style', 0), - 'display_subforum_list' => request_var('display_subforum_list', false), - 'display_on_index' => request_var('display_on_index', false), - 'forum_topics_per_page' => request_var('topics_per_page', 0), - 'enable_indexing' => request_var('enable_indexing', true), - 'enable_icons' => request_var('enable_icons', false), - 'enable_prune' => request_var('enable_prune', false), - 'enable_post_review' => request_var('enable_post_review', true), - 'enable_quick_reply' => request_var('enable_quick_reply', false), - 'prune_days' => request_var('prune_days', 7), - 'prune_viewed' => request_var('prune_viewed', 7), - 'prune_freq' => request_var('prune_freq', 1), - 'prune_old_polls' => request_var('prune_old_polls', false), - 'prune_announce' => request_var('prune_announce', false), - 'prune_sticky' => request_var('prune_sticky', false), - 'forum_password' => request_var('forum_password', '', true), - 'forum_password_confirm'=> request_var('forum_password_confirm', '', true), - 'forum_password_unset' => request_var('forum_password_unset', false), + 'forum_rules_link' => $request->variable('forum_rules_link', ''), + 'forum_image' => $request->variable('forum_image', ''), + 'forum_style' => $request->variable('forum_style', 0), + 'display_subforum_list' => $request->variable('display_subforum_list', false), + 'display_on_index' => $request->variable('display_on_index', false), + 'forum_topics_per_page' => $request->variable('topics_per_page', 0), + 'enable_indexing' => $request->variable('enable_indexing', true), + 'enable_icons' => $request->variable('enable_icons', false), + 'enable_prune' => $request->variable('enable_prune', false), + 'enable_post_review' => $request->variable('enable_post_review', true), + 'enable_quick_reply' => $request->variable('enable_quick_reply', false), + 'enable_shadow_prune' => $request->variable('enable_shadow_prune', false), + 'prune_days' => $request->variable('prune_days', 7), + 'prune_viewed' => $request->variable('prune_viewed', 7), + 'prune_freq' => $request->variable('prune_freq', 1), + 'prune_old_polls' => $request->variable('prune_old_polls', false), + 'prune_announce' => $request->variable('prune_announce', false), + 'prune_sticky' => $request->variable('prune_sticky', false), + 'prune_shadow_days' => $request->variable('prune_shadow_days', 7), + 'prune_shadow_freq' => $request->variable('prune_shadow_freq', 1), + 'forum_password' => $request->variable('forum_password', '', true), + 'forum_password_confirm'=> $request->variable('forum_password_confirm', '', true), + 'forum_password_unset' => $request->variable('forum_password_unset', false), ); /** @@ -155,7 +159,7 @@ class acp_forums * @event core.acp_manage_forums_request_data * @var string action Type of the action: add|edit * @var array forum_data Array with new forum data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('action', 'forum_data'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_request_data', compact($vars))); @@ -169,7 +173,7 @@ class acp_forums // Use link_display_on_index setting if forum type is link if ($forum_data['forum_type'] == FORUM_LINK) { - $forum_data['display_on_index'] = request_var('link_display_on_index', false); + $forum_data['display_on_index'] = $request->variable('link_display_on_index', false); } // Linked forums and categories are not able to be locked... @@ -178,25 +182,25 @@ class acp_forums $forum_data['forum_status'] = ITEM_UNLOCKED; } - $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? request_var('display_recent', true) : request_var('display_active', false); + $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? $request->variable('display_recent', true) : $request->variable('display_active', false); // Get data for forum rules if specified... if ($forum_data['forum_rules']) { - generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_parse_bbcode', false), request_var('rules_parse_urls', false), request_var('rules_parse_smilies', false)); + generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_parse_bbcode', false), $request->variable('rules_parse_urls', false), $request->variable('rules_parse_smilies', false)); } // Get data for forum description if specified if ($forum_data['forum_desc']) { - generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_parse_bbcode', false), request_var('desc_parse_urls', false), request_var('desc_parse_smilies', false)); + generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_parse_bbcode', false), $request->variable('desc_parse_urls', false), $request->variable('desc_parse_smilies', false)); } $errors = $this->update_forum_data($forum_data); if (!sizeof($errors)) { - $forum_perm_from = request_var('forum_perm_from', 0); + $forum_perm_from = $request->variable('forum_perm_from', 0); $cache->destroy('sql', FORUMS_TABLE); $copied_permissions = false; @@ -262,7 +266,7 @@ class acp_forums if ($move_forum_name !== false) { - add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_' . strtoupper($action), false, array($row['forum_name'], $move_forum_name)); $cache->destroy('sql', FORUMS_TABLE); } @@ -307,7 +311,7 @@ class acp_forums $row2['min_topic_id'] = (int) $row2['min_topic_id']; $row2['max_topic_id'] = (int) $row2['max_topic_id']; - $start = request_var('start', $row2['min_topic_id']); + $start = $request->variable('start', $row2['min_topic_id']); $batch_size = 2000; $end = $start + $batch_size; @@ -323,7 +327,7 @@ class acp_forums WHERE forum_id = ' . $forum_id . ' AND topic_id BETWEEN ' . $start . ' AND ' . $end; $result = $db->sql_query($sql); - $topics_done = request_var('topics_done', 0) + (int) $db->sql_fetchfield('num_topics'); + $topics_done = $request->variable('topics_done', 0) + (int) $db->sql_fetchfield('num_topics'); $db->sql_freeresult($result); $start += $batch_size; @@ -373,7 +377,8 @@ class acp_forums sync('forum', 'forum_id', $forum_id, false, true); - add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_SYNC', false, array($row['forum_name'])); + $cache->destroy('sql', FORUMS_TABLE); $template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name'])); @@ -386,13 +391,13 @@ class acp_forums if ($update) { $forum_data['forum_flags'] = 0; - $forum_data['forum_flags'] += (request_var('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0; - $forum_data['forum_flags'] += (request_var('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0; - $forum_data['forum_flags'] += (request_var('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; - $forum_data['forum_flags'] += (request_var('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0; + $forum_data['forum_flags'] += ($request->variable('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0; + $forum_data['forum_flags'] += ($request->variable('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0; + $forum_data['forum_flags'] += ($request->variable('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; + $forum_data['forum_flags'] += ($request->variable('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0; $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; - $forum_data['forum_flags'] += (request_var('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; - $forum_data['forum_flags'] += (request_var('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; + $forum_data['forum_flags'] += ($request->variable('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data['forum_flags'] += ($request->variable('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; } // Initialise $row, so we always have it in the event @@ -440,7 +445,7 @@ class acp_forums 'parent_id' => $this->parent_id, 'forum_type' => FORUM_POST, 'forum_status' => ITEM_UNLOCKED, - 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), + 'forum_name' => $request->variable('forum_name', '', true), 'forum_link' => '', 'forum_link_track' => false, 'forum_desc' => '', @@ -457,6 +462,9 @@ class acp_forums 'prune_days' => 7, 'prune_viewed' => 7, 'prune_freq' => 1, + 'enable_shadow_prune' => false, + 'prune_shadow_days' => 7, + 'prune_shadow_freq' => 1, 'forum_flags' => FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS, 'forum_options' => 0, 'forum_password' => '', @@ -478,7 +486,7 @@ class acp_forums * empty when creating new forum * @var array forum_data Array with new forum data * @var string parents_list List of parent options - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('action', 'update', 'forum_id', 'row', 'forum_data', 'parents_list'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_initialise_data', compact($vars))); @@ -504,12 +512,12 @@ class acp_forums { if (!isset($forum_data['forum_rules_uid'])) { - // Before we are able to display the preview and plane text, we need to parse our request_var()'d value... + // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value... $forum_data['forum_rules_uid'] = ''; $forum_data['forum_rules_bitfield'] = ''; $forum_data['forum_rules_options'] = 0; - generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smilies', false)); + generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_allow_bbcode', false), $request->variable('rules_allow_urls', false), $request->variable('rules_allow_smilies', false)); } // Generate preview content @@ -524,12 +532,12 @@ class acp_forums { if (!isset($forum_data['forum_desc_uid'])) { - // Before we are able to display the preview and plane text, we need to parse our request_var()'d value... + // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value... $forum_data['forum_desc_uid'] = ''; $forum_data['forum_desc_bitfield'] = ''; $forum_data['forum_desc_options'] = 0; - generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smilies', false)); + generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_allow_bbcode', false), $request->variable('desc_allow_urls', false), $request->variable('desc_allow_smilies', false)); } // decode... @@ -636,6 +644,8 @@ class acp_forums 'PRUNE_FREQ' => $forum_data['prune_freq'], 'PRUNE_DAYS' => $forum_data['prune_days'], 'PRUNE_VIEWED' => $forum_data['prune_viewed'], + 'PRUNE_SHADOW_FREQ' => $forum_data['prune_shadow_freq'], + 'PRUNE_SHADOW_DAYS' => $forum_data['prune_shadow_days'], 'TOPICS_PER_PAGE' => $forum_data['forum_topics_per_page'], 'FORUM_RULES_LINK' => $forum_data['forum_rules_link'], 'FORUM_RULES' => $forum_data['forum_rules'], @@ -668,6 +678,7 @@ class acp_forums 'S_DISPLAY_SUBFORUM_LIST' => ($forum_data['display_subforum_list']) ? true : false, 'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false, 'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false, + 'S_PRUNE_SHADOW_ENABLE' => ($forum_data['enable_shadow_prune']) ? true : false, 'S_FORUM_LINK_TRACK' => ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? true : false, 'S_PRUNE_OLD_POLLS' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_POLL) ? true : false, 'S_PRUNE_ANNOUNCE' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_ANNOUNCE) ? true : false, @@ -696,9 +707,18 @@ class acp_forums * ensure to update the template variables * S_ERROR and ERROR_MSG to display it * @var array template_data Array with new forum data - * @since 3.1-A1 + * @since 3.1.0-a1 */ - $vars = array('action', 'update', 'forum_id', 'row', 'forum_data', 'parents_list', 'errors', 'template_data'); + $vars = array( + 'action', + 'update', + 'forum_id', + 'row', + 'forum_data', + 'parents_list', + 'errors', + 'template_data', + ); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_display_form', compact($vars))); $template->assign_vars($template_data); @@ -760,7 +780,7 @@ class acp_forums break; case 'copy_perm': - $forum_perm_from = request_var('forum_perm_from', 0); + $forum_perm_from = $request->variable('forum_perm_from', 0); // Copy permissions? if (!empty($forum_perm_from) && $forum_perm_from != $forum_id) @@ -924,12 +944,13 @@ class acp_forums /** * Update forum data */ - function update_forum_data(&$forum_data) + function update_forum_data(&$forum_data_ary) { - global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher; + global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; $errors = array(); + $forum_data = $forum_data_ary; /** * Validate the forum data before we create/update the forum * @@ -937,46 +958,48 @@ class acp_forums * @var array forum_data Array with new forum data * @var array errors Array of errors, should be strings and not * language key. - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('forum_data', 'errors'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); - if ($forum_data['forum_name'] == '') + if ($forum_data_ary['forum_name'] == '') { $errors[] = $user->lang['FORUM_NAME_EMPTY']; } - if (utf8_strlen($forum_data['forum_desc']) > 4000) + if (utf8_strlen($forum_data_ary['forum_desc']) > 4000) { $errors[] = $user->lang['FORUM_DESC_TOO_LONG']; } - if (utf8_strlen($forum_data['forum_rules']) > 4000) + if (utf8_strlen($forum_data_ary['forum_rules']) > 4000) { $errors[] = $user->lang['FORUM_RULES_TOO_LONG']; } - if ($forum_data['forum_password'] || $forum_data['forum_password_confirm']) + if ($forum_data_ary['forum_password'] || $forum_data_ary['forum_password_confirm']) { - if ($forum_data['forum_password'] != $forum_data['forum_password_confirm']) + if ($forum_data_ary['forum_password'] != $forum_data_ary['forum_password_confirm']) { - $forum_data['forum_password'] = $forum_data['forum_password_confirm'] = ''; + $forum_data_ary['forum_password'] = $forum_data_ary['forum_password_confirm'] = ''; $errors[] = $user->lang['FORUM_PASSWORD_MISMATCH']; } } - if ($forum_data['prune_days'] < 0 || $forum_data['prune_viewed'] < 0 || $forum_data['prune_freq'] < 0) + if ($forum_data_ary['prune_days'] < 0 || $forum_data_ary['prune_viewed'] < 0 || $forum_data_ary['prune_freq'] < 0) { - $forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0; + $forum_data_ary['prune_days'] = $forum_data_ary['prune_viewed'] = $forum_data_ary['prune_freq'] = 0; $errors[] = $user->lang['FORUM_DATA_NEGATIVE']; } $range_test_ary = array( - array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'), + array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'TINT:0'), ); - if (!empty($forum_data['forum_image']) && !file_exists($phpbb_root_path . $forum_data['forum_image'])) + if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image'])) { $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST']; } @@ -990,17 +1013,17 @@ class acp_forums // 8 = prune stickies // 16 = show active topics // 32 = enable post review - $forum_data['forum_flags'] = 0; - $forum_data['forum_flags'] += ($forum_data['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0; - $forum_data['forum_flags'] += ($forum_data['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0; - $forum_data['forum_flags'] += ($forum_data['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; - $forum_data['forum_flags'] += ($forum_data['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; - $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; - $forum_data['forum_flags'] += ($forum_data['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; - $forum_data['forum_flags'] += ($forum_data['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0; + $forum_data_ary['forum_flags'] = 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0; // Unset data that are not database fields - $forum_data_sql = $forum_data; + $forum_data_sql = $forum_data_ary; unset($forum_data_sql['forum_link_track']); unset($forum_data_sql['prune_old_polls']); @@ -1031,12 +1054,14 @@ class acp_forums else { // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ $passwords_manager = $phpbb_container->get('passwords.manager'); $forum_data_sql['forum_password'] = $passwords_manager->hash($forum_data_sql['forum_password']); } unset($forum_data_sql['forum_password_unset']); + $forum_data = $forum_data_ary; /** * Remove invalid values from forum_data_sql that should not be updated * @@ -1045,10 +1070,12 @@ class acp_forums * @var array forum_data_sql Array with data we are going to update * If forum_data_sql[forum_id] is set, we update * that forum, otherwise a new one is created. - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('forum_data', 'forum_data_sql'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); $is_new_forum = !isset($forum_data_sql['forum_id']); @@ -1105,9 +1132,9 @@ class acp_forums $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql); $db->sql_query($sql); - $forum_data['forum_id'] = $db->sql_nextid(); + $forum_data_ary['forum_id'] = $db->sql_nextid(); - add_log('admin', 'LOG_FORUM_ADD', $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_ADD', false, array($forum_data_ary['forum_name'])); } else { @@ -1125,7 +1152,7 @@ class acp_forums // we're turning a postable forum into a non-postable forum if ($forum_data_sql['type_action'] == 'move') { - $to_forum_id = request_var('to_forum_id', 0); + $to_forum_id = $request->variable('to_forum_id', 0); if ($to_forum_id) { @@ -1155,8 +1182,8 @@ class acp_forums if ($row['right_id'] - $row['left_id'] > 1) { // We are turning a category into a link - but need to decide what to do with the subforums. - $action_subforums = request_var('action_subforums', ''); - $subforums_to_id = request_var('subforums_to_id', 0); + $action_subforums = $request->variable('action_subforums', ''); + $subforums_to_id = $request->variable('subforums_to_id', 0); if ($action_subforums == 'delete') { @@ -1237,8 +1264,6 @@ class acp_forums return array($user->lang['NO_FORUM']); } - $subforums_to_name = $_row['forum_name']; - $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . " WHERE parent_id = {$row['forum_id']}"; @@ -1322,11 +1347,12 @@ class acp_forums $db->sql_query($sql); // Add it back - $forum_data['forum_id'] = $forum_id; + $forum_data_ary['forum_id'] = $forum_id; - add_log('admin', 'LOG_FORUM_EDIT', $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data_ary['forum_name'])); } + $forum_data = $forum_data_ary; /** * Event after a forum was updated or created * @@ -1338,10 +1364,12 @@ class acp_forums * ensure to set forum_data_sql[forum_id] * @var array errors Array of errors, should be strings and not * language key. - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); return $errors; } @@ -1353,7 +1381,7 @@ class acp_forums { global $db, $user, $phpbb_dispatcher; - $to_data = $moved_ids = $errors = array(); + $errors = array(); // Check if we want to move to a parent with link type if ($to_id > 0) @@ -1376,7 +1404,7 @@ class acp_forums * @var int to_id If of the new parent forum * @var array errors Array of errors, should be strings and not * language key. - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('from_id', 'to_id', 'errors'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_children', compact($vars))); @@ -1480,7 +1508,7 @@ class acp_forums * @var array errors Array of errors, should be strings and not * language key. If this array is not empty, * The content will not be moved. - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('from_id', 'to_id', 'sync', 'errors'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content', compact($vars))); @@ -1526,7 +1554,7 @@ class acp_forums */ function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0) { - global $db, $user, $cache; + global $db, $user, $cache, $phpbb_log; $forum_data = $this->get_forum_info($forum_id); @@ -1723,39 +1751,39 @@ class acp_forums switch ($log_action) { case 'MOVE_POSTS_MOVE_FORUMS': - add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', $posts_to_name, $subforums_to_name, $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', false, array($posts_to_name, $subforums_to_name, $forum_data['forum_name'])); break; case 'MOVE_POSTS_FORUMS': - add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', $posts_to_name, $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', false, array($posts_to_name, $forum_data['forum_name'])); break; case 'POSTS_MOVE_FORUMS': - add_log('admin', 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', $subforums_to_name, $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name'])); break; case '_MOVE_FORUMS': - add_log('admin', 'LOG_FORUM_DEL_MOVE_FORUMS', $subforums_to_name, $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name'])); break; case 'MOVE_POSTS_': - add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS', $posts_to_name, $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS', false, array($posts_to_name, $forum_data['forum_name'])); break; case 'POSTS_FORUMS': - add_log('admin', 'LOG_FORUM_DEL_POSTS_FORUMS', $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_FORUMS', false, array($forum_data['forum_name'])); break; case '_FORUMS': - add_log('admin', 'LOG_FORUM_DEL_FORUMS', $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUMS', false, array($forum_data['forum_name'])); break; case 'POSTS_': - add_log('admin', 'LOG_FORUM_DEL_POSTS', $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS', false, array($forum_data['forum_name'])); break; default: - add_log('admin', 'LOG_FORUM_DEL_FORUM', $forum_data['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUM', false, array($forum_data['forum_name'])); break; } @@ -1767,7 +1795,7 @@ class acp_forums */ function delete_forum_content($forum_id) { - global $db, $config, $phpbb_root_path, $phpEx; + global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -1788,7 +1816,10 @@ class acp_forums } $db->sql_freeresult($result); - delete_attachments('topic', $topic_ids, false); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('topic', $topic_ids, false); + unset($attachment_manager); // Delete shadow topics pointing to topics in this forum delete_topic_shadows($forum_id); @@ -1808,7 +1839,7 @@ class acp_forums } $db->sql_freeresult($result); - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql4': case 'mysqli': @@ -1899,6 +1930,24 @@ class acp_forums $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE); + /** + * Perform additional actions before forum content deletion + * + * @event core.delete_forum_content_before_query + * @var array table_ary Array of tables from which all rows will be deleted that hold the forum_id + * @var int forum_id the forum id + * @var array topic_ids Array of the topic ids from the forum to be deleted + * @var array post_counts Array of counts of posts in the forum, by poster_id + * @since 3.1.6-RC1 + */ + $vars = array( + 'table_ary', + 'forum_id', + 'topic_ids', + 'post_counts', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_forum_content_before_query', compact($vars))); + foreach ($table_ary as $table) { $db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id"); @@ -1941,7 +1990,7 @@ class acp_forums $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_posts', (int) $row['stat'], true); + $config->set('num_posts', (int) $row['stat'], false); $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' @@ -1950,7 +1999,7 @@ class acp_forums $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_topics', (int) $row['stat'], true); + $config->set('num_topics', (int) $row['stat'], false); $sql = 'SELECT COUNT(attach_id) as stat FROM ' . ATTACHMENTS_TABLE; @@ -1958,7 +2007,7 @@ class acp_forums $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_files', (int) $row['stat'], true); + $config->set('num_files', (int) $row['stat'], false); $sql = 'SELECT SUM(filesize) as stat FROM ' . ATTACHMENTS_TABLE; @@ -1966,7 +2015,7 @@ class acp_forums $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('upload_dir_size', (float) $row['stat'], true); + $config->set('upload_dir_size', (float) $row['stat'], false); return array(); } diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 7ecedcf51e..1f965b334c 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_groups { var $u_action; @@ -25,8 +26,8 @@ class acp_groups function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; - global $request, $phpbb_container; + global $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $request, $phpbb_container, $phpbb_dispatcher; $user->add_lang('acp/groups'); $this->tpl_name = 'acp_groups'; @@ -41,18 +42,23 @@ class acp_groups return; } - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('group_user_attributes')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } // Check and set some common vars - $action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : request_var('action', '')); - $group_id = request_var('g', 0); - $mark_ary = request_var('mark', array(0)); - $name_ary = request_var('usernames', '', true); - $leader = request_var('leader', 0); - $default = request_var('default', 0); - $start = request_var('start', 0); + $action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', '')); + $group_id = $request->variable('g', 0); + $mark_ary = $request->variable('mark', array(0)); + $name_ary = $request->variable('usernames', '', true); + $leader = $request->variable('leader', 0); + $default = $request->variable('default', 0); + $start = $request->variable('start', 0); $update = (isset($_POST['update'])) ? true : false; + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); // Clear some vars $group_row = array(); @@ -98,7 +104,7 @@ class acp_groups } // Approve, demote or promote - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = $group_helper->get_name($group_row['group_name']); $error = group_user_attributes($action, $group_id, $mark_ary, false, $group_name); if (!$error) @@ -139,8 +145,8 @@ class acp_groups if (confirm_box(true)) { - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; - group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); + $group_name = $group_helper->get_name($group_row['group_name']); + group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); } else @@ -158,7 +164,7 @@ class acp_groups case 'set_default_on_all': if (confirm_box(true)) { - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = $group_helper->get_name($group_row['group_name']); $start = 0; @@ -236,7 +242,7 @@ class acp_groups break; case 'deleteusers': - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = $group_helper->get_name($group_row['group_name']); $error = group_user_del($group_id, $mark_ary, false, $group_name); break; } @@ -280,7 +286,7 @@ class acp_groups } $name_ary = array_unique(explode("\n", $name_ary)); - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = $group_helper->get_name($group_row['group_name']); // Add user/s to group if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, $leader, 0, $group_row)) @@ -295,9 +301,10 @@ class acp_groups case 'edit': case 'add': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - - $data = $submit_ary = array(); + if (!function_exists('display_forums')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } if ($action == 'edit' && !$group_id) { @@ -320,6 +327,7 @@ class acp_groups if ($config['allow_avatar']) { + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); @@ -331,6 +339,27 @@ class acp_groups } } + if ($request->is_set_post('avatar_delete')) + { + if (confirm_box(true)) + { + $avatar_data['id'] = substr($avatar_data['id'], 1); + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, GROUPS_TABLE, 'group_'); + + $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; + trigger_error($user->lang[$message] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode, + 'g' => $group_id, + 'action' => $action)) + ); + } + } // Did we submit? if ($update) @@ -340,24 +369,24 @@ class acp_groups trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } - $group_name = utf8_normalize_nfc(request_var('group_name', '', true)); - $group_desc = utf8_normalize_nfc(request_var('group_desc', '', true)); - $group_type = request_var('group_type', GROUP_FREE); + $group_name = $request->variable('group_name', '', true); + $group_desc = $request->variable('group_desc', '', true); + $group_type = $request->variable('group_type', GROUP_FREE); - $allow_desc_bbcode = request_var('desc_parse_bbcode', false); - $allow_desc_urls = request_var('desc_parse_urls', false); - $allow_desc_smilies = request_var('desc_parse_smilies', false); + $allow_desc_bbcode = $request->variable('desc_parse_bbcode', false); + $allow_desc_urls = $request->variable('desc_parse_urls', false); + $allow_desc_smilies = $request->variable('desc_parse_smilies', false); $submit_ary = array( - 'colour' => request_var('group_colour', ''), - 'rank' => request_var('group_rank', 0), + 'colour' => $request->variable('group_colour', ''), + 'rank' => $request->variable('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'legend' => isset($_REQUEST['group_legend']) ? 1 : 0, 'teampage' => isset($_REQUEST['group_teampage']) ? 1 : 0, - 'message_limit' => request_var('group_message_limit', 0), - 'max_recipients' => request_var('group_max_recipients', 0), + 'message_limit' => $request->variable('group_message_limit', 0), + 'max_recipients' => $request->variable('group_max_recipients', 0), 'founder_manage' => 0, - 'skip_auth' => request_var('group_skip_auth', 0), + 'skip_auth' => $request->variable('group_skip_auth', 0), ); if ($user->data['user_type'] == USER_FOUNDER) @@ -411,6 +440,42 @@ class acp_groups 'colour' => array('hex_colour', true), ); + /** + * Request group data and operate on it + * + * @event core.acp_manage_group_request_data + * @var string action Type of the action: add|edit + * @var int group_id The group id + * @var array group_row Array with new group data + * @var array error Array of errors, if you add errors + * ensure to update the template variables + * S_ERROR and ERROR_MSG to display it + * @var string group_name The group name + * @var string group_desc The group description + * @var int group_type The group type + * @var bool allow_desc_bbcode Allow bbcode in group description: true|false + * @var bool allow_desc_urls Allow urls in group description: true|false + * @var bool allow_desc_smilies Allow smiles in group description: true|false + * @var array submit_ary Array with new group data + * @var array validation_checks Array with validation data + * @since 3.1.0-b5 + */ + $vars = array( + 'action', + 'group_id', + 'group_row', + 'error', + 'group_name', + 'group_desc', + 'group_type', + 'allow_desc_bbcode', + 'allow_desc_urls', + 'allow_desc_smilies', + 'submit_ary', + 'validation_checks', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_group_request_data', compact($vars))); + if ($validation_error = validate_data($submit_ary, $validation_checks)) { // Replace "error" string with its real, localised form @@ -443,6 +508,42 @@ class acp_groups 'skip_auth' => 'int', ); + /** + * Initialise data before we display the add/edit form + * + * @event core.acp_manage_group_initialise_data + * @var string action Type of the action: add|edit + * @var int group_id The group id + * @var array group_row Array with new group data + * @var array error Array of errors, if you add errors + * ensure to update the template variables + * S_ERROR and ERROR_MSG to display it + * @var string group_name The group name + * @var string group_desc The group description + * @var int group_type The group type + * @var bool allow_desc_bbcode Allow bbcode in group description: true|false + * @var bool allow_desc_urls Allow urls in group description: true|false + * @var bool allow_desc_smilies Allow smiles in group description: true|false + * @var array submit_ary Array with new group data + * @var array test_variables Array with variables for test + * @since 3.1.0-b5 + */ + $vars = array( + 'action', + 'group_id', + 'group_row', + 'error', + 'group_name', + 'group_desc', + 'group_type', + 'allow_desc_bbcode', + 'allow_desc_urls', + 'allow_desc_smilies', + 'submit_ary', + 'test_variables', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_group_initialise_data', compact($vars))); + foreach ($test_variables as $test => $type) { if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0 || in_array($test, $set_attributes))) @@ -454,7 +555,7 @@ class acp_groups if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) { - $group_perm_from = request_var('group_perm_from', 0); + $group_perm_from = $request->variable('group_perm_from', 0); // Copy permissions? // If the user has the a_authgroups permission and at least one additional permission ability set the permissions are fully transferred. @@ -524,7 +625,7 @@ class acp_groups } else if (!$group_id) { - $group_name = utf8_normalize_nfc(request_var('group_name', '', true)); + $group_name = $request->variable('group_name', '', true); $group_desc_data = array( 'text' => '', 'allow_bbcode' => true, @@ -573,9 +674,8 @@ class acp_groups $driver = $phpbb_avatar_manager->get_driver($current_driver); $avatars_enabled = true; - $config_name = $phpbb_avatar_manager->get_driver_config_name($driver); $template->set_filenames(array( - 'avatar' => "acp_avatar_options_{$config_name}.html", + 'avatar' => $driver->get_acp_template_name(), )); if ($driver->prepare_form($request, $template, $user, $avatar_data, $avatar_error)) @@ -602,12 +702,12 @@ class acp_groups $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error)); } - $back_link = request_var('back_link', ''); + $back_link = $request->variable('back_link', ''); switch ($back_link) { case 'acp_users_groups': - $u_back = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=groups&u=' . request_var('u', 0)); + $u_back = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=groups&u=' . $request->variable('u', 0)); break; default: @@ -626,7 +726,7 @@ class acp_groups 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', - 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name, + 'GROUP_NAME' => $group_helper->get_name($group_name), 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_DESC' => $group_desc_data['text'], 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', @@ -665,6 +765,39 @@ class acp_groups 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), )); + /** + * Modify group template data before we display the form + * + * @event core.acp_manage_group_display_form + * @var string action Type of the action: add|edit + * @var bool update Do we display the form only + * or did the user press submit + * @var int group_id The group id + * @var array group_row Array with new group data + * @var string group_name The group name + * @var int group_type The group type + * @var array group_desc_data The group description data + * @var string group_rank The group rank + * @var string rank_options The rank options + * @var array error Array of errors, if you add errors + * ensure to update the template variables + * S_ERROR and ERROR_MSG to display it + * @since 3.1.0-b5 + */ + $vars = array( + 'action', + 'update', + 'group_id', + 'group_row', + 'group_desc_data', + 'group_name', + 'group_type', + 'group_rank', + 'rank_options', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_group_display_form', compact($vars))); + return; break; @@ -675,8 +808,9 @@ class acp_groups trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } - $this->page_title = 'GROUP_MEMBERS'; + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); + $this->page_title = 'GROUP_MEMBERS'; // Grab the leaders - always, on every page... $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending @@ -727,7 +861,7 @@ class acp_groups 'S_GROUP_SPECIAL' => ($group_row['group_type'] == GROUP_SPECIAL) ? true : false, 'S_ACTION_OPTIONS' => $s_action_options, - 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], + 'GROUP_NAME' => $group_helper->get_name($group_row['group_name']), 'U_ACTION' => $this->u_action . "&g=$group_id", 'U_BACK' => $this->u_action, @@ -856,6 +990,9 @@ class acp_groups $teampage_id = $request->variable('t', 0); $category_id = $request->variable('c', 0); + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + if ($field && !in_array($field, array('legend', 'teampage'))) { // Invalid mode @@ -863,7 +1000,7 @@ class acp_groups } else if ($field && in_array($field, array('legend', 'teampage'))) { - + /* @var $group_position \phpbb\groupposition\groupposition_interface */ $group_position = $phpbb_container->get('groupposition.' . $field); } @@ -955,10 +1092,9 @@ class acp_groups ORDER BY group_legend ASC, group_type DESC, group_name ASC'; $result = $db->sql_query($sql); - $s_group_select_legend = ''; while ($row = $db->sql_fetchrow($result)) { - $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $group_name = $group_helper->get_name($row['group_name']); if ($row['group_legend']) { $template->assign_block_vars('legend', array( @@ -993,7 +1129,6 @@ class acp_groups ORDER BY t.teampage_position ASC'; $result = $db->sql_query($sql); - $category_data = array(); while ($row = $db->sql_fetchrow($result)) { if ($row['teampage_id'] == $category_id) @@ -1006,7 +1141,7 @@ class acp_groups if ($row['group_id']) { - $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $group_name = $group_helper->get_name($row['group_name']); $group_type = $user->lang[\phpbb\groupposition\teampage::group_type_language($row['group_type'])]; } else @@ -1036,10 +1171,9 @@ class acp_groups ORDER BY g.group_type DESC, g.group_name ASC'; $result = $db->sql_query($sql); - $s_group_select_teampage = ''; while ($row = $db->sql_fetchrow($result)) { - $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $group_name = $group_helper->get_name($row['group_name']); $template->assign_block_vars('add_teampage', array( 'GROUP_ID' => (int) $row['group_id'], 'GROUP_NAME' => $group_name, diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 20b1f56182..0293dca9d3 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * @todo [smilies] check regular expressions for special char replacements (stored specialchared in db) -* @package acp */ class acp_icons { @@ -25,18 +28,18 @@ class acp_icons function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $template, $cache; + global $config, $phpbb_root_path; global $request, $phpbb_container; $user->add_lang('acp/posting'); // Set up general vars - $action = request_var('action', ''); + $action = $request->variable('action', ''); $action = (isset($_POST['add'])) ? 'add' : $action; $action = (isset($_POST['edit'])) ? 'edit' : $action; $action = (isset($_POST['import'])) ? 'import' : $action; - $icon_id = request_var('id', 0); + $icon_id = $request->variable('id', 0); $mode = ($mode == 'smilies') ? 'smilies' : 'icons'; @@ -191,7 +194,6 @@ class acp_icons $data = array(); $after = false; - $display = 0; $order_lists = array('', ''); $add_order_lists = array('', ''); $display_count = 0; @@ -203,11 +205,9 @@ class acp_icons unset($_images[$row[$fields . '_url']]); } - if ($row[$fields . '_id'] == $icon_id) { $after = true; - $display = $row['display_on_posting']; $data[$row[$fields . '_url']] = $row; } else @@ -246,7 +246,7 @@ class acp_icons $data = $_images; } - $colspan = (($mode == 'smilies') ? 7 : 5); + $colspan = (($mode == 'smilies') ? 7 : 6); $colspan += ($icon_id) ? 1 : 0; $colspan += ($action == 'add') ? 2 : 0; @@ -290,6 +290,8 @@ class acp_icons 'ID' => (isset($img_row[$fields . '_id'])) ? $img_row[$fields . '_id'] : 0, 'WIDTH' => (!empty($img_row[$fields .'_width'])) ? $img_row[$fields .'_width'] : $img_row['width'], 'HEIGHT' => (!empty($img_row[$fields .'_height'])) ? $img_row[$fields .'_height'] : $img_row['height'], + 'TEXT_ALT' => ($mode == 'icons' && !empty($img_row['icons_alt'])) ? $img_row['icons_alt'] : $img, + 'ALT' => ($mode == 'icons' && !empty($img_row['icons_alt'])) ? $img_row['icons_alt'] : '', 'POSTING_CHECKED' => (!empty($img_row['display_on_posting']) || $action == 'add') ? ' checked="checked"' : '', )); } @@ -324,24 +326,25 @@ class acp_icons case 'modify': // Get items to create/modify - $images = (isset($_POST['image'])) ? array_keys(request_var('image', array('' => 0))) : array(); + $images = (isset($_POST['image'])) ? array_keys($request->variable('image', array('' => 0))) : array(); // Now really get the items - $image_id = (isset($_POST['id'])) ? request_var('id', array('' => 0)) : array(); - $image_order = (isset($_POST['order'])) ? request_var('order', array('' => 0)) : array(); - $image_width = (isset($_POST['width'])) ? request_var('width', array('' => 0)) : array(); - $image_height = (isset($_POST['height'])) ? request_var('height', array('' => 0)) : array(); - $image_add = (isset($_POST['add_img'])) ? request_var('add_img', array('' => 0)) : array(); - $image_emotion = utf8_normalize_nfc(request_var('emotion', array('' => ''), true)); - $image_code = utf8_normalize_nfc(request_var('code', array('' => ''), true)); - $image_display_on_posting = (isset($_POST['display_on_posting'])) ? request_var('display_on_posting', array('' => 0)) : array(); + $image_id = (isset($_POST['id'])) ? $request->variable('id', array('' => 0)) : array(); + $image_order = (isset($_POST['order'])) ? $request->variable('order', array('' => 0)) : array(); + $image_width = (isset($_POST['width'])) ? $request->variable('width', array('' => 0)) : array(); + $image_height = (isset($_POST['height'])) ? $request->variable('height', array('' => 0)) : array(); + $image_add = (isset($_POST['add_img'])) ? $request->variable('add_img', array('' => 0)) : array(); + $image_emotion = $request->variable('emotion', array('' => ''), true); + $image_code = $request->variable('code', array('' => ''), true); + $image_alt = ($request->is_set_post('alt')) ? $request->variable('alt', array('' => ''), true) : array(); + $image_display_on_posting = (isset($_POST['display_on_posting'])) ? $request->variable('display_on_posting', array('' => 0)) : array(); // Ok, add the relevant bits if we are adding new codes to existing emoticons... if ($request->variable('add_additional_code', false, false, \phpbb\request\request_interface::POST)) { - $add_image = request_var('add_image', ''); - $add_code = utf8_normalize_nfc(request_var('add_code', '', true)); - $add_emotion = utf8_normalize_nfc(request_var('add_emotion', '', true)); + $add_image = $request->variable('add_image', ''); + $add_code = $request->variable('add_code', '', true); + $add_emotion = $request->variable('add_emotion', '', true); if ($add_image && $add_emotion && $add_code) { @@ -350,15 +353,15 @@ class acp_icons $image_code[$add_image] = $add_code; $image_emotion[$add_image] = $add_emotion; - $image_width[$add_image] = request_var('add_width', 0); - $image_height[$add_image] = request_var('add_height', 0); + $image_width[$add_image] = $request->variable('add_width', 0); + $image_height[$add_image] = $request->variable('add_height', 0); if ($request->variable('add_display_on_posting', false, false, \phpbb\request\request_interface::POST)) { $image_display_on_posting[$add_image] = 1; } - $image_order[$add_image] = request_var('add_order', 0); + $image_order[$add_image] = $request->variable('add_order', 0); } } @@ -436,6 +439,13 @@ class acp_icons ); } + if ($mode == 'icons') + { + $img_sql = array_merge($img_sql, array( + 'icons_alt' => $image_alt[$image]) + ); + } + // Image_order holds the 'new' order value if (!empty($image_order[$image])) { @@ -484,6 +494,7 @@ class acp_icons $cache->destroy('_icons'); $cache->destroy('sql', $table); + $phpbb_container->get('text_formatter.cache')->invalidate(); $level = ($icons_updated) ? E_USER_NOTICE : E_USER_WARNING; $errormsgs = ''; @@ -504,8 +515,8 @@ class acp_icons case 'import': - $pak = request_var('pak', ''); - $current = request_var('current', ''); + $pak = $request->variable('pak', ''); + $current = $request->variable('current', ''); if ($pak != '') { @@ -536,10 +547,10 @@ class acp_icons // The user has already selected a smilies_pak file if ($current == 'delete') { - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': - case 'firebird': + case 'sqlite3': $db->sql_query('DELETE FROM ' . $table); break; @@ -659,6 +670,7 @@ class acp_icons $cache->destroy('_icons'); $cache->destroy('sql', $table); + $phpbb_container->get('text_formatter.cache')->invalidate(); trigger_error($user->lang[$lang . '_IMPORT_SUCCESS'] . adm_back_link($this->u_action)); } @@ -735,7 +747,7 @@ class acp_icons { garbage_collection(); - header('Pragma: public'); + header('Cache-Control: public'); // Send out the Headers header('Content-Type: text/x-delimtext; name="' . $mode . '.pak"'); @@ -781,7 +793,8 @@ class acp_icons $cache->destroy('_icons'); $cache->destroy('sql', $table); - + $phpbb_container->get('text_formatter.cache')->invalidate(); + if ($request->is_ajax()) { $json_response = new \phpbb\json_response; @@ -846,6 +859,7 @@ class acp_icons $cache->destroy('_icons'); $cache->destroy('sql', $table); + $phpbb_container->get('text_formatter.cache')->invalidate(); if ($request->is_ajax()) { @@ -901,9 +915,10 @@ class acp_icons ) ); - $spacer = false; + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); - $pagination_start = request_var('start', 0); + $pagination_start = $request->variable('start', 0); + $spacer = false; $item_count = $this->item_count($table); @@ -914,7 +929,7 @@ class acp_icons while ($row = $db->sql_fetchrow($result)) { - $alt_text = ($mode == 'smilies') ? $row['code'] : ''; + $alt_text = ($mode == 'smilies') ? $row['code'] : (($mode == 'icons' && !empty($row['icons_alt'])) ? $row['icons_alt'] : $row['icons_url']); $template->assign_block_vars('items', array( 'S_SPACER' => (!$spacer && !$row['display_on_posting']) ? true : false, diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index 140815f06a..7ec43f45cc 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_inactive { var $u_action; @@ -30,31 +31,36 @@ class acp_inactive function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_container; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; + global $config, $db, $user, $auth, $template, $phpbb_container, $phpbb_log, $request; + global $phpbb_root_path, $phpbb_admin_path, $phpEx; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_active_flip')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $user->add_lang('memberlist'); - $action = request_var('action', ''); - $mark = (isset($_REQUEST['mark'])) ? request_var('mark', array(0)) : array(); - $start = request_var('start', 0); + $action = $request->variable('action', ''); + $mark = (isset($_REQUEST['mark'])) ? $request->variable('mark', array(0)) : array(); + $start = $request->variable('start', 0); $submit = isset($_POST['submit']); // Sort keys - $sort_days = request_var('st', 0); - $sort_key = request_var('sk', 'i'); - $sort_dir = request_var('sd', 'd'); + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 'i'); + $sort_dir = $request->variable('sd', 'd'); $form_key = 'acp_inactive'; add_form_key($form_key); + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); // We build the sort key and per page settings here, because they may be needed later // Number of entries to display - $per_page = request_var('users_per_page', (int) $config['topics_per_page']); + $per_page = $request->variable('users_per_page', (int) $config['topics_per_page']); // Sorting $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); @@ -108,7 +114,10 @@ class acp_inactive if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users)) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } $messenger = new messenger(false); @@ -134,8 +143,10 @@ class acp_inactive { foreach ($inactive_users as $row) { - add_log('admin', 'LOG_USER_ACTIVE', $row['username']); - add_log('user', $row['user_id'], 'LOG_USER_ACTIVE_USER'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE', false, array($row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE_USER', false, array( + 'reportee_id' => $row['user_id'] + )); } trigger_error(sprintf($user->lang['LOG_INACTIVE_ACTIVATE'], implode($user->lang['COMMA_SEPARATOR'], $user_affected) . ' ' . adm_back_link($this->u_action))); @@ -158,7 +169,7 @@ class acp_inactive user_delete('retain', $mark, true); - add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INACTIVE_' . strtoupper($action), false, array(implode(', ', $user_affected))); trigger_error(sprintf($user->lang['LOG_INACTIVE_DELETE'], implode($user->lang['COMMA_SEPARATOR'], $user_affected) . ' ' . adm_back_link($this->u_action))); } @@ -195,7 +206,10 @@ class acp_inactive if ($row = $db->sql_fetchrow($result)) { // Send the messages - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } $messenger = new messenger(); $usernames = $user_ids = array(); @@ -230,7 +244,7 @@ class acp_inactive WHERE ' . $db->sql_in_set('user_id', $user_ids); $db->sql_query($sql); - add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INACTIVE_REMIND', false, array(implode(', ', $usernames))); trigger_error(sprintf($user->lang['LOG_INACTIVE_REMIND'], implode($user->lang['COMMA_SEPARATOR'], $usernames) . ' ' . adm_back_link($this->u_action))); } @@ -270,9 +284,10 @@ class acp_inactive 'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])), - 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview')), + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&redirect=acp_inactive')), 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_EMAIL' => $row['user_email'], 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}"), 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&sr=posts") : '', diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index 96371075d6..5dec6bb7d4 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -1,10 +1,17 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** * @todo Check/enter/update transport info */ @@ -16,23 +23,22 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_jabber { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $template, $phpbb_log, $request; + global $config, $phpbb_root_path, $phpEx; $user->add_lang('acp/board'); - include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + if (!class_exists('jabber')) + { + include($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + } - $action = request_var('action', ''); $submit = (isset($_POST['submit'])) ? true : false; if ($mode != 'settings') @@ -43,13 +49,13 @@ class acp_jabber $this->tpl_name = 'acp_jabber'; $this->page_title = 'ACP_JABBER_SETTINGS'; - $jab_enable = request_var('jab_enable', (bool) $config['jab_enable']); - $jab_host = request_var('jab_host', (string) $config['jab_host']); - $jab_port = request_var('jab_port', (int) $config['jab_port']); - $jab_username = request_var('jab_username', (string) $config['jab_username']); - $jab_password = request_var('jab_password', (string) $config['jab_password']); - $jab_package_size = request_var('jab_package_size', (int) $config['jab_package_size']); - $jab_use_ssl = request_var('jab_use_ssl', (bool) $config['jab_use_ssl']); + $jab_enable = $request->variable('jab_enable', (bool) $config['jab_enable']); + $jab_host = $request->variable('jab_host', (string) $config['jab_host']); + $jab_port = $request->variable('jab_port', (int) $config['jab_port']); + $jab_username = $request->variable('jab_username', (string) $config['jab_username']); + $jab_password = $request->variable('jab_password', (string) $config['jab_password']); + $jab_package_size = $request->variable('jab_package_size', (int) $config['jab_package_size']); + $jab_use_ssl = $request->variable('jab_use_ssl', (bool) $config['jab_use_ssl']); $form_name = 'acp_jabber'; add_form_key($form_name); @@ -61,8 +67,6 @@ class acp_jabber trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } - $error = array(); - $message = $user->lang['JAB_SETTINGS_CHANGED']; $log = 'JAB_SETTINGS_CHANGED'; @@ -99,15 +103,18 @@ class acp_jabber $db->sql_query($sql); } - set_config('jab_enable', $jab_enable); - set_config('jab_host', $jab_host); - set_config('jab_port', $jab_port); - set_config('jab_username', $jab_username); - set_config('jab_password', $jab_password); - set_config('jab_package_size', $jab_package_size); - set_config('jab_use_ssl', $jab_use_ssl); + $config->set('jab_enable', $jab_enable); + $config->set('jab_host', $jab_host); + $config->set('jab_port', $jab_port); + $config->set('jab_username', $jab_username); + if ($jab_password !== '********') + { + $config->set('jab_password', $jab_password); + } + $config->set('jab_package_size', $jab_package_size); + $config->set('jab_use_ssl', $jab_use_ssl); - add_log('admin', 'LOG_' . $log); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . $log); trigger_error($message . adm_back_link($this->u_action)); } @@ -118,7 +125,7 @@ class acp_jabber 'JAB_HOST' => $jab_host, 'JAB_PORT' => ($jab_port) ? $jab_port : '', 'JAB_USERNAME' => $jab_username, - 'JAB_PASSWORD' => $jab_password, + 'JAB_PASSWORD' => $jab_password !== '' ? '********' : '', 'JAB_PACKAGE_SIZE' => $jab_package_size, 'JAB_USE_SSL' => $jab_use_ssl, 'S_CAN_USE_SSL' => jabber::can_use_ssl(), diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 013aab670f..03172e475a 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_language { var $u_action; @@ -30,151 +31,39 @@ class acp_language function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; - global $safe_mode, $file_uploads; - global $request; + global $config, $db, $user, $template, $phpbb_log, $phpbb_container; + global $phpbb_root_path, $phpEx, $request; - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); - - $this->default_variables(); + if (!function_exists('validate_language_iso_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } // Check and set some common vars - $action = (isset($_POST['update_details'])) ? 'update_details' : ''; - $action = (isset($_POST['download_file'])) ? 'download_file' : $action; - $action = (isset($_POST['upload_file'])) ? 'upload_file' : $action; - $action = (isset($_POST['upload_data'])) ? 'upload_data' : $action; - $action = (isset($_POST['submit_file'])) ? 'submit_file' : $action; $action = (isset($_POST['remove_store'])) ? 'details' : $action; $submit = (empty($action) && !isset($_POST['update']) && !isset($_POST['test_connection'])) ? false : true; - $action = (empty($action)) ? request_var('action', '') : $action; + $action = (empty($action)) ? $request->variable('action', '') : $action; $form_name = 'acp_lang'; add_form_key('acp_lang'); - $lang_id = request_var('id', 0); - if (isset($_POST['missing_file'])) - { - $missing_file = request_var('missing_file', array('' => 0)); - $request->overwrite('language_file', array_shift(array_keys($missing_file))); - } + $lang_id = $request->variable('id', 0); - $selected_lang_file = request_var('language_file', '|common.' . $phpEx); + $selected_lang_file = $request->variable('language_file', '|common.' . $phpEx); list($this->language_directory, $this->language_file) = explode('|', $selected_lang_file); $this->language_directory = basename($this->language_directory); $this->language_file = basename($this->language_file); - // detect language file type - if ($this->language_directory == 'email') - { - $language_file_type = 'email'; - $request_default = ''; - } - else if (strpos($this->language_file, 'help_') === 0) - { - $language_file_type = 'help'; - $request_default = array(0 => array(0 => '')); - } - else - { - $language_file_type = 'normal'; - $request_default = array('' => ''); - } - $user->add_lang('acp/language'); $this->tpl_name = 'acp_language'; $this->page_title = 'ACP_LANGUAGE_PACKS'; - if ($submit && $action == 'upload_data' && request_var('test_connection', '')) - { - $test_connection = false; - $action = 'upload_file'; - $method = request_var('method', ''); - - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); - - switch ($method) - { - case 'ftp': - $transfer = new ftp( - request_var('host', ''), - request_var('username', ''), - htmlspecialchars_decode($request->untrimmed_variable('password', '')), - request_var('root_path', ''), - request_var('port', ''), - request_var('timeout', '') - ); - break; - - case 'ftp_fsock': - $transfer = new ftp_fsock( - request_var('host', ''), - request_var('username', ''), - htmlspecialchars_decode($request->untrimmed_variable('password', '')), - request_var('root_path', ''), - request_var('port', ''), - request_var('timeout', '') - ); - break; - - default: - trigger_error($user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); - break; - } - - $test_connection = $transfer->open_session(); - $transfer->close_session(); - } - switch ($action) { - case 'upload_file': - - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); - - $method = request_var('method', ''); - - if (!class_exists($method)) - { - trigger_error('Method does not exist.', E_USER_ERROR); - } - - $requested_data = call_user_func(array($method, 'data')); - foreach ($requested_data as $data => $default) - { - $template->assign_block_vars('data', array( - 'DATA' => $data, - 'NAME' => $user->lang[strtoupper($method . '_' . $data)], - 'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], - 'DEFAULT' => $request->variable($data, (string) $default), - )); - } - - $hidden_data = build_hidden_fields(array( - 'file' => $this->language_file, - 'dir' => $this->language_directory, - 'language_file' => $selected_lang_file, - 'method' => $method) - ); - - $hidden_data .= build_hidden_fields(array('entry' => $request->variable('entry', $request_default, true, \phpbb\request\request_interface::POST))); - - $template->assign_vars(array( - 'S_UPLOAD' => true, - 'NAME' => $method, - 'U_ACTION' => $this->u_action . "&id=$lang_id&action=upload_data", - 'U_BACK' => $this->u_action . "&id=$lang_id&action=details&language_file=" . urlencode($selected_lang_file), - 'HIDDEN' => $hidden_data, - - 'S_CONNECTION_SUCCESS' => (request_var('test_connection', '') && $test_connection === true) ? true : false, - 'S_CONNECTION_FAILED' => (request_var('test_connection', '') && $test_connection !== true) ? true : false - )); - break; - case 'update_details': if (!$submit || !check_form_key($form_name)) @@ -195,273 +84,20 @@ class acp_language $db->sql_freeresult($result); $sql_ary = array( - 'lang_english_name' => request_var('lang_english_name', $row['lang_english_name']), - 'lang_local_name' => utf8_normalize_nfc(request_var('lang_local_name', $row['lang_local_name'], true)), - 'lang_author' => utf8_normalize_nfc(request_var('lang_author', $row['lang_author'], true)), + 'lang_english_name' => $request->variable('lang_english_name', $row['lang_english_name']), + 'lang_local_name' => $request->variable('lang_local_name', $row['lang_local_name'], true), + 'lang_author' => $request->variable('lang_author', $row['lang_author'], true), ); $db->sql_query('UPDATE ' . LANG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE lang_id = ' . $lang_id); - add_log('admin', 'LOG_LANGUAGE_PACK_UPDATED', $sql_ary['lang_english_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_LANGUAGE_PACK_UPDATED', false, array($sql_ary['lang_english_name'])); trigger_error($user->lang['LANGUAGE_DETAILS_UPDATED'] . adm_back_link($this->u_action)); break; - case 'submit_file': - case 'download_file': - case 'upload_data': - - if (!$submit || !check_form_key($form_name)) - { - trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); - } - - $entry_value = $request->variable('entry', $request_default, true, \phpbb\request\request_interface::POST); - - if (!$lang_id || !$entry_value) - { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - if (!$this->language_file || (!$this->language_directory && !in_array($this->language_file, $this->main_files))) - { - trigger_error($user->lang['NO_FILE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - $sql = 'SELECT * - FROM ' . LANG_TABLE . " - WHERE lang_id = $lang_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - // Before we attempt to write anything let's check if the admin really chose a correct filename - switch ($this->language_directory) - { - case 'email': - // Get email templates - $email_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt'); - $email_files = $email_files['email/']; - - if (!in_array($this->language_file, $email_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - break; - - case 'acp': - // Get acp files - $acp_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'acp', $phpEx); - $acp_files = $acp_files['acp/']; - - if (!in_array($this->language_file, $acp_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - break; - - case 'mods': - // Get mod files - $mods_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'mods', $phpEx); - $mods_files = (isset($mods_files['mods/'])) ? $mods_files['mods/'] : array(); - - if (!in_array($this->language_file, $mods_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - break; - - default: - if (!in_array($this->language_file, $this->main_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - break; - } - - if (!$safe_mode) - { - $mkdir_ary = array('language', 'language/' . $row['lang_iso']); - - if ($this->language_directory) - { - $mkdir_ary[] = 'language/' . $row['lang_iso'] . '/' . $this->language_directory; - } - - foreach ($mkdir_ary as $dir) - { - $dir = $phpbb_root_path . 'store/' . $dir; - - if (!is_dir($dir)) - { - if (!@mkdir($dir, 0777)) - { - trigger_error("Could not create directory $dir", E_USER_ERROR); - } - @chmod($dir, 0777); - } - } - } - - // Get target filename for storage folder - $filename = $this->get_filename($row['lang_iso'], $this->language_directory, $this->language_file, true, true); - $fp = @fopen($phpbb_root_path . $filename, 'wb'); - - if (!$fp) - { - trigger_error(sprintf($user->lang['UNABLE_TO_WRITE_FILE'], $filename) . adm_back_link($this->u_action . '&id=' . $lang_id . '&action=details&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); - } - - if ($language_file_type == 'email') - { - // Email Template - $entry = $this->prepare_lang_entry(htmlspecialchars_decode($entry_value), false); - fwrite($fp, $entry); - } - else - { - $name = (($this->language_directory) ? $this->language_directory . '_' : '') . $this->language_file; - $header = str_replace(array('{FILENAME}', '{LANG_NAME}', '{CHANGED}', '{AUTHOR}'), array($name, $row['lang_english_name'], date('Y-m-d', time()), $row['lang_author']), $this->language_file_header); - - if ($language_file_type == 'help') - { - // Help File - $header .= '$help = array(' . "\n"; - fwrite($fp, $header); - - foreach ($entry_value as $key => $value) - { - if (!is_array($value)) - { - continue; - } - - $entry = "\tarray(\n"; - - foreach ($value as $_key => $_value) - { - $entry .= "\t\t" . (int) $_key . "\t=> '" . $this->prepare_lang_entry(htmlspecialchars_decode($_value)) . "',\n"; - } - - $entry .= "\t),\n"; - fwrite($fp, $entry); - } - - $footer = ");\n\n?>"; - fwrite($fp, $footer); - } - else if ($language_file_type == 'normal') - { - // Language File - $header .= $this->lang_header; - fwrite($fp, $header); - - foreach ($entry_value as $key => $value) - { - $entry = $this->format_lang_array(htmlspecialchars_decode($key), htmlspecialchars_decode($value)); - fwrite($fp, $entry); - } - - $footer = "));\n\n?>"; - fwrite($fp, $footer); - } - } - - fclose($fp); - - if ($action == 'download_file') - { - header('Pragma: no-cache'); - header('Content-Type: application/octetstream; name="' . $this->language_file . '"'); - header('Content-disposition: attachment; filename=' . $this->language_file); - - $fp = @fopen($phpbb_root_path . $filename, 'rb'); - while ($buffer = fread($fp, 1024)) - { - echo $buffer; - } - fclose($fp); - - add_log('admin', 'LOG_LANGUAGE_FILE_SUBMITTED', $this->language_file); - - exit; - } - else if ($action == 'upload_data') - { - $sql = 'SELECT lang_iso - FROM ' . LANG_TABLE . " - WHERE lang_id = $lang_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $file = request_var('file', ''); - $dir = request_var('dir', ''); - - $selected_lang_file = $dir . '|' . $file; - - $old_file = '/' . $this->get_filename($row['lang_iso'], $dir, $file, false, true); - $lang_path = 'language/' . $row['lang_iso'] . '/' . (($dir) ? $dir . '/' : ''); - - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); - $method = request_var('method', ''); - - if ($method != 'ftp' && $method != 'ftp_fsock') - { - trigger_error($user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR); - } - - $transfer = new $method( - request_var('host', ''), - request_var('username', ''), - htmlspecialchars_decode($request->untrimmed_variable('password', '')), - request_var('root_path', ''), - request_var('port', ''), - request_var('timeout', '') - ); - - if (($result = $transfer->open_session()) !== true) - { - trigger_error($user->lang[$result] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); - } - - $transfer->rename($lang_path . $file, $lang_path . $file . '.bak'); - $result = $transfer->copy_file('store/' . $lang_path . $file, $lang_path . $file); - - if ($result === false) - { - // If failed, try to rename again and print error out... - $transfer->delete_file($lang_path . $file); - $transfer->rename($lang_path . $file . '.bak', $lang_path . $file); - - trigger_error($user->lang['UPLOAD_FAILED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); - } - - $transfer->close_session(); - - // Remove from storage folder - if (file_exists($phpbb_root_path . 'store/' . $lang_path . $file)) - { - @unlink($phpbb_root_path . 'store/' . $lang_path . $file); - } - - add_log('admin', 'LOG_LANGUAGE_FILE_REPLACED', $file); - - trigger_error($user->lang['UPLOAD_COMPLETED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file))); - } - - add_log('admin', 'LOG_LANGUAGE_FILE_SUBMITTED', $this->language_file); - $action = 'details'; - - // no break; - case 'details': if (!$lang_id) @@ -478,308 +114,82 @@ class acp_language $lang_entries = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $lang_iso = $lang_entries['lang_iso']; - $missing_vars = $missing_files = array(); - - // Get email templates - $email_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'email', 'txt'); - $email_files = $email_files['email/']; - - // Get acp files - $acp_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'acp', $phpEx); - $acp_files = $acp_files['acp/']; - - // Get mod files - $mods_files = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'mods', $phpEx); - $mods_files = (isset($mods_files['mods/'])) ? $mods_files['mods/'] : array(); - - // Check if our current filename matches the files - switch ($this->language_directory) + if (!$lang_entries) { - case 'email': - if (!in_array($this->language_file, $email_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - break; - - case 'acp': - if (!in_array($this->language_file, $acp_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - break; - - case 'mods': - if (!in_array($this->language_file, $mods_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - break; - - default: - if (!in_array($this->language_file, $this->main_files)) - { - trigger_error($user->lang['WRONG_LANGUAGE_FILE'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id), E_USER_WARNING); - } - } - - if (isset($_POST['remove_store'])) - { - $store_filename = $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true); - - if (file_exists($phpbb_root_path . $store_filename)) - { - @unlink($phpbb_root_path . $store_filename); - } + trigger_error($user->lang['LANGUAGE_PACK_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } - include_once($phpbb_root_path . 'includes/functions_transfer.' . $phpEx); - - $methods = transfer::methods(); - - foreach ($methods as $method) - { - $template->assign_block_vars('buttons', array( - 'VALUE' => $method - )); - } + $lang_iso = $lang_entries['lang_iso']; $template->assign_vars(array( 'S_DETAILS' => true, 'U_ACTION' => $this->u_action . "&action=details&id=$lang_id", 'U_BACK' => $this->u_action, + 'LANG_LOCAL_NAME' => $lang_entries['lang_local_name'], 'LANG_ENGLISH_NAME' => $lang_entries['lang_english_name'], - 'LANG_ISO' => $lang_entries['lang_iso'], + 'LANG_ISO' => $lang_iso, 'LANG_AUTHOR' => $lang_entries['lang_author'], - 'ALLOW_UPLOAD' => sizeof($methods) - ) - ); + 'L_MISSING_FILES' => $user->lang('THOSE_MISSING_LANG_FILES', $lang_entries['lang_local_name']), + 'L_MISSING_VARS_EXPLAIN' => $user->lang('THOSE_MISSING_LANG_VARIABLES', $lang_entries['lang_local_name']), + )); - // If current lang is different from the default lang, then first try to grab missing/additional vars + // If current lang is different from the default lang, then highlight missing files and variables if ($lang_iso != $config['default_lang']) { - $is_missing_var = false; - - foreach ($this->main_files as $file) + try { - if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file))) - { - $missing_vars[$file] = $this->compare_language_files($config['default_lang'], $lang_iso, '', $file); - - if (sizeof($missing_vars[$file])) - { - $is_missing_var = true; - } - } - else - { - $missing_files[] = $this->get_filename($lang_iso, '', $file); - } + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $phpbb_root_path . 'language/' . $config['default_lang'] . '/', + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::LEAVES_ONLY + ); } - - // Now go through acp/mods directories - foreach ($acp_files as $file) + catch (\Exception $e) { - if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'acp', $file))) - { - $missing_vars['acp/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'acp', $file); - - if (sizeof($missing_vars['acp/' . $file])) - { - $is_missing_var = true; - } - } - else - { - $missing_files[] = $this->get_filename($lang_iso, 'acp', $file); - } + return array(); } - if (sizeof($mods_files)) + foreach ($iterator as $file_info) { - foreach ($mods_files as $file) + /** @var \RecursiveDirectoryIterator $file_info */ + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + $relative_path = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path); + + if (file_exists($phpbb_root_path . 'language/' . $lang_iso . '/' . $relative_path)) { - if (file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'mods', $file))) + if (substr($relative_path, 0 - strlen($phpEx)) === $phpEx) { - $missing_vars['mods/' . $file] = $this->compare_language_files($config['default_lang'], $lang_iso, 'mods', $file); + $missing_vars = $this->compare_language_files($config['default_lang'], $lang_iso, $relative_path); - if (sizeof($missing_vars['mods/' . $file])) + if (!empty($missing_vars)) { - $is_missing_var = true; + $template->assign_block_vars('missing_varfile', array( + 'FILE_NAME' => $relative_path, + )); + + foreach ($missing_vars as $var) + { + $template->assign_block_vars('missing_varfile.variable', array( + 'VAR_NAME' => $var, + )); + } } } - else - { - $missing_files[] = $this->get_filename($lang_iso, 'mods', $file); - } - } - } - - // More missing files... for example email templates? - foreach ($email_files as $file) - { - if (!file_exists($phpbb_root_path . $this->get_filename($lang_iso, 'email', $file))) - { - $missing_files[] = $this->get_filename($lang_iso, 'email', $file); - } - } - - if (sizeof($missing_files)) - { - $template->assign_vars(array( - 'S_MISSING_FILES' => true, - 'L_MISSING_FILES' => sprintf($user->lang['THOSE_MISSING_LANG_FILES'], $lang_entries['lang_local_name']), - 'MISSING_FILES' => implode('<br />', $missing_files)) - ); - } - - if ($is_missing_var) - { - $template->assign_vars(array( - 'S_MISSING_VARS' => true, - 'L_MISSING_VARS_EXPLAIN' => sprintf($user->lang['THOSE_MISSING_LANG_VARIABLES'], $lang_entries['lang_local_name']), - 'U_MISSING_ACTION' => $this->u_action . "&action=$action&id=$lang_id") - ); - - foreach ($missing_vars as $file => $vars) - { - if (!sizeof($vars)) - { - continue; - } - - $template->assign_block_vars('missing', array( - 'FILE' => $file, - 'TPL' => $this->print_language_entries($vars, '', false), - 'KEY' => (strpos($file, '/') === false) ? '|' . $file : str_replace('/', '|', $file)) - ); } - } - } - - // Main language files - $s_lang_options = '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>'; - foreach ($this->main_files as $file) - { - if (strpos($file, 'help_') === 0) - { - continue; - } - - $prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : ''; - - $selected = (!$this->language_directory && $this->language_file == $file) ? ' selected="selected"' : ''; - $s_lang_options .= '<option value="|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; - } - - // Help Files - $s_lang_options .= '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang['HELP_FILES'] . '</option>'; - foreach ($this->main_files as $file) - { - if (strpos($file, 'help_') !== 0) - { - continue; - } - - $prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, '', $file, true, true))) ? '* ' : ''; - - $selected = (!$this->language_directory && $this->language_file == $file) ? ' selected="selected"' : ''; - $s_lang_options .= '<option value="|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; - } - - // Now every other language directory - $check_files = array('email', 'acp', 'mods'); - - foreach ($check_files as $check) - { - if (!sizeof(${$check . '_files'})) - { - continue; - } - - $s_lang_options .= '<option value="|common.' . $phpEx . '" class="sep">' . $user->lang[strtoupper($check) . '_FILES'] . '</option>'; - - foreach (${$check . '_files'} as $file) - { - $prefix = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, $check, $file, true, true))) ? '* ' : ''; - - $selected = ($this->language_directory == $check && $this->language_file == $file) ? ' selected="selected"' : ''; - $s_lang_options .= '<option value="' . $check . '|' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; - } - } - - // Get Language Entries - if saved within store folder, we take this one (with the option to remove it) - $lang = array(); - - $is_email_file = ($this->language_directory == 'email') ? true : false; - $is_help_file = (strpos($this->language_file, 'help_') === 0) ? true : false; - - $file_from_store = (file_exists($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, true, true))) ? true : false; - $no_store_filename = $this->get_filename($lang_iso, $this->language_directory, $this->language_file); - - if (!$file_from_store && !file_exists($phpbb_root_path . $no_store_filename)) - { - $print_message = sprintf($user->lang['MISSING_LANGUAGE_FILE'], $no_store_filename); - } - else - { - if ($is_email_file) - { - $lang = file_get_contents($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store)); - } - else - { - $help = array(); - include($phpbb_root_path . $this->get_filename($lang_iso, $this->language_directory, $this->language_file, $file_from_store)); - - if ($is_help_file) + else { - $lang = $help; - unset($help); + $template->assign_block_vars('missing_files', array( + 'FILE_NAME' => $relative_path, + )); } } - - $print_message = (($this->language_directory) ? $this->language_directory . '/' : '') . $this->language_file; - } - - // Normal language pack entries - $template->assign_vars(array( - 'U_ENTRY_ACTION' => $this->u_action . "&action=details&id=$lang_id#entries", - 'S_EMAIL_FILE' => $is_email_file, - 'S_FROM_STORE' => $file_from_store, - 'S_LANG_OPTIONS' => $s_lang_options, - 'PRINT_MESSAGE' => $print_message, - ) - ); - - if (!$is_email_file) - { - $tpl = ''; - $name = (($this->language_directory) ? $this->language_directory . '/' : '') . $this->language_file; - - if (isset($missing_vars[$name]) && sizeof($missing_vars[$name])) - { - $tpl .= $this->print_language_entries($missing_vars[$name], '* '); - } - - $tpl .= $this->print_language_entries($lang); - - $template->assign_var('TPL', $tpl); - unset($tpl); } - else - { - $template->assign_vars(array( - 'LANG' => $lang) - ); - - unset($lang); - } - return; - break; case 'delete': @@ -817,7 +227,7 @@ class acp_language $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; $db->sql_query($sql); - add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_LANGUAGE_PACK_DELETED', false, array($row['lang_english_name'])); trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action)); } @@ -829,12 +239,12 @@ class acp_language 'action' => $action, 'id' => $lang_id, ); - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + confirm_box(false, $user->lang('DELETE_LANGUAGE_CONFIRM', $row['lang_english_name']), build_hidden_fields($s_hidden_fields)); } break; case 'install': - $lang_iso = request_var('iso', ''); + $lang_iso = $request->variable('iso', ''); $lang_iso = basename($lang_iso); if (!$lang_iso || !file_exists("{$phpbb_root_path}language/$lang_iso/iso.txt")) @@ -922,134 +332,13 @@ class acp_language } $db->sql_freeresult($result); - add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_LANGUAGE_PACK_INSTALLED', false, array($lang_pack['name'])); $message = sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']); $message .= ($notify_cpf_update) ? '<br /><br />' . $user->lang['LANGUAGE_PACK_CPF_UPDATE'] : ''; trigger_error($message . adm_back_link($this->u_action)); break; - - case 'download': - - if (!$lang_id) - { - trigger_error($user->lang['NO_LANG_ID'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - $sql = 'SELECT * - FROM ' . LANG_TABLE . ' - WHERE lang_id = ' . $lang_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $use_method = request_var('use_method', ''); - $methods = array('.tar'); - - $available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib'); - foreach ($available_methods as $type => $module) - { - if (!@extension_loaded($module)) - { - continue; - } - - $methods[] = $type; - } - - // Let the user decide in which format he wants to have the pack - if (!$use_method) - { - $this->page_title = 'SELECT_DOWNLOAD_FORMAT'; - - $radio_buttons = ''; - foreach ($methods as $method) - { - $radio_buttons .= '<label><input type="radio"' . ((!$radio_buttons) ? ' id="use_method"' : '') . ' class="radio" value="' . $method . '" name="use_method" /> ' . $method . '</label>'; - } - - $template->assign_vars(array( - 'S_SELECT_METHOD' => true, - 'U_BACK' => $this->u_action, - 'U_ACTION' => $this->u_action . "&action=$action&id=$lang_id", - 'RADIO_BUTTONS' => $radio_buttons) - ); - - return; - } - - if (!in_array($use_method, $methods)) - { - $use_method = '.tar'; - } - - include_once($phpbb_root_path . 'includes/functions_compress.' . $phpEx); - - if ($use_method == '.zip') - { - $compress = new compress_zip('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method); - } - else - { - $compress = new compress_tar('w', $phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method, $use_method); - } - - // Get email templates - $email_templates = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt'); - $email_templates = $email_templates['email/']; - - // Get acp files - $acp_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'acp', $phpEx); - $acp_files = $acp_files['acp/']; - - // Get mod files - $mod_files = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'mods', $phpEx); - $mod_files = (isset($mod_files['mods/'])) ? $mod_files['mods/'] : array(); - - // Add main files - $this->add_to_archive($compress, $this->main_files, $row['lang_iso']); - - // Add search files if they exist... - if (file_exists($phpbb_root_path . 'language/' . $row['lang_iso'] . '/search_ignore_words.' . $phpEx)) - { - $this->add_to_archive($compress, array("search_ignore_words.$phpEx"), $row['lang_iso']); - } - - if (file_exists($phpbb_root_path . 'language/' . $row['lang_iso'] . '/search_synonyms.' . $phpEx)) - { - $this->add_to_archive($compress, array("search_synonyms.$phpEx"), $row['lang_iso']); - } - - // Write files in folders - $this->add_to_archive($compress, $email_templates, $row['lang_iso'], 'email'); - $this->add_to_archive($compress, $acp_files, $row['lang_iso'], 'acp'); - $this->add_to_archive($compress, $mod_files, $row['lang_iso'], 'mods'); - - // Write ISO File - $iso_src = htmlspecialchars_decode($row['lang_english_name']) . "\n"; - $iso_src .= htmlspecialchars_decode($row['lang_local_name']) . "\n"; - $iso_src .= htmlspecialchars_decode($row['lang_author']); - $compress->add_data($iso_src, 'language/' . $row['lang_iso'] . '/iso.txt'); - - // index.htm files - $compress->add_data('', 'language/' . $row['lang_iso'] . '/index.htm'); - $compress->add_data('', 'language/' . $row['lang_iso'] . '/email/index.htm'); - $compress->add_data('', 'language/' . $row['lang_iso'] . '/acp/index.htm'); - - if (sizeof($mod_files)) - { - $compress->add_data('', 'language/' . $row['lang_iso'] . '/mods/index.htm'); - } - - $compress->close(); - - $compress->download('lang_' . $row['lang_iso']); - @unlink($phpbb_root_path . 'store/lang_' . $row['lang_iso'] . $use_method); - - exit; - - break; } $sql = 'SELECT user_lang, COUNT(user_lang) AS lang_count @@ -1091,37 +380,19 @@ class acp_language $db->sql_freeresult($result); $new_ary = $iso = array(); - $dp = @opendir("{$phpbb_root_path}language"); - if ($dp) + /** @var \phpbb\language\language_file_helper $language_helper */ + $language_helper = $phpbb_container->get('language.helper.language_file'); + $iso = $language_helper->get_available_languages(); + + foreach ($iso as $lang_array) { - while (($file = readdir($dp)) !== false) - { - if ($file[0] == '.' || !is_dir($phpbb_root_path . 'language/' . $file)) - { - continue; - } + $lang_iso = $lang_array['iso']; - if (file_exists("{$phpbb_root_path}language/$file/iso.txt")) - { - if (!in_array($file, $installed)) - { - if ($iso = file("{$phpbb_root_path}language/$file/iso.txt")) - { - if (sizeof($iso) == 3) - { - $new_ary[$file] = array( - 'iso' => $file, - 'name' => trim($iso[0]), - 'local_name'=> trim($iso[1]), - 'author' => trim($iso[2]) - ); - } - } - } - } + if (!in_array($lang_iso, $installed)) + { + $new_ary[$lang_iso] = $lang_array; } - closedir($dp); } unset($installed); @@ -1142,291 +413,31 @@ class acp_language unset($new_ary); } - /** - * Set default language variables/header - */ - function default_variables() - { - global $phpEx; - - $this->language_file_header = '<?php -/** -* -* {FILENAME} [{LANG_NAME}] -* -* @package language -* @copyright (c) ' . date('Y') . ' phpBB Group -* @author {CHANGED} - {AUTHOR} -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* DO NOT CHANGE -*/ -if (!defined(\'IN_PHPBB\')) -{ - exit; -} - -if (empty($lang) || !is_array($lang)) -{ - $lang = array(); -} - -// DEVELOPERS PLEASE NOTE -// -// All language files should use UTF-8 as their encoding and the files must not contain a BOM. -// -// Placeholders can now contain order information, e.g. instead of -// \'Page %s of %s\' you can (and should) write \'Page %1$s of %2$s\', this allows -// translators to re-order the output of data while ensuring it remains correct -// -// You do not need this where single placeholders are used, e.g. \'Message %d\' is fine -// equally where a string contains only two placeholders which are used to wrap text -// in a url you again do not need to specify an order e.g., \'Click %sHERE%s\' is fine -'; - - $this->lang_header = ' -$lang = array_merge($lang, array( -'; - - // Language files in language root directory - $this->main_files = array("captcha_qa.$phpEx", "captcha_recaptcha.$phpEx", "common.$phpEx", "groups.$phpEx", "install.$phpEx", "mcp.$phpEx", "memberlist.$phpEx", "posting.$phpEx", "search.$phpEx", "ucp.$phpEx", "viewforum.$phpEx", "viewtopic.$phpEx", "help_bbcode.$phpEx", "help_faq.$phpEx"); - } - - /** - * Get filename/location of language file - */ - function get_filename($lang_iso, $directory, $filename, $check_store = false, $only_return_filename = false) - { - global $phpbb_root_path, $safe_mode; - - $check_filename = "language/$lang_iso/" . (($directory) ? $directory . '/' : '') . $filename; - - if ($check_store) - { - $check_store_filename = ($safe_mode) ? "store/langfile_{$lang_iso}" . (($directory) ? '_' . $directory : '') . "_{$filename}" : "store/language/$lang_iso/" . (($directory) ? $directory . '/' : '') . $filename; - - if (!$only_return_filename && file_exists($phpbb_root_path . $check_store_filename)) - { - return $check_store_filename; - } - else if ($only_return_filename) - { - return $check_store_filename; - } - } - - return $check_filename; - } - - /** - * Add files to archive + * Compare two language files */ - function add_to_archive(&$compress, $filelist, $lang_iso, $directory = '') + function compare_language_files($source_lang, $dest_lang, $file) { global $phpbb_root_path; - foreach ($filelist as $file) - { - // Get source filename - $source = $this->get_filename($lang_iso, $directory, $file, true); - $destination = 'language/' . $lang_iso . '/' . (($directory) ? $directory . '/' : '') . $file; - - // Add file to archive - $compress->add_custom_file($phpbb_root_path . $source, $destination); - } - } - - /** - * Little helper to add some hardcoded template bits - */ - function add_input_field() - { - $keys = func_get_args(); + $source_file = $phpbb_root_path . 'language/' . $source_lang . '/' . $file; + $dest_file = $phpbb_root_path . 'language/' . $dest_lang . '/' . $file; - $non_static = array_shift($keys); - $value = utf8_normalize_nfc(array_shift($keys)); - - if (!$non_static) + if (!file_exists($dest_file)) { - return '<strong>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</strong>'; - } - - // If more then 270 characters, then we present a textarea, else an input field - $textarea = (utf8_strlen($value) > 270) ? true : false; - $tpl = ''; - - $tpl .= ($textarea) ? '<textarea name="' : '<input type="text" name="'; - $tpl .= 'entry[' . implode('][', array_map('utf8_htmlspecialchars', $keys)) . ']"'; - - $tpl .= ($textarea) ? ' cols="80" rows="5" class="langvalue">' : ' class="langvalue" value="'; - $tpl .= htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); - $tpl .= ($textarea) ? '</textarea>' : '" />'; - - return $tpl; - } - - /** - * Print language entries - */ - function print_language_entries(&$lang_ary, $key_prefix = '', $input_field = true) - { - $tpl = ''; - - foreach ($lang_ary as $key => $value) - { - if (is_array($value)) - { - // Write key - $tpl .= ' - <tr> - <td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</strong></td> - </tr>'; - - foreach ($value as $_key => $_value) - { - if (is_array($_value)) - { - // Write key - $tpl .= ' - <tr> - <td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . ' <strong>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</strong></td> - </tr>'; - - foreach ($_value as $__key => $__value) - { - // Write key - $tpl .= ' - <tr> - <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . '</strong></td> - <td class="row2">'; - - $tpl .= $this->add_input_field($input_field, $__value, $key, $_key, $__key); - - $tpl .= '</td> - </tr>'; - } - } - else - { - // Write key - $tpl .= ' - <tr> - <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</strong></td> - <td class="row2">'; - - $tpl .= $this->add_input_field($input_field, $_value, $key, $_key); - - $tpl .= '</td> - </tr>'; - } - } - - $tpl .= ' - <tr> - <td class="spacer" colspan="2"> </td> - </tr>'; - } - else - { - // Write key - $tpl .= ' - <tr> - <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</strong></td> - <td class="row2">'; - - $tpl .= $this->add_input_field($input_field, $value, $key); - - $tpl .= '</td> - </tr>'; - } + return array(); } - return $tpl; - } - - /** - * Compare two language files - */ - function compare_language_files($source_lang, $dest_lang, $directory, $file) - { - global $phpbb_root_path, $phpEx; - - $return_ary = array(); - $lang = array(); - include("{$phpbb_root_path}language/{$source_lang}/" . (($directory) ? $directory . '/' : '') . $file); + include($source_file); $lang_entry_src = $lang; $lang = array(); - - if (!file_exists($phpbb_root_path . $this->get_filename($dest_lang, $directory, $file, true))) - { - return array(); - } - - include($phpbb_root_path . $this->get_filename($dest_lang, $directory, $file, true)); - + include($dest_file); $lang_entry_dst = $lang; unset($lang); - $diff_array_keys = array_diff(array_keys($lang_entry_src), array_keys($lang_entry_dst)); - unset($lang_entry_dst); - - foreach ($diff_array_keys as $key) - { - $return_ary[$key] = $lang_entry_src[$key]; - } - - unset($lang_entry_src); - - return $return_ary; - } - - /** - * Return language string value for storage - */ - function prepare_lang_entry($text, $store = true) - { - $text = (STRIP) ? stripslashes($text) : $text; - - // Adjust for storage... - if ($store) - { - $text = str_replace("'", "\\'", str_replace('\\', '\\\\', $text)); - } - - return $text; - } - - /** - * Format language array for storage - */ - function format_lang_array($key, $value, $tabs = "\t") - { - $entry = ''; - - if (!is_array($value)) - { - $entry .= "{$tabs}'" . $this->prepare_lang_entry($key) . "'\t=> '" . $this->prepare_lang_entry($value) . "',\n"; - } - else - { - $_tabs = $tabs . "\t"; - $entry .= "\n{$tabs}'" . $this->prepare_lang_entry($key) . "'\t=> array(\n"; - - foreach ($value as $_key => $_value) - { - $entry .= $this->format_lang_array($_key, $_value, $_tabs); - } - - $entry .= "{$tabs}),\n\n"; - } - - return $entry; + return array_diff(array_keys($lang_entry_src), array_keys($lang_entry_dst)); } } diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 10852e3a68..c33ca8c4fc 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,37 +19,35 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_logs { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $phpbb_container; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $user, $auth, $template, $phpbb_container; + global $config; global $request; $user->add_lang('mcp'); // Set up general vars - $action = request_var('action', ''); - $forum_id = request_var('f', 0); - $topic_id = request_var('t', 0); - $start = request_var('start', 0); + $action = $request->variable('action', ''); + $forum_id = $request->variable('f', 0); + $start = $request->variable('start', 0); $deletemark = $request->variable('delmarked', false, false, \phpbb\request\request_interface::POST); $deleteall = $request->variable('delall', false, false, \phpbb\request\request_interface::POST); - $marked = request_var('mark', array(0)); + $marked = $request->variable('mark', array(0)); // Sort keys - $sort_days = request_var('st', 0); - $sort_key = request_var('sk', 't'); - $sort_dir = request_var('sd', 'd'); + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); $this->tpl_name = 'acp_logs'; $this->log_type = constant('LOG_' . strtoupper($mode)); + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); // Delete entries if requested and able @@ -53,28 +55,27 @@ class acp_logs { if (confirm_box(true)) { - $where_sql = ''; + $conditions = array(); if ($deletemark && sizeof($marked)) { - $sql_in = array(); - foreach ($marked as $mark) - { - $sql_in[] = $mark; - } - $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); - unset($sql_in); + $conditions['log_id'] = array('IN' => $marked); } - if ($where_sql || $deleteall) + if ($deleteall) { - $sql = 'DELETE FROM ' . LOG_TABLE . " - WHERE log_type = {$this->log_type} - $where_sql"; - $db->sql_query($sql); + if ($sort_days) + { + $conditions['log_time'] = array('>=', time() - ($sort_days * 86400)); + } - add_log('admin', 'LOG_CLEAR_' . strtoupper($mode)); + $keywords = $request->variable('keywords', '', true); + $conditions['keywords'] = $keywords; } + + /* @var $phpbb_log \phpbb\log\log_interface */ + $phpbb_log = $phpbb_container->get('log'); + $phpbb_log->delete($mode, $conditions); } else { @@ -106,7 +107,7 @@ class acp_logs $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); + $keywords = $request->variable('keywords', '', true); $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS']; @@ -118,7 +119,7 @@ class acp_logs if ($mode == 'mod') { $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id); - + $template->assign_vars(array( 'S_SHOW_FORUMS' => true, 'S_FORUM_BOX' => $forum_box) @@ -149,7 +150,7 @@ class acp_logs foreach ($log_data as $row) { $data = array(); - + $checks = array('viewtopic', 'viewlogs', 'viewforum'); foreach ($checks as $check) { diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index f01cba0bcc..529c3a1835 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,17 +19,14 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_main { var $u_action; function main($id, $mode) { - global $config, $db, $cache, $user, $auth, $template, $request; - global $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $config, $db, $cache, $user, $auth, $template, $request, $phpbb_log; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher, $phpbb_filesystem; // Show restore permissions notice if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) @@ -40,11 +41,7 @@ class acp_main $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>'); - $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_row['user_id']) . '">' : ''; - $perm_from .= $user_row['username']; - $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '</a>' : ''; - $perm_from .= '</strong>'; + $perm_from = get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']); $template->assign_vars(array( 'S_RESTORE_PERMISSIONS' => true, @@ -56,7 +53,7 @@ class acp_main return; } - $action = request_var('action', ''); + $action = $request->variable('action', ''); if ($action) { @@ -124,9 +121,9 @@ class acp_main trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - set_config('record_online_users', 1, true); - set_config('record_online_date', time(), true); - add_log('admin', 'LOG_RESET_ONLINE'); + $config->set('record_online_users', 1, false); + $config->set('record_online_date', time(), false); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_ONLINE'); if ($request->is_ajax()) { @@ -144,35 +141,35 @@ class acp_main FROM ' . POSTS_TABLE . ' WHERE post_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); - set_config('num_posts', (int) $db->sql_fetchfield('stat'), true); + $config->set('num_posts', (int) $db->sql_fetchfield('stat'), false); $db->sql_freeresult($result); $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' WHERE topic_visibility = ' . ITEM_APPROVED; $result = $db->sql_query($sql); - set_config('num_topics', (int) $db->sql_fetchfield('stat'), true); + $config->set('num_topics', (int) $db->sql_fetchfield('stat'), false); $db->sql_freeresult($result); $sql = 'SELECT COUNT(user_id) AS stat FROM ' . USERS_TABLE . ' WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')'; $result = $db->sql_query($sql); - set_config('num_users', (int) $db->sql_fetchfield('stat'), true); + $config->set('num_users', (int) $db->sql_fetchfield('stat'), false); $db->sql_freeresult($result); $sql = 'SELECT COUNT(attach_id) as stat FROM ' . ATTACHMENTS_TABLE . ' WHERE is_orphan = 0'; $result = $db->sql_query($sql); - set_config('num_files', (int) $db->sql_fetchfield('stat'), true); + $config->set('num_files', (int) $db->sql_fetchfield('stat'), false); $db->sql_freeresult($result); $sql = 'SELECT SUM(filesize) as stat FROM ' . ATTACHMENTS_TABLE . ' WHERE is_orphan = 0'; $result = $db->sql_query($sql); - set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true); + $config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false); $db->sql_freeresult($result); if (!function_exists('update_last_username')) @@ -181,7 +178,7 @@ class acp_main } update_last_username(); - add_log('admin', 'LOG_RESYNC_STATS'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_STATS'); if ($request->is_ajax()) { @@ -218,7 +215,7 @@ class acp_main // Still no maximum post id? Then we are finished if (!$max_post_id) { - add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS'); break; } @@ -248,7 +245,7 @@ class acp_main $start += $step; } - add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS'); if ($request->is_ajax()) { @@ -262,8 +259,8 @@ class acp_main trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - set_config('board_startdate', time() - 1); - add_log('admin', 'LOG_RESET_DATE'); + $config->set('board_startdate', time() - 1); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_DATE'); if ($request->is_ajax()) { @@ -272,10 +269,10 @@ class acp_main break; case 'db_track': - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': - case 'firebird': + case 'sqlite3': $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); break; @@ -343,7 +340,7 @@ class acp_main } } - add_log('admin', 'LOG_RESYNC_POST_MARKING'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POST_MARKING'); if ($request->is_ajax()) { @@ -352,14 +349,19 @@ class acp_main break; case 'purge_cache': - global $cache; + $config->increment('assets_version', 1); $cache->purge(); + // Remove old renderers from the text_formatter service. Since this + // operation is performed after the cache is purged, there is not "current" + // renderer and in effect all renderers will be purged + $phpbb_container->get('text_formatter.cache')->tidy(); + // Clear permissions $auth->acl_clear_prefetch(); phpbb_cache_moderators($db, $cache, $auth); - add_log('admin', 'LOG_PURGE_CACHE'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_CACHE'); if ($request->is_ajax()) { @@ -377,10 +379,10 @@ class acp_main foreach ($tables as $table) { - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': - case 'firebird': + case 'sqlite3': $db->sql_query("DELETE FROM $table"); break; @@ -410,7 +412,7 @@ class acp_main $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary); $db->sql_query($sql); - add_log('admin', 'LOG_PURGE_SESSIONS'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_SESSIONS'); if ($request->is_ajax()) { @@ -424,7 +426,7 @@ class acp_main // Version check $user->add_lang('install'); - if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.3', '<')) + if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4', '<')) { $template->assign_vars(array( 'S_PHP_VERSION_OLD' => true, @@ -432,20 +434,39 @@ class acp_main )); } - $latest_version_info = false; - if (($latest_version_info = obtain_latest_version_info(request_var('versioncheck_force', false))) === false) + if ($auth->acl_get('a_board')) { - $template->assign_var('S_VERSIONCHECK_FAIL', true); + /* @var $version_helper \phpbb\version_helper */ + $version_helper = $phpbb_container->get('version_helper'); + try + { + $recheck = $request->variable('versioncheck_force', false); + $updates_available = $version_helper->get_suggested_updates($recheck); + + $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available)); + } + catch (\RuntimeException $e) + { + $template->assign_vars(array( + 'S_VERSIONCHECK_FAIL' => true, + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', + )); + } } else { - $latest_version_info = explode("\n", $latest_version_info); - - $template->assign_vars(array( - 'S_VERSION_UP_TO_DATE' => phpbb_version_compare(trim($latest_version_info[0]), $config['version'], '<='), - )); + // We set this template var to true, to not display an outdated version notice. + $template->assign_var('S_VERSION_UP_TO_DATE', true); } + /** + * Notice admin + * + * @event core.acp_main_notice + * @since 3.1.0-RC3 + */ + $phpbb_dispatcher->dispatch('core.acp_main_notice'); + // Get forum statistics $total_posts = $config['num_posts']; $total_topics = $config['num_topics']; @@ -546,6 +567,7 @@ class acp_main 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'), + 'S_VERSIONCHECK' => ($auth->acl_get('a_board')) ? true : false, 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, ) @@ -625,7 +647,7 @@ class acp_main { $error = false; $search_type = $config['search_type']; - $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); if (!$search->index_created()) { @@ -636,7 +658,7 @@ class acp_main } } - if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) + if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && $phpbb_filesystem->is_writable($phpbb_root_path . 'config.' . $phpEx)) { // World-Writable? (000x) $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002)); @@ -648,15 +670,15 @@ class acp_main 'S_MBSTRING_LOADED' => true, 'S_MBSTRING_FUNC_OVERLOAD_FAIL' => (intval(@ini_get('mbstring.func_overload')) & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)), 'S_MBSTRING_ENCODING_TRANSLATION_FAIL' => (@ini_get('mbstring.encoding_translation') != 0), - 'S_MBSTRING_HTTP_INPUT_FAIL' => (@ini_get('mbstring.http_input') != 'pass'), - 'S_MBSTRING_HTTP_OUTPUT_FAIL' => (@ini_get('mbstring.http_output') != 'pass'), + 'S_MBSTRING_HTTP_INPUT_FAIL' => !in_array(@ini_get('mbstring.http_input'), array('pass', '')), + 'S_MBSTRING_HTTP_OUTPUT_FAIL' => !in_array(@ini_get('mbstring.http_output'), array('pass', '')), )); } // Fill dbms version if not yet filled if (empty($config['dbms_version'])) { - set_config('dbms_version', $db->sql_server_info(true)); + $config->set('dbms_version', $db->sql_server_info(true)); } $this->tpl_name = 'acp_main'; diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index c124377ba9..d3ecffe81e 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,6 +19,8 @@ if (!defined('IN_PHPBB')) exit; } +use phpbb\module\exception\module_exception; + /** * - Able to check for new module versions (modes changed/adjusted/added/removed) * Icons for: @@ -25,9 +31,6 @@ if (!defined('IN_PHPBB')) * - category disabled */ -/** -* @package acp -*/ class acp_modules { var $module_class = ''; @@ -36,8 +39,10 @@ class acp_modules function main($id, $mode) { - global $db, $user, $auth, $template, $module, $request; - global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; + global $db, $user, $template, $module, $request, $phpbb_log, $phpbb_container; + + /** @var \phpbb\module\module_manager $module_manager */ + $module_manager = $phpbb_container->get('module.manager'); // Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant) define('MODULE_INCLUDE', true); @@ -64,9 +69,9 @@ class acp_modules $this->page_title = strtoupper($this->module_class); - $this->parent_id = request_var('parent_id', 0); - $module_id = request_var('m', 0); - $action = request_var('action', ''); + $this->parent_id = $request->variable('parent_id', 0); + $module_id = $request->variable('m', 0); + $action = $request->variable('action', ''); $errors = array(); switch ($action) @@ -90,13 +95,20 @@ class acp_modules $db->sql_freeresult($result); } - $errors = $this->delete_module($module_id); - - if (!sizeof($errors)) + try { - $this->remove_cache_file(); - trigger_error($user->lang['MODULE_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + $row = $module_manager->get_module_row($module_id, $this->module_class); + $module_manager->delete_module($module_id, $this->module_class); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_REMOVED', false, array($user->lang($row['module_langname']))); } + catch (module_exception $e) + { + $msg = $user->lang($e->getMessage()); + trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + $module_manager->remove_cache_file($this->module_class); + trigger_error($user->lang['MODULE_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); } else { @@ -137,8 +149,8 @@ class acp_modules AND module_id = $module_id"; $db->sql_query($sql); - add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname'])); - $this->remove_cache_file(); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_' . strtoupper($action), false, array($user->lang($row['module_langname']))); + $module_manager->remove_cache_file($this->module_class); break; @@ -162,12 +174,16 @@ class acp_modules trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - $move_module_name = $this->move_module_by($row, $action, 1); + try + { + $move_module_name = $module_manager->move_module_by($row, $this->module_class, $action, 1); - if ($move_module_name !== false) + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_' . strtoupper($action), false, array($user->lang($row['module_langname']), $move_module_name)); + $module_manager->remove_cache_file($this->module_class); + } + catch (module_exception $e) { - add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname']), $move_module_name); - $this->remove_cache_file(); + // Do nothing } if ($request->is_ajax()) @@ -181,7 +197,7 @@ class acp_modules break; case 'quickadd': - $quick_install = request_var('quick_install', ''); + $quick_install = $request->variable('quick_install', ''); if (confirm_box(true)) { @@ -193,7 +209,7 @@ class acp_modules list($module_basename, $module_mode) = explode('::', $quick_install); // Check if module name and mode exist... - $fileinfo = $this->get_module_infos($module_basename); + $fileinfo = $module_manager->get_module_infos($this->module_class, $module_basename); $fileinfo = $fileinfo[$module_basename]; if (isset($fileinfo['modes'][$module_mode])) @@ -209,11 +225,20 @@ class acp_modules 'module_auth' => $fileinfo['modes'][$module_mode]['auth'], ); - $errors = $this->update_module_data($module_data); + try + { + $module_manager->update_module_data($module_data); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_ADD', false, array($user->lang($module_data['module_langname']))); + } + catch (\phpbb\module\exception\module_exception $e) + { + $msg = $user->lang($e->getMessage()); + trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } if (!sizeof($errors)) { - $this->remove_cache_file(); + $module_manager->remove_cache_file($this->module_class); trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); } @@ -239,7 +264,15 @@ class acp_modules trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - $module_row = $this->get_module_row($module_id); + try + { + $module_row = $module_manager->get_module_row($module_id, $this->module_class); + } + catch (\phpbb\module\exception\module_not_found_exception $e) + { + $msg = $user->lang($e->getMessage()); + trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } // no break @@ -252,7 +285,7 @@ class acp_modules 'module_enabled' => 0, 'module_display' => 1, 'parent_id' => 0, - 'module_langname' => utf8_normalize_nfc(request_var('module_langname', '', true)), + 'module_langname' => $request->variable('module_langname', '', true), 'module_mode' => '', 'module_auth' => '', ); @@ -260,13 +293,13 @@ class acp_modules $module_data = array(); - $module_data['module_basename'] = request_var('module_basename', (string) $module_row['module_basename']); - $module_data['module_enabled'] = request_var('module_enabled', (int) $module_row['module_enabled']); - $module_data['module_display'] = request_var('module_display', (int) $module_row['module_display']); - $module_data['parent_id'] = request_var('module_parent_id', (int) $module_row['parent_id']); + $module_data['module_basename'] = $request->variable('module_basename', (string) $module_row['module_basename']); + $module_data['module_enabled'] = $request->variable('module_enabled', (int) $module_row['module_enabled']); + $module_data['module_display'] = $request->variable('module_display', (int) $module_row['module_display']); + $module_data['parent_id'] = $request->variable('module_parent_id', (int) $module_row['parent_id']); $module_data['module_class'] = $this->module_class; - $module_data['module_langname'] = utf8_normalize_nfc(request_var('module_langname', (string) $module_row['module_langname'], true)); - $module_data['module_mode'] = request_var('module_mode', (string) $module_row['module_mode']); + $module_data['module_langname'] = $request->variable('module_langname', (string) $module_row['module_langname'], true); + $module_data['module_mode'] = $request->variable('module_mode', (string) $module_row['module_mode']); $submit = (isset($_POST['submit'])) ? true : false; @@ -277,7 +310,7 @@ class acp_modules trigger_error($user->lang['NO_MODULE_LANGNAME'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - $module_type = request_var('module_type', 'category'); + $module_type = $request->variable('module_type', 'category'); if ($module_type == 'category') { @@ -293,15 +326,29 @@ class acp_modules // Adjust auth row if ($module_data['module_basename'] && $module_data['module_mode']) { - $fileinfo = $this->get_module_infos($module_data['module_basename']); + $fileinfo = $module_manager->get_module_infos($this->module_class, $module_data['module_basename']); $module_data['module_auth'] = $fileinfo[$module_data['module_basename']]['modes'][$module_data['module_mode']]['auth']; } - $errors = $this->update_module_data($module_data); + try + { + $module_manager->update_module_data($module_data); + $phpbb_log->add('admin', + $user->data['user_id'], + $user->ip, + ($action === 'edit') ? 'LOG_MODULE_EDIT' : 'LOG_MODULE_ADD', + false, + array($user->lang($module_data['module_langname'])) + ); } + catch (\phpbb\module\exception\module_exception $e) + { + $msg = $user->lang($e->getMessage()); + trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } if (!sizeof($errors)) { - $this->remove_cache_file(); + $module_manager->remove_cache_file($this->module_class); trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); } @@ -311,7 +358,7 @@ class acp_modules $is_cat = (!$module_data['module_basename']) ? true : false; // Get module information - $module_infos = $this->get_module_infos(); + $module_infos = $module_manager->get_module_infos($this->module_class); // Build name options $s_name_options = $s_mode_options = ''; @@ -323,7 +370,7 @@ class acp_modules } // Name options - $s_name_options .= '<option value="' . $option . '"' . (($option == $module_data['module_basename']) ? ' selected="selected"' : '') . '>' . $this->lang_name($values['title']) . ' [' . $option . ']</option>'; + $s_name_options .= '<option value="' . $option . '"' . (($option == $module_data['module_basename']) ? ' selected="selected"' : '') . '>' . $user->lang($values['title']) . ' [' . $option . ']</option>'; $template->assign_block_vars('m_names', array('NAME' => $option, 'A_NAME' => addslashes($option))); @@ -332,14 +379,14 @@ class acp_modules { if ($option == $module_data['module_basename']) { - $s_mode_options .= '<option value="' . $m_mode . '"' . (($m_mode == $module_data['module_mode']) ? ' selected="selected"' : '') . '>' . $this->lang_name($m_values['title']) . '</option>'; + $s_mode_options .= '<option value="' . $m_mode . '"' . (($m_mode == $module_data['module_mode']) ? ' selected="selected"' : '') . '>' . $user->lang($m_values['title']) . '</option>'; } $template->assign_block_vars('m_names.modes', array( 'OPTION' => $m_mode, - 'VALUE' => $this->lang_name($m_values['title']), + 'VALUE' => $user->lang($m_values['title']), 'A_OPTION' => addslashes($m_mode), - 'A_VALUE' => addslashes($this->lang_name($m_values['title']))) + 'A_VALUE' => addslashes($user->lang($m_values['title']))) ); } } @@ -357,7 +404,7 @@ class acp_modules 'L_TITLE' => $user->lang[strtoupper($action) . '_MODULE'], - 'MODULENAME' => $this->lang_name($module_data['module_langname']), + 'MODULENAME' => $user->lang($module_data['module_langname']), 'ACTION' => $action, 'MODULE_ID' => $module_id, @@ -405,11 +452,11 @@ class acp_modules { $navigation = '<a href="' . $this->u_action . '">' . strtoupper($this->module_class) . '</a>'; - $modules_nav = $this->get_module_branch($this->parent_id, 'parents', 'descending'); + $modules_nav = $module_manager->get_module_branch($this->parent_id, $this->module_class, 'parents'); foreach ($modules_nav as $row) { - $langname = $this->lang_name($row['module_langname']); + $langname = $user->lang($row['module_langname']); if ($row['module_id'] == $this->parent_id) { @@ -436,7 +483,7 @@ class acp_modules { do { - $langname = $this->lang_name($row['module_langname']); + $langname = $user->lang($row['module_langname']); if (!$row['module_enabled']) { @@ -471,7 +518,15 @@ class acp_modules } else if ($this->parent_id) { - $row = $this->get_module_row($this->parent_id); + try + { + $row = $module_manager->get_module_row($this->parent_id, $this->module_class); + } + catch (\phpbb\module\exception\module_not_found_exception $e) + { + $msg = $user->lang($e->getMessage()); + trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } $url = $this->u_action . '&parent_id=' . $this->parent_id . '&m=' . $row['module_id']; @@ -490,19 +545,19 @@ class acp_modules $db->sql_freeresult($result); // Quick adding module - $module_infos = $this->get_module_infos(); + $module_infos = $module_manager->get_module_infos($this->module_class); // Build quick options $s_install_options = ''; foreach ($module_infos as $option => $values) { // Name options - $s_install_options .= '<optgroup label="' . $this->lang_name($values['title']) . ' [' . $option . ']">'; + $s_install_options .= '<optgroup label="' . $user->lang($values['title']) . ' [' . $option . ']">'; // Build module modes foreach ($values['modes'] as $m_mode => $m_values) { - $s_install_options .= '<option value="' . $option . '::' . $m_mode . '"> ' . $this->lang_name($m_values['title']) . '</option>'; + $s_install_options .= '<option value="' . $option . '::' . $m_mode . '"> ' . $user->lang($m_values['title']) . '</option>'; } $s_install_options .= '</optgroup>'; @@ -520,109 +575,11 @@ class acp_modules } /** - * Get row for specified module - */ - function get_module_row($module_id) - { - global $db, $user; - - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND module_id = $module_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); - } - - return $row; - } - - /** - * Get available module information from module files - * - * @param string $module - * @param bool|string $module_class - * @param bool $use_all_available Use all available instead of just all - * enabled extensions - * @return array - */ - function get_module_infos($module = '', $module_class = false, $use_all_available = false) - { - global $phpbb_extension_manager, $phpbb_root_path, $phpEx; - - $module_class = ($module_class === false) ? $this->module_class : $module_class; - - $directory = $phpbb_root_path . 'includes/' . $module_class . '/info/'; - $fileinfo = array(); - - $finder = $phpbb_extension_manager->get_finder(); - - $modules = $finder - ->extension_suffix('_module') - ->extension_directory("/$module_class") - ->core_path("includes/$module_class/info/") - ->core_prefix($module_class . '_') - ->get_classes(true, $use_all_available); - - foreach ($modules as $cur_module) - { - // Skip entries we do not need if we know the module we are - // looking for - if ($module && strpos(str_replace('\\', '_', $cur_module), $module) === false && $module !== $cur_module) - { - continue; - } - - $info_class = preg_replace('/_module$/', '_info', $cur_module); - - // If the class does not exist it might be following the old - // format. phpbb_acp_info_acp_foo needs to be turned into - // acp_foo_info and the respective file has to be included - // manually because it does not support auto loading - $old_info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module); - $old_info_class = $old_info_class_file . '_info'; - - if (class_exists($old_info_class)) - { - $info_class = $old_info_class; - } - else if (!class_exists($info_class)) - { - $info_class = $old_info_class; - // need to check class exists again because previous checks triggered autoloading - if (!class_exists($info_class) && file_exists($directory . $old_info_class_file . '.' . $phpEx)) - { - include($directory . $old_info_class_file . '.' . $phpEx); - } - } - - if (class_exists($info_class)) - { - $info = new $info_class(); - $module_info = $info->module(); - - $main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $cur_module; - - $fileinfo[$main_class] = $module_info; - } - } - - ksort($fileinfo); - - return $fileinfo; - } - - /** * Simple version of jumpbox, just lists modules */ function make_module_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $ignore_noncat = false) { - global $db, $user, $auth, $config; + global $db, $user; $sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth FROM ' . MODULES_TABLE . " @@ -677,7 +634,7 @@ class acp_modules $selected = (is_array($select_id)) ? ((in_array($row['module_id'], $select_id)) ? ' selected="selected"' : '') : (($row['module_id'] == $select_id) ? ' selected="selected"' : ''); - $langname = $this->lang_name($row['module_langname']); + $langname = $user->lang($row['module_langname']); $module_list .= '<option value="' . $row['module_id'] . '"' . $selected . ((!$row['module_enabled']) ? ' class="disabled"' : '') . '>' . $padding . $langname . '</option>'; $iteration++; @@ -688,400 +645,4 @@ class acp_modules return $module_list; } - - /** - * Get module branch - */ - function get_module_branch($module_id, $type = 'all', $order = 'descending', $include_module = true) - { - global $db; - - switch ($type) - { - case 'parents': - $condition = 'm1.left_id BETWEEN m2.left_id AND m2.right_id'; - break; - - case 'children': - $condition = 'm2.left_id BETWEEN m1.left_id AND m1.right_id'; - break; - - default: - $condition = 'm2.left_id BETWEEN m1.left_id AND m1.right_id OR m1.left_id BETWEEN m2.left_id AND m2.right_id'; - break; - } - - $rows = array(); - - $sql = 'SELECT m2.* - FROM ' . MODULES_TABLE . ' m1 - LEFT JOIN ' . MODULES_TABLE . " m2 ON ($condition) - WHERE m1.module_class = '" . $db->sql_escape($this->module_class) . "' - AND m2.module_class = '" . $db->sql_escape($this->module_class) . "' - AND m1.module_id = $module_id - ORDER BY m2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC'); - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if (!$include_module && $row['module_id'] == $module_id) - { - continue; - } - - $rows[] = $row; - } - $db->sql_freeresult($result); - - return $rows; - } - - /** - * Remove modules cache file - */ - function remove_cache_file() - { - global $phpbb_container; - - // Sanitise for future path use, it's escaped as appropriate for queries - $p_class = str_replace(array('.', '/', '\\'), '', basename($this->module_class)); - - $phpbb_container->get('cache.driver')->destroy('_modules_' . $p_class); - - // Additionally remove sql cache - $phpbb_container->get('cache.driver')->destroy('sql', MODULES_TABLE); - } - - /** - * Return correct language name - */ - function lang_name($module_langname) - { - global $user; - - return (!empty($user->lang[$module_langname])) ? $user->lang[$module_langname] : $module_langname; - } - - /** - * Update/Add module - * - * @param bool $run_inline if set to true errors will be returned and no logs being written - */ - function update_module_data(&$module_data, $run_inline = false) - { - global $db, $user; - - if (!isset($module_data['module_id'])) - { - // no module_id means we're creating a new category/module - if ($module_data['parent_id']) - { - $sql = 'SELECT left_id, right_id - FROM ' . MODULES_TABLE . " - WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' - AND module_id = " . (int) $module_data['parent_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - if ($run_inline) - { - return 'PARENT_NO_EXIST'; - } - - trigger_error($user->lang['PARENT_NO_EXIST'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); - } - - // Workaround - $row['left_id'] = (int) $row['left_id']; - $row['right_id'] = (int) $row['right_id']; - - $sql = 'UPDATE ' . MODULES_TABLE . " - SET left_id = left_id + 2, right_id = right_id + 2 - WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' - AND left_id > {$row['right_id']}"; - $db->sql_query($sql); - - $sql = 'UPDATE ' . MODULES_TABLE . " - SET right_id = right_id + 2 - WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' - AND {$row['left_id']} BETWEEN left_id AND right_id"; - $db->sql_query($sql); - - $module_data['left_id'] = (int) $row['right_id']; - $module_data['right_id'] = (int) $row['right_id'] + 1; - } - else - { - $sql = 'SELECT MAX(right_id) AS right_id - FROM ' . MODULES_TABLE . " - WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $module_data['left_id'] = (int) $row['right_id'] + 1; - $module_data['right_id'] = (int) $row['right_id'] + 2; - } - - $sql = 'INSERT INTO ' . MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $module_data); - $db->sql_query($sql); - - $module_data['module_id'] = $db->sql_nextid(); - - if (!$run_inline) - { - add_log('admin', 'LOG_MODULE_ADD', $this->lang_name($module_data['module_langname'])); - } - } - else - { - $row = $this->get_module_row($module_data['module_id']); - - if ($module_data['module_basename'] && !$row['module_basename']) - { - // we're turning a category into a module - $branch = $this->get_module_branch($module_data['module_id'], 'children', 'descending', false); - - if (sizeof($branch)) - { - return array($user->lang['NO_CATEGORY_TO_MODULE']); - } - } - - if ($row['parent_id'] != $module_data['parent_id']) - { - $this->move_module($module_data['module_id'], $module_data['parent_id']); - } - - $update_ary = $module_data; - unset($update_ary['module_id']); - - $sql = 'UPDATE ' . MODULES_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $update_ary) . " - WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' - AND module_id = " . (int) $module_data['module_id']; - $db->sql_query($sql); - - if (!$run_inline) - { - add_log('admin', 'LOG_MODULE_EDIT', $this->lang_name($module_data['module_langname'])); - } - } - - return array(); - } - - /** - * Move module around the tree - */ - function move_module($from_module_id, $to_parent_id) - { - global $db; - - $moved_modules = $this->get_module_branch($from_module_id, 'children', 'descending'); - $from_data = $moved_modules[0]; - $diff = sizeof($moved_modules) * 2; - - $moved_ids = array(); - for ($i = 0; $i < sizeof($moved_modules); ++$i) - { - $moved_ids[] = $moved_modules[$i]['module_id']; - } - - // Resync parents - $sql = 'UPDATE ' . MODULES_TABLE . " - SET right_id = right_id - $diff - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND left_id < " . (int) $from_data['right_id'] . ' - AND right_id > ' . (int) $from_data['right_id']; - $db->sql_query($sql); - - // Resync righthand side of tree - $sql = 'UPDATE ' . MODULES_TABLE . " - SET left_id = left_id - $diff, right_id = right_id - $diff - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND left_id > " . (int) $from_data['right_id']; - $db->sql_query($sql); - - if ($to_parent_id > 0) - { - $to_data = $this->get_module_row($to_parent_id); - - // Resync new parents - $sql = 'UPDATE ' . MODULES_TABLE . " - SET right_id = right_id + $diff - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND " . (int) $to_data['right_id'] . ' BETWEEN left_id AND right_id - AND ' . $db->sql_in_set('module_id', $moved_ids, true); - $db->sql_query($sql); - - // Resync the righthand side of the tree - $sql = 'UPDATE ' . MODULES_TABLE . " - SET left_id = left_id + $diff, right_id = right_id + $diff - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND left_id > " . (int) $to_data['right_id'] . ' - AND ' . $db->sql_in_set('module_id', $moved_ids, true); - $db->sql_query($sql); - - // Resync moved branch - $to_data['right_id'] += $diff; - if ($to_data['right_id'] > $from_data['right_id']) - { - $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); - } - else - { - $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); - } - } - else - { - $sql = 'SELECT MAX(right_id) AS right_id - FROM ' . MODULES_TABLE . " - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND " . $db->sql_in_set('module_id', $moved_ids, true); - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $diff = '+ ' . (int) ($row['right_id'] - $from_data['left_id'] + 1); - } - - $sql = 'UPDATE ' . MODULES_TABLE . " - SET left_id = left_id $diff, right_id = right_id $diff - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND " . $db->sql_in_set('module_id', $moved_ids); - $db->sql_query($sql); - } - - /** - * Remove module from tree - */ - function delete_module($module_id) - { - global $db, $user; - - $row = $this->get_module_row($module_id); - - $branch = $this->get_module_branch($module_id, 'children', 'descending', false); - - if (sizeof($branch)) - { - return array($user->lang['CANNOT_REMOVE_MODULE']); - } - - // If not move - $diff = 2; - $sql = 'DELETE FROM ' . MODULES_TABLE . " - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND module_id = $module_id"; - $db->sql_query($sql); - - $row['right_id'] = (int) $row['right_id']; - $row['left_id'] = (int) $row['left_id']; - - // Resync tree - $sql = 'UPDATE ' . MODULES_TABLE . " - SET right_id = right_id - $diff - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND left_id < {$row['right_id']} AND right_id > {$row['right_id']}"; - $db->sql_query($sql); - - $sql = 'UPDATE ' . MODULES_TABLE . " - SET left_id = left_id - $diff, right_id = right_id - $diff - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND left_id > {$row['right_id']}"; - $db->sql_query($sql); - - add_log('admin', 'LOG_MODULE_REMOVED', $this->lang_name($row['module_langname'])); - - return array(); - - } - - /** - * Move module position by $steps up/down - */ - function move_module_by($module_row, $action = 'move_up', $steps = 1) - { - global $db; - - /** - * Fetch all the siblings between the module's current spot - * and where we want to move it to. If there are less than $steps - * siblings between the current spot and the target then the - * module will move as far as possible - */ - $sql = 'SELECT module_id, left_id, right_id, module_langname - FROM ' . MODULES_TABLE . " - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND parent_id = " . (int) $module_row['parent_id'] . ' - AND ' . (($action == 'move_up') ? 'right_id < ' . (int) $module_row['right_id'] . ' ORDER BY right_id DESC' : 'left_id > ' . (int) $module_row['left_id'] . ' ORDER BY left_id ASC'); - $result = $db->sql_query_limit($sql, $steps); - - $target = array(); - while ($row = $db->sql_fetchrow($result)) - { - $target = $row; - } - $db->sql_freeresult($result); - - if (!sizeof($target)) - { - // The module is already on top or bottom - return false; - } - - /** - * $left_id and $right_id define the scope of the nodes that are affected by the move. - * $diff_up and $diff_down are the values to substract or add to each node's left_id - * and right_id in order to move them up or down. - * $move_up_left and $move_up_right define the scope of the nodes that are moving - * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. - */ - if ($action == 'move_up') - { - $left_id = (int) $target['left_id']; - $right_id = (int) $module_row['right_id']; - - $diff_up = (int) ($module_row['left_id'] - $target['left_id']); - $diff_down = (int) ($module_row['right_id'] + 1 - $module_row['left_id']); - - $move_up_left = (int) $module_row['left_id']; - $move_up_right = (int) $module_row['right_id']; - } - else - { - $left_id = (int) $module_row['left_id']; - $right_id = (int) $target['right_id']; - - $diff_up = (int) ($module_row['right_id'] + 1 - $module_row['left_id']); - $diff_down = (int) ($target['right_id'] - $module_row['right_id']); - - $move_up_left = (int) ($module_row['right_id'] + 1); - $move_up_right = (int) $target['right_id']; - } - - // Now do the dirty job - $sql = 'UPDATE ' . MODULES_TABLE . " - SET left_id = left_id + CASE - WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} - ELSE {$diff_down} - END, - right_id = right_id + CASE - WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} - ELSE {$diff_down} - END - WHERE module_class = '" . $db->sql_escape($this->module_class) . "' - AND left_id BETWEEN {$left_id} AND {$right_id} - AND right_id BETWEEN {$left_id} AND {$right_id}"; - $db->sql_query($sql); - - $this->remove_cache_file(); - - return $this->lang_name($target['module_langname']); - } } diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index aca45575d3..93aca295d7 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_permission_roles { var $u_action; @@ -25,12 +26,19 @@ class acp_permission_roles function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $phpbb_container; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - global $request; + global $db, $user, $template, $phpbb_container; + global $phpbb_root_path, $phpEx; + global $request, $phpbb_log; + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } $this->auth_admin = new auth_admin(); @@ -40,8 +48,8 @@ class acp_permission_roles $this->tpl_name = 'acp_permission_roles'; $submit = (isset($_POST['submit'])) ? true : false; - $role_id = request_var('role_id', 0); - $action = request_var('action', ''); + $role_id = $request->variable('role_id', 0); + $action = $request->variable('action', ''); $action = (isset($_POST['add'])) ? 'add' : $action; $form_name = 'acp_permissions'; @@ -108,7 +116,7 @@ class acp_permission_roles $this->remove_role($role_id, $permission_type); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; - add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', $role_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', false, array($role_name)); trigger_error($user->lang['ROLE_DELETED'] . adm_back_link($this->u_action)); } else @@ -147,9 +155,9 @@ class acp_permission_roles trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } - $role_name = utf8_normalize_nfc(request_var('role_name', '', true)); - $role_description = utf8_normalize_nfc(request_var('role_description', '', true)); - $auth_settings = request_var('setting', array('' => 0)); + $role_name = $request->variable('role_name', '', true); + $role_description = $request->variable('role_description', '', true); + $auth_settings = $request->variable('setting', array('' => 0)); if (!$role_name) { @@ -211,7 +219,7 @@ class acp_permission_roles $this->auth_admin->acl_set_role($role_id, $auth_settings); $role_name = (!empty($user->lang[$role_name])) ? $user->lang[$role_name] : $role_name; - add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), $role_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), false, array($role_name)); trigger_error($user->lang['ROLE_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action)); @@ -224,11 +232,11 @@ class acp_permission_roles { case 'add': - $options_from = request_var('options_from', 0); + $options_from = $request->variable('options_from', 0); $role_row = array( - 'role_name' => utf8_normalize_nfc(request_var('role_name', '', true)), - 'role_description' => utf8_normalize_nfc(request_var('role_description', '', true)), + 'role_name' => $request->variable('role_name', '', true), + 'role_description' => $request->variable('role_description', '', true), 'role_type' => $permission_type, ); @@ -252,7 +260,7 @@ class acp_permission_roles { $sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . " + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()) . " AND auth_option <> '{$permission_type}' ORDER BY auth_option_id"; $result = $db->sql_query($sql); @@ -270,7 +278,7 @@ class acp_permission_roles case 'edit': if ($action == 'edit') - { + { $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . ' WHERE role_id = ' . $role_id; @@ -298,6 +306,7 @@ class acp_permission_roles trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } + /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); $template->assign_vars(array( @@ -314,7 +323,7 @@ class acp_permission_roles // We need to fill the auth options array with ACL_NO options ;) $sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . " + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()) . " AND auth_option <> '{$permission_type}' ORDER BY auth_option_id"; $result = $db->sql_query($sql); @@ -412,7 +421,7 @@ class acp_permission_roles $db->sql_freeresult($result); // Display assigned items? - $display_item = request_var('display_item', 0); + $display_item = $request->variable('display_item', 0); // Select existing roles $sql = 'SELECT * @@ -468,8 +477,9 @@ class acp_permission_roles */ function display_auth_options($auth_options) { - global $template, $user, $phpbb_container; + global $template, $phpbb_container; + /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); $content_array = $categories = array(); @@ -518,7 +528,7 @@ class acp_permission_roles // Get complete auth array $sql = 'SELECT auth_option, auth_option_id FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char); + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()); $result = $db->sql_query($sql); $auth_settings = array(); diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index e7dc03db5c..fdac7c4d00 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,22 +19,30 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_permissions { var $u_action; var $permission_dropdown; + + /** + * @var $phpbb_permissions \phpbb\permissions + */ protected $permissions; function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $phpbb_container; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $phpbb_container, $request; + global $config, $phpbb_root_path, $phpEx; + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } $this->permissions = $phpbb_container->get('acl.permissions'); @@ -44,9 +56,9 @@ class acp_permissions // Trace has other vars if ($mode == 'trace') { - $user_id = request_var('u', 0); - $forum_id = request_var('f', 0); - $permission = request_var('auth', ''); + $user_id = $request->variable('u', 0); + $forum_id = $request->variable('f', 0); + $permission = $request->variable('auth', ''); $this->tpl_name = 'permission_trace'; @@ -75,20 +87,20 @@ class acp_permissions } // Set some vars - $action = request_var('action', array('' => 0)); + $action = $request->variable('action', array('' => 0)); $action = key($action); $action = (isset($_POST['psubmit'])) ? 'apply_permissions' : $action; - $all_forums = request_var('all_forums', 0); - $subforum_id = request_var('subforum_id', 0); - $forum_id = request_var('forum_id', array(0)); + $all_forums = $request->variable('all_forums', 0); + $subforum_id = $request->variable('subforum_id', 0); + $forum_id = $request->variable('forum_id', array(0)); - $username = request_var('username', array(''), true); - $usernames = request_var('usernames', '', true); - $user_id = request_var('user_id', array(0)); + $username = $request->variable('username', array(''), true); + $usernames = $request->variable('usernames', '', true); + $user_id = $request->variable('user_id', array(0)); - $group_id = request_var('group_id', array(0)); - $select_all_groups = request_var('select_all_groups', 0); + $group_id = $request->variable('group_id', array(0)); + $select_all_groups = $request->variable('select_all_groups', 0); $form_name = 'acp_permissions'; add_form_key($form_name); @@ -155,8 +167,6 @@ class acp_permissions } // Define some common variables for every mode - $error = array(); - $permission_scope = (strpos($mode, '_global') !== false) ? 'global' : 'local'; // Showing introductionary page? @@ -227,7 +237,7 @@ class acp_permissions ); // Get permission type - $permission_type = request_var('type', $this->permission_dropdown[0]); + $permission_type = $request->variable('type', $this->permission_dropdown[0]); if (!in_array($permission_type, $this->permission_dropdown)) { @@ -330,15 +340,6 @@ class acp_permissions } } - - // Setting permissions screen - $s_hidden_fields = build_hidden_fields(array( - 'user_id' => $user_id, - 'group_id' => $group_id, - 'forum_id' => $forum_id, - 'type' => $permission_type) - ); - // Go through the screens/options needed and present them in correct order foreach ($permission_victim as $victim) { @@ -471,6 +472,14 @@ class acp_permissions // If there are more than 5 forums selected the admin is not able to select all users/groups too. // We need to see if the number of forums can be increased or need to be decreased. + // Setting permissions screen + $s_hidden_fields = build_hidden_fields(array( + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + )); + $template->assign_vars(array( 'U_ACTION' => $this->u_action, 'ANONYMOUS_USER_ID' => ANONYMOUS, @@ -507,6 +516,14 @@ class acp_permissions return; } + // Setting permissions screen + $s_hidden_fields = build_hidden_fields(array( + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + )); + // Do not allow forum_ids being set and no other setting defined (will bog down the server too much) if (sizeof($forum_id) && !sizeof($user_id) && !sizeof($group_id)) { @@ -662,7 +679,7 @@ class acp_permissions global $db, $cache, $user, $auth; global $request; - $psubmit = request_var('psubmit', array(0 => array(0 => 0))); + $psubmit = $request->variable('psubmit', array(0 => array(0 => 0))); // User or group to be set? $ug_type = (sizeof($user_id)) ? 'user' : 'group'; @@ -673,8 +690,6 @@ class acp_permissions trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - $ug_id = $forum_id = 0; - // We loop through the auth settings defined in our submit list($ug_id, ) = each($psubmit); list($forum_id, ) = each($psubmit[$ug_id]); @@ -692,7 +707,7 @@ class acp_permissions $assigned_role = (isset($roles[$ug_id][$forum_id])) ? (int) $roles[$ug_id][$forum_id] : 0; // Do the admin want to set these permissions to other items too? - $inherit = request_var('inherit', array(0 => array(0))); + $inherit = $request->variable('inherit', array(0 => array(0))); $ug_id = array($ug_id); $forum_id = array($forum_id); @@ -897,7 +912,7 @@ class acp_permissions */ function log_action($mode, $action, $permission_type, $ug_type, $ug_id, $forum_id) { - global $db, $user; + global $db, $user, $phpbb_log, $phpbb_container; if (!is_array($ug_id)) { @@ -914,10 +929,14 @@ class acp_permissions $sql .= $db->sql_in_set(($ug_type == 'group') ? 'group_id' : 'user_id', array_map('intval', $ug_id)); $result = $db->sql_query($sql); + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + $l_ug_list = ''; while ($row = $db->sql_fetchrow($result)) { - $l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '<span class="sep">' . $user->lang['G_' . $row['name']] . '</span>' : $row['name']); + $group_name = $group_helper->get_name($row['name']); + $l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '<span class="sep">' . $group_name . '</span>' : $group_name); } $db->sql_freeresult($result); @@ -925,7 +944,7 @@ class acp_permissions if ($forum_id[0] == 0) { - add_log('admin', 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), $l_ug_list); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_ug_list)); } else { @@ -942,7 +961,7 @@ class acp_permissions } $db->sql_freeresult($result); - add_log('admin', 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), $l_forum_list, $l_ug_list); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_forum_list, $l_ug_list)); } } @@ -951,7 +970,7 @@ class acp_permissions */ function permission_trace($user_id, $forum_id, $permission) { - global $db, $template, $user, $auth; + global $db, $template, $user, $auth, $request, $phpbb_container; if ($user_id != $user->data['user_id']) { @@ -967,6 +986,9 @@ class acp_permissions trigger_error('NO_USERS', E_USER_ERROR); } + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + $forum_name = false; if ($forum_id) @@ -979,7 +1001,7 @@ class acp_permissions $db->sql_freeresult($result); } - $back = request_var('back', 0); + $back = $request->variable('back', 0); $template->assign_vars(array( 'PERMISSION' => $this->permissions->get_permission_lang($permission), @@ -1013,7 +1035,7 @@ class acp_permissions { $groups[$row['group_id']] = array( 'auth_setting' => ACL_NO, - 'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'] + 'group_name' => $group_helper->get_name($row['group_name']), ); } $db->sql_freeresult($result); @@ -1170,7 +1192,7 @@ class acp_permissions */ function copy_forum_permissions() { - global $db, $auth, $cache, $template, $user; + global $db, $auth, $cache, $template, $user, $request; $user->add_lang('acp/forums'); @@ -1178,8 +1200,8 @@ class acp_permissions if ($submit) { - $src = request_var('src_forum_id', 0); - $dest = request_var('dest_forum_ids', array(0)); + $src = $request->variable('src_forum_id', 0); + $dest = $request->variable('dest_forum_ids', array(0)); if (confirm_box(true)) { @@ -1221,7 +1243,10 @@ class acp_permissions */ function retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type) { - global $db, $user; + global $db, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((sizeof($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); @@ -1230,7 +1255,7 @@ class acp_permissions $sql = 'SELECT auth_option_id FROM ' . ACL_OPTIONS_TABLE . ' - WHERE auth_option ' . $db->sql_like_expression($permission_type . $db->any_char); + WHERE auth_option ' . $db->sql_like_expression($permission_type . $db->get_any_char()); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -1296,7 +1321,7 @@ class acp_permissions $defined_group_ids = array(); while ($row = $db->sql_fetchrow($result)) { - $s_defined_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_defined_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>'; $defined_group_ids[] = $row['group_id']; } $db->sql_freeresult($result); diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php index 125b77529f..2a1afe80d4 100644 --- a/phpBB/includes/acp/acp_php_info.php +++ b/phpBB/includes/acp/acp_php_info.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,17 +19,13 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_php_info { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $template; if ($mode != 'info') { @@ -46,7 +46,7 @@ class acp_php_info // for this was nabbed from the PHP annotated manual preg_match_all('#<body[^>]*>(.*)</body>#si', $phpinfo, $output); - if (empty($phpinfo) || empty($output)) + if (empty($phpinfo) || empty($output[1][0])) { trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING); } @@ -81,7 +81,7 @@ class acp_php_info $template->assign_var('PHPINFO', $output); } - + function remove_spaces($matches) { return '<a name="' . str_replace(' ', '_', $matches[1]) . '">'; diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 3a5298fb58..69672ebec0 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,41 +19,49 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_profile { var $u_action; var $edit_lang_id; var $lang_defs; + + /** + * @var \phpbb\di\service_collection + */ protected $type_collection; function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; - global $request, $phpbb_container; + global $config, $db, $user, $template; + global $phpbb_root_path, $phpEx; + global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher; - include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('generate_smilies')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $user->add_lang(array('ucp', 'acp/profile')); $this->tpl_name = 'acp_profile'; $this->page_title = 'ACP_CUSTOM_PROFILE_FIELDS'; $field_id = $request->variable('field_id', 0); - $action = (isset($_POST['create'])) ? 'create' : request_var('action', ''); + $action = (isset($_POST['create'])) ? 'create' : $request->variable('action', ''); $error = array(); - $s_hidden_fields = ''; if (!$field_id && in_array($action, array('delete','activate', 'deactivate', 'move_up', 'move_down', 'edit'))) { trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING); } + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); $this->type_collection = $phpbb_container->get('profilefields.type_collection'); @@ -111,57 +123,9 @@ class acp_profile $db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id"); $db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id"); - switch ($db->sql_layer) - { - case 'sqlite': - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '" . PROFILE_FIELDS_DATA_TABLE . "' - ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - // Create a temp table and populate it, destroy the existing one - $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE); - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $new_table_cols = trim($matches[1]); - $old_table_cols = preg_split('/,(?=[\\sa-z])/im', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - - if ($entities[0] == 'PRIMARY') - { - continue; - } - - if ($entities[0] !== 'pf_' . $field_ident) - { - $column_list[] = $entities[0]; - } - } - - $columns = implode(',', $column_list); - - $new_table_cols = preg_replace('/' . 'pf_' . $field_ident . '[^,]+,/', '', $new_table_cols); - - // create a new table and fill it up. destroy the temp one - $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); - break; - - default: - $db->sql_query('ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " DROP COLUMN pf_$field_ident"); - } + /* @var $db_tools \phpbb\db\tools\tools_interface */ + $db_tools = $phpbb_container->get('dbal.tools'); + $db_tools->sql_column_remove(PROFILE_FIELDS_DATA_TABLE, 'pf_' . $field_ident); $order = 0; @@ -185,7 +149,7 @@ class acp_profile $db->sql_transaction('commit'); - add_log('admin', 'LOG_PROFILE_FIELD_REMOVED', $field_ident); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_REMOVED', false, array($field_ident)); trigger_error($user->lang['REMOVED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } else @@ -226,7 +190,7 @@ class acp_profile $field_ident = (string) $db->sql_fetchfield('field_ident'); $db->sql_freeresult($result); - add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_ACTIVATE', false, array($field_ident)); if ($request->is_ajax()) { @@ -262,7 +226,7 @@ class acp_profile )); } - add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_DEACTIVATE', false, array($field_ident)); trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); @@ -303,7 +267,7 @@ class acp_profile case 'create': case 'edit': - $step = request_var('step', 1); + $step = $request->variable('step', 1); $submit = (isset($_REQUEST['next']) || isset($_REQUEST['prev'])) ? true : false; $save = (isset($_REQUEST['save'])) ? true : false; @@ -367,7 +331,7 @@ class acp_profile // We are adding a new field, define basic params $lang_options = $field_row = array(); - $field_type = request_var('field_type', ''); + $field_type = $request->variable('field_type', ''); if (!isset($this->type_collection[$field_type])) { @@ -376,7 +340,7 @@ class acp_profile $profile_field = $this->type_collection[$field_type]; $field_row = array_merge($profile_field->get_default_option_values(), array( - 'field_ident' => str_replace(' ', '_', utf8_clean_string(request_var('field_ident', '', true))), + 'field_ident' => str_replace(' ', '_', utf8_clean_string($request->variable('field_ident', '', true))), 'field_required' => 0, 'field_show_novalue'=> 0, 'field_hide' => 0, @@ -386,7 +350,10 @@ class acp_profile 'field_show_on_pm' => 0, 'field_show_on_vt' => 0, 'field_show_on_ml' => 0, - 'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)), + 'field_is_contact' => 0, + 'field_contact_desc'=> '', + 'field_contact_url' => '', + 'lang_name' => $request->variable('field_ident', '', true), 'lang_explain' => '', 'lang_default_value'=> '') ); @@ -396,7 +363,7 @@ class acp_profile // $exclude contains the data we gather in each step $exclude = array( - 1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_on_ml', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view'), + 1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_on_ml', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view', 'field_is_contact', 'field_contact_desc', 'field_contact_url'), 2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'), 3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options') ); @@ -411,21 +378,50 @@ class acp_profile 'field_show_on_ml', 'field_show_profile', 'field_hide', + 'field_is_contact', ); + /** + * Event to add initialization for new profile field table fields + * + * @event core.acp_profile_create_edit_init + * @var string action create|edit + * @var int step Configuration step (1|2|3) + * @var bool submit Form has been submitted + * @var bool save Configuration should be saved + * @var string field_type Type of the field we are dealing with + * @var array field_row Array of data about the field + * @var array exclude Array of excluded fields by step + * @var array visibility_ary Array of fields that are visibility related + * @since 3.1.6-RC1 + */ + $vars = array( + 'action', + 'step', + 'submit', + 'save', + 'field_type', + 'field_row', + 'exclude', + 'visibility_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_profile_create_edit_init', compact($vars))); + $options = $profile_field->prepare_options_form($exclude, $visibility_ary); - $cp->vars['field_ident'] = ($action == 'create' && $step == 1) ? utf8_clean_string(request_var('field_ident', $field_row['field_ident'], true)) : request_var('field_ident', $field_row['field_ident']); - $cp->vars['lang_name'] = utf8_normalize_nfc(request_var('lang_name', $field_row['lang_name'], true)); - $cp->vars['lang_explain'] = utf8_normalize_nfc(request_var('lang_explain', $field_row['lang_explain'], true)); - $cp->vars['lang_default_value'] = utf8_normalize_nfc(request_var('lang_default_value', $field_row['lang_default_value'], true)); + $cp->vars['field_ident'] = ($action == 'create' && $step == 1) ? utf8_clean_string($request->variable('field_ident', $field_row['field_ident'], true)) : $request->variable('field_ident', $field_row['field_ident']); + $cp->vars['lang_name'] = $request->variable('lang_name', $field_row['lang_name'], true); + $cp->vars['lang_explain'] = $request->variable('lang_explain', $field_row['lang_explain'], true); + $cp->vars['lang_default_value'] = $request->variable('lang_default_value', $field_row['lang_default_value'], true); + $cp->vars['field_contact_desc'] = $request->variable('field_contact_desc', $field_row['field_contact_desc'], true); + $cp->vars['field_contact_url'] = $request->variable('field_contact_url', $field_row['field_contact_url'], true); foreach ($visibility_ary as $val) { - $cp->vars[$val] = ($submit || $save) ? request_var($val, 0) : $field_row[$val]; + $cp->vars[$val] = ($submit || $save) ? $request->variable($val, 0) : $field_row[$val]; } - $cp->vars['field_no_view'] = request_var('field_no_view', (int) $field_row['field_no_view']); + $cp->vars['field_no_view'] = $request->variable('field_no_view', (int) $field_row['field_no_view']); // If the user has submitted a form with options (i.e. dropdown field) if ($options) @@ -452,7 +448,7 @@ class acp_profile // step 2 foreach ($exclude[2] as $key) { - $var = utf8_normalize_nfc(request_var($key, $field_row[$key], true)); + $var = $request->variable($key, $field_row[$key], true); $field_data = $cp->vars; $var = $profile_field->get_excluded_options($key, $action, $var, $field_data, 2); @@ -479,7 +475,6 @@ class acp_profile } $db->sql_freeresult($result); - $sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id <> ' . $this->edit_lang_id . " @@ -499,11 +494,11 @@ class acp_profile foreach ($exclude[3] as $key) { - $cp->vars[$key] = utf8_normalize_nfc(request_var($key, array(0 => ''), true)); + $cp->vars[$key] = $request->variable($key, array(0 => ''), true); if (!$cp->vars[$key] && $action == 'edit') { - $cp->vars[$key] = $$key; + $cp->vars[$key] = ${$key}; } $field_data = $cp->vars; @@ -554,13 +549,14 @@ class acp_profile } } - $step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step); - if (sizeof($error)) { - $step--; $submit = false; } + else + { + $step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step); + } // Build up the specific hidden fields foreach ($exclude as $num => $key_ary) @@ -578,7 +574,7 @@ class acp_profile $var = $profile_field->prepare_hidden_fields($step, $key, $action, $field_data); if ($var !== null) { - $_new_key_ary[$key] = $profile_field->prepare_hidden_fields($step, $key, $action, $field_data); + $_new_key_ary[$key] = $var; } } $cp->vars = $field_data; @@ -588,11 +584,7 @@ class acp_profile if (!sizeof($error)) { - if ($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save)) - { - $this->save_profile_field($cp, $field_type, $action); - } - else if ($action == 'edit' && $save) + if (($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save)) { $this->save_profile_field($cp, $field_type, $action); } @@ -626,6 +618,9 @@ class acp_profile 'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false, 'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false, 'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false, + 'S_FIELD_CONTACT' => $cp->vars['field_is_contact'], + 'FIELD_CONTACT_DESC'=> $cp->vars['field_contact_desc'], + 'FIELD_CONTACT_URL' => $cp->vars['field_contact_url'], 'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']), 'FIELD_TYPE' => $profile_field->get_name(), @@ -684,6 +679,33 @@ class acp_profile break; } + $field_data = $cp->vars; + /** + * Event to add template variables for new profile field table fields + * + * @event core.acp_profile_create_edit_after + * @var string action create|edit + * @var int step Configuration step (1|2|3) + * @var bool submit Form has been submitted + * @var bool save Configuration should be saved + * @var string field_type Type of the field we are dealing with + * @var array field_data Array of data about the field + * @var array s_hidden_fields Array of hidden fields in case this needs modification + * @var array options Array of options specific to this step + * @since 3.1.6-RC1 + */ + $vars = array( + 'action', + 'step', + 'submit', + 'save', + 'field_type', + 'field_data', + 's_hidden_fields', + 'options', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_profile_create_edit_after', compact($vars))); + $template->assign_vars(array( 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); @@ -753,7 +775,7 @@ class acp_profile */ function build_language_options(&$cp, $field_type, $action = 'create') { - global $user, $config, $db, $phpbb_container; + global $user, $config, $db, $request; $default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][$config['default_lang']]; @@ -794,7 +816,7 @@ class acp_profile $lang_options[$lang_id]['lang_iso'] = $lang_iso; foreach ($options as $field => $field_type) { - $value = ($action == 'create') ? utf8_normalize_nfc(request_var('l_' . $field, array(0 => ''), true)) : $cp->vars['l_' . $field]; + $value = ($action == 'create') ? $request->variable('l_' . $field, array(0 => ''), true) : $cp->vars['l_' . $field]; if ($field == 'lang_options') { $var = (!isset($cp->vars['l_lang_options'][$lang_id]) || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['lang_options'] : $cp->vars['l_lang_options'][$lang_id]; @@ -850,9 +872,9 @@ class acp_profile */ function save_profile_field(&$cp, $field_type, $action = 'create') { - global $db, $config, $user, $phpbb_container; + global $db, $config, $user, $phpbb_container, $phpbb_log, $request, $phpbb_dispatcher; - $field_id = request_var('field_id', 0); + $field_id = $request->variable('field_id', 0); // Collect all information, if something is going wrong, abort the operation $profile_sql = $profile_lang = $empty_lang = $profile_lang_fields = array(); @@ -886,9 +908,31 @@ class acp_profile 'field_show_on_ml' => $cp->vars['field_show_on_ml'], 'field_hide' => $cp->vars['field_hide'], 'field_show_profile' => $cp->vars['field_show_profile'], - 'field_no_view' => $cp->vars['field_no_view'] + 'field_no_view' => $cp->vars['field_no_view'], + 'field_is_contact' => $cp->vars['field_is_contact'], + 'field_contact_desc' => $cp->vars['field_contact_desc'], + 'field_contact_url' => $cp->vars['field_contact_url'], ); + $field_data = $cp->vars; + /** + * Event to modify profile field configuration data before saving to database + * + * @event core.acp_profile_create_edit_save_before + * @var string action create|edit + * @var string field_type Type of the field we are dealing with + * @var array field_data Array of data about the field + * @var array profile_fields Array of fields to be sent to the database + * @since 3.1.6-RC1 + */ + $vars = array( + 'action', + 'field_type', + 'field_data', + 'profile_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_profile_create_edit_save_before', compact($vars))); + if ($action == 'create') { $profile_fields += array( @@ -917,11 +961,9 @@ class acp_profile if ($action == 'create') { $field_ident = 'pf_' . $field_ident; - + /* @var $db_tools \phpbb\db\tools\tools_interface */ $db_tools = $phpbb_container->get('dbal.tools'); - - list($sql_type, $null) = $db_tools->get_column_type($profile_field->get_database_column_type()); - $profile_sql[] = $this->add_field_ident($field_ident, $sql_type); + $db_tools->sql_column_add(PROFILE_FIELDS_DATA_TABLE, $field_ident, array($profile_field->get_database_column_type(), null)); } $sql_ary = array( @@ -1104,7 +1146,6 @@ class acp_profile } } - $db->sql_transaction('begin'); if ($action == 'create') @@ -1119,12 +1160,12 @@ class acp_profile if ($action == 'edit') { - add_log('admin', 'LOG_PROFILE_FIELD_EDIT', $cp->vars['field_ident'] . ':' . $cp->vars['lang_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_EDIT', false, array($cp->vars['field_ident'] . ':' . $cp->vars['lang_name'])); trigger_error($user->lang['CHANGED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } else { - add_log('admin', 'LOG_PROFILE_FIELD_CREATE', substr($field_ident, 3) . ':' . $cp->vars['lang_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_CREATE', false, array(substr($field_ident, 3) . ':' . $cp->vars['lang_name'])); trigger_error($user->lang['ADDED_PROFILE_FIELD'] . adm_back_link($this->u_action)); } } @@ -1176,95 +1217,4 @@ class acp_profile } } } - - /** - * Return sql statement for adding a new field ident (profile field) to the profile fields data table - */ - function add_field_ident($field_ident, $sql_type) - { - global $db; - - switch ($db->sql_layer) - { - case 'mysql': - case 'mysql4': - case 'mysqli': - $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD `$field_ident` " . $sql_type; - - break; - - case 'sqlite': - if (version_compare(sqlite_libversion(), '3.0') == -1) - { - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '" . PROFILE_FIELDS_DATA_TABLE . "' - ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - // Create a temp table and populate it, destroy the existing one - $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE); - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $new_table_cols = trim($matches[1]); - $old_table_cols = explode(',', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - continue; - } - $column_list[] = $entities[0]; - } - - $columns = implode(',', $column_list); - - $new_table_cols = $field_ident . ' ' . $sql_type . ',' . $new_table_cols; - - // create a new table and fill it up. destroy the temp one - $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); - } - else - { - $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident [$sql_type]"; - } - - break; - - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $sql = 'ALTER TABLE [' . PROFILE_FIELDS_DATA_TABLE . "] ADD [$field_ident] " . $sql_type; - - break; - - case 'postgres': - $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD COLUMN \"$field_ident\" " . $sql_type; - - break; - - case 'firebird': - $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' ADD "' . strtoupper($field_ident) . '" ' . $sql_type; - - break; - - case 'oracle': - $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident " . $sql_type; - - break; - } - - return $sql; - } } diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index 5d9080b55b..d37050869a 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,19 +19,20 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_prune { var $u_action; function main($id, $mode) { - global $user, $phpEx, $phpbb_admin_path, $phpbb_root_path; + global $user, $phpEx, $phpbb_root_path; $user->add_lang('acp/prune'); - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + + if (!function_exists('user_active_flip')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } switch ($mode) { @@ -50,11 +55,10 @@ class acp_prune */ function prune_forums($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $phpbb_log, $request; - $all_forums = request_var('all_forums', 0); - $forum_id = request_var('f', array(0)); + $all_forums = $request->variable('all_forums', 0); + $forum_id = $request->variable('f', array(0)); $submit = (isset($_POST['submit'])) ? true : false; if ($all_forums) @@ -76,14 +80,14 @@ class acp_prune { if (confirm_box(true)) { - $prune_posted = request_var('prune_days', 0); - $prune_viewed = request_var('prune_vieweddays', 0); + $prune_posted = $request->variable('prune_days', 0); + $prune_viewed = $request->variable('prune_vieweddays', 0); $prune_all = (!$prune_posted && !$prune_viewed) ? true : false; - + $prune_flags = 0; - $prune_flags += (request_var('prune_old_polls', 0)) ? 2 : 0; - $prune_flags += (request_var('prune_announce', 0)) ? 4 : 0; - $prune_flags += (request_var('prune_sticky', 0)) ? 8 : 0; + $prune_flags += ($request->variable('prune_old_polls', 0)) ? 2 : 0; + $prune_flags += ($request->variable('prune_announce', 0)) ? 4 : 0; + $prune_flags += ($request->variable('prune_sticky', 0)) ? 8 : 0; // Convert days to seconds for timestamp functions... $prunedate_posted = time() - ($prune_posted * 86400); @@ -109,7 +113,7 @@ class acp_prune $p_result['topics'] = 0; $p_result['posts'] = 0; $log_data = ''; - + do { if (!$auth->acl_get('f_list', $row['forum_id'])) @@ -129,7 +133,7 @@ class acp_prune $p_result['topics'] += $return['topics']; $p_result['posts'] += $return['posts']; } - + if ($prune_viewed) { $return = prune($row['forum_id'], 'viewed', $prunedate_viewed, $prune_flags, false); @@ -145,14 +149,15 @@ class acp_prune 'NUM_TOPICS' => $p_result['topics'], 'NUM_POSTS' => $p_result['posts']) ); - + $log_data .= (($log_data != '') ? ', ' : '') . $row['forum_name']; } while ($row = $db->sql_fetchrow($result)); - + // Sync all pruned forums at once sync('forum', 'forum_id', $prune_ids, true, true); - add_log('admin', 'LOG_PRUNE', $log_data); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PRUNE', false, array($log_data)); } $db->sql_freeresult($result); @@ -167,11 +172,11 @@ class acp_prune 'all_forums' => $all_forums, 'f' => $forum_id, - 'prune_days' => request_var('prune_days', 0), - 'prune_vieweddays' => request_var('prune_vieweddays', 0), - 'prune_old_polls' => request_var('prune_old_polls', 0), - 'prune_announce' => request_var('prune_announce', 0), - 'prune_sticky' => request_var('prune_sticky', 0), + 'prune_days' => $request->variable('prune_days', 0), + 'prune_vieweddays' => $request->variable('prune_vieweddays', 0), + 'prune_old_polls' => $request->variable('prune_old_polls', 0), + 'prune_announce' => $request->variable('prune_announce', 0), + 'prune_sticky' => $request->variable('prune_sticky', 0), ))); } } @@ -227,8 +232,11 @@ class acp_prune */ function prune_users($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $auth, $template, $phpbb_log, $request; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); $user->add_lang('memberlist'); @@ -236,8 +244,8 @@ class acp_prune if ($prune) { - $action = request_var('action', 'deactivate'); - $deleteposts = request_var('deleteposts', 0); + $action = $request->variable('action', 'deactivate'); + $deleteposts = $request->variable('deleteposts', 0); if (confirm_box(true)) { @@ -256,7 +264,7 @@ class acp_prune if ($deleteposts) { user_delete('remove', $user_ids); - + $l_log = 'LOG_PRUNE_USER_DEL_DEL'; } else @@ -267,7 +275,7 @@ class acp_prune } } - add_log('admin', $l_log, implode(', ', $usernames)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $l_log, false, array(implode(', ', $usernames))); $msg = $user->lang['USER_' . strtoupper($action) . '_SUCCESS']; } else @@ -294,7 +302,7 @@ class acp_prune $template->assign_block_vars('users', array( 'USERNAME' => $usernames[$user_id], 'USER_ID' => $user_id, - 'U_PROFILE' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx, 'mode=viewprofile&u=' . $user_id), + 'U_PROFILE' => get_username_string('profile', $user_id, $usernames[$user_id]), 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', )); } @@ -309,8 +317,8 @@ class acp_prune 'mode' => $mode, 'prune' => 1, - 'deleteposts' => request_var('deleteposts', 0), - 'action' => request_var('action', ''), + 'deleteposts' => $request->variable('deleteposts', 0), + 'action' => $request->variable('action', ''), )), 'confirm_body_prune.html'); } } @@ -340,7 +348,7 @@ class acp_prune $s_group_list = ''; while ($row = $db->sql_fetchrow($result)) { - $s_group_list .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; + $s_group_list .= '<option value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -367,9 +375,9 @@ class acp_prune { global $user, $db, $request; - $users_by_name = request_var('users', '', true); - $users_by_id = request_var('user_ids', array(0)); - $group_id = request_var('group_id', 0); + $users_by_name = $request->variable('users', '', true); + $users_by_id = $request->variable('user_ids', array(0)); + $group_id = $request->variable('group_id', 0); $posts_on_queue = (trim($request->variable('posts_on_queue', '')) === '') ? false : $request->variable('posts_on_queue', 0); if ($users_by_name) @@ -386,18 +394,17 @@ class acp_prune } else { - $username = request_var('username', '', true); - $email = request_var('email', ''); - $website = request_var('website', ''); + $username = $request->variable('username', '', true); + $email = $request->variable('email', ''); - $active_select = request_var('active_select', 'lt'); - $count_select = request_var('count_select', 'eq'); - $queue_select = request_var('queue_select', 'gt'); - $joined_before = request_var('joined_before', ''); - $joined_after = request_var('joined_after', ''); - $active = request_var('active', ''); + $active_select = $request->variable('active_select', 'lt'); + $count_select = $request->variable('count_select', 'eq'); + $queue_select = $request->variable('queue_select', 'gt'); + $joined_before = $request->variable('joined_before', ''); + $joined_after = $request->variable('joined_after', ''); + $active = $request->variable('active', ''); - $count = request_var('count', 0); + $count = ($request->variable('count', '') === '') ? false : $request->variable('count', 0); $active = ($active) ? explode('-', $active) : array(); $joined_before = ($joined_before) ? explode('-', $joined_before) : array(); @@ -433,20 +440,18 @@ class acp_prune } $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); - $sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit'); $where_sql = ''; - $where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : ''; - $where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : ''; - $where_sql .= ($website) ? ' AND user_website ' . $db->sql_like_expression(str_replace('*', $db->any_char, $website)) . ' ' : ''; + $where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : ''; + $where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : ''; $where_sql .= $joined_sql; - $where_sql .= ($count) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; + $where_sql .= ($count !== false) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; // First handle pruning of users who never logged in, last active date is 0000-00-00 if (sizeof($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) { $where_sql .= ' AND user_lastvisit = 0'; - } + } else if (sizeof($active) && $active_select != 'lt') { $where_sql .= ' AND user_lastvisit ' . $key_match[$active_select] . ' ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); @@ -507,9 +512,9 @@ class acp_prune WHERE ug.group_id = ' . (int) $group_id . ' AND ug.user_id <> ' . ANONYMOUS . ' AND u.user_type <> ' . USER_FOUNDER . ' - AND ug.user_pending = 0 ' . - ((!empty($user_ids)) ? 'AND ' . $db->sql_in_set('ug.user_id', $user_ids) : '') . ' - AND u.user_id = ug.user_id'; + AND ug.user_pending = 0 + AND u.user_id = ug.user_id + ' . (!empty($user_ids) ? ' AND ' . $db->sql_in_set('ug.user_id', $user_ids) : ''); $result = $db->sql_query($sql); // we're performing an intersection operation, so all the relevant users @@ -533,10 +538,10 @@ class acp_prune $sql = 'SELECT u.user_id, u.username, COUNT(p.post_id) AS queue_posts FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u WHERE u.user_id <> ' . ANONYMOUS . ' - AND u.user_type <> ' . USER_FOUNDER . - ((!empty($user_ids)) ? 'AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . ' - AND p.post_visibility = ' . ITEM_UNAPPROVED . ' + AND u.user_type <> ' . USER_FOUNDER . ' + AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . ' AND u.user_id = p.poster_id + ' . (!empty($user_ids) ? ' AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . ' GROUP BY p.poster_id HAVING queue_posts ' . $key_match[$queue_select] . ' ' . $posts_on_queue; $result = $db->sql_query($sql); diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index 73e1de44d9..4d2b64d74c 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,25 +19,22 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_ranks { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $request; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $template, $cache, $request, $phpbb_dispatcher; + global $config, $phpbb_root_path, $phpbb_admin_path, $phpbb_log; $user->add_lang('acp/posting'); // Set up general vars - $action = request_var('action', ''); + $action = $request->variable('action', ''); $action = (isset($_POST['add'])) ? 'add' : $action; $action = (isset($_POST['save'])) ? 'save' : $action; - $rank_id = request_var('id', 0); + $rank_id = $request->variable('id', 0); $this->tpl_name = 'acp_ranks'; $this->page_title = 'ACP_MANAGE_RANKS'; @@ -49,10 +50,10 @@ class acp_ranks { trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } - $rank_title = utf8_normalize_nfc(request_var('title', '', true)); - $special_rank = request_var('special_rank', 0); - $min_posts = ($special_rank) ? 0 : max(0, request_var('min_posts', 0)); - $rank_image = request_var('rank_image', ''); + $rank_title = $request->variable('title', '', true); + $special_rank = $request->variable('special_rank', 0); + $min_posts = ($special_rank) ? 0 : max(0, $request->variable('min_posts', 0)); + $rank_image = $request->variable('rank_image', ''); // The rank image has to be a jpg, gif or png if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#i', $rank_image)) @@ -72,19 +73,30 @@ class acp_ranks 'rank_image' => htmlspecialchars_decode($rank_image) ); + /** + * Modify the SQL array when saving a rank + * + * @event core.acp_ranks_save_modify_sql_ary + * @var int rank_id The ID of the rank (if available) + * @var array sql_ary Array with the rank's data + * @since 3.1.0-RC3 + */ + $vars = array('rank_id', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_save_modify_sql_ary', compact($vars))); + if ($rank_id) { $sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id"; $message = $user->lang['RANK_UPDATED']; - add_log('admin', 'LOG_RANK_UPDATED', $rank_title); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RANK_UPDATED', false, array($rank_title)); } else { $sql = 'INSERT INTO ' . RANKS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $message = $user->lang['RANK_ADDED']; - add_log('admin', 'LOG_RANK_ADDED', $rank_title); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RANK_ADDED', false, array($rank_title)); } $db->sql_query($sql); @@ -121,7 +133,7 @@ class acp_ranks $cache->destroy('_ranks'); - add_log('admin', 'LOG_RANK_REMOVED', $rank_title); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RANK_REMOVED', false, array($rank_title)); if ($request->is_ajax()) { @@ -150,7 +162,7 @@ class acp_ranks case 'edit': case 'add': - $data = $ranks = $existing_imgs = array(); + $ranks = $existing_imgs = array(); $sql = 'SELECT * FROM ' . RANKS_TABLE . ' @@ -201,7 +213,7 @@ class acp_ranks $filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>----------</option>' . $filename_list; unset($existing_imgs, $imglist); - $template->assign_vars(array( + $tpl_ary = array( 'S_EDIT' => true, 'U_BACK' => $this->u_action, 'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'], @@ -211,10 +223,21 @@ class acp_ranks 'S_FILENAME_LIST' => $filename_list, 'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : htmlspecialchars($phpbb_admin_path) . 'images/spacer.gif', 'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false, - 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0) + 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0, ); - + /** + * Modify the template output array for editing/adding ranks + * + * @event core.acp_ranks_edit_modify_tpl_ary + * @var array ranks Array with the rank's data + * @var array tpl_ary Array with the rank's template data + * @since 3.1.0-RC3 + */ + $vars = array('ranks', 'tpl_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_edit_modify_tpl_ary', compact($vars))); + + $template->assign_vars($tpl_ary); return; break; @@ -231,7 +254,7 @@ class acp_ranks while ($row = $db->sql_fetchrow($result)) { - $template->assign_block_vars('ranks', array( + $rank_row = array( 'S_RANK_IMAGE' => ($row['rank_image']) ? true : false, 'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false, @@ -240,8 +263,21 @@ class acp_ranks 'MIN_POSTS' => $row['rank_min'], 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row['rank_id'], - 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['rank_id']) + 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['rank_id'], ); + + /** + * Modify the template output array for each listed rank + * + * @event core.acp_ranks_list_modify_rank_row + * @var array row Array with the rank's data + * @var array rank_row Array with the rank's template data + * @since 3.1.0-RC3 + */ + $vars = array('row', 'rank_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_list_modify_rank_row', compact($vars))); + + $template->assign_block_vars('ranks', $rank_row); } $db->sql_freeresult($result); diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 569bb73ab0..0d221bba3c 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,25 +19,21 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_reasons { var $u_action; function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - global $request; + global $db, $user, $template; + global $request, $phpbb_log; $user->add_lang(array('mcp', 'acp/posting')); // Set up general vars - $action = request_var('action', ''); + $action = $request->variable('action', ''); $submit = (isset($_POST['submit'])) ? true : false; - $reason_id = request_var('id', 0); + $reason_id = $request->variable('id', 0); $this->tpl_name = 'acp_reasons'; $this->page_title = 'ACP_REASONS'; @@ -49,8 +49,8 @@ class acp_reasons case 'edit': $reason_row = array( - 'reason_title' => utf8_normalize_nfc(request_var('reason_title', '', true)), - 'reason_description' => utf8_normalize_nfc(request_var('reason_description', '', true)), + 'reason_title' => $request->variable('reason_title', '', true), + 'reason_description' => $request->variable('reason_description', '', true), ); if ($submit) @@ -138,7 +138,7 @@ class acp_reasons $log = 'UPDATED'; } - add_log('admin', 'LOG_REASON_' . $log, $reason_row['reason_title']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_' . $log, false, array($reason_row['reason_title'])); trigger_error($user->lang['REASON_' . $log] . adm_back_link($this->u_action)); } } @@ -218,7 +218,7 @@ class acp_reasons $other_reason_id = (int) $db->sql_fetchfield('reason_id'); $db->sql_freeresult($result); - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { // The ugly one! case 'mysqli': @@ -251,8 +251,8 @@ class acp_reasons // Teh standard case 'postgres': case 'oracle': - case 'firebird': case 'sqlite': + case 'sqlite3': // Change the reports using this reason to 'other' $sql = 'UPDATE ' . REPORTS_TABLE . ' SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' || report_text @@ -263,7 +263,7 @@ class acp_reasons $db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); - add_log('admin', 'LOG_REASON_REMOVED', $reason_row['reason_title']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_REMOVED', false, array($reason_row['reason_title'])); trigger_error($user->lang['REASON_REMOVED'] . adm_back_link($this->u_action)); } else diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 11a2511aee..1f0e8ef539 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_search { var $u_action; @@ -49,8 +50,8 @@ class acp_search function settings($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $user, $template, $phpbb_log, $request; + global $config, $phpbb_admin_path, $phpEx; $submit = (isset($_POST['submit'])) ? true : false; @@ -79,7 +80,8 @@ class acp_search $name = $search->get_name(); $selected = ($config['search_type'] == $type) ? ' selected="selected"' : ''; - $search_options .= '<option value="' . $type . '"' . $selected . '>' . $name . '</option>'; + $identifier = substr($type, strrpos($type, '\\') + 1); + $search_options .= "<option value=\"$type\"$selected data-toggle-setting=\"#search_{$identifier}_settings\">$name</option>"; if (method_exists($search, 'acp')) { @@ -88,9 +90,10 @@ class acp_search if (!$submit) { $template->assign_block_vars('backend', array( - 'NAME' => $name, - 'SETTINGS' => $vars['tpl']) - ); + 'NAME' => $name, + 'SETTINGS' => $vars['tpl'], + 'IDENTIFIER' => $identifier, + )); } else if (is_array($vars['config'])) { @@ -101,8 +104,8 @@ class acp_search unset($search); unset($error); - $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => ''), true) : array(); - $updated = request_var('updated', false); + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : array(); + $updated = $request->variable('updated', false); foreach ($settings as $config_name => $var_type) { @@ -130,7 +133,7 @@ class acp_search // only change config if anything was actually changed if ($submit && ($config[$config_name] != $config_value)) { - set_config($config_name, $config_value); + $config->set($config_name, $config_value); $updated = true; } } @@ -140,7 +143,7 @@ class acp_search $extra_message = ''; if ($updated) { - add_log('admin', 'LOG_CONFIG_SEARCH'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_SEARCH'); } if (isset($cfg_array['search_type']) && in_array($cfg_array['search_type'], $search_types, true) && ($cfg_array['search_type'] != $config['search_type'])) @@ -154,11 +157,11 @@ class acp_search { if (!method_exists($search, 'init') || !($error = $search->init())) { - set_config('search_type', $cfg_array['search_type']); + $config->set('search_type', $cfg_array['search_type']); if (!$updated) { - add_log('admin', 'LOG_CONFIG_SEARCH'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_SEARCH'); } $extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=search&mode=index') . '">» ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>'; } @@ -229,10 +232,10 @@ class acp_search function index($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $template, $phpbb_log, $request; + global $config, $phpbb_admin_path, $phpEx; - $action = request_var('action', ''); + $action = $request->variable('action', ''); $this->state = explode(',', $config['search_indexing_state']); if (isset($_POST['cancel'])) @@ -247,7 +250,7 @@ class acp_search switch ($action) { case 'progress_bar': - $type = request_var('type', ''); + $type = $request->variable('type', ''); $this->display_progress_bar($type); break; @@ -266,7 +269,7 @@ class acp_search if (empty($this->state[0])) { - $this->state[0] = request_var('search_type', ''); + $this->state[0] = $request->variable('search_type', ''); } $this->search = null; @@ -300,8 +303,7 @@ class acp_search } else { - $starttime = explode(' ', microtime()); - $starttime = $starttime[1] + $starttime[0]; + $starttime = microtime(true); $row_count = 0; while (still_on_time() && $post_counter <= $this->max_post_id) { @@ -333,8 +335,7 @@ class acp_search if ($post_counter <= $this->max_post_id) { - $mtime = explode(' ', microtime()); - $totaltime = $mtime[0] + $mtime[1] - $starttime; + $totaltime = microtime(true) - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter)); trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter, $rows_per_second)); @@ -346,7 +347,7 @@ class acp_search $this->state = array(''); $this->save_state(); - add_log('admin', 'LOG_SEARCH_INDEX_REMOVED', $name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_REMOVED', false, array($name)); trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js()); break; @@ -373,8 +374,7 @@ class acp_search } $db->sql_freeresult($result); - $starttime = explode(' ', microtime()); - $starttime = $starttime[1] + $starttime[0]; + $starttime = microtime(true); $row_count = 0; while (still_on_time() && $post_counter <= $this->max_post_id) { @@ -423,8 +423,7 @@ class acp_search if ($post_counter <= $this->max_post_id) { - $mtime = explode(' ', microtime()); - $totaltime = $mtime[0] + $mtime[1] - $starttime; + $totaltime = microtime(true) - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter)); trigger_error($user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second)); @@ -436,7 +435,7 @@ class acp_search $this->state = array(''); $this->save_state(); - add_log('admin', 'LOG_SEARCH_INDEX_CREATED', $name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_CREATED', false, array($name)); trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js()); break; } @@ -446,7 +445,6 @@ class acp_search $search = null; $error = false; - $search_options = ''; foreach ($search_types as $type) { if ($this->init_search($type, $search, $error) || !method_exists($search, 'index_created')) @@ -553,7 +551,7 @@ class acp_search function get_search_types() { - global $phpbb_root_path, $phpEx, $phpbb_extension_manager; + global $phpbb_extension_manager; $finder = $phpbb_extension_manager->get_finder(); @@ -579,6 +577,8 @@ class acp_search function save_state($state = false) { + global $config; + if ($state) { $this->state = $state; @@ -586,7 +586,7 @@ class acp_search ksort($this->state); - set_config('search_indexing_state', implode(',', $this->state), true); + $config->set('search_indexing_state', implode(',', $this->state), true); } /** @@ -596,7 +596,7 @@ class acp_search */ function init_search($type, &$search, &$error) { - global $phpbb_root_path, $phpEx, $user, $auth, $config, $db; + global $phpbb_root_path, $phpEx, $user, $auth, $config, $db, $phpbb_dispatcher; if (!class_exists($type) || !method_exists($type, 'keyword_search')) { @@ -605,7 +605,7 @@ class acp_search } $error = false; - $search = new $type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + $search = new $type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); return $error; } diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php index 39140b8da4..74da5996f1 100644 --- a/phpBB/includes/acp/acp_send_statistics.php +++ b/phpBB/includes/acp/acp_send_statistics.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_send_statistics { var $u_action; @@ -26,7 +27,10 @@ class acp_send_statistics { global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); + if (!class_exists('phpbb_questionnaire_data_collector')) + { + include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); + } $collect_url = "https://www.phpbb.com/stats/receive_stats.php"; @@ -37,7 +41,7 @@ class acp_send_statistics if (!isset($config['questionnaire_unique_id'])) { $install_id = unique_id(); - set_config('questionnaire_unique_id', $install_id); + $config->set('questionnaire_unique_id', $install_id); } else { diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index d5492d85a3..7878cbc8e9 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_styles { public $u_action; @@ -28,19 +29,45 @@ class acp_styles protected $styles_path; protected $styles_path_absolute = 'styles'; protected $default_style = 0; + protected $styles_list_cols = 0; + protected $reserved_style_names = array('adm', 'admin', 'all'); + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ protected $db; + + /** @var \phpbb\user */ protected $user; + + /** @var \phpbb\template\template */ protected $template; + + /** @var \phpbb\request\request_interface */ protected $request; + + /** @var \phpbb\cache\driver\driver_interface */ protected $cache; + + /** @var \phpbb\auth\auth */ protected $auth; + + /** @var \phpbb\textformatter\cache_interface */ + protected $text_formatter_cache; + + /** @var string */ protected $phpbb_root_path; + + /** @var string */ protected $php_ext; + /** @var \phpbb\event\dispatcher_interface */ + protected $dispatcher; + public function main($id, $mode) { - global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config; + global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_container; $this->db = $db; $this->user = $user; @@ -48,9 +75,11 @@ class acp_styles $this->request = $request; $this->cache = $cache; $this->auth = $auth; + $this->text_formatter_cache = $phpbb_container->get('text_formatter.cache'); $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $phpEx; + $this->dispatcher = $phpbb_dispatcher; $this->default_style = $config['default_style']; $this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/'; @@ -69,11 +98,6 @@ class acp_styles $action = $this->request->variable('action', ''); $post_actions = array('install', 'activate', 'deactivate', 'uninstall'); - if ($action && in_array($action, $post_actions) && !check_link_hash($request->variable('hash', ''), $action)) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); - } - foreach ($post_actions as $key) { if ($this->request->is_set_post($key)) @@ -82,6 +106,18 @@ class acp_styles } } + // The uninstall action uses confirm_box() to verify the validity of the request, + // so there is no need to check for a valid token here. + if (in_array($action, $post_actions) && $action != 'uninstall') + { + $is_valid_request = check_link_hash($request->variable('hash', ''), $action) || check_form_key('styles_management'); + + if (!$is_valid_request) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + if ($action != '') { $this->s_hidden_fields['action'] = $action; @@ -93,6 +129,18 @@ class acp_styles ) ); + /** + * Run code before ACP styles action execution + * + * @event core.acp_styles_action_before + * @var int id Module ID + * @var string mode Active module + * @var string action Module that should be run + * @since 3.1.7-RC1 + */ + $vars = array('id', 'mode', 'action'); + extract($this->dispatcher->trigger_event('core.acp_styles_action_before', compact($vars))); + // Execute actions switch ($action) { @@ -121,6 +169,8 @@ class acp_styles */ protected function frontend() { + add_form_key('styles_management'); + // Check mode switch ($this->mode) { @@ -132,32 +182,11 @@ class acp_styles $this->welcome_message('INSTALL_STYLES', 'INSTALL_STYLES_EXPLAIN'); $this->show_available(); return; - case 'cache': - $this->action_cache(); - return; } trigger_error($this->user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); } /** - * Purge cache - */ - protected function action_cache() - { - global $db, $cache, $auth; - - $this->cache->purge(); - - // Clear permissions - $this->auth->acl_clear_prefetch(); - phpbb_cache_moderators($db, $cache, $auth); - - add_log('admin', 'LOG_PURGE_CACHE'); - - trigger_error($this->user->lang['PURGED_CACHE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); - } - - /** * Install style(s) */ protected function action_install() @@ -172,9 +201,14 @@ class acp_styles $messages = array(); $installed_names = array(); $installed_dirs = array(); - $last_installed = false; foreach ($dirs as $dir) { + if (in_array($dir, $this->reserved_style_names)) + { + $messages[] = $this->user->lang('STYLE_NAME_RESERVED', htmlspecialchars($dir)); + continue; + } + $found = false; foreach ($styles as &$style) { @@ -189,7 +223,6 @@ class acp_styles $style['style_id'] = $this->install_style($style); $style['_installed'] = true; $found = true; - $last_installed = $style['style_id']; $installed_names[] = $style['style_name']; $installed_dirs[] = $style['style_path']; $messages[] = sprintf($this->user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name'])); @@ -201,14 +234,20 @@ class acp_styles } } + // Invalidate the text formatter's cache for the new styles to take effect + if (!empty($installed_names)) + { + $this->text_formatter_cache->invalidate(); + } + // Show message if (!count($messages)) { trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } $message = implode('<br />', $messages); - $message .= '<br /><br />' . sprintf($this->user->lang['STYLE_INSTALLED_RETURN_STYLES'], $this->u_base_action . '&mode=style'); - $message .= '<br /><br />' . sprintf($this->user->lang['STYLE_INSTALLED_RETURN_UNINSTALLED'], $this->u_base_action . '&mode=install'); + $message .= '<br /><br /><a href="' . $this->u_base_action . '&mode=style' . '">« ' . $this->user->lang('STYLE_INSTALLED_RETURN_INSTALLED_STYLES') . '</a>'; + $message .= '<br /><br /><a href="' . $this->u_base_action . '&mode=install' . '">» ' . $this->user->lang('STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES') . '</a>'; trigger_error($message, E_USER_NOTICE); } @@ -248,6 +287,8 @@ class acp_styles */ protected function action_uninstall_confirmed($ids, $delete_files) { + global $user, $phpbb_log; + $default = $this->default_style; $uninstalled = array(); $messages = array(); @@ -307,7 +348,7 @@ class acp_styles // Log action if (count($uninstalled)) { - add_log('admin', 'LOG_STYLE_DELETE', implode(', ', $uninstalled)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_DELETE', false, array(implode(', ', $uninstalled))); } // Clear cache @@ -379,6 +420,8 @@ class acp_styles */ protected function action_details() { + global $user, $phpbb_log; + $id = $this->request->variable('id', 0); if (!$id) { @@ -510,7 +553,8 @@ class acp_styles $this->cache->purge(); } } - add_log('admin', 'LOG_STYLE_EDIT_DETAILS', $style['style_name']); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_EDIT_DETAILS', false, array($style['style_name'])); } // Update default style @@ -521,7 +565,7 @@ class acp_styles { trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING); } - set_config('default_style', $id); + $this->config->set('default_style', $id); $this->cache->purge(); } @@ -530,6 +574,9 @@ class acp_styles return; } + // Show page title + $this->welcome_message('ACP_STYLES', null); + // Show parent styles foreach ($list as $row) { @@ -799,7 +846,7 @@ class acp_styles * * @param array $styles Styles list, passed as reference * @param string $name Name of parent style - * @param string $level Styles tree level + * @param int $level Styles tree level */ protected function show_available_child_styles(&$styles, $name, $level) { @@ -817,7 +864,7 @@ class acp_styles * Update styles tree * * @param array $styles Styles list, passed as reference - * @param array $style Current style, false if root + * @param array|false $style Current style, false if root * @return bool True if something was updated, false if not */ protected function update_styles_tree(&$styles, $style = false) @@ -883,7 +930,7 @@ class acp_styles * Show item in styles list * * @param array $style style row - * @param array $level style inheritance level + * @param int $level style inheritance level */ protected function list_style(&$style, $level) { @@ -980,7 +1027,7 @@ class acp_styles // Assign template variables $this->template->assign_block_vars('styles_list', $row); - foreach($actions as $action) + foreach ($actions as $action) { $this->template->assign_block_vars('styles_list.actions', $action); } @@ -1099,11 +1146,13 @@ class acp_styles /** * Install style * - * @param $style style data + * @param array $style style data * @return int Style id */ protected function install_style($style) { + global $user, $phpbb_log; + // Generate row $sql_ary = array(); foreach ($style as $key => $value) @@ -1125,7 +1174,7 @@ class acp_styles $this->db->sql_transaction('commit'); - add_log('admin', 'LOG_STYLE_ADD', $sql_ary['style_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_ADD', false, array($sql_ary['style_name'])); return $id; } diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 6b5407067d..52897e1043 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,73 +19,49 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_update { var $u_action; function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $config, $user, $template, $request; + global $phpbb_root_path, $phpEx, $phpbb_container; $user->add_lang('install'); $this->tpl_name = 'acp_update'; $this->page_title = 'ACP_VERSION_CHECK'; - // Get current and latest version - $errstr = ''; - $errno = 0; - - $info = obtain_latest_version_info(request_var('versioncheck_force', false)); - - if (empty($info)) + /* @var $version_helper \phpbb\version_helper */ + $version_helper = $phpbb_container->get('version_helper'); + try { - trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING); + $recheck = $request->variable('versioncheck_force', false); + $updates_available = $version_helper->get_suggested_updates($recheck); } + catch (\RuntimeException $e) + { + $template->assign_var('S_VERSIONCHECK_FAIL', true); - $info = explode("\n", $info); - $latest_version = trim($info[0]); - - $announcement_url = trim($info[1]); - $announcement_url = (strpos($announcement_url, '&') === false) ? str_replace('&', '&', $announcement_url) : $announcement_url; - $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); + $updates_available = array(); + } - // next feature release - $next_feature_version = $next_feature_announcement_url = false; - if (isset($info[2]) && trim($info[2]) !== '') + foreach ($updates_available as $branch => $version_data) { - $next_feature_version = trim($info[2]); - $next_feature_announcement_url = trim($info[3]); + $template->assign_block_vars('updates_available', $version_data); } - // Determine automatic update... - $sql = 'SELECT config_value - FROM ' . CONFIG_TABLE . " - WHERE config_name = 'version_update_from'"; - $result = $db->sql_query($sql); - $version_update_from = (string) $db->sql_fetchfield('config_value'); - $db->sql_freeresult($result); - - $current_version = (!empty($version_update_from)) ? $version_update_from : $config['version']; + $update_link = $phpbb_root_path . 'install/app.' . $phpEx; $template->assign_vars(array( - 'S_UP_TO_DATE' => phpbb_version_compare($latest_version, $config['version'], '<='), - 'S_UP_TO_DATE_AUTO' => phpbb_version_compare($latest_version, $current_version, '<='), - 'S_VERSION_CHECK' => true, - 'U_ACTION' => $this->u_action, - 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), + 'S_UP_TO_DATE' => empty($updates_available), + 'U_ACTION' => $this->u_action, + 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), - 'LATEST_VERSION' => $latest_version, - 'CURRENT_VERSION' => $config['version'], - 'AUTO_VERSION' => $version_update_from, - 'NEXT_FEATURE_VERSION' => $next_feature_version, + 'CURRENT_VERSION' => $config['version'], - 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link), - 'UPGRADE_INSTRUCTIONS' => $next_feature_version ? $user->lang('UPGRADE_INSTRUCTIONS', $next_feature_version, $next_feature_announcement_url) : false, + 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link), )); } } diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 87582dcedb..2bec4385c3 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_users { var $u_action; @@ -30,19 +31,23 @@ class acp_users function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; + global $config, $db, $user, $auth, $template; + global $phpbb_root_path, $phpbb_admin_path, $phpEx; global $phpbb_dispatcher, $request; - global $phpbb_container; + global $phpbb_container, $phpbb_log; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; - $this->page_title = 'ACP_USER_' . strtoupper($mode); $error = array(); - $username = utf8_normalize_nfc(request_var('username', '', true)); - $user_id = request_var('u', 0); - $action = request_var('action', ''); + $username = $request->variable('username', '', true); + $user_id = $request->variable('u', 0); + $action = $request->variable('action', ''); + + // Get referer to redirect user to the appropriate page after delete action + $redirect = $request->variable('redirect', ''); + $redirect_tag = "redirect=$redirect"; + $redirect_url = append_sid("{$phpbb_admin_path}index.$phpEx", "i=$redirect"); $submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false; @@ -52,12 +57,15 @@ class acp_users // Whois (special case) if ($action == 'whois') { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $this->page_title = 'WHOIS'; $this->tpl_name = 'simple_body'; - $user_ip = phpbb_ip_normalise(request_var('user_ip', '')); + $user_ip = phpbb_ip_normalise($request->variable('user_ip', '')); $domain = gethostbyaddr($user_ip); $ipwhois = user_ipwhois($user_ip); @@ -146,9 +154,9 @@ class acp_users } $template->assign_vars(array( - 'U_BACK' => $this->u_action, + 'U_BACK' => (empty($redirect)) ? $this->u_action : $redirect_url, 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), - 'U_ACTION' => $this->u_action . '&u=' . $user_id, + 'U_ACTION' => $this->u_action . '&u=' . $user_id . ((empty($redirect)) ? '' : '&' . $redirect_tag), 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username']) ); @@ -159,22 +167,41 @@ class acp_users trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); } + $this->page_title = $user_row['username'] . ' :: ' . $user->lang('ACP_USER_' . strtoupper($mode)); + switch ($mode) { case 'overview': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $user->add_lang('acp/ban'); - $delete = request_var('delete', 0); - $delete_type = request_var('delete_type', ''); - $ip = request_var('ip', 'ip'); + $delete = $request->variable('delete', 0); + $delete_type = $request->variable('delete_type', ''); + $ip = $request->variable('ip', 'ip'); + + /** + * Run code at beginning of ACP users overview + * + * @event core.acp_users_overview_before + * @var array user_row Current user data + * @var string mode Active module + * @var string action Module that should be run + * @var bool submit Do we display the form only + * or did the user press submit + * @var array error Array holding error messages + * @since 3.1.3-RC1 + */ + $vars = array('user_row', 'mode', 'action', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_before', compact($vars))); if ($submit) { - // You can't delete the founder - if ($delete && $user_row['user_type'] != USER_FOUNDER) + if ($delete) { if (!$auth->acl_get('a_userdel')) { @@ -187,6 +214,12 @@ class acp_users trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } + // Founders can not be deleted. + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_REMOVE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + if ($user_id == $user->data['user_id']) { trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); @@ -198,20 +231,31 @@ class acp_users { user_delete($delete_type, $user_id, $user_row['username']); - add_log('admin', 'LOG_USER_DELETED', $user_row['username']); - trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DELETED', false, array($user_row['username'])); + trigger_error($user->lang['USER_DELETED'] . adm_back_link( + (empty($redirect)) ? $this->u_action : $redirect_url + ) + ); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + $delete_confirm_hidden_fields = array( 'u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true, 'delete' => 1, - 'delete_type' => $delete_type)) + 'delete_type' => $delete_type, ); + + // Checks if the redirection page is specified + if (!empty($redirect)) + { + $delete_confirm_hidden_fields['redirect'] = $redirect; + } + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($delete_confirm_hidden_fields)); } } else @@ -254,13 +298,11 @@ class acp_users case 'banuser': $ban[] = $user_row['username']; $reason = 'USER_ADMIN_BAN_NAME_REASON'; - $log = 'LOG_USER_BAN_USER'; break; case 'banemail': $ban[] = $user_row['user_email']; $reason = 'USER_ADMIN_BAN_EMAIL_REASON'; - $log = 'LOG_USER_BAN_EMAIL'; break; case 'banip': @@ -278,12 +320,11 @@ class acp_users $db->sql_freeresult($result); $reason = 'USER_ADMIN_BAN_IP_REASON'; - $log = 'LOG_USER_BAN_IP'; break; } - $ban_reason = utf8_normalize_nfc(request_var('ban_reason', $user->lang[$reason], true)); - $ban_give_reason = utf8_normalize_nfc(request_var('ban_give_reason', '', true)); + $ban_reason = $request->variable('ban_reason', $user->lang[$reason], true); + $ban_give_reason = $request->variable('ban_give_reason', '', true); // Log not used at the moment, we simply utilize the ban function. $result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason); @@ -316,7 +357,10 @@ class acp_users if ($config['email_enable']) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } $server_url = generate_board_url(); @@ -359,8 +403,10 @@ class acp_users $messenger->send(NOTIFY_EMAIL); - add_log('admin', 'LOG_USER_REACTIVATE', $user_row['username']); - add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE_USER', false, array( + 'reportee_id' => $user_id + )); trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id)); } @@ -396,10 +442,14 @@ class acp_users { if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } $messenger = new messenger(false); @@ -420,8 +470,10 @@ class acp_users $message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED'; $log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE'; - add_log('admin', $log, $user_row['username']); - add_log('user', $user_id, $log . '_USER'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, $log . '_USER', false, array( + 'reportee_id' => $user_id + )); trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -444,8 +496,10 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); - add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']); - add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG_USER', false, array( + 'reportee_id' => $user_id + )); trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -458,28 +512,15 @@ class acp_users trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - $sql_ary = array( - 'user_avatar' => '', - 'user_avatar_type' => '', - 'user_avatar_width' => 0, - 'user_avatar_height' => 0, - ); - - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " - WHERE user_id = $user_id"; - $db->sql_query($sql); - // Delete old avatar if present + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); - $driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type']); - if ($driver) - { - $driver->delete($user_row); - } + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $phpbb_avatar_manager->clean_row($user_row, 'user'), USERS_TABLE, 'user_'); - add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']); - add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR_USER', false, array( + 'reportee_id' => $user_id + )); trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); break; @@ -491,7 +532,7 @@ class acp_users // Delete posts, attachments, etc. delete_posts('poster_id', $user_id); - add_log('admin', 'LOG_USER_DEL_POSTS', $user_row['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_POSTS', false, array($user_row['username'])); trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } else @@ -511,9 +552,12 @@ class acp_users if (confirm_box(true)) { - delete_attachments('user', $user_id); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('user', $user_id); + unset($attachment_manager); - add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username'])); trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } else @@ -559,7 +603,7 @@ class acp_users delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX); - add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_OUTBOX', false, array($user_row['username'])); $lang = 'EMPTIED'; } @@ -588,7 +632,7 @@ class acp_users $user->add_lang('acp/forums'); - $new_forum_id = request_var('new_f', 0); + $new_forum_id = $request->variable('new_f', 0); if (!$new_forum_id) { @@ -651,6 +695,7 @@ class acp_users { if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved'] && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_REAPPROVE] == $row['topic_posts_unapproved'] && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) { $move_topic_ary[] = $row['topic_id']; @@ -729,9 +774,11 @@ class acp_users sync('forum', 'forum_id', $forum_id_ary, false, true); } - - add_log('admin', 'LOG_USER_MOVE_POSTS', $user_row['username'], $forum_info['forum_name']); - add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_info['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS', false, array($user_row['username'], $forum_info['forum_name'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS_USER', false, array( + 'reportee_id' => $user_id, + $forum_info['forum_name'] + )); trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -743,7 +790,7 @@ class acp_users { remove_newly_registered($user_id, $user_row); - add_log('admin', 'LOG_USER_REMOVED_NR', $user_row['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REMOVED_NR', false, array($user_row['username'])); trigger_error($user->lang['USER_LIFTED_NR'] . adm_back_link($this->u_action . '&u=' . $user_id)); } else @@ -766,7 +813,7 @@ class acp_users * @event core.acp_users_overview_run_quicktool * @var array user_row Current user data * @var string action Quick tool that should be run - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('action', 'user_row'); extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars))); @@ -775,9 +822,9 @@ class acp_users // Handle registration info updates $data = array( - 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), - 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), - 'email' => strtolower(request_var('user_email', $user_row['user_email'])), + 'username' => $request->variable('user', $user_row['username'], true), + 'user_founder' => $request->variable('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), + 'email' => strtolower($request->variable('user_email', $user_row['user_email'])), 'new_password' => $request->variable('new_password', '', true), 'password_confirm' => $request->variable('password_confirm', '', true), ); @@ -807,7 +854,7 @@ class acp_users $check_ary += array( 'email' => array( array('string', false, 6, 60), - array('email', $user_row['user_email']) + array('user_email', $user_row['user_email']), ), ); } @@ -825,6 +872,7 @@ class acp_users } // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ $passwords_manager = $phpbb_container->get('passwords.manager'); // Which updates do we need to do? @@ -887,7 +935,7 @@ class acp_users * @var array user_row Current user data * @var array data Submitted user data * @var array sql_ary User data we udpate - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('user_row', 'data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_modify_data', compact($vars))); @@ -897,7 +945,11 @@ class acp_users $sql_ary['username'] = $update_username; $sql_ary['username_clean'] = utf8_clean_string($update_username); - add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array( + 'reportee_id' => $user_id, + $user_row['username'], + $update_username + )); } if ($update_email !== false) @@ -907,7 +959,12 @@ class acp_users 'user_email_hash' => phpbb_email_hash($update_email), ); - add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( + 'reportee_id' => $user_id, + $user_row['username'], + $user_row['user_email'], + $update_email + )); } if ($update_password) @@ -915,11 +972,14 @@ class acp_users $sql_ary += array( 'user_password' => $passwords_manager->hash($data['new_password']), 'user_passchg' => time(), - 'user_pass_convert' => 0, ); $user->reset_login_keys($user_id); - add_log('user', $user_id, 'LOG_USER_NEW_PASSWORD', $user_row['username']); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( + 'reportee_id' => $user_id, + $user_row['username'] + )); } if (sizeof($sql_ary)) @@ -938,7 +998,7 @@ class acp_users // Let the users permissions being updated $auth->acl_clear_prefetch($user_id); - add_log('admin', 'LOG_USER_USER_UPDATE', $data['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_USER_UPDATE', false, array($data['username'])); trigger_error($user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } @@ -1002,7 +1062,7 @@ class acp_users * @event core.acp_users_display_overview * @var array user_row Array with user data * @var array quick_tool_ary Ouick tool options - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('user_row', 'quick_tool_ary'); extract($phpbb_dispatcher->trigger_event('core.acp_users_display_overview', compact($vars))); @@ -1013,7 +1073,7 @@ class acp_users $s_action_options .= '<option value="' . $value . '">' . $user->lang['USER_ADMIN_' . $lang] . '</option>'; } - $last_visit = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; + $last_active = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; $inactive_reason = ''; if ($user_row['user_type'] == USER_INACTIVE) @@ -1044,7 +1104,7 @@ class acp_users $sql = 'SELECT COUNT(post_id) as posts_in_queue FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $user_id . ' - AND post_visibility = ' . ITEM_UNAPPROVED; + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); $result = $db->sql_query($sql); $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); @@ -1072,6 +1132,7 @@ class acp_users 'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'), 'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}", 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', + 'U_SEARCH_USER' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$user_row['user_id']}&sr=posts") : '', 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_row['user_id']}&hash=" . generate_link_hash('switchperm')) : '', @@ -1079,7 +1140,7 @@ class acp_users 'USER' => $user_row['username'], 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), 'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'], - 'USER_LASTACTIVE' => ($last_visit) ? $user->format_date($last_visit) : ' - ', + 'USER_LASTACTIVE' => ($last_active) ? $user->format_date($last_active) : ' - ', 'USER_EMAIL' => $user_row['user_email'], 'USER_WARNINGS' => $user_row['user_warnings'], 'USER_POSTS' => $user_row['user_posts'], @@ -1094,17 +1155,19 @@ class acp_users $user->add_lang('mcp'); // Set up general vars - $start = request_var('start', 0); + $start = $request->variable('start', 0); $deletemark = (isset($_POST['delmarked'])) ? true : false; $deleteall = (isset($_POST['delall'])) ? true : false; - $marked = request_var('mark', array(0)); - $message = utf8_normalize_nfc(request_var('message', '', true)); + $marked = $request->variable('mark', array(0)); + $message = $request->variable('message', '', true); + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); // Sort keys - $sort_days = request_var('st', 0); - $sort_key = request_var('sk', 't'); - $sort_dir = request_var('sd', 'd'); + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); // Delete entries if requested and able if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) @@ -1134,7 +1197,7 @@ class acp_users $where_sql"; $db->sql_query($sql); - add_log('admin', 'LOG_CLEAR_USER', $user_row['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($user_row['username'])); } } @@ -1145,9 +1208,16 @@ class acp_users trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - add_log('admin', 'LOG_USER_FEEDBACK', $user_row['username']); - add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $user_row['username']); - add_log('user', $user_id, 'LOG_USER_GENERAL', $message); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($user_row['username'])); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $user_row['username'] + )); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array( + 'reportee_id' => $user_id, + $message + )); trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } @@ -1198,17 +1268,10 @@ class acp_users $user->add_lang('mcp'); // Set up general vars - $start = request_var('start', 0); $deletemark = (isset($_POST['delmarked'])) ? true : false; $deleteall = (isset($_POST['delall'])) ? true : false; $confirm = (isset($_POST['confirm'])) ? true : false; - $marked = request_var('mark', array(0)); - $message = utf8_normalize_nfc(request_var('message', '', true)); - - // Sort keys - $sort_days = request_var('st', 0); - $sort_key = request_var('sk', 't'); - $sort_dir = request_var('sd', 'd'); + $marked = $request->variable('mark', array(0)); // Delete entries if requested and able if ($deletemark || $deleteall || $confirm) @@ -1216,8 +1279,8 @@ class acp_users if (confirm_box(true)) { $where_sql = ''; - $deletemark = request_var('delmarked', 0); - $deleteall = request_var('delall', 0); + $deletemark = $request->variable('delmarked', 0); + $deleteall = $request->variable('delall', 0); if ($deletemark && $marked) { $where_sql = ' AND ' . $db->sql_in_set('warning_id', array_values($marked)); @@ -1246,17 +1309,13 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); - switch ($log_warnings) + if ($log_warnings) { - case 2: - add_log('admin', 'LOG_WARNINGS_DELETED', $user_row['username'], $num_warnings); - break; - case 1: - add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']); - break; - default: - add_log('admin', 'LOG_WARNINGS_DELETED_ALL', $user_row['username']); - break; + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED', false, array($user_row['username'], $num_warnings)); + } + else + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED_ALL', false, array($user_row['username'])); } } } @@ -1326,7 +1385,6 @@ class acp_users } } - $template->assign_block_vars('warn', array( 'ID' => $row['warning_id'], 'USERNAME' => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-', @@ -1344,8 +1402,12 @@ class acp_users case 'profile': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); $cp_data = $cp_error = array(); @@ -1360,12 +1422,7 @@ class acp_users $user_row['iso_lang_id'] = $row['lang_id']; $data = array( - 'icq' => request_var('icq', $user_row['user_icq']), - 'aim' => request_var('aim', $user_row['user_aim']), - 'msn' => request_var('msn', $user_row['user_msnm']), - 'yim' => request_var('yim', $user_row['user_yim']), - 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), - 'website' => request_var('website', $user_row['user_website']), + 'jabber' => $request->variable('jabber', $user_row['user_jabber'], true), 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0, @@ -1376,27 +1433,30 @@ class acp_users list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user_row['user_birthday']); } - $data['bday_day'] = request_var('bday_day', $data['bday_day']); - $data['bday_month'] = request_var('bday_month', $data['bday_month']); - $data['bday_year'] = request_var('bday_year', $data['bday_year']); + $data['bday_day'] = $request->variable('bday_day', $data['bday_day']); + $data['bday_month'] = $request->variable('bday_month', $data['bday_month']); + $data['bday_year'] = $request->variable('bday_year', $data['bday_year']); $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); + /** + * Modify user data on editing profile in ACP + * + * @event core.acp_users_modify_profile + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var int user_id The user id + * @var array user_row Array with the full user data + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'user_id', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_profile', compact($vars))); if ($submit) { $error = validate_data($data, array( - 'icq' => array( - array('string', true, 3, 15), - array('match', true, '#^[0-9]+$#i')), - 'aim' => array('string', true, 3, 255), - 'msn' => array('string', true, 5, 255), 'jabber' => array( array('string', true, 5, 255), array('jabber')), - 'yim' => array('string', true, 5, 255), - 'website' => array( - array('string', true, 12, 255), - array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())), @@ -1415,18 +1475,39 @@ class acp_users $error[] = 'FORM_INVALID'; } + /** + * Validate profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_validate + * @var bool submit Flag indicating if submit button has been pressed + * @var array data Array with user profile data + * @var array error Array with the form errors + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); + if (!sizeof($error)) { $sql_ary = array( - 'user_icq' => $data['icq'], - 'user_aim' => $data['aim'], - 'user_msnm' => $data['msn'], - 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], - 'user_website' => $data['website'], 'user_birthday' => $data['user_birthday'], ); + /** + * Modify profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_modify_sql_ary + * @var array cp_data Array with the user custom profile fields data + * @var array data Array with user profile data + * @var int user_id The user id + * @var array user_row Array with the full user data + * @var array sql_ary Array with sql data + * @since 3.1.4-RC1 + */ + $vars = array('cp_data', 'data', 'user_id', 'user_row', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $user_id"; @@ -1455,7 +1536,6 @@ class acp_users $selected = ($i == $data['bday_month']) ? ' selected="selected"' : ''; $s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>"; } - $s_birthday_year_options = ''; $now = getdate(); $s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>'; @@ -1467,13 +1547,7 @@ class acp_users unset($now); $template->assign_vars(array( - 'ICQ' => $data['icq'], - 'YIM' => $data['yim'], - 'AIM' => $data['aim'], - 'MSN' => $data['msn'], 'JABBER' => $data['jabber'], - 'WEBSITE' => $data['website'], - 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, @@ -1490,45 +1564,59 @@ class acp_users case 'prefs': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $data = array( - 'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)), - 'lang' => basename(request_var('lang', $user_row['user_lang'])), - 'tz' => request_var('tz', $user_row['user_timezone']), - 'style' => request_var('style', $user_row['user_style']), - 'viewemail' => request_var('viewemail', $user_row['user_allow_viewemail']), - 'massemail' => request_var('massemail', $user_row['user_allow_massemail']), - 'hideonline' => request_var('hideonline', !$user_row['user_allow_viewonline']), - 'notifymethod' => request_var('notifymethod', $user_row['user_notify_type']), - 'notifypm' => request_var('notifypm', $user_row['user_notify_pm']), - 'allowpm' => request_var('allowpm', $user_row['user_allow_pm']), - - 'topic_sk' => request_var('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), - 'topic_sd' => request_var('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'), - 'topic_st' => request_var('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0), - - 'post_sk' => request_var('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'), - 'post_sd' => request_var('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'), - 'post_st' => request_var('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0), - - 'view_images' => request_var('view_images', $this->optionget($user_row, 'viewimg')), - 'view_flash' => request_var('view_flash', $this->optionget($user_row, 'viewflash')), - 'view_smilies' => request_var('view_smilies', $this->optionget($user_row, 'viewsmilies')), - 'view_sigs' => request_var('view_sigs', $this->optionget($user_row, 'viewsigs')), - 'view_avatars' => request_var('view_avatars', $this->optionget($user_row, 'viewavatars')), - 'view_wordcensor' => request_var('view_wordcensor', $this->optionget($user_row, 'viewcensors')), - - 'bbcode' => request_var('bbcode', $this->optionget($user_row, 'bbcode')), - 'smilies' => request_var('smilies', $this->optionget($user_row, 'smilies')), - 'sig' => request_var('sig', $this->optionget($user_row, 'attachsig')), - 'notify' => request_var('notify', $user_row['user_notify']), + 'dateformat' => $request->variable('dateformat', $user_row['user_dateformat'], true), + 'lang' => basename($request->variable('lang', $user_row['user_lang'])), + 'tz' => $request->variable('tz', $user_row['user_timezone']), + 'style' => $request->variable('style', $user_row['user_style']), + 'viewemail' => $request->variable('viewemail', $user_row['user_allow_viewemail']), + 'massemail' => $request->variable('massemail', $user_row['user_allow_massemail']), + 'hideonline' => $request->variable('hideonline', !$user_row['user_allow_viewonline']), + 'notifymethod' => $request->variable('notifymethod', $user_row['user_notify_type']), + 'notifypm' => $request->variable('notifypm', $user_row['user_notify_pm']), + 'allowpm' => $request->variable('allowpm', $user_row['user_allow_pm']), + + 'topic_sk' => $request->variable('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), + 'topic_sd' => $request->variable('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'), + 'topic_st' => $request->variable('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0), + + 'post_sk' => $request->variable('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'), + 'post_sd' => $request->variable('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'), + 'post_st' => $request->variable('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0), + + 'view_images' => $request->variable('view_images', $this->optionget($user_row, 'viewimg')), + 'view_flash' => $request->variable('view_flash', $this->optionget($user_row, 'viewflash')), + 'view_smilies' => $request->variable('view_smilies', $this->optionget($user_row, 'viewsmilies')), + 'view_sigs' => $request->variable('view_sigs', $this->optionget($user_row, 'viewsigs')), + 'view_avatars' => $request->variable('view_avatars', $this->optionget($user_row, 'viewavatars')), + 'view_wordcensor' => $request->variable('view_wordcensor', $this->optionget($user_row, 'viewcensors')), + + 'bbcode' => $request->variable('bbcode', $this->optionget($user_row, 'bbcode')), + 'smilies' => $request->variable('smilies', $this->optionget($user_row, 'smilies')), + 'sig' => $request->variable('sig', $this->optionget($user_row, 'attachsig')), + 'notify' => $request->variable('notify', $user_row['user_notify']), ); + /** + * Modify users preferences data + * + * @event core.acp_users_prefs_modify_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_data', compact($vars))); + if ($submit) { $error = validate_data($data, array( - 'dateformat' => array('string', false, 1, 30), + 'dateformat' => array('string', false, 1, 64), 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), 'tz' => array('timezone'), @@ -1581,37 +1669,53 @@ class acp_users 'user_notify' => $data['notify'], ); - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " - WHERE user_id = $user_id"; - $db->sql_query($sql); + /** + * Modify SQL query before users preferences are updated + * + * @event core.acp_users_prefs_modify_sql + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array sql_ary SQL array with users preferences data to update + * @var array error Array with errors data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'sql_ary', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_sql', compact($vars))); - // Check if user has an active session - if ($user_row['session_id']) + if (!sizeof($error)) { - // We'll update the session if user_allow_viewonline has changed and the user is a bot - // Or if it's a regular user and the admin set it to hide the session - if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE - || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Check if user has an active session + if ($user_row['session_id']) { - // We also need to check if the user has the permission to cloak. - $user_auth = new \phpbb\auth\auth(); - $user_auth->acl($user_row); + // We'll update the session if user_allow_viewonline has changed and the user is a bot + // Or if it's a regular user and the admin set it to hide the session + if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE + || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) + { + // We also need to check if the user has the permission to cloak. + $user_auth = new \phpbb\auth\auth(); + $user_auth->acl($user_row); - $session_sql_ary = array( - 'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true, - ); + $session_sql_ary = array( + 'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true, + ); - $sql = 'UPDATE ' . SESSIONS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . " - WHERE session_user_id = $user_id"; - $db->sql_query($sql); + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . " + WHERE session_user_id = $user_id"; + $db->sql_query($sql); - unset($user_auth); + unset($user_auth); + } } - } - trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } } // Replace "error" strings with their real, localised form @@ -1674,8 +1778,8 @@ class acp_users ${'s_sort_' . $sort_option . '_dir'} .= '</select>'; } - $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); - $template->assign_vars(array( + phpbb_timezone_select($template, $user, $data['tz'], true); + $user_prefs_data = array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, @@ -1713,21 +1817,31 @@ class acp_users 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']), - 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], - 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], - ) ); + /** + * Modify users preferences data before assigning it to the template + * + * @event core.acp_users_prefs_modify_template_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array user_prefs_data Array with users preferences data to be assigned to the template + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'user_prefs_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_template_data', compact($vars))); + + $template->assign_vars($user_prefs_data); + break; case 'avatar': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - $avatars_enabled = false; if ($config['allow_avatar']) { + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); @@ -1763,29 +1877,6 @@ class acp_users trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } } - else - { - $driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']); - if ($driver) - { - $driver->delete($avatar_data); - } - - // Removing the avatar - $result = array( - 'user_avatar' => '', - 'user_avatar_type' => '', - 'user_avatar_width' => 0, - 'user_avatar_height' => 0, - ); - - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $result) . ' - WHERE user_id = ' . (int) $user_id; - - $db->sql_query($sql); - trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); - } } else { @@ -1793,6 +1884,23 @@ class acp_users } } + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (!confirm_box(true)) + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true)) + ); + } + else + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_'); + + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); foreach ($avatar_drivers as $current_driver) @@ -1800,9 +1908,8 @@ class acp_users $driver = $phpbb_avatar_manager->get_driver($current_driver); $avatars_enabled = true; - $config_name = $phpbb_avatar_manager->get_driver_config_name($driver); $template->set_filenames(array( - 'avatar' => "acp_avatar_options_{$config_name}.html", + 'avatar' => $driver->get_acp_template_name(), )); if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) @@ -1850,7 +1957,7 @@ class acp_users trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - $rank_id = request_var('user_rank', 0); + $rank_id = $request->variable('user_rank', 0); $sql = 'UPDATE ' . USERS_TABLE . " SET user_rank = $rank_id @@ -1884,50 +1991,70 @@ class acp_users case 'sig': - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); - - $enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false; - $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false; - $enable_urls = ($config['allow_sig_links']) ? (bool) $this->optionget($user_row, 'sig_links') : false; - $signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true)); - - $preview = (isset($_POST['preview'])) ? true : false; - - if ($submit || $preview) + if (!function_exists('display_custom_bbcodes')) { - include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); - - $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false; - $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false; - $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } - $message_parser = new parse_message($signature); + $enable_bbcode = ($config['allow_sig_bbcode']) ? $this->optionget($user_row, 'sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? $this->optionget($user_row, 'sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? $this->optionget($user_row, 'sig_links') : false; - // Allowing Quote BBCode - $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); + $decoded_message = generate_text_for_edit($user_row['user_sig'], $user_row['user_sig_bbcode_uid'], $user_row['user_sig_bbcode_bitfield']); + $signature = $request->variable('signature', $decoded_message['text'], true); + $signature_preview = ''; - if (sizeof($message_parser->warn_msg)) - { - $error[] = implode('<br />', $message_parser->warn_msg); - } + if ($submit || $request->is_set_post('preview')) + { + $enable_bbcode = ($config['allow_sig_bbcode']) ? !$request->variable('disable_bbcode', false) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? !$request->variable('disable_smilies', false) : false; + $enable_urls = ($config['allow_sig_links']) ? !$request->variable('disable_magic_url', false) : false; if (!check_form_key($form_name)) { - $error = 'FORM_INVALID'; + $error[] = 'FORM_INVALID'; } + } + + $bbcode_uid = $bbcode_bitfield = $bbcode_flags = ''; + $warn_msg = generate_text_for_storage( + $signature, + $bbcode_uid, + $bbcode_bitfield, + $bbcode_flags, + $enable_bbcode, + $enable_urls, + $enable_smilies, + $config['allow_sig_img'], + $config['allow_sig_flash'], + true, + $config['allow_sig_links'], + 'sig' + ); - if (!sizeof($error) && $submit) + if (sizeof($warn_msg)) + { + $error += $warn_msg; + } + + if (!$submit) + { + // Parse it for displaying + $signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags); + } + else + { + if (!sizeof($error)) { $this->optionset($user_row, 'sig_bbcode', $enable_bbcode); $this->optionset($user_row, 'sig_smilies', $enable_smilies); $this->optionset($user_row, 'sig_links', $enable_urls); $sql_ary = array( - 'user_sig' => (string) $message_parser->message, + 'user_sig' => $signature, 'user_options' => $user_row['user_options'], - 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, - 'user_sig_bbcode_bitfield' => (string) $message_parser->bbcode_bitfield + 'user_sig_bbcode_uid' => $bbcode_uid, + 'user_sig_bbcode_bitfield' => $bbcode_bitfield, ); $sql = 'UPDATE ' . USERS_TABLE . ' @@ -1937,33 +2064,27 @@ class acp_users trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } - - // Replace "error" strings with their real, localised form - $error = array_map(array($user, 'lang'), $error); } - $signature_preview = ''; + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); - if ($preview) - { - // Now parse it for displaying - $signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); - unset($message_parser); - } + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield); - decode_message($signature, $user_row['user_sig_bbcode_uid']); + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); $template->assign_vars(array( 'S_SIGNATURE' => true, - 'SIGNATURE' => $signature, + 'SIGNATURE' => $decoded_message['text'], 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], @@ -1984,15 +2105,16 @@ class acp_users break; case 'attach': + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); - $start = request_var('start', 0); + $start = $request->variable('start', 0); $deletemark = (isset($_POST['delmarked'])) ? true : false; - $marked = request_var('mark', array(0)); - $pagination = $phpbb_container->get('pagination'); + $marked = $request->variable('mark', array(0)); // Sort keys - $sort_key = request_var('sk', 'a'); - $sort_dir = request_var('sd', 'd'); + $sort_key = $request->variable('sk', 'a'); + $sort_dir = $request->variable('sd', 'd'); if ($deletemark && sizeof($marked)) { @@ -2027,11 +2149,14 @@ class acp_users } $db->sql_freeresult($result); - delete_attachments('attach', $marked); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', $marked); + unset($attachment_manager); $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; - add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode($user->lang['COMMA_SEPARATOR'], $log_attachments)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode($user->lang['COMMA_SEPARATOR'], $log_attachments))); trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); } else @@ -2090,7 +2215,7 @@ class acp_users WHERE a.poster_id = ' . $user_id . " AND a.is_orphan = 0 ORDER BY $order_by"; - $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start); + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); while ($row = $db->sql_fetchrow($result)) { @@ -2137,10 +2262,13 @@ class acp_users case 'groups': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('group_user_attributes')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $user->add_lang(array('groups', 'acp/groups')); - $group_id = request_var('g', 0); + $group_id = $request->variable('g', 0); if ($group_id) { @@ -2157,10 +2285,6 @@ class acp_users trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } } - else - { - $founder_manage = 0; - } switch ($action) { @@ -2265,6 +2389,8 @@ class acp_users $error = array(); } + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); $sql = 'SELECT ug.*, g.* FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug @@ -2310,7 +2436,7 @@ class acp_users continue; } - $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -2354,14 +2480,17 @@ class acp_users case 'perm': - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } $auth_admin = new auth_admin(); $user->add_lang('acp/permissions'); add_permission_language(); - $forum_id = request_var('f', 0); + $forum_id = $request->variable('f', 0); // Global Permissions if (!$forum_id) @@ -2369,7 +2498,7 @@ class acp_users // Select auth options $sql = 'SELECT auth_option, is_local, is_global FROM ' . ACL_OPTIONS_TABLE . ' - WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . ' + WHERE auth_option ' . $db->sql_like_expression($db->get_any_char() . '_') . ' AND is_global = 1 ORDER BY auth_option'; $result = $db->sql_query($sql); @@ -2389,7 +2518,7 @@ class acp_users { $sql = 'SELECT auth_option, is_local, is_global FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . " + WHERE auth_option " . $db->sql_like_expression($db->get_any_char() . '_') . " AND is_local = 1 ORDER BY is_global DESC, auth_option"; $result = $db->sql_query($sql); diff --git a/phpBB/includes/acp/acp_words.php b/phpBB/includes/acp/acp_words.php index d8d14ba4ad..e5eeb7ab07 100644 --- a/phpBB/includes/acp/acp_words.php +++ b/phpBB/includes/acp/acp_words.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * @todo [words] check regular expressions for special char replacements (stored specialchared in db) -* @package acp */ class acp_words { @@ -25,13 +28,12 @@ class acp_words function main($id, $mode) { - global $db, $user, $auth, $template, $cache; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $template, $cache, $phpbb_log, $request, $phpbb_container; $user->add_lang('acp/posting'); // Set up general vars - $action = request_var('action', ''); + $action = $request->variable('action', ''); $action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $action); $s_hidden_fields = ''; @@ -47,7 +49,7 @@ class acp_words { case 'edit': - $word_id = request_var('id', 0); + $word_id = $request->variable('id', 0); if (!$word_id) { @@ -85,9 +87,9 @@ class acp_words trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } - $word_id = request_var('id', 0); - $word = utf8_normalize_nfc(request_var('word', '', true)); - $replacement = utf8_normalize_nfc(request_var('replacement', '', true)); + $word_id = $request->variable('id', 0); + $word = $request->variable('word', '', true); + $replacement = $request->variable('replacement', '', true); if ($word === '' || $replacement === '') { @@ -101,7 +103,7 @@ class acp_words 'word' => $word, 'replacement' => $replacement ); - + if ($word_id) { $db->sql_query('UPDATE ' . WORDS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE word_id = ' . $word_id); @@ -112,9 +114,11 @@ class acp_words } $cache->destroy('_word_censors'); + $phpbb_container->get('text_formatter.cache')->invalidate(); $log_action = ($word_id) ? 'LOG_WORD_EDIT' : 'LOG_WORD_ADD'; - add_log('admin', $log_action, $word); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($word)); $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; trigger_error($message . adm_back_link($this->u_action)); @@ -123,7 +127,7 @@ class acp_words case 'delete': - $word_id = request_var('id', 0); + $word_id = $request->variable('id', 0); if (!$word_id) { @@ -144,8 +148,9 @@ class acp_words $db->sql_query($sql); $cache->destroy('_word_censors'); + $phpbb_container->get('text_formatter.cache')->invalidate(); - add_log('admin', 'LOG_WORD_DELETE', $deleted_word); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WORD_DELETE', false, array($deleted_word)); trigger_error($user->lang['WORD_REMOVED'] . adm_back_link($this->u_action)); } @@ -162,7 +167,6 @@ class acp_words break; } - $template->assign_vars(array( 'U_ACTION' => $this->u_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields) diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index a023bced0a..11478842d7 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * ACP Permission/Auth class -* @package phpBB3 */ class auth_admin extends \phpbb\auth\auth { @@ -139,7 +142,6 @@ class auth_admin extends \phpbb\auth\auth $auth2 = &$auth; } - $hold_ary[$userdata['user_id']] = array(); foreach ($forum_ids as $f_id) { @@ -181,7 +183,10 @@ class auth_admin extends \phpbb\auth\auth } // Defining the user-function here to save some memory - $return_acl_fill = create_function('$value', 'return ' . $acl_fill . ';'); + $return_acl_fill = function () use ($acl_fill) + { + return $acl_fill; + }; // Actually fill the gaps if (sizeof($hold_ary)) @@ -261,9 +266,14 @@ class auth_admin extends \phpbb\auth\auth */ function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true) { - global $template, $user, $db, $phpbb_root_path, $phpEx, $phpbb_container; + global $template, $user, $db, $phpbb_container; + + /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + // Define names for template loops, might be able to be set $tpl_pmask = 'p_mask'; $tpl_fmask = 'f_mask'; @@ -295,7 +305,7 @@ class auth_admin extends \phpbb\auth\auth $ug_names_ary = array(); while ($row = $db->sql_fetchrow($result)) { - $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['ug_name']] : $row['ug_name']); + $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : $group_helper->get_name($row['ug_name']); } $db->sql_freeresult($result); @@ -403,14 +413,7 @@ class auth_admin extends \phpbb\auth\auth { foreach ($memberships as $row) { - if ($groups[$row['group_id']]['group_type'] == GROUP_SPECIAL) - { - $user_groups_default[$row['user_id']][] = $user->lang['G_' . $groups[$row['group_id']]['group_name']]; - } - else - { - $user_groups_custom[$row['user_id']][] = $groups[$row['group_id']]['group_name']; - } + $user_groups_default[$row['user_id']][] = $group_helper->get_name($groups[$row['group_id']]['group_name']); } } unset($memberships, $groups); @@ -463,7 +466,8 @@ class auth_admin extends \phpbb\auth\auth // Build role dropdown options $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; - $s_role_options = ''; + // Output current role id to template + $template->assign_var('S_ROLE_ID', $current_role_id); @reset($roles); while (list($role_id, $role_row) = each($roles)) @@ -471,13 +475,12 @@ class auth_admin extends \phpbb\auth\auth $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; - $title = ($role_description) ? ' title="' . $role_description . '"' : ''; - $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; - } - - if ($s_role_options) - { - $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars($user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; + $template->assign_block_vars('role_options', array( + 'ID' => $role_id, + 'ROLE_NAME' => $role_name, + 'TITLE' => $role_description, + 'SELECTED' => $role_id == $current_role_id, + )); } if (!$current_role_id && $mode != 'view') @@ -500,7 +503,6 @@ class auth_admin extends \phpbb\auth\auth $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( 'NAME' => $ug_names_ary[$ug_id], - 'S_ROLE_OPTIONS' => $s_role_options, 'UG_ID' => $ug_id, 'S_CUSTOM' => $s_custom_permissions, 'FORUM_ID' => $forum_id) @@ -549,7 +551,8 @@ class auth_admin extends \phpbb\auth\auth // Build role dropdown options $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; - $s_role_options = ''; + // Output current role id to template + $template->assign_var('S_ROLE_ID', $current_role_id); @reset($roles); while (list($role_id, $role_row) = each($roles)) @@ -557,13 +560,12 @@ class auth_admin extends \phpbb\auth\auth $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; - $title = ($role_description) ? ' title="' . $role_description . '"' : ''; - $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; - } - - if ($s_role_options) - { - $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars($user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; + $template->assign_block_vars('role_options', array( + 'ID' => $role_id, + 'ROLE_NAME' => $role_name, + 'TITLE' => $role_description, + 'SELECTED' => $role_id == $current_role_id, + )); } if (!$current_role_id && $mode != 'view') @@ -587,7 +589,6 @@ class auth_admin extends \phpbb\auth\auth $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'], 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'], - 'S_ROLE_OPTIONS' => $s_role_options, 'S_CUSTOM' => $s_custom_permissions, 'UG_ID' => $ug_id, 'FORUM_ID' => $forum_id) @@ -606,13 +607,17 @@ class auth_admin extends \phpbb\auth\auth */ function display_role_mask(&$hold_ary) { - global $db, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $template, $user, $phpbb_root_path, $phpEx; + global $phpbb_container; if (!sizeof($hold_ary)) { return; } + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + // Get forum names $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' @@ -649,9 +654,9 @@ class auth_admin extends \phpbb\auth\auth { $template->assign_block_vars('role_mask.users', array( 'USER_ID' => $row['user_id'], - 'USERNAME' => $row['username'], - 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u={$row['user_id']}")) - ); + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username']), + 'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username']), + )); } $db->sql_freeresult($result); } @@ -668,7 +673,7 @@ class auth_admin extends \phpbb\auth\auth { $template->assign_block_vars('role_mask.groups', array( 'GROUP_ID' => $row['group_id'], - 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=group&g={$row['group_id']}")) ); } @@ -833,7 +838,7 @@ class auth_admin extends \phpbb\auth\auth } // Remove current auth options... - $auth_option_ids = array((int)$any_option_id); + $auth_option_ids = array((int) $any_option_id); foreach ($auth as $auth_option => $auth_setting) { $auth_option_ids[] = (int) $this->acl_options['id'][$auth_option]; @@ -1022,7 +1027,7 @@ class auth_admin extends \phpbb\auth\auth // Get permission type $sql = 'SELECT auth_option, auth_option_id FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char); + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()); $result = $db->sql_query($sql); $auth_id_ary = array(); @@ -1101,13 +1106,19 @@ class auth_admin extends \phpbb\auth\auth */ function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $s_view, $show_trace = false) { - global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container; + global $template, $phpbb_admin_path, $phpEx, $phpbb_container; + /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); @reset($category_array); while (list($cat, $cat_array) = each($category_array)) { + if (!$phpbb_permissions->category_defined($cat)) + { + continue; + } + $template->assign_block_vars($tpl_cat, array( 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, @@ -1134,6 +1145,11 @@ class auth_admin extends \phpbb\auth\auth @reset($cat_array['permissions']); while (list($permission, $allowed) = each($cat_array['permissions'])) { + if (!$phpbb_permissions->permission_defined($permission)) + { + continue; + } + if ($s_view) { $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( @@ -1179,8 +1195,9 @@ class auth_admin extends \phpbb\auth\auth */ function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array) { - global $user, $phpbb_container; + global $phpbb_container; + /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); foreach ($key_sort_array as $forum_id) diff --git a/phpBB/includes/acp/info/acp_attachments.php b/phpBB/includes/acp/info/acp_attachments.php index 8fad241451..057f08201e 100644 --- a/phpBB/includes/acp/info/acp_attachments.php +++ b/phpBB/includes/acp/info/acp_attachments.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_attachments_info { function module() @@ -17,7 +18,6 @@ class acp_attachments_info return array( 'filename' => 'acp_attachments', 'title' => 'ACP_ATTACHMENTS', - 'version' => '1.0.0', 'modes' => array( 'attach' => array('title' => 'ACP_ATTACHMENT_SETTINGS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_BOARD_CONFIGURATION', 'ACP_ATTACHMENTS')), 'extensions' => array('title' => 'ACP_MANAGE_EXTENSIONS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_ATTACHMENTS')), diff --git a/phpBB/includes/acp/info/acp_ban.php b/phpBB/includes/acp/info/acp_ban.php index 37f0f021a7..c88f4c2ebb 100644 --- a/phpBB/includes/acp/info/acp_ban.php +++ b/phpBB/includes/acp/info/acp_ban.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_ban_info { function module() @@ -17,7 +18,6 @@ class acp_ban_info return array( 'filename' => 'acp_ban', 'title' => 'ACP_BAN', - 'version' => '1.0.0', 'modes' => array( 'email' => array('title' => 'ACP_BAN_EMAILS', 'auth' => 'acl_a_ban', 'cat' => array('ACP_USER_SECURITY')), 'ip' => array('title' => 'ACP_BAN_IPS', 'auth' => 'acl_a_ban', 'cat' => array('ACP_USER_SECURITY')), diff --git a/phpBB/includes/acp/info/acp_bbcodes.php b/phpBB/includes/acp/info/acp_bbcodes.php index 5c88ca8a0f..dfcd43a8ac 100644 --- a/phpBB/includes/acp/info/acp_bbcodes.php +++ b/phpBB/includes/acp/info/acp_bbcodes.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_bbcodes_info { function module() @@ -17,7 +18,6 @@ class acp_bbcodes_info return array( 'filename' => 'acp_bbcodes', 'title' => 'ACP_BBCODES', - 'version' => '1.0.0', 'modes' => array( 'bbcodes' => array('title' => 'ACP_BBCODES', 'auth' => 'acl_a_bbcode', 'cat' => array('ACP_MESSAGES')), ), diff --git a/phpBB/includes/acp/info/acp_board.php b/phpBB/includes/acp/info/acp_board.php index 50d5a4f4e1..1a3ee7b6be 100644 --- a/phpBB/includes/acp/info/acp_board.php +++ b/phpBB/includes/acp/info/acp_board.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_board_info { function module() @@ -17,7 +18,6 @@ class acp_board_info return array( 'filename' => 'acp_board', 'title' => 'ACP_BOARD_MANAGEMENT', - 'version' => '1.0.0', 'modes' => array( 'settings' => array('title' => 'ACP_BOARD_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 'features' => array('title' => 'ACP_BOARD_FEATURES', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), diff --git a/phpBB/includes/acp/info/acp_bots.php b/phpBB/includes/acp/info/acp_bots.php index c30ab588ab..26782d8c0b 100644 --- a/phpBB/includes/acp/info/acp_bots.php +++ b/phpBB/includes/acp/info/acp_bots.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_bots_info { function module() @@ -17,7 +18,6 @@ class acp_bots_info return array( 'filename' => 'acp_bots', 'title' => 'ACP_BOTS', - 'version' => '1.0.0', 'modes' => array( 'bots' => array('title' => 'ACP_BOTS', 'auth' => 'acl_a_bots', 'cat' => array('ACP_GENERAL_TASKS')), ), diff --git a/phpBB/includes/acp/info/acp_captcha.php b/phpBB/includes/acp/info/acp_captcha.php index 3f31b4c102..3f7bf0351d 100644 --- a/phpBB/includes/acp/info/acp_captcha.php +++ b/phpBB/includes/acp/info/acp_captcha.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_captcha_info { function module() @@ -17,7 +18,6 @@ class acp_captcha_info return array( 'filename' => 'acp_captcha', 'title' => 'ACP_CAPTCHA', - 'version' => '1.0.0', 'modes' => array( 'visual' => array('title' => 'ACP_VC_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 'img' => array('title' => 'ACP_VC_CAPTCHA_DISPLAY', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION'), 'display' => false) diff --git a/phpBB/includes/acp/info/acp_contact.php b/phpBB/includes/acp/info/acp_contact.php new file mode 100644 index 0000000000..548eb52816 --- /dev/null +++ b/phpBB/includes/acp/info/acp_contact.php @@ -0,0 +1,30 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @package module_install +*/ +class acp_contact_info +{ + public function module() + { + return array( + 'filename' => 'acp_contact', + 'title' => 'ACP_CONTACT', + 'version' => '1.0.0', + 'modes' => array( + 'contact' => array('title' => 'ACP_CONTACT_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), + ), + ); + } +} diff --git a/phpBB/includes/acp/info/acp_database.php b/phpBB/includes/acp/info/acp_database.php index c8ad65e255..815db53b67 100644 --- a/phpBB/includes/acp/info/acp_database.php +++ b/phpBB/includes/acp/info/acp_database.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_database_info { function module() @@ -17,7 +18,6 @@ class acp_database_info return array( 'filename' => 'acp_database', 'title' => 'ACP_DATABASE', - 'version' => '1.0.0', 'modes' => array( 'backup' => array('title' => 'ACP_BACKUP', 'auth' => 'acl_a_backup', 'cat' => array('ACP_CAT_DATABASE')), 'restore' => array('title' => 'ACP_RESTORE', 'auth' => 'acl_a_backup', 'cat' => array('ACP_CAT_DATABASE')), diff --git a/phpBB/includes/acp/info/acp_disallow.php b/phpBB/includes/acp/info/acp_disallow.php index f9dd4c32c0..df4765b6bb 100644 --- a/phpBB/includes/acp/info/acp_disallow.php +++ b/phpBB/includes/acp/info/acp_disallow.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_disallow_info { function module() @@ -17,7 +18,6 @@ class acp_disallow_info return array( 'filename' => 'acp_disallow', 'title' => 'ACP_DISALLOW', - 'version' => '1.0.0', 'modes' => array( 'usernames' => array('title' => 'ACP_DISALLOW_USERNAMES', 'auth' => 'acl_a_names', 'cat' => array('ACP_USER_SECURITY')), ), diff --git a/phpBB/includes/acp/info/acp_email.php b/phpBB/includes/acp/info/acp_email.php index 620904c956..e85ef0923a 100644 --- a/phpBB/includes/acp/info/acp_email.php +++ b/phpBB/includes/acp/info/acp_email.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_email_info { function module() @@ -17,7 +18,6 @@ class acp_email_info return array( 'filename' => 'acp_email', 'title' => 'ACP_MASS_EMAIL', - 'version' => '1.0.0', 'modes' => array( 'email' => array('title' => 'ACP_MASS_EMAIL', 'auth' => 'acl_a_email && cfg_email_enable', 'cat' => array('ACP_GENERAL_TASKS')), ), diff --git a/phpBB/includes/acp/info/acp_extensions.php b/phpBB/includes/acp/info/acp_extensions.php index 174b365af0..9adcd543b9 100644 --- a/phpBB/includes/acp/info/acp_extensions.php +++ b/phpBB/includes/acp/info/acp_extensions.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_extensions_info { function module() @@ -17,7 +18,6 @@ class acp_extensions_info return array( 'filename' => 'acp_extensions', 'title' => 'ACP_EXTENSION_MANAGEMENT', - 'version' => '1.0.0', 'modes' => array( 'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_EXTENSION_MANAGEMENT')), ), diff --git a/phpBB/includes/acp/info/acp_forums.php b/phpBB/includes/acp/info/acp_forums.php index e5281a4e58..8b5ce7edc2 100644 --- a/phpBB/includes/acp/info/acp_forums.php +++ b/phpBB/includes/acp/info/acp_forums.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_forums_info { function module() @@ -17,7 +18,6 @@ class acp_forums_info return array( 'filename' => 'acp_forums', 'title' => 'ACP_FORUM_MANAGEMENT', - 'version' => '1.0.0', 'modes' => array( 'manage' => array('title' => 'ACP_MANAGE_FORUMS', 'auth' => 'acl_a_forum', 'cat' => array('ACP_MANAGE_FORUMS')), ), diff --git a/phpBB/includes/acp/info/acp_groups.php b/phpBB/includes/acp/info/acp_groups.php index af3f4893fd..e0aafeca0d 100644 --- a/phpBB/includes/acp/info/acp_groups.php +++ b/phpBB/includes/acp/info/acp_groups.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_groups_info { function module() @@ -17,7 +18,6 @@ class acp_groups_info return array( 'filename' => 'acp_groups', 'title' => 'ACP_GROUPS_MANAGEMENT', - 'version' => '1.0.0', 'modes' => array( 'manage' => array('title' => 'ACP_GROUPS_MANAGE', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')), 'position' => array('title' => 'ACP_GROUPS_POSITION', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')), diff --git a/phpBB/includes/acp/info/acp_icons.php b/phpBB/includes/acp/info/acp_icons.php index e0cf05660c..87eadddd8d 100644 --- a/phpBB/includes/acp/info/acp_icons.php +++ b/phpBB/includes/acp/info/acp_icons.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_icons_info { function module() @@ -17,7 +18,6 @@ class acp_icons_info return array( 'filename' => 'acp_icons', 'title' => 'ACP_ICONS_SMILIES', - 'version' => '1.0.0', 'modes' => array( 'icons' => array('title' => 'ACP_ICONS', 'auth' => 'acl_a_icons', 'cat' => array('ACP_MESSAGES')), 'smilies' => array('title' => 'ACP_SMILIES', 'auth' => 'acl_a_icons', 'cat' => array('ACP_MESSAGES')), diff --git a/phpBB/includes/acp/info/acp_inactive.php b/phpBB/includes/acp/info/acp_inactive.php index 02b1fcdaa2..38cb964735 100644 --- a/phpBB/includes/acp/info/acp_inactive.php +++ b/phpBB/includes/acp/info/acp_inactive.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_inactive_info { function module() @@ -17,7 +18,6 @@ class acp_inactive_info return array( 'filename' => 'acp_inactive', 'title' => 'ACP_INACTIVE_USERS', - 'version' => '1.0.0', 'modes' => array( 'list' => array('title' => 'ACP_INACTIVE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')), ), diff --git a/phpBB/includes/acp/info/acp_jabber.php b/phpBB/includes/acp/info/acp_jabber.php index 3ad05e1a6a..660299a12d 100644 --- a/phpBB/includes/acp/info/acp_jabber.php +++ b/phpBB/includes/acp/info/acp_jabber.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_jabber_info { function module() @@ -17,7 +18,6 @@ class acp_jabber_info return array( 'filename' => 'acp_jabber', 'title' => 'ACP_JABBER_SETTINGS', - 'version' => '1.0.0', 'modes' => array( 'settings' => array('title' => 'ACP_JABBER_SETTINGS', 'auth' => 'acl_a_jabber', 'cat' => array('ACP_CLIENT_COMMUNICATION')), ), diff --git a/phpBB/includes/acp/info/acp_language.php b/phpBB/includes/acp/info/acp_language.php index 7f33a22fa6..1a5a2b6ba8 100644 --- a/phpBB/includes/acp/info/acp_language.php +++ b/phpBB/includes/acp/info/acp_language.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_language_info { function module() @@ -17,7 +18,6 @@ class acp_language_info return array( 'filename' => 'acp_language', 'title' => 'ACP_LANGUAGE', - 'version' => '1.0.0', 'modes' => array( 'lang_packs' => array('title' => 'ACP_LANGUAGE_PACKS', 'auth' => 'acl_a_language', 'cat' => array('ACP_LANGUAGE')), ), diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php index 033f9baf50..efa35b2118 100644 --- a/phpBB/includes/acp/info/acp_logs.php +++ b/phpBB/includes/acp/info/acp_logs.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_logs_info { function module() @@ -17,7 +18,6 @@ class acp_logs_info return array( 'filename' => 'acp_logs', 'title' => 'ACP_LOGGING', - 'version' => '1.0.0', 'modes' => array( 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), diff --git a/phpBB/includes/acp/info/acp_main.php b/phpBB/includes/acp/info/acp_main.php index 4c1cb6dc0f..48d35da585 100644 --- a/phpBB/includes/acp/info/acp_main.php +++ b/phpBB/includes/acp/info/acp_main.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_main_info { function module() @@ -17,7 +18,6 @@ class acp_main_info return array( 'filename' => 'acp_main', 'title' => 'ACP_INDEX', - 'version' => '1.0.0', 'modes' => array( 'main' => array('title' => 'ACP_INDEX', 'auth' => '', 'cat' => array('ACP_CAT_GENERAL')), ), diff --git a/phpBB/includes/acp/info/acp_modules.php b/phpBB/includes/acp/info/acp_modules.php index c9d2cffa72..073e69c6a8 100644 --- a/phpBB/includes/acp/info/acp_modules.php +++ b/phpBB/includes/acp/info/acp_modules.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_modules_info { function module() @@ -17,7 +18,6 @@ class acp_modules_info return array( 'filename' => 'acp_modules', 'title' => 'ACP_MODULE_MANAGEMENT', - 'version' => '1.0.0', 'modes' => array( 'acp' => array('title' => 'ACP', 'auth' => 'acl_a_modules', 'cat' => array('ACP_MODULE_MANAGEMENT')), 'ucp' => array('title' => 'UCP', 'auth' => 'acl_a_modules', 'cat' => array('ACP_MODULE_MANAGEMENT')), diff --git a/phpBB/includes/acp/info/acp_permission_roles.php b/phpBB/includes/acp/info/acp_permission_roles.php index ee2a3ee560..34af693b7b 100644 --- a/phpBB/includes/acp/info/acp_permission_roles.php +++ b/phpBB/includes/acp/info/acp_permission_roles.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_permission_roles_info { function module() @@ -17,7 +18,6 @@ class acp_permission_roles_info return array( 'filename' => 'acp_permission_roles', 'title' => 'ACP_PERMISSION_ROLES', - 'version' => '1.0.0', 'modes' => array( 'admin_roles' => array('title' => 'ACP_ADMIN_ROLES', 'auth' => 'acl_a_roles && acl_a_aauth', 'cat' => array('ACP_PERMISSION_ROLES')), 'user_roles' => array('title' => 'ACP_USER_ROLES', 'auth' => 'acl_a_roles && acl_a_uauth', 'cat' => array('ACP_PERMISSION_ROLES')), diff --git a/phpBB/includes/acp/info/acp_permissions.php b/phpBB/includes/acp/info/acp_permissions.php index 7b51b67a96..3d415f2b72 100644 --- a/phpBB/includes/acp/info/acp_permissions.php +++ b/phpBB/includes/acp/info/acp_permissions.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_permissions_info { function module() @@ -17,7 +18,6 @@ class acp_permissions_info return array( 'filename' => 'acp_permissions', 'title' => 'ACP_PERMISSIONS', - 'version' => '1.0.0', 'modes' => array( 'intro' => array('title' => 'ACP_PERMISSIONS', 'auth' => 'acl_a_authusers || acl_a_authgroups || acl_a_viewauth', 'cat' => array('ACP_CAT_PERMISSIONS')), 'trace' => array('title' => 'ACP_PERMISSION_TRACE', 'auth' => 'acl_a_viewauth', 'display' => false, 'cat' => array('ACP_PERMISSION_MASKS')), diff --git a/phpBB/includes/acp/info/acp_php_info.php b/phpBB/includes/acp/info/acp_php_info.php index a456e4b8b7..c5e60c7e66 100644 --- a/phpBB/includes/acp/info/acp_php_info.php +++ b/phpBB/includes/acp/info/acp_php_info.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_php_info_info { function module() @@ -17,7 +18,6 @@ class acp_php_info_info return array( 'filename' => 'acp_php_info', 'title' => 'ACP_PHP_INFO', - 'version' => '1.0.0', 'modes' => array( 'info' => array('title' => 'ACP_PHP_INFO', 'auth' => 'acl_a_phpinfo', 'cat' => array('ACP_GENERAL_TASKS')), ), diff --git a/phpBB/includes/acp/info/acp_profile.php b/phpBB/includes/acp/info/acp_profile.php index 6fa673b094..ede34204b4 100644 --- a/phpBB/includes/acp/info/acp_profile.php +++ b/phpBB/includes/acp/info/acp_profile.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_profile_info { function module() @@ -17,7 +18,6 @@ class acp_profile_info return array( 'filename' => 'acp_profile', 'title' => 'ACP_CUSTOM_PROFILE_FIELDS', - 'version' => '1.0.0', 'modes' => array( 'profile' => array('title' => 'ACP_CUSTOM_PROFILE_FIELDS', 'auth' => 'acl_a_profile', 'cat' => array('ACP_CAT_USERS')), ), diff --git a/phpBB/includes/acp/info/acp_prune.php b/phpBB/includes/acp/info/acp_prune.php index 7498e46cad..74e5248aa9 100644 --- a/phpBB/includes/acp/info/acp_prune.php +++ b/phpBB/includes/acp/info/acp_prune.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_prune_info { function module() @@ -17,10 +18,9 @@ class acp_prune_info return array( 'filename' => 'acp_prune', 'title' => 'ACP_PRUNING', - 'version' => '1.0.0', 'modes' => array( 'forums' => array('title' => 'ACP_PRUNE_FORUMS', 'auth' => 'acl_a_prune', 'cat' => array('ACP_MANAGE_FORUMS')), - 'users' => array('title' => 'ACP_PRUNE_USERS', 'auth' => 'acl_a_userdel', 'cat' => array('ACP_USER_SECURITY')), + 'users' => array('title' => 'ACP_PRUNE_USERS', 'auth' => 'acl_a_userdel', 'cat' => array('ACP_CAT_USERS')), ), ); } diff --git a/phpBB/includes/acp/info/acp_ranks.php b/phpBB/includes/acp/info/acp_ranks.php index 651a86471d..9bf51eba3c 100644 --- a/phpBB/includes/acp/info/acp_ranks.php +++ b/phpBB/includes/acp/info/acp_ranks.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_ranks_info { function module() @@ -17,7 +18,6 @@ class acp_ranks_info return array( 'filename' => 'acp_ranks', 'title' => 'ACP_RANKS', - 'version' => '1.0.0', 'modes' => array( 'ranks' => array('title' => 'ACP_MANAGE_RANKS', 'auth' => 'acl_a_ranks', 'cat' => array('ACP_CAT_USERS')), ), diff --git a/phpBB/includes/acp/info/acp_reasons.php b/phpBB/includes/acp/info/acp_reasons.php index 9f8f2ced77..55a0495d0f 100644 --- a/phpBB/includes/acp/info/acp_reasons.php +++ b/phpBB/includes/acp/info/acp_reasons.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_reasons_info { function module() @@ -17,7 +18,6 @@ class acp_reasons_info return array( 'filename' => 'acp_reasons', 'title' => 'ACP_REASONS', - 'version' => '1.0.0', 'modes' => array( 'main' => array('title' => 'ACP_MANAGE_REASONS', 'auth' => 'acl_a_reasons', 'cat' => array('ACP_GENERAL_TASKS')), ), diff --git a/phpBB/includes/acp/info/acp_search.php b/phpBB/includes/acp/info/acp_search.php index 494d8afd67..0635dd9edd 100644 --- a/phpBB/includes/acp/info/acp_search.php +++ b/phpBB/includes/acp/info/acp_search.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_search_info { function module() @@ -17,7 +18,6 @@ class acp_search_info return array( 'filename' => 'acp_search', 'title' => 'ACP_SEARCH', - 'version' => '1.0.0', 'modes' => array( 'settings' => array('title' => 'ACP_SEARCH_SETTINGS', 'auth' => 'acl_a_search', 'cat' => array('ACP_SERVER_CONFIGURATION')), 'index' => array('title' => 'ACP_SEARCH_INDEX', 'auth' => 'acl_a_search', 'cat' => array('ACP_CAT_DATABASE')), diff --git a/phpBB/includes/acp/info/acp_send_statistics.php b/phpBB/includes/acp/info/acp_send_statistics.php index 07e7f3ba5c..a0db1a48c4 100644 --- a/phpBB/includes/acp/info/acp_send_statistics.php +++ b/phpBB/includes/acp/info/acp_send_statistics.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_send_statistics_info { function module() @@ -17,7 +18,6 @@ class acp_send_statistics_info return array( 'filename' => 'acp_send_statistics', 'title' => 'ACP_SEND_STATISTICS', - 'version' => '1.0.0', 'modes' => array( 'send_statistics' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')), ), diff --git a/phpBB/includes/acp/info/acp_styles.php b/phpBB/includes/acp/info/acp_styles.php index 3137c4781b..59b0a64899 100644 --- a/phpBB/includes/acp/info/acp_styles.php +++ b/phpBB/includes/acp/info/acp_styles.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_styles_info { function module() @@ -17,11 +18,9 @@ class acp_styles_info return array( 'filename' => 'acp_styles', 'title' => 'ACP_CAT_STYLES', - 'version' => '2.0.0', 'modes' => array( 'style' => array('title' => 'ACP_STYLES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), 'install' => array('title' => 'ACP_STYLES_INSTALL', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), - 'cache' => array('title' => 'ACP_STYLES_CACHE', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), ), ); } diff --git a/phpBB/includes/acp/info/acp_update.php b/phpBB/includes/acp/info/acp_update.php index 3d491216a8..7806fb4891 100644 --- a/phpBB/includes/acp/info/acp_update.php +++ b/phpBB/includes/acp/info/acp_update.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_update_info { function module() @@ -17,7 +18,6 @@ class acp_update_info return array( 'filename' => 'acp_update', 'title' => 'ACP_UPDATE', - 'version' => '1.0.0', 'modes' => array( 'version_check' => array('title' => 'ACP_VERSION_CHECK', 'auth' => 'acl_a_board', 'cat' => array('ACP_AUTOMATION')), ), diff --git a/phpBB/includes/acp/info/acp_users.php b/phpBB/includes/acp/info/acp_users.php index 1848622a1c..cb59d24293 100644 --- a/phpBB/includes/acp/info/acp_users.php +++ b/phpBB/includes/acp/info/acp_users.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_users_info { function module() @@ -17,7 +18,6 @@ class acp_users_info return array( 'filename' => 'acp_users', 'title' => 'ACP_USER_MANAGEMENT', - 'version' => '1.0.0', 'modes' => array( 'overview' => array('title' => 'ACP_MANAGE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')), 'feedback' => array('title' => 'ACP_USER_FEEDBACK', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), diff --git a/phpBB/includes/acp/info/acp_words.php b/phpBB/includes/acp/info/acp_words.php index 48cb3fbdd1..8a6d0d7f20 100644 --- a/phpBB/includes/acp/info/acp_words.php +++ b/phpBB/includes/acp/info/acp_words.php @@ -1,15 +1,16 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_words_info { function module() @@ -17,7 +18,6 @@ class acp_words_info return array( 'filename' => 'acp_words', 'title' => 'ACP_WORDS', - 'version' => '1.0.0', 'modes' => array( 'words' => array('title' => 'ACP_WORDS', 'auth' => 'acl_a_words', 'cat' => array('ACP_MESSAGES')), ), diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 683fbf0fd2..eb6133d013 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * BBCode class -* @package phpBB3 */ class bbcode { @@ -107,7 +110,18 @@ class bbcode $undid_bbcode_specialchars = true; } - $message = preg_replace($preg['search'], $preg['replace'], $message); + foreach ($preg['search'] as $key => $search) + { + if (is_callable($preg['replace'][$key])) + { + $message = preg_replace_callback($search, $preg['replace'][$key], $message); + } + else + { + $message = preg_replace($search, $preg['replace'][$key], $message); + } + } + $preg = array('search' => array(), 'replace' => array()); } } @@ -126,13 +140,33 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_path_helper; + global $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem; if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new phpbb\template\context(), $phpbb_extension_manager); + $template = new \phpbb\template\twig\twig( + $phpbb_container->get('path_helper'), + $phpbb_container->get('config'), + new \phpbb\template\context(), + new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), + $phpbb_container->get('path_helper'), + $phpbb_container, + $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader( + $phpbb_filesystem + ) + ), + $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('user'), + $phpbb_container->get('template.twig.extensions.collection'), + $phpbb_extension_manager + ); + $template->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); @@ -179,6 +213,8 @@ class bbcode $db->sql_freeresult($result); } + // To perform custom second pass in extension, use $this->bbcode_second_pass_by_extension() + // method which accepts variable number of parameters foreach ($bbcode_ids as $bbcode_id) { switch ($bbcode_id) @@ -189,7 +225,9 @@ class bbcode '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id) ), 'preg' => array( - '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise' => "\$this->bbcode_second_pass_quote('\$1', '\$2')" + '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#is' => function ($match) { + return $this->bbcode_second_pass_quote($match[1], $match[2]); + }, ) ); break; @@ -268,7 +306,9 @@ class bbcode case 8: $this->bbcode_cache[$bbcode_id] = array( 'preg' => array( - '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#ise' => "\$this->bbcode_second_pass_code('\$1', '\$2')", + '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#is' => function ($match) { + return $this->bbcode_second_pass_code($match[1], $match[2]); + }, ) ); break; @@ -278,7 +318,9 @@ class bbcode 'preg' => array( '#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#' => "\$1", '#(\[list=([^\[]+):$uid\])[\n]{1}#' => "\$1", - '#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_list('\$1')", + '#\[list=([^\[]+):$uid\]#' => function ($match) { + return $this->bbcode_list($match[1]); + }, ), 'str' => array( '[list:$uid]' => $this->bbcode_tpl('ulist_open_default', $bbcode_id), @@ -362,7 +404,9 @@ class bbcode } // Replace {L_*} lang strings - $bbcode_tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl); + $bbcode_tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); + }, $bbcode_tpl); if (!empty($rowset[$bbcode_id]['second_pass_replace'])) { @@ -385,6 +429,26 @@ class bbcode break; } } + + $bbcode_cache = $this->bbcode_cache; + $bbcode_bitfield = $this->bbcode_bitfield; + $bbcode_uid = $this->bbcode_uid; + + /** + * Use this event to modify the bbcode_cache + * + * @event core.bbcode_cache_init_end + * @var array bbcode_cache The array of cached search and replace patterns of bbcodes + * @var string bbcode_bitfield The bbcode bitfield + * @var string bbcode_uid The bbcode uid + * @since 3.1.3-RC1 + */ + $vars = array('bbcode_cache', 'bbcode_bitfield', 'bbcode_uid'); + extract($phpbb_dispatcher->trigger_event('core.bbcode_cache_init_end', compact($vars))); + + $this->bbcode_cache = $bbcode_cache; + $this->bbcode_bitfield = $bbcode_bitfield; + $this->bbcode_uid = $bbcode_uid; } /** @@ -404,7 +468,7 @@ class bbcode 'i_close' => '</span>', 'u_open' => '<span style="text-decoration: underline">', 'u_close' => '</span>', - 'img' => '<img src="$1" alt="' . $user->lang['IMAGE'] . '" />', + 'img' => '<img src="$1" class="postimage" alt="' . $user->lang['IMAGE'] . '" />', 'size' => '<span style="font-size: $1%; line-height: normal">$2</span>', 'color' => '<span style="color: $1">$2</span>', 'email' => '<a href="mailto:$1">$2</a>' @@ -466,7 +530,9 @@ class bbcode 'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') ); - $tpl = preg_replace('/{L_([A-Z0-9_]+)}/e', "(!empty(\$user->lang['\$1'])) ? \$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $tpl); + $tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); + }, $tpl); if (!empty($replacements[$tpl_name])) { @@ -590,4 +656,36 @@ class bbcode return $code; } + + /** + * Function to perform custom bbcode second pass by extensions + * can be used to assign bbcode pattern replacement + * Example: '#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_second_pass_by_extension('\$1')" + * + * Accepts variable number of parameters + * + * @return mixed Second pass result + */ + function bbcode_second_pass_by_extension() + { + global $phpbb_dispatcher; + + $return = false; + $params_array = func_get_args(); + + /** + * Event to perform bbcode second pass with + * the custom validating methods provided by extensions + * + * @event core.bbcode_second_pass_by_extension + * @var array params_array Array with the function parameters + * @var mixed return Second pass result to return + * + * @since 3.1.5-RC1 + */ + $vars = array('params_array', 'return'); + extract($phpbb_dispatcher->trigger_event('core.bbcode_second_pass_by_extension', compact($vars))); + + return $return; + } } diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php deleted file mode 100644 index fac45087e3..0000000000 --- a/phpBB/includes/captcha/captcha_factory.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* A small class for 3.0.x (no autoloader in 3.0.x) -* -* @package VC -*/ -class phpbb_captcha_factory -{ - /** - * return an instance of class $name in file $name_plugin.php - */ - static public function get_instance($name) - { - global $phpbb_root_path, $phpEx; - - $name = basename($name); - if (!class_exists($name)) - { - include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); - } - $instance = call_user_func(array($name, 'get_instance')); - return $instance; - } - - /** - * Call the garbage collector - */ - function garbage_collect($name) - { - global $phpbb_root_path, $phpEx; - - $name = basename($name); - if (!class_exists($name)) - { - include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); - } - $captcha = self::get_instance($name); - $captcha->garbage_collect(0); - } - - /** - * return a list of all discovered CAPTCHA plugins - */ - function get_captcha_types() - { - global $phpbb_root_path, $phpEx, $phpbb_extension_manager; - - $captchas = array( - 'available' => array(), - 'unavailable' => array(), - ); - - $finder = $phpbb_extension_manager->get_finder(); - $captcha_plugin_classes = $finder - ->extension_directory('/captcha') - ->suffix('_plugin') - ->core_path('includes/captcha/plugins/') - ->get_classes(); - - foreach ($captcha_plugin_classes as $class) - { - // check if this class needs to be loaded in legacy mode - $old_class = preg_replace('/^phpbb_captcha_plugins_/', '', $class); - if (file_exists($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx") && !class_exists($old_class)) - { - include($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx"); - $class = preg_replace('/_plugin$/', '', $old_class); - } - - if (call_user_func(array($class, 'is_available'))) - { - $captchas['available'][$class] = call_user_func(array($class, 'get_name')); - } - else - { - $captchas['unavailable'][$class] = call_user_func(array($class, 'get_name')); - } - } - - return $captchas; - } -} diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php deleted file mode 100644 index ab45aa9db6..0000000000 --- a/phpBB/includes/captcha/captcha_gd.php +++ /dev/null @@ -1,2638 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Original Author - Xore (Robert Hetzler) -* With contributions from Neothermic -* -* @package VC -*/ -class captcha -{ - var $width = 360; - var $height = 96; - - /** - * Create the image containing $code with a seed of $seed - */ - function execute($code, $seed) - { - global $config; - - mt_srand($seed); - - // Create image - $img = imagecreatetruecolor($this->width, $this->height); - - // Generate colours - $colour = new colour_manager($img, array( - 'random' => true, - 'min_value' => 60, - ), 'hsv'); - - $scheme = $colour->colour_scheme('background', false); - $scheme = $colour->mono_range($scheme, 10, false); - shuffle($scheme); - - $bg_colours = array_splice($scheme, mt_rand(6, 12)); - - // Generate code characters - $characters = $sizes = $bounding_boxes = $noise = array(); - $width_avail = $this->width - 15; - $code_len = strlen($code); - $captcha_bitmaps = $this->captcha_bitmaps(); - - for ($i = 0; $i < $code_len; ++$i) - { - $characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]); - - list($min, $max) = $characters[$i]->range(); - $sizes[$i] = mt_rand($min, $max); - - $box = $characters[$i]->dimensions($sizes[$i]); - $width_avail -= ($box[2] - $box[0]); - $bounding_boxes[$i] = $box; - } - - // Redistribute leftover x-space - $offset = array(); - for ($i = 0; $i < $code_len; ++$i) - { - $denom = ($code_len - $i); - $denom = max(1.3, $denom); - $offset[$i] = phpbb_mt_rand(0, (int) round((1.5 * $width_avail) / $denom)); - $width_avail -= $offset[$i]; - } - - if ($config['captcha_gd_x_grid']) - { - $grid = (int) $config['captcha_gd_x_grid']; - for ($y = 0; $y < $this->height; $y += mt_rand($grid - 2, $grid + 2)) - { - $current_colour = $scheme[array_rand($scheme)]; - imageline($img, mt_rand(0,4), mt_rand($y - 3, $y), mt_rand($this->width - 5, $this->width), mt_rand($y - 3, $y), $current_colour); - } - } - - if ($config['captcha_gd_y_grid']) - { - $grid = (int) $config['captcha_gd_y_grid']; - for ($x = 0; $x < $this->width; $x += mt_rand($grid - 2, $grid + 2)) - { - $current_colour = $scheme[array_rand($scheme)]; - imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour); - } - } - - if ($config['captcha_gd_wave'] && ($config['captcha_gd_y_grid'] || $config['captcha_gd_y_grid'])) - { - $this->wave($img); - } - - if ($config['captcha_gd_3d_noise']) - { - $xoffset = mt_rand(0,9); - $noise_bitmaps = $this->captcha_noise_bg_bitmaps(); - for ($i = 0; $i < $code_len; ++$i) - { - $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data']))); - - list($min, $max) = $noise[$i]->range(); - //$box = $noise[$i]->dimensions($sizes[$i]); - } - $xoffset = 0; - for ($i = 0; $i < $code_len; ++$i) - { - $dimm = $bounding_boxes[$i]; - $xoffset += ($offset[$i] - $dimm[0]); - $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]); - - $noise[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); - $xoffset += $dimm[2]; - } - } - - $xoffset = 5; - for ($i = 0; $i < $code_len; ++$i) - { - $dimm = $bounding_boxes[$i]; - $xoffset += ($offset[$i] - $dimm[0]); - $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]); - - $characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); - $xoffset += $dimm[2]; - } - - if ($config['captcha_gd_wave']) - { - $this->wave($img); - } - - if ($config['captcha_gd_foreground_noise']) - { - $this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours); - } - - // Send image - header('Content-Type: image/png'); - header('Cache-control: no-cache, no-store'); - imagepng($img); - imagedestroy($img); - } - - /** - * Sinus - */ - function wave($img) - { - global $config; - - $period_x = mt_rand(12,18); - $period_y = mt_rand(7,14); - $amp_x = mt_rand(5,10); - $amp_y = mt_rand(2,4); - $socket = mt_rand(0,100); - - $dampen_x = mt_rand($this->width/5, $this->width/2); - $dampen_y = mt_rand($this->height/5, $this->height/2); - $direction_x = (mt_rand (0, 1)); - $direction_y = (mt_rand (0, 1)); - - for ($i = 0; $i < $this->width; $i++) - { - $dir = ($direction_x) ? $i : ($this->width - $i); - imagecopy($img, $img, $i-1, sin($socket+ $i/($period_x + $dir/$dampen_x)) * $amp_x, $i, 0, 1, $this->height); - } - $socket = mt_rand(0,100); - for ($i = 0; $i < $this->height; $i++) - { - $dir = ($direction_y) ? $i : ($this->height - $i); - imagecopy($img, $img ,sin($socket + $i/($period_y + ($dir)/$dampen_y)) * $amp_y, $i-1, 0, $i, $this->width, 1); - } - return $img; - } - - /** - * Noise line - */ - function noise_line($img, $min_x, $min_y, $max_x, $max_y, $bg, $font, $non_font) - { - imagesetthickness($img, 2); - - $x1 = $min_x; - $x2 = $max_x; - $y1 = $min_y; - $y2 = $min_y; - - do - { - $line = array_merge( - array_fill(0, mt_rand(30, 60), $non_font[array_rand($non_font)]), - array_fill(0, mt_rand(30, 60), $bg) - ); - - imagesetstyle($img, $line); - imageline($img, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED); - - $y1 += mt_rand(12, 35); - $y2 += mt_rand(12, 35); - } - while ($y1 < $max_y && $y2 < $max_y); - - $x1 = $min_x; - $x2 = $min_x; - $y1 = $min_y; - $y2 = $max_y; - - do - { - $line = array_merge( - array_fill(0, mt_rand(30, 60), $non_font[array_rand($non_font)]), - array_fill(0, mt_rand(30, 60), $bg) - ); - - imagesetstyle($img, $line); - imageline($img, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED); - - $x1 += mt_rand(20, 35); - $x2 += mt_rand(20, 35); - } - while ($x1 < $max_x && $x2 < $max_x); - imagesetthickness($img, 1); - } - - function captcha_noise_bg_bitmaps() - { - return array( - 'width' => 15, - 'height' => 5, - 'data' => array( - - 1 => array( - array(1,0,0,0,1,0,0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,1,0,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0,0,0,1,0,0,0), - ), - 2 => array( - array(1,1,mt_rand(0,1),1,0,1,1,1,1,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,1,1,0,1,1,1), - ), - 3 => array( - array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), - array(0,0,0,0,1,0,0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), - ), - 4 => array( - array(1,0,1,0,1,0,0,1,1,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), - ), - 5 => array( - array(1,1,1,1,0,0,0,1,1,1,0,0,1,0,1), - array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), - ), - 6 => array( - array(mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1)), - array(0,0,0,0,0,0,0,mt_rand(0,1),0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(mt_rand(0,1),0,mt_rand(0,1),0,0,0,0,0,0,0,0,0,0,0,0), - ), - 7 => array( - array(0,0,0,0,0,0,0,0,0,0,1,1,0,1,1), - array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - array(0,0,1,1,0,0,0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,1,0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), - ), - )); - } - - /** - * Return bitmaps - */ - function captcha_bitmaps() - { - global $config; - - $chars = array( - 'A' => array( - array( - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,1,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,1,0,1,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,0,0,0,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,1,1,0,0,0,1,1,0), - array(1,1,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,1), - array(0,0,0,0,0,1,1,1,1), - array(0,0,0,1,1,1,0,0,1), - array(0,1,1,1,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,1,0,0,0,0,1,1,1), - array(0,1,1,1,1,1,1,0,1), - ), - ), - 'B' => array( - array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - ), - array( - array(1,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - ), - array( - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,0,0), - ), - ), - 'C' => array( - array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - array( - array(0,0,1,1,1,1,1,0,1), - array(0,1,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,1), - array(0,0,1,1,1,1,1,0,1), - ), - ), - 'D' => array( - array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - ), - array( - array(1,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,1,1,1,1,1,0,1), - array(0,1,1,0,0,0,1,1,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,1,0,0,0,1,1,1), - array(0,0,1,1,1,1,1,0,1), - ), - ), - 'E' => array( - array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - ), - array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,1,1,0,0,0,1,1,0), - array(1,1,0,0,0,0,0,1,1), - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,1,0,0,0,0,0,1,1), - array(0,1,1,1,1,1,1,1,0), - ), - ), - 'F' => array( - array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - ), - array( - array(0,1,1,1,1,1,1,1,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,1,1,0,0,0,0,0,0), - ), - array( - array(0,0,0,1,1,0,0,0,0), - array(0,0,1,1,0,0,0,0,0), - array(0,1,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,1,1,1,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - ), - ), - 'G' => array( - array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - array( - array(0,0,1,1,1,1,1,0,1), - array(0,1,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,1,1,1,1,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,1), - array(0,0,1,1,1,1,1,0,1), - ), - array( - array(0,0,1,1,1,1,1,0,1), - array(0,1,1,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,0,0,0,0,0,1), - array(0,0,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,1), - array(1,1,1,1,1,1,1,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - ), - 'H' => array( - array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - array( - array(1,1,1,0,0,0,1,1,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,0,0,0,1,1,1), - ), - array( - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,1,1,1,0,0,0), - array(1,1,1,1,0,1,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - ), - ), - 'I' => array( - array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - ), - array( - array(0,0,0,1,1,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,1,1,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,1,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,1,1,0,0,0), - ), - ), - 'J' => array( - array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,0,1,1,0,0,0,0,0), - ), - array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,1,0,0,1,0,0,0,0), - array(1,0,1,1,0,0,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,0,1,1,0,0,0,0,0), - ), - ), - 'K' => array( - array( // New 'K', supplied by NeoThermic - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,1,0,0,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - ), - array( - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,1,0,0), - array(0,1,0,0,0,1,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,1,0,1,0,0,0,0,0), - array(0,1,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,1,0,0,0,0,0,0), - array(0,1,0,1,0,0,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,1,0,0,0,1,0,0,0), - array(0,1,0,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,0,0,0,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,1,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,1,0,1,0,0,0,0,0), - array(0,1,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,1,0,0,0,0,0,0), - array(0,1,0,1,0,0,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,1,0,0,0,1,0,0,0), - array(0,1,0,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - ), - ), - 'L' => array( - array( - array(0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,1,0,0,0,0,0,0), - array(0,0,1,1,1,0,0,0,0), - ), - ), - 'M' => array( - array( - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,1,0,1,0,1,0,1,0), - array(0,1,0,1,0,1,0,1,0), - array(0,1,0,1,0,1,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,0,0,0,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,1,1,1,0,1,1,1,0), - array(1,1,0,1,1,1,0,1,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - ), - ), - 'N' => array( - array( - array(1,1,0,0,0,0,0,0,1), - array(1,1,0,0,0,0,0,0,1), - array(1,0,1,0,0,0,0,0,1), - array(1,0,1,0,0,0,0,0,1), - array(1,0,0,1,0,0,0,0,1), - array(1,0,0,1,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,0,1,0,1), - array(1,0,0,0,0,0,1,0,1), - array(1,0,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,0,0,0,0,1,0), - array(0,1,1,0,0,0,0,1,0), - array(0,1,1,0,0,0,0,1,0), - array(0,1,0,1,0,0,0,1,0), - array(0,1,0,1,0,0,0,1,0), - array(0,1,0,1,0,0,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,0,1,1,0,1,0), - array(0,1,0,0,0,1,0,1,0), - array(0,1,0,0,0,1,1,1,0), - array(0,1,0,0,0,0,1,1,0), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,0,0,0,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(1,0,1,1,1,1,0,0,0), - array(1,1,1,0,0,1,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - ), - ), - 'O' => array( - array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,1,1,1,1,1,0,0,0), - array(1,1,1,0,0,1,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,0,0,0,1,1,0,0), - array(0,1,1,1,1,1,0,0,0), - ), - ), - 'P' => array( - array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - ), - array( - array(1,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,1,1,0,0,0,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,1,1,0,0,0,0,0), - array(1,1,0,1,1,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,1,1,0,0,0,0), - array(1,1,1,1,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - ), - ), - 'Q' => array( - array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,0,1,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,1), - ), - array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,1,0,0,1,1,0,1,1), - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,0,0,1,1,0), - array(0,0,0,0,0,0,0,1,1), - array(0,0,0,0,0,0,0,0,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,1,1,1,1), - array(0,0,0,0,1,1,0,0,1), - array(0,0,0,0,1,0,0,0,1), - array(0,0,0,0,1,0,0,0,1), - array(0,0,0,0,1,1,0,1,1), - array(0,0,0,0,0,1,1,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - ), - ), - 'R' => array( - array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(1,1,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - ), - array( - array(1,1,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(0,1,1,0,0,0,0,0,0), - array(0,1,1,1,0,0,0,0,0), - array(0,1,0,1,1,0,0,0,0), - array(0,1,0,0,1,1,0,0,0), - array(0,1,0,0,0,1,1,0,0), - array(0,1,0,0,0,0,1,1,0), - array(1,1,1,0,0,0,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,0,0,0,0), - array(1,1,0,0,1,1,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - ), - ), - 'S' => array( - array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - array( - array(0,0,1,1,1,1,1,0,1), - array(0,1,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,1,0,0,0,0,0,1,0), - array(1,0,1,1,1,1,1,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,1,1,1,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,0,0,0,0,0,0,0), - array(0,1,1,1,1,0,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(1,0,0,0,1,1,0,0,0), - array(0,1,1,1,1,0,0,0,0), - ), - ), - 'T' => array( - array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,1,0,0,0,1), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,1,1,0,0,0), - ), - array( - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,1,1,1,1,1,1,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,1,0,0,0), - array(0,0,0,0,0,1,1,1,0), - ), - ), - 'U' => array( - array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - array( - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,0,0,0,1,1,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,1,1), - array(0,0,1,1,0,0,1,1,1), - array(0,0,0,1,1,1,1,0,1), - ), - ), - 'V' => array( - array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(1,1,1,0,0,0,1,1,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - ), - 'W' => array( - array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,1,0,0,0,0,0,1,1), - array(1,1,0,0,0,0,0,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(1,1,1,0,0,0,1,1,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,1,1,1,0,1,0), - array(0,1,0,1,0,1,0,1,0), - array(0,1,1,1,0,1,1,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,1,1,1,0,1,0), - array(0,1,0,1,0,1,0,1,0), - array(0,1,1,1,0,1,1,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - ), - ), - 'X' => array( - array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(1,1,1,0,0,0,1,1,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,1,1,0,0,0,1,1,1), - array(0,0,0,0,0,0,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,0,1,1,0,1,1,0,0), - array(0,0,0,1,1,1,0,0,0), - array(0,0,0,1,1,1,0,0,0), - array(0,0,1,1,0,1,1,0,0), - array(0,1,1,0,0,0,1,1,0), - array(0,0,0,0,0,0,0,0,0), - ), - ), - 'Y' => array( - array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(1,1,1,0,0,0,1,1,1), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,1,1,0,0,0), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,1,0,0,0,0,1), - array(0,0,0,1,1,0,0,0,1), - array(0,0,0,0,1,0,0,1,1), - array(0,0,0,0,1,1,0,1,0), - array(0,0,0,0,0,1,1,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,1,0,0,0), - array(0,0,1,1,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - ), - 'Z' => array( - array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - ), - array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - ), - array( - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,0,1,1,0,0), - array(0,0,0,0,1,1,0,0,0), - array(0,0,0,1,1,0,0,0,0), - array(0,0,1,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,1,1,1,1,1,1,0), - ), - ), - ); - return array( - 'width' => 9, - 'height' => 15, - 'data' => array( - - 'A' => $chars['A'][mt_rand(0, min(sizeof($chars['A']), $config['captcha_gd_fonts']) -1)], - 'B' => $chars['B'][mt_rand(0, min(sizeof($chars['B']), $config['captcha_gd_fonts']) -1)], - 'C' => $chars['C'][mt_rand(0, min(sizeof($chars['C']), $config['captcha_gd_fonts']) -1)], - 'D' => $chars['D'][mt_rand(0, min(sizeof($chars['D']), $config['captcha_gd_fonts']) -1)], - 'E' => $chars['E'][mt_rand(0, min(sizeof($chars['E']), $config['captcha_gd_fonts']) -1)], - 'F' => $chars['F'][mt_rand(0, min(sizeof($chars['F']), $config['captcha_gd_fonts']) -1)], - 'G' => $chars['G'][mt_rand(0, min(sizeof($chars['G']), $config['captcha_gd_fonts']) -1)], - 'H' => $chars['H'][mt_rand(0, min(sizeof($chars['H']), $config['captcha_gd_fonts']) -1)], - 'I' => $chars['I'][mt_rand(0, min(sizeof($chars['I']), $config['captcha_gd_fonts']) -1)], - 'J' => $chars['J'][mt_rand(0, min(sizeof($chars['J']), $config['captcha_gd_fonts']) -1)], - 'K' => $chars['K'][mt_rand(0, min(sizeof($chars['K']), $config['captcha_gd_fonts']) -1)], - 'L' => $chars['L'][mt_rand(0, min(sizeof($chars['L']), $config['captcha_gd_fonts']) -1)], - 'M' => $chars['M'][mt_rand(0, min(sizeof($chars['M']), $config['captcha_gd_fonts']) -1)], - 'N' => $chars['N'][mt_rand(0, min(sizeof($chars['N']), $config['captcha_gd_fonts']) -1)], - 'O' => $chars['O'][mt_rand(0, min(sizeof($chars['O']), $config['captcha_gd_fonts']) -1)], - 'P' => $chars['P'][mt_rand(0, min(sizeof($chars['P']), $config['captcha_gd_fonts']) -1)], - 'Q' => $chars['Q'][mt_rand(0, min(sizeof($chars['Q']), $config['captcha_gd_fonts']) -1)], - 'R' => $chars['R'][mt_rand(0, min(sizeof($chars['R']), $config['captcha_gd_fonts']) -1)], - 'S' => $chars['S'][mt_rand(0, min(sizeof($chars['S']), $config['captcha_gd_fonts']) -1)], - 'T' => $chars['T'][mt_rand(0, min(sizeof($chars['T']), $config['captcha_gd_fonts']) -1)], - 'U' => $chars['U'][mt_rand(0, min(sizeof($chars['U']), $config['captcha_gd_fonts']) -1)], - 'V' => $chars['V'][mt_rand(0, min(sizeof($chars['V']), $config['captcha_gd_fonts']) -1)], - 'W' => $chars['W'][mt_rand(0, min(sizeof($chars['W']), $config['captcha_gd_fonts']) -1)], - 'X' => $chars['X'][mt_rand(0, min(sizeof($chars['X']), $config['captcha_gd_fonts']) -1)], - 'Y' => $chars['Y'][mt_rand(0, min(sizeof($chars['Y']), $config['captcha_gd_fonts']) -1)], - 'Z' => $chars['Z'][mt_rand(0, min(sizeof($chars['Z']), $config['captcha_gd_fonts']) -1)], - - '1' => array( - array(0,0,0,1,1,0,0,0,0), - array(0,0,1,0,1,0,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,1,1,1,1,1,1,1,0), - ), - '2' => array( // New '2' supplied by Anon - array(0,0,0,1,1,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,1,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,0), - ), - '3' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - '4' => array( - array(0,0,0,0,0,0,1,1,0), - array(0,0,0,0,0,1,0,1,0), - array(0,0,0,0,1,0,0,1,0), - array(0,0,0,1,0,0,0,1,0), - array(0,0,1,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - ), - '5' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - '6' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,1,1,1,1,0,0), - array(1,0,1,0,0,0,0,1,0), - array(1,1,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - '7' => array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - ), - '8' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - '9' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,1), - array(0,1,0,0,0,0,1,0,1), - array(0,0,1,1,1,1,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - ), - ) - ); - } -} - -/** -* @package VC -*/ -class char_cube3d -{ - var $bitmap; - var $bitmap_width; - var $bitmap_height; - - var $basis_matrix = array(array(1, 0, 0), array(0, 1, 0), array(0, 0, 1)); - var $abs_x = array(1, 0); - var $abs_y = array(0, 1); - var $x = 0; - var $y = 1; - var $z = 2; - var $letter = ''; - - /** - */ - function char_cube3d(&$bitmaps, $letter) - { - $this->bitmap = $bitmaps['data'][$letter]; - $this->bitmap_width = $bitmaps['width']; - $this->bitmap_height = $bitmaps['height']; - - $this->basis_matrix[0][0] = mt_rand(-600, 600); - $this->basis_matrix[0][1] = mt_rand(-600, 600); - $this->basis_matrix[0][2] = (mt_rand(0, 1) * 2000) - 1000; - $this->basis_matrix[1][0] = mt_rand(-1000, 1000); - $this->basis_matrix[1][1] = mt_rand(-1000, 1000); - $this->basis_matrix[1][2] = mt_rand(-1000, 1000); - - $this->normalize($this->basis_matrix[0]); - $this->normalize($this->basis_matrix[1]); - $this->basis_matrix[2] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[1]); - $this->normalize($this->basis_matrix[2]); - - // $this->basis_matrix[1] might not be (probably isn't) orthogonal to $basis_matrix[0] - $this->basis_matrix[1] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[2]); - $this->normalize($this->basis_matrix[1]); - - // Make sure our cube is facing into the canvas (assuming +z == in) - for ($i = 0; $i < 3; ++$i) - { - if ($this->basis_matrix[$i][2] < 0) - { - $this->basis_matrix[$i][0] *= -1; - $this->basis_matrix[$i][1] *= -1; - $this->basis_matrix[$i][2] *= -1; - } - } - - // Force our "z" basis vector to be the one with greatest absolute z value - $this->x = 0; - $this->y = 1; - $this->z = 2; - - // Swap "y" with "z" - if ($this->basis_matrix[1][2] > $this->basis_matrix[2][2]) - { - $this->z = 1; - $this->y = 2; - } - - // Swap "x" with "z" - if ($this->basis_matrix[0][2] > $this->basis_matrix[$this->z][2]) - { - $this->x = $this->z; - $this->z = 0; - } - - // Still need to determine which of $x,$y are which. - // wrong orientation if y's y-component is less than it's x-component - // likewise if x's x-component is less than it's y-component - // if they disagree, go with the one with the greater weight difference. - // rotate if positive - $weight = (abs($this->basis_matrix[$this->x][1]) - abs($this->basis_matrix[$this->x][0])) + (abs($this->basis_matrix[$this->y][0]) - abs($this->basis_matrix[$this->y][1])); - - // Swap "x" with "y" - if ($weight > 0) - { - list($this->x, $this->y) = array($this->y, $this->x); - } - - $this->abs_x = array($this->basis_matrix[$this->x][0], $this->basis_matrix[$this->x][1]); - $this->abs_y = array($this->basis_matrix[$this->y][0], $this->basis_matrix[$this->y][1]); - - if ($this->abs_x[0] < 0) - { - $this->abs_x[0] *= -1; - $this->abs_x[1] *= -1; - } - - if ($this->abs_y[1] > 0) - { - $this->abs_y[0] *= -1; - $this->abs_y[1] *= -1; - } - - $this->letter = $letter; - } - - /** - * Draw a character - */ - function drawchar($scale, $xoff, $yoff, $img, $background, $colours) - { - $width = $this->bitmap_width; - $height = $this->bitmap_height; - $bitmap = $this->bitmap; - - $colour1 = $colours[array_rand($colours)]; - $colour2 = $colours[array_rand($colours)]; - - $swapx = ($this->basis_matrix[$this->x][0] > 0); - $swapy = ($this->basis_matrix[$this->y][1] < 0); - - for ($y = 0; $y < $height; ++$y) - { - for ($x = 0; $x < $width; ++$x) - { - $xp = ($swapx) ? ($width - $x - 1) : $x; - $yp = ($swapy) ? ($height - $y - 1) : $y; - - if ($bitmap[$height - $yp - 1][$xp]) - { - $dx = $this->scale($this->abs_x, ($xp - ($swapx ? ($width / 2) : ($width / 2) - 1)) * $scale); - $dy = $this->scale($this->abs_y, ($yp - ($swapy ? ($height / 2) : ($height / 2) - 1)) * $scale); - $xo = $xoff + $dx[0] + $dy[0]; - $yo = $yoff + $dx[1] + $dy[1]; - - $origin = array(0, 0, 0); - $xvec = $this->scale($this->basis_matrix[$this->x], $scale); - $yvec = $this->scale($this->basis_matrix[$this->y], $scale); - $face_corner = $this->sum2($xvec, $yvec); - - $zvec = $this->scale($this->basis_matrix[$this->z], $scale); - $x_corner = $this->sum2($xvec, $zvec); - $y_corner = $this->sum2($yvec, $zvec); - - imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $xvec, $x_corner,$zvec), 4, $colour1); - imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $yvec, $y_corner,$zvec), 4, $colour2); - - $face = $this->gen_poly($xo, $yo, $origin, $xvec, $face_corner, $yvec); - - imagefilledpolygon($img, $face, 4, $background); - imagepolygon($img, $face, 4, $colour1); - } - } - } - } - - /* - * return a roughly acceptable range of sizes for rendering with this texttype - */ - function range() - { - return array(3, 4); - } - - /** - * Vector length - */ - function vectorlen($vector) - { - return sqrt(pow($vector[0], 2) + pow($vector[1], 2) + pow($vector[2], 2)); - } - - /** - * Normalize - */ - function normalize(&$vector, $length = 1) - { - $length = (( $length < 1) ? 1 : $length); - $length /= $this->vectorlen($vector); - $vector[0] *= $length; - $vector[1] *= $length; - $vector[2] *= $length; - } - - /** - */ - function cross_product($vector1, $vector2) - { - $retval = array(0, 0, 0); - $retval[0] = (($vector1[1] * $vector2[2]) - ($vector1[2] * $vector2[1])); - $retval[1] = -(($vector1[0] * $vector2[2]) - ($vector1[2] * $vector2[0])); - $retval[2] = (($vector1[0] * $vector2[1]) - ($vector1[1] * $vector2[0])); - - return $retval; - } - - /** - */ - function sum($vector1, $vector2) - { - return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1], $vector1[2] + $vector2[2]); - } - - /** - */ - function sum2($vector1, $vector2) - { - return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1]); - } - - /** - */ - function scale($vector, $length) - { - if (sizeof($vector) == 2) - { - return array($vector[0] * $length, $vector[1] * $length); - } - - return array($vector[0] * $length, $vector[1] * $length, $vector[2] * $length); - } - - /** - */ - function gen_poly($xoff, $yoff, &$vec1, &$vec2, &$vec3, &$vec4) - { - $poly = array(); - $poly[0] = $xoff + $vec1[0]; - $poly[1] = $yoff + $vec1[1]; - $poly[2] = $xoff + $vec2[0]; - $poly[3] = $yoff + $vec2[1]; - $poly[4] = $xoff + $vec3[0]; - $poly[5] = $yoff + $vec3[1]; - $poly[6] = $xoff + $vec4[0]; - $poly[7] = $yoff + $vec4[1]; - - return $poly; - } - - /** - * dimensions - */ - function dimensions($size) - { - $xn = $this->scale($this->basis_matrix[$this->x], -($this->bitmap_width / 2) * $size); - $xp = $this->scale($this->basis_matrix[$this->x], ($this->bitmap_width / 2) * $size); - $yn = $this->scale($this->basis_matrix[$this->y], -($this->bitmap_height / 2) * $size); - $yp = $this->scale($this->basis_matrix[$this->y], ($this->bitmap_height / 2) * $size); - - $p = array(); - $p[0] = $this->sum2($xn, $yn); - $p[1] = $this->sum2($xp, $yn); - $p[2] = $this->sum2($xp, $yp); - $p[3] = $this->sum2($xn, $yp); - - $min_x = $max_x = $p[0][0]; - $min_y = $max_y = $p[0][1]; - - for ($i = 1; $i < 4; ++$i) - { - $min_x = ($min_x > $p[$i][0]) ? $p[$i][0] : $min_x; - $min_y = ($min_y > $p[$i][1]) ? $p[$i][1] : $min_y; - $max_x = ($max_x < $p[$i][0]) ? $p[$i][0] : $max_x; - $max_y = ($max_y < $p[$i][1]) ? $p[$i][1] : $max_y; - } - - return array($min_x, $min_y, $max_x, $max_y); - } -} - -/** -* @package VC -*/ -class colour_manager -{ - var $img; - var $mode; - var $colours; - var $named_colours; - - /** - * Create the colour manager, link it to the image resource - */ - function colour_manager($img, $background = false, $mode = 'ahsv') - { - $this->img = $img; - $this->mode = $mode; - $this->colours = array(); - $this->named_colours = array(); - - if ($background !== false) - { - $bg = $this->allocate_named('background', $background); - imagefill($this->img, 0, 0, $bg); - } - } - - /** - * Lookup a named colour resource - */ - function get_resource($named_colour) - { - if (isset($this->named_colours[$named_colour])) - { - return $this->named_colours[$named_colour]; - } - - if (isset($this->named_rgb[$named_colour])) - { - return $this->allocate_named($named_colour, $this->named_rgb[$named_colour], 'rgb'); - } - - return false; - } - - /** - * Assign a name to a colour resource - */ - function name_colour($name, $resource) - { - $this->named_colours[$name] = $resource; - } - - /** - * names and allocates a colour resource - */ - function allocate_named($name, $colour, $mode = false) - { - $resource = $this->allocate($colour, $mode); - - if ($resource !== false) - { - $this->name_colour($name, $resource); - } - return $resource; - } - - /** - * allocates a specified colour into the image - */ - function allocate($colour, $mode = false) - { - if ($mode === false) - { - $mode = $this->mode; - } - - if (!is_array($colour)) - { - if (isset($this->named_rgb[$colour])) - { - return $this->allocate_named($colour, $this->named_rgb[$colour], 'rgb'); - } - - if (!is_int($colour)) - { - return false; - } - - $mode = 'rgb'; - $colour = array(255 & ($colour >> 16), 255 & ($colour >> 8), 255 & $colour); - } - - if (isset($colour['mode'])) - { - $mode = $colour['mode']; - unset($colour['mode']); - } - - if (isset($colour['random'])) - { - unset($colour['random']); - // everything else is params - return $this->random_colour($colour, $mode); - } - - $rgb = colour_manager::model_convert($colour, $mode, 'rgb'); - $store = ($this->mode == 'rgb') ? $rgb : colour_manager::model_convert($colour, $mode, $this->mode); - $resource = imagecolorallocate($this->img, $rgb[0], $rgb[1], $rgb[2]); - $this->colours[$resource] = $store; - - return $resource; - } - - /** - * randomly generates a colour, with optional params - */ - function random_colour($params = array(), $mode = false) - { - if ($mode === false) - { - $mode = $this->mode; - } - - switch ($mode) - { - case 'rgb': - // @TODO random rgb generation. do we intend to do this, or is it just too tedious? - break; - - case 'ahsv': - case 'hsv': - default: - - $default_params = array( - 'hue_bias' => false, // degree / 'r'/'g'/'b'/'c'/'m'/'y' /'o' - 'hue_range' => false, // if hue bias, then difference range +/- from bias - 'min_saturation' => 30, // 0 - 100 - 'max_saturation' => 80, // 0 - 100 - 'min_value' => 30, // 0 - 100 - 'max_value' => 80, // 0 - 100 - ); - - $alt = ($mode == 'ahsv') ? true : false; - $params = array_merge($default_params, $params); - - $min_hue = 0; - $max_hue = 359; - $min_saturation = max(0, $params['min_saturation']); - $max_saturation = min(100, $params['max_saturation']); - $min_value = max(0, $params['min_value']); - $max_value = min(100, $params['max_value']); - - if ($params['hue_bias'] !== false) - { - if (is_numeric($params['hue_bias'])) - { - $h = intval($params['hue_bias']) % 360; - } - else - { - switch ($params['hue_bias']) - { - case 'o': - $h = $alt ? 60 : 30; - break; - - case 'y': - $h = $alt ? 120 : 60; - break; - - case 'g': - $h = $alt ? 180 : 120; - break; - - case 'c': - $h = $alt ? 210 : 180; - break; - - case 'b': - $h = 240; - break; - - case 'm': - $h = 300; - break; - - case 'r': - default: - $h = 0; - break; - } - } - - $min_hue = $h + 360; - $max_hue = $h + 360; - - if ($params['hue_range']) - { - $min_hue -= min(180, $params['hue_range']); - $max_hue += min(180, $params['hue_range']); - } - } - - $h = mt_rand($min_hue, $max_hue); - $s = mt_rand($min_saturation, $max_saturation); - $v = mt_rand($min_value, $max_value); - - return $this->allocate(array($h, $s, $v), $mode); - - break; - } - } - - /** - */ - function colour_scheme($resource, $include_original = true) - { - $mode = 'hsv'; - - if (($pre = $this->get_resource($resource)) !== false) - { - $resource = $pre; - } - - $colour = colour_manager::model_convert($this->colours[$resource], $this->mode, $mode); - $results = ($include_original) ? array($resource) : array(); - $colour2 = $colour3 = $colour4 = $colour; - $colour2[0] += 150; - $colour3[0] += 180; - $colour4[0] += 210; - - - $results[] = $this->allocate($colour2, $mode); - $results[] = $this->allocate($colour3, $mode); - $results[] = $this->allocate($colour4, $mode); - - return $results; - } - - /** - */ - function mono_range($resource, $count = 5, $include_original = true) - { - if (is_array($resource)) - { - $results = array(); - for ($i = 0, $size = sizeof($resource); $i < $size; ++$i) - { - $results = array_merge($results, $this->mono_range($resource[$i], $count, $include_original)); - } - return $results; - } - - $mode = (in_array($this->mode, array('hsv', 'ahsv'), true) ? $this->mode : 'ahsv'); - if (($pre = $this->get_resource($resource)) !== false) - { - $resource = $pre; - } - - $colour = colour_manager::model_convert($this->colours[$resource], $this->mode, $mode); - - $results = array(); - if ($include_original) - { - $results[] = $resource; - $count--; - } - - // This is a hard problem. I chicken out and try to maintain readability at the cost of less randomness. - - while ($count > 0) - { - $colour[1] = ($colour[1] + mt_rand(40,60)) % 99; - $colour[2] = ($colour[2] + mt_rand(40,60)); - $results[] = $this->allocate($colour, $mode); - $count--; - } - return $results; - } - - /** - * Convert from one colour model to another - */ - function model_convert($colour, $from_model, $to_model) - { - if ($from_model == $to_model) - { - return $colour; - } - - switch ($to_model) - { - case 'hsv': - - switch ($from_model) - { - case 'ahsv': - return colour_manager::ah2h($colour); - break; - - case 'rgb': - return colour_manager::rgb2hsv($colour); - break; - } - break; - - case 'ahsv': - - switch ($from_model) - { - case 'hsv': - return colour_manager::h2ah($colour); - break; - - case 'rgb': - return colour_manager::h2ah(colour_manager::rgb2hsv($colour)); - break; - } - break; - - case 'rgb': - switch ($from_model) - { - case 'hsv': - return colour_manager::hsv2rgb($colour); - break; - - case 'ahsv': - return colour_manager::hsv2rgb(colour_manager::ah2h($colour)); - break; - } - break; - } - return false; - } - - /** - * Slightly altered from wikipedia's algorithm - */ - function hsv2rgb($hsv) - { - colour_manager::normalize_hue($hsv[0]); - - $h = $hsv[0]; - $s = min(1, max(0, $hsv[1] / 100)); - $v = min(1, max(0, $hsv[2] / 100)); - - // calculate hue sector - $hi = floor($hsv[0] / 60); - - // calculate opposite colour - $p = $v * (1 - $s); - - // calculate distance between hex vertices - $f = ($h / 60) - $hi; - - // coming in or going out? - if (!($hi & 1)) - { - $f = 1 - $f; - } - - // calculate adjacent colour - $q = $v * (1 - ($f * $s)); - - switch ($hi) - { - case 0: - $rgb = array($v, $q, $p); - break; - - case 1: - $rgb = array($q, $v, $p); - break; - - case 2: - $rgb = array($p, $v, $q); - break; - - case 3: - $rgb = array($p, $q, $v); - break; - - case 4: - $rgb = array($q, $p, $v); - break; - - case 5: - $rgb = array($v, $p, $q); - break; - - default: - return array(0, 0, 0); - break; - } - - return array(255 * $rgb[0], 255 * $rgb[1], 255 * $rgb[2]); - } - - /** - * (more than) Slightly altered from wikipedia's algorithm - */ - function rgb2hsv($rgb) - { - $r = min(255, max(0, $rgb[0])); - $g = min(255, max(0, $rgb[1])); - $b = min(255, max(0, $rgb[2])); - $max = max($r, $g, $b); - $min = min($r, $g, $b); - - $v = $max / 255; - $s = (!$max) ? 0 : 1 - ($min / $max); - - // if max - min is 0, we want hue to be 0 anyway. - $h = $max - $min; - - if ($h) - { - switch ($max) - { - case $g: - $h = 120 + (60 * ($b - $r) / $h); - break; - - case $b: - $h = 240 + (60 * ($r - $g) / $h); - break; - - case $r: - $h = 360 + (60 * ($g - $b) / $h); - break; - } - } - colour_manager::normalize_hue($h); - - return array($h, $s * 100, $v * 100); - } - - /** - */ - function normalize_hue(&$hue) - { - $hue %= 360; - - if ($hue < 0) - { - $hue += 360; - } - } - - /** - * Alternate hue to hue - */ - function ah2h($ahue) - { - if (is_array($ahue)) - { - $ahue[0] = colour_manager::ah2h($ahue[0]); - return $ahue; - } - colour_manager::normalize_hue($ahue); - - // blue through red is already ok - if ($ahue >= 240) - { - return $ahue; - } - - // ahue green is at 180 - if ($ahue >= 180) - { - // return (240 - (2 * (240 - $ahue))); - return (2 * $ahue) - 240; // equivalent - } - - // ahue yellow is at 120 (RYB rather than RGB) - if ($ahue >= 120) - { - return $ahue - 60; - } - - return $ahue / 2; - } - - /** - * hue to Alternate hue - */ - function h2ah($hue) - { - if (is_array($hue)) - { - $hue[0] = colour_manager::h2ah($hue[0]); - return $hue; - } - colour_manager::normalize_hue($hue); - - // blue through red is already ok - if ($hue >= 240) - { - return $hue; - } - else if ($hue <= 60) - { - return $hue * 2; - } - else if ($hue <= 120) - { - return $hue + 60; - } - else - { - return ($hue + 240) / 2; - } - } -} diff --git a/phpBB/includes/captcha/captcha_gd_wave.php b/phpBB/includes/captcha/captcha_gd_wave.php deleted file mode 100644 index 185352dd4e..0000000000 --- a/phpBB/includes/captcha/captcha_gd_wave.php +++ /dev/null @@ -1,842 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* Wave3D CAPTCHA -* -* @author Robert Hetzler -* @package VC -*/ -class captcha -{ - var $width = 360; - var $height = 96; - - function execute($code, $seed) - { - global $starttime; - - // seed the random generator - mt_srand($seed); - - // set height and width - $img_x = $this->width; - $img_y = $this->height; - - // Generate image - $img = imagecreatetruecolor($img_x, $img_y); - $x_grid = mt_rand(6, 10); - $y_grid = mt_rand(6, 10); - - // Ok, so lets cut to the chase. We could accurately represent this in 3d and - // do all the appropriate linear transforms. my questions is... why bother? - // The computational overhead is unnecessary when you consider the simple fact: - // we're not here to accurately represent a model, but to just show off some random-ish - // polygons - - // Conceive of 3 spaces. - // 1) planar-space (discrete "pixel" grid) - // 2) 3-space. (planar-space with z/height aspect) - // 3) image space (pixels on the screen) - // resolution of the planar-space we're embedding the text code in - $plane_x = 100; - $plane_y = 30; - - $subdivision_factor = 3; - - // $box is the 4 points in img_space that correspond to the corners of the plane in 3-space - $box = array( - 'upper_left' => array( - 'x' => mt_rand(5, 15), - 'y' => mt_rand(10, 15) - ), - 'upper_right' => array( - 'x' => mt_rand($img_x - 35, $img_x - 19), - 'y' => mt_rand(10, 17) - ), - 'lower_left' => array( - 'x' => mt_rand($img_x - 45, $img_x - 5), - 'y' => mt_rand($img_y - 15, $img_y - 0), - ), - ); - - $box['lower_right'] = array( - 'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'], - 'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'], - ); - - // TODO - $background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255)); - imagefill($img, 0, 0, $background); - $black = imagecolorallocate($img, 0, 0, 0); - - $random = array(); - $fontcolors = array(); - - for ($i = 0; $i < 15; ++$i) - { - $random[$i] = imagecolorallocate($img, mt_rand(120, 255), mt_rand(120, 255), mt_rand(120, 255)); - } - - $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120)); - - $colors = array(); - - $minr = mt_rand(20, 30); - $ming = mt_rand(20, 30); - $minb = mt_rand(20, 30); - - $maxr = mt_rand(150, 230); - $maxg = mt_rand(150, 230); - $maxb = mt_rand(150, 230); - - for ($i = -30; $i <= 30; ++$i) - { - $coeff1 = ($i + 12) / 45; - $coeff2 = 1 - $coeff1; - $colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb)); - } - - // $img_buffer is the last row of 3-space positions (converted to img-space), cached - // (using this means we don't need to recalculate all 4 positions for each new polygon, - // merely the newest point that we're adding, which is then cached. - $img_buffer = array(array(), array()); - - // In image-space, the x- and y-offset necessary to move one unit in the x-direction in planar-space - $dxx = ($box['upper_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_x); - $dxy = ($box['upper_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_x); - - // In image-space, the x- and y-offset necessary to move one unit in the y-direction in planar-space - $dyx = ($box['lower_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_y); - $dyy = ($box['lower_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_y); - - // Initial captcha-letter offset in planar-space - $plane_offset_x = mt_rand(3, 8); - $plane_offset_y = mt_rand( 12, 15); - - // character map - $map = $this->captcha_bitmaps(); - - // matrix - $plane = array(); - - // for each character, we'll silkscreen it into our boolean pixel plane - for ($c = 0, $code_num = strlen($code); $c < $code_num; ++$c) - { - $letter = $code[$c]; - - for ($x = $map['width'] - 1; $x >= 0; --$x) - { - for ($y = $map['height'] - 1; $y >= 0; --$y) - { - if ($map['data'][$letter][$y][$x]) - { - $plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true; - } - } - } - $plane_offset_x += 11; - } - - // calculate our first buffer, we can't actually draw polys with these yet - // img_pos_prev == screen x,y location to our immediate left. - // img_pos_cur == current screen x,y location - // we calculate screen position of our - // current cell based on the difference from the previous cell - // rather than recalculating from absolute coordinates - // What we cache into the $img_buffer contains the raised text coordinates. - $img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']); - $cur_height = $prev_height = $this->wave_height(0, 0, $subdivision_factor); - $full_x = $plane_x * $subdivision_factor; - $full_y = $plane_y * $subdivision_factor; - - for ($x = 1; $x <= $full_x; ++$x) - { - $cur_height = $this->wave_height($x, 0, $subdivision_factor); - $offset = $cur_height - $prev_height; - $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); - - $img_buffer[0][$x] = $img_pos_cur; - $img_pos_prev = $img_pos_cur; - $prev_height = $cur_height; - } - - for ($y = 1; $y <= $full_y; ++$y) - { - // swap buffers - $buffer_cur = $y & 1; - $buffer_prev = 1 - $buffer_cur; - - $prev_height = $this->wave_height(0, $y, $subdivision_factor); - $offset = $prev_height - $this->wave_height(0, $y - 1, $subdivision_factor); - $img_pos_cur = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1)); - - // make sure we don't try to write off the page - $img_pos_prev = $img_pos_cur; - - $img_buffer[$buffer_cur][0] = $img_pos_cur; - - for ($x = 1; $x <= $full_x; ++$x) - { - $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, $x_grid, $y_grid, 1); - - // height is a z-factor, not a y-factor - $offset = $cur_height - $prev_height; - $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); - - // height is float, index it to an int, get closest color - $color = $colors[intval($cur_height)]; - $img_pos_prev = $img_pos_cur; - $prev_height = $cur_height; - - $y_index_old = intval(($y - 1) / $subdivision_factor); - $y_index_new = intval($y / $subdivision_factor); - $x_index_old = intval(($x - 1) / $subdivision_factor); - $x_index_new = intval($x / $subdivision_factor); - - if (!empty($plane[$y_index_new][$x_index_new])) - { - $img_pos_cur[1] += $this->wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height; - $color = $colors[20]; - } - $img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1); - $img_buffer[$buffer_cur][$x] = $img_pos_cur; - - // Smooth the edges as much as possible by having not more than one low<->high traingle per square - // Otherwise, just - $diag_down = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new])); - $diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old])); - - // natural switching - $mode = ($x + $y) & 1; - - // override if it requires it - if ($diag_down != $diag_up) - { - $mode = $diag_up; - } - - if ($mode) - { - // +-/ / - // 1 |/ 2 /| - // / /-+ - $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x]); - $poly2 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_cur][$x], $img_buffer[$buffer_prev][$x]); - } - else - { - // \ \-+ - // 1 |\ 2 \| - // +-\ \ - $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_cur][$x]); - $poly2 = array_merge($img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x], $img_buffer[$buffer_cur][$x]); - } - - imagefilledpolygon($img, $poly1, 3, $color); - imagefilledpolygon($img, $poly2, 3, $color); - } - } - - // Output image - header('Content-Type: image/png'); - header('Cache-control: no-cache, no-store'); - //$mtime = explode(' ', microtime()); - //$totaltime = $mtime[0] + $mtime[1] - $starttime; - - //echo $totaltime . "<br />\n"; - //echo memory_get_usage() - $tmp; - imagepng($img); - imagedestroy($img); - } - - function wave_height($x, $y, $factor = 1, $tweak = 0.7) - { - // stretch the wave. TODO: pretty it up - $x = $x/5 + 180; - $y = $y/4; - return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak); - } - - function grid_height($x, $y, $x_grid, $y_grid, $factor = 1) - { - return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0); - } - - function captcha_bitmaps() - { - return array( - 'width' => 9, - 'height' => 13, - 'data' => array( - 'A' => array( - array(0,0,1,1,1,1,0,0,0), - array(0,1,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'B' => array( - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'C' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'D' => array( - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'E' => array( - array(0,0,1,1,1,1,1,1,1), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'F' => array( - array(0,0,1,1,1,1,1,1,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'G' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'H' => array( - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'I' => array( - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'J' => array( - array(0,0,0,0,0,0,1,1,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,1,0), - array(0,0,0,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'K' => array( - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,1,0,0,0,0,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'L' => array( - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'M' => array( - array(0,1,0,0,0,0,0,1,0), - array(0,1,1,0,0,0,1,1,0), - array(0,1,0,1,0,1,0,1,0), - array(0,1,0,0,1,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'N' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,1,0,0,0,0,0,0,1), - array(1,0,1,0,0,0,0,0,1), - array(1,0,0,1,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,0,0,1,0,0,1), - array(1,0,0,0,0,0,1,0,1), - array(1,0,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'O' => array( - array(0,0,0,1,1,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,1,1,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'P' => array( - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'Q' => array( - array(0,0,1,1,1,1,0,0,0), - array(0,1,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,1,0,0,1,0), - array(1,0,0,0,0,1,0,1,0), - array(0,1,0,0,0,0,1,0,0), - array(0,0,1,1,1,1,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'R' => array( - array(1,1,1,1,1,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,1,0,0), - array(1,1,1,1,1,1,0,0,0), - array(1,0,1,0,0,0,0,0,0), - array(1,0,0,1,0,0,0,0,0), - array(1,0,0,0,1,0,0,0,0), - array(1,0,0,0,0,1,0,0,0), - array(1,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'S' => array( - array(0,0,1,1,1,1,1,1,1), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(1,1,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'T' => array( - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'U' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'V' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'W' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,1,0,0,0,1), - array(1,0,0,1,0,1,0,0,1), - array(1,0,1,0,0,0,1,0,1), - array(1,1,0,0,0,0,0,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'X' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'Y' => array( - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,0,0,0,1,0,0), - array(0,0,0,1,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - 'Z' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,1), - array(1,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '1' => array( - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,1,0,0,0,0), - array(0,0,1,0,1,0,0,0,0), - array(0,1,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,1,1,1,1,1,1,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '2' => array( - array(0,0,0,1,1,1,0,0,0), - array(0,0,1,0,0,0,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,1,0,0,0,0,0), - array(0,0,1,0,0,0,0,0,0), - array(0,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,0,0), - ), - '3' => array( - array(0,0,0,1,1,1,1,0,0), - array(0,0,1,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,1,0), - array(0,0,0,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '4' => array( - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,1,0), - array(0,0,0,0,0,1,0,1,0), - array(0,0,0,0,1,0,0,1,0), - array(0,0,0,1,0,0,0,1,0), - array(0,0,1,0,0,0,0,1,0), - array(0,1,1,1,1,1,1,1,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '5' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(0,1,0,0,0,0,0,0,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '6' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,0,0,0,0,0,0), - array(1,0,0,1,1,1,1,0,0), - array(1,0,1,0,0,0,0,1,0), - array(1,1,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '7' => array( - array(1,1,1,1,1,1,1,1,1), - array(1,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,1,0), - array(0,0,0,0,0,0,1,0,0), - array(0,0,0,0,0,1,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,1,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '8' => array( - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,1,0,0,0,0,0,1,0), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(1,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,0), - array(0,0,1,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - '9' => array( - array(0,0,0,1,1,1,1,0,0), - array(0,0,1,0,0,0,0,1,0), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,1,1), - array(0,0,1,1,1,1,1,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,0,0,0,0,0,0,0,1), - array(0,1,0,0,0,0,0,0,1), - array(0,0,1,0,0,0,0,1,0), - array(0,0,0,1,1,1,1,0,0), - array(0,0,0,0,0,0,0,0,0), - array(0,0,0,0,0,0,0,0,0), - ), - ) - ); - } -} diff --git a/phpBB/includes/captcha/captcha_non_gd.php b/phpBB/includes/captcha/captcha_non_gd.php deleted file mode 100644 index bb5067cafa..0000000000 --- a/phpBB/includes/captcha/captcha_non_gd.php +++ /dev/null @@ -1,389 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Main non-gd captcha class -* @ignore -* @package VC -*/ -class captcha -{ - var $filtered_pngs; - var $width = 320; - var $height = 50; - - /** - * Define filtered pngs on init - */ - function captcha() - { - // If we can we will generate a single filtered png, we avoid nastiness via emulation of some Zlib stuff - $this->define_filtered_pngs(); - } - - /** - * Create the image containing $code with a seed of $seed - */ - function execute($code, $seed) - { - $img_height = $this->height - 10; - $img_width = 0; - - mt_srand($seed); - - $char_widths = $hold_chars = array(); - $code_len = strlen($code); - - for ($i = 0; $i < $code_len; $i++) - { - $char = $code[$i]; - - $width = mt_rand(0, 4); - $raw_width = $this->filtered_pngs[$char]['width']; - $char_widths[$i] = $width; - $img_width += $raw_width - $width; - - // Split the char into chunks of $raw_width + 1 length - if (empty($hold_chars[$char])) - { - $hold_chars[$char] = str_split(base64_decode($this->filtered_pngs[$char]['data']), $raw_width + 1); - } - } - - $offset_x = mt_rand(0, $this->width - $img_width); - $offset_y = mt_rand(0, $this->height - $img_height); - - $image = ''; - for ($i = 0; $i < $this->height; $i++) - { - $image .= chr(0); - - if ($i > $offset_y && $i < $offset_y + $img_height) - { - for ($j = 0; $j < $offset_x; $j++) - { - $image .= chr(mt_rand(140, 255)); - } - - for ($j = 0; $j < $code_len; $j++) - { - $image .= $this->randomise(substr($hold_chars[$code{$j}][$i - $offset_y - 1], 1), $char_widths[$j]); - } - - for ($j = $offset_x + $img_width; $j < $this->width; $j++) - { - $image .= chr(mt_rand(140, 255)); - } - } - else - { - for ($j = 0; $j < $this->width; $j++) - { - $image .= chr(mt_rand(140, 255)); - } - } - } - unset($hold_chars); - - $image = $this->create_png($image, $this->width, $this->height); - - // Output image - header('Content-Type: image/png'); - header('Cache-control: no-cache, no-store'); - echo $image; - exit; - } - - /** - * This is designed to randomise the pixels of the image data within - * certain limits so as to keep it readable. It also varies the image - * width a little - */ - function randomise($scanline, $width) - { - $new_line = ''; - - $end = strlen($scanline) - ceil($width/2); - for ($i = (int) floor($width / 2); $i < $end; $i++) - { - $pixel = ord($scanline{$i}); - - if ($pixel < 190) - { - $new_line .= chr(mt_rand(0, 205)); - } - else if ($pixel > 190) - { - $new_line .= chr(mt_rand(145, 255)); - } - else - { - $new_line .= $scanline{$i}; - } - } - - return $new_line; - } - - /** - * This creates a chunk of the given type, with the given data - * of the given length adding the relevant crc - */ - function png_chunk($length, $type, $data) - { - $raw = $type . $data; - - return pack('N', $length) . $raw . pack('N', crc32($raw)); - } - - /** - * Creates greyscale 8bit png - The PNG spec can be found at - * http://www.libpng.org/pub/png/spec/PNG-Contents.html we use - * png because it's a fully recognised open standard and supported - * by practically all modern browsers and OSs - */ - function create_png($raw_image, $width, $height) - { - // SIG - $image = pack('C8', 137, 80, 78, 71, 13, 10, 26, 10); - - // IHDR - $raw = pack('N2', $width, $height); - $raw .= pack('C5', 8, 0, 0, 0, 0); - $image .= $this->png_chunk(13, 'IHDR', $raw); - - // IDAT - if (@extension_loaded('zlib')) - { - $raw_image = gzcompress($raw_image); - $length = strlen($raw_image); - } - else - { - // The total length of this image, uncompressed, is just a calculation of pixels - $length = ($width + 1) * $height; - - // Adler-32 hash generation - // Note: The hash is _backwards_ so we must reverse it - - if (@extension_loaded('hash')) - { - $adler_hash = strrev(hash('adler32', $raw_image, true)); - } - else if (@extension_loaded('mhash')) - { - $adler_hash = strrev(mhash(MHASH_ADLER32, $raw_image)); - } - else - { - // Optimized Adler-32 loop ported from the GNU Classpath project - $temp_length = $length; - $s1 = 1; - $s2 = $index = 0; - - while ($temp_length > 0) - { - // We can defer the modulo operation: - // s1 maximally grows from 65521 to 65521 + 255 * 3800 - // s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31 - $substract_value = ($temp_length < 3800) ? $temp_length : 3800; - $temp_length -= $substract_value; - - while (--$substract_value >= 0) - { - $s1 += ord($raw_image[$index]); - $s2 += $s1; - - $index++; - } - - $s1 %= 65521; - $s2 %= 65521; - } - $adler_hash = pack('N', ($s2 << 16) | $s1); - } - - // This is the same thing as gzcompress($raw_image, 0) but does not need zlib - $raw_image = pack('C3v2', 0x78, 0x01, 0x01, $length, ~$length) . $raw_image . $adler_hash; - - // The Zlib header + Adler hash make us add on 11 - $length += 11; - } - - // IDAT - $image .= $this->png_chunk($length, 'IDAT', $raw_image); - - // IEND - $image .= $this->png_chunk(0, 'IEND', ''); - - return $image; - } - - /** - * png image data - * Each 'data' element is base64_encoded uncompressed IDAT - */ - function define_filtered_pngs() - { - $this->filtered_pngs = array( - '0' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////olFAkBAAAGDyA4P///M31/////////////wD////////////////0dAgAAAAAAAAAAAAEcPipFGHn////////////AP//////////////6DAAAAAAAAAAAAAAAAAALSEAN+T///////////8A//////////////xAAAAAAAAAAAAAAAAAAAAAACPA/////////////wD/////////////oAAAAAAAAAAAAAAAAAAAAAAAev//////////////AP////////////8oAAAAAAAAPNj/zDAAAAAAAABD//////////////8A////////////1AAAAAAAABjw////5BAAAAAAAADo/////////////wD///////////+QAAAAAAAAbP//////QgAAAAAAAKj/////////////AP///////////1wAAAAAAACs/////8AXAAAAAAAAcP////////////8A////////////OAAAAAAAAND////dNwAAAAAAAABI/////////////wD///////////8gAAAAAAAA4P//7koACwAAAAAAACT/////////////AP///////////wgAAAAAAAD///VqAwaPAAAAAAAAEP////////////8A////////////AAAAAAAAAP/8kQYDavUAAAAAAAAA/////////////wD///////////8AAAAAAAAA/6kNAEru/wAAAAAAAAD/////////////AP///////////wAAAAAAAADAIwA33f//AAAAAAAAAP////////////8A////////////FAAAAAAAADYAI8D///8AAAAAAAAQ/////////////wD///////////8kAAAAAAAAAA2p////5AAAAAAAACD/////////////AP///////////0gAAAAAAAAFkfz////UAAAAAAAAQP////////////8A////////////cAAAAAAAAET1/////7AAAAAAAABo/////////////wD///////////+oAAAAAAAAXfX/////sAAAAAAAAGj/////////////AAAAALgAAAAAAAAwAAAAAAAAAAAAAAD////////////oAAAAAAAACOT////oEAAAAAAAAOD/////////////AP////////////8+AAAAAAAAKMz/zDQAAAAAAAA0//////////////8A////////////7jgAAAAAAAAAAAAAAAAAAAAAAKT//////////////wD///////////VqAwIAAAAAAAAAAAAAAAAAAAA8////////////////AP//////////rQcDaVEAAAAAAAAAAAAAAAAAKOj///////////////8A///////////nblnu/IAIAAAAAAAAAAAAAFzw/////////////////wD////////////79////+iITCAAAAAgSITg////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////w==', - 'width' => 40 - ), - '1' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////8BAAAAAAAP//////////////////AP////////////////////////9sAAAAAAAA//////////////////8A////////////////////////pAAAAAAAAAD//////////////////wD//////////////////////6wEAAAAAAAAAP//////////////////AP////////////////////h4AAAAAAAAAAAA//////////////////8A//////////////////ygJAAAAAAAAAAAAAD//////////////////wD//////////////9x8HAAAAAAAAAAAAAAAAP//////////////////AP//////////////AAAAAAAAAAAAAAAAAAAA//////////////////8A//////////////8AAAAAAAAAAAAAAAAAAAD//////////////////wD//////////////wAAAAAAAAR4AAAAAAAAAP//////////////////AP//////////////AAAAAAA4zP8AAAAAAAAA//////////////////8A//////////////8AAAA4sP///wAAAAAAAAD//////////////////wD//////////////yR80P//////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '2' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////okFAkCAAABCBIfNT///////////////////8A///////////////8hAgAAAAAAAAAAAAAAFTo/////////////////wD//////////////1QAAAAAAAAAAAAAAAAAACjo////////////////AP////////////+MAAAAAAAAAAAAAAAAAAAAADj///////////////8A////////////9BAAAAAAAAAAAAAAAAAAAAAAALD//////////////wD///////////+gAAAAAAAAAHjs+KwMAAAAAAAAVP//////////////AP///////////1gAAAAAAABM/////6QAAAAAAAAU//////////////8A////////////KAAAAAAAALj/////+AAAAAAAAAD//////////////wD///////////+MfGBMOCAI8P/////wAAAAAAAACP//////////////AP///////////////////////////5wAAAAAAAAw//////////////8A///////////////////////////oFAAAAAAAAHz//////////////wD/////////////////////////6CgAAAAAAAAE3P//////////////AP///////////////////////9ggAAAAAAAAAHT///////////////8A//////////////////////+0DAAAAAAAAAA8+P///////////////wD/////////////////////gAAAAAAAAAAAKOj/////////////////AP//////////////////9FAAAAAAAAAAADzw//////////////////8A/////////////////+g4AAAAAAAAAABk/P///////////////////wD////////////////oKAAAAAAAAAAMqP//////////////////////AP//////////////6CgAAAAAAAAAMNz///////////////////////8A//////////////g4AAAAAAAAAFT0/////////////////////////wD/////////////bAAAAAAAAABU/P//////////////////////////AP///////////8wAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A////////////SAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////9AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////xAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '3' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////8sGg0FAAAACA4cLz8////////////////////AP//////////////rBgAAAAAAAAAAAAAACTA//////////////////8A/////////////3QAAAAAAAAAAAAAAAAAAASs/////////////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAjc////////////////AP//////////6AwAAAAAAAAAAAAAAAAAAAAAAGT///////////////8A//////////94AAAAAAAABJDw/8g4AAAAAAAAHP///////////////wD//////////yAAAAAAAACE/////9gAAAAAAAAA////////////////AP///////////NSwiGQ4FOT//////AAAAAAAABD///////////////8A//////////////////////////+YAAAAAAAAVP///////////////wD//////////////////////P/ggAQAAAAAAATM////////////////AP////////////////////9gAAAAAAAAAAAElP////////////////8A/////////////////////0AAAAAAAAAAHLj//////////////////wD/////////////////////OAAAAAAAAAAwkPj/////////////////AP////////////////////8gAAAAAAAAAAAAINj///////////////8A/////////////////////xAAAAAAAAAAAAAAIPD//////////////wD/////////////////////uOz/4HgEAAAAAAAAhP//////////////AP///////////////////////////3wAAAAAAAAw//////////////8A////////////////////////////6AAAAAAAAAj//////////////wD/////////////////////////////AAAAAAAAAP//////////////AP//////////tJh8YEQoDNz//////+AAAAAAAAAY//////////////8A//////////88AAAAAAAAaP//////dAAAAAAAAEz//////////////wD//////////6QAAAAAAAAAdOD/5HQAAAAAAAAApP//////////////AP///////////CgAAAAAAAAAAAAAAAAAAAAAACD4//////////////8A////////////yAQAAAAAAAAAAAAAAAAAAAAEuP///////////////wD/////////////rAQAAAAAAAAAAAAAAAAABJD/////////////////AP//////////////zDQAAAAAAAAAAAAAACTA//////////////////8A/////////////////8BwOCAAAAAUNGi0/P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '4' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////////////nAAAAAAAAAD///////////////8A/////////////////////////8AEAAAAAAAAAP///////////////wD////////////////////////gGAAAAAAAAAAA////////////////AP//////////////////////9DAAAAAAAAAAAAD///////////////8A//////////////////////9UAAAAAAAAAAAAAP///////////////wD/////////////////////hAAAAAAAAAAAAAAA////////////////AP///////////////////7QAAAAAAAAAAAAAAAD///////////////8A///////////////////UDAAAAAAUAAAAAAAAAP///////////////wD/////////////////7CQAAAAABMAAAAAAAAAA////////////////AP////////////////xEAAAAAACU/wAAAAAAAAD///////////////8A////////////////cAAAAAAAZP//AAAAAAAAAP///////////////wD//////////////6AAAAAAADz8//8AAAAAAAAA////////////////AP/////////////IBAAAAAAc6P///wAAAAAAAAD///////////////8A////////////5BgAAAAADMz/////AAAAAAAAAP///////////////wD///////////g0AAAAAACk//////8AAAAAAAAA////////////////AP//////////XAAAAAAAfP///////wAAAAAAAAD///////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP///////////////////////////wAAAAAAAAD///////////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '5' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////8AAAAAAAAAAAAAAAAAAAAAAA//////////////8A///////////////MAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////6wAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////iAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////////9kAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////0QAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////IAAAAAAAYP////////////////////////////8A//////////////wAAAAAAAB8/////////////////////////////wD/////////////3AAAAAAAAIj/////////////////////////////AP////////////+4AAAAAAAAoLRYHAAEKGTE//////////////////8A/////////////5QAAAAAAAAQAAAAAAAAAABY9P///////////////wD/////////////dAAAAAAAAAAAAAAAAAAAAAA89P//////////////AP////////////9QAAAAAAAAAAAAAAAAAAAAAABg//////////////8A/////////////zAAAAAAAAAAAAAAAAAAAAAAAADQ/////////////wD/////////////IAAAAAAAAGjY/+h4BAAAAAAAAGz/////////////AP//////////////9NS0lHSc//////90AAAAAAAALP////////////8A/////////////////////////////9QAAAAAAAAE/////////////wD//////////////////////////////wAAAAAAAAD/////////////AP/////////////////////////////8AAAAAAAAEP////////////8A////////////pIRwWEAgDOD//////8wAAAAAAAA8/////////////wD///////////9EAAAAAAAAaP//////ZAAAAAAAAHz/////////////AP///////////6QAAAAAAAAAaOD/4GQAAAAAAAAE4P////////////8A/////////////CQAAAAAAAAAAAAAAAAAAAAAAGD//////////////wD/////////////yAQAAAAAAAAAAAAAAAAAAAAc7P//////////////AP//////////////rAwAAAAAAAAAAAAAAAAAGNj///////////////8A////////////////0EAAAAAAAAAAAAAAAFTo/////////////////wD//////////////////8h4QCAAAAAcQHzU////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '6' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////+0ZCwMAAAUNGjI////////////////////AP/////////////////EMAAAAAAAAAAAAABM6P////////////////8A////////////////lAQAAAAAAAAAAAAAAAAo6P///////////////wD//////////////6wAAAAAAAAAAAAAAAAAAABI////////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAACw//////////////8A/////////////3AAAAAAAAAoxP/YPAAAAAAAAEj//////////////wD////////////4EAAAAAAACOD////YDCBAVGiAoP//////////////AP///////////7gAAAAAAABY//////////////////////////////8A////////////eAAAAAAAAJT//////////////////////////////wD///////////9MAAAAAAAAvP/IXBgABCx03P//////////////////AP///////////ygAAAAAAADcdAAAAAAAAAAEiP////////////////8A////////////FAAAAAAAAFAAAAAAAAAAAAAAcP///////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAlP//////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAQ8P////////////8A////////////AAAAAAAAAABAyP/kZAAAAAAAAACQ/////////////wD///////////8MAAAAAAAALPj/////WAAAAAAAAET/////////////AP///////////yQAAAAAAACY///////MAAAAAAAAFP////////////8A////////////SAAAAAAAAMD///////wAAAAAAAAA/////////////wD///////////9wAAAAAAAAvP///////wAAAAAAAAD/////////////AP///////////7QAAAAAAACI///////UAAAAAAAAJP////////////8A////////////+AwAAAAAACDw/////2wAAAAAAABY/////////////wD/////////////cAAAAAAAADC8/Ox4AAAAAAAAAKj/////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAAAk/P////////////8A//////////////+oAAAAAAAAAAAAAAAAAAAABLj//////////////wD///////////////+QAAAAAAAAAAAAAAAAAACQ////////////////AP////////////////+0JAAAAAAAAAAAAAAkuP////////////////8A///////////////////8sGg0FAAADCxgqPz//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '7' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAABP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAy4/////////////wD//////////////////////////+QUAAAAAAAEuP//////////////AP/////////////////////////8QAAAAAAAAKT///////////////8A/////////////////////////4wAAAAAAAB0/////////////////wD////////////////////////cCAAAAAAANPz/////////////////AP///////////////////////0QAAAAAAATY//////////////////8A//////////////////////+0AAAAAAAAeP///////////////////wD//////////////////////CQAAAAAABTw////////////////////AP////////////////////+gAAAAAAAAkP////////////////////8A/////////////////////ywAAAAAABDw/////////////////////wD///////////////////+4AAAAAAAAbP//////////////////////AP///////////////////1wAAAAAAADQ//////////////////////8A///////////////////4DAAAAAAAMP///////////////////////wD//////////////////7QAAAAAAAB8////////////////////////AP//////////////////aAAAAAAAAMj///////////////////////8A//////////////////8oAAAAAAAM/P///////////////////////wD/////////////////8AAAAAAAAET/////////////////////////AP////////////////+0AAAAAAAAcP////////////////////////8A/////////////////4wAAAAAAACY/////////////////////////wD/////////////////WAAAAAAAAMD/////////////////////////AP////////////////80AAAAAAAA4P////////////////////////8A/////////////////xAAAAAAAAD4/////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '8' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////////IdDQUAAAEIEiA1P//////////////////AP/////////////////gRAAAAAAAAAAAAAAAROD///////////////8A////////////////0BgAAAAAAAAAAAAAAAAAEMj//////////////wD///////////////AcAAAAAAAAAAAAAAAAAAAAHPD/////////////AP//////////////hAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A//////////////8sAAAAAAAAKMz/zCgAAAAAAAAs/////////////wD//////////////wAAAAAAAADM////zAAAAAAAAAD/////////////AP//////////////BAAAAAAAAP//////AAAAAAAABP////////////8A//////////////8sAAAAAAAAzP///9QAAAAAAAAw/////////////wD//////////////3wAAAAAAAAoyP/YNAAAAAAAAIT/////////////AP//////////////7BgAAAAAAAAAAAAAAAAAAAAc8P////////////8A////////////////xBgAAAAAAAAAAAAAAAAAGNj//////////////wD/////////////////tAQAAAAAAAAAAAAAAACo////////////////AP///////////////HAAAAAAAAAAAAAAAAAAAAB8//////////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB8/////////////wD/////////////wAAAAAAAAABk4P/UWAAAAAAAAATQ////////////AP////////////9UAAAAAAAAaP//////XAAAAAAAAGT///////////8A/////////////xgAAAAAAADg///////cAAAAAAAAJP///////////wD/////////////AAAAAAAAAP////////8AAAAAAAAA////////////AP////////////8AAAAAAAAA4P//////3AAAAAAAAAT///////////8A/////////////ygAAAAAAABg//////9cAAAAAAAALP///////////wD/////////////ZAAAAAAAAABY1P/cXAAAAAAAAABw////////////AP/////////////QAAAAAAAAAAAAAAAAAAAAAAAABNz///////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB0/////////////wD///////////////Q8AAAAAAAAAAAAAAAAAAAAUPz/////////////AP////////////////x4CAAAAAAAAAAAAAAAEIT8//////////////8A///////////////////smFQwGAAAABg0ZKT0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - '9' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////ysYCwMAAAUNGiw/P//////////////////AP////////////////+4JAAAAAAAAAAAAAAkuP////////////////8A////////////////lAQAAAAAAAAAAAAAAAAAkP///////////////wD//////////////8AEAAAAAAAAAAAAAAAAAAAAqP//////////////AP/////////////8JAAAAAAAAAAAAAAAAAAAAAAQ7P////////////8A/////////////6wAAAAAAAAAfOz8vCwAAAAAAABw/////////////wD/////////////WAAAAAAAAHD/////7BgAAAAAAAz4////////////AP////////////8kAAAAAAAA1P//////hAAAAAAAALT///////////8A/////////////wAAAAAAAAD///////+4AAAAAAAAcP///////////wD/////////////AAAAAAAAAPz//////8AAAAAAAABI////////////AP////////////8UAAAAAAAAzP//////lAAAAAAAACT///////////8A/////////////0QAAAAAAABY//////gsAAAAAAAADP///////////wD/////////////kAAAAAAAAABw5P/IPAAAAAAAAAAA////////////AP/////////////wEAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////////+UAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////9wAAAAAAAAAAAAAFAAAAAAAAAU////////////AP////////////////+IBAAAAAAAAABw3AAAAAAAACj///////////8A///////////////////cdCwEABhcxP+8AAAAAAAATP///////////wD//////////////////////////////5AAAAAAAAB4////////////AP//////////////////////////////UAAAAAAAALj///////////8A//////////////+kgGxUQCAM2P///+AIAAAAAAAQ+P///////////wD//////////////0gAAAAAAAA42P/EKAAAAAAAAHD/////////////AP//////////////sAAAAAAAAAAAAAAAAAAAAAAQ6P////////////8A////////////////TAAAAAAAAAAAAAAAAAAAAKz//////////////wD////////////////oKAAAAAAAAAAAAAAAAASU////////////////AP/////////////////sUAAAAAAAAAAAAAAwxP////////////////8A////////////////////yHA0FAAADCxktP///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'A' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////+QAAAAAAAAAAAAAAOT/////////////////AP//////////////////kAAAAAAAAAAAAAAAkP////////////////8A//////////////////88AAAAAAAAAAAAAAA8/////////////////wD/////////////////5AAAAAAAAAAAAAAAAADk////////////////AP////////////////+QAAAAAAAAAAAAAAAAAJD///////////////8A/////////////////zwAAAAAAAAAAAAAAAAAPP///////////////wD////////////////kAAAAAAAAAAgAAAAAAAAA5P//////////////AP///////////////5AAAAAAAAAAgAAAAAAAAACQ//////////////8A////////////////PAAAAAAAAAz8HAAAAAAAADz//////////////wD//////////////+QAAAAAAAAAWP9kAAAAAAAAANz/////////////AP//////////////kAAAAAAAAACk/7wAAAAAAAAAhP////////////8A//////////////88AAAAAAAABOz//BQAAAAAAAAw/////////////wD/////////////4AAAAAAAAAA8////ZAAAAAAAAADc////////////AP////////////+EAAAAAAAAAIj///+8AAAAAAAAAIT///////////8A/////////////zAAAAAAAAAA2P////wQAAAAAAAAMP///////////wD////////////cAAAAAAAAACT//////1wAAAAAAAAA3P//////////AP///////////4QAAAAAAAAAAAAAAAAAAAAAAAAAAACE//////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAAAAAADD//////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANz/////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhP////////8A//////////8wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw/////////wD/////////3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc////////AP////////+EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIT///////8A/////////zAAAAAAAAAAhP///////////2QAAAAAAAAAMP///////wD////////cAAAAAAAAAADM////////////vAAAAAAAAAAA3P//////AP///////4QAAAAAAAAAHP/////////////4DAAAAAAAAACE//////8A////////MAAAAAAAAABk//////////////9cAAAAAAAAADD//////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'B' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAEDh83P///////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAEhP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAeP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAABY////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAABT///////////8A//////////8AAAAAAAAAAP/////4zEwAAAAAAAAAAP///////////wD//////////wAAAAAAAAAA////////7AAAAAAAAAAQ////////////AP//////////AAAAAAAAAAD////////sAAAAAAAAAEj///////////8A//////////8AAAAAAAAAAP/////4zEQAAAAAAAAAtP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAFz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAiA/P////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAIjPj//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAGKz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJT///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAABNz//////////wD//////////wAAAAAAAAAA///////sqCAAAAAAAAAAbP//////////AP//////////AAAAAAAAAAD/////////yAAAAAAAAAAs//////////8A//////////8AAAAAAAAAAP//////////AAAAAAAAAAT//////////wD//////////wAAAAAAAAAA/////////7wAAAAAAAAAAP//////////AP//////////AAAAAAAAAAD//////+ikGAAAAAAAAAAY//////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFT//////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsP//////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAADj///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAc6P///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAATOj/////////////AP//////////AAAAAAAAAAAAAAAAAAAEIEBkkNj///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'C' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////5JRULBAAAAgkTIDQ//////////////////8A////////////////1FAAAAAAAAAAAAAAAABAyP///////////////wD//////////////4gEAAAAAAAAAAAAAAAAAAAElP//////////////AP////////////9wAAAAAAAAAAAAAAAAAAAAAAAAlP////////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAEyP///////////wD//////////9wIAAAAAAAAAAAAAAAAAAAAAAAAAAAw////////////AP//////////WAAAAAAAAAAAWMz/8JwQAAAAAAAAAACw//////////8A/////////+wEAAAAAAAAAID//////9QMAAAAAAAAAET//////////wD/////////nAAAAAAAAAAo/P///////3wAAAAABDBspP//////////AP////////9gAAAAAAAAAIz/////////3BxQjMT0//////////////8A/////////zQAAAAAAAAAzP///////////////////////////////wD/////////GAAAAAAAAADo////////////////////////////////AP////////8AAAAAAAAAAP////////////////////////////////8A/////////wAAAAAAAAAA/////////////////////////////////wD/////////AAAAAAAAAAD/////////////////////////////////AP////////8cAAAAAAAAAOj///////////////////////////////8A/////////zgAAAAAAAAA0P/////////kIGio7P///////////////wD/////////bAAAAAAAAACg/////////5wAAAAAMHS49P//////////AP////////+oAAAAAAAAAEz/////////PAAAAAAAAAAc//////////8A//////////QIAAAAAAAAALz//////6QAAAAAAAAAAGT//////////wD//////////3AAAAAAAAAADIzo/+SEBAAAAAAAAAAAyP//////////AP//////////7BAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////rAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD/////////////fAAAAAAAAAAAAAAAAAAAAAAAAJz/////////////AP//////////////iAQAAAAAAAAAAAAAAAAAAASY//////////////8A////////////////yEAAAAAAAAAAAAAAAAA8yP///////////////wD//////////////////9yIUCwQAAAAIEB4yP//////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'D' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAADChQkOT/////////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAABGjw//////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAACDY/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAABjk////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKj//////////wD///////////8AAAAAAAAAAP///+isSAAAAAAAAAAANP//////////AP///////////wAAAAAAAAAA////////hAAAAAAAAAAA2P////////8A////////////AAAAAAAAAAD/////////MAAAAAAAAACQ/////////wD///////////8AAAAAAAAAAP////////+MAAAAAAAAAFj/////////AP///////////wAAAAAAAAAA/////////8gAAAAAAAAAMP////////8A////////////AAAAAAAAAAD/////////5AAAAAAAAAAY/////////wD///////////8AAAAAAAAAAP//////////AAAAAAAAAAD/////////AP///////////wAAAAAAAAAA//////////8AAAAAAAAAAP////////8A////////////AAAAAAAAAAD//////////wAAAAAAAAAA/////////wD///////////8AAAAAAAAAAP/////////wAAAAAAAAABD/////////AP///////////wAAAAAAAAAA/////////9QAAAAAAAAAJP////////8A////////////AAAAAAAAAAD/////////qAAAAAAAAABI/////////wD///////////8AAAAAAAAAAP////////9QAAAAAAAAAHj/////////AP///////////wAAAAAAAAAA////////uAAAAAAAAAAAvP////////8A////////////AAAAAAAAAAD////w0HwEAAAAAAAAACT8/////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAADz8//////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAY6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAKNz/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAACHT0//////////////8A////////////AAAAAAAAAAAAAAAAABg4bKj0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'E' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'F' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'G' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////MB8TCgQAAAACCA4YJzs////////////////AP///////////////JQcAAAAAAAAAAAAAAAAAAhw8P////////////8A/////////////9gwAAAAAAAAAAAAAAAAAAAAAAAk2P///////////wD////////////EDAAAAAAAAAAAAAAAAAAAAAAAAAAc7P//////////AP//////////2AwAAAAAAAAAAAAAAAAAAAAAAAAAAABY//////////8A//////////wwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQ/////////wD/////////kAAAAAAAAAAAEHzQ/P/gmCAAAAAAAAAAAFz/////////AP////////wcAAAAAAAAACjg////////8CwAAAAAAAAgWP////////8A////////vAAAAAAAAAAI2P//////////yBRAcJjI8P///////////wD///////94AAAAAAAAAGD/////////////////////////////////AP///////0AAAAAAAAAAsP////////////////////////////////8A////////IAAAAAAAAADc/////////////////////////////////wD///////8AAAAAAAAAAP///////wAAAAAAAAAAAAAAAAD/////////AP///////wAAAAAAAAAA////////AAAAAAAAAAAAAAAAAP////////8A////////AAAAAAAAAAD///////8AAAAAAAAAAAAAAAAA/////////wD///////8gAAAAAAAAAOD//////wAAAAAAAAAAAAAAAAD/////////AP///////0AAAAAAAAAAtP//////AAAAAAAAAAAAAAAAAP////////8A////////cAAAAAAAAABw//////8AAAAAAAAAAAAAAAAA/////////wD///////+8AAAAAAAAABDs////////////AAAAAAAAAAD/////////AP////////wYAAAAAAAAADz0//////////AAAAAAAAAAAP////////8A/////////5AAAAAAAAAAACCY4P//3KhcCAAAAAAAAAAA/////////wD/////////+CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////AP//////////xAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIP////////8A////////////rAQAAAAAAAAAAAAAAAAAAAAAAAAAAGTw/////////wD/////////////vBQAAAAAAAAAAAAAAAAAAAAAADjI////////////AP//////////////8HAQAAAAAAAAAAAAAAAAAEiw//////////////8A//////////////////iwcEAgBAAABCA4aKDk/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'H' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'I' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'J' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAj//////////////wD//////////+zMrIxwUDAQ//////wAAAAAAAAAIP//////////////AP//////////DAAAAAAAAADo////2AAAAAAAAAA0//////////////8A//////////8wAAAAAAAAAKj///+YAAAAAAAAAFj//////////////wD//////////2gAAAAAAAAAIND/yBgAAAAAAAAAkP//////////////AP//////////vAAAAAAAAAAAAAAAAAAAAAAAAADc//////////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAUP///////////////wD////////////EBAAAAAAAAAAAAAAAAAAAABjk////////////////AP////////////+sBAAAAAAAAAAAAAAAAAAY2P////////////////8A///////////////EMAAAAAAAAAAAAAAAVOj//////////////////wD/////////////////vHBAIAAAABg8fNT/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'K' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////8AAAAAAAAAAP//////////wAQAAAAAAAAAAABw////////AP///////wAAAAAAAAAA/////////9AMAAAAAAAAAAAAcP////////8A////////AAAAAAAAAAD////////cGAAAAAAAAAAAAHD//////////wD///////8AAAAAAAAAAP//////6CgAAAAAAAAAAABs////////////AP///////wAAAAAAAAAA//////Q0AAAAAAAAAAAAVPz///////////8A////////AAAAAAAAAAD////8RAAAAAAAAAAAAFT8/////////////wD///////8AAAAAAAAAAP///1gAAAAAAAAAAABU/P//////////////AP///////wAAAAAAAAAA//9wAAAAAAAAAAAASPz///////////////8A////////AAAAAAAAAAD/jAAAAAAAAAAAADz0/////////////////wD///////8AAAAAAAAAAKQAAAAAAAAAAAA89P//////////////////AP///////wAAAAAAAAAABAAAAAAAAAAAFPT///////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAApP///////////////////wD///////8AAAAAAAAAAAAAAAAAAAAAAAAU8P//////////////////AP///////wAAAAAAAAAAAAAAAAAAAAAAAABk//////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAAAADE/////////////////wD///////8AAAAAAAAAAAAAAAAoEAAAAAAAACz8////////////////AP///////wAAAAAAAAAAAAAAGNiAAAAAAAAAAIj///////////////8A////////AAAAAAAAAAAAABjY//gYAAAAAAAACOD//////////////wD///////8AAAAAAAAAAAAY2P///5wAAAAAAAAASP//////////////AP///////wAAAAAAAAAAGNj//////CgAAAAAAAAAqP////////////8A////////AAAAAAAAAADI////////sAAAAAAAAAAc8P///////////wD///////8AAAAAAAAAAP//////////QAAAAAAAAABs////////////AP///////wAAAAAAAAAA///////////IAAAAAAAAAATI//////////8A////////AAAAAAAAAAD///////////9YAAAAAAAAADD8/////////wD///////8AAAAAAAAAAP///////////9wEAAAAAAAAAJD/////////AP///////wAAAAAAAAAA/////////////3AAAAAAAAAADOT///////8A////////AAAAAAAAAAD/////////////7BAAAAAAAAAAUP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'L' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'M' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////8AAAAAAAAAAAAAAHz//////3wAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAATP//////UAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAc//////8cAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAADw////8AAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAAALz////AAAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAAkP///5AAAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAABc////ZAAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAoAAAAADD///8wAAAAACQAAAAAAAAA////////AP//////AAAAAAAAAFwAAAAABPz//AgAAAAAXAAAAAAAAAD///////8A//////8AAAAAAAAAkAAAAAAA0P/UAAAAAACQAAAAAAAAAP///////wD//////wAAAAAAAADMAAAAAACg/6gAAAAAAMQAAAAAAAAA////////AP//////AAAAAAAAAPgEAAAAAHD/dAAAAAAE+AAAAAAAAAD///////8A//////8AAAAAAAAA/zQAAAAAQP9IAAAAADD/AAAAAAAAAP///////wD//////wAAAAAAAAD/bAAAAAAQ/xQAAAAAaP8AAAAAAAAA////////AP//////AAAAAAAAAP+gAAAAAADQAAAAAACc/wAAAAAAAAD///////8A//////8AAAAAAAAA/9QAAAAAAGgAAAAAAND/AAAAAAAAAP///////wD//////wAAAAAAAAD//wwAAAAAFAAAAAAM/P8AAAAAAAAA////////AP//////AAAAAAAAAP//RAAAAAAAAAAAADz//wAAAAAAAAD///////8A//////8AAAAAAAAA//94AAAAAAAAAAAAcP//AAAAAAAAAP///////wD//////wAAAAAAAAD//7AAAAAAAAAAAACo//8AAAAAAAAA////////AP//////AAAAAAAAAP//5AAAAAAAAAAAANz//wAAAAAAAAD///////8A//////8AAAAAAAAA////HAAAAAAAAAAQ////AAAAAAAAAP///////wD//////wAAAAAAAAD///9QAAAAAAAAAEz///8AAAAAAAAA////////AP//////AAAAAAAAAP///4gAAAAAAAAAfP///wAAAAAAAAD///////8A//////8AAAAAAAAA////vAAAAAAAAACw////AAAAAAAAAP///////wD//////wAAAAAAAAD////wAAAAAAAAAOz///8AAAAAAAAA////////AP//////AAAAAAAAAP////8sAAAAAAAc/////wAAAAAAAAD///////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'N' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAALD/////////////AAAAAAAAAP//////////AP////////8AAAAAAAAAFOj///////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAASP///////////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAkP//////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAI1P////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAw+P///////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAABw////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAC8//////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAABzs/////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAFD/////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAJz///8AAAAAAAAA//////////8A/////////wAAAAAAAAAUAAAAAAAADNz//wAAAAAAAAD//////////wD/////////AAAAAAAAALQAAAAAAAAANPz/AAAAAAAAAP//////////AP////////8AAAAAAAAA/2wAAAAAAAAAfP8AAAAAAAAA//////////8A/////////wAAAAAAAAD/+CwAAAAAAAAExAAAAAAAAAD//////////wD/////////AAAAAAAAAP//0AQAAAAAAAAgAAAAAAAAAP//////////AP////////8AAAAAAAAA////jAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////RAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP/////kFAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA//////+sAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD///////9kAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP////////QkAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA/////////8wEAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD//////////4QAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP///////////DwAAAAAAAAAAP//////////AP////////8AAAAAAAAA////////////4BAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////////////qAAAAAAAAAD//////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'O' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////0qGw4HAAAABw4aKT0/////////////////wD////////////////wcAwAAAAAAAAAAAAAAAho6P//////////////AP//////////////uBQAAAAAAAAAAAAAAAAAAAAMoP////////////8A/////////////6AEAAAAAAAAAAAAAAAAAAAAAAAAkP///////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP//////////8BQAAAAAAAAAAAAAAAAAAAAAAAAAAAAM5P////////8A//////////9wAAAAAAAAAAAsrPD/7KQsAAAAAAAAAABg/////////wD/////////+BAAAAAAAAAAUPj///////hQAAAAAAAAAAjs////////AP////////+sAAAAAAAAABDw//////////AYAAAAAAAAAKD///////8A/////////2wAAAAAAAAAdP///////////3wAAAAAAAAAYP///////wD/////////OAAAAAAAAAC4////////////xAAAAAAAAAAw////////AP////////8cAAAAAAAAAOD////////////oAAAAAAAAABT///////8A/////////wAAAAAAAAAA//////////////8AAAAAAAAAAP///////wD/////////AAAAAAAAAAD//////////////wAAAAAAAAAA////////AP////////8AAAAAAAAAAP/////////////8AAAAAAAAAAD///////8A/////////xwAAAAAAAAA5P///////////+AAAAAAAAAAHP///////wD/////////NAAAAAAAAAC8////////////uAAAAAAAAAA4////////AP////////9oAAAAAAAAAHj///////////98AAAAAAAAAGT///////8A/////////6gAAAAAAAAAGPD/////////+BgAAAAAAAAApP///////wD/////////9AwAAAAAAAAAUPz///////xcAAAAAAAAAAjs////////AP//////////cAAAAAAAAAAALKjs//CwOAAAAAAAAAAAYP////////8A///////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzk/////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP////////////+QAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A//////////////+sEAAAAAAAAAAAAAAAAAAAAAyg/////////////wD////////////////oZAgAAAAAAAAAAAAAAARg4P//////////////AP//////////////////9KhsOCAAAAAUMFyc7P////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'P' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////wAAAAAAAAAAAAAAAAAACCxguP////////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAOOD//////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAGOD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAARP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAABo////////////AP///////////wAAAAAAAAAA////6JwMAAAAAAAAADD///////////8A////////////AAAAAAAAAAD//////6AAAAAAAAAADP///////////wD///////////8AAAAAAAAAAP//////9AAAAAAAAAAA////////////AP///////////wAAAAAAAAAA///////0AAAAAAAAAAD///////////8A////////////AAAAAAAAAAD//////5gAAAAAAAAAHP///////////wD///////////8AAAAAAAAAAP///9iICAAAAAAAAABI////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAIT/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAABU/P////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAIhPz//////////////wD///////////8AAAAAAAAAAAAAAAAABCRMkOz/////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'Q' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////SoaDQcAAAAHDhoqPT///////////////////8A//////////////BwDAAAAAAAAAAAAAAACHDo/////////////////wD///////////+4FAAAAAAAAAAAAAAAAAAAABCo////////////////AP//////////nAQAAAAAAAAAAAAAAAAAAAAAAACQ//////////////8A/////////7gEAAAAAAAAAAAAAAAAAAAAAAAAAACg/////////////wD////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzo////////////AP///////3AAAAAAAAAAACyo8P/sqCwAAAAAAAAAAGT///////////8A///////4EAAAAAAAAABM+P///////FQAAAAAAAAACPT//////////wD//////7AAAAAAAAAAFPD/////////9BgAAAAAAAAApP//////////AP//////bAAAAAAAAAB4////////////fAAAAAAAAABk//////////8A//////84AAAAAAAAALz///////////+8AAAAAAAAADT//////////wD//////xwAAAAAAAAA6P///////////+QAAAAAAAAAHP//////////AP//////AAAAAAAAAAD//////////////wAAAAAAAAAA//////////8A//////8AAAAAAAAAAP//////////////AAAAAAAAAAD//////////wD//////wAAAAAAAAAA/P////////////8AAAAAAAAAAP//////////AP//////GAAAAAAAAADg////////////4AAAAAAAAAAc//////////8A//////84AAAAAAAAALT////MJHTo//+8AAAAAAAAADT//////////wD//////2wAAAAAAAAAdP///2AAABCg/3wAAAAAAAAAZP//////////AP//////rAAAAAAAAAAY9P/sCAAAAABMGAAAAAAAAACk//////////8A///////4EAAAAAAAAABU/P+0OAAAAAAAAAAAAAAACPT//////////wD///////94AAAAAAAAAAA4sPD/gAAAAAAAAAAAAABk////////////AP////////AcAAAAAAAAAAAAAAAAAAAAAAAAAAAADOT///////////8A/////////7wEAAAAAAAAAAAAAAAAAAAAAAAAAACQ/////////////wD//////////6wEAAAAAAAAAAAAAAAAAAAAAAAAABSs////////////AP///////////7gUAAAAAAAAAAAAAAAAAAAAAAAAAABAwP////////8A//////////////BwDAAAAAAAAAAAAAAABAgAAAAAAAA8/////////wD////////////////0qGg0GAAAABgwXJjkxBgAAAAAALD/////////AP//////////////////////////////////5DQAAAAk/P////////8A////////////////////////////////////+GwAAJD//////////wD//////////////////////////////////////8A49P//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'R' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////wAAAAAAAAAAAAAAAAAAAAQgOGSk+P///////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAcuP//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAEsP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ6P///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADD///////////8A/////////wAAAAAAAAAA///////svDgAAAAAAAAACP///////////wD/////////AAAAAAAAAAD/////////7AAAAAAAAAAA////////////AP////////8AAAAAAAAAAP/////////cAAAAAAAAABD///////////8A/////////wAAAAAAAAAA//////DQoCQAAAAAAAAAQP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACU////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIPj///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAzU/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAA02P//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAxctPz///////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAEDY/////////////////wD/////////AAAAAAAAAAD/9LAsAAAAAAAAAAzc////////////////AP////////8AAAAAAAAAAP///+wkAAAAAAAAADD8//////////////8A/////////wAAAAAAAAAA/////8QAAAAAAAAAAJD//////////////wD/////////AAAAAAAAAAD//////1QAAAAAAAAAFPD/////////////AP////////8AAAAAAAAAAP//////3AQAAAAAAAAAgP////////////8A/////////wAAAAAAAAAA////////aAAAAAAAAAAM6P///////////wD/////////AAAAAAAAAAD////////oCAAAAAAAAABs////////////AP////////8AAAAAAAAAAP////////+AAAAAAAAAAATc//////////8A/////////wAAAAAAAAAA//////////AUAAAAAAAAAFj//////////wD/////////AAAAAAAAAAD//////////5AAAAAAAAAAAND/////////AP////////8AAAAAAAAAAP//////////+CQAAAAAAAAAQP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'S' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////8vHBEIAgAAAQgQHC8/P////////////////8A////////////////pCQAAAAAAAAAAAAAAAAcoP///////////////wD//////////////FwAAAAAAAAAAAAAAAAAAAAAXP//////////////AP////////////9oAAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A////////////zAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////9cAAAAAAAAAAAAAAAAAAAAAAAAAACA////////////AP///////////xgAAAAAAAAAUOD/8KwkAAAAAAAAADj///////////8A////////////AAAAAAAAAAD0/////8wABCAgICxASP///////////wD///////////8MAAAAAAAAAMz/////////////////////////////AP///////////0AAAAAAAAAACFiQxPT///////////////////////8A////////////oAAAAAAAAAAAAAAAADBwtPT//////////////////wD////////////8QAAAAAAAAAAAAAAAAAAACFTA////////////////AP/////////////oOAAAAAAAAAAAAAAAAAAAAABM6P////////////8A///////////////4fAgAAAAAAAAAAAAAAAAAAAAY2P///////////wD/////////////////7IwwAAAAAAAAAAAAAAAAAAAo+P//////////AP/////////////////////koGw0BAAAAAAAAAAAAACU//////////8A///////////////////////////4uFgAAAAAAAAAADz//////////wD//////////2BgSEA0IBwA6P///////5QAAAAAAAAADP//////////AP//////////JAAAAAAAAACc/////////AAAAAAAAAAA//////////8A//////////9YAAAAAAAAACDo///////AAAAAAAAAABT//////////wD//////////6QAAAAAAAAAACCk7P/snBQAAAAAAAAAUP//////////AP//////////+BAAAAAAAAAAAAAAAAAAAAAAAAAAAACs//////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAAOP///////////wD////////////8RAAAAAAAAAAAAAAAAAAAAAAAABjc////////////AP/////////////0PAAAAAAAAAAAAAAAAAAAAAAg2P////////////8A///////////////8hBQAAAAAAAAAAAAAAAAMdPT//////////////wD/////////////////+LRwSCAMAAAAHDhoqPT/////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'T' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'U' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////JAAAAAAAAADk/////////+gAAAAAAAAAHP//////////AP////////9MAAAAAAAAAJz/////////nAAAAAAAAABE//////////8A/////////4gAAAAAAAAAHOj//////+ggAAAAAAAAAHz//////////wD/////////0AAAAAAAAAAAIJzs/+ykIAAAAAAAAAAA0P//////////AP//////////QAAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A///////////IBAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAAAAJj/////////////AP////////////+UBAAAAAAAAAAAAAAAAAAAAASU//////////////8A///////////////IPAAAAAAAAAAAAAAAAAAwyP///////////////wD/////////////////0IxYOCAIAAAEIEiAyP//////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'V' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////zAAAAAAAAAAYP//////////////ZAAAAAAAAAAw////////AP//////kAAAAAAAAAAU/P////////////8UAAAAAAAAAJD///////8A///////oBAAAAAAAAADE////////////xAAAAAAAAAAE7P///////wD///////9MAAAAAAAAAHD///////////94AAAAAAAAAEz/////////AP///////6gAAAAAAAAAJP///////////yQAAAAAAAAArP////////8A////////+BAAAAAAAAAA1P/////////YAAAAAAAAABT4/////////wD/////////aAAAAAAAAACE/////////4QAAAAAAAAAbP//////////AP/////////EAAAAAAAAADT/////////OAAAAAAAAADM//////////8A//////////8kAAAAAAAAAOT//////+QAAAAAAAAAKP///////////wD//////////4QAAAAAAAAAmP//////nAAAAAAAAACI////////////AP//////////5AAAAAAAAABE//////9EAAAAAAAABOT///////////8A////////////QAAAAAAAAAT0////9AgAAAAAAABI/////////////wD///////////+gAAAAAAAAAKT///+kAAAAAAAAAKj/////////////AP////////////QIAAAAAAAAXP///1wAAAAAAAAM+P////////////8A/////////////1wAAAAAAAAM+P/8DAAAAAAAAGT//////////////wD/////////////vAAAAAAAAAC8/7wAAAAAAAAAxP//////////////AP//////////////HAAAAAAAAGj/aAAAAAAAACT///////////////8A//////////////94AAAAAAAAHP8cAAAAAAAAhP///////////////wD//////////////9gAAAAAAAAAkAAAAAAAAADk////////////////AP///////////////zgAAAAAAAAQAAAAAAAAQP////////////////8A////////////////lAAAAAAAAAAAAAAAAACg/////////////////wD////////////////sCAAAAAAAAAAAAAAADPT/////////////////AP////////////////9QAAAAAAAAAAAAAABg//////////////////8A/////////////////7AAAAAAAAAAAAAAAMD//////////////////wD//////////////////BQAAAAAAAAAAAAc////////////////////AP//////////////////cAAAAAAAAAAAAHz///////////////////8A///////////////////MAAAAAAAAAAAA3P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'W' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//8cAAAAAAAAALz/////4AAAAAAAAAAA6P////+8AAAAAAAAABz//wD//1QAAAAAAAAAjP////+gAAAAAAAAAACo/////4wAAAAAAAAAUP//AP//jAAAAAAAAABU/////2AAAAAAAAAAAGj/////VAAAAAAAAACM//8A///EAAAAAAAAACT/////IAAAAAAAAAAAKP////8kAAAAAAAAAMT//wD///gEAAAAAAAAAPD//+AAAAAAAAAAAAAA6P//8AAAAAAAAAAE9P//AP///zAAAAAAAAAAvP//oAAAAAAAAAAAAACo//+8AAAAAAAAADD///8A////bAAAAAAAAACM//9gAAAAAAAAAAAAAGT//4wAAAAAAAAAaP///wD///+kAAAAAAAAAFT//yAAAAAAAAAAAAAAIP//VAAAAAAAAACc////AP///9gAAAAAAAAAJP/gAAAAAAAAAAAAAAAA4P8kAAAAAAAAANT///8A/////xAAAAAAAAAA8KAAAAAAAAAAAAAAAACg8AAAAAAAAAAQ/////wD/////TAAAAAAAAAC8YAAAAAAAAAAAAAAAAGC8AAAAAAAAAET/////AP////+AAAAAAAAAAIwgAAAAAAAAAAAAAAAAIIwAAAAAAAAAfP////8A/////7gAAAAAAAAANAAAAAAAACwwAAAAAAAANAAAAAAAAACw/////wD/////8AAAAAAAAAAAAAAAAAAAdHgAAAAAAAAAAAAAAAAAAOz/////AP//////KAAAAAAAAAAAAAAAAAC4vAAAAAAAAAAAAAAAAAAg//////8A//////9gAAAAAAAAAAAAAAAACPj4CAAAAAAAAAAAAAAAAFj//////wD//////5QAAAAAAAAAAAAAAABE//9IAAAAAAAAAAAAAAAAkP//////AP//////0AAAAAAAAAAAAAAAAIj//4wAAAAAAAAAAAAAAADI//////8A///////8DAAAAAAAAAAAAAAAzP//1AAAAAAAAAAAAAAABPj//////wD///////88AAAAAAAAAAAAABT/////GAAAAAAAAAAAAAA0////////AP///////3QAAAAAAAAAAAAAWP////9gAAAAAAAAAAAAAHD///////8A////////sAAAAAAAAAAAAACg/////6QAAAAAAAAAAAAApP///////wD////////kAAAAAAAAAAAAAOT/////6AAAAAAAAAAAAADc////////AP////////8cAAAAAAAAAAAo////////MAAAAAAAAAAAEP////////8A/////////1QAAAAAAAAAAHD///////94AAAAAAAAAABM/////////wD/////////jAAAAAAAAAAAtP///////7wAAAAAAAAAAID/////////AP/////////EAAAAAAAAAAT0////////+AgAAAAAAAAAuP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'X' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////9UAAAAAAAAAKz///////////+sAAAAAAAAAFD/////////AP///////+QQAAAAAAAAFOT/////////8BwAAAAAAAAM5P////////8A/////////5gAAAAAAAAATP////////9kAAAAAAAAAJD//////////wD//////////0AAAAAAAAAAoP//////wAAAAAAAAAA0/P//////////AP//////////2AgAAAAAAAAQ4P////gkAAAAAAAABMz///////////8A////////////iAAAAAAAAABA////dAAAAAAAAABw/////////////wD////////////8MAAAAAAAAACU/9AEAAAAAAAAHPD/////////////AP/////////////IBAAAAAAAAAzYMAAAAAAAAACs//////////////8A//////////////90AAAAAAAAABAAAAAAAAAATP///////////////wD///////////////QgAAAAAAAAAAAAAAAAAAzg////////////////AP///////////////7wAAAAAAAAAAAAAAAAAjP////////////////8A/////////////////2AAAAAAAAAAAAAAADD8/////////////////wD/////////////////7BQAAAAAAAAAAAAEyP//////////////////AP/////////////////gDAAAAAAAAAAAAAjY//////////////////8A/////////////////0AAAAAAAAAAAAAAADj8/////////////////wD///////////////+UAAAAAAAAAAAAAAAAAJD/////////////////AP//////////////4AwAAAAAAAAAAAAAAAAADOD///////////////8A//////////////9AAAAAAAAAAAAAAAAAAAAAQP///////////////wD/////////////nAAAAAAAAAAAWAAAAAAAAAAAlP//////////////AP///////////+QQAAAAAAAAAGD/YAAAAAAAAAAM4P////////////8A////////////TAAAAAAAAAAs9P/0LAAAAAAAAABM/////////////wD//////////6AAAAAAAAAADNT////UDAAAAAAAAACg////////////AP/////////kEAAAAAAAAACg//////+gAAAAAAAAABDk//////////8A/////////0wAAAAAAAAAYP////////9gAAAAAAAAAEz//////////wD///////+oAAAAAAAAACz0//////////QsAAAAAAAAAKT/////////AP//////7BQAAAAAAAAM1P///////////9QMAAAAAAAAFOz///////8A//////9UAAAAAAAAAKD//////////////6AAAAAAAAAAVP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'Y' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////1QAAAAAAAAAAGj//////////2gAAAAAAAAAAFT///////8A////////5BAAAAAAAAAAAMT////////EAAAAAAAAAAAQ5P///////wD/////////mAAAAAAAAAAAKPj/////+CgAAAAAAAAAAJj/////////AP//////////PAAAAAAAAAAAgP////+AAAAAAAAAAAA8//////////8A///////////YCAAAAAAAAAAE2P//2AQAAAAAAAAACNj//////////wD///////////+AAAAAAAAAAAA4//84AAAAAAAAAACA////////////AP////////////woAAAAAAAAAACUlAAAAAAAAAAAKPz///////////8A/////////////8gAAAAAAAAAABAQAAAAAAAAAADI/////////////wD//////////////2wAAAAAAAAAAAAAAAAAAAAAbP//////////////AP//////////////8BwAAAAAAAAAAAAAAAAAABzw//////////////8A////////////////tAAAAAAAAAAAAAAAAAAAtP///////////////wD/////////////////VAAAAAAAAAAAAAAAAFT/////////////////AP/////////////////oEAAAAAAAAAAAAAAQ6P////////////////8A//////////////////+cAAAAAAAAAAAAAJz//////////////////wD///////////////////9AAAAAAAAAAABA////////////////////AP///////////////////9gAAAAAAAAAANj///////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - 'Z' => array( - 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAQ//////////////8A/////////////////////////1AAAAAAAAAABLz//////////////wD///////////////////////98AAAAAAAAAACY////////////////AP//////////////////////pAAAAAAAAAAAaP////////////////8A/////////////////////8QIAAAAAAAAAET8/////////////////wD////////////////////gGAAAAAAAAAAo9P//////////////////AP//////////////////9CwAAAAAAAAAFNz///////////////////8A//////////////////xMAAAAAAAAAATA/////////////////////wD/////////////////eAAAAAAAAAAAnP//////////////////////AP///////////////5wAAAAAAAAAAHT///////////////////////8A///////////////ABAAAAAAAAABM/P///////////////////////wD/////////////3BQAAAAAAAAALPT/////////////////////////AP////////////QoAAAAAAAAABjg//////////////////////////8A///////////8SAAAAAAAAAAExP///////////////////////////wD//////////2wAAAAAAAAAAKD/////////////////////////////AP////////+YAAAAAAAAAAB8//////////////////////////////8A/////////wQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', - 'width' => 40 - ), - ); - } -} diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php deleted file mode 100644 index 7fd88feeb5..0000000000 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ /dev/null @@ -1,372 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006, 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - - -/** -* This class holds the code shared by the two default 3.0.x CAPTCHAs. -* -* @package VC -*/ -class phpbb_captcha_plugins_captcha_abstract -{ - var $confirm_id; - var $confirm_code; - var $code; - var $seed; - var $attempts = 0; - var $type; - var $solved = 0; - var $captcha_vars = false; - - function init($type) - { - global $config, $db, $user; - - // read input - $this->confirm_id = request_var('confirm_id', ''); - $this->confirm_code = request_var('confirm_code', ''); - $refresh = request_var('refresh_vc', false) && $config['confirm_refresh']; - - $this->type = (int) $type; - - if (!strlen($this->confirm_id) || !$this->load_code()) - { - // we have no confirm ID, better get ready to display something - $this->generate_code(); - } - else if ($refresh) - { - $this->regenerate_code(); - } - } - - function execute_demo() - { - global $user; - - $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $this->seed = hexdec(substr(unique_id(), 4, 10)); - - // compute $seed % 0x7fffffff - $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); - - $captcha = new captcha(); - define('IMAGE_OUTPUT', 1); - $captcha->execute($this->code, $this->seed); - } - - function execute() - { - if (empty($this->code)) - { - if (!$this->load_code()) - { - // invalid request, bail out - return false; - } - } - $captcha = new captcha(); - define('IMAGE_OUTPUT', 1); - $captcha->execute($this->code, $this->seed); - } - - function get_template() - { - global $config, $user, $template, $phpEx, $phpbb_root_path; - - if ($this->is_solved()) - { - return false; - } - else - { - $link = append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type); - $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'); - - $template->assign_vars(array( - 'CONFIRM_IMAGE_LINK' => $link, - 'CONFIRM_IMAGE' => '<img src="' . $link . '" />', - 'CONFIRM_IMG' => '<img src="' . $link . '" />', - 'CONFIRM_ID' => $this->confirm_id, - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, - 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh'] && $this->type == CONFIRM_REG) ? true : false, - 'L_CONFIRM_EXPLAIN' => $explain, - )); - - return 'captcha_default.html'; - } - } - - function get_demo_template($id) - { - global $config, $user, $template, $phpbb_admin_path, $phpEx; - - $variables = ''; - - if (is_array($this->captcha_vars)) - { - foreach ($this->captcha_vars as $captcha_var => $template_var) - { - $variables .= '&' . rawurlencode($captcha_var) . '=' . request_var($captcha_var, (int) $config[$captcha_var]); - } - } - - // acp_captcha has a delivery function; let's use it - $template->assign_vars(array( - 'CONFIRM_IMAGE' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'captcha_demo=1&mode=visual&i=' . $id . '&select_captcha=' . $this->get_class_name()) . $variables, - 'CONFIRM_ID' => $this->confirm_id, - )); - - return 'captcha_default_acp_demo.html'; - } - - function get_hidden_fields() - { - $hidden_fields = array(); - - // this is required for posting.php - otherwise we would forget about the captcha being already solved - if ($this->solved) - { - $hidden_fields['confirm_code'] = $this->confirm_code; - } - $hidden_fields['confirm_id'] = $this->confirm_id; - return $hidden_fields; - } - - function garbage_collect($type) - { - global $db, $config; - - $sql = 'SELECT DISTINCT c.session_id - FROM ' . CONFIRM_TABLE . ' c - LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) - WHERE s.session_id IS NULL' . - ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $sql_in = array(); - do - { - $sql_in[] = (string) $row['session_id']; - } - while ($row = $db->sql_fetchrow($result)); - - if (sizeof($sql_in)) - { - $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' - WHERE ' . $db->sql_in_set('session_id', $sql_in); - $db->sql_query($sql); - } - } - $db->sql_freeresult($result); - } - - function uninstall() - { - $this->garbage_collect(0); - } - - function install() - { - return; - } - - function validate() - { - global $config, $db, $user; - - if (empty($user->lang)) - { - $user->setup(); - } - - $error = ''; - if (!$this->confirm_id) - { - $error = $user->lang['CONFIRM_CODE_WRONG']; - } - else - { - if ($this->check_code()) - { - $this->solved = true; - } - else - { - $error = $user->lang['CONFIRM_CODE_WRONG']; - } - } - - if (strlen($error)) - { - // okay, incorrect answer. Let's ask a new question. - $this->new_attempt(); - return $error; - } - else - { - return false; - } - } - - /** - * The old way to generate code, suitable for GD and non-GD. Resets the internal state. - */ - function generate_code() - { - global $db, $user; - - $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $this->confirm_id = md5(unique_id($user->ip)); - $this->seed = hexdec(substr(unique_id(), 4, 10)); - $this->solved = 0; - // compute $seed % 0x7fffffff - $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); - - $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $this->confirm_id, - 'session_id' => (string) $user->session_id, - 'confirm_type' => (int) $this->type, - 'code' => (string) $this->code, - 'seed' => (int) $this->seed) - ); - $db->sql_query($sql); - } - - /** - * New Question, if desired. - */ - function regenerate_code() - { - global $db, $user; - - $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $this->seed = hexdec(substr(unique_id(), 4, 10)); - $this->solved = 0; - // compute $seed % 0x7fffffff - $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); - - $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'code' => (string) $this->code, - 'seed' => (int) $this->seed)) . ' - WHERE - confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' - AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; - $db->sql_query($sql); - } - - /** - * New Question, if desired. - */ - function new_attempt() - { - global $db, $user; - - $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); - $this->seed = hexdec(substr(unique_id(), 4, 10)); - $this->solved = 0; - // compute $seed % 0x7fffffff - $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); - - $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'code' => (string) $this->code, - 'seed' => (int) $this->seed)) . ' - , attempts = attempts + 1 - WHERE - confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' - AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; - $db->sql_query($sql); - } - - /** - * Look up everything we need for painting&checking. - */ - function load_code() - { - global $db, $user; - - $sql = 'SELECT code, seed, attempts - FROM ' . CONFIRM_TABLE . " - WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . $this->type; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row) - { - $this->code = $row['code']; - $this->seed = $row['seed']; - $this->attempts = $row['attempts']; - return true; - } - - return false; - } - - function check_code() - { - return (strcasecmp($this->code, $this->confirm_code) === 0); - } - - function get_attempt_count() - { - return $this->attempts; - } - - function reset() - { - global $db, $user; - - $sql = 'DELETE FROM ' . CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . (int) $this->type; - $db->sql_query($sql); - - // we leave the class usable by generating a new question - $this->generate_code(); - } - - function is_solved() - { - if (request_var('confirm_code', false) && $this->solved === 0) - { - $this->validate(); - } - return (bool) $this->solved; - } - - /** - * API function - */ - function has_config() - { - return false; - } - -} - -/** -* Old class name for legacy use. The new class name is auto loadable. -*/ -class phpbb_default_captcha extends phpbb_captcha_plugins_captcha_abstract -{ -} diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php deleted file mode 100644 index 80f5b65967..0000000000 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006, 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Placeholder for autoload -*/ -if (!class_exists('phpbb_default_captcha', false)) -{ - include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); -} - -/** -* @package VC -*/ -class phpbb_captcha_gd extends phpbb_default_captcha -{ - - var $captcha_vars = array( - 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', - 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', - 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', -// 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', - 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', - 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', - 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS', - ); - - function phpbb_captcha_gd() - { - global $phpbb_root_path, $phpEx; - - if (!class_exists('captcha')) - { - include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx); - } - } - - static public function get_instance() - { - $instance = new phpbb_captcha_gd(); - return $instance; - } - - static public function is_available() - { - return @extension_loaded('gd'); - } - - /** - * API function - */ - function has_config() - { - return true; - } - - static public function get_name() - { - return 'CAPTCHA_GD'; - } - - function get_class_name() - { - return 'phpbb_captcha_gd'; - } - - function acp_page($id, &$module) - { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - - $user->add_lang('acp/board'); - - $config_vars = array( - 'enable_confirm' => 'REG_ENABLE', - 'enable_post_confirm' => 'POST_ENABLE', - 'confirm_refresh' => 'CONFIRM_REFRESH', - 'captcha_gd' => 'CAPTCHA_GD', - ); - - $module->tpl_name = 'captcha_gd_acp'; - $module->page_title = 'ACP_VC_SETTINGS'; - $form_key = 'acp_captcha'; - add_form_key($form_key); - - $submit = request_var('submit', ''); - - if ($submit && check_form_key($form_key)) - { - $captcha_vars = array_keys($this->captcha_vars); - foreach ($captcha_vars as $captcha_var) - { - $value = request_var($captcha_var, 0); - if ($value >= 0) - { - set_config($captcha_var, $value); - } - } - - add_log('admin', 'LOG_CONFIG_VISUAL'); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); - } - else if ($submit) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); - } - else - { - foreach ($this->captcha_vars as $captcha_var => $template_var) - { - $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var]; - $template->assign_var($template_var, $var); - } - - $template->assign_vars(array( - 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), - 'CAPTCHA_NAME' => $this->get_class_name(), - 'U_ACTION' => $module->u_action, - )); - } - } - - function execute_demo() - { - global $config; - - $config_old = $config; - - $config = new \phpbb\config\config(array()); - foreach ($config_old as $key => $value) - { - $config->set($key, $value); - } - - foreach ($this->captcha_vars as $captcha_var => $template_var) - { - $config->set($captcha_var, request_var($captcha_var, (int) $config[$captcha_var])); - } - parent::execute_demo(); - $config = $config_old; - } - -} diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php deleted file mode 100644 index 0d4b8bd451..0000000000 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006, 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Placeholder for autoload -*/ -if (!class_exists('phpbb_default_captcha', false)) -{ - include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); -} - -/** -* @package VC -*/ -class phpbb_captcha_gd_wave extends phpbb_default_captcha -{ - - function phpbb_captcha_gd_wave() - { - global $phpbb_root_path, $phpEx; - - if (!class_exists('captcha')) - { - include_once($phpbb_root_path . 'includes/captcha/captcha_gd_wave.' . $phpEx); - } - } - - static public function get_instance() - { - return new phpbb_captcha_gd_wave(); - } - - static public function is_available() - { - return @extension_loaded('gd'); - } - - static public function get_name() - { - return 'CAPTCHA_GD_3D'; - } - - function get_class_name() - { - return 'phpbb_captcha_gd_wave'; - } - - function acp_page($id, &$module) - { - global $config, $db, $template, $user; - - trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); - } -} diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php deleted file mode 100644 index c5ef8c78b0..0000000000 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006, 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Placeholder for autoload -*/ -if (!class_exists('phpbb_default_captcha', false)) -{ - include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); -} - -/** -* @package VC -*/ -class phpbb_captcha_nogd extends phpbb_default_captcha -{ - - function phpbb_captcha_nogd() - { - global $phpbb_root_path, $phpEx; - - if (!class_exists('captcha')) - { - include_once($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx); - } - } - - static public function get_instance() - { - $instance = new phpbb_captcha_nogd(); - return $instance; - } - - static public function is_available() - { - return true; - } - - static public function get_name() - { - return 'CAPTCHA_NO_GD'; - } - - function get_class_name() - { - return 'phpbb_captcha_nogd'; - } - - function acp_page($id, &$module) - { - global $user; - - trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); - } -} diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php deleted file mode 100644 index 82333f739e..0000000000 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ /dev/null @@ -1,996 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006, 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -global $table_prefix; - -define('CAPTCHA_QUESTIONS_TABLE', $table_prefix . 'captcha_questions'); -define('CAPTCHA_ANSWERS_TABLE', $table_prefix . 'captcha_answers'); -define('CAPTCHA_QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm'); - -/** -* And now to something completely different. Let's make a captcha without extending the abstract class. -* QA CAPTCHA sample implementation -* -* @package VC -*/ -class phpbb_captcha_qa -{ - var $confirm_id; - var $answer; - var $question_ids; - var $question_text; - var $question_lang; - var $question_strict; - var $attempts = 0; - var $type; - // dirty trick: 0 is false, but can still encode that the captcha is not yet validated - var $solved = 0; - - /** - * @param int $type as per the CAPTCHA API docs, the type - */ - function init($type) - { - global $config, $db, $user; - - // load our language file - $user->add_lang('captcha_qa'); - - // read input - $this->confirm_id = request_var('qa_confirm_id', ''); - $this->answer = utf8_normalize_nfc(request_var('qa_answer', '', true)); - - $this->type = (int) $type; - $this->question_lang = $user->lang_name; - - // we need all defined questions - shouldn't be too many, so we can just grab them - // try the user's lang first - $sql = 'SELECT question_id - FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($user->lang_name) . "'"; - $result = $db->sql_query($sql, 3600); - - while ($row = $db->sql_fetchrow($result)) - { - $this->question_ids[$row['question_id']] = $row['question_id']; - } - $db->sql_freeresult($result); - - // fallback to the board default lang - if (!sizeof($this->question_ids)) - { - $this->question_lang = $config['default_lang']; - - $sql = 'SELECT question_id - FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; - $result = $db->sql_query($sql, 7200); - - while ($row = $db->sql_fetchrow($result)) - { - $this->question_ids[$row['question_id']] = $row['question_id']; - } - $db->sql_freeresult($result); - } - - // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one - if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) - { - // we have no valid confirm ID, better get ready to ask something - $this->select_question(); - } - } - - /** - * API function - */ - static public function get_instance() - { - $instance = new phpbb_captcha_qa(); - - return $instance; - } - - /** - * See if the captcha has created its tables. - */ - static public function is_installed() - { - global $db; - - $db_tool = new \phpbb\db\tools($db); - - return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE); - } - - /** - * API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang - */ - static public function is_available() - { - global $config, $db, $phpbb_root_path, $phpEx, $user; - - // load language file for pretty display in the ACP dropdown - $user->add_lang('captcha_qa'); - - if (!self::is_installed()) - { - return false; - } - - $sql = 'SELECT COUNT(question_id) AS question_count - FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - return ((bool) $row['question_count']); - } - - /** - * API function - */ - function has_config() - { - return true; - } - - /** - * API function - */ - static public function get_name() - { - return 'CAPTCHA_QA'; - } - - /** - * API function - */ - function get_class_name() - { - return 'phpbb_captcha_qa'; - } - - /** - * API function - not needed as we don't display an image - */ - function execute_demo() - { - } - - /** - * API function - not needed as we don't display an image - */ - function execute() - { - } - - /** - * API function - send the question to the template - */ - function get_template() - { - global $template; - - if ($this->is_solved()) - { - return false; - } - else - { - $template->assign_vars(array( - 'QA_CONFIRM_QUESTION' => $this->question_text, - 'QA_CONFIRM_ID' => $this->confirm_id, - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, - )); - - return 'captcha_qa.html'; - } - } - - /** - * API function - we just display a mockup so that the captcha doesn't need to be installed - */ - function get_demo_template() - { - global $config, $db, $template; - - if ($this->is_available()) - { - $sql = 'SELECT question_text - FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; - $result = $db->sql_query_limit($sql, 1); - if ($row = $db->sql_fetchrow($result)) - { - $template->assign_vars(array( - 'QA_CONFIRM_QUESTION' => $row['question_text'], - )); - } - $db->sql_freeresult($result); - } - return 'captcha_qa_acp_demo.html'; - } - - /** - * API function - */ - function get_hidden_fields() - { - $hidden_fields = array(); - - // this is required - otherwise we would forget about the captcha being already solved - if ($this->solved) - { - $hidden_fields['qa_answer'] = $this->answer; - } - $hidden_fields['qa_confirm_id'] = $this->confirm_id; - - return $hidden_fields; - } - - /** - * API function - */ - function garbage_collect($type = 0) - { - global $db, $config; - - $sql = 'SELECT c.confirm_id - FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' c - LEFT JOIN ' . SESSIONS_TABLE . ' s - ON (c.session_id = s.session_id) - WHERE s.session_id IS NULL' . - ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $sql_in = array(); - - do - { - $sql_in[] = (string) $row['confirm_id']; - } - while ($row = $db->sql_fetchrow($result)); - - if (sizeof($sql_in)) - { - $sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' - WHERE ' . $db->sql_in_set('confirm_id', $sql_in); - $db->sql_query($sql); - } - } - $db->sql_freeresult($result); - } - - /** - * API function - we don't drop the tables here, as that would cause the loss of all entered questions. - */ - function uninstall() - { - $this->garbage_collect(0); - } - - /** - * API function - set up shop - */ - function install() - { - global $db; - - $db_tool = new \phpbb\db\tools($db); - - $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE); - - $schemas = array( - CAPTCHA_QUESTIONS_TABLE => array ( - 'COLUMNS' => array( - 'question_id' => array('UINT', Null, 'auto_increment'), - 'strict' => array('BOOL', 0), - 'lang_id' => array('UINT', 0), - 'lang_iso' => array('VCHAR:30', ''), - 'question_text' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'question_id', - 'KEYS' => array( - 'lang' => array('INDEX', 'lang_iso'), - ), - ), - CAPTCHA_ANSWERS_TABLE => array ( - 'COLUMNS' => array( - 'question_id' => array('UINT', 0), - 'answer_text' => array('STEXT_UNI', ''), - ), - 'KEYS' => array( - 'qid' => array('INDEX', 'question_id'), - ), - ), - CAPTCHA_QA_CONFIRM_TABLE => array ( - 'COLUMNS' => array( - 'session_id' => array('CHAR:32', ''), - 'confirm_id' => array('CHAR:32', ''), - 'lang_iso' => array('VCHAR:30', ''), - 'question_id' => array('UINT', 0), - 'attempts' => array('UINT', 0), - 'confirm_type' => array('USINT', 0), - ), - 'KEYS' => array( - 'session_id' => array('INDEX', 'session_id'), - 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso')), - ), - 'PRIMARY_KEY' => 'confirm_id', - ), - ); - - foreach($schemas as $table => $schema) - { - if (!$db_tool->sql_table_exists($table)) - { - $db_tool->sql_create_table($table, $schema); - } - } - } - - /** - * API function - see what has to be done to validate - */ - function validate() - { - global $config, $db, $user; - - $error = ''; - - if (!sizeof($this->question_ids)) - { - return false; - } - - if (!$this->confirm_id) - { - $error = $user->lang['CONFIRM_QUESTION_WRONG']; - } - else - { - if ($this->check_answer()) - { - $this->solved = true; - } - else - { - $error = $user->lang['CONFIRM_QUESTION_WRONG']; - } - } - - if (strlen($error)) - { - // okay, incorrect answer. Let's ask a new question. - $this->new_attempt(); - $this->solved = false; - - return $error; - } - else - { - return false; - } - } - - /** - * Select a question - */ - function select_question() - { - global $db, $user; - - if (!sizeof($this->question_ids)) - { - return false; - } - $this->confirm_id = md5(unique_id($user->ip)); - $this->question = (int) array_rand($this->question_ids); - - $sql = 'INSERT INTO ' . CAPTCHA_QA_CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $this->confirm_id, - 'session_id' => (string) $user->session_id, - 'lang_iso' => (string) $this->question_lang, - 'confirm_type' => (int) $this->type, - 'question_id' => (int) $this->question, - )); - $db->sql_query($sql); - - $this->load_answer(); - } - - /** - * New Question, if desired. - */ - function reselect_question() - { - global $db, $user; - - if (!sizeof($this->question_ids)) - { - return false; - } - - $this->question = (int) array_rand($this->question_ids); - $this->solved = 0; - - $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' - SET question_id = ' . (int) $this->question . " - WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "'"; - $db->sql_query($sql); - - $this->load_answer(); - } - - /** - * Wrong answer, so we increase the attempts and use a different question. - */ - function new_attempt() - { - global $db, $user; - - // yah, I would prefer a stronger rand, but this should work - $this->question = (int) array_rand($this->question_ids); - $this->solved = 0; - - $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' - SET question_id = ' . (int) $this->question . ", - attempts = attempts + 1 - WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "'"; - $db->sql_query($sql); - - $this->load_answer(); - } - - - /** - * See if there is already an entry for the current session. - */ - function load_confirm_id() - { - global $db, $user; - - $sql = 'SELECT confirm_id - FROM ' . CAPTCHA_QA_CONFIRM_TABLE . " - WHERE - session_id = '" . $db->sql_escape($user->session_id) . "' - AND lang_iso = '" . $db->sql_escape($this->question_lang) . "' - AND confirm_type = " . $this->type; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row) - { - $this->confirm_id = $row['confirm_id']; - return true; - } - return false; - } - - /** - * Look up everything we need and populate the instance variables. - */ - function load_answer() - { - global $db, $user; - - if (!strlen($this->confirm_id) || !sizeof($this->question_ids)) - { - return false; - } - - $sql = 'SELECT con.question_id, attempts, question_text, strict - FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' con, ' . CAPTCHA_QUESTIONS_TABLE . " qes - WHERE con.question_id = qes.question_id - AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "' - AND session_id = '" . $db->sql_escape($user->session_id) . "' - AND qes.lang_iso = '" . $db->sql_escape($this->question_lang) . "' - AND confirm_type = " . $this->type; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row) - { - $this->question = $row['question_id']; - - $this->attempts = $row['attempts']; - $this->question_strict = $row['strict']; - $this->question_text = $row['question_text']; - - return true; - } - - return false; - } - - /** - * The actual validation - */ - function check_answer() - { - global $db; - - $answer = ($this->question_strict) ? utf8_normalize_nfc(request_var('qa_answer', '', true)) : utf8_clean_string(utf8_normalize_nfc(request_var('qa_answer', '', true))); - - $sql = 'SELECT answer_text - FROM ' . CAPTCHA_ANSWERS_TABLE . ' - WHERE question_id = ' . (int) $this->question; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $solution = ($this->question_strict) ? $row['answer_text'] : utf8_clean_string($row['answer_text']); - - if ($solution === $answer) - { - $this->solved = true; - - break; - } - } - $db->sql_freeresult($result); - - return $this->solved; - } - - /** - * API function - */ - function get_attempt_count() - { - return $this->attempts; - } - - /** - * API function - */ - function reset() - { - global $db, $user; - - $sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . " - WHERE session_id = '" . $db->sql_escape($user->session_id) . "' - AND confirm_type = " . (int) $this->type; - $db->sql_query($sql); - - // we leave the class usable by generating a new question - $this->select_question(); - } - - /** - * API function - */ - function is_solved() - { - if (request_var('qa_answer', false) && $this->solved === 0) - { - $this->validate(); - } - - return (bool) $this->solved; - } - - /** - * API function - The ACP backend, this marks the end of the easy methods - */ - function acp_page($id, &$module) - { - global $db, $user, $auth, $template; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - - $user->add_lang('acp/board'); - $user->add_lang('captcha_qa'); - - if (!self::is_installed()) - { - $this->install(); - } - - $module->tpl_name = 'captcha_qa_acp'; - $module->page_title = 'ACP_VC_SETTINGS'; - $form_key = 'acp_captcha'; - add_form_key($form_key); - - $submit = request_var('submit', false); - $question_id = request_var('question_id', 0); - $action = request_var('action', ''); - - // we have two pages, so users might want to navigate from one to the other - $list_url = $module->u_action . "&configure=1&select_captcha=" . $this->get_class_name(); - - $template->assign_vars(array( - 'U_ACTION' => $module->u_action, - 'QUESTION_ID' => $question_id , - 'CLASS' => $this->get_class_name(), - )); - - // show the list? - if (!$question_id && $action != 'add') - { - $this->acp_question_list($module); - } - else if ($question_id && $action == 'delete') - { - if ($this->get_class_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id)) - { - if (confirm_box(true)) - { - $this->acp_delete_question($question_id); - - trigger_error($user->lang['QUESTION_DELETED'] . adm_back_link($list_url)); - } - else - { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( - 'question_id' => $question_id, - 'action' => $action, - 'configure' => 1, - 'select_captcha' => $this->get_class_name(), - )) - ); - } - } - else - { - trigger_error($user->lang['QA_LAST_QUESTION'] . adm_back_link($list_url), E_USER_WARNING); - } - } - else - { - // okay, show the editor - $error = false; - $input_question = request_var('question_text', '', true); - $input_answers = request_var('answers', '', true); - $input_lang = request_var('lang_iso', '', true); - $input_strict = request_var('strict', false); - $langs = $this->get_languages(); - - foreach ($langs as $lang => $entry) - { - $template->assign_block_vars('langs', array( - 'ISO' => $lang, - 'NAME' => $entry['name'], - )); - } - - $template->assign_vars(array( - 'U_LIST' => $list_url, - )); - - if ($question_id) - { - if ($question = $this->acp_get_question_data($question_id)) - { - $answers = (isset($input_answers[$lang])) ? $input_answers[$lang] : implode("\n", $question['answers']); - - $template->assign_vars(array( - 'QUESTION_TEXT' => ($input_question) ? $input_question : $question['question_text'], - 'LANG_ISO' => ($input_lang) ? $input_lang : $question['lang_iso'], - 'STRICT' => (isset($_REQUEST['strict'])) ? $input_strict : $question['strict'], - 'ANSWERS' => $answers, - )); - } - else - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url)); - } - } - else - { - $template->assign_vars(array( - 'QUESTION_TEXT' => $input_question, - 'LANG_ISO' => $input_lang, - 'STRICT' => $input_strict, - 'ANSWERS' => $input_answers, - )); - } - - if ($submit && check_form_key($form_key)) - { - $data = $this->acp_get_question_input(); - - if (!$this->validate_input($data)) - { - $template->assign_vars(array( - 'S_ERROR' => true, - )); - } - else - { - if ($question_id) - { - $this->acp_update_question($data, $question_id); - } - else - { - $this->acp_add_question($data); - } - - add_log('admin', 'LOG_CONFIG_VISUAL'); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($list_url)); - } - } - else if ($submit) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url), E_USER_WARNING); - } - } - } - - /** - * This handles the list overview - */ - function acp_question_list(&$module) - { - global $db, $template; - - $sql = 'SELECT * - FROM ' . CAPTCHA_QUESTIONS_TABLE; - $result = $db->sql_query($sql); - - $template->assign_vars(array( - 'S_LIST' => true, - )); - - while ($row = $db->sql_fetchrow($result)) - { - $url = $module->u_action . "&question_id={$row['question_id']}&configure=1&select_captcha=" . $this->get_class_name() . '&'; - - $template->assign_block_vars('questions', array( - 'QUESTION_TEXT' => $row['question_text'], - 'QUESTION_ID' => $row['question_id'], - 'QUESTION_LANG' => $row['lang_iso'], - 'U_DELETE' => "{$url}action=delete", - 'U_EDIT' => "{$url}action=edit", - )); - } - $db->sql_freeresult($result); - } - - /** - * Grab a question and bring it into a format the editor understands - */ - function acp_get_question_data($question_id) - { - global $db; - - if ($question_id) - { - $sql = 'SELECT * - FROM ' . CAPTCHA_QUESTIONS_TABLE . ' - WHERE question_id = ' . $question_id; - $result = $db->sql_query($sql); - $question = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$question) - { - return false; - } - - $question['answers'] = array(); - - $sql = 'SELECT * - FROM ' . CAPTCHA_ANSWERS_TABLE . ' - WHERE question_id = ' . $question_id; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $question['answers'][] = $row['answer_text']; - } - $db->sql_freeresult($result); - - return $question; - } - } - - /** - * Grab a question from input and bring it into a format the editor understands - */ - function acp_get_question_input() - { - $answers = utf8_normalize_nfc(request_var('answers', '', true)); - $question = array( - 'question_text' => request_var('question_text', '', true), - 'strict' => request_var('strict', false), - 'lang_iso' => request_var('lang_iso', ''), - 'answers' => (strlen($answers)) ? explode("\n", $answers) : '', - ); - - return $question; - } - - /** - * Update a question. - * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data - */ - function acp_update_question($data, $question_id) - { - global $db, $cache; - - // easier to delete all answers than to figure out which to update - $sql = 'DELETE FROM ' . CAPTCHA_ANSWERS_TABLE . " WHERE question_id = $question_id"; - $db->sql_query($sql); - - $langs = $this->get_languages(); - $question_ary = $data; - $question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id']; - unset($question_ary['answers']); - - $sql = 'UPDATE ' . CAPTCHA_QUESTIONS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $question_ary) . " - WHERE question_id = $question_id"; - $db->sql_query($sql); - - $this->acp_insert_answers($data, $question_id); - - $cache->destroy('sql', CAPTCHA_QUESTIONS_TABLE); - } - - /** - * Insert a question. - * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data - */ - function acp_add_question($data) - { - global $db, $cache; - - $langs = $this->get_languages(); - $question_ary = $data; - - $question_ary['lang_id'] = $langs[$data['lang_iso']]['id']; - unset($question_ary['answers']); - - $sql = 'INSERT INTO ' . CAPTCHA_QUESTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $question_ary); - $db->sql_query($sql); - - $question_id = $db->sql_nextid(); - - $this->acp_insert_answers($data, $question_id); - - $cache->destroy('sql', CAPTCHA_QUESTIONS_TABLE); - } - - /** - * Insert the answers. - * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data - */ - function acp_insert_answers($data, $question_id) - { - global $db, $cache; - - foreach ($data['answers'] as $answer) - { - $answer_ary = array( - 'question_id' => $question_id, - 'answer_text' => $answer, - ); - - $sql = 'INSERT INTO ' . CAPTCHA_ANSWERS_TABLE . ' ' . $db->sql_build_array('INSERT', $answer_ary); - $db->sql_query($sql); - } - - $cache->destroy('sql', CAPTCHA_ANSWERS_TABLE); - } - - /** - * Delete a question. - */ - function acp_delete_question($question_id) - { - global $db, $cache; - - $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE); - - foreach ($tables as $table) - { - $sql = "DELETE FROM $table - WHERE question_id = $question_id"; - $db->sql_query($sql); - } - - $cache->destroy('sql', $tables); - } - - /** - * Check if the entered data can be inserted/used - * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data - */ - function validate_input($question_data) - { - $langs = $this->get_languages(); - - if (!isset($question_data['lang_iso']) || - !isset($question_data['question_text']) || - !isset($question_data['strict']) || - !isset($question_data['answers'])) - { - return false; - } - - if (!isset($langs[$question_data['lang_iso']]) || - !strlen($question_data['question_text']) || - !sizeof($question_data['answers']) || - !is_array($question_data['answers'])) - { - return false; - } - - return true; - } - - /** - * List the installed language packs - */ - function get_languages() - { - global $db; - - $sql = 'SELECT * - FROM ' . LANG_TABLE; - $result = $db->sql_query($sql); - - $langs = array(); - while ($row = $db->sql_fetchrow($result)) - { - $langs[$row['lang_iso']] = array( - 'name' => $row['lang_local_name'], - 'id' => (int) $row['lang_id'], - ); - } - $db->sql_freeresult($result); - - return $langs; - } - - - - /** - * See if there is a question other than the one we have - */ - function acp_is_last($question_id) - { - global $config, $db; - - if ($question_id) - { - $sql = 'SELECT question_id - FROM ' . CAPTCHA_QUESTIONS_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "' - AND question_id <> " . (int) $question_id; - $result = $db->sql_query_limit($sql, 1); - $question = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$question) - { - return true; - } - return false; - } - } -} diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php deleted file mode 100644 index cb21b04ec5..0000000000 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ /dev/null @@ -1,343 +0,0 @@ -<?php -/** -* -* @package VC -* @copyright (c) 2006, 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -if (!class_exists('phpbb_default_captcha', false)) -{ - // we need the classic captcha code for tracking solutions and attempts - include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx); -} - -/** -* @package VC -*/ -class phpbb_recaptcha extends phpbb_default_captcha -{ - var $recaptcha_server = 'http://www.google.com/recaptcha/api'; - var $recaptcha_server_secure = 'https://www.google.com/recaptcha/api'; // class constants :( - - // We are opening a socket to port 80 of this host and send - // the POST request asking for verification to the path specified here. - var $recaptcha_verify_server = 'www.google.com'; - var $recaptcha_verify_path = '/recaptcha/api/verify'; - - var $challenge; - var $response; - - // PHP4 Constructor - function phpbb_recaptcha() - { - global $request; - $this->recaptcha_server = $request->is_secure() ? $this->recaptcha_server_secure : $this->recaptcha_server; - } - - function init($type) - { - global $config, $db, $user; - - $user->add_lang('captcha_recaptcha'); - parent::init($type); - $this->challenge = request_var('recaptcha_challenge_field', ''); - $this->response = request_var('recaptcha_response_field', ''); - } - - static public function get_instance() - { - $instance = new phpbb_recaptcha(); - return $instance; - } - - static public function is_available() - { - global $config, $user; - $user->add_lang('captcha_recaptcha'); - return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey'])); - } - - /** - * API function - */ - function has_config() - { - return true; - } - - static public function get_name() - { - return 'CAPTCHA_RECAPTCHA'; - } - - function get_class_name() - { - return 'phpbb_recaptcha'; - } - - function acp_page($id, &$module) - { - global $config, $db, $template, $user; - - $captcha_vars = array( - 'recaptcha_pubkey' => 'RECAPTCHA_PUBKEY', - 'recaptcha_privkey' => 'RECAPTCHA_PRIVKEY', - ); - - $module->tpl_name = 'captcha_recaptcha_acp'; - $module->page_title = 'ACP_VC_SETTINGS'; - $form_key = 'acp_captcha'; - add_form_key($form_key); - - $submit = request_var('submit', ''); - - if ($submit && check_form_key($form_key)) - { - $captcha_vars = array_keys($captcha_vars); - foreach ($captcha_vars as $captcha_var) - { - $value = request_var($captcha_var, ''); - if ($value) - { - set_config($captcha_var, $value); - } - } - - add_log('admin', 'LOG_CONFIG_VISUAL'); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); - } - else if ($submit) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); - } - else - { - foreach ($captcha_vars as $captcha_var => $template_var) - { - $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, '') : ((isset($config[$captcha_var])) ? $config[$captcha_var] : ''); - $template->assign_var($template_var, $var); - } - - $template->assign_vars(array( - 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), - 'CAPTCHA_NAME' => $this->get_class_name(), - 'U_ACTION' => $module->u_action, - )); - - } - } - - // not needed - function execute_demo() - { - } - - // not needed - function execute() - { - } - - function get_template() - { - global $config, $user, $template; - - if ($this->is_solved()) - { - return false; - } - else - { - $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'); - - $template->assign_vars(array( - 'RECAPTCHA_SERVER' => $this->recaptcha_server, - 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', - 'RECAPTCHA_ERRORGET' => '', - 'S_RECAPTCHA_AVAILABLE' => self::is_available(), - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, - 'L_CONFIRM_EXPLAIN' => $explain, - )); - - return 'captcha_recaptcha.html'; - } - } - - function get_demo_template($id) - { - return $this->get_template(); - } - - function get_hidden_fields() - { - $hidden_fields = array(); - - // this is required for posting.php - otherwise we would forget about the captcha being already solved - if ($this->solved) - { - $hidden_fields['confirm_code'] = $this->code; - } - $hidden_fields['confirm_id'] = $this->confirm_id; - return $hidden_fields; - } - - function uninstall() - { - $this->garbage_collect(0); - } - - function install() - { - return; - } - - function validate() - { - if (!parent::validate()) - { - return false; - } - else - { - return $this->recaptcha_check_answer(); - } - } - -// Code from here on is based on recaptchalib.php -/* - * This is a PHP library that handles calling reCAPTCHA. - * - Documentation and latest version - * http://recaptcha.net/plugins/php/ - * - Get a reCAPTCHA API Key - * http://recaptcha.net/api/getkey - * - Discussion group - * http://groups.google.com/group/recaptcha - * - * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net - * AUTHORS: - * Mike Crawford - * Ben Maurer - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - /** - * Submits an HTTP POST to a reCAPTCHA server - * @param string $host - * @param string $path - * @param array $data - * @param int port - * @return array response - */ - function _recaptcha_http_post($host, $path, $data, $port = 80) - { - $req = $this->_recaptcha_qsencode ($data); - - $http_request = "POST $path HTTP/1.0\r\n"; - $http_request .= "Host: $host\r\n"; - $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; - $http_request .= "Content-Length: " . strlen($req) . "\r\n"; - $http_request .= "User-Agent: reCAPTCHA/PHP/phpBB\r\n"; - $http_request .= "\r\n"; - $http_request .= $req; - - $response = ''; - if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) - { - trigger_error('RECAPTCHA_SOCKET_ERROR', E_USER_ERROR); - } - - fwrite($fs, $http_request); - - while (!feof($fs)) - { - // One TCP-IP packet - $response .= fgets($fs, 1160); - } - fclose($fs); - $response = explode("\r\n\r\n", $response, 2); - - return $response; - } - - /** - * Calls an HTTP POST function to verify if the user's guess was correct - * @param array $extra_params an array of extra variables to post to the server - * @return ReCaptchaResponse - */ - function recaptcha_check_answer($extra_params = array()) - { - global $config, $user; - - //discard spam submissions - if ($this->challenge == null || strlen($this->challenge) == 0 || $this->response == null || strlen($this->response) == 0) - { - return $user->lang['RECAPTCHA_INCORRECT']; - } - - $response = $this->_recaptcha_http_post($this->recaptcha_verify_server, $this->recaptcha_verify_path, - array( - 'privatekey' => $config['recaptcha_privkey'], - 'remoteip' => $user->ip, - 'challenge' => $this->challenge, - 'response' => $this->response - ) + $extra_params - ); - - $answers = explode("\n", $response[1]); - - if (trim($answers[0]) === 'true') - { - $this->solved = true; - return false; - } - else - { - return $user->lang['RECAPTCHA_INCORRECT']; - } - } - - /** - * Encodes the given data into a query string format - * @param $data - array of string elements to be encoded - * @return string - encoded request - */ - function _recaptcha_qsencode($data) - { - $req = ''; - foreach ($data as $key => $value) - { - $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; - } - - // Cut the last '&' - $req = substr($req, 0, strlen($req) - 1); - return $req; - } -} diff --git a/phpBB/includes/compatibility_globals.php b/phpBB/includes/compatibility_globals.php new file mode 100644 index 0000000000..ae532c0f13 --- /dev/null +++ b/phpBB/includes/compatibility_globals.php @@ -0,0 +1,79 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * Sets compatibility globals in the global scope + * + * This function registers compatibility variables to the global + * variable scope. This is required to make it possible to include this file + * in a service. + */ +function register_compatibility_globals() +{ + global $phpbb_container; + + global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log; + global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template; + + // set up caching + /* @var $cache \phpbb\cache\service */ + $cache = $phpbb_container->get('cache'); + + // Instantiate some basic classes + /* @var $phpbb_dispatcher \phpbb\event\dispatcher */ + $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + + /* @var $request \phpbb\request\request_interface */ + $request = $phpbb_container->get('request'); + + /* @var $user \phpbb\user */ + $user = $phpbb_container->get('user'); + + /* @var $auth \phpbb\auth\auth */ + $auth = $phpbb_container->get('auth'); + + /* @var $db \phpbb\db\driver\driver_interface */ + $db = $phpbb_container->get('dbal.conn'); + + // Grab global variables, re-cache if necessary + /* @var $config phpbb\config\db */ + $config = $phpbb_container->get('config'); + + /* @var $phpbb_log \phpbb\log\log_interface */ + $phpbb_log = $phpbb_container->get('log'); + + /* @var $symfony_request \phpbb\symfony_request */ + $symfony_request = $phpbb_container->get('symfony_request'); + + /* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */ + $phpbb_filesystem = $phpbb_container->get('filesystem'); + + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + + // load extensions + /* @var $phpbb_extension_manager \phpbb\extension\manager */ + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); + + /* @var $template \phpbb\template\template */ + $template = $phpbb_container->get('template'); +} + +register_compatibility_globals(); diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index c2c7ca0abd..8056abef00 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -24,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.1.0-a4-dev'); +@define('PHPBB_VERSION', '3.2.0-a3-dev'); // QA-related // define('PHPBB_QA', 1); @@ -46,10 +50,10 @@ define('USER_INACTIVE', 1); define('USER_IGNORE', 2); define('USER_FOUNDER', 3); -define('INACTIVE_REGISTER', 1); -define('INACTIVE_PROFILE', 2); -define('INACTIVE_MANUAL', 3); -define('INACTIVE_REMIND', 4); +define('INACTIVE_REGISTER', 1); // Newly registered account +define('INACTIVE_PROFILE', 2); // Profile details changed +define('INACTIVE_MANUAL', 3); // Account deactivated by administrator +define('INACTIVE_REMIND', 4); // Forced user account reactivation // ACL define('ACL_NEVER', 0); @@ -91,6 +95,7 @@ define('ITEM_MOVED', 2); define('ITEM_UNAPPROVED', 0); // => has not yet been approved define('ITEM_APPROVED', 1); // => has been approved, and has not been soft deleted define('ITEM_DELETED', 2); // => has been soft deleted +define('ITEM_REAPPROVE', 3); // => has been edited and needs to be re-approved // Forum Flags define('FORUM_FLAG_LINK_TRACK', 1); @@ -166,11 +171,11 @@ define('CONFIRM_REPORT', 4); // Categories - Attachments define('ATTACHMENT_CATEGORY_NONE', 0); define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images -define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming -define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming +define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2 define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files -define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files +define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2 // BBCode UID length define('BBCODE_UID_LEN', 8); @@ -216,6 +221,9 @@ define('CAPTCHA_MAX_CHARS', 7); // Additional constants define('VOTE_CONVERTED', 127); +// BC global FTW +global $table_prefix; + // Table names define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups'); define('ACL_OPTIONS_TABLE', $table_prefix . 'acl_options'); @@ -227,7 +235,8 @@ define('BANLIST_TABLE', $table_prefix . 'banlist'); define('BBCODES_TABLE', $table_prefix . 'bbcodes'); define('BOOKMARKS_TABLE', $table_prefix . 'bookmarks'); define('BOTS_TABLE', $table_prefix . 'bots'); -define('CONFIG_TABLE', $table_prefix . 'config'); +@define('CONFIG_TABLE', $table_prefix . 'config'); +define('CONFIG_TEXT_TABLE', $table_prefix . 'config_text'); define('CONFIRM_TABLE', $table_prefix . 'confirm'); define('DISALLOW_TABLE', $table_prefix . 'disallow'); define('DRAFTS_TABLE', $table_prefix . 'drafts'); diff --git a/phpBB/includes/db/schema_data.php b/phpBB/includes/db/schema_data.php deleted file mode 100644 index dc85ff327b..0000000000 --- a/phpBB/includes/db/schema_data.php +++ /dev/null @@ -1,1221 +0,0 @@ -<?php -/** -* -* @package dbal -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -$schema_data = array(); - -/** -* Define the basic structure -* The format: -* array('{TABLE_NAME}' => {TABLE_DATA}) -* {TABLE_DATA}: -* COLUMNS = array({column_name} = array({column_type}, {default}, {auto_increment})) -* PRIMARY_KEY = {column_name(s)} -* KEYS = array({key_name} = array({key_type}, {column_name(s)})), -* -* Column Types: -* INT:x => SIGNED int(x) -* BINT => BIGINT -* ULINT => UNSIGNED int(10) -* UINT => mediumint(8) UNSIGNED -* UINT:x => int(x) UNSIGNED -* TINT:x => tinyint(x) -* USINT => smallint(4) UNSIGNED (for _order columns) -* BOOL => tinyint(1) UNSIGNED -* VCHAR => varchar(255) -* CHAR:x => char(x) -* XSTEXT_UNI => text for storing 100 characters (topic_title for example) -* STEXT_UNI => text for storing 255 characters (normal input field with a max of 255 single-byte chars) - same as VCHAR_UNI -* TEXT_UNI => text for storing 3000 characters (short text, descriptions, comments, etc.) -* MTEXT_UNI => mediumtext (post text, large text) -* VCHAR:x => varchar(x) -* TIMESTAMP => int(11) UNSIGNED -* DECIMAL => decimal number (5,2) -* DECIMAL: => decimal number (x,2) -* PDECIMAL => precision decimal number (6,3) -* PDECIMAL: => precision decimal number (x,3) -* VCHAR_UNI => varchar(255) BINARY -* VCHAR_CI => varchar_ci for postgresql, others VCHAR -*/ -$schema_data['phpbb_attachments'] = array( - 'COLUMNS' => array( - 'attach_id' => array('UINT', NULL, 'auto_increment'), - 'post_msg_id' => array('UINT', 0), - 'topic_id' => array('ULINT', 0), - 'in_message' => array('BOOL', 0), - 'poster_id' => array('UINT', 0), - 'is_orphan' => array('BOOL', 1), - 'physical_filename' => array('VCHAR', ''), - 'real_filename' => array('VCHAR', ''), - 'download_count' => array('UINT', 0), - 'attach_comment' => array('TEXT_UNI', ''), - 'extension' => array('VCHAR:100', ''), - 'mimetype' => array('VCHAR:100', ''), - 'filesize' => array('UINT:20', 0), - 'filetime' => array('TIMESTAMP', 0), - 'thumbnail' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => 'attach_id', - 'KEYS' => array( - 'filetime' => array('INDEX', 'filetime'), - 'post_msg_id' => array('INDEX', 'post_msg_id'), - 'topic_id' => array('INDEX', 'topic_id'), - 'poster_id' => array('INDEX', 'poster_id'), - 'is_orphan' => array('INDEX', 'is_orphan'), - ), -); - -$schema_data['phpbb_acl_groups'] = array( - 'COLUMNS' => array( - 'group_id' => array('UINT', 0), - 'forum_id' => array('UINT', 0), - 'auth_option_id' => array('UINT', 0), - 'auth_role_id' => array('UINT', 0), - 'auth_setting' => array('TINT:2', 0), - ), - 'KEYS' => array( - 'group_id' => array('INDEX', 'group_id'), - 'auth_opt_id' => array('INDEX', 'auth_option_id'), - 'auth_role_id' => array('INDEX', 'auth_role_id'), - ), -); - -$schema_data['phpbb_acl_options'] = array( - 'COLUMNS' => array( - 'auth_option_id' => array('UINT', NULL, 'auto_increment'), - 'auth_option' => array('VCHAR:50', ''), - 'is_global' => array('BOOL', 0), - 'is_local' => array('BOOL', 0), - 'founder_only' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => 'auth_option_id', - 'KEYS' => array( - 'auth_option' => array('UNIQUE', 'auth_option'), - ), -); - -$schema_data['phpbb_acl_roles'] = array( - 'COLUMNS' => array( - 'role_id' => array('UINT', NULL, 'auto_increment'), - 'role_name' => array('VCHAR_UNI', ''), - 'role_description' => array('TEXT_UNI', ''), - 'role_type' => array('VCHAR:10', ''), - 'role_order' => array('USINT', 0), - ), - 'PRIMARY_KEY' => 'role_id', - 'KEYS' => array( - 'role_type' => array('INDEX', 'role_type'), - 'role_order' => array('INDEX', 'role_order'), - ), -); - -$schema_data['phpbb_acl_roles_data'] = array( - 'COLUMNS' => array( - 'role_id' => array('UINT', 0), - 'auth_option_id' => array('UINT', 0), - 'auth_setting' => array('TINT:2', 0), - ), - 'PRIMARY_KEY' => array('role_id', 'auth_option_id'), - 'KEYS' => array( - 'ath_op_id' => array('INDEX', 'auth_option_id'), - ), -); - -$schema_data['phpbb_acl_users'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), - 'forum_id' => array('UINT', 0), - 'auth_option_id' => array('UINT', 0), - 'auth_role_id' => array('UINT', 0), - 'auth_setting' => array('TINT:2', 0), - ), - 'KEYS' => array( - 'user_id' => array('INDEX', 'user_id'), - 'auth_option_id' => array('INDEX', 'auth_option_id'), - 'auth_role_id' => array('INDEX', 'auth_role_id'), - ), -); - -$schema_data['phpbb_banlist'] = array( - 'COLUMNS' => array( - 'ban_id' => array('UINT', NULL, 'auto_increment'), - 'ban_userid' => array('UINT', 0), - 'ban_ip' => array('VCHAR:40', ''), - 'ban_email' => array('VCHAR_UNI:100', ''), - 'ban_start' => array('TIMESTAMP', 0), - 'ban_end' => array('TIMESTAMP', 0), - 'ban_exclude' => array('BOOL', 0), - 'ban_reason' => array('VCHAR_UNI', ''), - 'ban_give_reason' => array('VCHAR_UNI', ''), - ), - 'PRIMARY_KEY' => 'ban_id', - 'KEYS' => array( - 'ban_end' => array('INDEX', 'ban_end'), - 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')), - 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')), - 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')), - ), -); - -$schema_data['phpbb_bbcodes'] = array( - 'COLUMNS' => array( - 'bbcode_id' => array('USINT', 0), - 'bbcode_tag' => array('VCHAR:16', ''), - 'bbcode_helpline' => array('VCHAR_UNI', ''), - 'display_on_posting' => array('BOOL', 0), - 'bbcode_match' => array('TEXT_UNI', ''), - 'bbcode_tpl' => array('MTEXT_UNI', ''), - 'first_pass_match' => array('MTEXT_UNI', ''), - 'first_pass_replace' => array('MTEXT_UNI', ''), - 'second_pass_match' => array('MTEXT_UNI', ''), - 'second_pass_replace' => array('MTEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'bbcode_id', - 'KEYS' => array( - 'display_on_post' => array('INDEX', 'display_on_posting'), - ), -); - -$schema_data['phpbb_bookmarks'] = array( - 'COLUMNS' => array( - 'topic_id' => array('ULINT', 0), - 'user_id' => array('ULINT', 0), - ), - 'PRIMARY_KEY' => array('topic_id', 'user_id'), -); - -$schema_data['phpbb_bots'] = array( - 'COLUMNS' => array( - 'bot_id' => array('UINT', NULL, 'auto_increment'), - 'bot_active' => array('BOOL', 1), - 'bot_name' => array('STEXT_UNI', ''), - 'user_id' => array('ULINT', 0), - 'bot_agent' => array('VCHAR', ''), - 'bot_ip' => array('VCHAR', ''), - ), - 'PRIMARY_KEY' => 'bot_id', - 'KEYS' => array( - 'bot_active' => array('INDEX', 'bot_active'), - ), -); - -$schema_data['phpbb_config'] = array( - 'COLUMNS' => array( - 'config_name' => array('VCHAR', ''), - 'config_value' => array('VCHAR_UNI', ''), - 'is_dynamic' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => 'config_name', - 'KEYS' => array( - 'is_dynamic' => array('INDEX', 'is_dynamic'), - ), -); - -$schema_data['phpbb_config_text'] = array( - 'COLUMNS' => array( - 'config_name' => array('VCHAR', ''), - 'config_value' => array('MTEXT', ''), - ), - 'PRIMARY_KEY' => 'config_name', -); - -$schema_data['phpbb_confirm'] = array( - 'COLUMNS' => array( - 'confirm_id' => array('CHAR:32', ''), - 'session_id' => array('CHAR:32', ''), - 'confirm_type' => array('TINT:3', 0), - 'code' => array('VCHAR:8', ''), - 'seed' => array('UINT:10', 0), - 'attempts' => array('UINT', 0), - ), - 'PRIMARY_KEY' => array('session_id', 'confirm_id'), - 'KEYS' => array( - 'confirm_type' => array('INDEX', 'confirm_type'), - ), -); - -$schema_data['phpbb_disallow'] = array( - 'COLUMNS' => array( - 'disallow_id' => array('UINT', NULL, 'auto_increment'), - 'disallow_username' => array('VCHAR_UNI:255', ''), - ), - 'PRIMARY_KEY' => 'disallow_id', -); - -$schema_data['phpbb_drafts'] = array( - 'COLUMNS' => array( - 'draft_id' => array('UINT', NULL, 'auto_increment'), - 'user_id' => array('ULINT', 0), - 'topic_id' => array('ULINT', 0), - 'forum_id' => array('UINT', 0), - 'save_time' => array('TIMESTAMP', 0), - 'draft_subject' => array('STEXT_UNI', ''), - 'draft_message' => array('MTEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'draft_id', - 'KEYS' => array( - 'save_time' => array('INDEX', 'save_time'), - ), -); - -$schema_data['phpbb_ext'] = array( - 'COLUMNS' => array( - 'ext_name' => array('VCHAR', ''), - 'ext_active' => array('BOOL', 0), - 'ext_state' => array('TEXT', ''), - ), - 'KEYS' => array( - 'ext_name' => array('UNIQUE', 'ext_name'), - ), -); - -$schema_data['phpbb_extensions'] = array( - 'COLUMNS' => array( - 'extension_id' => array('UINT', NULL, 'auto_increment'), - 'group_id' => array('UINT', 0), - 'extension' => array('VCHAR:100', ''), - ), - 'PRIMARY_KEY' => 'extension_id', -); - -$schema_data['phpbb_extension_groups'] = array( - 'COLUMNS' => array( - 'group_id' => array('UINT', NULL, 'auto_increment'), - 'group_name' => array('VCHAR_UNI', ''), - 'cat_id' => array('TINT:2', 0), - 'allow_group' => array('BOOL', 0), - 'download_mode' => array('BOOL', 1), - 'upload_icon' => array('VCHAR', ''), - 'max_filesize' => array('UINT:20', 0), - 'allowed_forums' => array('TEXT', ''), - 'allow_in_pm' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => 'group_id', -); - -$schema_data['phpbb_forums'] = array( - 'COLUMNS' => array( - 'forum_id' => array('UINT', NULL, 'auto_increment'), - 'parent_id' => array('UINT', 0), - 'left_id' => array('UINT', 0), - 'right_id' => array('UINT', 0), - 'forum_parents' => array('MTEXT', ''), - 'forum_name' => array('STEXT_UNI', ''), - 'forum_desc' => array('TEXT_UNI', ''), - 'forum_desc_bitfield' => array('VCHAR:255', ''), - 'forum_desc_options' => array('UINT:11', 7), - 'forum_desc_uid' => array('VCHAR:8', ''), - 'forum_link' => array('VCHAR_UNI', ''), - 'forum_password' => array('VCHAR_UNI', ''), - 'forum_style' => array('UINT', 0), - 'forum_image' => array('VCHAR', ''), - 'forum_rules' => array('TEXT_UNI', ''), - 'forum_rules_link' => array('VCHAR_UNI', ''), - 'forum_rules_bitfield' => array('VCHAR:255', ''), - 'forum_rules_options' => array('UINT:11', 7), - 'forum_rules_uid' => array('VCHAR:8', ''), - 'forum_topics_per_page' => array('TINT:4', 0), - 'forum_type' => array('TINT:4', 0), - 'forum_status' => array('TINT:4', 0), - 'forum_posts_approved' => array('UINT', 0), - 'forum_posts_unapproved' => array('UINT', 0), - 'forum_posts_softdeleted' => array('UINT', 0), - 'forum_topics_approved' => array('UINT', 0), - 'forum_topics_unapproved' => array('UINT', 0), - 'forum_topics_softdeleted' => array('UINT', 0), - 'forum_last_post_id' => array('UINT', 0), - 'forum_last_poster_id' => array('UINT', 0), - 'forum_last_post_subject' => array('STEXT_UNI', ''), - 'forum_last_post_time' => array('TIMESTAMP', 0), - 'forum_last_poster_name'=> array('VCHAR_UNI', ''), - 'forum_last_poster_colour'=> array('VCHAR:6', ''), - 'forum_flags' => array('TINT:4', 32), - 'forum_options' => array('UINT:20', 0), - 'display_subforum_list' => array('BOOL', 1), - 'display_on_index' => array('BOOL', 1), - 'enable_indexing' => array('BOOL', 1), - 'enable_icons' => array('BOOL', 1), - 'enable_prune' => array('BOOL', 0), - 'prune_next' => array('TIMESTAMP', 0), - 'prune_days' => array('UINT', 0), - 'prune_viewed' => array('UINT', 0), - 'prune_freq' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'forum_id', - 'KEYS' => array( - 'left_right_id' => array('INDEX', array('left_id', 'right_id')), - 'forum_lastpost_id' => array('INDEX', 'forum_last_post_id'), - ), -); - -$schema_data['phpbb_forums_access'] = array( - 'COLUMNS' => array( - 'forum_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'session_id' => array('CHAR:32', ''), - ), - 'PRIMARY_KEY' => array('forum_id', 'user_id', 'session_id'), -); - -$schema_data['phpbb_forums_track'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), - 'forum_id' => array('UINT', 0), - 'mark_time' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => array('user_id', 'forum_id'), -); - -$schema_data['phpbb_forums_watch'] = array( - 'COLUMNS' => array( - 'forum_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'notify_status' => array('BOOL', 0), - ), - 'KEYS' => array( - 'forum_id' => array('INDEX', 'forum_id'), - 'user_id' => array('INDEX', 'user_id'), - 'notify_stat' => array('INDEX', 'notify_status'), - ), -); - -$schema_data['phpbb_groups'] = array( - 'COLUMNS' => array( - 'group_id' => array('UINT', NULL, 'auto_increment'), - 'group_type' => array('TINT:4', 1), - 'group_founder_manage' => array('BOOL', 0), - 'group_skip_auth' => array('BOOL', 0), - 'group_name' => array('VCHAR_CI', ''), - 'group_desc' => array('TEXT_UNI', ''), - 'group_desc_bitfield' => array('VCHAR:255', ''), - 'group_desc_options' => array('UINT:11', 7), - 'group_desc_uid' => array('VCHAR:8', ''), - 'group_display' => array('BOOL', 0), - 'group_avatar' => array('VCHAR', ''), - 'group_avatar_type' => array('VCHAR:255', ''), - 'group_avatar_width' => array('USINT', 0), - 'group_avatar_height' => array('USINT', 0), - 'group_rank' => array('UINT', 0), - 'group_colour' => array('VCHAR:6', ''), - 'group_sig_chars' => array('UINT', 0), - 'group_receive_pm' => array('BOOL', 0), - 'group_message_limit' => array('UINT', 0), - 'group_max_recipients' => array('UINT', 0), - 'group_legend' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'group_id', - 'KEYS' => array( - 'group_legend_name' => array('INDEX', array('group_legend', 'group_name')), - ), -); - -$schema_data['phpbb_icons'] = array( - 'COLUMNS' => array( - 'icons_id' => array('UINT', NULL, 'auto_increment'), - 'icons_url' => array('VCHAR', ''), - 'icons_width' => array('TINT:4', 0), - 'icons_height' => array('TINT:4', 0), - 'icons_order' => array('UINT', 0), - 'display_on_posting' => array('BOOL', 1), - ), - 'PRIMARY_KEY' => 'icons_id', - 'KEYS' => array( - 'display_on_posting' => array('INDEX', 'display_on_posting'), - ), -); - -$schema_data['phpbb_lang'] = array( - 'COLUMNS' => array( - 'lang_id' => array('TINT:4', NULL, 'auto_increment'), - 'lang_iso' => array('VCHAR:30', ''), - 'lang_dir' => array('VCHAR:30', ''), - 'lang_english_name' => array('VCHAR_UNI:100', ''), - 'lang_local_name' => array('VCHAR_UNI:255', ''), - 'lang_author' => array('VCHAR_UNI:255', ''), - ), - 'PRIMARY_KEY' => 'lang_id', - 'KEYS' => array( - 'lang_iso' => array('INDEX', 'lang_iso'), - ), -); - -$schema_data['phpbb_log'] = array( - 'COLUMNS' => array( - 'log_id' => array('UINT', NULL, 'auto_increment'), - 'log_type' => array('TINT:4', 0), - 'user_id' => array('ULINT', 0), - 'forum_id' => array('UINT', 0), - 'topic_id' => array('ULINT', 0), - 'reportee_id' => array('UINT', 0), - 'log_ip' => array('VCHAR:40', ''), - 'log_time' => array('TIMESTAMP', 0), - 'log_operation' => array('TEXT_UNI', ''), - 'log_data' => array('MTEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'log_id', - 'KEYS' => array( - 'log_type' => array('INDEX', 'log_type'), - 'log_time' => array('INDEX', 'log_time'), - 'forum_id' => array('INDEX', 'forum_id'), - 'topic_id' => array('INDEX', 'topic_id'), - 'reportee_id' => array('INDEX', 'reportee_id'), - 'user_id' => array('INDEX', 'user_id'), - ), -); - -$schema_data['phpbb_login_attempts'] = array( - 'COLUMNS' => array( - 'attempt_ip' => array('VCHAR:40', ''), - 'attempt_browser' => array('VCHAR:150', ''), - 'attempt_forwarded_for' => array('VCHAR:255', ''), - 'attempt_time' => array('TIMESTAMP', 0), - 'user_id' => array('ULINT', 0), - 'username' => array('VCHAR_UNI:255', 0), - 'username_clean' => array('VCHAR_CI', 0), - ), - 'KEYS' => array( - 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), - 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), - 'att_time' => array('INDEX', array('attempt_time')), - 'user_id' => array('INDEX', 'user_id'), - ), -); - -$schema_data['phpbb_moderator_cache'] = array( - 'COLUMNS' => array( - 'forum_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'username' => array('VCHAR_UNI:255', ''), - 'group_id' => array('UINT', 0), - 'group_name' => array('VCHAR_UNI', ''), - 'display_on_index' => array('BOOL', 1), - ), - 'KEYS' => array( - 'disp_idx' => array('INDEX', 'display_on_index'), - 'forum_id' => array('INDEX', 'forum_id'), - ), -); - -$schema_data['phpbb_migrations'] = array( - 'COLUMNS' => array( - 'migration_name' => array('VCHAR', ''), - 'migration_depends_on' => array('TEXT', ''), - 'migration_schema_done' => array('BOOL', 0), - 'migration_data_done' => array('BOOL', 0), - 'migration_data_state' => array('TEXT', ''), - 'migration_start_time' => array('TIMESTAMP', 0), - 'migration_end_time' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => 'migration_name', -); - -$schema_data['phpbb_modules'] = array( - 'COLUMNS' => array( - 'module_id' => array('UINT', NULL, 'auto_increment'), - 'module_enabled' => array('BOOL', 1), - 'module_display' => array('BOOL', 1), - 'module_basename' => array('VCHAR', ''), - 'module_class' => array('VCHAR:10', ''), - 'parent_id' => array('UINT', 0), - 'left_id' => array('UINT', 0), - 'right_id' => array('UINT', 0), - 'module_langname' => array('VCHAR', ''), - 'module_mode' => array('VCHAR', ''), - 'module_auth' => array('VCHAR', ''), - ), - 'PRIMARY_KEY' => 'module_id', - 'KEYS' => array( - 'left_right_id' => array('INDEX', array('left_id', 'right_id')), - 'module_enabled' => array('INDEX', 'module_enabled'), - 'class_left_id' => array('INDEX', array('module_class', 'left_id')), - ), -); - -$schema_data['phpbb_notification_types'] = array( - 'COLUMNS' => array( - 'notification_type_id' => array('USINT', NULL, 'auto_increment'), - 'notification_type_name' => array('VCHAR:255', ''), - 'notification_type_enabled' => array('BOOL', 1), - ), - 'PRIMARY_KEY' => array('notification_type_id'), - 'KEYS' => array( - 'type' => array('UNIQUE', array('notification_type_name')), - ), -); - -$schema_data['phpbb_notifications'] = array( - 'COLUMNS' => array( - 'notification_id' => array('UINT:10', NULL, 'auto_increment'), - 'notification_type_id' => array('USINT', 0), - 'item_id' => array('UINT', 0), - 'item_parent_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'notification_read' => array('BOOL', 0), - 'notification_time' => array('TIMESTAMP', 1), - 'notification_data' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'notification_id', - 'KEYS' => array( - 'item_ident' => array('INDEX', array('notification_type_id', 'item_id')), - 'user' => array('INDEX', array('user_id', 'notification_read')), - ), -); - -$schema_data['phpbb_oauth_accounts'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), - 'provider' => array('VCHAR', ''), - 'oauth_provider_id' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => array( - 'user_id', - 'provider', - ), -); - -$schema_data['phpbb_oauth_tokens'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), // phpbb_users.user_id - 'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set - 'provider' => array('VCHAR', ''), // Name of the OAuth provider - 'oauth_token' => array('MTEXT', ''), // Serialized token - ), - 'KEYS' => array( - 'user_id' => array('INDEX', 'user_id'), - 'provider' => array('INDEX', 'provider'), - ), -); - -$schema_data['phpbb_poll_options'] = array( - 'COLUMNS' => array( - 'poll_option_id' => array('TINT:4', 0), - 'topic_id' => array('ULINT', 0), - 'poll_option_text' => array('TEXT_UNI', ''), - 'poll_option_total' => array('UINT', 0), - ), - 'KEYS' => array( - 'poll_opt_id' => array('INDEX', 'poll_option_id'), - 'topic_id' => array('INDEX', 'topic_id'), - ), -); - -$schema_data['phpbb_poll_votes'] = array( - 'COLUMNS' => array( - 'topic_id' => array('ULINT', 0), - 'poll_option_id' => array('TINT:4', 0), - 'vote_user_id' => array('UINT', 0), - 'vote_user_ip' => array('VCHAR:40', ''), - ), - 'KEYS' => array( - 'topic_id' => array('INDEX', 'topic_id'), - 'vote_user_id' => array('INDEX', 'vote_user_id'), - 'vote_user_ip' => array('INDEX', 'vote_user_ip'), - ), -); - -$schema_data['phpbb_posts'] = array( - 'COLUMNS' => array( - 'post_id' => array('ULINT', NULL, 'auto_increment'), - 'topic_id' => array('ULINT', 0), - 'forum_id' => array('UINT', 0), - 'poster_id' => array('UINT', 0), - 'icon_id' => array('UINT', 0), - 'poster_ip' => array('VCHAR:40', ''), - 'post_time' => array('TIMESTAMP', 0), - 'post_visibility' => array('TINT:3', 0), - 'post_reported' => array('BOOL', 0), - 'enable_bbcode' => array('BOOL', 1), - 'enable_smilies' => array('BOOL', 1), - 'enable_magic_url' => array('BOOL', 1), - 'enable_sig' => array('BOOL', 1), - 'post_username' => array('VCHAR_UNI:255', ''), - 'post_subject' => array('STEXT_UNI', '', 'true_sort'), - 'post_text' => array('MTEXT_UNI', ''), - 'post_checksum' => array('VCHAR:32', ''), - 'post_attachment' => array('BOOL', 0), - 'bbcode_bitfield' => array('VCHAR:255', ''), - 'bbcode_uid' => array('VCHAR:8', ''), - 'post_postcount' => array('BOOL', 1), - 'post_edit_time' => array('TIMESTAMP', 0), - 'post_edit_reason' => array('STEXT_UNI', ''), - 'post_edit_user' => array('UINT', 0), - 'post_edit_count' => array('USINT', 0), - 'post_edit_locked' => array('BOOL', 0), - 'post_delete_time' => array('TIMESTAMP', 0), - 'post_delete_reason' => array('STEXT_UNI', ''), - 'post_delete_user' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'post_id', - 'KEYS' => array( - 'forum_id' => array('INDEX', 'forum_id'), - 'topic_id' => array('INDEX', 'topic_id'), - 'poster_ip' => array('INDEX', 'poster_ip'), - 'poster_id' => array('INDEX', 'poster_id'), - 'post_visibility' => array('INDEX', 'post_visibility'), - 'post_username' => array('INDEX', 'post_username'), - 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')), - ), -); - -$schema_data['phpbb_privmsgs'] = array( - 'COLUMNS' => array( - 'msg_id' => array('UINT', NULL, 'auto_increment'), - 'root_level' => array('UINT', 0), - 'author_id' => array('UINT', 0), - 'icon_id' => array('UINT', 0), - 'author_ip' => array('VCHAR:40', ''), - 'message_time' => array('TIMESTAMP', 0), - 'enable_bbcode' => array('BOOL', 1), - 'enable_smilies' => array('BOOL', 1), - 'enable_magic_url' => array('BOOL', 1), - 'enable_sig' => array('BOOL', 1), - 'message_subject' => array('STEXT_UNI', ''), - 'message_text' => array('MTEXT_UNI', ''), - 'message_edit_reason' => array('STEXT_UNI', ''), - 'message_edit_user' => array('UINT', 0), - 'message_attachment' => array('BOOL', 0), - 'bbcode_bitfield' => array('VCHAR:255', ''), - 'bbcode_uid' => array('VCHAR:8', ''), - 'message_edit_time' => array('TIMESTAMP', 0), - 'message_edit_count' => array('USINT', 0), - 'to_address' => array('TEXT_UNI', ''), - 'bcc_address' => array('TEXT_UNI', ''), - 'message_reported' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => 'msg_id', - 'KEYS' => array( - 'author_ip' => array('INDEX', 'author_ip'), - 'message_time' => array('INDEX', 'message_time'), - 'author_id' => array('INDEX', 'author_id'), - 'root_level' => array('INDEX', 'root_level'), - ), -); - -$schema_data['phpbb_privmsgs_folder'] = array( - 'COLUMNS' => array( - 'folder_id' => array('UINT', NULL, 'auto_increment'), - 'user_id' => array('ULINT', 0), - 'folder_name' => array('VCHAR_UNI', ''), - 'pm_count' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'folder_id', - 'KEYS' => array( - 'user_id' => array('INDEX', 'user_id'), - ), -); - -$schema_data['phpbb_privmsgs_rules'] = array( - 'COLUMNS' => array( - 'rule_id' => array('UINT', NULL, 'auto_increment'), - 'user_id' => array('ULINT', 0), - 'rule_check' => array('UINT', 0), - 'rule_connection' => array('UINT', 0), - 'rule_string' => array('VCHAR_UNI', ''), - 'rule_user_id' => array('UINT', 0), - 'rule_group_id' => array('UINT', 0), - 'rule_action' => array('UINT', 0), - 'rule_folder_id' => array('INT:11', 0), - ), - 'PRIMARY_KEY' => 'rule_id', - 'KEYS' => array( - 'user_id' => array('INDEX', 'user_id'), - ), -); - -$schema_data['phpbb_privmsgs_to'] = array( - 'COLUMNS' => array( - 'msg_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'author_id' => array('UINT', 0), - 'pm_deleted' => array('BOOL', 0), - 'pm_new' => array('BOOL', 1), - 'pm_unread' => array('BOOL', 1), - 'pm_replied' => array('BOOL', 0), - 'pm_marked' => array('BOOL', 0), - 'pm_forwarded' => array('BOOL', 0), - 'folder_id' => array('INT:11', 0), - ), - 'KEYS' => array( - 'msg_id' => array('INDEX', 'msg_id'), - 'author_id' => array('INDEX', 'author_id'), - 'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')), - ), -); - -$schema_data['phpbb_profile_fields'] = array( - 'COLUMNS' => array( - 'field_id' => array('UINT', NULL, 'auto_increment'), - 'field_name' => array('VCHAR_UNI', ''), - 'field_type' => array('VCHAR:100', ''), - 'field_ident' => array('VCHAR:20', ''), - 'field_length' => array('VCHAR:20', ''), - 'field_minlen' => array('VCHAR', ''), - 'field_maxlen' => array('VCHAR', ''), - 'field_novalue' => array('VCHAR_UNI', ''), - 'field_default_value' => array('VCHAR_UNI', ''), - 'field_validation' => array('VCHAR_UNI:20', ''), - 'field_required' => array('BOOL', 0), - 'field_show_novalue' => array('BOOL', 0), - 'field_show_on_reg' => array('BOOL', 0), - 'field_show_on_pm' => array('BOOL', 0), - 'field_show_on_vt' => array('BOOL', 0), - 'field_show_on_ml' => array('BOOL', 0), - 'field_show_profile' => array('BOOL', 0), - 'field_hide' => array('BOOL', 0), - 'field_no_view' => array('BOOL', 0), - 'field_active' => array('BOOL', 0), - 'field_order' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'field_id', - 'KEYS' => array( - 'fld_type' => array('INDEX', 'field_type'), - 'fld_ordr' => array('INDEX', 'field_order'), - ), -); - -$schema_data['phpbb_profile_fields_data'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), - 'pf_phpbb_location' => array('VCHAR', ''), - 'pf_phpbb_interests' => array('TEXT_UNI', ''), - 'pf_phpbb_occupation' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'user_id', -); - -$schema_data['phpbb_profile_fields_lang'] = array( - 'COLUMNS' => array( - 'field_id' => array('UINT', 0), - 'lang_id' => array('UINT', 0), - 'option_id' => array('UINT', 0), - 'field_type' => array('VCHAR:100', ''), - 'lang_value' => array('VCHAR_UNI', ''), - ), - 'PRIMARY_KEY' => array('field_id', 'lang_id', 'option_id'), -); - -$schema_data['phpbb_profile_lang'] = array( - 'COLUMNS' => array( - 'field_id' => array('UINT', 0), - 'lang_id' => array('UINT', 0), - 'lang_name' => array('VCHAR_UNI', ''), - 'lang_explain' => array('TEXT_UNI', ''), - 'lang_default_value' => array('VCHAR_UNI', ''), - ), - 'PRIMARY_KEY' => array('field_id', 'lang_id'), -); - -$schema_data['phpbb_ranks'] = array( - 'COLUMNS' => array( - 'rank_id' => array('UINT', NULL, 'auto_increment'), - 'rank_title' => array('VCHAR_UNI', ''), - 'rank_min' => array('UINT', 0), - 'rank_special' => array('BOOL', 0), - 'rank_image' => array('VCHAR', ''), - ), - 'PRIMARY_KEY' => 'rank_id', -); - -$schema_data['phpbb_reports'] = array( - 'COLUMNS' => array( - 'report_id' => array('UINT', NULL, 'auto_increment'), - 'reason_id' => array('USINT', 0), - 'post_id' => array('ULINT', 0), - 'pm_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'user_notify' => array('BOOL', 0), - 'report_closed' => array('BOOL', 0), - 'report_time' => array('TIMESTAMP', 0), - 'report_text' => array('MTEXT_UNI', ''), - 'reported_post_text' => array('MTEXT_UNI', ''), - 'reported_post_uid' => array('VCHAR:8', ''), - 'reported_post_bitfield' => array('VCHAR:255', ''), - 'reported_post_enable_magic_url' => array('BOOL', 1), - 'reported_post_enable_smilies' => array('BOOL', 1), - 'reported_post_enable_bbcode' => array('BOOL', 1) - ), - 'PRIMARY_KEY' => 'report_id', - 'KEYS' => array( - 'post_id' => array('INDEX', 'post_id'), - 'pm_id' => array('INDEX', 'pm_id'), - ), -); - -$schema_data['phpbb_reports_reasons'] = array( - 'COLUMNS' => array( - 'reason_id' => array('USINT', NULL, 'auto_increment'), - 'reason_title' => array('VCHAR_UNI', ''), - 'reason_description' => array('MTEXT_UNI', ''), - 'reason_order' => array('USINT', 0), - ), - 'PRIMARY_KEY' => 'reason_id', -); - -$schema_data['phpbb_search_results'] = array( - 'COLUMNS' => array( - 'search_key' => array('VCHAR:32', ''), - 'search_time' => array('TIMESTAMP', 0), - 'search_keywords' => array('MTEXT_UNI', ''), - 'search_authors' => array('MTEXT', ''), - ), - 'PRIMARY_KEY' => 'search_key', -); - -$schema_data['phpbb_search_wordlist'] = array( - 'COLUMNS' => array( - 'word_id' => array('UINT', NULL, 'auto_increment'), - 'word_text' => array('VCHAR_UNI', ''), - 'word_common' => array('BOOL', 0), - 'word_count' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'word_id', - 'KEYS' => array( - 'wrd_txt' => array('UNIQUE', 'word_text'), - 'wrd_cnt' => array('INDEX', 'word_count'), - ), -); - -$schema_data['phpbb_search_wordmatch'] = array( - 'COLUMNS' => array( - 'post_id' => array('ULINT', 0), - 'word_id' => array('UINT', 0), - 'title_match' => array('BOOL', 0), - ), - 'KEYS' => array( - 'unq_mtch' => array('UNIQUE', array('word_id', 'post_id', 'title_match')), - 'word_id' => array('INDEX', 'word_id'), - 'post_id' => array('INDEX', 'post_id'), - ), -); - -$schema_data['phpbb_sessions'] = array( - 'COLUMNS' => array( - 'session_id' => array('CHAR:32', ''), - 'session_user_id' => array('UINT', 0), - 'session_forum_id' => array('UINT', 0), - 'session_last_visit' => array('TIMESTAMP', 0), - 'session_start' => array('TIMESTAMP', 0), - 'session_time' => array('TIMESTAMP', 0), - 'session_ip' => array('VCHAR:40', ''), - 'session_browser' => array('VCHAR:150', ''), - 'session_forwarded_for' => array('VCHAR:255', ''), - 'session_page' => array('VCHAR_UNI', ''), - 'session_viewonline' => array('BOOL', 1), - 'session_autologin' => array('BOOL', 0), - 'session_admin' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => 'session_id', - 'KEYS' => array( - 'session_time' => array('INDEX', 'session_time'), - 'session_user_id' => array('INDEX', 'session_user_id'), - 'session_fid' => array('INDEX', 'session_forum_id'), - ), -); - -$schema_data['phpbb_sessions_keys'] = array( - 'COLUMNS' => array( - 'key_id' => array('CHAR:32', ''), - 'user_id' => array('ULINT', 0), - 'last_ip' => array('VCHAR:40', ''), - 'last_login' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => array('key_id', 'user_id'), - 'KEYS' => array( - 'last_login' => array('INDEX', 'last_login'), - ), -); - -$schema_data['phpbb_sitelist'] = array( - 'COLUMNS' => array( - 'site_id' => array('UINT', NULL, 'auto_increment'), - 'site_ip' => array('VCHAR:40', ''), - 'site_hostname' => array('VCHAR', ''), - 'ip_exclude' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => 'site_id', -); - -$schema_data['phpbb_smilies'] = array( - 'COLUMNS' => array( - 'smiley_id' => array('UINT', NULL, 'auto_increment'), - // We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed. - 'code' => array('VCHAR_UNI:50', ''), - 'emotion' => array('VCHAR_UNI:50', ''), - 'smiley_url' => array('VCHAR:50', ''), - 'smiley_width' => array('USINT', 0), - 'smiley_height' => array('USINT', 0), - 'smiley_order' => array('UINT', 0), - 'display_on_posting'=> array('BOOL', 1), - ), - 'PRIMARY_KEY' => 'smiley_id', - 'KEYS' => array( - 'display_on_post' => array('INDEX', 'display_on_posting'), - ), -); - -$schema_data['phpbb_styles'] = array( - 'COLUMNS' => array( - 'style_id' => array('UINT', NULL, 'auto_increment'), - 'style_name' => array('VCHAR_UNI:255', ''), - 'style_copyright' => array('VCHAR_UNI', ''), - 'style_active' => array('BOOL', 1), - 'style_path' => array('VCHAR:100', ''), - 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), - 'style_parent_id' => array('UINT:4', 0), - 'style_parent_tree' => array('TEXT', ''), - ), - 'PRIMARY_KEY' => 'style_id', - 'KEYS' => array( - 'style_name' => array('UNIQUE', 'style_name'), - ), -); - -$schema_data['phpbb_teampage'] = array( - 'COLUMNS' => array( - 'teampage_id' => array('UINT', NULL, 'auto_increment'), - 'group_id' => array('UINT', 0), - 'teampage_name' => array('VCHAR_UNI:255', ''), - 'teampage_position' => array('UINT', 0), - 'teampage_parent' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'teampage_id', -); - -$schema_data['phpbb_topics'] = array( - 'COLUMNS' => array( - 'topic_id' => array('ULINT', NULL, 'auto_increment'), - 'forum_id' => array('UINT', 0), - 'icon_id' => array('UINT', 0), - 'topic_attachment' => array('BOOL', 0), - 'topic_visibility' => array('TINT:3', 0), - 'topic_reported' => array('BOOL', 0), - 'topic_title' => array('STEXT_UNI', '', 'true_sort'), - 'topic_poster' => array('UINT', 0), - 'topic_time' => array('TIMESTAMP', 0), - 'topic_time_limit' => array('TIMESTAMP', 0), - 'topic_views' => array('UINT', 0), - 'topic_posts_approved' => array('UINT', 0), - 'topic_posts_unapproved' => array('UINT', 0), - 'topic_posts_softdeleted' => array('UINT', 0), - 'topic_status' => array('TINT:3', 0), - 'topic_type' => array('TINT:3', 0), - 'topic_first_post_id' => array('UINT', 0), - 'topic_first_poster_name' => array('VCHAR_UNI', ''), - 'topic_first_poster_colour' => array('VCHAR:6', ''), - 'topic_last_post_id' => array('UINT', 0), - 'topic_last_poster_id' => array('UINT', 0), - 'topic_last_poster_name' => array('VCHAR_UNI', ''), - 'topic_last_poster_colour' => array('VCHAR:6', ''), - 'topic_last_post_subject' => array('STEXT_UNI', ''), - 'topic_last_post_time' => array('TIMESTAMP', 0), - 'topic_last_view_time' => array('TIMESTAMP', 0), - 'topic_moved_id' => array('UINT', 0), - 'topic_bumped' => array('BOOL', 0), - 'topic_bumper' => array('UINT', 0), - 'poll_title' => array('STEXT_UNI', ''), - 'poll_start' => array('TIMESTAMP', 0), - 'poll_length' => array('TIMESTAMP', 0), - 'poll_max_options' => array('TINT:4', 1), - 'poll_last_vote' => array('TIMESTAMP', 0), - 'poll_vote_change' => array('BOOL', 0), - 'topic_delete_time' => array('TIMESTAMP', 0), - 'topic_delete_reason' => array('STEXT_UNI', ''), - 'topic_delete_user' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'topic_id', - 'KEYS' => array( - 'forum_id' => array('INDEX', 'forum_id'), - 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')), - 'last_post_time' => array('INDEX', 'topic_last_post_time'), - 'topic_visibility' => array('INDEX', 'topic_visibility'), - 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')), - 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')), - ), -); - -$schema_data['phpbb_topics_track'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), - 'topic_id' => array('ULINT', 0), - 'forum_id' => array('UINT', 0), - 'mark_time' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => array('user_id', 'topic_id'), - 'KEYS' => array( - 'topic_id' => array('INDEX', 'topic_id'), - 'forum_id' => array('INDEX', 'forum_id'), - ), -); - -$schema_data['phpbb_topics_posted'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), - 'topic_id' => array('ULINT', 0), - 'topic_posted' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => array('user_id', 'topic_id'), -); - -$schema_data['phpbb_topics_watch'] = array( - 'COLUMNS' => array( - 'topic_id' => array('ULINT', 0), - 'user_id' => array('ULINT', 0), - 'notify_status' => array('BOOL', 0), - ), - 'KEYS' => array( - 'topic_id' => array('INDEX', 'topic_id'), - 'user_id' => array('INDEX', 'user_id'), - 'notify_stat' => array('INDEX', 'notify_status'), - ), -); - -$schema_data['phpbb_user_notifications'] = array( - 'COLUMNS' => array( - 'item_type' => array('VCHAR:255', ''), - 'item_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'method' => array('VCHAR:255', ''), - 'notify' => array('BOOL', 1), - ), -); - -$schema_data['phpbb_user_group'] = array( - 'COLUMNS' => array( - 'group_id' => array('UINT', 0), - 'user_id' => array('ULINT', 0), - 'group_leader' => array('BOOL', 0), - 'user_pending' => array('BOOL', 1), - ), - 'KEYS' => array( - 'group_id' => array('INDEX', 'group_id'), - 'user_id' => array('INDEX', 'user_id'), - 'group_leader' => array('INDEX', 'group_leader'), - ), -); - -$schema_data['phpbb_users'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', NULL, 'auto_increment'), - 'user_type' => array('TINT:2', 0), - 'group_id' => array('UINT', 3), - 'user_permissions' => array('MTEXT', ''), - 'user_perm_from' => array('UINT', 0), - 'user_ip' => array('VCHAR:40', ''), - 'user_regdate' => array('TIMESTAMP', 0), - 'username' => array('VCHAR_CI', ''), - 'username_clean' => array('VCHAR_CI', ''), - 'user_password' => array('VCHAR_UNI', ''), - 'user_passchg' => array('TIMESTAMP', 0), - 'user_pass_convert' => array('BOOL', 0), - 'user_actkey' => array('VCHAR:32', ''), - 'user_newpasswd' => array('VCHAR_UNI', ''), - 'user_email' => array('VCHAR_UNI:100', ''), - 'user_email_hash' => array('BINT', 0), - 'user_birthday' => array('VCHAR:10', ''), - 'user_lastvisit' => array('TIMESTAMP', 0), - 'user_lastmark' => array('TIMESTAMP', 0), - 'user_lastpost_time' => array('TIMESTAMP', 0), - 'user_lastpage' => array('VCHAR_UNI:200', ''), - 'user_last_confirm_key' => array('VCHAR:10', ''), - 'user_last_search' => array('TIMESTAMP', 0), - 'user_warnings' => array('TINT:4', 0), - 'user_last_warning' => array('TIMESTAMP', 0), - 'user_login_attempts' => array('TINT:4', 0), - 'user_inactive_reason' => array('TINT:2', 0), - 'user_inactive_time' => array('TIMESTAMP', 0), - 'user_posts' => array('UINT', 0), - 'user_lang' => array('VCHAR:30', ''), - 'user_timezone' => array('VCHAR:100', 'UTC'), - 'user_dateformat' => array('VCHAR_UNI:30', 'd M Y H:i'), - 'user_style' => array('UINT', 0), - 'user_rank' => array('UINT', 0), - 'user_colour' => array('VCHAR:6', ''), - 'user_new_privmsg' => array('INT:4', 0), - 'user_unread_privmsg' => array('INT:4', 0), - 'user_last_privmsg' => array('TIMESTAMP', 0), - 'user_message_rules' => array('BOOL', 0), - 'user_full_folder' => array('INT:11', -3), - 'user_emailtime' => array('TIMESTAMP', 0), - 'user_topic_show_days' => array('USINT', 0), - 'user_topic_sortby_type' => array('VCHAR:1', 't'), - 'user_topic_sortby_dir' => array('VCHAR:1', 'd'), - 'user_post_show_days' => array('USINT', 0), - 'user_post_sortby_type' => array('VCHAR:1', 't'), - 'user_post_sortby_dir' => array('VCHAR:1', 'a'), - 'user_notify' => array('BOOL', 0), - 'user_notify_pm' => array('BOOL', 1), - 'user_notify_type' => array('TINT:4', 0), - 'user_allow_pm' => array('BOOL', 1), - 'user_allow_viewonline' => array('BOOL', 1), - 'user_allow_viewemail' => array('BOOL', 1), - 'user_allow_massemail' => array('BOOL', 1), - 'user_options' => array('UINT:11', 230271), - 'user_avatar' => array('VCHAR', ''), - 'user_avatar_type' => array('VCHAR:255', ''), - 'user_avatar_width' => array('USINT', 0), - 'user_avatar_height' => array('USINT', 0), - 'user_sig' => array('MTEXT_UNI', ''), - 'user_sig_bbcode_uid' => array('VCHAR:8', ''), - 'user_sig_bbcode_bitfield' => array('VCHAR:255', ''), - 'user_icq' => array('VCHAR:15', ''), - 'user_aim' => array('VCHAR_UNI', ''), - 'user_yim' => array('VCHAR_UNI', ''), - 'user_msnm' => array('VCHAR_UNI', ''), - 'user_jabber' => array('VCHAR_UNI', ''), - 'user_website' => array('VCHAR_UNI:200', ''), - 'user_form_salt' => array('VCHAR_UNI:32', ''), - 'user_new' => array('BOOL', 1), - 'user_reminded' => array('TINT:4', 0), - 'user_reminded_time' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => 'user_id', - 'KEYS' => array( - 'user_birthday' => array('INDEX', 'user_birthday'), - 'user_email_hash' => array('INDEX', 'user_email_hash'), - 'user_type' => array('INDEX', 'user_type'), - 'username_clean' => array('UNIQUE', 'username_clean'), - ), -); - -$schema_data['phpbb_warnings'] = array( - 'COLUMNS' => array( - 'warning_id' => array('UINT', NULL, 'auto_increment'), - 'user_id' => array('ULINT', 0), - 'post_id' => array('ULINT', 0), - 'log_id' => array('UINT', 0), - 'warning_time' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => 'warning_id', -); - -$schema_data['phpbb_words'] = array( - 'COLUMNS' => array( - 'word_id' => array('UINT', NULL, 'auto_increment'), - 'word' => array('VCHAR_UNI', ''), - 'replacement' => array('VCHAR_UNI', ''), - ), - 'PRIMARY_KEY' => 'word_id', -); - -$schema_data['phpbb_zebra'] = array( - 'COLUMNS' => array( - 'user_id' => array('ULINT', 0), - 'zebra_id' => array('UINT', 0), - 'friend' => array('BOOL', 0), - 'foe' => array('BOOL', 0), - ), - 'PRIMARY_KEY' => array('user_id', 'zebra_id'), -); diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index 1ffa3429b5..d307880c4b 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -1,9 +1,13 @@ <?php /** * -* @package diff -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,7 +23,7 @@ if (!defined('IN_PHPBB')) * Code from pear.php.net, Text_Diff-1.1.0 package * http://pear.php.net/package/Text_Diff/ * -* Modified by phpBB Group to meet our coding standards +* Modified by phpBB Limited to meet our coding standards * and being able to integrate into phpBB * * General API for generating and formatting diffs - the differences between @@ -42,8 +46,9 @@ class diff /** * Computes diffs between sequences of strings. * - * @param array $from_lines An array of strings. Typically these are lines from a file. - * @param array $to_lines An array of strings. + * @param array &$from_content An array of strings. Typically these are lines from a file. + * @param array &$to_content An array of strings. + * @param bool $preserve_cr If true, \r is replaced by a new line in the diff output */ function diff(&$from_content, &$to_content, $preserve_cr = true) { @@ -487,9 +492,11 @@ class diff3 extends diff /** * Computes diff between 3 sequences of strings. * - * @param array $orig The original lines to use. - * @param array $final1 The first version to compare to. - * @param array $final2 The second version to compare to. + * @param array &$orig The original lines to use. + * @param array &$final1 The first version to compare to. + * @param array &$final2 The second version to compare to. + * @param bool $preserve_cr If true, \r\n and bare \r are replaced by a new line + * in the diff output */ function diff3(&$orig, &$final1, &$final2, $preserve_cr = true) { diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index dc1ca5875f..bc21b3b9ba 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -1,9 +1,13 @@ <?php /** * -* @package diff -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,7 +23,7 @@ if (!defined('IN_PHPBB')) * Code from pear.php.net, Text_Diff-1.1.0 package * http://pear.php.net/package/Text_Diff/ (native engine) * -* Modified by phpBB Group to meet our coding standards +* Modified by phpBB Limited to meet our coding standards * and being able to integrate into phpBB * * Class used internally by Text_Diff to actually compute the diffs. This diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index eacd42d760..6b7f07cf9c 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -1,9 +1,13 @@ <?php /** * -* @package diff -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,7 +23,7 @@ if (!defined('IN_PHPBB')) * Code from pear.php.net, Text_Diff-1.1.0 package * http://pear.php.net/package/Text_Diff/ * -* Modified by phpBB Group to meet our coding standards +* Modified by phpBB Limited to meet our coding standards * and being able to integrate into phpBB * * A class to render Diffs in different formats. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 689a682de3..38879caf5f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,144 +21,46 @@ if (!defined('IN_PHPBB')) // Common global functions /** -* Casts a variable to the given type. -* -* @deprecated -*/ -function set_var(&$result, $var, $type, $multibyte = false) -{ - // no need for dependency injection here, if you have the object, call the method yourself! - $type_cast_helper = new \phpbb\request\type_cast_helper(); - $type_cast_helper->set_var($result, $var, $type, $multibyte); -} - -/** -* Wrapper function of \phpbb\request\request::variable which exists for backwards compatability. -* See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for -* documentation of this function's use. -* -* @deprecated -* @param mixed $var_name The form variable's name from which data shall be retrieved. -* If the value is an array this may be an array of indizes which will give -* direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") -* then specifying array("var", 1) as the name will return "a". -* If you pass an instance of {@link \phpbb\request\request_interface phpbb_request_interface} -* as this parameter it will overwrite the current request class instance. If you do -* not do so, it will create its own instance (but leave superglobals enabled). -* @param mixed $default A default value that is returned if the variable was not set. -* This function will always return a value of the same type as the default. -* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters -* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks -* @param bool $cookie This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for -* \phpbb\request\request_interface::variable for backwards compatability reasons. -* @param \phpbb\request\request_interface|null|false If an instance of \phpbb\request\request_interface is given the instance is stored in -* a static variable and used for all further calls where this parameters is null. Until -* the function is called with an instance it automatically creates a new \phpbb\request\request -* instance on every call. By passing false this per-call instantiation can be restored -* after having passed in a \phpbb\request\request_interface instance. -* -* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the -* the same as that of $default. If the variable is not set $default is returned. -*/ -function request_var($var_name, $default, $multibyte = false, $cookie = false, $request = null) -{ - // This is all just an ugly hack to add "Dependency Injection" to a function - // the only real code is the function call which maps this function to a method. - static $static_request = null; - - if ($request instanceof \phpbb\request\request_interface) - { - $static_request = $request; - - if (empty($var_name)) - { - return; - } - } - else if ($request === false) - { - $static_request = null; - - if (empty($var_name)) - { - return; - } - } - - $tmp_request = $static_request; - - // no request class set, create a temporary one ourselves to keep backwards compatability - if ($tmp_request === null) - { - // false param: enable super globals, so the created request class does not - // make super globals inaccessible everywhere outside this function. - $tmp_request = new \phpbb\request\request(new \phpbb\request\type_cast_helper(), false); - } - - return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST); -} - -/** -* Sets a configuration option's value. -* -* Please note that this function does not update the is_dynamic value for -* an already existing config option. -* -* @param string $config_name The configuration option's name -* @param string $config_value New configuration value -* @param bool $is_dynamic Whether this variable should be cached (false) or -* if it changes too frequently (true) to be -* efficiently cached. +* Load the autoloaders added by the extensions. * -* @return null -* -* @deprecated +* @param string $phpbb_root_path Path to the phpbb root directory. */ -function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null) +function phpbb_load_extensions_autoloaders($phpbb_root_path) { - static $config = null; + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $phpbb_root_path . 'ext/', + \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(2); - if ($set_config !== null) + foreach ($iterator as $file_info) { - $config = $set_config; - - if (empty($config_name)) + if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2) { - return; + $filename = $file_info->getRealPath() . '/autoload.php'; + if (file_exists($filename)) + { + require $filename; + } } } - - $config->set($config_name, $config_value, !$is_dynamic); } /** -* Increments an integer config value directly in the database. -* -* @param string $config_name The configuration option's name -* @param int $increment Amount to increment by -* @param bool $is_dynamic Whether this variable should be cached (false) or -* if it changes too frequently (true) to be -* efficiently cached. -* -* @return null +* Casts a variable to the given type. * * @deprecated */ -function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null) +function set_var(&$result, $var, $type, $multibyte = false) { - static $config = null; - - if ($set_config !== null) - { - $config = $set_config; - - if (empty($config_name)) - { - return; - } - } - - $config->increment($config_name, $increment, !$is_dynamic); + // no need for dependency injection here, if you have the object, call the method yourself! + $type_cast_helper = new \phpbb\request\type_cast_helper(); + $type_cast_helper->set_var($result, $var, $type, $multibyte); } /** @@ -200,8 +106,8 @@ function unique_id($extra = 'c') if ($dss_seeded !== true && ($config['rand_seed_last_update'] < time() - rand(1,10))) { - set_config('rand_seed_last_update', time(), true); - set_config('rand_seed', $config['rand_seed'], true); + $config->set('rand_seed_last_update', time(), false); + $config->set('rand_seed', $config['rand_seed'], false); $dss_seeded = true; } @@ -254,7 +160,6 @@ function phpbb_gmgetdate($time = false) * @param array $allowed_units only allow these units (data array indexes) * * @return mixed data array if $string_only is false -* @author bantu */ function get_formatted_filesize($value, $string_only = true, $allowed_units = false) { @@ -342,8 +247,7 @@ function still_on_time($extra_time = 15) { static $max_execution_time, $start_time; - $time = explode(' ', microtime()); - $current_time = $time[0] + $time[1]; + $current_time = microtime(true); if (empty($max_execution_time)) { @@ -368,41 +272,6 @@ function still_on_time($extra_time = 15) } /** -* Hash the password -* -* @deprecated 3.1.0-a2 (To be removed: 3.3.0) -* -* @param string $password Password to be hashed -* -* @return string|bool Password hash or false if something went wrong during hashing -*/ -function phpbb_hash($password) -{ - global $phpbb_container; - - $passwords_manager = $phpbb_container->get('passwords.manager'); - return $passwords_manager->hash($password); -} - -/** -* Check for correct password -* -* @deprecated 3.1.0-a2 (To be removed: 3.3.0) -* -* @param string $password The password in plain text -* @param string $hash The stored password hash -* -* @return bool Returns true if the password is correct, false if not. -*/ -function phpbb_check_hash($password, $hash) -{ - global $phpbb_container; - - $passwords_manager = $phpbb_container->get('passwords.manager'); - return $passwords_manager->check($password, $hash); -} - -/** * Hashes an email address to a big integer * * @param string $email Email address @@ -442,489 +311,6 @@ function phpbb_version_compare($version1, $version2, $operator = null) } } -/** -* Global function for chmodding directories and files for internal use -* -* This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. -* The function determines owner and group from common.php file and sets the same to the provided file. -* The function uses bit fields to build the permissions. -* The function sets the appropiate execute bit on directories. -* -* Supported constants representing bit fields are: -* -* CHMOD_ALL - all permissions (7) -* CHMOD_READ - read permission (4) -* CHMOD_WRITE - write permission (2) -* CHMOD_EXECUTE - execute permission (1) -* -* NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. -* -* @param string $filename The file/directory to be chmodded -* @param int $perms Permissions to set -* -* @return bool true on success, otherwise false -* @author faw, phpBB Group -*/ -function phpbb_chmod($filename, $perms = CHMOD_READ) -{ - static $_chmod_info; - - // Return if the file no longer exists. - if (!file_exists($filename)) - { - return false; - } - - // Determine some common vars - if (empty($_chmod_info)) - { - if (!function_exists('fileowner') || !function_exists('filegroup')) - { - // No need to further determine owner/group - it is unknown - $_chmod_info['process'] = false; - } - else - { - global $phpbb_root_path, $phpEx; - - // Determine owner/group of common.php file and the filename we want to change here - $common_php_owner = @fileowner($phpbb_root_path . 'common.' . $phpEx); - $common_php_group = @filegroup($phpbb_root_path . 'common.' . $phpEx); - - // And the owner and the groups PHP is running under. - $php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false; - $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; - - // If we are unable to get owner/group, then do not try to set them by guessing - if (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group) - { - $_chmod_info['process'] = false; - } - else - { - $_chmod_info = array( - 'process' => true, - 'common_owner' => $common_php_owner, - 'common_group' => $common_php_group, - 'php_uid' => $php_uid, - 'php_gids' => $php_gids, - ); - } - } - } - - if ($_chmod_info['process']) - { - $file_uid = @fileowner($filename); - $file_gid = @filegroup($filename); - - // Change owner - if (@chown($filename, $_chmod_info['common_owner'])) - { - clearstatcache(); - $file_uid = @fileowner($filename); - } - - // Change group - if (@chgrp($filename, $_chmod_info['common_group'])) - { - clearstatcache(); - $file_gid = @filegroup($filename); - } - - // If the file_uid/gid now match the one from common.php we can process further, else we are not able to change something - if ($file_uid != $_chmod_info['common_owner'] || $file_gid != $_chmod_info['common_group']) - { - $_chmod_info['process'] = false; - } - } - - // Still able to process? - if ($_chmod_info['process']) - { - if ($file_uid == $_chmod_info['php_uid']) - { - $php = 'owner'; - } - else if (in_array($file_gid, $_chmod_info['php_gids'])) - { - $php = 'group'; - } - else - { - // Since we are setting the everyone bit anyway, no need to do expensive operations - $_chmod_info['process'] = false; - } - } - - // We are not able to determine or change something - if (!$_chmod_info['process']) - { - $php = 'other'; - } - - // Owner always has read/write permission - $owner = CHMOD_READ | CHMOD_WRITE; - if (is_dir($filename)) - { - $owner |= CHMOD_EXECUTE; - - // Only add execute bit to the permission if the dir needs to be readable - if ($perms & CHMOD_READ) - { - $perms |= CHMOD_EXECUTE; - } - } - - switch ($php) - { - case 'owner': - $result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0)); - - clearstatcache(); - - if (is_readable($filename) && phpbb_is_writable($filename)) - { - break; - } - - case 'group': - $result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0)); - - clearstatcache(); - - if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || phpbb_is_writable($filename))) - { - break; - } - - case 'other': - $result = @chmod($filename, ($owner << 6) + ($perms << 3) + ($perms << 0)); - - clearstatcache(); - - if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || phpbb_is_writable($filename))) - { - break; - } - - default: - return false; - break; - } - - return $result; -} - -/** -* Test if a file/directory is writable -* -* This function calls the native is_writable() when not running under -* Windows and it is not disabled. -* -* @param string $file Path to perform write test on -* @return bool True when the path is writable, otherwise false. -*/ -function phpbb_is_writable($file) -{ - if (strtolower(substr(PHP_OS, 0, 3)) === 'win' || !function_exists('is_writable')) - { - if (file_exists($file)) - { - // Canonicalise path to absolute path - $file = phpbb_realpath($file); - - if (is_dir($file)) - { - // Test directory by creating a file inside the directory - $result = @tempnam($file, 'i_w'); - - if (is_string($result) && file_exists($result)) - { - unlink($result); - - // Ensure the file is actually in the directory (returned realpathed) - return (strpos($result, $file) === 0) ? true : false; - } - } - else - { - $handle = @fopen($file, 'r+'); - - if (is_resource($handle)) - { - fclose($handle); - return true; - } - } - } - else - { - // file does not exist test if we can write to the directory - $dir = dirname($file); - - if (file_exists($dir) && is_dir($dir) && phpbb_is_writable($dir)) - { - return true; - } - } - - return false; - } - else - { - return is_writable($file); - } -} - -/** -* Checks if a path ($path) is absolute or relative -* -* @param string $path Path to check absoluteness of -* @return boolean -*/ -function phpbb_is_absolute($path) -{ - return (isset($path[0]) && $path[0] == '/' || preg_match('#^[a-z]:[/\\\]#i', $path)) ? true : false; -} - -/** -* @author Chris Smith <chris@project-minerva.org> -* @copyright 2006 Project Minerva Team -* @param string $path The path which we should attempt to resolve. -* @return mixed -*/ -function phpbb_own_realpath($path) -{ - global $request; - - // Now to perform funky shizzle - - // Switch to use UNIX slashes - $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); - $path_prefix = ''; - - // Determine what sort of path we have - if (phpbb_is_absolute($path)) - { - $absolute = true; - - if ($path[0] == '/') - { - // Absolute path, *NIX style - $path_prefix = ''; - } - else - { - // Absolute path, Windows style - // Remove the drive letter and colon - $path_prefix = $path[0] . ':'; - $path = substr($path, 2); - } - } - else - { - // Relative Path - // Prepend the current working directory - if (function_exists('getcwd')) - { - // This is the best method, hopefully it is enabled! - $path = str_replace(DIRECTORY_SEPARATOR, '/', getcwd()) . '/' . $path; - $absolute = true; - if (preg_match('#^[a-z]:#i', $path)) - { - $path_prefix = $path[0] . ':'; - $path = substr($path, 2); - } - else - { - $path_prefix = ''; - } - } - else if ($request->server('SCRIPT_FILENAME')) - { - // Warning: If chdir() has been used this will lie! - // Warning: This has some problems sometime (CLI can create them easily) - $filename = htmlspecialchars_decode($request->server('SCRIPT_FILENAME')); - $path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($filename)) . '/' . $path; - $absolute = true; - $path_prefix = ''; - } - else - { - // We have no way of getting the absolute path, just run on using relative ones. - $absolute = false; - $path_prefix = '.'; - } - } - - // Remove any repeated slashes - $path = preg_replace('#/{2,}#', '/', $path); - - // Remove the slashes from the start and end of the path - $path = trim($path, '/'); - - // Break the string into little bits for us to nibble on - $bits = explode('/', $path); - - // Remove any . in the path, renumber array for the loop below - $bits = array_values(array_diff($bits, array('.'))); - - // Lets get looping, run over and resolve any .. (up directory) - for ($i = 0, $max = sizeof($bits); $i < $max; $i++) - { - // @todo Optimise - if ($bits[$i] == '..' ) - { - if (isset($bits[$i - 1])) - { - if ($bits[$i - 1] != '..') - { - // We found a .. and we are able to traverse upwards, lets do it! - unset($bits[$i]); - unset($bits[$i - 1]); - $i -= 2; - $max -= 2; - $bits = array_values($bits); - } - } - else if ($absolute) // ie. !isset($bits[$i - 1]) && $absolute - { - // We have an absolute path trying to descend above the root of the filesystem - // ... Error! - return false; - } - } - } - - // Prepend the path prefix - array_unshift($bits, $path_prefix); - - $resolved = ''; - - $max = sizeof($bits) - 1; - - // Check if we are able to resolve symlinks, Windows cannot. - $symlink_resolve = (function_exists('readlink')) ? true : false; - - foreach ($bits as $i => $bit) - { - if (@is_dir("$resolved/$bit") || ($i == $max && @is_file("$resolved/$bit"))) - { - // Path Exists - if ($symlink_resolve && is_link("$resolved/$bit") && ($link = readlink("$resolved/$bit"))) - { - // Resolved a symlink. - $resolved = $link . (($i == $max) ? '' : '/'); - continue; - } - } - else - { - // Something doesn't exist here! - // This is correct realpath() behaviour but sadly open_basedir and safe_mode make this problematic - // return false; - } - $resolved .= $bit . (($i == $max) ? '' : '/'); - } - - // @todo If the file exists fine and open_basedir only has one path we should be able to prepend it - // because we must be inside that basedir, the question is where... - // @internal The slash in is_dir() gets around an open_basedir restriction - if (!@file_exists($resolved) || (!@is_dir($resolved . '/') && !is_file($resolved))) - { - return false; - } - - // Put the slashes back to the native operating systems slashes - $resolved = str_replace('/', DIRECTORY_SEPARATOR, $resolved); - - // Check for DIRECTORY_SEPARATOR at the end (and remove it!) - if (substr($resolved, -1) == DIRECTORY_SEPARATOR) - { - return substr($resolved, 0, -1); - } - - return $resolved; // We got here, in the end! -} - -if (!function_exists('realpath')) -{ - /** - * A wrapper for realpath - * @ignore - */ - function phpbb_realpath($path) - { - return phpbb_own_realpath($path); - } -} -else -{ - /** - * A wrapper for realpath - */ - function phpbb_realpath($path) - { - $realpath = realpath($path); - - // Strangely there are provider not disabling realpath but returning strange values. :o - // We at least try to cope with them. - if ($realpath === $path || $realpath === false) - { - return phpbb_own_realpath($path); - } - - // Check for DIRECTORY_SEPARATOR at the end (and remove it!) - if (substr($realpath, -1) == DIRECTORY_SEPARATOR) - { - $realpath = substr($realpath, 0, -1); - } - - return $realpath; - } -} - -/** -* Eliminates useless . and .. components from specified path. -* -* Deprecated, use filesystem class instead -* -* @param string $path Path to clean -* @return string Cleaned path -* -* @deprecated -*/ -function phpbb_clean_path($path) -{ - global $phpbb_path_helper, $phpbb_container; - - if (!$phpbb_path_helper && $phpbb_container) - { - $phpbb_path_helper = $phpbb_container->get('path_helper'); - } - else if (!$phpbb_path_helper) - { - // The container is not yet loaded, use a new instance - if (!class_exists('\phpbb\path_helper')) - { - global $phpbb_root_path, $phpEx; - require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); - } - - $phpbb_path_helper = new phpbb\path_helper( - new phpbb\symfony_request( - new phpbb\request\request() - ), - new phpbb\filesystem(), - $phpbb_root_path, - $phpEx - ); - } - - return $phpbb_path_helper->clean_path($path); -} - // functions used for building option fields /** @@ -979,14 +365,20 @@ function style_select($default = '', $all = false) * Format the timezone offset with hours and minutes * * @param int $tz_offset Timezone offset in seconds +* @param bool $show_null Whether null offsets should be shown * @return string Normalized offset string: -7200 => -02:00 * 16200 => +04:30 */ -function phpbb_format_timezone_offset($tz_offset) +function phpbb_format_timezone_offset($tz_offset, $show_null = false) { $sign = ($tz_offset < 0) ? '-' : '+'; $time_offset = abs($tz_offset); + if ($time_offset == 0 && $show_null == false) + { + return ''; + } + $offset_seconds = $time_offset % 3600; $offset_minutes = $offset_seconds / 60; $offset_hours = ($time_offset - $offset_seconds) / 3600; @@ -1071,7 +463,7 @@ function phpbb_get_timezone_identifiers($selected_timezone) $validate_timezone = new DateTimeZone($selected_timezone); $timezones[] = $selected_timezone; } - catch (Exception $e) + catch (\Exception $e) { } } @@ -1080,33 +472,16 @@ function phpbb_get_timezone_identifiers($selected_timezone) } /** -* Pick a timezone -* -* @param string $default A timezone to select -* @param boolean $truncate Shall we truncate the options text -* -* @return string Returns the options for timezone selector only -* -* @deprecated -*/ -function tz_select($default = '', $truncate = false) -{ - global $user; - - $timezone_select = phpbb_timezone_select($user, $default, $truncate); - return $timezone_select['tz_select']; -} - -/** * Options to pick a timezone and date/time * +* @param \phpbb\template\template $template phpBB template object * @param \phpbb\user $user Object of the current user * @param string $default A timezone to select * @param boolean $truncate Shall we truncate the options text * -* @return array Returns an array, also containing the options for the time selector. +* @return array Returns an array containing the options for the time selector. */ -function phpbb_timezone_select($user, $default = '', $truncate = false) +function phpbb_timezone_select($template, $user, $default = '', $truncate = false) { static $timezones; @@ -1119,18 +494,18 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) foreach ($unsorted_timezones as $timezone) { $tz = new DateTimeZone($timezone); - $dt = new \phpbb\datetime($user, 'now', $tz); + $dt = $user->create_datetime('now', $tz); $offset = $dt->getOffset(); $current_time = $dt->format($user->lang['DATETIME_FORMAT'], true); - $offset_string = phpbb_format_timezone_offset($offset); - $timezones['GMT' . $offset_string . ' - ' . $timezone] = array( + $offset_string = phpbb_format_timezone_offset($offset, true); + $timezones['UTC' . $offset_string . ' - ' . $timezone] = array( 'tz' => $timezone, - 'offest' => 'GMT' . $offset_string, + 'offset' => $offset_string, 'current' => $current_time, ); if ($timezone === $default) { - $default_offset = 'GMT' . $offset_string; + $default_offset = 'UTC' . $offset_string; } } unset($unsorted_timezones); @@ -1138,18 +513,27 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) uksort($timezones, 'phpbb_tz_select_compare'); } - $tz_select = $tz_dates = $opt_group = ''; + $tz_select = $opt_group = ''; - foreach ($timezones as $timezone) + foreach ($timezones as $key => $timezone) { - if ($opt_group != $timezone['offest']) + if ($opt_group != $timezone['offset']) { + // Generate tz_select for backwards compatibility $tz_select .= ($opt_group) ? '</optgroup>' : ''; - $tz_select .= '<optgroup label="' . $timezone['offest'] . ' - ' . $timezone['current'] . '">'; - $opt_group = $timezone['offest']; + $tz_select .= '<optgroup label="' . $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']) . '">'; + $opt_group = $timezone['offset']; + $template->assign_block_vars('timezone_select', array( + 'LABEL' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + 'VALUE' => $key . ' - ' . $timezone['current'], + )); - $selected = ($default_offset == $timezone['offest']) ? ' selected="selected"' : ''; - $tz_dates .= '<option value="' . $timezone['offest'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offest'] . ' - ' . $timezone['current'] . '</option>'; + $selected = (!empty($default_offset) && strpos($key, $default_offset) !== false) ? ' selected="selected"' : ''; + $template->assign_block_vars('timezone_date', array( + 'VALUE' => $key . ' - ' . $timezone['current'], + 'SELECTED' => !empty($selected), + 'TITLE' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + )); } $label = $timezone['tz']; @@ -1157,22 +541,26 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) { $label = $user->lang['timezones'][$label]; } - $title = $timezone['offest'] . ' - ' . $label; + $title = $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $label); if ($truncate) { $label = truncate_string($label, 50, 255, false, '...'); } + // Also generate timezone_select for backwards compatibility $selected = ($timezone['tz'] === $default) ? ' selected="selected"' : ''; $tz_select .= '<option title="' . $title . '" value="' . $timezone['tz'] . '"' . $selected . '>' . $label . '</option>'; + $template->assign_block_vars('timezone_select.timezone_options', array( + 'TITLE' => $title, + 'VALUE' => $timezone['tz'], + 'SELECTED' => !empty($selected), + 'LABEL' => $label, + )); } $tz_select .= '</optgroup>'; - return array( - 'tz_select' => $tz_select, - 'tz_dates' => $tz_dates, - ); + return $tz_select; } // Functions handling topic/post tracking/marking @@ -1190,26 +578,59 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0) { global $db, $user, $config; - global $request, $phpbb_container; + global $request, $phpbb_container, $phpbb_dispatcher; $post_time = ($post_time === 0 || $post_time > time()) ? time() : (int) $post_time; + $should_markread = true; + + /** + * This event is used for performing actions directly before marking forums, + * topics or posts as read. + * + * It is also possible to prevent the marking. For that, the $should_markread parameter + * should be set to FALSE. + * + * @event core.markread_before + * @var string mode Variable containing marking mode value + * @var mixed forum_id Variable containing forum id, or false + * @var mixed topic_id Variable containing topic id, or false + * @var int post_time Variable containing post time + * @var int user_id Variable containing the user id + * @var bool should_markread Flag indicating if the markread should be done or not. + * @since 3.1.4-RC1 + */ + $vars = array( + 'mode', + 'forum_id', + 'topic_id', + 'post_time', + 'user_id', + 'should_markread', + ); + extract($phpbb_dispatcher->trigger_event('core.markread_before', compact($vars))); + + if (!$should_markread) + { + return; + } + if ($mode == 'all') { if ($forum_id === false || !sizeof($forum_id)) { // Mark all forums read (index page) - + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); // Mark all topic notifications read for this user - $phpbb_notifications->mark_notifications_read(array( - 'topic', - 'quote', - 'bookmark', - 'post', - 'approve_topic', - 'approve_post', + $phpbb_notifications->mark_notifications(array( + 'notification.type.topic', + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_topic', + 'notification.type.approve_post', ), false, $user->data['user_id'], $post_time); if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -1265,12 +686,17 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ { $forum_id = array($forum_id); } + else + { + $forum_id = array_unique($forum_id); + } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->mark_notifications_read_by_parent(array( - 'topic', - 'approve_topic', + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.topic', + 'notification.type.approve_topic', ), $forum_id, $user->data['user_id'], $post_time); // Mark all post/quote notifications read for this user in this forum @@ -1285,11 +711,11 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $db->sql_freeresult($result); - $phpbb_notifications->mark_notifications_read_by_parent(array( - 'quote', - 'bookmark', - 'post', - 'approve_post', + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_post', ), $topic_ids, $user->data['user_id'], $post_time); // Add 0 to forums array to mark global announcements correctly @@ -1388,19 +814,20 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ return; } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); // Mark post notifications read for this user in this topic - $phpbb_notifications->mark_notifications_read(array( - 'topic', - 'approve_topic', + $phpbb_notifications->mark_notifications(array( + 'notification.type.topic', + 'notification.type.approve_topic', ), $topic_id, $user->data['user_id'], $post_time); - $phpbb_notifications->mark_notifications_read_by_parent(array( - 'quote', - 'bookmark', - 'post', - 'approve_post', + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_post', ), $topic_id, $user->data['user_id'], $post_time); if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -1528,7 +955,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ */ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $global_announce_list = false) { - global $config, $user; + global $user; $last_read = array(); @@ -1687,7 +1114,8 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis */ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0) { - global $config, $db, $user; + global $config, $db, $user, $request; + global $phpbb_dispatcher; $user_id = ($user_id === false) ? (int) $user->data['user_id'] : (int) $user_id; @@ -1696,7 +1124,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s if (empty($sql_sort)) { - $sql_sort = 'ORDER BY t.topic_last_post_time DESC'; + $sql_sort = 'ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC'; } if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -1731,6 +1159,24 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s $sql_sort", ); + /** + * Change SQL query for fetching unread topics data + * + * @event core.get_unread_topics_modify_sql + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, LEFT_JOIN, WHERE + * @var int last_mark User's last_mark time + * @var string sql_extra Extra WHERE SQL statement + * @var string sql_sort ORDER BY SQL sorting statement + * @since 3.1.4-RC1 + */ + $vars = array( + 'sql_array', + 'last_mark', + 'sql_extra', + 'sql_sort', + ); + extract($phpbb_dispatcher->trigger_event('core.get_unread_topics_modify_sql', compact($vars))); + $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset); @@ -1747,7 +1193,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s if (empty($tracking_topics)) { - $tracking_topics = request_var($config['cookie_name'] . '_track', '', false, true); + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', false, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } @@ -1814,7 +1260,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s */ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false) { - global $db, $tracking_topics, $user, $config, $auth, $request, $phpbb_container; + global $db, $tracking_topics, $user, $config, $request, $phpbb_container; // Determine the users last forum mark time if not given. if ($mark_time_forum === false) @@ -1839,6 +1285,7 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti // Handle update of unapproved topics info. // Only update for moderators having m_approve permission for the forum. + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // Check the forum for any left unread topics. @@ -1871,8 +1318,6 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti else if ($config['load_anon_lastread'] || $user->data['is_registered']) { // Get information from cookie - $row = false; - if (!isset($tracking_topics['tf'][$forum_id])) { // We do not need to mark read, this happened before. Therefore setting this to true @@ -2049,6 +1494,9 @@ function tracking_unserialize($string, $max_depth = 3) * @param mixed $params String or array of additional url parameters * @param bool $is_amp Is url using & (true) or & (false) * @param string $session_id Possibility to use a custom session id instead of the global one +* @param bool $is_route Is url generated by a route. +* +* @return string The corrected url. * * Examples: * <code> @@ -2059,7 +1507,7 @@ function tracking_unserialize($string, $max_depth = 3) * </code> * */ -function append_sid($url, $params = false, $is_amp = true, $session_id = false) +function append_sid($url, $params = false, $is_amp = true, $session_id = false, $is_route = false) { global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper; global $phpbb_dispatcher; @@ -2071,7 +1519,7 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) } // Update the root path with the correct relative web path - if ($phpbb_path_helper instanceof \phpbb\path_helper) + if (!$is_route && $phpbb_path_helper instanceof \phpbb\path_helper) { $url = $phpbb_path_helper->update_web_root_path($url); } @@ -2097,9 +1545,10 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) * the global one (false) * @var bool|string append_sid_overwrite Overwrite function (string * URL) or not (false) - * @since 3.1-A1 + * @var bool is_route Is url generated by a route. + * @since 3.1.0-a1 */ - $vars = array('url', 'params', 'is_amp', 'session_id', 'append_sid_overwrite'); + $vars = array('url', 'params', 'is_amp', 'session_id', 'append_sid_overwrite', 'is_route'); extract($phpbb_dispatcher->trigger_event('core.append_sid', compact($vars))); if ($append_sid_overwrite) @@ -2268,20 +1717,13 @@ function generate_board_url($without_script_path = false) */ function redirect($url, $return = false, $disable_cd_check = false) { - global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem, $phpbb_path_helper, $phpEx; - - $failover_flag = false; + global $user, $phpbb_path_helper, $phpbb_dispatcher; - if (empty($user->lang)) + if (!$user->is_setup()) { $user->add_lang('common'); } - if (!$return) - { - garbage_collection(); - } - // Make sure no &'s are in, this will break the redirect $url = str_replace('&', '&', $url); @@ -2298,7 +1740,7 @@ function redirect($url, $return = false, $disable_cd_check = false) // Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work) if (!$disable_cd_check && $url_parts['host'] !== $user->host) { - $url = generate_board_url(); + trigger_error('INSECURE_REDIRECT', E_USER_ERROR); } } else if ($url[0] == '/') @@ -2336,7 +1778,7 @@ function redirect($url, $return = false, $disable_cd_check = false) // Clean URL and check if we go outside the forum directory $url = $phpbb_path_helper->clean_url($url); - if (!$disable_cd_check && strpos($url, generate_board_url(true)) === false) + if (!$disable_cd_check && strpos($url, generate_board_url(true) . '/') !== 0) { trigger_error('INSECURE_REDIRECT', E_USER_ERROR); } @@ -2356,13 +1798,29 @@ function redirect($url, $return = false, $disable_cd_check = false) trigger_error('INSECURE_REDIRECT', E_USER_ERROR); } + /** + * Execute code and/or overwrite redirect() + * + * @event core.functions.redirect + * @var string url The url + * @var bool return If true, do not redirect but return the sanitized URL. + * @var bool disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. + * @since 3.1.0-RC3 + */ + $vars = array('url', 'return', 'disable_cd_check'); + extract($phpbb_dispatcher->trigger_event('core.functions.redirect', compact($vars))); + if ($return) { return $url; } + else + { + garbage_collection(); + } // Redirect via an HTML form for PITA webservers - if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE'))) + if (@preg_match('#WebSTAR|Xitami#', getenv('SERVER_SOFTWARE'))) { header('Refresh: 0; URL=' . $url); @@ -2419,79 +1877,23 @@ function reapply_sid($url) */ function build_url($strip_vars = false) { - global $user, $phpbb_root_path; - - $page = $user->page['page']; - - // We need to be cautious here. - // On some situations, the redirect path is an absolute URL, sometimes a relative path - // For a relative path, let's prefix it with $phpbb_root_path to point to the correct location, - // else we use the URL directly. - $url_parts = parse_url($page); + global $config, $user, $phpbb_path_helper; - // URL - if ($url_parts === false || empty($url_parts['scheme']) || empty($url_parts['host'])) - { - $page = $phpbb_root_path . $page; - } + $page = $phpbb_path_helper->get_valid_page($user->page['page'], $config['enable_mod_rewrite']); // Append SID $redirect = append_sid($page, false, false); - // Add delimiter if not there... - if (strpos($redirect, '?') === false) + if ($strip_vars !== false) { - $redirect .= '?'; + $redirect = $phpbb_path_helper->strip_url_params($redirect, $strip_vars, false); } - - // Strip vars... - if ($strip_vars !== false && strpos($redirect, '?') !== false) + else { - if (!is_array($strip_vars)) - { - $strip_vars = array($strip_vars); - } - - $query = $_query = array(); - - $args = substr($redirect, strpos($redirect, '?') + 1); - $args = ($args) ? explode('&', $args) : array(); - $redirect = substr($redirect, 0, strpos($redirect, '?')); - - foreach ($args as $argument) - { - $arguments = explode('=', $argument); - $key = $arguments[0]; - unset($arguments[0]); - - if ($key === '') - { - continue; - } - - $query[$key] = implode('=', $arguments); - } - - // Strip the vars off - foreach ($strip_vars as $strip) - { - if (isset($query[$strip])) - { - unset($query[$strip]); - } - } - - // Glue the remaining parts together... already urlencoded - foreach ($query as $key => $value) - { - $_query[] = $key . '=' . $value; - } - $query = implode('&', $_query); - - $redirect .= ($query) ? '?' . $query : ''; + $redirect = str_replace('&', '&', $redirect); } - return str_replace('&', '&', $redirect); + return $redirect . ((strpos($redirect, '?') === false) ? '?' : ''); } /** @@ -2506,19 +1908,19 @@ function meta_refresh($time, $url, $disable_cd_check = false) { global $template, $refresh_data, $request; + $url = redirect($url, true, $disable_cd_check); if ($request->is_ajax()) { $refresh_data = array( 'time' => $time, - 'url' => str_replace('&', '&', $url) + 'url' => $url, ); } else { - $url = redirect($url, true, $disable_cd_check); + // For XHTML compatibility we change back & to & $url = str_replace('&', '&', $url); - // For XHTML compatibility we change back & to & $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="' . $time . '; url=' . $url . '" />') ); @@ -2573,13 +1975,19 @@ function phpbb_request_http_version() { global $request; + $version = ''; if ($request && $request->server('SERVER_PROTOCOL')) { - return $request->server('SERVER_PROTOCOL'); + $version = $request->server('SERVER_PROTOCOL'); } else if (isset($_SERVER['SERVER_PROTOCOL'])) { - return $_SERVER['SERVER_PROTOCOL']; + $version = $_SERVER['SERVER_PROTOCOL']; + } + + if (!empty($version) && is_string($version) && preg_match('#^HTTP/[0-9]\.[0-9]$#', $version)) + { + return $version; } return 'HTTP/1.0'; @@ -2624,7 +2032,7 @@ function check_link_hash($token, $link_name) */ function add_form_key($form_name) { - global $config, $template, $user; + global $config, $template, $user, $phpbb_dispatcher; $now = time(); $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : ''; @@ -2635,21 +2043,44 @@ function add_form_key($form_name) 'form_token' => $token, )); + /** + * Perform additional actions on creation of the form token + * + * @event core.add_form_key + * @var string form_name The form name + * @var int now Current time timestamp + * @var string s_fields Generated hidden fields + * @var string token Form token + * @var string token_sid User session ID + * + * @since 3.1.0-RC3 + */ + $vars = array( + 'form_name', + 'now', + 's_fields', + 'token', + 'token_sid', + ); + extract($phpbb_dispatcher->trigger_event('core.add_form_key', compact($vars))); + $template->assign_vars(array( 'S_FORM_TOKEN' => $s_fields, )); } /** -* Check the form key. Required for all altering actions not secured by confirm_box -* @param string $form_name The name of the form; has to match the name used in add_form_key, otherwise no restrictions apply -* @param int $timespan The maximum acceptable age for a submitted form in seconds. Defaults to the config setting. -* @param string $return_page The address for the return link -* @param bool $trigger If true, the function will triger an error when encountering an invalid form -*/ -function check_form_key($form_name, $timespan = false, $return_page = '', $trigger = false) + * Check the form key. Required for all altering actions not secured by confirm_box + * + * @param string $form_name The name of the form; has to match the name used + * in add_form_key, otherwise no restrictions apply + * @param int $timespan The maximum acceptable age for a submitted form + * in seconds. Defaults to the config setting. + * @return bool True, if the form key was valid, false otherwise + */ +function check_form_key($form_name, $timespan = false) { - global $config, $user; + global $config, $request, $user; if ($timespan === false) { @@ -2657,10 +2088,10 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg $timespan = ($config['form_token_lifetime'] == -1) ? -1 : max(30, $config['form_token_lifetime']); } - if (isset($_POST['creation_time']) && isset($_POST['form_token'])) + if ($request->is_set_post('creation_time') && $request->is_set_post('form_token')) { - $creation_time = abs(request_var('creation_time', 0)); - $token = request_var('form_token', ''); + $creation_time = abs($request->variable('creation_time', 0)); + $token = $request->variable('form_token', ''); $diff = time() - $creation_time; @@ -2677,11 +2108,6 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg } } - if ($trigger) - { - trigger_error($user->lang['FORM_INVALID'] . $return_page); - } - return false; } @@ -2701,7 +2127,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 = '') { global $user, $template, $db, $request; - global $phpEx, $phpbb_root_path, $request; + global $config, $phpbb_path_helper; if (isset($_POST['cancel'])) { @@ -2712,9 +2138,9 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo if ($check && $confirm) { - $user_id = request_var('confirm_uid', 0); - $session_id = request_var('sess', ''); - $confirm_key = request_var('confirm_key', ''); + $user_id = $request->variable('confirm_uid', 0); + $session_id = $request->variable('sess', ''); + $confirm_key = $request->variable('confirm_key', ''); if ($user_id != $user->data['user_id'] || $session_id != $user->session_id || !$confirm_key || !$user->data['user_last_confirm_key'] || $confirm_key != $user->data['user_last_confirm_key']) { @@ -2748,7 +2174,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo } else { - page_header(((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]), false); + page_header((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]); } $template->set_filenames(array( @@ -2756,15 +2182,15 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo ); // If activation key already exist, we better do not re-use the key (something very strange is going on...) - if (request_var('confirm_key', '')) + if ($request->variable('confirm_key', '')) { // This should not occur, therefore we cancel the operation to safe the user return false; } // re-add sid / transform & to & for user->page (user->page is always using &) - $use_page = ($u_action) ? $phpbb_root_path . $u_action : $phpbb_root_path . str_replace('&', '&', $user->page['page']); - $u_action = reapply_sid($use_page); + $use_page = ($u_action) ? $u_action : str_replace('&', '&', $user->page['page']); + $u_action = reapply_sid($phpbb_path_helper->get_valid_page($use_page, $config['enable_mod_rewrite'])); $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; $template->assign_vars(array( @@ -2781,7 +2207,6 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo WHERE user_id = " . $user->data['user_id']; $db->sql_query($sql); - if ($request->is_ajax()) { $u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id; @@ -2812,18 +2237,13 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo */ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) { - global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config; - global $request, $phpbb_container; - - if (!class_exists('phpbb_captcha_factory', false)) - { - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - } + global $user, $template, $auth, $phpEx, $phpbb_root_path, $config; + global $request, $phpbb_container, $phpbb_dispatcher, $phpbb_log; $err = ''; // Make sure user->setup() has been called - if (empty($user->lang)) + if (!$user->is_setup()) { $user->setup(); } @@ -2835,7 +2255,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions if ($user->data['is_registered']) { - add_log('admin', 'LOG_ADMIN_AUTH_FAIL'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); } trigger_error('NO_AUTH_ADMIN'); } @@ -2845,13 +2265,13 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // Get credential if ($admin) { - $credential = request_var('credential', ''); + $credential = $request->variable('credential', ''); if (strspn($credential, 'abcdef0123456789') !== strlen($credential) || strlen($credential) != 32) { if ($user->data['is_registered']) { - add_log('admin', 'LOG_ADMIN_AUTH_FAIL'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); } trigger_error('NO_AUTH_ADMIN'); } @@ -2863,7 +2283,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $password = $request->untrimmed_variable('password', '', true); } - $username = request_var('username', '', true); + $username = $request->variable('username', '', true); $autologin = $request->is_set_post('autologin'); $viewonline = (int) !$request->is_set_post('viewonline'); $admin = ($admin) ? 1 : 0; @@ -2873,7 +2293,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa if ($admin && utf8_clean_string($username) != utf8_clean_string($user->data['username'])) { // We log the attempt to use a different username... - add_log('admin', 'LOG_ADMIN_AUTH_FAIL'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); trigger_error('NO_AUTH_ADMIN_USER_DIFFER'); } @@ -2886,7 +2306,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { if ($result['status'] == LOGIN_SUCCESS) { - add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_SUCCESS'); } else { @@ -2894,7 +2314,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions if ($user->data['is_registered']) { - add_log('admin', 'LOG_ADMIN_AUTH_FAIL'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); } } } @@ -2902,9 +2322,19 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // The result parameter is always an array, holding the relevant information... if ($result['status'] == LOGIN_SUCCESS) { - $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx"); - $message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT']; - $l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']); + $redirect = $request->variable('redirect', "{$phpbb_root_path}index.$phpEx"); + + /** + * This event allows an extension to modify the redirection when a user successfully logs in + * + * @event core.login_box_redirect + * @var string redirect Redirect string + * @var boolean admin Is admin? + * @var bool return If true, do not redirect but return the sanitized URL. + * @since 3.1.0-RC5 + */ + $vars = array('redirect', 'admin', 'return'); + extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars))); // append/replace SID (may change during the session for AOL users) $redirect = reapply_sid($redirect); @@ -2927,28 +2357,26 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // Special cases... determine switch ($result['status']) { + case LOGIN_ERROR_PASSWORD_CONVERT: + $err = sprintf( + $user->lang[$result['error_msg']], + ($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '', + ($config['email_enable']) ? '</a>' : '', + '<a href="' . phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx) . '">', + '</a>' + ); + break; + case LOGIN_ERROR_ATTEMPTS: - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); // $captcha->reset(); $template->assign_vars(array( 'CAPTCHA_TEMPLATE' => $captcha->get_template(), )); - - $err = $user->lang[$result['error_msg']]; - break; - - case LOGIN_ERROR_PASSWORD_CONVERT: - $err = sprintf( - $user->lang[$result['error_msg']], - ($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '', - ($config['email_enable']) ? '</a>' : '', - ($config['board_contact']) ? '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">' : '', - ($config['board_contact']) ? '</a>' : '' - ); - break; + // no break; // Username, password, etc... default: @@ -2957,11 +2385,24 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa // Assign admin contact to some error messages if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD') { - $err = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'); + $err = sprintf($user->lang[$result['error_msg']], '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') . '">', '</a>'); } break; } + + /** + * This event allows an extension to process when a user fails a login attempt + * + * @event core.login_box_failed + * @var array result Login result data + * @var string username User name used to login + * @var string password Password used to login + * @var string err Error message + * @since 3.1.3-RC1 + */ + $vars = array('result', 'username', 'password', 'err'); + extract($phpbb_dispatcher->trigger_event('core.login_box_failed', compact($vars))); } // Assign credential for username/password pair @@ -2981,7 +2422,9 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $s_hidden_fields['credential'] = $credential; } - $auth_provider = $phpbb_container->get('auth.provider.' . $config['auth_method']); + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider(); $auth_provider_data = $auth_provider->get_login_data(); if ($auth_provider_data) @@ -3025,7 +2468,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'PASSWORD_CREDENTIAL' => ($admin) ? 'password_' . $credential : 'password', )); - page_header($user->lang['LOGIN'], false); + page_header($user->lang['LOGIN']); $template->set_filenames(array( 'body' => 'login_body.html') @@ -3040,7 +2483,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa */ function login_forum_box($forum_data) { - global $db, $phpbb_container, $request, $template, $user; + global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher; $password = $request->variable('password', '', true); @@ -3083,6 +2526,7 @@ function login_forum_box($forum_data) } $db->sql_freeresult($result); + /* @var $passwords_manager \phpbb\passwords\manager */ $passwords_manager = $phpbb_container->get('passwords.manager'); if ($passwords_manager->check($password, $forum_data['forum_password'])) @@ -3101,7 +2545,18 @@ function login_forum_box($forum_data) $template->assign_var('LOGIN_ERROR', $user->lang['WRONG_PASSWORD']); } - page_header($user->lang['LOGIN'], false); + /** + * Performing additional actions, load additional data on forum login + * + * @event core.login_forum_box + * @var array forum_data Array with forum data + * @var string password Password entered + * @since 3.1.0-RC3 + */ + $vars = array('forum_data', 'password'); + extract($phpbb_dispatcher->trigger_event('core.login_forum_box', compact($vars))); + + page_header($user->lang['LOGIN']); $template->assign_vars(array( 'FORUM_NAME' => isset($forum_data['forum_name']) ? $forum_data['forum_name'] : '', @@ -3192,7 +2647,7 @@ function parse_cfg_file($filename, $lines = false) } // Determine first occurrence, since in values the equal sign is allowed - $key = strtolower(trim(substr($line, 0, $delim_pos))); + $key = htmlspecialchars(strtolower(trim(substr($line, 0, $delim_pos)))); $value = trim(substr($line, $delim_pos + 1)); if (in_array($value, array('off', 'false', '0'))) @@ -3209,7 +2664,11 @@ function parse_cfg_file($filename, $lines = false) } else if (($value[0] == "'" && $value[sizeof($value) - 1] == "'") || ($value[0] == '"' && $value[sizeof($value) - 1] == '"')) { - $value = substr($value, 1, sizeof($value)-2); + $value = htmlspecialchars(substr($value, 1, sizeof($value)-2)); + } + else + { + $value = htmlspecialchars($value); } $parsed_items[$key] = $value; @@ -3224,52 +2683,6 @@ function parse_cfg_file($filename, $lines = false) } /** -* Add log entry -* -* @param string $mode The mode defines which log_type is used and from which log the entry is retrieved -* @param int $forum_id Mode 'mod' ONLY: forum id of the related item, NOT INCLUDED otherwise -* @param int $topic_id Mode 'mod' ONLY: topic id of the related item, NOT INCLUDED otherwise -* @param int $reportee_id Mode 'user' ONLY: user id of the reportee, NOT INCLUDED otherwise -* @param string $log_operation Name of the operation -* @param array $additional_data More arguments can be added, depending on the log_type -* -* @return int|bool Returns the log_id, if the entry was added to the database, false otherwise. -* -* @deprecated Use $phpbb_log->add() instead -*/ -function add_log() -{ - global $phpbb_log, $user; - - $args = func_get_args(); - $mode = array_shift($args); - - // This looks kind of dirty, but add_log has some additional data before the log_operation - $additional_data = array(); - switch ($mode) - { - case 'admin': - case 'critical': - break; - case 'mod': - $additional_data['forum_id'] = array_shift($args); - $additional_data['topic_id'] = array_shift($args); - break; - case 'user': - $additional_data['reportee_id'] = array_shift($args); - break; - } - - $log_operation = array_shift($args); - $additional_data = array_merge($additional_data, $args); - - $user_id = (empty($user->data)) ? ANONYMOUS : $user->data['user_id']; - $user_ip = (empty($user->ip)) ? '' : $user->ip; - - return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data); -} - -/** * Return a nicely formatted backtrace. * * Turns the array returned by debug_backtrace() into HTML markup. @@ -3325,14 +2738,14 @@ function get_preg_expression($mode) case 'email': // Regex written by James Watts and Francisco Jose Martin Moreno // http://fightingforalostcause.net/misc/2006/compare-email-regex.php - return '([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; + return '((?:[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+)@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; break; case 'bbcode_htm': return array( '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', '#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&|\?)sid=[0-9a-f]{32})?">.*?</a><!\-\- l \-\->#', - '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->#', + '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">(.*?)</a><!\-\- \1 \-\->#', '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '#<!\-\- .*? \-\->#s', '#<.*?>#s', @@ -3351,28 +2764,43 @@ function get_preg_expression($mode) break; case 'url': + // generated with regex_idn.php file in the develop folder + return "[a-z][a-z\d+\-.]*:/{2}(?:(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + break; + case 'url_inline': - $inline = ($mode == 'url') ? ')' : ''; - $scheme = ($mode == 'url') ? '[a-z\d+\-.]' : '[a-z\d+]'; // avoid automatic parsing of "word" in "last word.http://..." - // generated with regex generation file in the develop folder - return "[a-z]$scheme*:/{2}(?:(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + // generated with regex_idn.php file in the develop folder + return "[a-z][a-z\d+]*:/{2}(?:(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'www_url': + // generated with regex_idn.php file in the develop folder + return "www\.(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})+(?::\d*)?(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + break; + case 'www_url_inline': - $inline = ($mode == 'www_url') ? ')' : ''; - return "www\.(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})+(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + // generated with regex_idn.php file in the develop folder + return "www\.(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})+(?::\d*)?(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'relative_url': + // generated with regex_idn.php file in the develop folder + return "(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + break; + case 'relative_url_inline': - $inline = ($mode == 'relative_url') ? ')' : ''; - return "(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + // generated with regex_idn.php file in the develop folder + return "(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[^\p{C}\p{Z}\p{S}\p{P}\p{Nl}\p{No}\p{Me}\x{1100}-\x{115F}\x{A960}-\x{A97C}\x{1160}-\x{11A7}\x{D7B0}-\x{D7C6}\x{20D0}-\x{20FF}\x{1D100}-\x{1D1FF}\x{1D200}-\x{1D24F}\x{0640}\x{07FA}\x{302E}\x{302F}\x{3031}-\x{3035}\x{303B}]*[\x{00B7}\x{0375}\x{05F3}\x{05F4}\x{30FB}\x{002D}\x{06FD}\x{06FE}\x{0F0B}\x{3007}\x{00DF}\x{03C2}\x{200C}\x{200D}\pL0-9\-._~!$&'(*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'table_prefix': return '#^[a-zA-Z][a-zA-Z0-9_]*$#'; break; + + // Matches the predecing dot + case 'path_remove_dot_trailing_slash': + return '#^(?:(\.)?)+(?:(.+)?)+(?:([\\/\\\])$)#'; + break; } return ''; @@ -3383,31 +2811,19 @@ function get_preg_expression($mode) * Depends on whether installed PHP version supports unicode properties * * @param string $word word template to be replaced -* @param bool $use_unicode whether or not to take advantage of PCRE supporting unicode * * @return string $preg_expr regex to use with word censor */ -function get_censor_preg_expression($word, $use_unicode = true) +function get_censor_preg_expression($word) { // Unescape the asterisk to simplify further conversions $word = str_replace('\*', '*', preg_quote($word, '#')); - if ($use_unicode && phpbb_pcre_utf8_support()) - { - // Replace asterisk(s) inside the pattern, at the start and at the end of it with regexes - $word = preg_replace(array('#(?<=[\p{Nd}\p{L}_])\*+(?=[\p{Nd}\p{L}_])#iu', '#^\*+#', '#\*+$#'), array('([\x20]*?|[\p{Nd}\p{L}_-]*?)', '[\p{Nd}\p{L}_-]*?', '[\p{Nd}\p{L}_-]*?'), $word); - - // Generate the final substitution - $preg_expr = '#(?<![\p{Nd}\p{L}_-])(' . $word . ')(?![\p{Nd}\p{L}_-])#iu'; - } - else - { - // Replace the asterisk inside the pattern, at the start and at the end of it with regexes - $word = preg_replace(array('#(?<=\S)\*+(?=\S)#iu', '#^\*+#', '#\*+$#'), array('(\x20*?\S*?)', '\S*?', '\S*?'), $word); + // Replace asterisk(s) inside the pattern, at the start and at the end of it with regexes + $word = preg_replace(array('#(?<=[\p{Nd}\p{L}_])\*+(?=[\p{Nd}\p{L}_])#iu', '#^\*+#', '#\*+$#'), array('([\x20]*?|[\p{Nd}\p{L}_-]*?)', '[\p{Nd}\p{L}_-]*?', '[\p{Nd}\p{L}_-]*?'), $word); - // Generate the final substitution - $preg_expr = '#(?<!\S)(' . $word . ')(?!\S)#iu'; - } + // Generate the final substitution + $preg_expr = '#(?<![\p{Nd}\p{L}_-])(' . $word . ')(?![\p{Nd}\p{L}_-])#iu'; return $preg_expr; } @@ -3457,8 +2873,6 @@ function short_ipv6($ip, $length) * * @return mixed false if specified address is not valid, * string otherwise -* -* @author bantu */ function phpbb_ip_normalise($address) { @@ -3487,8 +2901,6 @@ function phpbb_ip_normalise($address) * * @return mixed false on failure, * string otherwise -* -* @author APTX */ function phpbb_inet_ntop($in_addr) { @@ -3558,8 +2970,6 @@ function phpbb_inet_ntop($in_addr) * * @return mixed false if address is invalid, * in_addr representation of the given address otherwise (string) -* -* @author APTX */ function phpbb_inet_pton($address) { @@ -3639,8 +3049,6 @@ function phpbb_inet_pton($address) * * Since null can also be returned, you probably want to compare the result * with === true or === false, -* -* @author bantu */ function phpbb_checkdnsrr($host, $type = 'MX') { @@ -3663,38 +3071,12 @@ function phpbb_checkdnsrr($host, $type = 'MX') return (@gethostbyname($host_fqdn) == $host_fqdn) ? false : true; } - // checkdnsrr() is available on Windows since PHP 5.3, - // but until 5.3.3 it only works for MX records - // See: http://bugs.php.net/bug.php?id=51844 - - // Call checkdnsrr() if - // we're looking for an MX record or - // we're not on Windows or - // we're running a PHP version where #51844 has been fixed - - // checkdnsrr() supports AAAA since 5.0.0 - // checkdnsrr() supports TXT since 5.2.4 - if ( - ($type == 'MX' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.3', '>=')) && - ($type != 'AAAA' || version_compare(PHP_VERSION, '5.0.0', '>=')) && - ($type != 'TXT' || version_compare(PHP_VERSION, '5.2.4', '>=')) && - function_exists('checkdnsrr') - ) + if (function_exists('checkdnsrr')) { return checkdnsrr($host_fqdn, $type); } - // dns_get_record() is available since PHP 5; since PHP 5.3 also on Windows, - // but on Windows it does not work reliable for AAAA records before PHP 5.3.1 - - // Call dns_get_record() if - // we're not looking for an AAAA record or - // we're not on Windows or - // we're running a PHP version where AAAA lookups work reliable - if ( - ($type != 'AAAA' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.1', '>=')) && - function_exists('dns_get_record') - ) + if (function_exists('dns_get_record')) { // dns_get_record() expects an integer as second parameter // We have to convert the string $type to the corresponding integer constant. @@ -3827,7 +3209,7 @@ function phpbb_checkdnsrr($host, $type = 'MX') function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user, $request; - global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text; + global $phpbb_root_path, $msg_title, $msg_long_text, $phpbb_log; // Do not display notices if we suppress them via @ if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE) @@ -3841,11 +3223,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $msg_text = $msg_long_text; } - if (!defined('E_DEPRECATED')) - { - define('E_DEPRECATED', 8192); - } - switch ($errno) { case E_NOTICE: @@ -3868,7 +3245,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // we are writing an image - the user won't see the debug, so let's place it in the log if (defined('IMAGE_OUTPUT') || defined('IN_CRON')) { - add_log('critical', 'LOG_IMAGE_GENERATION_ERROR', $errfile, $errline, $msg_text); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_IMAGE_GENERATION_ERROR', false, array($errfile, $errline, $msg_text)); } // echo '<br /><br />BACKTRACE<br />' . get_backtrace() . '<br />' . "\n"; } @@ -3879,7 +3256,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) case E_USER_ERROR: - if (!empty($user) && !empty($user->lang)) + if (!empty($user) && $user->is_setup()) { $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; $msg_title = (!isset($msg_title)) ? $user->lang['GENERAL_ERROR'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); @@ -3914,13 +3291,23 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if (defined('IN_INSTALL') || defined('DEBUG') || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; + + // If this is defined there already was some output + // So let's not break it + if (defined('IN_DB_UPDATE')) + { + echo '<div class="errorbox">' . $msg_text . '</div>'; + + $db->sql_return_on_error(true); + phpbb_end_update($cache, $config); + } } if ((defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) { // let's avoid loops $db->sql_return_on_error(true); - add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $log_text); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_GENERAL_ERROR', false, array($msg_title, $log_text)); $db->sql_return_on_error(false); } @@ -3964,7 +3351,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; - echo ' Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'; + echo ' Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited'; echo ' </div>'; echo '</div>'; echo '</body>'; @@ -3989,7 +3376,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // We re-init the auth array to get correct results on login/logout $auth->acl($user->data); - if (empty($user->lang)) + if (!$user->is_setup()) { $user->setup(); } @@ -4010,7 +3397,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } else { - page_header($msg_title, false); + page_header($msg_title); } } @@ -4078,11 +3465,21 @@ function msg_handler($errno, $msg_text, $errfile, $errline) */ function phpbb_filter_root_path($errfile) { + global $phpbb_filesystem; + static $root_path; if (empty($root_path)) { - $root_path = phpbb_realpath(dirname(__FILE__) . '/../'); + if ($phpbb_filesystem) + { + $root_path = $phpbb_filesystem->realpath(dirname(__FILE__) . '/../'); + } + else + { + $filesystem = new \phpbb\filesystem\filesystem(); + $root_path = $filesystem->realpath(dirname(__FILE__) . '/../'); + } } return str_replace(array($root_path, '\\'), array('[ROOT]', '/'), $errfile); @@ -4110,7 +3507,7 @@ function obtain_guest_count($item_id = 0, $item = 'forum') // Get number of online guests - if ($db->sql_layer === 'sqlite') + if ($db->get_sql_layer() === 'sqlite' || $db->get_sql_layer() === 'sqlite3') { $sql = 'SELECT COUNT(session_ip) as num_guests FROM ( @@ -4144,7 +3541,7 @@ function obtain_guest_count($item_id = 0, $item = 'forum') */ function obtain_users_online($item_id = 0, $item = 'forum') { - global $db, $config, $user; + global $db, $config; $reading_sql = ''; if ($item_id !== 0) @@ -4208,21 +3605,45 @@ function obtain_users_online($item_id = 0, $item = 'forum') */ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum') { - global $config, $db, $user, $auth; + global $config, $db, $user, $auth, $phpbb_dispatcher; - $user_online_link = $online_userlist = ''; + $user_online_link = $rowset = array(); // Need caps version of $item for language-strings $item_caps = strtoupper($item); if (sizeof($online_users['online_users'])) { - $sql = 'SELECT username, username_clean, user_id, user_type, user_allow_viewonline, user_colour - FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $online_users['online_users']) . ' - ORDER BY username_clean ASC'; - $result = $db->sql_query($sql); + $sql_ary = array( + 'SELECT' => 'u.username, u.username_clean, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour', + 'FROM' => array( + USERS_TABLE => 'u', + ), + 'WHERE' => $db->sql_in_set('u.user_id', $online_users['online_users']), + 'ORDER_BY' => 'u.username_clean ASC', + ); - while ($row = $db->sql_fetchrow($result)) + /** + * Modify SQL query to obtain online users data + * + * @event core.obtain_users_online_string_sql + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var string sql_ary SQL query to obtain users online data + * @since 3.1.4-RC1 + * @changed 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary. + */ + $vars = array('online_users', 'item_id', 'item', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + $rowset = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($rowset as $row) { // User is logged in and therefore not a guest if ($row['user_id'] != ANONYMOUS) @@ -4232,15 +3653,14 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' $row['username'] = '<em>' . $row['username'] . '</em>'; } - if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline')) + if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline') || $row['user_id'] === $user->data['user_id']) { - $user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); - $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link; + $user_online_link[$row['user_id']] = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); } } } - $db->sql_freeresult($result); } + $online_userlist = implode(', ', $user_online_link); if (!$online_userlist) { @@ -4273,6 +3693,33 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' $l_online_users = $user->lang('ONLINE_USERS_TOTAL', (int) $online_users['total_online'], $visible_online, $hidden_online); } + /** + * Modify online userlist data + * + * @event core.obtain_users_online_string_modify + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array rowset Array with online users data + * @var array user_online_link Array with online users items (usernames) + * @var string online_userlist String containing users online list + * @var string l_online_users String with total online users count info + * @since 3.1.4-RC1 + */ + $vars = array( + 'online_users', + 'item_id', + 'item', + 'rowset', + 'user_online_link', + 'online_userlist', + 'l_online_users', + ); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_modify', compact($vars))); + return array( 'online_userlist' => $online_userlist, 'l_online_users' => $l_online_users, @@ -4315,178 +3762,6 @@ function phpbb_optionset($bit, $set, $data) } /** -* Determine which plural form we should use. -* For some languages this is not as simple as for English. -* -* @param $rule int ID of the plural rule we want to use, see http://wiki.phpbb.com/Plural_Rules#Plural_Rules -* @param $number int|float The number we want to get the plural case for. Float numbers are floored. -* @return int The plural-case we need to use for the number plural-rule combination -*/ -function phpbb_get_plural_form($rule, $number) -{ - $number = (int) $number; - - if ($rule > 15 || $rule < 0) - { - trigger_error('INVALID_PLURAL_RULE'); - } - - /** - * The following plural rules are based on a list published by the Mozilla Developer Network - * https://developer.mozilla.org/en/Localization_and_Plurals - */ - switch ($rule) - { - case 0: - /** - * Families: Asian (Chinese, Japanese, Korean, Vietnamese), Persian, Turkic/Altaic (Turkish), Thai, Lao - * 1 - everything: 0, 1, 2, ... - */ - return 1; - - case 1: - /** - * Families: Germanic (Danish, Dutch, English, Faroese, Frisian, German, Norwegian, Swedish), Finno-Ugric (Estonian, Finnish, Hungarian), Language isolate (Basque), Latin/Greek (Greek), Semitic (Hebrew), Romanic (Italian, Portuguese, Spanish, Catalan) - * 1 - 1 - * 2 - everything else: 0, 2, 3, ... - */ - return ($number == 1) ? 1 : 2; - - case 2: - /** - * Families: Romanic (French, Brazilian Portuguese) - * 1 - 0, 1 - * 2 - everything else: 2, 3, ... - */ - return (($number == 0) || ($number == 1)) ? 1 : 2; - - case 3: - /** - * Families: Baltic (Latvian) - * 1 - 0 - * 2 - ends in 1, not 11: 1, 21, ... 101, 121, ... - * 3 - everything else: 2, 3, ... 10, 11, 12, ... 20, 22, ... - */ - return ($number == 0) ? 1 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 2 : 3); - - case 4: - /** - * Families: Celtic (Scottish Gaelic) - * 1 - is 1 or 11: 1, 11 - * 2 - is 2 or 12: 2, 12 - * 3 - others between 3 and 19: 3, 4, ... 10, 13, ... 18, 19 - * 4 - everything else: 0, 20, 21, ... - */ - return ($number == 1 || $number == 11) ? 1 : (($number == 2 || $number == 12) ? 2 : (($number >= 3 && $number <= 19) ? 3 : 4)); - - case 5: - /** - * Families: Romanic (Romanian) - * 1 - 1 - * 2 - is 0 or ends in 01-19: 0, 2, 3, ... 19, 101, 102, ... 119, 201, ... - * 3 - everything else: 20, 21, ... - */ - return ($number == 1) ? 1 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 2 : 3); - - case 6: - /** - * Families: Baltic (Lithuanian) - * 1 - ends in 1, not 11: 1, 21, 31, ... 101, 121, ... - * 2 - ends in 0 or ends in 10-20: 0, 10, 11, 12, ... 19, 20, 30, 40, ... - * 3 - everything else: 2, 3, ... 8, 9, 22, 23, ... 29, 32, 33, ... - */ - return (($number % 10 == 1) && ($number % 100 != 11)) ? 1 : ((($number % 10 < 2) || (($number % 100 >= 10) && ($number % 100 < 20))) ? 2 : 3); - - case 7: - /** - * Families: Slavic (Croatian, Serbian, Russian, Ukrainian) - * 1 - ends in 1, not 11: 1, 21, 31, ... 101, 121, ... - * 2 - ends in 2-4, not 12-14: 2, 3, 4, 22, 23, 24, 32, ... - * 3 - everything else: 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, ... - */ - return (($number % 10 == 1) && ($number % 100 != 11)) ? 1 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 2 : 3); - - case 8: - /** - * Families: Slavic (Slovak, Czech) - * 1 - 1 - * 2 - 2, 3, 4 - * 3 - everything else: 0, 5, 6, 7, ... - */ - return ($number == 1) ? 1 : ((($number >= 2) && ($number <= 4)) ? 2 : 3); - - case 9: - /** - * Families: Slavic (Polish) - * 1 - 1 - * 2 - ends in 2-4, not 12-14: 2, 3, 4, 22, 23, 24, 32, ... 104, 122, ... - * 3 - everything else: 0, 5, 6, ... 11, 12, 13, 14, 15, ... 20, 21, 25, ... - */ - return ($number == 1) ? 1 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 2 : 3); - - case 10: - /** - * Families: Slavic (Slovenian, Sorbian) - * 1 - ends in 01: 1, 101, 201, ... - * 2 - ends in 02: 2, 102, 202, ... - * 3 - ends in 03-04: 3, 4, 103, 104, 203, 204, ... - * 4 - everything else: 0, 5, 6, 7, 8, 9, 10, 11, ... - */ - return ($number % 100 == 1) ? 1 : (($number % 100 == 2) ? 2 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 3 : 4)); - - case 11: - /** - * Families: Celtic (Irish Gaeilge) - * 1 - 1 - * 2 - 2 - * 3 - is 3-6: 3, 4, 5, 6 - * 4 - is 7-10: 7, 8, 9, 10 - * 5 - everything else: 0, 11, 12, ... - */ - return ($number == 1) ? 1 : (($number == 2) ? 2 : (($number >= 3 && $number <= 6) ? 3 : (($number >= 7 && $number <= 10) ? 4 : 5))); - - case 12: - /** - * Families: Semitic (Arabic) - * 1 - 1 - * 2 - 2 - * 3 - ends in 03-10: 3, 4, ... 10, 103, 104, ... 110, 203, 204, ... - * 4 - ends in 11-99: 11, ... 99, 111, 112, ... - * 5 - everything else: 100, 101, 102, 200, 201, 202, ... - * 6 - 0 - */ - return ($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : (($number != 0) ? 5 : 6)))); - - case 13: - /** - * Families: Semitic (Maltese) - * 1 - 1 - * 2 - is 0 or ends in 01-10: 0, 2, 3, ... 9, 10, 101, 102, ... - * 3 - ends in 11-19: 11, 12, ... 18, 19, 111, 112, ... - * 4 - everything else: 20, 21, ... - */ - return ($number == 1) ? 1 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 2 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 3 : 4)); - - case 14: - /** - * Families: Slavic (Macedonian) - * 1 - ends in 1: 1, 11, 21, ... - * 2 - ends in 2: 2, 12, 22, ... - * 3 - everything else: 0, 3, 4, ... 10, 13, 14, ... 20, 23, ... - */ - return ($number % 10 == 1) ? 1 : (($number % 10 == 2) ? 2 : 3); - - case 15: - /** - * Families: Icelandic - * 1 - ends in 1, not 11: 1, 21, 31, ... 101, 121, 131, ... - * 2 - everything else: 0, 2, 3, ... 10, 11, 12, ... 20, 22, ... - */ - return (($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2; - } -} - -/** * Login using http authenticate. * * @param array $param Parameter array, see $param_defaults array. @@ -4685,9 +3960,133 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null) } /** +* Get user avatar +* +* @param array $user_row Row from the users table +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false, $lazy = false) +{ + $row = \phpbb\avatar\manager::clean_row($user_row, 'user'); + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Get group avatar +* +* @param array $group_row Row from the groups table +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false) +{ + $row = \phpbb\avatar\manager::clean_row($user_row, 'group'); + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Get avatar +* +* @param array $row Row cleaned by \phpbb\avatar\manager::clean_row +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false) +{ + global $user, $config; + global $phpbb_container, $phpbb_dispatcher; + + if (!$config['allow_avatar'] && !$ignore_config) + { + return ''; + } + + $avatar_data = array( + 'src' => $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $driver = $phpbb_avatar_manager->get_driver($row['avatar_type'], !$ignore_config); + $html = ''; + + if ($driver) + { + $html = $driver->get_custom_html($user, $row, $alt); + if (!empty($html)) + { + return $html; + } + + $avatar_data = $driver->get_data($row); + } + else + { + $avatar_data['src'] = ''; + } + + if (!empty($avatar_data['src'])) + { + if ($lazy) + { + // Determine board url - we may need it later + $board_url = generate_board_url() . '/'; + // This path is sent with the base template paths in the assign_vars() + // call below. We need to correct it in case we are accessing from a + // controller because the web paths will be incorrect otherwise. + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); + + $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; + + $theme = "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme'; + + $src = 'src="' . $theme . '/images/no_avatar.gif" data-src="' . $avatar_data['src'] . '"'; + } + else + { + $src = 'src="' . $avatar_data['src'] . '"'; + } + + $html = '<img class="avatar" ' . $src . ' ' . + ($avatar_data['width'] ? ('width="' . $avatar_data['width'] . '" ') : '') . + ($avatar_data['height'] ? ('height="' . $avatar_data['height'] . '" ') : '') . + 'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />'; + } + + /** + * Event to modify HTML <img> tag of avatar + * + * @event core.get_avatar_after + * @var array row Row cleaned by \phpbb\avatar\manager::clean_row + * @var string alt Optional language string for alt tag within image, can be a language key or text + * @var bool ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP + * @var array avatar_data The HTML attributes for avatar <img> tag + * @var string html The HTML <img> tag of generated avatar + * @since 3.1.6-RC1 + */ + $vars = array('row', 'alt', 'ignore_config', 'avatar_data', 'html'); + extract($phpbb_dispatcher->trigger_event('core.get_avatar_after', compact($vars))); + + return $html; +} + +/** * Generate page header */ -function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum') +function page_header($page_title = '', $display_online_list = false, $item_id = 0, $item = 'forum') { global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; global $phpbb_dispatcher, $request, $phpbb_container, $phpbb_admin_path; @@ -4714,7 +4113,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 * @var int item_id Restrict online users to item id * @var bool page_header_override Shall we return instead of running * the rest of page_header() - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'page_header_override'); extract($phpbb_dispatcher->trigger_event('core.page_header', compact($vars))); @@ -4751,7 +4150,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 if ($user->data['user_id'] != ANONYMOUS) { $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id); - $l_login_logout = sprintf($user->lang['LOGOUT_USER'], $user->data['username']); + $l_login_logout = $user->lang['LOGOUT']; } else { @@ -4782,8 +4181,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 if ($total_online_users > $config['record_online_users']) { - set_config('record_online_users', $total_online_users, true); - set_config('record_online_date', time(), true); + $config->set('record_online_users', $total_online_users, false); + $config->set('record_online_date', time(), false); } $l_online_record = $user->lang('RECORD_ONLINE_USERS', (int) $config['record_online_users'], $user->format_date($config['record_online_date'], false, true)); @@ -4818,8 +4217,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 } } - $forum_id = request_var('f', 0); - $topic_id = request_var('t', 0); + $forum_id = $request->variable('f', 0); + $topic_id = $request->variable('t', 0); $s_feed_news = false; @@ -4839,6 +4238,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 // This path is sent with the base template paths in the assign_vars() // call below. We need to correct it in case we are accessing from a // controller because the web paths will be incorrect otherwise. + /* @var $phpbb_path_helper \phpbb\path_helper */ $phpbb_path_helper = $phpbb_container->get('path_helper'); $corrected_path = $phpbb_path_helper->get_web_root_path(); $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; @@ -4865,8 +4265,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 } } - $dt = new \phpbb\datetime($user, 'now', $user->timezone); - $timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset()); + $dt = $user->create_datetime(); + $timezone_offset = $user->lang(array('timezones', 'UTC_OFFSET'), phpbb_format_timezone_offset($dt->getOffset())); $timezone_name = $user->timezone->getName(); if (isset($user->lang['timezones'][$timezone_name])) { @@ -4875,11 +4275,12 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 // Output the notifications $notifications = false; - if ($config['load_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE) + if ($config['load_notifications'] && $config['allow_board_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE) { + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $notifications = $phpbb_notifications->load_notifications(array( + $notifications = $phpbb_notifications->load_notifications('notification.method.board', array( 'all_unread' => true, 'limit' => 5, )); @@ -4890,7 +4291,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 } } - $hidden_fields_for_jumpbox = phpbb_build_hidden_fields_for_query_params($request, array('f')); + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); $notification_mark_hash = generate_link_hash('mark_all_notifications_read'); // The following assigns all _common_ variables that may be used at any point in a template. @@ -4905,15 +4307,17 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'TOTAL_USERS_ONLINE' => $l_online_users, 'LOGGED_IN_USER_LIST' => $online_userlist, 'RECORD_USERS' => $l_online_record, - 'PRIVATE_MESSAGE_COUNT' => (!empty($user->data['user_unread_privmsg'])) ? $user->data['user_unread_privmsg'] : 0, - 'HIDDEN_FIELDS_FOR_JUMPBOX' => $hidden_fields_for_jumpbox, + 'PRIVATE_MESSAGE_COUNT' => (!empty($user->data['user_unread_privmsg'])) ? $user->data['user_unread_privmsg'] : 0, + 'CURRENT_USER_AVATAR' => phpbb_get_user_avatar($user->data), + 'CURRENT_USERNAME_SIMPLE' => get_username_string('no_profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), + 'CURRENT_USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'UNREAD_NOTIFICATIONS_COUNT' => ($notifications !== false) ? $notifications['unread_count'] : '', 'NOTIFICATIONS_COUNT' => ($notifications !== false) ? $notifications['unread_count'] : '', 'U_VIEW_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications'), 'U_MARK_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications&mode=notification_list&mark=all&token=' . $notification_mark_hash), 'U_NOTIFICATION_SETTINGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications&mode=notification_options'), - 'S_NOTIFICATIONS_DISPLAY' => $config['load_notifications'], + 'S_NOTIFICATIONS_DISPLAY' => $config['load_notifications'] && $config['allow_board_notifications'], 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], @@ -4940,19 +4344,21 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'U_SITE_HOME' => $config['site_home_url'], 'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), 'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.$phpEx"), + 'U_USER_PROFILE' => get_username_string('profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'U_MODCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id), - 'U_FAQ' => append_sid("{$phpbb_root_path}faq.$phpEx"), + 'U_FAQ' => $controller_helper->route('phpbb_help_faq_controller'), 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'), 'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'), 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), - 'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=leaders'), + 'U_CONTACT_US' => ($config['contact_admin_form_enable'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '', + 'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team'), 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), 'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '', - 'U_FEED' => generate_board_url() . "/feed.$phpEx", + 'U_FEED' => $controller_helper->route('phpbb_feed_index'), 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, @@ -4977,7 +4383,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_TOPIC_ID' => $topic_id, 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id)), - 'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => build_url())), + 'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => $phpbb_path_helper->remove_web_root_path(build_url()))), 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false, 'S_ENABLE_FEEDS_OVERALL' => ($config['feed_overall']) ? true : false, @@ -5003,8 +4409,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/", 'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/", 'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'], - 'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'], - 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js?assets_version=" . $config['assets_version'], + 'T_STYLESHEET_LANG_LINK'=> "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'], + 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$web_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'], + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.min.js?assets_version=" . $config['assets_version'], 'S_ALLOW_CDN' => !empty($config['allow_cdn']), 'T_THEME_NAME' => rawurlencode($user->style['style_path']), @@ -5022,23 +4429,123 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'SITE_LOGO_IMG' => $user->img('site_logo'), )); - // application/xhtml+xml not used because of IE - header('Content-type: text/html; charset=UTF-8'); - - header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: 0'); - header('Pragma: no-cache'); - + // An array of http headers that phpbb will set. The following event may override these. + $http_headers = array( + // application/xhtml+xml not used because of IE + 'Content-type' => 'text/html; charset=UTF-8', + 'Cache-Control' => 'private, no-cache="set-cookie"', + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + ); if (!empty($user->data['is_bot'])) { // Let reverse proxies know we detected a bot. - header('X-PHPBB-IS-BOT: yes'); + $http_headers['X-PHPBB-IS-BOT'] = 'yes'; + } + + /** + * Execute code and/or overwrite _common_ template variables after they have been assigned. + * + * @event core.page_header_after + * @var string page_title Page title + * @var bool display_online_list Do we display online users list + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var int item_id Restrict online users to item id + * @var array http_headers HTTP headers that should be set by phpbb + * + * @since 3.1.0-b3 + */ + $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'http_headers'); + extract($phpbb_dispatcher->trigger_event('core.page_header_after', compact($vars))); + + foreach ($http_headers as $hname => $hval) + { + header((string) $hname . ': ' . (string) $hval); } return; } /** +* Check and display the SQL report if requested. +* +* @param \phpbb\request\request_interface $request Request object +* @param \phpbb\auth\auth $auth Auth object +* @param \phpbb\db\driver\driver_interface $db Database connection +*/ +function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db) +{ + if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG')) + { + $db->sql_report('display'); + } +} + +/** +* Generate the debug output string +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\config\config $config Config object +* @param \phpbb\auth\auth $auth Auth object +* @param \phpbb\user $user User object +* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher +* @return string +*/ +function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher) +{ + $debug_info = array(); + + // Output page creation time + if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + if (isset($GLOBALS['starttime'])) + { + $totaltime = microtime(true) - $GLOBALS['starttime']; + $debug_info[] = sprintf('<span title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</span>', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime); + } + + $debug_info[] = sprintf('<span title="Cached: %d">Queries: %d</span>', $db->sql_num_queries(true), $db->sql_num_queries()); + + $memory_usage = memory_get_peak_usage(); + if ($memory_usage) + { + $memory_usage = get_formatted_filesize($memory_usage); + + $debug_info[] = 'Peak Memory Usage: ' . $memory_usage; + } + } + + if (defined('DEBUG')) + { + $debug_info[] = 'GZIP: ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off'); + + if ($user->load) + { + $debug_info[] = 'Load: ' . $user->load; + } + + if ($auth->acl_get('a_')) + { + $debug_info[] = '<a href="' . build_url() . '&explain=1">SQL Explain</a>'; + } + } + + /** + * Modify debug output information + * + * @event core.phpbb_generate_debug_output + * @var array debug_info Array of strings with debug information + * + * @since 3.1.0-RC3 + */ + $vars = array('debug_info'); + extract($phpbb_dispatcher->trigger_event('core.phpbb_generate_debug_output', compact($vars))); + + return implode(' | ', $debug_info); +} + +/** * Generate page footer * * @param bool $run_cron Whether or not to run the cron @@ -5047,7 +4554,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 */ function page_footer($run_cron = true, $display_template = true, $exit_handler = true) { - global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx; + global $db, $config, $template, $user, $auth, $cache, $phpEx; global $request, $phpbb_dispatcher, $phpbb_admin_path; // A listener can set this variable to `true` when it overrides this function @@ -5060,7 +4567,7 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler = * @var bool run_cron Shall we run cron tasks * @var bool page_footer_override Shall we return instead of running * the rest of page_footer() - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('run_cron', 'page_footer_override'); extract($phpbb_dispatcher->trigger_event('core.page_footer', compact($vars))); @@ -5070,46 +4577,21 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler = return; } - // Output page creation time - if (defined('DEBUG')) - { - $mtime = explode(' ', microtime()); - $totaltime = $mtime[0] + $mtime[1] - $starttime; - - if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG') && method_exists($db, 'sql_report')) - { - $db->sql_report('display'); - } + $user->update_session_infos(); - $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); - - if ($auth->acl_get('a_') && defined('DEBUG')) - { - if (function_exists('memory_get_peak_usage')) - { - if ($memory_usage = memory_get_peak_usage()) - { - $memory_usage = get_formatted_filesize($memory_usage); - - $debug_output .= ' | Peak Memory Usage: ' . $memory_usage; - } - } - - $debug_output .= ' | <a href="' . build_url() . '&explain=1">Explain</a>'; - } - } + phpbb_check_and_display_sql_report($request, $auth, $db); $template->assign_vars(array( - 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', + 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher), 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', - 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'), + 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited'), 'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id) : '') ); // Call cron-type script $call_cron = false; - if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot']) + if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('_cron.lock_check')) { $call_cron = true; $time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time(); @@ -5130,7 +4612,10 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler = // Call cron job? if ($call_cron) { - global $cron; + global $phpbb_container; + + /* @var $cron \phpbb\cron\manager */ + $cron = $phpbb_container->get('cron.manager'); $task = $cron->find_one_ready_task(); if ($task) @@ -5138,8 +4623,24 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler = $url = $task->get_url(); $template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />'); } + else + { + $cache->put('_cron.lock_check', true, 60); + } } + /** + * Execute code and/or modify output before displaying the template. + * + * @event core.page_footer_after + * @var bool display_template Whether or not to display the template + * @var bool exit_handler Whether or not to run the exit_handler() + * + * @since 3.1.0-RC5 + */ + $vars = array('display_template', 'exit_handler'); + extract($phpbb_dispatcher->trigger_event('core.page_footer_after', compact($vars))); + if ($display_template) { $template->display('body'); @@ -5168,7 +4669,7 @@ function garbage_collection() * Unload some objects, to free some memory, before we finish our task * * @event core.garbage_collection - * @since 3.1-A1 + * @since 3.1.0-a1 */ $phpbb_dispatcher->dispatch('core.garbage_collection'); } @@ -5194,7 +4695,7 @@ function garbage_collection() */ function exit_handler() { - global $phpbb_hook, $config; + global $phpbb_hook; if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__)) { @@ -5230,22 +4731,6 @@ function phpbb_user_session_handler() } /** -* Check if PCRE has UTF-8 support -* PHP may not be linked with the bundled PCRE lib and instead with an older version -* -* @return bool Returns true if PCRE (the regular expressions library) supports UTF-8 encoding -*/ -function phpbb_pcre_utf8_support() -{ - static $utf8_pcre_properties = null; - if (is_null($utf8_pcre_properties)) - { - $utf8_pcre_properties = (@preg_match('/\p{L}/u', 'a') !== false); - } - return $utf8_pcre_properties; -} - -/** * Casts a numeric string $input to an appropriate numeric type (i.e. integer or float) * * @param string $input A numeric string. @@ -5259,47 +4744,40 @@ function phpbb_to_numeric($input) } /** -* Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name. -* -* If $dbms is a valid 3.1 db driver class name, returns it unchanged. -* Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms -* to 3.1 db driver class name. +* Get the board contact details (e.g. for emails) * -* @param string $dbms dbms parameter -* @return db driver class +* @param \phpbb\config\config $config +* @param string $phpEx +* @return string */ -function phpbb_convert_30_dbms_to_31($dbms) +function phpbb_get_board_contact(\phpbb\config\config $config, $phpEx) { - // Note: this check is done first because mysqli extension - // supplies a mysqli class, and class_exists($dbms) would return - // true for mysqli class. - // However, per the docblock any valid 3.1 driver name should be - // recognized by this function, and have priority over 3.0 dbms. - if (class_exists('phpbb\db\driver\\' . $dbms)) + if ($config['contact_admin_form_enable']) { - return 'phpbb\db\driver\\' . $dbms; + return generate_board_url() . '/memberlist.' . $phpEx . '?mode=contactadmin'; } - - if (class_exists($dbms)) + else { - // Additionally we could check that $dbms extends phpbb\db\driver\driver. - // http://php.net/manual/en/class.reflectionclass.php - // Beware of possible performance issues: - // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance - // We could check for interface implementation in all paths or - // only when we do not prepend phpbb\db\driver\. - - /* - $reflection = new \ReflectionClass($dbms); - - if ($reflection->isSubclassOf('phpbb\db\driver\driver')) - { - return $dbms; - } - */ - - return $dbms; + return $config['board_contact']; } +} - throw new \RuntimeException("You have specified an invalid dbms driver: $dbms"); +/** +* Get a clickable board contact details link +* +* @param \phpbb\config\config $config +* @param string $phpbb_root_path +* @param string $phpEx +* @return string +*/ +function phpbb_get_board_contact_link(\phpbb\config\config $config, $phpbb_root_path, $phpEx) +{ + if ($config['contact_admin_form_enable'] && $config['email_enable']) + { + return append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); + } + else + { + return 'mailto:' . htmlspecialchars($config['board_contact']); + } } diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index cb44ed2794..3f64bc19f9 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,7 +24,7 @@ if (!defined('IN_PHPBB')) */ function adm_page_header($page_title) { - global $config, $db, $user, $template; + global $config, $user, $template; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID; global $phpbb_dispatcher; @@ -41,7 +45,7 @@ function adm_page_header($page_title) * @var string page_title Page title * @var bool adm_page_header_override Shall we return instead of * running the rest of adm_page_header() - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('page_title', 'adm_page_header_override'); extract($phpbb_dispatcher->trigger_event('core.adm_page_header', compact($vars))); @@ -103,12 +107,30 @@ function adm_page_header($page_title) 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', )); - // application/xhtml+xml not used because of IE - header('Content-type: text/html; charset=UTF-8'); + // An array of http headers that phpbb will set. The following event may override these. + $http_headers = array( + // application/xhtml+xml not used because of IE + 'Content-type' => 'text/html; charset=UTF-8', + 'Cache-Control' => 'private, no-cache="set-cookie"', + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + ); - header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: 0'); - header('Pragma: no-cache'); + /** + * Execute code and/or overwrite _common_ template variables after they have been assigned. + * + * @event core.adm_page_header_after + * @var string page_title Page title + * @var array http_headers HTTP headers that should be set by phpbb + * + * @since 3.1.0-RC3 + */ + $vars = array('page_title', 'http_headers'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_header_after', compact($vars))); + + foreach ($http_headers as $hname => $hval) + { + header((string) $hname . ': ' . (string) $hval); + } return; } @@ -118,8 +140,8 @@ function adm_page_header($page_title) */ function adm_page_footer($copyright_html = true) { - global $db, $config, $template, $user, $auth, $cache; - global $starttime, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $config, $template, $user, $auth; + global $phpbb_root_path; global $request, $phpbb_dispatcher; // A listener can set this variable to `true` when it overrides this function @@ -132,7 +154,7 @@ function adm_page_footer($copyright_html = true) * @var bool copyright_html Shall we display the copyright? * @var bool adm_page_footer_override Shall we return instead of * running the rest of adm_page_footer() - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('copyright_html', 'adm_page_footer_override'); extract($phpbb_dispatcher->trigger_event('core.adm_page_footer', compact($vars))); @@ -142,41 +164,16 @@ function adm_page_footer($copyright_html = true) return; } - // Output page creation time - if (defined('DEBUG')) - { - $mtime = explode(' ', microtime()); - $totaltime = $mtime[0] + $mtime[1] - $starttime; - - if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG') && method_exists($db, 'sql_report')) - { - $db->sql_report('display'); - } - - $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); + $user->update_session_infos(); - if ($auth->acl_get('a_') && defined('DEBUG')) - { - if (function_exists('memory_get_peak_usage')) - { - if ($memory_usage = memory_get_peak_usage()) - { - $memory_usage = get_formatted_filesize($memory_usage); - - $debug_output .= ' | Peak Memory Usage: ' . $memory_usage; - } - } - - $debug_output .= ' | <a href="' . build_url() . '&explain=1">Explain</a>'; - } - } + phpbb_check_and_display_sql_report($request, $auth, $db); $template->assign_vars(array( - 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', + 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher), 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html, - 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'), - 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js", + 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited'), + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.min.js", 'S_ALLOW_CDN' => !empty($config['allow_cdn']), 'VERSION' => $config['version']) ); @@ -235,7 +232,7 @@ function h_radio($name, $input_ary, $input_default = false, $id = false, $key = /** * Build configuration template for acp configuration pages */ -function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) +function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars) { global $user, $module, $phpbb_dispatcher; @@ -243,15 +240,20 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) $name = 'config[' . $config_key . ']'; // Make sure there is no notice printed out for non-existent config options (we simply set them) - if (!isset($new[$config_key])) + if (!isset($new_ary[$config_key])) { - $new[$config_key] = ''; + $new_ary[$config_key] = ''; } switch ($tpl_type[0]) { - case 'text': case 'password': + if ($new_ary[$config_key] !== '') + { + // replace passwords with asterixes + $new_ary[$config_key] = '********'; + } + case 'text': case 'url': case 'email': case 'color': @@ -263,16 +265,15 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) case 'range': case 'search': case 'tel': - case 'url': case 'week': $size = (int) $tpl_type[1]; $maxlength = (int) $tpl_type[2]; - $tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />'; + $tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new_ary[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />'; break; case 'number': - $min = $max = $maxlength = ''; + $max = $maxlength = ''; $min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false; if ( isset($tpl_type[2]) ) { @@ -280,11 +281,11 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) $maxlength = strlen( (string) $max ); } - $tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new[$config_key] . '" />'; + $tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new_ary[$config_key] . '" />'; break; case 'dimension': - $min = $max = $maxlength = $size = ''; + $max = $maxlength = $size = ''; $min = (int) $tpl_type[1]; @@ -294,19 +295,19 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) $size = $maxlength = strlen( (string) $max ); } - $tpl = '<input id="' . $key . '" type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />'; + $tpl = '<input id="' . $key . '" type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new_ary[$config_key . '_width'] . '" /> x <input type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new_ary[$config_key . '_height'] . '" />'; break; case 'textarea': $rows = (int) $tpl_type[1]; $cols = (int) $tpl_type[2]; - $tpl = '<textarea id="' . $key . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>'; + $tpl = '<textarea id="' . $key . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new_ary[$config_key] . '</textarea>'; break; case 'radio': - $key_yes = ($new[$config_key]) ? ' checked="checked"' : ''; - $key_no = (!$new[$config_key]) ? ' checked="checked"' : ''; + $key_yes = ($new_ary[$config_key]) ? ' checked="checked"' : ''; + $key_no = (!$new_ary[$config_key]) ? ' checked="checked"' : ''; $tpl_type_cond = explode('_', $tpl_type[1]); $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; @@ -320,8 +321,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) case 'select': case 'custom': - $return = ''; - if (isset($vars['method'])) { $call = array($module->module, $vars['method']); @@ -343,7 +342,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) switch ($value) { case '{CONFIG_VALUE}': - $value = $new[$config_key]; + $value = $new_ary[$config_key]; break; case '{KEY}': @@ -356,7 +355,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) } else { - $args = array($new[$config_key], $key); + $args = array($new_ary[$config_key], $key); } $return = call_user_func_array($call, $args); @@ -364,8 +363,9 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) if ($tpl_type[0] == 'select') { $size = (isset($tpl_type[1])) ? (int) $tpl_type[1] : 1; + $data_toggle = (!empty($tpl_type[2])) ? ' data-togglable-settings="true"' : ''; - $tpl = '<select id="' . $key . '" name="' . $name . '"' . (($size > 1) ? ' size="' . $size . '"' : '') . '>' . $return . '</select>'; + $tpl = '<select id="' . $key . '" name="' . $name . '"' . (($size > 1) ? ' size="' . $size . '"' : '') . $data_toggle . '>' . $return . '</select>'; } else { @@ -383,6 +383,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) $tpl .= $vars['append']; } + $new = $new_ary; /** * Overwrite the html code we display for the config value * @@ -396,10 +397,12 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) * @var string name Should be used for the name attribute * @var array vars Array with the options for the config * @var string tpl The resulting html code we display - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl'); extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars))); + $new_ary = $new; + unset($new); return $tpl; } @@ -410,7 +413,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) */ function validate_config_vars($config_vars, &$cfg_array, &$error) { - global $phpbb_root_path, $user, $phpbb_dispatcher; + global $phpbb_root_path, $user, $phpbb_dispatcher, $phpbb_filesystem; $type = 0; $min = 1; @@ -555,6 +558,9 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) $cfg_array[$config_name] = trim($destination); + // Absolute file path + case 'absolute_path': + case 'absolute_path_writable': // Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir... case 'path': case 'wpath': @@ -573,20 +579,22 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) break; } - if (!file_exists($phpbb_root_path . $cfg_array[$config_name])) + $path = in_array($config_definition['validate'], array('wpath', 'path', 'rpath', 'rwpath')) ? $phpbb_root_path . $cfg_array[$config_name] : $cfg_array[$config_name]; + + if (!file_exists($path)) { $error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]); } - if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !is_dir($phpbb_root_path . $cfg_array[$config_name])) + if (file_exists($path) && !is_dir($path)) { $error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]); } // Check if the path is writable - if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath') + if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath' || $config_definition['validate'] === 'absolute_path_writable') { - if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !phpbb_is_writable($phpbb_root_path . $cfg_array[$config_name])) + if (file_exists($path) && !$phpbb_filesystem->is_writable($path)) { $error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); } @@ -606,7 +614,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) * @var array error Array of errors, the errors should * be strings only, language keys are * not replaced afterwards - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('cfg_array', 'config_name', 'config_definition', 'error'); extract($phpbb_dispatcher->trigger_event('core.validate_config_variable', compact($vars))); @@ -642,8 +650,6 @@ function validate_range($value_ary, &$error) foreach ($value_ary as $value) { $column = explode(':', $value['column_type']); - $max = $min = 0; - $type = 0; if (!isset($column_types[$column[0]])) { continue; @@ -678,3 +684,30 @@ function validate_range($value_ary, &$error) } } } + +/** +* Inserts new config display_vars into an exisiting display_vars array +* at the given position. +* +* @param array $display_vars An array of existing config display vars +* @param array $add_config_vars An array of new config display vars +* @param array $where Where to place the new config vars, +* before or after an exisiting config, as an array +* of the form: array('after' => 'config_name') or +* array('before' => 'config_name'). +* @return array The array of config display vars +*/ +function phpbb_insert_config_array($display_vars, $add_config_vars, $where) +{ + if (is_array($where) && array_key_exists(current($where), $display_vars)) + { + $position = array_search(current($where), array_keys($display_vars)) + ((key($where) == 'before') ? 0 : 1); + $display_vars = array_merge( + array_slice($display_vars, 0, $position), + $add_config_vars, + array_slice($display_vars, $position) + ); + } + + return $display_vars; +} diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 722d3c9c67..1c7e68d358 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -23,8 +27,6 @@ if (!defined('IN_PHPBB')) * @param string $table constant or fullname of the table * @param int $parent_id parent_id of the current set (default = 0) * @param array $where contains strings to compare closer on the where statement (additional) -* -* @author EXreaction */ function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = array()) { @@ -63,7 +65,7 @@ function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = ar */ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false, $return_array = false) { - global $db, $user, $auth; + global $db, $auth; // This query is identical to the jumpbox one $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id @@ -169,7 +171,10 @@ function size_select_options($size_compare) */ function group_select_options($group_id, $exclude_ids = false, $manage_founder = false) { - global $db, $user, $config; + global $db, $config, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; $sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; @@ -187,7 +192,7 @@ function group_select_options($group_id, $exclude_ids = false, $manage_founder = while ($row = $db->sql_fetchrow($result)) { $selected = ($row['group_id'] == $group_id) ? ' selected="selected"' : ''; - $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . $group_helper->get_name($row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -311,12 +316,10 @@ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $incl * @param bool $add_log True if log entry should be added * * @return bool False on error -* -* @author bantu */ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perms = true, $add_log = true) { - global $db; + global $db, $user, $phpbb_log; // Only one forum id specified if (!is_array($dest_forum_ids)) @@ -439,7 +442,7 @@ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perm if ($add_log) { - add_log('admin', 'LOG_FORUM_COPIED_PERMISSIONS', $src_forum_name, implode(', ', $dest_forum_names)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_COPIED_PERMISSIONS', false, array($src_forum_name, implode(', ', $dest_forum_names))); } $db->sql_transaction('commit'); @@ -500,7 +503,7 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png') */ function move_topics($topic_ids, $forum_id, $auto_sync = true) { - global $db; + global $db, $phpbb_dispatcher; if (empty($topic_ids)) { @@ -534,6 +537,27 @@ function move_topics($topic_ids, $forum_id, $auto_sync = true) } $table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); + + /** + * Perform additional actions before topics move + * + * @event core.move_topics_before_query + * @var array table_ary Array of tables from which forum_id will be updated for all rows that hold the moved topics + * @var array topic_ids Array of the moved topic ids + * @var string forum_id The forum id from where the topics are moved + * @var array forum_ids Array of the forums where the topics are moving (includes also forum_id) + * @var bool auto_sync Whether or not to perform auto sync + * @since 3.1.5-RC1 + */ + $vars = array( + 'table_ary', + 'topic_ids', + 'forum_id', + 'forum_ids', + 'auto_sync', + ); + extract($phpbb_dispatcher->trigger_event('core.move_topics_before_query', compact($vars))); + foreach ($table_ary as $table) { $sql = "UPDATE $table @@ -555,7 +579,7 @@ function move_topics($topic_ids, $forum_id, $auto_sync = true) */ function move_posts($post_ids, $topic_id, $auto_sync = true) { - global $db; + global $db, $phpbb_dispatcher; if (!is_array($post_ids)) { @@ -589,6 +613,28 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) trigger_error('NO_TOPIC'); } + /** + * Perform additional actions before moving posts + * + * @event core.move_posts_before + * @var array post_ids Array of post ids to move + * @var string topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_before', compact($vars))); + $sql = 'UPDATE ' . POSTS_TABLE . ' SET forum_id = ' . (int) $forum_row['forum_id'] . ", topic_id = $topic_id WHERE " . $db->sql_in_set('post_id', $post_ids); @@ -599,6 +645,28 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) WHERE " . $db->sql_in_set('post_msg_id', $post_ids); $db->sql_query($sql); + /** + * Perform additional actions after moving posts + * + * @event core.move_posts_after + * @var array post_ids Array of the moved post ids + * @var string topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_after', compact($vars))); + if ($auto_sync) { $forum_ids[] = (int) $forum_row['forum_id']; @@ -618,7 +686,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) */ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) { - global $db, $config, $phpbb_container; + global $db, $config, $phpbb_container, $phpbb_dispatcher; $approved_topics = 0; $forum_ids = $topic_ids = array(); @@ -672,6 +740,20 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s $table_ary = array(BOOKMARKS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE); + /** + * Perform additional actions before topic(s) deletion + * + * @event core.delete_topics_before_query + * @var array table_ary Array of tables from which all rows will be deleted that hold a topic_id occuring in topic_ids + * @var array topic_ids Array of topic ids to delete + * @since 3.1.4-RC1 + */ + $vars = array( + 'table_ary', + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_topics_before_query', compact($vars))); + foreach ($table_ary as $table) { $sql = "DELETE FROM $table @@ -680,6 +762,18 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } unset($table_ary); + /** + * Perform additional actions after topic(s) deletion + * + * @event core.delete_topics_after_query + * @var array topic_ids Array of topic ids that were deleted + * @since 3.1.4-RC1 + */ + $vars = array( + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_topics_after_query', compact($vars))); + $moved_topic_ids = array(); // update the other forums @@ -712,15 +806,16 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s if ($approved_topics) { - set_config_count('num_topics', $approved_topics * (-1), true); + $config->increment('num_topics', $approved_topics * (-1), false); } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); $phpbb_notifications->delete_notifications(array( - 'topic', - 'approve_topic', - 'topic_in_queue', + 'notification.type.topic', + 'notification.type.approve_topic', + 'notification.type.topic_in_queue', ), $topic_ids); return $return; @@ -731,7 +826,39 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s */ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) { - global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container; + global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container, $phpbb_dispatcher; + + // Notifications types to delete + $delete_notifications_types = array( + 'notification.type.quote', + 'notification.type.approve_post', + 'notification.type.post_in_queue', + 'notification.type.report_post', + ); + + /** + * Perform additional actions before post(s) deletion + * + * @event core.delete_posts_before + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var bool auto_sync Flag indicating if topics/forums should be synchronized + * @var bool posted_sync Flag indicating if topics_posted table should be resynchronized + * @var bool post_count_sync Flag indicating if posts count should be resynchronized + * @var bool call_delete_topics Flag indicating if topics having no posts should be deleted + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'where_type', + 'where_ids', + 'auto_sync', + 'posted_sync', + 'post_count_sync', + 'call_delete_topics', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_before', compact($vars))); if ($where_type === 'range') { @@ -808,6 +935,32 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $table_ary = array(POSTS_TABLE, REPORTS_TABLE); + /** + * Perform additional actions during post(s) deletion before running the queries + * + * @event core.delete_posts_in_transaction_before + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of post ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @var array table_ary Array with table names to delete data from + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + 'table_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction_before', compact($vars))); + foreach ($table_ary as $table) { $sql = "DELETE FROM $table @@ -863,7 +1016,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } $error = false; - $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); if ($error) { @@ -872,10 +1025,61 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $search->index_remove($post_ids, $poster_ids, $forum_ids); - delete_attachments('post', $post_ids, false); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('post', $post_ids, false); + unset($attachment_manager); + + /** + * Perform additional actions during post(s) deletion + * + * @event core.delete_posts_in_transaction + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction', compact($vars))); $db->sql_transaction('commit'); + /** + * Perform additional actions after post(s) deletion + * + * @event core.delete_posts_after + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_after', compact($vars))); + // Resync topics_posted table if ($posted_sync) { @@ -891,7 +1095,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = if ($approved_posts && $post_count_sync) { - set_config_count('num_posts', $approved_posts * (-1), true); + $config->increment('num_posts', $approved_posts * (-1), false); } // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too) @@ -900,15 +1104,10 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->delete_notifications(array( - 'quote', - 'bookmark', - 'post', - 'approve_post', - 'post_in_queue', - ), $post_ids); + $phpbb_notifications->delete_notifications($delete_notifications_types, $post_ids); return sizeof($post_ids); } @@ -916,225 +1115,21 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = /** * Delete Attachments * +* @deprecated 3.2.0-a1 (To be removed: 3.4.0) +* * @param string $mode can be: post|message|topic|attach|user * @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids * @param bool $resync set this to false if you are deleting posts or topics */ function delete_attachments($mode, $ids, $resync = true) { - global $db, $config; - - // 0 is as bad as an empty array - if (empty($ids)) - { - return false; - } - - if (is_array($ids)) - { - $ids = array_unique($ids); - $ids = array_map('intval', $ids); - } - else - { - $ids = array((int) $ids); - } - - $sql_where = ''; - - switch ($mode) - { - case 'post': - case 'message': - $sql_id = 'post_msg_id'; - $sql_where = ' AND in_message = ' . ($mode == 'message' ? 1 : 0); - break; - - case 'topic': - $sql_id = 'topic_id'; - break; - - case 'user': - $sql_id = 'poster_id'; - break; - - case 'attach': - default: - $sql_id = 'attach_id'; - $mode = 'attach'; - break; - } - - $post_ids = $message_ids = $topic_ids = $physical = array(); - - // Collect post and topic ids for later use if we need to touch remaining entries (if resync is enabled) - $sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan - FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set($sql_id, $ids); - - $sql .= $sql_where; - - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - // We only need to store post/message/topic ids if resync is enabled and the file is not orphaned - if ($resync && !$row['is_orphan']) - { - if (!$row['in_message']) - { - $post_ids[] = $row['post_msg_id']; - $topic_ids[] = $row['topic_id']; - } - else - { - $message_ids[] = $row['post_msg_id']; - } - } + global $phpbb_container; - $physical[] = array('filename' => $row['physical_filename'], 'thumbnail' => $row['thumbnail'], 'filesize' => $row['filesize'], 'is_orphan' => $row['is_orphan']); - } - $db->sql_freeresult($result); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $num_deleted = $attachment_manager->delete($mode, $ids, $resync); - // Delete attachments - $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set($sql_id, $ids); - - $sql .= $sql_where; - - $db->sql_query($sql); - $num_deleted = $db->sql_affectedrows(); - - if (!$num_deleted) - { - return 0; - } - - // Delete attachments from filesystem - $space_removed = $files_removed = 0; - foreach ($physical as $file_ary) - { - if (phpbb_unlink($file_ary['filename'], 'file', true) && !$file_ary['is_orphan']) - { - // Only non-orphaned files count to the file size - $space_removed += $file_ary['filesize']; - $files_removed++; - } - - if ($file_ary['thumbnail']) - { - phpbb_unlink($file_ary['filename'], 'thumbnail', true); - } - } - - if ($space_removed || $files_removed) - { - set_config_count('upload_dir_size', $space_removed * (-1), true); - set_config_count('num_files', $files_removed * (-1), true); - } - - // If we do not resync, we do not need to adjust any message, post, topic or user entries - if (!$resync) - { - return $num_deleted; - } - - // No more use for the original ids - unset($ids); - - // Now, we need to resync posts, messages, topics. We go through every one of them - $post_ids = array_unique($post_ids); - $message_ids = array_unique($message_ids); - $topic_ids = array_unique($topic_ids); - - // Update post indicators for posts now no longer having attachments - if (sizeof($post_ids)) - { - // Just check which posts are still having an assigned attachment not orphaned by querying the attachments table - $sql = 'SELECT post_msg_id - FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_msg_id', $post_ids) . ' - AND in_message = 0 - AND is_orphan = 0'; - $result = $db->sql_query($sql); - - $remaining_ids = array(); - while ($row = $db->sql_fetchrow($result)) - { - $remaining_ids[] = $row['post_msg_id']; - } - $db->sql_freeresult($result); - - // Now only unset those ids remaining - $post_ids = array_diff($post_ids, $remaining_ids); - - if (sizeof($post_ids)) - { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_attachment = 0 - WHERE ' . $db->sql_in_set('post_id', $post_ids); - $db->sql_query($sql); - } - } - - // Update message table if messages are affected - if (sizeof($message_ids)) - { - // Just check which messages are still having an assigned attachment not orphaned by querying the attachments table - $sql = 'SELECT post_msg_id - FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_msg_id', $message_ids) . ' - AND in_message = 1 - AND is_orphan = 0'; - $result = $db->sql_query($sql); - - $remaining_ids = array(); - while ($row = $db->sql_fetchrow($result)) - { - $remaining_ids[] = $row['post_msg_id']; - } - $db->sql_freeresult($result); - - // Now only unset those ids remaining - $message_ids = array_diff($message_ids, $remaining_ids); - - if (sizeof($message_ids)) - { - $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' - SET message_attachment = 0 - WHERE ' . $db->sql_in_set('msg_id', $message_ids); - $db->sql_query($sql); - } - } - - // Now update the topics. This is a bit trickier, because there could be posts still having attachments within the topic - if (sizeof($topic_ids)) - { - // Just check which topics are still having an assigned attachment not orphaned by querying the attachments table (much less entries expected) - $sql = 'SELECT topic_id - FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' - AND is_orphan = 0'; - $result = $db->sql_query($sql); - - $remaining_ids = array(); - while ($row = $db->sql_fetchrow($result)) - { - $remaining_ids[] = $row['topic_id']; - } - $db->sql_freeresult($result); - - // Now only unset those ids remaining - $topic_ids = array_diff($topic_ids, $remaining_ids); - - if (sizeof($topic_ids)) - { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_attachment = 0 - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); - } - } + unset($attachment_manager); return $num_deleted; } @@ -1147,8 +1142,6 @@ function delete_attachments($mode, $ids, $resync = true) * @param bool $auto_sync Will call sync() if this is true * * @return array Array with affected forums -* -* @author bantu */ function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true) { @@ -1254,27 +1247,19 @@ function update_posted_info(&$topic_ids) /** * Delete attached file +* +* @deprecated 3.2.0-a1 (To be removed: 3.4.0) */ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) { - global $db, $phpbb_root_path, $config; + global $phpbb_container; - // Because of copying topics or modifications a physical filename could be assigned more than once. If so, do not remove the file itself. - $sql = 'SELECT COUNT(attach_id) AS num_entries - FROM ' . ATTACHMENTS_TABLE . " - WHERE physical_filename = '" . $db->sql_escape(utf8_basename($filename)) . "'"; - $result = $db->sql_query($sql); - $num_entries = (int) $db->sql_fetchfield('num_entries'); - $db->sql_freeresult($result); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $unlink = $attachment_manager->unlink($filename, $mode, $entry_removed); + unset($attachment_manager); - // Do not remove file if at least one additional entry with the same name exist. - if (($entry_removed && $num_entries > 0) || (!$entry_removed && $num_entries > 1)) - { - return false; - } - - $filename = ($mode == 'thumbnail') ? 'thumb_' . utf8_basename($filename) : utf8_basename($filename); - return @unlink($phpbb_root_path . $config['upload_path'] . '/' . $filename); + return $unlink; } /** @@ -1358,7 +1343,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { case 'topic_moved': $db->sql_transaction('begin'); - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql4': case 'mysqli': @@ -1438,7 +1423,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, ITEM_DELETED => (!empty($topics_softdeleted)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_softdeleted) : '', ); - foreach ($topic_visiblities as $visibility => $sql_where) + foreach ($update_ary as $visibility => $sql_where) { if ($sql_where) { @@ -1727,7 +1712,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { $forum_data[$forum_id]['topics_approved'] = $row['total_topics']; } - else if ($row['topic_visibility'] == ITEM_UNAPPROVED) + else if ($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) { $forum_data[$forum_id]['topics_unapproved'] = $row['total_topics']; } @@ -1950,7 +1935,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { $topic_data[$topic_id]['posts_approved'] = $row['total_posts']; } - else if ($row['post_visibility'] == ITEM_UNAPPROVED) + else if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) { $topic_data[$topic_id]['posts_unapproved'] = $row['total_posts']; } @@ -1972,7 +1957,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_data[$topic_id]['first_post_id'] = (!empty($topic_data[$topic_id]['first_post_id'])) ? min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']) : $row['first_post_id']; $topic_data[$topic_id]['last_post_id'] = max($topic_data[$topic_id]['last_post_id'], $row['last_post_id']); - if ($topic_data[$topic_id]['visibility'] == ITEM_UNAPPROVED) + if ($topic_data[$topic_id]['visibility'] == ITEM_UNAPPROVED || $topic_data[$topic_id]['visibility'] == ITEM_REAPPROVE) { // Soft delete status is stronger than unapproved. $topic_data[$topic_id]['visibility'] = $row['post_visibility']; @@ -2024,7 +2009,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, AND u.user_id = p.poster_id'; $result = $db->sql_query($sql); - $post_ids = array(); while ($row = $db->sql_fetchrow($result)) { $topic_id = intval($row['topic_id']); @@ -2097,7 +2081,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, AND u.user_id = p.poster_id'; $result = $db->sql_query($sql); - $post_ids = array(); while ($row = $db->sql_fetchrow($result)) { $topic_id = (int) $row['topic_id']; @@ -2240,7 +2223,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, */ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true) { - global $db; + global $db, $phpbb_dispatcher; if (!is_array($forum_id)) { @@ -2275,6 +2258,26 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync $sql_and .= " AND topic_last_view_time < $prune_date"; } + if ($prune_mode == 'shadow') + { + $sql_and .= ' AND topic_status = ' . ITEM_MOVED . " AND topic_last_post_time < $prune_date"; + } + + /** + * Use this event to modify the SQL that selects topics to be pruned + * + * @event core.prune_sql + * @var string forum_id The forum id + * @var string prune_mode The prune mode + * @var string prune_date The prune date + * @var int prune_flags The prune flags + * @var bool auto_sync Whether or not to perform auto sync + * @var string sql_and SQL text appended to where clause + * @since 3.1.3-RC1 + */ + $vars = array('forum_id', 'prune_mode', 'prune_date', 'prune_flags', 'auto_sync', 'sql_and'); + extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); + $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " @@ -2316,7 +2319,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync */ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_freq) { - global $db; + global $db, $user, $phpbb_log; $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . " @@ -2337,7 +2340,7 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr WHERE forum_id = $forum_id"; $db->sql_query($sql); - add_log('admin', 'LOG_AUTO_PRUNE', $row['forum_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_AUTO_PRUNE', false, array($row['forum_name'])); } return; @@ -2348,7 +2351,7 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr * via admin_permissions. Changes of usernames and group names * must be carried through for the moderators table. * -* @param \phpbb\db\driver\driver $db Database connection +* @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\cache\driver\driver_interface Cache driver * @param \phpbb\auth\auth $auth Authentication object * @return null @@ -2359,10 +2362,10 @@ function phpbb_cache_moderators($db, $cache, $auth) $cache->destroy('sql', MODERATOR_CACHE_TABLE); // Clear table - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': - case 'firebird': + case 'sqlite3': $db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE); break; @@ -2372,7 +2375,7 @@ function phpbb_cache_moderators($db, $cache, $auth) } // We add moderators who have forum moderator permissions without an explicit ACL_NEVER setting - $hold_ary = $ug_id_ary = $sql_ary = array(); + $sql_ary = array(); // Grab all users having moderative options... $hold_ary = $auth->acl_user_raw_data(false, 'm_%', false); @@ -2409,7 +2412,7 @@ function phpbb_cache_moderators($db, $cache, $auth) AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . " AND ug.user_pending = 0 - AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char), + AND o.auth_option " . $db->sql_like_expression('m_' . $db->get_any_char()), ); $sql = $db->sql_build_query('SELECT', $sql_ary_deny); $result = $db->sql_query($sql); @@ -2436,6 +2439,7 @@ function phpbb_cache_moderators($db, $cache, $auth) { $usernames_ary[$row['user_id']] = $row['username']; } + $db->sql_freeresult($result); foreach ($hold_ary as $user_id => $forum_id_ary) { @@ -2525,20 +2529,6 @@ function phpbb_cache_moderators($db, $cache, $auth) } /** -* Cache moderators. Called whenever permissions are changed -* via admin_permissions. Changes of usernames and group names -* must be carried through for the moderators table. -* -* @deprecated 3.1 -* @return null -*/ -function cache_moderators() -{ - global $db, $cache, $auth; - return phpbb_cache_moderators($db, $cache, $auth); -} - -/** * View log * * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved @@ -2571,7 +2561,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id /** * Removes moderators and administrators from foe lists. * -* @param \phpbb\db\driver\driver $db Database connection +* @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\auth\auth $auth Authentication object * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore @@ -2629,11 +2619,11 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) return; } - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysqli': case 'mysql4': - $sql = 'DELETE ' . (($db->sql_layer === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=')) ? 'z.*' : ZEBRA_TABLE) . ' + $sql = 'DELETE ' . (($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=')) ? 'z.*' : ZEBRA_TABLE) . ' FROM ' . ZEBRA_TABLE . ' z, ' . USER_GROUP_TABLE . ' ug WHERE z.zebra_id = ug.user_id AND z.foe = 1 @@ -2688,20 +2678,6 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } /** -* Removes moderators and administrators from foe lists. -* -* @deprecated 3.1 -* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore -* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore -* @return null -*/ -function update_foes($group_id = false, $user_id = false) -{ - global $db, $auth; - return phpbb_update_foes($db, $auth, $group_id, $user_id); -} - -/** * Lists inactive users */ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC') @@ -2758,6 +2734,7 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li $users[] = $row; } + $db->sql_freeresult($result); return $offset; } @@ -2800,7 +2777,7 @@ function get_database_size() $database_size = false; // This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0 - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': @@ -2816,7 +2793,7 @@ function get_database_size() if (preg_match('#(3\.23|[45]\.)#', $version)) { - $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$db->dbname}`" : $db->dbname; + $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$db->get_db_name()}`" : $db->get_db_name(); $sql = 'SHOW TABLE STATUS FROM ' . $db_name; @@ -2845,18 +2822,8 @@ function get_database_size() } break; - case 'firebird': - global $dbname; - - // if it on the local machine, we can get lucky - if (file_exists($dbname)) - { - $database_size = filesize($dbname); - } - - break; - case 'sqlite': + case 'sqlite3': global $dbhost; if (file_exists($dbhost)) @@ -2869,8 +2836,24 @@ function get_database_size() case 'mssql': case 'mssql_odbc': case 'mssqlnative': + $sql = 'SELECT @@VERSION AS mssql_version'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize FROM sysfiles'; + + if ($row) + { + // Azure stats are stored elsewhere + if (strpos($row['mssql_version'], 'SQL Azure') !== false) + { + $sql = 'SELECT ((SUM(reserved_page_count) * 8.0) * 1024.0) as dbsize + FROM sys.dm_db_partition_stats'; + } + } + $result = $db->sql_query($sql, 7200); $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; $db->sql_freeresult($result); @@ -2886,7 +2869,7 @@ function get_database_size() if ($row['proname'] == 'pg_database_size') { - $database = $db->dbname; + $database = $db->get_db_name(); if (strpos($database, '.') !== false) { list($database, ) = explode('.', $database); @@ -2924,73 +2907,7 @@ function get_database_size() return $database_size; } -/** -* Retrieve contents from remotely stored file -*/ -function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6) -{ - global $user; - - if ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) - { - @fputs($fsock, "GET $directory/$filename HTTP/1.0\r\n"); - @fputs($fsock, "HOST: $host\r\n"); - @fputs($fsock, "Connection: close\r\n\r\n"); - - $timer_stop = time() + $timeout; - stream_set_timeout($fsock, $timeout); - - $file_info = ''; - $get_info = false; - - while (!@feof($fsock)) - { - if ($get_info) - { - $file_info .= @fread($fsock, 1024); - } - else - { - $line = @fgets($fsock, 1024); - if ($line == "\r\n") - { - $get_info = true; - } - else if (stripos($line, '404 not found') !== false) - { - $errstr = $user->lang['FILE_NOT_FOUND'] . ': ' . $filename; - return false; - } - } - - $stream_meta_data = stream_get_meta_data($fsock); - - if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) - { - $errstr = $user->lang['FSOCK_TIMEOUT']; - return false; - } - } - @fclose($fsock); - } - else - { - if ($errstr) - { - $errstr = utf8_convert_message($errstr); - return false; - } - else - { - $errstr = $user->lang['FSOCK_DISABLED']; - return false; - } - } - - return $file_info; -} - -/** +/* * Tidy Warnings * Remove all warnings which have now expired from the database * The duration of a warning can be defined by the administrator @@ -3033,7 +2950,7 @@ function tidy_warnings() $db->sql_transaction('commit'); } - set_config('warnings_last_gc', time(), true); + $config->set('warnings_last_gc', time(), false); } /** @@ -3041,7 +2958,7 @@ function tidy_warnings() */ function tidy_database() { - global $db; + global $config, $db; // Here we check permission consistency @@ -3066,7 +2983,7 @@ function tidy_database() WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true); $db->sql_query($sql); - set_config('database_last_gc', time(), true); + $config->set('database_last_gc', time(), false); } /** @@ -3100,45 +3017,6 @@ function add_permission_language() } /** - * Obtains the latest version information - * - * @param bool $force_update Ignores cached data. Defaults to false. - * @param bool $warn_fail Trigger a warning if obtaining the latest version information fails. Defaults to false. - * @param int $ttl Cache version information for $ttl seconds. Defaults to 86400 (24 hours). - * - * @return string | false Version info on success, false on failure. - */ -function obtain_latest_version_info($force_update = false, $warn_fail = false, $ttl = 86400) -{ - global $cache; - - $info = $cache->get('versioncheck'); - - if ($info === false || $force_update) - { - $errstr = ''; - $errno = 0; - - $info = get_remote_file('version.phpbb.com', '/phpbb', - ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); - - if (empty($info)) - { - $cache->destroy('versioncheck'); - if ($warn_fail) - { - trigger_error($errstr, E_USER_WARNING); - } - return false; - } - - $cache->put('versioncheck', $info, $ttl); - } - - return $info; -} - -/** * Enables a particular flag in a bitfield column of a given table. * * @param string $table_name The table to update diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 2197815087..4b085a6050 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -26,10 +30,11 @@ if (!defined('IN_PHPBB')) * @param string $avatar_height Height of users avatar * @param string $alt Optional language string for alt tag within image, can be a language key or text * @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) * * @return string Avatar image */ -function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false) +function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false, $lazy = false) { // map arguments to new function phpbb_get_avatar() $row = array( @@ -39,12 +44,470 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ 'avatar_height' => $avatar_height, ); - if (!function_exists('phpbb_get_avatar')) + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Hash the password +* +* @deprecated 3.1.0-a2 (To be removed: 3.3.0) +* +* @param string $password Password to be hashed +* +* @return string|bool Password hash or false if something went wrong during hashing +*/ +function phpbb_hash($password) +{ + global $phpbb_container; + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + return $passwords_manager->hash($password); +} + +/** +* Check for correct password +* +* @deprecated 3.1.0-a2 (To be removed: 3.3.0) +* +* @param string $password The password in plain text +* @param string $hash The stored password hash +* +* @return bool Returns true if the password is correct, false if not. +*/ +function phpbb_check_hash($password, $hash) +{ + global $phpbb_container; + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + return $passwords_manager->check($password, $hash); +} + +/** +* Eliminates useless . and .. components from specified path. +* +* Deprecated, use filesystem class instead +* +* @param string $path Path to clean +* @return string Cleaned path +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +*/ +function phpbb_clean_path($path) +{ + global $phpbb_path_helper, $phpbb_container; + + if (!$phpbb_path_helper && $phpbb_container) + { + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + } + else if (!$phpbb_path_helper) { global $phpbb_root_path, $phpEx; + // The container is not yet loaded, use a new instance + if (!class_exists('\phpbb\path_helper')) + { + require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); + } + + $request = new phpbb\request\request(); + $phpbb_path_helper = new phpbb\path_helper( + new phpbb\symfony_request( + $request + ), + new phpbb\filesystem\filesystem(), + $request, + $phpbb_root_path, + $phpEx + ); + } + + return $phpbb_path_helper->clean_path($path); +} + +/** +* Pick a timezone +* +* @param string $default A timezone to select +* @param boolean $truncate Shall we truncate the options text +* +* @return string Returns the options for timezone selector only +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +*/ +function tz_select($default = '', $truncate = false) +{ + global $template, $user; + + return phpbb_timezone_select($template, $user, $default, $truncate); +} + +/** +* Cache moderators. Called whenever permissions are changed +* via admin_permissions. Changes of usernames and group names +* must be carried through for the moderators table. +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +* @return null +*/ +function cache_moderators() +{ + global $db, $cache, $auth; + return phpbb_cache_moderators($db, $cache, $auth); +} + +/** +* Removes moderators and administrators from foe lists. +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore +* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore +* @return null +*/ +function update_foes($group_id = false, $user_id = false) +{ + global $db, $auth; + return phpbb_update_foes($db, $auth, $group_id, $user_id); +} + +/** +* Get user rank title and image +* +* @param int $user_rank the current stored users rank id +* @param int $user_posts the users number of posts +* @param string &$rank_title the rank title will be stored here after execution +* @param string &$rank_img the rank image as full img tag is stored here after execution +* @param string &$rank_img_src the rank image source is stored here after execution +* +* @deprecated 3.1.0-RC5 (To be removed: 3.3.0) +* +* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false +*/ +function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) +{ + global $phpbb_root_path, $phpEx; + if (!function_exists('phpbb_get_user_rank')) + { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } - return phpbb_get_avatar($row, $alt, $ignore_config); + $rank_data = phpbb_get_user_rank(array('user_rank' => $user_rank), $user_posts); + $rank_title = $rank_data['title']; + $rank_img = $rank_data['img']; + $rank_img_src = $rank_data['img_src']; +} + +/** + * Retrieve contents from remotely stored file + * + * @deprecated 3.1.2 Use file_downloader instead + */ +function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6) +{ + global $phpbb_container; + + // Get file downloader and assign $errstr and $errno + /* @var $file_downloader \phpbb\file_downloader */ + $file_downloader = $phpbb_container->get('file_downloader'); + + $file_data = $file_downloader->get($host, $directory, $filename, $port, $timeout); + $errstr = $file_downloader->get_error_string(); + $errno = $file_downloader->get_error_number(); + + return $file_data; +} + +/** + * Add log entry + * + * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved + * @param int $forum_id Mode 'mod' ONLY: forum id of the related item, NOT INCLUDED otherwise + * @param int $topic_id Mode 'mod' ONLY: topic id of the related item, NOT INCLUDED otherwise + * @param int $reportee_id Mode 'user' ONLY: user id of the reportee, NOT INCLUDED otherwise + * @param string $log_operation Name of the operation + * @param array $additional_data More arguments can be added, depending on the log_type + * + * @return int|bool Returns the log_id, if the entry was added to the database, false otherwise. + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function add_log() +{ + global $phpbb_log, $user; + + $args = func_get_args(); + $mode = array_shift($args); + + // This looks kind of dirty, but add_log has some additional data before the log_operation + $additional_data = array(); + switch ($mode) + { + case 'admin': + case 'critical': + break; + case 'mod': + $additional_data['forum_id'] = array_shift($args); + $additional_data['topic_id'] = array_shift($args); + break; + case 'user': + $additional_data['reportee_id'] = array_shift($args); + break; + } + + $log_operation = array_shift($args); + $additional_data = array_merge($additional_data, $args); + + $user_id = (empty($user->data)) ? ANONYMOUS : $user->data['user_id']; + $user_ip = (empty($user->ip)) ? '' : $user->ip; + + return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data); +} + +/** + * Sets a configuration option's value. + * + * Please note that this function does not update the is_dynamic value for + * an already existing config option. + * + * @param string $config_name The configuration option's name + * @param string $config_value New configuration value + * @param bool $is_dynamic Whether this variable should be cached (false) or + * if it changes too frequently (true) to be + * efficiently cached. + * + * @return null + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null) +{ + static $config = null; + + if ($set_config !== null) + { + $config = $set_config; + + if (empty($config_name)) + { + return; + } + } + + $config->set($config_name, $config_value, !$is_dynamic); +} + +/** + * Increments an integer config value directly in the database. + * + * @param string $config_name The configuration option's name + * @param int $increment Amount to increment by + * @param bool $is_dynamic Whether this variable should be cached (false) or + * if it changes too frequently (true) to be + * efficiently cached. + * + * @return null + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null) +{ + static $config = null; + if ($set_config !== null) + { + $config = $set_config; + if (empty($config_name)) + { + return; + } + } + $config->increment($config_name, $increment, !$is_dynamic); +} + +/** + * Wrapper function of \phpbb\request\request::variable which exists for backwards compatability. + * See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for + * documentation of this function's use. + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + * @param mixed $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * If you pass an instance of {@link \phpbb\request\request_interface phpbb_request_interface} + * as this parameter it will overwrite the current request class instance. If you do + * not do so, it will create its own instance (but leave superglobals enabled). + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param bool $cookie This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for + * \phpbb\request\request_interface::variable for backwards compatability reasons. + * @param \phpbb\request\request_interface|null|false If an instance of \phpbb\request\request_interface is given the instance is stored in + * a static variable and used for all further calls where this parameters is null. Until + * the function is called with an instance it automatically creates a new \phpbb\request\request + * instance on every call. By passing false this per-call instantiation can be restored + * after having passed in a \phpbb\request\request_interface instance. + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ +function request_var($var_name, $default, $multibyte = false, $cookie = false, $request = null) +{ + // This is all just an ugly hack to add "Dependency Injection" to a function + // the only real code is the function call which maps this function to a method. + static $static_request = null; + if ($request instanceof \phpbb\request\request_interface) + { + $static_request = $request; + if (empty($var_name)) + { + return; + } + } + else if ($request === false) + { + $static_request = null; + if (empty($var_name)) + { + return; + } + } + $tmp_request = $static_request; + // no request class set, create a temporary one ourselves to keep backwards compatibility + if ($tmp_request === null) + { + // false param: enable super globals, so the created request class does not + // make super globals inaccessible everywhere outside this function. + $tmp_request = new \phpbb\request\request(new \phpbb\request\type_cast_helper(), false); + } + return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST); +} + +/** + * Get tables of a database + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function get_tables(&$db) +{ + $db_tools_factory = new \phpbb\db\tools\factory(); + $db_tools = $db_tools_factory->get($db); + + return $db_tools->sql_list_tables(); +} + +/** + * Global function for chmodding directories and files for internal use + * + * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. + * The function determines owner and group from common.php file and sets the same to the provided file. + * The function uses bit fields to build the permissions. + * The function sets the appropiate execute bit on directories. + * + * Supported constants representing bit fields are: + * + * CHMOD_ALL - all permissions (7) + * CHMOD_READ - read permission (4) + * CHMOD_WRITE - write permission (2) + * CHMOD_EXECUTE - execute permission (1) + * + * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. + * + * @param string $filename The file/directory to be chmodded + * @param int $perms Permissions to set + * + * @return bool true on success, otherwise false + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::phpbb_chmod() instead + */ +function phpbb_chmod($filename, $perms = CHMOD_READ) +{ + global $phpbb_filesystem; + + try + { + $phpbb_filesystem->phpbb_chmod($filename, $perms); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + return false; + } + + return true; +} + +/** + * Test if a file/directory is writable + * + * This function calls the native is_writable() when not running under + * Windows and it is not disabled. + * + * @param string $file Path to perform write test on + * @return bool True when the path is writable, otherwise false. + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::is_writable() instead + */ +function phpbb_is_writable($file) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->is_writable($file); +} + +/** + * Checks if a path ($path) is absolute or relative + * + * @param string $path Path to check absoluteness of + * @return boolean + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::is_absolute_path() instead + */ +function phpbb_is_absolute($path) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->is_absolute_path($path); +} + +/** + * A wrapper for realpath + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::realpath() instead + */ +function phpbb_realpath($path) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->realpath($path); +} + +/** + * Determine which plural form we should use. + * For some languages this is not as simple as for English. + * + * @param $rule int ID of the plural rule we want to use, see http://wiki.phpbb.com/Plural_Rules#Plural_Rules + * @param $number int|float The number we want to get the plural case for. Float numbers are floored. + * @return int The plural-case we need to use for the number plural-rule combination + * + * @deprecated 3.2.0-dev (To be removed: 3.3.0) + */ +function phpbb_get_plural_form($rule, $number) +{ + global $phpbb_container; + + /** @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + return $language->get_plural_form($number, $rule); +} + +/** +* @return bool Always true +* @deprecated 3.2.0-dev +*/ +function phpbb_pcre_utf8_support() +{ + return true; } diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 39a1b2ad21..910708f502 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * Class for handling archives (compression/decompression) -* @package phpBB3 */ class compress { @@ -53,7 +56,6 @@ class compress // Clean up path, add closing / if not present $src_path = ($src_path && substr($src_path, -1) != '/') ? $src_path . '/' : $src_path; - $filelist = array(); $filelist = filelist("$phpbb_root_path$src", '', '*'); krsort($filelist); @@ -181,17 +183,15 @@ class compress } /** -* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, +* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, * Marc Delisle, http://www.phpmyadmin.net/ * * Zip extraction function by Alexandre Tedeschi, alexandrebr at gmail dot com * -* Modified extensively by psoTFX and DavidMJ, (c) phpBB Group, 2003 +* Modified extensively by psoTFX and DavidMJ, (c) phpBB Limited, 2003 * * Based on work by Eric Mueller and Denis125 * Official ZIP file format: http://www.pkware.com/appnote.txt -* -* @package phpBB3 */ class compress_zip extends compress { @@ -203,11 +203,19 @@ class compress_zip extends compress var $datasec_len = 0; /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** * Constructor */ function compress_zip($mode, $file) { + global $phpbb_filesystem; + $this->fp = @fopen($file, $mode . 'b'); + $this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem(); if (!$this->fp) { @@ -285,7 +293,15 @@ class compress_zip extends compress { trigger_error("Could not create directory $folder"); } - phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } } } } @@ -314,7 +330,15 @@ class compress_zip extends compress { trigger_error("Could not create directory $folder"); } - phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } } } } @@ -508,7 +532,7 @@ class compress_zip extends compress $mimetype = 'application/zip'; - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"$download_name.zip\""); header("Content-disposition: attachment; filename=$download_name.zip"); @@ -527,8 +551,6 @@ class compress_zip extends compress /** * Tar/tar.gz compression routine * Header/checksum creation derived from tarfile.pl, (c) Tom Horsley, 1994 -* -* @package phpBB3 */ class compress_tar extends compress { @@ -540,10 +562,17 @@ class compress_tar extends compress var $wrote = false; /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** * Constructor */ function compress_tar($mode, $file, $type = '') { + global $phpbb_filesystem; + $type = (!$type) ? $file : $type; $this->isgz = preg_match('#(\.tar\.gz|\.tgz)$#', $type); $this->isbz = preg_match('#\.tar\.bz2$#', $type); @@ -552,6 +581,8 @@ class compress_tar extends compress $this->file = &$file; $this->type = &$type; $this->open(); + + $this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem(); } /** @@ -602,7 +633,15 @@ class compress_tar extends compress { trigger_error("Could not create directory $folder"); } - phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } } } } @@ -629,7 +668,15 @@ class compress_tar extends compress { trigger_error("Could not create directory $folder"); } - phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } } } @@ -638,7 +685,15 @@ class compress_tar extends compress { trigger_error("Couldn't create file $filename"); } - phpbb_chmod($target_filename, CHMOD_READ); + + try + { + $this->filesystem->phpbb_chmod($target_filename, CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } // Grab the file contents fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize); @@ -758,7 +813,7 @@ class compress_tar extends compress break; } - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"$download_name$this->type\""); header("Content-disposition: attachment; filename=$download_name$this->type"); diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php deleted file mode 100644 index 667d27fd20..0000000000 --- a/phpBB/includes/functions_container.php +++ /dev/null @@ -1,287 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Dumper\PhpDumper; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Get DB connection from config.php. -* -* Used to bootstrap the container. -* -* @param string $config_file -* @return \phpbb\db\driver\driver -*/ -function phpbb_bootstrap_db_connection($config_file) -{ - require($config_file); - $dbal_driver_class = phpbb_convert_30_dbms_to_31($dbms); - - $db = new $dbal_driver_class(); - $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, defined('PHPBB_DB_NEW_LINK')); - - return $db; -} - -/** -* Get table prefix from config.php. -* -* Used to bootstrap the container. -* -* @param string $config_file -* @return string table prefix -*/ -function phpbb_bootstrap_table_prefix($config_file) -{ - require($config_file); - return $table_prefix; -} - -/** -* Get enabled extensions. -* -* Used to bootstrap the container. -* -* @param string $config_file -* @param string $phpbb_root_path -* @return array enabled extensions -*/ -function phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path) -{ - $db = phpbb_bootstrap_db_connection($config_file); - $table_prefix = phpbb_bootstrap_table_prefix($config_file); - $extension_table = $table_prefix.'ext'; - - $sql = 'SELECT * - FROM ' . $extension_table . ' - WHERE ext_active = 1'; - - $result = $db->sql_query($sql); - $rows = $db->sql_fetchrowset($result); - $db->sql_freeresult($result); - - $exts = array(); - foreach ($rows as $row) - { - $exts[$row['ext_name']] = $phpbb_root_path . 'ext/' . $row['ext_name'] . '/'; - } - - return $exts; -} - -/** -* Create the ContainerBuilder object -* -* @param array $extensions Array of Container extension objects -* @param string $phpbb_root_path Root path -* @param string $php_ext PHP Extension -* @return ContainerBuilder object -*/ -function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) -{ - $container = new ContainerBuilder(); - - foreach ($extensions as $extension) - { - $container->registerExtension($extension); - $container->loadFromExtension($extension->getAlias()); - } - - $container->setParameter('core.root_path', $phpbb_root_path); - $container->setParameter('core.php_ext', $php_ext); - - return $container; -} - -/** -* Create installer container -* -* @param string $phpbb_root_path Root path -* @param string $php_ext PHP Extension -* @return ContainerBuilder object -*/ -function phpbb_create_install_container($phpbb_root_path, $php_ext) -{ - $other_config_path = $phpbb_root_path . 'install/update/new/config/'; - $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; - - $core = new \phpbb\di\extension\core($config_path); - $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); - - $container->setParameter('core.root_path', $phpbb_root_path); - $container->setParameter('core.adm_relative_path', $phpbb_adm_relative_path); - $container->setParameter('core.php_ext', $php_ext); - $container->setParameter('core.table_prefix', ''); - - $container->register('dbal.conn')->setSynthetic(true); - - $container->setAlias('cache.driver', 'cache.driver.install'); - - $container->compile(); - - return $container; -} - -/** -* Create updater container -* -* @param string $phpbb_root_path Root path -* @param string $php_ext PHP Extension -* @param array $config_path Path to config directory -* @return ContainerBuilder object (compiled) -*/ -function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) -{ - $config_file = $phpbb_root_path . 'config.' . $php_ext; - return phpbb_create_compiled_container( - $config_file, - array( - new phpbb\di\extension\config($config_file), - new phpbb\di\extension\core($config_path), - ), - array( - new phpbb\di\pass\collection_pass(), - new phpbb\di\pass\kernel_pass(), - ), - $phpbb_root_path, - $php_ext - ); -} - -/** -* Create a compiled ContainerBuilder object -* -* @param array $extensions Array of Container extension objects -* @param array $passes Array of Compiler Pass objects -* @param string $phpbb_root_path Root path -* @param string $php_ext PHP Extension -* @return ContainerBuilder object (compiled) -*/ -function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext) -{ - // Create the final container to be compiled and cached - $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext); - - // Compile the container - foreach ($passes as $pass) - { - $container->addCompilerPass($pass); - } - $container->compile(); - - return $container; -} - -/** -* Create a compiled and dumped ContainerBuilder object -* -* @param array $extensions Array of Container extension objects -* @param array $passes Array of Compiler Pass objects -* @param string $phpbb_root_path Root path -* @param string $php_ext PHP Extension -* @return ContainerBuilder object (compiled) -*/ -function phpbb_create_dumped_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext) -{ - // Check for our cached container; if it exists, use it - $container_filename = phpbb_container_filename($phpbb_root_path, $php_ext); - if (file_exists($container_filename)) - { - require($container_filename); - return new phpbb_cache_container(); - } - - $container = phpbb_create_compiled_container($config_file, $extensions, $passes, $phpbb_root_path, $php_ext); - - // Lastly, we create our cached container class - $dumper = new PhpDumper($container); - $cached_container_dump = $dumper->dump(array( - 'class' => 'phpbb_cache_container', - 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder', - )); - - file_put_contents($container_filename, $cached_container_dump); - - return $container; -} - -/** -* Create an environment-specific ContainerBuilder object -* -* If debug is enabled, the container is re-compiled every time. -* This ensures that the latest changes will always be reflected -* during development. -* -* Otherwise it will get the existing dumped container and use -* that one instead. -* -* @param array $extensions Array of Container extension objects -* @param array $passes Array of Compiler Pass objects -* @param string $phpbb_root_path Root path -* @param string $php_ext PHP Extension -* @return ContainerBuilder object (compiled) -*/ -function phpbb_create_dumped_container_unless_debug($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext) -{ - $container_factory = defined('DEBUG') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container'; - return $container_factory($config_file, $extensions, $passes, $phpbb_root_path, $php_ext); -} - -/** -* Create a default ContainerBuilder object -* -* Contains the default configuration of the phpBB container. -* -* @param array $extensions Array of Container extension objects -* @param array $passes Array of Compiler Pass objects -* @return ContainerBuilder object (compiled) -*/ -function phpbb_create_default_container($phpbb_root_path, $php_ext) -{ - $config_file = $phpbb_root_path . 'config.' . $php_ext; - $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); - - return phpbb_create_dumped_container_unless_debug( - $config_file, - array( - new \phpbb\di\extension\config($config_file), - new \phpbb\di\extension\core($phpbb_root_path . 'config'), - new \phpbb\di\extension\ext($installed_exts), - ), - array( - new \phpbb\di\pass\collection_pass(), - new \phpbb\di\pass\kernel_pass(), - ), - $phpbb_root_path, - $php_ext - ); -} - -/** -* Get the filename under which the dumped container will be stored. -* -* @param string $phpbb_root_path Root path -* @param string $php_ext PHP Extension -* @return Path for dumped container -*/ -function phpbb_container_filename($phpbb_root_path, $php_ext) -{ - $filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path); - return $phpbb_root_path . 'cache/container_' . $filename . '.' . $php_ext; -} diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 8122b87e4b..df25451266 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,6 +24,7 @@ if (!defined('IN_PHPBB')) * make_jumpbox() * bump_topic_allowed() * get_context() +* phpbb_clean_search_string() * decode_message() * strip_bbcode() * generate_text_for_display() @@ -73,7 +78,7 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, foreach ($sorts as $name => $sort_ary) { $key = $sort_ary['key']; - $selected = $$sort_ary['key']; + $selected = ${$sort_ary['key']}; // Check if the key is selectable. If not, we reset to the default or first key found. // This ensures the values are always valid. We also set $sort_dir/sort_key/etc. to the @@ -82,12 +87,12 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, { if ($sort_ary['default'] !== false) { - $selected = $$key = $sort_ary['default']; + $selected = ${$key} = $sort_ary['default']; } else { @reset($sort_ary['options']); - $selected = $$key = key($sort_ary['options']); + $selected = ${$key} = key($sort_ary['options']); } } @@ -109,7 +114,7 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, */ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false) { - global $config, $auth, $template, $user, $db; + global $config, $auth, $template, $user, $db, $phpbb_path_helper; // We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality) if (!$config['load_jumpbox'] && $force_display === false) @@ -169,8 +174,9 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list $template->assign_block_vars('jumpbox_forums', array( 'FORUM_ID' => ($select_all) ? 0 : -1, 'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'], - 'S_FORUM_COUNT' => $iteration) - ); + 'S_FORUM_COUNT' => $iteration, + 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $forum_id)), + )); $iteration++; $display_jumpbox = true; @@ -183,8 +189,9 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list 'S_FORUM_COUNT' => $iteration, 'S_IS_CAT' => ($row['forum_type'] == FORUM_CAT) ? true : false, 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, - 'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false) - ); + 'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false, + 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $row['forum_id'])), + )); for ($i = 0; $i < $padding; $i++) { @@ -195,10 +202,13 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list $db->sql_freeresult($result); unset($padding_store); + $url_parts = $phpbb_path_helper->get_url_parts($action); + $template->assign_vars(array( - 'S_DISPLAY_JUMPBOX' => $display_jumpbox, - 'S_JUMPBOX_ACTION' => $action) - ); + 'S_DISPLAY_JUMPBOX' => $display_jumpbox, + 'S_JUMPBOX_ACTION' => $action, + 'HIDDEN_FIELDS_FOR_JUMPBOX' => build_hidden_fields($url_parts['params']), + )); return; } @@ -360,48 +370,87 @@ function get_context($text, $words, $length = 400) } /** +* Cleans a search string by removing single wildcards from it and replacing multiple spaces with a single one. +* +* @param string $search_string The full search string which should be cleaned. +* +* @return string The cleaned search string without any wildcards and multiple spaces. +*/ +function phpbb_clean_search_string($search_string) +{ + // This regular expressions matches every single wildcard. + // That means one after a whitespace or the beginning of the string or one before a whitespace or the end of the string. + $search_string = preg_replace('#(?<=^|\s)\*+(?=\s|$)#', '', $search_string); + $search_string = trim($search_string); + $search_string = preg_replace(array('#\s+#u', '#\*+#u'), array(' ', '*'), $search_string); + return $search_string; +} + +/** * Decode text whereby text is coming from the db and expected to be pre-parsed content * We are placing this outside of the message parser because we are often in need of it... +* +* NOTE: special chars are kept encoded +* +* @param string &$message Original message, passed by reference +* @param string $bbcode_uid BBCode UID +* @return null */ function decode_message(&$message, $bbcode_uid = '') { - global $config; + global $phpbb_container; - if ($bbcode_uid) + if (preg_match('#^<[rt][ >]#', $message)) { - $match = array('<br />', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid"); - $replace = array("\n", '', '', '', ''); + $message = htmlspecialchars($phpbb_container->get('text_formatter.utils')->unparse($message), ENT_COMPAT); } else { - $match = array('<br />'); - $replace = array("\n"); - } + if ($bbcode_uid) + { + $match = array('<br />', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid"); + $replace = array("\n", '', '', '', ''); + } + else + { + $match = array('<br />'); + $replace = array("\n"); + } - $message = str_replace($match, $replace, $message); + $message = str_replace($match, $replace, $message); - $match = get_preg_expression('bbcode_htm'); - $replace = array('\1', '\1', '\2', '\1', '', ''); + $match = get_preg_expression('bbcode_htm'); + $replace = array('\1', '\1', '\3', '\1', '', ''); - $message = preg_replace($match, $replace, $message); + $message = preg_replace($match, $replace, $message); + } } /** -* Strips all bbcode from a text and returns the plain content +* Strips all bbcode from a text in place */ function strip_bbcode(&$text, $uid = '') { - if (!$uid) + global $phpbb_container; + + if (preg_match('#^<[rt][ >]#', $text)) { - $uid = '[0-9a-z]{5,}'; + $text = $phpbb_container->get('text_formatter.utils')->clean_formatting($text); } + else + { + if (!$uid) + { + $uid = '[0-9a-z]{5,}'; + } - $text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:$uid)\]#", ' ', $text); + $text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:$uid)\]#", ' ', $text); - $match = get_preg_expression('bbcode_htm'); - $replace = array('\1', '\1', '\2', '\1', '', ''); + $match = get_preg_expression('bbcode_htm'); + $replace = array('\1', '\1', '\2', '\1', '', ''); - $text = preg_replace($match, $replace, $text); + $text = preg_replace($match, $replace, $text); + } } /** @@ -411,7 +460,7 @@ function strip_bbcode(&$text, $uid = '') function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true) { static $bbcode; - global $phpbb_dispatcher; + global $phpbb_dispatcher, $phpbb_container; if ($text === '') { @@ -427,39 +476,61 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * @var string bitfield The BBCode Bitfield * @var int flags The BBCode Flags * @var bool censor_text Whether or not to apply word censors - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('text', 'uid', 'bitfield', 'flags', 'censor_text'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_before', compact($vars))); - if ($censor_text) - { - $text = censor_text($text); - } - - // Parse bbcode if bbcode uid stored and bbcode enabled - if ($uid && ($flags & OPTION_FLAG_BBCODE)) + if (preg_match('#^<[rt][ >]#', $text)) { - if (!class_exists('bbcode')) + $renderer = $phpbb_container->get('text_formatter.renderer'); + + // Temporarily switch off viewcensors if applicable + $old_censor = $renderer->get_viewcensors(); + if ($old_censor !== $censor_text) { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + $renderer->set_viewcensors($censor_text); } - if (empty($bbcode)) + $text = $renderer->render($text); + + // Restore the previous value + if ($old_censor !== $censor_text) { - $bbcode = new bbcode($bitfield); + $renderer->set_viewcensors($old_censor); } - else + } + else + { + if ($censor_text) { - $bbcode->bbcode($bitfield); + $text = censor_text($text); } - $bbcode->bbcode_second_pass($text, $uid); - } + // Parse bbcode if bbcode uid stored and bbcode enabled + if ($uid && ($flags & OPTION_FLAG_BBCODE)) + { + if (!class_exists('bbcode')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + } - $text = bbcode_nl2br($text); - $text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); + if (empty($bbcode)) + { + $bbcode = new bbcode($bitfield); + } + else + { + $bbcode->bbcode($bitfield); + } + + $bbcode->bbcode_second_pass($text, $uid); + } + + $text = bbcode_nl2br($text); + $text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); + } /** * Use this event to modify the text after it is parsed @@ -469,7 +540,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * @var string uid The BBCode UID * @var string bitfield The BBCode Bitfield * @var int flags The BBCode Flags - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('text', 'uid', 'bitfield', 'flags'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_after', compact($vars))); @@ -480,8 +551,8 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text /** * For parsing custom parsed text to be stored within the database. * This function additionally returns the uid and bitfield that needs to be stored. -* Expects $text to be the value directly from request_var() and in it's non-parsed form -* +* Expects $text to be the value directly from $request->variable() and in it's non-parsed form +* * @param string $text The text to be replaced with the parsed one * @param string $uid The BBCode uid for this parse * @param string $bitfield The BBCode bitfield for this parse @@ -489,10 +560,15 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * @param bool $allow_bbcode If BBCode is allowed (i.e. if BBCode is parsed) * @param bool $allow_urls If urls is allowed * @param bool $allow_smilies If smilies are allowed +* @param bool $allow_img_bbcode +* @param bool $allow_flash_bbcode +* @param bool $allow_quote_bbcode +* @param bool $allow_url_bbcode +* @param string $mode Mode to parse text as, e.g. post or sig * * @return array An array of string with the errors that occurred while parsing */ -function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false) +function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $mode = 'post') { global $phpbb_root_path, $phpEx, $phpbb_dispatcher; @@ -507,26 +583,40 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb * @var bool allow_bbcode Whether or not to parse BBCode * @var bool allow_urls Whether or not to parse URLs * @var bool allow_smilies Whether or not to parse Smilies - * @since 3.1-A1 + * @var bool allow_img_bbcode Whether or not to parse the [img] BBCode + * @var bool allow_flash_bbcode Whether or not to parse the [flash] BBCode + * @var bool allow_quote_bbcode Whether or not to parse the [quote] BBCode + * @var bool allow_url_bbcode Whether or not to parse the [url] BBCode + * @var string mode Mode to parse text as, e.g. post or sig + * @since 3.1.0-a1 + * @changed 3.2.0-a1 */ - $vars = array('text', 'uid', 'bitfield', 'flags', 'allow_bbcode', 'allow_urls', 'allow_smilies'); + $vars = array( + 'text', + 'uid', + 'bitfield', + 'flags', + 'allow_bbcode', + 'allow_urls', + 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', + 'mode', + ); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars))); $uid = $bitfield = ''; $flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0); - if ($text === '') - { - return; - } - if (!class_exists('parse_message')) { include($phpbb_root_path . 'includes/message_parser.' . $phpEx); } $message_parser = new parse_message($text); - $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies); + $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, true, $mode); $text = $message_parser->message; $uid = $message_parser->bbcode_uid; @@ -547,7 +637,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb * @var string uid The BBCode UID * @var string bitfield The BBCode Bitfield * @var int flags The BBCode Flags - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('text', 'uid', 'bitfield', 'flags'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_after', compact($vars))); @@ -561,7 +651,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb */ function generate_text_for_edit($text, $uid, $flags) { - global $phpbb_root_path, $phpEx, $phpbb_dispatcher; + global $phpbb_dispatcher; /** * Use this event to modify the text before it is decoded for editing @@ -570,7 +660,7 @@ function generate_text_for_edit($text, $uid, $flags) * @var string text The text to parse * @var string uid The BBCode UID * @var int flags The BBCode Flags - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('text', 'uid', 'flags'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_before', compact($vars))); @@ -583,7 +673,7 @@ function generate_text_for_edit($text, $uid, $flags) * @event core.modify_text_for_edit_after * @var string text The text to parse * @var int flags The BBCode Flags - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('text', 'flags'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_after', compact($vars))); @@ -677,7 +767,7 @@ function make_clickable_callback($type, $whitespace, $url, $relative_url, $class break; } - $short_url = (strlen($url) > 55) ? substr($url, 0, 39) . ' ... ' . substr($url, -10) : $url; + $short_url = (utf8_strlen($url) > 55) ? utf8_substr($url, 0, 39) . ' ... ' . utf8_substr($url, -10) : $url; switch ($type) { @@ -740,44 +830,47 @@ function make_clickable($text, $server_url = false, $class = 'postlink') static $static_class; static $magic_url_match_args; - if (!is_array($magic_url_match_args) || $static_class != $class) + if (!isset($magic_url_match_args[$server_url]) || $static_class != $class) { $static_class = $class; $class = ($static_class) ? ' class="' . $static_class . '"' : ''; $local_class = ($static_class) ? ' class="' . $static_class . '-local"' : ''; - $magic_url_match_args = array(); + if (!is_array($magic_url_match_args)) + { + $magic_url_match_args = array(); + } // relative urls for this board - $magic_url_match_args[] = array( - '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#i', + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#iu', MAGIC_URL_LOCAL, $local_class, ); // matches a xxxx://aaaaa.bbb.cccc. ... - $magic_url_match_args[] = array( - '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#i', + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#iu', MAGIC_URL_FULL, $class, ); // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing - $magic_url_match_args[] = array( - '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#i', + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#iu', MAGIC_URL_WWW, $class, ); // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. - $magic_url_match_args[] = array( - '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/i', + $magic_url_match_args[$server_url][] = array( + '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/iu', MAGIC_URL_EMAIL, '', ); } - foreach ($magic_url_match_args as $magic_args) + foreach ($magic_url_match_args[$server_url] as $magic_args) { if (preg_match($magic_args[0], $text, $matches)) { @@ -864,17 +957,17 @@ function smiley_text($text, $force_option = false) * @param mixed $forum_id The forum id the attachments are displayed in (false if in private message) * @param string &$message The post/private message * @param array &$attachments The attachments to parse for (inline) display. The attachments array will hold templated data after parsing. -* @param array &$update_count The attachment counts to be updated - will be filled +* @param array &$update_count_ary The attachment counts to be updated - will be filled * @param bool $preview If set to true the attachments are parsed for preview. Within preview mode the comments are fetched from the given $attachments array and not fetched from the database. */ -function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $preview = false) +function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false) { if (!sizeof($attachments)) { return; } - global $template, $cache, $user; + global $template, $cache, $user, $phpbb_dispatcher; global $extensions, $config, $phpbb_root_path, $phpEx; // @@ -963,7 +1056,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, // Some basics... $attachment['extension'] = strtolower(trim($attachment['extension'])); $filename = $phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($attachment['physical_filename']); - $thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . utf8_basename($attachment['physical_filename']); $upload_icon = ''; @@ -1005,7 +1097,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, if (!$denied) { - $l_downloaded_viewed = $download_link = ''; $display_cat = $extensions[$attachment['extension']]['display_cat']; if ($display_cat == ATTACHMENT_CATEGORY_IMAGE) @@ -1066,7 +1157,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, 'U_INLINE_LINK' => $inline_link, ); - $update_count[] = $attachment['attach_id']; + $update_count_ary[] = $attachment['attach_id']; break; // Images, but display Thumbnail @@ -1079,39 +1170,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, 'THUMB_IMAGE' => $thumbnail_link, ); - $update_count[] = $attachment['attach_id']; - break; - - // Windows Media Streams - case ATTACHMENT_CATEGORY_WM: - - // Giving the filename directly because within the wm object all variables are in local context making it impossible - // to validate against a valid session (all params can differ) - // $download_link = $filename; - - $block_array += array( - 'U_FORUM' => generate_board_url(), - 'ATTACH_ID' => $attachment['attach_id'], - 'S_WM_FILE' => true, - ); - - // Viewed/Heared File ... update the download count - $update_count[] = $attachment['attach_id']; - break; - - // Real Media Streams - case ATTACHMENT_CATEGORY_RM: - case ATTACHMENT_CATEGORY_QUICKTIME: - - $block_array += array( - 'S_RM_FILE' => ($display_cat == ATTACHMENT_CATEGORY_RM) ? true : false, - 'S_QUICKTIME_FILE' => ($display_cat == ATTACHMENT_CATEGORY_QUICKTIME) ? true : false, - 'U_FORUM' => generate_board_url(), - 'ATTACH_ID' => $attachment['attach_id'], - ); - - // Viewed/Heared File ... update the download count - $update_count[] = $attachment['attach_id']; + $update_count_ary[] = $attachment['attach_id']; break; // Macromedia Flash Files @@ -1126,7 +1185,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, ); // Viewed/Heared File ... update the download count - $update_count[] = $attachment['attach_id']; + $update_count_ary[] = $attachment['attach_id']; break; default: @@ -1149,6 +1208,37 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, ); } + $update_count = $update_count_ary; + /** + * Use this event to modify the attachment template data. + * + * This event is triggered once per attachment. + * + * @event core.parse_attachments_modify_template_data + * @var array attachment Array with attachment data + * @var array block_array Template data of the attachment + * @var int display_cat Attachment category data + * @var string download_link Attachment download link + * @var array extensions Array with attachment extensions data + * @var mixed forum_id The forum id the attachments are displayed in (false if in private message) + * @var bool preview Flag indicating if we are in post preview mode + * @var array update_count Array with attachment ids to update download count + * @since 3.1.0-RC5 + */ + $vars = array( + 'attachment', + 'block_array', + 'display_cat', + 'download_link', + 'extensions', + 'forum_id', + 'preview', + 'update_count', + ); + extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars))); + $update_count_ary = $update_count; + unset($update_count); + $template->assign_block_vars('_file', $block_array); $compiled_attachments[] = $template->assign_display('attachment_tpl'); @@ -1224,8 +1314,6 @@ function extension_allowed($forum_id, $extension, &$extensions) */ function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '') { - $chars = array(); - $strip_reply = false; $stripped = false; if ($allow_reply && strpos($string, 'Re: ') === 0) @@ -1285,7 +1373,6 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al * @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &u={user_id} * * @return string A string consisting of what is wanted based on $mode. -* @author BartVB, Acyd Burn */ function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false) { @@ -1298,9 +1385,9 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', global $phpbb_root_path, $phpEx; $_profile_cache['base_url'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}'); - $_profile_cache['tpl_noprofile'] = '{USERNAME}'; + $_profile_cache['tpl_noprofile'] = '<span class="username">{USERNAME}</span>'; $_profile_cache['tpl_noprofile_colour'] = '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>'; - $_profile_cache['tpl_profile'] = '<a href="{PROFILE_URL}">{USERNAME}</a>'; + $_profile_cache['tpl_profile'] = '<a href="{PROFILE_URL}" class="username">{USERNAME}</a>'; $_profile_cache['tpl_profile_colour'] = '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>'; } @@ -1319,7 +1406,8 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // Return colour if ($mode == 'colour') { - return $username_colour; + $username_string = $username_colour; + break; } // no break; @@ -1339,7 +1427,8 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // Return username if ($mode == 'username') { - return $username; + $username_string = $username; + break; } // no break; @@ -1360,21 +1449,25 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', // Return profile if ($mode == 'profile') { - return $profile_url; + $username_string = $profile_url; + break; } // no break; } - if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') - { - $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']); - } - else + if (!isset($username_string)) { - $username_string = 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']); + if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') + { + $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']); + } + else + { + $username_string = 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']); + } } - + /** * Use this event to change the output of get_username_string() * @@ -1390,9 +1483,18 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', * profile url. * @var string username_string The string that has been generated * @var array _profile_cache Array of original return templates - * @since 3.1-A1 + * @since 3.1.0-a1 */ - $vars = array('mode', 'user_id', 'username', 'username_colour', 'guest_username', 'custom_profile_url', 'username_string', '_profile_cache'); + $vars = array( + 'mode', + 'user_id', + 'username', + 'username_colour', + 'guest_username', + 'custom_profile_url', + 'username_string', + '_profile_cache', + ); extract($phpbb_dispatcher->trigger_event('core.modify_username_string', compact($vars))); return $username_string; @@ -1401,22 +1503,54 @@ function get_username_string($mode, $user_id, $username, $username_colour = '', /** * Add an option to the quick-mod tools. * + * @param string $url The recepting URL for the quickmod actions. * @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) +function phpbb_add_quickmod_option($url, $option, $lang_string) { - global $template, $user; + global $template, $user, $phpbb_path_helper; + $lang_string = $user->lang($lang_string); $template->assign_block_vars('quickmod', array( - 'VALUE' => $option, - 'TITLE' => $lang_string, + 'VALUE' => $option, + 'TITLE' => $lang_string, + 'LINK' => $phpbb_path_helper->append_url_params($url, array('action' => $option)), )); } /** -* @package phpBB3 +* Concatenate an array into a string list. +* +* @param array $items Array of items to concatenate +* @param object $user The phpBB $user object. +* +* @return string String list. Examples: "A"; "A and B"; "A, B, and C" */ +function phpbb_generate_string_list($items, $user) +{ + if (empty($items)) + { + return ''; + } + + $count = sizeof($items); + $last_item = array_pop($items); + $lang_key = 'STRING_LIST_MULTI'; + + if ($count == 1) + { + return $last_item; + } + else if ($count == 2) + { + $lang_key = 'STRING_LIST_SIMPLE'; + } + $list = implode($user->lang['COMMA_SEPARATOR'], $items); + + return $user->lang($lang_key, $list, $last_item); +} + class bitfield { var $data; diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 1646c79161..3575768782 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1,9 +1,13 @@ <?php /** * -* @package install -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -419,7 +423,7 @@ function remote_avatar_dims() function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false) { - global $config, $convert, $phpbb_root_path, $user; + global $config, $convert, $user; $relative_path = empty($convert->convertor['source_path_absolute']); @@ -488,7 +492,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false function import_attachment_files($category_name = '') { - global $config, $convert, $phpbb_root_path, $db, $user; + global $config, $convert, $db, $user; $sql = 'SELECT config_value AS upload_path FROM ' . CONFIG_TABLE . " @@ -586,7 +590,7 @@ function import_attachment($source, $use_target = false) return ''; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; // check for trailing slash if (rtrim($convert->convertor['upload_path'], '/') === '') @@ -628,7 +632,7 @@ function import_rank($source, $use_target = false) return ''; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $user; if (!isset($convert->convertor['ranks_path'])) { @@ -646,7 +650,7 @@ function import_smiley($source, $use_target = false) return ''; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $user; // check for trailing slash if (rtrim($convert->convertor['smilies_path'], '/') === '') @@ -667,7 +671,7 @@ function import_avatar($source, $use_target = false, $user_id = false) return; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $config, $user; // check for trailing slash if (rtrim($convert->convertor['avatar_path'], '/') === '') @@ -680,7 +684,7 @@ function import_avatar($source, $use_target = false, $user_id = false) $use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1); } - $result = _import_check('avatar_path', $source, $use_target); + _import_check('avatar_path', $source, $use_target); return ((!empty($user_id)) ? $user_id : $use_target) . '.' . substr(strrchr($source, '.'), 1); } @@ -746,7 +750,7 @@ function get_smiley_dim($source, $axis) return $smiley_cache[$source][$axis]; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $user; $orig_source = $source; @@ -854,14 +858,12 @@ function get_upload_avatar_dim($source, $axis) return $cachedims[$axis]; } - $orig_source = $source; - if (substr($source, 0, 7) == 'upload:') { $source = substr($source, 7); } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $user; if (!isset($convert->convertor['avatar_path'])) { @@ -903,7 +905,7 @@ function get_gallery_avatar_dim($source, $axis) return $avatar_cache[$source][$axis]; } - global $convert, $phpbb_root_path, $config, $user; + global $convert, $user; $orig_source = $source; @@ -962,7 +964,7 @@ function get_remote_avatar_dim($src, $axis) $protocol = (isset($url_info['scheme'])) ? $url_info['scheme'] : 'http'; if (empty($port)) { - switch(strtolower($protocol)) + switch (strtolower($protocol)) { case 'ftp': $port = 21; @@ -1003,8 +1005,8 @@ function get_remote_avatar_dim($src, $axis) { $bigger = ($remote_avatar_cache[$src][0] > $remote_avatar_cache[$src][1]) ? 0 : 1; $ratio = $default[$bigger] / $remote_avatar_cache[$src][$bigger]; - $remote_avatar_cache[$src][0] = (int)($remote_avatar_cache[$src][0] * $ratio); - $remote_avatar_cache[$src][1] = (int)($remote_avatar_cache[$src][1] * $ratio); + $remote_avatar_cache[$src][0] = (int) ($remote_avatar_cache[$src][0] * $ratio); + $remote_avatar_cache[$src][1] = (int) ($remote_avatar_cache[$src][1] * $ratio); } } @@ -1118,7 +1120,7 @@ function words_unique(&$words) */ function add_user_group($group_id, $user_id, $group_leader = false) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $db; $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'group_id' => $group_id, @@ -1138,7 +1140,7 @@ function add_user_group($group_id, $user_id, $group_leader = false) */ function user_group_auth($group, $select_query, $use_src_db) { - global $convert, $phpbb_root_path, $config, $user, $db, $src_db, $same_db; + global $convert, $user, $db, $src_db, $same_db; if (!in_array($group, array('guests', 'registered', 'registered_coppa', 'global_moderators', 'administrators', 'bots'))) { @@ -1194,7 +1196,7 @@ function get_config() return $convert_config; } - global $src_db, $same_db, $phpbb_root_path, $config; + global $src_db, $same_db; global $convert; if ($convert->config_schema['table_format'] != 'file') @@ -1236,7 +1238,7 @@ function get_config() $filename = $convert->options['forum_path'] . '/' . $convert->config_schema['filename']; if (!file_exists($filename)) { - $convert->p_master->error($user->lang['FILE_NOT_FOUND'] . ': ' . $filename, __LINE__, __FILE__); + $convert->p_master->error($user->lang('FILE_NOT_FOUND', $filename), __LINE__, __FILE__); } if (isset($convert->config_schema['array_name'])) @@ -1273,7 +1275,7 @@ function get_config() */ function restore_config($schema) { - global $db, $config; + global $config; $convert_config = get_config(); @@ -1283,7 +1285,9 @@ function restore_config($schema) { $var = (empty($m[2]) || empty($convert_config[$m[2]])) ? "''" : "'" . addslashes($convert_config[$m[2]]) . "'"; $exec = '$config_value = ' . $m[1] . '(' . $var . ');'; + // @codingStandardsIgnoreStart eval($exec); + // @codingStandardsIgnoreEnd } else { @@ -1306,7 +1310,7 @@ function restore_config($schema) $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false); } - set_config($config_name, $config_value); + $config->set($config_name, $config_value); } } } @@ -1316,7 +1320,7 @@ function restore_config($schema) */ function update_folder_pm_count() { - global $db, $convert, $user; + global $db; $sql = 'SELECT user_id, folder_id, COUNT(msg_id) as num_messages FROM ' . PRIVMSGS_TO_TABLE . ' @@ -1375,7 +1379,7 @@ function extract_variables_from_file($_filename) function get_path($src_path, $src_url, $test_file) { - global $config, $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx; $board_config = get_config(); @@ -1486,7 +1490,7 @@ function compare_table($tables, $tablename, &$prefixes) */ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) { - global $db, $convert, $user, $config; + global $db; static $acl_option_ids, $group_ids; if (($ug_type == 'group' || $ug_type == 'group_role') && is_string($ug_id)) @@ -1641,7 +1645,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) switch ($sql_type) { case 'insert': - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': @@ -1650,6 +1654,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) case 'mssql': case 'sqlite': + case 'sqlite3': case 'mssqlnative': $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); break; @@ -1961,9 +1966,9 @@ function update_dynamic_config() if ($row) { - set_config('newest_user_id', $row['user_id'], true); - set_config('newest_username', $row['username'], true); - set_config('newest_user_colour', $row['user_colour'], true); + $config->set('newest_user_id', $row['user_id'], false); + $config->set('newest_username', $row['username'], false); + $config->set('newest_user_colour', $row['user_colour'], false); } // Also do not reset record online user/date. There will be old data or the fresh data from the schema. @@ -1977,7 +1982,7 @@ function update_dynamic_config() $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_posts', (int) $row['stat'], true); + $config->set('num_posts', (int) $row['stat'], false); $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' @@ -1986,7 +1991,7 @@ function update_dynamic_config() $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_topics', (int) $row['stat'], true); + $config->set('num_topics', (int) $row['stat'], false); $sql = 'SELECT COUNT(user_id) AS stat FROM ' . USERS_TABLE . ' @@ -1995,20 +2000,20 @@ function update_dynamic_config() $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_users', (int) $row['stat'], true); + $config->set('num_users', (int) $row['stat'], false); $sql = 'SELECT COUNT(attach_id) as stat FROM ' . ATTACHMENTS_TABLE . ' WHERE is_orphan = 0'; $result = $db->sql_query($sql); - set_config('num_files', (int) $db->sql_fetchfield('stat'), true); + $config->set('num_files', (int) $db->sql_fetchfield('stat'), false); $db->sql_freeresult($result); $sql = 'SELECT SUM(filesize) as stat FROM ' . ATTACHMENTS_TABLE . ' WHERE is_orphan = 0'; $result = $db->sql_query($sql); - set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true); + $config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false); $db->sql_freeresult($result); /** @@ -2032,12 +2037,12 @@ function update_dynamic_config() */ function update_topics_posted() { - global $db, $config; + global $db; - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': - case 'firebird': + case 'sqlite3': $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); break; @@ -2141,6 +2146,7 @@ function fix_empty_primary_groups() } $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('global_moderators'); + $result = $db->sql_query($sql); $user_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -2172,7 +2178,7 @@ function fix_empty_primary_groups() */ function remove_invalid_users() { - global $convert, $db, $phpEx, $phpbb_root_path; + global $db, $phpEx, $phpbb_root_path; // username_clean is UNIQUE $sql = 'SELECT user_id @@ -2289,7 +2295,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals $message = preg_replace('#\[size=([0-9]+)\](.*?)\[/size\]#i', '[size=\1]\2[/size]', $message); $message = preg_replace('#\[size=[0-9]{2,}\](.*?)\[/size\]#i', '[size=29]\1[/size]', $message); - for ($i = sizeof($size); $i; ) + for ($i = sizeof($size); $i;) { $i--; $message = str_replace('[size=' . $i . ']', '[size=' . $size[$i] . ']', $message); @@ -2308,7 +2314,10 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $source_relative_path = true) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $convert, $phpbb_root_path, $user, $phpbb_filesystem; + + /** @var \phpbb\filesystem\filesystem_interface $filesystem */ + $filesystem = $phpbb_filesystem; if (substr($trg, -1) == '/') { @@ -2341,7 +2350,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour } } - if (!phpbb_is_writable($path)) + if (!$filesystem->is_writable($path)) { @chmod($path, 0777); } @@ -2362,7 +2371,10 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_failure = true, $source_relative_path = true) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $convert, $phpbb_root_path, $config, $user, $phpbb_filesystem; + + /** @var \phpbb\filesystem\filesystem_interface $filesystem */ + $filesystem = $phpbb_filesystem; $dirlist = $filelist = $bad_dirs = array(); $src = path($src, $source_relative_path); @@ -2376,7 +2388,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ @chmod($trg_path, 0777); } - if (!phpbb_is_writable($trg_path)) + if (!$filesystem->is_writable($trg_path)) { $bad_dirs[] = path($config['script_path']) . $trg; } @@ -2443,7 +2455,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ @chmod($trg_path . $dir, 0777); } - if (!phpbb_is_writable($trg_path . $dir)) + if (!$filesystem->is_writable($trg_path . $dir)) { $bad_dirs[] = $trg . $dir; $bad_dirs[] = $trg_path . $dir; @@ -2471,7 +2483,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ function relative_base($path, $is_relative = true, $line = false, $file = false) { - global $convert, $phpbb_root_path, $config, $user, $db; + global $convert, $user; if (!$is_relative) { diff --git a/phpBB/includes/functions_database_helper.php b/phpBB/includes/functions_database_helper.php index 923e542690..8f363d56f3 100644 --- a/phpBB/includes/functions_database_helper.php +++ b/phpBB/includes/functions_database_helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -22,14 +26,14 @@ if (!defined('IN_PHPBB')) * * The only supported table is bookmarks. * -* @param \phpbb\db\driver\driver $db Database object +* @param \phpbb\db\driver\driver_interface $db Database object * @param string $table Table on which to perform the update * @param string $column Column whose values to change * @param array $from_values An array of values that should be changed * @param int $to_value The new value * @return null */ -function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value) +function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver_interface $db, $table, $column, $from_values, $to_value) { $sql = "SELECT $column, user_id FROM $table @@ -107,14 +111,14 @@ function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver $db, $tab * * The only supported table is topics_watch. * -* @param \phpbb\db\driver\driver $db Database object +* @param \phpbb\db\driver\driver_interface $db Database object * @param string $table Table on which to perform the update * @param string $column Column whose values to change * @param array $from_values An array of values that should be changed * @param int $to_value The new value * @return null */ -function phpbb_update_rows_avoiding_duplicates_notify_status(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value) +function phpbb_update_rows_avoiding_duplicates_notify_status(\phpbb\db\driver\driver_interface $db, $table, $column, $from_values, $to_value) { $sql = "SELECT $column, user_id, notify_status FROM $table diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e663ac90c5..afda10ebee 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -26,10 +30,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); $parent_id = $visible_forums = 0; - $sql_from = ''; // Mark forums read? - $mark_read = request_var('mark', ''); + $mark_read = $request->variable('mark', ''); if ($mark_read == 'all') { @@ -57,9 +60,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $redirect = build_url(array('mark', 'hash', 'mark_time')); meta_refresh(3, $redirect); - if (check_link_hash(request_var('hash', ''), 'global')) + if (check_link_hash($request->variable('hash', ''), 'global')) { - markread('all', false, false, request_var('mark_time', 0)); + markread('all', false, false, $request->variable('mark_time', 0)); if ($request->is_ajax()) { @@ -138,7 +141,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod * * @event core.display_forums_modify_sql * @var array sql_ary The SQL array to get the data of the forums - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('sql_ary'); extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_sql', compact($vars))); @@ -146,9 +149,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); - $forum_tracking_info = array(); + $forum_tracking_info = $valid_categories = array(); $branch_root_id = $root_data['forum_id']; + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); while ($row = $db->sql_fetchrow($result)) @@ -161,7 +165,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod * @event core.display_forums_modify_row * @var int branch_root_id Last top-level forum * @var array row The data of the forum - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('branch_root_id', 'row'); extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_row', compact($vars))); @@ -246,6 +250,12 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } } + // Fill list of categories with forums + if (isset($forum_rows[$row['parent_id']])) + { + $valid_categories[$row['parent_id']] = true; + } + // if ($row['parent_id'] == $root_data['forum_id'] || $row['parent_id'] == $branch_root_id) { @@ -263,6 +273,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $branch_root_id = $forum_id; } $forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id']; + $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password']; $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; } else if ($row['forum_type'] != FORUM_CAT) @@ -304,6 +315,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name']; $forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour']; $forum_rows[$parent_id]['forum_id_last_post'] = $forum_id; + $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password']; } } @@ -318,7 +330,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod * @var int branch_root_id Current top-level forum * @var int parent_id Current parent forum * @var array row The data of the forum - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('forum_rows', 'subforums', 'branch_root_id', 'parent_id', 'row'); extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_forum_rows', compact($vars))); @@ -329,10 +341,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($mark_read == 'forums') { $redirect = build_url(array('mark', 'hash', 'mark_time')); - $token = request_var('hash', ''); + $token = $request->variable('hash', ''); if (check_link_hash($token, 'global')) { - markread('topics', $forum_ids, false, request_var('mark_time', 0)); + markread('topics', $forum_ids, false, $request->variable('mark_time', 0)); $message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>'); meta_refresh(3, $redirect); @@ -371,14 +383,42 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod get_moderators($forum_moderators, $forum_ids_moderator); } + /** + * Event to perform additional actions before the forum list is being generated + * + * @event core.display_forums_before + * @var array active_forum_ary Array with forum data to display active topics + * @var bool display_moderators Flag indicating if we display forum moderators + * @var array forum_moderators Array with forum moderators list + * @var array forum_rows Data array of all forums we display + * @var bool return_moderators Flag indicating if moderators list should be returned + * @var array root_data Array with the root forum data + * @since 3.1.4-RC1 + */ + $vars = array( + 'active_forum_ary', + 'display_moderators', + 'forum_moderators', + 'forum_rows', + 'return_moderators', + 'root_data', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_before', compact($vars))); + // Used to tell whatever we have to create a dummy category or not. $last_catless = true; foreach ($forum_rows as $row) { - // Empty category + // Category if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT) { - $template->assign_block_vars('forumrow', array( + // Do not display categories without any forums to display + if (!isset($valid_categories[$row['forum_id']])) + { + continue; + } + + $cat_row = array( 'S_IS_CAT' => true, 'FORUM_ID' => $row['forum_id'], 'FORUM_NAME' => $row['forum_name'], @@ -387,8 +427,31 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_FOLDER_IMG_SRC' => '', 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang['FORUM_CAT'] . '" />' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', - 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id'])) + 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), + ); + + /** + * Modify the template data block of the 'category' + * + * This event is triggered once per 'category' + * + * @event core.display_forums_modify_category_template_vars + * @var array cat_row Template data of the 'category' + * @var bool last_catless The flag indicating whether the last forum had a parent category + * @var array root_data Array with the root forum data + * @var array row The data of the 'category' + * @since 3.1.0-RC4 + * @change 3.1.7-RC1 Removed undefined catless variable + */ + $vars = array( + 'cat_row', + 'last_catless', + 'root_data', + 'row', ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_category_template_vars', compact($vars))); + + $template->assign_block_vars('forumrow', $cat_row); continue; } @@ -441,7 +504,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } } - $l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': '; + $l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS']; $folder_image = ($forum_unread) ? 'forum_unread_subforum' : 'forum_read_subforum'; } else @@ -472,8 +535,15 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Create last post link information, if appropriate if ($row['forum_last_post_id']) { - $last_post_subject = $row['forum_last_post_subject']; - $last_post_subject_truncated = truncate_string(censor_text($last_post_subject), 30, 255, false, $user->lang['ELLIPSIS']); + if ($row['forum_password_last_post'] === '' && $auth->acl_get('f_read', $row['forum_id_last_post'])) + { + $last_post_subject = censor_text($row['forum_last_post_subject']); + $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']); + } + else + { + $last_post_subject = $last_post_subject_truncated = ''; + } $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } @@ -493,10 +563,15 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $l_post_click_count = ($row['forum_type'] == FORUM_LINK) ? 'CLICKS' : 'POSTS'; $post_click_count = ($row['forum_type'] != FORUM_LINK || $row['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? $row['forum_posts'] : ''; - $s_subforums_list = array(); + $s_subforums_list = $subforums_row = array(); foreach ($subforums_list as $subforum) { $s_subforums_list[] = '<a href="' . $subforum['link'] . '" class="subforum ' . (($subforum['unread']) ? 'unread' : 'read') . '" title="' . (($subforum['unread']) ? $user->lang['UNREAD_POSTS'] : $user->lang['NO_UNREAD_POSTS']) . '">' . $subforum['name'] . '</a>'; + $subforums_row[] = array( + 'U_SUBFORUM' => $subforum['link'], + 'SUBFORUM_NAME' => $subforum['name'], + 'S_UNREAD' => $subforum['unread'], + ); } $s_subforums_list = (string) implode($user->lang['COMMA_SEPARATOR'], $s_subforums_list); $catless = ($row['parent_id'] == $root_data['forum_id']) ? true : false; @@ -528,7 +603,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, - 'S_DISPLAY_SUBJECT' => ($last_post_subject && $config['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, + 'S_DISPLAY_SUBJECT' => ($last_post_subject !== '' && $config['display_last_subject']) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], @@ -541,8 +616,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', 'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', - 'LAST_POST_SUBJECT' => (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? censor_text($last_post_subject) : "", - 'LAST_POST_SUBJECT_TRUNCATED' => (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? $last_post_subject_truncated : "", + 'LAST_POST_SUBJECT' => $last_post_subject, + 'LAST_POST_SUBJECT_TRUNCATED' => $last_post_subject_truncated, 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), @@ -568,22 +643,41 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod * @event core.display_forums_modify_template_vars * @var array forum_row Template data of the forum * @var array row The data of the forum - * @since 3.1-A1 + * @var array subforums_row Template data of subforums + * @since 3.1.0-a1 + * @change 3.1.0-b5 Added var subforums_row */ - $vars = array('forum_row', 'row'); + $vars = array('forum_row', 'row', 'subforums_row'); extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars))); $template->assign_block_vars('forumrow', $forum_row); // Assign subforums loop for style authors - foreach ($subforums_list as $subforum) - { - $template->assign_block_vars('forumrow.subforum', array( - 'U_SUBFORUM' => $subforum['link'], - 'SUBFORUM_NAME' => $subforum['name'], - 'S_UNREAD' => $subforum['unread']) - ); - } + $template->assign_block_vars_array('forumrow.subforum', $subforums_row); + + /** + * Modify and/or assign additional template data for the forum + * after forumrow loop has been assigned. This can be used + * to create additional forumrow subloops in extensions. + * + * This event is triggered once per forum + * + * @event core.display_forums_add_template_data + * @var array forum_row Template data of the forum + * @var array row The data of the forum + * @var array subforums_list The data of subforums + * @var array subforums_row Template data of subforums + * @var bool catless The flag indicating whether a forum has a parent category + * @since 3.1.0-b5 + */ + $vars = array( + 'forum_row', + 'row', + 'subforums_list', + 'subforums_row', + 'catless', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_add_template_data', compact($vars))); $last_catless = $catless; } @@ -594,9 +688,31 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPICS_UNAPPROVED'), - 'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED'), + 'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED_FORUM'), )); + /** + * Event to perform additional actions after the forum list has been generated + * + * @event core.display_forums_after + * @var array active_forum_ary Array with forum data to display active topics + * @var bool display_moderators Flag indicating if we display forum moderators + * @var array forum_moderators Array with forum moderators list + * @var array forum_rows Data array of all forums we display + * @var bool return_moderators Flag indicating if moderators list should be returned + * @var array root_data Array with the root forum data + * @since 3.1.0-RC5 + */ + $vars = array( + 'active_forum_ary', + 'display_moderators', + 'forum_moderators', + 'forum_rows', + 'return_moderators', + 'root_data', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_after', compact($vars))); + if ($return_moderators) { return array($active_forum_ary, $forum_moderators); @@ -615,7 +731,7 @@ function generate_forum_rules(&$forum_data) return; } - global $template, $phpbb_root_path, $phpEx; + global $template; if ($forum_data['forum_rules']) { @@ -633,18 +749,22 @@ function generate_forum_rules(&$forum_data) * Create forum navigation links for given forum, create parent * list if currently null, assign basic forum info to template */ -function generate_forum_nav(&$forum_data) +function generate_forum_nav(&$forum_data_ary) { - global $db, $user, $template, $auth, $config; - global $phpEx, $phpbb_root_path; + global $template, $auth, $config; + global $phpEx, $phpbb_root_path, $phpbb_dispatcher; - if (!$auth->acl_get('f_list', $forum_data['forum_id'])) + if (!$auth->acl_get('f_list', $forum_data_ary['forum_id'])) { return; } + $navlinks_parents = $forum_template_data = array(); + // Get forum parents - $forum_parents = get_forum_parents($forum_data); + $forum_parents = get_forum_parents($forum_data_ary); + + $microdata_attr = 'data-forum-id'; // Build navigation links if (!empty($forum_parents)) @@ -659,33 +779,62 @@ function generate_forum_nav(&$forum_data) continue; } - $template->assign_block_vars('navlinks', array( + $navlinks_parents[] = array( 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false, 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false, 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id)) + 'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"', + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id), ); } } - $template->assign_block_vars('navlinks', array( - 'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false, - 'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, - 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, - 'FORUM_NAME' => $forum_data['forum_name'], - 'FORUM_ID' => $forum_data['forum_id'], - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id'])) + $navlinks = array( + 'S_IS_CAT' => ($forum_data_ary['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($forum_data_ary['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($forum_data_ary['forum_type'] == FORUM_POST) ? true : false, + 'FORUM_NAME' => $forum_data_ary['forum_name'], + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'MICRODATA' => $microdata_attr . '="' . $forum_data_ary['forum_id'] . '"', + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data_ary['forum_id']), ); - $template->assign_vars(array( - 'FORUM_ID' => $forum_data['forum_id'], - 'FORUM_NAME' => $forum_data['forum_name'], - 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']), + $forum_template_data = array( + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'FORUM_NAME' => $forum_data_ary['forum_name'], + 'FORUM_DESC' => generate_text_for_display($forum_data_ary['forum_desc'], $forum_data_ary['forum_desc_uid'], $forum_data_ary['forum_desc_bitfield'], $forum_data_ary['forum_desc_options']), - 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false, - )); + 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data_ary['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data_ary['forum_options'])) ? true : false, + ); + + $forum_data = $forum_data_ary; + /** + * Event to modify the navlinks text + * + * @event core.generate_forum_nav + * @var array forum_data Array with the forum data + * @var array forum_template_data Array with generic forum template data + * @var string microdata_attr The microdata attribute + * @var array navlinks_parents Array with the forum parents navlinks data + * @var array navlinks Array with the forum navlinks data + * @since 3.1.5-RC1 + */ + $vars = array( + 'forum_data', + 'forum_template_data', + 'microdata_attr', + 'navlinks_parents', + 'navlinks', + ); + extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + $template->assign_block_vars_array('navlinks', $navlinks_parents); + $template->assign_block_vars('navlinks', $navlinks); + $template->assign_vars($forum_template_data); return; } @@ -737,7 +886,8 @@ function get_forum_parents(&$forum_data) */ function get_moderators(&$forum_moderators, $forum_id = false) { - global $config, $template, $db, $phpbb_root_path, $phpEx, $user, $auth; + global $db, $phpbb_root_path, $phpEx, $user, $auth; + global $phpbb_container; $forum_id_ary = array(); @@ -773,6 +923,9 @@ function get_moderators(&$forum_moderators, $forum_id = false) 'WHERE' => 'm.display_on_index = 1', ); + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + // We query every forum here because for caching we should not have any parameter. $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql, 3600); @@ -792,7 +945,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) } else { - $group_name = (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']); + $group_name = $group_helper->get_name($row['group_name']); if ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) { @@ -849,8 +1002,6 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold { global $user, $config; - $folder = $folder_new = ''; - if ($topic_row['topic_status'] == ITEM_MOVED) { $topic_type = $user->lang['VIEW_TOPIC_MOVED']; @@ -900,7 +1051,6 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold $folder_new .= '_locked'; } - $folder_img = ($unread_topic) ? $folder_new : $folder; $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); @@ -962,6 +1112,7 @@ function display_custom_bbcodes() 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), 'BBCODE_TAG' => $row['bbcode_tag'], + 'BBCODE_TAG_CLEAN' => str_replace('=', '-', $row['bbcode_tag']), 'BBCODE_HELPLINE' => $row['bbcode_helpline'], 'A_BBCODE_HELPLINE' => str_replace(array('&', '"', "'", '<', '>'), array('&', '"', "\'", '<', '>'), $row['bbcode_helpline']), ); @@ -974,7 +1125,7 @@ function display_custom_bbcodes() * @event core.display_custom_bbcodes_modify_row * @var array custom_tags Template data of the bbcode * @var array row The data of the bbcode - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('custom_tags', 'row'); extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_row', compact($vars))); @@ -989,52 +1140,34 @@ function display_custom_bbcodes() * Display custom bbcodes * * @event core.display_custom_bbcodes - * @since 3.1-A1 + * @since 3.1.0-a1 */ $phpbb_dispatcher->dispatch('core.display_custom_bbcodes'); } /** * Display reasons +* +* @deprecated 3.2.0-dev */ function display_reasons($reason_id = 0) { - global $db, $user, $template; - - $sql = 'SELECT * - FROM ' . REPORTS_REASONS_TABLE . ' - ORDER BY reason_order ASC'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - // If the reason is defined within the language file, we will use the localized version, else just use the database entry... - if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) - { - $row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; - $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; - } + global $phpbb_container; - $template->assign_block_vars('reason', array( - 'ID' => $row['reason_id'], - 'TITLE' => $row['reason_title'], - 'DESCRIPTION' => $row['reason_description'], - 'S_SELECTED' => ($row['reason_id'] == $reason_id) ? true : false) - ); - } - $db->sql_freeresult($result); + $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id); } /** * Display user activity (action forum/topic) */ -function display_user_activity(&$userdata) +function display_user_activity(&$userdata_ary) { global $auth, $template, $db, $user; - global $phpbb_root_path, $phpEx, $phpbb_container; + global $phpbb_root_path, $phpEx; + global $phpbb_container, $phpbb_dispatcher; // Do not display user activity for users having more than 5000 posts... - if ($userdata['user_posts'] > 5000) + if ($userdata_ary['user_posts'] > 5000) { return; } @@ -1055,12 +1188,13 @@ function display_user_activity(&$userdata) $active_f_row = $active_t_row = array(); if (!empty($forum_ary)) { + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // Obtain active forum $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts FROM ' . POSTS_TABLE . ' - WHERE poster_id = ' . $userdata['user_id'] . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' AND post_postcount = 1 AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' GROUP BY forum_id @@ -1082,7 +1216,7 @@ function display_user_activity(&$userdata) // Obtain active topic $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts FROM ' . POSTS_TABLE . ' - WHERE poster_id = ' . $userdata['user_id'] . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' AND post_postcount = 1 AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' GROUP BY topic_id @@ -1102,8 +1236,23 @@ function display_user_activity(&$userdata) } } - $userdata['active_t_row'] = $active_t_row; - $userdata['active_f_row'] = $active_f_row; + $userdata = $userdata_ary; + /** + * Alter list of forums and topics to display as active + * + * @event core.display_user_activity_modify_actives + * @var array userdata User's data + * @var array active_f_row List of active forums + * @var array active_t_row List of active posts + * @since 3.1.0-RC3 + */ + $vars = array('userdata', 'active_f_row', 'active_t_row'); + extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars))); + $userdata_ary = $userdata; + unset($userdata); + + $userdata_ary['active_t_row'] = $active_t_row; + $userdata_ary['active_f_row'] = $active_f_row; $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; if (!empty($active_f_row['num_posts'])) @@ -1111,7 +1260,7 @@ function display_user_activity(&$userdata) $active_f_name = $active_f_row['forum_name']; $active_f_id = $active_f_row['forum_id']; $active_f_count = $active_f_row['num_posts']; - $active_f_pct = ($userdata['user_posts']) ? ($active_f_count / $userdata['user_posts']) * 100 : 0; + $active_f_pct = ($userdata_ary['user_posts']) ? ($active_f_count / $userdata_ary['user_posts']) * 100 : 0; } $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; @@ -1120,10 +1269,10 @@ function display_user_activity(&$userdata) $active_t_name = $active_t_row['topic_title']; $active_t_id = $active_t_row['topic_id']; $active_t_count = $active_t_row['num_posts']; - $active_t_pct = ($userdata['user_posts']) ? ($active_t_count / $userdata['user_posts']) * 100 : 0; + $active_t_pct = ($userdata_ary['user_posts']) ? ($active_t_count / $userdata_ary['user_posts']) * 100 : 0; } - $l_active_pct = ($userdata['user_id'] != ANONYMOUS && $userdata['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE']; + $l_active_pct = ($userdata_ary['user_id'] != ANONYMOUS && $userdata_ary['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE']; $template->assign_vars(array( 'ACTIVE_FORUM' => $active_f_name, @@ -1143,7 +1292,7 @@ function display_user_activity(&$userdata) */ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '') { - global $template, $db, $user, $phpEx, $start, $phpbb_root_path; + global $db, $user, $phpEx, $start, $phpbb_root_path; global $request; $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; @@ -1153,7 +1302,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $u_url .= ($mode == 'forum') ? '&f' : '&f=' . $forum_id . '&t'; $is_watching = 0; - // Is user watching this thread? + // Is user watching this topic? if ($user_id != ANONYMOUS) { $can_watch = true; @@ -1174,8 +1323,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { if (isset($_GET['unwatch'])) { - $uid = request_var('uid', 0); - $token = request_var('hash', ''); + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { @@ -1248,8 +1397,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { if (isset($_GET['watch'])) { - $uid = request_var('uid', 0); - $token = request_var('hash', ''); + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { @@ -1333,17 +1482,34 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, /** * Get user rank title and image * -* @param int $user_rank the current stored users rank id +* @param array $user_data the current stored users data * @param int $user_posts the users number of posts -* @param string &$rank_title the rank title will be stored here after execution -* @param string &$rank_img the rank image as full img tag is stored here after execution -* @param string &$rank_img_src the rank image source is stored here after execution +* +* @return array An associative array containing the rank title (title), the rank image as full img tag (img) and the rank image source (img_src) * * Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false */ -function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) +function phpbb_get_user_rank($user_data, $user_posts) { - global $ranks, $config, $phpbb_root_path; + global $ranks, $config, $phpbb_root_path, $phpbb_path_helper, $phpbb_dispatcher; + + $user_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + + /** + * Preparing a user's rank before displaying + * + * @event core.modify_user_rank + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @since 3.1.0-RC4 + */ + + $vars = array('user_data', 'user_posts'); + extract($phpbb_dispatcher->trigger_event('core.modify_user_rank', compact($vars))); if (empty($ranks)) { @@ -1351,11 +1517,14 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank $ranks = $cache->obtain_ranks(); } - if (!empty($user_rank)) + if (!empty($user_data['user_rank'])) { - $rank_title = (isset($ranks['special'][$user_rank]['rank_title'])) ? $ranks['special'][$user_rank]['rank_title'] : ''; - $rank_img = (!empty($ranks['special'][$user_rank]['rank_image'])) ? '<img src="' . $phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] . '" alt="' . $ranks['special'][$user_rank]['rank_title'] . '" title="' . $ranks['special'][$user_rank]['rank_title'] . '" />' : ''; - $rank_img_src = (!empty($ranks['special'][$user_rank]['rank_image'])) ? $phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image'] : ''; + + $user_rank_data['title'] = (isset($ranks['special'][$user_data['user_rank']]['rank_title'])) ? $ranks['special'][$user_data['user_rank']]['rank_title'] : ''; + + $user_rank_data['img_src'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_data['user_rank']]['rank_image']) : ''; + + $user_rank_data['img'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? '<img src="' . $user_rank_data['img_src'] . '" alt="' . $ranks['special'][$user_data['user_rank']]['rank_title'] . '" title="' . $ranks['special'][$user_data['user_rank']]['rank_title'] . '" />' : ''; } else if ($user_posts !== false) { @@ -1365,136 +1534,176 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank { if ($user_posts >= $rank['rank_min']) { - $rank_title = $rank['rank_title']; - $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; - $rank_img_src = (!empty($rank['rank_image'])) ? $phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image'] : ''; + $user_rank_data['title'] = $rank['rank_title']; + $user_rank_data['img_src'] = (!empty($rank['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image']) : ''; + $user_rank_data['img'] = (!empty($rank['rank_image'])) ? '<img src="' . $user_rank_data['img_src'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; break; } } } } -} -/** -* Get user avatar -* -* @param array $user_row Row from the users table -* @param string $alt Optional language string for alt tag within image, can be a language key or text -* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP -* -* @return string Avatar html -*/ -function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false) -{ - $row = \phpbb\avatar\manager::clean_row($user_row, 'user'); - return phpbb_get_avatar($row, $alt, $ignore_config); + return $user_rank_data; } /** -* Get group avatar -* -* @param array $group_row Row from the groups table -* @param string $alt Optional language string for alt tag within image, can be a language key or text -* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP -* -* @return string Avatar html +* Prepare profile data */ -function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false) +function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false, $check_can_receive_pm = true) { - $row = \phpbb\avatar\manager::clean_row($user_row, 'group'); - return phpbb_get_avatar($row, $alt, $ignore_config); -} + global $config, $auth, $user, $phpEx, $phpbb_root_path, $phpbb_dispatcher; -/** -* Get avatar -* -* @param array $row Row cleaned by \phpbb\avatar\driver\driver::clean_row -* @param string $alt Optional language string for alt tag within image, can be a language key or text -* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP -* -* @return string Avatar html -*/ -function phpbb_get_avatar($row, $alt, $ignore_config = false) -{ - global $user, $config, $cache, $phpbb_root_path, $phpEx; - global $request; - global $phpbb_container; + $username = $data['username']; + $user_id = $data['user_id']; - if (!$config['allow_avatar'] && !$ignore_config) + $user_rank_data = phpbb_get_user_rank($data, (($user_id == ANONYMOUS) ? false : $data['user_posts'])); + + if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user')) { - return ''; + $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']); + } + else + { + $email = ''; } - $avatar_data = array( - 'src' => $row['avatar'], - 'width' => $row['avatar_width'], - 'height' => $row['avatar_height'], - ); - - $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); - $driver = $phpbb_avatar_manager->get_driver($row['avatar_type'], $ignore_config); - $html = ''; - - if ($driver) + if ($config['load_onlinetrack']) { - $html = $driver->get_custom_html($user, $row, $alt); - if (!empty($html)) - { - return $html; - } + $update_time = $config['load_online_time'] * 60; + $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; + } + else + { + $online = false; + } - $avatar_data = $driver->get_data($row, $ignore_config); + if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) + { + $last_active = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit']; } else { - $avatar_data['src'] = ''; + $last_active = ''; } - if (!empty($avatar_data['src'])) + $age = ''; + + if ($config['allow_birthdays'] && $data['user_birthday']) + { + list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday'])); + + if ($bday_year) + { + $now = $user->create_datetime(); + $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); + + $diff = $now['mon'] - $bday_month; + if ($diff == 0) + { + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; + } + else + { + $diff = ($diff < 0) ? 1 : 0; + } + + $age = max(0, (int) ($now['year'] - $bday_year - $diff)); + } + } + + if (!function_exists('phpbb_get_banned_user_ids')) { - $html = '<img src="' . $avatar_data['src'] . '" ' . - ($avatar_data['width'] ? ('width="' . $avatar_data['width'] . '" ') : '') . - ($avatar_data['height'] ? ('height="' . $avatar_data['height'] . '" ') : '') . - 'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />'; + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - return $html; + // Can this user receive a Private Message? + $can_receive_pm = $check_can_receive_pm && ( + // They must be a "normal" user + $data['user_type'] != USER_IGNORE && + + // They must not be deactivated by the administrator + ($data['user_type'] != USER_INACTIVE || $data['user_inactive_reason'] != INACTIVE_MANUAL) && + + // They must be able to read PMs + sizeof($auth->acl_get_list($user_id, 'u_readpm')) && + + // They must not be permanently banned + !sizeof(phpbb_get_banned_user_ids($user_id, false)) && + + // They must allow users to contact via PM + (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $data['user_allow_pm']) + ); + + // Dump it out to the template + $template_data = array( + 'AGE' => $age, + 'RANK_TITLE' => $user_rank_data['title'], + 'JOINED' => $user->format_date($data['user_regdate']), + 'LAST_ACTIVE' => (empty($last_active)) ? ' - ' : $user->format_date($last_active), + 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, + 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, + + 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), + 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), + 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), + 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), + + 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), + + 'AVATAR_IMG' => phpbb_get_user_avatar($data), + 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], + 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, + + 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false, + + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '', + 'U_NOTES' => ($user_notes_enabled && $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', + 'U_WARN' => ($warn_user_enabled && $auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', + 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '', + 'U_EMAIL' => $email, + 'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '', + + 'USER_JABBER' => ($config['jab_enable']) ? $data['user_jabber'] : '', + 'USER_JABBER_IMG' => ($config['jab_enable'] && $data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', + + 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $username), + 'L_CONTACT_USER' => $user->lang('CONTACT_USER', $username), + 'L_VIEWING_PROFILE' => $user->lang('VIEWING_PROFILE', $username), + ); + + /** + * Preparing a user's data before displaying it in profile and memberlist + * + * @event core.memberlist_prepare_profile_data + * @var array data Array with user's data + * @var array template_data Template array with user's data + * @since 3.1.0-a1 + */ + $vars = array('data', 'template_data'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_prepare_profile_data', compact($vars))); + + return $template_data; } -/** -* Generate a list of archive types available for compressing attachments -* -* @param string $param_key Either topic_id or post_id -* @param string $param_val The value of the topic or post id -* @param string $phpbb_root_path The root path of the phpBB installation -* @param string $phpEx The PHP extension -* -* @return array Array containing the link and the type of compression -*/ -function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $phpEx) +function phpbb_sort_last_active($first, $second) { - if (!class_exists('compress')) - { - require $phpbb_root_path . 'includes/functions_compress.' . $phpEx; - } + global $id_cache, $sort_dir; - $methods = compress::methods(); - // Sort by preferred type. - $methods = array_intersect(array('.zip', '.tar.bz2', '.tar.gz', '.tar'), $methods); - $links = array(); + $lesser_than = ($sort_dir === 'd') ? -1 : 1; - foreach ($methods as $method) + if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader'])) { - $exploded = explode('.', $method); - $type = array_pop($exploded); - $params = array('archive' => $method); - $params[$param_key] = $param_val; - - $links[] = array( - 'LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", $params), - 'TYPE' => $type, - ); + return -1; + } + else if (isset($id_cache[$second]['group_leader']) && (!isset($id_cache[$first]['group_leader']) || !$id_cache[$first]['group_leader']) && $id_cache[$second]['group_leader']) + { + return 1; + } + else + { + return $lesser_than * (int) ($id_cache[$first]['last_visit'] - $id_cache[$second]['last_visit']); } - - return $links; } diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index c895f7b54b..916655e77c 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -41,28 +45,28 @@ function send_avatar_to_browser($file, $browser) if ((@file_exists($file_path) && @is_readable($file_path)) && !headers_sent()) { - header('Pragma: public'); + header('Cache-Control: public'); $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - if ((strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7)) + if ((strpos(strtolower($browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7)) { header('Content-Disposition: attachment; ' . header_filename($file)); if (strpos(strtolower($browser), 'msie 6.0') !== false) { - header('Expires: -1'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); } else { - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); } } else { header('Content-Disposition: inline; ' . header_filename($file)); - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); } $size = @filesize($file_path); @@ -119,7 +123,7 @@ function wrap_img_in_html($src, $title) */ function send_file_to_browser($attachment, $upload_dir, $category) { - global $user, $db, $config, $phpbb_root_path; + global $user, $db, $phpbb_root_path, $request; $filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename']; @@ -171,7 +175,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) } // Now the tricky part... let's dance - header('Pragma: public'); + header('Cache-Control: public'); // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. header('Content-Type: ' . $attachment['mimetype']); @@ -181,7 +185,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) header('X-Content-Type-Options: nosniff'); } - if ($category == ATTACHMENT_CATEGORY_FLASH && request_var('view', 0) === 1) + if ($category == ATTACHMENT_CATEGORY_FLASH && $request->variable('view', 0) === 1) { // We use content-disposition: inline for flash files and view=1 to let it correctly play with flash player 10 - any other disposition will fail to play inline header('Content-Disposition: inline'); @@ -193,7 +197,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) { - header('expires: -1'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); } } else @@ -206,11 +210,6 @@ function send_file_to_browser($attachment, $upload_dir, $category) } } - if ($size) - { - header("Content-Length: $size"); - } - // Close the db connection before sending the file etc. file_gc(false); @@ -234,6 +233,11 @@ function send_file_to_browser($attachment, $upload_dir, $category) exit; } + if ($size) + { + header("Content-Length: $size"); + } + // Try to deliver in chunks @set_time_limit(0); @@ -416,8 +420,8 @@ function set_modified_headers($stamp, $browser) { send_status_line(304, 'Not Modified'); // seems that we need those too ... browsers - header('Pragma: public'); - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); + header('Cache-Control: public'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); return true; } else @@ -596,7 +600,7 @@ function phpbb_parse_range_request($request_array, $filesize) /** * Increments the download count of all provided attachments * -* @param \phpbb\db\driver\driver $db The database object +* @param \phpbb\db\driver\driver_interface $db The database object * @param array|int $ids The attach_id of each attachment * * @return null @@ -617,7 +621,7 @@ function phpbb_increment_downloads($db, $ids) /** * Handles authentication when downloading attachments from a post or topic * -* @param \phpbb\db\driver\driver $db The database object +* @param \phpbb\db\driver\driver_interface $db The database object * @param \phpbb\auth\auth $auth The authentication object * @param int $topic_id The id of the topic that we are downloading from * @@ -663,7 +667,7 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id) /** * Handles authentication when downloading attachments from PMs * -* @param \phpbb\db\driver\driver $db The database object +* @param \phpbb\db\driver\driver_interface $db The database object * @param \phpbb\auth\auth $auth The authentication object * @param int $user_id The user id * @param int $msg_id The id of the PM that we are downloading from @@ -690,7 +694,7 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) /** * Checks whether a user can download from a particular PM * -* @param \phpbb\db\driver\driver $db The database object +* @param \phpbb\db\driver\driver_interface $db The database object * @param int $user_id The user id * @param int $msg_id The id of the PM that we are downloading from * @@ -714,27 +718,6 @@ function phpbb_download_check_pm_auth($db, $user_id, $msg_id) } /** -* Cleans a filename of any characters that could potentially cause a problem on -* a user's filesystem. -* -* @param string $filename The filename to clean -* -* @return string The cleaned filename -*/ -function phpbb_download_clean_filename($filename) -{ - $bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|'); - - // rawurlencode to convert any potentially 'bad' characters that we missed - $filename = rawurlencode(str_replace($bad_chars, '_', $filename)); - - // Turn the %xx entities created by rawurlencode to _ - $filename = preg_replace("/%(\w{2})/", '_', $filename); - - return $filename; -} - -/** * Check if the browser is internet explorer version 7+ * * @param string $user_agent User agent HTTP header diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php deleted file mode 100644 index deb304b838..0000000000 --- a/phpBB/includes/functions_install.php +++ /dev/null @@ -1,583 +0,0 @@ -<?php -/** -* -* @package install -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Returns an array of available DBMS with some data, if a DBMS is specified it will only -* return data for that DBMS and will load its extension if necessary. -*/ -function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false) -{ - global $lang; - $available_dbms = array( - 'firebird' => array( - 'LABEL' => 'FireBird', - 'SCHEMA' => 'firebird', - 'MODULE' => 'interbase', - 'DELIM' => ';;', - 'DRIVER' => 'phpbb\db\driver\firebird', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - // Note: php 5.5 alpha 2 deprecated mysql. - // Keep mysqli before mysql in this list. - 'mysqli' => array( - 'LABEL' => 'MySQL with MySQLi Extension', - 'SCHEMA' => 'mysql_41', - 'MODULE' => 'mysqli', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\mysqli', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mysql' => array( - 'LABEL' => 'MySQL', - 'SCHEMA' => 'mysql', - 'MODULE' => 'mysql', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\mysql', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mssql' => array( - 'LABEL' => 'MS SQL Server 2000+', - 'SCHEMA' => 'mssql', - 'MODULE' => 'mssql', - 'DELIM' => 'GO', - 'DRIVER' => 'phpbb\db\driver\mssql', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mssql_odbc'=> array( - 'LABEL' => 'MS SQL Server [ ODBC ]', - 'SCHEMA' => 'mssql', - 'MODULE' => 'odbc', - 'DELIM' => 'GO', - 'DRIVER' => 'phpbb\db\driver\mssql_odbc', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mssqlnative' => array( - 'LABEL' => 'MS SQL Server 2005+ [ Native ]', - 'SCHEMA' => 'mssql', - 'MODULE' => 'sqlsrv', - 'DELIM' => 'GO', - 'DRIVER' => 'phpbb\db\driver\mssqlnative', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - 'oracle' => array( - 'LABEL' => 'Oracle', - 'SCHEMA' => 'oracle', - 'MODULE' => 'oci8', - 'DELIM' => '/', - 'DRIVER' => 'phpbb\db\driver\oracle', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - 'postgres' => array( - 'LABEL' => 'PostgreSQL 8.3+', - 'SCHEMA' => 'postgres', - 'MODULE' => 'pgsql', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\postgres', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'sqlite' => array( - 'LABEL' => 'SQLite', - 'SCHEMA' => 'sqlite', - 'MODULE' => 'sqlite', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\sqlite', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - ); - - if ($dbms) - { - if (isset($available_dbms[$dbms])) - { - $available_dbms = array($dbms => $available_dbms[$dbms]); - } - else - { - return array(); - } - } - - // now perform some checks whether they are really available - foreach ($available_dbms as $db_name => $db_ary) - { - if ($only_20x_options && !$db_ary['2.0.x']) - { - if ($return_unavailable) - { - $available_dbms[$db_name]['AVAILABLE'] = false; - } - else - { - unset($available_dbms[$db_name]); - } - continue; - } - - $dll = $db_ary['MODULE']; - - if (!@extension_loaded($dll)) - { - if ($return_unavailable) - { - $available_dbms[$db_name]['AVAILABLE'] = false; - } - else - { - unset($available_dbms[$db_name]); - } - continue; - } - $any_db_support = true; - } - - if ($return_unavailable) - { - $available_dbms['ANY_DB_SUPPORT'] = $any_db_support; - } - return $available_dbms; -} - -/** -* Generate the drop down of available database options -*/ -function dbms_select($default = '', $only_20x_options = false) -{ - global $lang; - - $available_dbms = get_available_dbms(false, false, $only_20x_options); - $dbms_options = ''; - foreach ($available_dbms as $dbms_name => $details) - { - $selected = ($dbms_name == $default) ? ' selected="selected"' : ''; - $dbms_options .= '<option value="' . $dbms_name . '"' . $selected .'>' . $lang['DLL_' . strtoupper($dbms_name)] . '</option>'; - } - return $dbms_options; -} - -/** -* Get tables of a database -* -* @deprecated -*/ -function get_tables(&$db) -{ - $db_tools = new \phpbb\db\tools($db); - - return $db_tools->sql_list_tables(); -} - -/** -* Used to test whether we are able to connect to the database the user has specified -* and identify any problems (eg there are already tables with the names we want to use -* @param array $dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()} -* necessary extensions should be loaded already -*/ -function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true) -{ - global $phpbb_root_path, $phpEx, $config, $lang; - - $dbms = $dbms_details['DRIVER']; - - // Instantiate it and set return on error true - $db = new $dbms(); - $db->sql_return_on_error(true); - - // Check that we actually have a database name before going any further..... - if ($dbms_details['DRIVER'] != 'phpbb\db\driver\sqlite' && $dbms_details['DRIVER'] != 'phpbb\db\driver\oracle' && $dbname === '') - { - $error[] = $lang['INST_ERR_DB_NO_NAME']; - return false; - } - - // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea - if ($dbms_details['DRIVER'] == 'phpbb\db\driver\sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) - { - $error[] = $lang['INST_ERR_DB_FORUM_PATH']; - return false; - } - - // Check the prefix length to ensure that index names are not too long and does not contain invalid characters - switch ($dbms_details['DRIVER']) - { - case 'phpbb\db\driver\mysql': - case 'phpbb\db\driver\mysqli': - if (strspn($table_prefix, '-./\\') !== 0) - { - $error[] = $lang['INST_ERR_PREFIX_INVALID']; - return false; - } - - // no break; - - case 'phpbb\db\driver\postgres': - $prefix_length = 36; - break; - - case 'phpbb\db\driver\mssql': - case 'phpbb\db\driver\mssql_odbc': - case 'phpbb\db\driver\mssqlnative': - $prefix_length = 90; - break; - - case 'phpbb\db\driver\sqlite': - $prefix_length = 200; - break; - - case 'phpbb\db\driver\firebird': - case 'phpbb\db\driver\oracle': - $prefix_length = 6; - break; - } - - if (strlen($table_prefix) > $prefix_length) - { - $error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length); - return false; - } - - // Try and connect ... - if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) - { - $db_error = $db->sql_error(); - $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']); - } - else - { - // Likely matches for an existing phpBB installation - if (!$prefix_may_exist) - { - $temp_prefix = strtolower($table_prefix); - $table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users'); - - $tables = get_tables($db); - $tables = array_map('strtolower', $tables); - $table_intersect = array_intersect($tables, $table_ary); - - if (sizeof($table_intersect)) - { - $error[] = $lang['INST_ERR_PREFIX']; - } - } - - // Make sure that the user has selected a sensible DBAL for the DBMS actually installed - switch ($dbms_details['DRIVER']) - { - case 'phpbb\db\driver\mysqli': - if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) - { - $error[] = $lang['INST_ERR_DB_NO_MYSQLI']; - } - break; - - case 'phpbb\db\driver\sqlite': - if (version_compare(sqlite_libversion(), '2.8.2', '<')) - { - $error[] = $lang['INST_ERR_DB_NO_SQLITE']; - } - break; - - case 'phpbb\db\driver\firebird': - // check the version of FB, use some hackery if we can't get access to the server info - if ($db->service_handle !== false && function_exists('ibase_server_info')) - { - $val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION); - preg_match('#V([\d.]+)#', $val, $match); - if ($match[1] < 2) - { - $error[] = $lang['INST_ERR_DB_NO_FIREBIRD']; - } - $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES); - - preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs); - $page_size = intval($regs[1]); - if ($page_size < 8192) - { - $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS']; - } - } - else - { - $sql = "SELECT * - FROM RDB$FUNCTIONS - WHERE RDB$SYSTEM_FLAG IS NULL - AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - // if its a UDF, its too old - if ($row) - { - $error[] = $lang['INST_ERR_DB_NO_FIREBIRD']; - } - else - { - $sql = 'SELECT 1 FROM RDB$DATABASE - WHERE BIN_AND(10, 1) = 0'; - $result = $db->sql_query($sql); - if (!$result) // This can only fail if BIN_AND is not defined - { - $error[] = $lang['INST_ERR_DB_NO_FIREBIRD']; - } - $db->sql_freeresult($result); - } - - // Setup the stuff for our random table - $char_array = array_merge(range('A', 'Z'), range('0', '9')); - $char_len = mt_rand(7, 9); - $char_array_len = sizeof($char_array) - 1; - - $final = ''; - - for ($i = 0; $i < $char_len; $i++) - { - $final .= $char_array[mt_rand(0, $char_array_len)]; - } - - // Create some random table - $sql = 'CREATE TABLE ' . $final . " ( - FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - FIELD2 INTEGER DEFAULT 0 NOT NULL);"; - $db->sql_query($sql); - - // Create an index that should fail if the page size is less than 8192 - $sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);'; - $db->sql_query($sql); - - if (ibase_errmsg() !== false) - { - $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS']; - } - else - { - // Kill the old table - $db->sql_query('DROP TABLE ' . $final . ';'); - } - unset($final); - } - break; - - case 'phpbb\db\driver\oracle': - if ($unicode_check) - { - $sql = "SELECT * - FROM NLS_DATABASE_PARAMETERS - WHERE PARAMETER = 'NLS_RDBMS_VERSION' - OR PARAMETER = 'NLS_CHARACTERSET'"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $stats[$row['parameter']] = $row['value']; - } - $db->sql_freeresult($result); - - if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8') - { - $error[] = $lang['INST_ERR_DB_NO_ORACLE']; - } - } - break; - - case 'phpbb\db\driver\postgres': - if ($unicode_check) - { - $sql = "SHOW server_encoding;"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') - { - $error[] = $lang['INST_ERR_DB_NO_POSTGRES']; - } - } - break; - } - - } - - if ($error_connect && (!isset($error) || !sizeof($error))) - { - return true; - } - return false; -} - -/** -* Removes "/* style" as well as "# style" comments from $input. -* -* @param string $input Input string -* -* @return string Input string with comments removed -*/ -function phpbb_remove_comments($input) -{ - // Remove /* */ comments (http://ostermiller.org/findcomment.html) - $input = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $input); - - // Remove # style comments - $input = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $input)); - - return $input; -} - -/** -* split_sql_file will split an uploaded sql file into single sql statements. -* Note: expects trim() to have already been run on $sql. -*/ -function split_sql_file($sql, $delimiter) -{ - $sql = str_replace("\r" , '', $sql); - $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); - - $data = array_map('trim', $data); - - // The empty case - $end_data = end($data); - - if (empty($end_data)) - { - unset($data[key($data)]); - } - - return $data; -} - -/** -* For replacing {L_*} strings with preg_replace_callback -*/ -function adjust_language_keys_callback($matches) -{ - if (!empty($matches[1])) - { - global $lang, $db; - - return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]); - } -} - -/** -* Creates the output to be stored in a phpBB config.php file -* -* @param array $data Array containing the database connection information -* @param string $dbms The name of the DBAL class to use -* @param bool $debug If the debug constants should be enabled by default or not -* @param bool $debug_test If the DEBUG_TEST constant should be added -* NOTE: Only for use within the testing framework -* -* @return string The output to write to the file -*/ -function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test = false) -{ - $config_data = "<?php\n"; - $config_data .= "// phpBB 3.1.x auto-generated configuration file\n// Do not change anything in this file!\n"; - - $config_data_array = array( - 'dbms' => $dbms, - 'dbhost' => $data['dbhost'], - 'dbport' => $data['dbport'], - 'dbname' => $data['dbname'], - 'dbuser' => $data['dbuser'], - 'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']), - 'table_prefix' => $data['table_prefix'], - - 'phpbb_adm_relative_path' => 'adm/', - - 'acm_type' => 'phpbb\cache\driver\file', - ); - - foreach ($config_data_array as $key => $value) - { - $config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n"; - } - - $config_data .= "\n@define('PHPBB_INSTALLED', true);\n"; - - if ($debug) - { - $config_data .= "@define('DEBUG', true);\n"; - } - else - { - $config_data .= "// @define('DEBUG', true);\n"; - } - - if ($debug_test) - { - $config_data .= "@define('DEBUG_TEST', true);\n"; - } - - return $config_data; -} - -/** -* Check whether a file should be ignored on update -* -* We ignore new files in some circumstances: -* 1. The file is a language file, but the language is not installed -* 2. The file is a style file, but the style is not installed -* 3. The file is a style language file, but the language is not installed -* -* @param string $phpbb_root_path phpBB root path -* @param string $file File including path from phpbb root -* @return bool Should we ignore the new file or add it to the board? -*/ -function phpbb_ignore_new_file_on_update($phpbb_root_path, $file) -{ - $ignore_new_file = false; - - // We ignore new files in some circumstances: - // 1. The file is a language file, but the language is not installed - if (!$ignore_new_file && strpos($file, 'language/') === 0) - { - list($language_dir, $language_iso) = explode('/', $file); - $ignore_new_file = !file_exists($phpbb_root_path . $language_dir . '/' . $language_iso); - } - - // 2. The file is a style file, but the style is not installed - if (!$ignore_new_file && strpos($file, 'styles/') === 0) - { - list($styles_dir, $style_name) = explode('/', $file); - $ignore_new_file = !file_exists($phpbb_root_path . $styles_dir . '/' . $style_name); - } - - // 3. The file is a style language file, but the language is not installed - if (!$ignore_new_file && strpos($file, 'styles/') === 0) - { - $dirs = explode('/', $file); - if (sizeof($dirs) >= 5) - { - list($styles_dir, $style_name, $template_component, $language_iso) = explode('/', $file); - if ($template_component == 'theme' && $language_iso !== 'images') - { - $ignore_new_file = !file_exists($phpbb_root_path . 'language/' . $language_iso); - } - } - } - - return $ignore_new_file; -} diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index b260ffad6e..a38888a861 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -24,8 +28,6 @@ if (!defined('IN_PHPBB')) * @author Florian Schmitz (floele) * * Only slightly modified by Acyd Burn -* -* @package phpBB3 */ class jabber { @@ -85,8 +87,7 @@ class jabber */ static public function can_use_ssl() { - // Will not work with PHP >= 5.2.1 or < 5.2.3RC2 until timeout problem with ssl hasn't been fixed (http://bugs.php.net/41236) - return ((version_compare(PHP_VERSION, '5.2.1', '<') || version_compare(PHP_VERSION, '5.2.3RC2', '>=')) && @extension_loaded('openssl')) ? true : false; + return @extension_loaded('openssl'); } /** diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php new file mode 100644 index 0000000000..dfe3fefbd0 --- /dev/null +++ b/phpBB/includes/functions_mcp.php @@ -0,0 +1,741 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Functions used to generate additional URL paramters +*/ +function phpbb_module__url($mode, &$module_row) +{ + return phpbb_extra_url(); +} + +function phpbb_module_notes_url($mode, &$module_row) +{ + if ($mode == 'front') + { + return ''; + } + + global $user_id; + return ($user_id) ? "&u=$user_id" : ''; +} + +function phpbb_module_warn_url($mode, &$module_row) +{ + if ($mode == 'front' || $mode == 'list') + { + global $forum_id; + + return ($forum_id) ? "&f=$forum_id" : ''; + } + + if ($mode == 'warn_post') + { + global $forum_id, $post_id; + + $url_extra = ($forum_id) ? "&f=$forum_id" : ''; + $url_extra .= ($post_id) ? "&p=$post_id" : ''; + + return $url_extra; + } + else + { + global $user_id; + + return ($user_id) ? "&u=$user_id" : ''; + } +} + +function phpbb_module_main_url($mode, &$module_row) +{ + return phpbb_extra_url(); +} + +function phpbb_module_logs_url($mode, &$module_row) +{ + return phpbb_extra_url(); +} + +function phpbb_module_ban_url($mode, &$module_row) +{ + return phpbb_extra_url(); +} + +function phpbb_module_queue_url($mode, &$module_row) +{ + return phpbb_extra_url(); +} + +function phpbb_module_reports_url($mode, &$module_row) +{ + return phpbb_extra_url(); +} + +function phpbb_extra_url() +{ + global $forum_id, $topic_id, $post_id, $report_id, $user_id; + + $url_extra = ''; + $url_extra .= ($forum_id) ? "&f=$forum_id" : ''; + $url_extra .= ($topic_id) ? "&t=$topic_id" : ''; + $url_extra .= ($post_id) ? "&p=$post_id" : ''; + $url_extra .= ($user_id) ? "&u=$user_id" : ''; + $url_extra .= ($report_id) ? "&r=$report_id" : ''; + + return $url_extra; +} + +/** +* Get simple topic data +*/ +function phpbb_get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) +{ + global $auth, $db, $config, $user; + static $rowset = array(); + + $topics = array(); + + if (!sizeof($topic_ids)) + { + return array(); + } + + // cache might not contain read tracking info, so we can't use it if read + // tracking information is requested + if (!$read_tracking) + { + $cache_topic_ids = array_intersect($topic_ids, array_keys($rowset)); + $topic_ids = array_diff($topic_ids, array_keys($rowset)); + } + else + { + $cache_topic_ids = array(); + } + + if (sizeof($topic_ids)) + { + $sql_array = array( + 'SELECT' => 't.*, f.*', + + 'FROM' => array( + TOPICS_TABLE => 't', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'f.forum_id = t.forum_id' + ) + ), + + 'WHERE' => $db->sql_in_set('t.topic_id', $topic_ids) + ); + + if ($read_tracking && $config['load_db_lastread']) + { + $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' + ); + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' + ); + } + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['topic_id']] = $row; + + if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) + { + continue; + } + + $topics[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($cache_topic_ids as $id) + { + if (!$acl_list || $auth->acl_gets($acl_list, $rowset[$id]['forum_id'])) + { + $topics[$id] = $rowset[$id]; + } + } + + return $topics; +} + +/** +* Get simple post data +*/ +function phpbb_get_post_data($post_ids, $acl_list = false, $read_tracking = false) +{ + global $db, $auth, $config, $user; + + $rowset = array(); + + if (!sizeof($post_ids)) + { + return array(); + } + + $sql_array = array( + 'SELECT' => 'p.*, u.*, t.*, f.*', + + 'FROM' => array( + USERS_TABLE => 'u', + POSTS_TABLE => 'p', + TOPICS_TABLE => 't', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'f.forum_id = t.forum_id' + ) + ), + + 'WHERE' => $db->sql_in_set('p.post_id', $post_ids) . ' + AND u.user_id = p.poster_id + AND t.topic_id = p.topic_id', + ); + + if ($read_tracking && $config['load_db_lastread']) + { + $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' + ); + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' + ); + } + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + unset($sql_array); + + while ($row = $db->sql_fetchrow($result)) + { + if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) + { + continue; + } + + if ($row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) + { + // Moderators without the permission to approve post should at least not see them. ;) + continue; + } + + $rowset[$row['post_id']] = $row; + } + $db->sql_freeresult($result); + + return $rowset; +} + +/** +* Get simple forum data +*/ +function phpbb_get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) +{ + global $auth, $db, $user, $config, $phpbb_container; + + $rowset = array(); + + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + if (!sizeof($forum_id)) + { + return array(); + } + + if ($read_tracking && $config['load_db_lastread']) + { + $read_tracking_join = ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' + AND ft.forum_id = f.forum_id)'; + $read_tracking_select = ', ft.mark_time'; + } + else + { + $read_tracking_join = $read_tracking_select = ''; + } + + $sql = "SELECT f.* $read_tracking_select + FROM " . FORUMS_TABLE . " f$read_tracking_join + WHERE " . $db->sql_in_set('f.forum_id', $forum_id); + $result = $db->sql_query($sql); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + while ($row = $db->sql_fetchrow($result)) + { + if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) + { + continue; + } + + $row['forum_topics_approved'] = $phpbb_content_visibility->get_count('forum_topics', $row, $row['forum_id']); + + $rowset[$row['forum_id']] = $row; + } + $db->sql_freeresult($result); + + return $rowset; +} + +/** +* Get simple pm data +*/ +function phpbb_get_pm_data($pm_ids) +{ + global $db; + + $rowset = array(); + + if (!sizeof($pm_ids)) + { + return array(); + } + + $sql_array = array( + 'SELECT' => 'p.*, u.*', + + 'FROM' => array( + USERS_TABLE => 'u', + PRIVMSGS_TABLE => 'p', + ), + + 'WHERE' => $db->sql_in_set('p.msg_id', $pm_ids) . ' + AND u.user_id = p.author_id', + ); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + unset($sql_array); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['msg_id']] = $row; + } + $db->sql_freeresult($result); + + return $rowset; +} + +/** +* sorting in mcp +* +* @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR +* +* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table +* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table +*/ +function phpbb_mcp_sorting($mode, &$sort_days_val, &$sort_key_val, &$sort_dir_val, &$sort_by_sql_ary, &$sort_order_sql, &$total_val, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE') +{ + global $db, $user, $auth, $template, $request, $phpbb_dispatcher; + + $sort_days_val = $request->variable('st', 0); + $min_time = ($sort_days_val) ? time() - ($sort_days_val * 86400) : 0; + + switch ($mode) + { + case 'viewforum': + $type = 'topics'; + $default_key = 't'; + $default_dir = 'd'; + + $sql = 'SELECT COUNT(topic_id) AS total + FROM ' . TOPICS_TABLE . " + $where_sql forum_id = $forum_id + AND topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ") + AND topic_last_post_time >= $min_time"; + + if (!$auth->acl_get('m_approve', $forum_id)) + { + $sql .= ' AND topic_visibility = ' . ITEM_APPROVED; + } + break; + + case 'viewtopic': + $type = 'posts'; + $default_key = 't'; + $default_dir = 'a'; + + $sql = 'SELECT COUNT(post_id) AS total + FROM ' . POSTS_TABLE . " + $where_sql topic_id = $topic_id + AND post_time >= $min_time"; + + if (!$auth->acl_get('m_approve', $forum_id)) + { + $sql .= ' AND post_visibility = ' . ITEM_APPROVED; + } + break; + + case 'unapproved_posts': + case 'deleted_posts': + $visibility_const = ($mode == 'unapproved_posts') ? array(ITEM_UNAPPROVED, ITEM_REAPPROVE) : ITEM_DELETED; + $type = 'posts'; + $default_key = 't'; + $default_dir = 'd'; + $where_sql .= ($topic_id) ? ' p.topic_id = ' . $topic_id . ' AND' : ''; + + $sql = 'SELECT COUNT(p.post_id) AS total + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + $where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' + AND ' . $db->sql_in_set('p.post_visibility', $visibility_const) .' + AND t.topic_id = p.topic_id + AND t.topic_visibility <> p.post_visibility'; + + if ($min_time) + { + $sql .= ' AND post_time >= ' . $min_time; + } + break; + + case 'unapproved_topics': + case 'deleted_topics': + $visibility_const = ($mode == 'unapproved_topics') ? array(ITEM_UNAPPROVED, ITEM_REAPPROVE) : ITEM_DELETED; + $type = 'topics'; + $default_key = 't'; + $default_dir = 'd'; + + $sql = 'SELECT COUNT(topic_id) AS total + FROM ' . TOPICS_TABLE . " + $where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' + AND ' . $db->sql_in_set('topic_visibility', $visibility_const); + + if ($min_time) + { + $sql .= ' AND topic_time >= ' . $min_time; + } + break; + + case 'pm_reports': + case 'pm_reports_closed': + case 'reports': + case 'reports_closed': + $pm = (strpos($mode, 'pm_') === 0) ? true : false; + + $type = ($pm) ? 'pm_reports' : 'reports'; + $default_key = 't'; + $default_dir = 'd'; + $limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : ''; + + if ($topic_id) + { + $where_sql .= ' p.topic_id = ' . $topic_id . ' AND '; + } + else if ($forum_id) + { + $where_sql .= ' p.forum_id = ' . $forum_id . ' AND '; + } + else if (!$pm) + { + $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND '; + } + + if ($mode == 'reports' || $mode == 'pm_reports') + { + $where_sql .= ' r.report_closed = 0 AND '; + } + else + { + $where_sql .= ' r.report_closed = 1 AND '; + } + + if ($pm) + { + $sql = 'SELECT COUNT(r.report_id) AS total + FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . " p + $where_sql r.post_id = 0 + AND p.msg_id = r.pm_id + $limit_time_sql"; + } + else + { + $sql = 'SELECT COUNT(r.report_id) AS total + FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p + $where_sql r.pm_id = 0 + AND p.post_id = r.post_id + $limit_time_sql"; + } + break; + + case 'viewlogs': + $type = 'logs'; + $default_key = 't'; + $default_dir = 'd'; + + $sql = 'SELECT COUNT(log_id) AS total + FROM ' . LOG_TABLE . " + $where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_'))) . ' + AND log_time >= ' . $min_time . ' + AND log_type = ' . LOG_MOD; + break; + } + + $sort_key_val = $request->variable('sk', $default_key); + $sort_dir_val = $request->variable('sd', $default_dir); + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + switch ($type) + { + case 'topics': + $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); + + $sort_by_sql_ary = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views'); + $limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : ''; + break; + + case 'posts': + $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql_ary = array('a' => 'u.username_clean', 't' => array('p.post_time', 'p.post_id'), 's' => 'p.post_subject'); + $limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : ''; + break; + + case 'reports': + $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql_ary = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => array('p.post_time', 'p.post_id'), 't' => 'r.report_time', 's' => 'p.post_subject'); + break; + + case 'pm_reports': + $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql_ary = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.message_time', 't' => 'r.report_time', 's' => 'p.message_subject'); + break; + + case 'logs': + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + + $sort_by_sql_ary = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + $limit_time_sql = ($min_time) ? "AND l.log_time >= $min_time" : ''; + break; + } + + // Default total to -1 to allow editing by the event + $total_val = -1; + + $sort_by_sql = $sort_by_sql_ary; + $sort_days = $sort_days_val; + $sort_dir = $sort_dir_val; + $sort_key = $sort_key_val; + $total = $total_val; + /** + * This event allows you to control the SQL query used to get the total number + * of reports the user can access. + * + * This total is used for the pagination and for displaying the total number + * of reports to the user + * + * + * @event core.mcp_sorting_query_before + * @var string sql The current SQL search string + * @var string mode An id related to the module(s) the user is viewing + * @var string type Which kind of information is this being used for displaying. Posts, topics, etc... + * @var int forum_id The forum id of the posts the user is trying to access, if not 0 + * @var int topic_id The topic id of the posts the user is trying to access, if not 0 + * @var int sort_days The max age of the oldest report to be shown, in days + * @var string sort_key The way the user has decided to sort the data. + * The valid values must be in the keys of the sort_by_* variables + * @var string sort_dir Either 'd' for "DESC" or 'a' for 'ASC' in the SQL query + * @var int limit_days The possible max ages of the oldest report for the user to choose, in days. + * @var array sort_by_sql SQL text (values) for the possible names of the ways of sorting data (keys). + * @var array sort_by_text Language text (values) for the possible names of the ways of sorting data (keys). + * @var int min_time Integer with the minimum post time that the user is searching for + * @var int limit_time_sql Time limiting options used in the SQL query. + * @var int total The total number of reports that exist. Only set if you want to override the result + * @var string where_sql Extra information included in the WHERE clause. It must end with "WHERE" or "AND" or "OR". + * Set to "WHERE" and set total above -1 to override the total value + * @since 3.1.4-RC1 + */ + $vars = array( + 'sql', + 'mode', + 'type', + 'forum_id', + 'topic_id', + 'sort_days', + 'sort_key', + 'sort_dir', + 'limit_days', + 'sort_by_sql', + 'sort_by_text', + 'min_time', + 'limit_time_sql', + 'total', + 'where_sql', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_sorting_query_before', compact($vars))); + $sort_by_sql_ary = $sort_by_sql; + $sort_days_val = $sort_days; + $sort_key_val = $sort_key; + $sort_dir_val = $sort_dir; + $total_val = $total; + unset($sort_by_sql); + unset($sort_days); + unset($sort_key); + unset($sort_dir); + unset($total); + + if (!isset($sort_by_sql_ary[$sort_key_val])) + { + $sort_key_val = $default_key; + } + + $direction = ($sort_dir_val == 'd') ? 'DESC' : 'ASC'; + + if (is_array($sort_by_sql_ary[$sort_key_val])) + { + $sort_order_sql = implode(' ' . $direction . ', ', $sort_by_sql_ary[$sort_key_val]) . ' ' . $direction; + } + else + { + $sort_order_sql = $sort_by_sql_ary[$sort_key_val] . ' ' . $direction; + } + + $s_limit_days = $s_sort_key = $s_sort_dir = $sort_url = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days_val, $sort_key_val, $sort_dir_val, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url); + + $template->assign_vars(array( + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days) + ); + + if (($sort_days_val && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts', 'deleted_topics', 'deleted_posts')) || $where_sql != 'WHERE') + { + $result = $db->sql_query($sql); + $total_val = (int) $db->sql_fetchfield('total'); + $db->sql_freeresult($result); + } + else if ($total_val < -1) + { + $total_val = -1; + } +} + +/** +* Validate ids +* +* @param array &$ids The relevant ids to check +* @param string $table The table to find the ids in +* @param string $sql_id The ids relevant column name +* @param array $acl_list A list of permissions the user need to have +* @param mixed $singe_forum Limit to one forum id (int) or the first forum found (true) +* +* @return mixed False if no ids were able to be retrieved, true if at least one id left. +* Additionally, this value can be the forum_id assigned if $single_forum was set. +* Therefore checking the result for with !== false is the best method. +*/ +function phpbb_check_ids(&$ids, $table, $sql_id, $acl_list = false, $single_forum = false) +{ + global $db, $auth; + + if (!is_array($ids) || empty($ids)) + { + return false; + } + + $sql = "SELECT $sql_id, forum_id FROM $table + WHERE " . $db->sql_in_set($sql_id, $ids); + $result = $db->sql_query($sql); + + $ids = array(); + $forum_id = false; + + while ($row = $db->sql_fetchrow($result)) + { + if ($acl_list && $row['forum_id'] && !$auth->acl_gets($acl_list, $row['forum_id'])) + { + continue; + } + + if ($acl_list && !$row['forum_id'] && !$auth->acl_getf_global($acl_list)) + { + continue; + } + + // Limit forum? If not, just assign the id. + if ($single_forum === false) + { + $ids[] = $row[$sql_id]; + continue; + } + + // Limit forum to a specific forum id? + // This can get really tricky, because we do not want to create a failure on global topics. :) + if ($row['forum_id']) + { + if ($single_forum !== true && $row['forum_id'] == (int) $single_forum) + { + $forum_id = (int) $single_forum; + } + else if ($forum_id === false) + { + $forum_id = $row['forum_id']; + } + + if ($row['forum_id'] == $forum_id) + { + $ids[] = $row[$sql_id]; + } + } + else + { + // Always add a global topic + $ids[] = $row[$sql_id]; + } + } + $db->sql_freeresult($result); + + if (!sizeof($ids)) + { + return false; + } + + // If forum id is false and ids populated we may have only global announcements selected (returning 0 because of (int) $forum_id) + + return ($single_forum === false) ? true : (int) $forum_id; +} diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 6ceeb50330..0aee9dd3cf 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * Messenger -* @package phpBB3 */ class messenger { @@ -30,8 +33,6 @@ class messenger /** @var \phpbb\template\template */ protected $template; - var $eol = "\n"; - /** * Constructor */ @@ -41,10 +42,6 @@ class messenger $this->use_queue = (!$config['email_package_size']) ? false : $use_queue; $this->subject = ''; - - // Determine EOL character (\n for UNIX, \r\n for Windows and \r for Mac) - $this->eol = (!defined('PHP_EOL')) ? (($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win') ? "\r\n" : (($eol == 'mac') ? "\r" : "\n") : PHP_EOL; - $this->eol = (!$this->eol) ? "\n" : $this->eol; } /** @@ -209,7 +206,7 @@ class messenger */ function template($template_file, $template_lang = '', $template_path = '') { - global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager; + global $config, $phpbb_root_path, $user; $this->setup_template(); @@ -252,7 +249,12 @@ class messenger } } - $this->set_template_paths($template_lang . '_email', $template_paths); + $this->set_template_paths(array( + array( + 'name' => $template_lang . '_email', + 'ext_path' => 'language/' . $template_lang . '/email' + ), + ), $template_paths); $this->template->set_filenames(array( 'body' => $template_file . '.txt', @@ -347,7 +349,7 @@ class messenger */ function error($type, $msg) { - global $user, $phpEx, $phpbb_root_path, $config, $request; + global $user, $config, $request, $phpbb_log; // Session doesn't exist, create it if (!isset($user->session_id) || $user->session_id === '') @@ -357,7 +359,6 @@ class messenger $calling_page = htmlspecialchars_decode($request->server('PHP_SELF')); - $message = ''; switch ($type) { case 'EMAIL': @@ -370,7 +371,7 @@ class messenger } $message .= '<br /><em>' . htmlspecialchars($calling_page) . '</em><br /><br />' . $msg . '<br />'; - add_log('critical', 'LOG_ERROR_' . $type, $message); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_' . $type, false, array($message)); } /** @@ -394,17 +395,9 @@ class messenger */ function generate_message_id() { - global $config; + global $config, $request; - $domain = 'phpbb.generated'; - if ($config['server_name']) - { - $domain = $config['server_name']; - } - else if (!empty($_SERVER['SERVER_NAME'])) - { - $domain = $_SERVER['SERVER_NAME']; - } + $domain = ($config['server_name']) ?: $request->server('SERVER_NAME', 'phpbb.generated'); return md5(unique_id(time())) . '@' . $domain; } @@ -459,7 +452,7 @@ class messenger */ function msg_email() { - global $config, $user; + global $config; if (empty($config['email_enable'])) { @@ -484,17 +477,20 @@ class messenger $use_queue = true; } + $contact_name = htmlspecialchars_decode($config['board_contact_name']); + $board_contact = (($contact_name !== '') ? '"' . mail_encode($contact_name) . '" ' : '') . '<' . $config['board_contact'] . '>'; + if (empty($this->replyto)) { - $this->replyto = '<' . $config['board_contact'] . '>'; + $this->replyto = $board_contact; } if (empty($this->from)) { - $this->from = '<' . $config['board_contact'] . '>'; + $this->from = $board_contact; } - $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol; + $encode_eol = ($config['smtp_delivery']) ? "\r\n" : PHP_EOL; // Build to, cc and bcc strings $to = $cc = $bcc = ''; @@ -507,7 +503,7 @@ class messenger foreach ($address_ary as $which_ary) { - $$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? mail_encode($which_ary['name'], $encode_eol) . ' <' . $which_ary['email'] . '>' : $which_ary['email']); + ${$type} .= ((${$type} != '') ? ', ' : '') . (($which_ary['name'] != '') ? mail_encode($which_ary['name'], $encode_eol) . ' <' . $which_ary['email'] . '>' : $which_ary['email']); } } @@ -526,7 +522,7 @@ class messenger } else { - $result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, $this->eol, $err_msg); + $result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, PHP_EOL, $err_msg); } if (!$result) @@ -554,7 +550,7 @@ class messenger */ function msg_jabber() { - global $config, $db, $user, $phpbb_root_path, $phpEx; + global $config, $user, $phpbb_root_path, $phpEx; if (empty($config['jab_enable']) || empty($config['jab_host']) || empty($config['jab_username']) || empty($config['jab_password'])) { @@ -626,14 +622,33 @@ class messenger */ protected function setup_template() { - global $config, $phpbb_path_helper, $user, $phpbb_extension_manager; + global $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem; if ($this->template instanceof \phpbb\template\template) { return; } - $this->template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context(), $phpbb_extension_manager); + $this->template = new \phpbb\template\twig\twig( + $phpbb_container->get('path_helper'), + $phpbb_container->get('config'), + new \phpbb\template\context(), + new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), + $phpbb_container->get('path_helper'), + $phpbb_container, + $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader( + $phpbb_filesystem + ) + ), + $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('user'), + $phpbb_container->get('template.twig.extensions.collection'), + $phpbb_extension_manager + ); } /** @@ -649,7 +664,6 @@ class messenger /** * handling email and jabber queue -* @package phpBB3 */ class queue { @@ -660,18 +674,20 @@ class queue var $eol = "\n"; /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** * constructor */ function queue() { - global $phpEx, $phpbb_root_path; + global $phpEx, $phpbb_root_path, $phpbb_filesystem; $this->data = array(); $this->cache_file = "{$phpbb_root_path}cache/queue.$phpEx"; - - // Determine EOL character (\n for UNIX, \r\n for Windows and \r for Mac) - $this->eol = (!defined('PHP_EOL')) ? (($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win') ? "\r\n" : (($eol == 'mac') ? "\r" : "\n") : PHP_EOL; - $this->eol = (!$this->eol) ? "\n" : $this->eol; + $this->filesystem = $phpbb_filesystem; } /** @@ -698,7 +714,7 @@ class queue */ function process() { - global $db, $config, $phpEx, $phpbb_root_path, $user; + global $config, $phpEx, $phpbb_root_path, $user; $lock = new \phpbb\lock\flock($this->cache_file); $lock->acquire(); @@ -709,14 +725,14 @@ class queue { if (!$have_cache_file) { - set_config('last_queue_run', time(), true); + $config->set('last_queue_run', time(), false); } $lock->release(); return; } - set_config('last_queue_run', time(), true); + $config->set('last_queue_run', time(), false); include($this->cache_file); @@ -768,13 +784,15 @@ class queue if (!$this->jabber->connect()) { - messenger::error('JABBER', $user->lang['ERR_JAB_CONNECT']); + $messenger = new messenger(); + $messenger->error('JABBER', $user->lang['ERR_JAB_CONNECT']); continue 2; } if (!$this->jabber->login()) { - messenger::error('JABBER', $user->lang['ERR_JAB_AUTH']); + $messenger = new messenger(); + $messenger->error('JABBER', $user->lang['ERR_JAB_AUTH']); continue 2; } @@ -802,12 +820,13 @@ class queue } else { - $result = phpbb_mail($to, $subject, $msg, $headers, $this->eol, $err_msg); + $result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg); } if (!$result) { - messenger::error('EMAIL', $err_msg); + $messenger = new messenger(); + $messenger->error('EMAIL', $err_msg); continue 2; } break; @@ -817,7 +836,8 @@ class queue { if ($this->jabber->send_message($address, $msg, $subject) === false) { - messenger::error('JABBER', $this->jabber->get_log()); + $messenger = new messenger(); + $messenger->error('JABBER', $this->jabber->get_log()); continue 3; } } @@ -853,7 +873,14 @@ class queue fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>"); fclose($fp); - phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + try + { + $this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } } } @@ -895,7 +922,16 @@ class queue fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>"); fclose($fp); - phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + try + { + $this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + $this->data = array(); } $lock->release(); @@ -1125,7 +1161,6 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) * SMTP Class * Auth Mechanisms originally taken from the AUTH Modules found within the PHP Extension and Application Repository (PEAR) * See docs/AUTHORS for more details -* @package phpBB3 */ class smtp_class { @@ -1222,8 +1257,6 @@ class smtp_class { global $user; - $err_msg = ''; - // Here we try to determine the *real* hostname (reverse DNS entry preferrably) $local_host = $user->host; @@ -1258,7 +1291,7 @@ class smtp_class $this->server_send("QUIT"); fclose($this->socket); - $result = $this->pop_before_smtp($hostname, $username, $password); + $this->pop_before_smtp($hostname, $username, $password); $username = $password = $default_auth_method = ''; // We need to close the previous session, else the server is not @@ -1700,7 +1733,7 @@ function mail_encode($str, $eol = "\r\n") */ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) { - global $config, $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx; // We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used... // Reference: http://bugs.php.net/bug.php?id=15841 diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 53055752f6..7a1991d69a 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * Class handling all types of 'plugins' (a future term) -* @package phpBB3 */ class p_master { @@ -79,8 +82,8 @@ class p_master */ function list_modules($p_class) { - global $auth, $db, $user, $cache; - global $config, $phpbb_root_path, $phpEx; + global $db, $user, $cache; + global $phpbb_dispatcher; // Sanitise for future path use, it's escaped as appropriate for queries $this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class)); @@ -125,8 +128,17 @@ class p_master // Clean up module cache array to only let survive modules the user can access $right_id = false; + + $hide_categories = array(); foreach ($this->module_cache['modules'] as $key => $row) { + // When the module has no mode (category) we check whether it has visible children + // before listing it as well. + if (!$row['module_mode']) + { + $hide_categories[(int) $row['module_id']] = $key; + } + // Not allowed to view module? if (!$this->module_auth_self($row['module_auth'])) { @@ -161,6 +173,22 @@ class p_master $right_id = $row['right_id']; continue; } + + if ($row['module_mode']) + { + // The parent category has a visible child + // So remove it and all its parents from the hide array + unset($hide_categories[(int) $row['parent_id']]); + foreach ($this->module_cache['parents'][$row['module_id']] as $module_id => $row_id) + { + unset($hide_categories[$module_id]); + } + } + } + + foreach ($hide_categories as $module_id => $row_id) + { + unset($this->module_cache['modules'][$row_id]); } // Re-index (this is needed, else we are not able to array_slice later) @@ -222,13 +250,25 @@ class p_master // Function for building 'url_extra' $short_name = $this->get_short_name($row['module_basename']); - $url_func = '_module_' . $short_name . '_url'; + $url_func = 'phpbb_module_' . $short_name . '_url'; + if (!function_exists($url_func)) + { + $url_func = '_module_' . $short_name . '_url'; + } // Function for building the language name - $lang_func = '_module_' . $short_name . '_lang'; + $lang_func = 'phpbb_module_' . $short_name . '_lang'; + if (!function_exists($lang_func)) + { + $lang_func = '_module_' . $short_name . '_lang'; + } // Custom function for calling parameters on module init (for example assigning template variables) - $custom_func = '_module_' . $short_name; + $custom_func = 'phpbb_module_' . $short_name; + if (!function_exists($custom_func)) + { + $custom_func = '_module_' . $short_name; + } $names[$row['module_basename'] . '_' . $row['module_mode']][] = true; @@ -259,6 +299,20 @@ class p_master $custom_func($row['module_mode'], $module_row); } + /** + * This event allows to modify parameters for building modules list + * + * @event core.modify_module_row + * @var string url_func Function for building 'url_extra' + * @var string lang_func Function for building the language name + * @var string custom_func Custom function for calling parameters on module init + * @var array row Array holding the basic module data + * @var array module_row Array holding the module display parameters + * @since 3.1.0-b3 + */ + $vars = array('url_func', 'lang_func', 'custom_func', 'row', 'module_row'); + extract($phpbb_dispatcher->trigger_event('core.modify_module_row', compact($vars))); + $this->module_ary[] = $module_row; } @@ -359,6 +413,7 @@ class p_master 'cfg_([a-z0-9_]+)' => '(int) $config[\'\\1\']', 'request_([a-zA-Z0-9_]+)' => '$request->variable(\'\\1\', false)', 'ext_([a-zA-Z0-9_/]+)' => 'array_key_exists(\'\\1\', $phpbb_extension_manager->all_enabled())', + 'authmethod_([a-z0-9_\\\\]+)' => '($config[\'auth_method\'] === \'\\1\')', ); /** @@ -370,7 +425,7 @@ class p_master * @var string module_auth The module_auth of the current * module * @var int forum_id The current forum_id - * @since 3.1-A3 + * @since 3.1.0-a3 */ $vars = array('valid_tokens', 'module_auth', 'forum_id'); extract($phpbb_dispatcher->trigger_event('core.module_auth', compact($vars))); @@ -413,7 +468,9 @@ class p_master ); $is_auth = false; + // @codingStandardsIgnoreStart eval('$is_auth = (int) (' . $module_auth . ');'); + // @codingStandardsIgnoreEnd return $is_auth; } @@ -423,13 +480,21 @@ class p_master */ function set_active($id = false, $mode = false) { + global $request; + $icat = false; $this->active_module = false; - if (request_var('icat', '')) + if ($request->variable('icat', '')) { $icat = $id; - $id = request_var('icat', ''); + $id = $request->variable('icat', ''); + } + + // Restore the backslashes in class names + if (strpos($id, '-') !== false) + { + $id = str_replace('-', '\\', $id); } if ($id && !is_numeric($id) && !$this->is_full_class($id)) @@ -484,18 +549,20 @@ class p_master * * This method loads a given module, passing it the relevant id and mode. * - * @param string $mode mode, as passed through to the module + * @param string|false $mode mode, as passed through to the module + * @param string|false $module_url If supplied, we use this module url + * @param bool $execute_module If true, at the end we execute the main method for the new instance */ function load_active($mode = false, $module_url = false, $execute_module = true) { - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template, $request; $module_path = $this->include_path . $this->p_class; - $icat = request_var('icat', ''); + $icat = $request->variable('icat', ''); if ($this->active_module === false) { - trigger_error('Module not accessible', E_USER_ERROR); + trigger_error('MODULE_NOT_ACCESS', E_USER_ERROR); } // new modules use the full class names, old ones are always called <type>_<name>, e.g. acp_board @@ -503,14 +570,14 @@ class p_master { if (!file_exists("$module_path/{$this->p_name}.$phpEx")) { - trigger_error("Cannot find module $module_path/{$this->p_name}.$phpEx", E_USER_ERROR); + trigger_error($user->lang('MODULE_NOT_FIND', "$module_path/{$this->p_name}.$phpEx"), E_USER_ERROR); } include("$module_path/{$this->p_name}.$phpEx"); if (!class_exists($this->p_name)) { - trigger_error("Module file $module_path/{$this->p_name}.$phpEx does not contain correct class [{$this->p_name}]", E_USER_ERROR); + trigger_error($user->lang('MODULE_FILE_INCORRECT_CLASS', "$module_path/{$this->p_name}.$phpEx", $this->p_name), E_USER_ERROR); } } @@ -541,7 +608,12 @@ class p_master if (is_dir($module_style_dir)) { - $template->set_custom_style('adm', array($module_style_dir, $phpbb_admin_path . 'style')); + $template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), + ), array($module_style_dir, $phpbb_admin_path . 'style')); } } @@ -552,7 +624,7 @@ class p_master } // Not being able to overwrite ;) - $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } else { @@ -584,7 +656,7 @@ class p_master $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; } - $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } // Add url_extra parameter to u_action url @@ -657,8 +729,6 @@ class p_master */ function get_parents($parent_id, $left_id, $right_id, &$all_parents) { - global $db; - $parents = array(); if ($parent_id > 0) @@ -750,7 +820,7 @@ class p_master // Make sure the module_url has a question mark set, effectively determining the delimiter to use $delim = (strpos($module_url, '?') === false) ? '?' : '&'; - $current_padding = $current_depth = 0; + $current_depth = 0; $linear_offset = 'l_block1'; $tabular_offset = 't_block2'; @@ -837,7 +907,7 @@ class p_master else { // if the category has a name, then use it. - $u_title .= $this->get_module_identifier($item_ary['name'], $item_ary['id']); + $u_title .= $this->get_module_identifier($item_ary['name']); } // If the item is not a category append the mode if (!$item_ary['cat']) @@ -906,7 +976,7 @@ class p_master * * @param string $class module class (acp/mcp/ucp) * @param string $name module name (class name of the module, or its basename - * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra) + * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra) * @param string $mode mode, as passed through to the module * */ @@ -931,7 +1001,7 @@ class p_master /** * Display module */ - function display($page_title, $display_online_list = true) + function display($page_title, $display_online_list = false) { global $template, $user; @@ -978,19 +1048,45 @@ class p_master */ function add_mod_info($module_class) { - global $user, $phpEx; - - global $phpbb_extension_manager; + global $config, $user, $phpEx, $phpbb_extension_manager; $finder = $phpbb_extension_manager->get_finder(); - $lang_files = $finder + // We grab the language files from the default, English and user's language. + // So we can fall back to the other files like we do when using add_lang() + $default_lang_files = $english_lang_files = $user_lang_files = array(); + + // Search for board default language if it's not the user language + if ($config['default_lang'] != $user->lang_name) + { + $default_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/' . basename($config['default_lang'])) + ->core_path('language/' . basename($config['default_lang']) . '/mods/') + ->find(); + } + + // Search for english, if its not the default or user language + if ($config['default_lang'] != 'en' && $user->lang_name != 'en') + { + $english_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/en') + ->core_path('language/en/mods/') + ->find(); + } + + // Find files in the user's language + $user_lang_files = $finder ->prefix('info_' . strtolower($module_class) . '_') ->suffix(".$phpEx") ->extension_directory('/language/' . $user->lang_name) ->core_path('language/' . $user->lang_name . '/mods/') ->find(); + $lang_files = array_merge($english_lang_files, $default_lang_files, $user_lang_files); foreach ($lang_files as $lang_file => $ext_name) { $user->add_lang_ext($ext_name, $lang_file); @@ -1016,26 +1112,24 @@ class p_master } /** - * If the basename contains a \ we dont use that for the URL. + * If the basename contains a \ we don't use that for the URL. * * Firefox is currently unable to correctly copy a urlencoded \ * so users will be unable to post links to modules. - * However we can still fallback to the id instead of the name, - * so we do that in this case. + * However we can replace them with dashes and re-replace them later * * @param string $basename Basename of the module - * @param int $id Id of the module - * @return mixed Identifier that should be used for + * @return string Identifier that should be used for * module link creation */ - protected function get_module_identifier($basename, $id) + protected function get_module_identifier($basename) { if (strpos($basename, '\\') === false) { return $basename; } - return $id; + return str_replace('\\', '-', $basename); } /** diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 8e9cc3a950..56d2408e88 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,12 +24,13 @@ if (!defined('IN_PHPBB')) */ function generate_smilies($mode, $forum_id) { - global $db, $user, $config, $template, $phpbb_dispatcher; - global $phpEx, $phpbb_root_path, $phpbb_container; + global $db, $user, $config, $template, $phpbb_dispatcher, $request; + global $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_path_helper; - $base_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id); + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); - $start = request_var('start', 0); + $base_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id); + $start = $request->variable('start', 0); if ($mode == 'window') { @@ -111,7 +116,7 @@ function generate_smilies($mode, $forum_id) if (sizeof($smilies)) { - $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_path_helper->get_web_root_path(); foreach ($smilies as $row) { @@ -133,7 +138,7 @@ function generate_smilies($mode, $forum_id) * @var string mode Mode of the smilies: window|inline * @var int forum_id The forum ID we are currently in * @var bool display_link Shall we display the "more smilies" link? - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('mode', 'forum_id', 'display_link'); extract($phpbb_dispatcher->trigger_event('core.generate_smilies_after', compact($vars))); @@ -173,7 +178,6 @@ function update_post_information($type, $ids, $return_update_sql = false) $ids = array($ids); } - $update_sql = $empty_forums = $not_empty_forums = array(); if ($type != 'topic') @@ -310,6 +314,7 @@ function posting_gen_topic_icons($mode, $icon_id) 'ICON_IMG' => $root_path . $config['icons_path'] . '/' . $data['img'], 'ICON_WIDTH' => $data['width'], 'ICON_HEIGHT' => $data['height'], + 'ICON_ALT' => $data['alt'], 'S_CHECKED' => ($id == $icon_id) ? true : false, 'S_ICON_CHECKED' => ($id == $icon_id) ? ' checked="checked"' : '') @@ -328,23 +333,20 @@ function posting_gen_topic_icons($mode, $icon_id) */ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) { - global $auth, $user, $template, $topic_type; + global $auth, $user, $template; $toggle = false; $topic_types = array( - 'sticky' => array('const' => POST_STICKY, 'lang' => 'POST_STICKY'), - 'announce' => array('const' => POST_ANNOUNCE, 'lang' => 'POST_ANNOUNCEMENT'), - 'global' => array('const' => POST_GLOBAL, 'lang' => 'POST_GLOBAL') + 'sticky' => array('const' => POST_STICKY, 'lang' => 'POST_STICKY'), + 'announce' => array('const' => POST_ANNOUNCE, 'lang' => 'POST_ANNOUNCEMENT'), + 'announce_global' => array('const' => POST_GLOBAL, 'lang' => 'POST_GLOBAL') ); $topic_type_array = array(); foreach ($topic_types as $auth_key => $topic_value) { - // We do not have a special post global announcement permission - $auth_key = ($auth_key == 'global') ? 'announce' : $auth_key; - if ($auth->acl_get('f_' . $auth_key, $forum_id)) { $toggle = true; @@ -374,8 +376,8 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) $template->assign_vars(array( 'S_TOPIC_TYPE_STICKY' => ($auth->acl_get('f_sticky', $forum_id)), - 'S_TOPIC_TYPE_ANNOUNCE' => ($auth->acl_get('f_announce', $forum_id))) - ); + 'S_TOPIC_TYPE_ANNOUNCE' => ($auth->acl_gets('f_announce', 'f_announce_global', $forum_id)), + )); } return $toggle; @@ -389,164 +391,27 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) * Upload Attachment - filedata is generated here * Uses upload class * +* @deprecated 3.2.0-a1 (To be removed: 3.4.0) +* * @param string $form_name The form name of the file upload input * @param int $forum_id The id of the forum * @param bool $local Whether the file is local or not * @param string $local_storage The path to the local file * @param bool $is_message Whether it is a PM or not -* @param \filespec $local_filedata A filespec object created for the local file -* @param \phpbb\plupload\plupload $plupload The plupload object if one is being used +* @param array $local_filedata A filespec object created for the local file * -* @return object filespec +* @return array File data array */ -function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\plupload\plupload $plupload = null) +function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) { - global $auth, $user, $config, $db, $cache; - global $phpbb_root_path, $phpEx; - - $filedata = array( - 'error' => array() - ); - - include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx); - $upload = new fileupload(); - - if ($config['check_attachment_content'] && isset($config['mime_triggers'])) - { - $upload->set_disallowed_content(explode('|', $config['mime_triggers'])); - } - - $filedata['post_attach'] = $local || $upload->is_valid($form_name); - - if (!$filedata['post_attach']) - { - $filedata['error'][] = $user->lang['NO_UPLOAD_FORM_FOUND']; - return $filedata; - } - - $extensions = $cache->obtain_attach_extensions((($is_message) ? false : (int) $forum_id)); - $upload->set_allowed_extensions(array_keys($extensions['_allowed_'])); - - $file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name, $plupload); - - if ($file->init_error) - { - $filedata['post_attach'] = false; - return $filedata; - } - - // Whether the uploaded file is in the image category - $is_image = (isset($extensions[$file->get('extension')]['display_cat'])) ? $extensions[$file->get('extension')]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE : false; - - if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id)) - { - // Check Image Size, if it is an image - if ($is_image) - { - $file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']); - } - - // Admins and mods are allowed to exceed the allowed filesize - if (!empty($extensions[$file->get('extension')]['max_filesize'])) - { - $allowed_filesize = $extensions[$file->get('extension')]['max_filesize']; - } - else - { - $allowed_filesize = ($is_message) ? $config['max_filesize_pm'] : $config['max_filesize']; - } - - $file->upload->set_max_filesize($allowed_filesize); - } - - $file->clean_filename('unique', $user->data['user_id'] . '_'); - - // Are we uploading an image *and* this image being within the image category? - // Only then perform additional image checks. - $file->move_file($config['upload_path'], false, !$is_image); - - // Do we have to create a thumbnail? - $filedata['thumbnail'] = ($is_image && $config['img_create_thumbnail']) ? 1 : 0; - - if (sizeof($file->error)) - { - $file->remove(); - $filedata['error'] = array_merge($filedata['error'], $file->error); - $filedata['post_attach'] = false; - - return $filedata; - } - - // Make sure the image category only holds valid images... - if ($is_image && !$file->is_image()) - { - $file->remove(); - - if ($plupload && $plupload->is_active()) - { - $plupload->emit_error(104, 'ATTACHED_IMAGE_NOT_IMAGE'); - } - - // If this error occurs a user tried to exploit an IE Bug by renaming extensions - // Since the image category is displaying content inline we need to catch this. - trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']); - } - - $filedata['filesize'] = $file->get('filesize'); - $filedata['mimetype'] = $file->get('mimetype'); - $filedata['extension'] = $file->get('extension'); - $filedata['physical_filename'] = $file->get('realname'); - $filedata['real_filename'] = $file->get('uploadname'); - $filedata['filetime'] = time(); - - // Check our complete quota - if ($config['attachment_quota']) - { - if ($config['upload_dir_size'] + $file->get('filesize') > $config['attachment_quota']) - { - $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED']; - $filedata['post_attach'] = false; + global $phpbb_container; - $file->remove(); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata); + unset($attachment_manager); - return $filedata; - } - } - - // Check free disk space - if ($free_space = @disk_free_space($phpbb_root_path . $config['upload_path'])) - { - 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['post_attach'] = false; - - $file->remove(); - - return $filedata; - } - } - - // Create Thumbnail - if ($filedata['thumbnail']) - { - $source = $file->get('destination_file'); - $destination = $file->get('destination_path') . '/thumb_' . $file->get('realname'); - - if (!create_thumbnail($source, $destination, $file->get('mimetype'))) - { - $filedata['thumbnail'] = 0; - } - } - - return $filedata; + return $file; } /** @@ -645,7 +510,7 @@ function get_supported_image_types($type = false) */ function create_thumbnail($source, $destination, $mimetype) { - global $config; + global $config, $phpbb_filesystem; $min_filesize = (int) $config['img_min_thumb_filesize']; $img_filesize = (file_exists($source)) ? @filesize($source) : false; @@ -797,7 +662,14 @@ function create_thumbnail($source, $destination, $mimetype) return false; } - phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE); + try + { + $phpbb_filesystem->phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } return true; } @@ -886,7 +758,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $msg_id = 0) { global $user, $db, $template, $auth; - global $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpbb_dispatcher, $phpEx; $topic_ids = $forum_ids = $draft_rows = array(); @@ -929,7 +801,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms $topic_rows = array(); if (sizeof($topic_ids)) { - $sql = 'SELECT topic_id, forum_id, topic_title + $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids)); $result = $db->sql_query($sql); @@ -940,6 +812,20 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms } $db->sql_freeresult($result); } + + /** + * Drafts found and their topics + * Edit $draft_rows in order to add or remove drafts loaded + * + * @event core.load_drafts_draft_list_result + * @var array draft_rows The drafts query result. Includes its forum id and everything about the draft + * @var array topic_ids The list of topics got from the topics table + * @var array topic_rows The topics that draft_rows references + * @since 3.1.0-RC3 + */ + $vars = array('draft_rows', 'topic_ids', 'topic_rows'); + extract($phpbb_dispatcher->trigger_event('core.load_drafts_draft_list_result', compact($vars))); + unset($topic_ids); $template->assign_var('S_SHOW_DRAFTS', true); @@ -947,7 +833,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms foreach ($draft_rows as $draft) { $link_topic = $link_forum = $link_pm = false; - $insert_url = $view_url = $title = ''; + $view_url = $title = ''; if (isset($topic_rows[$draft['topic_id']]) && ( @@ -1000,10 +886,12 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms */ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true) { - global $user, $auth, $db, $template, $bbcode, $cache; - global $config, $phpbb_root_path, $phpEx, $phpbb_container; + global $user, $auth, $db, $template; + global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $sql_sort = ($mode == 'post_review') ? 'ASC' : 'DESC'; // Go ahead and pull all data for this topic $sql = 'SELECT p.post_id @@ -1012,8 +900,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . ' ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' ' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . ' - ORDER BY p.post_time '; - $sql .= ($mode == 'post_review') ? 'ASC' : 'DESC'; + ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort; $result = $db->sql_query_limit($sql, $config['posts_per_page']); $post_list = array(); @@ -1058,13 +945,11 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); - $bbcode_bitfield = ''; $rowset = array(); $has_attachments = false; while ($row = $db->sql_fetchrow($result)) { $rowset[$row['post_id']] = $row; - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); if ($row['post_attachment']) { @@ -1073,19 +958,10 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id } $db->sql_freeresult($result); - // Instantiate BBCode class - if (!isset($bbcode) && $bbcode_bitfield !== '') - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode(base64_encode($bbcode_bitfield)); - } - // Grab extensions - $extensions = $attachments = array(); + $attachments = array(); if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) { - $extensions = $cache->obtain_attach_extensions($forum_id); - // Get attachments... $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' @@ -1140,7 +1016,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $post_anchor = ($mode == 'post_review') ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id']; $u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f=$forum_id&t=$topic_id&p={$row['post_id']}&view=show#p{$row['post_id']}"); - $template->assign_block_vars($mode . '_row', array( + $post_row = array( 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), @@ -1149,7 +1025,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, 'S_FRIEND' => ($row['friend']) ? true : false, 'S_IGNORE_POST' => ($row['foe']) ? true : false, - 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"dE('{$post_anchor}', 1); return false;\">", '</a>') : '', + 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"phpbb.toggleDisplay('{$post_anchor}', 1); return false;\">", '</a>') : '', 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), @@ -1157,11 +1033,41 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'POST_ID' => $row['post_id'], + 'POST_TIME' => $row['post_time'], + 'USER_ID' => $row['user_id'], 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], 'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=post_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', - 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '') + 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', ); + $current_row_number = $i; + + /** + * Event to modify the template data block for topic reviews + * + * @event core.topic_review_modify_row + * @var string mode The review mode + * @var int topic_id The topic that is being reviewed + * @var int forum_id The topic's forum + * @var int cur_post_id Post offset id + * @var int current_row_number Number of the current row being iterated + * @var array post_row Template block array of the current post + * @var array row Array with original post and user data + * @since 3.1.4-RC1 + */ + $vars = array( + 'mode', + 'topic_id', + 'forum_id', + 'cur_post_id', + 'current_row_number', + 'post_row', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_row', compact($vars))); + + $template->assign_block_vars($mode . '_row', $post_row); + // Display not already displayed Attachments for this post, we already parsed them. ;) if (!empty($attachments[$row['post_id']])) { @@ -1193,7 +1099,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id */ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '') { - global $db, $user, $auth, $phpbb_container; + global $db, $user, $phpbb_container; global $config, $phpEx, $phpbb_root_path; // Specify our post mode @@ -1240,6 +1146,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ $db->sql_freeresult($result); } + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // (Soft) delete the post @@ -1281,25 +1188,13 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ if ($is_soft) { - $topic_row = array(); $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason); } else { delete_topics('topic_id', array($topic_id), false); - if ($data['topic_visibility'] == ITEM_APPROVED) - { - $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1'; - } - else if ($data['topic_visibility'] == ITEM_UNAPPROVED) - { - $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1'; - } - else if ($data['topic_visibility'] == ITEM_DELETED) - { - $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1'; - } + $phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data); $update_sql = update_post_information('forum', $forum_id, true); if (sizeof($update_sql)) @@ -1317,7 +1212,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ WHERE p.topic_id = $topic_id AND p.poster_id = u.user_id AND p.post_visibility = " . ITEM_APPROVED . ' - ORDER BY p.post_time ASC'; + ORDER BY p.post_time ASC, p.post_id ASC'; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1329,7 +1224,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u WHERE p.topic_id = $topic_id AND p.poster_id = u.user_id - ORDER BY p.post_time ASC"; + ORDER BY p.post_time ASC, p.post_id ASC"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1384,7 +1279,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ WHERE topic_id = $topic_id AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . ' AND post_time > ' . $data['post_time'] . ' - ORDER BY post_time ASC'; + ORDER BY post_time ASC, post_id ASC'; $result = $db->sql_query_limit($sql, 1); $next_post_id = (int) $db->sql_fetchfield('post_id'); $db->sql_freeresult($result); @@ -1395,20 +1290,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ { if (!$is_soft) { - if ($data['post_visibility'] == ITEM_APPROVED) - { - $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data); - } - else if ($data['post_visibility'] == ITEM_UNAPPROVED) - { - $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1'; - $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1'; - } - else if ($data['post_visibility'] == ITEM_DELETED) - { - $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1'; - $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1'; - } + $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data); } $sql = 'SELECT 1 AS has_attachments @@ -1475,10 +1357,12 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ * Submit Post * @todo Split up and create lightweight, simple API for this. */ -function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true) +function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data_ary, $update_message = true, $update_search_index = true) { - global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher; + global $db, $auth, $user, $config, $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; + $poll = $poll_ary; + $data = $data_ary; /** * Modify the data for post submitting * @@ -1493,7 +1377,21 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u * @var bool update_search_index Flag indicating if the search index will be updated * @since 3.1.0-a4 */ - extract($phpbb_dispatcher->trigger_event('core.modify_submit_post_data', compact(array('mode', 'subject', 'username', 'topic_type', 'poll', 'data', 'update_message', 'update_search_index')))); + $vars = array( + 'mode', + 'subject', + 'username', + 'topic_type', + 'poll', + 'data', + 'update_message', + 'update_search_index', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_submit_post_data', compact($vars))); + $poll_ary = $poll; + $data_ary = $data; + unset($poll); + unset($data); // We do not handle erasing posts here if ($mode == 'delete') @@ -1501,7 +1399,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u return false; } - $current_time = time(); + if (!empty($data_ary['post_time'])) + { + $current_time = $data_ary['post_time']; + } + else + { + $current_time = time(); + } if ($mode == 'post') { @@ -1515,31 +1420,31 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } else if ($mode == 'edit') { - $post_mode = ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit')); + $post_mode = ($data_ary['topic_posts_approved'] + $data_ary['topic_posts_unapproved'] + $data_ary['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data_ary['topic_first_post_id'] == $data_ary['post_id']) ? 'edit_first_post' : (($data_ary['topic_last_post_id'] == $data_ary['post_id']) ? 'edit_last_post' : 'edit')); } // First of all make sure the subject and topic title are having the correct length. // To achieve this without cutting off between special chars we convert to an array and then count the elements. $subject = truncate_string($subject, 120); - $data['topic_title'] = truncate_string($data['topic_title'], 120); + $data_ary['topic_title'] = truncate_string($data_ary['topic_title'], 120); // Collect some basic information about which tables and which rows to update/insert $sql_data = $topic_row = array(); - $poster_id = ($mode == 'edit') ? $data['poster_id'] : (int) $user->data['user_id']; + $poster_id = ($mode == 'edit') ? $data_ary['poster_id'] : (int) $user->data['user_id']; // Retrieve some additional information if not present - if ($mode == 'edit' && (!isset($data['post_visibility']) || !isset($data['topic_visibility']) || $data['post_visibility'] === false || $data['topic_visibility'] === false)) + if ($mode == 'edit' && (!isset($data_ary['post_visibility']) || !isset($data_ary['topic_visibility']) || $data_ary['post_visibility'] === false || $data_ary['topic_visibility'] === false)) { $sql = 'SELECT p.post_visibility, t.topic_type, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_visibility FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p WHERE t.topic_id = p.topic_id - AND p.post_id = ' . $data['post_id']; + AND p.post_id = ' . $data_ary['post_id']; $result = $db->sql_query($sql); $topic_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $data['topic_visibility'] = $topic_row['topic_visibility']; - $data['post_visibility'] = $topic_row['post_visibility']; + $data_ary['topic_visibility'] = $topic_row['topic_visibility']; + $data_ary['post_visibility'] = $topic_row['post_visibility']; } // This variable indicates if the user is able to post or put into the queue @@ -1547,20 +1452,29 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Check the permissions for post approval. // Moderators must go through post approval like ordinary users. - if (!$auth->acl_get('f_noapprove', $data['forum_id'])) + if (!$auth->acl_get('f_noapprove', $data_ary['forum_id'])) { // Post not approved, but in queue $post_visibility = ITEM_UNAPPROVED; + switch ($post_mode) + { + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + case 'edit_topic': + $post_visibility = ITEM_REAPPROVE; + break; + } } // MODs/Extensions are able to force any visibility on posts - if (isset($data['force_approved_state'])) + if (isset($data_ary['force_approved_state'])) { - $post_visibility = (in_array((int) $data['force_approved_state'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED))) ? (int) $data['force_approved_state'] : $post_visibility; + $post_visibility = (in_array((int) $data_ary['force_approved_state'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_approved_state'] : $post_visibility; } - if (isset($data['force_visibility'])) + if (isset($data_ary['force_visibility'])) { - $post_visibility = (in_array((int) $data['force_visibility'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED))) ? (int) $data['force_visibility'] : $post_visibility; + $post_visibility = (in_array((int) $data_ary['force_visibility'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_visibility'] : $post_visibility; } // Start the transaction here @@ -1572,25 +1486,25 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u case 'post': case 'reply': $sql_data[POSTS_TABLE]['sql'] = array( - 'forum_id' => $data['forum_id'], + 'forum_id' => $data_ary['forum_id'], 'poster_id' => (int) $user->data['user_id'], - 'icon_id' => $data['icon_id'], + 'icon_id' => $data_ary['icon_id'], 'poster_ip' => $user->ip, 'post_time' => $current_time, 'post_visibility' => $post_visibility, - 'enable_bbcode' => $data['enable_bbcode'], - 'enable_smilies' => $data['enable_smilies'], - 'enable_magic_url' => $data['enable_urls'], - 'enable_sig' => $data['enable_sig'], + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], 'post_username' => (!$user->data['is_registered']) ? $username : '', 'post_subject' => $subject, - 'post_text' => $data['message'], - 'post_checksum' => $data['message_md5'], - 'post_attachment' => (!empty($data['attachment_data'])) ? 1 : 0, - 'bbcode_bitfield' => $data['bbcode_bitfield'], - 'bbcode_uid' => $data['bbcode_uid'], - 'post_postcount' => ($auth->acl_get('f_postcount', $data['forum_id'])) ? 1 : 0, - 'post_edit_locked' => $data['post_edit_locked'] + 'post_text' => $data_ary['message'], + 'post_checksum' => $data_ary['message_md5'], + 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'post_postcount' => ($auth->acl_get('f_postcount', $data_ary['forum_id'])) ? 1 : 0, + 'post_edit_locked' => $data_ary['post_edit_locked'] ); break; @@ -1607,19 +1521,19 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // If normal edit display edit info // Display edit info if edit reason given or user is editing his post, which is not the last within the topic. - if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post'))) + if ($data_ary['post_edit_reason'] || (!$auth->acl_get('m_edit', $data_ary['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post'))) { - $data['post_edit_reason'] = truncate_string($data['post_edit_reason'], 255, 255, false); + $data_ary['post_edit_reason'] = truncate_string($data_ary['post_edit_reason'], 255, 255, false); $sql_data[POSTS_TABLE]['sql'] = array( 'post_edit_time' => $current_time, - 'post_edit_reason' => $data['post_edit_reason'], - 'post_edit_user' => (int) $data['post_edit_user'], + 'post_edit_reason' => $data_ary['post_edit_reason'], + 'post_edit_user' => (int) $data_ary['post_edit_user'], ); $sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1'; } - else if (!$data['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data['forum_id'])) + else if (!$data_ary['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data_ary['forum_id'])) { $sql_data[POSTS_TABLE]['sql'] = array( 'post_edit_reason' => '', @@ -1630,8 +1544,15 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods if ($user->data['user_id'] != $poster_id) { - $log_subject = ($subject) ? $subject : $data['topic_title']; - add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']); + $log_subject = ($subject) ? $subject : $data_ary['topic_title']; + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_EDITED', false, array( + 'forum_id' => $data_ary['forum_id'], + 'topic_id' => $data_ary['topic_id'], + 'post_id' => $data_ary['post_id'], + $log_subject, + (!empty($username)) ? $username : $user->lang['GUEST'], + $data_ary['post_edit_reason'] + )); } if (!isset($sql_data[POSTS_TABLE]['sql'])) @@ -1640,32 +1561,31 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( - 'forum_id' => $data['forum_id'], - 'poster_id' => $data['poster_id'], - 'icon_id' => $data['icon_id'], + 'forum_id' => $data_ary['forum_id'], + 'poster_id' => $data_ary['poster_id'], + 'icon_id' => $data_ary['icon_id'], // We will change the visibility later //'post_visibility' => $post_visibility, - 'enable_bbcode' => $data['enable_bbcode'], - 'enable_smilies' => $data['enable_smilies'], - 'enable_magic_url' => $data['enable_urls'], - 'enable_sig' => $data['enable_sig'], - 'post_username' => ($username && $data['poster_id'] == ANONYMOUS) ? $username : '', + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'post_username' => ($username && $data_ary['poster_id'] == ANONYMOUS) ? $username : '', 'post_subject' => $subject, - 'post_checksum' => $data['message_md5'], - 'post_attachment' => (!empty($data['attachment_data'])) ? 1 : 0, - 'bbcode_bitfield' => $data['bbcode_bitfield'], - 'bbcode_uid' => $data['bbcode_uid'], - 'post_edit_locked' => $data['post_edit_locked']) + 'post_checksum' => $data_ary['message_md5'], + 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'post_edit_locked' => $data_ary['post_edit_locked']) ); if ($update_message) { - $sql_data[POSTS_TABLE]['sql']['post_text'] = $data['message']; + $sql_data[POSTS_TABLE]['sql']['post_text'] = $data_ary['message']; } break; } - $topic_row = array(); // And the topic ladies and gentlemen switch ($post_mode) @@ -1675,8 +1595,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_poster' => (int) $user->data['user_id'], 'topic_time' => $current_time, 'topic_last_view_time' => $current_time, - 'forum_id' => $data['forum_id'], - 'icon_id' => $data['icon_id'], + 'forum_id' => $data_ary['forum_id'], + 'icon_id' => $data_ary['icon_id'], 'topic_posts_approved' => ($post_visibility == ITEM_APPROVED) ? 1 : 0, 'topic_posts_softdeleted' => ($post_visibility == ITEM_DELETED) ? 1 : 0, 'topic_posts_unapproved' => ($post_visibility == ITEM_UNAPPROVED) ? 1 : 0, @@ -1686,14 +1606,15 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), 'topic_first_poster_colour' => $user->data['user_colour'], 'topic_type' => $topic_type, - 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0, - 'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : 0, + 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0, + 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'topic_status' => (isset($data_ary['topic_status'])) ? $data_ary['topic_status'] : ITEM_UNLOCKED, ); - if (isset($poll['poll_options']) && !empty($poll['poll_options'])) + if (isset($poll_ary['poll_options']) && !empty($poll_ary['poll_options'])) { - $poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time; - $poll_length = $poll['poll_length'] * 86400; + $poll_start = ($poll_ary['poll_start']) ? $poll_ary['poll_start'] : $current_time; + $poll_length = $poll_ary['poll_length'] * 86400; if ($poll_length < 0) { $poll_start = $poll_start + $poll_length; @@ -1705,15 +1626,15 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } $sql_data[TOPICS_TABLE]['sql'] = array_merge($sql_data[TOPICS_TABLE]['sql'], array( - 'poll_title' => $poll['poll_title'], + 'poll_title' => $poll_ary['poll_title'], 'poll_start' => $poll_start, - 'poll_max_options' => $poll['poll_max_options'], + 'poll_max_options' => $poll_ary['poll_max_options'], 'poll_length' => $poll_length, - 'poll_vote_change' => $poll['poll_vote_change']) + 'poll_vote_change' => $poll_ary['poll_vote_change']) ); } - $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); + $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); if ($post_visibility == ITEM_APPROVED) { @@ -1739,9 +1660,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u (($post_visibility == ITEM_APPROVED) ? ', topic_posts_approved = topic_posts_approved + 1' : '') . (($post_visibility == ITEM_UNAPPROVED) ? ', topic_posts_unapproved = topic_posts_unapproved + 1' : '') . (($post_visibility == ITEM_DELETED) ? ', topic_posts_softdeleted = topic_posts_softdeleted + 1' : '') . - ((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : ''); + ((!empty($data_ary['attachment_data']) || (isset($data_ary['topic_attachment']) && $data_ary['topic_attachment'])) ? ', topic_attachment = 1' : ''); - $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); + $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); if ($post_visibility == ITEM_APPROVED) { @@ -1759,10 +1680,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u case 'edit_topic': case 'edit_first_post': - if (isset($poll['poll_options'])) + if (isset($poll_ary['poll_options'])) { - $poll_start = ($poll['poll_start'] || empty($poll['poll_options'])) ? $poll['poll_start'] : $current_time; - $poll_length = $poll['poll_length'] * 86400; + $poll_start = ($poll_ary['poll_start'] || empty($poll_ary['poll_options'])) ? $poll_ary['poll_start'] : $current_time; + $poll_length = $poll_ary['poll_length'] * 86400; if ($poll_length < 0) { $poll_start = $poll_start + $poll_length; @@ -1775,25 +1696,55 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } $sql_data[TOPICS_TABLE]['sql'] = array( - 'forum_id' => $data['forum_id'], - 'icon_id' => $data['icon_id'], + 'forum_id' => $data_ary['forum_id'], + 'icon_id' => $data_ary['icon_id'], 'topic_title' => $subject, 'topic_first_poster_name' => $username, 'topic_type' => $topic_type, - 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0, - 'poll_title' => (isset($poll['poll_options'])) ? $poll['poll_title'] : '', - 'poll_start' => (isset($poll['poll_options'])) ? $poll_start : 0, - 'poll_max_options' => (isset($poll['poll_options'])) ? $poll['poll_max_options'] : 1, - 'poll_length' => (isset($poll['poll_options'])) ? $poll_length : 0, - 'poll_vote_change' => (isset($poll['poll_vote_change'])) ? $poll['poll_vote_change'] : 0, + 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0, + 'poll_title' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '', + 'poll_start' => (isset($poll_ary['poll_options'])) ? $poll_start : 0, + 'poll_max_options' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1, + 'poll_length' => (isset($poll_ary['poll_options'])) ? $poll_length : 0, + 'poll_vote_change' => (isset($poll_ary['poll_vote_change'])) ? $poll_ary['poll_vote_change'] : 0, 'topic_last_view_time' => $current_time, - 'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0), + 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : (isset($data_ary['topic_attachment']) ? $data_ary['topic_attachment'] : 0), ); break; } + $poll = $poll_ary; + $data = $data_ary; + /** + * Modify sql query data for post submitting + * + * @event core.submit_post_modify_sql_data + * @var array data Array with the data for the post + * @var array poll Array with the poll data for the post + * @var string post_mode Variable containing posting mode value + * @var bool sql_data Array with the data for the posting SQL query + * @var string subject Variable containing post subject value + * @var int topic_type Variable containing topic type value + * @var string username Variable containing post author name + * @since 3.1.3-RC1 + */ + $vars = array( + 'data', + 'poll', + 'post_mode', + 'sql_data', + 'subject', + 'topic_type', + 'username', + ); + extract($phpbb_dispatcher->trigger_event('core.submit_post_modify_sql_data', compact($vars))); + $poll_ary = $poll; + $data_ary = $data; + unset($poll); + unset($data); + // Submit new topic if ($post_mode == 'post') { @@ -1801,10 +1752,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $db->sql_build_array('INSERT', $sql_data[TOPICS_TABLE]['sql']); $db->sql_query($sql); - $data['topic_id'] = $db->sql_nextid(); + $data_ary['topic_id'] = $db->sql_nextid(); $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( - 'topic_id' => $data['topic_id']) + 'topic_id' => $data_ary['topic_id']) ); unset($sql_data[TOPICS_TABLE]['sql']); } @@ -1815,18 +1766,18 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($post_mode == 'reply') { $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( - 'topic_id' => $data['topic_id'], + 'topic_id' => $data_ary['topic_id'], )); } $sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']); $db->sql_query($sql); - $data['post_id'] = $db->sql_nextid(); + $data_ary['post_id'] = $db->sql_nextid(); if ($post_mode == 'post' || $post_visibility == ITEM_APPROVED) { $sql_data[TOPICS_TABLE]['sql'] = array( - 'topic_last_post_id' => $data['post_id'], + 'topic_last_post_id' => $data_ary['post_id'], 'topic_last_post_time' => $current_time, 'topic_last_poster_id' => $sql_data[POSTS_TABLE]['sql']['poster_id'], 'topic_last_poster_name' => ($user->data['user_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username'], @@ -1837,7 +1788,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($post_mode == 'post') { - $sql_data[TOPICS_TABLE]['sql']['topic_first_post_id'] = $data['post_id']; + $sql_data[TOPICS_TABLE]['sql']['topic_first_post_id'] = $data_ary['post_id']; } // Update total post count and forum information @@ -1845,11 +1796,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { if ($post_mode == 'post') { - set_config_count('num_topics', 1, true); + $config->increment('num_topics', 1, false); } - set_config_count('num_posts', 1, true); + $config->increment('num_posts', 1, false); - $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id']; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data_ary['post_id']; $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'"; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time; $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id']; @@ -1865,7 +1816,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_data[TOPICS_TABLE]['sql']) . ' - WHERE topic_id = ' . $data['topic_id']; + WHERE topic_id = ' . $data_ary['topic_id']; $db->sql_query($sql); unset($sql_data[TOPICS_TABLE]['sql']); @@ -1876,14 +1827,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { $sql = 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . ' - WHERE post_id = ' . $data['post_id']; + WHERE post_id = ' . $data_ary['post_id']; $db->sql_query($sql); unset($sql_data[POSTS_TABLE]['sql']); } // Update Poll Tables - if (isset($poll['poll_options'])) + if (isset($poll_ary['poll_options'])) { $cur_poll_options = array(); @@ -1891,7 +1842,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { $sql = 'SELECT * FROM ' . POLL_OPTIONS_TABLE . ' - WHERE topic_id = ' . $data['topic_id'] . ' + WHERE topic_id = ' . $data_ary['topic_id'] . ' ORDER BY poll_option_id'; $result = $db->sql_query($sql); @@ -1905,25 +1856,25 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql_insert_ary = array(); - for ($i = 0, $size = sizeof($poll['poll_options']); $i < $size; $i++) + for ($i = 0, $size = sizeof($poll_ary['poll_options']); $i < $size; $i++) { - if (strlen(trim($poll['poll_options'][$i]))) + if (strlen(trim($poll_ary['poll_options'][$i]))) { if (empty($cur_poll_options[$i])) { // If we add options we need to put them to the end to be able to preserve votes... $sql_insert_ary[] = array( 'poll_option_id' => (int) sizeof($cur_poll_options) + 1 + sizeof($sql_insert_ary), - 'topic_id' => (int) $data['topic_id'], - 'poll_option_text' => (string) $poll['poll_options'][$i] + 'topic_id' => (int) $data_ary['topic_id'], + 'poll_option_text' => (string) $poll_ary['poll_options'][$i] ); } - else if ($poll['poll_options'][$i] != $cur_poll_options[$i]) + else if ($poll_ary['poll_options'][$i] != $cur_poll_options[$i]) { $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . " - SET poll_option_text = '" . $db->sql_escape($poll['poll_options'][$i]) . "' + SET poll_option_text = '" . $db->sql_escape($poll_ary['poll_options'][$i]) . "' WHERE poll_option_id = " . $cur_poll_options[$i]['poll_option_id'] . ' - AND topic_id = ' . $data['topic_id']; + AND topic_id = ' . $data_ary['topic_id']; $db->sql_query($sql); } } @@ -1931,29 +1882,29 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary); - if (sizeof($poll['poll_options']) < sizeof($cur_poll_options)) + if (sizeof($poll_ary['poll_options']) < sizeof($cur_poll_options)) { $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ' - WHERE poll_option_id > ' . sizeof($poll['poll_options']) . ' - AND topic_id = ' . $data['topic_id']; + WHERE poll_option_id > ' . sizeof($poll_ary['poll_options']) . ' + AND topic_id = ' . $data_ary['topic_id']; $db->sql_query($sql); } // If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option - if ($mode == 'edit' && sizeof($poll['poll_options']) != sizeof($cur_poll_options)) + if ($mode == 'edit' && sizeof($poll_ary['poll_options']) != sizeof($cur_poll_options)) { - $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data['topic_id']); - $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data['topic_id']); + $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']); + $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']); } } // Submit Attachments - if (!empty($data['attachment_data']) && $data['post_id'] && in_array($mode, array('post', 'reply', 'quote', 'edit'))) + if (!empty($data_ary['attachment_data']) && $data_ary['post_id'] && in_array($mode, array('post', 'reply', 'quote', 'edit'))) { $space_taken = $files_added = 0; $orphan_rows = array(); - foreach ($data['attachment_data'] as $pos => $attach_row) + foreach ($data_ary['attachment_data'] as $pos => $attach_row) { $orphan_rows[(int) $attach_row['attach_id']] = array(); } @@ -1975,7 +1926,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $db->sql_freeresult($result); } - foreach ($data['attachment_data'] as $pos => $attach_row) + foreach ($data_ary['attachment_data'] as $pos => $attach_row) { if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']])) { @@ -2003,8 +1954,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $files_added++; $attach_sql = array( - 'post_msg_id' => $data['post_id'], - 'topic_id' => $data['topic_id'], + 'post_msg_id' => $data_ary['post_id'], + 'topic_id' => $data_ary['topic_id'], 'is_orphan' => 0, 'poster_id' => $poster_id, 'attach_comment' => $attach_row['attach_comment'], @@ -2020,36 +1971,38 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($space_taken && $files_added) { - set_config_count('upload_dir_size', $space_taken, true); - set_config_count('num_files', $files_added, true); + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); } } $first_post_has_topic_info = ($post_mode == 'edit_first_post' && - (($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) || - ($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) || - ($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1))); + (($post_visibility == ITEM_DELETED && $data_ary['topic_posts_softdeleted'] == 1) || + ($post_visibility == ITEM_UNAPPROVED && $data_ary['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_REAPPROVE && $data_ary['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_APPROVED && $data_ary['topic_posts_approved'] == 1))); // Fix the post's and topic's visibility and first/last post information, when the post is edited - if (($post_mode != 'post' && $post_mode != 'reply') && $data['post_visibility'] != $post_visibility) + if (($post_mode != 'post' && $post_mode != 'reply') && $data_ary['post_visibility'] != $post_visibility) { // If the post was not approved, it could also be the starter, // so we sync the starter after approving/restoring, to ensure that the stats are correct // Same applies for the last post - $is_starter = ($post_mode == 'edit_first_post' || $data['post_visibility'] != ITEM_APPROVED); - $is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED); + $is_starter = ($post_mode == 'edit_first_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED); + $is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED); + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); - $phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest); + $phpbb_content_visibility->set_post_visibility($post_visibility, $data_ary['post_id'], $data_ary['topic_id'], $data_ary['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest); } else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info) { - if ($post_visibility == ITEM_APPROVED || $data['topic_visibility'] == $post_visibility) + if ($post_visibility == ITEM_APPROVED || $data_ary['topic_visibility'] == $post_visibility) { // only the subject can be changed from edit $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'"; // Maybe not only the subject, but also changing anonymous usernames. ;) - if ($data['poster_id'] == ANONYMOUS) + if ($data_ary['poster_id'] == ANONYMOUS) { $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape($username) . "'"; } @@ -2060,13 +2013,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // it just means that we might have to $sql = 'SELECT forum_last_post_id, forum_last_post_subject FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . (int) $data['forum_id']; + WHERE forum_id = ' . (int) $data_ary['forum_id']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); // this post is the latest post in the forum, better update - if ($row['forum_last_post_id'] == $data['post_id'] && ($row['forum_last_post_subject'] !== $subject || $data['poster_id'] == ANONYMOUS)) + if ($row['forum_last_post_id'] == $data_ary['post_id'] && ($row['forum_last_post_subject'] !== $subject || $data_ary['poster_id'] == ANONYMOUS)) { // the post's subject changed if ($row['forum_last_post_subject'] !== $subject) @@ -2075,7 +2028,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Update the user name if poster is anonymous... just in case a moderator changed it - if ($data['poster_id'] == ANONYMOUS) + if ($data_ary['poster_id'] == ANONYMOUS) { $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'"; } @@ -2086,9 +2039,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Update forum stats $where_sql = array( - POSTS_TABLE => 'post_id = ' . $data['post_id'], - TOPICS_TABLE => 'topic_id = ' . $data['topic_id'], - FORUMS_TABLE => 'forum_id = ' . $data['forum_id'], + POSTS_TABLE => 'post_id = ' . $data_ary['post_id'], + TOPICS_TABLE => 'topic_id = ' . $data_ary['topic_id'], + FORUMS_TABLE => 'forum_id = ' . $data_ary['forum_id'], USERS_TABLE => 'user_id = ' . $poster_id ); @@ -2105,7 +2058,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($topic_type == POST_GLOBAL) { $sql = 'DELETE FROM ' . TOPICS_TABLE . ' - WHERE topic_moved_id = ' . $data['topic_id']; + WHERE topic_moved_id = ' . $data_ary['topic_id']; $db->sql_query($sql); } @@ -2113,7 +2066,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $db->sql_transaction('commit'); // Delete draft if post was loaded... - $draft_id = request_var('draft_loaded', 0); + $draft_id = $request->variable('draft_loaded', 0); if ($draft_id) { $sql = 'DELETE FROM ' . DRAFTS_TABLE . " @@ -2123,7 +2076,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Index message contents - if ($update_search_index && $data['enable_indexing']) + if ($update_search_index && $data_ary['enable_indexing']) { // Select the search method and do some additional checks to ensure it can actually be utilised $search_type = $config['search_type']; @@ -2134,30 +2087,30 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } $error = false; - $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); if ($error) { trigger_error($error); } - $search->index($mode, $data['post_id'], $data['message'], $subject, $poster_id, $data['forum_id']); + $search->index($mode, $data_ary['post_id'], $data_ary['message'], $subject, $poster_id, $data_ary['forum_id']); } // Topic Notification, do not change if moderator is changing other users posts... if ($user->data['user_id'] == $poster_id) { - if (!$data['notify_set'] && $data['notify']) + if (!$data_ary['notify_set'] && $data_ary['notify']) { $sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . ' (user_id, topic_id) - VALUES (' . $user->data['user_id'] . ', ' . $data['topic_id'] . ')'; + VALUES (' . $user->data['user_id'] . ', ' . $data_ary['topic_id'] . ')'; $db->sql_query($sql); } - else if (($config['email_enable'] || $config['jab_enable']) && $data['notify_set'] && !$data['notify']) + else if (($config['email_enable'] || $config['jab_enable']) && $data_ary['notify_set'] && !$data_ary['notify']) { $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE user_id = ' . $user->data['user_id'] . ' - AND topic_id = ' . $data['topic_id']; + AND topic_id = ' . $data_ary['topic_id']; $db->sql_query($sql); } } @@ -2165,12 +2118,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($mode == 'post' || $mode == 'reply' || $mode == 'quote') { // Mark this topic as posted to - markread('post', $data['forum_id'], $data['topic_id']); + markread('post', $data_ary['forum_id'], $data_ary['topic_id']); } // Mark this topic as read // We do not use post_time here, this is intended (post_time can have a date in the past if editing a message) - markread('topic', $data['forum_id'], $data['topic_id'], time()); + markread('topic', $data_ary['forum_id'], $data_ary['topic_id'], time()); // if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -2178,7 +2131,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $sql = 'SELECT mark_time FROM ' . FORUMS_TRACK_TABLE . ' WHERE user_id = ' . $user->data['user_id'] . ' - AND forum_id = ' . $data['forum_id']; + AND forum_id = ' . $data_ary['forum_id']; $result = $db->sql_query($sql); $f_mark_time = (int) $db->sql_fetchfield('mark_time'); $db->sql_freeresult($result); @@ -2193,12 +2146,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Update forum info $sql = 'SELECT forum_last_post_time FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $data['forum_id']; + WHERE forum_id = ' . $data_ary['forum_id']; $result = $db->sql_query($sql); $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time'); $db->sql_freeresult($result); - update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false); + update_forum_tracking_info($data_ary['forum_id'], $forum_last_post_time, $f_mark_time, false); } // If a username was supplied or the poster is a guest, we will use the supplied username. @@ -2207,15 +2160,16 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $username = ($username !== '' || !$user->data['is_registered']) ? $username : $user->data['username']; // Send Notifications - $notification_data = array_merge($data, array( - 'topic_title' => (isset($data['topic_title'])) ? $data['topic_title'] : $subject, + $notification_data = array_merge($data_ary, array( + 'topic_title' => (isset($data_ary['topic_title'])) ? $data_ary['topic_title'] : $subject, 'post_username' => $username, 'poster_id' => $poster_id, - 'post_text' => $data['message'], + 'post_text' => $data_ary['message'], 'post_time' => $current_time, 'post_subject' => $subject, )); + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); if ($post_visibility == ITEM_APPROVED) @@ -2224,17 +2178,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { case 'post': $phpbb_notifications->add_notifications(array( - 'quote', - 'topic', + 'notification.type.quote', + 'notification.type.topic', ), $notification_data); break; case 'reply': case 'quote': $phpbb_notifications->add_notifications(array( - 'quote', - 'bookmark', - 'post', + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', ), $notification_data); break; @@ -2243,10 +2197,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u case 'edit': case 'edit_last_post': $phpbb_notifications->update_notifications(array( - 'quote', - 'bookmark', - 'topic', - 'post', + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.topic', + 'notification.type.post', ), $notification_data); break; } @@ -2256,51 +2210,63 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u switch ($mode) { case 'post': - $phpbb_notifications->add_notifications('topic_in_queue', $notification_data); + $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data); break; case 'reply': case 'quote': - $phpbb_notifications->add_notifications('post_in_queue', $notification_data); + $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data); break; case 'edit_topic': case 'edit_first_post': case 'edit': case 'edit_last_post': - // @todo: Check whether these notification deletions are correct - $phpbb_notifications->delete_notifications('topic', $data['topic_id']); - - $phpbb_notifications->delete_notifications(array( - 'quote', - 'bookmark', - 'post', - ), $data['post_id']); + // Nothing to do here break; } } - else if ($post_visibility == ITEM_DELETED) + else if ($post_visibility == ITEM_REAPPROVE) { switch ($mode) { + case 'edit_topic': + case 'edit_first_post': + $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data); + + // Delete the approve_post notification so we can notify the user again, + // when his post got reapproved + $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']); + break; + + case 'edit': + case 'edit_last_post': + $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data); + + // Delete the approve_post notification so we can notify the user again, + // when his post got reapproved + $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']); + break; + case 'post': case 'reply': case 'quote': // Nothing to do here break; - + } + } + else if ($post_visibility == ITEM_DELETED) + { + switch ($mode) + { + case 'post': + case 'reply': + case 'quote': case 'edit_topic': case 'edit_first_post': case 'edit': case 'edit_last_post': - // @todo: Check whether these notification deletions are correct - $phpbb_notifications->delete_notifications('topic', $data['topic_id']); - - $phpbb_notifications->delete_notifications(array( - 'quote', - 'bookmark', - 'post', - ), $data['post_id']); + // Nothing to do here break; } } @@ -2309,22 +2275,24 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($post_visibility == ITEM_APPROVED) { - $params .= '&t=' . $data['topic_id']; + $params .= '&t=' . $data_ary['topic_id']; if ($mode != 'post') { - $params .= '&p=' . $data['post_id']; - $add_anchor = '#p' . $data['post_id']; + $params .= '&p=' . $data_ary['post_id']; + $add_anchor = '#p' . $data_ary['post_id']; } } else if ($mode != 'post' && $post_mode != 'edit_first_post' && $post_mode != 'edit_topic') { - $params .= '&t=' . $data['topic_id']; + $params .= '&t=' . $data_ary['topic_id']; } $url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx"; - $url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor; + $url = append_sid($url, 'f=' . $data_ary['forum_id'] . $params) . $add_anchor; + $poll = $poll_ary; + $data = $data_ary; /** * This event is used for performing actions directly after a post or topic * has been submitted. When a new topic is posted, the topic ID is @@ -2334,13 +2302,38 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u * event is to modify the return URL ($url). * * @event core.submit_post_end - * @var string url The "Return to topic" URL - * @var array data Array of post data about the - * submitted post - * @since 3.1-A3 + * @var string mode Variable containing posting mode value + * @var string subject Variable containing post subject value + * @var string username Variable containing post author name + * @var int topic_type Variable containing topic type value + * @var array poll Array with the poll data for the post + * @var array data Array with the data for the post + * @var int post_visibility Variable containing up to date post visibility + * @var bool update_message Flag indicating if the post will be updated + * @var bool update_search_index Flag indicating if the search index will be updated + * @var string url The "Return to topic" URL + * + * @since 3.1.0-a3 + * @change 3.1.0-RC3 Added vars mode, subject, username, topic_type, + * poll, update_message, update_search_index */ - $vars = array('url', 'data'); + $vars = array( + 'mode', + 'subject', + 'username', + 'topic_type', + 'poll', + 'data', + 'post_visibility', + 'update_message', + 'update_search_index', + 'url', + ); extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars))); + $data_ary = $data; + $poll_ary = $poll; + unset($data); + unset($poll); return $url; } @@ -2361,7 +2354,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u */ function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false) { - global $config, $db, $user, $phpEx, $phpbb_root_path; + global $config, $db, $user, $phpEx, $phpbb_root_path, $phpbb_log; if ($bump_time === false) { @@ -2440,9 +2433,160 @@ function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false) update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false); } - add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_BUMP_TOPIC', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'] + )); $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}"; return $url; } + +/** +* Show upload popup (progress bar) +*/ +function phpbb_upload_popup($forum_style = 0) +{ + global $template, $user; + + ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting'); + + page_header($user->lang['PROGRESS_BAR']); + + $template->set_filenames(array( + 'popup' => 'posting_progress_bar.html') + ); + + $template->assign_vars(array( + 'PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS'])) + ); + + $template->display('popup'); + + garbage_collection(); + exit_handler(); +} + +/** +* Do the various checks required for removing posts as well as removing it +*/ +function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '') +{ + global $user, $auth, $config, $request; + global $phpbb_root_path, $phpEx, $phpbb_log; + + $perm_check = ($is_soft) ? 'softdelete' : 'delete'; + + // If moderator removing post or user itself removing post, present a confirmation screen + if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) + { + $s_hidden_fields = array( + 'p' => $post_id, + 'f' => $forum_id, + 'mode' => ($is_soft) ? 'soft_delete' : 'delete', + ); + + if (confirm_box(true)) + { + $data = array( + 'topic_first_post_id' => $post_data['topic_first_post_id'], + 'topic_last_post_id' => $post_data['topic_last_post_id'], + 'topic_posts_approved' => $post_data['topic_posts_approved'], + 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'], + 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'], + 'topic_visibility' => $post_data['topic_visibility'], + 'topic_type' => $post_data['topic_type'], + 'post_visibility' => $post_data['post_visibility'], + 'post_reported' => $post_data['post_reported'], + 'post_time' => $post_data['post_time'], + 'poster_id' => $post_data['poster_id'], + 'post_postcount' => $post_data['post_postcount'], + ); + + $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $delete_reason); + $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username']; + + if ($next_post_id === false) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'], + $post_username, + $delete_reason + )); + + $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); + $message = $user->lang['POST_DELETED']; + } + else + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + 'post_id' => $post_id, + $post_data['post_subject'], + $post_username, + $delete_reason + )); + + $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; + $message = $user->lang['POST_DELETED']; + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $meta_info . '">', '</a>'); + } + } + + meta_refresh(3, $meta_info); + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . $user->lang('RETURN_FORUM', '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>'); + } + trigger_error($message); + } + else + { + global $user, $template, $request; + + $can_delete = $auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id)); + $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id)); + + $template->assign_vars(array( + 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED, + 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '', + 'S_ALLOWED_DELETE' => $can_delete, + 'S_ALLOWED_SOFTDELETE' => $can_softdelete, + )); + + $l_confirm = 'DELETE_POST'; + if ($post_data['post_visibility'] == ITEM_DELETED) + { + $l_confirm .= '_PERMANENTLY'; + $s_hidden_fields['delete_permanent'] = '1'; + } + else if (!$can_softdelete) + { + $s_hidden_fields['delete_permanent'] = '1'; + } + + confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); + } + } + + // If we are here the user is not able to delete - present the correct error message + if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) + { + trigger_error('DELETE_OWN_POSTS'); + } + + if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) + { + trigger_error('CANNOT_DELETE_REPLIED'); + } + + trigger_error('USER_CANNOT_DELETE'); +} diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index a2a79e032f..d92934e59e 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -208,7 +212,7 @@ function get_folder($user_id, $folder_id = false) ); } - if ($folder_id !== false && !isset($folder[$folder_id])) + if ($folder_id !== false && $folder_id !== PRIVMSGS_HOLD_BOX && !isset($folder[$folder_id])) { trigger_error('UNKNOWN_FOLDER'); } @@ -222,7 +226,7 @@ function get_folder($user_id, $folder_id = false) */ function clean_sentbox($num_sentbox_messages) { - global $db, $user, $config; + global $db, $user; // Check Message Limit if ($user->data['message_limit'] && $num_sentbox_messages > $user->data['message_limit']) @@ -251,8 +255,6 @@ function clean_sentbox($num_sentbox_messages) */ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) { - global $user, $config; - if (!isset($rules[$rule_row['rule_check']][$rule_row['rule_connection']])) { return false; @@ -314,7 +316,6 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) break; } - if (!$result) { return false; @@ -332,7 +333,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) break; case ACTION_DELETE_MESSAGE: - global $db, $auth; + global $db; // Check for admins/mods - users are not allowed to remove those messages... // We do the check here to make sure the data we use is consistent @@ -543,7 +544,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } // We place actions into arrays, to save queries. - $sql = $unread_ids = $delete_ids = $important_ids = array(); + $unread_ids = $delete_ids = $important_ids = array(); foreach ($action_ary as $msg_id => $msg_ary) { @@ -878,9 +879,10 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) global $db, $user, $phpbb_container; + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->mark_notifications_read('pm', $msg_id, $user_id); + $phpbb_notifications->mark_notifications('notification.type.pm', $msg_id, $user_id); $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " SET pm_unread = 0 @@ -911,16 +913,33 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) } } +function mark_folder_read($user_id, $folder_id) +{ + global $db; + + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id = ' . ((int) $folder_id) . ' + AND user_id = ' . ((int) $user_id) . ' + AND pm_unread = 1'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + update_unread_status(true, $row['msg_id'], $user_id, $folder_id); + } + $db->sql_freeresult($result); +} + /** * Handle all actions possible with marked messages */ function handle_mark_actions($user_id, $mark_action) { - global $db, $user, $phpbb_root_path, $phpEx; + global $db, $user, $phpbb_root_path, $phpEx, $request; - $msg_ids = request_var('marked_msg_id', array(0)); - $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX); - $confirm = (isset($_POST['confirm'])) ? true : false; + $msg_ids = $request->variable('marked_msg_id', array(0)); + $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); if (!sizeof($msg_ids)) { @@ -985,7 +1004,7 @@ function handle_mark_actions($user_id, $mark_action) */ function delete_pm($user_id, $msg_ids, $folder_id) { - global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; + global $db, $user, $phpbb_container, $phpbb_dispatcher; $user_id = (int) $user_id; $folder_id = (int) $folder_id; @@ -1009,6 +1028,18 @@ function delete_pm($user_id, $msg_ids, $folder_id) return false; } + /** + * Get all info for PM(s) before they are deleted + * + * @event core.delete_pm_before + * @var int user_id ID of the user requested the message delete + * @var array msg_ids array of all messages to be deleted + * @var int folder_id ID of the user folder where the messages are stored + * @since 3.1.0-b5 + */ + $vars = array('user_id', 'msg_ids', 'folder_id'); + extract($phpbb_dispatcher->trigger_event('core.delete_pm_before', compact($vars))); + // Get PM Information for later deleting $sql = 'SELECT msg_id, pm_unread, pm_new FROM ' . PRIVMSGS_TO_TABLE . ' @@ -1097,9 +1128,10 @@ function delete_pm($user_id, $msg_ids, $folder_id) $user->data['user_unread_privmsg'] -= $num_unread; } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->delete_notifications('pm', array_keys($delete_rows)); + $phpbb_notifications->delete_notifications('notification.type.pm', array_keys($delete_rows)); // Now we have to check which messages we can delete completely $sql = 'SELECT msg_id @@ -1118,12 +1150,10 @@ function delete_pm($user_id, $msg_ids, $folder_id) if (sizeof($delete_ids)) { // Check if there are any attachments we need to remove - if (!function_exists('delete_attachments')) - { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - } - - delete_attachments('message', $delete_ids, false); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('message', $delete_ids, false); + unset($attachment_manager); $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' WHERE ' . $db->sql_in_set('msg_id', $delete_ids); @@ -1144,8 +1174,6 @@ function delete_pm($user_id, $msg_ids, $folder_id) */ function phpbb_delete_user_pms($user_id) { - global $db, $user, $phpbb_root_path, $phpEx; - $user_id = (int) $user_id; if (!$user_id) @@ -1165,7 +1193,7 @@ function phpbb_delete_user_pms($user_id) */ function phpbb_delete_users_pms($user_ids) { - global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; + global $db, $phpbb_container; $user_id_sql = $db->sql_in_set('user_id', $user_ids); $author_id_sql = $db->sql_in_set('author_id', $user_ids); @@ -1210,6 +1238,7 @@ function phpbb_delete_users_pms($user_ids) $db->sql_transaction('begin'); + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); if (!empty($undelivered_msg)) @@ -1281,7 +1310,7 @@ function phpbb_delete_users_pms($user_ids) AND ' . $db->sql_in_set('msg_id', $delivered_msg); $db->sql_query($sql); - $phpbb_notifications->delete_notifications('pm', $delivered_msg); + $phpbb_notifications->delete_notifications('notification.type.pm', $delivered_msg); } if (!empty($undelivered_msg)) @@ -1294,7 +1323,7 @@ function phpbb_delete_users_pms($user_ids) WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg); $db->sql_query($sql); - $phpbb_notifications->delete_notifications('pm', $undelivered_msg); + $phpbb_notifications->delete_notifications('notification.type.pm', $undelivered_msg); } } @@ -1327,18 +1356,16 @@ function phpbb_delete_users_pms($user_ids) if (!empty($delete_ids)) { // Check if there are any attachments we need to remove - if (!function_exists('delete_attachments')) - { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - } - - delete_attachments('message', $delete_ids, false); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('message', $delete_ids, false); + unset($attachment_manager); $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' WHERE ' . $db->sql_in_set('msg_id', $delete_ids); $db->sql_query($sql); - $phpbb_notifications->delete_notifications('pm', $delete_ids); + $phpbb_notifications->delete_notifications('notification.type.pm', $delete_ids); } } @@ -1364,8 +1391,6 @@ function phpbb_delete_users_pms($user_ids) */ function rebuild_header($check_ary) { - global $db; - $address = array(); foreach ($check_ary as $check_type => $address_field) @@ -1382,9 +1407,9 @@ function rebuild_header($check_ary) $_types = array('u', 'g'); foreach ($_types as $type) { - if (sizeof($$type)) + if (sizeof(${$type})) { - foreach ($$type as $id) + foreach (${$type} as $id) { $address[$type][$id] = $check_type; } @@ -1400,7 +1425,10 @@ function rebuild_header($check_ary) */ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { - global $db, $user, $template, $phpbb_root_path, $phpEx; + global $db, $user, $template, $phpbb_root_path, $phpEx, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); $addresses = array(); @@ -1461,7 +1489,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) { - $address[] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $address[] = $group_helper->get_name($row['group_name']); } } $db->sql_freeresult($result); @@ -1481,7 +1509,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) { - $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $row['group_name'] = $group_helper->get_name($row['group_name']); $address['group'][$row['group_id']] = array('name' => $row['group_name'], 'colour' => $row['group_colour']); } } @@ -1542,7 +1570,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) */ function get_folder_status($folder_id, $folder) { - global $db, $user, $config; + global $user; if (isset($folder[$folder_id])) { @@ -1558,10 +1586,10 @@ function get_folder_status($folder_id, $folder) 'cur' => $folder['num_messages'], 'remaining' => ($user->data['message_limit']) ? $user->data['message_limit'] - $folder['num_messages'] : 0, 'max' => $user->data['message_limit'], - 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? round(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, + 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? floor(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, ); - $return['message'] = $user->lang('FOLDER_STATUS_MSG', (int) $return['max'], $return['cur'], $return['percent']); + $return['message'] = $user->lang('FOLDER_STATUS_MSG', $user->lang('MESSAGES_COUNT', (int) $return['max']), (int) $return['cur'], $return['percent']); return $return; } @@ -1573,9 +1601,9 @@ function get_folder_status($folder_id, $folder) /** * Submit PM */ -function submit_pm($mode, $subject, &$data, $put_in_outbox = true) +function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) { - global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path, $phpbb_container; + global $db, $auth, $config, $user, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $request; // We do not handle erasing pms here if ($mode == 'delete') @@ -1585,6 +1613,21 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $current_time = time(); + $data = $data_ary; + /** + * Get all parts of the PM that are to be submited to the DB. + * + * @event core.submit_pm_before + * @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit + * @var string subject Subject of the private message + * @var array data The whole row data of the PM. + * @since 3.1.0-b3 + */ + $vars = array('mode', 'subject', 'data'); + extract($phpbb_dispatcher->trigger_event('core.submit_pm_before', compact($vars))); + $data_ary = $data; + unset($data); + // Collect some basic information about which tables and which rows to update/insert $sql_data = array(); $root_level = 0; @@ -1599,9 +1642,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($data['address_list'][$ug_type]) && sizeof($data['address_list'][$ug_type])) + if (isset($data_ary['address_list'][$ug_type]) && sizeof($data_ary['address_list'][$ug_type])) { - foreach ($data['address_list'][$ug_type] as $id => $field) + foreach ($data_ary['address_list'][$ug_type] as $id => $field) { $id = (int) $id; @@ -1621,7 +1664,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) } } - if (isset($data['address_list']['g']) && sizeof($data['address_list']['g'])) + if (isset($data_ary['address_list']['g']) && sizeof($data_ary['address_list']['g'])) { // We need to check the PM status of group members (do they want to receive PM's?) // Only check if not a moderator or admin, since they are allowed to override this user setting @@ -1629,7 +1672,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $sql = 'SELECT u.user_type, ug.group_id, ug.user_id FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug - WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . ' + WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data_ary['address_list']['g'])) . ' AND ug.user_pending = 0 AND u.user_id = ug.user_id AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . @@ -1638,7 +1681,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) while ($row = $db->sql_fetchrow($result)) { - $field = ($data['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc'; + $field = ($data_ary['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc'; $recipients[$row['user_id']] = $field; } $db->sql_freeresult($result); @@ -1661,13 +1704,13 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) { case 'reply': case 'quote': - $root_level = ($data['reply_from_root_level']) ? $data['reply_from_root_level'] : $data['reply_from_msg_id']; + $root_level = ($data_ary['reply_from_root_level']) ? $data_ary['reply_from_root_level'] : $data_ary['reply_from_msg_id']; // Set message_replied switch for this user $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_replied = 1 - WHERE user_id = ' . $data['from_user_id'] . ' - AND msg_id = ' . $data['reply_from_msg_id']; + WHERE user_id = ' . $data_ary['from_user_id'] . ' + AND msg_id = ' . $data_ary['reply_from_msg_id']; // no break @@ -1676,19 +1719,19 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) case 'quotepost': $sql_data = array( 'root_level' => $root_level, - 'author_id' => $data['from_user_id'], - 'icon_id' => $data['icon_id'], - 'author_ip' => $data['from_user_ip'], + 'author_id' => $data_ary['from_user_id'], + 'icon_id' => $data_ary['icon_id'], + 'author_ip' => $data_ary['from_user_ip'], 'message_time' => $current_time, - 'enable_bbcode' => $data['enable_bbcode'], - 'enable_smilies' => $data['enable_smilies'], - 'enable_magic_url' => $data['enable_urls'], - 'enable_sig' => $data['enable_sig'], + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], 'message_subject' => $subject, - 'message_text' => $data['message'], - 'message_attachment'=> (!empty($data['attachment_data'])) ? 1 : 0, - 'bbcode_bitfield' => $data['bbcode_bitfield'], - 'bbcode_uid' => $data['bbcode_uid'], + 'message_text' => $data_ary['message'], + 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], 'to_address' => implode(':', $to), 'bcc_address' => implode(':', $bcc), 'message_reported' => 0, @@ -1697,35 +1740,33 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) case 'edit': $sql_data = array( - 'icon_id' => $data['icon_id'], + 'icon_id' => $data_ary['icon_id'], 'message_edit_time' => $current_time, - 'enable_bbcode' => $data['enable_bbcode'], - 'enable_smilies' => $data['enable_smilies'], - 'enable_magic_url' => $data['enable_urls'], - 'enable_sig' => $data['enable_sig'], + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], 'message_subject' => $subject, - 'message_text' => $data['message'], - 'message_attachment'=> (!empty($data['attachment_data'])) ? 1 : 0, - 'bbcode_bitfield' => $data['bbcode_bitfield'], - 'bbcode_uid' => $data['bbcode_uid'] + 'message_text' => $data_ary['message'], + 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'] ); break; } if (sizeof($sql_data)) { - $query = ''; - if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') { $db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data)); - $data['msg_id'] = $db->sql_nextid(); + $data_ary['msg_id'] = $db->sql_nextid(); } else if ($mode == 'edit') { $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' SET message_edit_count = message_edit_count + 1, ' . $db->sql_build_array('UPDATE', $sql_data) . ' - WHERE msg_id = ' . $data['msg_id']; + WHERE msg_id = ' . $data_ary['msg_id']; $db->sql_query($sql); } } @@ -1742,9 +1783,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) foreach ($recipients as $user_id => $type) { $sql_ary[] = array( - 'msg_id' => (int) $data['msg_id'], + 'msg_id' => (int) $data_ary['msg_id'], 'user_id' => (int) $user_id, - 'author_id' => (int) $data['from_user_id'], + 'author_id' => (int) $data_ary['from_user_id'], 'folder_id' => PRIVMSGS_NO_BOX, 'pm_new' => 1, 'pm_unread' => 1, @@ -1763,9 +1804,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) if ($put_in_outbox) { $db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'msg_id' => (int) $data['msg_id'], - 'user_id' => (int) $data['from_user_id'], - 'author_id' => (int) $data['from_user_id'], + 'msg_id' => (int) $data_ary['msg_id'], + 'user_id' => (int) $data_ary['from_user_id'], + 'author_id' => (int) $data_ary['from_user_id'], 'folder_id' => PRIVMSGS_OUTBOX, 'pm_new' => 0, 'pm_unread' => 0, @@ -1779,17 +1820,17 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) { $sql = 'UPDATE ' . USERS_TABLE . " SET user_lastpost_time = $current_time - WHERE user_id = " . $data['from_user_id']; + WHERE user_id = " . $data_ary['from_user_id']; $db->sql_query($sql); } // Submit Attachments - if (!empty($data['attachment_data']) && $data['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward'))) + if (!empty($data_ary['attachment_data']) && $data_ary['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward'))) { $space_taken = $files_added = 0; $orphan_rows = array(); - foreach ($data['attachment_data'] as $pos => $attach_row) + foreach ($data_ary['attachment_data'] as $pos => $attach_row) { $orphan_rows[(int) $attach_row['attach_id']] = array(); } @@ -1812,7 +1853,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $db->sql_freeresult($result); } - foreach ($data['attachment_data'] as $pos => $attach_row) + foreach ($data_ary['attachment_data'] as $pos => $attach_row) { if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']])) { @@ -1840,10 +1881,10 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $files_added++; $attach_sql = array( - 'post_msg_id' => $data['msg_id'], + 'post_msg_id' => $data_ary['msg_id'], 'topic_id' => 0, 'is_orphan' => 0, - 'poster_id' => $data['from_user_id'], + 'poster_id' => $data_ary['from_user_id'], 'attach_comment' => $attach_row['attach_comment'], ); @@ -1857,41 +1898,58 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) if ($space_taken && $files_added) { - set_config_count('upload_dir_size', $space_taken, true); - set_config_count('num_files', $files_added, true); + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); } } // Delete draft if post was loaded... - $draft_id = request_var('draft_loaded', 0); + $draft_id = $request->variable('draft_loaded', 0); if ($draft_id) { $sql = 'DELETE FROM ' . DRAFTS_TABLE . " WHERE draft_id = $draft_id - AND user_id = " . $data['from_user_id']; + AND user_id = " . $data_ary['from_user_id']; $db->sql_query($sql); } $db->sql_transaction('commit'); // Send Notifications - $pm_data = array_merge($data, array( + $pm_data = array_merge($data_ary, array( 'message_subject' => $subject, 'recipients' => $recipients, )); + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); if ($mode == 'edit') { - $phpbb_notifications->update_notifications('pm', $pm_data); + $phpbb_notifications->update_notifications('notification.type.pm', $pm_data); } else { - $phpbb_notifications->add_notifications('pm', $pm_data); - } - - return $data['msg_id']; + $phpbb_notifications->add_notifications('notification.type.pm', $pm_data); + } + + $data = $data_ary; + /** + * Get PM message ID after submission to DB + * + * @event core.submit_pm_after + * @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit + * @var string subject Subject of the private message + * @var array data The whole row data of the PM. + * @var array pm_data The data sent to notification class + * @since 3.1.0-b5 + */ + $vars = array('mode', 'subject', 'data', 'pm_data'); + extract($phpbb_dispatcher->trigger_event('core.submit_pm_after', compact($vars))); + $data_ary = $data; + unset($data); + + return $data_ary['msg_id']; } /** @@ -1899,7 +1957,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) */ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false) { - global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; + global $db, $user, $template, $phpbb_root_path, $phpEx, $auth; // Select all receipts and the author from the pm we currently view, to only display their pm-history $sql = 'SELECT author_id, user_id @@ -1951,7 +2009,6 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $title = $row['message_subject']; $rowset = array(); - $bbcode_bitfield = ''; $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; do @@ -1967,7 +2024,6 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode else { $rowset[$row['msg_id']] = $row; - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } } while ($row = $db->sql_fetchrow($result)); @@ -1978,16 +2034,6 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode return false; } - // Instantiate BBCode class - if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield !== '') - { - if (!class_exists('bbcode')) - { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); - } - $bbcode = new bbcode(base64_encode($bbcode_bitfield)); - } - $title = censor_text($title); $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); @@ -2018,10 +2064,10 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $decoded_message = bbcode_nl2br($decoded_message); } - + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); - + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); $subject = censor_text($subject); @@ -2050,6 +2096,8 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'S_IN_POST_MODE' => $in_post_mode, 'MSG_ID' => $row['msg_id'], + 'MESSAGE_TIME' => $row['message_time'], + 'USER_ID' => $row['user_id'], 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') @@ -2077,17 +2125,42 @@ function set_user_message_limit() { global $user, $db, $config; - // Get maximum about from user memberships - if it is 0, there is no limit set and we use the maximum value within the config. - $sql = 'SELECT MAX(g.group_message_limit) as max_message_limit + // Get maximum about from user memberships + $message_limit = phpbb_get_max_setting_from_group($db, $user->data['user_id'], 'message_limit'); + + // If it is 0, there is no limit set and we use the maximum value within the config. + $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; +} + +/** + * Get the maximum PM setting for the groups of the user + * + * @param \phpbb\db\driver\driver_interface $db + * @param int $user_id + * @param string $setting Only 'max_recipients' and 'message_limit' are supported + * @return int The maximum setting for all groups of the user, unless one group has '0' + * @throws \InvalidArgumentException If selected group setting is not supported + */ +function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db, $user_id, $setting) +{ + if ($setting !== 'max_recipients' && $setting !== 'message_limit') + { + throw new InvalidArgumentException('Setting "' . $setting . '" is not supported'); + } + + // Get maximum number of allowed recipients + $sql = 'SELECT MIN(g.group_' . $setting . ') as min_setting, MAX(g.group_' . $setting . ') as max_setting FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug - WHERE ug.user_id = ' . $user->data['user_id'] . ' + WHERE ug.user_id = ' . (int) $user_id . ' AND ug.user_pending = 0 AND ug.group_id = g.group_id'; $result = $db->sql_query($sql); - $message_limit = (int) $db->sql_fetchfield('max_message_limit'); + $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); + $max_setting = (int) $row['max_setting']; + $min_setting = (int) $row['min_setting']; - $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; + return ($min_setting > 0) ? $max_setting : 0; } /** @@ -2101,7 +2174,10 @@ function set_user_message_limit() */ function get_recipient_strings($pm_by_id) { - global $db, $phpbb_root_path, $phpEx, $user; + global $db, $phpbb_root_path, $phpEx, $user, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); $address_list = $recipient_list = $address = array(); @@ -2147,7 +2223,7 @@ function get_recipient_strings($pm_by_id) { if ($ug_type == 'g') { - $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; + $row['name'] = $group_helper->get_name($row['name']); } $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 9bec17ca8f..0fc8a7eea5 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * Transfer class, wrapper for ftp/sftp/ssh -* @package phpBB3 */ class transfer { @@ -255,7 +258,6 @@ class transfer /** * FTP transfer class -* @package phpBB3 */ class ftp extends transfer { @@ -279,7 +281,7 @@ class ftp extends transfer } // Init some needed values - transfer::transfer(); + $this->transfer(); return; } @@ -404,9 +406,6 @@ class ftp extends transfer */ function _put($from_file, $to_file) { - // get the file extension - $file_extension = strtolower(substr(strrchr($to_file, '.'), 1)); - // We only use the BINARY file mode to cicumvent rewrite actions from ftp server (mostly linefeeds being replaced) $mode = FTP_BINARY; @@ -505,9 +504,6 @@ class ftp extends transfer /** * FTP fsock transfer class -* -* @author wGEric -* @package phpBB3 */ class ftp_fsock extends transfer { @@ -533,7 +529,7 @@ class ftp_fsock extends transfer } // Init some needed values - transfer::transfer(); + $this->transfer(); return; } diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php deleted file mode 100644 index 04d483e14c..0000000000 --- a/phpBB/includes/functions_upload.php +++ /dev/null @@ -1,1071 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Responsible for holding all file relevant information, as well as doing file-specific operations. -* The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on. -* @package phpBB3 -*/ -class filespec -{ - var $filename = ''; - var $realname = ''; - var $uploadname = ''; - var $mimetype = ''; - var $extension = ''; - var $filesize = 0; - var $width = 0; - var $height = 0; - var $image_info = array(); - - var $destination_file = ''; - var $destination_path = ''; - - var $file_moved = false; - var $init_error = false; - var $local = false; - - var $error = array(); - - var $upload = ''; - - /** - * The plupload object - * @var \phpbb\plupload\plupload - */ - protected $plupload; - - /** - * File Class - * @access private - */ - function filespec($upload_ary, $upload_namespace, \phpbb\plupload\plupload $plupload = null) - { - if (!isset($upload_ary)) - { - $this->init_error = true; - return; - } - - $this->filename = $upload_ary['tmp_name']; - $this->filesize = $upload_ary['size']; - $name = (STRIP) ? stripslashes($upload_ary['name']) : $upload_ary['name']; - $name = trim(utf8_htmlspecialchars(utf8_basename($name))); - $this->realname = $this->uploadname = $name; - $this->mimetype = $upload_ary['type']; - - // Opera adds the name to the mime type - $this->mimetype = (strpos($this->mimetype, '; name') !== false) ? str_replace(strstr($this->mimetype, '; name'), '', $this->mimetype) : $this->mimetype; - - if (!$this->mimetype) - { - $this->mimetype = 'application/octetstream'; - } - - $this->extension = strtolower(self::get_extension($this->realname)); - - // Try to get real filesize from temporary folder (not always working) ;) - $this->filesize = (@filesize($this->filename)) ? @filesize($this->filename) : $this->filesize; - - $this->width = $this->height = 0; - $this->file_moved = false; - - $this->local = (isset($upload_ary['local_mode'])) ? true : false; - $this->upload = $upload_namespace; - $this->plupload = $plupload; - } - - /** - * Cleans destination filename - * - * @param real|unique|unique_ext $mode real creates a realname, filtering some characters, lowering every character. Unique creates an unique filename - * @param string $prefix Prefix applied to filename - * @access public - */ - function clean_filename($mode = 'unique', $prefix = '', $user_id = '') - { - if ($this->init_error) - { - return; - } - - switch ($mode) - { - case 'real': - // Remove every extension from filename (to not let the mime bug being exposed) - if (strpos($this->realname, '.') !== false) - { - $this->realname = substr($this->realname, 0, strpos($this->realname, '.')); - } - - // Replace any chars which may cause us problems with _ - $bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|'); - - $this->realname = rawurlencode(str_replace($bad_chars, '_', strtolower($this->realname))); - $this->realname = preg_replace("/%(\w{2})/", '_', $this->realname); - - $this->realname = $prefix . $this->realname . '.' . $this->extension; - break; - - case 'unique': - $this->realname = $prefix . md5(unique_id()); - break; - - case 'avatar': - $this->extension = strtolower($this->extension); - $this->realname = $prefix . $user_id . '.' . $this->extension; - - break; - - case 'unique_ext': - default: - $this->realname = $prefix . md5(unique_id()) . '.' . $this->extension; - break; - } - } - - /** - * Get property from file object - */ - function get($property) - { - if ($this->init_error || !isset($this->$property)) - { - return false; - } - - return $this->$property; - } - - /** - * Check if file is an image (mimetype) - * - * @return true if it is an image, false if not - */ - function is_image() - { - return (strpos($this->mimetype, 'image/') === 0); - } - - /** - * Check if the file got correctly uploaded - * - * @return true if it is a valid upload, false if not - */ - function is_uploaded() - { - $is_plupload = $this->plupload && $this->plupload->is_active(); - - if (!$this->local && !$is_plupload && !is_uploaded_file($this->filename)) - { - return false; - } - - if (($this->local || $is_plupload) && !file_exists($this->filename)) - { - return false; - } - - return true; - } - - /** - * Remove file - */ - function remove() - { - if ($this->file_moved) - { - @unlink($this->destination_file); - } - } - - /** - * Get file extension - * - * @param string Filename that needs to be checked - * @return string Extension of the supplied filename - */ - static public function get_extension($filename) - { - if (strpos($filename, '.') === false) - { - return ''; - } - - $filename = explode('.', $filename); - return array_pop($filename); - } - - /** - * Get mimetype. Utilize mime_content_type if the function exist. - * Not used at the moment... - */ - function get_mimetype($filename) - { - $mimetype = ''; - - if (function_exists('mime_content_type')) - { - $mimetype = mime_content_type($filename); - } - - // Some browsers choke on a mimetype of application/octet-stream - if (!$mimetype || $mimetype == 'application/octet-stream') - { - $mimetype = 'application/octetstream'; - } - - return $mimetype; - } - - /** - * Get filesize - */ - function get_filesize($filename) - { - return @filesize($filename); - } - - - /** - * Check the first 256 bytes for forbidden content - */ - function check_content($disallowed_content) - { - if (empty($disallowed_content)) - { - return true; - } - - $fp = @fopen($this->filename, 'rb'); - - if ($fp !== false) - { - $ie_mime_relevant = fread($fp, 256); - fclose($fp); - foreach ($disallowed_content as $forbidden) - { - if (stripos($ie_mime_relevant, '<' . $forbidden) !== false) - { - return false; - } - } - } - return true; - } - - /** - * Move file to destination folder - * The phpbb_root_path variable will be applied to the destination path - * - * @param string $destination_path Destination path, for example $config['avatar_path'] - * @param bool $overwrite If set to true, an already existing file will be overwritten - * @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()} - * - * @access public - */ - function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) - { - global $user, $phpbb_root_path; - - if (sizeof($this->error)) - { - return false; - } - - $chmod = ($chmod === false) ? CHMOD_READ | CHMOD_WRITE : $chmod; - - // We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it... - $this->destination_path = $phpbb_root_path . $destination; - - // Check if the destination path exist... - if (!file_exists($this->destination_path)) - { - @unlink($this->filename); - return false; - } - - $upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') ? 'move' : 'copy'; - $upload_mode = ($this->local) ? 'local' : $upload_mode; - $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); - - // Check if the file already exist, else there is something wrong... - if (file_exists($this->destination_file) && !$overwrite) - { - @unlink($this->filename); - } - else - { - if (file_exists($this->destination_file)) - { - @unlink($this->destination_file); - } - - switch ($upload_mode) - { - case 'copy': - - if (!@copy($this->filename, $this->destination_file)) - { - if (!@move_uploaded_file($this->filename, $this->destination_file)) - { - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - } - } - - break; - - case 'move': - - if (!@move_uploaded_file($this->filename, $this->destination_file)) - { - if (!@copy($this->filename, $this->destination_file)) - { - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - } - } - - break; - - case 'local': - - if (!@copy($this->filename, $this->destination_file)) - { - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR'], $this->destination_file); - } - - break; - } - - // Remove temporary filename - @unlink($this->filename); - - if (sizeof($this->error)) - { - return false; - } - - phpbb_chmod($this->destination_file, $chmod); - } - - // Try to get real filesize from destination folder - $this->filesize = (@filesize($this->destination_file)) ? @filesize($this->destination_file) : $this->filesize; - - if ($this->is_image() && !$skip_image_check) - { - $this->width = $this->height = 0; - - if (($this->image_info = @getimagesize($this->destination_file)) !== false) - { - $this->width = $this->image_info[0]; - $this->height = $this->image_info[1]; - - if (!empty($this->image_info['mime'])) - { - $this->mimetype = $this->image_info['mime']; - } - - // Check image type - $types = fileupload::image_types(); - - if (!isset($types[$this->image_info[2]]) || !in_array($this->extension, $types[$this->image_info[2]])) - { - if (!isset($types[$this->image_info[2]])) - { - $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_INVALID'], $this->image_info[2], $this->mimetype); - } - else - { - $this->error[] = sprintf($user->lang['IMAGE_FILETYPE_MISMATCH'], $types[$this->image_info[2]][0], $this->extension); - } - } - - // Make sure the dimensions match a valid image - if (empty($this->width) || empty($this->height)) - { - $this->error[] = $user->lang['ATTACHED_IMAGE_NOT_IMAGE']; - } - } - else - { - $this->error[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; - } - } - - $this->file_moved = true; - $this->additional_checks(); - unset($this->upload); - - return true; - } - - /** - * Performing additional checks - */ - function additional_checks() - { - global $user; - - if (!$this->file_moved) - { - return false; - } - - // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form - if ($this->upload->max_filesize && ($this->get('filesize') > $this->upload->max_filesize || $this->filesize == 0)) - { - $max_filesize = get_formatted_filesize($this->upload->max_filesize, false); - - $this->error[] = sprintf($user->lang[$this->upload->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']); - - return false; - } - - if (!$this->upload->valid_dimensions($this)) - { - $this->error[] = $user->lang($this->upload->error_prefix . 'WRONG_SIZE', - $user->lang('PIXELS', (int) $this->upload->min_width), - $user->lang('PIXELS', (int) $this->upload->min_height), - $user->lang('PIXELS', (int) $this->upload->max_width), - $user->lang('PIXELS', (int) $this->upload->max_height), - $user->lang('PIXELS', (int) $this->width), - $user->lang('PIXELS', (int) $this->height)); - - return false; - } - - return true; - } -} - -/** -* Class for assigning error messages before a real filespec class can be assigned -* -* @package phpBB3 -*/ -class fileerror extends filespec -{ - function fileerror($error_msg) - { - $this->error[] = $error_msg; - } -} - -/** -* File upload class -* Init class (all parameters optional and able to be set/overwritten separately) - scope is global and valid for all uploads -* -* @package phpBB3 -*/ -class fileupload -{ - var $allowed_extensions = array(); - var $disallowed_content = array('body', 'head', 'html', 'img', 'plaintext', 'a href', 'pre', 'script', 'table', 'title'); - var $max_filesize = 0; - var $min_width = 0; - var $min_height = 0; - var $max_width = 0; - var $max_height = 0; - var $error_prefix = ''; - - /** - * Init file upload class. - * - * @param string $error_prefix Used error messages will get prefixed by this string - * @param array $allowed_extensions Array of allowed extensions, for example array('jpg', 'jpeg', 'gif', 'png') - * @param int $max_filesize Maximum filesize - * @param int $min_width Minimum image width (only checked for images) - * @param int $min_height Minimum image height (only checked for images) - * @param int $max_width Maximum image width (only checked for images) - * @param int $max_height Maximum image height (only checked for images) - * - */ - function fileupload($error_prefix = '', $allowed_extensions = false, $max_filesize = false, $min_width = false, $min_height = false, $max_width = false, $max_height = false, $disallowed_content = false) - { - $this->set_allowed_extensions($allowed_extensions); - $this->set_max_filesize($max_filesize); - $this->set_allowed_dimensions($min_width, $min_height, $max_width, $max_height); - $this->set_error_prefix($error_prefix); - $this->set_disallowed_content($disallowed_content); - } - - /** - * Reset vars - */ - function reset_vars() - { - $this->max_filesize = 0; - $this->min_width = $this->min_height = $this->max_width = $this->max_height = 0; - $this->error_prefix = ''; - $this->allowed_extensions = array(); - $this->disallowed_content = array(); - } - - /** - * Set allowed extensions - */ - function set_allowed_extensions($allowed_extensions) - { - if ($allowed_extensions !== false && is_array($allowed_extensions)) - { - $this->allowed_extensions = $allowed_extensions; - } - } - - /** - * Set allowed dimensions - */ - function set_allowed_dimensions($min_width, $min_height, $max_width, $max_height) - { - $this->min_width = (int) $min_width; - $this->min_height = (int) $min_height; - $this->max_width = (int) $max_width; - $this->max_height = (int) $max_height; - } - - /** - * Set maximum allowed filesize - */ - function set_max_filesize($max_filesize) - { - if ($max_filesize !== false && (int) $max_filesize) - { - $this->max_filesize = (int) $max_filesize; - } - } - - /** - * Set disallowed strings - */ - function set_disallowed_content($disallowed_content) - { - if ($disallowed_content !== false && is_array($disallowed_content)) - { - $this->disallowed_content = array_diff($disallowed_content, array('')); - } - } - - /** - * Set error prefix - */ - function set_error_prefix($error_prefix) - { - $this->error_prefix = $error_prefix; - } - - /** - * Form upload method - * Upload file from users harddisk - * - * @param string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified) - * @param \phpbb\plupload\plupload $plupload The plupload object - * - * @return object $file Object "filespec" is returned, all further operations can be done with this object - * @access public - */ - function form_upload($form_name, \phpbb\plupload\plupload $plupload = null) - { - global $user, $request; - - $upload = $request->file($form_name); - unset($upload['local_mode']); - - if ($plupload) - { - $result = $plupload->handle_upload($form_name); - if (is_array($result)) - { - $upload = array_merge($upload, $result); - } - } - - $file = new filespec($upload, $this, $plupload); - - if ($file->init_error) - { - $file->error[] = ''; - return $file; - } - - // Error array filled? - if (isset($upload['error'])) - { - $error = $this->assign_internal_error($upload['error']); - - if ($error !== false) - { - $file->error[] = $error; - return $file; - } - } - - // Check if empty file got uploaded (not catched by is_uploaded_file) - if (isset($upload['size']) && $upload['size'] == 0) - { - $file->error[] = $user->lang[$this->error_prefix . 'EMPTY_FILEUPLOAD']; - return $file; - } - - // PHP Upload filesize exceeded - if ($file->get('filename') == 'none') - { - $max_filesize = @ini_get('upload_max_filesize'); - $unit = 'MB'; - - if (!empty($max_filesize)) - { - $unit = strtolower(substr($max_filesize, -1, 1)); - $max_filesize = (int) $max_filesize; - - $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB'); - } - - $file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]); - return $file; - } - - // Not correctly uploaded - if (!$file->is_uploaded()) - { - $file->error[] = $user->lang[$this->error_prefix . 'NOT_UPLOADED']; - return $file; - } - - $this->common_checks($file); - - return $file; - } - - /** - * Move file from another location to phpBB - */ - function local_upload($source_file, $filedata = false) - { - global $user, $request; - - $upload = array(); - - $upload['local_mode'] = true; - $upload['tmp_name'] = $source_file; - - if ($filedata === false) - { - $upload['name'] = utf8_basename($source_file); - $upload['size'] = 0; - $mimetype = ''; - - if (function_exists('mime_content_type')) - { - $mimetype = mime_content_type($source_file); - } - - // Some browsers choke on a mimetype of application/octet-stream - if (!$mimetype || $mimetype == 'application/octet-stream') - { - $mimetype = 'application/octetstream'; - } - - $upload['type'] = $mimetype; - } - else - { - $upload['name'] = $filedata['realname']; - $upload['size'] = $filedata['size']; - $upload['type'] = $filedata['type']; - } - - $file = new filespec($upload, $this); - - if ($file->init_error) - { - $file->error[] = ''; - return $file; - } - - if (isset($upload['error'])) - { - $error = $this->assign_internal_error($upload['error']); - - if ($error !== false) - { - $file->error[] = $error; - return $file; - } - } - - // PHP Upload filesize exceeded - if ($file->get('filename') == 'none') - { - $max_filesize = @ini_get('upload_max_filesize'); - $unit = 'MB'; - - if (!empty($max_filesize)) - { - $unit = strtolower(substr($max_filesize, -1, 1)); - $max_filesize = (int) $max_filesize; - - $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB'); - } - - $file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]); - return $file; - } - - // Not correctly uploaded - if (!$file->is_uploaded()) - { - $file->error[] = $user->lang[$this->error_prefix . 'NOT_UPLOADED']; - return $file; - } - - $this->common_checks($file); - $request->overwrite('local', $upload, \phpbb\request\request_interface::FILES); - - return $file; - } - - /** - * Remote upload method - * Uploads file from given url - * - * @param string $upload_url URL pointing to file to upload, for example http://www.foobar.com/example.gif - * @return object $file Object "filespec" is returned, all further operations can be done with this object - * @access public - */ - function remote_upload($upload_url) - { - global $user, $phpbb_root_path; - - $upload_ary = array(); - $upload_ary['local_mode'] = true; - - if (!preg_match('#^(https?://).*?\.(' . implode('|', $this->allowed_extensions) . ')$#i', $upload_url, $match)) - { - $file = new fileerror($user->lang[$this->error_prefix . 'URL_INVALID']); - return $file; - } - - if (empty($match[2])) - { - $file = new fileerror($user->lang[$this->error_prefix . 'URL_INVALID']); - return $file; - } - - $url = parse_url($upload_url); - - $host = $url['host']; - $path = $url['path']; - $port = (!empty($url['port'])) ? (int) $url['port'] : 80; - - $upload_ary['type'] = 'application/octet-stream'; - - $url['path'] = explode('.', $url['path']); - $ext = array_pop($url['path']); - - $url['path'] = implode('', $url['path']); - $upload_ary['name'] = utf8_basename($url['path']) . (($ext) ? '.' . $ext : ''); - $filename = $url['path']; - $filesize = 0; - - $remote_max_filesize = $this->max_filesize; - if (!$remote_max_filesize) - { - $max_filesize = @ini_get('upload_max_filesize'); - - if (!empty($max_filesize)) - { - $unit = strtolower(substr($max_filesize, -1, 1)); - $remote_max_filesize = (int) $max_filesize; - - switch ($unit) - { - case 'g': - $remote_max_filesize *= 1024; - // no break - case 'm': - $remote_max_filesize *= 1024; - // no break - case 'k': - $remote_max_filesize *= 1024; - // no break - } - } - } - - $errno = 0; - $errstr = ''; - - if (!($fsock = @fsockopen($host, $port, $errno, $errstr))) - { - $file = new fileerror($user->lang[$this->error_prefix . 'NOT_UPLOADED']); - return $file; - } - - // Make sure $path not beginning with / - if (strpos($path, '/') === 0) - { - $path = substr($path, 1); - } - - fputs($fsock, 'GET /' . $path . " HTTP/1.1\r\n"); - fputs($fsock, "HOST: " . $host . "\r\n"); - fputs($fsock, "Connection: close\r\n\r\n"); - - $get_info = false; - $data = ''; - while (!@feof($fsock)) - { - if ($get_info) - { - $block = @fread($fsock, 1024); - $filesize += strlen($block); - - if ($remote_max_filesize && $filesize > $remote_max_filesize) - { - $max_filesize = get_formatted_filesize($remote_max_filesize, false); - - $file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit'])); - return $file; - } - - $data .= $block; - } - else - { - $line = @fgets($fsock, 1024); - - if ($line == "\r\n") - { - $get_info = true; - } - else - { - if (stripos($line, 'content-type: ') !== false) - { - $upload_ary['type'] = rtrim(str_replace('content-type: ', '', strtolower($line))); - } - else if ($this->max_filesize && stripos($line, 'content-length: ') !== false) - { - $length = (int) str_replace('content-length: ', '', strtolower($line)); - - if ($remote_max_filesize && $length && $length > $remote_max_filesize) - { - $max_filesize = get_formatted_filesize($remote_max_filesize, false); - - $file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit'])); - return $file; - } - } - else if (stripos($line, '404 not found') !== false) - { - $file = new fileerror($user->lang[$this->error_prefix . 'URL_NOT_FOUND']); - return $file; - } - } - } - } - @fclose($fsock); - - if (empty($data)) - { - $file = new fileerror($user->lang[$this->error_prefix . 'EMPTY_REMOTE_DATA']); - return $file; - } - - $tmp_path = (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') ? false : $phpbb_root_path . 'cache'; - $filename = tempnam($tmp_path, unique_id() . '-'); - - if (!($fp = @fopen($filename, 'wb'))) - { - $file = new fileerror($user->lang[$this->error_prefix . 'NOT_UPLOADED']); - return $file; - } - - $upload_ary['size'] = fwrite($fp, $data); - fclose($fp); - unset($data); - - $upload_ary['tmp_name'] = $filename; - - $file = new filespec($upload_ary, $this); - $this->common_checks($file); - - return $file; - } - - /** - * Assign internal error - * @access private - */ - function assign_internal_error($errorcode) - { - global $user; - - switch ($errorcode) - { - case 1: - $max_filesize = @ini_get('upload_max_filesize'); - $unit = 'MB'; - - if (!empty($max_filesize)) - { - $unit = strtolower(substr($max_filesize, -1, 1)); - $max_filesize = (int) $max_filesize; - - $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB'); - } - - $error = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]); - break; - - case 2: - $max_filesize = get_formatted_filesize($this->max_filesize, false); - - $error = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']); - break; - - case 3: - $error = $user->lang[$this->error_prefix . 'PARTIAL_UPLOAD']; - break; - - case 4: - $error = $user->lang[$this->error_prefix . 'NOT_UPLOADED']; - break; - - case 6: - $error = 'Temporary folder could not be found. Please check your PHP installation.'; - break; - - default: - $error = false; - break; - } - - return $error; - } - - /** - * Perform common checks - */ - function common_checks(&$file) - { - global $user; - - // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form - if ($this->max_filesize && ($file->get('filesize') > $this->max_filesize || $file->get('filesize') == 0)) - { - $max_filesize = get_formatted_filesize($this->max_filesize, false); - - $file->error[] = sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']); - } - - // check Filename - if (preg_match("#[\\/:*?\"<>|]#i", $file->get('realname'))) - { - $file->error[] = sprintf($user->lang[$this->error_prefix . 'INVALID_FILENAME'], $file->get('realname')); - } - - // Invalid Extension - if (!$this->valid_extension($file)) - { - $file->error[] = sprintf($user->lang[$this->error_prefix . 'DISALLOWED_EXTENSION'], $file->get('extension')); - } - - // MIME Sniffing - if (!$this->valid_content($file)) - { - $file->error[] = sprintf($user->lang[$this->error_prefix . 'DISALLOWED_CONTENT']); - } - } - - /** - * Check for allowed extension - */ - function valid_extension(&$file) - { - return (in_array($file->get('extension'), $this->allowed_extensions)) ? true : false; - } - - /** - * Check for allowed dimension - */ - function valid_dimensions(&$file) - { - if (!$this->max_width && !$this->max_height && !$this->min_width && !$this->min_height) - { - return true; - } - - if (($file->get('width') > $this->max_width && $this->max_width) || - ($file->get('height') > $this->max_height && $this->max_height) || - ($file->get('width') < $this->min_width && $this->min_width) || - ($file->get('height') < $this->min_height && $this->min_height)) - { - return false; - } - - return true; - } - - /** - * Check if form upload is valid - */ - function is_valid($form_name) - { - global $request; - $upload = $request->file($form_name); - - return (!empty($upload) && $upload['name'] !== 'none'); - } - - - /** - * Check for bad content (IE mime-sniffing) - */ - function valid_content(&$file) - { - return ($file->check_content($this->disallowed_content)); - } - - /** - * Get image type/extension mapping - * - * @return array Array containing the image types and their extensions - */ - static public function image_types() - { - return array( - IMAGETYPE_GIF => array('gif'), - IMAGETYPE_JPEG => array('jpg', 'jpeg'), - IMAGETYPE_PNG => array('png'), - IMAGETYPE_SWF => array('swf'), - IMAGETYPE_PSD => array('psd'), - IMAGETYPE_BMP => array('bmp'), - IMAGETYPE_TIFF_II => array('tif', 'tiff'), - IMAGETYPE_TIFF_MM => array('tif', 'tiff'), - IMAGETYPE_JPC => array('jpg', 'jpeg'), - IMAGETYPE_JP2 => array('jpg', 'jpeg'), - IMAGETYPE_JPX => array('jpg', 'jpeg'), - IMAGETYPE_JB2 => array('jpg', 'jpeg'), - IMAGETYPE_SWC => array('swc'), - IMAGETYPE_IFF => array('iff'), - IMAGETYPE_WBMP => array('wbmp'), - IMAGETYPE_XBM => array('xbm'), - ); - } -} diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php deleted file mode 100644 index c5d6815119..0000000000 --- a/phpBB/includes/functions_url_matcher.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; -use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\RequestContext; - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Create a new UrlMatcher class and dump it into the cache file -* -* @param \phpbb\extension\finder $finder Extension finder -* @param RequestContext $context Symfony RequestContext object -* @param string $root_path Root path -* @param string $php_ext PHP extension -* @return null -*/ -function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path, $php_ext) -{ - if (defined('DEBUG')) - { - return phpbb_create_url_matcher($finder, $context, $root_path); - } - - if (!phpbb_url_matcher_dumped($root_path, $php_ext)) - { - phpbb_create_dumped_url_matcher($finder, $root_path, $php_ext); - } - - return phpbb_load_url_matcher($context, $root_path, $php_ext); -} - -/** -* Create a new UrlMatcher class and dump it into the cache file -* -* @param \phpbb\extension\finder $finder Extension finder -* @param string $root_path Root path -* @param string $php_ext PHP extension -* @return null -*/ -function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_path, $php_ext) -{ - $provider = new \phpbb\controller\provider(); - $routes = $provider->import_paths_from_finder($finder)->find($root_path); - $dumper = new PhpMatcherDumper($routes); - $cached_url_matcher_dump = $dumper->dump(array( - 'class' => 'phpbb_url_matcher', - )); - - file_put_contents($root_path . 'cache/url_matcher.' . $php_ext, $cached_url_matcher_dump); -} - -/** -* Create a non-cached UrlMatcher -* -* @param \phpbb\extension\finder $finder Extension finder -* @param RequestContext $context Symfony RequestContext object -* @return UrlMatcher -*/ -function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path) -{ - $provider = new \phpbb\controller\provider(); - $routes = $provider->import_paths_from_finder($finder)->find($root_path); - return new UrlMatcher($routes, $context); -} - -/** -* Load the cached phpbb_url_matcher class -* -* @param RequestContext $context Symfony RequestContext object -* @param string $root_path Root path -* @param string $php_ext PHP extension -* @return phpbb_url_matcher -*/ -function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext) -{ - require($root_path . 'cache/url_matcher.' . $php_ext); - return new phpbb_url_matcher($context); -} - -/** -* Determine whether we have our dumped URL matcher -* -* The class is automatically dumped to the cache directory -* -* @param string $root_path Root path -* @param string $php_ext PHP extension -* @return bool True if it exists, false if not -*/ -function phpbb_url_matcher_dumped($root_path, $php_ext) -{ - return file_exists($root_path . 'cache/url_matcher.' . $php_ext); -} diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6682622d94..e1c687551b 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -40,13 +44,13 @@ function user_get_id_name(&$user_id_ary, &$username_ary, $user_type = false) $which_ary = ($user_id_ary) ? 'user_id_ary' : 'username_ary'; - if ($$which_ary && !is_array($$which_ary)) + if (${$which_ary} && !is_array(${$which_ary})) { - $$which_ary = array($$which_ary); + ${$which_ary} = array(${$which_ary}); } - $sql_in = ($which_ary == 'user_id_ary') ? array_map('intval', $$which_ary) : array_map('utf8_clean_string', $$which_ary); - unset($$which_ary); + $sql_in = ($which_ary == 'user_id_ary') ? array_map('intval', ${$which_ary}) : array_map('utf8_clean_string', ${$which_ary}); + unset(${$which_ary}); $user_id_ary = $username_ary = array(); @@ -85,7 +89,7 @@ function user_get_id_name(&$user_id_ary, &$username_ary, $user_type = false) */ function update_last_username() { - global $db; + global $config, $db; // Get latest username $sql = 'SELECT user_id, username, user_colour @@ -98,9 +102,9 @@ function update_last_username() if ($row) { - set_config('newest_user_id', $row['user_id'], true); - set_config('newest_username', $row['username'], true); - set_config('newest_user_colour', $row['user_colour'], true); + $config->set('newest_user_id', $row['user_id'], false); + $config->set('newest_username', $row['username'], false); + $config->set('newest_user_colour', $row['user_colour'], false); } } @@ -134,7 +138,7 @@ function user_update_name($old_name, $new_name) if ($config['newest_username'] == $old_name) { - set_config('newest_username', $new_name, true); + $config->set('newest_username', $new_name, false); } /** @@ -143,7 +147,7 @@ function user_update_name($old_name, $new_name) * @event core.update_username * @var string old_name The old username that is replaced * @var string new_name The new username - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('old_name', 'new_name'); extract($phpbb_dispatcher->trigger_event('core.update_username', compact($vars))); @@ -157,11 +161,12 @@ function user_update_name($old_name, $new_name) * * @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded. * @param string $cp_data custom profile fields, see custom_profile::build_insert_sql_array +* @param array $notifications_data The notifications settings for the new user * @return the new user's ID. */ -function user_add($user_row, $cp_data = false) +function user_add($user_row, $cp_data = false, $notifications_data = null) { - global $db, $user, $auth, $config, $phpbb_root_path, $phpEx; + global $db, $config; global $phpbb_dispatcher, $phpbb_container; if (empty($user_row['username']) || !isset($user_row['group_id']) || !isset($user_row['user_email']) || !isset($user_row['user_type'])) @@ -180,7 +185,6 @@ function user_add($user_row, $cp_data = false) 'username' => $user_row['username'], 'username_clean' => $username_clean, 'user_password' => (isset($user_row['user_password'])) ? $user_row['user_password'] : '', - 'user_pass_convert' => 0, 'user_email' => strtolower($user_row['user_email']), 'user_email_hash' => phpbb_email_hash($user_row['user_email']), 'group_id' => $user_row['group_id'], @@ -258,10 +262,13 @@ function user_add($user_row, $cp_data = false) * Use this event to modify the values to be inserted when a user is added * * @event core.user_add_modify_data + * @var array user_row Array of user details submited to user_add + * @var array cp_data Array of Custom profile fields submited to user_add * @var array sql_ary Array of data to be inserted when a user is added - * @since 3.1-A1 + * @since 3.1.0-a1 + * @change 3.1.0-b5 */ - $vars = array('sql_ary'); + $vars = array('user_row', 'cp_data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); @@ -274,6 +281,7 @@ function user_add($user_row, $cp_data = false) { $cp_data['user_id'] = (int) $user_id; + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data)); @@ -306,7 +314,7 @@ function user_add($user_row, $cp_data = false) { global $phpbb_log; - // Because these actions only fill the log unneccessarily we skip the add_log() entry. + // Because these actions only fill the log unnecessarily, we disable it $phpbb_log->disable('admin'); // Add user to "newly registered users" group and set to default group if admin specified so. @@ -327,9 +335,9 @@ function user_add($user_row, $cp_data = false) // set the newest user and adjust the user count if the user is a normal user and no activation mail is sent if ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_FOUNDER) { - set_config('newest_user_id', $user_id, true); - set_config('newest_username', $user_row['username'], true); - set_config_count('num_users', 1, true); + $config->set('newest_user_id', $user_id, false); + $config->set('newest_username', $user_row['username'], false); + $config->increment('num_users', 1, false); $sql = 'SELECT group_colour FROM ' . GROUPS_TABLE . ' @@ -338,19 +346,61 @@ function user_add($user_row, $cp_data = false) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('newest_user_colour', $row['group_colour'], true); + $config->set('newest_user_colour', $row['group_colour'], false); + } + + // Use default notifications settings if notifications_data is not set + if ($notifications_data === null) + { + $notifications_data = array( + array( + 'item_type' => 'notification.type.post', + 'method' => 'notification.method.email', + ), + array( + 'item_type' => 'notification.type.topic', + 'method' => 'notification.method.email', + ), + ); + } + + // Subscribe user to notifications if necessary + if (!empty($notifications_data)) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + foreach ($notifications_data as $subscription) + { + $phpbb_notifications->add_subscription($subscription['item_type'], 0, $subscription['method'], $user_id); + } } + /** + * Event that returns user id, user detals and user CPF of newly registared user + * + * @event core.user_add_after + * @var int user_id User id of newly registared user + * @var array user_row Array of user details submited to user_add + * @var array cp_data Array of Custom profile fields submited to user_add + * @since 3.1.0-b5 + */ + $vars = array('user_id', 'user_row', 'cp_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_after', compact($vars))); + return $user_id; } /** -* Remove User -* @param $mode Either 'retain' or 'remove' -*/ + * Remove User + * + * @param string $mode Either 'retain' or 'remove' + * @param mixed $user_ids Either an array of integers or an integer + * @param bool $retain_username + * @return bool + */ function user_delete($mode, $user_ids, $retain_username = true) { - global $cache, $config, $db, $user, $auth, $phpbb_dispatcher; + global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container; global $phpbb_root_path, $phpEx; $db->sql_transaction('begin'); @@ -386,7 +436,7 @@ function user_delete($mode, $user_ids, $retain_username = true) * @var array user_ids IDs of the deleted user * @var mixed retain_username True if username should be retained * or false if not - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('mode', 'user_ids', 'retain_username'); extract($phpbb_dispatcher->trigger_event('core.delete_user_before', compact($vars))); @@ -452,6 +502,9 @@ function user_delete($mode, $user_ids, $retain_username = true) $num_users_delta = 0; + // Get auth provider collection in case accounts might need to be unlinked + $provider_collection = $phpbb_container->get('auth.provider_collection'); + // Some things need to be done in the loop (if the query changes based // on which user is currently being deleted) $added_guest_posts = 0; @@ -462,6 +515,38 @@ function user_delete($mode, $user_ids, $retain_username = true) avatar_delete('user', $user_row); } + // Unlink accounts + foreach ($provider_collection as $provider_name => $auth_provider) + { + $provider_data = $auth_provider->get_auth_link_data($user_id); + + if ($provider_data !== null) + { + $link_data = array( + 'user_id' => $user_id, + 'link_method' => 'user_delete', + ); + + // BLOCK_VARS might contain hidden fields necessary for unlinking accounts + if (isset($provider_data['BLOCK_VARS']) && is_array($provider_data['BLOCK_VARS'])) + { + foreach ($provider_data['BLOCK_VARS'] as $provider_service) + { + if (!array_key_exists('HIDDEN_FIELDS', $provider_service)) + { + $provider_service['HIDDEN_FIELDS'] = array(); + } + + $auth_provider->unlink_account(array_merge($link_data, $provider_service['HIDDEN_FIELDS'])); + } + } + else + { + $auth_provider->unlink_account($link_data); + } + } + } + // Decrement number of users if this user is active if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE) { @@ -523,7 +608,7 @@ function user_delete($mode, $user_ids, $retain_username = true) if ($num_users_delta != 0) { - set_config_count('num_users', $num_users_delta, true); + $config->increment('num_users', $num_users_delta, false); } // Now do the invariant tasks @@ -537,11 +622,6 @@ function user_delete($mode, $user_ids, $retain_username = true) WHERE ' . $db->sql_in_set('poster_id', $user_ids); $db->sql_query($sql); - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_edit_user = ' . ANONYMOUS . ' - WHERE ' . $db->sql_in_set('post_edit_user', $user_ids); - $db->sql_query($sql); - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + ' . $added_guest_posts . ' WHERE user_id = ' . ANONYMOUS; @@ -571,6 +651,30 @@ function user_delete($mode, $user_ids, $retain_username = true) $cache->destroy('sql', MODERATOR_CACHE_TABLE); + // Change user_id to anonymous for posts edited by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for pms edited by this user + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('message_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for posts deleted by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_delete_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for topics deleted by this user + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('topic_delete_user', $user_ids); + $db->sql_query($sql); + // Delete user log entries about this user $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE ' . $db->sql_in_set('reportee_id', $user_ids); @@ -605,6 +709,9 @@ function user_delete($mode, $user_ids, $retain_username = true) } phpbb_delete_users_pms($user_ids); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_ids); + $db->sql_transaction('commit'); /** @@ -615,7 +722,7 @@ function user_delete($mode, $user_ids, $retain_username = true) * @var array user_ids IDs of the deleted user * @var mixed retain_username True if username should be retained * or false if not - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('mode', 'user_ids', 'retain_username'); extract($phpbb_dispatcher->trigger_event('core.delete_user_after', compact($vars))); @@ -636,7 +743,7 @@ function user_delete($mode, $user_ids, $retain_username = true) */ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) { - global $config, $db, $user, $auth; + global $config, $db, $user, $auth, $phpbb_dispatcher; $deactivated = $activated = 0; $sql_statements = array(); @@ -689,6 +796,21 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) } $db->sql_freeresult($result); + /** + * Check or modify activated/deactivated users data before submitting it to the database + * + * @event core.user_active_flip_before + * @var string mode User type changing mode, can be: flip|activate|deactivate + * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND + * @var int activated The number of users to be activated + * @var int deactivated The number of users to be deactivated + * @var array user_id_ary Array with user ids to change user type + * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data + * @since 3.1.4-RC1 + */ + $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); + extract($phpbb_dispatcher->trigger_event('core.user_active_flip_before', compact($vars))); + if (sizeof($sql_statements)) { foreach ($sql_statements as $user_id => $sql_ary) @@ -702,14 +824,29 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) $auth->acl_clear_prefetch(array_keys($sql_statements)); } + /** + * Perform additional actions after the users have been activated/deactivated + * + * @event core.user_active_flip_after + * @var string mode User type changing mode, can be: flip|activate|deactivate + * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND + * @var int activated The number of users to be activated + * @var int deactivated The number of users to be deactivated + * @var array user_id_ary Array with user ids to change user type + * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data + * @since 3.1.4-RC1 + */ + $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); + extract($phpbb_dispatcher->trigger_event('core.user_active_flip_after', compact($vars))); + if ($deactivated) { - set_config_count('num_users', $deactivated * (-1), true); + $config->increment('num_users', $deactivated * (-1), false); } if ($activated) { - set_config_count('num_users', $activated, true); + $config->increment('num_users', $activated, false); } // Update latest username @@ -729,7 +866,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) */ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason = '') { - global $db, $user, $auth, $cache; + global $db, $user, $cache, $phpbb_log; // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -752,7 +889,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas else { $ban_other = explode('-', $ban_len_other); - if (sizeof($ban_other) == 3 && ((int)$ban_other[0] < 9999) && + if (sizeof($ban_other) == 3 && ((int) $ban_other[0] < 9999) && (strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2)) { $ban_end = max($current_time, $user->create_datetime() @@ -878,7 +1015,6 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas if ($ip_2_counter == 0 && $ip_2_end == 254) { $ip_2_counter = 256; - $ip_2_fragment = 256; $banlist_ary[] = "$ip_1_counter.*"; } @@ -891,7 +1027,6 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas if ($ip_3_counter == 0 && $ip_3_end == 254) { $ip_3_counter = 256; - $ip_3_fragment = 256; $banlist_ary[] = "$ip_1_counter.$ip_2_counter.*"; } @@ -904,7 +1039,6 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas if ($ip_4_counter == 0 && $ip_4_end == 254) { $ip_4_counter = 256; - $ip_4_fragment = 256; $banlist_ary[] = "$ip_1_counter.$ip_2_counter.$ip_3_counter.*"; } @@ -1119,14 +1253,23 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas // Update log $log_entry = ($ban_exclude) ? 'LOG_BAN_EXCLUDE_' : 'LOG_BAN_'; - // Add to moderator log, admin log and user notes - add_log('admin', $log_entry . strtoupper($mode), $ban_reason, $ban_list_log); - add_log('mod', 0, 0, $log_entry . strtoupper($mode), $ban_reason, $ban_list_log); + // Add to admin log, moderator log and user notes + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array($ban_reason, $ban_list_log)); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $ban_reason, + $ban_list_log + )); if ($mode == 'user') { foreach ($banlist_ary as $user_id) { - add_log('user', $user_id, $log_entry . strtoupper($mode), $ban_reason, $ban_list_log); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array( + 'reportee_id' => $user_id, + $ban_reason, + $ban_list_log + )); } } @@ -1146,7 +1289,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas */ function user_unban($mode, $ban) { - global $db, $user, $auth, $cache; + global $db, $user, $cache, $phpbb_log; // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -1204,13 +1347,20 @@ function user_unban($mode, $ban) $db->sql_query($sql); // Add to moderator log, admin log and user notes - add_log('admin', 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list); - add_log('mod', 0, 0, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array($l_unban_list)); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $l_unban_list + )); if ($mode == 'user') { foreach ($user_ids_ary as $user_id) { - add_log('user', $user_id, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array( + 'reportee_id' => $user_id, + $l_unban_list + )); } } } @@ -1267,7 +1417,7 @@ function user_ipwhois($ip) $match = array(); // Test for referrals from $whois_host to other whois databases, roll on rwhois - if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match)) + if (preg_match('#ReferralServer:[\x20]*whois://(.+)#im', $ipwhois, $match)) { if (strpos($match[1], ':') !== false) { @@ -1326,9 +1476,18 @@ function validate_data($data, $val_ary) { $function = array_shift($validate); array_unshift($validate, $data[$var]); - $function_prefix = (function_exists('phpbb_validate_' . $function)) ? 'phpbb_validate_' : 'validate_'; - if ($result = call_user_func_array($function_prefix . $function, $validate)) + if (is_array($function)) + { + $result = call_user_func_array(array($function[0], 'validate_' . $function[1]), $validate); + } + else + { + $function_prefix = (function_exists('phpbb_validate_' . $function)) ? 'phpbb_validate_' : 'validate_'; + $result = call_user_func_array($function_prefix . $function, $validate); + } + + if ($result) { // Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted. $error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var); @@ -1520,89 +1679,37 @@ function validate_username($username, $allowed_username = false) return 'INVALID_CHARS'; } - $mbstring = $pcre = false; - - // generic UTF-8 character types supported? - if (phpbb_pcre_utf8_support()) - { - $pcre = true; - } - else if (function_exists('mb_ereg_match')) - { - mb_regex_encoding('UTF-8'); - $mbstring = true; - } - switch ($config['allow_name_chars']) { case 'USERNAME_CHARS_ANY': - $pcre = true; $regex = '.+'; break; case 'USERNAME_ALPHA_ONLY': - $pcre = true; $regex = '[A-Za-z0-9]+'; break; case 'USERNAME_ALPHA_SPACERS': - $pcre = true; $regex = '[A-Za-z0-9-[\]_+ ]+'; break; case 'USERNAME_LETTER_NUM': - if ($pcre) - { - $regex = '[\p{Lu}\p{Ll}\p{N}]+'; - } - else if ($mbstring) - { - $regex = '[[:upper:][:lower:][:digit:]]+'; - } - else - { - $pcre = true; - $regex = '[a-zA-Z0-9]+'; - } + $regex = '[\p{Lu}\p{Ll}\p{N}]+'; break; case 'USERNAME_LETTER_NUM_SPACERS': - if ($pcre) - { - $regex = '[-\]_+ [\p{Lu}\p{Ll}\p{N}]+'; - } - else if ($mbstring) - { - $regex = '[-\]_+ \[[:upper:][:lower:][:digit:]]+'; - } - else - { - $pcre = true; - $regex = '[-\]_+ [a-zA-Z0-9]+'; - } + $regex = '[-\]_+ [\p{Lu}\p{Ll}\p{N}]+'; break; case 'USERNAME_ASCII': default: - $pcre = true; $regex = '[\x01-\x7F]+'; break; } - if ($pcre) + if (!preg_match('#^' . $regex . '$#u', $username)) { - if (!preg_match('#^' . $regex . '$#u', $username)) - { - return 'INVALID_CHARS'; - } - } - else if ($mbstring) - { - mb_ereg_search_init($username, '^' . $regex . '$'); - if (!mb_ereg_search()) - { - return 'INVALID_CHARS'; - } + return 'INVALID_CHARS'; } $sql = 'SELECT username @@ -1657,35 +1764,10 @@ function validate_password($password) return false; } - $pcre = $mbstring = false; - - // generic UTF-8 character types supported? - if (phpbb_pcre_utf8_support()) - { - $upp = '\p{Lu}'; - $low = '\p{Ll}'; - $num = '\p{N}'; - $sym = '[^\p{Lu}\p{Ll}\p{N}]'; - $pcre = true; - } - else if (function_exists('mb_ereg_match')) - { - mb_regex_encoding('UTF-8'); - $upp = '[[:upper:]]'; - $low = '[[:lower:]]'; - $num = '[[:digit:]]'; - $sym = '[^[:upper:][:lower:][:digit:]]'; - $mbstring = true; - } - else - { - $upp = '[A-Z]'; - $low = '[a-z]'; - $num = '[0-9]'; - $sym = '[^A-Za-z0-9]'; - $pcre = true; - } - + $upp = '\p{Lu}'; + $low = '\p{Ll}'; + $num = '\p{N}'; + $sym = '[^\p{Lu}\p{Ll}\p{N}]'; $chars = array(); switch ($config['pass_complex']) @@ -1708,24 +1790,11 @@ function validate_password($password) $chars[] = $upp; } - if ($pcre) + foreach ($chars as $char) { - foreach ($chars as $char) + if (!preg_match('#' . $char . '#u', $password)) { - if (!preg_match('#' . $char . '#u', $password)) - { - return 'INVALID_CHARS'; - } - } - } - else if ($mbstring) - { - foreach ($chars as $char) - { - if (mb_ereg($char, $password) === false) - { - return 'INVALID_CHARS'; - } + return 'INVALID_CHARS'; } } @@ -1733,25 +1802,21 @@ function validate_password($password) } /** -* Check to see if email address is banned or already present in the DB +* Check to see if email address is a valid address and contains a MX record * * @param string $email The email to check -* @param string $allowed_email An allowed email, default being $user->data['user_email'] * * @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) */ -function validate_email($email, $allowed_email = false) +function phpbb_validate_email($email, $config = null) { - global $config, $db, $user; - - $email = strtolower($email); - $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); - - if ($allowed_email == $email) + if ($config === null) { - return false; + global $config; } + $email = strtolower($email); + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) { return 'EMAIL_INVALID'; @@ -1769,6 +1834,35 @@ function validate_email($email, $allowed_email = false) } } + return false; +} + +/** +* Check to see if email address is banned or already present in the DB +* +* @param string $email The email to check +* @param string $allowed_email An allowed email, default being $user->data['user_email'] +* +* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_user_email($email, $allowed_email = false) +{ + global $config, $db, $user; + + $email = strtolower($email); + $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); + + if ($allowed_email == $email) + { + return false; + } + + $validate_email = phpbb_validate_email($email, $config); + if ($validate_email) + { + return $validate_email; + } + if (($ban_reason = $user->check_ban(false, false, $email, true)) !== false) { return ($ban_reason === true) ? 'EMAIL_BANNED' : $ban_reason; @@ -2044,12 +2138,12 @@ function phpbb_style_is_active($style_id) */ function avatar_delete($mode, $row, $clean_db = false) { - global $phpbb_root_path, $config, $db, $user; + global $phpbb_root_path, $config; // Check if the users avatar is actually *not* a group avatar if ($mode == 'user') { - if (strpos($row['user_avatar'], 'g') === 0 || (((int)$row['user_avatar'] !== 0) && ((int)$row['user_avatar'] !== (int)$row['user_id']))) + if (strpos($row['user_avatar'], 'g') === 0 || (((int) $row['user_avatar'] !== 0) && ((int) $row['user_avatar'] !== (int) $row['user_id']))) { return false; } @@ -2077,7 +2171,6 @@ function get_avatar_filename($avatar_entry) { global $config; - if ($avatar_entry[0] === 'g') { $avatar_group = true; @@ -2117,7 +2210,10 @@ function phpbb_avatar_explanation_string() */ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow_desc_bbcode = false, $allow_desc_urls = false, $allow_desc_smilies = false) { - global $phpbb_root_path, $config, $db, $user, $file_upload, $phpbb_container; + global $db, $user, $phpbb_container, $phpbb_log; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); $error = array(); @@ -2149,8 +2245,12 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $current_legend = \phpbb\groupposition\legend::GROUP_DISABLED; $current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED; + /* @var $legend \phpbb\groupposition\legend */ $legend = $phpbb_container->get('groupposition.legend'); + + /* @var $teampage \phpbb\groupposition\teampage */ $teampage = $phpbb_container->get('groupposition.teampage'); + if ($group_id) { try @@ -2222,8 +2322,6 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow // Setting the log message before we set the group id (if group gets added) $log = ($group_id) ? 'LOG_GROUP_UPDATED' : 'LOG_GROUP_CREATED'; - $query = ''; - if ($group_id) { $sql = 'SELECT user_id @@ -2366,8 +2464,8 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow group_set_user_default($group_id, $user_ary, $sql_ary); } - $name = ($type == GROUP_SPECIAL) ? $user->lang['G_' . $name] : $name; - add_log('admin', $log, $name); + $name = $group_helper->get_name($name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($name)); group_update_listings($group_id); } @@ -2383,7 +2481,7 @@ function group_correct_avatar($group_id, $old_entry) { global $config, $db, $phpbb_root_path; - $group_id = (int)$group_id; + $group_id = (int) $group_id; $ext = substr(strrchr($old_entry, '.'), 1); $old_filename = get_avatar_filename($old_entry); $new_filename = $config['avatar_salt'] . "_g$group_id.$ext"; @@ -2405,7 +2503,7 @@ function group_correct_avatar($group_id, $old_entry) */ function avatar_remove_db($avatar_name) { - global $config, $db; + global $db; $sql = 'UPDATE ' . USERS_TABLE . " SET user_avatar = '', @@ -2420,7 +2518,7 @@ function avatar_remove_db($avatar_name) */ function group_delete($group_id, $group_name = false) { - global $db, $cache, $auth, $user, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container; + global $db, $cache, $auth, $user, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container, $phpbb_log; if (!$group_name) { @@ -2464,6 +2562,7 @@ function group_delete($group_id, $group_name = false) // Delete group from legend and teampage try { + /* @var $legend \phpbb\groupposition\legend */ $legend = $phpbb_container->get('groupposition.legend'); $legend->delete_group($group_id); unset($legend); @@ -2477,6 +2576,7 @@ function group_delete($group_id, $group_name = false) try { + /* @var $teampage \phpbb\groupposition\teampage */ $teampage = $phpbb_container->get('groupposition.teampage'); $teampage->delete_group($group_id); unset($teampage); @@ -2504,7 +2604,7 @@ function group_delete($group_id, $group_name = false) * @event core.delete_group_after * @var int group_id ID of the deleted group * @var string group_name Name of the deleted group - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('group_id', 'group_name'); extract($phpbb_dispatcher->trigger_event('core.delete_group_after', compact($vars))); @@ -2517,7 +2617,7 @@ function group_delete($group_id, $group_name = false) phpbb_cache_moderators($db, $cache, $auth); - add_log('admin', 'LOG_GROUP_DELETE', $group_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_GROUP_DELETE', false, array($group_name)); // Return false - no error return false; @@ -2530,7 +2630,7 @@ function group_delete($group_id, $group_name = false) */ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false) { - global $db, $auth, $phpbb_container; + global $db, $auth, $user, $phpbb_container, $phpbb_log, $phpbb_dispatcher; // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); @@ -2607,6 +2707,26 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, // Clear permissions cache of relevant users $auth->acl_clear_prefetch($user_id_ary); + /** + * Event after users are added to a group + * + * @event core.group_add_user_after + * @var int group_id ID of the group to which users are added + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are added + * @var array username_ary names of the users which are added + * @var int pending Pending setting, 1 if user(s) added are pending + * @since 3.1.7-RC1 + */ + $vars = array( + 'group_id', + 'group_name', + 'user_id_ary', + 'username_ary', + 'pending', + ); + extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); + if (!$group_name) { $group_name = get_group_name($group_id); @@ -2614,17 +2734,18 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $log = ($leader) ? 'LOG_MODS_ADDED' : (($pending) ? 'LOG_USERS_PENDING' : 'LOG_USERS_ADDED'); - add_log('admin', $log, $group_name, implode(', ', $username_ary)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); group_update_listings($group_id); if ($pending) { + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); foreach ($add_id_ary as $user_id) { - $phpbb_notifications->add_notifications('group_request', array( + $phpbb_notifications->add_notifications('notification.type.group_request', array( 'group_id' => $group_id, 'user_id' => $user_id, 'group_name' => $group_name, @@ -2645,7 +2766,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, */ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false) { - global $db, $auth, $config, $phpbb_dispatcher, $phpbb_container; + global $db, $auth, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_log; if ($config['coppa_enable']) { @@ -2752,7 +2873,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, * @var string group_name Name of the group * @var array user_id_ary IDs of the users which are removed * @var array username_ary names of the users which are removed - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); extract($phpbb_dispatcher->trigger_event('core.group_delete_user_before', compact($vars))); @@ -2765,6 +2886,19 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, // Clear permissions cache of relevant users $auth->acl_clear_prefetch($user_id_ary); + /** + * Event after users are removed from a group + * + * @event core.group_delete_user_after + * @var int group_id ID of the group from which users are deleted + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are removed + * @var array username_ary names of the users which are removed + * @since 3.1.7-RC1 + */ + $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + extract($phpbb_dispatcher->trigger_event('core.group_delete_user_after', compact($vars))); + if (!$group_name) { $group_name = get_group_name($group_id); @@ -2774,14 +2908,15 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, if ($group_name) { - add_log('admin', $log, $group_name, implode(', ', $username_ary)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); } group_update_listings($group_id); + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->delete_notifications('group_request', $user_id_ary, $group_id); + $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id); // Return false - no error return false; @@ -2808,7 +2943,7 @@ function remove_default_avatar($group_id, $user_ids) $sql = 'SELECT * FROM ' . GROUPS_TABLE . ' - WHERE group_id = ' . (int)$group_id; + WHERE group_id = ' . (int) $group_id; $result = $db->sql_query($sql); if (!$row = $db->sql_fetchrow($result)) { @@ -2849,7 +2984,7 @@ function remove_default_rank($group_id, $user_ids) $sql = 'SELECT * FROM ' . GROUPS_TABLE . ' - WHERE group_id = ' . (int)$group_id; + WHERE group_id = ' . (int) $group_id; $result = $db->sql_query($sql); if (!$row = $db->sql_fetchrow($result)) { @@ -2860,9 +2995,9 @@ function remove_default_rank($group_id, $user_ids) $sql = 'UPDATE ' . USERS_TABLE . ' SET user_rank = 0 - WHERE group_id = ' . (int)$group_id . ' + WHERE group_id = ' . (int) $group_id . ' AND user_rank <> 0 - AND user_rank = ' . (int)$row['group_rank'] . ' + AND user_rank = ' . (int) $row['group_rank'] . ' AND ' . $db->sql_in_set('user_id', $user_ids); $db->sql_query($sql); } @@ -2872,7 +3007,7 @@ function remove_default_rank($group_id, $user_ids) */ function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false) { - global $db, $auth, $phpbb_root_path, $phpEx, $config, $phpbb_container; + global $db, $auth, $user, $phpbb_container, $phpbb_log; // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); @@ -2943,14 +3078,15 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna AND " . $db->sql_in_set('user_id', $user_id_ary); $db->sql_query($sql); + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->add_notifications('group_request_approved', array( + $phpbb_notifications->add_notifications('notification.type.group_request_approved', array( 'user_ids' => $user_id_ary, 'group_id' => $group_id, 'group_name' => $group_name, )); - $phpbb_notifications->delete_notifications('group_request', $user_id_ary, $group_id); + $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id); $log = 'LOG_USERS_APPROVED'; break; @@ -3006,7 +3142,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna // Clear permissions cache of relevant users $auth->acl_clear_prefetch($user_id_ary); - add_log('admin', $log, $group_name, implode(', ', $username_ary)); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); group_update_listings($group_id); @@ -3018,7 +3154,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna */ function group_validate_groupname($group_id, $group_name) { - global $config, $db; + global $db; $group_name = utf8_clean_string($group_name); @@ -3066,7 +3202,7 @@ function group_validate_groupname($group_id, $group_name) */ function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false) { - global $phpbb_container, $db, $phpbb_dispatcher; + global $config, $phpbb_container, $db, $phpbb_dispatcher; if (empty($user_id_ary)) { @@ -3136,8 +3272,8 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal if (isset($sql_ary[$avatar_option])) { $avatar_sql_ary[$avatar_option] = $sql_ary[$avatar_option]; - } } + } $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $avatar_sql_ary) . " @@ -3178,11 +3314,9 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary); $db->sql_query($sql); - global $config; - if (in_array($config['newest_user_id'], $user_id_ary)) { - set_config('newest_user_colour', $sql_ary['user_colour'], true); + $config->set('newest_user_colour', $sql_ary['user_colour'], false); } } @@ -3198,7 +3332,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal * @var array group_attributes Group attributes which were changed * @var array update_listing Update the list of moderators and foes * @var array sql_ary User attributes which were changed - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('group_id', 'user_id_ary', 'group_attributes', 'update_listing', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.user_set_default_group', compact($vars))); @@ -3217,7 +3351,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal */ function get_group_name($group_id) { - global $db, $user; + global $db, $phpbb_container; $sql = 'SELECT group_name, group_type FROM ' . GROUPS_TABLE . ' @@ -3226,12 +3360,15 @@ function get_group_name($group_id) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if (!$row || ($row['group_type'] == GROUP_SPECIAL && empty($user->lang))) + if (!$row) { return ''; } - return ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + return $group_helper->get_name($row['group_name']); } /** @@ -3447,9 +3584,12 @@ function remove_newly_registered($user_id, $user_data = false) * * @param array $user_ids Array of users' ids to check for banning, * leave empty to get complete list of banned ids +* @param bool|int $ban_end Bool True to get users currently banned +* Bool False to only get permanently banned users +* Int Unix timestamp to get users banned until that time * @return array Array of banned users' ids if any, empty array otherwise */ -function phpbb_get_banned_user_ids($user_ids = array()) +function phpbb_get_banned_user_ids($user_ids = array(), $ban_end = true) { global $db; @@ -3461,9 +3601,26 @@ function phpbb_get_banned_user_ids($user_ids = array()) $sql = 'SELECT ban_userid FROM ' . BANLIST_TABLE . " WHERE $sql_user_ids - AND ban_exclude <> 1 - AND (ban_end > " . time() . ' + AND ban_exclude <> 1"; + + if ($ban_end === true) + { + // Banned currently + $sql .= " AND (ban_end > " . time() . ' OR ban_end = 0)'; + } + else if ($ban_end === false) + { + // Permanently banned + $sql .= " AND ban_end = 0"; + } + else + { + // Banned until a specified time + $sql .= " AND (ban_end > " . (int) $ban_end . ' + OR ban_end = 0)'; + } + $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { @@ -3474,3 +3631,23 @@ function phpbb_get_banned_user_ids($user_ids = array()) return $banned_ids_list; } + +/** +* Function for assigning a template var if the zebra module got included +*/ +function phpbb_module_zebra($mode, &$module_row) +{ + global $template; + + $template->assign_var('S_ZEBRA_ENABLED', true); + + if ($mode == 'friends') + { + $template->assign_var('S_ZEBRA_FRIENDS_ENABLED', true); + } + + if ($mode == 'foes') + { + $template->assign_var('S_ZEBRA_FOES_ENABLED', true); + } +} diff --git a/phpBB/includes/hooks/index.php b/phpBB/includes/hooks/index.php index 11478aee1e..805e0eea1a 100644 --- a/phpBB/includes/hooks/index.php +++ b/phpBB/includes/hooks/index.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * phpBB Hook Class -* @package phpBB3 */ class phpbb_hook { diff --git a/phpBB/includes/mcp/info/mcp_ban.php b/phpBB/includes/mcp/info/mcp_ban.php index a3a1e0ef9a..b4fd32792a 100644 --- a/phpBB/includes/mcp/info/mcp_ban.php +++ b/phpBB/includes/mcp/info/mcp_ban.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_ban_info { function module() @@ -17,7 +18,6 @@ class mcp_ban_info return array( 'filename' => 'mcp_ban', 'title' => 'MCP_BAN', - 'version' => '1.0.0', 'modes' => array( 'user' => array('title' => 'MCP_BAN_USERNAMES', 'auth' => 'acl_m_ban', 'cat' => array('MCP_BAN')), 'ip' => array('title' => 'MCP_BAN_IPS', 'auth' => 'acl_m_ban', 'cat' => array('MCP_BAN')), diff --git a/phpBB/includes/mcp/info/mcp_logs.php b/phpBB/includes/mcp/info/mcp_logs.php index fc30a600c0..7a0205fce9 100644 --- a/phpBB/includes/mcp/info/mcp_logs.php +++ b/phpBB/includes/mcp/info/mcp_logs.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_logs_info { function module() @@ -17,7 +18,6 @@ class mcp_logs_info return array( 'filename' => 'mcp_logs', 'title' => 'MCP_LOGS', - 'version' => '1.0.0', 'modes' => array( 'front' => array('title' => 'MCP_LOGS_FRONT', 'auth' => 'acl_m_ || aclf_m_', 'cat' => array('MCP_LOGS')), 'forum_logs' => array('title' => 'MCP_LOGS_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_LOGS')), diff --git a/phpBB/includes/mcp/info/mcp_main.php b/phpBB/includes/mcp/info/mcp_main.php index 705715cbeb..c0f0363255 100644 --- a/phpBB/includes/mcp/info/mcp_main.php +++ b/phpBB/includes/mcp/info/mcp_main.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_main_info { function module() @@ -17,7 +18,6 @@ class mcp_main_info return array( 'filename' => 'mcp_main', 'title' => 'MCP_MAIN', - 'version' => '1.0.0', 'modes' => array( 'front' => array('title' => 'MCP_MAIN_FRONT', 'auth' => '', 'cat' => array('MCP_MAIN')), 'forum_view' => array('title' => 'MCP_MAIN_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_MAIN')), diff --git a/phpBB/includes/mcp/info/mcp_notes.php b/phpBB/includes/mcp/info/mcp_notes.php index a77b461bbd..de4a41dd80 100644 --- a/phpBB/includes/mcp/info/mcp_notes.php +++ b/phpBB/includes/mcp/info/mcp_notes.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_notes_info { function module() @@ -17,7 +18,6 @@ class mcp_notes_info return array( 'filename' => 'mcp_notes', 'title' => 'MCP_NOTES', - 'version' => '1.0.0', 'modes' => array( 'front' => array('title' => 'MCP_NOTES_FRONT', 'auth' => '', 'cat' => array('MCP_NOTES')), 'user_notes' => array('title' => 'MCP_NOTES_USER', 'auth' => '', 'cat' => array('MCP_NOTES')), diff --git a/phpBB/includes/mcp/info/mcp_pm_reports.php b/phpBB/includes/mcp/info/mcp_pm_reports.php index 07dc564b19..2a57c0c49a 100644 --- a/phpBB/includes/mcp/info/mcp_pm_reports.php +++ b/phpBB/includes/mcp/info/mcp_pm_reports.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_pm_reports_info { function module() @@ -17,11 +18,10 @@ class mcp_pm_reports_info return array( 'filename' => 'mcp_pm_reports', 'title' => 'MCP_PM_REPORTS', - 'version' => '1.0.0', 'modes' => array( - 'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), - 'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), - 'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), + 'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'acl_m_pm_report', 'cat' => array('MCP_REPORTS')), + 'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'acl_m_pm_report', 'cat' => array('MCP_REPORTS')), + 'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'acl_m_pm_report', 'cat' => array('MCP_REPORTS')), ), ); } diff --git a/phpBB/includes/mcp/info/mcp_queue.php b/phpBB/includes/mcp/info/mcp_queue.php index 68cac5abd2..d5605aa50e 100644 --- a/phpBB/includes/mcp/info/mcp_queue.php +++ b/phpBB/includes/mcp/info/mcp_queue.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_queue_info { function module() @@ -17,7 +18,6 @@ class mcp_queue_info return array( 'filename' => 'mcp_queue', 'title' => 'MCP_QUEUE', - 'version' => '1.0.0', 'modes' => array( 'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')), 'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')), diff --git a/phpBB/includes/mcp/info/mcp_reports.php b/phpBB/includes/mcp/info/mcp_reports.php index cb6962a1d5..76e62efe9c 100644 --- a/phpBB/includes/mcp/info/mcp_reports.php +++ b/phpBB/includes/mcp/info/mcp_reports.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_reports_info { function module() @@ -17,7 +18,6 @@ class mcp_reports_info return array( 'filename' => 'mcp_reports', 'title' => 'MCP_REPORTS', - 'version' => '1.0.0', 'modes' => array( 'reports' => array('title' => 'MCP_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), 'reports_closed' => array('title' => 'MCP_REPORTS_CLOSED', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), diff --git a/phpBB/includes/mcp/info/mcp_warn.php b/phpBB/includes/mcp/info/mcp_warn.php index d5ac1eedbf..b4f83e77c6 100644 --- a/phpBB/includes/mcp/info/mcp_warn.php +++ b/phpBB/includes/mcp/info/mcp_warn.php @@ -1,15 +1,16 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class mcp_warn_info { function module() @@ -17,7 +18,6 @@ class mcp_warn_info return array( 'filename' => 'mcp_warn', 'title' => 'MCP_WARN', - 'version' => '1.0.0', 'modes' => array( 'front' => array('title' => 'MCP_WARN_FRONT', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')), 'list' => array('title' => 'MCP_WARN_LIST', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')), diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index d3bc336293..4d2151fded 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,16 +19,13 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package mcp -*/ class mcp_ban { var $u_action; function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $request, $phpbb_dispatcher; global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/functions_user.' . $phpEx); @@ -32,55 +33,133 @@ class mcp_ban // Include the admin banning interface... include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx); - $bansubmit = (isset($_POST['bansubmit'])) ? true : false; - $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; - $current_time = time(); + $bansubmit = $request->is_set_post('bansubmit'); + $unbansubmit = $request->is_set_post('unbansubmit'); $user->add_lang(array('acp/ban', 'acp/users')); $this->tpl_name = 'mcp_ban'; + /** + * Use this event to pass perform actions when a ban is issued or revoked + * + * @event core.mcp_ban_main + * @var bool bansubmit True if a ban is issued + * @var bool unbansubmit True if a ban is removed + * @var string mode Mode of the ban that is being worked on + * @since 3.1.0-RC5 + */ + $vars = array( + 'bansubmit', + 'unbansubmit', + 'mode', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_main', compact($vars))); + // Ban submitted? if ($bansubmit) { // Grab the list of entries - $ban = request_var('ban', '', ($mode === 'user') ? true : false); - - if ($mode === 'user') - { - $ban = utf8_normalize_nfc($ban); - } - - $ban_len = request_var('banlength', 0); - $ban_len_other = request_var('banlengthother', ''); - $ban_exclude = request_var('banexclude', 0); - $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true)); - $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true)); + $ban = $request->variable('ban', '', $mode === 'user'); + $ban_length = $request->variable('banlength', 0); + $ban_length_other = $request->variable('banlengthother', ''); + $ban_exclude = $request->variable('banexclude', 0); + $ban_reason = $request->variable('banreason', '', true); + $ban_give_reason = $request->variable('bangivereason', '', true); if ($ban) { if (confirm_box(true)) { - user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason); + $abort_ban = false; + /** + * Use this event to modify the ban details before the ban is performed + * + * @event core.mcp_ban_before + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @var mixed abort_ban Either false, or an error message that is displayed to the user. + * If a string is given the bans are not issued. + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + 'abort_ban', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_before', compact($vars))); + + if ($abort_ban) + { + trigger_error($abort_ban); + } + user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason); + + /** + * Use this event to perform actions after the ban has been performed + * + * @event core.mcp_ban_after + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_after', compact($vars))); trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>'); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + $hidden_fields = array( 'mode' => $mode, 'ban' => $ban, 'bansubmit' => true, - 'banlength' => $ban_len, - 'banlengthother' => $ban_len_other, + 'banlength' => $ban_length, + 'banlengthother' => $ban_length_other, 'banexclude' => $ban_exclude, 'banreason' => $ban_reason, - 'bangivereason' => $ban_give_reason))); + 'bangivereason' => $ban_give_reason, + ); + + /** + * Use this event to pass data from the ban form to the confirmation screen + * + * @event core.mcp_ban_confirm + * @var array hidden_fields Hidden fields that are passed through the confirm screen + * @since 3.1.0-RC5 + */ + $vars = array('hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_confirm', compact($vars))); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($hidden_fields)); } } } else if ($unbansubmit) { - $ban = request_var('unban', array('')); + $ban = $request->variable('unban', array('')); if ($ban) { @@ -156,9 +235,9 @@ class mcp_ban } // As a "service" we will check if any post id is specified and populate the username of the poster id if given - $post_id = request_var('p', 0); - $user_id = request_var('u', 0); - $username = $pre_fill = false; + $post_id = $request->variable('p', 0); + $user_id = $request->variable('u', 0); + $pre_fill = false; if ($user_id && $user_id <> ANONYMOUS) { @@ -171,7 +250,7 @@ class mcp_ban case 'user': $pre_fill = (string) $db->sql_fetchfield('username'); break; - + case 'ip': $pre_fill = (string) $db->sql_fetchfield('user_ip'); break; @@ -184,7 +263,7 @@ class mcp_ban } else if ($post_id) { - $post_info = get_post_data($post_id, 'm_ban'); + $post_info = phpbb_get_post_data($post_id, 'm_ban'); if (sizeof($post_info) && !empty($post_info[$post_id])) { diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 7c1c61dae7..dc4d59cc46 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -31,21 +35,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info) // merge_topic is the quickmod action, merge_topics is the mcp_forum action, and merge_select is the mcp_topic action $merge_select = ($action == 'merge_select' || $action == 'merge_topic' || $action == 'merge_topics') ? true : false; - if ($merge_select) - { - // Fixes a "bug" that makes forum_view use the same ordering as topic_view - $request->overwrite('sk', null); - $request->overwrite('sd', null); - $request->overwrite('sk', null, \phpbb\request\request_interface::POST); - $request->overwrite('sd', null, \phpbb\request\request_interface::POST); - } - $forum_id = $forum_info['forum_id']; - $start = request_var('start', 0); - $topic_id_list = request_var('topic_id_list', array(0)); - $post_id_list = request_var('post_id_list', array(0)); - $source_topic_ids = array(request_var('t', 0)); - $to_topic_id = request_var('to_topic_id', 0); + $start = $request->variable('start', 0); + $topic_id_list = $request->variable('topic_id_list', array(0)); + $post_id_list = $request->variable('post_id_list', array(0)); + $source_topic_ids = array($request->variable('t', 0)); + $to_topic_id = $request->variable('to_topic_id', 0); $url_extra = ''; $url_extra .= ($forum_id) ? "&f=$forum_id" : ''; @@ -59,7 +54,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) switch ($action) { case 'resync': - $topic_ids = request_var('topic_id_list', array(0)); + $topic_ids = $request->variable('topic_id_list', array(0)); mcp_resync_topics($topic_ids); break; @@ -73,6 +68,31 @@ function mcp_forum_view($id, $mode, $action, $forum_info) break; } + /** + * Get some data in order to execute other actions. + * + * @event core.mcp_forum_view_before + * @var string action The action + * @var array forum_info Array with forum infos + * @var int start Start value + * @var array topic_id_list Array of topics ids + * @var array post_id_list Array of posts ids + * @var array source_topic_ids Array of source topics ids + * @var int to_topic_id Array of destination topics ids + * @since 3.1.6-RC1 + */ + $vars = array( + 'action', + 'forum_info', + 'start', + 'topic_id_list', + 'post_id_list', + 'source_topic_ids', + 'to_topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_forum_view_before', compact($vars))); + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); $selected_ids = ''; @@ -98,7 +118,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $sort_days = $total = 0; $sort_key = $sort_dir = ''; $sort_by_sql = $sort_order_sql = array(); - mcp_sorting('viewforum', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id); + phpbb_mcp_sorting('viewforum', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id); $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total; $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -126,9 +146,10 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'S_CAN_SYNC' => $auth->acl_get('m_', $forum_id), 'S_CAN_APPROVE' => $auth->acl_get('m_approve', $forum_id), 'S_MERGE_SELECT' => ($merge_select) ? true : false, - 'S_CAN_MAKE_NORMAL' => $auth->acl_gets('f_sticky', 'f_announce', $forum_id), + 'S_CAN_MAKE_NORMAL' => $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id), 'S_CAN_MAKE_STICKY' => $auth->acl_get('f_sticky', $forum_id), 'S_CAN_MAKE_ANNOUNCE' => $auth->acl_get('f_announce', $forum_id), + 'S_CAN_MAKE_ANNOUNCE_GLOBAL' => $auth->acl_get('f_announce_global', $forum_id), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=forum_logs&f=' . $forum_id) : '', @@ -153,6 +174,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $read_tracking_join = $read_tracking_select = ''; } + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); $sql = 'SELECT t.topic_id @@ -161,13 +183,29 @@ function mcp_forum_view($id, $mode, $action, $forum_info) AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . " $limit_time_sql ORDER BY t.topic_type DESC, $sort_order_sql"; + + /** + * Modify SQL query before MCP forum view topic list is queried + * + * @event core.mcp_view_forum_modify_sql + * @var string sql SQL query for forum view topic list + * @var int forum_id ID of the forum + * @var string limit_time_sql SQL query part for limit time + * @var string sort_order_sql SQL query part for sort order + * @var int topics_per_page Number of topics per page + * @var int start Start value + * @since 3.1.2-RC1 + */ + $vars = array('sql', 'forum_id', 'limit_time_sql', 'sort_order_sql', 'topics_per_page', 'start'); + extract($phpbb_dispatcher->trigger_event('core.mcp_view_forum_modify_sql', compact($vars))); + $result = $db->sql_query_limit($sql, $topics_per_page, $start); $topic_list = $topic_tracking_info = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row_ary = $db->sql_fetchrow($result)) { - $topic_list[] = $row['topic_id']; + $topic_list[] = $row_ary['topic_id']; } $db->sql_freeresult($result); @@ -176,9 +214,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info) WHERE " . $db->sql_in_set('t.topic_id', $topic_list, false, true); $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row_ary = $db->sql_fetchrow($result)) { - $topic_rows[$row['topic_id']] = $row; + $topic_rows[$row_ary['topic_id']] = $row_ary; } $db->sql_freeresult($result); @@ -203,109 +241,110 @@ function mcp_forum_view($id, $mode, $action, $forum_info) foreach ($topic_list as $topic_id) { - $topic_title = ''; - - $row = &$topic_rows[$topic_id]; + $row_ary = &$topic_rows[$topic_id]; - $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1; + $replies = $phpbb_content_visibility->get_count('topic_posts', $row_ary, $forum_id) - 1; - if ($row['topic_status'] == ITEM_MOVED) + if ($row_ary['topic_status'] == ITEM_MOVED) { $unread_topic = false; } else { - $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row_ary['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; } // Get folder img, topic status/type related information $folder_img = $folder_alt = $topic_type = ''; - topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); + topic_status($row_ary, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); - $topic_title = censor_text($row['topic_title']); + $topic_title = censor_text($row_ary['topic_title']); - $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; - $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; - $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; - $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&t=' . $row['topic_id'] : ''; + $topic_unapproved = (($row_ary['topic_visibility'] == ITEM_UNAPPROVED || $row_ary['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row_ary['forum_id'])) ? true : false; + $posts_unapproved = ($row_ary['topic_visibility'] == ITEM_APPROVED && $row_ary['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row_ary['forum_id'])) ? true : false; + $topic_deleted = $row_ary['topic_visibility'] == ITEM_DELETED; + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&t=' . $row_ary['topic_id'] : ''; $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? $url . '&i=queue&mode=deleted_topics&t=' . $topic_id : $u_mcp_queue; $topic_row = array( - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row_ary['forum_id']) && $row_ary['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), - 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', - 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', - 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', + 'TOPIC_ICON_IMG' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['height'] : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'DELETED_IMG' => ($topic_deleted) ? $user->img('icon_topic_deleted', 'POSTS_DELETED') : '', - 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR' => get_username_string('username', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']), - 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), - 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), - 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), - 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR' => get_username_string('username', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']), + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']), 'TOPIC_TYPE' => $topic_type, 'TOPIC_TITLE' => $topic_title, - 'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1, - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), - 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], - 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row_ary, $row_ary['forum_id']) - 1, + 'LAST_POST_TIME' => $user->format_date($row_ary['topic_last_post_time']), + 'FIRST_POST_TIME' => $user->format_date($row_ary['topic_time']), + 'LAST_POST_SUBJECT' => $row_ary['topic_last_post_subject'], + 'LAST_VIEW_TIME' => $user->format_date($row_ary['topic_last_view_time']), - 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false, + 'S_TOPIC_REPORTED' => (!empty($row_ary['topic_reported']) && empty($row_ary['topic_moved_id']) && $auth->acl_get('m_report', $row_ary['forum_id'])) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_TOPIC_DELETED' => $topic_deleted, 'S_UNREAD_TOPIC' => $unread_topic, ); - if ($row['topic_status'] == ITEM_MOVED) + if ($row_ary['topic_status'] == ITEM_MOVED) { $topic_row = array_merge($topic_row, array( - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_moved_id']}"), - 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&topic_id_list[]={$row['topic_id']}&mode=forum_view&action=delete_topic") : '', + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row_ary['topic_moved_id']}"), + 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&topic_id_list[]={$row_ary['topic_id']}&mode=forum_view&action=delete_topic") : '', 'S_MOVED_TOPIC' => true, - 'TOPIC_ID' => $row['topic_moved_id'], + 'TOPIC_ID' => $row_ary['topic_moved_id'], )); } else { if ($action == 'merge_topic' || $action == 'merge_topics') { - $u_select_topic = $url . "&i=$id&mode=forum_view&action=$action&to_topic_id=" . $row['topic_id'] . $selected_ids; + $u_select_topic = $url . "&i=$id&mode=forum_view&action=$action&to_topic_id=" . $row_ary['topic_id'] . $selected_ids; } else { - $u_select_topic = $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row['topic_id'] . $selected_ids; + $u_select_topic = $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row_ary['topic_id'] . $selected_ids; } $topic_row = array_merge($topic_row, array( - 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row['topic_id']}&mode=topic_view"), + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row_ary['topic_id']}&mode=topic_view"), - 'S_SELECT_TOPIC' => ($merge_select && !in_array($row['topic_id'], $source_topic_ids)) ? true : false, + 'S_SELECT_TOPIC' => ($merge_select && !in_array($row_ary['topic_id'], $source_topic_ids)) ? true : false, 'U_SELECT_TOPIC' => $u_select_topic, 'U_MCP_QUEUE' => $u_mcp_queue, - 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&t=' . $row['topic_id'] . '&action=reports') : '', - 'TOPIC_ID' => $row['topic_id'], - 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? true : false, + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&t=' . $row_ary['topic_id'] . '&action=reports') : '', + 'TOPIC_ID' => $row_ary['topic_id'], + 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row_ary['topic_id'], $topic_id_list)) ? true : false, )); } + $row = $row_ary; /** * Modify the topic data before it is assigned to the template in MCP * * @event core.mcp_view_forum_modify_topicrow - * @var array row Array with topic data + * @var array row Array with topic data * @var array topic_row Template array with topic data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('row', 'topic_row'); extract($phpbb_dispatcher->trigger_event('core.mcp_view_forum_modify_topicrow', compact($vars))); + $row_ary = $row; + unset($row); $template->assign_block_vars('topicrow', $topic_row); } @@ -317,14 +356,14 @@ function mcp_forum_view($id, $mode, $action, $forum_info) */ function mcp_resync_topics($topic_ids) { - global $auth, $db, $template, $phpEx, $user, $phpbb_root_path; + global $db, $user, $phpbb_log, $request; if (!sizeof($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) { return; } @@ -342,13 +381,17 @@ function mcp_resync_topics($topic_ids) // Log this action while ($row = $db->sql_fetchrow($result)) { - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_RESYNC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + $row['topic_title'] + )); } $db->sql_freeresult($result); $msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; - $redirect = request_var('redirect', $user->data['session_page']); + $redirect = $request->variable('redirect', $user->data['session_page']); meta_refresh(3, $redirect); trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); @@ -361,7 +404,7 @@ function mcp_resync_topics($topic_ids) */ function merge_topics($forum_id, $topic_ids, $to_topic_id) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth; + global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request; if (!sizeof($topic_ids)) { @@ -374,18 +417,26 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) return; } - $topic_data = get_topic_data(array($to_topic_id), 'm_merge'); + $sync_topics = array_merge($topic_ids, array($to_topic_id)); - if (!sizeof($topic_data)) + $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); + + if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; } + $sync_forums = array(); + foreach ($topic_data as $data) + { + $sync_forums[$data['forum_id']] = $data['forum_id']; + } + $topic_data = $topic_data[$to_topic_id]; - $post_id_list = request_var('post_id_list', array(0)); - $start = request_var('start', 0); + $post_id_list = $request->variable('post_id_list', array(0)); + $start = $request->variable('start', 0); if (!sizeof($post_id_list) && sizeof($topic_ids)) { @@ -408,12 +459,12 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) return; } - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) { return; } - $redirect = request_var('redirect', build_url(array('quickmod'))); + $redirect = $request->variable('redirect', build_url(array('quickmod'))); $s_hidden_fields = build_hidden_fields(array( 'i' => 'main', @@ -426,14 +477,19 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) 'redirect' => $redirect, 'topic_id_list' => $topic_ids) ); - $success_msg = $return_link = ''; + $return_link = ''; if (confirm_box(true)) { $to_forum_id = $topic_data['forum_id']; - move_posts($post_id_list, $to_topic_id); - add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']); + move_posts($post_id_list, $to_topic_id, false); + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $to_topic_id, + $topic_data['topic_title'] + )); // Message and return links $success_msg = 'POSTS_MERGED_SUCCESS'; @@ -449,9 +505,15 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) // Update the bookmarks table. phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id); + // Re-sync the topics and forums because the auto-sync was deactivated in the call of move_posts() + sync('topic_reported', 'topic_id', $sync_topics); + sync('topic_attachment', 'topic_id', $sync_topics); + sync('topic', 'topic_id', $sync_topics, true); + sync('forum', 'forum_id', $sync_forums, true, true); + // Link to the new topic $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); - $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); + $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); $redirect = reapply_sid($redirect); meta_refresh(3, $redirect); diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 44cab5d910..432b26ad11 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,8 +24,9 @@ if (!defined('IN_PHPBB')) */ function mcp_front_view($id, $mode, $action) { - global $phpEx, $phpbb_root_path, $config; + global $phpEx, $phpbb_root_path; global $template, $db, $user, $auth, $module; + global $phpbb_dispatcher, $request; // Latest 5 unapproved if ($module->loaded('queue')) @@ -30,16 +35,33 @@ function mcp_front_view($id, $mode, $action) $post_list = array(); $forum_names = array(); - $forum_id = request_var('f', 0); + $forum_id = $request->variable('f', 0); $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false); if (!empty($forum_list)) { - $sql = 'SELECT COUNT(post_id) AS total - FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND post_visibility = ' . ITEM_UNAPPROVED; + $sql_ary = array( + 'SELECT' => 'COUNT(post_id) AS total', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'WHERE' => $db->sql_in_set('p.forum_id', $forum_list) . ' + AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) + ); + + /** + * Allow altering the query to get the number of unapproved posts + * + * @event core.mcp_front_queue_unapproved_total_before + * @var int sql_ary Query to get the total number of unapproved posts + * @var array forum_list List of forums to look for unapproved posts + * @since 3.1.5-RC1 + */ + $vars = array('sql_ary', 'forum_list'); + extract($phpbb_dispatcher->trigger_event('core.mcp_front_queue_unapproved_total_before', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $total = (int) $db->sql_fetchfield('total'); $db->sql_freeresult($result); @@ -60,8 +82,8 @@ function mcp_front_view($id, $mode, $action) $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND post_visibility = ' . ITEM_UNAPPROVED . ' - ORDER BY post_time DESC'; + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . ' + ORDER BY post_time DESC, post_id DESC'; $result = $db->sql_query_limit($sql, 5); while ($row = $db->sql_fetchrow($result)) @@ -76,6 +98,19 @@ function mcp_front_view($id, $mode, $action) } } + /** + * Alter list of posts and total as required + * + * @event core.mcp_front_view_queue_postid_list_after + * @var int total Number of unapproved posts + * @var array post_list List of unapproved posts + * @var array forum_list List of forums that contain the posts + * @var array forum_names Associative array with forum_id as key and it's corresponding forum_name as value + * @since 3.1.0-RC3 + */ + $vars = array('total', 'post_list', 'forum_list', 'forum_names'); + extract($phpbb_dispatcher->trigger_event('core.mcp_front_view_queue_postid_list_after', compact($vars))); + if ($total) { $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.post_attachment, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id @@ -83,7 +118,7 @@ function mcp_front_view($id, $mode, $action) WHERE ' . $db->sql_in_set('p.post_id', $post_list) . ' AND t.topic_id = p.topic_id AND p.poster_id = u.user_id - ORDER BY p.post_time DESC'; + ORDER BY p.post_time DESC, p.post_id DESC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -139,6 +174,18 @@ function mcp_front_view($id, $mode, $action) AND r.pm_id = 0 AND r.report_closed = 0 AND ' . $db->sql_in_set('p.forum_id', $forum_list); + + /** + * Alter sql query to count the number of reported posts + * + * @event core.mcp_front_reports_count_query_before + * @var int sql The query string used to get the number of reports that exist + * @var array forum_list List of forums that contain the posts + * @since 3.1.5-RC1 + */ + $vars = array('sql', 'forum_list'); + extract($phpbb_dispatcher->trigger_event('core.mcp_front_reports_count_query_before', compact($vars))); + $result = $db->sql_query($sql); $total = (int) $db->sql_fetchfield('total'); $db->sql_freeresult($result); @@ -172,8 +219,20 @@ function mcp_front_view($id, $mode, $action) AND p.poster_id = u2.user_id AND ' . $db->sql_in_set('p.forum_id', $forum_list), - 'ORDER_BY' => 'p.post_time DESC', + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', ); + + /** + * Alter sql query to get latest reported posts + * + * @event core.mcp_front_reports_listing_query_before + * @var int sql_ary Associative array with the query to be executed + * @var array forum_list List of forums that contain the posts + * @since 3.1.0-RC3 + */ + $vars = array('sql_ary', 'forum_list'); + extract($phpbb_dispatcher->trigger_event('core.mcp_front_reports_listing_query_before', compact($vars))); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query_limit($sql, 5); @@ -204,6 +263,7 @@ function mcp_front_view($id, $mode, $action) 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', )); } + $db->sql_freeresult($result); } $template->assign_vars(array( @@ -214,7 +274,7 @@ function mcp_front_view($id, $mode, $action) } // Latest 5 reported PMs - if ($module->loaded('pm_reports') && $auth->acl_getf_global('m_report')) + if ($module->loaded('pm_reports') && $auth->acl_get('m_pm_report')) { $template->assign_var('S_SHOW_PM_REPORTS', true); $user->add_lang(array('ucp')); @@ -260,6 +320,7 @@ function mcp_front_view($id, $mode, $action) $pm_by_id[(int) $row['msg_id']] = $row; $pm_list[] = (int) $row['msg_id']; } + $db->sql_freeresult($result); $address_list = get_recipient_strings($pm_by_id); diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 7bcb0fc477..fca0412321 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * mcp_logs * Handling warning the users -* @package mcp */ class mcp_logs { @@ -32,12 +35,12 @@ class mcp_logs function main($id, $mode) { - global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx, $phpbb_container; + global $auth, $db, $user, $template, $request; + global $config, $phpbb_container, $phpbb_log; $user->add_lang('acp/common'); - $action = request_var('action', array('' => '')); + $action = $request->variable('action', array('' => '')); if (is_array($action)) { @@ -45,23 +48,24 @@ class mcp_logs } else { - $action = request_var('action', ''); + $action = $request->variable('action', ''); } // Set up general vars - $start = request_var('start', 0); + $start = $request->variable('start', 0); $deletemark = ($action == 'del_marked') ? true : false; $deleteall = ($action == 'del_all') ? true : false; - $marked = request_var('mark', array(0)); + $marked = $request->variable('mark', array(0)); // Sort keys - $sort_days = request_var('st', 0); - $sort_key = request_var('sk', 't'); - $sort_dir = request_var('sd', 'd'); + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); $this->tpl_name = 'mcp_logs'; $this->page_title = 'MCP_LOGS'; + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_'))); @@ -75,7 +79,7 @@ class mcp_logs break; case 'forum_logs': - $forum_id = request_var('f', 0); + $forum_id = $request->variable('f', 0); if (!in_array($forum_id, $forum_list)) { @@ -86,7 +90,7 @@ class mcp_logs break; case 'topic_logs': - $topic_id = request_var('t', 0); + $topic_id = $request->variable('t', 0); $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' @@ -111,27 +115,33 @@ class mcp_logs { if ($deletemark && sizeof($marked)) { - $sql = 'DELETE FROM ' . LOG_TABLE . ' - WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND ' . $db->sql_in_set('log_id', $marked); - $db->sql_query($sql); + $conditions = array( + 'forum_id' => array('IN' => $forum_list), + 'log_id' => array('IN' => $marked), + ); - add_log('admin', 'LOG_CLEAR_MOD'); + $phpbb_log->delete('mod', $conditions); } else if ($deleteall) { - $sql = 'DELETE FROM ' . LOG_TABLE . ' - WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list); + $keywords = $request->variable('keywords', '', true); + + $conditions = array( + 'forum_id' => array('IN' => $forum_list), + 'keywords' => $keywords, + ); + + if ($sort_days) + { + $conditions['log_time'] = array('>=', time() - ($sort_days * 86400)); + } if ($mode == 'topic_logs') { - $sql .= ' AND topic_id = ' . $topic_id; + $conditions['topic_id'] = $topic_id; } - $db->sql_query($sql); - add_log('admin', 'LOG_CLEAR_MOD'); + $phpbb_log->delete('mod', $conditions); } } else @@ -148,7 +158,7 @@ class mcp_logs 'sd' => $sort_dir, 'i' => $id, 'mode' => $mode, - 'action' => request_var('action', array('' => '')))) + 'action' => $request->variable('action', array('' => '')))) ); } } @@ -165,7 +175,7 @@ class mcp_logs $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); + $keywords = $request->variable('keywords', '', true); $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; // Grab log data @@ -195,7 +205,7 @@ class mcp_logs { $data = array(); - $checks = array('viewtopic', 'viewforum'); + $checks = array('viewpost', 'viewtopic', 'viewforum'); foreach ($checks as $check) { if (isset($row[$check]) && $row[$check]) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 016094c5d4..9702056d7b 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * mcp_main * Handling mcp actions -* @package mcp */ class mcp_main { @@ -32,8 +35,8 @@ class mcp_main function main($id, $mode) { - global $auth, $db, $user, $template, $action; - global $config, $phpbb_root_path, $phpEx, $request; + global $auth, $user, $action; + global $phpbb_root_path, $phpEx, $request; global $phpbb_dispatcher; $quickmod = ($mode == 'quickmod') ? true : false; @@ -42,7 +45,7 @@ class mcp_main { case 'lock': case 'unlock': - $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); if (!sizeof($topic_ids)) { @@ -55,7 +58,7 @@ class mcp_main case 'lock_post': case 'unlock_post': - $post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0)); + $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); if (!sizeof($post_ids)) { @@ -70,7 +73,7 @@ class mcp_main case 'make_global': case 'make_normal': - $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); if (!sizeof($topic_ids)) { @@ -83,7 +86,7 @@ class mcp_main case 'move': $user->add_lang('viewtopic'); - $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); if (!sizeof($topic_ids)) { @@ -96,7 +99,7 @@ class mcp_main case 'fork': $user->add_lang('viewtopic'); - $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); if (!sizeof($topic_ids)) { @@ -120,7 +123,7 @@ class mcp_main trigger_error('NO_TOPIC_SELECTED'); } - mcp_delete_topic($topic_ids, $soft_delete, ($soft_delete) ? $request->variable('delete_reason', '', true) : ''); + mcp_delete_topic($topic_ids, $soft_delete, $request->variable('delete_reason', '', true)); break; case 'delete_post': @@ -137,7 +140,7 @@ class mcp_main trigger_error('NO_POST_SELECTED'); } - mcp_delete_post($post_ids, $soft_delete, ($soft_delete) ? $request->variable('delete_reason', '', true) : ''); + mcp_delete_post($post_ids, $soft_delete, $request->variable('delete_reason', '', true)); break; case 'restore_topic': @@ -158,9 +161,13 @@ class mcp_main * This event allows you to handle custom quickmod options * * @event core.modify_quickmod_actions + * @var string action Topic quick moderation action name + * @var bool quickmod Flag indicating whether MCP is in quick moderation mode * @since 3.1.0-a4 + * @change 3.1.0-RC4 Added variables: action, quickmod */ - $phpbb_dispatcher->dispatch('core.modify_quickmod_actions'); + $vars = array('action', 'quickmod'); + extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars))); break; } @@ -182,9 +189,9 @@ class mcp_main $user->add_lang('viewforum'); - $forum_id = request_var('f', 0); + $forum_id = $request->variable('f', 0); - $forum_info = get_forum_data($forum_id, 'm_', true); + $forum_info = phpbb_get_forum_data($forum_id, 'm_', true); if (!sizeof($forum_info)) { @@ -219,6 +226,31 @@ class mcp_main break; default: + if ($quickmod) + { + switch ($action) + { + case 'lock': + case 'unlock': + case 'make_announce': + case 'make_sticky': + case 'make_global': + case 'make_normal': + case 'make_onindex': + case 'move': + case 'fork': + case 'delete_topic': + trigger_error('TOPIC_NOT_EXIST'); + break; + + case 'lock_post': + case 'unlock_post': + case 'delete_post': + trigger_error('POST_NOT_EXIST'); + break; + } + } + trigger_error('NO_MODE', E_USER_ERROR); break; } @@ -230,7 +262,7 @@ class mcp_main */ function lock_unlock($action, $ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path, $request; + global $user, $db, $request, $phpbb_log, $phpbb_dispatcher; if ($action == 'lock' || $action == 'unlock') { @@ -249,7 +281,7 @@ function lock_unlock($action, $ids) $orig_ids = $ids; - if (!check_ids($ids, $table, $sql_id, array('m_lock'))) + if (!phpbb_check_ids($ids, $table, $sql_id, array('m_lock'))) { // Make sure that for f_user_lock only the lock action is triggered. if ($action != 'lock') @@ -259,14 +291,14 @@ function lock_unlock($action, $ids) $ids = $orig_ids; - if (!check_ids($ids, $table, $sql_id, array('f_user_lock'))) + if (!phpbb_check_ids($ids, $table, $sql_id, array('f_user_lock'))) { return; } } unset($orig_ids); - $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); $redirect = reapply_sid($redirect); $s_hidden_fields = build_hidden_fields(array( @@ -274,7 +306,6 @@ function lock_unlock($action, $ids) 'action' => $action, 'redirect' => $redirect) ); - $success_msg = ''; if (confirm_box(true)) { @@ -283,13 +314,34 @@ function lock_unlock($action, $ids) WHERE ' . $db->sql_in_set($sql_id, $ids); $db->sql_query($sql); - $data = ($action == 'lock' || $action == 'unlock') ? get_topic_data($ids) : get_post_data($ids); + $data = ($action == 'lock' || $action == 'unlock') ? phpbb_get_topic_data($ids) : phpbb_get_post_data($ids); foreach ($data as $id => $row) { - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($action), false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => isset($row['post_id']) ? $row['post_id'] : 0, + $row['topic_title'] + )); } + /** + * Perform additional actions after locking/unlocking posts/topics + * + * @event core.mcp_lock_unlock_after + * @var string action Variable containing the action we perform on the posts/topics ('lock', 'unlock', 'lock_post' or 'unlock_post') + * @var array ids Array containing the post/topic IDs that have been locked/unlocked + * @var array data Array containing posts/topics data + * @since 3.1.7-RC1 + */ + $vars = array( + 'action', + 'ids', + 'data', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars))); + $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; meta_refresh(2, $redirect); @@ -314,7 +366,7 @@ function lock_unlock($action, $ids) */ function change_topic_type($action, $topic_ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path, $request; + global $user, $db, $request, $phpbb_log; switch ($action) { @@ -326,7 +378,7 @@ function change_topic_type($action, $topic_ids) case 'make_global': $new_topic_type = POST_GLOBAL; - $check_acl = 'f_announce'; + $check_acl = 'f_announce_global'; $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; break; @@ -343,14 +395,14 @@ function change_topic_type($action, $topic_ids) break; } - $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_acl, true); + $forum_id = phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_acl, true); if ($forum_id === false) { return; } - $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); $redirect = reapply_sid($redirect); $s_hidden_fields = array( @@ -359,7 +411,6 @@ function change_topic_type($action, $topic_ids) 'action' => $action, 'redirect' => $redirect, ); - $success_msg = ''; if (confirm_box(true)) { @@ -385,11 +436,15 @@ function change_topic_type($action, $topic_ids) if (sizeof($topic_ids)) { - $data = get_topic_data($topic_ids); + $data = phpbb_get_topic_data($topic_ids); foreach ($data as $topic_id => $row) { - add_log('mod', $forum_id, $topic_id, 'LOG_TOPIC_TYPE_CHANGED', $row['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_TYPE_CHANGED', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $row['topic_title'] + )); } } @@ -415,20 +470,19 @@ function change_topic_type($action, $topic_ids) */ function mcp_move_topic($topic_ids) { - global $auth, $user, $db, $template; + global $auth, $user, $db, $template, $phpbb_log, $request; global $phpEx, $phpbb_root_path; - global $request; // Here we limit the operation to one forum only - $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true); + $forum_id = phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true); if ($forum_id === false) { return; } - $to_forum_id = request_var('to_forum_id', 0); - $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $to_forum_id = $request->variable('to_forum_id', 0); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); $additional_msg = $success_msg = ''; $s_hidden_fields = build_hidden_fields(array( @@ -440,7 +494,7 @@ function mcp_move_topic($topic_ids) if ($to_forum_id) { - $forum_data = get_forum_data($to_forum_id, 'f_post'); + $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); if (!sizeof($forum_data)) { @@ -477,7 +531,7 @@ function mcp_move_topic($topic_ids) if (confirm_box(true)) { - $topic_data = get_topic_data($topic_ids); + $topic_data = phpbb_get_topic_data($topic_ids); $leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false; $forum_sync_data = array(); @@ -494,11 +548,11 @@ function mcp_move_topic($topic_ids) { $topics_moved++; } - elseif ($topic_info['topic_visibility'] == ITEM_UNAPPROVED) + else if ($topic_info['topic_visibility'] == ITEM_UNAPPROVED || $topic_info['topic_visibility'] == ITEM_REAPPROVE) { $topics_moved_unapproved++; } - elseif ($topic_info['topic_visibility'] == ITEM_DELETED) + else if ($topic_info['topic_visibility'] == ITEM_DELETED) { $topics_moved_softdeleted++; } @@ -525,9 +579,19 @@ function mcp_move_topic($topic_ids) $forum_ids = array($to_forum_id); foreach ($topic_data as $topic_id => $row) { - // Get the list of forums to resync, add a log entry + // Get the list of forums to resync $forum_ids[] = $row['forum_id']; - add_log('mod', $to_forum_id, $topic_id, 'LOG_MOVE', $row['forum_name'], $forum_data['forum_name']); + + // We add the $to_forum_id twice, because 'forum_id' is updated + // when the topic is moved again later. + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MOVE', false, array( + 'forum_id' => (int) $to_forum_id, + 'topic_id' => (int) $topic_id, + $row['forum_name'], + $forum_data['forum_name'], + (int) $row['forum_id'], + (int) $forum_data['forum_id'], + )); // Leave a redirection if required and only if the topic is visible to users if ($leave_shadow && $row['topic_visibility'] == ITEM_APPROVED && $row['topic_type'] != POST_GLOBAL) @@ -555,7 +619,7 @@ function mcp_move_topic($topic_ids) 'topic_last_poster_id' => (int) $row['topic_last_poster_id'], 'topic_last_poster_colour'=>(string) $row['topic_last_poster_colour'], 'topic_last_poster_name'=> (string) $row['topic_last_poster_name'], - 'topic_last_post_subject'=> (string) $row['topic_last_post_subject'], + 'topic_last_post_subject'=> (string) $row['topic_last_post_subject'], 'topic_last_post_time' => (int) $row['topic_last_post_time'], 'topic_last_view_time' => (int) $row['topic_last_view_time'], 'topic_moved_id' => (int) $row['topic_id'], @@ -638,7 +702,7 @@ function mcp_move_topic($topic_ids) confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); if (!$success_msg) @@ -663,9 +727,9 @@ function mcp_move_topic($topic_ids) */ function mcp_restore_topic($topic_ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; + global $user, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve'))) + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve'))) { return; } @@ -685,15 +749,21 @@ function mcp_restore_topic($topic_ids) { $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS'; - $data = get_topic_data($topic_ids); + $data = phpbb_get_topic_data($topic_ids); + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); foreach ($data as $topic_id => $row) { $return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), ''); if (!empty($return)) { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_RESTORE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_RESTORE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'] + )); } } } @@ -736,9 +806,10 @@ function mcp_restore_topic($topic_ids) */ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic') { - global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete'))) + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission))) { return; } @@ -758,36 +829,53 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' { $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS'; - $data = get_topic_data($topic_ids); + $data = phpbb_get_topic_data($topic_ids); foreach ($data as $topic_id => $row) { if ($row['topic_moved_id']) { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_SHADOW_TOPIC', $row['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_SHADOW_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'] + )); } else { // Only soft delete non-shadow topics if ($is_soft) { + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); $return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason); if (!empty($return)) { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'], + $soft_delete_reason + )); } } else { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'], + $soft_delete_reason + )); } } } if (!$is_soft) { - $return = delete_topics('topic_id', $topic_ids); + delete_topics('topic_id', $topic_ids); } } else @@ -796,8 +884,17 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' $user->add_lang('posting'); + // If there are only shadow topics, we neither need a reason nor softdelete + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND topic_moved_id = 0'; + $result = $db->sql_query_limit($sql, 1); + $only_shadow = !$db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); + $only_softdeleted = false; - if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) + if (!$only_shadow && $auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) { // If there are only soft deleted topics, we display a message why the option is not available $sql = 'SELECT topic_id @@ -810,11 +907,11 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' } $template->assign_vars(array( + 'S_SHADOW_TOPICS' => $only_shadow, 'S_SOFTDELETED' => $only_softdeleted, 'S_TOPIC_MODE' => true, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id), )); $l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; @@ -823,7 +920,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' $l_confirm .= '_PERMANENTLY'; $s_hidden_fields['delete_permanent'] = '1'; } - else if (!$auth->acl_get('m_softdelete', $forum_id)) + else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id)) { $s_hidden_fields['delete_permanent'] = '1'; } @@ -865,9 +962,10 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' */ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post') { - global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; - if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_softdelete'))) + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array($check_permission))) { return; } @@ -885,7 +983,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', if (confirm_box(true) && $is_soft) { - $post_info = get_post_data($post_ids); + $post_info = phpbb_get_post_data($post_ids); $topic_info = $approve_log = array(); @@ -921,6 +1019,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', ); } + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); foreach ($topic_info as $topic_id => $topic_data) { @@ -935,7 +1034,14 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', foreach ($approve_log as $row) { $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_POST', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $row['post_id'], + $row['post_subject'], + $post_username, + $soft_delete_reason + )); } $topic_id = $request->variable('t', 0); @@ -973,12 +1079,19 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $affected_topics = sizeof($topic_id_list); $db->sql_freeresult($result); - $post_data = get_post_data($post_ids); + $post_data = phpbb_get_post_data($post_ids); foreach ($post_data as $id => $row) { $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $row['post_id'], + $row['post_subject'], + $post_username, + $soft_delete_reason + )); } // Now delete the posts, topics and forums are automatically resync'ed @@ -1051,7 +1164,6 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', 'S_SOFTDELETED' => $only_softdeleted, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id), )); $l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS'; @@ -1093,17 +1205,18 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', function mcp_fork_topic($topic_ids) { global $auth, $user, $db, $template, $config; - global $phpEx, $phpbb_root_path; + global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) { return; } - $to_forum_id = request_var('to_forum_id', 0); - $forum_id = request_var('f', 0); - $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $to_forum_id = $request->variable('to_forum_id', 0); + $forum_id = $request->variable('f', 0); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); $additional_msg = $success_msg = ''; + $counter = array(); $s_hidden_fields = build_hidden_fields(array( 'topic_id_list' => $topic_ids, @@ -1114,7 +1227,7 @@ function mcp_fork_topic($topic_ids) if ($to_forum_id) { - $forum_data = get_forum_data($to_forum_id, 'f_post'); + $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); if (!sizeof($topic_ids)) { @@ -1151,7 +1264,7 @@ function mcp_fork_topic($topic_ids) if (confirm_box(true)) { - $topic_data = get_topic_data($topic_ids, 'f_post'); + $topic_data = phpbb_get_topic_data($topic_ids, 'f_post'); $total_topics = $total_topics_unapproved = $total_topics_softdeleted = 0; $total_posts = $total_posts_unapproved = $total_posts_softdeleted = 0; @@ -1170,7 +1283,7 @@ function mcp_fork_topic($topic_ids) } $error = false; - $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); $search_mode = 'post'; if ($error) @@ -1221,6 +1334,7 @@ function mcp_fork_topic($topic_ids) $total_topics++; break; case ITEM_UNAPPROVED: + case ITEM_REAPPROVE: $total_topics_unapproved++; break; case ITEM_DELETED: @@ -1230,8 +1344,6 @@ function mcp_fork_topic($topic_ids) if ($topic_row['poll_start']) { - $poll_rows = array(); - $sql = 'SELECT * FROM ' . POLL_OPTIONS_TABLE . " WHERE topic_id = $topic_id"; @@ -1248,12 +1360,13 @@ function mcp_fork_topic($topic_ids) $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); } + $db->sql_freeresult($result); } $sql = 'SELECT * FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id - ORDER BY post_time ASC"; + ORDER BY post_time ASC, post_id ASC"; $result = $db->sql_query($sql); $post_rows = array(); @@ -1295,9 +1408,20 @@ function mcp_fork_topic($topic_ids) 'post_edit_time' => (int) $row['post_edit_time'], 'post_edit_count' => (int) $row['post_edit_count'], 'post_edit_locked' => (int) $row['post_edit_locked'], - 'post_postcount' => 0, + 'post_postcount' => $row['post_postcount'], ); - + // Adjust post count only if the post can be incremented to the user counter + if ($row['post_postcount']) + { + if (isset($counter[$row['poster_id']])) + { + ++$counter[$row['poster_id']]; + } + else + { + $counter[$row['poster_id']] = 1; + } + } $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_post_id = $db->sql_nextid(); @@ -1307,6 +1431,7 @@ function mcp_fork_topic($topic_ids) $total_posts++; break; case ITEM_UNAPPROVED: + case ITEM_REAPPROVE: $total_posts_unapproved++; break; case ITEM_DELETED: @@ -1416,15 +1541,31 @@ function mcp_fork_topic($topic_ids) WHERE forum_id = ' . $to_forum_id; $db->sql_query($sql); + if (!empty($counter)) + { + // Do only one query per user and not a query per post. + foreach ($counter as $user_id => $count) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts + ' . (int) $count . ' + WHERE user_id = ' . (int) $user_id; + $db->sql_query($sql); + } + } + sync('topic', 'topic_id', $new_topic_id_list); sync('forum', 'forum_id', $to_forum_id); - set_config_count('num_topics', sizeof($new_topic_id_list), true); - set_config_count('num_posts', $total_posts, true); + $config->increment('num_topics', sizeof($new_topic_id_list), false); + $config->increment('num_posts', $total_posts, false); foreach ($new_topic_id_list as $topic_id => $new_topic_id) { - add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $topic_row['forum_name']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $new_topic_id, + $topic_row['forum_name'] + )); } $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS'; @@ -1440,7 +1581,7 @@ function mcp_fork_topic($topic_ids) confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); if (!$success_msg) diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 28de8724be..67f59bd618 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * mcp_notes * Displays notes about a user -* @package mcp */ class mcp_notes { @@ -32,10 +35,10 @@ class mcp_notes function main($id, $mode) { - global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx; + global $user, $template, $request; + global $phpbb_root_path, $phpEx; - $action = request_var('action', array('' => '')); + $action = $request->variable('action', array('' => '')); if (is_array($action)) { @@ -71,15 +74,17 @@ class mcp_notes */ function mcp_notes_user_view($action) { - global $phpEx, $phpbb_root_path, $config; + global $config, $phpbb_log, $request; global $template, $db, $user, $auth, $phpbb_container; - $user_id = request_var('u', 0); - $username = request_var('username', '', true); - $start = request_var('start', 0); - $st = request_var('st', 0); - $sk = request_var('sk', 'b'); - $sd = request_var('sd', 'd'); + $user_id = $request->variable('u', 0); + $username = $request->variable('username', '', true); + $start = $request->variable('start', 0); + $st = $request->variable('st', 0); + $sk = $request->variable('sk', 'b'); + $sd = $request->variable('sd', 'd'); + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); add_form_key('mcp_notes'); @@ -111,8 +116,8 @@ class mcp_notes $deletemark = ($action == 'del_marked') ? true : false; $deleteall = ($action == 'del_all') ? true : false; - $marked = request_var('marknote', array(0)); - $usernote = utf8_normalize_nfc(request_var('usernote', '', true)); + $marked = $request->variable('marknote', array(0)); + $usernote = $request->variable('usernote', '', true); // Handle any actions if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) @@ -139,7 +144,7 @@ class mcp_notes $where_sql"; $db->sql_query($sql); - add_log('admin', 'LOG_CLEAR_USER', $userrow['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($userrow['username'])); $msg = ($deletemark) ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED'; } @@ -157,10 +162,17 @@ class mcp_notes { if (check_form_key('mcp_notes')) { - add_log('admin', 'LOG_USER_FEEDBACK', $userrow['username']); - add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $userrow['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($userrow['username'])); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $userrow['username'] + )); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array( + 'reportee_id' => $user_id, + $usernote + )); - add_log('user', $user_id, 'LOG_USER_GENERAL', $usernote); $msg = $user->lang['USER_FEEDBACK_ADDED']; } else @@ -174,10 +186,6 @@ class mcp_notes } // Generate the appropriate user information for the user we are looking at - if (!function_exists('phpbb_get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - } $rank_title = $rank_img = ''; $avatar_img = phpbb_get_user_avatar($userrow); @@ -193,7 +201,7 @@ class mcp_notes $sql_where = ($st) ? (time() - ($st * 86400)) : 0; $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); - $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); + $keywords = $request->variable('keywords', '', true); $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; $log_data = array(); diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 008984b1c3..67a1a959e4 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * mcp_reports * Handling the reports queue -* @package mcp */ class mcp_pm_reports { @@ -32,14 +35,15 @@ class mcp_pm_reports function main($id, $mode) { - global $auth, $db, $user, $template, $cache; + global $auth, $db, $user, $template, $request; global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); - $start = request_var('start', 0); + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); + $start = $request->variable('start', 0); $this->page_title = 'MCP_PM_REPORTS'; @@ -49,7 +53,7 @@ class mcp_pm_reports case 'delete': include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - $report_id_list = request_var('report_id_list', array(0)); + $report_id_list = $request->variable('report_id_list', array(0)); if (!sizeof($report_id_list)) { @@ -72,7 +76,7 @@ class mcp_pm_reports $user->add_lang(array('posting', 'viewforum', 'viewtopic', 'ucp')); - $report_id = request_var('r', 0); + $report_id = $request->variable('r', 0); $sql = 'SELECT r.pm_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 FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u @@ -90,14 +94,15 @@ class mcp_pm_reports trigger_error('NO_REPORT'); } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->mark_notifications_read_by_parent('report_pm', $report_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications_by_parent('report_pm', $report_id, $user->data['user_id']); $pm_id = $report['pm_id']; $report_id = $report['report_id']; - $pm_info = get_pm_data(array($pm_id)); + $pm_info = phpbb_get_pm_data(array($pm_id)); if (!sizeof($pm_info)) { @@ -170,7 +175,7 @@ class mcp_pm_reports 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $pm_info['author_id']), 'U_MCP_WARN_REPORTER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $pm_info['author_id']) : '', - + 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'), @@ -196,7 +201,7 @@ class mcp_pm_reports 'POST_SUBJECT' => ($pm_info['message_subject']) ? $pm_info['message_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($pm_info['message_time']), 'POST_IP' => $pm_info['author_ip'], - 'POST_IPADDR' => ($auth->acl_getf_global('m_info') && request_var('lookup', '')) ? @gethostbyaddr($pm_info['author_ip']) : '', + 'POST_IPADDR' => ($auth->acl_getf_global('m_info') && $request->variable('lookup', '')) ? @gethostbyaddr($pm_info['author_ip']) : '', 'POST_ID' => $pm_info['msg_id'], 'U_LOOKUP_IP' => ($auth->acl_getf_global('m_info')) ? $this->u_action . '&r=' . $report_id . '&pm=' . $pm_id . '&lookup=' . $pm_info['author_ip'] . '#ip' : '', @@ -213,7 +218,7 @@ class mcp_pm_reports $sort_days = $total = 0; $sort_key = $sort_dir = ''; $sort_by_sql = $sort_order_sql = array(); - mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total); + phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total); $limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -304,7 +309,7 @@ class mcp_pm_reports $template->assign_vars(array( 'L_EXPLAIN' => ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_PM_REPORTS_CLOSED_EXPLAIN'], 'L_TITLE' => ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN'] : $user->lang['MCP_PM_REPORTS_CLOSED'], - + 'S_PM' => true, 'S_MCP_ACTION' => $this->u_action, 'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false, diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 06f27655ae..7fa6ef4fff 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,16 +24,17 @@ if (!defined('IN_PHPBB')) */ function mcp_post_details($id, $mode, $action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth, $cache; + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $auth; + global $phpbb_dispatcher; $user->add_lang('posting'); - $post_id = request_var('p', 0); - $start = request_var('start', 0); + $post_id = $request->variable('p', 0); + $start = $request->variable('start', 0); // Get post data - $post_info = get_post_data(array($post_id), false, true); + $post_info = phpbb_get_post_data(array($post_id), false, true); add_form_key('mcp_post_details'); @@ -39,7 +44,7 @@ function mcp_post_details($id, $mode, $action) } $post_info = $post_info[$post_id]; - $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url()); + $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url()); switch ($action) { @@ -47,7 +52,7 @@ function mcp_post_details($id, $mode, $action) if ($auth->acl_get('m_info', $post_info['forum_id'])) { - $ip = request_var('ip', ''); + $ip = $request->variable('ip', ''); include($phpbb_root_path . 'includes/functions_user.' . $phpEx); $template->assign_vars(array( @@ -68,12 +73,12 @@ function mcp_post_details($id, $mode, $action) if ($action == 'chgposter') { - $username = request_var('username', '', true); + $username = $request->variable('username', '', true); $sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; } else { - $new_user_id = request_var('u', 0); + $new_user_id = $request->variable('u', 0); $sql_where = 'user_id = ' . $new_user_id; } @@ -102,13 +107,27 @@ function mcp_post_details($id, $mode, $action) } break; + + default: + + /** + * This event allows you to handle custom post moderation options + * + * @event core.mcp_post_additional_options + * @var string action Post moderation action name + * @var array post_info Information on the affected post + * @since 3.1.5-RC1 + */ + $vars = array('action', 'post_info'); + extract($phpbb_dispatcher->trigger_event('core.mcp_post_additional_options', compact($vars))); + + break; } // Set some vars $users_ary = $usernames_ary = array(); $attachments = $extensions = array(); $post_id = $post_info['post_id']; - $topic_tracking_info = array(); // Get topic tracking info if ($config['load_db_lastread']) @@ -130,8 +149,6 @@ function mcp_post_details($id, $mode, $action) if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { - $extensions = $cache->obtain_attach_extensions($post_info['forum_id']); - $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' WHERE post_msg_id = ' . $post_id . ' @@ -147,6 +164,7 @@ function mcp_post_details($id, $mode, $action) if (sizeof($attachments)) { + $user->add_lang('viewtopic'); $update_count = array(); parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); } @@ -192,7 +210,7 @@ function mcp_post_details($id, $mode, $action) $l_deleted_by = ''; } - $template->assign_vars(array( + $mcp_post_template_data = array( 'U_MCP_ACTION' => "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"), @@ -203,7 +221,7 @@ function mcp_post_details($id, $mode, $action) 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']), 'S_POST_REPORTED' => ($post_info['post_reported']) ? true : false, - 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED) ? true : false, + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE) ? true : false, 'S_POST_DELETED' => ($post_info['post_visibility'] == ITEM_DELETED) ? true : false, 'S_POST_LOCKED' => ($post_info['post_edit_locked']) ? true : false, 'S_USER_NOTES' => true, @@ -239,12 +257,37 @@ function mcp_post_details($id, $mode, $action) 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], - 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', + 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '', 'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '', - )); + ); + + $s_additional_opts = false; + + /** + * Event to add/modify MCP post template data + * + * @event core.mcp_post_template_data + * @var array post_info Array with the post information + * @var array mcp_post_template_data Array with the MCP post template data + * @var array attachments Array with the post attachments, if any + * @var bool s_additional_opts Must be set to true in extension if additional options are presented in MCP post panel + * @since 3.1.5-RC1 + */ + $vars = array( + 'post_info', + 'mcp_post_template_data', + 'attachments', + 's_additional_opts', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_post_template_data', compact($vars))); + + $template->assign_vars($mcp_post_template_data); + $template->assign_var('S_MCP_POST_ADDITIONAL_OPTS', $s_additional_opts); + + unset($mcp_post_template_data); // Get User Notes $log_data = array(); @@ -294,8 +337,8 @@ function mcp_post_details($id, $mode, $action) 'REPORT_ID' => $row['report_id'], 'REASON_TITLE' => $row['reason_title'], 'REASON_DESC' => $row['reason_description'], - 'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'], - 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) : '', + 'REPORTER' => get_username_string('username', $row['user_id'], $row['username']), + 'U_REPORTER' => get_username_string('profile', $row['user_id'], $row['username']), 'USER_NOTIFY' => ($row['user_notify']) ? true : false, 'REPORT_TIME' => $user->format_date($row['report_time']), 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])), @@ -309,7 +352,7 @@ function mcp_post_details($id, $mode, $action) // Get IP if ($auth->acl_get('m_info', $post_info['forum_id'])) { - $rdns_ip_num = request_var('rdns', ''); + $rdns_ip_num = $request->variable('rdns', ''); if ($rdns_ip_num != 'all') { @@ -354,11 +397,11 @@ function mcp_post_details($id, $mode, $action) foreach ($users_ary as $user_id => $user_row) { $template->assign_block_vars('userrow', array( - 'USERNAME' => ($user_id == ANONYMOUS) ? $user->lang['GUEST'] : $user_row['username'], + 'USERNAME' => get_username_string('username', $user_id, $user_row['username']), 'NUM_POSTS' => $user_row['postings'], 'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], - 'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id), + 'U_PROFILE' => get_username_string('profile', $user_id, $user_row['username']), 'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user_id . '&sr=topics')) ); } @@ -415,7 +458,7 @@ function mcp_post_details($id, $mode, $action) */ function change_poster(&$post_info, $userdata) { - global $auth, $db, $config, $phpbb_root_path, $phpEx, $user; + global $auth, $db, $config, $phpbb_root_path, $phpEx, $user, $phpbb_log, $phpbb_dispatcher; if (empty($userdata) || $userdata['user_id'] == $post_info['user_id']) { @@ -492,7 +535,7 @@ function change_poster(&$post_info, $userdata) { // We do some additional checks in the module to ensure it can actually be utilised $error = false; - $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); if (!$error && method_exists($search, 'destroy_cache')) { @@ -503,8 +546,20 @@ function change_poster(&$post_info, $userdata) $from_username = $post_info['username']; $to_username = $userdata['username']; + /** + * This event allows you to perform additional tasks after changing a post's poster + * + * @event core.mcp_change_poster_after + * @var array userdata Information on a post's new poster + * @var array post_info Information on the affected post + * @since 3.1.6-RC1 + * @changed 3.1.7-RC1 Change location to prevent post_info from being set to the new post information + */ + $vars = array('userdata', 'post_info'); + extract($phpbb_dispatcher->trigger_event('core.mcp_change_poster_after', compact($vars))); + // Renew post info - $post_info = get_post_data(array($post_id), false, true); + $post_info = phpbb_get_post_data(array($post_id), false, true); if (!sizeof($post_info)) { @@ -514,5 +569,12 @@ function change_poster(&$post_info, $userdata) $post_info = $post_info[$post_id]; // Now add log entry - add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MCP_CHANGE_POSTER', false, array( + 'forum_id' => $post_info['forum_id'], + 'topic_id' => $post_info['topic_id'], + 'post_id' => $post_info['post_id'], + $post_info['topic_title'], + $from_username, + $to_username + )); } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index a46c4bd499..bf93593c74 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * mcp_queue * Handling the moderation queue -* @package mcp */ class mcp_queue { @@ -32,13 +35,14 @@ class mcp_queue public function main($id, $mode) { - global $auth, $db, $user, $template, $cache, $request; + global $auth, $db, $user, $template, $request; global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container; + global $phpbb_dispatcher; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - $forum_id = request_var('f', 0); - $start = request_var('start', 0); + $forum_id = $request->variable('f', 0); + $start = $request->variable('start', 0); $this->page_title = 'MCP_QUEUE'; @@ -68,6 +72,7 @@ class mcp_queue case 'delete': $post_id_list = $request->variable('post_id_list', array(0)); $topic_id_list = $request->variable('topic_id_list', array(0)); + $delete_reason = $request->variable('delete_reason', '', true); if (!empty($post_id_list)) { @@ -76,7 +81,7 @@ class mcp_queue global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx); } - mcp_delete_post($post_id_list, false, '', $action); + mcp_delete_post($post_id_list, false, $delete_reason, $action); } else if (!empty($topic_id_list)) { @@ -85,7 +90,7 @@ class mcp_queue global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx); } - mcp_delete_topic($topic_id_list, false, '', $action); + mcp_delete_topic($topic_id_list, false, $delete_reason, $action); } else { @@ -115,10 +120,10 @@ class mcp_queue if (!empty($topic_id_list)) { - $post_visibility = ($mode == 'deleted_topics') ? ITEM_DELETED : ITEM_UNAPPROVED; + $post_visibility = ($mode == 'deleted_topics') ? ITEM_DELETED : array(ITEM_UNAPPROVED, ITEM_REAPPROVE); $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' - WHERE post_visibility = ' . $post_visibility . ' + WHERE ' . $db->sql_in_set('post_visibility', $post_visibility) . ' AND ' . $db->sql_in_set('topic_id', $topic_id_list); $result = $db->sql_query($sql); @@ -149,19 +154,20 @@ class mcp_queue $user->add_lang(array('posting', 'viewtopic')); - $post_id = request_var('p', 0); - $topic_id = request_var('t', 0); + $post_id = $request->variable('p', 0); + $topic_id = $request->variable('t', 0); + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); if ($topic_id) { - $topic_info = get_topic_data(array($topic_id), 'm_approve'); + $topic_info = phpbb_get_topic_data(array($topic_id), 'm_approve'); if (isset($topic_info[$topic_id]['topic_first_post_id'])) { $post_id = (int) $topic_info[$topic_id]['topic_first_post_id']; - $phpbb_notifications->mark_notifications_read('topic_in_queue', $topic_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications('topic_in_queue', $topic_id, $user->data['user_id']); } else { @@ -169,9 +175,9 @@ class mcp_queue } } - $phpbb_notifications->mark_notifications_read('post_in_queue', $post_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications('post_in_queue', $post_id, $user->data['user_id']); - $post_info = get_post_data(array($post_id), 'm_approve', true); + $post_info = phpbb_get_post_data(array($post_id), 'm_approve', true); if (!sizeof($post_info)) { @@ -189,7 +195,7 @@ class mcp_queue )); } - $extensions = $attachments = $topic_tracking_info = array(); + $attachments = $topic_tracking_info = array(); // Get topic tracking info if ($config['load_db_lastread']) @@ -211,8 +217,6 @@ class mcp_queue if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { - $extensions = $cache->obtain_attach_extensions($post_info['forum_id']); - $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' WHERE post_msg_id = ' . $post_id . ' @@ -279,9 +283,10 @@ class mcp_queue $template->assign_vars(array( 'S_MCP_QUEUE' => true, 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"), + 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], - 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED), + 'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE, 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'S_POST_DELETED' => ($post_info['post_visibility'] == ITEM_DELETED), @@ -298,7 +303,6 @@ class mcp_queue 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), - 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . '&start=' . $start . '">', '</a>'), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), @@ -315,7 +319,7 @@ class mcp_queue 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], - 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', + 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id), @@ -331,17 +335,19 @@ class mcp_queue $m_perm = 'm_approve'; $is_topics = ($mode == 'unapproved_topics' || $mode == 'deleted_topics') ? true : false; $is_restore = ($mode == 'deleted_posts' || $mode == 'deleted_topics') ? true : false; - $visibility_const = (!$is_restore) ? ITEM_UNAPPROVED : ITEM_DELETED; + $visibility_const = (!$is_restore) ? array(ITEM_UNAPPROVED, ITEM_REAPPROVE) : ITEM_DELETED; $user->add_lang(array('viewtopic', 'viewforum')); $topic_id = $request->variable('t', 0); $forum_info = array(); + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); if ($topic_id) { - $topic_info = get_topic_data(array($topic_id)); + $topic_info = phpbb_get_topic_data(array($topic_id)); if (!sizeof($topic_info)) { @@ -387,29 +393,27 @@ class mcp_queue } else { - $forum_info = get_forum_data(array($forum_id), $m_perm); + $forum_info = phpbb_get_forum_data(array($forum_id), $m_perm); if (!sizeof($forum_info)) { trigger_error('NOT_MODERATOR'); } - $forum_info = $forum_info[$forum_id]; $forum_list = $forum_id; } $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>'; foreach ($forum_list_approve as $row) { - $forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . $row['forum_name'] . '</option>'; + $forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . truncate_string($row['forum_name'], 30, 255, false, $user->lang['ELLIPSIS']) . '</option>'; } $sort_days = $total = 0; $sort_key = $sort_dir = ''; $sort_by_sql = $sort_order_sql = array(); - mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); + phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); - $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total; $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; $forum_names = array(); @@ -419,7 +423,7 @@ class mcp_queue $sql = 'SELECT p.post_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . ' WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . ' - AND p.post_visibility = ' . $visibility_const . ' + AND ' . $db->sql_in_set('p.post_visibility', $visibility_const) . ' ' . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . ' ' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . " AND t.topic_id = p.topic_id @@ -427,6 +431,29 @@ class mcp_queue OR t.topic_delete_user = 0) $limit_time_sql ORDER BY $sort_order_sql"; + + /** + * Alter sql query to get posts in queue to be accepted + * + * @event core.mcp_queue_get_posts_query_before + * @var string sql Associative array with the query to be executed + * @var array forum_list List of forums that contain the posts + * @var int visibility_const Integer with one of the possible ITEM_* constant values + * @var int topic_id If topic_id not equal to 0, the topic id to filter the posts to display + * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string) + * @var string sort_order_sql String with the ORDER BY SQL code used in this query + * @since 3.1.0-RC3 + */ + $vars = array( + 'sql', + 'forum_list', + 'visibility_const', + 'topic_id', + 'limit_time_sql', + 'sort_order_sql', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_query_before', compact($vars))); + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); $i = 0; @@ -472,10 +499,33 @@ class mcp_queue $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_attachment AS post_attachment, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour FROM ' . TOPICS_TABLE . ' t WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND topic_visibility = ' . $visibility_const . " + AND ' . $db->sql_in_set('topic_visibility', $visibility_const) . " AND topic_delete_user <> 0 $limit_time_sql ORDER BY $sort_order_sql"; + + /** + * Alter sql query to get information on all topics in the list of forums provided. + * + * @event core.mcp_queue_get_posts_for_topics_query_before + * @var string sql String with the query to be executed + * @var array forum_list List of forums that contain the posts + * @var int visibility_const Integer with one of the possible ITEM_* constant values + * @var int topic_id topic_id in the page request + * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string) + * @var string sort_order_sql String with the ORDER BY SQL code used in this query + * @since 3.1.0-RC3 + */ + $vars = array( + 'sql', + 'forum_list', + 'visibility_const', + 'topic_id', + 'limit_time_sql', + 'sort_order_sql', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_for_topics_query_before', compact($vars))); + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); $rowset = array(); @@ -567,18 +617,19 @@ class mcp_queue */ static public function approve_posts($action, $post_id_list, $id, $mode) { - global $db, $template, $user, $config, $request, $phpbb_container; - global $phpEx, $phpbb_root_path; + global $template, $user, $request, $phpbb_container, $phpbb_dispatcher; + global $phpEx, $phpbb_root_path, $phpbb_log; - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { trigger_error('NOT_AUTHORISED'); } $redirect = $request->variable('redirect', build_url(array('quickmod'))); $redirect = reapply_sid($redirect); - $success_msg = $post_url = ''; + $post_url = ''; $approve_log = array(); + $num_topics = 0; $s_hidden_fields = build_hidden_fields(array( 'i' => $id, @@ -588,7 +639,7 @@ class mcp_queue 'redirect' => $redirect, )); - $post_info = get_post_data($post_id_list, 'm_approve'); + $post_info = phpbb_get_post_data($post_id_list, 'm_approve'); if (confirm_box(true)) { @@ -625,29 +676,32 @@ class mcp_queue $approve_log[] = array( 'forum_id' => $post_data['forum_id'], 'topic_id' => $post_data['topic_id'], + 'post_id' => $post_id, 'post_subject' => $post_data['post_subject'], ); } + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); foreach ($topic_info as $topic_id => $topic_data) { $phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post'])); } - if (sizeof($post_info) >= 1) - { - $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; - } - foreach ($approve_log as $log_data) { - add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_POST_' . strtoupper($action) . 'D', $log_data['post_subject']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_' . strtoupper($action) . 'D', false, array( + 'forum_id' => $log_data['forum_id'], + 'topic_id' => $log_data['topic_id'], + 'post_id' => $log_data['post_id'], + $log_data['post_subject'] + )); } // Only send out the mails, when the posts are being approved if ($action == 'approve') { + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); // Handle notifications @@ -656,20 +710,38 @@ class mcp_queue // A single topic approval may also happen here, so handle deleting the respective notification. if (!$post_data['topic_posts_approved']) { - $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); + $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $post_data['topic_id']); + + if ($post_data['post_visibility'] == ITEM_UNAPPROVED) + { + $phpbb_notifications->add_notifications(array('notification.type.topic'), $post_data); + } + if ($post_data['post_visibility'] != ITEM_APPROVED) + { + $num_topics++; + } + } + else + { + // Only add notifications, if we are not reapproving post + // When the topic was already approved, but was edited and + // now needs re-approval, we don't want to notify the users + // again. + if ($post_data['post_visibility'] == ITEM_UNAPPROVED) + { + $phpbb_notifications->add_notifications(array( + 'notification.type.bookmark', + 'notification.type.post', + ), $post_data); + } } - $phpbb_notifications->delete_notifications('post_in_queue', $post_id); - - $phpbb_notifications->add_notifications(array( - 'quote', - 'bookmark', - 'post', - ), $post_data); - - $phpbb_notifications->mark_notifications_read(array( - 'quote', - 'bookmark', - 'post', + $phpbb_notifications->add_notifications(array('notification.type.quote'), $post_data); + $phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id); + + $phpbb_notifications->mark_notifications(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', ), $post_data['post_id'], $user->data['user_id']); // Notify Poster? @@ -680,11 +752,51 @@ class mcp_queue continue; } - $phpbb_notifications->add_notifications('approve_post', $post_data); + if (!$post_data['topic_posts_approved']) + { + $phpbb_notifications->add_notifications('notification.type.approve_topic', $post_data); + } + else + { + $phpbb_notifications->add_notifications('notification.type.approve_post', $post_data); + } } } } + if ($num_topics >= 1) + { + $success_msg = ($num_topics == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS'; + } + else + { + $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; + } + + /** + * Perform additional actions during post(s) approval + * + * @event core.approve_posts_after + * @var string action Variable containing the action we perform on the posts ('approve' or 'restore') + * @var array post_info Array containing info for all posts being approved + * @var array topic_info Array containing info for all parent topics of the posts + * @var int num_topics Variable containing number of topics + * @var bool notify_poster Variable telling if the post should be notified or not + * @var string success_msg Variable containing the language key for the success message + * @var string redirect Variable containing the redirect url + * @since 3.1.4-RC1 + */ + $vars = array( + 'action', + 'post_info', + 'topic_info', + 'num_topics', + 'notify_poster', + 'success_msg', + 'redirect', + ); + extract($phpbb_dispatcher->trigger_event('core.approve_posts_after', compact($vars))); + meta_refresh(3, $redirect); $message = $user->lang[$success_msg]; @@ -715,14 +827,14 @@ class mcp_queue { foreach ($post_info as $post_data) { - if ($post_data['poster_id'] == ANONYMOUS) + if (!$post_data['topic_posts_approved']) { - continue; + $num_topics++; } - else + + if (!$show_notify && $post_data['poster_id'] != ANONYMOUS) { $show_notify = true; - break; } } } @@ -732,7 +844,18 @@ class mcp_queue 'S_' . strtoupper($action) => true, )); - confirm_box(false, strtoupper($action) . '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); + // Create the confirm box message + $action_msg = strtoupper($action); + $num_posts = sizeof($post_id_list) - $num_topics; + if ($num_topics > 0 && $num_posts <= 0) + { + $action_msg .= '_TOPIC' . (($num_topics == 1) ? '' : 'S'); + } + else + { + $action_msg .= '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'); + } + confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html'); } redirect($redirect); @@ -749,10 +872,10 @@ class mcp_queue */ static public function approve_topics($action, $topic_id_list, $id, $mode) { - global $db, $template, $user, $config; - global $phpEx, $phpbb_root_path, $request, $phpbb_container; + global $db, $template, $user, $phpbb_log; + global $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_dispatcher; - if (!check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve'))) + if (!phpbb_check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve'))) { trigger_error('NOT_AUTHORISED'); } @@ -770,12 +893,13 @@ class mcp_queue 'redirect' => $redirect, )); - $topic_info = get_topic_data($topic_id_list, 'm_approve'); + $topic_info = phpbb_get_topic_data($topic_id_list, 'm_approve'); if (confirm_box(true)) { $notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false; + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); $first_post_ids = array(); @@ -800,7 +924,11 @@ class mcp_queue foreach ($approve_log as $log_data) { - add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_TOPIC_' . strtoupper($action) . 'D', $log_data['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_' . strtoupper($action) . 'D', false, array( + 'forum_id' => $log_data['forum_id'], + 'topic_id' => $log_data['topic_id'], + $log_data['topic_title'] + )); } // Only send out the mails, when the posts are being approved @@ -819,6 +947,7 @@ class mcp_queue $db->sql_freeresult($result); // Handle notifications + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); foreach ($topic_info as $topic_id => $topic_data) @@ -828,25 +957,55 @@ class mcp_queue 'post_subject' => $topic_data['topic_title'], 'post_time' => $topic_data['topic_time'], 'poster_id' => $topic_data['topic_poster'], - 'username' => $topic_data['topic_first_poster_name'], + 'post_username' => $topic_data['topic_first_poster_name'], )); - $phpbb_notifications->delete_notifications('topic_in_queue', $topic_id); - $phpbb_notifications->add_notifications(array( - 'quote', - 'topic', - ), $topic_data); + $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $topic_id); - $phpbb_notifications->mark_notifications_read('quote', $topic_data['post_id'], $user->data['user_id']); - $phpbb_notifications->mark_notifications_read('topic', $topic_id, $user->data['user_id']); + // Only add notifications, if we are not reapproving post + // When the topic was already approved, but was edited and + // now needs re-approval, we don't want to notify the users + // again. + if ($topic_data['topic_visibility'] == ITEM_UNAPPROVED) + { + $phpbb_notifications->add_notifications(array( + 'notification.type.quote', + 'notification.type.topic', + ), $topic_data); + } + + $phpbb_notifications->mark_notifications('quote', $topic_data['post_id'], $user->data['user_id']); + $phpbb_notifications->mark_notifications('topic', $topic_id, $user->data['user_id']); if ($notify_poster) { - $phpbb_notifications->add_notifications('approve_topic', $topic_data); + $phpbb_notifications->add_notifications('notification.type.approve_topic', $topic_data); } } } + /** + * Perform additional actions during topics(s) approval + * + * @event core.approve_topics_after + * @var string action Variable containing the action we perform on the posts ('approve' or 'restore') + * @var mixed topic_info Array containing info for all topics being approved + * @var array first_post_ids Array containing ids of all first posts + * @var bool notify_poster Variable telling if the poster should be notified or not + * @var string success_msg Variable containing the language key for the success message + * @var string redirect Variable containing the redirect url + * @since 3.1.4-RC1 + */ + $vars = array( + 'action', + 'topic_info', + 'first_post_ids', + 'notify_poster', + 'success_msg', + 'redirect', + ); + extract($phpbb_dispatcher->trigger_event('core.approve_topics_after', compact($vars))); + meta_refresh(3, $redirect); $message = $user->lang[$success_msg]; @@ -910,10 +1069,10 @@ class mcp_queue */ static public function disapprove_posts($post_id_list, $id, $mode) { - global $db, $template, $user, $config, $phpbb_container; - global $phpEx, $phpbb_root_path, $request; + global $db, $template, $user, $phpbb_container, $phpbb_dispatcher; + global $phpEx, $phpbb_root_path, $request, $phpbb_log; - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { trigger_error('NOT_AUTHORISED'); } @@ -922,7 +1081,7 @@ class mcp_queue $redirect = reapply_sid($redirect); $reason = $request->variable('reason', '', true); $reason_id = $request->variable('reason_id', 0); - $success_msg = $additional_msg = ''; + $additional_msg = ''; $s_hidden_fields = build_hidden_fields(array( 'i' => $id, @@ -965,7 +1124,7 @@ class mcp_queue } } - $post_info = get_post_data($post_id_list, 'm_approve'); + $post_info = phpbb_get_post_data($post_id_list, 'm_approve'); $is_disapproving = false; foreach ($post_info as $post_id => $post_data) @@ -980,12 +1139,17 @@ class mcp_queue if (confirm_box(true)) { - $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array(); + $disapprove_log_topics = $disapprove_log_posts = array(); $topic_posts_unapproved = $post_disapprove_list = $topic_information = array(); // Build a list of posts to be disapproved and get the related topics real replies count foreach ($post_info as $post_id => $post_data) { + if ($mode === 'unapproved_topics' && $post_data['post_visibility'] == ITEM_APPROVED) + { + continue; + } + $post_disapprove_list[$post_id] = $post_data['topic_id']; if (!isset($topic_posts_unapproved[$post_data['topic_id']])) { @@ -995,6 +1159,12 @@ class mcp_queue $topic_posts_unapproved[$post_data['topic_id']]++; } + // Do not try to disapprove if no posts are selected + if (empty($post_disapprove_list)) + { + trigger_error('NO_POST_SELECTED'); + } + // Now we build the log array foreach ($post_disapprove_list as $post_id => $topic_id) { @@ -1060,16 +1230,28 @@ class mcp_queue if ($is_disapproving) { $l_log_message = ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED'; - add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $disapprove_reason); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $l_log_message, false, array( + 'forum_id' => $log_data['forum_id'], + 'topic_id' => $log_data['topic_id'], + $log_data['post_subject'], + $disapprove_reason, + $log_data['post_username'] + )); } else { $l_log_message = ($log_data['type'] == 'topic') ? 'LOG_DELETE_TOPIC' : 'LOG_DELETE_POST'; - add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $log_data['post_username']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $l_log_message, false, array( + 'forum_id' => $log_data['forum_id'], + 'topic_id' => $log_data['topic_id'], + $log_data['post_subject'], + $log_data['post_username'] + )); } } } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); $lang_reasons = array(); @@ -1080,12 +1262,12 @@ class mcp_queue $topic_information[$topic_id]['topic_posts_softdeleted'] == 0 && $topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id]; - $phpbb_notifications->delete_notifications('post_in_queue', $post_id); + $phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id); // Do we disapprove the whole topic? Remove potential notifications if ($disapprove_all_posts_in_topic) { - $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); + $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $post_data['topic_id']); } // Notify Poster? @@ -1096,7 +1278,7 @@ class mcp_queue continue; } - $post_data['disapprove_reason'] = ''; + $post_data['disapprove_reason'] = $disapprove_reason; if (isset($disapprove_reason_lang)) { // Okay we need to get the reason from the posters language @@ -1126,25 +1308,21 @@ class mcp_queue $post_data['disapprove_reason'] .= ($reason) ? "\n\n" . $reason : ''; } - if ($disapprove_all_posts_in_topic && $topic_information[$topic_id]['topic_posts_unapproved'] == 1) { // If there is only 1 post when disapproving the topic, // we send the user a "disapprove topic" notification... - $phpbb_notifications->add_notifications('disapprove_topic', $post_data); + $phpbb_notifications->add_notifications('notification.type.disapprove_topic', $post_data); } else { // ... otherwise there are multiple unapproved posts and // all of them are disapproved as posts. - $phpbb_notifications->add_notifications('disapprove_post', $post_data); + $phpbb_notifications->add_notifications('notification.type.disapprove_post', $post_data); } } } - unset($lang_reasons, $post_info, $disapprove_reason, $disapprove_reason_lang); - - if ($num_disapproved_topics) { $success_msg = ($num_disapproved_topics == 1) ? 'TOPIC' : 'TOPICS'; @@ -1163,6 +1341,60 @@ class mcp_queue $success_msg .= '_DELETED_SUCCESS'; } + // If we came from viewtopic, we try to go back to it. + if (strpos($redirect, $phpbb_root_path . 'viewtopic.' . $phpEx) === 0) + { + if ($num_disapproved_topics == 0) + { + // So we need to remove the post id part from the Url + $redirect = str_replace("&p={$post_id_list[0]}#p{$post_id_list[0]}", '', $redirect); + } + else + { + // However this is only possible if the topic still exists, + // Otherwise we go back to the viewforum page + $redirect = append_sid($phpbb_root_path . 'viewforum.' . $phpEx, 'f=' . $request->variable('f', 0)); + } + } + + /** + * Perform additional actions during post(s) disapproval + * + * @event core.disapprove_posts_after + * @var array post_info Array containing info for all posts being disapproved + * @var array topic_information Array containing information for the topics + * @var array topic_posts_unapproved Array containing list of topic ids and the count of disapproved posts in them + * @var array post_disapprove_list Array containing list of posts and their topic id + * @var int num_disapproved_topics Variable containing the number of disapproved topics + * @var int num_disapproved_posts Variable containing the number of disapproved posts + * @var array lang_reasons Array containing the language keys for reasons + * @var string disapprove_reason Variable containing the language key for the success message + * @var string disapprove_reason_lang Variable containing the language key for the success message + * @var bool is_disapproving Variable telling if anything is going to be disapproved + * @var bool notify_poster Variable telling if the post should be notified or not + * @var string success_msg Variable containing the language key for the success message + * @var string redirect Variable containing the redirect url + * @since 3.1.4-RC1 + */ + $vars = array( + 'post_info', + 'topic_information', + 'topic_posts_unapproved', + 'post_disapprove_list', + 'num_disapproved_topics', + 'num_disapproved_posts', + 'lang_reasons', + 'disapprove_reason', + 'disapprove_reason_lang', + 'is_disapproving', + 'notify_poster', + 'success_msg', + 'redirect', + ); + extract($phpbb_dispatcher->trigger_event('core.disapprove_posts_after', compact($vars))); + + unset($lang_reasons, $post_info, $disapprove_reason, $disapprove_reason_lang); + meta_refresh(3, $redirect); $message = $user->lang[$success_msg]; @@ -1181,11 +1413,6 @@ class mcp_queue } else { - if (!function_exists('display_reasons')) - { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - } - $show_notify = false; foreach ($post_info as $post_data) @@ -1205,7 +1432,7 @@ class mcp_queue $confirm_template = 'mcp_approve.html'; if ($is_disapproving) { - display_reasons($reason_id); + $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id); } else { diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 8026e071cd..48d0e8d890 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * mcp_reports * Handling the reports queue -* @package mcp */ class mcp_reports { @@ -32,13 +35,13 @@ class mcp_reports function main($id, $mode) { - global $auth, $db, $user, $template, $cache; - global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container; + global $auth, $db, $user, $template, $request; + global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container, $phpbb_dispatcher; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - $forum_id = request_var('f', 0); - $start = request_var('start', 0); + $forum_id = $request->variable('f', 0); + $start = $request->variable('start', 0); $this->page_title = 'MCP_REPORTS'; @@ -48,7 +51,7 @@ class mcp_reports case 'delete': include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - $report_id_list = request_var('report_id_list', array(0)); + $report_id_list = $request->variable('report_id_list', array(0)); if (!sizeof($report_id_list)) { @@ -66,30 +69,80 @@ class mcp_reports $user->add_lang(array('posting', 'viewforum', 'viewtopic')); - $post_id = request_var('p', 0); + $post_id = $request->variable('p', 0); // closed reports are accessed by report id - $report_id = request_var('r', 0); + $report_id = $request->variable('r', 0); + + $sql_ary = array( + 'SELECT' => 'r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, 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, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, 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 - WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' + 'FROM' => array( + REPORTS_TABLE => 'r', + REPORTS_REASONS_TABLE => 'rr', + USERS_TABLE => 'u', + ), + + 'WHERE' => (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' AND rr.reason_id = r.reason_id AND r.user_id = u.user_id - AND r.pm_id = 0 - ORDER BY report_closed ASC'; + AND r.pm_id = 0', + + 'ORDER_BY' => 'report_closed ASC', + ); + + /** + * Allow changing the query to obtain the user-submitted report. + * + * @event core.mcp_reports_report_details_query_before + * @var array sql_ary The array in the format of the query builder with the query + * @var mixed forum_id The forum_id, the number in the f GET parameter + * @var int post_id The post_id of the report being viewed (if 0, it is meaningless) + * @var int report_id The report_id of the report being viewed + * @since 3.1.5-RC1 + */ + $vars = array( + 'sql_ary', + 'forum_id', + 'post_id', + 'report_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_reports_report_details_query_before', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query_limit($sql, 1); $report = $db->sql_fetchrow($result); $db->sql_freeresult($result); + /** + * Allow changing the data obtained from the user-submitted report. + * + * @event core.mcp_reports_report_details_query_after + * @var array sql_ary The array in the format of the query builder with the query that had been executted + * @var mixed forum_id The forum_id, the number in the f GET parameter + * @var int post_id The post_id of the report being viewed (if 0, it is meaningless) + * @var int report_id The report_id of the report being viewed + * @var int report The query's resulting row. + * @since 3.1.5-RC1 + */ + $vars = array( + 'sql_ary', + 'forum_id', + 'post_id', + 'report_id', + 'report', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_reports_report_details_query_after', compact($vars))); + if (!$report) { trigger_error('NO_REPORT'); } + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->mark_notifications_read('report_post', $post_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications('report_post', $post_id, $user->data['user_id']); if (!$report_id && $report['report_closed']) { @@ -98,12 +151,12 @@ class mcp_reports $post_id = $report['post_id']; $report_id = $report['report_id']; - + $parse_post_flags = $report['reported_post_enable_bbcode'] ? OPTION_FLAG_BBCODE : 0; $parse_post_flags += $report['reported_post_enable_smilies'] ? OPTION_FLAG_SMILIES : 0; - $parse_post_flags += $report['reported_post_enable_magic_url'] ? OPTION_FLAG_LINKS : 0; + $parse_post_flags += $report['reported_post_enable_magic_url'] ? OPTION_FLAG_LINKS : 0; - $post_info = get_post_data(array($post_id), 'm_report', true); + $post_info = phpbb_get_post_data(array($post_id), 'm_report', true); if (!sizeof($post_info)) { @@ -129,7 +182,7 @@ class mcp_reports )); } - $topic_tracking_info = $extensions = $attachments = array(); + $attachments = array(); // Get topic tracking info if ($config['load_db_lastread']) { @@ -143,7 +196,13 @@ class mcp_reports } $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; - + $message = generate_text_for_display( + $report['reported_post_text'], + $report['reported_post_uid'], + $report['reported_post_bitfield'], + $parse_post_flags, + false + ); $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text'])); @@ -153,6 +212,7 @@ class mcp_reports FROM ' . ATTACHMENTS_TABLE . ' WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 + AND filetime <= ' . (int) $report['report_time'] . ' ORDER BY filetime DESC'; $result = $db->sql_query($sql); @@ -165,7 +225,7 @@ class mcp_reports if (sizeof($attachments)) { $update_count = array(); - parse_attachments($post_info['forum_id'], $report['reported_post_text'], $attachments, $update_count); + parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); } // Display not already displayed Attachments for this post, we already parsed them. ;) @@ -187,7 +247,7 @@ class mcp_reports 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], - 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED), + 'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE, 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_REPORT_CLOSED' => $report['report_closed'], 'S_USER_NOTES' => true, @@ -225,11 +285,11 @@ class mcp_reports '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']), - 'POST_PREVIEW' => generate_text_for_display($report['reported_post_text'], $report['reported_post_uid'], $report['reported_post_bitfield'], $parse_post_flags, false), + 'POST_PREVIEW' => $message, 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], - 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', + 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&r=' . $report_id . '&p=' . $post_id . '&f=' . $forum_id . '&lookup=' . $post_info['poster_ip'] . '#ip' : '', @@ -241,7 +301,7 @@ class mcp_reports case 'reports': case 'reports_closed': - $topic_id = request_var('t', 0); + $topic_id = $request->variable('t', 0); $forum_info = array(); $forum_list_reports = get_forum_list('m_report', false, true); @@ -259,7 +319,7 @@ class mcp_reports if ($topic_id) { - $topic_info = get_topic_data(array($topic_id)); + $topic_info = phpbb_get_topic_data(array($topic_id)); if (!sizeof($topic_info)) { @@ -291,8 +351,6 @@ class mcp_reports trigger_error('NOT_MODERATOR'); } - $global_id = $forum_list[0]; - $sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_list); @@ -302,20 +360,20 @@ class mcp_reports } else { - $forum_info = get_forum_data(array($forum_id), 'm_report'); + $forum_info = phpbb_get_forum_data(array($forum_id), 'm_report'); if (!sizeof($forum_info)) { trigger_error('NOT_MODERATOR'); } - $forum_info = $forum_info[$forum_id]; $forum_list = array($forum_id); } + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); $forum_list[] = 0; $forum_data = array(); - $pagination = $phpbb_container->get('pagination'); $forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>'; foreach ($forum_list_reports as $row) @@ -328,9 +386,8 @@ class mcp_reports $sort_days = $total = 0; $sort_key = $sort_dir = ''; $sort_by_sql = $sort_order_sql = array(); - mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); + phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); - $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total; $limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : ''; if ($mode == 'reports') @@ -354,6 +411,27 @@ class mcp_reports AND r.pm_id = 0 $limit_time_sql ORDER BY $sort_order_sql"; + + /** + * Alter sql query to get report id of all reports for requested forum and topic or just forum + * + * @event core.mcp_reports_get_reports_query_before + * @var string sql String with the query to be executed + * @var array forum_list List of forums that contain the posts + * @var int topic_id topic_id in the page request + * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string) + * @var string sort_order_sql String with the ORDER BY SQL code used in this query + * @since 3.1.0-RC4 + */ + $vars = array( + 'sql', + 'forum_list', + 'topic_id', + 'limit_time_sql', + 'sort_order_sql', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_reports_get_reports_query_before', compact($vars))); + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); $i = 0; @@ -378,7 +456,6 @@ class mcp_reports ORDER BY ' . $sort_order_sql; $result = $db->sql_query($sql); - $report_data = $rowset = array(); while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('postrow', array( @@ -440,7 +517,7 @@ class mcp_reports */ function close_report($report_id_list, $mode, $action, $pm = false) { - global $db, $template, $user, $config, $auth; + global $db, $user, $auth, $phpbb_log, $request; global $phpEx, $phpbb_root_path, $phpbb_container; $pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 '; @@ -458,6 +535,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) { $post_id_list[] = $row[$id_column]; } + $db->sql_freeresult($result); $post_id_list = array_unique($post_id_list); if ($pm) @@ -469,7 +547,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) } else { - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report'))) + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report'))) { trigger_error('NOT_AUTHORISED'); } @@ -477,19 +555,19 @@ function close_report($report_id_list, $mode, $action, $pm = false) if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false) { - $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=reports'); + $redirect = $request->variable('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=reports'); } - elseif ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false) + else if ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false) { - $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=pm_reports'); + $redirect = $request->variable('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=pm_reports'); } - else if ($action == 'close' && !request_var('r', 0)) + else if ($action == 'close' && !$request->variable('r', 0)) { - $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&mode=' . $module); + $redirect = $request->variable('redirect', build_url(array('mode', 'p', 'quickmod')) . '&mode=' . $module); } else { - $redirect = request_var('redirect', build_url(array('quickmod'))); + $redirect = $request->variable('redirect', build_url(array('quickmod'))); } $success_msg = ''; $forum_ids = array(); @@ -505,7 +583,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) if (confirm_box(true)) { - $post_info = ($pm) ? get_pm_data($post_id_list) : get_post_data($post_id_list, 'm_report'); + $post_info = ($pm) ? phpbb_get_pm_data($post_id_list) : phpbb_get_post_data($post_id_list, 'm_report'); $sql = "SELECT r.report_id, r.$id_column, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type FROM " . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u @@ -578,7 +656,6 @@ function close_report($report_id_list, $mode, $action, $pm = false) } $db->sql_query($sql); - if (sizeof($close_report_posts)) { if ($pm) @@ -615,19 +692,29 @@ function close_report($report_id_list, $mode, $action, $pm = false) } unset($close_report_posts, $close_report_topics); + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); foreach ($reports as $report) { if ($pm) { - add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']); - $phpbb_notifications->delete_notifications('report_pm', $report['pm_id']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $post_info[$report['pm_id']]['message_subject'] + )); + $phpbb_notifications->delete_notifications('notification.type.report_pm', $report['pm_id']); } else { - add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']); - $phpbb_notifications->delete_notifications('report_post', $report['post_id']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_REPORT_' . strtoupper($action) . 'D', false, array( + 'forum_id' => $post_info[$report['post_id']]['forum_id'], + 'topic_id' => $post_info[$report['post_id']]['topic_id'], + 'post_id' => $report['post_id'], + $post_info[$report['post_id']]['post_subject'] + )); + $phpbb_notifications->delete_notifications('notification.type.report_post', $report['post_id']); } } @@ -645,7 +732,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) if ($pm) { - $phpbb_notifications->add_notifications('report_pm_closed', array_merge($post_info[$post_id], array( + $phpbb_notifications->add_notifications('notification.type.report_pm_closed', array_merge($post_info[$post_id], array( 'reporter' => $reporter['user_id'], 'closer_id' => $user->data['user_id'], 'from_user_id' => $post_info[$post_id]['author_id'], @@ -653,7 +740,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) } else { - $phpbb_notifications->add_notifications('report_post_closed', array_merge($post_info[$post_id], array( + $phpbb_notifications->add_notifications('notification.type.report_post_closed', array_merge($post_info[$post_id], array( 'reporter' => $reporter['user_id'], 'closer_id' => $user->data['user_id'], ))); @@ -679,7 +766,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); + $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); if (!$success_msg) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index cdb88bf2bf..ba86484040 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,16 +24,17 @@ if (!defined('IN_PHPBB')) */ function mcp_topic_view($id, $mode, $action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth, $cache, $phpbb_container; + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $auth, $phpbb_container, $phpbb_dispatcher; - $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url()); + $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url()); - $user->add_lang('viewtopic'); + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); + $user->add_lang('viewtopic'); - $topic_id = request_var('t', 0); - $topic_info = get_topic_data(array($topic_id), false, true); + $topic_id = $request->variable('t', 0); + $topic_info = phpbb_get_topic_data(array($topic_id), false, true); if (!sizeof($topic_info)) { @@ -39,16 +44,16 @@ function mcp_topic_view($id, $mode, $action) $topic_info = $topic_info[$topic_id]; // Set up some vars - $icon_id = request_var('icon', 0); - $subject = utf8_normalize_nfc(request_var('subject', '', true)); - $start = request_var('start', 0); - $sort_days_old = request_var('st_old', 0); - $forum_id = request_var('f', 0); - $to_topic_id = request_var('to_topic_id', 0); - $to_forum_id = request_var('to_forum_id', 0); + $icon_id = $request->variable('icon', 0); + $subject = $request->variable('subject', '', true); + $start = $request->variable('start', 0); + $sort_days_old = $request->variable('st_old', 0); + $forum_id = $request->variable('f', 0); + $to_topic_id = $request->variable('to_topic_id', 0); + $to_forum_id = $request->variable('to_forum_id', 0); $sort = isset($_POST['sort']) ? true : false; - $submitted_id_list = request_var('post_ids', array(0)); - $checked_ids = $post_id_list = request_var('post_id_list', array(0)); + $submitted_id_list = $request->variable('post_ids', array(0)); + $checked_ids = $post_id_list = $request->variable('post_id_list', array(0)); // Resync Topic? if ($action == 'resync') @@ -110,17 +115,18 @@ function mcp_topic_view($id, $mode, $action) $sort_days = $total = 0; $sort_key = $sort_dir = ''; $sort_by_sql = $sort_order_sql = array(); - mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql); + phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql); - $limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; if ($total == -1) { $total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']); } - $posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page']))); + $posts_per_page = max(0, $request->variable('posts_per_page', intval($config['posts_per_page']))); if ($posts_per_page == 0) { $posts_per_page = $total; @@ -143,23 +149,13 @@ function mcp_topic_view($id, $mode, $action) $result = $db->sql_query_limit($sql, $posts_per_page, $start); $rowset = $post_id_list = array(); - $bbcode_bitfield = ''; while ($row = $db->sql_fetchrow($result)) { $rowset[] = $row; $post_id_list[] = $row['post_id']; - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } $db->sql_freeresult($result); - if ($bbcode_bitfield !== '') - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode(base64_encode($bbcode_bitfield)); - } - - $topic_tracking_info = array(); - // Get topic tracking info if ($config['load_db_lastread']) { @@ -175,11 +171,9 @@ function mcp_topic_view($id, $mode, $action) $has_unapproved_posts = $has_deleted_posts = false; // Grab extensions - $extensions = $attachments = array(); + $attachments = array(); if ($topic_info['topic_attachment'] && sizeof($post_id_list)) { - $extensions = $cache->obtain_attach_extensions($topic_info['forum_id']); - // Get attachments... if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id'])) { @@ -198,6 +192,30 @@ function mcp_topic_view($id, $mode, $action) } } + /** + * Event to modify the post data for the MCP topic review before assigning the posts + * + * @event core.mcp_topic_modify_post_data + * @var array attachments List of attachments post_id => array of attachments + * @var int forum_id The forum ID we are currently in + * @var int id ID of the tab we are displaying + * @var string mode Mode of the MCP page we are displaying + * @var array post_id_list Array with post ids we are going to display + * @var array rowset Array with the posts data + * @var int topic_id The topic ID we are currently reviewing + * @since 3.1.7-RC1 + */ + $vars = array( + 'attachments', + 'forum_id', + 'id', + 'mode', + 'post_id_list', + 'rowset', + 'topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars))); + foreach ($rowset as $i => $row) { $message = $row['post_text']; @@ -212,7 +230,7 @@ function mcp_topic_view($id, $mode, $action) parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count); } - if ($row['post_visibility'] == ITEM_UNAPPROVED) + if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) { $has_unapproved_posts = true; } @@ -224,7 +242,7 @@ function mcp_topic_view($id, $mode, $action) $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false; - $template->assign_block_vars('postrow', array( + $post_row = array( 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), @@ -239,15 +257,47 @@ function mcp_topic_view($id, $mode, $action) 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])), - 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $topic_info['forum_id'])), + 'S_POST_UNAPPROVED' => (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $topic_info['forum_id'])), 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])), 'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false, 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, 'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''), 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', - 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '') + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', + ); + + /** + * Event to modify the template data block for topic reviews in the MCP + * + * @event core.mcp_topic_review_modify_row + * @var int id ID of the tab we are displaying + * @var string mode Mode of the MCP page we are displaying + * @var int topic_id The topic ID we are currently reviewing + * @var int forum_id The forum ID we are currently in + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var array post_row Template block array of the current post + * @var array row Array with original post and user data + * @var array topic_info Array with topic data + * @var int total Total posts count + * @since 3.1.4-RC1 + */ + $vars = array( + 'id', + 'mode', + 'topic_id', + 'forum_id', + 'start', + 'current_row_number', + 'post_row', + 'row', + 'topic_info', + 'total', ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topic_review_modify_row', compact($vars))); + + $template->assign_block_vars('postrow', $post_row); // Display not already displayed Attachments for this post, we already parsed them. ;) if (!empty($attachments[$row['post_id']])) @@ -274,7 +324,7 @@ function mcp_topic_view($id, $mode, $action) // Has the user selected a topic for merge? if ($to_topic_id) { - $to_topic_info = get_topic_data(array($to_topic_id), 'm_merge'); + $to_topic_info = phpbb_get_topic_data(array($to_topic_id), 'm_merge'); if (!sizeof($to_topic_info)) { @@ -352,11 +402,11 @@ function mcp_topic_view($id, $mode, $action) */ function split_topic($action, $topic_id, $to_forum_id, $subject) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config; + global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config, $phpbb_log, $request; - $post_id_list = request_var('post_id_list', array(0)); - $forum_id = request_var('forum_id', 0); - $start = request_var('start', 0); + $post_id_list = $request->variable('post_id_list', array(0)); + $forum_id = $request->variable('forum_id', 0); + $start = $request->variable('start', 0); if (!sizeof($post_id_list)) { @@ -364,13 +414,13 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) return; } - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split'))) + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split'))) { return; } $post_id = $post_id_list[0]; - $post_info = get_post_data(array($post_id)); + $post_info = phpbb_get_post_data(array($post_id)); if (!sizeof($post_info)) { @@ -394,7 +444,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) return; } - $forum_info = get_forum_data(array($to_forum_id), 'f_post'); + $forum_info = phpbb_get_forum_data(array($to_forum_id), 'f_post'); if (!sizeof($forum_info)) { @@ -410,7 +460,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) return; } - $redirect = request_var('redirect', build_url(array('quickmod'))); + $redirect = $request->variable('redirect', build_url(array('quickmod'))); $s_hidden_fields = build_hidden_fields(array( 'i' => 'main', @@ -423,9 +473,8 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) 'redirect' => $redirect, 'subject' => $subject, 'to_forum_id' => $to_forum_id, - 'icon' => request_var('icon', 0)) + 'icon' => $request->variable('icon', 0)) ); - $success_msg = $return_link = ''; if (confirm_box(true)) { @@ -434,7 +483,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $sort_days = $total = 0; $sort_key = $sort_dir = ''; $sort_by_sql = $sort_order_sql = array(); - mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); + phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -462,7 +511,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) while ($row = $db->sql_fetchrow($result)) { // If split from selected post (split_beyond), we split the unapproved items too. - if ($row['post_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) + if (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $row['forum_id'])) { // continue; } @@ -486,7 +535,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) trigger_error('NO_POST_SELECTED'); } - $icon_id = request_var('icon', 0); + $icon_id = $request->variable('icon', 0); $sql_ary = array( 'forum_id' => $to_forum_id, @@ -501,11 +550,19 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $to_topic_id = $db->sql_nextid(); move_posts($post_id_list, $to_topic_id); - $topic_info = get_topic_data(array($topic_id)); + $topic_info = phpbb_get_topic_data(array($topic_id)); $topic_info = $topic_info[$topic_id]; - add_log('mod', $to_forum_id, $to_topic_id, 'LOG_SPLIT_DESTINATION', $subject); - add_log('mod', $forum_id, $topic_id, 'LOG_SPLIT_SOURCE', $topic_info['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_DESTINATION', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $to_topic_id, + $subject + )); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_SOURCE', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $topic_info['topic_title'] + )); // Change topic title of first post $sql = 'UPDATE ' . POSTS_TABLE . " @@ -559,11 +616,11 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $success_msg = 'TOPIC_SPLIT_SUCCESS'; // Update forum statistics - set_config_count('num_topics', 1, true); + $config->increment('num_topics', 1, false); // Link back to both topics $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); - $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); + $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); $redirect = reapply_sid($redirect); meta_refresh(3, $redirect); @@ -580,7 +637,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) */ function merge_posts($topic_id, $to_topic_id) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth; + global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request; if (!$to_topic_id) { @@ -588,18 +645,26 @@ function merge_posts($topic_id, $to_topic_id) return; } - $topic_data = get_topic_data(array($to_topic_id), 'm_merge'); + $sync_topics = array($topic_id, $to_topic_id); + + $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); - if (!sizeof($topic_data)) + if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; } + $sync_forums = array(); + foreach ($topic_data as $data) + { + $sync_forums[$data['forum_id']] = $data['forum_id']; + } + $topic_data = $topic_data[$to_topic_id]; - $post_id_list = request_var('post_id_list', array(0)); - $start = request_var('start', 0); + $post_id_list = $request->variable('post_id_list', array(0)); + $start = $request->variable('start', 0); if (!sizeof($post_id_list)) { @@ -607,12 +672,12 @@ function merge_posts($topic_id, $to_topic_id) return; } - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) { return; } - $redirect = request_var('redirect', build_url(array('quickmod'))); + $redirect = $request->variable('redirect', build_url(array('quickmod'))); $s_hidden_fields = build_hidden_fields(array( 'i' => 'main', @@ -624,21 +689,26 @@ function merge_posts($topic_id, $to_topic_id) 'redirect' => $redirect, 't' => $topic_id) ); - $success_msg = $return_link = ''; + $return_link = ''; if (confirm_box(true)) { $to_forum_id = $topic_data['forum_id']; - move_posts($post_id_list, $to_topic_id); - add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']); + move_posts($post_id_list, $to_topic_id, false); + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $to_topic_id, + $topic_data['topic_title'] + )); // Message and return links $success_msg = 'POSTS_MERGED_SUCCESS'; // Does the original topic still exist? If yes, link back to it $sql = 'SELECT forum_id - FROM ' . TOPICS_TABLE . ' + FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $topic_id; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); @@ -662,9 +732,15 @@ function merge_posts($topic_id, $to_topic_id) phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id); } + // Re-sync the topics and forums because the auto-sync was deactivated in the call of move_posts() + sync('topic_reported', 'topic_id', $sync_topics); + sync('topic_attachment', 'topic_id', $sync_topics); + sync('topic', 'topic_id', $sync_topics, true); + sync('forum', 'forum_id', $sync_forums, true, true); + // Link to the new topic $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); - $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); + $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); $redirect = reapply_sid($redirect); meta_refresh(3, $redirect); diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index d396d004dc..0b66aae030 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * mcp_warn * Handling warning the users -* @package mcp */ class mcp_warn { @@ -32,10 +35,9 @@ class mcp_warn function main($id, $mode) { - global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx; + global $request; - $action = request_var('action', array('' => '')); + $action = $request->variable('action', array('' => '')); if (is_array($action)) { @@ -75,8 +77,8 @@ class mcp_warn */ function mcp_warn_front_view() { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $phpEx, $phpbb_root_path; + global $template, $db, $user; $template->assign_vars(array( 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), @@ -96,9 +98,6 @@ class mcp_warn 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), - 'USERNAME' => $row['username'], - 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), 'WARNING_TIME' => $user->format_date($row['user_last_warning']), 'WARNINGS' => $row['user_warnings'], @@ -118,9 +117,6 @@ class mcp_warn 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), - 'USERNAME' => $row['username'], - 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), 'WARNING_TIME' => $user->format_date($row['warning_time']), 'WARNINGS' => $row['user_warnings'], @@ -135,15 +131,16 @@ class mcp_warn function mcp_warn_list_view($action) { global $phpEx, $phpbb_root_path, $config, $phpbb_container; - global $template, $db, $user, $auth; + global $template, $user, $auth, $request; - $user->add_lang('memberlist'); + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); + $user->add_lang('memberlist'); - $start = request_var('start', 0); - $st = request_var('st', 0); - $sk = request_var('sk', 'b'); - $sd = request_var('sd', 'd'); + $start = $request->variable('start', 0); + $st = $request->variable('st', 0); + $sk = $request->variable('sk', 'b'); + $sd = $request->variable('sd', 'd'); $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']); @@ -167,9 +164,6 @@ class mcp_warn 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), - 'USERNAME' => $row['username'], - 'USERNAME_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), 'WARNING_TIME' => $user->format_date($row['user_last_warning']), 'WARNINGS' => $row['user_warnings'], @@ -195,13 +189,13 @@ class mcp_warn */ function mcp_warn_post_view($action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $phpbb_dispatcher; - $post_id = request_var('p', 0); - $forum_id = request_var('f', 0); + $post_id = $request->variable('p', 0); + $forum_id = $request->variable('f', 0); $notify = (isset($_REQUEST['notify_user'])) ? true : false; - $warning = utf8_normalize_nfc(request_var('warning', '', true)); + $warning = $request->variable('warning', '', true); $sql = 'SELECT u.*, p.* FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u @@ -273,32 +267,81 @@ class mcp_warn { if (check_form_key('mcp_warn')) { - add_warning($user_row, $warning, $notify, $post_id); - $msg = $user->lang['USER_WARNING_ADDED']; + $s_mcp_warn_post = true; + + /** + * Event for before warning a user for a post. + * + * @event core.mcp_warn_post_before + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, we notify the user for the warning + * @var int post_id The post id for which the warning is added + * @var bool s_mcp_warn_post If true, we add the warning else we omit it + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'post_id', + 's_mcp_warn_post', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_before', compact($vars))); + + if ($s_mcp_warn_post) + { + add_warning($user_row, $warning, $notify, $post_id); + $message = $user->lang['USER_WARNING_ADDED']; + + /** + * Event for after warning a user for a post. + * + * @event core.mcp_warn_post_after + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, the user was notified for the warning + * @var int post_id The post id for which the warning is added + * @var string message Message displayed to the moderator + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'post_id', + 'message', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_after', compact($vars))); + } } else { - $msg = $user->lang['FORM_INVALID']; + $message = $user->lang['FORM_INVALID']; + } + + if (!empty($message)) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($message . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } - $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); - meta_refresh(2, $redirect); - trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } // OK, they didn't submit a warning so lets build the page for them to do so // We want to make the message available here as a reminder // Parse the message and subject - $parse_flags = OPTION_FLAG_SMILIES | ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $parse_flags = OPTION_FLAG_SMILIES | ($user_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true); // Generate the appropriate user information for the user we are looking at - if (!function_exists('phpbb_get_user_avatar')) + if (!function_exists('phpbb_get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } - get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); $avatar_img = phpbb_get_user_avatar($user_row); $template->assign_vars(array( @@ -307,13 +350,13 @@ class mcp_warn 'POST' => $message, 'USERNAME' => $user_row['username'], 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', - 'RANK_TITLE' => $rank_title, + 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, + 'RANK_IMG' => $user_rank_data['img'], 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id#p$post_id"), @@ -326,13 +369,13 @@ class mcp_warn */ function mcp_warn_user_view($action) { - global $phpEx, $phpbb_root_path, $config, $module; - global $template, $db, $user, $auth; + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $phpbb_dispatcher; - $user_id = request_var('u', 0); - $username = request_var('username', '', true); + $user_id = $request->variable('u', 0); + $username = $request->variable('username', '', true); $notify = (isset($_REQUEST['notify_user'])) ? true : false; - $warning = utf8_normalize_nfc(request_var('warning', '', true)); + $warning = $request->variable('warning', '', true); $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; @@ -385,32 +428,76 @@ class mcp_warn { if (check_form_key('mcp_warn')) { - add_warning($user_row, $warning, $notify); - $msg = $user->lang['USER_WARNING_ADDED']; + $s_mcp_warn_user = true; + + /** + * Event for before warning a user from MCP. + * + * @event core.mcp_warn_user_before + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, we notify the user for the warning + * @var bool s_mcp_warn_user If true, we add the warning else we omit it + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 's_mcp_warn_user', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_before', compact($vars))); + + if ($s_mcp_warn_user) + { + add_warning($user_row, $warning, $notify); + $message = $user->lang['USER_WARNING_ADDED']; + + /** + * Event for after warning a user from MCP. + * + * @event core.mcp_warn_user_after + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, the user was notified for the warning + * @var string message Message displayed to the moderator + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'message', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_after', compact($vars))); + } } else { - $msg = $user->lang['FORM_INVALID']; + $message = $user->lang['FORM_INVALID']; + } + + if (!empty($message)) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($message . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } - $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); - meta_refresh(2, $redirect); - trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } // Generate the appropriate user information for the user we are looking at - if (!function_exists('phpbb_get_user_avatar')) + if (!function_exists('phpbb_get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } - - get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); $avatar_img = phpbb_get_user_avatar($user_row); // OK, they didn't submit a warning so lets build the page for them to do so $template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, - 'RANK_TITLE' => $rank_title, + 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, @@ -421,7 +508,7 @@ class mcp_warn 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, + 'RANK_IMG' => $user_rank_data['img'], 'S_CAN_NOTIFY' => $s_can_notify, )); @@ -435,8 +522,8 @@ class mcp_warn */ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth; + global $phpEx, $phpbb_root_path, $config, $phpbb_log; + global $db, $user; if ($send_pm) { @@ -448,7 +535,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) $message_parser = new parse_message(); - $message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning); + $message_parser->message = $user->lang('WARNING_PM_BODY', $warning); $message_parser->parse(true, true, true, false, false, true, true); $pm_data = array( @@ -466,11 +553,14 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) 'address_list' => array('u' => array($user_row['user_id'] => 'to')), ); - submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false); + submit_pm('post', $user->lang('WARNING_PM_SUBJECT'), $pm_data, false); } - add_log('admin', 'LOG_USER_WARNING', $user_row['username']); - $log_id = add_log('user', $user_row['user_id'], 'LOG_USER_WARNING_BODY', $warning); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array($user_row['username'])); + $log_id = $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING_BODY', false, array( + 'reportee_id' => $user_row['user_id'], + $warning + )); $sql_ary = array( 'user_id' => $user_row['user_id'], @@ -495,5 +585,10 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_USER_WARNING', $user_row['username']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $post_id, + $user_row['username'] + )); } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index ad6743b3a3..97e0dd9f0d 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,13 +21,25 @@ if (!defined('IN_PHPBB')) if (!class_exists('bbcode')) { + // The following lines are for extensions which include message_parser.php + // while $phpbb_root_path and $phpEx are out of the script scope + // which may lead to the 'Undefined variable' and 'failed to open stream' errors + if (!isset($phpbb_root_path)) + { + global $phpbb_root_path; + } + + if (!isset($phpEx)) + { + global $phpEx; + } + include($phpbb_root_path . 'includes/bbcode.' . $phpEx); } /** * BBCODE FIRSTPASS * BBCODE first pass class (functions for parsing messages for db storage) -* @package phpBB3 */ class bbcode_firstpass extends bbcode { @@ -67,7 +83,14 @@ class bbcode_firstpass extends bbcode // it should not demand recompilation if (preg_match($regexp, $this->message)) { - $this->message = preg_replace($regexp, $replacement, $this->message); + if (is_callable($replacement)) + { + $this->message = preg_replace_callback($regexp, $replacement, $this->message); + } + else + { + $this->message = preg_replace($regexp, $replacement, $this->message); + } $bitfield->set($bbcode_data['bbcode_id']); } } @@ -104,28 +127,85 @@ class bbcode_firstpass extends bbcode function bbcode_init($allow_custom_bbcode = true) { global $phpbb_dispatcher; - + static $rowset; + $bbcode_class = $this; + // This array holds all bbcode data. BBCodes will be processed in this // order, so it is important to keep [code] in first position and // [quote] in second position. // To parse multiline URL we enable dotall option setting only for URL text // but not for link itself, thus [url][/url] is not affected. + // + // To perform custom validation in extension, use $this->validate_bbcode_by_extension() + // method which accepts variable number of parameters $this->bbcodes = array( - 'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uise' => "\$this->bbcode_code('\$1', '\$2')")), - 'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#uise' => "\$this->bbcode_quote('\$0')")), - 'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uise' => "\$this->bbcode_attachment('\$1', '\$2')")), - 'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->bbcode_strong('\$1')")), - 'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#uise' => "\$this->bbcode_italic('\$1')")), - 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiUe' => "\$this->validate_url('\$2', ('\$3') ? '\$3' : '\$4')")), - 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#uiUe' => "\$this->bbcode_img('\$1')")), - 'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uise' => "\$this->bbcode_size('\$1', '\$2')")), - 'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uise' => "\$this->bbcode_color('\$1', '\$2')")), - 'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#uise' => "\$this->bbcode_underline('\$1')")), - 'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#uise' => "\$this->bbcode_parse_list('\$0')")), - 'email' => array('bbcode_id' => 10, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#uise' => "\$this->validate_email('\$1', '\$2')")), - 'flash' => array('bbcode_id' => 11, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#uie' => "\$this->bbcode_flash('\$1', '\$2', '\$3')")) + 'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_code($match[1], $match[2]); + } + )), + 'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_quote($match[0]); + } + )), + 'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_attachment($match[1], $match[2]); + } + )), + 'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_strong($match[1]); + } + )), + 'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_italic($match[1]); + } + )), + 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiU' => function ($match) use($bbcode_class) + { + return $bbcode_class->validate_url($match[2], ($match[3]) ? $match[3] : $match[4]); + } + )), + 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#uiU' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_img($match[1]); + } + )), + 'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_size($match[1], $match[2]); + } + )), + 'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_color($match[1], $match[2]); + } + )), + 'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_underline($match[1]); + } + )), + 'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_parse_list($match[0]); + } + )), + 'email' => array('bbcode_id' => 10, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->validate_email($match[1], $match[2]); + } + )), + 'flash' => array('bbcode_id' => 11, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ui' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_flash($match[1], $match[2], $match[3]); + } + )) ); // Zero the parsed items array @@ -310,7 +390,7 @@ class bbcode_firstpass extends bbcode $in = str_replace(' ', '%20', $in); // Checking urls - if (!preg_match('#^' . get_preg_expression('url') . '$#i', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#i', $in)) + if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in)) { return '[img]' . $in . '[/img]'; } @@ -323,22 +403,23 @@ class bbcode_firstpass extends bbcode if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) { - $stats = @getimagesize(htmlspecialchars_decode($in)); + $imagesize = new \FastImageSize\FastImageSize(); + $size_info = $imagesize->getImageSize(htmlspecialchars_decode($in)); - if ($stats === false) + if ($size_info === false) { $error = true; $this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; } else { - if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $stats[1]) + if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $size_info['height']) { $error = true; $this->warn_msg[] = $user->lang('MAX_IMG_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']); } - if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $stats[0]) + if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $size_info['width']) { $error = true; $this->warn_msg[] = $user->lang('MAX_IMG_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']); @@ -378,8 +459,8 @@ class bbcode_firstpass extends bbcode $in = str_replace(' ', '%20', $in); // Make sure $in is a URL. - if (!preg_match('#^' . get_preg_expression('url') . '$#i', $in) && - !preg_match('#^' . get_preg_expression('www_url') . '$#i', $in)) + if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) && + !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in)) { return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; } @@ -717,8 +798,6 @@ class bbcode_firstpass extends bbcode */ function bbcode_quote($in) { - global $config, $user; - $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in))); if (!$in) @@ -727,7 +806,9 @@ class bbcode_firstpass extends bbcode } // To let the parser not catch tokens within quote_username quotes we encode them before we start this... - $in = preg_replace('#quote="(.*?)"\]#ie', "'quote="' . str_replace(array('[', ']', '\\\"'), array('[', ']', '\"'), '\$1') . '"]'", $in); + $in = preg_replace_callback('#quote="(.*?)"\]#i', function ($match) { + return 'quote="' . str_replace(array('[', ']', '\\\"'), array('[', ']', '\"'), $match[1]) . '"]'; + }, $in); $tok = ']'; $out = '['; @@ -772,20 +853,6 @@ class bbcode_firstpass extends bbcode else if (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m) && substr($out, -1, 1) == '[') { $this->parsed_items['quote']++; - - // the buffer holds a valid opening tag - if ($config['max_quote_depth'] && sizeof($close_tags) >= $config['max_quote_depth']) - { - // there are too many nested quotes - $error_ary['quote_depth'] = $user->lang('QUOTE_DEPTH_EXCEEDED', (int) $config['max_quote_depth']); - - $out .= $buffer . $tok; - $tok = '[]'; - $buffer = ''; - - continue; - } - array_push($close_tags, '/quote:' . $this->bbcode_uid); if (isset($m[1]) && $m[1]) @@ -940,8 +1007,6 @@ class bbcode_firstpass extends bbcode */ function validate_url($var1, $var2) { - global $config; - $var1 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var1))); $var2 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var2))); @@ -962,9 +1027,9 @@ class bbcode_firstpass extends bbcode $url = str_replace(' ', '%20', $url); // Checking urls - if (preg_match('#^' . get_preg_expression('url') . '$#i', $url) || - preg_match('#^' . get_preg_expression('www_url') . '$#i', $url) || - preg_match('#^' . preg_quote(generate_board_url(), '#') . get_preg_expression('relative_url') . '$#i', $url)) + if (preg_match('#^' . get_preg_expression('url') . '$#iu', $url) || + preg_match('#^' . get_preg_expression('www_url') . '$#iu', $url) || + preg_match('#^' . preg_quote(generate_board_url(), '#') . get_preg_expression('relative_url') . '$#iu', $url)) { $valid = true; } @@ -1049,7 +1114,6 @@ class bbcode_firstpass extends bbcode /** * Main message parser for posting, pm, etc. takes raw message * and parses it for attachments, bbcode and smilies -* @package phpBB3 */ class parse_message extends bbcode_firstpass { @@ -1087,7 +1151,7 @@ class parse_message extends bbcode_firstpass */ function parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post') { - global $config, $db, $user; + global $config, $user, $phpbb_dispatcher, $phpbb_container; $this->mode = $mode; @@ -1116,19 +1180,13 @@ class parse_message extends bbcode_firstpass $this->decode_message(); } - // Do some general 'cleanup' first before processing message, - // e.g. remove excessive newlines(?), smilies(?) - $match = array('#(script|about|applet|activex|chrome):#i'); - $replace = array("\\1:"); - $this->message = preg_replace($match, $replace, trim($this->message)); - // Store message length... $message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)); // Maximum message length check. 0 disables this check completely. if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars']) { - $this->warn_msg[] = $user->lang('TOO_MANY_CHARS_' . strtoupper($mode), $message_length, (int) $config['max_' . $mode . '_chars']); + $this->warn_msg[] = $user->lang('CHARS_' . strtoupper($mode) . '_CONTAINS', $message_length) . '<br />' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); return (!$update_this_message) ? $return_message : $this->warn_msg; } @@ -1137,51 +1195,91 @@ class parse_message extends bbcode_firstpass { if (!$message_length || $message_length < (int) $config['min_post_chars']) { - $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : $user->lang('TOO_FEW_CHARS_LIMIT', $message_length, (int) $config['min_post_chars']); + $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('CHARS_POST_CONTAINS', $message_length) . '<br />' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); return (!$update_this_message) ? $return_message : $this->warn_msg; } } - // Prepare BBcode (just prepares some tags for better parsing) - if ($allow_bbcode && strpos($this->message, '[') !== false) + /** + * This event can be used for additional message checks/cleanup before parsing + * + * @event core.message_parser_check_message + * @var bool allow_bbcode Do we allow BBCodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool allow_img_bbcode Do we allow image BBCode + * @var bool allow_flash_bbcode Do we allow flash BBCode + * @var bool allow_quote_bbcode Do we allow quote BBCode + * @var bool allow_url_bbcode Do we allow url BBCode + * @var bool update_this_message Do we alter the parsed message + * @var string mode Posting mode + * @var string message The message text to parse + * @var string bbcode_bitfield The bbcode_bitfield before parsing + * @var string bbcode_uid The bbcode_uid before parsing + * @var bool return Do we return after the event is triggered if $warn_msg is not empty + * @var array warn_msg Array of the warning messages + * @since 3.1.2-RC1 + * @change 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid + */ + $message = $this->message; + $warn_msg = $this->warn_msg; + $return = false; + $bbcode_bitfield = $this->bbcode_bitfield; + $bbcode_uid = $this->bbcode_uid; + $vars = array( + 'allow_bbcode', + 'allow_magic_url', + 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', + 'update_this_message', + 'mode', + 'message', + 'bbcode_bitfield', + 'bbcode_uid', + 'return', + 'warn_msg', + ); + extract($phpbb_dispatcher->trigger_event('core.message_parser_check_message', compact($vars))); + $this->message = $message; + $this->warn_msg = $warn_msg; + $this->bbcode_bitfield = $bbcode_bitfield; + $this->bbcode_uid = $bbcode_uid; + if ($return && !empty($this->warn_msg)) { - $this->bbcode_init(); - $disallow = array('img', 'flash', 'quote', 'url'); - foreach ($disallow as $bool) - { - if (!${'allow_' . $bool . '_bbcode'}) - { - $this->bbcodes[$bool]['disabled'] = true; - } - } - - $this->prepare_bbcodes(); + return (!$update_this_message) ? $return_message : $this->warn_msg; } - // Parse smilies - if ($allow_smilies) - { - $this->smilies($config['max_' . $mode . '_smilies']); - } + // Get the parser + $parser = $phpbb_container->get('text_formatter.parser'); - $num_urls = 0; + // Set the parser's options + ($allow_bbcode) ? $parser->enable_bbcodes() : $parser->disable_bbcodes(); + ($allow_magic_url) ? $parser->enable_magic_url() : $parser->disable_magic_url(); + ($allow_smilies) ? $parser->enable_smilies() : $parser->disable_smilies(); + ($allow_img_bbcode) ? $parser->enable_bbcode('img') : $parser->disable_bbcode('img'); + ($allow_flash_bbcode) ? $parser->enable_bbcode('flash') : $parser->disable_bbcode('flash'); + ($allow_quote_bbcode) ? $parser->enable_bbcode('quote') : $parser->disable_bbcode('quote'); + ($allow_url_bbcode) ? $parser->enable_bbcode('url') : $parser->disable_bbcode('url'); - // Parse BBCode - if ($allow_bbcode && strpos($this->message, '[') !== false) - { - $this->parse_bbcode(); - $num_urls += $this->parsed_items['url']; - } + // Set some config values + $parser->set_vars(array( + 'max_font_size' => $config['max_' . $this->mode . '_font_size'], + 'max_img_height' => $config['max_' . $this->mode . '_img_height'], + 'max_img_width' => $config['max_' . $this->mode . '_img_width'], + 'max_smilies' => $config['max_' . $this->mode . '_smilies'], + 'max_urls' => $config['max_' . $this->mode . '_urls'] + )); - // Parse URL's - if ($allow_magic_url) - { - $this->magic_url(generate_board_url()); + // Parse this message + $this->message = $parser->parse(htmlspecialchars_decode($this->message, ENT_QUOTES)); - if ($config['max_' . $mode . '_urls']) - { - $num_urls += preg_match_all('#\<!-- ([lmwe]) --\>.*?\<!-- \1 --\>#', $this->message, $matches); - } + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) + { + $this->remove_nested_quotes($config['max_quote_depth']); } // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. @@ -1192,10 +1290,27 @@ class parse_message extends bbcode_firstpass return (!$update_this_message) ? $return_message : $this->warn_msg; } - // Check number of links - if ($config['max_' . $mode . '_urls'] && $num_urls > $config['max_' . $mode . '_urls']) + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) { - $this->warn_msg[] = sprintf($user->lang['TOO_MANY_URLS'], $config['max_' . $mode . '_urls']); + $this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $this->message, + 'quote', + $config['max_quote_depth'] + ); + } + + // Check for errors + $errors = $parser->get_errors(); + if ($errors) + { + foreach ($errors as $i => $args) + { + // Translate each error with $user->lang() + $errors[$i] = call_user_func_array(array($user, 'lang'), $args); + } + $this->warn_msg = array_merge($this->warn_msg, $errors); + return (!$update_this_message) ? $return_message : $this->warn_msg; } @@ -1215,7 +1330,7 @@ class parse_message extends bbcode_firstpass */ function format_display($allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true) { - global $phpbb_dispatcher; + global $phpbb_container, $phpbb_dispatcher; // If false, then the parsed message get returned but internal message not processed. if (!$update_this_message) @@ -1224,26 +1339,48 @@ class parse_message extends bbcode_firstpass $return_message = &$this->message; } - if ($this->message_status == 'plain') + $text = $this->message; + $uid = $this->bbcode_uid; + + /** + * Event to modify the text before it is parsed + * + * @event core.modify_format_display_text_before + * @var string text The message text to parse + * @var string uid The bbcode uid + * @var bool allow_bbcode Do we allow bbcodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool update_this_message Do we update the internal message + * with the parsed result + * @since 3.1.6-RC1 + */ + $vars = array('text', 'uid', 'allow_bbcode', 'allow_magic_url', 'allow_smilies', 'update_this_message'); + extract($phpbb_dispatcher->trigger_event('core.modify_format_display_text_before', compact($vars))); + + $this->message = $text; + $this->bbcode_uid = $uid; + unset($text, $uid); + + // NOTE: message_status is unreliable for detecting unparsed text because some callers + // change $this->message without resetting $this->message_status to 'plain' so we + // inspect the message instead + //if ($this->message_status == 'plain') + if (!preg_match('/^<[rt][ >]/', $this->message)) { // Force updating message - of course. $this->parse($allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_flash_bbcode, $this->allow_quote_bbcode, $this->allow_url_bbcode, true); } - // Replace naughty words such as farty pants - $this->message = censor_text($this->message); - - // Parse BBcode - if ($allow_bbcode) + // There's a bug when previewing a topic with no poll, because the empty title of the poll + // gets parsed but $this->message still ends up empty. This fixes it, until a proper fix is + // devised + if ($this->message === '') { - $this->bbcode_cache_init(); - - // We are giving those parameters to be able to use the bbcode class on its own - $this->bbcode_second_pass($this->message, $this->bbcode_uid); + $this->message = $phpbb_container->get('text_formatter.parser')->parse($this->message); } - $this->message = bbcode_nl2br($this->message); - $this->message = smiley_text($this->message, !$allow_smilies); + $this->message = $phpbb_container->get('text_formatter.renderer')->render($this->message); $text = $this->message; $uid = $this->bbcode_uid; @@ -1331,7 +1468,7 @@ class parse_message extends bbcode_firstpass // NOTE: obtain_* function? chaching the table contents? // For now setting the ttl to 10 minutes - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mssql': case 'mssql_odbc': @@ -1341,12 +1478,6 @@ class parse_message extends bbcode_firstpass ORDER BY LEN(code) DESC'; break; - case 'firebird': - $sql = 'SELECT * - FROM ' . SMILIES_TABLE . ' - ORDER BY CHAR_LENGTH(code) DESC'; - break; - // LENGTH supported by MySQL, IBM DB2, Oracle and Access for sure... default: $sql = 'SELECT * @@ -1400,11 +1531,12 @@ class parse_message extends bbcode_firstpass function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request; + global $phpbb_container; $error = array(); $num_attachments = sizeof($this->attachment_data); - $this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true)); + $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); $upload = $request->file($form_name); $upload_file = (!empty($upload) && $upload['name'] !== 'none' && trim($upload['name'])); @@ -1412,7 +1544,7 @@ class parse_message extends bbcode_firstpass $delete_file = (isset($_POST['delete_file'])) ? true : false; // First of all adjust comments if changed - $actual_comment_list = utf8_normalize_nfc(request_var('comment_list', array(''), true)); + $actual_comment_list = $request->variable('comment_list', array(''), true); foreach ($actual_comment_list as $comment_key => $comment) { @@ -1435,7 +1567,9 @@ class parse_message extends bbcode_firstpass { if ($num_attachments < $cfg['max_attachments'] || $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) { - $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); $error = $filedata['error']; if ($filedata['post_attach'] && !sizeof($error)) @@ -1465,7 +1599,9 @@ class parse_message extends bbcode_firstpass ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); - $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "'[attachment='.(\\1 + 1).']\\2[/attachment]'", $this->message); + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { + return '[attachment='.($match[1] + 1).']' . $match[2] . '[/attachment]'; + }, $this->message); $this->filename_data['filecomment'] = ''; @@ -1498,11 +1634,14 @@ class parse_message extends bbcode_firstpass { include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - $index = array_keys(request_var('delete_file', array(0 => 0))); + $index = array_keys($request->variable('delete_file', array(0 => 0))); $index = (!empty($index)) ? $index[0] : false; if ($index !== false && !empty($this->attachment_data[$index])) { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + // delete selected attachment if ($this->attachment_data[$index]['is_orphan']) { @@ -1517,11 +1656,11 @@ class parse_message extends bbcode_firstpass if ($row) { - phpbb_unlink($row['physical_filename'], 'file'); + $attachment_manager->unlink($row['physical_filename'], 'file'); if ($row['thumbnail']) { - phpbb_unlink($row['physical_filename'], 'thumbnail'); + $attachment_manager->unlink($row['physical_filename'], 'thumbnail'); } $db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']); @@ -1529,11 +1668,13 @@ class parse_message extends bbcode_firstpass } else { - delete_attachments('attach', array(intval($this->attachment_data[$index]['attach_id']))); + $attachment_manager->delete('attach', $this->attachment_data[$index]['attach_id']); } unset($this->attachment_data[$index]); - $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "(\\1 == \$index) ? '' : ((\\1 > \$index) ? '[attachment=' . (\\1 - 1) . ']\\2[/attachment]' : '\\0')", $this->message); + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) use($index) { + return ($match[1] == $index) ? '' : (($match[1] > $index) ? '[attachment=' . ($match[1] - 1) . ']' . $match[2] . '[/attachment]' : $match[0]); + }, $this->message); // Reindex Array $this->attachment_data = array_values($this->attachment_data); @@ -1547,7 +1688,9 @@ class parse_message extends bbcode_firstpass { if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id)) { - $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message, false, $this->plupload); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); $error = array_merge($error, $filedata['error']); if (!sizeof($error)) @@ -1577,7 +1720,9 @@ class parse_message extends bbcode_firstpass ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); - $this->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#e', "'[attachment='.(\\1 + 1).']\\2[/attachment]'", $this->message); + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { + return '[attachment=' . ($match[1] + 1) . ']' . $match[2] . '[/attachment]'; + }, $this->message); $this->filename_data['filecomment'] = ''; if (isset($this->plupload) && $this->plupload->is_active()) @@ -1621,10 +1766,10 @@ class parse_message extends bbcode_firstpass */ function get_submitted_attachment_data($check_user_id = false) { - global $user, $db, $phpbb_root_path, $phpEx, $config; + global $user, $db; global $request; - $this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true)); + $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); $attachment_data = $request->variable('attachment_data', array(0 => array('' => '')), true, \phpbb\request\request_interface::POST); $this->attachment_data = array(); @@ -1709,28 +1854,26 @@ class parse_message extends bbcode_firstpass */ function parse_poll(&$poll) { - global $auth, $user, $config; + global $user, $config; $poll_max_options = $poll['poll_max_options']; - // Parse Poll Option text ;) + // Parse Poll Option text $tmp_message = $this->message; - $this->message = $poll['poll_option_text']; - $bbcode_bitfield = $this->bbcode_bitfield; - $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); + $poll['poll_options'] = explode("\n", trim($poll['poll_option_text'])); + $poll['poll_options_size'] = sizeof($poll['poll_options']); - $bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield)); - $this->message = $tmp_message; + foreach ($poll['poll_options'] as &$poll_option) + { + $this->message = $poll_option; + $poll_option = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); + } + unset($poll_option); + $poll['poll_option_text'] = implode("\n", $poll['poll_options']); // Parse Poll Title - $tmp_message = $this->message; $this->message = $poll['poll_title']; - $this->bbcode_bitfield = $bbcode_bitfield; - - $poll['poll_options'] = explode("\n", trim($poll['poll_option_text'])); - $poll['poll_options_size'] = sizeof($poll['poll_options']); - if (!$poll['poll_title'] && $poll['poll_options_size']) { $this->warn_msg[] = $user->lang['NO_POLL_TITLE']; @@ -1748,10 +1891,6 @@ class parse_message extends bbcode_firstpass } } - $this->bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield)); - $this->message = $tmp_message; - unset($tmp_message); - if (sizeof($poll['poll_options']) == 1) { $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS']; @@ -1766,6 +1905,65 @@ class parse_message extends bbcode_firstpass } $poll['poll_max_options'] = ($poll['poll_max_options'] < 1) ? 1 : (($poll['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll['poll_max_options']); + + $this->message = $tmp_message; + } + + /** + * Remove nested quotes at given depth in current parsed message + * + * @param integer $max_depth Depth limit + * @return null + */ + public function remove_nested_quotes($max_depth) + { + global $phpbb_container; + + if (preg_match('#^<[rt][ >]#', $this->message)) + { + $this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $this->message, + 'quote', + $max_depth + ); + + return; + } + + // Capture all [quote] and [/quote] tags + preg_match_all('(\\[/?quote(?:="(.*?)")?:' . $this->bbcode_uid . '\\])', $this->message, $matches, PREG_OFFSET_CAPTURE); + + // Iterate over the quote tags to mark the ranges that must be removed + $depth = 0; + $ranges = array(); + $start_pos = 0; + foreach ($matches[0] as $match) + { + if ($match[0][1] === '/') + { + --$depth; + if ($depth == $max_depth) + { + $end_pos = $match[1] + strlen($match[0]); + $length = $end_pos - $start_pos; + $ranges[] = array($start_pos, $length); + } + } + else + { + ++$depth; + if ($depth == $max_depth + 1) + { + $start_pos = $match[1]; + } + } + } + + foreach (array_reverse($ranges) as $range) + { + list($start_pos, $length) = $range; + $this->message = substr_replace($this->message, '', $start_pos, $length); + } } /** @@ -1779,4 +1977,36 @@ class parse_message extends bbcode_firstpass { $this->plupload = $plupload; } + + /** + * Function to perform custom bbcode validation by extensions + * can be used in bbcode_init() to assign regexp replacement + * Example: 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->validate_bbcode_by_extension('\$1')") + * + * Accepts variable number of parameters + * + * @return mixed Validation result + */ + public function validate_bbcode_by_extension() + { + global $phpbb_dispatcher; + + $return = false; + $params_array = func_get_args(); + + /** + * Event to validate bbcode with the custom validating methods + * provided by extensions + * + * @event core.validate_bbcode_by_extension + * @var array params_array Array with the function parameters + * @var mixed return Validation result to return + * + * @since 3.1.5-RC1 + */ + $vars = array('params_array', 'return'); + extract($phpbb_dispatcher->trigger_event('core.validate_bbcode_by_extension', compact($vars))); + + return $return; + } } diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 6f2727a38c..60e63eddc4 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -87,7 +91,6 @@ class phpbb_questionnaire_data_collector /** * Questionnaire PHP data provider -* @package phpBB3 */ class phpbb_questionnaire_php_data_provider { @@ -131,7 +134,6 @@ class phpbb_questionnaire_php_data_provider /** * Questionnaire System data provider -* @package phpBB3 */ class phpbb_questionnaire_system_data_provider { @@ -211,7 +213,6 @@ class phpbb_questionnaire_system_data_provider /** * Questionnaire phpBB data provider -* @package phpBB3 */ class phpbb_questionnaire_phpbb_data_provider { @@ -229,7 +230,7 @@ class phpbb_questionnaire_phpbb_data_provider if (empty($config['questionnaire_unique_id'])) { $this->unique_id = unique_id(); - set_config('questionnaire_unique_id', $this->unique_id); + $config->set('questionnaire_unique_id', $this->unique_id); } else { @@ -256,11 +257,12 @@ class phpbb_questionnaire_phpbb_data_provider */ function get_data() { - global $phpbb_root_path, $phpEx; - include("{$phpbb_root_path}config.$phpEx"); + global $phpbb_config_php_file; + + extract($phpbb_config_php_file->get_all()); unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution - $dbms = phpbb_convert_30_dbms_to_31($dbms); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); // Only send certain config vars $config_vars = array( diff --git a/phpBB/includes/sphinxapi.php b/phpBB/includes/sphinxapi.php index 6c3b66710c..5e1f131ac2 100644 --- a/phpBB/includes/sphinxapi.php +++ b/phpBB/includes/sphinxapi.php @@ -1659,7 +1659,6 @@ class SphinxClient return false; } - $res = substr ( $response, 4 ); // just ignore length, error handling, etc $p = 0; list ( $rows, $cols ) = array_values ( unpack ( "N*N*", substr ( $response, $p, 8 ) ) ); $p += 8; diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index 441eaec6b1..5900016c39 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,10 +19,6 @@ if (!defined('IN_PHPBB')) } // Report all errors, except notices and deprecation messages -if (!defined('E_DEPRECATED')) -{ - define('E_DEPRECATED', 8192); -} $level = E_ALL & ~E_NOTICE & ~E_DEPRECATED; error_reporting($level); @@ -65,31 +65,13 @@ function deregister_globals() { if (isset($not_unset[$varname])) { - // Hacking attempt. No point in continuing unless it's a COOKIE (so a cookie called GLOBALS doesn't lock users out completely) - if ($varname !== 'GLOBALS' || isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS'])) - { - exit; - } - else + // Hacking attempt. No point in continuing. + if (isset($_COOKIE[$varname])) { - $cookie = &$_COOKIE; - while (isset($cookie['GLOBALS'])) - { - if (!is_array($cookie['GLOBALS'])) - { - break; - } - - foreach ($cookie['GLOBALS'] as $registered_var => $value) - { - if (!isset($not_unset[$registered_var])) - { - unset($GLOBALS[$registered_var]); - } - } - $cookie = &$cookie['GLOBALS']; - } + echo "Clear your cookies. "; } + echo "Malicious variable name detected. Contact the administrator and ask them to disable register_globals."; + exit; } unset($GLOBALS[$varname]); @@ -108,7 +90,11 @@ if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) } else { - @set_magic_quotes_runtime(0); + if (get_magic_quotes_runtime()) + { + // Deactivate + @set_magic_quotes_runtime(0); + } // Be paranoid with passed vars if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on' || !function_exists('ini_get')) @@ -119,33 +105,21 @@ else define('STRIP', (get_magic_quotes_gpc()) ? true : false); } -// Prevent date/time functions from throwing E_WARNING on PHP 5.3 by setting a default timezone -if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) -{ - // For PHP 5.1.0 the date/time functions have been rewritten - // and setting a timezone is required prior to calling any date/time function. - - // Since PHP 5.2.0 calls to date/time functions without having a timezone set - // result in E_STRICT errors being thrown. - // Note: We already exclude E_STRICT errors - // (to be exact: they are not included in E_ALL in PHP 5.2) - - // In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems - // because we show E_WARNING errors and do not set a default timezone. - // This is because we have our own timezone handling and work in UTC only anyway. +// In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems +// because we show E_WARNING errors and do not set a default timezone. +// This is because we have our own timezone handling and work in UTC only anyway. - // So what we basically want to do is set our timezone to UTC, - // but we don't know what other scripts (such as bridges) are involved, - // so we check whether a timezone is already set by calling date_default_timezone_get(). +// So what we basically want to do is set our timezone to UTC, +// but we don't know what other scripts (such as bridges) are involved, +// so we check whether a timezone is already set by calling date_default_timezone_get(). - // Unfortunately, date_default_timezone_get() itself might throw E_WARNING - // if no timezone has been set, so we have to keep it quiet with @. +// Unfortunately, date_default_timezone_get() itself might throw E_WARNING +// if no timezone has been set, so we have to keep it quiet with @. - // date_default_timezone_get() tries to guess the correct timezone first - // and then falls back to UTC when everything fails. - // We just set the timezone to whatever date_default_timezone_get() returns. - date_default_timezone_set(@date_default_timezone_get()); -} +// date_default_timezone_get() tries to guess the correct timezone first +// and then falls back to UTC when everything fails. +// We just set the timezone to whatever date_default_timezone_get() returns. +date_default_timezone_set(@date_default_timezone_get()); // Autoloading of dependencies. // Three options are supported: @@ -173,10 +147,13 @@ else { if (!file_exists($phpbb_root_path . 'vendor/autoload.php')) { - trigger_error('You have not set up composer dependencies. See http://getcomposer.org/.', E_USER_ERROR); + trigger_error( + 'Composer dependencies have not been set up yet, run ' . + "'php ../composer.phar install' from the phpBB directory to do so.", + E_USER_ERROR + ); } require($phpbb_root_path . 'vendor/autoload.php'); } -$starttime = explode(' ', microtime()); -$starttime = $starttime[1] + $starttime[0]; +$starttime = microtime(true); diff --git a/phpBB/includes/ucp/info/ucp_attachments.php b/phpBB/includes/ucp/info/ucp_attachments.php index adc7b92920..96e7956db9 100644 --- a/phpBB/includes/ucp/info/ucp_attachments.php +++ b/phpBB/includes/ucp/info/ucp_attachments.php @@ -1,15 +1,16 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_attachments_info { function module() @@ -17,7 +18,6 @@ class ucp_attachments_info return array( 'filename' => 'ucp_attachments', 'title' => 'UCP_ATTACHMENTS', - 'version' => '1.0.0', 'modes' => array( 'attachments' => array('title' => 'UCP_MAIN_ATTACHMENTS', 'auth' => 'acl_u_attach', 'cat' => array('UCP_MAIN')), ), diff --git a/phpBB/includes/ucp/info/ucp_auth_link.php b/phpBB/includes/ucp/info/ucp_auth_link.php index ee88b15ea8..57c9269c5e 100644 --- a/phpBB/includes/ucp/info/ucp_auth_link.php +++ b/phpBB/includes/ucp/info/ucp_auth_link.php @@ -1,15 +1,16 @@ <?php /** * -* @package ucp -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_auth_link_info { function module() @@ -17,9 +18,8 @@ class ucp_auth_link_info return array( 'filename' => 'ucp_auth_link', 'title' => 'UCP_AUTH_LINK', - 'version' => '1.0.0', 'modes' => array( - 'auth_link' => array('title' => 'UCP_AUTH_LINK_MANAGE', 'auth' => '', 'cat' => array('UCP_PROFILE')), + 'auth_link' => array('title' => 'UCP_AUTH_LINK_MANAGE', 'auth' => 'authmethod_oauth', 'cat' => array('UCP_PROFILE')), ), ); } diff --git a/phpBB/includes/ucp/info/ucp_groups.php b/phpBB/includes/ucp/info/ucp_groups.php index b7ffcd0971..42eb285075 100644 --- a/phpBB/includes/ucp/info/ucp_groups.php +++ b/phpBB/includes/ucp/info/ucp_groups.php @@ -1,15 +1,16 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_groups_info { function module() @@ -17,7 +18,6 @@ class ucp_groups_info return array( 'filename' => 'ucp_groups', 'title' => 'UCP_USERGROUPS', - 'version' => '1.0.0', 'modes' => array( 'membership' => array('title' => 'UCP_USERGROUPS_MEMBER', 'auth' => '', 'cat' => array('UCP_USERGROUPS')), 'manage' => array('title' => 'UCP_USERGROUPS_MANAGE', 'auth' => '', 'cat' => array('UCP_USERGROUPS')), diff --git a/phpBB/includes/ucp/info/ucp_main.php b/phpBB/includes/ucp/info/ucp_main.php index e40a0cc1c5..e967b8445f 100644 --- a/phpBB/includes/ucp/info/ucp_main.php +++ b/phpBB/includes/ucp/info/ucp_main.php @@ -1,15 +1,16 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_main_info { function module() @@ -17,7 +18,6 @@ class ucp_main_info return array( 'filename' => 'ucp_main', 'title' => 'UCP_MAIN', - 'version' => '1.0.0', 'modes' => array( 'front' => array('title' => 'UCP_MAIN_FRONT', 'auth' => '', 'cat' => array('UCP_MAIN')), 'subscribed' => array('title' => 'UCP_MAIN_SUBSCRIBED', 'auth' => '', 'cat' => array('UCP_MAIN')), diff --git a/phpBB/includes/ucp/info/ucp_notifications.php b/phpBB/includes/ucp/info/ucp_notifications.php index 98d8b9db61..94e0467ccb 100644 --- a/phpBB/includes/ucp/info/ucp_notifications.php +++ b/phpBB/includes/ucp/info/ucp_notifications.php @@ -1,15 +1,16 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_notifications_info { function module() @@ -17,10 +18,9 @@ class ucp_notifications_info return array( 'filename' => 'ucp_notifications', 'title' => 'UCP_NOTIFICATION_OPTIONS', - 'version' => '1.0.0', 'modes' => array( 'notification_options' => array('title' => 'UCP_NOTIFICATION_OPTIONS', 'auth' => '', 'cat' => array('UCP_PREFS')), - 'notification_list' => array('title' => 'UCP_NOTIFICATION_LIST', 'auth' => '', 'cat' => array('UCP_MAIN')), + 'notification_list' => array('title' => 'UCP_NOTIFICATION_LIST', 'auth' => 'cfg_allow_board_notifications', 'cat' => array('UCP_MAIN')), ), ); } diff --git a/phpBB/includes/ucp/info/ucp_pm.php b/phpBB/includes/ucp/info/ucp_pm.php index a80de21999..26bd670fc5 100644 --- a/phpBB/includes/ucp/info/ucp_pm.php +++ b/phpBB/includes/ucp/info/ucp_pm.php @@ -1,14 +1,16 @@ <?php /** -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_pm_info { function module() @@ -16,7 +18,6 @@ class ucp_pm_info return array( 'filename' => 'ucp_pm', 'title' => 'UCP_PM', - 'version' => '1.0.0', 'modes' => array( 'view' => array('title' => 'UCP_PM_VIEW', 'auth' => 'cfg_allow_privmsg', 'display' => false, 'cat' => array('UCP_PM')), 'compose' => array('title' => 'UCP_PM_COMPOSE', 'auth' => 'cfg_allow_privmsg', 'cat' => array('UCP_PM')), diff --git a/phpBB/includes/ucp/info/ucp_prefs.php b/phpBB/includes/ucp/info/ucp_prefs.php index 91fbd7a14c..4793aa2649 100644 --- a/phpBB/includes/ucp/info/ucp_prefs.php +++ b/phpBB/includes/ucp/info/ucp_prefs.php @@ -1,15 +1,16 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_prefs_info { function module() @@ -17,7 +18,6 @@ class ucp_prefs_info return array( 'filename' => 'ucp_prefs', 'title' => 'UCP_PREFS', - 'version' => '1.0.0', 'modes' => array( 'personal' => array('title' => 'UCP_PREFS_PERSONAL', 'auth' => '', 'cat' => array('UCP_PREFS')), 'post' => array('title' => 'UCP_PREFS_POST', 'auth' => '', 'cat' => array('UCP_PREFS')), diff --git a/phpBB/includes/ucp/info/ucp_profile.php b/phpBB/includes/ucp/info/ucp_profile.php index e974cea713..fc2792224d 100644 --- a/phpBB/includes/ucp/info/ucp_profile.php +++ b/phpBB/includes/ucp/info/ucp_profile.php @@ -1,15 +1,16 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_profile_info { function module() @@ -17,7 +18,6 @@ class ucp_profile_info return array( 'filename' => 'ucp_profile', 'title' => 'UCP_PROFILE', - 'version' => '1.0.0', 'modes' => array( 'profile_info' => array('title' => 'UCP_PROFILE_PROFILE_INFO', 'auth' => 'acl_u_chgprofileinfo', 'cat' => array('UCP_PROFILE')), 'signature' => array('title' => 'UCP_PROFILE_SIGNATURE', 'auth' => 'acl_u_sig', 'cat' => array('UCP_PROFILE')), diff --git a/phpBB/includes/ucp/info/ucp_zebra.php b/phpBB/includes/ucp/info/ucp_zebra.php index db57102aae..69274c2866 100644 --- a/phpBB/includes/ucp/info/ucp_zebra.php +++ b/phpBB/includes/ucp/info/ucp_zebra.php @@ -1,15 +1,16 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class ucp_zebra_info { function module() @@ -17,7 +18,6 @@ class ucp_zebra_info return array( 'filename' => 'ucp_zebra', 'title' => 'UCP_ZEBRA', - 'version' => '1.0.0', 'modes' => array( 'friends' => array('title' => 'UCP_ZEBRA_FRIENDS', 'auth' => '', 'cat' => array('UCP_ZEBRA')), 'foes' => array('title' => 'UCP_ZEBRA_FOES', 'auth' => '', 'cat' => array('UCP_ZEBRA')), diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index 2a94acbe02..00044340df 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * ucp_activate * User activation -* @package ucp */ class ucp_activate { @@ -26,11 +29,11 @@ class ucp_activate function main($id, $mode) { - global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template, $phpbb_container; + global $config, $phpbb_root_path, $phpEx, $request; + global $db, $user, $auth, $phpbb_container, $phpbb_log, $phpbb_dispatcher; - $user_id = request_var('u', 0); - $key = request_var('k', ''); + $user_id = $request->variable('u', 0); + $key = $request->variable('k', ''); $sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason FROM ' . USERS_TABLE . " @@ -75,7 +78,6 @@ class ucp_activate 'user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => '', - 'user_pass_convert' => 0, 'user_login_attempts' => 0, ); @@ -84,7 +86,10 @@ class ucp_activate WHERE user_id = ' . $user_row['user_id']; $db->sql_query($sql); - add_log('user', $user_row['user_id'], 'LOG_USER_NEW_PASSWORD', $user_row['username']); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( + 'reportee_id' => $user_row['user_id'], + $user_row['username'] + )); } if (!$update_password) @@ -99,17 +104,21 @@ class ucp_activate $db->sql_query($sql); // Create the correct logs - add_log('user', $user_row['user_id'], 'LOG_USER_ACTIVE_USER'); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE_USER', false, array( + 'reportee_id' => $user_row['user_id'] + )); + if ($auth->acl_get('a_user')) { - add_log('admin', 'LOG_USER_ACTIVE', $user_row['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE', false, array($user_row['username'])); } } if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) { + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); @@ -141,6 +150,17 @@ class ucp_activate } } + /** + * This event can be used to modify data after user account's activation + * + * @event core.ucp_activate_after + * @var array user_row Array with some user data + * @var string message Language string of the message that will be displayed to the user + * @since 3.1.6-RC1 + */ + $vars = array('user_row', 'message'); + extract($phpbb_dispatcher->trigger_event('core.ucp_activate_after', compact($vars))); + meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); trigger_error($user->lang[$message]); } diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index 6a5b48a181..66c3109b3d 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * ucp_attachments * User attachments -* @package ucp */ class ucp_attachments { @@ -26,15 +29,14 @@ class ucp_attachments function main($id, $mode) { - global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container; + global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container, $request; - $start = request_var('start', 0); - $sort_key = request_var('sk', 'a'); - $sort_dir = request_var('sd', 'a'); + $start = $request->variable('start', 0); + $sort_key = $request->variable('sk', 'a'); + $sort_dir = $request->variable('sd', 'a'); $delete = (isset($_POST['delete'])) ? true : false; - $confirm = (isset($_POST['confirm'])) ? true : false; - $delete_ids = array_keys(request_var('attachment', array(0))); + $delete_ids = array_keys($request->variable('attachment', array(0))); if ($delete && sizeof($delete_ids)) { @@ -67,12 +69,10 @@ class ucp_attachments if (confirm_box(true)) { - if (!function_exists('delete_attachments')) - { - include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - } - - delete_attachments('attach', $delete_ids); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', $delete_ids); + unset($attachment_manager); meta_refresh(3, $this->u_action); $message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); @@ -120,6 +120,7 @@ class ucp_attachments $db->sql_freeresult($result); // Ensure start is a valid value + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); $start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments); @@ -179,6 +180,7 @@ class ucp_attachments $template->assign_vars(array( 'TOTAL_ATTACHMENTS' => $num_attachments, + 'NUM_ATTACHMENTS' => $user->lang('NUM_ATTACHMENTS', $num_attachments), 'L_TITLE' => $user->lang['UCP_ATTACHMENTS'], diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php index b86c4c8d52..08aacdef3a 100644 --- a/phpBB/includes/ucp/ucp_auth_link.php +++ b/phpBB/includes/ucp/ucp_auth_link.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -30,11 +34,13 @@ class ucp_auth_link */ public function main($id, $mode) { - global $config, $request, $template, $phpbb_container, $user; + global $request, $template, $phpbb_container, $user; $error = array(); - $auth_provider = $phpbb_container->get('auth.provider.' . $config['auth_method']); + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider(); // confirm that the auth provider supports this page $provider_data = $auth_provider->get_auth_link_data(); diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index aafb92d8e4..cdf4de65fd 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -1,9 +1,13 @@ <?php /** * -* @package VC -* @copyright (c) 2005 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -25,8 +29,6 @@ if (!defined('IN_PHPBB')) * to that licence. Do not incorporate this within software * released or distributed in any way under a licence other * than the GPL. We will be watching ... ;) -* -* @package VC */ class ucp_confirm { @@ -34,11 +36,10 @@ class ucp_confirm function main($id, $mode) { - global $db, $user, $phpbb_root_path, $config, $phpEx; + global $config, $phpbb_container, $request; - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); - $captcha->init(request_var('type', 0)); + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init($request->variable('type', 0)); $captcha->execute(); garbage_collection(); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 373d9433b2..1273ea9723 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * ucp_groups -* @package ucp */ class ucp_groups { @@ -27,16 +30,17 @@ class ucp_groups { global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path; global $db, $user, $auth, $cache, $template; - global $request, $phpbb_container; + global $request, $phpbb_container, $phpbb_log; $user->add_lang('groups'); $return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>'); - $mark_ary = request_var('mark', array(0)); + $mark_ary = $request->variable('mark', array(0)); $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); - $delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST); - $error = $data = array(); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); switch ($mode) { @@ -46,8 +50,8 @@ class ucp_groups if ($submit || isset($_POST['change_default'])) { - $action = (isset($_POST['change_default'])) ? 'change_default' : request_var('action', ''); - $group_id = ($action == 'change_default') ? request_var('default', 0) : request_var('selected', 0); + $action = (isset($_POST['change_default'])) ? 'change_default' : $request->variable('action', ''); + $group_id = ($action == 'change_default') ? $request->variable('default', 0) : $request->variable('selected', 0); if (!$group_id) { @@ -62,7 +66,7 @@ class ucp_groups $group_row = array(); while ($row = $db->sql_fetchrow($result)) { - $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $row['group_name'] = $group_helper->get_name($row['group_name']); $group_row[$row['group_id']] = $row; } $db->sql_freeresult($result); @@ -96,7 +100,10 @@ class ucp_groups { group_user_attributes('default', $group_id, $user->data['user_id']); - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_CHANGE', sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_CHANGE', false, array( + 'reportee_id' => $user->data['user_id'], + sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name']) + )); meta_refresh(3, $this->u_action); trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page); @@ -143,7 +150,10 @@ class ucp_groups { group_user_del($group_id, $user->data['user_id']); - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_RESIGN', $group_row[$group_id]['group_name']); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_RESIGN', false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); meta_refresh(3, $this->u_action); trigger_error($user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page); @@ -199,7 +209,10 @@ class ucp_groups group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1); } - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); meta_refresh(3, $this->u_action); trigger_error($user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page); @@ -234,7 +247,10 @@ class ucp_groups { group_user_attributes('demote', $group_id, $user->data['user_id']); - add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_DEMOTE', $group_row[$group_id]['group_name']); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_DEMOTE', false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); meta_refresh(3, $this->u_action); trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page); @@ -292,7 +308,7 @@ class ucp_groups $template->assign_block_vars($block, array( 'GROUP_ID' => $row['group_id'], - 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], @@ -346,7 +362,7 @@ class ucp_groups $template->assign_block_vars('nonmember', array( 'GROUP_ID' => $row['group_id'], - 'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, 'GROUP_CLOSED' => ($row['group_type'] <> GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? false : true, @@ -376,8 +392,8 @@ class ucp_groups case 'manage': $this->page_title = 'UCP_USERGROUPS_MANAGE'; - $action = (isset($_POST['addusers'])) ? 'addusers' : request_var('action', ''); - $group_id = request_var('g', 0); + $action = (isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', ''); + $group_id = $request->variable('g', 0); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); @@ -411,7 +427,7 @@ class ucp_groups $avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true); $template->assign_vars(array( - 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name, + 'GROUP_NAME' => $group_helper->get_name($group_name), 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', 'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), @@ -444,11 +460,8 @@ class ucp_groups trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } - $file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false; $user->add_lang(array('acp/groups', 'acp/common')); - $data = $submit_ary = array(); - $update = (isset($_POST['update'])) ? true : false; $error = array(); @@ -461,6 +474,7 @@ class ucp_groups if ($config['allow_avatar']) { + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); @@ -468,23 +482,46 @@ class ucp_groups $avatar_data = \phpbb\avatar\manager::clean_row($group_row, 'group'); } + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (confirm_box(true)) + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, GROUPS_TABLE, 'group_'); + $cache->destroy('sql', GROUPS_TABLE); + + $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; + trigger_error($user->lang[$message] . $return_page); + } + else + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode, + 'g' => $group_id, + 'action' => $action)) + ); + } + } + // Did we submit? if ($update) { - $group_name = utf8_normalize_nfc(request_var('group_name', '', true)); - $group_desc = utf8_normalize_nfc(request_var('group_desc', '', true)); - $group_type = request_var('group_type', GROUP_FREE); + $group_name = $request->variable('group_name', '', true); + $group_desc = $request->variable('group_desc', '', true); + $group_type = $request->variable('group_type', GROUP_FREE); - $allow_desc_bbcode = request_var('desc_parse_bbcode', false); - $allow_desc_urls = request_var('desc_parse_urls', false); - $allow_desc_smilies = request_var('desc_parse_smilies', false); + $allow_desc_bbcode = $request->variable('desc_parse_bbcode', false); + $allow_desc_urls = $request->variable('desc_parse_urls', false); + $allow_desc_smilies = $request->variable('desc_parse_smilies', false); $submit_ary = array( - 'colour' => request_var('group_colour', ''), - 'rank' => request_var('group_rank', 0), + 'colour' => $request->variable('group_colour', ''), + 'rank' => $request->variable('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, - 'message_limit' => request_var('group_message_limit', 0), - 'max_recipients'=> request_var('group_max_recipients', 0), + 'message_limit' => $request->variable('group_message_limit', 0), + 'max_recipients'=> $request->variable('group_max_recipients', 0), 'legend' => $group_row['group_legend'], 'teampage' => $group_row['group_teampage'], ); @@ -493,7 +530,6 @@ class ucp_groups { // Handle avatar $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); - $config_name = preg_replace('#^avatar\.driver.#', '', $driver_name); if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) { @@ -507,19 +543,6 @@ class ucp_groups $submit_ary = array_merge($submit_ary, $result); } } - else - { - if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type'])) - { - $driver->delete($avatar_data); - } - - // Removing the avatar - $submit_ary['avatar_type'] = ''; - $submit_ary['avatar'] = ''; - $submit_ary['avatar_width'] = 0; - $submit_ary['avatar_height'] = 0; - } // Merge any avatars errors into the primary error array $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error)); @@ -595,7 +618,6 @@ class ucp_groups } else if (!$group_id) { - $group_name = utf8_normalize_nfc(request_var('group_name', '', true)); $group_desc_data = array( 'text' => '', 'allow_bbcode' => true, @@ -724,7 +746,7 @@ class ucp_groups } $user->add_lang(array('acp/groups', 'acp/common')); - $start = request_var('start', 0); + $start = $request->variable('start', 0); // Grab the leaders - always, on every page... $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending @@ -813,6 +835,7 @@ class ucp_groups $s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>'; } + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); $base_url = $this->u_action . "&action=$action&g=$group_id"; $start = $pagination->validate_start($start, $config['topics_per_page'], $total_members); @@ -874,7 +897,7 @@ class ucp_groups trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } - $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_row['group_name'] = $group_helper->get_name($group_row['group_name']); if (confirm_box(true)) { @@ -953,7 +976,7 @@ class ucp_groups trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); } - $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_row['group_name'] = $group_helper->get_name($group_row['group_name']); if (confirm_box(true)) { @@ -991,7 +1014,7 @@ class ucp_groups $user->add_lang(array('acp/groups', 'acp/common')); - $names = utf8_normalize_nfc(request_var('usernames', '', true)); + $names = $request->variable('usernames', '', true); if (!$group_id) { @@ -1015,9 +1038,9 @@ class ucp_groups } $name_ary = array_unique(explode("\n", $names)); - $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; + $group_name = $group_helper->get_name($group_row['group_name']); - $default = request_var('default', 0); + $default = $request->variable('default', 0); if (confirm_box(true)) { @@ -1061,7 +1084,7 @@ class ucp_groups while ($value = $db->sql_fetchrow($result)) { $template->assign_block_vars('leader', array( - 'GROUP_NAME' => ($value['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $value['group_name']] : $value['group_name'], + 'GROUP_NAME' => $group_helper->get_name($value['group_name']), 'GROUP_DESC' => generate_text_for_display($value['group_desc'], $value['group_desc_uid'], $value['group_desc_bitfield'], $value['group_desc_options']), 'GROUP_TYPE' => $value['group_type'], 'GROUP_ID' => $value['group_id'], diff --git a/phpBB/includes/ucp/ucp_login_link.php b/phpBB/includes/ucp/ucp_login_link.php index 80a553953d..f4d47e30bb 100644 --- a/phpBB/includes/ucp/ucp_login_link.php +++ b/phpBB/includes/ucp/ucp_login_link.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,7 +23,6 @@ if (!defined('IN_PHPBB')) * ucp_login_link * Allows users of external accounts link those accounts to their phpBB accounts * during an attempted login. -* @package ucp */ class ucp_login_link { @@ -36,7 +39,7 @@ class ucp_login_link */ function main($id, $mode) { - global $config, $phpbb_container, $request, $template, $user; + global $phpbb_container, $request, $template, $user; global $phpbb_root_path, $phpEx; // Initialize necessary variables @@ -54,8 +57,9 @@ class ucp_login_link } // Use the auth_provider requested even if different from configured - $auth_provider = 'auth.provider.' . $request->variable('auth_provider', $config['auth_method']); - $auth_provider = $phpbb_container->get($auth_provider); + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider($request->variable('auth_provider', '')); // Set the link_method to login_link $data['link_method'] = 'login_link'; @@ -72,7 +76,7 @@ class ucp_login_link { if ($request->is_set_post('login')) { - $login_username = $request->variable('login_username', '', false, \phpbb\request\request_interface::POST); + $login_username = $request->variable('login_username', '', true, \phpbb\request\request_interface::POST); $login_password = $request->untrimmed_variable('login_password', '', true, \phpbb\request\request_interface::POST); $login_result = $auth_provider->login($login_username, $login_password); @@ -95,7 +99,7 @@ class ucp_login_link else { // Finish login - $result = $user->session_create($login_result['user_row']['user_id'], false, false, true); + $user->session_create($login_result['user_row']['user_id'], false, false, true); // Perform a redirect as the account has been linked $this->perform_redirect(); @@ -178,7 +182,7 @@ class ucp_login_link */ protected function process_login_result($result) { - global $config, $request, $template, $user; + global $config, $template, $user, $phpbb_container; $login_error = null; @@ -194,7 +198,7 @@ class ucp_login_link { case LOGIN_ERROR_ATTEMPTS: - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); $template->assign_vars(array( diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 3ccf3e3545..217d46b767 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * ucp_main * UCP Front Panel -* @package ucp */ class ucp_main { @@ -78,7 +81,7 @@ class ucp_main FROM $sql_from WHERE t.topic_type = " . POST_GLOBAL . ' AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . ' - ORDER BY t.topic_last_post_time DESC'; + ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -189,7 +192,7 @@ class ucp_main $template->assign_vars(array( 'USER_COLOR' => (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '', 'JOINED' => $user->format_date($user->data['user_regdate']), - 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit), + 'LAST_ACTIVE' => (empty($last_active)) ? ' - ' : $user->format_date($last_active), 'WARNINGS' => ($user->data['user_warnings']) ? $user->data['user_warnings'] : 0, 'POSTS' => ($user->data['user_posts']) ? $user->data['user_posts'] : 0, 'POSTS_DAY' => $user->lang('POST_DAY', $posts_per_day), @@ -216,9 +219,8 @@ class ucp_main { if (check_form_key('ucp_front_subscribed')) { - $forums = array_keys(request_var('f', array(0 => 0))); - $topics = array_keys(request_var('t', array(0 => 0))); - $msg = ''; + $forums = array_keys($request->variable('f', array(0 => 0))); + $topics = array_keys($request->variable('t', array(0 => 0))); if (sizeof($forums) || sizeof($topics)) { @@ -354,6 +356,8 @@ class ucp_main 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'S_UNREAD_FORUM' => $unread_forum, + 'U_LAST_POST' => $last_post_url, 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id'])) ); @@ -396,7 +400,7 @@ class ucp_main if (isset($_POST['unbookmark'])) { $s_hidden_fields = array('unbookmark' => 1); - $topics = (isset($_POST['t'])) ? array_keys(request_var('t', array(0 => 0))) : array(); + $topics = (isset($_POST['t'])) ? array_keys($request->variable('t', array(0 => 0))) : array(); $url = $this->u_action; if (!sizeof($topics)) @@ -452,7 +456,7 @@ class ucp_main { if (check_form_key('ucp_draft')) { - $drafts = array_keys(request_var('d', array(0 => 0))); + $drafts = array_keys($request->variable('d', array(0 => 0))); if (sizeof($drafts)) { @@ -475,8 +479,8 @@ class ucp_main if ($submit && $edit) { - $draft_subject = utf8_normalize_nfc(request_var('subject', '', true)); - $draft_message = utf8_normalize_nfc(request_var('message', '', true)); + $draft_subject = $request->variable('subject', '', true); + $draft_message = $request->variable('message', '', true); if (check_form_key('ucp_draft')) { if ($draft_message && $draft_subject) @@ -617,7 +621,6 @@ class ucp_main break; } - $template->assign_vars(array( 'L_TITLE' => $user->lang['UCP_MAIN_' . strtoupper($mode)], @@ -639,11 +642,12 @@ class ucp_main */ function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array()) { - global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx, $phpbb_container; + global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx, $phpbb_container, $request; - $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; - $start = request_var('start', 0); + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); + $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE; + $start = $request->variable('start', 0); // Grab icons $icons = $cache->obtain_icons(); @@ -689,8 +693,7 @@ class ucp_main AND t.topic_id = tw.topic_id AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), - - 'ORDER_BY' => 't.topic_last_post_time DESC' + 'ORDER_BY' => 't.topic_last_post_time DESC, t.topic_last_post_id DESC' ); $sql_array['LEFT_JOIN'] = array(); @@ -707,7 +710,7 @@ class ucp_main 'WHERE' => 'b.user_id = ' . $user->data['user_id'] . ' AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true), - 'ORDER_BY' => 't.topic_last_post_time DESC' + 'ORDER_BY' => 't.topic_last_post_time DESC, t.topic_last_post_id DESC' ); $sql_array['LEFT_JOIN'] = array(); @@ -766,6 +769,7 @@ class ucp_main } } + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); foreach ($topic_list as $topic_id) diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 7c487b9073..51bd77bd4c 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -30,7 +34,10 @@ class ucp_notifications $form_time = $request->variable('form_time', 0); $form_time = ($form_time <= 0 || $form_time > time()) ? time() : $form_time; + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); switch ($mode) @@ -48,30 +55,21 @@ class ucp_notifications $notification_methods = $phpbb_notifications->get_subscription_methods(); - foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types) + foreach ($phpbb_notifications->get_subscription_types() as $group => $subscription_types) { - foreach($subscription_types as $type => $data) + foreach ($subscription_types as $type => $data) { - foreach($notification_methods as $method => $method_data) + foreach ($notification_methods as $method => $method_data) { - if ($request->is_set_post($type . '_' . $method_data['id']) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type]))) + if ($request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type]))) { $phpbb_notifications->add_subscription($type, 0, $method_data['id']); } - else if (!$request->is_set_post($type . '_' . $method_data['id']) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type])) + else if (!$request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type])) { $phpbb_notifications->delete_subscription($type, 0, $method_data['id']); } } - - if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type])) - { - $phpbb_notifications->add_subscription($type); - } - else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type])) - { - $phpbb_notifications->delete_subscription($type); - } } } @@ -91,35 +89,25 @@ class ucp_notifications case 'notification_list': default: // Mark all items read - if ($request->variable('mark', '') == 'all' && (confirm_box(true) || check_link_hash($request->variable('token', ''), 'mark_all_notifications_read'))) + if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_notifications_read')) { - if (confirm_box(true)) - { - $phpbb_notifications->mark_notifications_read(false, false, $user->data['user_id'], $form_time); + $phpbb_notifications->mark_notifications(false, false, $user->data['user_id'], $form_time); - meta_refresh(3, $this->u_action); - $message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS']; - - if ($request->is_ajax()) - { - $json_response = new \phpbb\json_response(); - $json_response->send(array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, - 'success' => true, - )); - } - $message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); + meta_refresh(3, $this->u_action); + $message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS']; - trigger_error($message); - } - else + if ($request->is_ajax()) { - confirm_box(false, 'NOTIFICATIONS_MARK_ALL_READ', build_hidden_fields(array( - 'mark' => 'all', - 'form_time' => $form_time, - ))); + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'success' => true, + )); } + $message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); + + trigger_error($message); } // Mark specific notifications read @@ -134,11 +122,11 @@ class ucp_notifications if (!empty($mark_read)) { - $phpbb_notifications->mark_notifications_read_by_id($mark_read, $form_time); + $phpbb_notifications->mark_notifications_by_id('notification.method.board', $mark_read, $form_time); } } - $notifications = $phpbb_notifications->load_notifications(array( + $notifications = $phpbb_notifications->load_notifications('notification.method.board', array( 'start' => $start, 'limit' => $config['topics_per_page'], 'count_total' => true, @@ -186,24 +174,22 @@ class ucp_notifications { $notification_methods = $phpbb_notifications->get_subscription_methods(); - foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types) + foreach ($phpbb_notifications->get_subscription_types() as $group => $subscription_types) { $template->assign_block_vars($block, array( 'GROUP_NAME' => $user->lang($group), )); - foreach($subscription_types as $type => $data) + foreach ($subscription_types as $type => $data) { $template->assign_block_vars($block, array( 'TYPE' => $type, 'NAME' => $user->lang($data['lang']), 'EXPLAIN' => (isset($user->lang[$data['lang'] . '_EXPLAIN'])) ? $user->lang($data['lang'] . '_EXPLAIN') : '', - - 'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false, )); - foreach($notification_methods as $method => $method_data) + foreach ($notification_methods as $method => $method_data) { $template->assign_block_vars($block . '.notification_methods', array( 'METHOD' => $method_data['id'], @@ -233,7 +219,7 @@ class ucp_notifications { $notification_methods = $phpbb_notifications->get_subscription_methods(); - foreach($notification_methods as $method => $method_data) + foreach ($notification_methods as $method => $method_data) { $template->assign_block_vars($block, array( 'METHOD' => $method_data['id'], diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index 517ae0b08c..33dff97fe6 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -1,8 +1,13 @@ <?php /** -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -33,8 +38,6 @@ if (!defined('IN_PHPBB')) * Quoting a post (action=quotepost&p=[post_id]) * Quoting a PM (action=quote&p=[msg_id]) * Forwarding a PM (action=forward&p=[msg_id]) -* -* @package ucp */ class ucp_pm { @@ -42,7 +45,7 @@ class ucp_pm function main($id, $mode) { - global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config; + global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config, $request; if (!$user->data['is_registered']) { @@ -59,7 +62,7 @@ class ucp_pm $template->assign_var('S_PRIVMSGS', true); // Folder directly specified? - $folder_specified = request_var('folder', ''); + $folder_specified = $request->variable('folder', ''); if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) { @@ -72,7 +75,7 @@ class ucp_pm if (!$folder_specified) { - $mode = (!$mode) ? request_var('mode', 'view') : $mode; + $mode = (!$mode) ? $request->variable('mode', 'view') : $mode; } else { @@ -85,11 +88,11 @@ class ucp_pm { // Compose message case 'compose': - $action = request_var('action', 'post'); + $action = $request->variable('action', 'post'); $user_folders = get_folder($user->data['user_id']); - if (!$auth->acl_get('u_sendpm')) + if ($action != 'delete' && !$auth->acl_get('u_sendpm')) { // trigger_error('NO_AUTH_SEND_MESSAGE'); $template->assign_vars(array( @@ -148,12 +151,12 @@ class ucp_pm } else { - $folder_id = request_var('f', PRIVMSGS_NO_BOX); - $action = request_var('action', 'view_folder'); + $folder_id = $request->variable('f', PRIVMSGS_NO_BOX); + $action = $request->variable('action', 'view_folder'); } - $msg_id = request_var('p', 0); - $view = request_var('view', ''); + $msg_id = $request->variable('p', 0); + $view = $request->variable('view', ''); // View message if specified if ($msg_id) @@ -172,12 +175,11 @@ class ucp_pm trigger_error('NO_AUTH_READ_HOLD_MESSAGE'); } - // First Handle Mark actions and moving messages $submit_mark = (isset($_POST['submit_mark'])) ? true : false; $move_pm = (isset($_POST['move_pm'])) ? true : false; - $mark_option = request_var('mark_option', ''); - $dest_folder = request_var('dest_folder', PRIVMSGS_NO_BOX); + $mark_option = $request->variable('mark_option', ''); + $dest_folder = $request->variable('dest_folder', PRIVMSGS_NO_BOX); // Is moving PM triggered through mark options? if (!in_array($mark_option, array('mark_important', 'delete_marked')) && $submit_mark) @@ -190,8 +192,8 @@ class ucp_pm // Move PM if ($move_pm) { - $move_msg_ids = (isset($_POST['marked_msg_id'])) ? request_var('marked_msg_id', array(0)) : array(); - $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX); + $move_msg_ids = (isset($_POST['marked_msg_id'])) ? $request->variable('marked_msg_id', array(0)) : array(); + $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); if (move_pm($user->data['user_id'], $user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) { @@ -199,7 +201,7 @@ class ucp_pm if ($action == 'view_message') { $msg_id = 0; - $folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX); + $folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); $action = 'view_folder'; } } @@ -213,7 +215,7 @@ class ucp_pm // If new messages arrived, place them into the appropriate folder $num_not_moved = $num_removed = 0; - $release = request_var('release', 0); + $release = $request->variable('release', 0); if ($user->data['user_new_privmsg'] && ($action == 'view_folder' || $action == 'view_message')) { @@ -244,6 +246,27 @@ class ucp_pm $folder_id = (int) $row['folder_id']; } + if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_pms_read')) + { + mark_folder_read($user->data['user_id'], $folder_id); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PM_MARK_ALL_READ_SUCCESS']; + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'success' => true, + )); + } + $message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); + + trigger_error($message); + } + $message_row = array(); if ($action == 'view_message' && $msg_id) { @@ -330,6 +353,7 @@ class ucp_pm 'U_SENTBOX' => $this->u_action . '&folder=sentbox', 'U_CREATE_FOLDER' => $this->u_action . '&mode=options', 'U_CURRENT_FOLDER' => $this->u_action . '&folder=' . $folder_id, + 'U_MARK_ALL' => $this->u_action . '&folder=' . $folder_id . '&mark=all&token=' . generate_link_hash('mark_all_pms_read'), 'S_IN_INBOX' => ($folder_id == PRIVMSGS_INBOX) ? true : false, 'S_IN_OUTBOX' => ($folder_id == PRIVMSGS_OUTBOX) ? true : false, @@ -352,9 +376,10 @@ class ucp_pm else if ($action == 'view_message') { $template->assign_vars(array( - 'S_VIEW_MESSAGE' => true, - 'MSG_ID' => $msg_id) - ); + 'S_VIEW_MESSAGE' => true, + 'L_RETURN_TO_FOLDER' => $user->lang('RETURN_TO', $folder_status['folder_name']), + 'MSG_ID' => $msg_id, + )); if (!$msg_id) { diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 87dfdf902b..e707c251fe 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -23,8 +27,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) { global $template, $db, $auth, $user, $cache; global $phpbb_root_path, $phpEx, $config; - global $request; - global $phpbb_container; + global $request, $phpbb_dispatcher, $phpbb_container; // Damn php and globals - i know, this is horrible // Needed for handle_message_list_actions() @@ -41,18 +44,17 @@ function compose_pm($id, $mode, $action, $user_folders = array()) add_form_key('ucp_pm_compose'); // Grab only parameters needed here - $to_user_id = request_var('u', 0); - $to_group_id = request_var('g', 0); - $msg_id = request_var('p', 0); - $draft_id = request_var('d', 0); - $lastclick = request_var('lastclick', 0); + $to_user_id = $request->variable('u', 0); + $to_group_id = $request->variable('g', 0); + $msg_id = $request->variable('p', 0); + $draft_id = $request->variable('d', 0); + $lastclick = $request->variable('lastclick', 0); // Reply to all triggered (quote/reply) - $reply_to_all = request_var('reply_to_all', 0); + $reply_to_all = $request->variable('reply_to_all', 0); $address_list = $request->variable('address_list', array('' => array(0 => ''))); - $submit = (isset($_POST['post'])) ? true : false; $preview = (isset($_POST['preview'])) ? true : false; $save = (isset($_POST['save'])) ? true : false; $load = (isset($_POST['load'])) ? true : false; @@ -66,6 +68,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load || $remove_u || $remove_g || $add_to || $add_bcc; + $submit = $request->is_set_post('post') && !$refresh && !$preview; $action = ($delete && !$preview && !$refresh && $submit) ? 'delete' : $action; $select_single = ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? false : true; @@ -73,6 +76,9 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $error = array(); $current_time = time(); + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + // Was cancel pressed? If so then redirect to the appropriate page if ($cancel || ($current_time - $lastclick < 2 && $submit)) { @@ -87,6 +93,32 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // we include the language file here $user->add_lang('viewtopic'); + /** + * Modify the default vars before composing a PM + * + * @event core.ucp_pm_compose_modify_data + * @var int msg_id post_id in the page request + * @var int to_user_id The id of whom the message is to + * @var int to_group_id The id of the group the message is to + * @var bool submit Whether the form has been submitted + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete Whether the user is deleting the PM + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.4-RC1 + */ + $vars = array( + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_data', compact($vars))); + // Output PM_TO box if message composing if ($action != 'edit') { @@ -116,7 +148,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $group_options = ''; while ($row = $db->sql_fetchrow($result)) { - $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>'; } $db->sql_freeresult($result); } @@ -229,6 +261,35 @@ function compose_pm($id, $mode, $action, $user_folders = array()) if ($sql) { + /** + * Alter sql query to get message for user to write the PM + * + * @event core.ucp_pm_compose_compose_pm_basic_info_query_before + * @var string sql String with the query to be executed + * @var int msg_id topic_id in the page request + * @var int to_user_id The id of whom the message is to + * @var int to_group_id The id of the group whom the message is to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete Whether the user is deleting the PM + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.0-RC5 + * @change 3.2.0-a1 Removed undefined variables + */ + $vars = array( + 'sql', + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_compose_pm_basic_info_query_before', compact($vars))); + $result = $db->sql_query($sql); $post = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -263,6 +324,37 @@ function compose_pm($id, $mode, $action, $user_folders = array()) trigger_error('NOT_AUTHORISED'); } + /** + * Get the result of querying for the post to be quoted in the pm message + * + * @event core.ucp_pm_compose_quotepost_query_after + * @var string sql The original SQL used in the query + * @var array post Associative array with the data of the quoted post + * @var array msg_id The post_id that was searched to get the message for quoting + * @var int to_user_id Users the message is sent to + * @var int to_group_id Groups the message is sent to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete If deleting message + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.0-RC5 + * @change 3.2.0-a1 Removed undefined variables + */ + $vars = array( + 'sql', + 'post', + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_quotepost_query_after', compact($vars))); + // Passworded forum? if ($post['forum_id']) { @@ -385,8 +477,9 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $icon_id = 0; } - $message_parser = new parse_message(); + /* @var $plupload \phpbb\plupload\plupload */ $plupload = $phpbb_container->get('plupload'); + $message_parser = new parse_message(); $message_parser->set_plupload($plupload); $message_parser->message = ($action == 'reply') ? '' : $message_text; @@ -399,7 +492,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) if ($action == 'delete') { // Folder id has been determined by the SQL Statement - // $folder_id = request_var('f', PRIVMSGS_NO_BOX); + // $folder_id = $request->variable('f', PRIVMSGS_NO_BOX); // Do we need to confirm ? if (confirm_box(true)) @@ -430,15 +523,9 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Get maximum number of allowed recipients - $sql = 'SELECT MAX(g.group_max_recipients) as max_recipients - FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug - WHERE ug.user_id = ' . $user->data['user_id'] . ' - AND ug.user_pending = 0 - AND ug.group_id = g.group_id'; - $result = $db->sql_query($sql); - $max_recipients = (int) $db->sql_fetchfield('max_recipients'); - $db->sql_freeresult($result); + $max_recipients = phpbb_get_max_setting_from_group($db, $user->data['user_id'], 'max_recipients'); + // If it is 0, there is no limit set and we use the maximum value within the config. $max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients; // If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients @@ -492,7 +579,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit') { // Do not change to SELECT * - $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize FROM ' . ATTACHMENTS_TABLE . " WHERE post_msg_id = $msg_id AND in_message = 1 @@ -511,7 +598,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $enable_urls = true; } - $enable_magic_url = $drafts = false; + $drafts = false; // User own some drafts? if ($auth->acl_get('u_savedrafts') && $action != 'delete') @@ -546,9 +633,9 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // Save Draft if ($save && $auth->acl_get('u_savedrafts')) { - $subject = utf8_normalize_nfc(request_var('subject', '', true)); + $subject = $request->variable('subject', '', true); $subject = (!$subject && $action != 'post') ? $user->lang['NEW_MESSAGE'] : $subject; - $message = utf8_normalize_nfc(request_var('message', '', true)); + $message = $request->variable('message', '', true); if ($subject && $message) { @@ -586,7 +673,6 @@ function compose_pm($id, $mode, $action, $user_folders = array()) ); $s_hidden_fields .= build_address_field($address_list); - confirm_box(false, 'SAVE_DRAFT', $s_hidden_fields); } } @@ -643,26 +729,16 @@ function compose_pm($id, $mode, $action, $user_folders = array()) { $error[] = $user->lang['FORM_INVALID']; } - $subject = utf8_normalize_nfc(request_var('subject', '', true)); - $message_parser->message = utf8_normalize_nfc(request_var('message', '', true)); + $subject = $request->variable('subject', '', true); + $message_parser->message = $request->variable('message', '', true); - $icon_id = request_var('icon', 0); + $icon_id = $request->variable('icon', 0); $enable_bbcode = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true; $enable_smilies = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true; $enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1; $enable_sig = (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false); - if ($submit) - { - $status_switch = (($enable_bbcode+1) << 8) + (($enable_smilies+1) << 4) + (($enable_urls+1) << 2) + (($enable_sig+1) << 1); - $status_switch = ($status_switch != $check_value); - } - else - { - $status_switch = 1; - } - // Parse Attachments - before checksum is calculated $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); @@ -748,7 +824,6 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $return_box_url = ($action === 'post' || $action === 'edit') ? $outbox_folder_url : $inbox_folder_url; $return_box_lang = ($action === 'post' || $action === 'edit') ? 'PM_OUTBOX' : 'PM_INBOX'; - $save_message = ($action === 'edit') ? $user->lang['MESSAGE_EDITED'] : $user->lang['MESSAGE_STORED']; $message = $save_message . '<br /><br />' . $user->lang('VIEW_PRIVATE_MESSAGE', '<a href="' . $return_message_url . '">', '</a>'); @@ -835,7 +910,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) { if ($action == 'quotepost') { - $post_id = request_var('p', 0); + $post_id = $request->variable('p', 0); if ($config['allow_post_links']) { $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}[/url]\n\n"; @@ -849,7 +924,20 @@ function compose_pm($id, $mode, $action, $user_folders = array()) { $message_link = ''; } - $message_parser->message = $message_link . '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + $quote_attributes = array( + 'author' => $quote_username, + 'time' => $post['message_time'], + 'user_id' => $post['author_id'], + ); + if ($action === 'quotepost') + { + $quote_attributes['post_id'] = $post['msg_id']; + } + $quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote( + censor_text($message_parser->message), + $quote_attributes + ); + $message_parser->message = $message_link . $quote_text . "\n\n"; } if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh) @@ -877,7 +965,11 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text); $forward_text[] = sprintf($user->lang['FWD_TO'], implode($user->lang['COMMA_SEPARATOR'], $fwd_to_field['to'])); - $message_parser->message = implode("\n", $forward_text) . "\n\n[quote="{$quote_username}"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]"; + $quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote( + censor_text($message_parser->message), + array('author' => $quote_username) + ); + $message_parser->message = implode("\n", $forward_text) . "\n\n" . $quote_text; $message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject); } @@ -950,7 +1042,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) { if ($type == 'g') { - $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; + $row['name'] = $group_helper->get_name($row['name']); } ${$type}[$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); @@ -960,7 +1052,6 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Now Build the address list - $plain_address_field = ''; foreach ($address_list as $type => $adr_ary) { foreach ($adr_ary as $id => $field) @@ -1006,7 +1097,6 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // Build hidden address list $s_hidden_address_field = build_address_field($address_list); - $bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : (($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !$user->optionget('bbcode') : 1); $smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : (($config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !$user->optionget('smilies') : 1); $urls_checked = (isset($enable_urls)) ? !$enable_urls : 0; @@ -1049,6 +1139,9 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"'; + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + // Start assigning vars for main posting page ... $template->assign_vars(array( 'L_POST_A' => $page_title, @@ -1057,7 +1150,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', 'MESSAGE' => $message_text, - 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], @@ -1081,6 +1174,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $action != 'edit') ? true : false, 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts), 'S_FORM_ENCTYPE' => $form_enctype, + 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, @@ -1104,7 +1198,8 @@ function compose_pm($id, $mode, $action, $user_folders = array()) if ($allowed) { - $plupload->configure($cache, $template, $s_action, false); + $max_files = ($auth->acl_gets('a_', 'm_')) ? 0 : (int) $config['max_attachments_pm']; + $plupload->configure($cache, $template, $s_action, false, $max_files); } // Attachment entry @@ -1151,13 +1246,13 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove } // Add Selected Groups - $group_list = request_var('group_list', array(0)); + $group_list = $request->variable('group_list', array(0)); // Build usernames to add - $usernames = request_var('username', '', true); + $usernames = $request->variable('username', '', true); $usernames = (empty($usernames)) ? array() : array($usernames); - $username_list = request_var('username_list', '', true); + $username_list = $request->variable('username_list', '', true); if ($username_list) { $usernames = array_merge($usernames, explode("\n", $username_list)); @@ -1174,7 +1269,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove $submit = false; // Preview is only true if there was also a message entered - if (request_var('message', '')) + if ($request->variable('message', '')) { $preview = true; } @@ -1227,35 +1322,86 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove // Check for disallowed recipients if (!empty($address_list['u'])) { - // We need to check their PM status (do they want to receive PM's?) - // Only check if not a moderator or admin, since they are allowed to override this user setting - if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) + $can_ignore_allow_pm = $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'); + + // Administrator deactivated users check and we need to check their + // PM status (do they want to receive PM's?) + // Only check PM status if not a moderator or admin, since they + // are allowed to override this user setting + $sql = 'SELECT user_id, user_allow_pm + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . ' + AND ( + (user_type = ' . USER_INACTIVE . ' + AND user_inactive_reason = ' . INACTIVE_MANUAL . ') + ' . ($can_ignore_allow_pm ? '' : ' OR user_allow_pm = 0') . ' + )'; + + $result = $db->sql_query($sql); + + $removed_no_pm = $removed_no_permission = false; + while ($row = $db->sql_fetchrow($result)) { - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . ' - AND user_allow_pm = 0'; - $result = $db->sql_query($sql); + if (!$can_ignore_allow_pm && !$row['user_allow_pm']) + { + $removed_no_pm = true; + } + else + { + $removed_no_permission = true; + } - $removed = false; - while ($row = $db->sql_fetchrow($result)) + unset($address_list['u'][$row['user_id']]); + } + $db->sql_freeresult($result); + + // print a notice about users not being added who do not want to receive pms + if ($removed_no_pm) + { + $error[] = $user->lang['PM_USERS_REMOVED_NO_PM']; + } + + // print a notice about users not being added who do not have permission to receive PMs + if ($removed_no_permission) + { + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + + if (!sizeof(array_keys($address_list['u']))) + { + return; + } + + // Check if users have permission to read PMs + $can_read = $auth->acl_get_list(array_keys($address_list['u']), 'u_readpm'); + $can_read = (empty($can_read) || !isset($can_read[0]['u_readpm'])) ? array() : $can_read[0]['u_readpm']; + $cannot_read_list = array_diff(array_keys($address_list['u']), $can_read); + if (!empty($cannot_read_list)) + { + foreach ($cannot_read_list as $cannot_read) { - $removed = true; - unset($address_list['u'][$row['user_id']]); + unset($address_list['u'][$cannot_read]); } - $db->sql_freeresult($result); - // print a notice about users not being added who do not want to receive pms - if ($removed) + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + + // Check if users are banned + $banned_user_list = phpbb_get_banned_user_ids(array_keys($address_list['u']), false); + if (!empty($banned_user_list)) + { + foreach ($banned_user_list as $banned_user) { - $error[] = $user->lang['PM_USERS_REMOVED_NO_PM']; + unset($address_list['u'][$banned_user]); } + + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; } } } /** -* Build the hidden field for the recipients. Needed, as the variable is not read via request_var. +* Build the hidden field for the recipients. Needed, as the variable is not read via $request->variable(). */ function build_address_field($address_list) { diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index bf7334b307..2458c4118d 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,7 +24,7 @@ if (!defined('IN_PHPBB')) */ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions) { - global $phpbb_root_path, $phpEx, $user, $template, $auth, $config, $db; + global $phpbb_root_path, $phpEx, $user, $template, $config, $db, $request; $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=options"); @@ -28,8 +32,12 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Change "full folder" setting - what to do if folder is full if (isset($_POST['fullfolder'])) { - check_form_key('ucp_pm_options', $config['form_token_lifetime'], $redirect_url); - $full_action = request_var('full_action', 0); + if (!check_form_key('ucp_pm_options')) + { + trigger_error('FORM_INVALID'); + } + + $full_action = $request->variable('full_action', 0); $set_folder_id = 0; switch ($full_action) @@ -39,7 +47,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit break; case 2: - $set_folder_id = request_var('full_move_to', PRIVMSGS_INBOX); + $set_folder_id = $request->variable('full_move_to', PRIVMSGS_INBOX); break; case 3: @@ -65,14 +73,13 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit trigger_error($message); } } - + // Add Folder if (isset($_POST['addfolder'])) { if (check_form_key('ucp_pm_options')) { - $folder_name = utf8_normalize_nfc(request_var('foldername', '', true)); - $msg = ''; + $folder_name = $request->variable('foldername', '', true); if ($folder_name) { @@ -127,8 +134,8 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { if (check_form_key('ucp_pm_options')) { - $new_folder_name = utf8_normalize_nfc(request_var('new_folder_name', '', true)); - $rename_folder_id= request_var('rename_folder_id', 0); + $new_folder_name = $request->variable('new_folder_name', '', true); + $rename_folder_id= $request->variable('rename_folder_id', 0); if (!$new_folder_name) { @@ -170,11 +177,11 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Remove Folder if (isset($_POST['remove_folder'])) { - $remove_folder_id = request_var('remove_folder_id', 0); + $remove_folder_id = $request->variable('remove_folder_id', 0); // Default to "move all messages to inbox" - $remove_action = request_var('remove_action', 1); - $move_to = request_var('move_to', PRIVMSGS_INBOX); + $remove_action = $request->variable('remove_action', 1); + $move_to = $request->variable('move_to', PRIVMSGS_INBOX); // Move to same folder? if ($remove_action == 1 && $remove_folder_id == $move_to) @@ -226,11 +233,11 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Move Messages case 1: $num_moved = move_pm($user->data['user_id'], $user->data['message_limit'], $msg_ids, $move_to, $remove_folder_id); - + // Something went wrong, only partially moved? if ($num_moved != $folder_row['pm_count']) { - trigger_error($user->lang('MOVE_PM_ERROR', (int) $folder_row['pm_count'], $num_moved)); + trigger_error($user->lang('MOVE_PM_ERROR', $user->lang('MESSAGES_COUNT', (int) $folder_row['pm_count']), $num_moved)); } break; @@ -283,13 +290,13 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { if (check_form_key('ucp_pm_options')) { - $check_option = request_var('check_option', 0); - $rule_option = request_var('rule_option', 0); - $cond_option = request_var('cond_option', ''); - $action_option = explode('|', request_var('action_option', '')); - $rule_string = ($cond_option != 'none') ? utf8_normalize_nfc(request_var('rule_string', '', true)) : ''; - $rule_user_id = ($cond_option != 'none') ? request_var('rule_user_id', 0) : 0; - $rule_group_id = ($cond_option != 'none') ? request_var('rule_group_id', 0) : 0; + $check_option = $request->variable('check_option', 0); + $rule_option = $request->variable('rule_option', 0); + $cond_option = $request->variable('cond_option', ''); + $action_option = explode('|', $request->variable('action_option', '')); + $rule_string = ($cond_option != 'none') ? $request->variable('rule_string', '', true) : ''; + $rule_user_id = ($cond_option != 'none') ? $request->variable('rule_user_id', 0) : 0; + $rule_group_id = ($cond_option != 'none') ? $request->variable('rule_group_id', 0) : 0; $action = (int) $action_option[0]; $folder_id = (int) $action_option[1]; @@ -363,7 +370,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit // Remove Rule if (isset($_POST['delete_rule']) && !isset($_POST['cancel'])) { - $delete_id = array_keys(request_var('delete_rule', array(0 => 0))); + $delete_id = array_keys($request->variable('delete_rule', array(0 => 0))); $delete_id = (!empty($delete_id[0])) ? $delete_id[0] : 0; if (!$delete_id) @@ -418,10 +425,10 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $result = $db->sql_query($sql); $num_messages = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); - + $folder[PRIVMSGS_INBOX] = array( 'folder_name' => $user->lang['PM_INBOX'], - 'message_status' => $user->lang('FOLDER_MESSAGE_STATUS', (int) $user->data['message_limit'], $num_messages), + 'message_status' => $user->lang('FOLDER_MESSAGE_STATUS', $user->lang('MESSAGES_COUNT', (int) $user->data['message_limit']), $num_messages), ); $sql = 'SELECT folder_id, folder_name, pm_count @@ -435,7 +442,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $num_user_folder++; $folder[$row['folder_id']] = array( 'folder_name' => $row['folder_name'], - 'message_status' => $user->lang('FOLDER_MESSAGE_STATUS', (int) $user->data['message_limit'], $row['pm_count']), + 'message_status' => $user->lang('FOLDER_MESSAGE_STATUS', $user->lang('MESSAGES_COUNT', (int) $user->data['message_limit']), (int) $row['pm_count']), ); } $db->sql_freeresult($result); @@ -499,18 +506,20 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $rule_lang = $action_lang = $check_lang = array(); // Build all three language arrays - preg_replace('#^((RULE|ACTION|CHECK)_([A-Z0-9_]+))$#e', "\${strtolower('\\2') . '_lang'}[constant('\\1')] = \$user->lang['PM_\\2']['\\3']", array_keys(get_defined_constants())); + preg_replace_callback('#^((RULE|ACTION|CHECK)_([A-Z0-9_]+))$#', function ($match) use(&$rule_lang, &$action_lang, &$check_lang, $user) { + ${strtolower($match[2]) . '_lang'}[constant($match[1])] = $user->lang['PM_' . $match[2]][$match[3]]; + }, array_keys(get_defined_constants())); /* Rule Ordering: -> CHECK_* -> RULE_* [IN $global_privmsgs_rules:CHECK_*] -> [IF $rule_conditions[RULE_*] [|text|bool|user|group|own_group]] -> ACTION_* */ - $check_option = request_var('check_option', 0); - $rule_option = request_var('rule_option', 0); - $cond_option = request_var('cond_option', ''); - $action_option = request_var('action_option', ''); - $back = (isset($_REQUEST['back'])) ? request_var('back', array('' => 0)) : array(); + $check_option = $request->variable('check_option', 0); + $rule_option = $request->variable('rule_option', 0); + $cond_option = $request->variable('cond_option', ''); + $action_option = $request->variable('action_option', ''); + $back = (isset($_REQUEST['back'])) ? $request->variable('back', array('' => 0)) : array(); if (sizeof($back)) { @@ -601,7 +610,7 @@ function define_check_option($hardcoded, $check_option, $check_lang) */ function define_action_option($hardcoded, $action_option, $action_lang, $folder) { - global $db, $template, $user; + global $template; $l_action = $s_action_options = ''; if ($hardcoded) @@ -690,8 +699,11 @@ function define_rule_option($hardcoded, $rule_option, $rule_lang, $check_ary) */ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule_conditions) { - global $db, $template, $auth, $user; - + global $db, $template, $auth, $user, $request, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + $template->assign_vars(array( 'S_COND_DEFINED' => true, 'S_COND_SELECT' => (!$hardcoded && isset($global_rule_conditions[$rule_option])) ? true : false) @@ -709,13 +721,12 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule // Define Condition $condition = $global_rule_conditions[$rule_option]; - $current_value = ''; switch ($condition) { case 'text': - $rule_string = utf8_normalize_nfc(request_var('rule_string', '', true)); - + $rule_string = $request->variable('rule_string', '', true); + $template->assign_vars(array( 'S_TEXT_CONDITION' => true, 'CURRENT_STRING' => $rule_string, @@ -727,9 +738,9 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule break; case 'user': - $rule_user_id = request_var('rule_user_id', 0); - $rule_string = utf8_normalize_nfc(request_var('rule_string', '', true)); - + $rule_user_id = $request->variable('rule_user_id', 0); + $rule_string = $request->variable('rule_string', '', true); + if ($rule_string && !$rule_user_id) { $sql = 'SELECT user_id @@ -770,8 +781,8 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule break; case 'group': - $rule_group_id = request_var('rule_group_id', 0); - $rule_string = utf8_normalize_nfc(request_var('rule_string', '', true)); + $rule_group_id = $request->variable('rule_group_id', 0); + $rule_string = $request->variable('rule_string', '', true); $sql = 'SELECT g.group_id, g.group_name, g.group_type FROM ' . GROUPS_TABLE . ' g '; @@ -791,10 +802,10 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule { $sql .= 'WHERE'; } - - $sql .= " (g.group_name NOT IN ('GUESTS', 'BOTS') OR g.group_type <> " . GROUP_SPECIAL . ') + + $sql .= " (g.group_name NOT IN ('GUESTS', 'BOTS') OR g.group_type <> " . GROUP_SPECIAL . ') ORDER BY g.group_type DESC, g.group_name ASC'; - + $result = $db->sql_query($sql); $s_group_options = ''; @@ -802,13 +813,13 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule { if ($rule_group_id && ($row['group_id'] == $rule_group_id)) { - $rule_string = (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']); + $rule_string = $group_helper->get_name($row['group_name']); } $s_class = ($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : ''; $s_selected = ($row['group_id'] == $rule_group_id) ? ' selected="selected"' : ''; - - $s_group_options .= '<option value="' . $row['group_id'] . '"' . $s_class . $s_selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + + $s_group_options .= '<option value="' . $row['group_id'] . '"' . $s_class . $s_selected . '>' . $group_helper->get_name($row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -845,7 +856,7 @@ function show_defined_rules($user_id, $check_lang, $rule_lang, $action_lang, $fo WHERE user_id = ' . $user_id . ' ORDER BY rule_id ASC'; $result = $db->sql_query($sql); - + $count = 0; while ($row = $db->sql_fetchrow($result)) { diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index a567283543..af2126c83d 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,7 +25,7 @@ if (!defined('IN_PHPBB')) */ function view_folder($id, $mode, $folder_id, $folder) { - global $user, $template, $auth, $db, $cache; + global $user, $template, $auth, $db, $cache, $request; global $phpbb_root_path, $config, $phpEx; $submit_export = (isset($_POST['submit_export'])) ? true : false; @@ -37,9 +41,6 @@ function view_folder($id, $mode, $folder_id, $folder) $color_rows = array('marked', 'replied'); - // only show the friend/foe color rows if the module is enabled - $zebra_enabled = false; - $_module = new p_master(); $_module->list_modules('ucp'); $_module->set_active('zebra'); @@ -192,9 +193,9 @@ function view_folder($id, $mode, $folder_id, $folder) } else { - $export_type = request_var('export_option', ''); - $enclosure = request_var('enclosure', ''); - $delimiter = request_var('delimiter', ''); + $export_type = $request->variable('export_option', ''); + $enclosure = $request->variable('enclosure', ''); + $delimiter = $request->variable('delimiter', ''); if ($export_type == 'CSV' && ($delimiter === '' || $enclosure === '')) { @@ -379,7 +380,7 @@ function view_folder($id, $mode, $folder_id, $folder) break; } - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"data.$filetype\""); header("Content-disposition: attachment; filename=data.$filetype"); echo $string; @@ -393,15 +394,16 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $request; - $start = request_var('start', 0); + $start = $request->variable('start', 0); // Additional vars later, pm ordering is mostly different from post ordering. :/ - $sort_days = request_var('st', 0); - $sort_key = request_var('sk', 't'); - $sort_dir = request_var('sd', 'd'); + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); // PM ordering options diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index e513b8ade2..2457ea9a2e 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,7 +24,7 @@ if (!defined('IN_PHPBB')) */ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) { - global $user, $template, $auth, $db, $cache, $phpbb_container; + global $user, $template, $auth, $db, $phpbb_container; global $phpbb_root_path, $request, $phpEx, $config, $phpbb_dispatcher; $user->add_lang(array('viewtopic', 'memberlist')); @@ -28,7 +32,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $msg_id = (int) $msg_id; $folder_id = (int) $folder_id; $author_id = (int) $message_row['author_id']; - $view = request_var('view', ''); + $view = $request->variable('view', ''); // Not able to view message, it was deleted by the sender if ($message_row['pm_deleted']) @@ -46,24 +50,13 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) trigger_error('NO_AUTH_READ_HOLD_MESSAGE'); } - // Grab icons - $icons = $cache->obtain_icons(); - - $bbcode = false; - - // Instantiate BBCode if need be - if ($message_row['bbcode_bitfield']) - { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($message_row['bbcode_bitfield']); - } - // Load the custom profile fields if ($config['load_cpf_pm']) { + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); - $profile_fields = $cp->generate_profile_fields_template('grab', $author_id); + $profile_fields = $cp->grab_profile_fields_data($author_id); } // Assign TO/BCC Addresses to template @@ -81,7 +74,16 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // Editing information if ($message_row['message_edit_count'] && $config['display_last_edited']) { - $l_edited_by = '<br /><br />' . $user->lang('EDITED_TIMES_TOTAL', (int) $message_row['message_edit_count'], (!$message_row['message_edit_user']) ? $message_row['username'] : $message_row['message_edit_user'], $user->format_date($message_row['message_edit_time'], false, true)); + if (!$message_row['message_edit_user']) + { + $display_username = get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour']); + } + else + { + $edit_user_info = get_user_information($message_row['message_edit_user'], false); + $display_username = get_username_string('full', $message_row['message_edit_user'], $edit_user_info['username'], $edit_user_info['user_colour']); + } + $l_edited_by = '<br /><br />' . $user->lang('EDITED_TIMES_TOTAL', (int) $message_row['message_edit_count'], $display_username, $user->format_date($message_row['message_edit_time'], false, true)); } else { @@ -173,10 +175,22 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) if (isset($profile_fields[$author_id])) { - $cp_row = $cp->generate_profile_fields_template('show', false, $profile_fields[$author_id]); + $cp_row = $cp->generate_profile_fields_template_data($profile_fields[$author_id]); } } + $u_pm = $u_jabber = ''; + + if ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) + { + $u_pm = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $author_id); + } + + if ($config['jab_enable'] && $user_info['user_jabber'] && $auth->acl_get('u_sendim')) + { + $u_jabber = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $author_id); + } + $msg_data = array( 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), @@ -188,6 +202,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'AUTHOR_AVATAR' => (isset($user_info['avatar'])) ? $user_info['avatar'] : '', 'AUTHOR_JOINED' => $user->format_date($user_info['user_regdate']), 'AUTHOR_POSTS' => (int) $user_info['user_posts'], + 'U_AUTHOR_POSTS' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$author_id&sr=posts") : '', + 'CONTACT_USER' => $user->lang('CONTACT_USER', get_username_string('username', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username'])), 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : ((isset($user_info['online']) && $user_info['online']) ? $user->img('icon_user_online', $user->lang['ONLINE']) : $user->img('icon_user_offline', $user->lang['OFFLINE'])), 'S_ONLINE' => (!$config['load_onlinetrack']) ? false : ((isset($user_info['online']) && $user_info['online']) ? true : false), @@ -208,17 +224,12 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'EDITED_MESSAGE' => $l_edited_by, 'MESSAGE_ID' => $message_row['msg_id'], - 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $author_id) : '', - 'U_WWW' => (!empty($user_info['user_website'])) ? $user_info['user_website'] : '', - 'U_ICQ' => ($user_info['user_icq']) ? 'http://www.icq.com/people/' . urlencode($user_info['user_icq']) . '/' : '', - 'U_AIM' => ($user_info['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=aim&u=' . $author_id) : '', - 'U_YIM' => ($user_info['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($user_info['user_yim']) . '&.src=pg' : '', - 'U_MSN' => ($user_info['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=msnm&u=' . $author_id) : '', - 'U_JABBER' => ($user_info['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $author_id) : '', + 'U_PM' => $u_pm, + 'U_JABBER' => $u_jabber, 'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EMAIL' => $user_info['email'], - 'U_REPORT' => ($config['allow_pm_report']) ? append_sid("{$phpbb_root_path}report.$phpEx", "pm=" . $message_row['msg_id']) : '', + 'U_REPORT' => ($config['allow_pm_report']) ? $phpbb_container->get('controller.helper')->route('phpbb_report_pm_controller', array('id' => $message_row['msg_id'])) : '', 'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_EDIT' => (($message_row['message_time'] > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit')) ? "$url&mode=compose&action=edit&f=$folder_id&p=" . $message_row['msg_id'] : '', 'U_POST_REPLY_PM' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $message_row['msg_id'] : '', @@ -229,7 +240,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_PM_ACTION' => $url . '&mode=compose&f=' . $folder_id . '&p=' . $message_row['msg_id'], 'S_HAS_ATTACHMENTS' => (sizeof($attachments)) ? true : false, - 'S_HAS_MULTIPLE_ATTACHMENTS' => (sizeof($attachments) > 1), 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, 'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)), @@ -253,13 +263,51 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) * @var array message_row Array with message data * @var array cp_row Array with senders custom profile field data * @var array msg_data Template array with message data - * @since 3.1-A1 + * @var array user_info User data of the sender + * @since 3.1.0-a1 + * @changed 3.1.6-RC1 Added user_info into event */ - $vars = array('id', 'mode', 'folder_id', 'msg_id', 'folder', 'message_row', 'cp_row', 'msg_data'); + $vars = array( + 'id', + 'mode', + 'folder_id', + 'msg_id', + 'folder', + 'message_row', + 'cp_row', + 'msg_data', + 'user_info', + ); extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_messsage', compact($vars))); $template->assign_vars($msg_data); + $contact_fields = array( + array( + 'ID' => 'pm', + 'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'], + 'U_CONTACT' => $u_pm, + ), + array( + 'ID' => 'email', + 'NAME' => $user->lang['SEND_EMAIL'], + 'U_CONTACT' => $user_info['email'], + ), + array( + 'ID' => 'jabber', + 'NAME' => $user->lang['JABBER'], + 'U_CONTACT' => $u_jabber, + ), + ); + + foreach ($contact_fields as $field) + { + if ($field['U_CONTACT']) + { + $template->assign_block_vars('contact', $field); + } + } + // Display the custom profile fields if (!empty($cp_row['row'])) { @@ -268,18 +316,21 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) foreach ($cp_row['blockrow'] as $cp_block_row) { $template->assign_block_vars('custom_fields', $cp_block_row); + + if ($cp_block_row['S_PROFILE_CONTACT']) + { + $template->assign_block_vars('contact', array( + 'ID' => $cp_block_row['PROFILE_FIELD_IDENT'], + 'NAME' => $cp_block_row['PROFILE_FIELD_NAME'], + 'U_CONTACT' => $cp_block_row['PROFILE_FIELD_CONTACT'], + )); + } } } // Display not already displayed Attachments for this post, we already parsed them. ;) if (isset($attachments) && sizeof($attachments)) { - $methods = phpbb_gen_download_links('msg_id', $msg_id, $phpbb_root_path, $phpEx); - foreach ($methods as $method) - { - $template->assign_block_vars('dl_method', $method); - } - foreach ($attachments as $attachment) { $template->assign_block_vars('attachment', array( @@ -303,7 +354,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) */ function get_user_information($user_id, $user_row) { - global $db, $auth, $user, $cache; + global $db, $auth, $user; global $phpbb_root_path, $phpEx, $config; if (!$user_id) @@ -343,14 +394,17 @@ function get_user_information($user_id, $user_row) } } - if (!function_exists('phpbb_get_user_avatar')) + $user_row['avatar'] = ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($user_row) : ''; + + if (!function_exists('phpbb_get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } - $user_row['avatar'] = ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($user_row) : ''; - - get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']); + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); + $user_row['rank_title'] = $user_rank_data['title']; + $user_row['rank_image'] = $user_rank_data['img']; + $user_row['rank_image_src'] = $user_rank_data['img_src']; if ((!empty($user_row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) { diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index e80cc2dce3..c2aa910ed0 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * ucp_prefs * Changing user preferences -* @package ucp */ class ucp_prefs { @@ -26,7 +29,7 @@ class ucp_prefs function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $phpbb_root_path, $phpEx; + global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $request; $submit = (isset($_POST['submit'])) ? true : false; $error = $data = array(); @@ -37,16 +40,16 @@ class ucp_prefs case 'personal': add_form_key('ucp_prefs_personal'); $data = array( - 'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']), - 'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true), - 'lang' => basename(request_var('lang', $user->data['user_lang'])), - 'style' => request_var('style', (int) $user->data['user_style']), - 'tz' => request_var('tz', $user->data['user_timezone']), - - 'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']), - 'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']), - 'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']), - 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']), + 'notifymethod' => $request->variable('notifymethod', $user->data['user_notify_type']), + 'dateformat' => $request->variable('dateformat', $user->data['user_dateformat'], true), + 'lang' => basename($request->variable('lang', $user->data['user_lang'])), + 'user_style' => $request->variable('user_style', (int) $user->data['user_style']), + 'tz' => $request->variable('tz', $user->data['user_timezone']), + + 'viewemail' => $request->variable('viewemail', (bool) $user->data['user_allow_viewemail']), + 'massemail' => $request->variable('massemail', (bool) $user->data['user_allow_massemail']), + 'hideonline' => $request->variable('hideonline', (bool) !$user->data['user_allow_viewonline']), + 'allowpm' => $request->variable('allowpm', (bool) $user->data['user_allow_pm']), ); if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) @@ -64,27 +67,29 @@ class ucp_prefs * @var bool submit Do we display the form only * or did the user press submit * @var array data Array with current ucp options data - * @since 3.1-A1 + * @var array error Array with list of errors + * @since 3.1.0-a1 + * @changed 3.1.4-RC1 Added error variable to the event */ - $vars = array('submit', 'data'); + $vars = array('submit', 'data', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars))); if ($submit) { if ($config['override_user_style']) { - $data['style'] = (int) $config['default_style']; + $data['user_style'] = (int) $config['default_style']; } - else if (!phpbb_style_is_active($data['style'])) + else if (!phpbb_style_is_active($data['user_style'])) { - $data['style'] = (int) $user->data['user_style']; + $data['user_style'] = (int) $user->data['user_style']; } - $error = validate_data($data, array( - 'dateformat' => array('string', false, 1, 30), + $error = array_merge(validate_data($data, array( + 'dateformat' => array('string', false, 1, 64), 'lang' => array('language_iso_name'), 'tz' => array('timezone'), - )); + )), $error); if (!check_form_key('ucp_prefs_personal')) { @@ -104,7 +109,7 @@ class ucp_prefs 'user_dateformat' => $data['dateformat'], 'user_lang' => $data['lang'], 'user_timezone' => $data['tz'], - 'user_style' => $data['style'], + 'user_style' => $data['user_style'], ); /** @@ -112,8 +117,8 @@ class ucp_prefs * * @event core.ucp_prefs_personal_update_data * @var array data Submitted display options data - * @var array sql_ary Display options data we udpate - * @since 3.1-A1 + * @var array sql_ary Display options data we update + * @since 3.1.0-a1 */ $vars = array('data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_update_data', compact($vars))); @@ -151,7 +156,7 @@ class ucp_prefs } $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; - $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); + phpbb_timezone_select($template, $user, $data['tz'], true); // check if there are any user-selectable languages $sql = 'SELECT COUNT(lang_id) as languages_count @@ -204,9 +209,7 @@ class ucp_prefs 'S_MORE_STYLES' => $s_more_styles, 'S_LANG_OPTIONS' => language_select($data['lang']), - 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']), - 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], - 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], + 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['user_style']), 'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false, 'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) ); @@ -218,20 +221,20 @@ class ucp_prefs add_form_key('ucp_prefs_view'); $data = array( - 'topic_sk' => request_var('topic_sk', (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'), - 'topic_sd' => request_var('topic_sd', (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'), - 'topic_st' => request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0), - - 'post_sk' => request_var('post_sk', (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'), - 'post_sd' => request_var('post_sd', (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'), - 'post_st' => request_var('post_st', (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0), - - 'images' => request_var('images', (bool) $user->optionget('viewimg')), - 'flash' => request_var('flash', (bool) $user->optionget('viewflash')), - 'smilies' => request_var('smilies', (bool) $user->optionget('viewsmilies')), - 'sigs' => request_var('sigs', (bool) $user->optionget('viewsigs')), - 'avatars' => request_var('avatars', (bool) $user->optionget('viewavatars')), - 'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')), + 'topic_sk' => $request->variable('topic_sk', (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'), + 'topic_sd' => $request->variable('topic_sd', (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'), + 'topic_st' => $request->variable('topic_st', (!empty($user->data['user_topic_show_days'])) ? (int) $user->data['user_topic_show_days'] : 0), + + 'post_sk' => $request->variable('post_sk', (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'), + 'post_sd' => $request->variable('post_sd', (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'), + 'post_st' => $request->variable('post_st', (!empty($user->data['user_post_show_days'])) ? (int) $user->data['user_post_show_days'] : 0), + + 'images' => $request->variable('images', (bool) $user->optionget('viewimg')), + 'flash' => $request->variable('flash', (bool) $user->optionget('viewflash')), + 'smilies' => $request->variable('smilies', (bool) $user->optionget('viewsmilies')), + 'sigs' => $request->variable('sigs', (bool) $user->optionget('viewsigs')), + 'avatars' => $request->variable('avatars', (bool) $user->optionget('viewavatars')), + 'wordcensor' => $request->variable('wordcensor', (bool) $user->optionget('viewcensors')), ); /** @@ -243,7 +246,7 @@ class ucp_prefs * @var bool submit Do we display the form only * or did the user press submit * @var array data Array with current ucp options data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('submit', 'data'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_data', compact($vars))); @@ -251,10 +254,22 @@ class ucp_prefs if ($submit) { $error = validate_data($data, array( - 'topic_sk' => array('string', false, 1, 1), - 'topic_sd' => array('string', false, 1, 1), - 'post_sk' => array('string', false, 1, 1), - 'post_sd' => array('string', false, 1, 1), + 'topic_sk' => array( + array('string', false, 1, 1), + array('match', false, '#(a|r|s|t|v)#'), + ), + 'topic_sd' => array( + array('string', false, 1, 1), + array('match', false, '#(a|d)#'), + ), + 'post_sk' => array( + array('string', false, 1, 1), + array('match', false, '#(a|s|t)#'), + ), + 'post_sd' => array( + array('string', false, 1, 1), + array('match', false, '#(a|d)#'), + ), )); if (!check_form_key('ucp_prefs_view')) @@ -291,8 +306,8 @@ class ucp_prefs * * @event core.ucp_prefs_view_update_data * @var array data Submitted display options data - * @var array sql_ary Display options data we udpate - * @since 3.1-A1 + * @var array sql_ary Display options data we update + * @since 3.1.0-a1 */ $vars = array('data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_update_data', compact($vars))); @@ -317,7 +332,7 @@ class ucp_prefs $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); - $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views'); + $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views'); // Post ordering options $limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); @@ -353,6 +368,49 @@ class ucp_prefs ${'s_sort_' . $sort_option . '_dir'} .= '</select>'; } + /** + * Run code before view form is displayed + * + * @event core.ucp_prefs_view_after + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp options data + * @var array sort_dir_text Array with sort dir language strings + * @var array limit_topic_days Topic ordering options + * @var array sort_by_topic_text Topic ordering language strings + * @var array sort_by_topic_sql Topic ordering sql + * @var array limit_post_days Post ordering options + * @var array sort_by_post_text Post ordering language strings + * @var array sort_by_post_sql Post ordering sql + * @var array _options Sort options + * @var string s_limit_topic_days Sort limit topic by days select box + * @var string s_sort_topic_key Sort topic key select box + * @var string s_sort_topic_dir Sort topic dir select box + * @var string s_limit_post_days Sort limit post by days select box + * @var string s_sort_post_key Sort post key select box + * @var string s_sort_post_dir Sort post dir select box + * @since 3.1.8-RC1 + */ + $vars = array( + 'submit', + 'data', + 'sort_dir_text', + 'limit_topic_days', + 'sort_by_topic_text', + 'sort_by_topic_sql', + 'limit_post_days', + 'sort_by_post_text', + 'sort_by_post_sql', + '_options', + 's_limit_topic_days', + 's_sort_topic_key', + 's_sort_topic_dir', + 's_limit_post_days', + 's_sort_post_key', + 's_sort_post_dir', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_after', compact($vars))); + $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', @@ -378,10 +436,10 @@ class ucp_prefs case 'post': $data = array( - 'bbcode' => request_var('bbcode', $user->optionget('bbcode')), - 'smilies' => request_var('smilies', $user->optionget('smilies')), - 'sig' => request_var('sig', $user->optionget('attachsig')), - 'notify' => request_var('notify', (bool) $user->data['user_notify']), + 'bbcode' => $request->variable('bbcode', $user->optionget('bbcode')), + 'smilies' => $request->variable('smilies', $user->optionget('smilies')), + 'sig' => $request->variable('sig', $user->optionget('attachsig')), + 'notify' => $request->variable('notify', (bool) $user->data['user_notify']), ); add_form_key('ucp_prefs_post'); @@ -394,7 +452,7 @@ class ucp_prefs * @var bool submit Do we display the form only * or did the user press submit * @var array data Array with current ucp options data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('submit', 'data'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_data', compact($vars))); @@ -417,8 +475,8 @@ class ucp_prefs * * @event core.ucp_prefs_post_update_data * @var array data Submitted display options data - * @var array sql_ary Display options data we udpate - * @since 3.1-A1 + * @var array sql_ary Display options data we update + * @since 3.1.0-a1 */ $vars = array('data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_update_data', compact($vars))); @@ -448,6 +506,24 @@ class ucp_prefs break; } + /** + * Modify UCP preferences data before the page load + * + * @event core.ucp_prefs_modify_common + * @var array data Array with current/submitted UCP options data + * @var array error Errors data + * @var string mode UCP prefs operation mode + * @var string s_hidden_fields Hidden fields data + * @since 3.1.0-RC3 + */ + $vars = array( + 'data', + 'error', + 'mode', + 's_hidden_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_modify_common', compact($vars))); + $template->assign_vars(array( 'L_TITLE' => $user->lang['UCP_PREFS_' . strtoupper($mode)], diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 8def48b1b4..4ac8e0f17d 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,7 +24,6 @@ if (!defined('IN_PHPBB')) * Changing profile settings * * @todo what about pertaining user_sig_options? -* @package ucp */ class ucp_profile { @@ -28,14 +31,12 @@ class ucp_profile function main($id, $mode) { - global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; - global $request, $phpbb_container; + global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher; $user->add_lang('posting'); - $preview = $request->variable('preview', false, false, \phpbb\request\request_interface::POST); $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); - $delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST); $error = $data = array(); $s_hidden_fields = ''; @@ -44,13 +45,24 @@ class ucp_profile case 'reg_details': $data = array( - 'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), - 'email' => strtolower(request_var('email', $user->data['user_email'])), + 'username' => $request->variable('username', $user->data['username'], true), + 'email' => strtolower($request->variable('email', $user->data['user_email'])), 'new_password' => $request->variable('new_password', '', true), 'cur_password' => $request->variable('cur_password', '', true), 'password_confirm' => $request->variable('password_confirm', '', true), ); + /** + * Modify user registration data on editing account settings in UCP + * + * @event core.ucp_profile_reg_details_data + * @var array data Array with current or updated user registration data + * @var bool submit Flag indicating if submit button has been pressed + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_data', compact($vars))); + add_form_key('ucp_reg_details'); if ($submit) @@ -63,7 +75,7 @@ class ucp_profile 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array( array('string', false, 6, 60), - array('email')), + array('user_email')), ); if ($auth->acl_get('u_chgname') && $config['allow_namechange']) @@ -82,6 +94,7 @@ class ucp_profile } // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ $passwords_manager = $phpbb_container->get('passwords.manager'); // Only check the new password against the previous password if there have been no errors @@ -100,6 +113,18 @@ class ucp_profile $error[] = 'FORM_INVALID'; } + /** + * Validate user data on editing registration data in UCP + * + * @event core.ucp_profile_reg_details_validate + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var array error Array of any generated errors + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars))); + if (!sizeof($error)) { $sql_ary = array( @@ -113,18 +138,30 @@ class ucp_profile if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) { - add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'], + $data['username'] + )); } if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !$passwords_manager->check($data['new_password'], $user->data['user_password'])) { $user->reset_login_keys(); - add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $data['username']); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'] + )); } if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) { - add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'], $user->data['user_email'], $data['email']); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'], + $data['user_email'], + $data['email'] + )); } $message = 'PROFILE_UPDATED'; @@ -157,37 +194,12 @@ class ucp_profile if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { - // Grab an array of user_id's with a_user permissions ... these users can activate a user - $admin_ary = $auth->acl_get_list(false, 'a_user', false); - $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array(); - - // Also include founders - $where_sql = ' WHERE user_type = ' . USER_FOUNDER; - - if (sizeof($admin_ary)) - { - $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary); - } - - $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type - FROM ' . USERS_TABLE . ' ' . - $where_sql; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $messenger->template('admin_activate', $row['user_lang']); - $messenger->set_addresses($row); - - $messenger->assign_vars(array( - 'USERNAME' => htmlspecialchars_decode($data['username']), - 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u={$user->data['user_id']}", - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") - ); - - $messenger->send($row['user_notify_type']); - } - $db->sql_freeresult($result); + $notifications_manager = $phpbb_container->get('notification_manager'); + $notifications_manager->add_notifications('notification.type.admin_activate_user', array( + 'user_id' => $user->data['user_id'], + 'user_actkey' => $user_actkey, + 'user_regdate' => time(), // Notification time + )); } user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE); @@ -197,6 +209,17 @@ class ucp_profile $sql_ary['user_newpasswd'] = ''; } + /** + * Modify user registration data before submitting it to the database + * + * @event core.ucp_profile_reg_details_sql_ary + * @var array data Array with current or updated user registration data + * @var array sql_ary Array with user registration data to submit to the database + * @since 3.1.4-RC1 + */ + $vars = array('data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars))); + if (sizeof($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' @@ -259,17 +282,13 @@ class ucp_profile trigger_error('NO_AUTH_PROFILEINFO'); } + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); $cp_data = $cp_error = array(); $data = array( - 'icq' => request_var('icq', $user->data['user_icq']), - 'aim' => request_var('aim', $user->data['user_aim']), - 'msn' => request_var('msn', $user->data['user_msnm']), - 'yim' => request_var('yim', $user->data['user_yim']), - 'jabber' => utf8_normalize_nfc(request_var('jabber', $user->data['user_jabber'], true)), - 'website' => request_var('website', $user->data['user_website']), + 'jabber' => $request->variable('jabber', $user->data['user_jabber'], true), ); if ($config['allow_birthdays']) @@ -281,29 +300,31 @@ class ucp_profile list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']); } - $data['bday_day'] = request_var('bday_day', $data['bday_day']); - $data['bday_month'] = request_var('bday_month', $data['bday_month']); - $data['bday_year'] = request_var('bday_year', $data['bday_year']); + $data['bday_day'] = $request->variable('bday_day', $data['bday_day']); + $data['bday_month'] = $request->variable('bday_month', $data['bday_month']); + $data['bday_year'] = $request->variable('bday_year', $data['bday_year']); $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); } + /** + * Modify user data on editing profile in UCP + * + * @event core.ucp_profile_modify_profile_info + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_profile_info', compact($vars))); + add_form_key('ucp_profile_info'); if ($submit) { $validate_array = array( - 'icq' => array( - array('string', true, 3, 15), - array('match', true, '#^[0-9]+$#i')), - 'aim' => array('string', true, 3, 255), - 'msn' => array('string', true, 5, 255), 'jabber' => array( array('string', true, 5, 255), array('jabber')), - 'yim' => array('string', true, 5, 255), - 'website' => array( - array('string', true, 12, 255), - array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), ); if ($config['allow_birthdays']) @@ -331,6 +352,18 @@ class ucp_profile $error[] = 'FORM_INVALID'; } + /** + * Validate user data on editing profile in UCP + * + * @event core.ucp_profile_validate_profile_info + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var array error Array of any generated errors + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_validate_profile_info', compact($vars))); + if (!sizeof($error)) { $data['notify'] = $user->data['user_notify_type']; @@ -343,12 +376,7 @@ class ucp_profile } $sql_ary = array( - 'user_icq' => $data['icq'], - 'user_aim' => $data['aim'], - 'user_msnm' => $data['msn'], - 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], - 'user_website' => $data['website'], 'user_notify_type' => $data['notify'], ); @@ -357,6 +385,18 @@ class ucp_profile $sql_ary['user_birthday'] = $data['user_birthday']; } + /** + * Modify profile data in UCP before submitting to the database + * + * @event core.ucp_profile_info_modify_sql_ary + * @var array cp_data Array with the user custom profile fields data + * @var array data Array with user profile data + * @var array sql_ary user options data we update + * @since 3.1.4-RC1 + */ + $vars = array('cp_data', 'data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_modify_sql_ary', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; @@ -389,7 +429,6 @@ class ucp_profile $selected = ($i == $data['bday_month']) ? ' selected="selected"' : ''; $s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>"; } - $s_birthday_year_options = ''; $now = getdate(); $s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>'; @@ -409,14 +448,9 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', - - 'ICQ' => $data['icq'], - 'YIM' => $data['yim'], - 'AIM' => $data['aim'], - 'MSN' => $data['msn'], - 'JABBER' => $data['jabber'], - 'WEBSITE' => $data['website'], + 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', + 'S_JABBER_ENABLED' => $config['jab_enable'], + 'JABBER' => $data['jabber'], )); // Get additional profile fields and assign them to the template block var 'profile_fields' @@ -436,86 +470,95 @@ class ucp_profile include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - $enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $user->optionget('sig_bbcode') : false; - $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $user->optionget('sig_smilies') : false; - $enable_urls = ($config['allow_sig_links']) ? (bool) $user->optionget('sig_links') : false; - - $signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true)); + $enable_bbcode = ($config['allow_sig_bbcode']) ? $user->optionget('sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? $user->optionget('sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? $user->optionget('sig_links') : false; - add_form_key('ucp_sig'); + $decoded_message = generate_text_for_edit($user->data['user_sig'], $user->data['user_sig_bbcode_uid'], $user->data['user_sig_bbcode_bitfield']); + $signature = $request->variable('signature', $decoded_message['text'], true); + $signature_preview = ''; - if ($submit || $preview) + if ($submit || $request->is_set_post('preview')) { - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); - - $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false; - $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false; - $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + $enable_bbcode = ($config['allow_sig_bbcode']) ? !$request->variable('disable_bbcode', false) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? !$request->variable('disable_smilies', false) : false; + $enable_urls = ($config['allow_sig_links']) ? !$request->variable('disable_magic_url', false) : false; - if (!sizeof($error)) + if (!check_form_key('ucp_sig')) { - $message_parser = new parse_message($signature); + $error[] = 'FORM_INVALID'; + } + } - // Allowing Quote BBCode - $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); + $bbcode_uid = $bbcode_bitfield = $bbcode_flags = ''; + $warn_msg = generate_text_for_storage( + $signature, + $bbcode_uid, + $bbcode_bitfield, + $bbcode_flags, + $enable_bbcode, + $enable_urls, + $enable_smilies, + $config['allow_sig_img'], + $config['allow_sig_flash'], + true, + $config['allow_sig_links'], + 'sig' + ); - if (sizeof($message_parser->warn_msg)) - { - $error[] = implode('<br />', $message_parser->warn_msg); - } + if (sizeof($warn_msg)) + { + $error += $warn_msg; + } - if (!check_form_key('ucp_sig')) - { - $error[] = 'FORM_INVALID'; - } + if (!$submit) + { + // Parse it for displaying + $signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags); + } + else + { + if (!sizeof($error)) + { + $user->optionset('sig_bbcode', $enable_bbcode); + $user->optionset('sig_smilies', $enable_smilies); + $user->optionset('sig_links', $enable_urls); - if (!sizeof($error) && $submit) - { - $user->optionset('sig_bbcode', $enable_bbcode); - $user->optionset('sig_smilies', $enable_smilies); - $user->optionset('sig_links', $enable_urls); - - $sql_ary = array( - 'user_sig' => (string) $message_parser->message, - 'user_options' => $user->data['user_options'], - 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, - 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield - ); + $sql_ary = array( + 'user_sig' => $signature, + 'user_options' => $user->data['user_options'], + 'user_sig_bbcode_uid' => $bbcode_uid, + 'user_sig_bbcode_bitfield' => $bbcode_bitfield + ); - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . $user->data['user_id']; - $db->sql_query($sql); + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); - $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); - trigger_error($message); - } + $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + trigger_error($message); } - - // Replace "error" strings with their real, localised form - $error = array_map(array($user, 'lang'), $error); } - $signature_preview = ''; - if ($preview) - { - // Now parse it for displaying - $signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); - unset($message_parser); - } + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield); - decode_message($signature, $user->data['user_sig_bbcode_uid']); + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', - 'SIGNATURE' => $signature, + 'SIGNATURE' => $decoded_message['text'], 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', - 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], @@ -531,6 +574,8 @@ class ucp_profile 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) ); + add_form_key('ucp_sig'); + // Build custom bbcodes array display_custom_bbcodes(); @@ -540,10 +585,6 @@ class ucp_profile break; case 'avatar': - if (!function_exists('phpbb_get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - } add_form_key('ucp_avatar'); @@ -551,6 +592,7 @@ class ucp_profile if ($config['allow_avatar'] && $auth->acl_get('u_chgavatar')) { + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); @@ -589,30 +631,6 @@ class ucp_profile trigger_error($message); } } - else - { - if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type'])) - { - $driver->delete($avatar_data); - } - - $result = array( - 'user_avatar' => '', - 'user_avatar_type' => '', - 'user_avatar_width' => 0, - 'user_avatar_height' => 0, - ); - - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $result) . ' - WHERE user_id = ' . (int) $user->data['user_id']; - - $db->sql_query($sql); - - meta_refresh(3, $this->u_action); - $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); - trigger_error($message); - } } else { @@ -620,6 +638,27 @@ class ucp_profile } } + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (!confirm_box(true)) + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode)) + ); + } + else + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_'); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); + trigger_error($message); + } + } + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user->data['user_avatar_type'])); foreach ($avatar_drivers as $current_driver) @@ -672,7 +711,7 @@ class ucp_profile if ($submit) { - $keys = request_var('keys', array('')); + $keys = $request->variable('keys', array('')); if (!check_form_key('ucp_autologin_keys')) { @@ -683,9 +722,14 @@ class ucp_profile { if (!empty($keys)) { + foreach ($keys as $key => $id) + { + $keys[$key] = $db->sql_like_expression($id . $db->get_any_char()); + } + $sql_where = '(key_id ' . implode(' OR key_id ', $keys) . ')'; $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' WHERE user_id = ' . (int) $user->data['user_id'] . ' - AND ' . $db->sql_in_set('key_id', $keys) ; + AND ' . $sql_where ; $db->sql_query($sql); @@ -701,16 +745,15 @@ class ucp_profile $sql = 'SELECT key_id, last_ip, last_login FROM ' . SESSIONS_KEYS_TABLE . ' - WHERE user_id = ' . (int) $user->data['user_id']; + WHERE user_id = ' . (int) $user->data['user_id'] . ' + ORDER BY last_login ASC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('sessions', array( - 'errors' => $error, - - 'KEY' => $row['key_id'], + 'KEY' => substr($row['key_id'], 0, 8), 'IP' => $row['last_ip'], 'LOGIN_TIME' => $user->format_date($row['last_login']), )); @@ -722,6 +765,8 @@ class ucp_profile } $template->assign_vars(array( + 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', + 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index ff51ca7b3c..1b62790700 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * ucp_register * Board registration -* @package ucp */ class ucp_register { @@ -26,11 +29,12 @@ class ucp_register function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; - global $request, $phpbb_container; + global $config, $db, $user, $template, $phpbb_root_path, $phpEx; + global $request, $phpbb_container, $phpbb_dispatcher; // - if ($config['require_activation'] == USER_ACTIVATION_DISABLE) + if ($config['require_activation'] == USER_ACTIVATION_DISABLE || + (in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)) && !$config['email_enable'])) { trigger_error('UCP_REGISTER_DISABLE'); } @@ -38,8 +42,8 @@ class ucp_register $coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false; $agreed = $request->variable('agreed', false); $submit = $request->is_set_post('submit'); - $change_lang = request_var('change_lang', ''); - $user_lang = request_var('lang', $user->lang_name); + $change_lang = $request->variable('change_lang', ''); + $user_lang = $request->variable('lang', $user->lang_name); if ($agreed) { @@ -64,10 +68,7 @@ class ucp_register $agreed = false; } - $user->lang_name = $user_lang = $use_lang; - $user->lang = array(); - $user->data['user_lang'] = $user->lang_name; - $user->add_lang(array('common', 'ucp')); + $user_lang = $use_lang; } else { @@ -76,6 +77,7 @@ class ucp_register } } + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); $error = $cp_data = $cp_error = array(); @@ -87,8 +89,9 @@ class ucp_register if (!empty($login_link_data)) { // Confirm that we have all necessary data - $auth_provider = 'auth.provider.' . $request->variable('auth_provider', $config['auth_method']); - $auth_provider = $phpbb_container->get($auth_provider); + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider($request->variable('auth_provider', '')); $result = $auth_provider->login_link_has_necessary_data($login_link_data); if ($result !== null) @@ -101,7 +104,6 @@ class ucp_register if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable'])) { - $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : ''; $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; $s_hidden_fields = array_merge($s_hidden_fields, array( @@ -113,10 +115,10 @@ class ucp_register { // We do not include the password $s_hidden_fields = array_merge($s_hidden_fields, array( - 'username' => utf8_normalize_nfc(request_var('username', '', true)), - 'email' => strtolower(request_var('email', '')), + 'username' => $request->variable('username', '', true), + 'email' => strtolower($request->variable('email', '')), 'lang' => $user->lang_name, - 'tz' => request_var('tz', $config['board_timezone']), + 'tz' => $request->variable('tz', $config['board_timezone']), )); } @@ -147,12 +149,15 @@ class ucp_register 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), - 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $add_lang), - 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $add_lang), + 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0'), + 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1'), 'S_SHOW_COPPA' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), - 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang), + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], )); } else @@ -164,12 +169,25 @@ class ucp_register 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), - 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang . $add_coppa), + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_coppa), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], ) ); } unset($lang_row); + /** + * Allows to modify the agreements. + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_agreement + * @since 3.1.6-RC1 + */ + $phpbb_dispatcher->dispatch('core.ucp_register_agreement'); + $this->tpl_name = 'ucp_agreement'; return; } @@ -177,21 +195,33 @@ class ucp_register // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. if ($config['enable_confirm']) { - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_REG); } $timezone = $config['board_timezone']; $data = array( - 'username' => utf8_normalize_nfc(request_var('username', '', true)), + 'username' => $request->variable('username', '', true), 'new_password' => $request->variable('new_password', '', true), 'password_confirm' => $request->variable('password_confirm', '', true), - 'email' => strtolower(request_var('email', '')), - 'lang' => basename(request_var('lang', $user->lang_name)), - 'tz' => request_var('tz', $timezone), + 'email' => strtolower($request->variable('email', '')), + 'lang' => basename($request->variable('lang', $user->lang_name)), + 'tz' => $request->variable('tz', $timezone), ); + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_data_before + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp registration data + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_before', compact($vars))); // Check and initialize some variables if needed if ($submit) @@ -206,7 +236,7 @@ class ucp_register 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array( array('string', false, 6, 60), - array('email')), + array('user_email')), 'tz' => array('timezone'), 'lang' => array('language_iso_name'), )); @@ -252,6 +282,19 @@ class ucp_register $error[] = $user->lang['NEW_PASSWORD_ERROR']; } } + /** + * Check UCP registration data after they are submitted + * + * @event core.ucp_register_data_after + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp registration data + * @var array cp_data Array with custom profile fields data + * @var array error Array with list of errors + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data', 'cp_data', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_after', compact($vars))); if (!sizeof($error)) { @@ -293,6 +336,7 @@ class ucp_register } // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ $passwords_manager = $phpbb_container->get('passwords.manager'); $user_row = array( @@ -314,6 +358,20 @@ class ucp_register { $user_row['user_new'] = 1; } + /** + * Add into $user_row before user_add + * + * user_add allows adding more data into the users table + * + * @event core.ucp_register_user_row_after + * @var bool submit Do we display the form only + * or did the user press submit + * @var array cp_data Array with custom profile fields data + * @var array user_row Array with current ucp registration data + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'cp_data', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_user_row_after', compact($vars))); // Register user... $user_id = user_add($user_row, $cp_data); @@ -384,8 +442,9 @@ class ucp_register if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->add_notifications('admin_activate_user', array( + $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array( 'user_id' => $user_id, 'user_actkey' => $user_row['user_actkey'], 'user_regdate' => $user_row['user_regdate'], @@ -425,7 +484,6 @@ class ucp_register $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); } $s_hidden_fields = build_hidden_fields($s_hidden_fields); - $confirm_image = ''; // Visual Confirmation - Show images if ($config['enable_confirm']) @@ -448,7 +506,9 @@ class ucp_register break; } - $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); + // Assign template vars for timezone select + phpbb_timezone_select($template, $user, $data['tz'], true); + $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], @@ -461,14 +521,15 @@ class ucp_register 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), 'S_LANG_OPTIONS' => language_select($data['lang']), - 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], - 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], 'S_TZ_PRESELECT' => !$submit, 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, 'S_REGISTRATION' => true, 'S_COPPA' => $coppa, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], )); // diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 99e945eeae..0a46674fb1 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * ucp_remind * Sending password reminders -* @package ucp */ class ucp_remind { @@ -26,16 +29,16 @@ class ucp_remind function main($id, $mode) { - global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template, $phpbb_container; + global $config, $phpbb_root_path, $phpEx, $request; + global $db, $user, $template, $phpbb_container; if (!$config['allow_password_reset']) { trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>')); } - $username = request_var('username', '', true); - $email = strtolower(request_var('email', '')); + $username = $request->variable('username', '', true); + $email = strtolower($request->variable('email', '')); $submit = (isset($_POST['submit'])) ? true : false; if ($submit) @@ -89,6 +92,7 @@ class ucp_remind $user_actkey = gen_rand_string(mt_rand(6, 10)); // Instantiate passwords manager + /* @var $manager \phpbb\passwords\manager */ $passwords_manager = $phpbb_container->get('passwords.manager'); $sql = 'UPDATE ' . USERS_TABLE . " diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index ab396cdec9..44c54100cd 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,6 @@ if (!defined('IN_PHPBB')) /** * ucp_resend * Resending activation emails -* @package ucp */ class ucp_resend { @@ -27,10 +30,10 @@ class ucp_resend function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template; + global $db, $user, $auth, $template, $request; - $username = request_var('username', '', true); - $email = strtolower(request_var('email', '')); + $username = $request->variable('username', '', true); + $email = strtolower($request->variable('email', '')); $submit = (isset($_POST['submit'])) ? true : false; add_form_key('ucp_resend'); diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index 090f9bf34c..fa6a03f87c 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,17 +19,13 @@ if (!defined('IN_PHPBB')) exit; } -/** -* ucp_zebra -* @package ucp -*/ class ucp_zebra { var $u_action; function main($id, $mode) { - global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher; + global $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher; $submit = (isset($_POST['submit']) || isset($_GET['add']) || isset($_GET['remove'])) ? true : false; $s_hidden_fields = ''; @@ -44,7 +44,7 @@ class ucp_zebra foreach ($var_ary as $var => $default) { - $data[$var] = request_var($var, $default, true); + $data[$var] = $request->variable($var, $default, true); } if (!empty($data['add']) || sizeof($data['usernames'])) @@ -62,7 +62,7 @@ class ucp_zebra * @event core.ucp_remove_zebra * @var string mode Zebra type: friends|foes * @var array user_ids User ids we remove - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('mode', 'user_ids'); extract($phpbb_dispatcher->trigger_event('core.ucp_remove_zebra', compact($vars))); @@ -207,7 +207,7 @@ class ucp_zebra * friends|foes * @var array sql_ary Array of * entries we add - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('mode', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.ucp_add_zebra', compact($vars))); @@ -224,15 +224,15 @@ class ucp_zebra } } } - + if ($request->is_ajax()) { $message = ($updated) ? $user->lang[$l_mode . '_UPDATED'] : implode('<br />', $error); - + $json_response = new \phpbb\json_response; $json_response->send(array( 'success' => $updated, - + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $message, 'REFRESH_DATA' => array( diff --git a/phpBB/includes/utf/data/utf_canonical_comp.php b/phpBB/includes/utf/data/utf_canonical_comp.php deleted file mode 100644 index 2de3149ee8..0000000000 --- a/phpBB/includes/utf/data/utf_canonical_comp.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php -$GLOBALS['utf_canonical_comp']=array('AÌ€'=>'À','AÌ'=>'Ã','AÌ‚'=>'Â','Ã'=>'Ã','Ä'=>'Ä','AÌŠ'=>'Ã…','Ç'=>'Ç','EÌ€'=>'È','EÌ'=>'É','EÌ‚'=>'Ê','Ë'=>'Ë','IÌ€'=>'ÃŒ','IÌ'=>'Ã','IÌ‚'=>'ÃŽ','Ï'=>'Ã','Ñ'=>'Ñ','OÌ€'=>'Ã’','OÌ'=>'Ó','OÌ‚'=>'Ô','Õ'=>'Õ','Ö'=>'Ö','UÌ€'=>'Ù','UÌ'=>'Ú','UÌ‚'=>'Û','Ü'=>'Ü','YÌ'=>'Ã','aÌ€'=>'à ','aÌ'=>'á','aÌ‚'=>'â','ã'=>'ã','ä'=>'ä','aÌŠ'=>'Ã¥','ç'=>'ç','eÌ€'=>'è','eÌ'=>'é','eÌ‚'=>'ê','ë'=>'ë','iÌ€'=>'ì','iÌ'=>'Ã','iÌ‚'=>'î','ï'=>'ï','ñ'=>'ñ','oÌ€'=>'ò','oÌ'=>'ó','oÌ‚'=>'ô','õ'=>'õ','ö'=>'ö','uÌ€'=>'ù','uÌ'=>'ú','uÌ‚'=>'û','ü'=>'ü','yÌ'=>'ý','ÿ'=>'ÿ','AÌ„'=>'Ä€','aÌ„'=>'Ä','Ă'=>'Ä‚','ă'=>'ă','Ą'=>'Ä„','ą'=>'Ä…','CÌ'=>'Ć','cÌ'=>'ć','CÌ‚'=>'Ĉ','cÌ‚'=>'ĉ','Ċ'=>'ÄŠ','ċ'=>'Ä‹','CÌŒ'=>'ÄŒ','cÌŒ'=>'Ä','DÌŒ'=>'ÄŽ','dÌŒ'=>'Ä','EÌ„'=>'Ä’','eÌ„'=>'Ä“','Ĕ'=>'Ä”','ĕ'=>'Ä•','Ė'=>'Ä–','ė'=>'Ä—','Ę'=>'Ę','ę'=>'Ä™','EÌŒ'=>'Äš','eÌŒ'=>'Ä›','GÌ‚'=>'Äœ','gÌ‚'=>'Ä','Ğ'=>'Äž','ğ'=>'ÄŸ','Ġ'=>'Ä ','ġ'=>'Ä¡','Ģ'=>'Ä¢','ģ'=>'Ä£','HÌ‚'=>'Ĥ','hÌ‚'=>'Ä¥','Ĩ'=>'Ĩ','ĩ'=>'Ä©','IÌ„'=>'Ī','iÌ„'=>'Ä«','Ĭ'=>'Ĭ','ĭ'=>'Ä','Į'=>'Ä®','į'=>'į','İ'=>'İ','JÌ‚'=>'Ä´','jÌ‚'=>'ĵ','Ķ'=>'Ķ','ķ'=>'Ä·','LÌ'=>'Ĺ','lÌ'=>'ĺ','Ļ'=>'Ä»','ļ'=>'ļ','LÌŒ'=>'Ľ','lÌŒ'=>'ľ','NÌ'=>'Ń','nÌ'=>'Å„','Ņ'=>'Å…','ņ'=>'ņ','NÌŒ'=>'Ň','nÌŒ'=>'ň','OÌ„'=>'ÅŒ','oÌ„'=>'Å','Ŏ'=>'ÅŽ','ŏ'=>'Å','OÌ‹'=>'Å','oÌ‹'=>'Å‘','RÌ'=>'Å”','rÌ'=>'Å•','Ŗ'=>'Å–','ŗ'=>'Å—','RÌŒ'=>'Ř','rÌŒ'=>'Å™','SÌ'=>'Åš','sÌ'=>'Å›','SÌ‚'=>'Åœ','sÌ‚'=>'Å','Ş'=>'Åž','ş'=>'ÅŸ','SÌŒ'=>'Å ','sÌŒ'=>'Å¡','Ţ'=>'Å¢','ţ'=>'Å£','TÌŒ'=>'Ť','tÌŒ'=>'Å¥','Ũ'=>'Ũ','ũ'=>'Å©','UÌ„'=>'Ū','uÌ„'=>'Å«','Ŭ'=>'Ŭ','ŭ'=>'Å','UÌŠ'=>'Å®','uÌŠ'=>'ů','UÌ‹'=>'Ű','uÌ‹'=>'ű','Ų'=>'Ų','ų'=>'ų','WÌ‚'=>'Å´','wÌ‚'=>'ŵ','YÌ‚'=>'Ŷ','yÌ‚'=>'Å·','Ÿ'=>'Ÿ','ZÌ'=>'Ź','zÌ'=>'ź','Ż'=>'Å»','ż'=>'ż','ZÌŒ'=>'Ž','zÌŒ'=>'ž','OÌ›'=>'Æ ','oÌ›'=>'Æ¡','UÌ›'=>'Ư','uÌ›'=>'ư','AÌŒ'=>'Ç','aÌŒ'=>'ÇŽ','IÌŒ'=>'Ç','iÌŒ'=>'Ç','OÌŒ'=>'Ç‘','oÌŒ'=>'Ç’','UÌŒ'=>'Ç“','uÌŒ'=>'Ç”','Ǖ'=>'Ç•','ǖ'=>'Ç–','ÜÌ'=>'Ç—','üÌ'=>'ǘ','Ǚ'=>'Ç™','ǚ'=>'Çš','Ǜ'=>'Ç›','ǜ'=>'Çœ','Ǟ'=>'Çž','ǟ'=>'ÇŸ','Ǡ'=>'Ç ','ǡ'=>'Ç¡','Ǣ'=>'Ç¢','ǣ'=>'Ç£','GÌŒ'=>'Ǧ','gÌŒ'=>'ǧ','KÌŒ'=>'Ǩ','kÌŒ'=>'Ç©','Ǫ'=>'Ǫ','ǫ'=>'Ç«','Ǭ'=>'Ǭ','ǭ'=>'Ç','Æ·ÌŒ'=>'Ç®','Ê’ÌŒ'=>'ǯ','jÌŒ'=>'ǰ','GÌ'=>'Ç´','gÌ'=>'ǵ','NÌ€'=>'Ǹ','nÌ€'=>'ǹ','Ã…Ì'=>'Ǻ','Ã¥Ì'=>'Ç»','ÆÌ'=>'Ǽ','æÌ'=>'ǽ','ØÌ'=>'Ǿ','øÌ'=>'Ç¿','AÌ'=>'È€','aÌ'=>'È','AÌ‘'=>'È‚','aÌ‘'=>'ȃ','EÌ'=>'È„','eÌ'=>'È…','EÌ‘'=>'Ȇ','eÌ‘'=>'ȇ','IÌ'=>'Ȉ','iÌ'=>'ȉ','IÌ‘'=>'ÈŠ','iÌ‘'=>'È‹','OÌ'=>'ÈŒ','oÌ'=>'È','OÌ‘'=>'ÈŽ','oÌ‘'=>'È','RÌ'=>'È','rÌ'=>'È‘','RÌ‘'=>'È’','rÌ‘'=>'È“','UÌ'=>'È”','uÌ'=>'È•','UÌ‘'=>'È–','uÌ‘'=>'È—','Ș'=>'Ș','ș'=>'È™','Ț'=>'Èš','ț'=>'È›','HÌŒ'=>'Èž','hÌŒ'=>'ÈŸ','Ȧ'=>'Ȧ','ȧ'=>'ȧ','Ȩ'=>'Ȩ','ȩ'=>'È©','Ȫ'=>'Ȫ','ȫ'=>'È«','Ȭ'=>'Ȭ','ȭ'=>'È','Ȯ'=>'È®','ȯ'=>'ȯ','Ȱ'=>'Ȱ','ȱ'=>'ȱ','YÌ„'=>'Ȳ','yÌ„'=>'ȳ','̈Ì'=>'Í„','¨Ì'=>'Î…','ΑÌ'=>'Ά','ΕÌ'=>'Έ','ΗÌ'=>'Ή','ΙÌ'=>'Ί','ΟÌ'=>'ÎŒ','Î¥Ì'=>'ÎŽ','ΩÌ'=>'Î','ÏŠÌ'=>'Î','Ϊ'=>'Ϊ','Ϋ'=>'Ϋ','αÌ'=>'ά','εÌ'=>'Î','ηÌ'=>'ή','ιÌ'=>'ί','Ï‹Ì'=>'ΰ','ϊ'=>'ÏŠ','ϋ'=>'Ï‹','οÌ'=>'ÏŒ','Ï…Ì'=>'Ï','ωÌ'=>'ÏŽ','Ï’Ì'=>'Ï“','ϔ'=>'Ï”','Ѐ'=>'Ѐ','Ё'=>'Ð','ГÌ'=>'Ѓ','Ї'=>'Ї','КÌ'=>'ÐŒ','Ѝ'=>'Ð','Ў'=>'ÐŽ','Й'=>'Й','й'=>'й','ѐ'=>'Ñ','ё'=>'Ñ‘','гÌ'=>'Ñ“','ї'=>'Ñ—','кÌ'=>'Ñœ','ѝ'=>'Ñ','ў'=>'Ñž','Ñ´Ì'=>'Ѷ','ѵÌ'=>'Ñ·','Ӂ'=>'Ó','ӂ'=>'Ó‚','Ð̆'=>'Ó','ӑ'=>'Ó‘','Ð̈'=>'Ó’','ӓ'=>'Ó“','Ӗ'=>'Ó–','ӗ'=>'Ó—','Ӛ'=>'Óš','ӛ'=>'Ó›','Ӝ'=>'Óœ','ӝ'=>'Ó','Ӟ'=>'Óž','ӟ'=>'ÓŸ','Ӣ'=>'Ó¢','ӣ'=>'Ó£','Ӥ'=>'Ó¤','ӥ'=>'Ó¥','Ӧ'=>'Ó¦','ӧ'=>'Ó§','Ӫ'=>'Óª','ӫ'=>'Ó«','Ð̈'=>'Ó¬','Ñ̈'=>'Ó','Ӯ'=>'Ó®','ӯ'=>'Ó¯','Ӱ'=>'Ó°','ӱ'=>'Ó±','Ӳ'=>'Ó²','ӳ'=>'Ó³','Ӵ'=>'Ó´','ӵ'=>'Óµ','Ӹ'=>'Ó¸','ӹ'=>'Ó¹','آ'=>'Ø¢','أ'=>'Ø£','ÙˆÙ”'=>'ؤ','إ'=>'Ø¥','ÙŠÙ”'=>'ئ','Û•Ù”'=>'Û€','ÛÙ”'=>'Û‚','Û’Ù”'=>'Û“','ऩ'=>'ऩ','ऱ'=>'ऱ','ऴ'=>'ऴ','ো'=>'à§‹','ৌ'=>'à§Œ','à‡à–'=>'àˆ','à‡à¬¾'=>'à‹','à‡à—'=>'àŒ','ஔ'=>'à®”','ொ'=>'ொ','ோ'=>'ோ','ௌ'=>'ௌ','ై'=>'ై','ೀ'=>'à³€','ೇ'=>'ೇ','ೈ'=>'ೈ','ೊ'=>'ೊ','ೋ'=>'ೋ','ൊ'=>'ൊ','ോ'=>'ോ','ൌ'=>'ൌ','ේ'=>'à·š','à·™à·'=>'à·œ','ෝ'=>'à·','ෞ'=>'à·ž','ཱི'=>'ཱི','ཱུ'=>'ཱུ','ཱྀ'=>'à¾','ဦ'=>'ဦ','ᬆ'=>'ᬆ','ᬈ'=>'ᬈ','ᬊ'=>'ᬊ','ᬌ'=>'ᬌ','á¬á¬µ'=>'ᬎ','ᬒ'=>'ᬒ','ᬻ'=>'ᬻ','ᬽ'=>'ᬽ','ᭀ'=>'á€','ᭁ'=>'á','á‚ᬵ'=>'áƒ','AÌ¥'=>'Ḁ','aÌ¥'=>'á¸','Ḃ'=>'Ḃ','ḃ'=>'ḃ','BÌ£'=>'Ḅ','bÌ£'=>'ḅ','Ḇ'=>'Ḇ','ḇ'=>'ḇ','ÇÌ'=>'Ḉ','çÌ'=>'ḉ','Ḋ'=>'Ḋ','ḋ'=>'ḋ','DÌ£'=>'Ḍ','dÌ£'=>'á¸','Ḏ'=>'Ḏ','ḏ'=>'á¸','Ḑ'=>'á¸','ḑ'=>'ḑ','DÌ'=>'Ḓ','dÌ'=>'ḓ','Ä’Ì€'=>'Ḕ','ḕ'=>'ḕ','Ä’Ì'=>'Ḗ','Ä“Ì'=>'ḗ','EÌ'=>'Ḙ','eÌ'=>'ḙ','Ḛ'=>'Ḛ','ḛ'=>'ḛ','Ḝ'=>'Ḝ','ḝ'=>'á¸','Ḟ'=>'Ḟ','ḟ'=>'ḟ','GÌ„'=>'Ḡ','gÌ„'=>'ḡ','Ḣ'=>'Ḣ','ḣ'=>'ḣ','HÌ£'=>'Ḥ','hÌ£'=>'ḥ','Ḧ'=>'Ḧ','ḧ'=>'ḧ','Ḩ'=>'Ḩ','ḩ'=>'ḩ','HÌ®'=>'Ḫ','hÌ®'=>'ḫ','Ḭ'=>'Ḭ','ḭ'=>'á¸','ÃÌ'=>'Ḯ','ïÌ'=>'ḯ','KÌ'=>'Ḱ','kÌ'=>'ḱ','KÌ£'=>'Ḳ','kÌ£'=>'ḳ','Ḵ'=>'Ḵ','ḵ'=>'ḵ','LÌ£'=>'Ḷ','lÌ£'=>'ḷ','Ḹ'=>'Ḹ','ḹ'=>'ḹ','Ḻ'=>'Ḻ','ḻ'=>'ḻ','LÌ'=>'Ḽ','lÌ'=>'ḽ','MÌ'=>'Ḿ','mÌ'=>'ḿ','Ṁ'=>'á¹€','ṁ'=>'á¹','MÌ£'=>'Ṃ','mÌ£'=>'ṃ','Ṅ'=>'Ṅ','ṅ'=>'á¹…','NÌ£'=>'Ṇ','nÌ£'=>'ṇ','Ṉ'=>'Ṉ','ṉ'=>'ṉ','NÌ'=>'Ṋ','nÌ'=>'ṋ','ÕÌ'=>'Ṍ','õÌ'=>'á¹','Ṏ'=>'Ṏ','ṏ'=>'á¹','Ṑ'=>'á¹','ÅÌ€'=>'ṑ','ÅŒÌ'=>'á¹’','ÅÌ'=>'ṓ','PÌ'=>'á¹”','pÌ'=>'ṕ','Ṗ'=>'á¹–','ṗ'=>'á¹—','Ṙ'=>'Ṙ','ṙ'=>'á¹™','RÌ£'=>'Ṛ','rÌ£'=>'á¹›','Ṝ'=>'Ṝ','ṝ'=>'á¹','Ṟ'=>'Ṟ','ṟ'=>'ṟ','Ṡ'=>'á¹ ','ṡ'=>'ṡ','SÌ£'=>'á¹¢','sÌ£'=>'á¹£','Ṥ'=>'Ṥ','ṥ'=>'á¹¥','Ṧ'=>'Ṧ','ṧ'=>'á¹§','Ṩ'=>'Ṩ','ṩ'=>'ṩ','Ṫ'=>'Ṫ','ṫ'=>'ṫ','TÌ£'=>'Ṭ','tÌ£'=>'á¹','Ṯ'=>'á¹®','ṯ'=>'ṯ','TÌ'=>'á¹°','tÌ'=>'á¹±','Ṳ'=>'á¹²','ṳ'=>'á¹³','Ṵ'=>'á¹´','ṵ'=>'á¹µ','UÌ'=>'á¹¶','uÌ'=>'á¹·','ŨÌ'=>'Ṹ','Å©Ì'=>'á¹¹','Ṻ'=>'Ṻ','ṻ'=>'á¹»','Ṽ'=>'á¹¼','ṽ'=>'á¹½','VÌ£'=>'á¹¾','vÌ£'=>'ṿ','WÌ€'=>'Ẁ','wÌ€'=>'áº','WÌ'=>'Ẃ','wÌ'=>'ẃ','Ẅ'=>'Ẅ','ẅ'=>'ẅ','Ẇ'=>'Ẇ','ẇ'=>'ẇ','WÌ£'=>'Ẉ','wÌ£'=>'ẉ','Ẋ'=>'Ẋ','ẋ'=>'ẋ','Ẍ'=>'Ẍ','ẍ'=>'áº','Ẏ'=>'Ẏ','ẏ'=>'áº','ZÌ‚'=>'áº','zÌ‚'=>'ẑ','ZÌ£'=>'Ẓ','zÌ£'=>'ẓ','Ẕ'=>'Ẕ','ẕ'=>'ẕ','ẖ'=>'ẖ','ẗ'=>'ẗ','wÌŠ'=>'ẘ','yÌŠ'=>'ẙ','ẛ'=>'ẛ','AÌ£'=>'Ạ','aÌ£'=>'ạ','Ả'=>'Ả','ả'=>'ả','ÂÌ'=>'Ấ','âÌ'=>'ấ','Ầ'=>'Ầ','ầ'=>'ầ','Ẩ'=>'Ẩ','ẩ'=>'ẩ','Ẫ'=>'Ẫ','ẫ'=>'ẫ','Ậ'=>'Ậ','ậ'=>'áº','Ä‚Ì'=>'Ắ','ăÌ'=>'ắ','Ằ'=>'Ằ','ằ'=>'ằ','Ẳ'=>'Ẳ','ẳ'=>'ẳ','Ẵ'=>'Ẵ','ẵ'=>'ẵ','Ặ'=>'Ặ','ặ'=>'ặ','EÌ£'=>'Ẹ','eÌ£'=>'ẹ','Ẻ'=>'Ẻ','ẻ'=>'ẻ','Ẽ'=>'Ẽ','ẽ'=>'ẽ','ÊÌ'=>'Ế','êÌ'=>'ế','Ề'=>'Ề','ề'=>'á»','Ể'=>'Ể','ể'=>'ể','Ễ'=>'Ễ','ễ'=>'á»…','Ệ'=>'Ệ','ệ'=>'ệ','Ỉ'=>'Ỉ','ỉ'=>'ỉ','IÌ£'=>'Ị','iÌ£'=>'ị','OÌ£'=>'Ọ','oÌ£'=>'á»','Ỏ'=>'Ỏ','ỏ'=>'á»','ÔÌ'=>'á»','ôÌ'=>'ố','Ồ'=>'á»’','ồ'=>'ồ','Ổ'=>'á»”','ổ'=>'ổ','Ỗ'=>'á»–','ỗ'=>'á»—','Ộ'=>'Ộ','á»Ì‚'=>'á»™','Æ Ì'=>'Ớ','Æ¡Ì'=>'á»›','Æ Ì€'=>'Ờ','ờ'=>'á»','Æ Ì‰'=>'Ở','ở'=>'ở','Æ Ìƒ'=>'á» ','ỡ'=>'ỡ','Æ Ì£'=>'Ợ','ợ'=>'ợ','UÌ£'=>'Ụ','uÌ£'=>'ụ','Ủ'=>'Ủ','ủ'=>'á»§','ƯÌ'=>'Ứ','ưÌ'=>'ứ','Ừ'=>'Ừ','ừ'=>'ừ','Ử'=>'Ử','ử'=>'á»','Ữ'=>'á»®','ữ'=>'ữ','Ự'=>'á»°','ự'=>'á»±','YÌ€'=>'Ỳ','yÌ€'=>'ỳ','YÌ£'=>'á»´','yÌ£'=>'ỵ','Ỷ'=>'á»¶','ỷ'=>'á»·','Ỹ'=>'Ỹ','ỹ'=>'ỹ','ἀ'=>'á¼€','ἁ'=>'á¼','ἂ'=>'ἂ','á¼Ì€'=>'ἃ','á¼€Ì'=>'ἄ','á¼Ì'=>'á¼…','ἆ'=>'ἆ','á¼Í‚'=>'ἇ','Ἀ'=>'Ἀ','Ἁ'=>'Ἁ','Ἂ'=>'Ἂ','Ἃ'=>'Ἃ','ἈÌ'=>'Ἄ','ἉÌ'=>'á¼','Ἆ'=>'Ἆ','Ἇ'=>'á¼','ἐ'=>'á¼','ἑ'=>'ἑ','á¼Ì€'=>'á¼’','ἓ'=>'ἓ','á¼Ì'=>'á¼”','ἑÌ'=>'ἕ','Ἐ'=>'Ἐ','Ἑ'=>'á¼™','Ἒ'=>'Ἒ','Ἓ'=>'á¼›','ἘÌ'=>'Ἔ','á¼™Ì'=>'á¼','ἠ'=>'á¼ ','ἡ'=>'ἡ','ἢ'=>'á¼¢','ἣ'=>'á¼£','á¼ Ì'=>'ἤ','ἡÌ'=>'á¼¥','á¼ Í‚'=>'ἦ','ἧ'=>'á¼§','Ἠ'=>'Ἠ','Ἡ'=>'Ἡ','Ἢ'=>'Ἢ','Ἣ'=>'Ἣ','ἨÌ'=>'Ἤ','ἩÌ'=>'á¼','Ἦ'=>'á¼®','Ἧ'=>'Ἧ','ἰ'=>'á¼°','ἱ'=>'á¼±','á¼°Ì€'=>'á¼²','ἳ'=>'á¼³','á¼°Ì'=>'á¼´','á¼±Ì'=>'á¼µ','á¼°Í‚'=>'á¼¶','ἷ'=>'á¼·','Ἰ'=>'Ἰ','Ἱ'=>'á¼¹','Ἲ'=>'Ἲ','Ἳ'=>'á¼»','ἸÌ'=>'á¼¼','á¼¹Ì'=>'á¼½','Ἶ'=>'á¼¾','Ἷ'=>'Ἷ','ὀ'=>'á½€','ὁ'=>'á½','ὂ'=>'ὂ','á½Ì€'=>'ὃ','á½€Ì'=>'ὄ','á½Ì'=>'á½…','Ὀ'=>'Ὀ','Ὁ'=>'Ὁ','Ὂ'=>'Ὂ','Ὃ'=>'Ὃ','ὈÌ'=>'Ὄ','ὉÌ'=>'á½','Ï…Ì“'=>'á½','Ï…Ì”'=>'ὑ','á½Ì€'=>'á½’','ὓ'=>'ὓ','á½Ì'=>'á½”','ὑÌ'=>'ὕ','á½Í‚'=>'á½–','ὗ'=>'á½—','Ὑ'=>'á½™','Ὓ'=>'á½›','á½™Ì'=>'á½','Ὗ'=>'Ὗ','ὠ'=>'á½ ','ὡ'=>'ὡ','ὢ'=>'á½¢','ὣ'=>'á½£','á½ Ì'=>'ὤ','ὡÌ'=>'á½¥','á½ Í‚'=>'ὦ','ὧ'=>'á½§','Ὠ'=>'Ὠ','Ὡ'=>'Ὡ','Ὢ'=>'Ὢ','Ὣ'=>'Ὣ','ὨÌ'=>'Ὤ','ὩÌ'=>'á½','Ὦ'=>'á½®','Ὧ'=>'Ὧ','ὰ'=>'á½°','ὲ'=>'á½²','ὴ'=>'á½´','ὶ'=>'á½¶','ὸ'=>'ὸ','Ï…Ì€'=>'ὺ','ὼ'=>'á½¼','ᾀ'=>'á¾€','á¼Í…'=>'á¾','ᾂ'=>'ᾂ','ᾃ'=>'ᾃ','ᾄ'=>'ᾄ','á¼…Í…'=>'á¾…','ᾆ'=>'ᾆ','ᾇ'=>'ᾇ','ᾈ'=>'ᾈ','ᾉ'=>'ᾉ','ᾊ'=>'ᾊ','ᾋ'=>'ᾋ','ᾌ'=>'ᾌ','á¼Í…'=>'á¾','ᾎ'=>'ᾎ','á¼Í…'=>'á¾','á¼ Í…'=>'á¾','ᾑ'=>'ᾑ','ᾒ'=>'á¾’','ᾓ'=>'ᾓ','ᾔ'=>'á¾”','ᾕ'=>'ᾕ','ᾖ'=>'á¾–','á¼§Í…'=>'á¾—','ᾘ'=>'ᾘ','ᾙ'=>'á¾™','ᾚ'=>'ᾚ','ᾛ'=>'á¾›','ᾜ'=>'ᾜ','á¼Í…'=>'á¾','ᾞ'=>'ᾞ','ᾟ'=>'ᾟ','á½ Í…'=>'á¾ ','ᾡ'=>'ᾡ','ᾢ'=>'á¾¢','ᾣ'=>'á¾£','ᾤ'=>'ᾤ','ᾥ'=>'á¾¥','ᾦ'=>'ᾦ','á½§Í…'=>'á¾§','ᾨ'=>'ᾨ','ᾩ'=>'ᾩ','ᾪ'=>'ᾪ','ᾫ'=>'ᾫ','ᾬ'=>'ᾬ','á½Í…'=>'á¾','ᾮ'=>'á¾®','ᾯ'=>'ᾯ','ᾰ'=>'á¾°','ᾱ'=>'á¾±','á½°Í…'=>'á¾²','ᾳ'=>'á¾³','ᾴ'=>'á¾´','ᾶ'=>'á¾¶','á¾¶Í…'=>'á¾·','Ᾰ'=>'Ᾰ','Ᾱ'=>'á¾¹','Ὰ'=>'Ὰ','ᾼ'=>'á¾¼','῁'=>'á¿','á½´Í…'=>'á¿‚','ῃ'=>'ῃ','ῄ'=>'á¿„','ῆ'=>'ῆ','ῇ'=>'ῇ','Ὲ'=>'Ὲ','Ὴ'=>'Ὴ','ῌ'=>'ῌ','῍'=>'á¿','᾿Ì'=>'῎','῏'=>'á¿','ῐ'=>'á¿','ῑ'=>'á¿‘','ÏŠÌ€'=>'á¿’','ῖ'=>'á¿–','ÏŠÍ‚'=>'á¿—','Ῐ'=>'Ῐ','Ῑ'=>'á¿™','Ὶ'=>'Ὶ','῝'=>'á¿','῾Ì'=>'῞','῟'=>'῟','ῠ'=>'á¿ ','Ï…Ì„'=>'á¿¡','ῢ'=>'á¿¢','ÏÌ“'=>'ῤ','ÏÌ”'=>'á¿¥','Ï…Í‚'=>'ῦ','ῧ'=>'á¿§','Ῠ'=>'Ῠ','Ῡ'=>'á¿©','Ὺ'=>'Ὺ','Ῥ'=>'Ῥ','῭'=>'á¿','ῲ'=>'ῲ','ῳ'=>'ῳ','ÏŽÍ…'=>'á¿´','ῶ'=>'á¿¶','á¿¶Í…'=>'á¿·','Ὸ'=>'Ὸ','Ὼ'=>'Ὼ','ῼ'=>'ῼ','â†Ì¸'=>'↚','↛'=>'↛','↮'=>'↮','â‡Ì¸'=>'â‡','⇎'=>'⇎','⇏'=>'â‡','∄'=>'∄','∉'=>'∉','∌'=>'∌','∤'=>'∤','∦'=>'∦','≁'=>'â‰','≄'=>'≄','≇'=>'≇','≉'=>'≉','≠'=>'≠','≢'=>'≢','â‰Ì¸'=>'â‰','≮'=>'≮','≯'=>'≯','≰'=>'≰','≱'=>'≱','≴'=>'≴','≵'=>'≵','≸'=>'≸','≹'=>'≹','⊀'=>'⊀','⊁'=>'âŠ','⊄'=>'⊄','⊅'=>'⊅','⊈'=>'⊈','⊉'=>'⊉','⊬'=>'⊬','⊭'=>'âŠ','⊮'=>'⊮','⊯'=>'⊯','⋠'=>'â‹ ','⋡'=>'â‹¡','⋢'=>'â‹¢','⋣'=>'â‹£','⋪'=>'⋪','⋫'=>'â‹«','⋬'=>'⋬','⋭'=>'â‹','ã‹ã‚™'=>'ãŒ','ãã‚™'=>'ãŽ','ãã‚™'=>'ã','ã‘ã‚™'=>'ã’','ã“ã‚™'=>'ã”','ã•ã‚™'=>'ã–','ã—ã‚™'=>'ã˜','ã™ã‚™'=>'ãš','ã›ã‚™'=>'ãœ','ãã‚™'=>'ãž','ãŸã‚™'=>'ã ','ã¡ã‚™'=>'ã¢','ã¤ã‚™'=>'ã¥','ã¦ã‚™'=>'ã§','ã¨ã‚™'=>'ã©','ã¯ã‚™'=>'ã°','ã¯ã‚š'=>'ã±','ã²ã‚™'=>'ã³','ã²ã‚š'=>'ã´','ãµã‚™'=>'ã¶','ãµã‚š'=>'ã·','ã¸ã‚™'=>'ã¹','ã¸ã‚š'=>'ãº','ã»ã‚™'=>'ã¼','ã»ã‚š'=>'ã½','ã†ã‚™'=>'ã‚”','ã‚ã‚™'=>'ゞ','ã‚«ã‚™'=>'ガ','ã‚ã‚™'=>'ã‚®','グ'=>'ã‚°','ゲ'=>'ゲ','ゴ'=>'ã‚´','ザ'=>'ã‚¶','ã‚·ã‚™'=>'ジ','ズ'=>'ズ','ゼ'=>'ゼ','ゾ'=>'ゾ','ã‚¿ã‚™'=>'ダ','ãƒã‚™'=>'ヂ','ヅ'=>'ヅ','デ'=>'デ','ド'=>'ド','ãƒã‚™'=>'ãƒ','ãƒã‚š'=>'パ','ビ'=>'ビ','ピ'=>'ピ','ブ'=>'ブ','プ'=>'プ','ベ'=>'ベ','ペ'=>'ペ','ボ'=>'ボ','ポ'=>'ãƒ','ヴ'=>'ヴ','ヷ'=>'ヷ','ヸ'=>'ヸ','ヹ'=>'ヹ','ヺ'=>'ヺ','ヾ'=>'ヾ'); diff --git a/phpBB/includes/utf/data/utf_canonical_decomp.php b/phpBB/includes/utf/data/utf_canonical_decomp.php deleted file mode 100644 index 9fb90803e2..0000000000 --- a/phpBB/includes/utf/data/utf_canonical_decomp.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php -$GLOBALS['utf_canonical_decomp']=array('À'=>'AÌ€','Ã'=>'AÌ','Â'=>'AÌ‚','Ã'=>'Ã','Ä'=>'Ä','Ã…'=>'AÌŠ','Ç'=>'Ç','È'=>'EÌ€','É'=>'EÌ','Ê'=>'EÌ‚','Ë'=>'Ë','ÃŒ'=>'IÌ€','Ã'=>'IÌ','ÃŽ'=>'IÌ‚','Ã'=>'Ï','Ñ'=>'Ñ','Ã’'=>'OÌ€','Ó'=>'OÌ','Ô'=>'OÌ‚','Õ'=>'Õ','Ö'=>'Ö','Ù'=>'UÌ€','Ú'=>'UÌ','Û'=>'UÌ‚','Ü'=>'Ü','Ã'=>'YÌ','à '=>'aÌ€','á'=>'aÌ','â'=>'aÌ‚','ã'=>'ã','ä'=>'ä','Ã¥'=>'aÌŠ','ç'=>'ç','è'=>'eÌ€','é'=>'eÌ','ê'=>'eÌ‚','ë'=>'ë','ì'=>'iÌ€','Ã'=>'iÌ','î'=>'iÌ‚','ï'=>'ï','ñ'=>'ñ','ò'=>'oÌ€','ó'=>'oÌ','ô'=>'oÌ‚','õ'=>'õ','ö'=>'ö','ù'=>'uÌ€','ú'=>'uÌ','û'=>'uÌ‚','ü'=>'ü','ý'=>'yÌ','ÿ'=>'ÿ','Ä€'=>'AÌ„','Ä'=>'aÌ„','Ä‚'=>'Ă','ă'=>'ă','Ä„'=>'Ą','Ä…'=>'ą','Ć'=>'CÌ','ć'=>'cÌ','Ĉ'=>'CÌ‚','ĉ'=>'cÌ‚','ÄŠ'=>'Ċ','Ä‹'=>'ċ','ÄŒ'=>'CÌŒ','Ä'=>'cÌŒ','ÄŽ'=>'DÌŒ','Ä'=>'dÌŒ','Ä’'=>'EÌ„','Ä“'=>'eÌ„','Ä”'=>'Ĕ','Ä•'=>'ĕ','Ä–'=>'Ė','Ä—'=>'ė','Ę'=>'Ę','Ä™'=>'ę','Äš'=>'EÌŒ','Ä›'=>'eÌŒ','Äœ'=>'GÌ‚','Ä'=>'gÌ‚','Äž'=>'Ğ','ÄŸ'=>'ğ','Ä '=>'Ġ','Ä¡'=>'ġ','Ä¢'=>'Ģ','Ä£'=>'ģ','Ĥ'=>'HÌ‚','Ä¥'=>'hÌ‚','Ĩ'=>'Ĩ','Ä©'=>'ĩ','Ī'=>'IÌ„','Ä«'=>'iÌ„','Ĭ'=>'Ĭ','Ä'=>'ĭ','Ä®'=>'Į','į'=>'į','İ'=>'İ','Ä´'=>'JÌ‚','ĵ'=>'jÌ‚','Ķ'=>'Ķ','Ä·'=>'ķ','Ĺ'=>'LÌ','ĺ'=>'lÌ','Ä»'=>'Ļ','ļ'=>'ļ','Ľ'=>'LÌŒ','ľ'=>'lÌŒ','Ń'=>'NÌ','Å„'=>'nÌ','Å…'=>'Ņ','ņ'=>'ņ','Ň'=>'NÌŒ','ň'=>'nÌŒ','ÅŒ'=>'OÌ„','Å'=>'oÌ„','ÅŽ'=>'Ŏ','Å'=>'ŏ','Å'=>'OÌ‹','Å‘'=>'oÌ‹','Å”'=>'RÌ','Å•'=>'rÌ','Å–'=>'Ŗ','Å—'=>'ŗ','Ř'=>'RÌŒ','Å™'=>'rÌŒ','Åš'=>'SÌ','Å›'=>'sÌ','Åœ'=>'SÌ‚','Å'=>'sÌ‚','Åž'=>'Ş','ÅŸ'=>'ş','Å '=>'SÌŒ','Å¡'=>'sÌŒ','Å¢'=>'Ţ','Å£'=>'ţ','Ť'=>'TÌŒ','Å¥'=>'tÌŒ','Ũ'=>'Ũ','Å©'=>'ũ','Ū'=>'UÌ„','Å«'=>'uÌ„','Ŭ'=>'Ŭ','Å'=>'ŭ','Å®'=>'UÌŠ','ů'=>'uÌŠ','Ű'=>'UÌ‹','ű'=>'uÌ‹','Ų'=>'Ų','ų'=>'ų','Å´'=>'WÌ‚','ŵ'=>'wÌ‚','Ŷ'=>'YÌ‚','Å·'=>'yÌ‚','Ÿ'=>'Ÿ','Ź'=>'ZÌ','ź'=>'zÌ','Å»'=>'Ż','ż'=>'ż','Ž'=>'ZÌŒ','ž'=>'zÌŒ','Æ '=>'OÌ›','Æ¡'=>'oÌ›','Ư'=>'UÌ›','ư'=>'uÌ›','Ç'=>'AÌŒ','ÇŽ'=>'aÌŒ','Ç'=>'IÌŒ','Ç'=>'iÌŒ','Ç‘'=>'OÌŒ','Ç’'=>'oÌŒ','Ç“'=>'UÌŒ','Ç”'=>'uÌŒ','Ç•'=>'Ǖ','Ç–'=>'ǖ','Ç—'=>'ÜÌ','ǘ'=>'üÌ','Ç™'=>'Ǚ','Çš'=>'ǚ','Ç›'=>'Ǜ','Çœ'=>'ǜ','Çž'=>'Ǟ','ÇŸ'=>'ǟ','Ç '=>'Ǡ','Ç¡'=>'ǡ','Ç¢'=>'Ǣ','Ç£'=>'ǣ','Ǧ'=>'GÌŒ','ǧ'=>'gÌŒ','Ǩ'=>'KÌŒ','Ç©'=>'kÌŒ','Ǫ'=>'Ǫ','Ç«'=>'ǫ','Ǭ'=>'Ǭ','Ç'=>'ǭ','Ç®'=>'Æ·ÌŒ','ǯ'=>'Ê’ÌŒ','ǰ'=>'jÌŒ','Ç´'=>'GÌ','ǵ'=>'gÌ','Ǹ'=>'NÌ€','ǹ'=>'nÌ€','Ǻ'=>'AÌŠÌ','Ç»'=>'aÌŠÌ','Ǽ'=>'ÆÌ','ǽ'=>'æÌ','Ǿ'=>'ØÌ','Ç¿'=>'øÌ','È€'=>'AÌ','È'=>'aÌ','È‚'=>'AÌ‘','ȃ'=>'aÌ‘','È„'=>'EÌ','È…'=>'eÌ','Ȇ'=>'EÌ‘','ȇ'=>'eÌ‘','Ȉ'=>'IÌ','ȉ'=>'iÌ','ÈŠ'=>'IÌ‘','È‹'=>'iÌ‘','ÈŒ'=>'OÌ','È'=>'oÌ','ÈŽ'=>'OÌ‘','È'=>'oÌ‘','È'=>'RÌ','È‘'=>'rÌ','È’'=>'RÌ‘','È“'=>'rÌ‘','È”'=>'UÌ','È•'=>'uÌ','È–'=>'UÌ‘','È—'=>'uÌ‘','Ș'=>'Ș','È™'=>'ș','Èš'=>'Ț','È›'=>'ț','Èž'=>'HÌŒ','ÈŸ'=>'hÌŒ','Ȧ'=>'Ȧ','ȧ'=>'ȧ','Ȩ'=>'Ȩ','È©'=>'ȩ','Ȫ'=>'Ȫ','È«'=>'ȫ','Ȭ'=>'Ȭ','È'=>'ȭ','È®'=>'Ȯ','ȯ'=>'ȯ','Ȱ'=>'Ȱ','ȱ'=>'ȱ','Ȳ'=>'YÌ„','ȳ'=>'yÌ„','Í€'=>'Ì€','Í'=>'Ì','̓'=>'Ì“','Í„'=>'̈Ì','Í´'=>'ʹ',';'=>';','Î…'=>'¨Ì','Ά'=>'ΑÌ','·'=>'·','Έ'=>'ΕÌ','Ή'=>'ΗÌ','Ί'=>'ΙÌ','ÎŒ'=>'ΟÌ','ÎŽ'=>'Î¥Ì','Î'=>'ΩÌ','Î'=>'ϊÌ','Ϊ'=>'Ϊ','Ϋ'=>'Ϋ','ά'=>'αÌ','Î'=>'εÌ','ή'=>'ηÌ','ί'=>'ιÌ','ΰ'=>'ϋÌ','ÏŠ'=>'ϊ','Ï‹'=>'ϋ','ÏŒ'=>'οÌ','Ï'=>'Ï…Ì','ÏŽ'=>'ωÌ','Ï“'=>'Ï’Ì','Ï”'=>'ϔ','Ѐ'=>'Ѐ','Ð'=>'Ё','Ѓ'=>'ГÌ','Ї'=>'Ї','ÐŒ'=>'КÌ','Ð'=>'Ѝ','ÐŽ'=>'Ў','Й'=>'Й','й'=>'й','Ñ'=>'ѐ','Ñ‘'=>'ё','Ñ“'=>'гÌ','Ñ—'=>'ї','Ñœ'=>'кÌ','Ñ'=>'ѝ','Ñž'=>'ў','Ѷ'=>'Ñ´Ì','Ñ·'=>'ѵÌ','Ó'=>'Ӂ','Ó‚'=>'ӂ','Ó'=>'Ð̆','Ó‘'=>'ӑ','Ó’'=>'Ð̈','Ó“'=>'ӓ','Ó–'=>'Ӗ','Ó—'=>'ӗ','Óš'=>'Ӛ','Ó›'=>'ӛ','Óœ'=>'Ӝ','Ó'=>'ӝ','Óž'=>'Ӟ','ÓŸ'=>'ӟ','Ó¢'=>'Ӣ','Ó£'=>'ӣ','Ó¤'=>'Ӥ','Ó¥'=>'ӥ','Ó¦'=>'Ӧ','Ó§'=>'ӧ','Óª'=>'Ӫ','Ó«'=>'ӫ','Ó¬'=>'Ð̈','Ó'=>'Ñ̈','Ó®'=>'Ӯ','Ó¯'=>'ӯ','Ó°'=>'Ӱ','Ó±'=>'ӱ','Ó²'=>'Ӳ','Ó³'=>'ӳ','Ó´'=>'Ӵ','Óµ'=>'ӵ','Ó¸'=>'Ӹ','Ó¹'=>'ӹ','Ø¢'=>'آ','Ø£'=>'أ','ؤ'=>'ÙˆÙ”','Ø¥'=>'إ','ئ'=>'ÙŠÙ”','Û€'=>'Û•Ù”','Û‚'=>'ÛÙ”','Û“'=>'Û’Ù”','ऩ'=>'ऩ','ऱ'=>'ऱ','ऴ'=>'ऴ','क़'=>'क़','ख़'=>'ख़','ग़'=>'ग़','ज़'=>'ज़','ड़'=>'ड़','à¥'=>'ढ़','फ़'=>'फ़','य़'=>'य़','à§‹'=>'ো','à§Œ'=>'ৌ','à§œ'=>'ড়','à§'=>'ঢ়','à§Ÿ'=>'য়','ਲ਼'=>'ਲ਼','ਸ਼'=>'ਸ਼','à©™'=>'ਖ਼','ਗ਼'=>'ਗ਼','à©›'=>'ਜ਼','ਫ਼'=>'ਫ਼','àˆ'=>'à‡à–','à‹'=>'à‡à¬¾','àŒ'=>'à‡à—','àœ'=>'ଡ଼','à'=>'ଢ଼','à®”'=>'ஔ','ொ'=>'ொ','ோ'=>'ோ','ௌ'=>'ௌ','ై'=>'ై','à³€'=>'ೀ','ೇ'=>'ೇ','ೈ'=>'ೈ','ೊ'=>'ೊ','ೋ'=>'ೋ','ൊ'=>'ൊ','ോ'=>'ോ','ൌ'=>'ൌ','à·š'=>'ේ','à·œ'=>'à·™à·','à·'=>'à·™à·à·Š','à·ž'=>'ෞ','གྷ'=>'གྷ','à½'=>'ཌྷ','དྷ'=>'དྷ','བྷ'=>'བྷ','ཛྷ'=>'ཛྷ','ཀྵ'=>'ཀྵ','ཱི'=>'ཱི','ཱུ'=>'ཱུ','ྲྀ'=>'ྲྀ','ླྀ'=>'ླྀ','à¾'=>'ཱྀ','ྒྷ'=>'ྒྷ','à¾'=>'ྜྷ','ྡྷ'=>'ྡྷ','ྦྷ'=>'ྦྷ','ྫྷ'=>'ྫྷ','ྐྵ'=>'à¾à¾µ','ဦ'=>'ဦ','ᬆ'=>'ᬆ','ᬈ'=>'ᬈ','ᬊ'=>'ᬊ','ᬌ'=>'ᬌ','ᬎ'=>'á¬á¬µ','ᬒ'=>'ᬒ','ᬻ'=>'ᬻ','ᬽ'=>'ᬽ','á€'=>'ᭀ','á'=>'ᭁ','áƒ'=>'á‚ᬵ','Ḁ'=>'AÌ¥','á¸'=>'aÌ¥','Ḃ'=>'Ḃ','ḃ'=>'ḃ','Ḅ'=>'BÌ£','ḅ'=>'bÌ£','Ḇ'=>'Ḇ','ḇ'=>'ḇ','Ḉ'=>'ÇÌ','ḉ'=>'çÌ','Ḋ'=>'Ḋ','ḋ'=>'ḋ','Ḍ'=>'DÌ£','á¸'=>'dÌ£','Ḏ'=>'Ḏ','á¸'=>'ḏ','á¸'=>'Ḑ','ḑ'=>'ḑ','Ḓ'=>'DÌ','ḓ'=>'dÌ','Ḕ'=>'Ḕ','ḕ'=>'ḕ','Ḗ'=>'EÌ„Ì','ḗ'=>'eÌ„Ì','Ḙ'=>'EÌ','ḙ'=>'eÌ','Ḛ'=>'Ḛ','ḛ'=>'ḛ','Ḝ'=>'Ḝ','á¸'=>'ḝ','Ḟ'=>'Ḟ','ḟ'=>'ḟ','Ḡ'=>'GÌ„','ḡ'=>'gÌ„','Ḣ'=>'Ḣ','ḣ'=>'ḣ','Ḥ'=>'HÌ£','ḥ'=>'hÌ£','Ḧ'=>'Ḧ','ḧ'=>'ḧ','Ḩ'=>'Ḩ','ḩ'=>'ḩ','Ḫ'=>'HÌ®','ḫ'=>'hÌ®','Ḭ'=>'Ḭ','á¸'=>'ḭ','Ḯ'=>'ÏÌ','ḯ'=>'ïÌ','Ḱ'=>'KÌ','ḱ'=>'kÌ','Ḳ'=>'KÌ£','ḳ'=>'kÌ£','Ḵ'=>'Ḵ','ḵ'=>'ḵ','Ḷ'=>'LÌ£','ḷ'=>'lÌ£','Ḹ'=>'Ḹ','ḹ'=>'ḹ','Ḻ'=>'Ḻ','ḻ'=>'ḻ','Ḽ'=>'LÌ','ḽ'=>'lÌ','Ḿ'=>'MÌ','ḿ'=>'mÌ','á¹€'=>'Ṁ','á¹'=>'ṁ','Ṃ'=>'MÌ£','ṃ'=>'mÌ£','Ṅ'=>'Ṅ','á¹…'=>'ṅ','Ṇ'=>'NÌ£','ṇ'=>'nÌ£','Ṉ'=>'Ṉ','ṉ'=>'ṉ','Ṋ'=>'NÌ','ṋ'=>'nÌ','Ṍ'=>'ÕÌ','á¹'=>'õÌ','Ṏ'=>'Ṏ','á¹'=>'ṏ','á¹'=>'Ṑ','ṑ'=>'ṑ','á¹’'=>'OÌ„Ì','ṓ'=>'oÌ„Ì','á¹”'=>'PÌ','ṕ'=>'pÌ','á¹–'=>'Ṗ','á¹—'=>'ṗ','Ṙ'=>'Ṙ','á¹™'=>'ṙ','Ṛ'=>'RÌ£','á¹›'=>'rÌ£','Ṝ'=>'Ṝ','á¹'=>'ṝ','Ṟ'=>'Ṟ','ṟ'=>'ṟ','á¹ '=>'Ṡ','ṡ'=>'ṡ','á¹¢'=>'SÌ£','á¹£'=>'sÌ£','Ṥ'=>'SÌ̇','á¹¥'=>'sÌ̇','Ṧ'=>'Ṧ','á¹§'=>'ṧ','Ṩ'=>'Ṩ','ṩ'=>'ṩ','Ṫ'=>'Ṫ','ṫ'=>'ṫ','Ṭ'=>'TÌ£','á¹'=>'tÌ£','á¹®'=>'Ṯ','ṯ'=>'ṯ','á¹°'=>'TÌ','á¹±'=>'tÌ','á¹²'=>'Ṳ','á¹³'=>'ṳ','á¹´'=>'Ṵ','á¹µ'=>'ṵ','á¹¶'=>'UÌ','á¹·'=>'uÌ','Ṹ'=>'ŨÌ','á¹¹'=>'ũÌ','Ṻ'=>'Ṻ','á¹»'=>'ṻ','á¹¼'=>'Ṽ','á¹½'=>'ṽ','á¹¾'=>'VÌ£','ṿ'=>'vÌ£','Ẁ'=>'WÌ€','áº'=>'wÌ€','Ẃ'=>'WÌ','ẃ'=>'wÌ','Ẅ'=>'Ẅ','ẅ'=>'ẅ','Ẇ'=>'Ẇ','ẇ'=>'ẇ','Ẉ'=>'WÌ£','ẉ'=>'wÌ£','Ẋ'=>'Ẋ','ẋ'=>'ẋ','Ẍ'=>'Ẍ','áº'=>'ẍ','Ẏ'=>'Ẏ','áº'=>'ẏ','áº'=>'ZÌ‚','ẑ'=>'zÌ‚','Ẓ'=>'ZÌ£','ẓ'=>'zÌ£','Ẕ'=>'Ẕ','ẕ'=>'ẕ','ẖ'=>'ẖ','ẗ'=>'ẗ','ẘ'=>'wÌŠ','ẙ'=>'yÌŠ','ẛ'=>'ẛ','Ạ'=>'AÌ£','ạ'=>'aÌ£','Ả'=>'Ả','ả'=>'ả','Ấ'=>'AÌ‚Ì','ấ'=>'aÌ‚Ì','Ầ'=>'Ầ','ầ'=>'ầ','Ẩ'=>'Ẩ','ẩ'=>'ẩ','Ẫ'=>'Ẫ','ẫ'=>'ẫ','Ậ'=>'Ậ','áº'=>'ậ','Ắ'=>'ĂÌ','ắ'=>'ăÌ','Ằ'=>'Ằ','ằ'=>'ằ','Ẳ'=>'Ẳ','ẳ'=>'ẳ','Ẵ'=>'Ẵ','ẵ'=>'ẵ','Ặ'=>'Ặ','ặ'=>'ặ','Ẹ'=>'EÌ£','ẹ'=>'eÌ£','Ẻ'=>'Ẻ','ẻ'=>'ẻ','Ẽ'=>'Ẽ','ẽ'=>'ẽ','Ế'=>'EÌ‚Ì','ế'=>'eÌ‚Ì','Ề'=>'Ề','á»'=>'ề','Ể'=>'Ể','ể'=>'ể','Ễ'=>'Ễ','á»…'=>'ễ','Ệ'=>'Ệ','ệ'=>'ệ','Ỉ'=>'Ỉ','ỉ'=>'ỉ','Ị'=>'IÌ£','ị'=>'iÌ£','Ọ'=>'OÌ£','á»'=>'oÌ£','Ỏ'=>'Ỏ','á»'=>'ỏ','á»'=>'OÌ‚Ì','ố'=>'oÌ‚Ì','á»’'=>'Ồ','ồ'=>'ồ','á»”'=>'Ổ','ổ'=>'ổ','á»–'=>'Ỗ','á»—'=>'ỗ','Ộ'=>'Ộ','á»™'=>'ộ','Ớ'=>'OÌ›Ì','á»›'=>'oÌ›Ì','Ờ'=>'Ờ','á»'=>'ờ','Ở'=>'Ở','ở'=>'ở','á» '=>'Ỡ','ỡ'=>'ỡ','Ợ'=>'Ợ','ợ'=>'ợ','Ụ'=>'UÌ£','ụ'=>'uÌ£','Ủ'=>'Ủ','á»§'=>'ủ','Ứ'=>'UÌ›Ì','ứ'=>'uÌ›Ì','Ừ'=>'Ừ','ừ'=>'ừ','Ử'=>'Ử','á»'=>'ử','á»®'=>'Ữ','ữ'=>'ữ','á»°'=>'Ự','á»±'=>'ự','Ỳ'=>'YÌ€','ỳ'=>'yÌ€','á»´'=>'YÌ£','ỵ'=>'yÌ£','á»¶'=>'Ỷ','á»·'=>'ỷ','Ỹ'=>'Ỹ','ỹ'=>'ỹ','á¼€'=>'ἀ','á¼'=>'ἁ','ἂ'=>'ἂ','ἃ'=>'ἃ','ἄ'=>'ἀÌ','á¼…'=>'ἁÌ','ἆ'=>'ἆ','ἇ'=>'ἇ','Ἀ'=>'Ἀ','Ἁ'=>'Ἁ','Ἂ'=>'Ἂ','Ἃ'=>'Ἃ','Ἄ'=>'ἈÌ','á¼'=>'ἉÌ','Ἆ'=>'Ἆ','á¼'=>'Ἇ','á¼'=>'ἐ','ἑ'=>'ἑ','á¼’'=>'ἒ','ἓ'=>'ἓ','á¼”'=>'ἐÌ','ἕ'=>'ἑÌ','Ἐ'=>'Ἐ','á¼™'=>'Ἑ','Ἒ'=>'Ἒ','á¼›'=>'Ἓ','Ἔ'=>'ἘÌ','á¼'=>'ἙÌ','á¼ '=>'ἠ','ἡ'=>'ἡ','á¼¢'=>'ἢ','á¼£'=>'ἣ','ἤ'=>'ἠÌ','á¼¥'=>'ἡÌ','ἦ'=>'ἦ','á¼§'=>'ἧ','Ἠ'=>'Ἠ','Ἡ'=>'Ἡ','Ἢ'=>'Ἢ','Ἣ'=>'Ἣ','Ἤ'=>'ἨÌ','á¼'=>'ἩÌ','á¼®'=>'Ἦ','Ἧ'=>'Ἧ','á¼°'=>'ἰ','á¼±'=>'ἱ','á¼²'=>'ἲ','á¼³'=>'ἳ','á¼´'=>'ἰÌ','á¼µ'=>'ἱÌ','á¼¶'=>'ἶ','á¼·'=>'ἷ','Ἰ'=>'Ἰ','á¼¹'=>'Ἱ','Ἲ'=>'Ἲ','á¼»'=>'Ἳ','á¼¼'=>'ἸÌ','á¼½'=>'ἹÌ','á¼¾'=>'Ἶ','Ἷ'=>'Ἷ','á½€'=>'ὀ','á½'=>'ὁ','ὂ'=>'ὂ','ὃ'=>'ὃ','ὄ'=>'ὀÌ','á½…'=>'ὁÌ','Ὀ'=>'Ὀ','Ὁ'=>'Ὁ','Ὂ'=>'Ὂ','Ὃ'=>'Ὃ','Ὄ'=>'ὈÌ','á½'=>'ὉÌ','á½'=>'Ï…Ì“','ὑ'=>'Ï…Ì”','á½’'=>'ὒ','ὓ'=>'ὓ','á½”'=>'Ï…Ì“Ì','ὕ'=>'Ï…Ì”Ì','á½–'=>'ὖ','á½—'=>'ὗ','á½™'=>'Ὑ','á½›'=>'Ὓ','á½'=>'ὙÌ','Ὗ'=>'Ὗ','á½ '=>'ὠ','ὡ'=>'ὡ','á½¢'=>'ὢ','á½£'=>'ὣ','ὤ'=>'ὠÌ','á½¥'=>'ὡÌ','ὦ'=>'ὦ','á½§'=>'ὧ','Ὠ'=>'Ὠ','Ὡ'=>'Ὡ','Ὢ'=>'Ὢ','Ὣ'=>'Ὣ','Ὤ'=>'ὨÌ','á½'=>'ὩÌ','á½®'=>'Ὦ','Ὧ'=>'Ὧ','á½°'=>'ὰ','á½±'=>'αÌ','á½²'=>'ὲ','á½³'=>'εÌ','á½´'=>'ὴ','á½µ'=>'ηÌ','á½¶'=>'ὶ','á½·'=>'ιÌ','ὸ'=>'ὸ','á½¹'=>'οÌ','ὺ'=>'Ï…Ì€','á½»'=>'Ï…Ì','á½¼'=>'ὼ','á½½'=>'ωÌ','á¾€'=>'ᾀ','á¾'=>'ᾁ','ᾂ'=>'ᾂ','ᾃ'=>'ᾃ','ᾄ'=>'ἀÌÍ…','á¾…'=>'ἁÌÍ…','ᾆ'=>'ᾆ','ᾇ'=>'ᾇ','ᾈ'=>'ᾈ','ᾉ'=>'ᾉ','ᾊ'=>'ᾊ','ᾋ'=>'ᾋ','ᾌ'=>'ἈÌÍ…','á¾'=>'ἉÌÍ…','ᾎ'=>'ᾎ','á¾'=>'ᾏ','á¾'=>'ᾐ','ᾑ'=>'ᾑ','á¾’'=>'ᾒ','ᾓ'=>'ᾓ','á¾”'=>'ἠÌÍ…','ᾕ'=>'ἡÌÍ…','á¾–'=>'ᾖ','á¾—'=>'ᾗ','ᾘ'=>'ᾘ','á¾™'=>'ᾙ','ᾚ'=>'ᾚ','á¾›'=>'ᾛ','ᾜ'=>'ἨÌÍ…','á¾'=>'ἩÌÍ…','ᾞ'=>'ᾞ','ᾟ'=>'ᾟ','á¾ '=>'ᾠ','ᾡ'=>'ᾡ','á¾¢'=>'ᾢ','á¾£'=>'ᾣ','ᾤ'=>'ὠÌÍ…','á¾¥'=>'ὡÌÍ…','ᾦ'=>'ᾦ','á¾§'=>'ᾧ','ᾨ'=>'ᾨ','ᾩ'=>'ᾩ','ᾪ'=>'ᾪ','ᾫ'=>'ᾫ','ᾬ'=>'ὨÌÍ…','á¾'=>'ὩÌÍ…','á¾®'=>'ᾮ','ᾯ'=>'ᾯ','á¾°'=>'ᾰ','á¾±'=>'ᾱ','á¾²'=>'ᾲ','á¾³'=>'ᾳ','á¾´'=>'αÌÍ…','á¾¶'=>'ᾶ','á¾·'=>'ᾷ','Ᾰ'=>'Ᾰ','á¾¹'=>'Ᾱ','Ὰ'=>'Ὰ','á¾»'=>'ΑÌ','á¾¼'=>'ᾼ','á¾¾'=>'ι','á¿'=>'῁','á¿‚'=>'ῂ','ῃ'=>'ῃ','á¿„'=>'ηÌÍ…','ῆ'=>'ῆ','ῇ'=>'ῇ','Ὲ'=>'Ὲ','Έ'=>'ΕÌ','Ὴ'=>'Ὴ','á¿‹'=>'ΗÌ','ῌ'=>'ῌ','á¿'=>'῍','῎'=>'᾿Ì','á¿'=>'῏','á¿'=>'ῐ','á¿‘'=>'ῑ','á¿’'=>'ῒ','á¿“'=>'ϊÌ','á¿–'=>'ῖ','á¿—'=>'ῗ','Ῐ'=>'Ῐ','á¿™'=>'Ῑ','Ὶ'=>'Ὶ','á¿›'=>'ΙÌ','á¿'=>'῝','῞'=>'῾Ì','῟'=>'῟','á¿ '=>'ῠ','á¿¡'=>'Ï…Ì„','á¿¢'=>'ῢ','á¿£'=>'ϋÌ','ῤ'=>'ÏÌ“','á¿¥'=>'ÏÌ”','ῦ'=>'Ï…Í‚','á¿§'=>'ῧ','Ῠ'=>'Ῠ','á¿©'=>'Ῡ','Ὺ'=>'Ὺ','á¿«'=>'Î¥Ì','Ῥ'=>'Ῥ','á¿'=>'῭','á¿®'=>'¨Ì','`'=>'`','ῲ'=>'ῲ','ῳ'=>'ῳ','á¿´'=>'ωÌÍ…','á¿¶'=>'ῶ','á¿·'=>'ῷ','Ὸ'=>'Ὸ','Ό'=>'ΟÌ','Ὼ'=>'Ὼ','á¿»'=>'ΩÌ','ῼ'=>'ῼ','´'=>'´',' '=>' ','â€'=>' ','Ω'=>'Ω','K'=>'K','â„«'=>'AÌŠ','↚'=>'â†Ì¸','↛'=>'↛','↮'=>'↮','â‡'=>'â‡Ì¸','⇎'=>'⇎','â‡'=>'⇏','∄'=>'∄','∉'=>'∉','∌'=>'∌','∤'=>'∤','∦'=>'∦','â‰'=>'≁','≄'=>'≄','≇'=>'≇','≉'=>'≉','≠'=>'≠','≢'=>'≢','â‰'=>'â‰Ì¸','≮'=>'≮','≯'=>'≯','≰'=>'≰','≱'=>'≱','≴'=>'≴','≵'=>'≵','≸'=>'≸','≹'=>'≹','⊀'=>'⊀','âŠ'=>'⊁','⊄'=>'⊄','⊅'=>'⊅','⊈'=>'⊈','⊉'=>'⊉','⊬'=>'⊬','âŠ'=>'⊭','⊮'=>'⊮','⊯'=>'⊯','â‹ '=>'⋠','â‹¡'=>'⋡','â‹¢'=>'⋢','â‹£'=>'⋣','⋪'=>'⋪','â‹«'=>'⋫','⋬'=>'⋬','â‹'=>'⋭','〈'=>'〈','〉'=>'〉','⫝̸'=>'â«Ì¸','ãŒ'=>'ã‹ã‚™','ãŽ'=>'ãã‚™','ã'=>'ãã‚™','ã’'=>'ã‘ã‚™','ã”'=>'ã“ã‚™','ã–'=>'ã•ã‚™','ã˜'=>'ã—ã‚™','ãš'=>'ã™ã‚™','ãœ'=>'ã›ã‚™','ãž'=>'ãã‚™','ã '=>'ãŸã‚™','ã¢'=>'ã¡ã‚™','ã¥'=>'ã¤ã‚™','ã§'=>'ã¦ã‚™','ã©'=>'ã¨ã‚™','ã°'=>'ã¯ã‚™','ã±'=>'ã¯ã‚š','ã³'=>'ã²ã‚™','ã´'=>'ã²ã‚š','ã¶'=>'ãµã‚™','ã·'=>'ãµã‚š','ã¹'=>'ã¸ã‚™','ãº'=>'ã¸ã‚š','ã¼'=>'ã»ã‚™','ã½'=>'ã»ã‚š','ã‚”'=>'ã†ã‚™','ゞ'=>'ã‚ã‚™','ガ'=>'ã‚«ã‚™','ã‚®'=>'ã‚ã‚™','ã‚°'=>'グ','ゲ'=>'ゲ','ã‚´'=>'ゴ','ã‚¶'=>'ザ','ジ'=>'ã‚·ã‚™','ズ'=>'ズ','ゼ'=>'ゼ','ゾ'=>'ゾ','ダ'=>'ã‚¿ã‚™','ヂ'=>'ãƒã‚™','ヅ'=>'ヅ','デ'=>'デ','ド'=>'ド','ãƒ'=>'ãƒã‚™','パ'=>'ãƒã‚š','ビ'=>'ビ','ピ'=>'ピ','ブ'=>'ブ','プ'=>'プ','ベ'=>'ベ','ペ'=>'ペ','ボ'=>'ボ','ãƒ'=>'ポ','ヴ'=>'ヴ','ヷ'=>'ヷ','ヸ'=>'ヸ','ヹ'=>'ヹ','ヺ'=>'ヺ','ヾ'=>'ヾ','豈'=>'豈','ï¤'=>'æ›´','車'=>'車','賈'=>'賈','滑'=>'滑','串'=>'串','句'=>'å¥','龜'=>'龜','龜'=>'龜','契'=>'契','金'=>'金','喇'=>'å–‡','奈'=>'奈','ï¤'=>'懶','癩'=>'癩','ï¤'=>'ç¾…','ï¤'=>'蘿','螺'=>'螺','裸'=>'裸','邏'=>'é‚','樂'=>'樂','洛'=>'æ´›','烙'=>'烙','珞'=>'çž','落'=>'è½','酪'=>'é…ª','駱'=>'é§±','亂'=>'亂','卵'=>'åµ','ï¤'=>'欄','爛'=>'爛','蘭'=>'è˜','ï¤ '=>'鸞','嵐'=>'åµ','濫'=>'æ¿«','藍'=>'è—','襤'=>'襤','拉'=>'拉','臘'=>'臘','蠟'=>'è Ÿ','廊'=>'廊','朗'=>'朗','浪'=>'浪','狼'=>'狼','郎'=>'郎','ï¤'=>'來','冷'=>'冷','勞'=>'勞','擄'=>'æ“„','櫓'=>'æ«“','爐'=>'çˆ','盧'=>'ç›§','老'=>'è€','蘆'=>'蘆','虜'=>'虜','路'=>'è·¯','露'=>'露','魯'=>'é¯','鷺'=>'é·º','碌'=>'碌','祿'=>'祿','綠'=>'ç¶ ','菉'=>'è‰','錄'=>'錄','鹿'=>'鹿','ï¥'=>'è«–','壟'=>'壟','弄'=>'弄','籠'=>'ç± ','聾'=>'è¾','牢'=>'牢','磊'=>'磊','賂'=>'賂','雷'=>'é›·','壘'=>'壘','屢'=>'å±¢','樓'=>'樓','ï¥'=>'æ·š','漏'=>'æ¼','ï¥'=>'ç´¯','ï¥'=>'縷','陋'=>'陋','勒'=>'å‹’','肋'=>'è‚‹','凜'=>'凜','凌'=>'凌','稜'=>'稜','綾'=>'ç¶¾','菱'=>'è±','陵'=>'陵','讀'=>'讀','拏'=>'æ‹','樂'=>'樂','ï¥'=>'諾','丹'=>'丹','寧'=>'寧','ï¥ '=>'怒','率'=>'率','異'=>'ç•°','北'=>'北','磻'=>'磻','便'=>'便','復'=>'復','不'=>'ä¸','泌'=>'泌','數'=>'數','索'=>'ç´¢','參'=>'åƒ','塞'=>'塞','ï¥'=>'çœ','葉'=>'葉','說'=>'說','殺'=>'殺','辰'=>'è¾°','沈'=>'沈','拾'=>'拾','若'=>'è‹¥','掠'=>'æŽ ','略'=>'ç•¥','亮'=>'亮','兩'=>'å…©','凉'=>'凉','梁'=>'æ¢','糧'=>'ç³§','良'=>'良','諒'=>'è«’','量'=>'é‡','勵'=>'勵','呂'=>'å‘‚','ï¦'=>'女','廬'=>'廬','旅'=>'æ—…','濾'=>'濾','礪'=>'礪','閭'=>'é–','驪'=>'驪','麗'=>'麗','黎'=>'黎','力'=>'力','曆'=>'曆','歷'=>'æ·','ï¦'=>'è½¢','年'=>'å¹´','ï¦'=>'æ†','ï¦'=>'戀','撚'=>'æ’š','漣'=>'æ¼£','煉'=>'ç…‰','璉'=>'ç’‰','秊'=>'ç§Š','練'=>'ç·´','聯'=>'è¯','輦'=>'輦','蓮'=>'è“®','連'=>'連','鍊'=>'éŠ','列'=>'列','ï¦'=>'劣','咽'=>'å’½','烈'=>'烈','ï¦ '=>'裂','說'=>'說','廉'=>'廉','念'=>'念','捻'=>'æ»','殮'=>'æ®®','簾'=>'ç°¾','獵'=>'çµ','令'=>'令','囹'=>'囹','寧'=>'寧','嶺'=>'嶺','怜'=>'怜','ï¦'=>'玲','瑩'=>'ç‘©','羚'=>'羚','聆'=>'è†','鈴'=>'鈴','零'=>'é›¶','靈'=>'éˆ','領'=>'é ˜','例'=>'例','禮'=>'禮','醴'=>'醴','隸'=>'隸','惡'=>'惡','了'=>'了','僚'=>'僚','寮'=>'寮','尿'=>'å°¿','料'=>'æ–™','樂'=>'樂','ï§€'=>'燎','ï§'=>'療','ï§‚'=>'蓼','遼'=>'é¼','ï§„'=>'é¾','ï§…'=>'暈','阮'=>'阮','劉'=>'劉','杻'=>'æ»','柳'=>'柳','ï§Š'=>'æµ','ï§‹'=>'溜','ï§Œ'=>'ç‰','ï§'=>'ç•™','ï§Ž'=>'ç¡«','ï§'=>'ç´','ï§'=>'類','ï§‘'=>'å…','ï§’'=>'戮','ï§“'=>'陸','ï§”'=>'倫','ï§•'=>'å´™','ï§–'=>'æ·ª','ï§—'=>'輪','律'=>'律','ï§™'=>'æ…„','ï§š'=>'æ —','ï§›'=>'率','ï§œ'=>'隆','ï§'=>'利','ï§ž'=>'å','ï§Ÿ'=>'å±¥','ï§ '=>'易','ï§¡'=>'æŽ','ï§¢'=>'梨','ï§£'=>'æ³¥','理'=>'ç†','ï§¥'=>'ç—¢','罹'=>'ç½¹','ï§§'=>'è£','裡'=>'裡','ï§©'=>'里','離'=>'離','ï§«'=>'匿','溺'=>'溺','ï§'=>'å','ï§®'=>'ç‡','璘'=>'ç’˜','ï§°'=>'è—º','ï§±'=>'隣','ï§²'=>'é±—','ï§³'=>'麟','ï§´'=>'æž—','ï§µ'=>'æ·‹','ï§¶'=>'臨','ï§·'=>'ç«‹','笠'=>'ç¬ ','ï§¹'=>'ç²’','狀'=>'ç‹€','ï§»'=>'ç‚™','ï§¼'=>'è˜','ï§½'=>'什','ï§¾'=>'茶','ï§¿'=>'刺','切'=>'切','ï¨'=>'度','拓'=>'æ‹“','糖'=>'ç³–','宅'=>'å®…','洞'=>'æ´ž','暴'=>'æš´','輻'=>'è¼»','行'=>'行','降'=>'é™','見'=>'見','廓'=>'廓','兀'=>'å…€','ï¨'=>'å—€','ï¨'=>'塚','晴'=>'æ™´','凞'=>'凞','猪'=>'猪','益'=>'益','礼'=>'礼','神'=>'神','祥'=>'祥','福'=>'ç¦','靖'=>'é–','ï¨'=>'ç²¾','羽'=>'ç¾½','ï¨ '=>'蘒','諸'=>'諸','逸'=>'逸','都'=>'都','飯'=>'飯','飼'=>'飼','館'=>'館','ï¨'=>'é¶´','侮'=>'ä¾®','僧'=>'僧','免'=>'å…','勉'=>'勉','勤'=>'勤','卑'=>'å‘','喝'=>'å–','嘆'=>'嘆','器'=>'器','塀'=>'å¡€','墨'=>'墨','層'=>'層','屮'=>'å±®','悔'=>'æ‚”','慨'=>'æ…¨','憎'=>'憎','ï©€'=>'懲','ï©'=>'æ•','ï©‚'=>'æ—¢','暑'=>'æš‘','ï©„'=>'梅','ï©…'=>'æµ·','渚'=>'渚','漢'=>'æ¼¢','煮'=>'ç…®','爫'=>'爫','琢'=>'ç¢','ï©‹'=>'碑','社'=>'社','ï©'=>'祉','祈'=>'祈','ï©'=>'ç¥','ï©'=>'祖','ï©‘'=>'ç¥','ï©’'=>'ç¦','ï©“'=>'禎','ï©”'=>'ç©€','ï©•'=>'çª','ï©–'=>'節','ï©—'=>'ç·´','縉'=>'縉','ï©™'=>'ç¹','署'=>'ç½²','ï©›'=>'者','臭'=>'è‡','ï©'=>'艹','艹'=>'艹','著'=>'è‘—','ï© '=>'è¤','ï©¡'=>'視','ï©¢'=>'è¬','ï©£'=>'謹','賓'=>'賓','ï©¥'=>'è´ˆ','辶'=>'è¾¶','ï©§'=>'逸','難'=>'難','ï©©'=>'響','頻'=>'é »','ï©°'=>'並','况'=>'况','全'=>'å…¨','侀'=>'ä¾€','ï©´'=>'å……','冀'=>'冀','ï©¶'=>'勇','ï©·'=>'勺','喝'=>'å–','啕'=>'å••','喙'=>'å–™','ï©»'=>'å—¢','塚'=>'塚','墳'=>'墳','奄'=>'奄','ï©¿'=>'奔','婢'=>'å©¢','ïª'=>'嬨','廒'=>'å»’','廙'=>'å»™','彩'=>'彩','徭'=>'å¾','惘'=>'惘','慎'=>'æ…Ž','愈'=>'愈','憎'=>'憎','慠'=>'æ… ','懲'=>'懲','戴'=>'戴','ïª'=>'æ„','搜'=>'æœ','ïª'=>'æ‘’','ïª'=>'æ•–','晴'=>'æ™´','朗'=>'朗','望'=>'望','杖'=>'æ–','歹'=>'æ¹','殺'=>'殺','流'=>'æµ','滛'=>'æ»›','滋'=>'滋','漢'=>'æ¼¢','瀞'=>'瀞','煮'=>'ç…®','ïª'=>'çž§','爵'=>'爵','犯'=>'犯','ïª '=>'猪','瑱'=>'瑱','甆'=>'甆','画'=>'ç”»','瘝'=>'ç˜','瘟'=>'瘟','益'=>'益','盛'=>'ç››','直'=>'ç›´','睊'=>'çŠ','着'=>'ç€','磌'=>'磌','窱'=>'窱','ïª'=>'節','类'=>'ç±»','絛'=>'çµ›','練'=>'ç·´','缾'=>'ç¼¾','者'=>'者','荒'=>'è’','華'=>'è¯','蝹'=>'è¹','襁'=>'è¥','覆'=>'覆','視'=>'視','調'=>'調','諸'=>'諸','請'=>'è«‹','謁'=>'è¬','諾'=>'諾','諭'=>'è«','謹'=>'謹','ï«€'=>'變','ï«'=>'è´ˆ','ï«‚'=>'輸','遲'=>'é²','ï«„'=>'醙','ï«…'=>'鉶','陼'=>'陼','難'=>'難','靖'=>'é–','韛'=>'韛','響'=>'響','ï«‹'=>'é ‹','頻'=>'é »','ï«'=>'鬒','龜'=>'龜','ï«'=>'𢡊','ï«'=>'𢡄','ï«‘'=>'ð£•','ï«’'=>'ã®','ï«“'=>'䀘','ï«”'=>'䀹','ï«•'=>'𥉉','ï«–'=>'ð¥³','ï«—'=>'𧻓','齃'=>'齃','ï«™'=>'龎','ï¬'=>'×™Ö´','ײַ'=>'ײַ','שׁ'=>'ש×','שׂ'=>'שׂ','שּׁ'=>'שּ×','ï¬'=>'שּׂ','אַ'=>'×Ö·','אָ'=>'×Ö¸','אּ'=>'×Ö¼','בּ'=>'בּ','גּ'=>'×’Ö¼','דּ'=>'דּ','הּ'=>'×”Ö¼','וּ'=>'וּ','זּ'=>'×–Ö¼','טּ'=>'טּ','יּ'=>'×™Ö¼','ךּ'=>'ךּ','כּ'=>'×›Ö¼','לּ'=>'לּ','מּ'=>'מּ','ï€'=>'× Ö¼','ï'=>'סּ','ïƒ'=>'×£Ö¼','ï„'=>'פּ','ï†'=>'צּ','ï‡'=>'×§Ö¼','ïˆ'=>'רּ','ï‰'=>'שּ','ïŠ'=>'תּ','ï‹'=>'וֹ','ïŒ'=>'בֿ','ï'=>'×›Ö¿','ïŽ'=>'פֿ','ð…ž'=>'ð…—ð…¥','ð…Ÿ'=>'ð…˜ð…¥','ð… '=>'ð…˜ð…¥ð…®','ð…¡'=>'ð…˜ð…¥ð…¯','ð…¢'=>'ð…˜ð…¥ð…°','ð…£'=>'ð…˜ð…¥ð…±','ð…¤'=>'ð…˜ð…¥ð…²','ð†»'=>'ð†¹ð…¥','ð†¼'=>'ð†ºð…¥','ð†½'=>'ð†¹ð…¥ð…®','ð†¾'=>'ð†ºð…¥ð…®','ð†¿'=>'ð†¹ð…¥ð…¯','ð‡€'=>'ð†ºð…¥ð…¯','丽'=>'丽','ð¯ '=>'丸','乁'=>'ä¹','𠄢'=>'ð „¢','你'=>'ä½ ','侮'=>'ä¾®','侻'=>'ä¾»','倂'=>'倂','偺'=>'åº','備'=>'å‚™','僧'=>'僧','像'=>'åƒ','㒞'=>'ã’ž','ð¯ '=>'𠘺','免'=>'å…','ð¯ '=>'å…”','ð¯ '=>'å…¤','具'=>'å…·','𠔜'=>'𠔜','㒹'=>'ã’¹','內'=>'å…§','再'=>'å†','𠕋'=>'ð •‹','冗'=>'冗','冤'=>'冤','仌'=>'仌','冬'=>'冬','况'=>'况','𩇟'=>'𩇟','ð¯ '=>'凵','刃'=>'刃','㓟'=>'㓟','ð¯ '=>'刻','剆'=>'剆','割'=>'割','剷'=>'剷','㔕'=>'㔕','勇'=>'勇','勉'=>'勉','勤'=>'勤','勺'=>'勺','包'=>'包','匆'=>'匆','北'=>'北','卉'=>'å‰','ð¯ '=>'å‘','博'=>'åš','即'=>'å³','卽'=>'å½','卿'=>'å¿','卿'=>'å¿','卿'=>'å¿','𠨬'=>'𠨬','灰'=>'ç°','及'=>'åŠ','叟'=>'åŸ','𠭣'=>'ð £','叫'=>'å«','叱'=>'å±','吆'=>'å†','咞'=>'å’ž','吸'=>'å¸','呈'=>'呈','周'=>'周','咢'=>'å’¢','ð¯¡'=>'å“¶','唐'=>'å”','啓'=>'å•“','啣'=>'å•£','善'=>'å–„','善'=>'å–„','喙'=>'å–™','喫'=>'å–«','喳'=>'å–³','嗂'=>'å—‚','圖'=>'圖','嘆'=>'嘆','ð¯¡'=>'圗','噑'=>'噑','ð¯¡'=>'å™´','ð¯¡'=>'切','壮'=>'壮','城'=>'城','埴'=>'埴','堍'=>'å ','型'=>'åž‹','堲'=>'å ²','報'=>'å ±','墬'=>'墬','𡓤'=>'𡓤','売'=>'売','壷'=>'壷','夆'=>'夆','ð¯¡'=>'多','夢'=>'夢','奢'=>'奢','𡚨'=>'𡚨','𡛪'=>'𡛪','姬'=>'姬','娛'=>'娛','娧'=>'娧','姘'=>'姘','婦'=>'婦','㛮'=>'ã›®','㛼'=>'㛼','嬈'=>'嬈','嬾'=>'嬾','嬾'=>'嬾','𡧈'=>'𡧈','ð¯¡'=>'寃','寘'=>'寘','寧'=>'寧','寳'=>'寳','𡬘'=>'𡬘','寿'=>'寿','将'=>'å°†','当'=>'当','尢'=>'å°¢','㞁'=>'ãž','屠'=>'å± ','屮'=>'å±®','峀'=>'å³€','岍'=>'å²','𡷤'=>'ð¡·¤','嵃'=>'嵃','𡷦'=>'ð¡·¦','嵮'=>'åµ®','嵫'=>'嵫','嵼'=>'åµ¼','ð¯¢'=>'å·¡','巢'=>'å·¢','㠯'=>'ã ¯','巽'=>'å·½','帨'=>'帨','帽'=>'帽','幩'=>'幩','㡢'=>'ã¡¢','𢆃'=>'𢆃','㡼'=>'㡼','庰'=>'庰','庳'=>'庳','ð¯¢'=>'庶','廊'=>'廊','ð¯¢'=>'𪎒','ð¯¢'=>'廾','𢌱'=>'𢌱','𢌱'=>'𢌱','舁'=>'èˆ','弢'=>'å¼¢','弢'=>'å¼¢','㣇'=>'㣇','𣊸'=>'𣊸','𦇚'=>'𦇚','形'=>'å½¢','彫'=>'彫','㣣'=>'㣣','徚'=>'徚','ð¯¢'=>'å¿','志'=>'å¿—','忹'=>'忹','悁'=>'æ‚','㤺'=>'㤺','㤜'=>'㤜','悔'=>'æ‚”','𢛔'=>'𢛔','惇'=>'惇','慈'=>'æ…ˆ','慌'=>'æ…Œ','慎'=>'æ…Ž','慌'=>'æ…Œ','慺'=>'æ…º','憎'=>'憎','憲'=>'憲','ð¯¢'=>'憤','憯'=>'憯','懞'=>'懞','懲'=>'懲','懶'=>'懶','成'=>'æˆ','戛'=>'戛','扝'=>'æ‰','抱'=>'抱','拔'=>'æ‹”','捐'=>'æ','𢬌'=>'𢬌','挽'=>'挽','拼'=>'拼','捨'=>'æ¨','掃'=>'掃','揤'=>'æ¤','𢯱'=>'𢯱','搢'=>'æ¢','揅'=>'æ…','ð¯£'=>'掩','㨮'=>'㨮','摩'=>'æ‘©','摾'=>'摾','撝'=>'æ’','摷'=>'æ‘·','㩬'=>'㩬','敏'=>'æ•','敬'=>'敬','𣀊'=>'𣀊','旣'=>'æ—£','書'=>'書','ð¯£'=>'晉','㬙'=>'㬙','ð¯£'=>'æš‘','ð¯£'=>'㬈','㫤'=>'㫤','冒'=>'冒','冕'=>'冕','最'=>'最','暜'=>'æšœ','肭'=>'è‚','䏙'=>'ä™','朗'=>'朗','望'=>'望','朡'=>'朡','杞'=>'æž','杓'=>'æ“','ð¯£'=>'ð£ƒ','㭉'=>'ã‰','柺'=>'柺','枅'=>'æž…','桒'=>'æ¡’','梅'=>'梅','𣑭'=>'ð£‘','梎'=>'梎','栟'=>'æ Ÿ','椔'=>'椔','㮝'=>'ã®','楂'=>'楂','榣'=>'榣','槪'=>'槪','檨'=>'檨','𣚣'=>'𣚣','ð¯£'=>'æ«›','㰘'=>'ã°˜','次'=>'次','𣢧'=>'𣢧','歔'=>'æ”','㱎'=>'㱎','歲'=>'æ²','殟'=>'殟','殺'=>'殺','殻'=>'æ®»','𣪍'=>'ð£ª','𡴋'=>'ð¡´‹','𣫺'=>'𣫺','汎'=>'汎','𣲼'=>'𣲼','沿'=>'沿','泍'=>'æ³','汧'=>'æ±§','洖'=>'æ´–','派'=>'æ´¾','ð¯¤'=>'æµ·','流'=>'æµ','浩'=>'浩','浸'=>'浸','涅'=>'æ¶…','𣴞'=>'𣴞','洴'=>'æ´´','港'=>'港','湮'=>'æ¹®','㴳'=>'ã´³','滋'=>'滋','滇'=>'滇','ð¯¤'=>'𣻑','淹'=>'æ·¹','ð¯¤'=>'æ½®','ð¯¤'=>'𣽞','𣾎'=>'𣾎','濆'=>'濆','瀹'=>'瀹','瀞'=>'瀞','瀛'=>'瀛','㶖'=>'ã¶–','灊'=>'çŠ','災'=>'ç½','灷'=>'ç·','炭'=>'ç‚','𠔥'=>'𠔥','煅'=>'ç……','ð¯¤'=>'𤉣','熜'=>'熜','𤎫'=>'𤎫','爨'=>'爨','爵'=>'爵','牐'=>'ç‰','𤘈'=>'𤘈','犀'=>'犀','犕'=>'犕','𤜵'=>'𤜵','𤠔'=>'𤠔','獺'=>'çº','王'=>'王','㺬'=>'㺬','玥'=>'玥','㺸'=>'㺸','ð¯¤'=>'㺸','瑇'=>'瑇','瑜'=>'瑜','瑱'=>'瑱','璅'=>'ç’…','瓊'=>'瓊','㼛'=>'ã¼›','甤'=>'甤','𤰶'=>'𤰶','甾'=>'甾','𤲒'=>'𤲒','異'=>'ç•°','𢆟'=>'𢆟','瘐'=>'ç˜','𤾡'=>'𤾡','𤾸'=>'𤾸','𥁄'=>'ð¥„','㿼'=>'㿼','䀈'=>'䀈','直'=>'ç›´','ð¯¥'=>'𥃳','𥃲'=>'𥃲','𥄙'=>'𥄙','𥄳'=>'𥄳','眞'=>'眞','真'=>'真','真'=>'真','睊'=>'çŠ','䀹'=>'䀹','瞋'=>'çž‹','䁆'=>'ä†','䂖'=>'ä‚–','ð¯¥'=>'ð¥','硎'=>'硎','ð¯¥'=>'碌','ð¯¥'=>'磌','䃣'=>'䃣','𥘦'=>'𥘦','祖'=>'祖','𥚚'=>'𥚚','𥛅'=>'𥛅','福'=>'ç¦','秫'=>'ç§«','䄯'=>'䄯','穀'=>'ç©€','穊'=>'穊','穏'=>'ç©','𥥼'=>'𥥼','ð¯¥'=>'𥪧','𥪧'=>'𥪧','竮'=>'ç«®','䈂'=>'䈂','𥮫'=>'𥮫','篆'=>'篆','築'=>'築','䈧'=>'䈧','𥲀'=>'𥲀','糒'=>'ç³’','䊠'=>'äŠ ','糨'=>'糨','糣'=>'ç³£','紀'=>'ç´€','𥾆'=>'𥾆','絣'=>'çµ£','ð¯¥'=>'äŒ','緇'=>'ç·‡','縂'=>'縂','繅'=>'ç¹…','䌴'=>'䌴','𦈨'=>'𦈨','𦉇'=>'𦉇','䍙'=>'ä™','𦋙'=>'𦋙','罺'=>'罺','𦌾'=>'𦌾','羕'=>'羕','翺'=>'翺','者'=>'者','𦓚'=>'𦓚','𦔣'=>'𦔣','聠'=>'è ','𦖨'=>'𦖨','聰'=>'è°','𣍟'=>'ð£Ÿ','ð¯¦'=>'ä•','育'=>'育','脃'=>'脃','䐋'=>'ä‹','脾'=>'脾','媵'=>'媵','𦞧'=>'𦞧','𦞵'=>'𦞵','𣎓'=>'𣎓','𣎜'=>'𣎜','舁'=>'èˆ','舄'=>'舄','ð¯¦'=>'辞','䑫'=>'ä‘«','ð¯¦'=>'芑','ð¯¦'=>'芋','芝'=>'èŠ','劳'=>'劳','花'=>'花','芳'=>'芳','芽'=>'芽','苦'=>'苦','𦬼'=>'𦬼','若'=>'è‹¥','茝'=>'èŒ','荣'=>'è£','莭'=>'èŽ','茣'=>'茣','ð¯¦'=>'莽','菧'=>'è§','著'=>'è‘—','荓'=>'è“','菊'=>'èŠ','菌'=>'èŒ','菜'=>'èœ','𦰶'=>'𦰶','𦵫'=>'𦵫','𦳕'=>'𦳕','䔫'=>'䔫','蓱'=>'蓱','蓳'=>'蓳','蔖'=>'è”–','𧏊'=>'ð§Š','蕤'=>'蕤','ð¯¦'=>'𦼬','䕝'=>'ä•','䕡'=>'ä•¡','𦾱'=>'𦾱','𧃒'=>'𧃒','䕫'=>'ä•«','虐'=>'è™','虜'=>'虜','虧'=>'è™§','虩'=>'虩','蚩'=>'èš©','蚈'=>'蚈','蜎'=>'蜎','蛢'=>'蛢','蝹'=>'è¹','蜨'=>'蜨','蝫'=>'è«','螆'=>'螆','䗗'=>'ä——','蟡'=>'蟡','ð¯§'=>'è ','䗹'=>'ä—¹','衠'=>'è¡ ','衣'=>'è¡£','𧙧'=>'ð§™§','裗'=>'裗','裞'=>'裞','䘵'=>'䘵','裺'=>'裺','㒻'=>'ã’»','𧢮'=>'ð§¢®','𧥦'=>'𧥦','ð¯§'=>'äš¾','䛇'=>'䛇','ð¯§'=>'èª ','ð¯§'=>'è«','變'=>'變','豕'=>'豕','𧲨'=>'𧲨','貫'=>'貫','賁'=>'è³','贛'=>'è´›','起'=>'èµ·','𧼯'=>'𧼯','𠠄'=>'ð „','跋'=>'è·‹','趼'=>'è¶¼','跰'=>'è·°','ð¯§'=>'𠣞','軔'=>'è»”','輸'=>'輸','𨗒'=>'𨗒','𨗭'=>'ð¨—','邔'=>'é‚”','郱'=>'郱','鄑'=>'é„‘','𨜮'=>'𨜮','鄛'=>'é„›','鈸'=>'鈸','鋗'=>'é‹—','鋘'=>'鋘','鉼'=>'鉼','鏹'=>'é¹','鐕'=>'é•','ð¯§'=>'𨯺','開'=>'é–‹','䦕'=>'䦕','閷'=>'é–·','𨵷'=>'𨵷','䧦'=>'䧦','雃'=>'雃','嶲'=>'å¶²','霣'=>'霣','𩅅'=>'ð©……','𩈚'=>'𩈚','䩮'=>'ä©®','䩶'=>'ä©¶','韠'=>'éŸ ','𩐊'=>'ð©Š','䪲'=>'䪲','𩒖'=>'ð©’–','頋'=>'é ‹','頋'=>'é ‹','頩'=>'é ©','ð¯¨'=>'ð©–¶','飢'=>'飢','䬳'=>'䬳','餩'=>'餩','馧'=>'馧','駂'=>'é§‚','駾'=>'é§¾','䯎'=>'䯎','𩬰'=>'𩬰','鬒'=>'鬒','鱀'=>'é±€','鳽'=>'é³½','ð¯¨'=>'䳎','䳭'=>'ä³','ð¯¨'=>'éµ§','ð¯¨'=>'𪃎','䳸'=>'䳸','𪄅'=>'𪄅','𪈎'=>'𪈎','𪊑'=>'𪊑','麻'=>'麻','䵖'=>'äµ–','黹'=>'黹','黾'=>'黾','鼅'=>'é¼…','鼏'=>'é¼','鼖'=>'é¼–','鼻'=>'é¼»','ð¯¨'=>'𪘀'); diff --git a/phpBB/includes/utf/data/utf_compatibility_decomp.php b/phpBB/includes/utf/data/utf_compatibility_decomp.php deleted file mode 100644 index c62948e81a..0000000000 --- a/phpBB/includes/utf/data/utf_compatibility_decomp.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php -$GLOBALS['utf_compatibility_decomp']=array(' '=>' ','¨'=>' ̈','ª'=>'a','¯'=>' Ì„','²'=>'2','³'=>'3','´'=>' Ì','µ'=>'μ','¸'=>' ̧','¹'=>'1','º'=>'o','¼'=>'1â„4','½'=>'1â„2','¾'=>'3â„4','À'=>'AÌ€','Ã'=>'AÌ','Â'=>'AÌ‚','Ã'=>'Ã','Ä'=>'Ä','Ã…'=>'AÌŠ','Ç'=>'Ç','È'=>'EÌ€','É'=>'EÌ','Ê'=>'EÌ‚','Ë'=>'Ë','ÃŒ'=>'IÌ€','Ã'=>'IÌ','ÃŽ'=>'IÌ‚','Ã'=>'Ï','Ñ'=>'Ñ','Ã’'=>'OÌ€','Ó'=>'OÌ','Ô'=>'OÌ‚','Õ'=>'Õ','Ö'=>'Ö','Ù'=>'UÌ€','Ú'=>'UÌ','Û'=>'UÌ‚','Ü'=>'Ü','Ã'=>'YÌ','à '=>'aÌ€','á'=>'aÌ','â'=>'aÌ‚','ã'=>'ã','ä'=>'ä','Ã¥'=>'aÌŠ','ç'=>'ç','è'=>'eÌ€','é'=>'eÌ','ê'=>'eÌ‚','ë'=>'ë','ì'=>'iÌ€','Ã'=>'iÌ','î'=>'iÌ‚','ï'=>'ï','ñ'=>'ñ','ò'=>'oÌ€','ó'=>'oÌ','ô'=>'oÌ‚','õ'=>'õ','ö'=>'ö','ù'=>'uÌ€','ú'=>'uÌ','û'=>'uÌ‚','ü'=>'ü','ý'=>'yÌ','ÿ'=>'ÿ','Ä€'=>'AÌ„','Ä'=>'aÌ„','Ä‚'=>'Ă','ă'=>'ă','Ä„'=>'Ą','Ä…'=>'ą','Ć'=>'CÌ','ć'=>'cÌ','Ĉ'=>'CÌ‚','ĉ'=>'cÌ‚','ÄŠ'=>'Ċ','Ä‹'=>'ċ','ÄŒ'=>'CÌŒ','Ä'=>'cÌŒ','ÄŽ'=>'DÌŒ','Ä'=>'dÌŒ','Ä’'=>'EÌ„','Ä“'=>'eÌ„','Ä”'=>'Ĕ','Ä•'=>'ĕ','Ä–'=>'Ė','Ä—'=>'ė','Ę'=>'Ę','Ä™'=>'ę','Äš'=>'EÌŒ','Ä›'=>'eÌŒ','Äœ'=>'GÌ‚','Ä'=>'gÌ‚','Äž'=>'Ğ','ÄŸ'=>'ğ','Ä '=>'Ġ','Ä¡'=>'ġ','Ä¢'=>'Ģ','Ä£'=>'ģ','Ĥ'=>'HÌ‚','Ä¥'=>'hÌ‚','Ĩ'=>'Ĩ','Ä©'=>'ĩ','Ī'=>'IÌ„','Ä«'=>'iÌ„','Ĭ'=>'Ĭ','Ä'=>'ĭ','Ä®'=>'Į','į'=>'į','İ'=>'İ','IJ'=>'IJ','ij'=>'ij','Ä´'=>'JÌ‚','ĵ'=>'jÌ‚','Ķ'=>'Ķ','Ä·'=>'ķ','Ĺ'=>'LÌ','ĺ'=>'lÌ','Ä»'=>'Ļ','ļ'=>'ļ','Ľ'=>'LÌŒ','ľ'=>'lÌŒ','Ä¿'=>'L·','Å€'=>'l·','Ń'=>'NÌ','Å„'=>'nÌ','Å…'=>'Ņ','ņ'=>'ņ','Ň'=>'NÌŒ','ň'=>'nÌŒ','ʼn'=>'ʼn','ÅŒ'=>'OÌ„','Å'=>'oÌ„','ÅŽ'=>'Ŏ','Å'=>'ŏ','Å'=>'OÌ‹','Å‘'=>'oÌ‹','Å”'=>'RÌ','Å•'=>'rÌ','Å–'=>'Ŗ','Å—'=>'ŗ','Ř'=>'RÌŒ','Å™'=>'rÌŒ','Åš'=>'SÌ','Å›'=>'sÌ','Åœ'=>'SÌ‚','Å'=>'sÌ‚','Åž'=>'Ş','ÅŸ'=>'ş','Å '=>'SÌŒ','Å¡'=>'sÌŒ','Å¢'=>'Ţ','Å£'=>'ţ','Ť'=>'TÌŒ','Å¥'=>'tÌŒ','Ũ'=>'Ũ','Å©'=>'ũ','Ū'=>'UÌ„','Å«'=>'uÌ„','Ŭ'=>'Ŭ','Å'=>'ŭ','Å®'=>'UÌŠ','ů'=>'uÌŠ','Ű'=>'UÌ‹','ű'=>'uÌ‹','Ų'=>'Ų','ų'=>'ų','Å´'=>'WÌ‚','ŵ'=>'wÌ‚','Ŷ'=>'YÌ‚','Å·'=>'yÌ‚','Ÿ'=>'Ÿ','Ź'=>'ZÌ','ź'=>'zÌ','Å»'=>'Ż','ż'=>'ż','Ž'=>'ZÌŒ','ž'=>'zÌŒ','Å¿'=>'s','Æ '=>'OÌ›','Æ¡'=>'oÌ›','Ư'=>'UÌ›','ư'=>'uÌ›','Ç„'=>'DZÌŒ','Ç…'=>'DzÌŒ','dž'=>'dzÌŒ','LJ'=>'LJ','Lj'=>'Lj','lj'=>'lj','ÇŠ'=>'NJ','Ç‹'=>'Nj','ÇŒ'=>'nj','Ç'=>'AÌŒ','ÇŽ'=>'aÌŒ','Ç'=>'IÌŒ','Ç'=>'iÌŒ','Ç‘'=>'OÌŒ','Ç’'=>'oÌŒ','Ç“'=>'UÌŒ','Ç”'=>'uÌŒ','Ç•'=>'Ǖ','Ç–'=>'ǖ','Ç—'=>'ÜÌ','ǘ'=>'üÌ','Ç™'=>'Ǚ','Çš'=>'ǚ','Ç›'=>'Ǜ','Çœ'=>'ǜ','Çž'=>'Ǟ','ÇŸ'=>'ǟ','Ç '=>'Ǡ','Ç¡'=>'ǡ','Ç¢'=>'Ǣ','Ç£'=>'ǣ','Ǧ'=>'GÌŒ','ǧ'=>'gÌŒ','Ǩ'=>'KÌŒ','Ç©'=>'kÌŒ','Ǫ'=>'Ǫ','Ç«'=>'ǫ','Ǭ'=>'Ǭ','Ç'=>'ǭ','Ç®'=>'Æ·ÌŒ','ǯ'=>'Ê’ÌŒ','ǰ'=>'jÌŒ','DZ'=>'DZ','Dz'=>'Dz','dz'=>'dz','Ç´'=>'GÌ','ǵ'=>'gÌ','Ǹ'=>'NÌ€','ǹ'=>'nÌ€','Ǻ'=>'AÌŠÌ','Ç»'=>'aÌŠÌ','Ǽ'=>'ÆÌ','ǽ'=>'æÌ','Ǿ'=>'ØÌ','Ç¿'=>'øÌ','È€'=>'AÌ','È'=>'aÌ','È‚'=>'AÌ‘','ȃ'=>'aÌ‘','È„'=>'EÌ','È…'=>'eÌ','Ȇ'=>'EÌ‘','ȇ'=>'eÌ‘','Ȉ'=>'IÌ','ȉ'=>'iÌ','ÈŠ'=>'IÌ‘','È‹'=>'iÌ‘','ÈŒ'=>'OÌ','È'=>'oÌ','ÈŽ'=>'OÌ‘','È'=>'oÌ‘','È'=>'RÌ','È‘'=>'rÌ','È’'=>'RÌ‘','È“'=>'rÌ‘','È”'=>'UÌ','È•'=>'uÌ','È–'=>'UÌ‘','È—'=>'uÌ‘','Ș'=>'Ș','È™'=>'ș','Èš'=>'Ț','È›'=>'ț','Èž'=>'HÌŒ','ÈŸ'=>'hÌŒ','Ȧ'=>'Ȧ','ȧ'=>'ȧ','Ȩ'=>'Ȩ','È©'=>'ȩ','Ȫ'=>'Ȫ','È«'=>'ȫ','Ȭ'=>'Ȭ','È'=>'ȭ','È®'=>'Ȯ','ȯ'=>'ȯ','Ȱ'=>'Ȱ','ȱ'=>'ȱ','Ȳ'=>'YÌ„','ȳ'=>'yÌ„','ʰ'=>'h','ʱ'=>'ɦ','ʲ'=>'j','ʳ'=>'r','Ê´'=>'ɹ','ʵ'=>'É»','ʶ'=>'Ê','Ê·'=>'w','ʸ'=>'y','˘'=>' ̆','Ë™'=>' ̇','Ëš'=>' ÌŠ','Ë›'=>' ̨','Ëœ'=>' ̃','Ë'=>' Ì‹','Ë '=>'É£','Ë¡'=>'l','Ë¢'=>'s','Ë£'=>'x','ˤ'=>'Ê•','Í€'=>'Ì€','Í'=>'Ì','̓'=>'Ì“','Í„'=>'̈Ì','Í´'=>'ʹ','ͺ'=>' Í…',';'=>';','΄'=>' Ì','Î…'=>' ̈Ì','Ά'=>'ΑÌ','·'=>'·','Έ'=>'ΕÌ','Ή'=>'ΗÌ','Ί'=>'ΙÌ','ÎŒ'=>'ΟÌ','ÎŽ'=>'Î¥Ì','Î'=>'ΩÌ','Î'=>'ϊÌ','Ϊ'=>'Ϊ','Ϋ'=>'Ϋ','ά'=>'αÌ','Î'=>'εÌ','ή'=>'ηÌ','ί'=>'ιÌ','ΰ'=>'ϋÌ','ÏŠ'=>'ϊ','Ï‹'=>'ϋ','ÏŒ'=>'οÌ','Ï'=>'Ï…Ì','ÏŽ'=>'ωÌ','Ï'=>'β','Ï‘'=>'θ','Ï’'=>'Î¥','Ï“'=>'Î¥Ì','Ï”'=>'Ϋ','Ï•'=>'φ','Ï–'=>'Ï€','ϰ'=>'κ','ϱ'=>'Ï','ϲ'=>'Ï‚','Ï´'=>'Θ','ϵ'=>'ε','Ϲ'=>'Σ','Ѐ'=>'Ѐ','Ð'=>'Ё','Ѓ'=>'ГÌ','Ї'=>'Ї','ÐŒ'=>'КÌ','Ð'=>'Ѝ','ÐŽ'=>'Ў','Й'=>'Й','й'=>'й','Ñ'=>'ѐ','Ñ‘'=>'ё','Ñ“'=>'гÌ','Ñ—'=>'ї','Ñœ'=>'кÌ','Ñ'=>'ѝ','Ñž'=>'ў','Ѷ'=>'Ñ´Ì','Ñ·'=>'ѵÌ','Ó'=>'Ӂ','Ó‚'=>'ӂ','Ó'=>'Ð̆','Ó‘'=>'ӑ','Ó’'=>'Ð̈','Ó“'=>'ӓ','Ó–'=>'Ӗ','Ó—'=>'ӗ','Óš'=>'Ӛ','Ó›'=>'ӛ','Óœ'=>'Ӝ','Ó'=>'ӝ','Óž'=>'Ӟ','ÓŸ'=>'ӟ','Ó¢'=>'Ӣ','Ó£'=>'ӣ','Ó¤'=>'Ӥ','Ó¥'=>'ӥ','Ó¦'=>'Ӧ','Ó§'=>'ӧ','Óª'=>'Ӫ','Ó«'=>'ӫ','Ó¬'=>'Ð̈','Ó'=>'Ñ̈','Ó®'=>'Ӯ','Ó¯'=>'ӯ','Ó°'=>'Ӱ','Ó±'=>'ӱ','Ó²'=>'Ӳ','Ó³'=>'ӳ','Ó´'=>'Ӵ','Óµ'=>'ӵ','Ó¸'=>'Ӹ','Ó¹'=>'ӹ','Ö‡'=>'Õ¥Ö‚','Ø¢'=>'آ','Ø£'=>'أ','ؤ'=>'ÙˆÙ”','Ø¥'=>'إ','ئ'=>'ÙŠÙ”','Ùµ'=>'اٴ','Ù¶'=>'وٴ','Ù·'=>'Û‡Ù´','Ù¸'=>'يٴ','Û€'=>'Û•Ù”','Û‚'=>'ÛÙ”','Û“'=>'Û’Ù”','ऩ'=>'ऩ','ऱ'=>'ऱ','ऴ'=>'ऴ','क़'=>'क़','ख़'=>'ख़','ग़'=>'ग़','ज़'=>'ज़','ड़'=>'ड़','à¥'=>'ढ़','फ़'=>'फ़','य़'=>'य़','à§‹'=>'ো','à§Œ'=>'ৌ','à§œ'=>'ড়','à§'=>'ঢ়','à§Ÿ'=>'য়','ਲ਼'=>'ਲ਼','ਸ਼'=>'ਸ਼','à©™'=>'ਖ਼','ਗ਼'=>'ਗ਼','à©›'=>'ਜ਼','ਫ਼'=>'ਫ਼','àˆ'=>'à‡à–','à‹'=>'à‡à¬¾','àŒ'=>'à‡à—','àœ'=>'ଡ଼','à'=>'ଢ଼','à®”'=>'ஔ','ொ'=>'ொ','ோ'=>'ோ','ௌ'=>'ௌ','ై'=>'ై','à³€'=>'ೀ','ೇ'=>'ೇ','ೈ'=>'ೈ','ೊ'=>'ೊ','ೋ'=>'ೋ','ൊ'=>'ൊ','ോ'=>'ോ','ൌ'=>'ൌ','à·š'=>'ේ','à·œ'=>'à·™à·','à·'=>'à·™à·à·Š','à·ž'=>'ෞ','ำ'=>'à¹à¸²','ຳ'=>'à»àº²','ໜ'=>'ຫນ','à»'=>'ຫມ','༌'=>'་','གྷ'=>'གྷ','à½'=>'ཌྷ','དྷ'=>'དྷ','བྷ'=>'བྷ','ཛྷ'=>'ཛྷ','ཀྵ'=>'ཀྵ','ཱི'=>'ཱི','ཱུ'=>'ཱུ','ྲྀ'=>'ྲྀ','ཷ'=>'ྲཱྀ','ླྀ'=>'ླྀ','ཹ'=>'ླཱྀ','à¾'=>'ཱྀ','ྒྷ'=>'ྒྷ','à¾'=>'ྜྷ','ྡྷ'=>'ྡྷ','ྦྷ'=>'ྦྷ','ྫྷ'=>'ྫྷ','ྐྵ'=>'à¾à¾µ','ဦ'=>'ဦ','ჼ'=>'ნ','ᬆ'=>'ᬆ','ᬈ'=>'ᬈ','ᬊ'=>'ᬊ','ᬌ'=>'ᬌ','ᬎ'=>'á¬á¬µ','ᬒ'=>'ᬒ','ᬻ'=>'ᬻ','ᬽ'=>'ᬽ','á€'=>'ᭀ','á'=>'ᭁ','áƒ'=>'á‚ᬵ','á´¬'=>'A','á´'=>'Æ','á´®'=>'B','á´°'=>'D','á´±'=>'E','á´²'=>'ÆŽ','á´³'=>'G','á´´'=>'H','á´µ'=>'I','á´¶'=>'J','á´·'=>'K','á´¸'=>'L','á´¹'=>'M','á´º'=>'N','á´¼'=>'O','á´½'=>'È¢','á´¾'=>'P','á´¿'=>'R','áµ€'=>'T','áµ'=>'U','ᵂ'=>'W','ᵃ'=>'a','ᵄ'=>'É','áµ…'=>'É‘','ᵆ'=>'á´‚','ᵇ'=>'b','ᵈ'=>'d','ᵉ'=>'e','ᵊ'=>'É™','ᵋ'=>'É›','ᵌ'=>'Éœ','áµ'=>'g','áµ'=>'k','áµ'=>'m','ᵑ'=>'Å‹','áµ’'=>'o','ᵓ'=>'É”','áµ”'=>'á´–','ᵕ'=>'á´—','áµ–'=>'p','áµ—'=>'t','ᵘ'=>'u','áµ™'=>'á´','ᵚ'=>'ɯ','áµ›'=>'v','ᵜ'=>'á´¥','áµ'=>'β','ᵞ'=>'γ','ᵟ'=>'δ','áµ '=>'φ','ᵡ'=>'χ','áµ¢'=>'i','áµ£'=>'r','ᵤ'=>'u','áµ¥'=>'v','ᵦ'=>'β','áµ§'=>'γ','ᵨ'=>'Ï','ᵩ'=>'φ','ᵪ'=>'χ','ᵸ'=>'н','á¶›'=>'É’','á¶œ'=>'c','á¶'=>'É•','á¶ž'=>'ð','á¶Ÿ'=>'Éœ','á¶ '=>'f','á¶¡'=>'ÉŸ','á¶¢'=>'É¡','á¶£'=>'É¥','ᶤ'=>'ɨ','á¶¥'=>'É©','ᶦ'=>'ɪ','á¶§'=>'áµ»','ᶨ'=>'Ê','á¶©'=>'É','ᶪ'=>'á¶…','á¶«'=>'ÊŸ','ᶬ'=>'ɱ','á¶'=>'ɰ','á¶®'=>'ɲ','ᶯ'=>'ɳ','á¶°'=>'É´','á¶±'=>'ɵ','á¶²'=>'ɸ','á¶³'=>'Ê‚','á¶´'=>'ʃ','á¶µ'=>'Æ«','á¶¶'=>'ʉ','á¶·'=>'ÊŠ','ᶸ'=>'á´œ','á¶¹'=>'Ê‹','ᶺ'=>'ÊŒ','á¶»'=>'z','á¶¼'=>'Ê','á¶½'=>'Ê‘','á¶¾'=>'Ê’','á¶¿'=>'θ','Ḁ'=>'AÌ¥','á¸'=>'aÌ¥','Ḃ'=>'Ḃ','ḃ'=>'ḃ','Ḅ'=>'BÌ£','ḅ'=>'bÌ£','Ḇ'=>'Ḇ','ḇ'=>'ḇ','Ḉ'=>'ÇÌ','ḉ'=>'çÌ','Ḋ'=>'Ḋ','ḋ'=>'ḋ','Ḍ'=>'DÌ£','á¸'=>'dÌ£','Ḏ'=>'Ḏ','á¸'=>'ḏ','á¸'=>'Ḑ','ḑ'=>'ḑ','Ḓ'=>'DÌ','ḓ'=>'dÌ','Ḕ'=>'Ḕ','ḕ'=>'ḕ','Ḗ'=>'EÌ„Ì','ḗ'=>'eÌ„Ì','Ḙ'=>'EÌ','ḙ'=>'eÌ','Ḛ'=>'Ḛ','ḛ'=>'ḛ','Ḝ'=>'Ḝ','á¸'=>'ḝ','Ḟ'=>'Ḟ','ḟ'=>'ḟ','Ḡ'=>'GÌ„','ḡ'=>'gÌ„','Ḣ'=>'Ḣ','ḣ'=>'ḣ','Ḥ'=>'HÌ£','ḥ'=>'hÌ£','Ḧ'=>'Ḧ','ḧ'=>'ḧ','Ḩ'=>'Ḩ','ḩ'=>'ḩ','Ḫ'=>'HÌ®','ḫ'=>'hÌ®','Ḭ'=>'Ḭ','á¸'=>'ḭ','Ḯ'=>'ÏÌ','ḯ'=>'ïÌ','Ḱ'=>'KÌ','ḱ'=>'kÌ','Ḳ'=>'KÌ£','ḳ'=>'kÌ£','Ḵ'=>'Ḵ','ḵ'=>'ḵ','Ḷ'=>'LÌ£','ḷ'=>'lÌ£','Ḹ'=>'Ḹ','ḹ'=>'ḹ','Ḻ'=>'Ḻ','ḻ'=>'ḻ','Ḽ'=>'LÌ','ḽ'=>'lÌ','Ḿ'=>'MÌ','ḿ'=>'mÌ','á¹€'=>'Ṁ','á¹'=>'ṁ','Ṃ'=>'MÌ£','ṃ'=>'mÌ£','Ṅ'=>'Ṅ','á¹…'=>'ṅ','Ṇ'=>'NÌ£','ṇ'=>'nÌ£','Ṉ'=>'Ṉ','ṉ'=>'ṉ','Ṋ'=>'NÌ','ṋ'=>'nÌ','Ṍ'=>'ÕÌ','á¹'=>'õÌ','Ṏ'=>'Ṏ','á¹'=>'ṏ','á¹'=>'Ṑ','ṑ'=>'ṑ','á¹’'=>'OÌ„Ì','ṓ'=>'oÌ„Ì','á¹”'=>'PÌ','ṕ'=>'pÌ','á¹–'=>'Ṗ','á¹—'=>'ṗ','Ṙ'=>'Ṙ','á¹™'=>'ṙ','Ṛ'=>'RÌ£','á¹›'=>'rÌ£','Ṝ'=>'Ṝ','á¹'=>'ṝ','Ṟ'=>'Ṟ','ṟ'=>'ṟ','á¹ '=>'Ṡ','ṡ'=>'ṡ','á¹¢'=>'SÌ£','á¹£'=>'sÌ£','Ṥ'=>'SÌ̇','á¹¥'=>'sÌ̇','Ṧ'=>'Ṧ','á¹§'=>'ṧ','Ṩ'=>'Ṩ','ṩ'=>'ṩ','Ṫ'=>'Ṫ','ṫ'=>'ṫ','Ṭ'=>'TÌ£','á¹'=>'tÌ£','á¹®'=>'Ṯ','ṯ'=>'ṯ','á¹°'=>'TÌ','á¹±'=>'tÌ','á¹²'=>'Ṳ','á¹³'=>'ṳ','á¹´'=>'Ṵ','á¹µ'=>'ṵ','á¹¶'=>'UÌ','á¹·'=>'uÌ','Ṹ'=>'ŨÌ','á¹¹'=>'ũÌ','Ṻ'=>'Ṻ','á¹»'=>'ṻ','á¹¼'=>'Ṽ','á¹½'=>'ṽ','á¹¾'=>'VÌ£','ṿ'=>'vÌ£','Ẁ'=>'WÌ€','áº'=>'wÌ€','Ẃ'=>'WÌ','ẃ'=>'wÌ','Ẅ'=>'Ẅ','ẅ'=>'ẅ','Ẇ'=>'Ẇ','ẇ'=>'ẇ','Ẉ'=>'WÌ£','ẉ'=>'wÌ£','Ẋ'=>'Ẋ','ẋ'=>'ẋ','Ẍ'=>'Ẍ','áº'=>'ẍ','Ẏ'=>'Ẏ','áº'=>'ẏ','áº'=>'ZÌ‚','ẑ'=>'zÌ‚','Ẓ'=>'ZÌ£','ẓ'=>'zÌ£','Ẕ'=>'Ẕ','ẕ'=>'ẕ','ẖ'=>'ẖ','ẗ'=>'ẗ','ẘ'=>'wÌŠ','ẙ'=>'yÌŠ','ẚ'=>'aʾ','ẛ'=>'ṡ','Ạ'=>'AÌ£','ạ'=>'aÌ£','Ả'=>'Ả','ả'=>'ả','Ấ'=>'AÌ‚Ì','ấ'=>'aÌ‚Ì','Ầ'=>'Ầ','ầ'=>'ầ','Ẩ'=>'Ẩ','ẩ'=>'ẩ','Ẫ'=>'Ẫ','ẫ'=>'ẫ','Ậ'=>'Ậ','áº'=>'ậ','Ắ'=>'ĂÌ','ắ'=>'ăÌ','Ằ'=>'Ằ','ằ'=>'ằ','Ẳ'=>'Ẳ','ẳ'=>'ẳ','Ẵ'=>'Ẵ','ẵ'=>'ẵ','Ặ'=>'Ặ','ặ'=>'ặ','Ẹ'=>'EÌ£','ẹ'=>'eÌ£','Ẻ'=>'Ẻ','ẻ'=>'ẻ','Ẽ'=>'Ẽ','ẽ'=>'ẽ','Ế'=>'EÌ‚Ì','ế'=>'eÌ‚Ì','Ề'=>'Ề','á»'=>'ề','Ể'=>'Ể','ể'=>'ể','Ễ'=>'Ễ','á»…'=>'ễ','Ệ'=>'Ệ','ệ'=>'ệ','Ỉ'=>'Ỉ','ỉ'=>'ỉ','Ị'=>'IÌ£','ị'=>'iÌ£','Ọ'=>'OÌ£','á»'=>'oÌ£','Ỏ'=>'Ỏ','á»'=>'ỏ','á»'=>'OÌ‚Ì','ố'=>'oÌ‚Ì','á»’'=>'Ồ','ồ'=>'ồ','á»”'=>'Ổ','ổ'=>'ổ','á»–'=>'Ỗ','á»—'=>'ỗ','Ộ'=>'Ộ','á»™'=>'ộ','Ớ'=>'OÌ›Ì','á»›'=>'oÌ›Ì','Ờ'=>'Ờ','á»'=>'ờ','Ở'=>'Ở','ở'=>'ở','á» '=>'Ỡ','ỡ'=>'ỡ','Ợ'=>'Ợ','ợ'=>'ợ','Ụ'=>'UÌ£','ụ'=>'uÌ£','Ủ'=>'Ủ','á»§'=>'ủ','Ứ'=>'UÌ›Ì','ứ'=>'uÌ›Ì','Ừ'=>'Ừ','ừ'=>'ừ','Ử'=>'Ử','á»'=>'ử','á»®'=>'Ữ','ữ'=>'ữ','á»°'=>'Ự','á»±'=>'ự','Ỳ'=>'YÌ€','ỳ'=>'yÌ€','á»´'=>'YÌ£','ỵ'=>'yÌ£','á»¶'=>'Ỷ','á»·'=>'ỷ','Ỹ'=>'Ỹ','ỹ'=>'ỹ','á¼€'=>'ἀ','á¼'=>'ἁ','ἂ'=>'ἂ','ἃ'=>'ἃ','ἄ'=>'ἀÌ','á¼…'=>'ἁÌ','ἆ'=>'ἆ','ἇ'=>'ἇ','Ἀ'=>'Ἀ','Ἁ'=>'Ἁ','Ἂ'=>'Ἂ','Ἃ'=>'Ἃ','Ἄ'=>'ἈÌ','á¼'=>'ἉÌ','Ἆ'=>'Ἆ','á¼'=>'Ἇ','á¼'=>'ἐ','ἑ'=>'ἑ','á¼’'=>'ἒ','ἓ'=>'ἓ','á¼”'=>'ἐÌ','ἕ'=>'ἑÌ','Ἐ'=>'Ἐ','á¼™'=>'Ἑ','Ἒ'=>'Ἒ','á¼›'=>'Ἓ','Ἔ'=>'ἘÌ','á¼'=>'ἙÌ','á¼ '=>'ἠ','ἡ'=>'ἡ','á¼¢'=>'ἢ','á¼£'=>'ἣ','ἤ'=>'ἠÌ','á¼¥'=>'ἡÌ','ἦ'=>'ἦ','á¼§'=>'ἧ','Ἠ'=>'Ἠ','Ἡ'=>'Ἡ','Ἢ'=>'Ἢ','Ἣ'=>'Ἣ','Ἤ'=>'ἨÌ','á¼'=>'ἩÌ','á¼®'=>'Ἦ','Ἧ'=>'Ἧ','á¼°'=>'ἰ','á¼±'=>'ἱ','á¼²'=>'ἲ','á¼³'=>'ἳ','á¼´'=>'ἰÌ','á¼µ'=>'ἱÌ','á¼¶'=>'ἶ','á¼·'=>'ἷ','Ἰ'=>'Ἰ','á¼¹'=>'Ἱ','Ἲ'=>'Ἲ','á¼»'=>'Ἳ','á¼¼'=>'ἸÌ','á¼½'=>'ἹÌ','á¼¾'=>'Ἶ','Ἷ'=>'Ἷ','á½€'=>'ὀ','á½'=>'ὁ','ὂ'=>'ὂ','ὃ'=>'ὃ','ὄ'=>'ὀÌ','á½…'=>'ὁÌ','Ὀ'=>'Ὀ','Ὁ'=>'Ὁ','Ὂ'=>'Ὂ','Ὃ'=>'Ὃ','Ὄ'=>'ὈÌ','á½'=>'ὉÌ','á½'=>'Ï…Ì“','ὑ'=>'Ï…Ì”','á½’'=>'ὒ','ὓ'=>'ὓ','á½”'=>'Ï…Ì“Ì','ὕ'=>'Ï…Ì”Ì','á½–'=>'ὖ','á½—'=>'ὗ','á½™'=>'Ὑ','á½›'=>'Ὓ','á½'=>'ὙÌ','Ὗ'=>'Ὗ','á½ '=>'ὠ','ὡ'=>'ὡ','á½¢'=>'ὢ','á½£'=>'ὣ','ὤ'=>'ὠÌ','á½¥'=>'ὡÌ','ὦ'=>'ὦ','á½§'=>'ὧ','Ὠ'=>'Ὠ','Ὡ'=>'Ὡ','Ὢ'=>'Ὢ','Ὣ'=>'Ὣ','Ὤ'=>'ὨÌ','á½'=>'ὩÌ','á½®'=>'Ὦ','Ὧ'=>'Ὧ','á½°'=>'ὰ','á½±'=>'αÌ','á½²'=>'ὲ','á½³'=>'εÌ','á½´'=>'ὴ','á½µ'=>'ηÌ','á½¶'=>'ὶ','á½·'=>'ιÌ','ὸ'=>'ὸ','á½¹'=>'οÌ','ὺ'=>'Ï…Ì€','á½»'=>'Ï…Ì','á½¼'=>'ὼ','á½½'=>'ωÌ','á¾€'=>'ᾀ','á¾'=>'ᾁ','ᾂ'=>'ᾂ','ᾃ'=>'ᾃ','ᾄ'=>'ἀÌÍ…','á¾…'=>'ἁÌÍ…','ᾆ'=>'ᾆ','ᾇ'=>'ᾇ','ᾈ'=>'ᾈ','ᾉ'=>'ᾉ','ᾊ'=>'ᾊ','ᾋ'=>'ᾋ','ᾌ'=>'ἈÌÍ…','á¾'=>'ἉÌÍ…','ᾎ'=>'ᾎ','á¾'=>'ᾏ','á¾'=>'ᾐ','ᾑ'=>'ᾑ','á¾’'=>'ᾒ','ᾓ'=>'ᾓ','á¾”'=>'ἠÌÍ…','ᾕ'=>'ἡÌÍ…','á¾–'=>'ᾖ','á¾—'=>'ᾗ','ᾘ'=>'ᾘ','á¾™'=>'ᾙ','ᾚ'=>'ᾚ','á¾›'=>'ᾛ','ᾜ'=>'ἨÌÍ…','á¾'=>'ἩÌÍ…','ᾞ'=>'ᾞ','ᾟ'=>'ᾟ','á¾ '=>'ᾠ','ᾡ'=>'ᾡ','á¾¢'=>'ᾢ','á¾£'=>'ᾣ','ᾤ'=>'ὠÌÍ…','á¾¥'=>'ὡÌÍ…','ᾦ'=>'ᾦ','á¾§'=>'ᾧ','ᾨ'=>'ᾨ','ᾩ'=>'ᾩ','ᾪ'=>'ᾪ','ᾫ'=>'ᾫ','ᾬ'=>'ὨÌÍ…','á¾'=>'ὩÌÍ…','á¾®'=>'ᾮ','ᾯ'=>'ᾯ','á¾°'=>'ᾰ','á¾±'=>'ᾱ','á¾²'=>'ᾲ','á¾³'=>'ᾳ','á¾´'=>'αÌÍ…','á¾¶'=>'ᾶ','á¾·'=>'ᾷ','Ᾰ'=>'Ᾰ','á¾¹'=>'Ᾱ','Ὰ'=>'Ὰ','á¾»'=>'ΑÌ','á¾¼'=>'ᾼ','á¾½'=>' Ì“','á¾¾'=>'ι','᾿'=>' Ì“','á¿€'=>' Í‚','á¿'=>' ̈͂','á¿‚'=>'ῂ','ῃ'=>'ῃ','á¿„'=>'ηÌÍ…','ῆ'=>'ῆ','ῇ'=>'ῇ','Ὲ'=>'Ὲ','Έ'=>'ΕÌ','Ὴ'=>'Ὴ','á¿‹'=>'ΗÌ','ῌ'=>'ῌ','á¿'=>' ̓̀','῎'=>' Ì“Ì','á¿'=>' ̓͂','á¿'=>'ῐ','á¿‘'=>'ῑ','á¿’'=>'ῒ','á¿“'=>'ϊÌ','á¿–'=>'ῖ','á¿—'=>'ῗ','Ῐ'=>'Ῐ','á¿™'=>'Ῑ','Ὶ'=>'Ὶ','á¿›'=>'ΙÌ','á¿'=>' ̔̀','῞'=>' Ì”Ì','῟'=>' ̔͂','á¿ '=>'ῠ','á¿¡'=>'Ï…Ì„','á¿¢'=>'ῢ','á¿£'=>'ϋÌ','ῤ'=>'ÏÌ“','á¿¥'=>'ÏÌ”','ῦ'=>'Ï…Í‚','á¿§'=>'ῧ','Ῠ'=>'Ῠ','á¿©'=>'Ῡ','Ὺ'=>'Ὺ','á¿«'=>'Î¥Ì','Ῥ'=>'Ῥ','á¿'=>' ̈̀','á¿®'=>' ̈Ì','`'=>'`','ῲ'=>'ῲ','ῳ'=>'ῳ','á¿´'=>'ωÌÍ…','á¿¶'=>'ῶ','á¿·'=>'ῷ','Ὸ'=>'Ὸ','Ό'=>'ΟÌ','Ὼ'=>'Ὼ','á¿»'=>'ΩÌ','ῼ'=>'ῼ','´'=>' Ì','῾'=>' Ì”',' '=>' ','â€'=>' ',' '=>' ',' '=>' ',' '=>' ',' '=>' ',' '=>' ',' '=>' ',' '=>' ',' '=>' ',' '=>' ','‑'=>'â€','‗'=>' ̳','․'=>'.','‥'=>'..','…'=>'...',' '=>' ','″'=>'′′','‴'=>'′′′','‶'=>'‵‵','‷'=>'‵‵‵','‼'=>'!!','‾'=>' Ì…','â‡'=>'??','âˆ'=>'?!','â‰'=>'!?','â—'=>'′′′′','âŸ'=>' ','â°'=>'0','â±'=>'i','â´'=>'4','âµ'=>'5','â¶'=>'6','â·'=>'7','â¸'=>'8','â¹'=>'9','âº'=>'+','â»'=>'−','â¼'=>'=','â½'=>'(','â¾'=>')','â¿'=>'n','â‚€'=>'0','â‚'=>'1','â‚‚'=>'2','₃'=>'3','â‚„'=>'4','â‚…'=>'5','₆'=>'6','₇'=>'7','₈'=>'8','₉'=>'9','₊'=>'+','â‚‹'=>'−','₌'=>'=','â‚'=>'(','₎'=>')','â‚'=>'a','â‚‘'=>'e','â‚’'=>'o','â‚“'=>'x','â‚”'=>'É™','₨'=>'Rs','â„€'=>'a/c','â„'=>'a/s','â„‚'=>'C','℃'=>'°C','â„…'=>'c/o','℆'=>'c/u','ℇ'=>'Æ','℉'=>'°F','ℊ'=>'g','â„‹'=>'H','ℌ'=>'H','â„'=>'H','ℎ'=>'h','â„'=>'ħ','â„'=>'I','â„‘'=>'I','â„’'=>'L','â„“'=>'l','â„•'=>'N','â„–'=>'No','â„™'=>'P','ℚ'=>'Q','â„›'=>'R','ℜ'=>'R','â„'=>'R','â„ '=>'SM','â„¡'=>'TEL','â„¢'=>'TM','ℤ'=>'Z','Ω'=>'Ω','ℨ'=>'Z','K'=>'K','â„«'=>'AÌŠ','ℬ'=>'B','â„'=>'C','ℯ'=>'e','â„°'=>'E','ℱ'=>'F','ℳ'=>'M','â„´'=>'o','ℵ'=>'×','â„¶'=>'ב','â„·'=>'×’','ℸ'=>'ד','ℹ'=>'i','â„»'=>'FAX','ℼ'=>'Ï€','ℽ'=>'γ','ℾ'=>'Γ','â„¿'=>'Î ','â…€'=>'∑','â……'=>'D','â…†'=>'d','â…‡'=>'e','â…ˆ'=>'i','â…‰'=>'j','â…“'=>'1â„3','â…”'=>'2â„3','â…•'=>'1â„5','â…–'=>'2â„5','â…—'=>'3â„5','â…˜'=>'4â„5','â…™'=>'1â„6','â…š'=>'5â„6','â…›'=>'1â„8','â…œ'=>'3â„8','â…'=>'5â„8','â…ž'=>'7â„8','â…Ÿ'=>'1â„','â… '=>'I','â…¡'=>'II','â…¢'=>'III','â…£'=>'IV','â…¤'=>'V','â…¥'=>'VI','â…¦'=>'VII','â…§'=>'VIII','â…¨'=>'IX','â…©'=>'X','â…ª'=>'XI','â…«'=>'XII','â…¬'=>'L','â…'=>'C','â…®'=>'D','â…¯'=>'M','â…°'=>'i','â…±'=>'ii','â…²'=>'iii','â…³'=>'iv','â…´'=>'v','â…µ'=>'vi','â…¶'=>'vii','â…·'=>'viii','â…¸'=>'ix','â…¹'=>'x','â…º'=>'xi','â…»'=>'xii','â…¼'=>'l','â…½'=>'c','â…¾'=>'d','â…¿'=>'m','↚'=>'â†Ì¸','↛'=>'↛','↮'=>'↮','â‡'=>'â‡Ì¸','⇎'=>'⇎','â‡'=>'⇏','∄'=>'∄','∉'=>'∉','∌'=>'∌','∤'=>'∤','∦'=>'∦','∬'=>'∫∫','âˆ'=>'∫∫∫','∯'=>'∮∮','∰'=>'∮∮∮','â‰'=>'≁','≄'=>'≄','≇'=>'≇','≉'=>'≉','≠'=>'≠','≢'=>'≢','â‰'=>'â‰Ì¸','≮'=>'≮','≯'=>'≯','≰'=>'≰','≱'=>'≱','≴'=>'≴','≵'=>'≵','≸'=>'≸','≹'=>'≹','⊀'=>'⊀','âŠ'=>'⊁','⊄'=>'⊄','⊅'=>'⊅','⊈'=>'⊈','⊉'=>'⊉','⊬'=>'⊬','âŠ'=>'⊭','⊮'=>'⊮','⊯'=>'⊯','â‹ '=>'⋠','â‹¡'=>'⋡','â‹¢'=>'⋢','â‹£'=>'⋣','⋪'=>'⋪','â‹«'=>'⋫','⋬'=>'⋬','â‹'=>'⋭','〈'=>'〈','〉'=>'〉','â‘ '=>'1','â‘¡'=>'2','â‘¢'=>'3','â‘£'=>'4','⑤'=>'5','â‘¥'=>'6','⑦'=>'7','â‘§'=>'8','⑨'=>'9','â‘©'=>'10','⑪'=>'11','â‘«'=>'12','⑬'=>'13','â‘'=>'14','â‘®'=>'15','⑯'=>'16','â‘°'=>'17','⑱'=>'18','⑲'=>'19','⑳'=>'20','â‘´'=>'(1)','⑵'=>'(2)','â‘¶'=>'(3)','â‘·'=>'(4)','⑸'=>'(5)','⑹'=>'(6)','⑺'=>'(7)','â‘»'=>'(8)','⑼'=>'(9)','⑽'=>'(10)','⑾'=>'(11)','â‘¿'=>'(12)','â’€'=>'(13)','â’'=>'(14)','â’‚'=>'(15)','â’ƒ'=>'(16)','â’„'=>'(17)','â’…'=>'(18)','â’†'=>'(19)','â’‡'=>'(20)','â’ˆ'=>'1.','â’‰'=>'2.','â’Š'=>'3.','â’‹'=>'4.','â’Œ'=>'5.','â’'=>'6.','â’Ž'=>'7.','â’'=>'8.','â’'=>'9.','â’‘'=>'10.','â’’'=>'11.','â’“'=>'12.','â’”'=>'13.','â’•'=>'14.','â’–'=>'15.','â’—'=>'16.','â’˜'=>'17.','â’™'=>'18.','â’š'=>'19.','â’›'=>'20.','â’œ'=>'(a)','â’'=>'(b)','â’ž'=>'(c)','â’Ÿ'=>'(d)','â’ '=>'(e)','â’¡'=>'(f)','â’¢'=>'(g)','â’£'=>'(h)','â’¤'=>'(i)','â’¥'=>'(j)','â’¦'=>'(k)','â’§'=>'(l)','â’¨'=>'(m)','â’©'=>'(n)','â’ª'=>'(o)','â’«'=>'(p)','â’¬'=>'(q)','â’'=>'(r)','â’®'=>'(s)','â’¯'=>'(t)','â’°'=>'(u)','â’±'=>'(v)','â’²'=>'(w)','â’³'=>'(x)','â’´'=>'(y)','â’µ'=>'(z)','â’¶'=>'A','â’·'=>'B','â’¸'=>'C','â’¹'=>'D','â’º'=>'E','â’»'=>'F','â’¼'=>'G','â’½'=>'H','â’¾'=>'I','â’¿'=>'J','â“€'=>'K','â“'=>'L','â“‚'=>'M','Ⓝ'=>'N','â“„'=>'O','â“…'=>'P','Ⓠ'=>'Q','Ⓡ'=>'R','Ⓢ'=>'S','Ⓣ'=>'T','Ⓤ'=>'U','â“‹'=>'V','Ⓦ'=>'W','â“'=>'X','Ⓨ'=>'Y','â“'=>'Z','â“'=>'a','â“‘'=>'b','â“’'=>'c','â““'=>'d','â“”'=>'e','â“•'=>'f','â“–'=>'g','â“—'=>'h','ⓘ'=>'i','â“™'=>'j','ⓚ'=>'k','â“›'=>'l','ⓜ'=>'m','â“'=>'n','ⓞ'=>'o','ⓟ'=>'p','â“ '=>'q','â“¡'=>'r','â“¢'=>'s','â“£'=>'t','ⓤ'=>'u','â“¥'=>'v','ⓦ'=>'w','â“§'=>'x','ⓨ'=>'y','â“©'=>'z','⓪'=>'0','⨌'=>'∫∫∫∫','â©´'=>'::=','⩵'=>'==','â©¶'=>'===','⫝̸'=>'â«Ì¸','ⵯ'=>'ⵡ','⺟'=>'æ¯','⻳'=>'龟','â¼€'=>'一','â¼'=>'丨','⼂'=>'丶','⼃'=>'丿','⼄'=>'ä¹™','â¼…'=>'亅','⼆'=>'二','⼇'=>'äº ','⼈'=>'人','⼉'=>'å„¿','⼊'=>'å…¥','⼋'=>'å…«','⼌'=>'冂','â¼'=>'冖','⼎'=>'冫','â¼'=>'å‡ ','â¼'=>'凵','⼑'=>'刀','â¼’'=>'力','⼓'=>'勹','â¼”'=>'匕','⼕'=>'匚','â¼–'=>'匸','â¼—'=>'å','⼘'=>'åœ','â¼™'=>'å©','⼚'=>'厂','â¼›'=>'厶','⼜'=>'åˆ','â¼'=>'å£','⼞'=>'å›—','⼟'=>'土','â¼ '=>'士','⼡'=>'夂','â¼¢'=>'夊','â¼£'=>'夕','⼤'=>'大','â¼¥'=>'女','⼦'=>'å','â¼§'=>'宀','⼨'=>'寸','⼩'=>'å°','⼪'=>'å°¢','⼫'=>'å°¸','⼬'=>'å±®','â¼'=>'å±±','â¼®'=>'å·›','⼯'=>'å·¥','â¼°'=>'å·±','â¼±'=>'å·¾','â¼²'=>'å¹²','â¼³'=>'幺','â¼´'=>'广','â¼µ'=>'å»´','â¼¶'=>'廾','â¼·'=>'弋','⼸'=>'弓','â¼¹'=>'å½','⼺'=>'彡','â¼»'=>'å½³','â¼¼'=>'心','â¼½'=>'戈','â¼¾'=>'戶','⼿'=>'手','â½€'=>'支','â½'=>'æ”´','⽂'=>'æ–‡','⽃'=>'æ–—','⽄'=>'æ–¤','â½…'=>'æ–¹','⽆'=>'æ— ','⽇'=>'æ—¥','⽈'=>'æ›°','⽉'=>'月','⽊'=>'木','⽋'=>'æ¬ ','⽌'=>'æ¢','â½'=>'æ¹','⽎'=>'殳','â½'=>'毋','â½'=>'比','⽑'=>'毛','â½’'=>'æ°','⽓'=>'æ°”','â½”'=>'æ°´','⽕'=>'ç«','â½–'=>'爪','â½—'=>'父','⽘'=>'爻','â½™'=>'爿','⽚'=>'片','â½›'=>'牙','⽜'=>'牛','â½'=>'犬','⽞'=>'玄','⽟'=>'玉','â½ '=>'瓜','⽡'=>'瓦','â½¢'=>'甘','â½£'=>'生','⽤'=>'用','â½¥'=>'ç”°','⽦'=>'ç–‹','â½§'=>'ç–’','⽨'=>'ç™¶','⽩'=>'白','⽪'=>'çš®','⽫'=>'çš¿','⽬'=>'ç›®','â½'=>'矛','â½®'=>'矢','⽯'=>'石','â½°'=>'示','â½±'=>'禸','â½²'=>'禾','â½³'=>'ç©´','â½´'=>'ç«‹','â½µ'=>'竹','â½¶'=>'ç±³','â½·'=>'糸','⽸'=>'ç¼¶','â½¹'=>'网','⽺'=>'羊','â½»'=>'ç¾½','â½¼'=>'è€','â½½'=>'而','â½¾'=>'耒','⽿'=>'耳','â¾€'=>'è¿','â¾'=>'肉','⾂'=>'臣','⾃'=>'自','⾄'=>'至','â¾…'=>'臼','⾆'=>'舌','⾇'=>'舛','⾈'=>'舟','⾉'=>'艮','⾊'=>'色','⾋'=>'艸','⾌'=>'è™','â¾'=>'虫','⾎'=>'è¡€','â¾'=>'行','â¾'=>'è¡£','⾑'=>'襾','â¾’'=>'見','⾓'=>'è§’','â¾”'=>'言','⾕'=>'è°·','â¾–'=>'豆','â¾—'=>'豕','⾘'=>'豸','â¾™'=>'è²','⾚'=>'赤','â¾›'=>'èµ°','⾜'=>'è¶³','â¾'=>'身','⾞'=>'車','⾟'=>'è¾›','â¾ '=>'è¾°','⾡'=>'è¾µ','â¾¢'=>'é‚‘','â¾£'=>'é…‰','⾤'=>'釆','â¾¥'=>'里','⾦'=>'金','â¾§'=>'é•·','⾨'=>'é–€','⾩'=>'阜','⾪'=>'éš¶','⾫'=>'éš¹','⾬'=>'雨','â¾'=>'é‘','â¾®'=>'éž','⾯'=>'é¢','â¾°'=>'é©','â¾±'=>'韋','â¾²'=>'éŸ','â¾³'=>'音','â¾´'=>'é ','â¾µ'=>'風','â¾¶'=>'飛','â¾·'=>'食','⾸'=>'首','â¾¹'=>'香','⾺'=>'馬','â¾»'=>'骨','â¾¼'=>'高','â¾½'=>'髟','â¾¾'=>'鬥','⾿'=>'鬯','â¿€'=>'鬲','â¿'=>'鬼','â¿‚'=>'éš','⿃'=>'é³¥','â¿„'=>'é¹µ','â¿…'=>'鹿','⿆'=>'麥','⿇'=>'麻','⿈'=>'黃','⿉'=>'é»','⿊'=>'黑','â¿‹'=>'黹','⿌'=>'黽','â¿'=>'鼎','⿎'=>'鼓','â¿'=>'é¼ ','â¿'=>'é¼»','â¿‘'=>'齊','â¿’'=>'é½’','â¿“'=>'é¾','â¿”'=>'龜','â¿•'=>'é¾ ',' '=>' ','〶'=>'〒','〸'=>'å','〹'=>'å„','〺'=>'å…','ãŒ'=>'ã‹ã‚™','ãŽ'=>'ãã‚™','ã'=>'ãã‚™','ã’'=>'ã‘ã‚™','ã”'=>'ã“ã‚™','ã–'=>'ã•ã‚™','ã˜'=>'ã—ã‚™','ãš'=>'ã™ã‚™','ãœ'=>'ã›ã‚™','ãž'=>'ãã‚™','ã '=>'ãŸã‚™','ã¢'=>'ã¡ã‚™','ã¥'=>'ã¤ã‚™','ã§'=>'ã¦ã‚™','ã©'=>'ã¨ã‚™','ã°'=>'ã¯ã‚™','ã±'=>'ã¯ã‚š','ã³'=>'ã²ã‚™','ã´'=>'ã²ã‚š','ã¶'=>'ãµã‚™','ã·'=>'ãµã‚š','ã¹'=>'ã¸ã‚™','ãº'=>'ã¸ã‚š','ã¼'=>'ã»ã‚™','ã½'=>'ã»ã‚š','ã‚”'=>'ã†ã‚™','ã‚›'=>' ã‚™','゜'=>' ゚','ゞ'=>'ã‚ã‚™','ゟ'=>'より','ガ'=>'ã‚«ã‚™','ã‚®'=>'ã‚ã‚™','ã‚°'=>'グ','ゲ'=>'ゲ','ã‚´'=>'ゴ','ã‚¶'=>'ザ','ジ'=>'ã‚·ã‚™','ズ'=>'ズ','ゼ'=>'ゼ','ゾ'=>'ゾ','ダ'=>'ã‚¿ã‚™','ヂ'=>'ãƒã‚™','ヅ'=>'ヅ','デ'=>'デ','ド'=>'ド','ãƒ'=>'ãƒã‚™','パ'=>'ãƒã‚š','ビ'=>'ビ','ピ'=>'ピ','ブ'=>'ブ','プ'=>'プ','ベ'=>'ベ','ペ'=>'ペ','ボ'=>'ボ','ãƒ'=>'ポ','ヴ'=>'ヴ','ヷ'=>'ヷ','ヸ'=>'ヸ','ヹ'=>'ヹ','ヺ'=>'ヺ','ヾ'=>'ヾ','ヿ'=>'コト','ㄱ'=>'á„€','ㄲ'=>'á„','ㄳ'=>'ᆪ','ã„´'=>'á„‚','ㄵ'=>'ᆬ','ã„¶'=>'á†','ã„·'=>'ᄃ','ㄸ'=>'á„„','ㄹ'=>'á„…','ㄺ'=>'ᆰ','ã„»'=>'ᆱ','ㄼ'=>'ᆲ','ㄽ'=>'ᆳ','ㄾ'=>'ᆴ','ã„¿'=>'ᆵ','ã…€'=>'ᄚ','ã…'=>'ᄆ','ã…‚'=>'ᄇ','ã…ƒ'=>'ᄈ','ã…„'=>'á„¡','ã……'=>'ᄉ','ã…†'=>'ᄊ','ã…‡'=>'á„‹','ã…ˆ'=>'ᄌ','ã…‰'=>'á„','ã…Š'=>'ᄎ','ã…‹'=>'á„','ã…Œ'=>'á„','ã…'=>'á„‘','ã…Ž'=>'á„’','ã…'=>'á…¡','ã…'=>'á…¢','ã…‘'=>'á…£','ã…’'=>'á…¤','ã…“'=>'á…¥','ã…”'=>'á…¦','ã…•'=>'á…§','ã…–'=>'á…¨','ã…—'=>'á…©','ã…˜'=>'á…ª','ã…™'=>'á…«','ã…š'=>'á…¬','ã…›'=>'á…','ã…œ'=>'á…®','ã…'=>'á…¯','ã…ž'=>'á…°','ã…Ÿ'=>'á…±','ã… '=>'á…²','ã…¡'=>'á…³','ã…¢'=>'á…´','ã…£'=>'á…µ','ã…¤'=>'á… ','ã…¥'=>'á„”','ã…¦'=>'á„•','ã…§'=>'ᇇ','ã…¨'=>'ᇈ','ã…©'=>'ᇌ','ã…ª'=>'ᇎ','ã…«'=>'ᇓ','ã…¬'=>'ᇗ','ã…'=>'ᇙ','ã…®'=>'ᄜ','ã…¯'=>'á‡','ã…°'=>'ᇟ','ã…±'=>'á„','ã…²'=>'ᄞ','ã…³'=>'á„ ','ã…´'=>'á„¢','ã…µ'=>'á„£','ã…¶'=>'á„§','ã…·'=>'á„©','ã…¸'=>'á„«','ã…¹'=>'ᄬ','ã…º'=>'á„','ã…»'=>'á„®','ã…¼'=>'ᄯ','ã…½'=>'ᄲ','ã…¾'=>'á„¶','ã…¿'=>'á…€','ㆀ'=>'á…‡','ã†'=>'á…Œ','ㆂ'=>'ᇱ','ㆃ'=>'ᇲ','ㆄ'=>'á…—','ㆅ'=>'á…˜','ㆆ'=>'á…™','ㆇ'=>'ᆄ','ㆈ'=>'ᆅ','ㆉ'=>'ᆈ','ㆊ'=>'ᆑ','ㆋ'=>'ᆒ','ㆌ'=>'ᆔ','ã†'=>'ᆞ','ㆎ'=>'ᆡ','㆒'=>'一','㆓'=>'二','㆔'=>'三','㆕'=>'å››','㆖'=>'上','㆗'=>'ä¸','㆘'=>'下','㆙'=>'甲','㆚'=>'ä¹™','㆛'=>'丙','㆜'=>'ä¸','ã†'=>'天','㆞'=>'地','㆟'=>'人','㈀'=>'(á„€)','ãˆ'=>'(á„‚)','㈂'=>'(ᄃ)','㈃'=>'(á„…)','㈄'=>'(ᄆ)','㈅'=>'(ᄇ)','㈆'=>'(ᄉ)','㈇'=>'(á„‹)','㈈'=>'(ᄌ)','㈉'=>'(ᄎ)','㈊'=>'(á„)','㈋'=>'(á„)','㈌'=>'(á„‘)','ãˆ'=>'(á„’)','㈎'=>'(가)','ãˆ'=>'(á„‚á…¡)','ãˆ'=>'(다)','㈑'=>'(á„…á…¡)','㈒'=>'(마)','㈓'=>'(바)','㈔'=>'(사)','㈕'=>'(á„‹á…¡)','㈖'=>'(자)','㈗'=>'(차)','㈘'=>'(á„á…¡)','㈙'=>'(á„á…¡)','㈚'=>'(á„‘á…¡)','㈛'=>'(á„’á…¡)','㈜'=>'(주)','ãˆ'=>'(오전)','㈞'=>'(á„‹á…©á„’á…®)','㈠'=>'(一)','㈡'=>'(二)','㈢'=>'(三)','㈣'=>'(å››)','㈤'=>'(五)','㈥'=>'(å…)','㈦'=>'(七)','㈧'=>'(å…«)','㈨'=>'(ä¹)','㈩'=>'(å)','㈪'=>'(月)','㈫'=>'(ç«)','㈬'=>'(æ°´)','ãˆ'=>'(木)','㈮'=>'(金)','㈯'=>'(土)','㈰'=>'(æ—¥)','㈱'=>'(æ ª)','㈲'=>'(有)','㈳'=>'(社)','㈴'=>'(å)','㈵'=>'(特)','㈶'=>'(財)','㈷'=>'(ç¥)','㈸'=>'(労)','㈹'=>'(代)','㈺'=>'(呼)','㈻'=>'(å¦)','㈼'=>'(監)','㈽'=>'(ä¼)','㈾'=>'(資)','㈿'=>'(å”)','㉀'=>'(ç¥)','ã‰'=>'(休)','㉂'=>'(自)','㉃'=>'(至)','ã‰'=>'PTE','㉑'=>'21','㉒'=>'22','㉓'=>'23','㉔'=>'24','㉕'=>'25','㉖'=>'26','㉗'=>'27','㉘'=>'28','㉙'=>'29','㉚'=>'30','㉛'=>'31','㉜'=>'32','ã‰'=>'33','㉞'=>'34','㉟'=>'35','㉠'=>'á„€','㉡'=>'á„‚','㉢'=>'ᄃ','㉣'=>'á„…','㉤'=>'ᄆ','㉥'=>'ᄇ','㉦'=>'ᄉ','㉧'=>'á„‹','㉨'=>'ᄌ','㉩'=>'ᄎ','㉪'=>'á„','㉫'=>'á„','㉬'=>'á„‘','ã‰'=>'á„’','㉮'=>'가','㉯'=>'á„‚á…¡','㉰'=>'다','㉱'=>'á„…á…¡','㉲'=>'마','㉳'=>'바','㉴'=>'사','㉵'=>'á„‹á…¡','㉶'=>'자','㉷'=>'차','㉸'=>'á„á…¡','㉹'=>'á„á…¡','㉺'=>'á„‘á…¡','㉻'=>'á„’á…¡','㉼'=>'참고','㉽'=>'주의','㉾'=>'á„‹á…®','㊀'=>'一','ãŠ'=>'二','㊂'=>'三','㊃'=>'å››','㊄'=>'五','㊅'=>'å…','㊆'=>'七','㊇'=>'å…«','㊈'=>'ä¹','㊉'=>'å','㊊'=>'月','㊋'=>'ç«','㊌'=>'æ°´','ãŠ'=>'木','㊎'=>'金','ãŠ'=>'土','ãŠ'=>'æ—¥','㊑'=>'æ ª','㊒'=>'有','㊓'=>'社','㊔'=>'å','㊕'=>'特','㊖'=>'財','㊗'=>'ç¥','㊘'=>'労','㊙'=>'秘','㊚'=>'ç”·','㊛'=>'女','㊜'=>'é©','ãŠ'=>'優','㊞'=>'å°','㊟'=>'注','㊠'=>'é …','㊡'=>'休','㊢'=>'写','㊣'=>'æ£','㊤'=>'上','㊥'=>'ä¸','㊦'=>'下','㊧'=>'å·¦','㊨'=>'å³','㊩'=>'医','㊪'=>'å®—','㊫'=>'å¦','㊬'=>'監','ãŠ'=>'ä¼','㊮'=>'資','㊯'=>'å”','㊰'=>'夜','㊱'=>'36','㊲'=>'37','㊳'=>'38','㊴'=>'39','㊵'=>'40','㊶'=>'41','㊷'=>'42','㊸'=>'43','㊹'=>'44','㊺'=>'45','㊻'=>'46','㊼'=>'47','㊽'=>'48','㊾'=>'49','㊿'=>'50','ã‹€'=>'1月','ã‹'=>'2月','ã‹‚'=>'3月','㋃'=>'4月','ã‹„'=>'5月','ã‹…'=>'6月','㋆'=>'7月','㋇'=>'8月','㋈'=>'9月','㋉'=>'10月','㋊'=>'11月','ã‹‹'=>'12月','㋌'=>'Hg','ã‹'=>'erg','㋎'=>'eV','ã‹'=>'LTD','ã‹'=>'ã‚¢','ã‹‘'=>'イ','ã‹’'=>'ウ','ã‹“'=>'エ','ã‹”'=>'オ','ã‹•'=>'ã‚«','ã‹–'=>'ã‚','ã‹—'=>'ク','㋘'=>'ケ','ã‹™'=>'コ','㋚'=>'サ','ã‹›'=>'ã‚·','㋜'=>'ス','ã‹'=>'ã‚»','㋞'=>'ソ','㋟'=>'ã‚¿','ã‹ '=>'ãƒ','ã‹¡'=>'ツ','ã‹¢'=>'テ','ã‹£'=>'ト','㋤'=>'ナ','ã‹¥'=>'ニ','㋦'=>'ヌ','ã‹§'=>'ãƒ','㋨'=>'ノ','ã‹©'=>'ãƒ','㋪'=>'ヒ','ã‹«'=>'フ','㋬'=>'ヘ','ã‹'=>'ホ','ã‹®'=>'マ','㋯'=>'ミ','ã‹°'=>'ム','㋱'=>'メ','㋲'=>'モ','㋳'=>'ヤ','ã‹´'=>'ユ','㋵'=>'ヨ','ã‹¶'=>'ラ','ã‹·'=>'リ','㋸'=>'ル','㋹'=>'レ','㋺'=>'ãƒ','ã‹»'=>'ワ','㋼'=>'ヰ','㋽'=>'ヱ','㋾'=>'ヲ','㌀'=>'ã‚¢ãƒã‚šãƒ¼ãƒˆ','ãŒ'=>'アルファ','㌂'=>'アンペア','㌃'=>'アール','㌄'=>'イニング','㌅'=>'インãƒ','㌆'=>'ウォン','㌇'=>'エスクード','㌈'=>'エーカー','㌉'=>'オンス','㌊'=>'オーム','㌋'=>'カイリ','㌌'=>'カラット','ãŒ'=>'ã‚«ãƒãƒªãƒ¼','㌎'=>'ã‚«ã‚™ãƒãƒ³','ãŒ'=>'ガンマ','ãŒ'=>'ã‚゙ガ','㌑'=>'ã‚゙ニー','㌒'=>'ã‚ュリー','㌓'=>'ã‚゙ルダー','㌔'=>'ã‚ãƒ','㌕'=>'ã‚ãƒã‚¯ã‚™ãƒ©ãƒ ','㌖'=>'ã‚ãƒãƒ¡ãƒ¼ãƒˆãƒ«','㌗'=>'ã‚ãƒãƒ¯ãƒƒãƒˆ','㌘'=>'グラム','㌙'=>'グラムトン','㌚'=>'クルゼイãƒ','㌛'=>'クãƒãƒ¼ãƒ','㌜'=>'ケース','ãŒ'=>'コルナ','㌞'=>'コーポ','㌟'=>'サイクル','㌠'=>'サンãƒãƒ¼ãƒ ','㌡'=>'シリング','㌢'=>'センãƒ','㌣'=>'セント','㌤'=>'ダース','㌥'=>'デシ','㌦'=>'ドル','㌧'=>'トン','㌨'=>'ナノ','㌩'=>'ノット','㌪'=>'ãƒã‚¤ãƒ„','㌫'=>'ãƒã‚šãƒ¼ã‚»ãƒ³ãƒˆ','㌬'=>'ãƒã‚šãƒ¼ãƒ„','ãŒ'=>'ãƒã‚™ãƒ¼ãƒ¬ãƒ«','㌮'=>'ピアストル','㌯'=>'ピクル','㌰'=>'ピコ','㌱'=>'ビル','㌲'=>'ファラッド','㌳'=>'フィート','㌴'=>'ブッシェル','㌵'=>'フラン','㌶'=>'ヘクタール','㌷'=>'ペソ','㌸'=>'ペニヒ','㌹'=>'ヘルツ','㌺'=>'ペンス','㌻'=>'ページ','㌼'=>'ベータ','㌽'=>'ポイント','㌾'=>'ボルト','㌿'=>'ホン','ã€'=>'ポンド','ã'=>'ホール','ã‚'=>'ホーン','ãƒ'=>'マイクãƒ','ã„'=>'マイル','ã…'=>'マッãƒ','ã†'=>'マルク','ã‡'=>'マンション','ãˆ'=>'ミクãƒãƒ³','ã‰'=>'ミリ','ãŠ'=>'ミリãƒã‚™ãƒ¼ãƒ«','ã‹'=>'メガ','ãŒ'=>'メガトン','ã'=>'メートル','ãŽ'=>'ヤード','ã'=>'ヤール','ã'=>'ユアン','ã‘'=>'リットル','ã’'=>'リラ','ã“'=>'ルピー','ã”'=>'ルーブル','ã•'=>'レム','ã–'=>'レントゲン','ã—'=>'ワット','ã˜'=>'0点','ã™'=>'1点','ãš'=>'2点','ã›'=>'3点','ãœ'=>'4点','ã'=>'5点','ãž'=>'6点','ãŸ'=>'7点','ã '=>'8点','ã¡'=>'9点','ã¢'=>'10点','ã£'=>'11点','ã¤'=>'12点','ã¥'=>'13点','ã¦'=>'14点','ã§'=>'15点','ã¨'=>'16点','ã©'=>'17点','ãª'=>'18点','ã«'=>'19点','ã¬'=>'20点','ã'=>'21点','ã®'=>'22点','ã¯'=>'23点','ã°'=>'24点','ã±'=>'hPa','ã²'=>'da','ã³'=>'AU','ã´'=>'bar','ãµ'=>'oV','ã¶'=>'pc','ã·'=>'dm','ã¸'=>'dm2','ã¹'=>'dm3','ãº'=>'IU','ã»'=>'å¹³æˆ','ã¼'=>'æ˜å’Œ','ã½'=>'大æ£','ã¾'=>'明治','ã¿'=>'æ ªå¼ä¼šç¤¾','㎀'=>'pA','ãŽ'=>'nA','㎂'=>'μA','㎃'=>'mA','㎄'=>'kA','㎅'=>'KB','㎆'=>'MB','㎇'=>'GB','㎈'=>'cal','㎉'=>'kcal','㎊'=>'pF','㎋'=>'nF','㎌'=>'μF','ãŽ'=>'μg','㎎'=>'mg','ãŽ'=>'kg','ãŽ'=>'Hz','㎑'=>'kHz','㎒'=>'MHz','㎓'=>'GHz','㎔'=>'THz','㎕'=>'μl','㎖'=>'ml','㎗'=>'dl','㎘'=>'kl','㎙'=>'fm','㎚'=>'nm','㎛'=>'μm','㎜'=>'mm','ãŽ'=>'cm','㎞'=>'km','㎟'=>'mm2','㎠'=>'cm2','㎡'=>'m2','㎢'=>'km2','㎣'=>'mm3','㎤'=>'cm3','㎥'=>'m3','㎦'=>'km3','㎧'=>'m∕s','㎨'=>'m∕s2','㎩'=>'Pa','㎪'=>'kPa','㎫'=>'MPa','㎬'=>'GPa','ãŽ'=>'rad','㎮'=>'rad∕s','㎯'=>'rad∕s2','㎰'=>'ps','㎱'=>'ns','㎲'=>'μs','㎳'=>'ms','㎴'=>'pV','㎵'=>'nV','㎶'=>'μV','㎷'=>'mV','㎸'=>'kV','㎹'=>'MV','㎺'=>'pW','㎻'=>'nW','㎼'=>'μW','㎽'=>'mW','㎾'=>'kW','㎿'=>'MW','ã€'=>'kΩ','ã'=>'MΩ','ã‚'=>'a.m.','ãƒ'=>'Bq','ã„'=>'cc','ã…'=>'cd','ã†'=>'C∕kg','ã‡'=>'Co.','ãˆ'=>'dB','ã‰'=>'Gy','ãŠ'=>'ha','ã‹'=>'HP','ãŒ'=>'in','ã'=>'KK','ãŽ'=>'KM','ã'=>'kt','ã'=>'lm','ã‘'=>'ln','ã’'=>'log','ã“'=>'lx','ã”'=>'mb','ã•'=>'mil','ã–'=>'mol','ã—'=>'PH','ã˜'=>'p.m.','ã™'=>'PPM','ãš'=>'PR','ã›'=>'sr','ãœ'=>'Sv','ã'=>'Wb','ãž'=>'V∕m','ãŸ'=>'A∕m','ã '=>'1æ—¥','ã¡'=>'2æ—¥','ã¢'=>'3æ—¥','ã£'=>'4æ—¥','ã¤'=>'5æ—¥','ã¥'=>'6æ—¥','ã¦'=>'7æ—¥','ã§'=>'8æ—¥','ã¨'=>'9æ—¥','ã©'=>'10æ—¥','ãª'=>'11æ—¥','ã«'=>'12æ—¥','ã¬'=>'13æ—¥','ã'=>'14æ—¥','ã®'=>'15æ—¥','ã¯'=>'16æ—¥','ã°'=>'17æ—¥','ã±'=>'18æ—¥','ã²'=>'19æ—¥','ã³'=>'20æ—¥','ã´'=>'21æ—¥','ãµ'=>'22æ—¥','ã¶'=>'23æ—¥','ã·'=>'24æ—¥','ã¸'=>'25æ—¥','ã¹'=>'26æ—¥','ãº'=>'27æ—¥','ã»'=>'28æ—¥','ã¼'=>'29æ—¥','ã½'=>'30æ—¥','ã¾'=>'31æ—¥','ã¿'=>'gal','豈'=>'豈','ï¤'=>'æ›´','車'=>'車','賈'=>'賈','滑'=>'滑','串'=>'串','句'=>'å¥','龜'=>'龜','龜'=>'龜','契'=>'契','金'=>'金','喇'=>'å–‡','奈'=>'奈','ï¤'=>'懶','癩'=>'癩','ï¤'=>'ç¾…','ï¤'=>'蘿','螺'=>'螺','裸'=>'裸','邏'=>'é‚','樂'=>'樂','洛'=>'æ´›','烙'=>'烙','珞'=>'çž','落'=>'è½','酪'=>'é…ª','駱'=>'é§±','亂'=>'亂','卵'=>'åµ','ï¤'=>'欄','爛'=>'爛','蘭'=>'è˜','ï¤ '=>'鸞','嵐'=>'åµ','濫'=>'æ¿«','藍'=>'è—','襤'=>'襤','拉'=>'拉','臘'=>'臘','蠟'=>'è Ÿ','廊'=>'廊','朗'=>'朗','浪'=>'浪','狼'=>'狼','郎'=>'郎','ï¤'=>'來','冷'=>'冷','勞'=>'勞','擄'=>'æ“„','櫓'=>'æ«“','爐'=>'çˆ','盧'=>'ç›§','老'=>'è€','蘆'=>'蘆','虜'=>'虜','路'=>'è·¯','露'=>'露','魯'=>'é¯','鷺'=>'é·º','碌'=>'碌','祿'=>'祿','綠'=>'ç¶ ','菉'=>'è‰','錄'=>'錄','鹿'=>'鹿','ï¥'=>'è«–','壟'=>'壟','弄'=>'弄','籠'=>'ç± ','聾'=>'è¾','牢'=>'牢','磊'=>'磊','賂'=>'賂','雷'=>'é›·','壘'=>'壘','屢'=>'å±¢','樓'=>'樓','ï¥'=>'æ·š','漏'=>'æ¼','ï¥'=>'ç´¯','ï¥'=>'縷','陋'=>'陋','勒'=>'å‹’','肋'=>'è‚‹','凜'=>'凜','凌'=>'凌','稜'=>'稜','綾'=>'ç¶¾','菱'=>'è±','陵'=>'陵','讀'=>'讀','拏'=>'æ‹','樂'=>'樂','ï¥'=>'諾','丹'=>'丹','寧'=>'寧','ï¥ '=>'怒','率'=>'率','異'=>'ç•°','北'=>'北','磻'=>'磻','便'=>'便','復'=>'復','不'=>'ä¸','泌'=>'泌','數'=>'數','索'=>'ç´¢','參'=>'åƒ','塞'=>'塞','ï¥'=>'çœ','葉'=>'葉','說'=>'說','殺'=>'殺','辰'=>'è¾°','沈'=>'沈','拾'=>'拾','若'=>'è‹¥','掠'=>'æŽ ','略'=>'ç•¥','亮'=>'亮','兩'=>'å…©','凉'=>'凉','梁'=>'æ¢','糧'=>'ç³§','良'=>'良','諒'=>'è«’','量'=>'é‡','勵'=>'勵','呂'=>'å‘‚','ï¦'=>'女','廬'=>'廬','旅'=>'æ—…','濾'=>'濾','礪'=>'礪','閭'=>'é–','驪'=>'驪','麗'=>'麗','黎'=>'黎','力'=>'力','曆'=>'曆','歷'=>'æ·','ï¦'=>'è½¢','年'=>'å¹´','ï¦'=>'æ†','ï¦'=>'戀','撚'=>'æ’š','漣'=>'æ¼£','煉'=>'ç…‰','璉'=>'ç’‰','秊'=>'ç§Š','練'=>'ç·´','聯'=>'è¯','輦'=>'輦','蓮'=>'è“®','連'=>'連','鍊'=>'éŠ','列'=>'列','ï¦'=>'劣','咽'=>'å’½','烈'=>'烈','ï¦ '=>'裂','說'=>'說','廉'=>'廉','念'=>'念','捻'=>'æ»','殮'=>'æ®®','簾'=>'ç°¾','獵'=>'çµ','令'=>'令','囹'=>'囹','寧'=>'寧','嶺'=>'嶺','怜'=>'怜','ï¦'=>'玲','瑩'=>'ç‘©','羚'=>'羚','聆'=>'è†','鈴'=>'鈴','零'=>'é›¶','靈'=>'éˆ','領'=>'é ˜','例'=>'例','禮'=>'禮','醴'=>'醴','隸'=>'隸','惡'=>'惡','了'=>'了','僚'=>'僚','寮'=>'寮','尿'=>'å°¿','料'=>'æ–™','樂'=>'樂','ï§€'=>'燎','ï§'=>'療','ï§‚'=>'蓼','遼'=>'é¼','ï§„'=>'é¾','ï§…'=>'暈','阮'=>'阮','劉'=>'劉','杻'=>'æ»','柳'=>'柳','ï§Š'=>'æµ','ï§‹'=>'溜','ï§Œ'=>'ç‰','ï§'=>'ç•™','ï§Ž'=>'ç¡«','ï§'=>'ç´','ï§'=>'類','ï§‘'=>'å…','ï§’'=>'戮','ï§“'=>'陸','ï§”'=>'倫','ï§•'=>'å´™','ï§–'=>'æ·ª','ï§—'=>'輪','律'=>'律','ï§™'=>'æ…„','ï§š'=>'æ —','ï§›'=>'率','ï§œ'=>'隆','ï§'=>'利','ï§ž'=>'å','ï§Ÿ'=>'å±¥','ï§ '=>'易','ï§¡'=>'æŽ','ï§¢'=>'梨','ï§£'=>'æ³¥','理'=>'ç†','ï§¥'=>'ç—¢','罹'=>'ç½¹','ï§§'=>'è£','裡'=>'裡','ï§©'=>'里','離'=>'離','ï§«'=>'匿','溺'=>'溺','ï§'=>'å','ï§®'=>'ç‡','璘'=>'ç’˜','ï§°'=>'è—º','ï§±'=>'隣','ï§²'=>'é±—','ï§³'=>'麟','ï§´'=>'æž—','ï§µ'=>'æ·‹','ï§¶'=>'臨','ï§·'=>'ç«‹','笠'=>'ç¬ ','ï§¹'=>'ç²’','狀'=>'ç‹€','ï§»'=>'ç‚™','ï§¼'=>'è˜','ï§½'=>'什','ï§¾'=>'茶','ï§¿'=>'刺','切'=>'切','ï¨'=>'度','拓'=>'æ‹“','糖'=>'ç³–','宅'=>'å®…','洞'=>'æ´ž','暴'=>'æš´','輻'=>'è¼»','行'=>'行','降'=>'é™','見'=>'見','廓'=>'廓','兀'=>'å…€','ï¨'=>'å—€','ï¨'=>'塚','晴'=>'æ™´','凞'=>'凞','猪'=>'猪','益'=>'益','礼'=>'礼','神'=>'神','祥'=>'祥','福'=>'ç¦','靖'=>'é–','ï¨'=>'ç²¾','羽'=>'ç¾½','ï¨ '=>'蘒','諸'=>'諸','逸'=>'逸','都'=>'都','飯'=>'飯','飼'=>'飼','館'=>'館','ï¨'=>'é¶´','侮'=>'ä¾®','僧'=>'僧','免'=>'å…','勉'=>'勉','勤'=>'勤','卑'=>'å‘','喝'=>'å–','嘆'=>'嘆','器'=>'器','塀'=>'å¡€','墨'=>'墨','層'=>'層','屮'=>'å±®','悔'=>'æ‚”','慨'=>'æ…¨','憎'=>'憎','ï©€'=>'懲','ï©'=>'æ•','ï©‚'=>'æ—¢','暑'=>'æš‘','ï©„'=>'梅','ï©…'=>'æµ·','渚'=>'渚','漢'=>'æ¼¢','煮'=>'ç…®','爫'=>'爫','琢'=>'ç¢','ï©‹'=>'碑','社'=>'社','ï©'=>'祉','祈'=>'祈','ï©'=>'ç¥','ï©'=>'祖','ï©‘'=>'ç¥','ï©’'=>'ç¦','ï©“'=>'禎','ï©”'=>'ç©€','ï©•'=>'çª','ï©–'=>'節','ï©—'=>'ç·´','縉'=>'縉','ï©™'=>'ç¹','署'=>'ç½²','ï©›'=>'者','臭'=>'è‡','ï©'=>'艹','艹'=>'艹','著'=>'è‘—','ï© '=>'è¤','ï©¡'=>'視','ï©¢'=>'è¬','ï©£'=>'謹','賓'=>'賓','ï©¥'=>'è´ˆ','辶'=>'è¾¶','ï©§'=>'逸','難'=>'難','ï©©'=>'響','頻'=>'é »','ï©°'=>'並','况'=>'况','全'=>'å…¨','侀'=>'ä¾€','ï©´'=>'å……','冀'=>'冀','ï©¶'=>'勇','ï©·'=>'勺','喝'=>'å–','啕'=>'å••','喙'=>'å–™','ï©»'=>'å—¢','塚'=>'塚','墳'=>'墳','奄'=>'奄','ï©¿'=>'奔','婢'=>'å©¢','ïª'=>'嬨','廒'=>'å»’','廙'=>'å»™','彩'=>'彩','徭'=>'å¾','惘'=>'惘','慎'=>'æ…Ž','愈'=>'愈','憎'=>'憎','慠'=>'æ… ','懲'=>'懲','戴'=>'戴','ïª'=>'æ„','搜'=>'æœ','ïª'=>'æ‘’','ïª'=>'æ•–','晴'=>'æ™´','朗'=>'朗','望'=>'望','杖'=>'æ–','歹'=>'æ¹','殺'=>'殺','流'=>'æµ','滛'=>'æ»›','滋'=>'滋','漢'=>'æ¼¢','瀞'=>'瀞','煮'=>'ç…®','ïª'=>'çž§','爵'=>'爵','犯'=>'犯','ïª '=>'猪','瑱'=>'瑱','甆'=>'甆','画'=>'ç”»','瘝'=>'ç˜','瘟'=>'瘟','益'=>'益','盛'=>'ç››','直'=>'ç›´','睊'=>'çŠ','着'=>'ç€','磌'=>'磌','窱'=>'窱','ïª'=>'節','类'=>'ç±»','絛'=>'çµ›','練'=>'ç·´','缾'=>'ç¼¾','者'=>'者','荒'=>'è’','華'=>'è¯','蝹'=>'è¹','襁'=>'è¥','覆'=>'覆','視'=>'視','調'=>'調','諸'=>'諸','請'=>'è«‹','謁'=>'è¬','諾'=>'諾','諭'=>'è«','謹'=>'謹','ï«€'=>'變','ï«'=>'è´ˆ','ï«‚'=>'輸','遲'=>'é²','ï«„'=>'醙','ï«…'=>'鉶','陼'=>'陼','難'=>'難','靖'=>'é–','韛'=>'韛','響'=>'響','ï«‹'=>'é ‹','頻'=>'é »','ï«'=>'鬒','龜'=>'龜','ï«'=>'𢡊','ï«'=>'𢡄','ï«‘'=>'ð£•','ï«’'=>'ã®','ï«“'=>'䀘','ï«”'=>'䀹','ï«•'=>'𥉉','ï«–'=>'ð¥³','ï«—'=>'𧻓','齃'=>'齃','ï«™'=>'龎','ff'=>'ff','ï¬'=>'fi','fl'=>'fl','ffi'=>'ffi','ffl'=>'ffl','ſt'=>'st','st'=>'st','ﬓ'=>'Õ´Õ¶','ﬔ'=>'Õ´Õ¥','ﬕ'=>'Õ´Õ«','ﬖ'=>'Õ¾Õ¶','ﬗ'=>'Õ´Õ','ï¬'=>'×™Ö´','ײַ'=>'ײַ','ï¬ '=>'×¢','ﬡ'=>'×','ﬢ'=>'ד','ﬣ'=>'×”','ﬤ'=>'×›','ﬥ'=>'ל','ﬦ'=>'×','ﬧ'=>'ר','ﬨ'=>'ת','﬩'=>'+','שׁ'=>'ש×','שׂ'=>'שׂ','שּׁ'=>'שּ×','ï¬'=>'שּׂ','אַ'=>'×Ö·','אָ'=>'×Ö¸','אּ'=>'×Ö¼','בּ'=>'בּ','גּ'=>'×’Ö¼','דּ'=>'דּ','הּ'=>'×”Ö¼','וּ'=>'וּ','זּ'=>'×–Ö¼','טּ'=>'טּ','יּ'=>'×™Ö¼','ךּ'=>'ךּ','כּ'=>'×›Ö¼','לּ'=>'לּ','מּ'=>'מּ','ï€'=>'× Ö¼','ï'=>'סּ','ïƒ'=>'×£Ö¼','ï„'=>'פּ','ï†'=>'צּ','ï‡'=>'×§Ö¼','ïˆ'=>'רּ','ï‰'=>'שּ','ïŠ'=>'תּ','ï‹'=>'וֹ','ïŒ'=>'בֿ','ï'=>'×›Ö¿','ïŽ'=>'פֿ','ï'=>'×ל','ï'=>'Ù±','ï‘'=>'Ù±','ï’'=>'Ù»','ï“'=>'Ù»','ï”'=>'Ù»','ï•'=>'Ù»','ï–'=>'Ù¾','ï—'=>'Ù¾','ï˜'=>'Ù¾','ï™'=>'Ù¾','ïš'=>'Ú€','ï›'=>'Ú€','ïœ'=>'Ú€','ï'=>'Ú€','ïž'=>'Ùº','ïŸ'=>'Ùº','ï '=>'Ùº','ï¡'=>'Ùº','ï¢'=>'Ù¿','ï£'=>'Ù¿','ï¤'=>'Ù¿','ï¥'=>'Ù¿','ï¦'=>'Ù¹','ï§'=>'Ù¹','ï¨'=>'Ù¹','ï©'=>'Ù¹','ïª'=>'Ú¤','ï«'=>'Ú¤','ï¬'=>'Ú¤','ï'=>'Ú¤','ï®'=>'Ú¦','ï¯'=>'Ú¦','ï°'=>'Ú¦','ï±'=>'Ú¦','ï²'=>'Ú„','ï³'=>'Ú„','ï´'=>'Ú„','ïµ'=>'Ú„','ï¶'=>'Úƒ','ï·'=>'Úƒ','ï¸'=>'Úƒ','ï¹'=>'Úƒ','ïº'=>'Ú†','ï»'=>'Ú†','ï¼'=>'Ú†','ï½'=>'Ú†','ï¾'=>'Ú‡','ï¿'=>'Ú‡','ﮀ'=>'Ú‡','ï®'=>'Ú‡','ﮂ'=>'Ú','ﮃ'=>'Ú','ﮄ'=>'ÚŒ','ï®…'=>'ÚŒ','ﮆ'=>'ÚŽ','ﮇ'=>'ÚŽ','ﮈ'=>'Úˆ','ﮉ'=>'Úˆ','ﮊ'=>'Ú˜','ﮋ'=>'Ú˜','ﮌ'=>'Ú‘','ï®'=>'Ú‘','ﮎ'=>'Ú©','ï®'=>'Ú©','ï®'=>'Ú©','ﮑ'=>'Ú©','ï®’'=>'Ú¯','ﮓ'=>'Ú¯','ï®”'=>'Ú¯','ﮕ'=>'Ú¯','ï®–'=>'Ú³','ï®—'=>'Ú³','ﮘ'=>'Ú³','ï®™'=>'Ú³','ﮚ'=>'Ú±','ï®›'=>'Ú±','ﮜ'=>'Ú±','ï®'=>'Ú±','ﮞ'=>'Úº','ﮟ'=>'Úº','ï® '=>'Ú»','ﮡ'=>'Ú»','ﮢ'=>'Ú»','ﮣ'=>'Ú»','ﮤ'=>'Û•Ù”','ﮥ'=>'Û•Ù”','ﮦ'=>'Û','ï®§'=>'Û','ﮨ'=>'Û','ﮩ'=>'Û','ﮪ'=>'Ú¾','ﮫ'=>'Ú¾','ﮬ'=>'Ú¾','ï®'=>'Ú¾','ï®®'=>'Û’','ﮯ'=>'Û’','ï®°'=>'Û’Ù”','ï®±'=>'Û’Ù”','ﯓ'=>'Ú','ﯔ'=>'Ú','ﯕ'=>'Ú','ﯖ'=>'Ú','ﯗ'=>'Û‡','ﯘ'=>'Û‡','ﯙ'=>'Û†','ﯚ'=>'Û†','ﯛ'=>'Ûˆ','ﯜ'=>'Ûˆ','ï¯'=>'Û‡Ù´','ﯞ'=>'Û‹','ﯟ'=>'Û‹','ï¯ '=>'Û…','ﯡ'=>'Û…','ﯢ'=>'Û‰','ﯣ'=>'Û‰','ﯤ'=>'Û','ﯥ'=>'Û','ﯦ'=>'Û','ﯧ'=>'Û','ﯨ'=>'Ù‰','ﯩ'=>'Ù‰','ﯪ'=>'ئا','ﯫ'=>'ئا','ﯬ'=>'ÙŠÙ”Û•','ï¯'=>'ÙŠÙ”Û•','ﯮ'=>'ÙŠÙ”Ùˆ','ﯯ'=>'ÙŠÙ”Ùˆ','ﯰ'=>'ÙŠÙ”Û‡','ﯱ'=>'ÙŠÙ”Û‡','ﯲ'=>'ÙŠÙ”Û†','ﯳ'=>'ÙŠÙ”Û†','ﯴ'=>'ÙŠÙ”Ûˆ','ﯵ'=>'ÙŠÙ”Ûˆ','ﯶ'=>'ÙŠÙ”Û','ﯷ'=>'ÙŠÙ”Û','ﯸ'=>'ÙŠÙ”Û','ﯹ'=>'ÙŠÙ”Ù‰','ﯺ'=>'ÙŠÙ”Ù‰','ﯻ'=>'ÙŠÙ”Ù‰','ﯼ'=>'ÛŒ','ﯽ'=>'ÛŒ','ﯾ'=>'ÛŒ','ﯿ'=>'ÛŒ','ï°€'=>'ئج','ï°'=>'ÙŠÙ”Ø','ï°‚'=>'ÙŠÙ”Ù…','ï°ƒ'=>'ÙŠÙ”Ù‰','ï°„'=>'ÙŠÙ”ÙŠ','ï°…'=>'بج','ï°†'=>'بØ','ï°‡'=>'بخ','ï°ˆ'=>'بم','ï°‰'=>'بى','ï°Š'=>'بي','ï°‹'=>'تج','ï°Œ'=>'تØ','ï°'=>'تخ','ï°Ž'=>'تم','ï°'=>'تى','ï°'=>'تي','ï°‘'=>'ثج','ï°’'=>'ثم','ï°“'=>'ثى','ï°”'=>'ثي','ï°•'=>'جØ','ï°–'=>'جم','ï°—'=>'ØØ¬','ï°˜'=>'ØÙ…','ï°™'=>'خج','ï°š'=>'Ø®Ø','ï°›'=>'خم','ï°œ'=>'سج','ï°'=>'سØ','ï°ž'=>'سخ','ï°Ÿ'=>'سم','ï° '=>'صØ','ï°¡'=>'صم','ï°¢'=>'ضج','ï°£'=>'ضØ','ï°¤'=>'ضخ','ï°¥'=>'ضم','ï°¦'=>'Ø·Ø','ï°§'=>'طم','ï°¨'=>'ظم','ï°©'=>'عج','ï°ª'=>'عم','ï°«'=>'غج','ï°¬'=>'غم','ï°'=>'ÙØ¬','ï°®'=>'ÙØ','ï°¯'=>'ÙØ®','ï°°'=>'ÙÙ…','ï°±'=>'ÙÙ‰','ï°²'=>'ÙÙŠ','ï°³'=>'Ù‚Ø','ï°´'=>'قم','ï°µ'=>'قى','ï°¶'=>'قي','ï°·'=>'كا','ï°¸'=>'كج','ï°¹'=>'ÙƒØ','ï°º'=>'كخ','ï°»'=>'كل','ï°¼'=>'كم','ï°½'=>'كى','ï°¾'=>'كي','ï°¿'=>'لج','ï±€'=>'Ù„Ø','ï±'=>'لخ','ﱂ'=>'لم','ﱃ'=>'لى','ﱄ'=>'لي','ï±…'=>'مج','ﱆ'=>'Ù…Ø','ﱇ'=>'مخ','ﱈ'=>'مم','ﱉ'=>'مى','ﱊ'=>'مي','ﱋ'=>'نج','ﱌ'=>'Ù†Ø','ï±'=>'نخ','ﱎ'=>'نم','ï±'=>'نى','ï±'=>'ني','ﱑ'=>'هج','ï±’'=>'هم','ﱓ'=>'هى','ï±”'=>'هي','ﱕ'=>'يج','ï±–'=>'ÙŠØ','ï±—'=>'يخ','ﱘ'=>'يم','ï±™'=>'يى','ﱚ'=>'يي','ï±›'=>'ذٰ','ﱜ'=>'رٰ','ï±'=>'ىٰ','ﱞ'=>' ٌّ','ﱟ'=>' ÙÙ‘','ï± '=>' ÙŽÙ‘','ﱡ'=>' ÙÙ‘','ï±¢'=>' ÙÙ‘','ï±£'=>' ّٰ','ﱤ'=>'ئر','ï±¥'=>'ئز','ﱦ'=>'ÙŠÙ”Ù…','ï±§'=>'ÙŠÙ”Ù†','ﱨ'=>'ÙŠÙ”Ù‰','ﱩ'=>'ÙŠÙ”ÙŠ','ﱪ'=>'بر','ﱫ'=>'بز','ﱬ'=>'بم','ï±'=>'بن','ï±®'=>'بى','ﱯ'=>'بي','ï±°'=>'تر','ï±±'=>'تز','ï±²'=>'تم','ï±³'=>'تن','ï±´'=>'تى','ï±µ'=>'تي','ï±¶'=>'ثر','ï±·'=>'ثز','ﱸ'=>'ثم','ï±¹'=>'ثن','ﱺ'=>'ثى','ï±»'=>'ثي','ï±¼'=>'ÙÙ‰','ï±½'=>'ÙÙŠ','ï±¾'=>'قى','ﱿ'=>'قي','ï²€'=>'كا','ï²'=>'كل','ﲂ'=>'كم','ﲃ'=>'كى','ﲄ'=>'كي','ï²…'=>'لم','ﲆ'=>'لى','ﲇ'=>'لي','ﲈ'=>'ما','ﲉ'=>'مم','ﲊ'=>'نر','ﲋ'=>'نز','ﲌ'=>'نم','ï²'=>'نن','ﲎ'=>'نى','ï²'=>'ني','ï²'=>'ىٰ','ﲑ'=>'ير','ï²’'=>'يز','ﲓ'=>'يم','ï²”'=>'ين','ﲕ'=>'يى','ï²–'=>'يي','ï²—'=>'ئج','ﲘ'=>'ÙŠÙ”Ø','ï²™'=>'ئخ','ﲚ'=>'ÙŠÙ”Ù…','ï²›'=>'ÙŠÙ”Ù‡','ﲜ'=>'بج','ï²'=>'بØ','ﲞ'=>'بخ','ﲟ'=>'بم','ï² '=>'به','ﲡ'=>'تج','ï²¢'=>'تØ','ï²£'=>'تخ','ﲤ'=>'تم','ï²¥'=>'ته','ﲦ'=>'ثم','ï²§'=>'جØ','ﲨ'=>'جم','ﲩ'=>'ØØ¬','ﲪ'=>'ØÙ…','ﲫ'=>'خج','ﲬ'=>'خم','ï²'=>'سج','ï²®'=>'سØ','ﲯ'=>'سخ','ï²°'=>'سم','ï²±'=>'صØ','ï²²'=>'صخ','ï²³'=>'صم','ï²´'=>'ضج','ï²µ'=>'ضØ','ï²¶'=>'ضخ','ï²·'=>'ضم','ﲸ'=>'Ø·Ø','ï²¹'=>'ظم','ﲺ'=>'عج','ï²»'=>'عم','ï²¼'=>'غج','ï²½'=>'غم','ï²¾'=>'ÙØ¬','ﲿ'=>'ÙØ','ï³€'=>'ÙØ®','ï³'=>'ÙÙ…','ﳂ'=>'Ù‚Ø','ﳃ'=>'قم','ﳄ'=>'كج','ï³…'=>'ÙƒØ','ﳆ'=>'كخ','ﳇ'=>'كل','ﳈ'=>'كم','ﳉ'=>'لج','ﳊ'=>'Ù„Ø','ﳋ'=>'لخ','ﳌ'=>'لم','ï³'=>'له','ﳎ'=>'مج','ï³'=>'Ù…Ø','ï³'=>'مخ','ﳑ'=>'مم','ï³’'=>'نج','ﳓ'=>'Ù†Ø','ï³”'=>'نخ','ﳕ'=>'نم','ï³–'=>'نه','ï³—'=>'هج','ﳘ'=>'هم','ï³™'=>'هٰ','ﳚ'=>'يج','ï³›'=>'ÙŠØ','ﳜ'=>'يخ','ï³'=>'يم','ﳞ'=>'يه','ﳟ'=>'ÙŠÙ”Ù…','ï³ '=>'ÙŠÙ”Ù‡','ﳡ'=>'بم','ï³¢'=>'به','ï³£'=>'تم','ﳤ'=>'ته','ï³¥'=>'ثم','ﳦ'=>'ثه','ï³§'=>'سم','ﳨ'=>'سه','ﳩ'=>'شم','ﳪ'=>'شه','ﳫ'=>'كل','ﳬ'=>'كم','ï³'=>'لم','ï³®'=>'نم','ﳯ'=>'نه','ï³°'=>'يم','ï³±'=>'يه','ï³²'=>'Ù€ÙŽÙ‘','ï³³'=>'Ù€ÙÙ‘','ï³´'=>'Ù€ÙÙ‘','ï³µ'=>'طى','ï³¶'=>'طي','ï³·'=>'عى','ﳸ'=>'عي','ï³¹'=>'غى','ﳺ'=>'غي','ï³»'=>'سى','ï³¼'=>'سي','ï³½'=>'شى','ï³¾'=>'شي','ﳿ'=>'ØÙ‰','ï´€'=>'ØÙŠ','ï´'=>'جى','ï´‚'=>'جي','ï´ƒ'=>'خى','ï´„'=>'خي','ï´…'=>'صى','ï´†'=>'صي','ï´‡'=>'ضى','ï´ˆ'=>'ضي','ï´‰'=>'شج','ï´Š'=>'Ø´Ø','ï´‹'=>'شخ','ï´Œ'=>'شم','ï´'=>'شر','ï´Ž'=>'سر','ï´'=>'صر','ï´'=>'ضر','ï´‘'=>'طى','ï´’'=>'طي','ï´“'=>'عى','ï´”'=>'عي','ï´•'=>'غى','ï´–'=>'غي','ï´—'=>'سى','ï´˜'=>'سي','ï´™'=>'شى','ï´š'=>'شي','ï´›'=>'ØÙ‰','ï´œ'=>'ØÙŠ','ï´'=>'جى','ï´ž'=>'جي','ï´Ÿ'=>'خى','ï´ '=>'خي','ï´¡'=>'صى','ï´¢'=>'صي','ï´£'=>'ضى','ï´¤'=>'ضي','ï´¥'=>'شج','ï´¦'=>'Ø´Ø','ï´§'=>'شخ','ï´¨'=>'شم','ï´©'=>'شر','ï´ª'=>'سر','ï´«'=>'صر','ï´¬'=>'ضر','ï´'=>'شج','ï´®'=>'Ø´Ø','ï´¯'=>'شخ','ï´°'=>'شم','ï´±'=>'سه','ï´²'=>'شه','ï´³'=>'طم','ï´´'=>'سج','ï´µ'=>'سØ','ï´¶'=>'سخ','ï´·'=>'شج','ï´¸'=>'Ø´Ø','ï´¹'=>'شخ','ï´º'=>'طم','ï´»'=>'ظم','ï´¼'=>'اً','ï´½'=>'اً','ïµ'=>'تجم','ﵑ'=>'ØªØØ¬','ïµ’'=>'ØªØØ¬','ﵓ'=>'تØÙ…','ïµ”'=>'تخم','ﵕ'=>'تمج','ïµ–'=>'تمØ','ïµ—'=>'تمخ','ﵘ'=>'جمØ','ïµ™'=>'جمØ','ﵚ'=>'ØÙ…ÙŠ','ïµ›'=>'ØÙ…Ù‰','ﵜ'=>'Ø³ØØ¬','ïµ'=>'سجØ','ﵞ'=>'سجى','ﵟ'=>'سمØ','ïµ '=>'سمØ','ﵡ'=>'سمج','ïµ¢'=>'سمم','ïµ£'=>'سمم','ﵤ'=>'ØµØØ','ïµ¥'=>'ØµØØ','ﵦ'=>'صمم','ïµ§'=>'Ø´ØÙ…','ﵨ'=>'Ø´ØÙ…','ﵩ'=>'شجي','ﵪ'=>'شمخ','ﵫ'=>'شمخ','ﵬ'=>'شمم','ïµ'=>'شمم','ïµ®'=>'ضØÙ‰','ﵯ'=>'ضخم','ïµ°'=>'ضخم','ïµ±'=>'طمØ','ïµ²'=>'طمØ','ïµ³'=>'طمم','ïµ´'=>'طمي','ïµµ'=>'عجم','ïµ¶'=>'عمم','ïµ·'=>'عمم','ﵸ'=>'عمى','ïµ¹'=>'غمم','ﵺ'=>'غمي','ïµ»'=>'غمى','ïµ¼'=>'ÙØ®Ù…','ïµ½'=>'ÙØ®Ù…','ïµ¾'=>'قمØ','ﵿ'=>'قمم','ï¶€'=>'Ù„ØÙ…','ï¶'=>'Ù„ØÙŠ','ï¶‚'=>'Ù„ØÙ‰','ﶃ'=>'لجج','ï¶„'=>'لجج','ï¶…'=>'لخم','ﶆ'=>'لخم','ﶇ'=>'لمØ','ﶈ'=>'لمØ','ﶉ'=>'Ù…ØØ¬','ï¶Š'=>'Ù…ØÙ…','ï¶‹'=>'Ù…ØÙŠ','ï¶Œ'=>'مجØ','ï¶'=>'مجم','ï¶Ž'=>'مخج','ï¶'=>'مخم','ï¶’'=>'مجخ','ï¶“'=>'همج','ï¶”'=>'همم','ï¶•'=>'Ù†ØÙ…','ï¶–'=>'Ù†ØÙ‰','ï¶—'=>'نجم','ﶘ'=>'نجم','ï¶™'=>'نجى','ï¶š'=>'نمي','ï¶›'=>'نمى','ï¶œ'=>'يمم','ï¶'=>'يمم','ï¶ž'=>'بخي','ï¶Ÿ'=>'تجي','ï¶ '=>'تجى','ï¶¡'=>'تخي','ï¶¢'=>'تخى','ï¶£'=>'تمي','ﶤ'=>'تمى','ï¶¥'=>'جمي','ﶦ'=>'جØÙ‰','ï¶§'=>'جمى','ﶨ'=>'سخى','ï¶©'=>'صØÙŠ','ﶪ'=>'Ø´ØÙŠ','ï¶«'=>'ضØÙŠ','ﶬ'=>'لجي','ï¶'=>'لمي','ï¶®'=>'ÙŠØÙŠ','ﶯ'=>'يجي','ï¶°'=>'يمي','ï¶±'=>'ممي','ï¶²'=>'قمي','ï¶³'=>'Ù†ØÙŠ','ï¶´'=>'قمØ','ï¶µ'=>'Ù„ØÙ…','ï¶¶'=>'عمي','ï¶·'=>'كمي','ﶸ'=>'نجØ','ï¶¹'=>'مخي','ﶺ'=>'لجم','ï¶»'=>'كمم','ï¶¼'=>'لجم','ï¶½'=>'نجØ','ï¶¾'=>'جØÙŠ','ï¶¿'=>'ØØ¬ÙŠ','ï·€'=>'مجي','ï·'=>'Ùمي','ï·‚'=>'بØÙŠ','ï·ƒ'=>'كمم','ï·„'=>'عجم','ï·…'=>'صمم','ï·†'=>'سخي','ï·‡'=>'نجي','ï·°'=>'صلے','ï·±'=>'قلے','ï·²'=>'الله','ï·³'=>'اكبر','ï·´'=>'Ù…ØÙ…د','ï·µ'=>'صلعم','ï·¶'=>'رسول','ï··'=>'عليه','ï·¸'=>'وسلم','ï·¹'=>'صلى','ï·º'=>'صلى الله عليه وسلم','ï·»'=>'جل جلاله','ï·¼'=>'ریال','ï¸'=>',','︑'=>'ã€','︒'=>'。','︓'=>':','︔'=>';','︕'=>'!','︖'=>'?','︗'=>'〖','︘'=>'〗','︙'=>'...','︰'=>'..','︱'=>'—','︲'=>'–','︳'=>'_','︴'=>'_','︵'=>'(','︶'=>')','︷'=>'{','︸'=>'}','︹'=>'〔','︺'=>'〕','︻'=>'ã€','︼'=>'】','︽'=>'《','︾'=>'》','︿'=>'〈','ï¹€'=>'〉','ï¹'=>'「','﹂'=>'ã€','﹃'=>'『','﹄'=>'ã€','﹇'=>'[','﹈'=>']','﹉'=>' Ì…','﹊'=>' Ì…','﹋'=>' Ì…','﹌'=>' Ì…','ï¹'=>'_','﹎'=>'_','ï¹'=>'_','ï¹'=>',','﹑'=>'ã€','ï¹’'=>'.','ï¹”'=>';','﹕'=>':','ï¹–'=>'?','ï¹—'=>'!','﹘'=>'—','ï¹™'=>'(','﹚'=>')','ï¹›'=>'{','﹜'=>'}','ï¹'=>'〔','﹞'=>'〕','﹟'=>'#','ï¹ '=>'&','﹡'=>'*','ï¹¢'=>'+','ï¹£'=>'-','﹤'=>'<','ï¹¥'=>'>','﹦'=>'=','﹨'=>'\\','﹩'=>'$','﹪'=>'%','﹫'=>'@','ï¹°'=>' Ù‹','ï¹±'=>'ـً','ï¹²'=>' ÙŒ','ï¹´'=>' Ù','ï¹¶'=>' ÙŽ','ï¹·'=>'Ù€ÙŽ','ﹸ'=>' Ù','ï¹¹'=>'Ù€Ù','ﹺ'=>' Ù','ï¹»'=>'Ù€Ù','ï¹¼'=>' Ù‘','ï¹½'=>'ـّ','ï¹¾'=>' Ù’','ﹿ'=>'ـْ','ﺀ'=>'Ø¡','ïº'=>'آ','ﺂ'=>'آ','ﺃ'=>'أ','ﺄ'=>'أ','ﺅ'=>'ÙˆÙ”','ﺆ'=>'ÙˆÙ”','ﺇ'=>'إ','ﺈ'=>'إ','ﺉ'=>'ÙŠÙ”','ﺊ'=>'ÙŠÙ”','ﺋ'=>'ÙŠÙ”','ﺌ'=>'ÙŠÙ”','ïº'=>'ا','ﺎ'=>'ا','ïº'=>'ب','ïº'=>'ب','ﺑ'=>'ب','ﺒ'=>'ب','ﺓ'=>'Ø©','ﺔ'=>'Ø©','ﺕ'=>'ت','ﺖ'=>'ت','ﺗ'=>'ت','ﺘ'=>'ت','ﺙ'=>'Ø«','ﺚ'=>'Ø«','ﺛ'=>'Ø«','ﺜ'=>'Ø«','ïº'=>'ج','ﺞ'=>'ج','ﺟ'=>'ج','ïº '=>'ج','ﺡ'=>'Ø','ﺢ'=>'Ø','ﺣ'=>'Ø','ﺤ'=>'Ø','ﺥ'=>'Ø®','ﺦ'=>'Ø®','ﺧ'=>'Ø®','ﺨ'=>'Ø®','ﺩ'=>'د','ﺪ'=>'د','ﺫ'=>'ذ','ﺬ'=>'ذ','ïº'=>'ر','ﺮ'=>'ر','ﺯ'=>'ز','ﺰ'=>'ز','ﺱ'=>'س','ﺲ'=>'س','ﺳ'=>'س','ﺴ'=>'س','ﺵ'=>'Ø´','ﺶ'=>'Ø´','ﺷ'=>'Ø´','ﺸ'=>'Ø´','ﺹ'=>'ص','ﺺ'=>'ص','ﺻ'=>'ص','ﺼ'=>'ص','ﺽ'=>'ض','ﺾ'=>'ض','ﺿ'=>'ض','ﻀ'=>'ض','ï»'=>'Ø·','ﻂ'=>'Ø·','ﻃ'=>'Ø·','ﻄ'=>'Ø·','ï»…'=>'ظ','ﻆ'=>'ظ','ﻇ'=>'ظ','ﻈ'=>'ظ','ﻉ'=>'ع','ﻊ'=>'ع','ﻋ'=>'ع','ﻌ'=>'ع','ï»'=>'غ','ﻎ'=>'غ','ï»'=>'غ','ï»'=>'غ','ﻑ'=>'Ù','ï»’'=>'Ù','ﻓ'=>'Ù','ï»”'=>'Ù','ﻕ'=>'Ù‚','ï»–'=>'Ù‚','ï»—'=>'Ù‚','ﻘ'=>'Ù‚','ï»™'=>'Ùƒ','ﻚ'=>'Ùƒ','ï»›'=>'Ùƒ','ﻜ'=>'Ùƒ','ï»'=>'Ù„','ﻞ'=>'Ù„','ﻟ'=>'Ù„','ï» '=>'Ù„','ﻡ'=>'Ù…','ﻢ'=>'Ù…','ﻣ'=>'Ù…','ﻤ'=>'Ù…','ﻥ'=>'Ù†','ﻦ'=>'Ù†','ï»§'=>'Ù†','ﻨ'=>'Ù†','ﻩ'=>'Ù‡','ﻪ'=>'Ù‡','ﻫ'=>'Ù‡','ﻬ'=>'Ù‡','ï»'=>'Ùˆ','ï»®'=>'Ùˆ','ﻯ'=>'Ù‰','ï»°'=>'Ù‰','ï»±'=>'ÙŠ','ﻲ'=>'ÙŠ','ﻳ'=>'ÙŠ','ï»´'=>'ÙŠ','ﻵ'=>'لآ','ï»¶'=>'لآ','ï»·'=>'لأ','ﻸ'=>'لأ','ﻹ'=>'لإ','ﻺ'=>'لإ','ï»»'=>'لا','ﻼ'=>'لا','ï¼'=>'!','"'=>'"','#'=>'#','$'=>'$','ï¼…'=>'%','&'=>'&','''=>'\'','('=>'(',')'=>')','*'=>'*','+'=>'+',','=>',','ï¼'=>'-','.'=>'.','ï¼'=>'/','ï¼'=>'0','1'=>'1','ï¼’'=>'2','3'=>'3','ï¼”'=>'4','5'=>'5','ï¼–'=>'6','ï¼—'=>'7','8'=>'8','ï¼™'=>'9',':'=>':','ï¼›'=>';','<'=>'<','ï¼'=>'=','>'=>'>','?'=>'?','ï¼ '=>'@','A'=>'A','ï¼¢'=>'B','ï¼£'=>'C','D'=>'D','ï¼¥'=>'E','F'=>'F','ï¼§'=>'G','H'=>'H','I'=>'I','J'=>'J','K'=>'K','L'=>'L','ï¼'=>'M','ï¼®'=>'N','O'=>'O','ï¼°'=>'P','ï¼±'=>'Q','ï¼²'=>'R','ï¼³'=>'S','ï¼´'=>'T','ï¼µ'=>'U','ï¼¶'=>'V','ï¼·'=>'W','X'=>'X','ï¼¹'=>'Y','Z'=>'Z','ï¼»'=>'[','ï¼¼'=>'\\','ï¼½'=>']','ï¼¾'=>'^','_'=>'_','ï½€'=>'`','ï½'=>'a','b'=>'b','c'=>'c','d'=>'d','ï½…'=>'e','f'=>'f','g'=>'g','h'=>'h','i'=>'i','j'=>'j','k'=>'k','l'=>'l','ï½'=>'m','n'=>'n','ï½'=>'o','ï½'=>'p','q'=>'q','ï½’'=>'r','s'=>'s','ï½”'=>'t','u'=>'u','ï½–'=>'v','ï½—'=>'w','x'=>'x','ï½™'=>'y','z'=>'z','ï½›'=>'{','|'=>'|','ï½'=>'}','~'=>'~','⦅'=>'⦅','ï½ '=>'⦆','。'=>'。','ï½¢'=>'「','ï½£'=>'ã€','、'=>'ã€','ï½¥'=>'・','ヲ'=>'ヲ','ï½§'=>'ã‚¡','ィ'=>'ã‚£','ゥ'=>'ã‚¥','ェ'=>'ã‚§','ォ'=>'ã‚©','ャ'=>'ャ','ï½'=>'ュ','ï½®'=>'ョ','ッ'=>'ッ','ï½°'=>'ー','ï½±'=>'ã‚¢','ï½²'=>'イ','ï½³'=>'ウ','ï½´'=>'エ','ï½µ'=>'オ','ï½¶'=>'ã‚«','ï½·'=>'ã‚','ク'=>'ク','ï½¹'=>'ケ','コ'=>'コ','ï½»'=>'サ','ï½¼'=>'ã‚·','ï½½'=>'ス','ï½¾'=>'ã‚»','ソ'=>'ソ','ï¾€'=>'ã‚¿','ï¾'=>'ãƒ','ツ'=>'ツ','テ'=>'テ','ト'=>'ト','ï¾…'=>'ナ','ニ'=>'ニ','ヌ'=>'ヌ','ネ'=>'ãƒ','ノ'=>'ノ','ハ'=>'ãƒ','ヒ'=>'ヒ','フ'=>'フ','ï¾'=>'ヘ','ホ'=>'ホ','ï¾'=>'マ','ï¾'=>'ミ','ム'=>'ム','ï¾’'=>'メ','モ'=>'モ','ï¾”'=>'ヤ','ユ'=>'ユ','ï¾–'=>'ヨ','ï¾—'=>'ラ','リ'=>'リ','ï¾™'=>'ル','レ'=>'レ','ï¾›'=>'ãƒ','ワ'=>'ワ','ï¾'=>'ン','゙'=>'ã‚™','゚'=>'゚','ï¾ '=>'á… ','ᄀ'=>'á„€','ï¾¢'=>'á„','ï¾£'=>'ᆪ','ᄂ'=>'á„‚','ï¾¥'=>'ᆬ','ᆭ'=>'á†','ï¾§'=>'ᄃ','ᄄ'=>'á„„','ᄅ'=>'á„…','ᆰ'=>'ᆰ','ᆱ'=>'ᆱ','ᆲ'=>'ᆲ','ï¾'=>'ᆳ','ï¾®'=>'ᆴ','ᆵ'=>'ᆵ','ï¾°'=>'ᄚ','ï¾±'=>'ᄆ','ï¾²'=>'ᄇ','ï¾³'=>'ᄈ','ï¾´'=>'á„¡','ï¾µ'=>'ᄉ','ï¾¶'=>'ᄊ','ï¾·'=>'á„‹','ᄌ'=>'ᄌ','ï¾¹'=>'á„','ᄎ'=>'ᄎ','ï¾»'=>'á„','ï¾¼'=>'á„','ï¾½'=>'á„‘','ï¾¾'=>'á„’','ï¿‚'=>'á…¡','ᅢ'=>'á…¢','ï¿„'=>'á…£','ï¿…'=>'á…¤','ᅥ'=>'á…¥','ᅦ'=>'á…¦','ᅧ'=>'á…§','ï¿‹'=>'á…¨','ᅩ'=>'á…©','ï¿'=>'á…ª','ᅫ'=>'á…«','ï¿'=>'á…¬','ï¿’'=>'á…','ï¿“'=>'á…®','ï¿”'=>'á…¯','ï¿•'=>'á…°','ï¿–'=>'á…±','ï¿—'=>'á…²','ᅳ'=>'á…³','ï¿›'=>'á…´','ᅵ'=>'á…µ','ï¿ '=>'¢','ï¿¡'=>'£','ï¿¢'=>'¬','ï¿£'=>' Ì„','¦'=>'¦','ï¿¥'=>'Â¥','₩'=>'â‚©','│'=>'│','ï¿©'=>'â†','↑'=>'↑','ï¿«'=>'→','↓'=>'↓','ï¿'=>'â– ','ï¿®'=>'â—‹','ð…ž'=>'ð…—ð…¥','ð…Ÿ'=>'ð…˜ð…¥','ð… '=>'ð…˜ð…¥ð…®','ð…¡'=>'ð…˜ð…¥ð…¯','ð…¢'=>'ð…˜ð…¥ð…°','ð…£'=>'ð…˜ð…¥ð…±','ð…¤'=>'ð…˜ð…¥ð…²','ð†»'=>'ð†¹ð…¥','ð†¼'=>'ð†ºð…¥','ð†½'=>'ð†¹ð…¥ð…®','ð†¾'=>'ð†ºð…¥ð…®','ð†¿'=>'ð†¹ð…¥ð…¯','ð‡€'=>'ð†ºð…¥ð…¯','ð€'=>'A','ð'=>'B','ð‚'=>'C','ðƒ'=>'D','ð„'=>'E','ð…'=>'F','ð†'=>'G','ð‡'=>'H','ðˆ'=>'I','ð‰'=>'J','ðŠ'=>'K','ð‹'=>'L','ðŒ'=>'M','ð'=>'N','ðŽ'=>'O','ð'=>'P','ð'=>'Q','ð‘'=>'R','ð’'=>'S','ð“'=>'T','ð”'=>'U','ð•'=>'V','ð–'=>'W','ð—'=>'X','ð˜'=>'Y','ð™'=>'Z','ðš'=>'a','ð›'=>'b','ðœ'=>'c','ð'=>'d','ðž'=>'e','ðŸ'=>'f','ð '=>'g','ð¡'=>'h','ð¢'=>'i','ð£'=>'j','ð¤'=>'k','ð¥'=>'l','ð¦'=>'m','ð§'=>'n','ð¨'=>'o','ð©'=>'p','ðª'=>'q','ð«'=>'r','ð¬'=>'s','ð'=>'t','ð®'=>'u','ð¯'=>'v','ð°'=>'w','ð±'=>'x','ð²'=>'y','ð³'=>'z','ð´'=>'A','ðµ'=>'B','ð¶'=>'C','ð·'=>'D','ð¸'=>'E','ð¹'=>'F','ðº'=>'G','ð»'=>'H','ð¼'=>'I','ð½'=>'J','ð¾'=>'K','ð¿'=>'L','ð‘€'=>'M','ð‘'=>'N','ð‘‚'=>'O','ð‘ƒ'=>'P','ð‘„'=>'Q','ð‘…'=>'R','ð‘†'=>'S','ð‘‡'=>'T','ð‘ˆ'=>'U','ð‘‰'=>'V','ð‘Š'=>'W','ð‘‹'=>'X','ð‘Œ'=>'Y','ð‘'=>'Z','ð‘Ž'=>'a','ð‘'=>'b','ð‘'=>'c','ð‘‘'=>'d','ð‘’'=>'e','ð‘“'=>'f','ð‘”'=>'g','ð‘–'=>'i','ð‘—'=>'j','ð‘˜'=>'k','ð‘™'=>'l','ð‘š'=>'m','ð‘›'=>'n','ð‘œ'=>'o','ð‘'=>'p','ð‘ž'=>'q','ð‘Ÿ'=>'r','ð‘ '=>'s','ð‘¡'=>'t','ð‘¢'=>'u','ð‘£'=>'v','ð‘¤'=>'w','ð‘¥'=>'x','ð‘¦'=>'y','ð‘§'=>'z','ð‘¨'=>'A','ð‘©'=>'B','ð‘ª'=>'C','ð‘«'=>'D','ð‘¬'=>'E','ð‘'=>'F','ð‘®'=>'G','ð‘¯'=>'H','ð‘°'=>'I','ð‘±'=>'J','ð‘²'=>'K','ð‘³'=>'L','ð‘´'=>'M','ð‘µ'=>'N','ð‘¶'=>'O','ð‘·'=>'P','ð‘¸'=>'Q','ð‘¹'=>'R','ð‘º'=>'S','ð‘»'=>'T','ð‘¼'=>'U','ð‘½'=>'V','ð‘¾'=>'W','ð‘¿'=>'X','ð’€'=>'Y','ð’'=>'Z','ð’‚'=>'a','ð’ƒ'=>'b','ð’„'=>'c','ð’…'=>'d','ð’†'=>'e','ð’‡'=>'f','ð’ˆ'=>'g','ð’‰'=>'h','ð’Š'=>'i','ð’‹'=>'j','ð’Œ'=>'k','ð’'=>'l','ð’Ž'=>'m','ð’'=>'n','ð’'=>'o','ð’‘'=>'p','ð’’'=>'q','ð’“'=>'r','ð’”'=>'s','ð’•'=>'t','ð’–'=>'u','ð’—'=>'v','ð’˜'=>'w','ð’™'=>'x','ð’š'=>'y','ð’›'=>'z','ð’œ'=>'A','ð’ž'=>'C','ð’Ÿ'=>'D','ð’¢'=>'G','ð’¥'=>'J','ð’¦'=>'K','ð’©'=>'N','ð’ª'=>'O','ð’«'=>'P','ð’¬'=>'Q','ð’®'=>'S','ð’¯'=>'T','ð’°'=>'U','ð’±'=>'V','ð’²'=>'W','ð’³'=>'X','ð’´'=>'Y','ð’µ'=>'Z','ð’¶'=>'a','ð’·'=>'b','ð’¸'=>'c','ð’¹'=>'d','ð’»'=>'f','ð’½'=>'h','ð’¾'=>'i','ð’¿'=>'j','ð“€'=>'k','ð“'=>'l','ð“‚'=>'m','ð“ƒ'=>'n','ð“…'=>'p','ð“†'=>'q','ð“‡'=>'r','ð“ˆ'=>'s','ð“‰'=>'t','ð“Š'=>'u','ð“‹'=>'v','ð“Œ'=>'w','ð“'=>'x','ð“Ž'=>'y','ð“'=>'z','ð“'=>'A','ð“‘'=>'B','ð“’'=>'C','ð““'=>'D','ð“”'=>'E','ð“•'=>'F','ð“–'=>'G','ð“—'=>'H','ð“˜'=>'I','ð“™'=>'J','ð“š'=>'K','ð“›'=>'L','ð“œ'=>'M','ð“'=>'N','ð“ž'=>'O','ð“Ÿ'=>'P','ð“ '=>'Q','ð“¡'=>'R','ð“¢'=>'S','ð“£'=>'T','ð“¤'=>'U','ð“¥'=>'V','ð“¦'=>'W','ð“§'=>'X','ð“¨'=>'Y','ð“©'=>'Z','ð“ª'=>'a','ð“«'=>'b','ð“¬'=>'c','ð“'=>'d','ð“®'=>'e','ð“¯'=>'f','ð“°'=>'g','ð“±'=>'h','ð“²'=>'i','ð“³'=>'j','ð“´'=>'k','ð“µ'=>'l','ð“¶'=>'m','ð“·'=>'n','ð“¸'=>'o','ð“¹'=>'p','ð“º'=>'q','ð“»'=>'r','ð“¼'=>'s','ð“½'=>'t','ð“¾'=>'u','ð“¿'=>'v','ð”€'=>'w','ð”'=>'x','ð”‚'=>'y','ð”ƒ'=>'z','ð”„'=>'A','ð”…'=>'B','ð”‡'=>'D','ð”ˆ'=>'E','ð”‰'=>'F','ð”Š'=>'G','ð”'=>'J','ð”Ž'=>'K','ð”'=>'L','ð”'=>'M','ð”‘'=>'N','ð”’'=>'O','ð”“'=>'P','ð””'=>'Q','ð”–'=>'S','ð”—'=>'T','ð”˜'=>'U','ð”™'=>'V','ð”š'=>'W','ð”›'=>'X','ð”œ'=>'Y','ð”ž'=>'a','ð”Ÿ'=>'b','ð” '=>'c','ð”¡'=>'d','ð”¢'=>'e','ð”£'=>'f','ð”¤'=>'g','ð”¥'=>'h','ð”¦'=>'i','ð”§'=>'j','ð”¨'=>'k','ð”©'=>'l','ð”ª'=>'m','ð”«'=>'n','ð”¬'=>'o','ð”'=>'p','ð”®'=>'q','ð”¯'=>'r','ð”°'=>'s','ð”±'=>'t','ð”²'=>'u','ð”³'=>'v','ð”´'=>'w','ð”µ'=>'x','ð”¶'=>'y','ð”·'=>'z','ð”¸'=>'A','ð”¹'=>'B','ð”»'=>'D','ð”¼'=>'E','ð”½'=>'F','ð”¾'=>'G','ð•€'=>'I','ð•'=>'J','ð•‚'=>'K','ð•ƒ'=>'L','ð•„'=>'M','ð•†'=>'O','ð•Š'=>'S','ð•‹'=>'T','ð•Œ'=>'U','ð•'=>'V','ð•Ž'=>'W','ð•'=>'X','ð•'=>'Y','ð•’'=>'a','ð•“'=>'b','ð•”'=>'c','ð••'=>'d','ð•–'=>'e','ð•—'=>'f','ð•˜'=>'g','ð•™'=>'h','ð•š'=>'i','ð•›'=>'j','ð•œ'=>'k','ð•'=>'l','ð•ž'=>'m','ð•Ÿ'=>'n','ð• '=>'o','ð•¡'=>'p','ð•¢'=>'q','ð•£'=>'r','ð•¤'=>'s','ð•¥'=>'t','ð•¦'=>'u','ð•§'=>'v','ð•¨'=>'w','ð•©'=>'x','ð•ª'=>'y','ð•«'=>'z','ð•¬'=>'A','ð•'=>'B','ð•®'=>'C','ð•¯'=>'D','ð•°'=>'E','ð•±'=>'F','ð•²'=>'G','ð•³'=>'H','ð•´'=>'I','ð•µ'=>'J','ð•¶'=>'K','ð•·'=>'L','ð•¸'=>'M','ð•¹'=>'N','ð•º'=>'O','ð•»'=>'P','ð•¼'=>'Q','ð•½'=>'R','ð•¾'=>'S','ð•¿'=>'T','ð–€'=>'U','ð–'=>'V','ð–‚'=>'W','ð–ƒ'=>'X','ð–„'=>'Y','ð–…'=>'Z','ð–†'=>'a','ð–‡'=>'b','ð–ˆ'=>'c','ð–‰'=>'d','ð–Š'=>'e','ð–‹'=>'f','ð–Œ'=>'g','ð–'=>'h','ð–Ž'=>'i','ð–'=>'j','ð–'=>'k','ð–‘'=>'l','ð–’'=>'m','ð–“'=>'n','ð–”'=>'o','ð–•'=>'p','ð––'=>'q','ð–—'=>'r','ð–˜'=>'s','ð–™'=>'t','ð–š'=>'u','ð–›'=>'v','ð–œ'=>'w','ð–'=>'x','ð–ž'=>'y','ð–Ÿ'=>'z','ð– '=>'A','ð–¡'=>'B','ð–¢'=>'C','ð–£'=>'D','ð–¤'=>'E','ð–¥'=>'F','ð–¦'=>'G','ð–§'=>'H','ð–¨'=>'I','ð–©'=>'J','ð–ª'=>'K','ð–«'=>'L','ð–¬'=>'M','ð–'=>'N','ð–®'=>'O','ð–¯'=>'P','ð–°'=>'Q','ð–±'=>'R','ð–²'=>'S','ð–³'=>'T','ð–´'=>'U','ð–µ'=>'V','ð–¶'=>'W','ð–·'=>'X','ð–¸'=>'Y','ð–¹'=>'Z','ð–º'=>'a','ð–»'=>'b','ð–¼'=>'c','ð–½'=>'d','ð–¾'=>'e','ð–¿'=>'f','ð—€'=>'g','ð—'=>'h','ð—‚'=>'i','ð—ƒ'=>'j','ð—„'=>'k','ð—…'=>'l','ð—†'=>'m','ð—‡'=>'n','ð—ˆ'=>'o','ð—‰'=>'p','ð—Š'=>'q','ð—‹'=>'r','ð—Œ'=>'s','ð—'=>'t','ð—Ž'=>'u','ð—'=>'v','ð—'=>'w','ð—‘'=>'x','ð—’'=>'y','ð—“'=>'z','ð—”'=>'A','ð—•'=>'B','ð—–'=>'C','ð——'=>'D','ð—˜'=>'E','ð—™'=>'F','ð—š'=>'G','ð—›'=>'H','ð—œ'=>'I','ð—'=>'J','ð—ž'=>'K','ð—Ÿ'=>'L','ð— '=>'M','ð—¡'=>'N','ð—¢'=>'O','ð—£'=>'P','ð—¤'=>'Q','ð—¥'=>'R','ð—¦'=>'S','ð—§'=>'T','ð—¨'=>'U','ð—©'=>'V','ð—ª'=>'W','ð—«'=>'X','ð—¬'=>'Y','ð—'=>'Z','ð—®'=>'a','ð—¯'=>'b','ð—°'=>'c','ð—±'=>'d','ð—²'=>'e','ð—³'=>'f','ð—´'=>'g','ð—µ'=>'h','ð—¶'=>'i','ð—·'=>'j','ð—¸'=>'k','ð—¹'=>'l','ð—º'=>'m','ð—»'=>'n','ð—¼'=>'o','ð—½'=>'p','ð—¾'=>'q','ð—¿'=>'r','ð˜€'=>'s','ð˜'=>'t','ð˜‚'=>'u','ð˜ƒ'=>'v','ð˜„'=>'w','ð˜…'=>'x','ð˜†'=>'y','ð˜‡'=>'z','ð˜ˆ'=>'A','ð˜‰'=>'B','ð˜Š'=>'C','ð˜‹'=>'D','ð˜Œ'=>'E','ð˜'=>'F','ð˜Ž'=>'G','ð˜'=>'H','ð˜'=>'I','ð˜‘'=>'J','ð˜’'=>'K','ð˜“'=>'L','ð˜”'=>'M','ð˜•'=>'N','ð˜–'=>'O','ð˜—'=>'P','ð˜˜'=>'Q','ð˜™'=>'R','ð˜š'=>'S','ð˜›'=>'T','ð˜œ'=>'U','ð˜'=>'V','ð˜ž'=>'W','ð˜Ÿ'=>'X','ð˜ '=>'Y','ð˜¡'=>'Z','ð˜¢'=>'a','ð˜£'=>'b','ð˜¤'=>'c','ð˜¥'=>'d','ð˜¦'=>'e','ð˜§'=>'f','ð˜¨'=>'g','ð˜©'=>'h','ð˜ª'=>'i','ð˜«'=>'j','ð˜¬'=>'k','ð˜'=>'l','ð˜®'=>'m','ð˜¯'=>'n','ð˜°'=>'o','ð˜±'=>'p','ð˜²'=>'q','ð˜³'=>'r','ð˜´'=>'s','ð˜µ'=>'t','ð˜¶'=>'u','ð˜·'=>'v','ð˜¸'=>'w','ð˜¹'=>'x','ð˜º'=>'y','ð˜»'=>'z','ð˜¼'=>'A','ð˜½'=>'B','ð˜¾'=>'C','ð˜¿'=>'D','ð™€'=>'E','ð™'=>'F','ð™‚'=>'G','ð™ƒ'=>'H','ð™„'=>'I','ð™…'=>'J','ð™†'=>'K','ð™‡'=>'L','ð™ˆ'=>'M','ð™‰'=>'N','ð™Š'=>'O','ð™‹'=>'P','ð™Œ'=>'Q','ð™'=>'R','ð™Ž'=>'S','ð™'=>'T','ð™'=>'U','ð™‘'=>'V','ð™’'=>'W','ð™“'=>'X','ð™”'=>'Y','ð™•'=>'Z','ð™–'=>'a','ð™—'=>'b','ð™˜'=>'c','ð™™'=>'d','ð™š'=>'e','ð™›'=>'f','ð™œ'=>'g','ð™'=>'h','ð™ž'=>'i','ð™Ÿ'=>'j','ð™ '=>'k','ð™¡'=>'l','ð™¢'=>'m','ð™£'=>'n','ð™¤'=>'o','ð™¥'=>'p','ð™¦'=>'q','ð™§'=>'r','ð™¨'=>'s','ð™©'=>'t','ð™ª'=>'u','ð™«'=>'v','ð™¬'=>'w','ð™'=>'x','ð™®'=>'y','ð™¯'=>'z','ð™°'=>'A','ð™±'=>'B','ð™²'=>'C','ð™³'=>'D','ð™´'=>'E','ð™µ'=>'F','ð™¶'=>'G','ð™·'=>'H','ð™¸'=>'I','ð™¹'=>'J','ð™º'=>'K','ð™»'=>'L','ð™¼'=>'M','ð™½'=>'N','ð™¾'=>'O','ð™¿'=>'P','ðš€'=>'Q','ðš'=>'R','ðš‚'=>'S','ðšƒ'=>'T','ðš„'=>'U','ðš…'=>'V','ðš†'=>'W','ðš‡'=>'X','ðšˆ'=>'Y','ðš‰'=>'Z','ðšŠ'=>'a','ðš‹'=>'b','ðšŒ'=>'c','ðš'=>'d','ðšŽ'=>'e','ðš'=>'f','ðš'=>'g','ðš‘'=>'h','ðš’'=>'i','ðš“'=>'j','ðš”'=>'k','ðš•'=>'l','ðš–'=>'m','ðš—'=>'n','ðš˜'=>'o','ðš™'=>'p','ðšš'=>'q','ðš›'=>'r','ðšœ'=>'s','ðš'=>'t','ðšž'=>'u','ðšŸ'=>'v','ðš '=>'w','ðš¡'=>'x','ðš¢'=>'y','ðš£'=>'z','ðš¤'=>'ı','ðš¥'=>'È·','ðš¨'=>'Α','ðš©'=>'Î’','ðšª'=>'Γ','ðš«'=>'Δ','ðš¬'=>'Ε','ðš'=>'Ζ','ðš®'=>'Η','ðš¯'=>'Θ','ðš°'=>'Ι','ðš±'=>'Κ','ðš²'=>'Λ','ðš³'=>'Μ','ðš´'=>'Î','ðšµ'=>'Ξ','ðš¶'=>'Ο','ðš·'=>'Î ','ðš¸'=>'Ρ','ðš¹'=>'Θ','ðšº'=>'Σ','ðš»'=>'Τ','ðš¼'=>'Î¥','ðš½'=>'Φ','ðš¾'=>'Χ','ðš¿'=>'Ψ','ð›€'=>'Ω','ð›'=>'∇','ð›‚'=>'α','ð›ƒ'=>'β','ð›„'=>'γ','ð›…'=>'δ','ð›†'=>'ε','ð›‡'=>'ζ','ð›ˆ'=>'η','ð›‰'=>'θ','ð›Š'=>'ι','ð›‹'=>'κ','ð›Œ'=>'λ','ð›'=>'μ','ð›Ž'=>'ν','ð›'=>'ξ','ð›'=>'ο','ð›‘'=>'Ï€','ð›’'=>'Ï','ð›“'=>'Ï‚','ð›”'=>'σ','ð›•'=>'Ï„','ð›–'=>'Ï…','ð›—'=>'φ','ð›˜'=>'χ','ð›™'=>'ψ','ð›š'=>'ω','ð››'=>'∂','ð›œ'=>'ε','ð›'=>'θ','ð›ž'=>'κ','ð›Ÿ'=>'φ','ð› '=>'Ï','ð›¡'=>'Ï€','ð›¢'=>'Α','ð›£'=>'Î’','ð›¤'=>'Γ','ð›¥'=>'Δ','ð›¦'=>'Ε','ð›§'=>'Ζ','ð›¨'=>'Η','ð›©'=>'Θ','ð›ª'=>'Ι','ð›«'=>'Κ','ð›¬'=>'Λ','ð›'=>'Μ','ð›®'=>'Î','ð›¯'=>'Ξ','ð›°'=>'Ο','ð›±'=>'Î ','ð›²'=>'Ρ','ð›³'=>'Θ','ð›´'=>'Σ','ð›µ'=>'Τ','ð›¶'=>'Î¥','ð›·'=>'Φ','ð›¸'=>'Χ','ð›¹'=>'Ψ','ð›º'=>'Ω','ð›»'=>'∇','ð›¼'=>'α','ð›½'=>'β','ð›¾'=>'γ','ð›¿'=>'δ','ðœ€'=>'ε','ðœ'=>'ζ','ðœ‚'=>'η','ðœƒ'=>'θ','ðœ„'=>'ι','ðœ…'=>'κ','ðœ†'=>'λ','ðœ‡'=>'μ','ðœˆ'=>'ν','ðœ‰'=>'ξ','ðœŠ'=>'ο','ðœ‹'=>'Ï€','ðœŒ'=>'Ï','ðœ'=>'Ï‚','ðœŽ'=>'σ','ðœ'=>'Ï„','ðœ'=>'Ï…','ðœ‘'=>'φ','ðœ’'=>'χ','ðœ“'=>'ψ','ðœ”'=>'ω','ðœ•'=>'∂','ðœ–'=>'ε','ðœ—'=>'θ','ðœ˜'=>'κ','ðœ™'=>'φ','ðœš'=>'Ï','ðœ›'=>'Ï€','ðœœ'=>'Α','ðœ'=>'Î’','ðœž'=>'Γ','ðœŸ'=>'Δ','ðœ '=>'Ε','ðœ¡'=>'Ζ','ðœ¢'=>'Η','ðœ£'=>'Θ','ðœ¤'=>'Ι','ðœ¥'=>'Κ','ðœ¦'=>'Λ','ðœ§'=>'Μ','ðœ¨'=>'Î','ðœ©'=>'Ξ','ðœª'=>'Ο','ðœ«'=>'Î ','ðœ¬'=>'Ρ','ðœ'=>'Θ','ðœ®'=>'Σ','ðœ¯'=>'Τ','ðœ°'=>'Î¥','ðœ±'=>'Φ','ðœ²'=>'Χ','ðœ³'=>'Ψ','ðœ´'=>'Ω','ðœµ'=>'∇','ðœ¶'=>'α','ðœ·'=>'β','ðœ¸'=>'γ','ðœ¹'=>'δ','ðœº'=>'ε','ðœ»'=>'ζ','ðœ¼'=>'η','ðœ½'=>'θ','ðœ¾'=>'ι','ðœ¿'=>'κ','ð€'=>'λ','ð'=>'μ','ð‚'=>'ν','ðƒ'=>'ξ','ð„'=>'ο','ð…'=>'Ï€','ð†'=>'Ï','ð‡'=>'Ï‚','ðˆ'=>'σ','ð‰'=>'Ï„','ðŠ'=>'Ï…','ð‹'=>'φ','ðŒ'=>'χ','ð'=>'ψ','ðŽ'=>'ω','ð'=>'∂','ð'=>'ε','ð‘'=>'θ','ð’'=>'κ','ð“'=>'φ','ð”'=>'Ï','ð•'=>'Ï€','ð–'=>'Α','ð—'=>'Î’','ð˜'=>'Γ','ð™'=>'Δ','ðš'=>'Ε','ð›'=>'Ζ','ðœ'=>'Η','ð'=>'Θ','ðž'=>'Ι','ðŸ'=>'Κ','ð '=>'Λ','ð¡'=>'Μ','ð¢'=>'Î','ð£'=>'Ξ','ð¤'=>'Ο','ð¥'=>'Î ','ð¦'=>'Ρ','ð§'=>'Θ','ð¨'=>'Σ','ð©'=>'Τ','ðª'=>'Î¥','ð«'=>'Φ','ð¬'=>'Χ','ð'=>'Ψ','ð®'=>'Ω','ð¯'=>'∇','ð°'=>'α','ð±'=>'β','ð²'=>'γ','ð³'=>'δ','ð´'=>'ε','ðµ'=>'ζ','ð¶'=>'η','ð·'=>'θ','ð¸'=>'ι','ð¹'=>'κ','ðº'=>'λ','ð»'=>'μ','ð¼'=>'ν','ð½'=>'ξ','ð¾'=>'ο','ð¿'=>'Ï€','ðž€'=>'Ï','ðž'=>'Ï‚','ðž‚'=>'σ','ðžƒ'=>'Ï„','ðž„'=>'Ï…','ðž…'=>'φ','ðž†'=>'χ','ðž‡'=>'ψ','ðžˆ'=>'ω','ðž‰'=>'∂','ðžŠ'=>'ε','ðž‹'=>'θ','ðžŒ'=>'κ','ðž'=>'φ','ðžŽ'=>'Ï','ðž'=>'Ï€','ðž'=>'Α','ðž‘'=>'Î’','ðž’'=>'Γ','ðž“'=>'Δ','ðž”'=>'Ε','ðž•'=>'Ζ','ðž–'=>'Η','ðž—'=>'Θ','ðž˜'=>'Ι','ðž™'=>'Κ','ðžš'=>'Λ','ðž›'=>'Μ','ðžœ'=>'Î','ðž'=>'Ξ','ðžž'=>'Ο','ðžŸ'=>'Î ','ðž '=>'Ρ','ðž¡'=>'Θ','ðž¢'=>'Σ','ðž£'=>'Τ','ðž¤'=>'Î¥','ðž¥'=>'Φ','ðž¦'=>'Χ','ðž§'=>'Ψ','ðž¨'=>'Ω','ðž©'=>'∇','ðžª'=>'α','ðž«'=>'β','ðž¬'=>'γ','ðž'=>'δ','ðž®'=>'ε','ðž¯'=>'ζ','ðž°'=>'η','ðž±'=>'θ','ðž²'=>'ι','ðž³'=>'κ','ðž´'=>'λ','ðžµ'=>'μ','ðž¶'=>'ν','ðž·'=>'ξ','ðž¸'=>'ο','ðž¹'=>'Ï€','ðžº'=>'Ï','ðž»'=>'Ï‚','ðž¼'=>'σ','ðž½'=>'Ï„','ðž¾'=>'Ï…','ðž¿'=>'φ','ðŸ€'=>'χ','ðŸ'=>'ψ','ðŸ‚'=>'ω','ðŸƒ'=>'∂','ðŸ„'=>'ε','ðŸ…'=>'θ','ðŸ†'=>'κ','ðŸ‡'=>'φ','ðŸˆ'=>'Ï','ðŸ‰'=>'Ï€','ðŸŠ'=>'Ïœ','ðŸ‹'=>'Ï','ðŸŽ'=>'0','ðŸ'=>'1','ðŸ'=>'2','ðŸ‘'=>'3','ðŸ’'=>'4','ðŸ“'=>'5','ðŸ”'=>'6','ðŸ•'=>'7','ðŸ–'=>'8','ðŸ—'=>'9','ðŸ˜'=>'0','ðŸ™'=>'1','ðŸš'=>'2','ðŸ›'=>'3','ðŸœ'=>'4','ðŸ'=>'5','ðŸž'=>'6','ðŸŸ'=>'7','ðŸ '=>'8','ðŸ¡'=>'9','ðŸ¢'=>'0','ðŸ£'=>'1','ðŸ¤'=>'2','ðŸ¥'=>'3','ðŸ¦'=>'4','ðŸ§'=>'5','ðŸ¨'=>'6','ðŸ©'=>'7','ðŸª'=>'8','ðŸ«'=>'9','ðŸ¬'=>'0','ðŸ'=>'1','ðŸ®'=>'2','ðŸ¯'=>'3','ðŸ°'=>'4','ðŸ±'=>'5','ðŸ²'=>'6','ðŸ³'=>'7','ðŸ´'=>'8','ðŸµ'=>'9','ðŸ¶'=>'0','ðŸ·'=>'1','ðŸ¸'=>'2','ðŸ¹'=>'3','ðŸº'=>'4','ðŸ»'=>'5','ðŸ¼'=>'6','ðŸ½'=>'7','ðŸ¾'=>'8','ðŸ¿'=>'9','丽'=>'丽','ð¯ '=>'丸','乁'=>'ä¹','𠄢'=>'ð „¢','你'=>'ä½ ','侮'=>'ä¾®','侻'=>'ä¾»','倂'=>'倂','偺'=>'åº','備'=>'å‚™','僧'=>'僧','像'=>'åƒ','㒞'=>'ã’ž','ð¯ '=>'𠘺','免'=>'å…','ð¯ '=>'å…”','ð¯ '=>'å…¤','具'=>'å…·','𠔜'=>'𠔜','㒹'=>'ã’¹','內'=>'å…§','再'=>'å†','𠕋'=>'ð •‹','冗'=>'冗','冤'=>'冤','仌'=>'仌','冬'=>'冬','况'=>'况','𩇟'=>'𩇟','ð¯ '=>'凵','刃'=>'刃','㓟'=>'㓟','ð¯ '=>'刻','剆'=>'剆','割'=>'割','剷'=>'剷','㔕'=>'㔕','勇'=>'勇','勉'=>'勉','勤'=>'勤','勺'=>'勺','包'=>'包','匆'=>'匆','北'=>'北','卉'=>'å‰','ð¯ '=>'å‘','博'=>'åš','即'=>'å³','卽'=>'å½','卿'=>'å¿','卿'=>'å¿','卿'=>'å¿','𠨬'=>'𠨬','灰'=>'ç°','及'=>'åŠ','叟'=>'åŸ','𠭣'=>'ð £','叫'=>'å«','叱'=>'å±','吆'=>'å†','咞'=>'å’ž','吸'=>'å¸','呈'=>'呈','周'=>'周','咢'=>'å’¢','ð¯¡'=>'å“¶','唐'=>'å”','啓'=>'å•“','啣'=>'å•£','善'=>'å–„','善'=>'å–„','喙'=>'å–™','喫'=>'å–«','喳'=>'å–³','嗂'=>'å—‚','圖'=>'圖','嘆'=>'嘆','ð¯¡'=>'圗','噑'=>'噑','ð¯¡'=>'å™´','ð¯¡'=>'切','壮'=>'壮','城'=>'城','埴'=>'埴','堍'=>'å ','型'=>'åž‹','堲'=>'å ²','報'=>'å ±','墬'=>'墬','𡓤'=>'𡓤','売'=>'売','壷'=>'壷','夆'=>'夆','ð¯¡'=>'多','夢'=>'夢','奢'=>'奢','𡚨'=>'𡚨','𡛪'=>'𡛪','姬'=>'姬','娛'=>'娛','娧'=>'娧','姘'=>'姘','婦'=>'婦','㛮'=>'ã›®','㛼'=>'㛼','嬈'=>'嬈','嬾'=>'嬾','嬾'=>'嬾','𡧈'=>'𡧈','ð¯¡'=>'寃','寘'=>'寘','寧'=>'寧','寳'=>'寳','𡬘'=>'𡬘','寿'=>'寿','将'=>'å°†','当'=>'当','尢'=>'å°¢','㞁'=>'ãž','屠'=>'å± ','屮'=>'å±®','峀'=>'å³€','岍'=>'å²','𡷤'=>'ð¡·¤','嵃'=>'嵃','𡷦'=>'ð¡·¦','嵮'=>'åµ®','嵫'=>'嵫','嵼'=>'åµ¼','ð¯¢'=>'å·¡','巢'=>'å·¢','㠯'=>'ã ¯','巽'=>'å·½','帨'=>'帨','帽'=>'帽','幩'=>'幩','㡢'=>'ã¡¢','𢆃'=>'𢆃','㡼'=>'㡼','庰'=>'庰','庳'=>'庳','ð¯¢'=>'庶','廊'=>'廊','ð¯¢'=>'𪎒','ð¯¢'=>'廾','𢌱'=>'𢌱','𢌱'=>'𢌱','舁'=>'èˆ','弢'=>'å¼¢','弢'=>'å¼¢','㣇'=>'㣇','𣊸'=>'𣊸','𦇚'=>'𦇚','形'=>'å½¢','彫'=>'彫','㣣'=>'㣣','徚'=>'徚','ð¯¢'=>'å¿','志'=>'å¿—','忹'=>'忹','悁'=>'æ‚','㤺'=>'㤺','㤜'=>'㤜','悔'=>'æ‚”','𢛔'=>'𢛔','惇'=>'惇','慈'=>'æ…ˆ','慌'=>'æ…Œ','慎'=>'æ…Ž','慌'=>'æ…Œ','慺'=>'æ…º','憎'=>'憎','憲'=>'憲','ð¯¢'=>'憤','憯'=>'憯','懞'=>'懞','懲'=>'懲','懶'=>'懶','成'=>'æˆ','戛'=>'戛','扝'=>'æ‰','抱'=>'抱','拔'=>'æ‹”','捐'=>'æ','𢬌'=>'𢬌','挽'=>'挽','拼'=>'拼','捨'=>'æ¨','掃'=>'掃','揤'=>'æ¤','𢯱'=>'𢯱','搢'=>'æ¢','揅'=>'æ…','ð¯£'=>'掩','㨮'=>'㨮','摩'=>'æ‘©','摾'=>'摾','撝'=>'æ’','摷'=>'æ‘·','㩬'=>'㩬','敏'=>'æ•','敬'=>'敬','𣀊'=>'𣀊','旣'=>'æ—£','書'=>'書','ð¯£'=>'晉','㬙'=>'㬙','ð¯£'=>'æš‘','ð¯£'=>'㬈','㫤'=>'㫤','冒'=>'冒','冕'=>'冕','最'=>'最','暜'=>'æšœ','肭'=>'è‚','䏙'=>'ä™','朗'=>'朗','望'=>'望','朡'=>'朡','杞'=>'æž','杓'=>'æ“','ð¯£'=>'ð£ƒ','㭉'=>'ã‰','柺'=>'柺','枅'=>'æž…','桒'=>'æ¡’','梅'=>'梅','𣑭'=>'ð£‘','梎'=>'梎','栟'=>'æ Ÿ','椔'=>'椔','㮝'=>'ã®','楂'=>'楂','榣'=>'榣','槪'=>'槪','檨'=>'檨','𣚣'=>'𣚣','ð¯£'=>'æ«›','㰘'=>'ã°˜','次'=>'次','𣢧'=>'𣢧','歔'=>'æ”','㱎'=>'㱎','歲'=>'æ²','殟'=>'殟','殺'=>'殺','殻'=>'æ®»','𣪍'=>'ð£ª','𡴋'=>'ð¡´‹','𣫺'=>'𣫺','汎'=>'汎','𣲼'=>'𣲼','沿'=>'沿','泍'=>'æ³','汧'=>'æ±§','洖'=>'æ´–','派'=>'æ´¾','ð¯¤'=>'æµ·','流'=>'æµ','浩'=>'浩','浸'=>'浸','涅'=>'æ¶…','𣴞'=>'𣴞','洴'=>'æ´´','港'=>'港','湮'=>'æ¹®','㴳'=>'ã´³','滋'=>'滋','滇'=>'滇','ð¯¤'=>'𣻑','淹'=>'æ·¹','ð¯¤'=>'æ½®','ð¯¤'=>'𣽞','𣾎'=>'𣾎','濆'=>'濆','瀹'=>'瀹','瀞'=>'瀞','瀛'=>'瀛','㶖'=>'ã¶–','灊'=>'çŠ','災'=>'ç½','灷'=>'ç·','炭'=>'ç‚','𠔥'=>'𠔥','煅'=>'ç……','ð¯¤'=>'𤉣','熜'=>'熜','𤎫'=>'𤎫','爨'=>'爨','爵'=>'爵','牐'=>'ç‰','𤘈'=>'𤘈','犀'=>'犀','犕'=>'犕','𤜵'=>'𤜵','𤠔'=>'𤠔','獺'=>'çº','王'=>'王','㺬'=>'㺬','玥'=>'玥','㺸'=>'㺸','ð¯¤'=>'㺸','瑇'=>'瑇','瑜'=>'瑜','瑱'=>'瑱','璅'=>'ç’…','瓊'=>'瓊','㼛'=>'ã¼›','甤'=>'甤','𤰶'=>'𤰶','甾'=>'甾','𤲒'=>'𤲒','異'=>'ç•°','𢆟'=>'𢆟','瘐'=>'ç˜','𤾡'=>'𤾡','𤾸'=>'𤾸','𥁄'=>'ð¥„','㿼'=>'㿼','䀈'=>'䀈','直'=>'ç›´','ð¯¥'=>'𥃳','𥃲'=>'𥃲','𥄙'=>'𥄙','𥄳'=>'𥄳','眞'=>'眞','真'=>'真','真'=>'真','睊'=>'çŠ','䀹'=>'䀹','瞋'=>'çž‹','䁆'=>'ä†','䂖'=>'ä‚–','ð¯¥'=>'ð¥','硎'=>'硎','ð¯¥'=>'碌','ð¯¥'=>'磌','䃣'=>'䃣','𥘦'=>'𥘦','祖'=>'祖','𥚚'=>'𥚚','𥛅'=>'𥛅','福'=>'ç¦','秫'=>'ç§«','䄯'=>'䄯','穀'=>'ç©€','穊'=>'穊','穏'=>'ç©','𥥼'=>'𥥼','ð¯¥'=>'𥪧','𥪧'=>'𥪧','竮'=>'ç«®','䈂'=>'䈂','𥮫'=>'𥮫','篆'=>'篆','築'=>'築','䈧'=>'䈧','𥲀'=>'𥲀','糒'=>'ç³’','䊠'=>'äŠ ','糨'=>'糨','糣'=>'ç³£','紀'=>'ç´€','𥾆'=>'𥾆','絣'=>'çµ£','ð¯¥'=>'äŒ','緇'=>'ç·‡','縂'=>'縂','繅'=>'ç¹…','䌴'=>'䌴','𦈨'=>'𦈨','𦉇'=>'𦉇','䍙'=>'ä™','𦋙'=>'𦋙','罺'=>'罺','𦌾'=>'𦌾','羕'=>'羕','翺'=>'翺','者'=>'者','𦓚'=>'𦓚','𦔣'=>'𦔣','聠'=>'è ','𦖨'=>'𦖨','聰'=>'è°','𣍟'=>'ð£Ÿ','ð¯¦'=>'ä•','育'=>'育','脃'=>'脃','䐋'=>'ä‹','脾'=>'脾','媵'=>'媵','𦞧'=>'𦞧','𦞵'=>'𦞵','𣎓'=>'𣎓','𣎜'=>'𣎜','舁'=>'èˆ','舄'=>'舄','ð¯¦'=>'辞','䑫'=>'ä‘«','ð¯¦'=>'芑','ð¯¦'=>'芋','芝'=>'èŠ','劳'=>'劳','花'=>'花','芳'=>'芳','芽'=>'芽','苦'=>'苦','𦬼'=>'𦬼','若'=>'è‹¥','茝'=>'èŒ','荣'=>'è£','莭'=>'èŽ','茣'=>'茣','ð¯¦'=>'莽','菧'=>'è§','著'=>'è‘—','荓'=>'è“','菊'=>'èŠ','菌'=>'èŒ','菜'=>'èœ','𦰶'=>'𦰶','𦵫'=>'𦵫','𦳕'=>'𦳕','䔫'=>'䔫','蓱'=>'蓱','蓳'=>'蓳','蔖'=>'è”–','𧏊'=>'ð§Š','蕤'=>'蕤','ð¯¦'=>'𦼬','䕝'=>'ä•','䕡'=>'ä•¡','𦾱'=>'𦾱','𧃒'=>'𧃒','䕫'=>'ä•«','虐'=>'è™','虜'=>'虜','虧'=>'è™§','虩'=>'虩','蚩'=>'èš©','蚈'=>'蚈','蜎'=>'蜎','蛢'=>'蛢','蝹'=>'è¹','蜨'=>'蜨','蝫'=>'è«','螆'=>'螆','䗗'=>'ä——','蟡'=>'蟡','ð¯§'=>'è ','䗹'=>'ä—¹','衠'=>'è¡ ','衣'=>'è¡£','𧙧'=>'ð§™§','裗'=>'裗','裞'=>'裞','䘵'=>'䘵','裺'=>'裺','㒻'=>'ã’»','𧢮'=>'ð§¢®','𧥦'=>'𧥦','ð¯§'=>'äš¾','䛇'=>'䛇','ð¯§'=>'èª ','ð¯§'=>'è«','變'=>'變','豕'=>'豕','𧲨'=>'𧲨','貫'=>'貫','賁'=>'è³','贛'=>'è´›','起'=>'èµ·','𧼯'=>'𧼯','𠠄'=>'ð „','跋'=>'è·‹','趼'=>'è¶¼','跰'=>'è·°','ð¯§'=>'𠣞','軔'=>'è»”','輸'=>'輸','𨗒'=>'𨗒','𨗭'=>'ð¨—','邔'=>'é‚”','郱'=>'郱','鄑'=>'é„‘','𨜮'=>'𨜮','鄛'=>'é„›','鈸'=>'鈸','鋗'=>'é‹—','鋘'=>'鋘','鉼'=>'鉼','鏹'=>'é¹','鐕'=>'é•','ð¯§'=>'𨯺','開'=>'é–‹','䦕'=>'䦕','閷'=>'é–·','𨵷'=>'𨵷','䧦'=>'䧦','雃'=>'雃','嶲'=>'å¶²','霣'=>'霣','𩅅'=>'ð©……','𩈚'=>'𩈚','䩮'=>'ä©®','䩶'=>'ä©¶','韠'=>'éŸ ','𩐊'=>'ð©Š','䪲'=>'䪲','𩒖'=>'ð©’–','頋'=>'é ‹','頋'=>'é ‹','頩'=>'é ©','ð¯¨'=>'ð©–¶','飢'=>'飢','䬳'=>'䬳','餩'=>'餩','馧'=>'馧','駂'=>'é§‚','駾'=>'é§¾','䯎'=>'䯎','𩬰'=>'𩬰','鬒'=>'鬒','鱀'=>'é±€','鳽'=>'é³½','ð¯¨'=>'䳎','䳭'=>'ä³','ð¯¨'=>'éµ§','ð¯¨'=>'𪃎','䳸'=>'䳸','𪄅'=>'𪄅','𪈎'=>'𪈎','𪊑'=>'𪊑','麻'=>'麻','䵖'=>'äµ–','黹'=>'黹','黾'=>'黾','鼅'=>'é¼…','鼏'=>'é¼','鼖'=>'é¼–','鼻'=>'é¼»','ð¯¨'=>'𪘀'); diff --git a/phpBB/includes/utf/data/utf_nfc_qc.php b/phpBB/includes/utf/data/utf_nfc_qc.php deleted file mode 100644 index ff56357ea6..0000000000 --- a/phpBB/includes/utf/data/utf_nfc_qc.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php -$GLOBALS['utf_nfc_qc']=array('Í€'=>1,'Í'=>1,'̓'=>1,'Í„'=>1,'Í´'=>1,';'=>1,'·'=>1,'क़'=>1,'ख़'=>1,'ग़'=>1,'ज़'=>1,'ड़'=>1,'à¥'=>1,'फ़'=>1,'य़'=>1,'à§œ'=>1,'à§'=>1,'à§Ÿ'=>1,'ਲ਼'=>1,'ਸ਼'=>1,'à©™'=>1,'ਗ਼'=>1,'à©›'=>1,'ਫ਼'=>1,'àœ'=>1,'à'=>1,'གྷ'=>1,'à½'=>1,'དྷ'=>1,'བྷ'=>1,'ཛྷ'=>1,'ཀྵ'=>1,'ཱི'=>1,'ཱུ'=>1,'ྲྀ'=>1,'ླྀ'=>1,'à¾'=>1,'ྒྷ'=>1,'à¾'=>1,'ྡྷ'=>1,'ྦྷ'=>1,'ྫྷ'=>1,'ྐྵ'=>1,'á½±'=>1,'á½³'=>1,'á½µ'=>1,'á½·'=>1,'á½¹'=>1,'á½»'=>1,'á½½'=>1,'á¾»'=>1,'á¾¾'=>1,'Έ'=>1,'á¿‹'=>1,'á¿“'=>1,'á¿›'=>1,'á¿£'=>1,'á¿«'=>1,'á¿®'=>1,'`'=>1,'Ό'=>1,'á¿»'=>1,'´'=>1,' '=>1,'â€'=>1,'Ω'=>1,'K'=>1,'â„«'=>1,'〈'=>1,'〉'=>1,'⫝̸'=>1,'豈'=>1,'ï¤'=>1,'車'=>1,'賈'=>1,'滑'=>1,'串'=>1,'句'=>1,'龜'=>1,'龜'=>1,'契'=>1,'金'=>1,'喇'=>1,'奈'=>1,'ï¤'=>1,'癩'=>1,'ï¤'=>1,'ï¤'=>1,'螺'=>1,'裸'=>1,'邏'=>1,'樂'=>1,'洛'=>1,'烙'=>1,'珞'=>1,'落'=>1,'酪'=>1,'駱'=>1,'亂'=>1,'卵'=>1,'ï¤'=>1,'爛'=>1,'蘭'=>1,'ï¤ '=>1,'嵐'=>1,'濫'=>1,'藍'=>1,'襤'=>1,'拉'=>1,'臘'=>1,'蠟'=>1,'廊'=>1,'朗'=>1,'浪'=>1,'狼'=>1,'郎'=>1,'ï¤'=>1,'冷'=>1,'勞'=>1,'擄'=>1,'櫓'=>1,'爐'=>1,'盧'=>1,'老'=>1,'蘆'=>1,'虜'=>1,'路'=>1,'露'=>1,'魯'=>1,'鷺'=>1,'碌'=>1,'祿'=>1,'綠'=>1,'菉'=>1,'錄'=>1,'鹿'=>1,'ï¥'=>1,'壟'=>1,'弄'=>1,'籠'=>1,'聾'=>1,'牢'=>1,'磊'=>1,'賂'=>1,'雷'=>1,'壘'=>1,'屢'=>1,'樓'=>1,'ï¥'=>1,'漏'=>1,'ï¥'=>1,'ï¥'=>1,'陋'=>1,'勒'=>1,'肋'=>1,'凜'=>1,'凌'=>1,'稜'=>1,'綾'=>1,'菱'=>1,'陵'=>1,'讀'=>1,'拏'=>1,'樂'=>1,'ï¥'=>1,'丹'=>1,'寧'=>1,'ï¥ '=>1,'率'=>1,'異'=>1,'北'=>1,'磻'=>1,'便'=>1,'復'=>1,'不'=>1,'泌'=>1,'數'=>1,'索'=>1,'參'=>1,'塞'=>1,'ï¥'=>1,'葉'=>1,'說'=>1,'殺'=>1,'辰'=>1,'沈'=>1,'拾'=>1,'若'=>1,'掠'=>1,'略'=>1,'亮'=>1,'兩'=>1,'凉'=>1,'梁'=>1,'糧'=>1,'良'=>1,'諒'=>1,'量'=>1,'勵'=>1,'呂'=>1,'ï¦'=>1,'廬'=>1,'旅'=>1,'濾'=>1,'礪'=>1,'閭'=>1,'驪'=>1,'麗'=>1,'黎'=>1,'力'=>1,'曆'=>1,'歷'=>1,'ï¦'=>1,'年'=>1,'ï¦'=>1,'ï¦'=>1,'撚'=>1,'漣'=>1,'煉'=>1,'璉'=>1,'秊'=>1,'練'=>1,'聯'=>1,'輦'=>1,'蓮'=>1,'連'=>1,'鍊'=>1,'列'=>1,'ï¦'=>1,'咽'=>1,'烈'=>1,'ï¦ '=>1,'說'=>1,'廉'=>1,'念'=>1,'捻'=>1,'殮'=>1,'簾'=>1,'獵'=>1,'令'=>1,'囹'=>1,'寧'=>1,'嶺'=>1,'怜'=>1,'ï¦'=>1,'瑩'=>1,'羚'=>1,'聆'=>1,'鈴'=>1,'零'=>1,'靈'=>1,'領'=>1,'例'=>1,'禮'=>1,'醴'=>1,'隸'=>1,'惡'=>1,'了'=>1,'僚'=>1,'寮'=>1,'尿'=>1,'料'=>1,'樂'=>1,'ï§€'=>1,'ï§'=>1,'ï§‚'=>1,'遼'=>1,'ï§„'=>1,'ï§…'=>1,'阮'=>1,'劉'=>1,'杻'=>1,'柳'=>1,'ï§Š'=>1,'ï§‹'=>1,'ï§Œ'=>1,'ï§'=>1,'ï§Ž'=>1,'ï§'=>1,'ï§'=>1,'ï§‘'=>1,'ï§’'=>1,'ï§“'=>1,'ï§”'=>1,'ï§•'=>1,'ï§–'=>1,'ï§—'=>1,'律'=>1,'ï§™'=>1,'ï§š'=>1,'ï§›'=>1,'ï§œ'=>1,'ï§'=>1,'ï§ž'=>1,'ï§Ÿ'=>1,'ï§ '=>1,'ï§¡'=>1,'ï§¢'=>1,'ï§£'=>1,'理'=>1,'ï§¥'=>1,'罹'=>1,'ï§§'=>1,'裡'=>1,'ï§©'=>1,'離'=>1,'ï§«'=>1,'溺'=>1,'ï§'=>1,'ï§®'=>1,'璘'=>1,'ï§°'=>1,'ï§±'=>1,'ï§²'=>1,'ï§³'=>1,'ï§´'=>1,'ï§µ'=>1,'ï§¶'=>1,'ï§·'=>1,'笠'=>1,'ï§¹'=>1,'狀'=>1,'ï§»'=>1,'ï§¼'=>1,'ï§½'=>1,'ï§¾'=>1,'ï§¿'=>1,'切'=>1,'ï¨'=>1,'拓'=>1,'糖'=>1,'宅'=>1,'洞'=>1,'暴'=>1,'輻'=>1,'行'=>1,'降'=>1,'見'=>1,'廓'=>1,'兀'=>1,'ï¨'=>1,'ï¨'=>1,'晴'=>1,'凞'=>1,'猪'=>1,'益'=>1,'礼'=>1,'神'=>1,'祥'=>1,'福'=>1,'靖'=>1,'ï¨'=>1,'羽'=>1,'ï¨ '=>1,'諸'=>1,'逸'=>1,'都'=>1,'飯'=>1,'飼'=>1,'館'=>1,'ï¨'=>1,'侮'=>1,'僧'=>1,'免'=>1,'勉'=>1,'勤'=>1,'卑'=>1,'喝'=>1,'嘆'=>1,'器'=>1,'塀'=>1,'墨'=>1,'層'=>1,'屮'=>1,'悔'=>1,'慨'=>1,'憎'=>1,'ï©€'=>1,'ï©'=>1,'ï©‚'=>1,'暑'=>1,'ï©„'=>1,'ï©…'=>1,'渚'=>1,'漢'=>1,'煮'=>1,'爫'=>1,'琢'=>1,'ï©‹'=>1,'社'=>1,'ï©'=>1,'祈'=>1,'ï©'=>1,'ï©'=>1,'ï©‘'=>1,'ï©’'=>1,'ï©“'=>1,'ï©”'=>1,'ï©•'=>1,'ï©–'=>1,'ï©—'=>1,'縉'=>1,'ï©™'=>1,'署'=>1,'ï©›'=>1,'臭'=>1,'ï©'=>1,'艹'=>1,'著'=>1,'ï© '=>1,'ï©¡'=>1,'ï©¢'=>1,'ï©£'=>1,'賓'=>1,'ï©¥'=>1,'辶'=>1,'ï©§'=>1,'難'=>1,'ï©©'=>1,'頻'=>1,'ï©°'=>1,'况'=>1,'全'=>1,'侀'=>1,'ï©´'=>1,'冀'=>1,'ï©¶'=>1,'ï©·'=>1,'喝'=>1,'啕'=>1,'喙'=>1,'ï©»'=>1,'塚'=>1,'墳'=>1,'奄'=>1,'ï©¿'=>1,'婢'=>1,'ïª'=>1,'廒'=>1,'廙'=>1,'彩'=>1,'徭'=>1,'惘'=>1,'慎'=>1,'愈'=>1,'憎'=>1,'慠'=>1,'懲'=>1,'戴'=>1,'ïª'=>1,'搜'=>1,'ïª'=>1,'ïª'=>1,'晴'=>1,'朗'=>1,'望'=>1,'杖'=>1,'歹'=>1,'殺'=>1,'流'=>1,'滛'=>1,'滋'=>1,'漢'=>1,'瀞'=>1,'煮'=>1,'ïª'=>1,'爵'=>1,'犯'=>1,'ïª '=>1,'瑱'=>1,'甆'=>1,'画'=>1,'瘝'=>1,'瘟'=>1,'益'=>1,'盛'=>1,'直'=>1,'睊'=>1,'着'=>1,'磌'=>1,'窱'=>1,'ïª'=>1,'类'=>1,'絛'=>1,'練'=>1,'缾'=>1,'者'=>1,'荒'=>1,'華'=>1,'蝹'=>1,'襁'=>1,'覆'=>1,'視'=>1,'調'=>1,'諸'=>1,'請'=>1,'謁'=>1,'諾'=>1,'諭'=>1,'謹'=>1,'ï«€'=>1,'ï«'=>1,'ï«‚'=>1,'遲'=>1,'ï«„'=>1,'ï«…'=>1,'陼'=>1,'難'=>1,'靖'=>1,'韛'=>1,'響'=>1,'ï«‹'=>1,'頻'=>1,'ï«'=>1,'龜'=>1,'ï«'=>1,'ï«'=>1,'ï«‘'=>1,'ï«’'=>1,'ï«“'=>1,'ï«”'=>1,'ï«•'=>1,'ï«–'=>1,'ï«—'=>1,'齃'=>1,'ï«™'=>1,'ï¬'=>1,'ײַ'=>1,'שׁ'=>1,'שׂ'=>1,'שּׁ'=>1,'ï¬'=>1,'אַ'=>1,'אָ'=>1,'אּ'=>1,'בּ'=>1,'גּ'=>1,'דּ'=>1,'הּ'=>1,'וּ'=>1,'זּ'=>1,'טּ'=>1,'יּ'=>1,'ךּ'=>1,'כּ'=>1,'לּ'=>1,'מּ'=>1,'ï€'=>1,'ï'=>1,'ïƒ'=>1,'ï„'=>1,'ï†'=>1,'ï‡'=>1,'ïˆ'=>1,'ï‰'=>1,'ïŠ'=>1,'ï‹'=>1,'ïŒ'=>1,'ï'=>1,'ïŽ'=>1,'ð…ž'=>1,'ð…Ÿ'=>1,'ð… '=>1,'ð…¡'=>1,'ð…¢'=>1,'ð…£'=>1,'ð…¤'=>1,'ð†»'=>1,'ð†¼'=>1,'ð†½'=>1,'ð†¾'=>1,'ð†¿'=>1,'ð‡€'=>1,'丽'=>1,'ð¯ '=>1,'乁'=>1,'𠄢'=>1,'你'=>1,'侮'=>1,'侻'=>1,'倂'=>1,'偺'=>1,'備'=>1,'僧'=>1,'像'=>1,'㒞'=>1,'ð¯ '=>1,'免'=>1,'ð¯ '=>1,'ð¯ '=>1,'具'=>1,'𠔜'=>1,'㒹'=>1,'內'=>1,'再'=>1,'𠕋'=>1,'冗'=>1,'冤'=>1,'仌'=>1,'冬'=>1,'况'=>1,'𩇟'=>1,'ð¯ '=>1,'刃'=>1,'㓟'=>1,'ð¯ '=>1,'剆'=>1,'割'=>1,'剷'=>1,'㔕'=>1,'勇'=>1,'勉'=>1,'勤'=>1,'勺'=>1,'包'=>1,'匆'=>1,'北'=>1,'卉'=>1,'ð¯ '=>1,'博'=>1,'即'=>1,'卽'=>1,'卿'=>1,'卿'=>1,'卿'=>1,'𠨬'=>1,'灰'=>1,'及'=>1,'叟'=>1,'𠭣'=>1,'叫'=>1,'叱'=>1,'吆'=>1,'咞'=>1,'吸'=>1,'呈'=>1,'周'=>1,'咢'=>1,'ð¯¡'=>1,'唐'=>1,'啓'=>1,'啣'=>1,'善'=>1,'善'=>1,'喙'=>1,'喫'=>1,'喳'=>1,'嗂'=>1,'圖'=>1,'嘆'=>1,'ð¯¡'=>1,'噑'=>1,'ð¯¡'=>1,'ð¯¡'=>1,'壮'=>1,'城'=>1,'埴'=>1,'堍'=>1,'型'=>1,'堲'=>1,'報'=>1,'墬'=>1,'𡓤'=>1,'売'=>1,'壷'=>1,'夆'=>1,'ð¯¡'=>1,'夢'=>1,'奢'=>1,'𡚨'=>1,'𡛪'=>1,'姬'=>1,'娛'=>1,'娧'=>1,'姘'=>1,'婦'=>1,'㛮'=>1,'㛼'=>1,'嬈'=>1,'嬾'=>1,'嬾'=>1,'𡧈'=>1,'ð¯¡'=>1,'寘'=>1,'寧'=>1,'寳'=>1,'𡬘'=>1,'寿'=>1,'将'=>1,'当'=>1,'尢'=>1,'㞁'=>1,'屠'=>1,'屮'=>1,'峀'=>1,'岍'=>1,'𡷤'=>1,'嵃'=>1,'𡷦'=>1,'嵮'=>1,'嵫'=>1,'嵼'=>1,'ð¯¢'=>1,'巢'=>1,'㠯'=>1,'巽'=>1,'帨'=>1,'帽'=>1,'幩'=>1,'㡢'=>1,'𢆃'=>1,'㡼'=>1,'庰'=>1,'庳'=>1,'ð¯¢'=>1,'廊'=>1,'ð¯¢'=>1,'ð¯¢'=>1,'𢌱'=>1,'𢌱'=>1,'舁'=>1,'弢'=>1,'弢'=>1,'㣇'=>1,'𣊸'=>1,'𦇚'=>1,'形'=>1,'彫'=>1,'㣣'=>1,'徚'=>1,'ð¯¢'=>1,'志'=>1,'忹'=>1,'悁'=>1,'㤺'=>1,'㤜'=>1,'悔'=>1,'𢛔'=>1,'惇'=>1,'慈'=>1,'慌'=>1,'慎'=>1,'慌'=>1,'慺'=>1,'憎'=>1,'憲'=>1,'ð¯¢'=>1,'憯'=>1,'懞'=>1,'懲'=>1,'懶'=>1,'成'=>1,'戛'=>1,'扝'=>1,'抱'=>1,'拔'=>1,'捐'=>1,'𢬌'=>1,'挽'=>1,'拼'=>1,'捨'=>1,'掃'=>1,'揤'=>1,'𢯱'=>1,'搢'=>1,'揅'=>1,'ð¯£'=>1,'㨮'=>1,'摩'=>1,'摾'=>1,'撝'=>1,'摷'=>1,'㩬'=>1,'敏'=>1,'敬'=>1,'𣀊'=>1,'旣'=>1,'書'=>1,'ð¯£'=>1,'㬙'=>1,'ð¯£'=>1,'ð¯£'=>1,'㫤'=>1,'冒'=>1,'冕'=>1,'最'=>1,'暜'=>1,'肭'=>1,'䏙'=>1,'朗'=>1,'望'=>1,'朡'=>1,'杞'=>1,'杓'=>1,'ð¯£'=>1,'㭉'=>1,'柺'=>1,'枅'=>1,'桒'=>1,'梅'=>1,'𣑭'=>1,'梎'=>1,'栟'=>1,'椔'=>1,'㮝'=>1,'楂'=>1,'榣'=>1,'槪'=>1,'檨'=>1,'𣚣'=>1,'ð¯£'=>1,'㰘'=>1,'次'=>1,'𣢧'=>1,'歔'=>1,'㱎'=>1,'歲'=>1,'殟'=>1,'殺'=>1,'殻'=>1,'𣪍'=>1,'𡴋'=>1,'𣫺'=>1,'汎'=>1,'𣲼'=>1,'沿'=>1,'泍'=>1,'汧'=>1,'洖'=>1,'派'=>1,'ð¯¤'=>1,'流'=>1,'浩'=>1,'浸'=>1,'涅'=>1,'𣴞'=>1,'洴'=>1,'港'=>1,'湮'=>1,'㴳'=>1,'滋'=>1,'滇'=>1,'ð¯¤'=>1,'淹'=>1,'ð¯¤'=>1,'ð¯¤'=>1,'𣾎'=>1,'濆'=>1,'瀹'=>1,'瀞'=>1,'瀛'=>1,'㶖'=>1,'灊'=>1,'災'=>1,'灷'=>1,'炭'=>1,'𠔥'=>1,'煅'=>1,'ð¯¤'=>1,'熜'=>1,'𤎫'=>1,'爨'=>1,'爵'=>1,'牐'=>1,'𤘈'=>1,'犀'=>1,'犕'=>1,'𤜵'=>1,'𤠔'=>1,'獺'=>1,'王'=>1,'㺬'=>1,'玥'=>1,'㺸'=>1,'ð¯¤'=>1,'瑇'=>1,'瑜'=>1,'瑱'=>1,'璅'=>1,'瓊'=>1,'㼛'=>1,'甤'=>1,'𤰶'=>1,'甾'=>1,'𤲒'=>1,'異'=>1,'𢆟'=>1,'瘐'=>1,'𤾡'=>1,'𤾸'=>1,'𥁄'=>1,'㿼'=>1,'䀈'=>1,'直'=>1,'ð¯¥'=>1,'𥃲'=>1,'𥄙'=>1,'𥄳'=>1,'眞'=>1,'真'=>1,'真'=>1,'睊'=>1,'䀹'=>1,'瞋'=>1,'䁆'=>1,'䂖'=>1,'ð¯¥'=>1,'硎'=>1,'ð¯¥'=>1,'ð¯¥'=>1,'䃣'=>1,'𥘦'=>1,'祖'=>1,'𥚚'=>1,'𥛅'=>1,'福'=>1,'秫'=>1,'䄯'=>1,'穀'=>1,'穊'=>1,'穏'=>1,'𥥼'=>1,'ð¯¥'=>1,'𥪧'=>1,'竮'=>1,'䈂'=>1,'𥮫'=>1,'篆'=>1,'築'=>1,'䈧'=>1,'𥲀'=>1,'糒'=>1,'䊠'=>1,'糨'=>1,'糣'=>1,'紀'=>1,'𥾆'=>1,'絣'=>1,'ð¯¥'=>1,'緇'=>1,'縂'=>1,'繅'=>1,'䌴'=>1,'𦈨'=>1,'𦉇'=>1,'䍙'=>1,'𦋙'=>1,'罺'=>1,'𦌾'=>1,'羕'=>1,'翺'=>1,'者'=>1,'𦓚'=>1,'𦔣'=>1,'聠'=>1,'𦖨'=>1,'聰'=>1,'𣍟'=>1,'ð¯¦'=>1,'育'=>1,'脃'=>1,'䐋'=>1,'脾'=>1,'媵'=>1,'𦞧'=>1,'𦞵'=>1,'𣎓'=>1,'𣎜'=>1,'舁'=>1,'舄'=>1,'ð¯¦'=>1,'䑫'=>1,'ð¯¦'=>1,'ð¯¦'=>1,'芝'=>1,'劳'=>1,'花'=>1,'芳'=>1,'芽'=>1,'苦'=>1,'𦬼'=>1,'若'=>1,'茝'=>1,'荣'=>1,'莭'=>1,'茣'=>1,'ð¯¦'=>1,'菧'=>1,'著'=>1,'荓'=>1,'菊'=>1,'菌'=>1,'菜'=>1,'𦰶'=>1,'𦵫'=>1,'𦳕'=>1,'䔫'=>1,'蓱'=>1,'蓳'=>1,'蔖'=>1,'𧏊'=>1,'蕤'=>1,'ð¯¦'=>1,'䕝'=>1,'䕡'=>1,'𦾱'=>1,'𧃒'=>1,'䕫'=>1,'虐'=>1,'虜'=>1,'虧'=>1,'虩'=>1,'蚩'=>1,'蚈'=>1,'蜎'=>1,'蛢'=>1,'蝹'=>1,'蜨'=>1,'蝫'=>1,'螆'=>1,'䗗'=>1,'蟡'=>1,'ð¯§'=>1,'䗹'=>1,'衠'=>1,'衣'=>1,'𧙧'=>1,'裗'=>1,'裞'=>1,'䘵'=>1,'裺'=>1,'㒻'=>1,'𧢮'=>1,'𧥦'=>1,'ð¯§'=>1,'䛇'=>1,'ð¯§'=>1,'ð¯§'=>1,'變'=>1,'豕'=>1,'𧲨'=>1,'貫'=>1,'賁'=>1,'贛'=>1,'起'=>1,'𧼯'=>1,'𠠄'=>1,'跋'=>1,'趼'=>1,'跰'=>1,'ð¯§'=>1,'軔'=>1,'輸'=>1,'𨗒'=>1,'𨗭'=>1,'邔'=>1,'郱'=>1,'鄑'=>1,'𨜮'=>1,'鄛'=>1,'鈸'=>1,'鋗'=>1,'鋘'=>1,'鉼'=>1,'鏹'=>1,'鐕'=>1,'ð¯§'=>1,'開'=>1,'䦕'=>1,'閷'=>1,'𨵷'=>1,'䧦'=>1,'雃'=>1,'嶲'=>1,'霣'=>1,'𩅅'=>1,'𩈚'=>1,'䩮'=>1,'䩶'=>1,'韠'=>1,'𩐊'=>1,'䪲'=>1,'𩒖'=>1,'頋'=>1,'頋'=>1,'頩'=>1,'ð¯¨'=>1,'飢'=>1,'䬳'=>1,'餩'=>1,'馧'=>1,'駂'=>1,'駾'=>1,'䯎'=>1,'𩬰'=>1,'鬒'=>1,'鱀'=>1,'鳽'=>1,'ð¯¨'=>1,'䳭'=>1,'ð¯¨'=>1,'ð¯¨'=>1,'䳸'=>1,'𪄅'=>1,'𪈎'=>1,'𪊑'=>1,'麻'=>1,'䵖'=>1,'黹'=>1,'黾'=>1,'鼅'=>1,'鼏'=>1,'鼖'=>1,'鼻'=>1,'ð¯¨'=>1,'Ì€'=>0,'Ì'=>0,'Ì‚'=>0,'̃'=>0,'Ì„'=>0,'̆'=>0,'̇'=>0,'̈'=>0,'̉'=>0,'ÌŠ'=>0,'Ì‹'=>0,'ÌŒ'=>0,'Ì'=>0,'Ì‘'=>0,'Ì“'=>0,'Ì”'=>0,'Ì›'=>0,'Ì£'=>0,'̤'=>0,'Ì¥'=>0,'̦'=>0,'̧'=>0,'̨'=>0,'Ì'=>0,'Ì®'=>0,'̰'=>0,'̱'=>0,'̸'=>0,'Í‚'=>0,'Í…'=>0,'Ù“'=>0,'Ù”'=>0,'Ù•'=>0,'़'=>0,'া'=>0,'à§—'=>0,'ା'=>0,'à–'=>0,'à—'=>0,'ா'=>0,'ௗ'=>0,'à±–'=>0,'ೂ'=>0,'ೕ'=>0,'à³–'=>0,'à´¾'=>0,'ൗ'=>0,'à·Š'=>0,'à·'=>0,'à·Ÿ'=>0,'ီ'=>0,'á…¡'=>0,'á…¢'=>0,'á…£'=>0,'á…¤'=>0,'á…¥'=>0,'á…¦'=>0,'á…§'=>0,'á…¨'=>0,'á…©'=>0,'á…ª'=>0,'á…«'=>0,'á…¬'=>0,'á…'=>0,'á…®'=>0,'á…¯'=>0,'á…°'=>0,'á…±'=>0,'á…²'=>0,'á…³'=>0,'á…´'=>0,'á…µ'=>0,'ᆨ'=>0,'ᆩ'=>0,'ᆪ'=>0,'ᆫ'=>0,'ᆬ'=>0,'á†'=>0,'ᆮ'=>0,'ᆯ'=>0,'ᆰ'=>0,'ᆱ'=>0,'ᆲ'=>0,'ᆳ'=>0,'ᆴ'=>0,'ᆵ'=>0,'ᆶ'=>0,'ᆷ'=>0,'ᆸ'=>0,'ᆹ'=>0,'ᆺ'=>0,'ᆻ'=>0,'ᆼ'=>0,'ᆽ'=>0,'ᆾ'=>0,'ᆿ'=>0,'ᇀ'=>0,'á‡'=>0,'ᇂ'=>0,'ᬵ'=>0,'ã‚™'=>0,'゚'=>0); diff --git a/phpBB/includes/utf/data/utf_nfkc_qc.php b/phpBB/includes/utf/data/utf_nfkc_qc.php deleted file mode 100644 index 181a07b351..0000000000 --- a/phpBB/includes/utf/data/utf_nfkc_qc.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php -$GLOBALS['utf_nfkc_qc']=array(' '=>1,'¨'=>1,'ª'=>1,'¯'=>1,'²'=>1,'³'=>1,'´'=>1,'µ'=>1,'¸'=>1,'¹'=>1,'º'=>1,'¼'=>1,'½'=>1,'¾'=>1,'IJ'=>1,'ij'=>1,'Ä¿'=>1,'Å€'=>1,'ʼn'=>1,'Å¿'=>1,'Ç„'=>1,'Ç…'=>1,'dž'=>1,'LJ'=>1,'Lj'=>1,'lj'=>1,'ÇŠ'=>1,'Ç‹'=>1,'ÇŒ'=>1,'DZ'=>1,'Dz'=>1,'dz'=>1,'ʰ'=>1,'ʱ'=>1,'ʲ'=>1,'ʳ'=>1,'Ê´'=>1,'ʵ'=>1,'ʶ'=>1,'Ê·'=>1,'ʸ'=>1,'˘'=>1,'Ë™'=>1,'Ëš'=>1,'Ë›'=>1,'Ëœ'=>1,'Ë'=>1,'Ë '=>1,'Ë¡'=>1,'Ë¢'=>1,'Ë£'=>1,'ˤ'=>1,'Í€'=>1,'Í'=>1,'̓'=>1,'Í„'=>1,'Í´'=>1,'ͺ'=>1,';'=>1,'΄'=>1,'Î…'=>1,'·'=>1,'Ï'=>1,'Ï‘'=>1,'Ï’'=>1,'Ï“'=>1,'Ï”'=>1,'Ï•'=>1,'Ï–'=>1,'ϰ'=>1,'ϱ'=>1,'ϲ'=>1,'Ï´'=>1,'ϵ'=>1,'Ϲ'=>1,'Ö‡'=>1,'Ùµ'=>1,'Ù¶'=>1,'Ù·'=>1,'Ù¸'=>1,'क़'=>1,'ख़'=>1,'ग़'=>1,'ज़'=>1,'ड़'=>1,'à¥'=>1,'फ़'=>1,'य़'=>1,'à§œ'=>1,'à§'=>1,'à§Ÿ'=>1,'ਲ਼'=>1,'ਸ਼'=>1,'à©™'=>1,'ਗ਼'=>1,'à©›'=>1,'ਫ਼'=>1,'àœ'=>1,'à'=>1,'ำ'=>1,'ຳ'=>1,'ໜ'=>1,'à»'=>1,'༌'=>1,'གྷ'=>1,'à½'=>1,'དྷ'=>1,'བྷ'=>1,'ཛྷ'=>1,'ཀྵ'=>1,'ཱི'=>1,'ཱུ'=>1,'ྲྀ'=>1,'ཷ'=>1,'ླྀ'=>1,'ཹ'=>1,'à¾'=>1,'ྒྷ'=>1,'à¾'=>1,'ྡྷ'=>1,'ྦྷ'=>1,'ྫྷ'=>1,'ྐྵ'=>1,'ჼ'=>1,'á´¬'=>1,'á´'=>1,'á´®'=>1,'á´°'=>1,'á´±'=>1,'á´²'=>1,'á´³'=>1,'á´´'=>1,'á´µ'=>1,'á´¶'=>1,'á´·'=>1,'á´¸'=>1,'á´¹'=>1,'á´º'=>1,'á´¼'=>1,'á´½'=>1,'á´¾'=>1,'á´¿'=>1,'áµ€'=>1,'áµ'=>1,'ᵂ'=>1,'ᵃ'=>1,'ᵄ'=>1,'áµ…'=>1,'ᵆ'=>1,'ᵇ'=>1,'ᵈ'=>1,'ᵉ'=>1,'ᵊ'=>1,'ᵋ'=>1,'ᵌ'=>1,'áµ'=>1,'áµ'=>1,'áµ'=>1,'ᵑ'=>1,'áµ’'=>1,'ᵓ'=>1,'áµ”'=>1,'ᵕ'=>1,'áµ–'=>1,'áµ—'=>1,'ᵘ'=>1,'áµ™'=>1,'ᵚ'=>1,'áµ›'=>1,'ᵜ'=>1,'áµ'=>1,'ᵞ'=>1,'ᵟ'=>1,'áµ '=>1,'ᵡ'=>1,'áµ¢'=>1,'áµ£'=>1,'ᵤ'=>1,'áµ¥'=>1,'ᵦ'=>1,'áµ§'=>1,'ᵨ'=>1,'ᵩ'=>1,'ᵪ'=>1,'ᵸ'=>1,'á¶›'=>1,'á¶œ'=>1,'á¶'=>1,'á¶ž'=>1,'á¶Ÿ'=>1,'á¶ '=>1,'á¶¡'=>1,'á¶¢'=>1,'á¶£'=>1,'ᶤ'=>1,'á¶¥'=>1,'ᶦ'=>1,'á¶§'=>1,'ᶨ'=>1,'á¶©'=>1,'ᶪ'=>1,'á¶«'=>1,'ᶬ'=>1,'á¶'=>1,'á¶®'=>1,'ᶯ'=>1,'á¶°'=>1,'á¶±'=>1,'á¶²'=>1,'á¶³'=>1,'á¶´'=>1,'á¶µ'=>1,'á¶¶'=>1,'á¶·'=>1,'ᶸ'=>1,'á¶¹'=>1,'ᶺ'=>1,'á¶»'=>1,'á¶¼'=>1,'á¶½'=>1,'á¶¾'=>1,'á¶¿'=>1,'ẚ'=>1,'ẛ'=>1,'á½±'=>1,'á½³'=>1,'á½µ'=>1,'á½·'=>1,'á½¹'=>1,'á½»'=>1,'á½½'=>1,'á¾»'=>1,'á¾½'=>1,'á¾¾'=>1,'᾿'=>1,'á¿€'=>1,'á¿'=>1,'Έ'=>1,'á¿‹'=>1,'á¿'=>1,'῎'=>1,'á¿'=>1,'á¿“'=>1,'á¿›'=>1,'á¿'=>1,'῞'=>1,'῟'=>1,'á¿£'=>1,'á¿«'=>1,'á¿'=>1,'á¿®'=>1,'`'=>1,'Ό'=>1,'á¿»'=>1,'´'=>1,'῾'=>1,' '=>1,'â€'=>1,' '=>1,' '=>1,' '=>1,' '=>1,' '=>1,' '=>1,' '=>1,' '=>1,' '=>1,'‑'=>1,'‗'=>1,'․'=>1,'‥'=>1,'…'=>1,' '=>1,'″'=>1,'‴'=>1,'‶'=>1,'‷'=>1,'‼'=>1,'‾'=>1,'â‡'=>1,'âˆ'=>1,'â‰'=>1,'â—'=>1,'âŸ'=>1,'â°'=>1,'â±'=>1,'â´'=>1,'âµ'=>1,'â¶'=>1,'â·'=>1,'â¸'=>1,'â¹'=>1,'âº'=>1,'â»'=>1,'â¼'=>1,'â½'=>1,'â¾'=>1,'â¿'=>1,'â‚€'=>1,'â‚'=>1,'â‚‚'=>1,'₃'=>1,'â‚„'=>1,'â‚…'=>1,'₆'=>1,'₇'=>1,'₈'=>1,'₉'=>1,'₊'=>1,'â‚‹'=>1,'₌'=>1,'â‚'=>1,'₎'=>1,'â‚'=>1,'â‚‘'=>1,'â‚’'=>1,'â‚“'=>1,'â‚”'=>1,'₨'=>1,'â„€'=>1,'â„'=>1,'â„‚'=>1,'℃'=>1,'â„…'=>1,'℆'=>1,'ℇ'=>1,'℉'=>1,'ℊ'=>1,'â„‹'=>1,'ℌ'=>1,'â„'=>1,'ℎ'=>1,'â„'=>1,'â„'=>1,'â„‘'=>1,'â„’'=>1,'â„“'=>1,'â„•'=>1,'â„–'=>1,'â„™'=>1,'ℚ'=>1,'â„›'=>1,'ℜ'=>1,'â„'=>1,'â„ '=>1,'â„¡'=>1,'â„¢'=>1,'ℤ'=>1,'Ω'=>1,'ℨ'=>1,'K'=>1,'â„«'=>1,'ℬ'=>1,'â„'=>1,'ℯ'=>1,'â„°'=>1,'ℱ'=>1,'ℳ'=>1,'â„´'=>1,'ℵ'=>1,'â„¶'=>1,'â„·'=>1,'ℸ'=>1,'ℹ'=>1,'â„»'=>1,'ℼ'=>1,'ℽ'=>1,'ℾ'=>1,'â„¿'=>1,'â…€'=>1,'â……'=>1,'â…†'=>1,'â…‡'=>1,'â…ˆ'=>1,'â…‰'=>1,'â…“'=>1,'â…”'=>1,'â…•'=>1,'â…–'=>1,'â…—'=>1,'â…˜'=>1,'â…™'=>1,'â…š'=>1,'â…›'=>1,'â…œ'=>1,'â…'=>1,'â…ž'=>1,'â…Ÿ'=>1,'â… '=>1,'â…¡'=>1,'â…¢'=>1,'â…£'=>1,'â…¤'=>1,'â…¥'=>1,'â…¦'=>1,'â…§'=>1,'â…¨'=>1,'â…©'=>1,'â…ª'=>1,'â…«'=>1,'â…¬'=>1,'â…'=>1,'â…®'=>1,'â…¯'=>1,'â…°'=>1,'â…±'=>1,'â…²'=>1,'â…³'=>1,'â…´'=>1,'â…µ'=>1,'â…¶'=>1,'â…·'=>1,'â…¸'=>1,'â…¹'=>1,'â…º'=>1,'â…»'=>1,'â…¼'=>1,'â…½'=>1,'â…¾'=>1,'â…¿'=>1,'∬'=>1,'âˆ'=>1,'∯'=>1,'∰'=>1,'〈'=>1,'〉'=>1,'â‘ '=>1,'â‘¡'=>1,'â‘¢'=>1,'â‘£'=>1,'⑤'=>1,'â‘¥'=>1,'⑦'=>1,'â‘§'=>1,'⑨'=>1,'â‘©'=>1,'⑪'=>1,'â‘«'=>1,'⑬'=>1,'â‘'=>1,'â‘®'=>1,'⑯'=>1,'â‘°'=>1,'⑱'=>1,'⑲'=>1,'⑳'=>1,'â‘´'=>1,'⑵'=>1,'â‘¶'=>1,'â‘·'=>1,'⑸'=>1,'⑹'=>1,'⑺'=>1,'â‘»'=>1,'⑼'=>1,'⑽'=>1,'⑾'=>1,'â‘¿'=>1,'â’€'=>1,'â’'=>1,'â’‚'=>1,'â’ƒ'=>1,'â’„'=>1,'â’…'=>1,'â’†'=>1,'â’‡'=>1,'â’ˆ'=>1,'â’‰'=>1,'â’Š'=>1,'â’‹'=>1,'â’Œ'=>1,'â’'=>1,'â’Ž'=>1,'â’'=>1,'â’'=>1,'â’‘'=>1,'â’’'=>1,'â’“'=>1,'â’”'=>1,'â’•'=>1,'â’–'=>1,'â’—'=>1,'â’˜'=>1,'â’™'=>1,'â’š'=>1,'â’›'=>1,'â’œ'=>1,'â’'=>1,'â’ž'=>1,'â’Ÿ'=>1,'â’ '=>1,'â’¡'=>1,'â’¢'=>1,'â’£'=>1,'â’¤'=>1,'â’¥'=>1,'â’¦'=>1,'â’§'=>1,'â’¨'=>1,'â’©'=>1,'â’ª'=>1,'â’«'=>1,'â’¬'=>1,'â’'=>1,'â’®'=>1,'â’¯'=>1,'â’°'=>1,'â’±'=>1,'â’²'=>1,'â’³'=>1,'â’´'=>1,'â’µ'=>1,'â’¶'=>1,'â’·'=>1,'â’¸'=>1,'â’¹'=>1,'â’º'=>1,'â’»'=>1,'â’¼'=>1,'â’½'=>1,'â’¾'=>1,'â’¿'=>1,'â“€'=>1,'â“'=>1,'â“‚'=>1,'Ⓝ'=>1,'â“„'=>1,'â“…'=>1,'Ⓠ'=>1,'Ⓡ'=>1,'Ⓢ'=>1,'Ⓣ'=>1,'Ⓤ'=>1,'â“‹'=>1,'Ⓦ'=>1,'â“'=>1,'Ⓨ'=>1,'â“'=>1,'â“'=>1,'â“‘'=>1,'â“’'=>1,'â““'=>1,'â“”'=>1,'â“•'=>1,'â“–'=>1,'â“—'=>1,'ⓘ'=>1,'â“™'=>1,'ⓚ'=>1,'â“›'=>1,'ⓜ'=>1,'â“'=>1,'ⓞ'=>1,'ⓟ'=>1,'â“ '=>1,'â“¡'=>1,'â“¢'=>1,'â“£'=>1,'ⓤ'=>1,'â“¥'=>1,'ⓦ'=>1,'â“§'=>1,'ⓨ'=>1,'â“©'=>1,'⓪'=>1,'⨌'=>1,'â©´'=>1,'⩵'=>1,'â©¶'=>1,'⫝̸'=>1,'ⵯ'=>1,'⺟'=>1,'⻳'=>1,'â¼€'=>1,'â¼'=>1,'⼂'=>1,'⼃'=>1,'⼄'=>1,'â¼…'=>1,'⼆'=>1,'⼇'=>1,'⼈'=>1,'⼉'=>1,'⼊'=>1,'⼋'=>1,'⼌'=>1,'â¼'=>1,'⼎'=>1,'â¼'=>1,'â¼'=>1,'⼑'=>1,'â¼’'=>1,'⼓'=>1,'â¼”'=>1,'⼕'=>1,'â¼–'=>1,'â¼—'=>1,'⼘'=>1,'â¼™'=>1,'⼚'=>1,'â¼›'=>1,'⼜'=>1,'â¼'=>1,'⼞'=>1,'⼟'=>1,'â¼ '=>1,'⼡'=>1,'â¼¢'=>1,'â¼£'=>1,'⼤'=>1,'â¼¥'=>1,'⼦'=>1,'â¼§'=>1,'⼨'=>1,'⼩'=>1,'⼪'=>1,'⼫'=>1,'⼬'=>1,'â¼'=>1,'â¼®'=>1,'⼯'=>1,'â¼°'=>1,'â¼±'=>1,'â¼²'=>1,'â¼³'=>1,'â¼´'=>1,'â¼µ'=>1,'â¼¶'=>1,'â¼·'=>1,'⼸'=>1,'â¼¹'=>1,'⼺'=>1,'â¼»'=>1,'â¼¼'=>1,'â¼½'=>1,'â¼¾'=>1,'⼿'=>1,'â½€'=>1,'â½'=>1,'⽂'=>1,'⽃'=>1,'⽄'=>1,'â½…'=>1,'⽆'=>1,'⽇'=>1,'⽈'=>1,'⽉'=>1,'⽊'=>1,'⽋'=>1,'⽌'=>1,'â½'=>1,'⽎'=>1,'â½'=>1,'â½'=>1,'⽑'=>1,'â½’'=>1,'⽓'=>1,'â½”'=>1,'⽕'=>1,'â½–'=>1,'â½—'=>1,'⽘'=>1,'â½™'=>1,'⽚'=>1,'â½›'=>1,'⽜'=>1,'â½'=>1,'⽞'=>1,'⽟'=>1,'â½ '=>1,'⽡'=>1,'â½¢'=>1,'â½£'=>1,'⽤'=>1,'â½¥'=>1,'⽦'=>1,'â½§'=>1,'⽨'=>1,'⽩'=>1,'⽪'=>1,'⽫'=>1,'⽬'=>1,'â½'=>1,'â½®'=>1,'⽯'=>1,'â½°'=>1,'â½±'=>1,'â½²'=>1,'â½³'=>1,'â½´'=>1,'â½µ'=>1,'â½¶'=>1,'â½·'=>1,'⽸'=>1,'â½¹'=>1,'⽺'=>1,'â½»'=>1,'â½¼'=>1,'â½½'=>1,'â½¾'=>1,'⽿'=>1,'â¾€'=>1,'â¾'=>1,'⾂'=>1,'⾃'=>1,'⾄'=>1,'â¾…'=>1,'⾆'=>1,'⾇'=>1,'⾈'=>1,'⾉'=>1,'⾊'=>1,'⾋'=>1,'⾌'=>1,'â¾'=>1,'⾎'=>1,'â¾'=>1,'â¾'=>1,'⾑'=>1,'â¾’'=>1,'⾓'=>1,'â¾”'=>1,'⾕'=>1,'â¾–'=>1,'â¾—'=>1,'⾘'=>1,'â¾™'=>1,'⾚'=>1,'â¾›'=>1,'⾜'=>1,'â¾'=>1,'⾞'=>1,'⾟'=>1,'â¾ '=>1,'⾡'=>1,'â¾¢'=>1,'â¾£'=>1,'⾤'=>1,'â¾¥'=>1,'⾦'=>1,'â¾§'=>1,'⾨'=>1,'⾩'=>1,'⾪'=>1,'⾫'=>1,'⾬'=>1,'â¾'=>1,'â¾®'=>1,'⾯'=>1,'â¾°'=>1,'â¾±'=>1,'â¾²'=>1,'â¾³'=>1,'â¾´'=>1,'â¾µ'=>1,'â¾¶'=>1,'â¾·'=>1,'⾸'=>1,'â¾¹'=>1,'⾺'=>1,'â¾»'=>1,'â¾¼'=>1,'â¾½'=>1,'â¾¾'=>1,'⾿'=>1,'â¿€'=>1,'â¿'=>1,'â¿‚'=>1,'⿃'=>1,'â¿„'=>1,'â¿…'=>1,'⿆'=>1,'⿇'=>1,'⿈'=>1,'⿉'=>1,'⿊'=>1,'â¿‹'=>1,'⿌'=>1,'â¿'=>1,'⿎'=>1,'â¿'=>1,'â¿'=>1,'â¿‘'=>1,'â¿’'=>1,'â¿“'=>1,'â¿”'=>1,'â¿•'=>1,' '=>1,'〶'=>1,'〸'=>1,'〹'=>1,'〺'=>1,'ã‚›'=>1,'゜'=>1,'ゟ'=>1,'ヿ'=>1,'ㄱ'=>1,'ㄲ'=>1,'ㄳ'=>1,'ã„´'=>1,'ㄵ'=>1,'ã„¶'=>1,'ã„·'=>1,'ㄸ'=>1,'ㄹ'=>1,'ㄺ'=>1,'ã„»'=>1,'ㄼ'=>1,'ㄽ'=>1,'ㄾ'=>1,'ã„¿'=>1,'ã…€'=>1,'ã…'=>1,'ã…‚'=>1,'ã…ƒ'=>1,'ã…„'=>1,'ã……'=>1,'ã…†'=>1,'ã…‡'=>1,'ã…ˆ'=>1,'ã…‰'=>1,'ã…Š'=>1,'ã…‹'=>1,'ã…Œ'=>1,'ã…'=>1,'ã…Ž'=>1,'ã…'=>1,'ã…'=>1,'ã…‘'=>1,'ã…’'=>1,'ã…“'=>1,'ã…”'=>1,'ã…•'=>1,'ã…–'=>1,'ã…—'=>1,'ã…˜'=>1,'ã…™'=>1,'ã…š'=>1,'ã…›'=>1,'ã…œ'=>1,'ã…'=>1,'ã…ž'=>1,'ã…Ÿ'=>1,'ã… '=>1,'ã…¡'=>1,'ã…¢'=>1,'ã…£'=>1,'ã…¤'=>1,'ã…¥'=>1,'ã…¦'=>1,'ã…§'=>1,'ã…¨'=>1,'ã…©'=>1,'ã…ª'=>1,'ã…«'=>1,'ã…¬'=>1,'ã…'=>1,'ã…®'=>1,'ã…¯'=>1,'ã…°'=>1,'ã…±'=>1,'ã…²'=>1,'ã…³'=>1,'ã…´'=>1,'ã…µ'=>1,'ã…¶'=>1,'ã…·'=>1,'ã…¸'=>1,'ã…¹'=>1,'ã…º'=>1,'ã…»'=>1,'ã…¼'=>1,'ã…½'=>1,'ã…¾'=>1,'ã…¿'=>1,'ㆀ'=>1,'ã†'=>1,'ㆂ'=>1,'ㆃ'=>1,'ㆄ'=>1,'ㆅ'=>1,'ㆆ'=>1,'ㆇ'=>1,'ㆈ'=>1,'ㆉ'=>1,'ㆊ'=>1,'ㆋ'=>1,'ㆌ'=>1,'ã†'=>1,'ㆎ'=>1,'㆒'=>1,'㆓'=>1,'㆔'=>1,'㆕'=>1,'㆖'=>1,'㆗'=>1,'㆘'=>1,'㆙'=>1,'㆚'=>1,'㆛'=>1,'㆜'=>1,'ã†'=>1,'㆞'=>1,'㆟'=>1,'㈀'=>1,'ãˆ'=>1,'㈂'=>1,'㈃'=>1,'㈄'=>1,'㈅'=>1,'㈆'=>1,'㈇'=>1,'㈈'=>1,'㈉'=>1,'㈊'=>1,'㈋'=>1,'㈌'=>1,'ãˆ'=>1,'㈎'=>1,'ãˆ'=>1,'ãˆ'=>1,'㈑'=>1,'㈒'=>1,'㈓'=>1,'㈔'=>1,'㈕'=>1,'㈖'=>1,'㈗'=>1,'㈘'=>1,'㈙'=>1,'㈚'=>1,'㈛'=>1,'㈜'=>1,'ãˆ'=>1,'㈞'=>1,'㈠'=>1,'㈡'=>1,'㈢'=>1,'㈣'=>1,'㈤'=>1,'㈥'=>1,'㈦'=>1,'㈧'=>1,'㈨'=>1,'㈩'=>1,'㈪'=>1,'㈫'=>1,'㈬'=>1,'ãˆ'=>1,'㈮'=>1,'㈯'=>1,'㈰'=>1,'㈱'=>1,'㈲'=>1,'㈳'=>1,'㈴'=>1,'㈵'=>1,'㈶'=>1,'㈷'=>1,'㈸'=>1,'㈹'=>1,'㈺'=>1,'㈻'=>1,'㈼'=>1,'㈽'=>1,'㈾'=>1,'㈿'=>1,'㉀'=>1,'ã‰'=>1,'㉂'=>1,'㉃'=>1,'ã‰'=>1,'㉑'=>1,'㉒'=>1,'㉓'=>1,'㉔'=>1,'㉕'=>1,'㉖'=>1,'㉗'=>1,'㉘'=>1,'㉙'=>1,'㉚'=>1,'㉛'=>1,'㉜'=>1,'ã‰'=>1,'㉞'=>1,'㉟'=>1,'㉠'=>1,'㉡'=>1,'㉢'=>1,'㉣'=>1,'㉤'=>1,'㉥'=>1,'㉦'=>1,'㉧'=>1,'㉨'=>1,'㉩'=>1,'㉪'=>1,'㉫'=>1,'㉬'=>1,'ã‰'=>1,'㉮'=>1,'㉯'=>1,'㉰'=>1,'㉱'=>1,'㉲'=>1,'㉳'=>1,'㉴'=>1,'㉵'=>1,'㉶'=>1,'㉷'=>1,'㉸'=>1,'㉹'=>1,'㉺'=>1,'㉻'=>1,'㉼'=>1,'㉽'=>1,'㉾'=>1,'㊀'=>1,'ãŠ'=>1,'㊂'=>1,'㊃'=>1,'㊄'=>1,'㊅'=>1,'㊆'=>1,'㊇'=>1,'㊈'=>1,'㊉'=>1,'㊊'=>1,'㊋'=>1,'㊌'=>1,'ãŠ'=>1,'㊎'=>1,'ãŠ'=>1,'ãŠ'=>1,'㊑'=>1,'㊒'=>1,'㊓'=>1,'㊔'=>1,'㊕'=>1,'㊖'=>1,'㊗'=>1,'㊘'=>1,'㊙'=>1,'㊚'=>1,'㊛'=>1,'㊜'=>1,'ãŠ'=>1,'㊞'=>1,'㊟'=>1,'㊠'=>1,'㊡'=>1,'㊢'=>1,'㊣'=>1,'㊤'=>1,'㊥'=>1,'㊦'=>1,'㊧'=>1,'㊨'=>1,'㊩'=>1,'㊪'=>1,'㊫'=>1,'㊬'=>1,'ãŠ'=>1,'㊮'=>1,'㊯'=>1,'㊰'=>1,'㊱'=>1,'㊲'=>1,'㊳'=>1,'㊴'=>1,'㊵'=>1,'㊶'=>1,'㊷'=>1,'㊸'=>1,'㊹'=>1,'㊺'=>1,'㊻'=>1,'㊼'=>1,'㊽'=>1,'㊾'=>1,'㊿'=>1,'ã‹€'=>1,'ã‹'=>1,'ã‹‚'=>1,'㋃'=>1,'ã‹„'=>1,'ã‹…'=>1,'㋆'=>1,'㋇'=>1,'㋈'=>1,'㋉'=>1,'㋊'=>1,'ã‹‹'=>1,'㋌'=>1,'ã‹'=>1,'㋎'=>1,'ã‹'=>1,'ã‹'=>1,'ã‹‘'=>1,'ã‹’'=>1,'ã‹“'=>1,'ã‹”'=>1,'ã‹•'=>1,'ã‹–'=>1,'ã‹—'=>1,'㋘'=>1,'ã‹™'=>1,'㋚'=>1,'ã‹›'=>1,'㋜'=>1,'ã‹'=>1,'㋞'=>1,'㋟'=>1,'ã‹ '=>1,'ã‹¡'=>1,'ã‹¢'=>1,'ã‹£'=>1,'㋤'=>1,'ã‹¥'=>1,'㋦'=>1,'ã‹§'=>1,'㋨'=>1,'ã‹©'=>1,'㋪'=>1,'ã‹«'=>1,'㋬'=>1,'ã‹'=>1,'ã‹®'=>1,'㋯'=>1,'ã‹°'=>1,'㋱'=>1,'㋲'=>1,'㋳'=>1,'ã‹´'=>1,'㋵'=>1,'ã‹¶'=>1,'ã‹·'=>1,'㋸'=>1,'㋹'=>1,'㋺'=>1,'ã‹»'=>1,'㋼'=>1,'㋽'=>1,'㋾'=>1,'㌀'=>1,'ãŒ'=>1,'㌂'=>1,'㌃'=>1,'㌄'=>1,'㌅'=>1,'㌆'=>1,'㌇'=>1,'㌈'=>1,'㌉'=>1,'㌊'=>1,'㌋'=>1,'㌌'=>1,'ãŒ'=>1,'㌎'=>1,'ãŒ'=>1,'ãŒ'=>1,'㌑'=>1,'㌒'=>1,'㌓'=>1,'㌔'=>1,'㌕'=>1,'㌖'=>1,'㌗'=>1,'㌘'=>1,'㌙'=>1,'㌚'=>1,'㌛'=>1,'㌜'=>1,'ãŒ'=>1,'㌞'=>1,'㌟'=>1,'㌠'=>1,'㌡'=>1,'㌢'=>1,'㌣'=>1,'㌤'=>1,'㌥'=>1,'㌦'=>1,'㌧'=>1,'㌨'=>1,'㌩'=>1,'㌪'=>1,'㌫'=>1,'㌬'=>1,'ãŒ'=>1,'㌮'=>1,'㌯'=>1,'㌰'=>1,'㌱'=>1,'㌲'=>1,'㌳'=>1,'㌴'=>1,'㌵'=>1,'㌶'=>1,'㌷'=>1,'㌸'=>1,'㌹'=>1,'㌺'=>1,'㌻'=>1,'㌼'=>1,'㌽'=>1,'㌾'=>1,'㌿'=>1,'ã€'=>1,'ã'=>1,'ã‚'=>1,'ãƒ'=>1,'ã„'=>1,'ã…'=>1,'ã†'=>1,'ã‡'=>1,'ãˆ'=>1,'ã‰'=>1,'ãŠ'=>1,'ã‹'=>1,'ãŒ'=>1,'ã'=>1,'ãŽ'=>1,'ã'=>1,'ã'=>1,'ã‘'=>1,'ã’'=>1,'ã“'=>1,'ã”'=>1,'ã•'=>1,'ã–'=>1,'ã—'=>1,'ã˜'=>1,'ã™'=>1,'ãš'=>1,'ã›'=>1,'ãœ'=>1,'ã'=>1,'ãž'=>1,'ãŸ'=>1,'ã '=>1,'ã¡'=>1,'ã¢'=>1,'ã£'=>1,'ã¤'=>1,'ã¥'=>1,'ã¦'=>1,'ã§'=>1,'ã¨'=>1,'ã©'=>1,'ãª'=>1,'ã«'=>1,'ã¬'=>1,'ã'=>1,'ã®'=>1,'ã¯'=>1,'ã°'=>1,'ã±'=>1,'ã²'=>1,'ã³'=>1,'ã´'=>1,'ãµ'=>1,'ã¶'=>1,'ã·'=>1,'ã¸'=>1,'ã¹'=>1,'ãº'=>1,'ã»'=>1,'ã¼'=>1,'ã½'=>1,'ã¾'=>1,'ã¿'=>1,'㎀'=>1,'ãŽ'=>1,'㎂'=>1,'㎃'=>1,'㎄'=>1,'㎅'=>1,'㎆'=>1,'㎇'=>1,'㎈'=>1,'㎉'=>1,'㎊'=>1,'㎋'=>1,'㎌'=>1,'ãŽ'=>1,'㎎'=>1,'ãŽ'=>1,'ãŽ'=>1,'㎑'=>1,'㎒'=>1,'㎓'=>1,'㎔'=>1,'㎕'=>1,'㎖'=>1,'㎗'=>1,'㎘'=>1,'㎙'=>1,'㎚'=>1,'㎛'=>1,'㎜'=>1,'ãŽ'=>1,'㎞'=>1,'㎟'=>1,'㎠'=>1,'㎡'=>1,'㎢'=>1,'㎣'=>1,'㎤'=>1,'㎥'=>1,'㎦'=>1,'㎧'=>1,'㎨'=>1,'㎩'=>1,'㎪'=>1,'㎫'=>1,'㎬'=>1,'ãŽ'=>1,'㎮'=>1,'㎯'=>1,'㎰'=>1,'㎱'=>1,'㎲'=>1,'㎳'=>1,'㎴'=>1,'㎵'=>1,'㎶'=>1,'㎷'=>1,'㎸'=>1,'㎹'=>1,'㎺'=>1,'㎻'=>1,'㎼'=>1,'㎽'=>1,'㎾'=>1,'㎿'=>1,'ã€'=>1,'ã'=>1,'ã‚'=>1,'ãƒ'=>1,'ã„'=>1,'ã…'=>1,'ã†'=>1,'ã‡'=>1,'ãˆ'=>1,'ã‰'=>1,'ãŠ'=>1,'ã‹'=>1,'ãŒ'=>1,'ã'=>1,'ãŽ'=>1,'ã'=>1,'ã'=>1,'ã‘'=>1,'ã’'=>1,'ã“'=>1,'ã”'=>1,'ã•'=>1,'ã–'=>1,'ã—'=>1,'ã˜'=>1,'ã™'=>1,'ãš'=>1,'ã›'=>1,'ãœ'=>1,'ã'=>1,'ãž'=>1,'ãŸ'=>1,'ã '=>1,'ã¡'=>1,'ã¢'=>1,'ã£'=>1,'ã¤'=>1,'ã¥'=>1,'ã¦'=>1,'ã§'=>1,'ã¨'=>1,'ã©'=>1,'ãª'=>1,'ã«'=>1,'ã¬'=>1,'ã'=>1,'ã®'=>1,'ã¯'=>1,'ã°'=>1,'ã±'=>1,'ã²'=>1,'ã³'=>1,'ã´'=>1,'ãµ'=>1,'ã¶'=>1,'ã·'=>1,'ã¸'=>1,'ã¹'=>1,'ãº'=>1,'ã»'=>1,'ã¼'=>1,'ã½'=>1,'ã¾'=>1,'ã¿'=>1,'豈'=>1,'ï¤'=>1,'車'=>1,'賈'=>1,'滑'=>1,'串'=>1,'句'=>1,'龜'=>1,'龜'=>1,'契'=>1,'金'=>1,'喇'=>1,'奈'=>1,'ï¤'=>1,'癩'=>1,'ï¤'=>1,'ï¤'=>1,'螺'=>1,'裸'=>1,'邏'=>1,'樂'=>1,'洛'=>1,'烙'=>1,'珞'=>1,'落'=>1,'酪'=>1,'駱'=>1,'亂'=>1,'卵'=>1,'ï¤'=>1,'爛'=>1,'蘭'=>1,'ï¤ '=>1,'嵐'=>1,'濫'=>1,'藍'=>1,'襤'=>1,'拉'=>1,'臘'=>1,'蠟'=>1,'廊'=>1,'朗'=>1,'浪'=>1,'狼'=>1,'郎'=>1,'ï¤'=>1,'冷'=>1,'勞'=>1,'擄'=>1,'櫓'=>1,'爐'=>1,'盧'=>1,'老'=>1,'蘆'=>1,'虜'=>1,'路'=>1,'露'=>1,'魯'=>1,'鷺'=>1,'碌'=>1,'祿'=>1,'綠'=>1,'菉'=>1,'錄'=>1,'鹿'=>1,'ï¥'=>1,'壟'=>1,'弄'=>1,'籠'=>1,'聾'=>1,'牢'=>1,'磊'=>1,'賂'=>1,'雷'=>1,'壘'=>1,'屢'=>1,'樓'=>1,'ï¥'=>1,'漏'=>1,'ï¥'=>1,'ï¥'=>1,'陋'=>1,'勒'=>1,'肋'=>1,'凜'=>1,'凌'=>1,'稜'=>1,'綾'=>1,'菱'=>1,'陵'=>1,'讀'=>1,'拏'=>1,'樂'=>1,'ï¥'=>1,'丹'=>1,'寧'=>1,'ï¥ '=>1,'率'=>1,'異'=>1,'北'=>1,'磻'=>1,'便'=>1,'復'=>1,'不'=>1,'泌'=>1,'數'=>1,'索'=>1,'參'=>1,'塞'=>1,'ï¥'=>1,'葉'=>1,'說'=>1,'殺'=>1,'辰'=>1,'沈'=>1,'拾'=>1,'若'=>1,'掠'=>1,'略'=>1,'亮'=>1,'兩'=>1,'凉'=>1,'梁'=>1,'糧'=>1,'良'=>1,'諒'=>1,'量'=>1,'勵'=>1,'呂'=>1,'ï¦'=>1,'廬'=>1,'旅'=>1,'濾'=>1,'礪'=>1,'閭'=>1,'驪'=>1,'麗'=>1,'黎'=>1,'力'=>1,'曆'=>1,'歷'=>1,'ï¦'=>1,'年'=>1,'ï¦'=>1,'ï¦'=>1,'撚'=>1,'漣'=>1,'煉'=>1,'璉'=>1,'秊'=>1,'練'=>1,'聯'=>1,'輦'=>1,'蓮'=>1,'連'=>1,'鍊'=>1,'列'=>1,'ï¦'=>1,'咽'=>1,'烈'=>1,'ï¦ '=>1,'說'=>1,'廉'=>1,'念'=>1,'捻'=>1,'殮'=>1,'簾'=>1,'獵'=>1,'令'=>1,'囹'=>1,'寧'=>1,'嶺'=>1,'怜'=>1,'ï¦'=>1,'瑩'=>1,'羚'=>1,'聆'=>1,'鈴'=>1,'零'=>1,'靈'=>1,'領'=>1,'例'=>1,'禮'=>1,'醴'=>1,'隸'=>1,'惡'=>1,'了'=>1,'僚'=>1,'寮'=>1,'尿'=>1,'料'=>1,'樂'=>1,'ï§€'=>1,'ï§'=>1,'ï§‚'=>1,'遼'=>1,'ï§„'=>1,'ï§…'=>1,'阮'=>1,'劉'=>1,'杻'=>1,'柳'=>1,'ï§Š'=>1,'ï§‹'=>1,'ï§Œ'=>1,'ï§'=>1,'ï§Ž'=>1,'ï§'=>1,'ï§'=>1,'ï§‘'=>1,'ï§’'=>1,'ï§“'=>1,'ï§”'=>1,'ï§•'=>1,'ï§–'=>1,'ï§—'=>1,'律'=>1,'ï§™'=>1,'ï§š'=>1,'ï§›'=>1,'ï§œ'=>1,'ï§'=>1,'ï§ž'=>1,'ï§Ÿ'=>1,'ï§ '=>1,'ï§¡'=>1,'ï§¢'=>1,'ï§£'=>1,'理'=>1,'ï§¥'=>1,'罹'=>1,'ï§§'=>1,'裡'=>1,'ï§©'=>1,'離'=>1,'ï§«'=>1,'溺'=>1,'ï§'=>1,'ï§®'=>1,'璘'=>1,'ï§°'=>1,'ï§±'=>1,'ï§²'=>1,'ï§³'=>1,'ï§´'=>1,'ï§µ'=>1,'ï§¶'=>1,'ï§·'=>1,'笠'=>1,'ï§¹'=>1,'狀'=>1,'ï§»'=>1,'ï§¼'=>1,'ï§½'=>1,'ï§¾'=>1,'ï§¿'=>1,'切'=>1,'ï¨'=>1,'拓'=>1,'糖'=>1,'宅'=>1,'洞'=>1,'暴'=>1,'輻'=>1,'行'=>1,'降'=>1,'見'=>1,'廓'=>1,'兀'=>1,'ï¨'=>1,'ï¨'=>1,'晴'=>1,'凞'=>1,'猪'=>1,'益'=>1,'礼'=>1,'神'=>1,'祥'=>1,'福'=>1,'靖'=>1,'ï¨'=>1,'羽'=>1,'ï¨ '=>1,'諸'=>1,'逸'=>1,'都'=>1,'飯'=>1,'飼'=>1,'館'=>1,'ï¨'=>1,'侮'=>1,'僧'=>1,'免'=>1,'勉'=>1,'勤'=>1,'卑'=>1,'喝'=>1,'嘆'=>1,'器'=>1,'塀'=>1,'墨'=>1,'層'=>1,'屮'=>1,'悔'=>1,'慨'=>1,'憎'=>1,'ï©€'=>1,'ï©'=>1,'ï©‚'=>1,'暑'=>1,'ï©„'=>1,'ï©…'=>1,'渚'=>1,'漢'=>1,'煮'=>1,'爫'=>1,'琢'=>1,'ï©‹'=>1,'社'=>1,'ï©'=>1,'祈'=>1,'ï©'=>1,'ï©'=>1,'ï©‘'=>1,'ï©’'=>1,'ï©“'=>1,'ï©”'=>1,'ï©•'=>1,'ï©–'=>1,'ï©—'=>1,'縉'=>1,'ï©™'=>1,'署'=>1,'ï©›'=>1,'臭'=>1,'ï©'=>1,'艹'=>1,'著'=>1,'ï© '=>1,'ï©¡'=>1,'ï©¢'=>1,'ï©£'=>1,'賓'=>1,'ï©¥'=>1,'辶'=>1,'ï©§'=>1,'難'=>1,'ï©©'=>1,'頻'=>1,'ï©°'=>1,'况'=>1,'全'=>1,'侀'=>1,'ï©´'=>1,'冀'=>1,'ï©¶'=>1,'ï©·'=>1,'喝'=>1,'啕'=>1,'喙'=>1,'ï©»'=>1,'塚'=>1,'墳'=>1,'奄'=>1,'ï©¿'=>1,'婢'=>1,'ïª'=>1,'廒'=>1,'廙'=>1,'彩'=>1,'徭'=>1,'惘'=>1,'慎'=>1,'愈'=>1,'憎'=>1,'慠'=>1,'懲'=>1,'戴'=>1,'ïª'=>1,'搜'=>1,'ïª'=>1,'ïª'=>1,'晴'=>1,'朗'=>1,'望'=>1,'杖'=>1,'歹'=>1,'殺'=>1,'流'=>1,'滛'=>1,'滋'=>1,'漢'=>1,'瀞'=>1,'煮'=>1,'ïª'=>1,'爵'=>1,'犯'=>1,'ïª '=>1,'瑱'=>1,'甆'=>1,'画'=>1,'瘝'=>1,'瘟'=>1,'益'=>1,'盛'=>1,'直'=>1,'睊'=>1,'着'=>1,'磌'=>1,'窱'=>1,'ïª'=>1,'类'=>1,'絛'=>1,'練'=>1,'缾'=>1,'者'=>1,'荒'=>1,'華'=>1,'蝹'=>1,'襁'=>1,'覆'=>1,'視'=>1,'調'=>1,'諸'=>1,'請'=>1,'謁'=>1,'諾'=>1,'諭'=>1,'謹'=>1,'ï«€'=>1,'ï«'=>1,'ï«‚'=>1,'遲'=>1,'ï«„'=>1,'ï«…'=>1,'陼'=>1,'難'=>1,'靖'=>1,'韛'=>1,'響'=>1,'ï«‹'=>1,'頻'=>1,'ï«'=>1,'龜'=>1,'ï«'=>1,'ï«'=>1,'ï«‘'=>1,'ï«’'=>1,'ï«“'=>1,'ï«”'=>1,'ï«•'=>1,'ï«–'=>1,'ï«—'=>1,'齃'=>1,'ï«™'=>1,'ff'=>1,'ï¬'=>1,'fl'=>1,'ffi'=>1,'ffl'=>1,'ſt'=>1,'st'=>1,'ﬓ'=>1,'ﬔ'=>1,'ﬕ'=>1,'ﬖ'=>1,'ﬗ'=>1,'ï¬'=>1,'ײַ'=>1,'ï¬ '=>1,'ﬡ'=>1,'ﬢ'=>1,'ﬣ'=>1,'ﬤ'=>1,'ﬥ'=>1,'ﬦ'=>1,'ﬧ'=>1,'ﬨ'=>1,'﬩'=>1,'שׁ'=>1,'שׂ'=>1,'שּׁ'=>1,'ï¬'=>1,'אַ'=>1,'אָ'=>1,'אּ'=>1,'בּ'=>1,'גּ'=>1,'דּ'=>1,'הּ'=>1,'וּ'=>1,'זּ'=>1,'טּ'=>1,'יּ'=>1,'ךּ'=>1,'כּ'=>1,'לּ'=>1,'מּ'=>1,'ï€'=>1,'ï'=>1,'ïƒ'=>1,'ï„'=>1,'ï†'=>1,'ï‡'=>1,'ïˆ'=>1,'ï‰'=>1,'ïŠ'=>1,'ï‹'=>1,'ïŒ'=>1,'ï'=>1,'ïŽ'=>1,'ï'=>1,'ï'=>1,'ï‘'=>1,'ï’'=>1,'ï“'=>1,'ï”'=>1,'ï•'=>1,'ï–'=>1,'ï—'=>1,'ï˜'=>1,'ï™'=>1,'ïš'=>1,'ï›'=>1,'ïœ'=>1,'ï'=>1,'ïž'=>1,'ïŸ'=>1,'ï '=>1,'ï¡'=>1,'ï¢'=>1,'ï£'=>1,'ï¤'=>1,'ï¥'=>1,'ï¦'=>1,'ï§'=>1,'ï¨'=>1,'ï©'=>1,'ïª'=>1,'ï«'=>1,'ï¬'=>1,'ï'=>1,'ï®'=>1,'ï¯'=>1,'ï°'=>1,'ï±'=>1,'ï²'=>1,'ï³'=>1,'ï´'=>1,'ïµ'=>1,'ï¶'=>1,'ï·'=>1,'ï¸'=>1,'ï¹'=>1,'ïº'=>1,'ï»'=>1,'ï¼'=>1,'ï½'=>1,'ï¾'=>1,'ï¿'=>1,'ﮀ'=>1,'ï®'=>1,'ﮂ'=>1,'ﮃ'=>1,'ﮄ'=>1,'ï®…'=>1,'ﮆ'=>1,'ﮇ'=>1,'ﮈ'=>1,'ﮉ'=>1,'ﮊ'=>1,'ﮋ'=>1,'ﮌ'=>1,'ï®'=>1,'ﮎ'=>1,'ï®'=>1,'ï®'=>1,'ﮑ'=>1,'ï®’'=>1,'ﮓ'=>1,'ï®”'=>1,'ﮕ'=>1,'ï®–'=>1,'ï®—'=>1,'ﮘ'=>1,'ï®™'=>1,'ﮚ'=>1,'ï®›'=>1,'ﮜ'=>1,'ï®'=>1,'ﮞ'=>1,'ﮟ'=>1,'ï® '=>1,'ﮡ'=>1,'ﮢ'=>1,'ﮣ'=>1,'ﮤ'=>1,'ﮥ'=>1,'ﮦ'=>1,'ï®§'=>1,'ﮨ'=>1,'ﮩ'=>1,'ﮪ'=>1,'ﮫ'=>1,'ﮬ'=>1,'ï®'=>1,'ï®®'=>1,'ﮯ'=>1,'ï®°'=>1,'ï®±'=>1,'ﯓ'=>1,'ﯔ'=>1,'ﯕ'=>1,'ﯖ'=>1,'ﯗ'=>1,'ﯘ'=>1,'ﯙ'=>1,'ﯚ'=>1,'ﯛ'=>1,'ﯜ'=>1,'ï¯'=>1,'ﯞ'=>1,'ﯟ'=>1,'ï¯ '=>1,'ﯡ'=>1,'ﯢ'=>1,'ﯣ'=>1,'ﯤ'=>1,'ﯥ'=>1,'ﯦ'=>1,'ﯧ'=>1,'ﯨ'=>1,'ﯩ'=>1,'ﯪ'=>1,'ﯫ'=>1,'ﯬ'=>1,'ï¯'=>1,'ﯮ'=>1,'ﯯ'=>1,'ﯰ'=>1,'ﯱ'=>1,'ﯲ'=>1,'ﯳ'=>1,'ﯴ'=>1,'ﯵ'=>1,'ﯶ'=>1,'ﯷ'=>1,'ﯸ'=>1,'ﯹ'=>1,'ﯺ'=>1,'ﯻ'=>1,'ﯼ'=>1,'ﯽ'=>1,'ﯾ'=>1,'ﯿ'=>1,'ï°€'=>1,'ï°'=>1,'ï°‚'=>1,'ï°ƒ'=>1,'ï°„'=>1,'ï°…'=>1,'ï°†'=>1,'ï°‡'=>1,'ï°ˆ'=>1,'ï°‰'=>1,'ï°Š'=>1,'ï°‹'=>1,'ï°Œ'=>1,'ï°'=>1,'ï°Ž'=>1,'ï°'=>1,'ï°'=>1,'ï°‘'=>1,'ï°’'=>1,'ï°“'=>1,'ï°”'=>1,'ï°•'=>1,'ï°–'=>1,'ï°—'=>1,'ï°˜'=>1,'ï°™'=>1,'ï°š'=>1,'ï°›'=>1,'ï°œ'=>1,'ï°'=>1,'ï°ž'=>1,'ï°Ÿ'=>1,'ï° '=>1,'ï°¡'=>1,'ï°¢'=>1,'ï°£'=>1,'ï°¤'=>1,'ï°¥'=>1,'ï°¦'=>1,'ï°§'=>1,'ï°¨'=>1,'ï°©'=>1,'ï°ª'=>1,'ï°«'=>1,'ï°¬'=>1,'ï°'=>1,'ï°®'=>1,'ï°¯'=>1,'ï°°'=>1,'ï°±'=>1,'ï°²'=>1,'ï°³'=>1,'ï°´'=>1,'ï°µ'=>1,'ï°¶'=>1,'ï°·'=>1,'ï°¸'=>1,'ï°¹'=>1,'ï°º'=>1,'ï°»'=>1,'ï°¼'=>1,'ï°½'=>1,'ï°¾'=>1,'ï°¿'=>1,'ï±€'=>1,'ï±'=>1,'ﱂ'=>1,'ﱃ'=>1,'ﱄ'=>1,'ï±…'=>1,'ﱆ'=>1,'ﱇ'=>1,'ﱈ'=>1,'ﱉ'=>1,'ﱊ'=>1,'ﱋ'=>1,'ﱌ'=>1,'ï±'=>1,'ﱎ'=>1,'ï±'=>1,'ï±'=>1,'ﱑ'=>1,'ï±’'=>1,'ﱓ'=>1,'ï±”'=>1,'ﱕ'=>1,'ï±–'=>1,'ï±—'=>1,'ﱘ'=>1,'ï±™'=>1,'ﱚ'=>1,'ï±›'=>1,'ﱜ'=>1,'ï±'=>1,'ﱞ'=>1,'ﱟ'=>1,'ï± '=>1,'ﱡ'=>1,'ï±¢'=>1,'ï±£'=>1,'ﱤ'=>1,'ï±¥'=>1,'ﱦ'=>1,'ï±§'=>1,'ﱨ'=>1,'ﱩ'=>1,'ﱪ'=>1,'ﱫ'=>1,'ﱬ'=>1,'ï±'=>1,'ï±®'=>1,'ﱯ'=>1,'ï±°'=>1,'ï±±'=>1,'ï±²'=>1,'ï±³'=>1,'ï±´'=>1,'ï±µ'=>1,'ï±¶'=>1,'ï±·'=>1,'ﱸ'=>1,'ï±¹'=>1,'ﱺ'=>1,'ï±»'=>1,'ï±¼'=>1,'ï±½'=>1,'ï±¾'=>1,'ﱿ'=>1,'ï²€'=>1,'ï²'=>1,'ﲂ'=>1,'ﲃ'=>1,'ﲄ'=>1,'ï²…'=>1,'ﲆ'=>1,'ﲇ'=>1,'ﲈ'=>1,'ﲉ'=>1,'ﲊ'=>1,'ﲋ'=>1,'ﲌ'=>1,'ï²'=>1,'ﲎ'=>1,'ï²'=>1,'ï²'=>1,'ﲑ'=>1,'ï²’'=>1,'ﲓ'=>1,'ï²”'=>1,'ﲕ'=>1,'ï²–'=>1,'ï²—'=>1,'ﲘ'=>1,'ï²™'=>1,'ﲚ'=>1,'ï²›'=>1,'ﲜ'=>1,'ï²'=>1,'ﲞ'=>1,'ﲟ'=>1,'ï² '=>1,'ﲡ'=>1,'ï²¢'=>1,'ï²£'=>1,'ﲤ'=>1,'ï²¥'=>1,'ﲦ'=>1,'ï²§'=>1,'ﲨ'=>1,'ﲩ'=>1,'ﲪ'=>1,'ﲫ'=>1,'ﲬ'=>1,'ï²'=>1,'ï²®'=>1,'ﲯ'=>1,'ï²°'=>1,'ï²±'=>1,'ï²²'=>1,'ï²³'=>1,'ï²´'=>1,'ï²µ'=>1,'ï²¶'=>1,'ï²·'=>1,'ﲸ'=>1,'ï²¹'=>1,'ﲺ'=>1,'ï²»'=>1,'ï²¼'=>1,'ï²½'=>1,'ï²¾'=>1,'ﲿ'=>1,'ï³€'=>1,'ï³'=>1,'ﳂ'=>1,'ﳃ'=>1,'ﳄ'=>1,'ï³…'=>1,'ﳆ'=>1,'ﳇ'=>1,'ﳈ'=>1,'ﳉ'=>1,'ﳊ'=>1,'ﳋ'=>1,'ﳌ'=>1,'ï³'=>1,'ﳎ'=>1,'ï³'=>1,'ï³'=>1,'ﳑ'=>1,'ï³’'=>1,'ﳓ'=>1,'ï³”'=>1,'ﳕ'=>1,'ï³–'=>1,'ï³—'=>1,'ﳘ'=>1,'ï³™'=>1,'ﳚ'=>1,'ï³›'=>1,'ﳜ'=>1,'ï³'=>1,'ﳞ'=>1,'ﳟ'=>1,'ï³ '=>1,'ﳡ'=>1,'ï³¢'=>1,'ï³£'=>1,'ﳤ'=>1,'ï³¥'=>1,'ﳦ'=>1,'ï³§'=>1,'ﳨ'=>1,'ﳩ'=>1,'ﳪ'=>1,'ﳫ'=>1,'ﳬ'=>1,'ï³'=>1,'ï³®'=>1,'ﳯ'=>1,'ï³°'=>1,'ï³±'=>1,'ï³²'=>1,'ï³³'=>1,'ï³´'=>1,'ï³µ'=>1,'ï³¶'=>1,'ï³·'=>1,'ﳸ'=>1,'ï³¹'=>1,'ﳺ'=>1,'ï³»'=>1,'ï³¼'=>1,'ï³½'=>1,'ï³¾'=>1,'ﳿ'=>1,'ï´€'=>1,'ï´'=>1,'ï´‚'=>1,'ï´ƒ'=>1,'ï´„'=>1,'ï´…'=>1,'ï´†'=>1,'ï´‡'=>1,'ï´ˆ'=>1,'ï´‰'=>1,'ï´Š'=>1,'ï´‹'=>1,'ï´Œ'=>1,'ï´'=>1,'ï´Ž'=>1,'ï´'=>1,'ï´'=>1,'ï´‘'=>1,'ï´’'=>1,'ï´“'=>1,'ï´”'=>1,'ï´•'=>1,'ï´–'=>1,'ï´—'=>1,'ï´˜'=>1,'ï´™'=>1,'ï´š'=>1,'ï´›'=>1,'ï´œ'=>1,'ï´'=>1,'ï´ž'=>1,'ï´Ÿ'=>1,'ï´ '=>1,'ï´¡'=>1,'ï´¢'=>1,'ï´£'=>1,'ï´¤'=>1,'ï´¥'=>1,'ï´¦'=>1,'ï´§'=>1,'ï´¨'=>1,'ï´©'=>1,'ï´ª'=>1,'ï´«'=>1,'ï´¬'=>1,'ï´'=>1,'ï´®'=>1,'ï´¯'=>1,'ï´°'=>1,'ï´±'=>1,'ï´²'=>1,'ï´³'=>1,'ï´´'=>1,'ï´µ'=>1,'ï´¶'=>1,'ï´·'=>1,'ï´¸'=>1,'ï´¹'=>1,'ï´º'=>1,'ï´»'=>1,'ï´¼'=>1,'ï´½'=>1,'ïµ'=>1,'ﵑ'=>1,'ïµ’'=>1,'ﵓ'=>1,'ïµ”'=>1,'ﵕ'=>1,'ïµ–'=>1,'ïµ—'=>1,'ﵘ'=>1,'ïµ™'=>1,'ﵚ'=>1,'ïµ›'=>1,'ﵜ'=>1,'ïµ'=>1,'ﵞ'=>1,'ﵟ'=>1,'ïµ '=>1,'ﵡ'=>1,'ïµ¢'=>1,'ïµ£'=>1,'ﵤ'=>1,'ïµ¥'=>1,'ﵦ'=>1,'ïµ§'=>1,'ﵨ'=>1,'ﵩ'=>1,'ﵪ'=>1,'ﵫ'=>1,'ﵬ'=>1,'ïµ'=>1,'ïµ®'=>1,'ﵯ'=>1,'ïµ°'=>1,'ïµ±'=>1,'ïµ²'=>1,'ïµ³'=>1,'ïµ´'=>1,'ïµµ'=>1,'ïµ¶'=>1,'ïµ·'=>1,'ﵸ'=>1,'ïµ¹'=>1,'ﵺ'=>1,'ïµ»'=>1,'ïµ¼'=>1,'ïµ½'=>1,'ïµ¾'=>1,'ﵿ'=>1,'ï¶€'=>1,'ï¶'=>1,'ï¶‚'=>1,'ﶃ'=>1,'ï¶„'=>1,'ï¶…'=>1,'ﶆ'=>1,'ﶇ'=>1,'ﶈ'=>1,'ﶉ'=>1,'ï¶Š'=>1,'ï¶‹'=>1,'ï¶Œ'=>1,'ï¶'=>1,'ï¶Ž'=>1,'ï¶'=>1,'ï¶’'=>1,'ï¶“'=>1,'ï¶”'=>1,'ï¶•'=>1,'ï¶–'=>1,'ï¶—'=>1,'ﶘ'=>1,'ï¶™'=>1,'ï¶š'=>1,'ï¶›'=>1,'ï¶œ'=>1,'ï¶'=>1,'ï¶ž'=>1,'ï¶Ÿ'=>1,'ï¶ '=>1,'ï¶¡'=>1,'ï¶¢'=>1,'ï¶£'=>1,'ﶤ'=>1,'ï¶¥'=>1,'ﶦ'=>1,'ï¶§'=>1,'ﶨ'=>1,'ï¶©'=>1,'ﶪ'=>1,'ï¶«'=>1,'ﶬ'=>1,'ï¶'=>1,'ï¶®'=>1,'ﶯ'=>1,'ï¶°'=>1,'ï¶±'=>1,'ï¶²'=>1,'ï¶³'=>1,'ï¶´'=>1,'ï¶µ'=>1,'ï¶¶'=>1,'ï¶·'=>1,'ﶸ'=>1,'ï¶¹'=>1,'ﶺ'=>1,'ï¶»'=>1,'ï¶¼'=>1,'ï¶½'=>1,'ï¶¾'=>1,'ï¶¿'=>1,'ï·€'=>1,'ï·'=>1,'ï·‚'=>1,'ï·ƒ'=>1,'ï·„'=>1,'ï·…'=>1,'ï·†'=>1,'ï·‡'=>1,'ï·°'=>1,'ï·±'=>1,'ï·²'=>1,'ï·³'=>1,'ï·´'=>1,'ï·µ'=>1,'ï·¶'=>1,'ï··'=>1,'ï·¸'=>1,'ï·¹'=>1,'ï·º'=>1,'ï·»'=>1,'ï·¼'=>1,'ï¸'=>1,'︑'=>1,'︒'=>1,'︓'=>1,'︔'=>1,'︕'=>1,'︖'=>1,'︗'=>1,'︘'=>1,'︙'=>1,'︰'=>1,'︱'=>1,'︲'=>1,'︳'=>1,'︴'=>1,'︵'=>1,'︶'=>1,'︷'=>1,'︸'=>1,'︹'=>1,'︺'=>1,'︻'=>1,'︼'=>1,'︽'=>1,'︾'=>1,'︿'=>1,'ï¹€'=>1,'ï¹'=>1,'﹂'=>1,'﹃'=>1,'﹄'=>1,'﹇'=>1,'﹈'=>1,'﹉'=>1,'﹊'=>1,'﹋'=>1,'﹌'=>1,'ï¹'=>1,'﹎'=>1,'ï¹'=>1,'ï¹'=>1,'﹑'=>1,'ï¹’'=>1,'ï¹”'=>1,'﹕'=>1,'ï¹–'=>1,'ï¹—'=>1,'﹘'=>1,'ï¹™'=>1,'﹚'=>1,'ï¹›'=>1,'﹜'=>1,'ï¹'=>1,'﹞'=>1,'﹟'=>1,'ï¹ '=>1,'﹡'=>1,'ï¹¢'=>1,'ï¹£'=>1,'﹤'=>1,'ï¹¥'=>1,'﹦'=>1,'﹨'=>1,'﹩'=>1,'﹪'=>1,'﹫'=>1,'ï¹°'=>1,'ï¹±'=>1,'ï¹²'=>1,'ï¹´'=>1,'ï¹¶'=>1,'ï¹·'=>1,'ﹸ'=>1,'ï¹¹'=>1,'ﹺ'=>1,'ï¹»'=>1,'ï¹¼'=>1,'ï¹½'=>1,'ï¹¾'=>1,'ﹿ'=>1,'ﺀ'=>1,'ïº'=>1,'ﺂ'=>1,'ﺃ'=>1,'ﺄ'=>1,'ﺅ'=>1,'ﺆ'=>1,'ﺇ'=>1,'ﺈ'=>1,'ﺉ'=>1,'ﺊ'=>1,'ﺋ'=>1,'ﺌ'=>1,'ïº'=>1,'ﺎ'=>1,'ïº'=>1,'ïº'=>1,'ﺑ'=>1,'ﺒ'=>1,'ﺓ'=>1,'ﺔ'=>1,'ﺕ'=>1,'ﺖ'=>1,'ﺗ'=>1,'ﺘ'=>1,'ﺙ'=>1,'ﺚ'=>1,'ﺛ'=>1,'ﺜ'=>1,'ïº'=>1,'ﺞ'=>1,'ﺟ'=>1,'ïº '=>1,'ﺡ'=>1,'ﺢ'=>1,'ﺣ'=>1,'ﺤ'=>1,'ﺥ'=>1,'ﺦ'=>1,'ﺧ'=>1,'ﺨ'=>1,'ﺩ'=>1,'ﺪ'=>1,'ﺫ'=>1,'ﺬ'=>1,'ïº'=>1,'ﺮ'=>1,'ﺯ'=>1,'ﺰ'=>1,'ﺱ'=>1,'ﺲ'=>1,'ﺳ'=>1,'ﺴ'=>1,'ﺵ'=>1,'ﺶ'=>1,'ﺷ'=>1,'ﺸ'=>1,'ﺹ'=>1,'ﺺ'=>1,'ﺻ'=>1,'ﺼ'=>1,'ﺽ'=>1,'ﺾ'=>1,'ﺿ'=>1,'ﻀ'=>1,'ï»'=>1,'ﻂ'=>1,'ﻃ'=>1,'ﻄ'=>1,'ï»…'=>1,'ﻆ'=>1,'ﻇ'=>1,'ﻈ'=>1,'ﻉ'=>1,'ﻊ'=>1,'ﻋ'=>1,'ﻌ'=>1,'ï»'=>1,'ﻎ'=>1,'ï»'=>1,'ï»'=>1,'ﻑ'=>1,'ï»’'=>1,'ﻓ'=>1,'ï»”'=>1,'ﻕ'=>1,'ï»–'=>1,'ï»—'=>1,'ﻘ'=>1,'ï»™'=>1,'ﻚ'=>1,'ï»›'=>1,'ﻜ'=>1,'ï»'=>1,'ﻞ'=>1,'ﻟ'=>1,'ï» '=>1,'ﻡ'=>1,'ﻢ'=>1,'ﻣ'=>1,'ﻤ'=>1,'ﻥ'=>1,'ﻦ'=>1,'ï»§'=>1,'ﻨ'=>1,'ﻩ'=>1,'ﻪ'=>1,'ﻫ'=>1,'ﻬ'=>1,'ï»'=>1,'ï»®'=>1,'ﻯ'=>1,'ï»°'=>1,'ï»±'=>1,'ﻲ'=>1,'ﻳ'=>1,'ï»´'=>1,'ﻵ'=>1,'ï»¶'=>1,'ï»·'=>1,'ﻸ'=>1,'ﻹ'=>1,'ﻺ'=>1,'ï»»'=>1,'ﻼ'=>1,'ï¼'=>1,'"'=>1,'#'=>1,'$'=>1,'ï¼…'=>1,'&'=>1,'''=>1,'('=>1,')'=>1,'*'=>1,'+'=>1,','=>1,'ï¼'=>1,'.'=>1,'ï¼'=>1,'ï¼'=>1,'1'=>1,'ï¼’'=>1,'3'=>1,'ï¼”'=>1,'5'=>1,'ï¼–'=>1,'ï¼—'=>1,'8'=>1,'ï¼™'=>1,':'=>1,'ï¼›'=>1,'<'=>1,'ï¼'=>1,'>'=>1,'?'=>1,'ï¼ '=>1,'A'=>1,'ï¼¢'=>1,'ï¼£'=>1,'D'=>1,'ï¼¥'=>1,'F'=>1,'ï¼§'=>1,'H'=>1,'I'=>1,'J'=>1,'K'=>1,'L'=>1,'ï¼'=>1,'ï¼®'=>1,'O'=>1,'ï¼°'=>1,'ï¼±'=>1,'ï¼²'=>1,'ï¼³'=>1,'ï¼´'=>1,'ï¼µ'=>1,'ï¼¶'=>1,'ï¼·'=>1,'X'=>1,'ï¼¹'=>1,'Z'=>1,'ï¼»'=>1,'ï¼¼'=>1,'ï¼½'=>1,'ï¼¾'=>1,'_'=>1,'ï½€'=>1,'ï½'=>1,'b'=>1,'c'=>1,'d'=>1,'ï½…'=>1,'f'=>1,'g'=>1,'h'=>1,'i'=>1,'j'=>1,'k'=>1,'l'=>1,'ï½'=>1,'n'=>1,'ï½'=>1,'ï½'=>1,'q'=>1,'ï½’'=>1,'s'=>1,'ï½”'=>1,'u'=>1,'ï½–'=>1,'ï½—'=>1,'x'=>1,'ï½™'=>1,'z'=>1,'ï½›'=>1,'|'=>1,'ï½'=>1,'~'=>1,'⦅'=>1,'ï½ '=>1,'。'=>1,'ï½¢'=>1,'ï½£'=>1,'、'=>1,'ï½¥'=>1,'ヲ'=>1,'ï½§'=>1,'ィ'=>1,'ゥ'=>1,'ェ'=>1,'ォ'=>1,'ャ'=>1,'ï½'=>1,'ï½®'=>1,'ッ'=>1,'ï½°'=>1,'ï½±'=>1,'ï½²'=>1,'ï½³'=>1,'ï½´'=>1,'ï½µ'=>1,'ï½¶'=>1,'ï½·'=>1,'ク'=>1,'ï½¹'=>1,'コ'=>1,'ï½»'=>1,'ï½¼'=>1,'ï½½'=>1,'ï½¾'=>1,'ソ'=>1,'ï¾€'=>1,'ï¾'=>1,'ツ'=>1,'テ'=>1,'ト'=>1,'ï¾…'=>1,'ニ'=>1,'ヌ'=>1,'ネ'=>1,'ノ'=>1,'ハ'=>1,'ヒ'=>1,'フ'=>1,'ï¾'=>1,'ホ'=>1,'ï¾'=>1,'ï¾'=>1,'ム'=>1,'ï¾’'=>1,'モ'=>1,'ï¾”'=>1,'ユ'=>1,'ï¾–'=>1,'ï¾—'=>1,'リ'=>1,'ï¾™'=>1,'レ'=>1,'ï¾›'=>1,'ワ'=>1,'ï¾'=>1,'゙'=>1,'゚'=>1,'ï¾ '=>1,'ᄀ'=>1,'ï¾¢'=>1,'ï¾£'=>1,'ᄂ'=>1,'ï¾¥'=>1,'ᆭ'=>1,'ï¾§'=>1,'ᄄ'=>1,'ᄅ'=>1,'ᆰ'=>1,'ᆱ'=>1,'ᆲ'=>1,'ï¾'=>1,'ï¾®'=>1,'ᆵ'=>1,'ï¾°'=>1,'ï¾±'=>1,'ï¾²'=>1,'ï¾³'=>1,'ï¾´'=>1,'ï¾µ'=>1,'ï¾¶'=>1,'ï¾·'=>1,'ᄌ'=>1,'ï¾¹'=>1,'ᄎ'=>1,'ï¾»'=>1,'ï¾¼'=>1,'ï¾½'=>1,'ï¾¾'=>1,'ï¿‚'=>1,'ᅢ'=>1,'ï¿„'=>1,'ï¿…'=>1,'ᅥ'=>1,'ᅦ'=>1,'ᅧ'=>1,'ï¿‹'=>1,'ᅩ'=>1,'ï¿'=>1,'ᅫ'=>1,'ï¿'=>1,'ï¿’'=>1,'ï¿“'=>1,'ï¿”'=>1,'ï¿•'=>1,'ï¿–'=>1,'ï¿—'=>1,'ᅳ'=>1,'ï¿›'=>1,'ᅵ'=>1,'ï¿ '=>1,'ï¿¡'=>1,'ï¿¢'=>1,'ï¿£'=>1,'¦'=>1,'ï¿¥'=>1,'₩'=>1,'│'=>1,'ï¿©'=>1,'↑'=>1,'ï¿«'=>1,'↓'=>1,'ï¿'=>1,'ï¿®'=>1,'ð…ž'=>1,'ð…Ÿ'=>1,'ð… '=>1,'ð…¡'=>1,'ð…¢'=>1,'ð…£'=>1,'ð…¤'=>1,'ð†»'=>1,'ð†¼'=>1,'ð†½'=>1,'ð†¾'=>1,'ð†¿'=>1,'ð‡€'=>1,'ð€'=>1,'ð'=>1,'ð‚'=>1,'ðƒ'=>1,'ð„'=>1,'ð…'=>1,'ð†'=>1,'ð‡'=>1,'ðˆ'=>1,'ð‰'=>1,'ðŠ'=>1,'ð‹'=>1,'ðŒ'=>1,'ð'=>1,'ðŽ'=>1,'ð'=>1,'ð'=>1,'ð‘'=>1,'ð’'=>1,'ð“'=>1,'ð”'=>1,'ð•'=>1,'ð–'=>1,'ð—'=>1,'ð˜'=>1,'ð™'=>1,'ðš'=>1,'ð›'=>1,'ðœ'=>1,'ð'=>1,'ðž'=>1,'ðŸ'=>1,'ð '=>1,'ð¡'=>1,'ð¢'=>1,'ð£'=>1,'ð¤'=>1,'ð¥'=>1,'ð¦'=>1,'ð§'=>1,'ð¨'=>1,'ð©'=>1,'ðª'=>1,'ð«'=>1,'ð¬'=>1,'ð'=>1,'ð®'=>1,'ð¯'=>1,'ð°'=>1,'ð±'=>1,'ð²'=>1,'ð³'=>1,'ð´'=>1,'ðµ'=>1,'ð¶'=>1,'ð·'=>1,'ð¸'=>1,'ð¹'=>1,'ðº'=>1,'ð»'=>1,'ð¼'=>1,'ð½'=>1,'ð¾'=>1,'ð¿'=>1,'ð‘€'=>1,'ð‘'=>1,'ð‘‚'=>1,'ð‘ƒ'=>1,'ð‘„'=>1,'ð‘…'=>1,'ð‘†'=>1,'ð‘‡'=>1,'ð‘ˆ'=>1,'ð‘‰'=>1,'ð‘Š'=>1,'ð‘‹'=>1,'ð‘Œ'=>1,'ð‘'=>1,'ð‘Ž'=>1,'ð‘'=>1,'ð‘'=>1,'ð‘‘'=>1,'ð‘’'=>1,'ð‘“'=>1,'ð‘”'=>1,'ð‘–'=>1,'ð‘—'=>1,'ð‘˜'=>1,'ð‘™'=>1,'ð‘š'=>1,'ð‘›'=>1,'ð‘œ'=>1,'ð‘'=>1,'ð‘ž'=>1,'ð‘Ÿ'=>1,'ð‘ '=>1,'ð‘¡'=>1,'ð‘¢'=>1,'ð‘£'=>1,'ð‘¤'=>1,'ð‘¥'=>1,'ð‘¦'=>1,'ð‘§'=>1,'ð‘¨'=>1,'ð‘©'=>1,'ð‘ª'=>1,'ð‘«'=>1,'ð‘¬'=>1,'ð‘'=>1,'ð‘®'=>1,'ð‘¯'=>1,'ð‘°'=>1,'ð‘±'=>1,'ð‘²'=>1,'ð‘³'=>1,'ð‘´'=>1,'ð‘µ'=>1,'ð‘¶'=>1,'ð‘·'=>1,'ð‘¸'=>1,'ð‘¹'=>1,'ð‘º'=>1,'ð‘»'=>1,'ð‘¼'=>1,'ð‘½'=>1,'ð‘¾'=>1,'ð‘¿'=>1,'ð’€'=>1,'ð’'=>1,'ð’‚'=>1,'ð’ƒ'=>1,'ð’„'=>1,'ð’…'=>1,'ð’†'=>1,'ð’‡'=>1,'ð’ˆ'=>1,'ð’‰'=>1,'ð’Š'=>1,'ð’‹'=>1,'ð’Œ'=>1,'ð’'=>1,'ð’Ž'=>1,'ð’'=>1,'ð’'=>1,'ð’‘'=>1,'ð’’'=>1,'ð’“'=>1,'ð’”'=>1,'ð’•'=>1,'ð’–'=>1,'ð’—'=>1,'ð’˜'=>1,'ð’™'=>1,'ð’š'=>1,'ð’›'=>1,'ð’œ'=>1,'ð’ž'=>1,'ð’Ÿ'=>1,'ð’¢'=>1,'ð’¥'=>1,'ð’¦'=>1,'ð’©'=>1,'ð’ª'=>1,'ð’«'=>1,'ð’¬'=>1,'ð’®'=>1,'ð’¯'=>1,'ð’°'=>1,'ð’±'=>1,'ð’²'=>1,'ð’³'=>1,'ð’´'=>1,'ð’µ'=>1,'ð’¶'=>1,'ð’·'=>1,'ð’¸'=>1,'ð’¹'=>1,'ð’»'=>1,'ð’½'=>1,'ð’¾'=>1,'ð’¿'=>1,'ð“€'=>1,'ð“'=>1,'ð“‚'=>1,'ð“ƒ'=>1,'ð“…'=>1,'ð“†'=>1,'ð“‡'=>1,'ð“ˆ'=>1,'ð“‰'=>1,'ð“Š'=>1,'ð“‹'=>1,'ð“Œ'=>1,'ð“'=>1,'ð“Ž'=>1,'ð“'=>1,'ð“'=>1,'ð“‘'=>1,'ð“’'=>1,'ð““'=>1,'ð“”'=>1,'ð“•'=>1,'ð“–'=>1,'ð“—'=>1,'ð“˜'=>1,'ð“™'=>1,'ð“š'=>1,'ð“›'=>1,'ð“œ'=>1,'ð“'=>1,'ð“ž'=>1,'ð“Ÿ'=>1,'ð“ '=>1,'ð“¡'=>1,'ð“¢'=>1,'ð“£'=>1,'ð“¤'=>1,'ð“¥'=>1,'ð“¦'=>1,'ð“§'=>1,'ð“¨'=>1,'ð“©'=>1,'ð“ª'=>1,'ð“«'=>1,'ð“¬'=>1,'ð“'=>1,'ð“®'=>1,'ð“¯'=>1,'ð“°'=>1,'ð“±'=>1,'ð“²'=>1,'ð“³'=>1,'ð“´'=>1,'ð“µ'=>1,'ð“¶'=>1,'ð“·'=>1,'ð“¸'=>1,'ð“¹'=>1,'ð“º'=>1,'ð“»'=>1,'ð“¼'=>1,'ð“½'=>1,'ð“¾'=>1,'ð“¿'=>1,'ð”€'=>1,'ð”'=>1,'ð”‚'=>1,'ð”ƒ'=>1,'ð”„'=>1,'ð”…'=>1,'ð”‡'=>1,'ð”ˆ'=>1,'ð”‰'=>1,'ð”Š'=>1,'ð”'=>1,'ð”Ž'=>1,'ð”'=>1,'ð”'=>1,'ð”‘'=>1,'ð”’'=>1,'ð”“'=>1,'ð””'=>1,'ð”–'=>1,'ð”—'=>1,'ð”˜'=>1,'ð”™'=>1,'ð”š'=>1,'ð”›'=>1,'ð”œ'=>1,'ð”ž'=>1,'ð”Ÿ'=>1,'ð” '=>1,'ð”¡'=>1,'ð”¢'=>1,'ð”£'=>1,'ð”¤'=>1,'ð”¥'=>1,'ð”¦'=>1,'ð”§'=>1,'ð”¨'=>1,'ð”©'=>1,'ð”ª'=>1,'ð”«'=>1,'ð”¬'=>1,'ð”'=>1,'ð”®'=>1,'ð”¯'=>1,'ð”°'=>1,'ð”±'=>1,'ð”²'=>1,'ð”³'=>1,'ð”´'=>1,'ð”µ'=>1,'ð”¶'=>1,'ð”·'=>1,'ð”¸'=>1,'ð”¹'=>1,'ð”»'=>1,'ð”¼'=>1,'ð”½'=>1,'ð”¾'=>1,'ð•€'=>1,'ð•'=>1,'ð•‚'=>1,'ð•ƒ'=>1,'ð•„'=>1,'ð•†'=>1,'ð•Š'=>1,'ð•‹'=>1,'ð•Œ'=>1,'ð•'=>1,'ð•Ž'=>1,'ð•'=>1,'ð•'=>1,'ð•’'=>1,'ð•“'=>1,'ð•”'=>1,'ð••'=>1,'ð•–'=>1,'ð•—'=>1,'ð•˜'=>1,'ð•™'=>1,'ð•š'=>1,'ð•›'=>1,'ð•œ'=>1,'ð•'=>1,'ð•ž'=>1,'ð•Ÿ'=>1,'ð• '=>1,'ð•¡'=>1,'ð•¢'=>1,'ð•£'=>1,'ð•¤'=>1,'ð•¥'=>1,'ð•¦'=>1,'ð•§'=>1,'ð•¨'=>1,'ð•©'=>1,'ð•ª'=>1,'ð•«'=>1,'ð•¬'=>1,'ð•'=>1,'ð•®'=>1,'ð•¯'=>1,'ð•°'=>1,'ð•±'=>1,'ð•²'=>1,'ð•³'=>1,'ð•´'=>1,'ð•µ'=>1,'ð•¶'=>1,'ð•·'=>1,'ð•¸'=>1,'ð•¹'=>1,'ð•º'=>1,'ð•»'=>1,'ð•¼'=>1,'ð•½'=>1,'ð•¾'=>1,'ð•¿'=>1,'ð–€'=>1,'ð–'=>1,'ð–‚'=>1,'ð–ƒ'=>1,'ð–„'=>1,'ð–…'=>1,'ð–†'=>1,'ð–‡'=>1,'ð–ˆ'=>1,'ð–‰'=>1,'ð–Š'=>1,'ð–‹'=>1,'ð–Œ'=>1,'ð–'=>1,'ð–Ž'=>1,'ð–'=>1,'ð–'=>1,'ð–‘'=>1,'ð–’'=>1,'ð–“'=>1,'ð–”'=>1,'ð–•'=>1,'ð––'=>1,'ð–—'=>1,'ð–˜'=>1,'ð–™'=>1,'ð–š'=>1,'ð–›'=>1,'ð–œ'=>1,'ð–'=>1,'ð–ž'=>1,'ð–Ÿ'=>1,'ð– '=>1,'ð–¡'=>1,'ð–¢'=>1,'ð–£'=>1,'ð–¤'=>1,'ð–¥'=>1,'ð–¦'=>1,'ð–§'=>1,'ð–¨'=>1,'ð–©'=>1,'ð–ª'=>1,'ð–«'=>1,'ð–¬'=>1,'ð–'=>1,'ð–®'=>1,'ð–¯'=>1,'ð–°'=>1,'ð–±'=>1,'ð–²'=>1,'ð–³'=>1,'ð–´'=>1,'ð–µ'=>1,'ð–¶'=>1,'ð–·'=>1,'ð–¸'=>1,'ð–¹'=>1,'ð–º'=>1,'ð–»'=>1,'ð–¼'=>1,'ð–½'=>1,'ð–¾'=>1,'ð–¿'=>1,'ð—€'=>1,'ð—'=>1,'ð—‚'=>1,'ð—ƒ'=>1,'ð—„'=>1,'ð—…'=>1,'ð—†'=>1,'ð—‡'=>1,'ð—ˆ'=>1,'ð—‰'=>1,'ð—Š'=>1,'ð—‹'=>1,'ð—Œ'=>1,'ð—'=>1,'ð—Ž'=>1,'ð—'=>1,'ð—'=>1,'ð—‘'=>1,'ð—’'=>1,'ð—“'=>1,'ð—”'=>1,'ð—•'=>1,'ð—–'=>1,'ð——'=>1,'ð—˜'=>1,'ð—™'=>1,'ð—š'=>1,'ð—›'=>1,'ð—œ'=>1,'ð—'=>1,'ð—ž'=>1,'ð—Ÿ'=>1,'ð— '=>1,'ð—¡'=>1,'ð—¢'=>1,'ð—£'=>1,'ð—¤'=>1,'ð—¥'=>1,'ð—¦'=>1,'ð—§'=>1,'ð—¨'=>1,'ð—©'=>1,'ð—ª'=>1,'ð—«'=>1,'ð—¬'=>1,'ð—'=>1,'ð—®'=>1,'ð—¯'=>1,'ð—°'=>1,'ð—±'=>1,'ð—²'=>1,'ð—³'=>1,'ð—´'=>1,'ð—µ'=>1,'ð—¶'=>1,'ð—·'=>1,'ð—¸'=>1,'ð—¹'=>1,'ð—º'=>1,'ð—»'=>1,'ð—¼'=>1,'ð—½'=>1,'ð—¾'=>1,'ð—¿'=>1,'ð˜€'=>1,'ð˜'=>1,'ð˜‚'=>1,'ð˜ƒ'=>1,'ð˜„'=>1,'ð˜…'=>1,'ð˜†'=>1,'ð˜‡'=>1,'ð˜ˆ'=>1,'ð˜‰'=>1,'ð˜Š'=>1,'ð˜‹'=>1,'ð˜Œ'=>1,'ð˜'=>1,'ð˜Ž'=>1,'ð˜'=>1,'ð˜'=>1,'ð˜‘'=>1,'ð˜’'=>1,'ð˜“'=>1,'ð˜”'=>1,'ð˜•'=>1,'ð˜–'=>1,'ð˜—'=>1,'ð˜˜'=>1,'ð˜™'=>1,'ð˜š'=>1,'ð˜›'=>1,'ð˜œ'=>1,'ð˜'=>1,'ð˜ž'=>1,'ð˜Ÿ'=>1,'ð˜ '=>1,'ð˜¡'=>1,'ð˜¢'=>1,'ð˜£'=>1,'ð˜¤'=>1,'ð˜¥'=>1,'ð˜¦'=>1,'ð˜§'=>1,'ð˜¨'=>1,'ð˜©'=>1,'ð˜ª'=>1,'ð˜«'=>1,'ð˜¬'=>1,'ð˜'=>1,'ð˜®'=>1,'ð˜¯'=>1,'ð˜°'=>1,'ð˜±'=>1,'ð˜²'=>1,'ð˜³'=>1,'ð˜´'=>1,'ð˜µ'=>1,'ð˜¶'=>1,'ð˜·'=>1,'ð˜¸'=>1,'ð˜¹'=>1,'ð˜º'=>1,'ð˜»'=>1,'ð˜¼'=>1,'ð˜½'=>1,'ð˜¾'=>1,'ð˜¿'=>1,'ð™€'=>1,'ð™'=>1,'ð™‚'=>1,'ð™ƒ'=>1,'ð™„'=>1,'ð™…'=>1,'ð™†'=>1,'ð™‡'=>1,'ð™ˆ'=>1,'ð™‰'=>1,'ð™Š'=>1,'ð™‹'=>1,'ð™Œ'=>1,'ð™'=>1,'ð™Ž'=>1,'ð™'=>1,'ð™'=>1,'ð™‘'=>1,'ð™’'=>1,'ð™“'=>1,'ð™”'=>1,'ð™•'=>1,'ð™–'=>1,'ð™—'=>1,'ð™˜'=>1,'ð™™'=>1,'ð™š'=>1,'ð™›'=>1,'ð™œ'=>1,'ð™'=>1,'ð™ž'=>1,'ð™Ÿ'=>1,'ð™ '=>1,'ð™¡'=>1,'ð™¢'=>1,'ð™£'=>1,'ð™¤'=>1,'ð™¥'=>1,'ð™¦'=>1,'ð™§'=>1,'ð™¨'=>1,'ð™©'=>1,'ð™ª'=>1,'ð™«'=>1,'ð™¬'=>1,'ð™'=>1,'ð™®'=>1,'ð™¯'=>1,'ð™°'=>1,'ð™±'=>1,'ð™²'=>1,'ð™³'=>1,'ð™´'=>1,'ð™µ'=>1,'ð™¶'=>1,'ð™·'=>1,'ð™¸'=>1,'ð™¹'=>1,'ð™º'=>1,'ð™»'=>1,'ð™¼'=>1,'ð™½'=>1,'ð™¾'=>1,'ð™¿'=>1,'ðš€'=>1,'ðš'=>1,'ðš‚'=>1,'ðšƒ'=>1,'ðš„'=>1,'ðš…'=>1,'ðš†'=>1,'ðš‡'=>1,'ðšˆ'=>1,'ðš‰'=>1,'ðšŠ'=>1,'ðš‹'=>1,'ðšŒ'=>1,'ðš'=>1,'ðšŽ'=>1,'ðš'=>1,'ðš'=>1,'ðš‘'=>1,'ðš’'=>1,'ðš“'=>1,'ðš”'=>1,'ðš•'=>1,'ðš–'=>1,'ðš—'=>1,'ðš˜'=>1,'ðš™'=>1,'ðšš'=>1,'ðš›'=>1,'ðšœ'=>1,'ðš'=>1,'ðšž'=>1,'ðšŸ'=>1,'ðš '=>1,'ðš¡'=>1,'ðš¢'=>1,'ðš£'=>1,'ðš¤'=>1,'ðš¥'=>1,'ðš¨'=>1,'ðš©'=>1,'ðšª'=>1,'ðš«'=>1,'ðš¬'=>1,'ðš'=>1,'ðš®'=>1,'ðš¯'=>1,'ðš°'=>1,'ðš±'=>1,'ðš²'=>1,'ðš³'=>1,'ðš´'=>1,'ðšµ'=>1,'ðš¶'=>1,'ðš·'=>1,'ðš¸'=>1,'ðš¹'=>1,'ðšº'=>1,'ðš»'=>1,'ðš¼'=>1,'ðš½'=>1,'ðš¾'=>1,'ðš¿'=>1,'ð›€'=>1,'ð›'=>1,'ð›‚'=>1,'ð›ƒ'=>1,'ð›„'=>1,'ð›…'=>1,'ð›†'=>1,'ð›‡'=>1,'ð›ˆ'=>1,'ð›‰'=>1,'ð›Š'=>1,'ð›‹'=>1,'ð›Œ'=>1,'ð›'=>1,'ð›Ž'=>1,'ð›'=>1,'ð›'=>1,'ð›‘'=>1,'ð›’'=>1,'ð›“'=>1,'ð›”'=>1,'ð›•'=>1,'ð›–'=>1,'ð›—'=>1,'ð›˜'=>1,'ð›™'=>1,'ð›š'=>1,'ð››'=>1,'ð›œ'=>1,'ð›'=>1,'ð›ž'=>1,'ð›Ÿ'=>1,'ð› '=>1,'ð›¡'=>1,'ð›¢'=>1,'ð›£'=>1,'ð›¤'=>1,'ð›¥'=>1,'ð›¦'=>1,'ð›§'=>1,'ð›¨'=>1,'ð›©'=>1,'ð›ª'=>1,'ð›«'=>1,'ð›¬'=>1,'ð›'=>1,'ð›®'=>1,'ð›¯'=>1,'ð›°'=>1,'ð›±'=>1,'ð›²'=>1,'ð›³'=>1,'ð›´'=>1,'ð›µ'=>1,'ð›¶'=>1,'ð›·'=>1,'ð›¸'=>1,'ð›¹'=>1,'ð›º'=>1,'ð›»'=>1,'ð›¼'=>1,'ð›½'=>1,'ð›¾'=>1,'ð›¿'=>1,'ðœ€'=>1,'ðœ'=>1,'ðœ‚'=>1,'ðœƒ'=>1,'ðœ„'=>1,'ðœ…'=>1,'ðœ†'=>1,'ðœ‡'=>1,'ðœˆ'=>1,'ðœ‰'=>1,'ðœŠ'=>1,'ðœ‹'=>1,'ðœŒ'=>1,'ðœ'=>1,'ðœŽ'=>1,'ðœ'=>1,'ðœ'=>1,'ðœ‘'=>1,'ðœ’'=>1,'ðœ“'=>1,'ðœ”'=>1,'ðœ•'=>1,'ðœ–'=>1,'ðœ—'=>1,'ðœ˜'=>1,'ðœ™'=>1,'ðœš'=>1,'ðœ›'=>1,'ðœœ'=>1,'ðœ'=>1,'ðœž'=>1,'ðœŸ'=>1,'ðœ '=>1,'ðœ¡'=>1,'ðœ¢'=>1,'ðœ£'=>1,'ðœ¤'=>1,'ðœ¥'=>1,'ðœ¦'=>1,'ðœ§'=>1,'ðœ¨'=>1,'ðœ©'=>1,'ðœª'=>1,'ðœ«'=>1,'ðœ¬'=>1,'ðœ'=>1,'ðœ®'=>1,'ðœ¯'=>1,'ðœ°'=>1,'ðœ±'=>1,'ðœ²'=>1,'ðœ³'=>1,'ðœ´'=>1,'ðœµ'=>1,'ðœ¶'=>1,'ðœ·'=>1,'ðœ¸'=>1,'ðœ¹'=>1,'ðœº'=>1,'ðœ»'=>1,'ðœ¼'=>1,'ðœ½'=>1,'ðœ¾'=>1,'ðœ¿'=>1,'ð€'=>1,'ð'=>1,'ð‚'=>1,'ðƒ'=>1,'ð„'=>1,'ð…'=>1,'ð†'=>1,'ð‡'=>1,'ðˆ'=>1,'ð‰'=>1,'ðŠ'=>1,'ð‹'=>1,'ðŒ'=>1,'ð'=>1,'ðŽ'=>1,'ð'=>1,'ð'=>1,'ð‘'=>1,'ð’'=>1,'ð“'=>1,'ð”'=>1,'ð•'=>1,'ð–'=>1,'ð—'=>1,'ð˜'=>1,'ð™'=>1,'ðš'=>1,'ð›'=>1,'ðœ'=>1,'ð'=>1,'ðž'=>1,'ðŸ'=>1,'ð '=>1,'ð¡'=>1,'ð¢'=>1,'ð£'=>1,'ð¤'=>1,'ð¥'=>1,'ð¦'=>1,'ð§'=>1,'ð¨'=>1,'ð©'=>1,'ðª'=>1,'ð«'=>1,'ð¬'=>1,'ð'=>1,'ð®'=>1,'ð¯'=>1,'ð°'=>1,'ð±'=>1,'ð²'=>1,'ð³'=>1,'ð´'=>1,'ðµ'=>1,'ð¶'=>1,'ð·'=>1,'ð¸'=>1,'ð¹'=>1,'ðº'=>1,'ð»'=>1,'ð¼'=>1,'ð½'=>1,'ð¾'=>1,'ð¿'=>1,'ðž€'=>1,'ðž'=>1,'ðž‚'=>1,'ðžƒ'=>1,'ðž„'=>1,'ðž…'=>1,'ðž†'=>1,'ðž‡'=>1,'ðžˆ'=>1,'ðž‰'=>1,'ðžŠ'=>1,'ðž‹'=>1,'ðžŒ'=>1,'ðž'=>1,'ðžŽ'=>1,'ðž'=>1,'ðž'=>1,'ðž‘'=>1,'ðž’'=>1,'ðž“'=>1,'ðž”'=>1,'ðž•'=>1,'ðž–'=>1,'ðž—'=>1,'ðž˜'=>1,'ðž™'=>1,'ðžš'=>1,'ðž›'=>1,'ðžœ'=>1,'ðž'=>1,'ðžž'=>1,'ðžŸ'=>1,'ðž '=>1,'ðž¡'=>1,'ðž¢'=>1,'ðž£'=>1,'ðž¤'=>1,'ðž¥'=>1,'ðž¦'=>1,'ðž§'=>1,'ðž¨'=>1,'ðž©'=>1,'ðžª'=>1,'ðž«'=>1,'ðž¬'=>1,'ðž'=>1,'ðž®'=>1,'ðž¯'=>1,'ðž°'=>1,'ðž±'=>1,'ðž²'=>1,'ðž³'=>1,'ðž´'=>1,'ðžµ'=>1,'ðž¶'=>1,'ðž·'=>1,'ðž¸'=>1,'ðž¹'=>1,'ðžº'=>1,'ðž»'=>1,'ðž¼'=>1,'ðž½'=>1,'ðž¾'=>1,'ðž¿'=>1,'ðŸ€'=>1,'ðŸ'=>1,'ðŸ‚'=>1,'ðŸƒ'=>1,'ðŸ„'=>1,'ðŸ…'=>1,'ðŸ†'=>1,'ðŸ‡'=>1,'ðŸˆ'=>1,'ðŸ‰'=>1,'ðŸŠ'=>1,'ðŸ‹'=>1,'ðŸŽ'=>1,'ðŸ'=>1,'ðŸ'=>1,'ðŸ‘'=>1,'ðŸ’'=>1,'ðŸ“'=>1,'ðŸ”'=>1,'ðŸ•'=>1,'ðŸ–'=>1,'ðŸ—'=>1,'ðŸ˜'=>1,'ðŸ™'=>1,'ðŸš'=>1,'ðŸ›'=>1,'ðŸœ'=>1,'ðŸ'=>1,'ðŸž'=>1,'ðŸŸ'=>1,'ðŸ '=>1,'ðŸ¡'=>1,'ðŸ¢'=>1,'ðŸ£'=>1,'ðŸ¤'=>1,'ðŸ¥'=>1,'ðŸ¦'=>1,'ðŸ§'=>1,'ðŸ¨'=>1,'ðŸ©'=>1,'ðŸª'=>1,'ðŸ«'=>1,'ðŸ¬'=>1,'ðŸ'=>1,'ðŸ®'=>1,'ðŸ¯'=>1,'ðŸ°'=>1,'ðŸ±'=>1,'ðŸ²'=>1,'ðŸ³'=>1,'ðŸ´'=>1,'ðŸµ'=>1,'ðŸ¶'=>1,'ðŸ·'=>1,'ðŸ¸'=>1,'ðŸ¹'=>1,'ðŸº'=>1,'ðŸ»'=>1,'ðŸ¼'=>1,'ðŸ½'=>1,'ðŸ¾'=>1,'ðŸ¿'=>1,'丽'=>1,'ð¯ '=>1,'乁'=>1,'𠄢'=>1,'你'=>1,'侮'=>1,'侻'=>1,'倂'=>1,'偺'=>1,'備'=>1,'僧'=>1,'像'=>1,'㒞'=>1,'ð¯ '=>1,'免'=>1,'ð¯ '=>1,'ð¯ '=>1,'具'=>1,'𠔜'=>1,'㒹'=>1,'內'=>1,'再'=>1,'𠕋'=>1,'冗'=>1,'冤'=>1,'仌'=>1,'冬'=>1,'况'=>1,'𩇟'=>1,'ð¯ '=>1,'刃'=>1,'㓟'=>1,'ð¯ '=>1,'剆'=>1,'割'=>1,'剷'=>1,'㔕'=>1,'勇'=>1,'勉'=>1,'勤'=>1,'勺'=>1,'包'=>1,'匆'=>1,'北'=>1,'卉'=>1,'ð¯ '=>1,'博'=>1,'即'=>1,'卽'=>1,'卿'=>1,'卿'=>1,'卿'=>1,'𠨬'=>1,'灰'=>1,'及'=>1,'叟'=>1,'𠭣'=>1,'叫'=>1,'叱'=>1,'吆'=>1,'咞'=>1,'吸'=>1,'呈'=>1,'周'=>1,'咢'=>1,'ð¯¡'=>1,'唐'=>1,'啓'=>1,'啣'=>1,'善'=>1,'善'=>1,'喙'=>1,'喫'=>1,'喳'=>1,'嗂'=>1,'圖'=>1,'嘆'=>1,'ð¯¡'=>1,'噑'=>1,'ð¯¡'=>1,'ð¯¡'=>1,'壮'=>1,'城'=>1,'埴'=>1,'堍'=>1,'型'=>1,'堲'=>1,'報'=>1,'墬'=>1,'𡓤'=>1,'売'=>1,'壷'=>1,'夆'=>1,'ð¯¡'=>1,'夢'=>1,'奢'=>1,'𡚨'=>1,'𡛪'=>1,'姬'=>1,'娛'=>1,'娧'=>1,'姘'=>1,'婦'=>1,'㛮'=>1,'㛼'=>1,'嬈'=>1,'嬾'=>1,'嬾'=>1,'𡧈'=>1,'ð¯¡'=>1,'寘'=>1,'寧'=>1,'寳'=>1,'𡬘'=>1,'寿'=>1,'将'=>1,'当'=>1,'尢'=>1,'㞁'=>1,'屠'=>1,'屮'=>1,'峀'=>1,'岍'=>1,'𡷤'=>1,'嵃'=>1,'𡷦'=>1,'嵮'=>1,'嵫'=>1,'嵼'=>1,'ð¯¢'=>1,'巢'=>1,'㠯'=>1,'巽'=>1,'帨'=>1,'帽'=>1,'幩'=>1,'㡢'=>1,'𢆃'=>1,'㡼'=>1,'庰'=>1,'庳'=>1,'ð¯¢'=>1,'廊'=>1,'ð¯¢'=>1,'ð¯¢'=>1,'𢌱'=>1,'𢌱'=>1,'舁'=>1,'弢'=>1,'弢'=>1,'㣇'=>1,'𣊸'=>1,'𦇚'=>1,'形'=>1,'彫'=>1,'㣣'=>1,'徚'=>1,'ð¯¢'=>1,'志'=>1,'忹'=>1,'悁'=>1,'㤺'=>1,'㤜'=>1,'悔'=>1,'𢛔'=>1,'惇'=>1,'慈'=>1,'慌'=>1,'慎'=>1,'慌'=>1,'慺'=>1,'憎'=>1,'憲'=>1,'ð¯¢'=>1,'憯'=>1,'懞'=>1,'懲'=>1,'懶'=>1,'成'=>1,'戛'=>1,'扝'=>1,'抱'=>1,'拔'=>1,'捐'=>1,'𢬌'=>1,'挽'=>1,'拼'=>1,'捨'=>1,'掃'=>1,'揤'=>1,'𢯱'=>1,'搢'=>1,'揅'=>1,'ð¯£'=>1,'㨮'=>1,'摩'=>1,'摾'=>1,'撝'=>1,'摷'=>1,'㩬'=>1,'敏'=>1,'敬'=>1,'𣀊'=>1,'旣'=>1,'書'=>1,'ð¯£'=>1,'㬙'=>1,'ð¯£'=>1,'ð¯£'=>1,'㫤'=>1,'冒'=>1,'冕'=>1,'最'=>1,'暜'=>1,'肭'=>1,'䏙'=>1,'朗'=>1,'望'=>1,'朡'=>1,'杞'=>1,'杓'=>1,'ð¯£'=>1,'㭉'=>1,'柺'=>1,'枅'=>1,'桒'=>1,'梅'=>1,'𣑭'=>1,'梎'=>1,'栟'=>1,'椔'=>1,'㮝'=>1,'楂'=>1,'榣'=>1,'槪'=>1,'檨'=>1,'𣚣'=>1,'ð¯£'=>1,'㰘'=>1,'次'=>1,'𣢧'=>1,'歔'=>1,'㱎'=>1,'歲'=>1,'殟'=>1,'殺'=>1,'殻'=>1,'𣪍'=>1,'𡴋'=>1,'𣫺'=>1,'汎'=>1,'𣲼'=>1,'沿'=>1,'泍'=>1,'汧'=>1,'洖'=>1,'派'=>1,'ð¯¤'=>1,'流'=>1,'浩'=>1,'浸'=>1,'涅'=>1,'𣴞'=>1,'洴'=>1,'港'=>1,'湮'=>1,'㴳'=>1,'滋'=>1,'滇'=>1,'ð¯¤'=>1,'淹'=>1,'ð¯¤'=>1,'ð¯¤'=>1,'𣾎'=>1,'濆'=>1,'瀹'=>1,'瀞'=>1,'瀛'=>1,'㶖'=>1,'灊'=>1,'災'=>1,'灷'=>1,'炭'=>1,'𠔥'=>1,'煅'=>1,'ð¯¤'=>1,'熜'=>1,'𤎫'=>1,'爨'=>1,'爵'=>1,'牐'=>1,'𤘈'=>1,'犀'=>1,'犕'=>1,'𤜵'=>1,'𤠔'=>1,'獺'=>1,'王'=>1,'㺬'=>1,'玥'=>1,'㺸'=>1,'ð¯¤'=>1,'瑇'=>1,'瑜'=>1,'瑱'=>1,'璅'=>1,'瓊'=>1,'㼛'=>1,'甤'=>1,'𤰶'=>1,'甾'=>1,'𤲒'=>1,'異'=>1,'𢆟'=>1,'瘐'=>1,'𤾡'=>1,'𤾸'=>1,'𥁄'=>1,'㿼'=>1,'䀈'=>1,'直'=>1,'ð¯¥'=>1,'𥃲'=>1,'𥄙'=>1,'𥄳'=>1,'眞'=>1,'真'=>1,'真'=>1,'睊'=>1,'䀹'=>1,'瞋'=>1,'䁆'=>1,'䂖'=>1,'ð¯¥'=>1,'硎'=>1,'ð¯¥'=>1,'ð¯¥'=>1,'䃣'=>1,'𥘦'=>1,'祖'=>1,'𥚚'=>1,'𥛅'=>1,'福'=>1,'秫'=>1,'䄯'=>1,'穀'=>1,'穊'=>1,'穏'=>1,'𥥼'=>1,'ð¯¥'=>1,'𥪧'=>1,'竮'=>1,'䈂'=>1,'𥮫'=>1,'篆'=>1,'築'=>1,'䈧'=>1,'𥲀'=>1,'糒'=>1,'䊠'=>1,'糨'=>1,'糣'=>1,'紀'=>1,'𥾆'=>1,'絣'=>1,'ð¯¥'=>1,'緇'=>1,'縂'=>1,'繅'=>1,'䌴'=>1,'𦈨'=>1,'𦉇'=>1,'䍙'=>1,'𦋙'=>1,'罺'=>1,'𦌾'=>1,'羕'=>1,'翺'=>1,'者'=>1,'𦓚'=>1,'𦔣'=>1,'聠'=>1,'𦖨'=>1,'聰'=>1,'𣍟'=>1,'ð¯¦'=>1,'育'=>1,'脃'=>1,'䐋'=>1,'脾'=>1,'媵'=>1,'𦞧'=>1,'𦞵'=>1,'𣎓'=>1,'𣎜'=>1,'舁'=>1,'舄'=>1,'ð¯¦'=>1,'䑫'=>1,'ð¯¦'=>1,'ð¯¦'=>1,'芝'=>1,'劳'=>1,'花'=>1,'芳'=>1,'芽'=>1,'苦'=>1,'𦬼'=>1,'若'=>1,'茝'=>1,'荣'=>1,'莭'=>1,'茣'=>1,'ð¯¦'=>1,'菧'=>1,'著'=>1,'荓'=>1,'菊'=>1,'菌'=>1,'菜'=>1,'𦰶'=>1,'𦵫'=>1,'𦳕'=>1,'䔫'=>1,'蓱'=>1,'蓳'=>1,'蔖'=>1,'𧏊'=>1,'蕤'=>1,'ð¯¦'=>1,'䕝'=>1,'䕡'=>1,'𦾱'=>1,'𧃒'=>1,'䕫'=>1,'虐'=>1,'虜'=>1,'虧'=>1,'虩'=>1,'蚩'=>1,'蚈'=>1,'蜎'=>1,'蛢'=>1,'蝹'=>1,'蜨'=>1,'蝫'=>1,'螆'=>1,'䗗'=>1,'蟡'=>1,'ð¯§'=>1,'䗹'=>1,'衠'=>1,'衣'=>1,'𧙧'=>1,'裗'=>1,'裞'=>1,'䘵'=>1,'裺'=>1,'㒻'=>1,'𧢮'=>1,'𧥦'=>1,'ð¯§'=>1,'䛇'=>1,'ð¯§'=>1,'ð¯§'=>1,'變'=>1,'豕'=>1,'𧲨'=>1,'貫'=>1,'賁'=>1,'贛'=>1,'起'=>1,'𧼯'=>1,'𠠄'=>1,'跋'=>1,'趼'=>1,'跰'=>1,'ð¯§'=>1,'軔'=>1,'輸'=>1,'𨗒'=>1,'𨗭'=>1,'邔'=>1,'郱'=>1,'鄑'=>1,'𨜮'=>1,'鄛'=>1,'鈸'=>1,'鋗'=>1,'鋘'=>1,'鉼'=>1,'鏹'=>1,'鐕'=>1,'ð¯§'=>1,'開'=>1,'䦕'=>1,'閷'=>1,'𨵷'=>1,'䧦'=>1,'雃'=>1,'嶲'=>1,'霣'=>1,'𩅅'=>1,'𩈚'=>1,'䩮'=>1,'䩶'=>1,'韠'=>1,'𩐊'=>1,'䪲'=>1,'𩒖'=>1,'頋'=>1,'頋'=>1,'頩'=>1,'ð¯¨'=>1,'飢'=>1,'䬳'=>1,'餩'=>1,'馧'=>1,'駂'=>1,'駾'=>1,'䯎'=>1,'𩬰'=>1,'鬒'=>1,'鱀'=>1,'鳽'=>1,'ð¯¨'=>1,'䳭'=>1,'ð¯¨'=>1,'ð¯¨'=>1,'䳸'=>1,'𪄅'=>1,'𪈎'=>1,'𪊑'=>1,'麻'=>1,'䵖'=>1,'黹'=>1,'黾'=>1,'鼅'=>1,'鼏'=>1,'鼖'=>1,'鼻'=>1,'ð¯¨'=>1,'Ì€'=>0,'Ì'=>0,'Ì‚'=>0,'̃'=>0,'Ì„'=>0,'̆'=>0,'̇'=>0,'̈'=>0,'̉'=>0,'ÌŠ'=>0,'Ì‹'=>0,'ÌŒ'=>0,'Ì'=>0,'Ì‘'=>0,'Ì“'=>0,'Ì”'=>0,'Ì›'=>0,'Ì£'=>0,'̤'=>0,'Ì¥'=>0,'̦'=>0,'̧'=>0,'̨'=>0,'Ì'=>0,'Ì®'=>0,'̰'=>0,'̱'=>0,'̸'=>0,'Í‚'=>0,'Í…'=>0,'Ù“'=>0,'Ù”'=>0,'Ù•'=>0,'़'=>0,'া'=>0,'à§—'=>0,'ା'=>0,'à–'=>0,'à—'=>0,'ா'=>0,'ௗ'=>0,'à±–'=>0,'ೂ'=>0,'ೕ'=>0,'à³–'=>0,'à´¾'=>0,'ൗ'=>0,'à·Š'=>0,'à·'=>0,'à·Ÿ'=>0,'ီ'=>0,'á…¡'=>0,'á…¢'=>0,'á…£'=>0,'á…¤'=>0,'á…¥'=>0,'á…¦'=>0,'á…§'=>0,'á…¨'=>0,'á…©'=>0,'á…ª'=>0,'á…«'=>0,'á…¬'=>0,'á…'=>0,'á…®'=>0,'á…¯'=>0,'á…°'=>0,'á…±'=>0,'á…²'=>0,'á…³'=>0,'á…´'=>0,'á…µ'=>0,'ᆨ'=>0,'ᆩ'=>0,'ᆪ'=>0,'ᆫ'=>0,'ᆬ'=>0,'á†'=>0,'ᆮ'=>0,'ᆯ'=>0,'ᆰ'=>0,'ᆱ'=>0,'ᆲ'=>0,'ᆳ'=>0,'ᆴ'=>0,'ᆵ'=>0,'ᆶ'=>0,'ᆷ'=>0,'ᆸ'=>0,'ᆹ'=>0,'ᆺ'=>0,'ᆻ'=>0,'ᆼ'=>0,'ᆽ'=>0,'ᆾ'=>0,'ᆿ'=>0,'ᇀ'=>0,'á‡'=>0,'ᇂ'=>0,'ᬵ'=>0,'ã‚™'=>0,'゚'=>0); diff --git a/phpBB/includes/utf/data/utf_normalizer_common.php b/phpBB/includes/utf/data/utf_normalizer_common.php deleted file mode 100644 index 2eb7feac69..0000000000 --- a/phpBB/includes/utf/data/utf_normalizer_common.php +++ /dev/null @@ -1,4 +0,0 @@ -<?php -$GLOBALS['utf_jamo_index']=array('á„€'=>44032,'á„'=>44620,'á„‚'=>45208,'ᄃ'=>45796,'á„„'=>46384,'á„…'=>46972,'ᄆ'=>47560,'ᄇ'=>48148,'ᄈ'=>48736,'ᄉ'=>49324,'ᄊ'=>49912,'á„‹'=>50500,'ᄌ'=>51088,'á„'=>51676,'ᄎ'=>52264,'á„'=>52852,'á„'=>53440,'á„‘'=>54028,'á„’'=>54616,'á…¡'=>0,'á…¢'=>28,'á…£'=>56,'á…¤'=>84,'á…¥'=>112,'á…¦'=>140,'á…§'=>168,'á…¨'=>196,'á…©'=>224,'á…ª'=>252,'á…«'=>280,'á…¬'=>308,'á…'=>336,'á…®'=>364,'á…¯'=>392,'á…°'=>420,'á…±'=>448,'á…²'=>476,'á…³'=>504,'á…´'=>532,'á…µ'=>560,'ᆧ'=>0,'ᆨ'=>1,'ᆩ'=>2,'ᆪ'=>3,'ᆫ'=>4,'ᆬ'=>5,'á†'=>6,'ᆮ'=>7,'ᆯ'=>8,'ᆰ'=>9,'ᆱ'=>10,'ᆲ'=>11,'ᆳ'=>12,'ᆴ'=>13,'ᆵ'=>14,'ᆶ'=>15,'ᆷ'=>16,'ᆸ'=>17,'ᆹ'=>18,'ᆺ'=>19,'ᆻ'=>20,'ᆼ'=>21,'ᆽ'=>22,'ᆾ'=>23,'ᆿ'=>24,'ᇀ'=>25,'á‡'=>26,'ᇂ'=>27); -$GLOBALS['utf_jamo_type']=array('á„€'=>0,'á„'=>0,'á„‚'=>0,'ᄃ'=>0,'á„„'=>0,'á„…'=>0,'ᄆ'=>0,'ᄇ'=>0,'ᄈ'=>0,'ᄉ'=>0,'ᄊ'=>0,'á„‹'=>0,'ᄌ'=>0,'á„'=>0,'ᄎ'=>0,'á„'=>0,'á„'=>0,'á„‘'=>0,'á„’'=>0,'á…¡'=>1,'á…¢'=>1,'á…£'=>1,'á…¤'=>1,'á…¥'=>1,'á…¦'=>1,'á…§'=>1,'á…¨'=>1,'á…©'=>1,'á…ª'=>1,'á…«'=>1,'á…¬'=>1,'á…'=>1,'á…®'=>1,'á…¯'=>1,'á…°'=>1,'á…±'=>1,'á…²'=>1,'á…³'=>1,'á…´'=>1,'á…µ'=>1,'ᆧ'=>2,'ᆨ'=>2,'ᆩ'=>2,'ᆪ'=>2,'ᆫ'=>2,'ᆬ'=>2,'á†'=>2,'ᆮ'=>2,'ᆯ'=>2,'ᆰ'=>2,'ᆱ'=>2,'ᆲ'=>2,'ᆳ'=>2,'ᆴ'=>2,'ᆵ'=>2,'ᆶ'=>2,'ᆷ'=>2,'ᆸ'=>2,'ᆹ'=>2,'ᆺ'=>2,'ᆻ'=>2,'ᆼ'=>2,'ᆽ'=>2,'ᆾ'=>2,'ᆿ'=>2,'ᇀ'=>2,'á‡'=>2,'ᇂ'=>2); -$GLOBALS['utf_combining_class']=array('Ì€'=>230,'Ì'=>230,'Ì‚'=>230,'̃'=>230,'Ì„'=>230,'Ì…'=>230,'̆'=>230,'̇'=>230,'̈'=>230,'̉'=>230,'ÌŠ'=>230,'Ì‹'=>230,'ÌŒ'=>230,'Ì'=>230,'ÌŽ'=>230,'Ì'=>230,'Ì'=>230,'Ì‘'=>230,'Ì’'=>230,'Ì“'=>230,'Ì”'=>230,'Ì•'=>232,'Ì–'=>220,'Ì—'=>220,'̘'=>220,'Ì™'=>220,'Ìš'=>232,'Ì›'=>216,'Ìœ'=>220,'Ì'=>220,'Ìž'=>220,'ÌŸ'=>220,'Ì '=>220,'Ì¡'=>202,'Ì¢'=>202,'Ì£'=>220,'̤'=>220,'Ì¥'=>220,'̦'=>220,'̧'=>202,'̨'=>202,'Ì©'=>220,'̪'=>220,'Ì«'=>220,'̬'=>220,'Ì'=>220,'Ì®'=>220,'̯'=>220,'̰'=>220,'̱'=>220,'̲'=>220,'̳'=>220,'Ì´'=>1,'̵'=>1,'̶'=>1,'Ì·'=>1,'̸'=>1,'̹'=>220,'̺'=>220,'Ì»'=>220,'̼'=>220,'̽'=>230,'̾'=>230,'Ì¿'=>230,'Í€'=>230,'Í'=>230,'Í‚'=>230,'̓'=>230,'Í„'=>230,'Í…'=>240,'͆'=>230,'͇'=>220,'͈'=>220,'͉'=>220,'ÍŠ'=>230,'Í‹'=>230,'ÍŒ'=>230,'Í'=>220,'ÍŽ'=>220,'Í'=>230,'Í‘'=>230,'Í’'=>230,'Í“'=>220,'Í”'=>220,'Í•'=>220,'Í–'=>220,'Í—'=>230,'͘'=>232,'Í™'=>220,'Íš'=>220,'Í›'=>230,'Íœ'=>233,'Í'=>234,'Íž'=>234,'ÍŸ'=>233,'Í '=>234,'Í¡'=>234,'Í¢'=>233,'Í£'=>230,'ͤ'=>230,'Í¥'=>230,'ͦ'=>230,'ͧ'=>230,'ͨ'=>230,'Í©'=>230,'ͪ'=>230,'Í«'=>230,'ͬ'=>230,'Í'=>230,'Í®'=>230,'ͯ'=>230,'Òƒ'=>230,'Ò„'=>230,'Ò…'=>230,'Ò†'=>230,'Ö‘'=>220,'Ö’'=>230,'Ö“'=>230,'Ö”'=>230,'Ö•'=>230,'Ö–'=>220,'Ö—'=>230,'Ö˜'=>230,'Ö™'=>230,'Öš'=>222,'Ö›'=>220,'Öœ'=>230,'Ö'=>230,'Öž'=>230,'ÖŸ'=>230,'Ö '=>230,'Ö¡'=>230,'Ö¢'=>220,'Ö£'=>220,'Ö¤'=>220,'Ö¥'=>220,'Ö¦'=>220,'Ö§'=>220,'Ö¨'=>230,'Ö©'=>230,'Öª'=>220,'Ö«'=>230,'Ö¬'=>230,'Ö'=>222,'Ö®'=>228,'Ö¯'=>230,'Ö°'=>10,'Ö±'=>11,'Ö²'=>12,'Ö³'=>13,'Ö´'=>14,'Öµ'=>15,'Ö¶'=>16,'Ö·'=>17,'Ö¸'=>18,'Ö¹'=>19,'Öº'=>19,'Ö»'=>20,'Ö¼'=>21,'Ö½'=>22,'Ö¿'=>23,'×'=>24,'ׂ'=>25,'ׄ'=>230,'×…'=>220,'ׇ'=>18,'Ø'=>230,'Ø‘'=>230,'Ø’'=>230,'Ø“'=>230,'Ø”'=>230,'Ø•'=>230,'Ù‹'=>27,'ÙŒ'=>28,'Ù'=>29,'ÙŽ'=>30,'Ù'=>31,'Ù'=>32,'Ù‘'=>33,'Ù’'=>34,'Ù“'=>230,'Ù”'=>230,'Ù•'=>220,'Ù–'=>220,'Ù—'=>230,'Ù˜'=>230,'Ù™'=>230,'Ùš'=>230,'Ù›'=>230,'Ùœ'=>220,'Ù'=>230,'Ùž'=>230,'Ù°'=>35,'Û–'=>230,'Û—'=>230,'Û˜'=>230,'Û™'=>230,'Ûš'=>230,'Û›'=>230,'Ûœ'=>230,'ÛŸ'=>230,'Û '=>230,'Û¡'=>230,'Û¢'=>230,'Û£'=>220,'Û¤'=>230,'Û§'=>230,'Û¨'=>230,'Ûª'=>220,'Û«'=>230,'Û¬'=>230,'Û'=>220,'Ü‘'=>36,'ܰ'=>230,'ܱ'=>220,'ܲ'=>230,'ܳ'=>230,'Ü´'=>220,'ܵ'=>230,'ܶ'=>230,'Ü·'=>220,'ܸ'=>220,'ܹ'=>220,'ܺ'=>230,'Ü»'=>220,'ܼ'=>220,'ܽ'=>230,'ܾ'=>220,'Ü¿'=>230,'Ý€'=>230,'Ý'=>230,'Ý‚'=>220,'݃'=>230,'Ý„'=>220,'Ý…'=>230,'݆'=>220,'݇'=>230,'݈'=>220,'݉'=>230,'ÝŠ'=>230,'ß«'=>230,'߬'=>230,'ß'=>230,'ß®'=>230,'߯'=>230,'ß°'=>230,'ß±'=>230,'ß²'=>220,'ß³'=>230,'़'=>7,'à¥'=>9,'॑'=>230,'॒'=>220,'॓'=>230,'॔'=>230,'়'=>7,'à§'=>9,'਼'=>7,'à©'=>9,'઼'=>7,'à«'=>9,'଼'=>7,'à'=>9,'à¯'=>9,'à±'=>9,'ౕ'=>84,'à±–'=>91,'಼'=>7,'à³'=>9,'àµ'=>9,'à·Š'=>9,'ุ'=>103,'ู'=>103,'ฺ'=>9,'่'=>107,'้'=>107,'๊'=>107,'๋'=>107,'ຸ'=>118,'ູ'=>118,'່'=>122,'້'=>122,'໊'=>122,'໋'=>122,'༘'=>220,'༙'=>220,'༵'=>220,'༷'=>220,'༹'=>216,'ཱ'=>129,'ི'=>130,'ུ'=>132,'ེ'=>130,'ཻ'=>130,'ོ'=>130,'ཽ'=>130,'ྀ'=>130,'ྂ'=>230,'ྃ'=>230,'྄'=>9,'྆'=>230,'྇'=>230,'࿆'=>220,'့'=>7,'္'=>9,'áŸ'=>230,'᜔'=>9,'᜴'=>9,'្'=>9,'áŸ'=>230,'ᢩ'=>228,'᤹'=>222,'᤺'=>230,'᤻'=>220,'ᨗ'=>230,'ᨘ'=>220,'᬴'=>7,'á„'=>9,'á«'=>230,'á¬'=>220,'á'=>230,'á®'=>230,'á¯'=>230,'á°'=>230,'á±'=>230,'á²'=>230,'á³'=>230,'á·€'=>230,'á·'=>230,'á·‚'=>220,'á·ƒ'=>230,'á·„'=>230,'á·…'=>230,'á·†'=>230,'á·‡'=>230,'á·ˆ'=>230,'á·‰'=>230,'á·Š'=>220,'á·¾'=>230,'á·¿'=>220,'âƒ'=>230,'⃑'=>230,'⃒'=>1,'⃓'=>1,'⃔'=>230,'⃕'=>230,'⃖'=>230,'⃗'=>230,'⃘'=>1,'⃙'=>1,'⃚'=>1,'⃛'=>230,'⃜'=>230,'⃡'=>230,'⃥'=>1,'⃦'=>1,'⃧'=>230,'⃨'=>220,'⃩'=>230,'⃪'=>1,'⃫'=>1,'⃬'=>220,'âƒ'=>220,'⃮'=>220,'⃯'=>220,'〪'=>218,'〫'=>228,'〬'=>232,'ã€'=>222,'〮'=>224,'〯'=>224,'ã‚™'=>8,'゚'=>8,'ê †'=>9,'ﬞ'=>26,'ï¸ '=>230,'︡'=>230,'︢'=>230,'︣'=>230,'ð¨'=>220,'ð¨'=>230,'ð¨¸'=>230,'ð¨¹'=>1,'ð¨º'=>220,'ð¨¿'=>9,'ð…¥'=>216,'ð…¦'=>216,'ð…§'=>1,'ð…¨'=>1,'ð…©'=>1,'ð…'=>226,'ð…®'=>216,'ð…¯'=>216,'ð…°'=>216,'ð…±'=>216,'ð…²'=>216,'ð…»'=>220,'ð…¼'=>220,'ð…½'=>220,'ð…¾'=>220,'ð…¿'=>220,'ð†€'=>220,'ð†'=>220,'ð†‚'=>220,'ð†…'=>230,'ð††'=>230,'ð†‡'=>230,'ð†ˆ'=>230,'ð†‰'=>230,'ð†Š'=>220,'ð†‹'=>220,'ð†ª'=>230,'ð†«'=>230,'ð†¬'=>230,'ð†'=>230,'ð‰‚'=>230,'ð‰ƒ'=>230,'ð‰„'=>230); diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php deleted file mode 100644 index a208552d53..0000000000 --- a/phpBB/includes/utf/utf_normalizer.php +++ /dev/null @@ -1,1513 +0,0 @@ -<?php -/** -* -* @package utf -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Some Unicode characters encoded in UTF-8 -* -* Preserved for compatibility -*/ -define('UTF8_REPLACEMENT', "\xEF\xBF\xBD"); -define('UTF8_MAX', "\xF4\x8F\xBF\xBF"); -define('UTF8_FFFE', "\xEF\xBF\xBE"); -define('UTF8_FFFF', "\xEF\xBF\xBF"); -define('UTF8_SURROGATE_FIRST', "\xED\xA0\x80"); -define('UTF8_SURROGATE_LAST', "\xED\xBF\xBF"); -define('UTF8_HANGUL_FIRST', "\xEA\xB0\x80"); -define('UTF8_HANGUL_LAST', "\xED\x9E\xA3"); - -define('UTF8_CJK_FIRST', "\xE4\xB8\x80"); -define('UTF8_CJK_LAST', "\xE9\xBE\xBB"); -define('UTF8_CJK_B_FIRST', "\xF0\xA0\x80\x80"); -define('UTF8_CJK_B_LAST', "\xF0\xAA\x9B\x96"); - -// Unset global variables -unset($GLOBALS['utf_jamo_index'], $GLOBALS['utf_jamo_type'], $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_combining_class'], $GLOBALS['utf_canonical_comp'], $GLOBALS['utf_canonical_decomp'], $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); - -// NFC_QC and NFKC_QC values -define('UNICODE_QC_MAYBE', 0); -define('UNICODE_QC_NO', 1); - -// Contains all the ASCII characters appearing in UTF-8, sorted by frequency -define('UTF8_ASCII_RANGE', "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"); - -// Contains all the tail bytes that can appear in the composition of a UTF-8 char -define('UTF8_TRAILING_BYTES', "\xA9\xA0\xA8\x80\xAA\x99\xA7\xBB\xAB\x89\x94\x82\xB4\xA2\xAE\x83\xB0\xB9\xB8\x93\xAF\xBC\xB3\x81\xA4\xB2\x9C\xA1\xB5\xBE\xBD\xBA\x98\xAD\xB1\x84\x95\xA6\xB6\x88\x8D\x90\xB7\xBF\x92\x85\xA5\x97\x8C\x86\xA3\x8E\x9F\x8F\x87\x91\x9D\xAC\x9E\x8B\x96\x9B\x8A\x9A"); - -// Constants used by the Hangul [de]composition algorithms -define('UNICODE_HANGUL_SBASE', 0xAC00); -define('UNICODE_HANGUL_LBASE', 0x1100); -define('UNICODE_HANGUL_VBASE', 0x1161); -define('UNICODE_HANGUL_TBASE', 0x11A7); -define('UNICODE_HANGUL_SCOUNT', 11172); -define('UNICODE_HANGUL_LCOUNT', 19); -define('UNICODE_HANGUL_VCOUNT', 21); -define('UNICODE_HANGUL_TCOUNT', 28); -define('UNICODE_HANGUL_NCOUNT', 588); -define('UNICODE_JAMO_L', 0); -define('UNICODE_JAMO_V', 1); -define('UNICODE_JAMO_T', 2); - -/** -* Unicode normalization routines -* -* @package utf -*/ -class utf_normalizer -{ - /** - * Validate, cleanup and normalize a string - * - * The ultimate convenience function! Clean up invalid UTF-8 sequences, - * and convert to Normal Form C, canonical composition. - * - * @param string &$str The dirty string - * @return string The same string, all shiny and cleaned-up - */ - static function cleanup(&$str) - { - // The string below is the list of all autorized characters, sorted by frequency in latin text - $pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D"); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings with no special chars return immediately - return; - } - - // Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed they are always loaded together - if (!isset($GLOBALS['utf_nfc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); - } - - if (!isset($GLOBALS['utf_canonical_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); - } - - // Replace any byte in the range 0x00..0x1F, except for \r, \n and \t - // We replace those characters with a 0xFF byte, which is illegal in UTF-8 and will in turn be replaced with a UTF replacement char - $str = strtr( - $str, - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - ); - - $str = utf_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); - } - - /** - * Validate and normalize a UTF string to NFC - * - * @param string &$str Unchecked UTF string - * @return string The string, validated and in normal form - */ - static function nfc(&$str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings return immediately - return; - } - - if (!isset($GLOBALS['utf_nfc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); - } - - if (!isset($GLOBALS['utf_canonical_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); - } - - $str = utf_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); - } - - /** - * Validate and normalize a UTF string to NFKC - * - * @param string &$str Unchecked UTF string - * @return string The string, validated and in normal form - */ - static function nfkc(&$str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings return immediately - return; - } - - if (!isset($GLOBALS['utf_nfkc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx); - } - - if (!isset($GLOBALS['utf_compatibility_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); - } - - $str = utf_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); - } - - /** - * Validate and normalize a UTF string to NFD - * - * @param string &$str Unchecked UTF string - * @return string The string, validated and in normal form - */ - static function nfd(&$str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings return immediately - return; - } - - if (!isset($GLOBALS['utf_canonical_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); - } - - $str = utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_canonical_decomp']); - } - - /** - * Validate and normalize a UTF string to NFKD - * - * @param string &$str Unchecked UTF string - * @return string The string, validated and in normal form - */ - static function nfkd(&$str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings return immediately - return; - } - - if (!isset($GLOBALS['utf_compatibility_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); - } - - $str = utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_compatibility_decomp']); - } - - - /** - * Recompose a UTF string - * - * @param string $str Unchecked UTF string - * @param integer $pos Position of the first UTF char (in bytes) - * @param integer $len Length of the string (in bytes) - * @param array &$qc Quick-check array, passed by reference but never modified - * @param array &$decomp_map Decomposition mapping, passed by reference but never modified - * @return string The string, validated and recomposed - * - * @access private - */ - static function recompose($str, $pos, $len, &$qc, &$decomp_map) - { - global $utf_combining_class, $utf_canonical_comp, $utf_jamo_type, $utf_jamo_index; - - // Load some commonly-used tables - if (!isset($utf_jamo_index, $utf_jamo_type, $utf_combining_class)) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx); - } - - // Load the canonical composition table - if (!isset($utf_canonical_comp)) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx); - } - - // Buffer the last ASCII char before the UTF-8 stuff if applicable - $tmp = ''; - $i = $tmp_pos = $last_cc = 0; - - $buffer = ($pos) ? array(++$i => $str[$pos - 1]) : array(); - - // UTF char length array - // This array is used to determine the length of a UTF character. - // Be $c the result of ($str[$pos] & "\xF0") --where $str is the string we're operating on and $pos - // the position of the cursor--, if $utf_len_mask[$c] does not exist, the byte is an ASCII char. - // Otherwise, if $utf_len_mask[$c] is greater than 0, we have a the leading byte of a multibyte character - // whose length is $utf_len_mask[$c] and if it is equal to 0, the byte is a trailing byte. - $utf_len_mask = array( - // Leading bytes masks - "\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4, - // Trailing bytes masks - "\x80" => 0, "\x90" => 0, "\xA0" => 0, "\xB0" => 0 - ); - - $extra_check = array( - "\xED" => 1, "\xEF" => 1, "\xC0" => 1, "\xC1" => 1, "\xE0" => 1, "\xF0" => 1, - "\xF4" => 1, "\xF5" => 1, "\xF6" => 1, "\xF7" => 1, "\xF8" => 1, "\xF9" => 1, - "\xFA" => 1, "\xFB" => 1, "\xFC" => 1, "\xFD" => 1, "\xFE" => 1, "\xFF" => 1 - ); - - $utf_validation_mask = array( - 2 => "\xE0\xC0", - 3 => "\xF0\xC0\xC0", - 4 => "\xF8\xC0\xC0\xC0" - ); - - $utf_validation_check = array( - 2 => "\xC0\x80", - 3 => "\xE0\x80\x80", - 4 => "\xF0\x80\x80\x80" - ); - - // Main loop - do - { - // STEP 0: Capture the current char and buffer it - $c = $str[$pos]; - $c_mask = $c & "\xF0"; - - if (isset($utf_len_mask[$c_mask])) - { - // Byte at $pos is either a leading byte or a missplaced trailing byte - if ($utf_len = $utf_len_mask[$c_mask]) - { - // Capture the char - $buffer[++$i & 7] = $utf_char = substr($str, $pos, $utf_len); - - // Let's find out if a thorough check is needed - if (isset($qc[$utf_char])) - { - // If the UTF char is in the qc array then it may not be in normal form. We do nothing here, the actual processing is below this "if" block - } - else if (isset($utf_combining_class[$utf_char])) - { - if ($utf_combining_class[$utf_char] < $last_cc) - { - // A combining character that is NOT canonically ordered - } - else - { - // A combining character that IS canonically ordered, skip to the next char - $last_cc = $utf_combining_class[$utf_char]; - - $pos += $utf_len; - continue; - } - } - else - { - // At this point, $utf_char holds a UTF char that we know is not a NF[K]C_QC and is not a combining character. - // It can be a singleton, a canonical composite, a replacement char or an even an ill-formed bunch of bytes. Let's find out - $last_cc = 0; - - // Check that we have the correct number of trailing bytes - if (($utf_char & $utf_validation_mask[$utf_len]) != $utf_validation_check[$utf_len]) - { - // Current char isn't well-formed or legal: either one or several trailing bytes are missing, or the Unicode char - // has been encoded in a five- or six- byte sequence - if ($utf_char[0] >= "\xF8") - { - if ($utf_char[0] < "\xFC") - { - $trailing_bytes = 4; - } - else if ($utf_char[0] > "\xFD") - { - $trailing_bytes = 0; - } - else - { - $trailing_bytes = 5; - } - } - else - { - $trailing_bytes = $utf_len - 1; - } - - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += strspn($str, UTF8_TRAILING_BYTES, ++$pos, $trailing_bytes); - $tmp_pos = $pos; - - continue; - } - - if (isset($extra_check[$c])) - { - switch ($c) - { - // Note: 0xED is quite common in Korean - case "\xED": - if ($utf_char >= "\xED\xA0\x80") - { - // Surrogates (U+D800..U+DFFF) are not allowed in UTF-8 (UTF sequence 0xEDA080..0xEDBFBF) - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - // Note: 0xEF is quite common in Japanese - case "\xEF": - if ($utf_char == "\xEF\xBF\xBE" || $utf_char == "\xEF\xBF\xBF") - { - // U+FFFE and U+FFFF are explicitly disallowed (UTF sequence 0xEFBFBE..0xEFBFBF) - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - case "\xC0": - case "\xC1": - if ($utf_char <= "\xC1\xBF") - { - // Overlong sequence: Unicode char U+0000..U+007F encoded as a double-byte UTF char - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - case "\xE0": - if ($utf_char <= "\xE0\x9F\xBF") - { - // Unicode char U+0000..U+07FF encoded in 3 bytes - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - case "\xF0": - if ($utf_char <= "\xF0\x8F\xBF\xBF") - { - // Unicode char U+0000..U+FFFF encoded in 4 bytes - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += $utf_len; - $tmp_pos = $pos; - continue 2; - } - break; - - default: - // Five- and six- byte sequences do not need being checked for here anymore - if ($utf_char > UTF8_MAX) - { - // Out of the Unicode range - if ($utf_char[0] < "\xF8") - { - $trailing_bytes = 3; - } - else if ($utf_char[0] < "\xFC") - { - $trailing_bytes = 4; - } - else if ($utf_char[0] > "\xFD") - { - $trailing_bytes = 0; - } - else - { - $trailing_bytes = 5; - } - - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . UTF8_REPLACEMENT; - $pos += strspn($str, UTF8_TRAILING_BYTES, ++$pos, $trailing_bytes); - $tmp_pos = $pos; - continue 2; - } - break; - } - } - - // The char is a valid starter, move the cursor and go on - $pos += $utf_len; - continue; - } - } - else - { - // A trailing byte came out of nowhere, we will advance the cursor and treat the this byte and all following trailing bytes as if - // each of them was a Unicode replacement char - $spn = strspn($str, UTF8_TRAILING_BYTES, $pos); - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . str_repeat(UTF8_REPLACEMENT, $spn); - - $pos += $spn; - $tmp_pos = $pos; - continue; - } - - - // STEP 1: Decompose current char - - // We have found a character that is either: - // - in the NFC_QC/NFKC_QC list - // - a non-starter char that is not canonically ordered - // - // We are going to capture the shortest UTF sequence that satisfies these two conditions: - // - // 1 - If the sequence does not start at the begginning of the string, it must begin with a starter, - // and that starter must not have the NF[K]C_QC property equal to "MAYBE" - // - // 2 - If the sequence does not end at the end of the string, it must end with a non-starter and be - // immediately followed by a starter that is not on the QC list - // - $utf_seq = array(); - $last_cc = 0; - $lpos = $pos; - $pos += $utf_len; - - if (isset($decomp_map[$utf_char])) - { - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - - do - { - $_utf_len =& $utf_len_mask[$decomp_map[$utf_char][$_pos] & "\xF0"]; - - if (isset($_utf_len)) - { - $utf_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - } - else - { - $utf_seq[] = $decomp_map[$utf_char][$_pos]; - ++$_pos; - } - } - while ($_pos < $_len); - } - else - { - // The char is not decomposable - $utf_seq = array($utf_char); - } - - - // STEP 2: Capture the starter - - // Check out the combining class of the first character of the UTF sequence - $k = 0; - if (isset($utf_combining_class[$utf_seq[0]]) || $qc[$utf_char] == UNICODE_QC_MAYBE) - { - // Not a starter, inspect previous characters - // The last 8 characters are kept in a buffer so that we don't have to capture them everytime. - // This is enough for all real-life strings but even if it wasn't, we can capture characters in backward mode, - // although it is slower than this method. - // - // In the following loop, $j starts at the previous buffered character ($i - 1, because current character is - // at offset $i) and process them in backward mode until we find a starter. - // - // $k is the index on each UTF character inside of our UTF sequence. At this time, $utf_seq contains one or more - // characters numbered 0 to n. $k starts at 0 and for each char we prepend we pre-decrement it and for numbering - $starter_found = 0; - $j_min = max(1, $i - 7); - - for ($j = $i - 1; $j >= $j_min && $lpos > $tmp_pos; --$j) - { - $utf_char = $buffer[$j & 7]; - $lpos -= strlen($utf_char); - - if (isset($decomp_map[$utf_char])) - { - // The char is a composite, decompose for storage - $decomp_seq = array(); - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - - do - { - $c = $decomp_map[$utf_char][$_pos]; - $_utf_len =& $utf_len_mask[$c & "\xF0"]; - - if (isset($_utf_len)) - { - $decomp_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - } - else - { - $decomp_seq[] = $c; - ++$_pos; - } - } - while ($_pos < $_len); - - // Prepend the UTF sequence with our decomposed sequence - if (isset($decomp_seq[1])) - { - // The char expanded into several chars - $decomp_cnt = sizeof($decomp_seq); - - foreach ($decomp_seq as $decomp_i => $decomp_char) - { - $utf_seq[$k + $decomp_i - $decomp_cnt] = $decomp_char; - } - $k -= $decomp_cnt; - } - else - { - // Decomposed to a single char, easier to prepend - $utf_seq[--$k] = $decomp_seq[0]; - } - } - else - { - $utf_seq[--$k] = $utf_char; - } - - if (!isset($utf_combining_class[$utf_seq[$k]])) - { - // We have found our starter - $starter_found = 1; - break; - } - } - - if (!$starter_found && $lpos > $tmp_pos) - { - // The starter was not found in the buffer, let's rewind some more - do - { - // $utf_len_mask contains the masks of both leading bytes and trailing bytes. If $utf_en > 0 then it's a leading byte, otherwise it's a trailing byte. - $c = $str[--$lpos]; - $c_mask = $c & "\xF0"; - - if (isset($utf_len_mask[$c_mask])) - { - // UTF byte - if ($utf_len = $utf_len_mask[$c_mask]) - { - // UTF *leading* byte - $utf_char = substr($str, $lpos, $utf_len); - - if (isset($decomp_map[$utf_char])) - { - // Decompose the character - $decomp_seq = array(); - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - - do - { - $c = $decomp_map[$utf_char][$_pos]; - $_utf_len =& $utf_len_mask[$c & "\xF0"]; - - if (isset($_utf_len)) - { - $decomp_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - } - else - { - $decomp_seq[] = $c; - ++$_pos; - } - } - while ($_pos < $_len); - - // Prepend the UTF sequence with our decomposed sequence - if (isset($decomp_seq[1])) - { - // The char expanded into several chars - $decomp_cnt = sizeof($decomp_seq); - foreach ($decomp_seq as $decomp_i => $utf_char) - { - $utf_seq[$k + $decomp_i - $decomp_cnt] = $utf_char; - } - $k -= $decomp_cnt; - } - else - { - // Decomposed to a single char, easier to prepend - $utf_seq[--$k] = $decomp_seq[0]; - } - } - else - { - $utf_seq[--$k] = $utf_char; - } - } - } - else - { - // ASCII char - $utf_seq[--$k] = $c; - } - } - while ($lpos > $tmp_pos); - } - } - - - // STEP 3: Capture following combining modifiers - - while ($pos < $len) - { - $c_mask = $str[$pos] & "\xF0"; - - if (isset($utf_len_mask[$c_mask])) - { - if ($utf_len = $utf_len_mask[$c_mask]) - { - $utf_char = substr($str, $pos, $utf_len); - } - else - { - // A trailing byte came out of nowhere - // Trailing bytes are replaced with Unicode replacement chars, we will just ignore it for now, break out of the loop - // as if it was a starter (replacement chars ARE starters) and let the next loop replace it - break; - } - - if (isset($utf_combining_class[$utf_char]) || isset($qc[$utf_char])) - { - // Combining character, add it to the sequence and move the cursor - if (isset($decomp_map[$utf_char])) - { - // Decompose the character - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - - do - { - $c = $decomp_map[$utf_char][$_pos]; - $_utf_len =& $utf_len_mask[$c & "\xF0"]; - - if (isset($_utf_len)) - { - $utf_seq[] = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - } - else - { - $utf_seq[] = $c; - ++$_pos; - } - } - while ($_pos < $_len); - } - else - { - $utf_seq[] = $utf_char; - } - - $pos += $utf_len; - } - else - { - // Combining class 0 and no QC, break out of the loop - // Note: we do not know if that character is valid. If it's not, the next iteration will replace it - break; - } - } - else - { - // ASCII chars are starters - break; - } - } - - - // STEP 4: Sort and combine - - // Here we sort... - $k_max = $k + sizeof($utf_seq); - - if (!$k && $k_max == 1) - { - // There is only one char in the UTF sequence, add it then jump to the next iteration of main loop - // Note: the two commented lines below can be enabled under PHP5 for a very small performance gain in most cases -// if (substr_compare($str, $utf_seq[0], $lpos, $pos - $lpos)) -// { - $tmp .= substr($str, $tmp_pos, $lpos - $tmp_pos) . $utf_seq[0]; - $tmp_pos = $pos; -// } - - continue; - } - - // ...there we combine - if (isset($utf_combining_class[$utf_seq[$k]])) - { - $starter = $nf_seq = ''; - } - else - { - $starter = $utf_seq[$k++]; - $nf_seq = ''; - } - $utf_sort = array(); - - // We add an empty char at the end of the UTF char sequence. It will act as a starter and trigger the sort/combine routine - // at the end of the string without altering it - $utf_seq[] = ''; - - do - { - $utf_char = $utf_seq[$k++]; - - if (isset($utf_combining_class[$utf_char])) - { - $utf_sort[$utf_combining_class[$utf_char]][] = $utf_char; - } - else - { - if (empty($utf_sort)) - { - // No combining characters... check for a composite of the two starters - if (isset($utf_canonical_comp[$starter . $utf_char])) - { - // Good ol' composite character - $starter = $utf_canonical_comp[$starter . $utf_char]; - } - else if (isset($utf_jamo_type[$utf_char])) - { - // Current char is a composable jamo - if (isset($utf_jamo_type[$starter]) && $utf_jamo_type[$starter] == UNICODE_JAMO_L && $utf_jamo_type[$utf_char] == UNICODE_JAMO_V) - { - // We have a L jamo followed by a V jamo, we are going to prefetch the next char to see if it's a T jamo - if (isset($utf_jamo_type[$utf_seq[$k]]) && $utf_jamo_type[$utf_seq[$k]] == UNICODE_JAMO_T) - { - // L+V+T jamos, combine to a LVT Hangul syllable ($k is incremented) - $cp = $utf_jamo_index[$starter] + $utf_jamo_index[$utf_char] + $utf_jamo_index[$utf_seq[$k]]; - ++$k; - } - else - { - // L+V jamos, combine to a LV Hangul syllable - $cp = $utf_jamo_index[$starter] + $utf_jamo_index[$utf_char]; - } - - $starter = chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); - } - else - { - // Non-composable jamo, just add it to the sequence - $nf_seq .= $starter; - $starter = $utf_char; - } - } - else - { - // No composite, just add the first starter to the sequence then continue with the other one - $nf_seq .= $starter; - $starter = $utf_char; - } - } - else - { - ksort($utf_sort); - - // For each class of combining characters - foreach ($utf_sort as $cc => $utf_chars) - { - $j = 0; - - do - { - // Look for a composite - if (isset($utf_canonical_comp[$starter . $utf_chars[$j]])) - { - // Found a composite, replace the starter - $starter = $utf_canonical_comp[$starter . $utf_chars[$j]]; - unset($utf_sort[$cc][$j]); - } - else - { - // No composite, all following characters in that class are blocked - break; - } - } - while (isset($utf_sort[$cc][++$j])); - } - - // Add the starter to the normalized sequence, followed by non-starters in canonical order - $nf_seq .= $starter; - - foreach ($utf_sort as $utf_chars) - { - if (!empty($utf_chars)) - { - $nf_seq .= implode('', $utf_chars); - } - } - - // Reset the array and go on - $utf_sort = array(); - $starter = $utf_char; - } - } - } - while ($k <= $k_max); - - $tmp .= substr($str, $tmp_pos, $lpos - $tmp_pos) . $nf_seq; - $tmp_pos = $pos; - } - else - { - // Only a ASCII char can make the program get here - // - // First we skip the current byte with ++$pos, then we quickly skip following ASCII chars with strspn(). - // - // The first two "if"'s here can be removed, with the consequences of being faster on latin text (lots of ASCII) and slower on - // multi-byte text (where the only ASCII chars are spaces and punctuation) - if (++$pos != $len) - { - if ($str[$pos] < "\x80") - { - $pos += strspn($str, UTF8_ASCII_RANGE, ++$pos); - $buffer[++$i & 7] = $str[$pos - 1]; - } - else - { - $buffer[++$i & 7] = $c; - } - } - } - } - while ($pos < $len); - - // Now is time to return the string - if ($tmp_pos) - { - // If the $tmp_pos cursor is not at the beggining of the string then at least one character was not in normal form. Replace $str with the fixed version - if ($tmp_pos == $len) - { - // The $tmp_pos cursor is at the end of $str, therefore $tmp holds the whole $str - return $tmp; - } - else - { - // The rightmost chunk of $str has not been appended to $tmp yet - return $tmp . substr($str, $tmp_pos); - } - } - - // The string was already in normal form - return $str; - } - - /** - * Decompose a UTF string - * - * @param string $str UTF string - * @param integer $pos Position of the first UTF char (in bytes) - * @param integer $len Length of the string (in bytes) - * @param array &$decomp_map Decomposition mapping, passed by reference but never modified - * @return string The string, decomposed and sorted canonically - * - * @access private - */ - static function decompose($str, $pos, $len, &$decomp_map) - { - global $utf_combining_class; - - // Load some commonly-used tables - if (!isset($utf_combining_class)) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_normalizer_common.' . $phpEx); - } - - // UTF char length array - $utf_len_mask = array( - // Leading bytes masks - "\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4, - // Trailing bytes masks - "\x80" => 0, "\x90" => 0, "\xA0" => 0, "\xB0" => 0 - ); - - // Some extra checks are triggered on the first byte of a UTF sequence - $extra_check = array( - "\xED" => 1, "\xEF" => 1, "\xC0" => 1, "\xC1" => 1, "\xE0" => 1, "\xF0" => 1, - "\xF4" => 1, "\xF5" => 1, "\xF6" => 1, "\xF7" => 1, "\xF8" => 1, "\xF9" => 1, - "\xFA" => 1, "\xFB" => 1, "\xFC" => 1, "\xFD" => 1, "\xFE" => 1, "\xFF" => 1 - ); - - // These masks are used to check if a UTF sequence is well formed. Here are the only 3 lengths we acknowledge: - // - 2-byte: 110? ???? 10?? ???? - // - 3-byte: 1110 ???? 10?? ???? 10?? ???? - // - 4-byte: 1111 0??? 10?? ???? 10?? ???? 10?? ???? - // Note that 5- and 6- byte sequences are automatically discarded - $utf_validation_mask = array( - 2 => "\xE0\xC0", - 3 => "\xF0\xC0\xC0", - 4 => "\xF8\xC0\xC0\xC0" - ); - - $utf_validation_check = array( - 2 => "\xC0\x80", - 3 => "\xE0\x80\x80", - 4 => "\xF0\x80\x80\x80" - ); - - $tmp = ''; - $starter_pos = $pos; - $tmp_pos = $last_cc = $sort = $dump = 0; - $utf_sort = array(); - - - // Main loop - do - { - // STEP 0: Capture the current char - - $cur_mask = $str[$pos] & "\xF0"; - if (isset($utf_len_mask[$cur_mask])) - { - if ($utf_len = $utf_len_mask[$cur_mask]) - { - // Multibyte char - $utf_char = substr($str, $pos, $utf_len); - $pos += $utf_len; - } - else - { - // A trailing byte came out of nowhere, we will treat it and all following trailing bytes as if each of them was a Unicode - // replacement char and we will advance the cursor - $spn = strspn($str, UTF8_TRAILING_BYTES, $pos); - - if ($dump) - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - // Dump combiners - if (!empty($utf_sort)) - { - if ($sort) - { - ksort($utf_sort); - } - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - } - - $tmp .= str_repeat(UTF8_REPLACEMENT, $spn); - $dump = $sort = 0; - } - else - { - $tmp .= substr($str, $tmp_pos, $pos - $tmp_pos) . str_repeat(UTF8_REPLACEMENT, $spn); - } - - $pos += $spn; - $tmp_pos = $starter_pos = $pos; - - $utf_sort = array(); - $last_cc = 0; - - continue; - } - - - // STEP 1: Decide what to do with current char - - // Now, in that order: - // - check if that character is decomposable - // - check if that character is a non-starter - // - check if that character requires extra checks to be performed - if (isset($decomp_map[$utf_char])) - { - // Decompose the char - $_pos = 0; - $_len = strlen($decomp_map[$utf_char]); - - do - { - $c = $decomp_map[$utf_char][$_pos]; - $_utf_len =& $utf_len_mask[$c & "\xF0"]; - - if (isset($_utf_len)) - { - $_utf_char = substr($decomp_map[$utf_char], $_pos, $_utf_len); - $_pos += $_utf_len; - - if (isset($utf_combining_class[$_utf_char])) - { - // The character decomposed to a non-starter, buffer it for sorting - $utf_sort[$utf_combining_class[$_utf_char]][] = $_utf_char; - - if ($utf_combining_class[$_utf_char] < $last_cc) - { - // Not canonically ordered, will require sorting - $sort = $dump = 1; - } - else - { - $dump = 1; - $last_cc = $utf_combining_class[$_utf_char]; - } - } - else - { - // This character decomposition contains a starter, dump the buffer and continue - if ($dump) - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - // Dump combiners - if (!empty($utf_sort)) - { - if ($sort) - { - ksort($utf_sort); - } - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - } - - $tmp .= $_utf_char; - $dump = $sort = 0; - } - else - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos) . $_utf_char; - } - - $tmp_pos = $starter_pos = $pos; - $utf_sort = array(); - $last_cc = 0; - } - } - else - { - // This character decomposition contains an ASCII char, which is a starter. Dump the buffer and continue - ++$_pos; - - if ($dump) - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - // Dump combiners - if (!empty($utf_sort)) - { - if ($sort) - { - ksort($utf_sort); - } - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - } - - $tmp .= $c; - $dump = $sort = 0; - } - else - { - $tmp .= substr($str, $tmp_pos, $pos - $utf_len - $tmp_pos) . $c; - } - - $tmp_pos = $starter_pos = $pos; - $utf_sort = array(); - $last_cc = 0; - } - } - while ($_pos < $_len); - } - else if (isset($utf_combining_class[$utf_char])) - { - // Combining character - if ($utf_combining_class[$utf_char] < $last_cc) - { - // Not in canonical order - $sort = $dump = 1; - } - else - { - $last_cc = $utf_combining_class[$utf_char]; - } - - $utf_sort[$utf_combining_class[$utf_char]][] = $utf_char; - } - else - { - // Non-decomposable starter, check out if it's a Hangul syllable - if ($utf_char < UTF8_HANGUL_FIRST || $utf_char > UTF8_HANGUL_LAST) - { - // Nope, regular UTF char, check that we have the correct number of trailing bytes - if (($utf_char & $utf_validation_mask[$utf_len]) != $utf_validation_check[$utf_len]) - { - // Current char isn't well-formed or legal: either one or several trailing bytes are missing, or the Unicode char - // has been encoded in a five- or six- byte sequence. - // Move the cursor back to its original position then advance it to the position it should really be at - $pos -= $utf_len; - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - // Add a replacement char then another replacement char for every trailing byte. - // - // @todo I'm not entirely sure that's how we're supposed to mark invalidated byte sequences, check this - $spn = strspn($str, UTF8_TRAILING_BYTES, ++$pos); - $tmp .= str_repeat(UTF8_REPLACEMENT, $spn + 1); - - $dump = $sort = 0; - - $pos += $spn; - $tmp_pos = $pos; - continue; - } - - if (isset($extra_check[$utf_char[0]])) - { - switch ($utf_char[0]) - { - // Note: 0xED is quite common in Korean - case "\xED": - if ($utf_char >= "\xED\xA0\x80") - { - // Surrogates (U+D800..U+DFFF) are not allowed in UTF-8 (UTF sequence 0xEDA080..0xEDBFBF) - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - // Note: 0xEF is quite common in Japanese - case "\xEF": - if ($utf_char == "\xEF\xBF\xBE" || $utf_char == "\xEF\xBF\xBF") - { - // U+FFFE and U+FFFF are explicitly disallowed (UTF sequence 0xEFBFBE..0xEFBFBF) - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - case "\xC0": - case "\xC1": - if ($utf_char <= "\xC1\xBF") - { - // Overlong sequence: Unicode char U+0000..U+007F encoded as a double-byte UTF char - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - case "\xE0": - if ($utf_char <= "\xE0\x9F\xBF") - { - // Unicode char U+0000..U+07FF encoded in 3 bytes - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - case "\xF0": - if ($utf_char <= "\xF0\x8F\xBF\xBF") - { - // Unicode char U+0000..U+FFFF encoded in 4 bytes - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - - default: - if ($utf_char > UTF8_MAX) - { - // Out of the Unicode range - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - if (!empty($utf_sort)) - { - ksort($utf_sort); - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - $utf_sort = array(); - } - - $tmp .= UTF8_REPLACEMENT; - $dump = $sort = 0; - - $tmp_pos = $starter_pos = $pos; - continue 2; - } - break; - } - } - } - else - { - // Hangul syllable - $idx = (((ord($utf_char[0]) & 0x0F) << 12) | ((ord($utf_char[1]) & 0x3F) << 6) | (ord($utf_char[2]) & 0x3F)) - UNICODE_HANGUL_SBASE; - - // LIndex can only range from 0 to 18, therefore it cannot influence the first two bytes of the L Jamo, which allows us to hardcode them (based on LBase). - // - // The same goes for VIndex, but for TIndex there's a catch: the value of the third byte could exceed 0xBF and we would have to increment the second byte - if ($t_index = $idx % UNICODE_HANGUL_TCOUNT) - { - if ($t_index < 25) - { - $utf_char = "\xE1\x84\x00\xE1\x85\x00\xE1\x86\x00"; - $utf_char[8] = chr(0xA7 + $t_index); - } - else - { - $utf_char = "\xE1\x84\x00\xE1\x85\x00\xE1\x87\x00"; - $utf_char[8] = chr(0x67 + $t_index); - } - } - else - { - $utf_char = "\xE1\x84\x00\xE1\x85\x00"; - } - - $utf_char[2] = chr(0x80 + (int) ($idx / UNICODE_HANGUL_NCOUNT)); - $utf_char[5] = chr(0xA1 + (int) (($idx % UNICODE_HANGUL_NCOUNT) / UNICODE_HANGUL_TCOUNT)); - - // Just like other decompositions, the resulting Jamos must be dumped to the tmp string - $dump = 1; - } - - // Do we need to dump stuff to the tmp string? - if ($dump) - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - // Dump combiners - if (!empty($utf_sort)) - { - if ($sort) - { - ksort($utf_sort); - } - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - } - - $tmp .= $utf_char; - $dump = $sort = 0; - $tmp_pos = $pos; - } - - $last_cc = 0; - $utf_sort = array(); - $starter_pos = $pos; - } - } - else - { - // ASCII char, which happens to be a starter (as any other ASCII char) - if ($dump) - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - // Dump combiners - if (!empty($utf_sort)) - { - if ($sort) - { - ksort($utf_sort); - } - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - } - - $tmp .= $str[$pos]; - $dump = $sort = 0; - $tmp_pos = ++$pos; - - $pos += strspn($str, UTF8_ASCII_RANGE, $pos); - } - else - { - $pos += strspn($str, UTF8_ASCII_RANGE, ++$pos); - } - - $last_cc = 0; - $utf_sort = array(); - $starter_pos = $pos; - } - } - while ($pos < $len); - - // Now is time to return the string - if ($dump) - { - $tmp .= substr($str, $tmp_pos, $starter_pos - $tmp_pos); - - // Dump combiners - if (!empty($utf_sort)) - { - if ($sort) - { - ksort($utf_sort); - } - - foreach ($utf_sort as $utf_chars) - { - $tmp .= implode('', $utf_chars); - } - } - - return $tmp; - } - else if ($tmp_pos) - { - // If the $tmp_pos cursor was moved then at least one character was not in normal form. Replace $str with the fixed version - if ($tmp_pos == $len) - { - // The $tmp_pos cursor is at the end of $str, therefore $tmp holds the whole $str - return $tmp; - } - else - { - // The rightmost chunk of $str has not been appended to $tmp yet - return $tmp . substr($str, $tmp_pos); - } - } - - // The string was already in normal form - return $str; - } -} diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index c402e15032..01caf47349 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -1,9 +1,13 @@ <?php /** * -* @package utf -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,552 +22,99 @@ if (!defined('IN_PHPBB')) setlocale(LC_CTYPE, 'C'); /** +* Setup the UTF-8 portability layer +*/ +Patchwork\Utf8\Bootup::initUtf8Encode(); +Patchwork\Utf8\Bootup::initMbstring(); +Patchwork\Utf8\Bootup::initIntl(); + +/** * UTF-8 tools * * Whenever possible, these functions will try to use PHP's built-in functions or * extensions, otherwise they will default to custom routines. * -* @package utf */ -if (!extension_loaded('xml')) -{ - /** - * Implementation of PHP's native utf8_encode for people without XML support - * This function exploits some nice things that ISO-8859-1 and UTF-8 have in common - * - * @param string $str ISO-8859-1 encoded data - * @return string UTF-8 encoded data - */ - function utf8_encode($str) - { - $out = ''; - for ($i = 0, $len = strlen($str); $i < $len; $i++) - { - $letter = $str[$i]; - $num = ord($letter); - if ($num < 0x80) - { - $out .= $letter; - } - else if ($num < 0xC0) - { - $out .= "\xC2" . $letter; - } - else - { - $out .= "\xC3" . chr($num - 64); - } - } - return $out; - } - - /** - * Implementation of PHP's native utf8_decode for people without XML support - * - * @param string $str UTF-8 encoded data - * @return string ISO-8859-1 encoded data - */ - function utf8_decode($str) - { - $pos = 0; - $len = strlen($str); - $ret = ''; - - while ($pos < $len) - { - $ord = ord($str[$pos]) & 0xF0; - if ($ord === 0xC0 || $ord === 0xD0) - { - $charval = ((ord($str[$pos]) & 0x1F) << 6) | (ord($str[$pos + 1]) & 0x3F); - $pos += 2; - $ret .= (($charval < 256) ? chr($charval) : '?'); - } - else if ($ord === 0xE0) - { - $ret .= '?'; - $pos += 3; - } - else if ($ord === 0xF0) - { - $ret .= '?'; - $pos += 4; - } - else - { - $ret .= $str[$pos]; - ++$pos; - } - } - return $ret; - } -} - -// mbstring is old and has it's functions around for older versions of PHP. -// if mbstring is not loaded, we go into native mode. -if (extension_loaded('mbstring')) +/** +* UTF-8 aware alternative to strrpos +* @ignore +*/ +function utf8_strrpos($str, $needle, $offset = null) { - mb_internal_encoding('UTF-8'); - - /** - * UTF-8 aware alternative to strrpos - * Find position of last occurrence of a char in a string - */ - /** - * UTF-8 aware alternative to strrpos - * @ignore - */ - function utf8_strrpos($str, $needle, $offset = null) - { - // Emulate behaviour of strrpos rather than raising warning - if (empty($str)) - { - return false; - } - - if (is_null($offset)) - { - return mb_strrpos($str, $needle); - } - else - { - return mb_strrpos($str, $needle, $offset); - } - } - - /** - * UTF-8 aware alternative to strpos - * @ignore - */ - function utf8_strpos($str, $needle, $offset = null) + // Emulate behaviour of strrpos rather than raising warning + if (empty($str)) { - if (is_null($offset)) - { - return mb_strpos($str, $needle); - } - else - { - return mb_strpos($str, $needle, $offset); - } + return false; } - /** - * UTF-8 aware alternative to strtolower - * @ignore - */ - function utf8_strtolower($str) + if (is_null($offset)) { - return mb_strtolower($str); + return mb_strrpos($str, $needle); } - - /** - * UTF-8 aware alternative to strtoupper - * @ignore - */ - function utf8_strtoupper($str) + else { - return mb_strtoupper($str); + return mb_strrpos($str, $needle, $offset); } +} - /** - * UTF-8 aware alternative to substr - * @ignore - */ - function utf8_substr($str, $offset, $length = null) +/** +* UTF-8 aware alternative to strpos +* @ignore +*/ +function utf8_strpos($str, $needle, $offset = null) +{ + if (is_null($offset)) { - if (is_null($length)) - { - return mb_substr($str, $offset); - } - else - { - return mb_substr($str, $offset, $length); - } + return mb_strpos($str, $needle); } - - /** - * Return the length (in characters) of a UTF-8 string - * @ignore - */ - function utf8_strlen($text) + else { - return mb_strlen($text, 'utf-8'); + return mb_strpos($str, $needle, $offset); } } -else -{ - /** - * UTF-8 aware alternative to strrpos - * Find position of last occurrence of a char in a string - * - * @author Harry Fuecks - * @param string $str haystack - * @param string $needle needle - * @param integer $offset (optional) offset (from left) - * @return mixed integer position or FALSE on failure - */ - function utf8_strrpos($str, $needle, $offset = null) - { - if (is_null($offset)) - { - $ar = explode($needle, $str); - - if (sizeof($ar) > 1) - { - // Pop off the end of the string where the last match was made - array_pop($ar); - $str = join($needle, $ar); - - return utf8_strlen($str); - } - return false; - } - else - { - if (!is_int($offset)) - { - trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_ERROR); - return false; - } - - $str = utf8_substr($str, $offset); - - if (false !== ($pos = utf8_strrpos($str, $needle))) - { - return $pos + $offset; - } - - return false; - } - } - - /** - * UTF-8 aware alternative to strpos - * Find position of first occurrence of a string - * - * @author Harry Fuecks - * @param string $str haystack - * @param string $needle needle - * @param integer $offset offset in characters (from left) - * @return mixed integer position or FALSE on failure - */ - function utf8_strpos($str, $needle, $offset = null) - { - if (is_null($offset)) - { - $ar = explode($needle, $str); - if (sizeof($ar) > 1) - { - return utf8_strlen($ar[0]); - } - return false; - } - else - { - if (!is_int($offset)) - { - trigger_error('utf8_strpos: Offset must be an integer', E_USER_ERROR); - return false; - } - - $str = utf8_substr($str, $offset); - if (false !== ($pos = utf8_strpos($str, $needle))) - { - return $pos + $offset; - } +/** +* UTF-8 aware alternative to strtolower +* @ignore +*/ +function utf8_strtolower($str) +{ + return mb_strtolower($str); +} - return false; - } - } +/** +* UTF-8 aware alternative to strtoupper +* @ignore +*/ +function utf8_strtoupper($str) +{ + return mb_strtoupper($str); +} - /** - * UTF-8 aware alternative to strtolower - * Make a string lowercase - * Note: The concept of a characters "case" only exists is some alphabets - * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does - * not exist in the Chinese alphabet, for example. See Unicode Standard - * Annex #21: Case Mappings - * - * @param string - * @return string string in lowercase - */ - function utf8_strtolower($string) +/** +* UTF-8 aware alternative to substr +* @ignore +*/ +function utf8_substr($str, $offset, $length = null) +{ + if (is_null($length)) { - static $utf8_upper_to_lower = array( - "\xC3\x80" => "\xC3\xA0", "\xC3\x81" => "\xC3\xA1", - "\xC3\x82" => "\xC3\xA2", "\xC3\x83" => "\xC3\xA3", "\xC3\x84" => "\xC3\xA4", "\xC3\x85" => "\xC3\xA5", - "\xC3\x86" => "\xC3\xA6", "\xC3\x87" => "\xC3\xA7", "\xC3\x88" => "\xC3\xA8", "\xC3\x89" => "\xC3\xA9", - "\xC3\x8A" => "\xC3\xAA", "\xC3\x8B" => "\xC3\xAB", "\xC3\x8C" => "\xC3\xAC", "\xC3\x8D" => "\xC3\xAD", - "\xC3\x8E" => "\xC3\xAE", "\xC3\x8F" => "\xC3\xAF", "\xC3\x90" => "\xC3\xB0", "\xC3\x91" => "\xC3\xB1", - "\xC3\x92" => "\xC3\xB2", "\xC3\x93" => "\xC3\xB3", "\xC3\x94" => "\xC3\xB4", "\xC3\x95" => "\xC3\xB5", - "\xC3\x96" => "\xC3\xB6", "\xC3\x98" => "\xC3\xB8", "\xC3\x99" => "\xC3\xB9", "\xC3\x9A" => "\xC3\xBA", - "\xC3\x9B" => "\xC3\xBB", "\xC3\x9C" => "\xC3\xBC", "\xC3\x9D" => "\xC3\xBD", "\xC3\x9E" => "\xC3\xBE", - "\xC4\x80" => "\xC4\x81", "\xC4\x82" => "\xC4\x83", "\xC4\x84" => "\xC4\x85", "\xC4\x86" => "\xC4\x87", - "\xC4\x88" => "\xC4\x89", "\xC4\x8A" => "\xC4\x8B", "\xC4\x8C" => "\xC4\x8D", "\xC4\x8E" => "\xC4\x8F", - "\xC4\x90" => "\xC4\x91", "\xC4\x92" => "\xC4\x93", "\xC4\x96" => "\xC4\x97", "\xC4\x98" => "\xC4\x99", - "\xC4\x9A" => "\xC4\x9B", "\xC4\x9C" => "\xC4\x9D", "\xC4\x9E" => "\xC4\x9F", "\xC4\xA0" => "\xC4\xA1", - "\xC4\xA2" => "\xC4\xA3", "\xC4\xA4" => "\xC4\xA5", "\xC4\xA6" => "\xC4\xA7", "\xC4\xA8" => "\xC4\xA9", - "\xC4\xAA" => "\xC4\xAB", "\xC4\xAE" => "\xC4\xAF", "\xC4\xB4" => "\xC4\xB5", "\xC4\xB6" => "\xC4\xB7", - "\xC4\xB9" => "\xC4\xBA", "\xC4\xBB" => "\xC4\xBC", "\xC4\xBD" => "\xC4\xBE", "\xC5\x81" => "\xC5\x82", - "\xC5\x83" => "\xC5\x84", "\xC5\x85" => "\xC5\x86", "\xC5\x87" => "\xC5\x88", "\xC5\x8A" => "\xC5\x8B", - "\xC5\x8C" => "\xC5\x8D", "\xC5\x90" => "\xC5\x91", "\xC5\x94" => "\xC5\x95", "\xC5\x96" => "\xC5\x97", - "\xC5\x98" => "\xC5\x99", "\xC5\x9A" => "\xC5\x9B", "\xC5\x9C" => "\xC5\x9D", "\xC5\x9E" => "\xC5\x9F", - "\xC5\xA0" => "\xC5\xA1", "\xC5\xA2" => "\xC5\xA3", "\xC5\xA4" => "\xC5\xA5", "\xC5\xA6" => "\xC5\xA7", - "\xC5\xA8" => "\xC5\xA9", "\xC5\xAA" => "\xC5\xAB", "\xC5\xAC" => "\xC5\xAD", "\xC5\xAE" => "\xC5\xAF", - "\xC5\xB0" => "\xC5\xB1", "\xC5\xB2" => "\xC5\xB3", "\xC5\xB4" => "\xC5\xB5", "\xC5\xB6" => "\xC5\xB7", - "\xC5\xB8" => "\xC3\xBF", "\xC5\xB9" => "\xC5\xBA", "\xC5\xBB" => "\xC5\xBC", "\xC5\xBD" => "\xC5\xBE", - "\xC6\xA0" => "\xC6\xA1", "\xC6\xAF" => "\xC6\xB0", "\xC8\x98" => "\xC8\x99", "\xC8\x9A" => "\xC8\x9B", - "\xCE\x86" => "\xCE\xAC", "\xCE\x88" => "\xCE\xAD", "\xCE\x89" => "\xCE\xAE", "\xCE\x8A" => "\xCE\xAF", - "\xCE\x8C" => "\xCF\x8C", "\xCE\x8E" => "\xCF\x8D", "\xCE\x8F" => "\xCF\x8E", "\xCE\x91" => "\xCE\xB1", - "\xCE\x92" => "\xCE\xB2", "\xCE\x93" => "\xCE\xB3", "\xCE\x94" => "\xCE\xB4", "\xCE\x95" => "\xCE\xB5", - "\xCE\x96" => "\xCE\xB6", "\xCE\x97" => "\xCE\xB7", "\xCE\x98" => "\xCE\xB8", "\xCE\x99" => "\xCE\xB9", - "\xCE\x9A" => "\xCE\xBA", "\xCE\x9B" => "\xCE\xBB", "\xCE\x9C" => "\xCE\xBC", "\xCE\x9D" => "\xCE\xBD", - "\xCE\x9E" => "\xCE\xBE", "\xCE\x9F" => "\xCE\xBF", "\xCE\xA0" => "\xCF\x80", "\xCE\xA1" => "\xCF\x81", - "\xCE\xA3" => "\xCF\x83", "\xCE\xA4" => "\xCF\x84", "\xCE\xA5" => "\xCF\x85", "\xCE\xA6" => "\xCF\x86", - "\xCE\xA7" => "\xCF\x87", "\xCE\xA8" => "\xCF\x88", "\xCE\xA9" => "\xCF\x89", "\xCE\xAA" => "\xCF\x8A", - "\xCE\xAB" => "\xCF\x8B", "\xD0\x81" => "\xD1\x91", "\xD0\x82" => "\xD1\x92", "\xD0\x83" => "\xD1\x93", - "\xD0\x84" => "\xD1\x94", "\xD0\x85" => "\xD1\x95", "\xD0\x86" => "\xD1\x96", "\xD0\x87" => "\xD1\x97", - "\xD0\x88" => "\xD1\x98", "\xD0\x89" => "\xD1\x99", "\xD0\x8A" => "\xD1\x9A", "\xD0\x8B" => "\xD1\x9B", - "\xD0\x8C" => "\xD1\x9C", "\xD0\x8E" => "\xD1\x9E", "\xD0\x8F" => "\xD1\x9F", "\xD0\x90" => "\xD0\xB0", - "\xD0\x91" => "\xD0\xB1", "\xD0\x92" => "\xD0\xB2", "\xD0\x93" => "\xD0\xB3", "\xD0\x94" => "\xD0\xB4", - "\xD0\x95" => "\xD0\xB5", "\xD0\x96" => "\xD0\xB6", "\xD0\x97" => "\xD0\xB7", "\xD0\x98" => "\xD0\xB8", - "\xD0\x99" => "\xD0\xB9", "\xD0\x9A" => "\xD0\xBA", "\xD0\x9B" => "\xD0\xBB", "\xD0\x9C" => "\xD0\xBC", - "\xD0\x9D" => "\xD0\xBD", "\xD0\x9E" => "\xD0\xBE", "\xD0\x9F" => "\xD0\xBF", "\xD0\xA0" => "\xD1\x80", - "\xD0\xA1" => "\xD1\x81", "\xD0\xA2" => "\xD1\x82", "\xD0\xA3" => "\xD1\x83", "\xD0\xA4" => "\xD1\x84", - "\xD0\xA5" => "\xD1\x85", "\xD0\xA6" => "\xD1\x86", "\xD0\xA7" => "\xD1\x87", "\xD0\xA8" => "\xD1\x88", - "\xD0\xA9" => "\xD1\x89", "\xD0\xAA" => "\xD1\x8A", "\xD0\xAB" => "\xD1\x8B", "\xD0\xAC" => "\xD1\x8C", - "\xD0\xAD" => "\xD1\x8D", "\xD0\xAE" => "\xD1\x8E", "\xD0\xAF" => "\xD1\x8F", "\xD2\x90" => "\xD2\x91", - "\xE1\xB8\x82" => "\xE1\xB8\x83", "\xE1\xB8\x8A" => "\xE1\xB8\x8B", "\xE1\xB8\x9E" => "\xE1\xB8\x9F", "\xE1\xB9\x80" => "\xE1\xB9\x81", - "\xE1\xB9\x96" => "\xE1\xB9\x97", "\xE1\xB9\xA0" => "\xE1\xB9\xA1", "\xE1\xB9\xAA" => "\xE1\xB9\xAB", "\xE1\xBA\x80" => "\xE1\xBA\x81", - "\xE1\xBA\x82" => "\xE1\xBA\x83", "\xE1\xBA\x84" => "\xE1\xBA\x85", "\xE1\xBB\xB2" => "\xE1\xBB\xB3" - ); - - return strtr(strtolower($string), $utf8_upper_to_lower); + return mb_substr($str, $offset); } - - /** - * UTF-8 aware alternative to strtoupper - * Make a string uppercase - * Note: The concept of a characters "case" only exists is some alphabets - * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does - * not exist in the Chinese alphabet, for example. See Unicode Standard - * Annex #21: Case Mappings - * - * @param string - * @return string string in uppercase - */ - function utf8_strtoupper($string) + else { - static $utf8_lower_to_upper = array( - "\xC3\xA0" => "\xC3\x80", "\xC3\xA1" => "\xC3\x81", - "\xC3\xA2" => "\xC3\x82", "\xC3\xA3" => "\xC3\x83", "\xC3\xA4" => "\xC3\x84", "\xC3\xA5" => "\xC3\x85", - "\xC3\xA6" => "\xC3\x86", "\xC3\xA7" => "\xC3\x87", "\xC3\xA8" => "\xC3\x88", "\xC3\xA9" => "\xC3\x89", - "\xC3\xAA" => "\xC3\x8A", "\xC3\xAB" => "\xC3\x8B", "\xC3\xAC" => "\xC3\x8C", "\xC3\xAD" => "\xC3\x8D", - "\xC3\xAE" => "\xC3\x8E", "\xC3\xAF" => "\xC3\x8F", "\xC3\xB0" => "\xC3\x90", "\xC3\xB1" => "\xC3\x91", - "\xC3\xB2" => "\xC3\x92", "\xC3\xB3" => "\xC3\x93", "\xC3\xB4" => "\xC3\x94", "\xC3\xB5" => "\xC3\x95", - "\xC3\xB6" => "\xC3\x96", "\xC3\xB8" => "\xC3\x98", "\xC3\xB9" => "\xC3\x99", "\xC3\xBA" => "\xC3\x9A", - "\xC3\xBB" => "\xC3\x9B", "\xC3\xBC" => "\xC3\x9C", "\xC3\xBD" => "\xC3\x9D", "\xC3\xBE" => "\xC3\x9E", - "\xC3\xBF" => "\xC5\xB8", "\xC4\x81" => "\xC4\x80", "\xC4\x83" => "\xC4\x82", "\xC4\x85" => "\xC4\x84", - "\xC4\x87" => "\xC4\x86", "\xC4\x89" => "\xC4\x88", "\xC4\x8B" => "\xC4\x8A", "\xC4\x8D" => "\xC4\x8C", - "\xC4\x8F" => "\xC4\x8E", "\xC4\x91" => "\xC4\x90", "\xC4\x93" => "\xC4\x92", "\xC4\x97" => "\xC4\x96", - "\xC4\x99" => "\xC4\x98", "\xC4\x9B" => "\xC4\x9A", "\xC4\x9D" => "\xC4\x9C", "\xC4\x9F" => "\xC4\x9E", - "\xC4\xA1" => "\xC4\xA0", "\xC4\xA3" => "\xC4\xA2", "\xC4\xA5" => "\xC4\xA4", "\xC4\xA7" => "\xC4\xA6", - "\xC4\xA9" => "\xC4\xA8", "\xC4\xAB" => "\xC4\xAA", "\xC4\xAF" => "\xC4\xAE", "\xC4\xB5" => "\xC4\xB4", - "\xC4\xB7" => "\xC4\xB6", "\xC4\xBA" => "\xC4\xB9", "\xC4\xBC" => "\xC4\xBB", "\xC4\xBE" => "\xC4\xBD", - "\xC5\x82" => "\xC5\x81", "\xC5\x84" => "\xC5\x83", "\xC5\x86" => "\xC5\x85", "\xC5\x88" => "\xC5\x87", - "\xC5\x8B" => "\xC5\x8A", "\xC5\x8D" => "\xC5\x8C", "\xC5\x91" => "\xC5\x90", "\xC5\x95" => "\xC5\x94", - "\xC5\x97" => "\xC5\x96", "\xC5\x99" => "\xC5\x98", "\xC5\x9B" => "\xC5\x9A", "\xC5\x9D" => "\xC5\x9C", - "\xC5\x9F" => "\xC5\x9E", "\xC5\xA1" => "\xC5\xA0", "\xC5\xA3" => "\xC5\xA2", "\xC5\xA5" => "\xC5\xA4", - "\xC5\xA7" => "\xC5\xA6", "\xC5\xA9" => "\xC5\xA8", "\xC5\xAB" => "\xC5\xAA", "\xC5\xAD" => "\xC5\xAC", - "\xC5\xAF" => "\xC5\xAE", "\xC5\xB1" => "\xC5\xB0", "\xC5\xB3" => "\xC5\xB2", "\xC5\xB5" => "\xC5\xB4", - "\xC5\xB7" => "\xC5\xB6", "\xC5\xBA" => "\xC5\xB9", "\xC5\xBC" => "\xC5\xBB", "\xC5\xBE" => "\xC5\xBD", - "\xC6\xA1" => "\xC6\xA0", "\xC6\xB0" => "\xC6\xAF", "\xC8\x99" => "\xC8\x98", "\xC8\x9B" => "\xC8\x9A", - "\xCE\xAC" => "\xCE\x86", "\xCE\xAD" => "\xCE\x88", "\xCE\xAE" => "\xCE\x89", "\xCE\xAF" => "\xCE\x8A", - "\xCE\xB1" => "\xCE\x91", "\xCE\xB2" => "\xCE\x92", "\xCE\xB3" => "\xCE\x93", "\xCE\xB4" => "\xCE\x94", - "\xCE\xB5" => "\xCE\x95", "\xCE\xB6" => "\xCE\x96", "\xCE\xB7" => "\xCE\x97", "\xCE\xB8" => "\xCE\x98", - "\xCE\xB9" => "\xCE\x99", "\xCE\xBA" => "\xCE\x9A", "\xCE\xBB" => "\xCE\x9B", "\xCE\xBC" => "\xCE\x9C", - "\xCE\xBD" => "\xCE\x9D", "\xCE\xBE" => "\xCE\x9E", "\xCE\xBF" => "\xCE\x9F", "\xCF\x80" => "\xCE\xA0", - "\xCF\x81" => "\xCE\xA1", "\xCF\x83" => "\xCE\xA3", "\xCF\x84" => "\xCE\xA4", "\xCF\x85" => "\xCE\xA5", - "\xCF\x86" => "\xCE\xA6", "\xCF\x87" => "\xCE\xA7", "\xCF\x88" => "\xCE\xA8", "\xCF\x89" => "\xCE\xA9", - "\xCF\x8A" => "\xCE\xAA", "\xCF\x8B" => "\xCE\xAB", "\xCF\x8C" => "\xCE\x8C", "\xCF\x8D" => "\xCE\x8E", - "\xCF\x8E" => "\xCE\x8F", "\xD0\xB0" => "\xD0\x90", "\xD0\xB1" => "\xD0\x91", "\xD0\xB2" => "\xD0\x92", - "\xD0\xB3" => "\xD0\x93", "\xD0\xB4" => "\xD0\x94", "\xD0\xB5" => "\xD0\x95", "\xD0\xB6" => "\xD0\x96", - "\xD0\xB7" => "\xD0\x97", "\xD0\xB8" => "\xD0\x98", "\xD0\xB9" => "\xD0\x99", "\xD0\xBA" => "\xD0\x9A", - "\xD0\xBB" => "\xD0\x9B", "\xD0\xBC" => "\xD0\x9C", "\xD0\xBD" => "\xD0\x9D", "\xD0\xBE" => "\xD0\x9E", - "\xD0\xBF" => "\xD0\x9F", "\xD1\x80" => "\xD0\xA0", "\xD1\x81" => "\xD0\xA1", "\xD1\x82" => "\xD0\xA2", - "\xD1\x83" => "\xD0\xA3", "\xD1\x84" => "\xD0\xA4", "\xD1\x85" => "\xD0\xA5", "\xD1\x86" => "\xD0\xA6", - "\xD1\x87" => "\xD0\xA7", "\xD1\x88" => "\xD0\xA8", "\xD1\x89" => "\xD0\xA9", "\xD1\x8A" => "\xD0\xAA", - "\xD1\x8B" => "\xD0\xAB", "\xD1\x8C" => "\xD0\xAC", "\xD1\x8D" => "\xD0\xAD", "\xD1\x8E" => "\xD0\xAE", - "\xD1\x8F" => "\xD0\xAF", "\xD1\x91" => "\xD0\x81", "\xD1\x92" => "\xD0\x82", "\xD1\x93" => "\xD0\x83", - "\xD1\x94" => "\xD0\x84", "\xD1\x95" => "\xD0\x85", "\xD1\x96" => "\xD0\x86", "\xD1\x97" => "\xD0\x87", - "\xD1\x98" => "\xD0\x88", "\xD1\x99" => "\xD0\x89", "\xD1\x9A" => "\xD0\x8A", "\xD1\x9B" => "\xD0\x8B", - "\xD1\x9C" => "\xD0\x8C", "\xD1\x9E" => "\xD0\x8E", "\xD1\x9F" => "\xD0\x8F", "\xD2\x91" => "\xD2\x90", - "\xE1\xB8\x83" => "\xE1\xB8\x82", "\xE1\xB8\x8B" => "\xE1\xB8\x8A", "\xE1\xB8\x9F" => "\xE1\xB8\x9E", "\xE1\xB9\x81" => "\xE1\xB9\x80", - "\xE1\xB9\x97" => "\xE1\xB9\x96", "\xE1\xB9\xA1" => "\xE1\xB9\xA0", "\xE1\xB9\xAB" => "\xE1\xB9\xAA", "\xE1\xBA\x81" => "\xE1\xBA\x80", - "\xE1\xBA\x83" => "\xE1\xBA\x82", "\xE1\xBA\x85" => "\xE1\xBA\x84", "\xE1\xBB\xB3" => "\xE1\xBB\xB2" - ); - - return strtr(strtoupper($string), $utf8_lower_to_upper); - } - - /** - * UTF-8 aware alternative to substr - * Return part of a string given character offset (and optionally length) - * - * Note arguments: comparied to substr - if offset or length are - * not integers, this version will not complain but rather massages them - * into an integer. - * - * Note on returned values: substr documentation states false can be - * returned in some cases (e.g. offset > string length) - * mb_substr never returns false, it will return an empty string instead. - * This adopts the mb_substr approach - * - * Note on implementation: PCRE only supports repetitions of less than - * 65536, in order to accept up to MAXINT values for offset and length, - * we'll repeat a group of 65535 characters when needed. - * - * Note on implementation: calculating the number of characters in the - * string is a relatively expensive operation, so we only carry it out when - * necessary. It isn't necessary for +ve offsets and no specified length - * - * @author Chris Smith<chris@jalakai.co.uk> - * @param string $str - * @param integer $offset number of UTF-8 characters offset (from left) - * @param integer $length (optional) length in UTF-8 characters from offset - * @return mixed string or FALSE if failure - */ - function utf8_substr($str, $offset, $length = NULL) - { - // generates E_NOTICE - // for PHP4 objects, but not PHP5 objects - $str = (string) $str; - $offset = (int) $offset; - if (!is_null($length)) - { - $length = (int) $length; - } - - // handle trivial cases - if ($length === 0 || ($offset < 0 && $length < 0 && $length < $offset)) - { - return ''; - } - - // normalise negative offsets (we could use a tail - // anchored pattern, but they are horribly slow!) - if ($offset < 0) - { - // see notes - $strlen = utf8_strlen($str); - $offset = $strlen + $offset; - if ($offset < 0) - { - $offset = 0; - } - } - - $op = ''; - $lp = ''; - - // establish a pattern for offset, a - // non-captured group equal in length to offset - if ($offset > 0) - { - $ox = (int) ($offset / 65535); - $oy = $offset % 65535; - - if ($ox) - { - $op = '(?:.{65535}){' . $ox . '}'; - } - - $op = '^(?:' . $op . '.{' . $oy . '})'; - } - else - { - // offset == 0; just anchor the pattern - $op = '^'; - } - - // establish a pattern for length - if (is_null($length)) - { - // the rest of the string - $lp = '(.*)$'; - } - else - { - if (!isset($strlen)) - { - // see notes - $strlen = utf8_strlen($str); - } - - // another trivial case - if ($offset > $strlen) - { - return ''; - } - - if ($length > 0) - { - // reduce any length that would - // go passed the end of the string - $length = min($strlen - $offset, $length); - - $lx = (int) ($length / 65535); - $ly = $length % 65535; - - // negative length requires a captured group - // of length characters - if ($lx) - { - $lp = '(?:.{65535}){' . $lx . '}'; - } - $lp = '(' . $lp . '.{'. $ly . '})'; - } - else if ($length < 0) - { - if ($length < ($offset - $strlen)) - { - return ''; - } - - $lx = (int)((-$length) / 65535); - $ly = (-$length) % 65535; - - // negative length requires ... capture everything - // except a group of -length characters - // anchored at the tail-end of the string - if ($lx) - { - $lp = '(?:.{65535}){' . $lx . '}'; - } - $lp = '(.*)(?:' . $lp . '.{' . $ly . '})$'; - } - } - - if (!preg_match('#' . $op . $lp . '#us', $str, $match)) - { - return ''; - } - - return $match[1]; + return mb_substr($str, $offset, $length); } +} - /** - * Return the length (in characters) of a UTF-8 string - * - * @param string $text UTF-8 string - * @return integer Length (in chars) of given string - */ - function utf8_strlen($text) - { - // Since utf8_decode is replacing multibyte characters to ? strlen works fine - return strlen(utf8_decode($text)); - } +/** +* Return the length (in characters) of a UTF-8 string +* @ignore +*/ +function utf8_strlen($text) +{ + return mb_strlen($text, 'utf-8'); } /** @@ -864,7 +415,6 @@ function utf8_recode($string, $encoding) // Trigger an error?! Fow now just give bad data :-( trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); - //return $string; // use utf_normalizer::cleanup() ? } /** @@ -1603,19 +1153,12 @@ function utf8_case_fold_nfkc($text, $option = 'full') "\xF0\x9D\x9E\xBB" => "\xCF\x83", "\xF0\x9D\x9F\x8A" => "\xCF\x9D", ); - global $phpbb_root_path, $phpEx; // do the case fold $text = utf8_case_fold($text, $option); - if (!class_exists('utf_normalizer')) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); - } - // convert to NFKC - utf_normalizer::nfkc($text); + Normalizer::normalize($text, Normalizer::NFKC); // FC_NFKC_Closure, http://www.unicode.org/Public/5.0.0/ucd/DerivedNormalizationProps.txt $text = strtr($text, $fc_nfkc_closure); @@ -1700,7 +1243,6 @@ function utf8_case_fold_nfc($text, $option = 'full') "\xE1\xBF\xB7" => "\xE1\xBF\xB6\xCD\x85", "\xE1\xBF\xBC" => "\xCE\xA9\xCD\x85", ); - global $phpbb_root_path, $phpEx; // perform a small trick, avoid further normalization on composed points that contain U+0345 in their decomposition $text = strtr($text, $ypogegrammeni); @@ -1711,106 +1253,56 @@ function utf8_case_fold_nfc($text, $option = 'full') return $text; } -if (extension_loaded('intl')) +/** +* wrapper around PHP's native normalizer from intl +* previously a PECL extension, included in the core since PHP 5.3.0 +* http://php.net/manual/en/normalizer.normalize.php +* +* @param mixed $strings a string or an array of strings to normalize +* @return mixed the normalized content, preserving array keys if array given. +*/ +function utf8_normalize_nfc($strings) { - /** - * wrapper around PHP's native normalizer from intl - * previously a PECL extension, included in the core since PHP 5.3.0 - * http://php.net/manual/en/normalizer.normalize.php - * - * @param mixed $strings a string or an array of strings to normalize - * @return mixed the normalized content, preserving array keys if array given. - */ - function utf8_normalize_nfc($strings) + if (empty($strings)) { - if (empty($strings)) - { - return $strings; - } - - if (!is_array($strings)) - { - if (Normalizer::isNormalized($strings)) - { - return $strings; - } - return (string) Normalizer::normalize($strings); - } - else - { - foreach ($strings as $key => $string) - { - if (is_array($string)) - { - foreach ($string as $_key => $_string) - { - if (Normalizer::isNormalized($strings[$key][$_key])) - { - continue; - } - $strings[$key][$_key] = (string) Normalizer::normalize($strings[$key][$_key]); - } - } - else - { - if (Normalizer::isNormalized($strings[$key])) - { - continue; - } - $strings[$key] = (string) Normalizer::normalize($strings[$key]); - } - } - } - return $strings; } -} -else -{ - /** - * A wrapper function for the normalizer which takes care of including the class if - * required and modifies the passed strings to be in NFC (Normalization Form Composition). - * - * @param mixed $strings a string or an array of strings to normalize - * @return mixed the normalized content, preserving array keys if array given. - */ - function utf8_normalize_nfc($strings) + + if (!is_array($strings)) { - if (empty($strings)) + if (Normalizer::isNormalized($strings)) { return $strings; } - - if (!class_exists('utf_normalizer')) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); - } - - if (!is_array($strings)) - { - utf_normalizer::nfc($strings); - } - else if (is_array($strings)) + return (string) Normalizer::normalize($strings); + } + else + { + foreach ($strings as $key => $string) { - foreach ($strings as $key => $string) + if (is_array($string)) { - if (is_array($string)) + foreach ($string as $_key => $_string) { - foreach ($string as $_key => $_string) + if (Normalizer::isNormalized($strings[$key][$_key])) { - utf_normalizer::nfc($strings[$key][$_key]); + continue; } + $strings[$key][$_key] = (string) Normalizer::normalize($strings[$key][$_key]); } - else + } + else + { + if (Normalizer::isNormalized($strings[$key])) { - utf_normalizer::nfc($strings[$key]); + continue; } + $strings[$key] = (string) Normalizer::normalize($strings[$key]); } } - - return $strings; } + + return $strings; } /** @@ -1956,50 +1448,3 @@ function utf8_basename($filename) return $filename; } - -/** -* UTF8-safe str_replace() function -* -* @param string $search The value to search for -* @param string $replace The replacement string -* @param string $subject The target string -* @return string The resultant string -*/ -function utf8_str_replace($search, $replace, $subject) -{ - if (!is_array($search)) - { - $search = array($search); - if (is_array($replace)) - { - $replace = (string) $replace; - trigger_error('Array to string conversion', E_USER_NOTICE); - } - } - - $length = sizeof($search); - - if (!is_array($replace)) - { - $replace = array_fill(0, $length, $replace); - } - else - { - $replace = array_pad($replace, $length, ''); - } - - for ($i = 0; $i < $length; $i++) - { - $search_length = utf8_strlen($search[$i]); - $replace_length = utf8_strlen($replace[$i]); - - $offset = 0; - while (($start = utf8_strpos($subject, $search[$i], $offset)) !== false) - { - $subject = utf8_substr($subject, 0, $start) . $replace[$i] . utf8_substr($subject, $start + $search_length); - $offset = $start + $replace_length; - } - } - - return $subject; -} diff --git a/phpBB/index.php b/phpBB/index.php index c363781667..9939b9ba7f 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -38,9 +42,10 @@ if (($mark_notification = $request->variable('mark_notification', 0))) if (check_link_hash($request->variable('hash', ''), 'mark_notification_read')) { + /* @var $phpbb_notifications \phpbb\notification\manager */ $phpbb_notifications = $phpbb_container->get('notification_manager'); - $notification = $phpbb_notifications->load_notifications(array( + $notification = $phpbb_notifications->load_notifications('notification.method.board', array( 'notification_id' => $mark_notification, )); @@ -63,7 +68,7 @@ if (($mark_notification = $request->variable('mark_notification', 0))) redirect(append_sid($phpbb_root_path . $redirect)); } - redirect($notification->get_url()); + redirect($notification->get_redirect_url()); } } } @@ -95,11 +100,14 @@ else } $result = $db->sql_query($sql); +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + $legend = array(); while ($row = $db->sql_fetchrow($result)) { $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; - $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $group_name = $group_helper->get_name($row['group_name']); if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile'))) { @@ -115,7 +123,7 @@ $db->sql_freeresult($result); $legend = implode($user->lang['COMMA_SEPARATOR'], $legend); // Generate birthday list if required ... -$birthday_list = array(); +$birthdays = $birthday_list = array(); if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) { $time = $user->create_datetime(); @@ -128,33 +136,66 @@ if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets(' $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; } - $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday - FROM ' . USERS_TABLE . ' u - LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid) - WHERE (b.ban_id IS NULL - OR b.ban_exclude = 1) + $sql_ary = array( + 'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_birthday', + 'FROM' => array( + USERS_TABLE => 'u', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(BANLIST_TABLE => 'b'), + 'ON' => 'u.user_id = b.ban_userid', + ), + ), + 'WHERE' => "(b.ban_id IS NULL OR b.ban_exclude = 1) AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays) - AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')', + ); + + /** + * Event to modify the SQL query to get birthdays data + * + * @event core.index_modify_birthdays_sql + * @var array now The assoc array with the 'now' local timestamp data + * @var array sql_ary The SQL array to get the birthdays data + * @var object time The user related Datetime object + * @since 3.1.7-RC1 + */ + $vars = array('now', 'sql_ary', 'time'); + extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); + $rows = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); - while ($row = $db->sql_fetchrow($result)) + foreach ($rows as $row) { $birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); $birthday_year = (int) substr($row['user_birthday'], -4); $birthday_age = ($birthday_year) ? max(0, $now['year'] - $birthday_year) : ''; - $template->assign_block_vars('birthdays', array( + $birthdays[] = array( 'USERNAME' => $birthday_username, 'AGE' => $birthday_age, - )); + ); // For 3.0 compatibility - if ($age = (int) substr($row['user_birthday'], -4)) - { - $birthday_list[] = $birthday_username . (($birthday_year) ? ' (' . $birthday_age . ')' : ''); - } + $birthday_list[] = $birthday_username . (($birthday_age) ? " ({$birthday_age})" : ''); } - $db->sql_freeresult($result); + + /** + * Event to modify the birthdays list + * + * @event core.index_modify_birthdays_list + * @var array birthdays Array with the users birhtdays data + * @var array rows Array with the birhtdays SQL query result + * @since 3.1.7-RC1 + */ + $vars = array('birthdays', 'rows'); + extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_list', compact($vars))); + + $template->assign_block_vars_array('birthdays', $birthdays); } // Assign index specific vars @@ -175,25 +216,26 @@ $template->assign_vars(array( 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false, + 'S_INDEX' => true, 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : '', 'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '') ); -$page_title = $user->lang['INDEX']; +$page_title = ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['INDEX']; /** * You can use this event to modify the page title and load data for the index * * @event core.index_modify_page_title * @var string page_title Title of the index page -* @since 3.1-A1 +* @since 3.1.0-a1 */ $vars = array('page_title'); extract($phpbb_dispatcher->trigger_event('core.index_modify_page_title', compact($vars))); // Output page -page_header($page_title); +page_header($page_title, true); $template->set_filenames(array( 'body' => 'index_body.html') diff --git a/phpBB/install/app.php b/phpBB/install/app.php new file mode 100644 index 0000000000..9664f92cf1 --- /dev/null +++ b/phpBB/install/app.php @@ -0,0 +1,58 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * @ignore + */ +define('IN_PHPBB', true); +define('IN_INSTALL', true); +define('PHPBB_ENVIRONMENT', 'production'); +$phpbb_root_path = '../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); + +$startup_new_path = $phpbb_root_path . 'install/update/update/new/install/startup.' . $phpEx; +$startup_path = (file_exists($startup_new_path)) ? $startup_new_path : $phpbb_root_path . 'install/startup.' . $phpEx; +require($startup_path); + +/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */ +$phpbb_filesystem = $phpbb_installer_container->get('filesystem'); + +/** @var \phpbb\template\template $template */ +$template = $phpbb_installer_container->get('template'); + +// Path to templates +$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); +$paths = array_filter($paths, 'is_dir'); + +$template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), +), $paths); + +/** @var $phpbb_dispatcher \phpbb\event\dispatcher */ +$phpbb_dispatcher = $phpbb_installer_container->get('dispatcher'); + +/** @var \phpbb\language\language $language */ +$language = $phpbb_installer_container->get('language'); +$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + +/** @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel */ +$http_kernel = $phpbb_installer_container->get('http_kernel'); + +/** @var $symfony_request \phpbb\symfony_request */ +$symfony_request = $phpbb_installer_container->get('symfony_request'); +$response = $http_kernel->handle($symfony_request); +$response->send(); +$http_kernel->terminate($symfony_request, $response); diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 94f685fa2f..282b3d238a 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -1,9 +1,13 @@ <?php /** * -* @package install -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,10 +25,11 @@ if (!defined('IN_PHPBB')) exit; } -include($phpbb_root_path . 'config.' . $phpEx); +$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); +extract($phpbb_config_php_file->get_all()); unset($dbpasswd); -$dbms = phpbb_convert_30_dbms_to_31($dbms); +$dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); /** * $convertor_data provides some basic information about this convertor which is @@ -33,8 +38,8 @@ $dbms = phpbb_convert_30_dbms_to_31($dbms); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.1.0-a3', - 'author' => '<a href="https://www.phpbb.com/">phpBB Group</a>', + 'phpbb_version' => '3.2.0-a2', + 'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>', 'dbms' => $dbms, 'dbhost' => $dbhost, 'dbport' => $dbport, @@ -228,11 +233,11 @@ if (!$get_info) $user_id = (int) $src_db->sql_fetchfield('max_user_id'); $src_db->sql_freeresult($result); - set_config('increment_user_id', ($user_id + 1), true); + $config->set('increment_user_id', ($user_id + 1), false); } else { - set_config('increment_user_id', 0, true); + $config->set('increment_user_id', 0, false); } // Overwrite maximum avatar width/height @@ -891,8 +896,7 @@ if (!$get_info) array('user_regdate', 'users.user_regdate', ''), array('username', 'users.username', 'phpbb_set_default_encoding'), // recode to utf8 with default lang array('username_clean', 'users.username', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_clean_string')), - array('user_password', 'users.user_password', 'phpbb_hash'), - array('user_pass_convert', 1, ''), + array('user_password', 'users.user_password', 'phpbb_convert_password_hash'), array('user_posts', 'users.user_posts', 'intval'), array('user_email', 'users.user_email', 'strtolower'), array('user_email_hash', 'users.user_email', 'gen_email_hash'), @@ -906,12 +910,7 @@ if (!$get_info) array('user_inactive_reason', '', 'phpbb_inactive_reason'), array('user_inactive_time', '', 'phpbb_inactive_time'), - array('user_website', 'users.user_website', 'validate_website'), array('user_jabber', '', ''), - array('user_msnm', 'users.user_msnm', array('function1' => 'phpbb_set_encoding')), - array('user_yim', 'users.user_yim', array('function1' => 'phpbb_set_encoding')), - array('user_aim', 'users.user_aim', array('function1' => 'phpbb_set_encoding')), - array('user_icq', 'users.user_icq', array('function1' => 'phpbb_set_encoding')), array('user_rank', 'users.user_rank', 'intval'), array('user_permissions', '', ''), @@ -963,6 +962,10 @@ if (!$get_info) array('pf_phpbb_occupation', 'users.user_occ', array('function1' => 'phpbb_set_encoding')), array('pf_phpbb_interests', 'users.user_interests', array('function1' => 'phpbb_set_encoding')), array('pf_phpbb_location', 'users.user_from', array('function1' => 'phpbb_set_encoding')), + array('pf_phpbb_icq', 'users.user_icq', array('function1' => 'phpbb_set_encoding')), + array('pf_phpbb_yahoo', 'users.user_yim', array('function1' => 'phpbb_set_encoding')), + array('pf_phpbb_aol', 'users.user_aim', array('function1' => 'phpbb_set_encoding')), + array('pf_phpbb_website', 'users.user_website', 'validate_website'), 'where' => 'users.user_id <> -1', ), diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 29e5f7ab09..e8de7ef3e1 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -1,9 +1,13 @@ <?php /** * -* @package install -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -50,7 +54,7 @@ function phpbb_forum_flags() */ function phpbb_insert_forums() { - global $db, $src_db, $same_db, $convert, $user, $config; + global $db, $src_db, $same_db, $convert, $user; $db->sql_query($convert->truncate_statement . FORUMS_TABLE); @@ -71,7 +75,6 @@ function phpbb_insert_forums() $prune_enabled = (int) $src_db->sql_fetchfield('config_value'); $src_db->sql_freeresult($result); - // Insert categories $sql = 'SELECT cat_id, cat_title FROM ' . $convert->src_table_prefix . 'categories @@ -89,7 +92,7 @@ function phpbb_insert_forums() $src_db->sql_query("SET NAMES 'utf8'"); } - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mssql': case 'mssql_odbc': @@ -176,7 +179,6 @@ function phpbb_insert_forums() $db->sql_query($sql); $cats_added[$unknown_cat_id] = $max_forum_id; - $max_forum_id++; } // Now insert the forums @@ -220,7 +222,7 @@ function phpbb_insert_forums() 'forum_desc' => htmlspecialchars(phpbb_set_default_encoding($row['forum_desc']), ENT_COMPAT, 'UTF-8'), 'forum_type' => FORUM_POST, 'forum_status' => is_item_locked($row['forum_status']), - 'enable_prune' => ($prune_enabled) ? (int)$row['prune_enable'] : 0, + 'enable_prune' => ($prune_enabled) ? (int) $row['prune_enable'] : 0, 'prune_next' => (int) null_to_zero($row['prune_next']), 'prune_days' => (int) null_to_zero($row['prune_days']), 'prune_viewed' => 0, @@ -286,7 +288,7 @@ function phpbb_insert_forums() } $src_db->sql_freeresult($result); - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'postgres': $db->sql_query("SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));'); @@ -419,8 +421,6 @@ function phpbb_set_encoding($text, $grab_user_lang = true) } } - $encoding = $lang_enc_array[$get_lang]; - return utf8_recode($text, $lang_enc_array[$get_lang]); } @@ -511,12 +511,12 @@ function phpbb_user_id($user_id) // If there is a user id 1, we need to increment user ids. :/ if ($id === 1) { - set_config('increment_user_id', ($max_id + 1), true); + $config->set('increment_user_id', ($max_id + 1), false); $config['increment_user_id'] = $max_id + 1; } else { - set_config('increment_user_id', 0, true); + $config->set('increment_user_id', 0, false); $config['increment_user_id'] = 0; } } @@ -561,7 +561,7 @@ function phpbb_copy_table_fields() */ function phpbb_convert_authentication($mode) { - global $db, $src_db, $same_db, $convert, $user, $config, $cache; + global $db, $src_db, $same_db, $convert, $config; if ($mode == 'start') { @@ -571,7 +571,6 @@ function phpbb_convert_authentication($mode) // What we will do is handling all 2.0.x admins as founder to replicate what is common in 2.0.x. // After conversion the main admin need to make sure he is removing permissions and the founder status if wanted. - // Grab user ids of users with user_level of ADMIN $sql = "SELECT user_id FROM {$convert->src_table_prefix}users @@ -659,7 +658,7 @@ function phpbb_convert_authentication($mode) 'auth_delete' => 'f_delete', 'auth_pollcreate' => 'f_poll', 'auth_vote' => 'f_vote', - 'auth_announce' => 'f_announce', + 'auth_announce' => array('f_announce', 'f_announce_global'), 'auth_sticky' => 'f_sticky', 'auth_attachments' => array('f_attach', 'f_download'), 'auth_download' => 'f_download', @@ -988,7 +987,7 @@ function phpbb_convert_authentication($mode) // We make sure that they have at least standard access to the forums they moderate in addition to the moderating permissions $mod_post_map = array( - 'auth_announce' => 'f_announce', + 'auth_announce' => array('f_announce', 'f_announce_global'), 'auth_sticky' => 'f_sticky' ); @@ -1219,7 +1218,7 @@ function phpbb_replace_size($matches) */ function phpbb_prepare_message($message) { - global $phpbb_root_path, $phpEx, $db, $convert, $user, $config, $cache, $convert_row, $message_parser; + global $convert, $user, $convert_row, $message_parser; if (!$message) { @@ -1249,9 +1248,6 @@ function phpbb_prepare_message($message) $message = str_replace('\"', '"', $message); } - // Already the new user id ;) - $user_id = $convert->row['poster_id']; - $message = str_replace('<br />', "\n", $message); $message = str_replace('<', '<', $message); $message = str_replace('>', '>', $message); @@ -1303,7 +1299,7 @@ function get_bbcode_bitfield() */ function phpbb_post_edit_user() { - global $convert_row, $config; + global $convert_row; if (isset($convert_row['post_edit_count'])) { @@ -1324,7 +1320,7 @@ function phpbb_get_files_dir() return; } - global $src_db, $same_db, $convert, $user, $config, $cache; + global $src_db, $same_db, $convert, $user; if ($convert->mysql_convert && $same_db) { @@ -1363,7 +1359,7 @@ function phpbb_get_files_dir() */ function phpbb_copy_thumbnails() { - global $db, $convert, $user, $config, $cache, $phpbb_root_path; + global $convert, $config, $phpbb_root_path; $src_path = $convert->options['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/'; @@ -1609,8 +1605,6 @@ function phpbb_get_avatar_width($user_avatar) */ function phpbb_privmsgs_to_userid($to_userid) { - global $config; - return 'u_' . phpbb_user_id($to_userid); } @@ -1657,7 +1651,7 @@ function phpbb_get_savebox_id($user_id) */ function phpbb_import_attach_config() { - global $db, $src_db, $same_db, $convert, $config; + global $src_db, $same_db, $convert, $config; if ($convert->mysql_convert && $same_db) { @@ -1680,29 +1674,29 @@ function phpbb_import_attach_config() } $src_db->sql_freeresult($result); - set_config('allow_attachments', 1); + $config->set('allow_attachments', 1); // old attachment mod? Must be very old if this entry do not exist... if (!empty($attach_config['display_order'])) { - set_config('display_order', $attach_config['display_order']); - } - set_config('max_filesize', $attach_config['max_filesize']); - set_config('max_filesize_pm', $attach_config['max_filesize_pm']); - set_config('attachment_quota', $attach_config['attachment_quota']); - set_config('max_attachments', $attach_config['max_attachments']); - set_config('max_attachments_pm', $attach_config['max_attachments_pm']); - set_config('allow_pm_attach', $attach_config['allow_pm_attach']); - - set_config('img_display_inlined', $attach_config['img_display_inlined']); - set_config('img_max_width', $attach_config['img_max_width']); - set_config('img_max_height', $attach_config['img_max_height']); - set_config('img_link_width', $attach_config['img_link_width']); - set_config('img_link_height', $attach_config['img_link_height']); - set_config('img_create_thumbnail', $attach_config['img_create_thumbnail']); - set_config('img_max_thumb_width', 400); - set_config('img_min_thumb_filesize', $attach_config['img_min_thumb_filesize']); - set_config('img_imagick', $attach_config['img_imagick']); + $config->set('display_order', $attach_config['display_order']); + } + $config->set('max_filesize', $attach_config['max_filesize']); + $config->set('max_filesize_pm', $attach_config['max_filesize_pm']); + $config->set('attachment_quota', $attach_config['attachment_quota']); + $config->set('max_attachments', $attach_config['max_attachments']); + $config->set('max_attachments_pm', $attach_config['max_attachments_pm']); + $config->set('allow_pm_attach', $attach_config['allow_pm_attach']); + + $config->set('img_display_inlined', $attach_config['img_display_inlined']); + $config->set('img_max_width', $attach_config['img_max_width']); + $config->set('img_max_height', $attach_config['img_max_height']); + $config->set('img_link_width', $attach_config['img_link_width']); + $config->set('img_link_height', $attach_config['img_link_height']); + $config->set('img_create_thumbnail', $attach_config['img_create_thumbnail']); + $config->set('img_max_thumb_width', 400); + $config->set('img_min_thumb_filesize', $attach_config['img_min_thumb_filesize']); + $config->set('img_imagick', $attach_config['img_imagick']); } /** @@ -1763,10 +1757,9 @@ function phpbb_disallowed_username($username) */ function phpbb_create_userconv_table() { - global $db, $src_db, $convert, $table_prefix, $user, $lang; + global $db; - $map_dbms = ''; - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': $map_dbms = 'mysql_40'; @@ -1794,7 +1787,7 @@ function phpbb_create_userconv_table() break; default: - $map_dbms = $db->sql_layer; + $map_dbms = $db->get_sql_layer(); break; } @@ -1802,13 +1795,6 @@ function phpbb_create_userconv_table() $drop_sql = 'DROP TABLE ' . USERCONV_TABLE; switch ($map_dbms) { - case 'firebird': - $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' ( - user_id INTEGER NOT NULL, - username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT \'\' NOT NULL COLLATE UNICODE - )'; - break; - case 'mssql': $create_sql = 'CREATE TABLE [' . USERCONV_TABLE . '] ( [user_id] [int] NOT NULL , @@ -1845,6 +1831,7 @@ function phpbb_create_userconv_table() break; case 'sqlite': + case 'sqlite3': $create_sql = 'CREATE TABLE ' . USERCONV_TABLE . ' ( user_id INTEGER NOT NULL DEFAULT \'0\', username_clean varchar(255) NOT NULL DEFAULT \'\' @@ -1860,7 +1847,7 @@ function phpbb_create_userconv_table() function phpbb_check_username_collisions() { - global $db, $src_db, $convert, $table_prefix, $user, $lang; + global $db, $src_db, $convert, $user, $lang; // now find the clean version of the usernames that collide $sql = 'SELECT username_clean @@ -1930,7 +1917,9 @@ function phpbb_check_username_collisions() function phpbb_convert_timezone($timezone) { global $config, $db, $phpbb_root_path, $phpEx, $table_prefix; - $timezone_migration = new \phpbb\db\migration\data\v310\timezone($config, $db, new \phpbb\db\tools($db), $phpbb_root_path, $phpEx, $table_prefix); + + $factory = new \phpbb\db\tools\factory(); + $timezone_migration = new \phpbb\db\migration\data\v310\timezone($config, $db, $factory->get($db), $phpbb_root_path, $phpEx, $table_prefix); return $timezone_migration->convert_phpbb30_timezone($timezone, 0); } @@ -1971,5 +1960,16 @@ function phpbb_add_notification_options($user_notify_pm) ); } - $sql = $db->sql_multi_insert(USER_NOTIFICATIONS_TABLE, $rows); + $db->sql_multi_insert(USER_NOTIFICATIONS_TABLE, $rows); +} + +function phpbb_convert_password_hash($hash) +{ + global $phpbb_container; + + /* @var $manager \phpbb\passwords\manager */ + $manager = $phpbb_container->get('passwords.manager'); + $hash = $manager->hash($hash, '$H$'); + + return '$CP$' . $hash; } diff --git a/phpBB/install/data/confusables.php b/phpBB/install/data/confusables.php index f5d3b11731..00e806f639 100644 --- a/phpBB/install/data/confusables.php +++ b/phpBB/install/data/confusables.php @@ -1,9 +1,13 @@ <?php /** * -* @package install -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -624,19 +628,12 @@ function utf8_new_case_fold_nfkc($text, $option = 'full') "\xF0\x9D\x9E\xBB" => "\xCF\x83", "\xF0\x9D\x9F\x8A" => "\xCF\x9D", ); - global $phpbb_root_path, $phpEx; // do the case fold $text = utf8_new_case_fold($text, $option); - if (!class_exists('utf_normalizer')) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); - } - // convert to NFKC - utf_new_normalizer::nfkc($text); + $text = Normalizer::normalize($text, Normalizer::NFKC); // FC_NFKC_Closure, http://www.unicode.org/Public/5.0.0/ucd/DerivedNormalizationProps.txt $text = strtr($text, $fc_nfkc_closure); diff --git a/phpBB/install/data/new_normalizer.php b/phpBB/install/data/new_normalizer.php deleted file mode 100644 index 380998f530..0000000000 --- a/phpBB/install/data/new_normalizer.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php -/** -* -* @package install -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* A wrapper function for the normalizer which takes care of including the class if required and modifies the passed strings -* to be in NFC (Normalization Form Composition). -* -* @param mixed $strings a string or an array of strings to normalize -* @return mixed the normalized content, preserving array keys if array given. -*/ -function utf8_new_normalize_nfc($strings) -{ - if (empty($strings)) - { - return $strings; - } - - if (!is_array($strings)) - { - utf_new_normalizer::nfc($strings); - } - else if (is_array($strings)) - { - foreach ($strings as $key => $string) - { - if (is_array($string)) - { - foreach ($string as $_key => $_string) - { - utf_new_normalizer::nfc($strings[$key][$_key]); - } - } - else - { - utf_new_normalizer::nfc($strings[$key]); - } - } - } - - return $strings; -} - -class utf_new_normalizer -{ - /** - * Validate, cleanup and normalize a string - * - * The ultimate convenience function! Clean up invalid UTF-8 sequences, - * and convert to Normal Form C, canonical composition. - * - * @param string &$str The dirty string - * @return string The same string, all shiny and cleaned-up - */ - function cleanup(&$str) - { - // The string below is the list of all autorized characters, sorted by frequency in latin text - $pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D"); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings with no special chars return immediately - return; - } - - // Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed they are always loaded together - if (!isset($GLOBALS['utf_nfc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); - } - - if (!isset($GLOBALS['utf_canonical_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); - } - - // Replace any byte in the range 0x00..0x1F, except for \r, \n and \t - // We replace those characters with a 0xFF byte, which is illegal in UTF-8 and will in turn be replaced with a UTF replacement char - $str = strtr( - $str, - "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - ); - - $str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); - } - - /** - * Validate and normalize a UTF string to NFC - * - * @param string &$str Unchecked UTF string - * @return string The string, validated and in normal form - */ - function nfc(&$str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings return immediately - return; - } - - if (!isset($GLOBALS['utf_nfc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); - } - - if (!isset($GLOBALS['utf_canonical_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); - } - - $str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); - } - - /** - * Validate and normalize a UTF string to NFKC - * - * @param string &$str Unchecked UTF string - * @return string The string, validated and in normal form - */ - function nfkc(&$str) - { - $pos = strspn($str, UTF8_ASCII_RANGE); - $len = strlen($str); - - if ($pos == $len) - { - // ASCII strings return immediately - return; - } - - if (!isset($GLOBALS['utf_nfkc_qc'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx); - } - - if (!isset($GLOBALS['utf_compatibility_decomp'])) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); - } - - $str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); - } - - /** - * Recompose a UTF string - * - * @param string $str Unchecked UTF string - * @param integer $pos Position of the first UTF char (in bytes) - * @param integer $len Length of the string (in bytes) - * @param array &$qc Quick-check array, passed by reference but never modified - * @param array &$decomp_map Decomposition mapping, passed by reference but never modified - * @return string The string, validated and recomposed - * - * @access private - */ - function recompose($str, $pos, $len, &$qc, &$decomp_map) - { - global $utf_canonical_comp; - - // Load the canonical composition table - if (!isset($utf_canonical_comp)) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx); - } - - return utf_normalizer::recompose($str, $pos, $len, $qc, $decomp_map); - } -} diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php deleted file mode 100644 index bad51e2fe3..0000000000 --- a/phpBB/install/database_update.php +++ /dev/null @@ -1,288 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -$update_start_time = time(); - -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; - -/** -* @ignore -*/ -define('IN_PHPBB', true); -define('IN_INSTALL', true); -$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); - -function phpbb_end_update($cache, $config) -{ - $cache->purge(); - - $config->increment('assets_version', 1); - -?> - </p> - </div> - </div> - <span class="corners-bottom"><span></span></span> - </div> - </div> - </div> - - <div id="page-footer"> - Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group - </div> - </div> -</body> -</html> - -<?php - - garbage_collection(); - exit_handler(); -} - -require($phpbb_root_path . 'includes/startup.' . $phpEx); - -include($phpbb_root_path . 'config.' . $phpEx); -if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) -{ - die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update."); -} - -// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. -$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; -$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; - -// Include files -require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); - -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_content.' . $phpEx); -require($phpbb_root_path . 'includes/functions_container.' . $phpEx); - -require($phpbb_root_path . 'config.' . $phpEx); -require($phpbb_root_path . 'includes/constants.' . $phpEx); -include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); -require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); - -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); - -// Setup class loader first -$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); -$phpbb_class_loader->register(); - -// Set up container (must be done here because extensions table may not exist) -$container_extensions = array( - new \phpbb\di\extension\config($phpbb_root_path . 'config.' . $phpEx), - new \phpbb\di\extension\core($phpbb_root_path . 'config/'), -); -$container_passes = array( - new \phpbb\di\pass\collection_pass(), -); -$phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx); - -// Compile the container -foreach ($container_passes as $pass) -{ - $phpbb_container->addCompilerPass($pass); -} -$phpbb_container->compile(); - -// set up caching -$cache = $phpbb_container->get('cache'); - -// Instantiate some basic classes -$phpbb_dispatcher = $phpbb_container->get('dispatcher'); -$request = $phpbb_container->get('request'); -$user = $phpbb_container->get('user'); -$auth = $phpbb_container->get('auth'); -$db = $phpbb_container->get('dbal.conn'); -$phpbb_log = $phpbb_container->get('log'); - -// make sure request_var uses this request instance -request_var('', 0, false, false, $request); // "dependency injection" for a function - -// Grab global variables, re-cache if necessary -$config = $phpbb_container->get('config'); -set_config(null, null, null, $config); -set_config_count(null, null, null, $config); -$orig_version = $config['version']; - -$user->add_lang(array('common', 'acp/common', 'install', 'migrator')); - -// Add own hook handler, if present. :o -if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx)) -{ - require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); - $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); - - $phpbb_hook_finder = $phpbb_container->get('hook_finder'); - foreach ($phpbb_hook_finder->find() as $hook) - { - @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); - } -} -else -{ - $phpbb_hook = false; -} - -header('Content-type: text/html; charset=UTF-8'); -?> -<!DOCTYPE html> -<html dir="<?php echo $user->lang['DIRECTION']; ?>" lang="<?php echo $user->lang['USER_LANG']; ?>"> -<head> -<meta charset="utf-8"> - -<title><?php echo $user->lang['UPDATING_TO_LATEST_STABLE']; ?></title> - -<link href="<?php echo htmlspecialchars($phpbb_admin_path); ?>style/admin.css" rel="stylesheet" type="text/css" media="screen" /> - -</head> - -<body> - <div id="wrap"> - <div id="page-header"> </div> - - <div id="page-body"> - <div id="acp"> - <div class="panel"> - <span class="corners-top"><span></span></span> - <div id="content"> - <div id="main" class="install-body"> - - <h1><?php echo $user->lang['UPDATING_TO_LATEST_STABLE']; ?></h1> - - <br /> - - <p><?php echo $user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->sql_layer; ?></strong><br /> - <?php echo $user->lang['PREVIOUS_VERSION']; ?> :: <strong><?php echo $config['version']; ?></strong><br /> - -<?php - -/** -* @todo firebird/mysql update? -*/ - -// End startup code - -// Make sure migrations have been installed. -$db_tools = $phpbb_container->get('dbal.tools'); -if (!$db_tools->sql_table_exists($table_prefix . 'migrations')) -{ - $db_tools->sql_create_table($table_prefix . 'migrations', array( - 'COLUMNS' => array( - 'migration_name' => array('VCHAR', ''), - 'migration_depends_on' => array('TEXT', ''), - 'migration_schema_done' => array('BOOL', 0), - 'migration_data_done' => array('BOOL', 0), - 'migration_data_state' => array('TEXT', ''), - 'migration_start_time' => array('TIMESTAMP', 0), - 'migration_end_time' => array('TIMESTAMP', 0), - ), - 'PRIMARY_KEY' => 'migration_name', - )); -} - -$migrator = $phpbb_container->get('migrator'); -$phpbb_extension_manager = $phpbb_container->get('ext.manager'); -$finder = $phpbb_extension_manager->get_finder(); - -$migrations = $finder - ->core_path('phpbb/db/migration/data/') - ->get_classes(); -$migrator->set_migrations($migrations); - -// What is a safe limit of execution time? Half the max execution time should be safe. -// No more than 15 seconds so the user isn't sitting and waiting for a very long time -$phpbb_ini = new \phpbb\php\ini(); -$safe_time_limit = min(15, ($phpbb_ini->get_int('max_execution_time') / 2)); - -// While we're going to try limit this to half the max execution time, -// we want to try and take additional measures to prevent hitting the -// max execution time (if, say, one migration step takes much longer -// than the max execution time) -@set_time_limit(0); - -while (!$migrator->finished()) -{ - $migration_start_time = microtime(true); - - try - { - $migrator->update(); - } - catch (\phpbb\db\migration\exception $e) - { - echo $e->getLocalisedMessage($user); - - phpbb_end_update($cache, $config); - } - - $state = array_merge(array( - 'migration_schema_done' => false, - 'migration_data_done' => false, - ), - $migrator->last_run_migration['state'] - ); - - if (isset($migrator->last_run_migration['effectively_installed']) && $migrator->last_run_migration['effectively_installed']) - { - echo $user->lang('MIGRATION_EFFECTIVELY_INSTALLED', $migrator->last_run_migration['name']); - } - else - { - if ($migrator->last_run_migration['task'] == 'process_data_step' && $state['migration_data_done']) - { - echo $user->lang('MIGRATION_DATA_DONE', $migrator->last_run_migration['name'], (microtime(true) - $migration_start_time)); - } - else if ($migrator->last_run_migration['task'] == 'process_data_step') - { - echo $user->lang('MIGRATION_DATA_IN_PROGRESS', $migrator->last_run_migration['name'], (microtime(true) - $migration_start_time)); - } - else if ($state['migration_schema_done']) - { - echo $user->lang('MIGRATION_SCHEMA_DONE', $migrator->last_run_migration['name'], (microtime(true) - $migration_start_time)); - } - } - - echo "<br />\n"; - - // Are we approaching the time limit? If so we want to pause the update and continue after refreshing - if ((time() - $update_start_time) >= $safe_time_limit) - { - echo '<br />' . $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br /><br />'; - echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>'; - - phpbb_end_update($cache, $config); - } -} - -if ($orig_version != $config['version']) -{ - add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']); -} - -echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />'; - -if ($request->variable('type', 0)) -{ - echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '<br /><br />'; - echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&sub=update_db&language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>'; -} -else -{ - echo '<div class="errorbox">' . $user->lang['UPDATE_FILES_NOTICE'] . '</div>'; - echo $user->lang['COMPLETE_LOGIN_TO_BOARD']; -} - -phpbb_end_update($cache, $config); diff --git a/phpBB/install/index.html b/phpBB/install/index.html new file mode 100644 index 0000000000..8f8bfb4fb2 --- /dev/null +++ b/phpBB/install/index.html @@ -0,0 +1,11 @@ +<html> +<head> +<title></title> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<meta http-equiv="refresh" content="0; url=./app.php" /> +</head> + +<body bgcolor="#FFFFFF" text="#000000"> + +</body> +</html> diff --git a/phpBB/install/index.php b/phpBB/install/index.php deleted file mode 100644 index 2e09e95ea7..0000000000 --- a/phpBB/install/index.php +++ /dev/null @@ -1,804 +0,0 @@ -<?php -/** -* -* @package install -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; - -/**#@+ -* @ignore -*/ -define('IN_PHPBB', true); -define('IN_INSTALL', true); -/**#@-*/ - -$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); - -if (version_compare(PHP_VERSION, '5.3.3') < 0) -{ - die('You are running an unsupported PHP version. Please upgrade to PHP 5.3.3 or higher before trying to install phpBB 3.1'); -} - -function phpbb_require_updated($path, $optional = false) -{ - global $phpbb_root_path, $table_prefix; - - $new_path = $phpbb_root_path . 'install/update/new/' . $path; - $old_path = $phpbb_root_path . $path; - - if (file_exists($new_path)) - { - require($new_path); - } - else if (!$optional || file_exists($old_path)) - { - require($old_path); - } -} - -function phpbb_include_updated($path, $optional = false) -{ - global $phpbb_root_path; - - $new_path = $phpbb_root_path . 'install/update/new/' . $path; - $old_path = $phpbb_root_path . $path; - - if (file_exists($new_path)) - { - include($new_path); - } - else if (!$optional || file_exists($old_path)) - { - include($old_path); - } -} - -phpbb_require_updated('includes/startup.' . $phpEx); - -// Try to override some limits - maybe it helps some... -@set_time_limit(0); -$mem_limit = @ini_get('memory_limit'); -if (!empty($mem_limit)) -{ - $unit = strtolower(substr($mem_limit, -1, 1)); - $mem_limit = (int) $mem_limit; - - if ($unit == 'k') - { - $mem_limit = floor($mem_limit / 1024); - } - else if ($unit == 'g') - { - $mem_limit *= 1024; - } - else if (is_numeric($unit)) - { - $mem_limit = floor((int) ($mem_limit . $unit) / 1048576); - } - $mem_limit = max(128, $mem_limit) . 'M'; -} -else -{ - $mem_limit = '128M'; -} -@ini_set('memory_limit', $mem_limit); - -// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. -$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; -$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; - -// Include essential scripts -phpbb_require_updated('phpbb/class_loader.' . $phpEx); - -phpbb_require_updated('includes/functions.' . $phpEx); -phpbb_require_updated('includes/functions_container.' . $phpEx); - -phpbb_require_updated('includes/functions_content.' . $phpEx, true); - -phpbb_include_updated('includes/functions_admin.' . $phpEx); -phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx); -phpbb_include_updated('includes/utf/utf_tools.' . $phpEx); -phpbb_require_updated('includes/functions_install.' . $phpEx); - -// Setup class loader first -$phpbb_class_loader_new = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx); -$phpbb_class_loader_new->register(); -$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); -$phpbb_class_loader->register(); -$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); -$phpbb_class_loader_ext->register(); - -// Set up container -$phpbb_container = phpbb_create_install_container($phpbb_root_path, $phpEx); - -$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); -$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); - -$phpbb_dispatcher = $phpbb_container->get('dispatcher'); -$request = $phpbb_container->get('request'); - -// make sure request_var uses this request instance -request_var('', 0, false, false, $request); // "dependency injection" for a function - -// Try and load an appropriate language if required -$language = basename($request->variable('language', '')); - -if ($request->header('Accept-Language') && !$language) -{ - $accept_lang_ary = explode(',', strtolower($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) . '_' . substr($accept_lang, 3, 2); - - if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang)) - { - $language = $accept_lang; - break; - } - else - { - // No match on xx_yy so try xx - $accept_lang = substr($accept_lang, 0, 2); - if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang)) - { - $language = $accept_lang; - break; - } - } - } -} - -// No appropriate language found ... so let's use the first one in the language -// dir, this may or may not be English -if (!$language) -{ - $dir = @opendir($phpbb_root_path . 'language'); - - if (!$dir) - { - die('Unable to access the language directory'); - exit; - } - - while (($file = readdir($dir)) !== false) - { - $path = $phpbb_root_path . 'language/' . $file; - - if (!is_file($path) && !is_link($path) && file_exists($path . '/iso.txt')) - { - $language = $file; - break; - } - } - closedir($dir); -} - -if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_root_path . 'language/' . $language)) -{ - die('No language found!'); -} - -// And finally, load the relevant language files -$load_lang_files = array('common', 'acp/common', 'acp/board', 'install', 'posting'); -$new_path = $phpbb_root_path . 'install/update/new/language/' . $language . '/'; -$old_path = $phpbb_root_path . 'language/' . $language . '/'; - -// NOTE: we can not use "phpbb_include_updated" as the files uses vars which would be required -// to be global while loading. -foreach ($load_lang_files as $lang_file) -{ - if (file_exists($new_path . $lang_file . '.' . $phpEx)) - { - include($new_path . $lang_file . '.' . $phpEx); - } - else - { - include($old_path . $lang_file . '.' . $phpEx); - } -} - -// usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :( - -// Define needed constants -define('CHMOD_ALL', 7); -define('CHMOD_READ', 4); -define('CHMOD_WRITE', 2); -define('CHMOD_EXECUTE', 1); - -$mode = $request->variable('mode', 'overview'); -$sub = $request->variable('sub', ''); - -// Set PHP error handler to ours -set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); - -$user = new \phpbb\user(); -$auth = new \phpbb\auth\auth(); - -// Add own hook handler, if present. :o -if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx)) -{ - require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); - $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); - - $phpbb_hook_finder = $phpbb_container->get('hook_finder'); - foreach ($phpbb_hook_finder->find() as $hook) - { - @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); - } -} -else -{ - $phpbb_hook = false; -} - -// Set some standard variables we want to force -$config = new \phpbb\config\config(array( - 'load_tplcompile' => '1' -)); - -$symfony_request = $phpbb_container->get('symfony_request'); -$phpbb_filesystem = $phpbb_container->get('filesystem'); -$phpbb_path_helper = $phpbb_container->get('path_helper'); -$template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context()); -$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); -$paths = array_filter($paths, 'is_dir'); -$template->set_custom_style('adm', $paths); - -$template->assign_var('T_ASSETS_PATH', '../assets'); -$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); - -$install = new module(); - -$install->create('install', "index.$phpEx", $mode, $sub); -$install->load(); - -// Generate the page -$install->page_header(); -$install->generate_navigation(); - -$template->set_filenames(array( - 'body' => $install->get_tpl_name()) -); - -$install->page_footer(); - -/** -* @package install -*/ -class module -{ - var $id = 0; - var $type = 'install'; - var $module_ary = array(); - var $filename; - var $module_url = ''; - var $tpl_name = ''; - var $mode; - var $sub; - - /** - * Private methods, should not be overwritten - */ - function create($module_type, $module_url, $selected_mod = false, $selected_submod = false) - { - global $db, $config, $phpEx, $phpbb_root_path; - - $module = array(); - - // Grab module information using Bart's "neat-o-module" system (tm) - $dir = @opendir('.'); - - if (!$dir) - { - $this->error('Unable to access the installation directory', __LINE__, __FILE__); - } - - $setmodules = 1; - while (($file = readdir($dir)) !== false) - { - if (preg_match('#^install_(.*?)\.' . $phpEx . '$#', $file)) - { - include($file); - } - } - closedir($dir); - - unset($setmodules); - - if (!sizeof($module)) - { - $this->error('No installation modules found', __LINE__, __FILE__); - } - - // Order to use and count further if modules get assigned to the same position or not having an order - $max_module_order = 1000; - - foreach ($module as $row) - { - // Module order not specified or module already assigned at this position? - if (!isset($row['module_order']) || isset($this->module_ary[$row['module_order']])) - { - $row['module_order'] = $max_module_order; - $max_module_order++; - } - - $this->module_ary[$row['module_order']]['name'] = $row['module_title']; - $this->module_ary[$row['module_order']]['filename'] = $row['module_filename']; - $this->module_ary[$row['module_order']]['subs'] = $row['module_subs']; - $this->module_ary[$row['module_order']]['stages'] = $row['module_stages']; - - if (strtolower($selected_mod) == strtolower($row['module_title'])) - { - $this->id = (int) $row['module_order']; - $this->filename = (string) $row['module_filename']; - $this->module_url = (string) $module_url; - $this->mode = (string) $selected_mod; - // Check that the sub-mode specified is valid or set a default if not - if (is_array($row['module_subs'])) - { - $this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_subs'])) ? $selected_submod : $row['module_subs'][0]); - } - else if (is_array($row['module_stages'])) - { - $this->sub = strtolower((in_array(strtoupper($selected_submod), $row['module_stages'])) ? $selected_submod : $row['module_stages'][0]); - } - else - { - $this->sub = ''; - } - } - } // END foreach - } // END create - - /** - * Load and run the relevant module if applicable - */ - function load($mode = false, $run = true) - { - global $phpbb_root_path, $phpEx; - - if ($run) - { - if (!empty($mode)) - { - $this->mode = $mode; - } - - $module = $this->filename; - if (!class_exists($module)) - { - $this->error('Module "' . htmlspecialchars($module) . '" not accessible.', __LINE__, __FILE__); - } - $this->module = new $module($this); - - if (method_exists($this->module, 'main')) - { - $this->module->main($this->mode, $this->sub); - } - } - } - - /** - * Output the standard page header - */ - function page_header() - { - if (defined('HEADER_INC')) - { - return; - } - - define('HEADER_INC', true); - global $template, $lang, $stage, $phpbb_root_path, $phpbb_admin_path; - - $template->assign_vars(array( - 'L_CHANGE' => $lang['CHANGE'], - 'L_COLON' => $lang['COLON'], - 'L_INSTALL_PANEL' => $lang['INSTALL_PANEL'], - 'L_SELECT_LANG' => $lang['SELECT_LANG'], - 'L_SKIP' => $lang['SKIP'], - 'PAGE_TITLE' => $this->get_page_title(), - 'T_IMAGE_PATH' => htmlspecialchars($phpbb_admin_path) . 'images/', - 'T_JQUERY_LINK' => $phpbb_root_path . 'assets/javascript/jquery.js', - - 'S_CONTENT_DIRECTION' => $lang['DIRECTION'], - 'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right', - 'S_CONTENT_FLOW_END' => ($lang['DIRECTION'] == 'ltr') ? 'right' : 'left', - 'S_CONTENT_ENCODING' => 'UTF-8', - - 'S_USER_LANG' => $lang['USER_LANG'], - ) - ); - - header('Content-type: text/html; charset=UTF-8'); - header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: 0'); - header('Pragma: no-cache'); - - return; - } - - /** - * Output the standard page footer - */ - function page_footer() - { - global $db, $template; - - $template->display('body'); - - // Close our DB connection. - if (!empty($db) && is_object($db)) - { - $db->sql_close(); - } - - if (function_exists('exit_handler')) - { - exit_handler(); - } - } - - /** - * Returns desired template name - */ - function get_tpl_name() - { - return $this->module->tpl_name . '.html'; - } - - /** - * Returns the desired page title - */ - function get_page_title() - { - global $lang; - - if (!isset($this->module->page_title)) - { - return ''; - } - - return (isset($lang[$this->module->page_title])) ? $lang[$this->module->page_title] : $this->module->page_title; - } - - /** - * Generate an HTTP/1.1 header to redirect the user to another page - * This is used during the installation when we do not have a database available to call the normal redirect function - * @param string $page The page to redirect to relative to the installer root path - */ - function redirect($page) - { - global $request; - - // HTTP_HOST is having the correct browser url in most cases... - $server_name = strtolower(htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME')))); - $server_port = $request->server('SERVER_PORT', 0); - $secure = $request->is_secure() ? 1 : 0; - - $script_name = htmlspecialchars_decode($request->server('PHP_SELF')); - if (!$script_name) - { - $script_name = htmlspecialchars_decode($request->server('REQUEST_URI')); - } - - // Replace backslashes and doubled slashes (could happen on some proxy setups) - $script_name = str_replace(array('\\', '//'), '/', $script_name); - $script_path = trim(dirname($script_name)); - - $url = (($secure) ? 'https://' : 'http://') . $server_name; - - if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80))) - { - // HTTP HOST can carry a port number... - if (strpos($server_name, ':') === false) - { - $url .= ':' . $server_port; - } - } - - $url .= $script_path . '/' . $page; - header('Location: ' . $url); - exit; - } - - /** - * Generate the navigation tabs - */ - function generate_navigation() - { - global $lang, $template, $phpEx, $language; - - if (is_array($this->module_ary)) - { - @ksort($this->module_ary); - foreach ($this->module_ary as $cat_ary) - { - $cat = $cat_ary['name']; - $l_cat = (!empty($lang['CAT_' . $cat])) ? $lang['CAT_' . $cat] : preg_replace('#_#', ' ', $cat); - $cat = strtolower($cat); - $url = $this->module_url . "?mode=$cat&language=$language"; - - if ($this->mode == $cat) - { - $template->assign_block_vars('t_block1', array( - 'L_TITLE' => $l_cat, - 'S_SELECTED' => true, - 'U_TITLE' => $url, - )); - - if (is_array($this->module_ary[$this->id]['subs'])) - { - $subs = $this->module_ary[$this->id]['subs']; - foreach ($subs as $option) - { - $l_option = (!empty($lang['SUB_' . $option])) ? $lang['SUB_' . $option] : preg_replace('#_#', ' ', $option); - $option = strtolower($option); - $url = $this->module_url . '?mode=' . $this->mode . "&sub=$option&language=$language"; - - $template->assign_block_vars('l_block1', array( - 'L_TITLE' => $l_option, - 'S_SELECTED' => ($this->sub == $option), - 'U_TITLE' => $url, - )); - } - } - - if (is_array($this->module_ary[$this->id]['stages'])) - { - $subs = $this->module_ary[$this->id]['stages']; - $matched = false; - foreach ($subs as $option) - { - $l_option = (!empty($lang['STAGE_' . $option])) ? $lang['STAGE_' . $option] : preg_replace('#_#', ' ', $option); - $option = strtolower($option); - $matched = ($this->sub == $option) ? true : $matched; - - $template->assign_block_vars('l_block2', array( - 'L_TITLE' => $l_option, - 'S_SELECTED' => ($this->sub == $option), - 'S_COMPLETE' => !$matched, - )); - } - } - } - else - { - $template->assign_block_vars('t_block1', array( - 'L_TITLE' => $l_cat, - 'S_SELECTED' => false, - 'U_TITLE' => $url, - )); - } - } - } - } - - /** - * Output an error message - * If skip is true, return and continue execution, else exit - */ - function error($error, $line, $file, $skip = false) - { - global $lang, $db, $template, $phpbb_admin_path; - - if ($skip) - { - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['INST_ERR'], - )); - - $template->assign_block_vars('checks', array( - 'TITLE' => basename($file) . ' [ ' . $line . ' ]', - 'RESULT' => '<b style="color:red">' . $error . '</b>', - )); - - return; - } - - echo '<!DOCTYPE html>'; - echo '<html dir="ltr">'; - echo '<head>'; - echo '<meta charset="utf-8">'; - echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>'; - echo '<link href="' . htmlspecialchars($phpbb_admin_path) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />'; - echo '</head>'; - echo '<body id="errorpage">'; - echo '<div id="wrap">'; - echo ' <div id="page-header">'; - echo ' </div>'; - echo ' <div id="page-body">'; - echo ' <div id="acp">'; - echo ' <div class="panel">'; - echo ' <span class="corners-top"><span></span></span>'; - echo ' <div id="content">'; - echo ' <h1>' . $lang['INST_ERR_FATAL'] . '</h1>'; - echo ' <p>' . $lang['INST_ERR_FATAL'] . "</p>\n"; - echo ' <p>' . basename($file) . ' [ ' . $line . " ]</p>\n"; - echo ' <p><b>' . $error . "</b></p>\n"; - echo ' </div>'; - echo ' <span class="corners-bottom"><span></span></span>'; - echo ' </div>'; - echo ' </div>'; - echo ' </div>'; - echo ' <div id="page-footer">'; - echo ' Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'; - echo ' </div>'; - echo '</div>'; - echo '</body>'; - echo '</html>'; - - if (!empty($db) && is_object($db)) - { - $db->sql_close(); - } - - exit_handler(); - } - - /** - * Output an error message for a database related problem - * If skip is true, return and continue execution, else exit - */ - function db_error($error, $sql, $line, $file, $skip = false) - { - global $lang, $db, $template; - - if ($skip) - { - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['INST_ERR_FATAL'], - )); - - $template->assign_block_vars('checks', array( - 'TITLE' => basename($file) . ' [ ' . $line . ' ]', - 'RESULT' => '<b style="color:red">' . $error . '</b><br />» SQL:' . $sql, - )); - - return; - } - - $template->set_filenames(array( - 'body' => 'install_error.html') - ); - $this->page_header(); - $this->generate_navigation(); - - $template->assign_vars(array( - 'MESSAGE_TITLE' => $lang['INST_ERR_FATAL_DB'], - 'MESSAGE_TEXT' => '<p>' . basename($file) . ' [ ' . $line . ' ]</p><p>SQL : ' . $sql . '</p><p><b>' . $error . '</b></p>', - )); - - // Rollback if in transaction - if ($db->transaction) - { - $db->sql_transaction('rollback'); - } - - $this->page_footer(); - } - - /** - * Generate the relevant HTML for an input field and the associated label and explanatory text - */ - function input_field($name, $type, $value = '', $options = '') - { - global $lang; - $tpl_type = explode(':', $type); - $tpl = ''; - - switch ($tpl_type[0]) - { - case 'text': - case 'password': - // HTML5 text-like input types - case 'color': - case 'date': - case 'time': - case 'datetime': - case 'datetime-local': - case 'email': - case 'month': - case 'number': - case 'range': - case 'search': - case 'tel': - case 'url': - case 'week': - - $size = (int) $tpl_type[1]; - $maxlength = (int) $tpl_type[2]; - - $tpl = '<input id="' . $name . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $value . '" />'; - break; - - case 'textarea': - $rows = (int) $tpl_type[1]; - $cols = (int) $tpl_type[2]; - - $tpl = '<textarea id="' . $name . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $value . '</textarea>'; - break; - - case 'radio': - $key_yes = ($value) ? ' checked="checked" id="' . $name . '"' : ''; - $key_no = (!$value) ? ' checked="checked" id="' . $name . '"' : ''; - - $tpl_type_cond = explode('_', $tpl_type[1]); - $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; - - $tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? $lang['NO'] : $lang['DISABLED']) . '</label>'; - $tpl_yes = '<label><input type="radio" name="' . $name . '" value="1"' . $key_yes . ' class="radio" /> ' . (($type_no) ? $lang['YES'] : $lang['ENABLED']) . '</label>'; - - $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . ' ' . $tpl_no : $tpl_no . ' ' . $tpl_yes; - break; - - case 'select': - eval('$s_options = ' . str_replace('{VALUE}', $value, $options) . ';'); - $tpl = '<select id="' . $name . '" name="' . $name . '">' . $s_options . '</select>'; - break; - - case 'custom': - eval('$tpl = ' . str_replace('{VALUE}', $value, $options) . ';'); - break; - - default: - break; - } - - return $tpl; - } - - /** - * Generate the drop down of available language packs - */ - function inst_language_select($default = '') - { - global $phpbb_root_path, $phpEx; - - $dir = @opendir($phpbb_root_path . 'language'); - - if (!$dir) - { - $this->error('Unable to access the language directory', __LINE__, __FILE__); - } - - while ($file = readdir($dir)) - { - $path = $phpbb_root_path . 'language/' . $file; - - if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS') - { - continue; - } - - if (file_exists($path . '/iso.txt')) - { - list($displayname, $localname) = @file($path . '/iso.txt'); - $lang[$localname] = $file; - } - } - closedir($dir); - - @asort($lang); - @reset($lang); - - $user_select = ''; - foreach ($lang as $displayname => $filename) - { - $selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : ''; - $user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>'; - } - - return $user_select; - } -} diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php deleted file mode 100644 index 1c7e2dca76..0000000000 --- a/phpBB/install/install_convert.php +++ /dev/null @@ -1,2098 +0,0 @@ -<?php -/** -* -* @package install -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -*/ - -if (!defined('IN_INSTALL')) -{ - // Someone has tried to access the file direct. This is not a good idea, so exit - exit; -} - -if (!empty($setmodules)) -{ - $module[] = array( - 'module_type' => 'install', - 'module_title' => 'CONVERT', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), - 'module_order' => 20, - 'module_subs' => '', - 'module_stages' => array('INTRO', 'SETTINGS', 'IN_PROGRESS', 'FINAL'), - 'module_reqs' => '' - ); -} - -/** -* Class holding all convertor-specific details. -* @package install -*/ -class convert -{ - var $options = array(); - - var $convertor_tag = ''; - var $src_dbms = ''; - var $src_dbhost = ''; - var $src_dbport = ''; - var $src_dbuser = ''; - var $src_dbpasswd = ''; - var $src_dbname = ''; - var $src_table_prefix = ''; - - var $convertor_data = array(); - var $tables = array(); - var $config_schema = array(); - var $convertor = array(); - var $src_truncate_statement = 'DELETE FROM '; - var $truncate_statement = 'DELETE FROM '; - - var $fulltext_search; - - // Batch size, can be adjusted by the conversion file - // For big boards a value of 6000 seems to be optimal - var $batch_size = 2000; - // Number of rows to be inserted at once (extended insert) if supported - // For installations having enough memory a value of 60 may be good. - var $num_wait_rows = 20; - - // Mysqls internal recoding engine messing up with our (better) functions? We at least support more encodings than mysql so should use it in favor. - var $mysql_convert = false; - - var $p_master; - - function convert(&$p_master) - { - $this->p_master = &$p_master; - } -} - -/** -* Convert class for conversions -* @package install -*/ -class install_convert extends module -{ - /** - * Variables used while converting, they are accessible from the global variable $convert - */ - function install_convert(&$p_master) - { - $this->p_master = &$p_master; - } - - function main($mode, $sub) - { - global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config, $language, $table_prefix; - global $convert, $request, $phpbb_container; - - $this->tpl_name = 'install_convert'; - $this->mode = $mode; - - $convert = new convert($this->p_master); - - // Enable super globals to prevent issues with the new \phpbb\request\request object - $request->enable_super_globals(); - // Create a normal container now - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); - - // Create cache - $cache = $phpbb_container->get('cache'); - - switch ($sub) - { - case 'intro': - // Try opening config file - // @todo If phpBB is not installed, we need to do a cut-down installation here - // For now, we redirect to the installation script instead - if (@file_exists($phpbb_root_path . 'config.' . $phpEx)) - { - include($phpbb_root_path . 'config.' . $phpEx); - } - - if (!defined('PHPBB_INSTALLED')) - { - $template->assign_vars(array( - 'S_NOT_INSTALLED' => true, - 'TITLE' => $lang['BOARD_NOT_INSTALLED'], - 'BODY' => sprintf($lang['BOARD_NOT_INSTALLED_EXPLAIN'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=install&language=' . $language)), - )); - - return; - } - - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); - - $dbms = phpbb_convert_30_dbms_to_31($dbms); - - $db = new $dbms(); - $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); - unset($dbpasswd); - - // We need to fill the config to let internal functions correctly work - $config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); - - // Detect if there is already a conversion in progress at this point and offer to resume - // It's quite possible that the user will get disconnected during a large conversion so they need to be able to resume it - $new_conversion = request_var('new_conv', 0); - - if ($new_conversion) - { - $config['convert_progress'] = ''; - $config['convert_db_server'] = ''; - $config['convert_db_user'] = ''; - $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " - WHERE config_name = 'convert_progress' - OR config_name = 'convert_db_server' - OR config_name = 'convert_db_user'" - ); - } - - // Let's see if there is a conversion in the works... - $options = array(); - if (!empty($config['convert_progress']) && !empty($config['convert_db_server']) && !empty($config['convert_db_user']) && !empty($config['convert_options'])) - { - $options = unserialize($config['convert_progress']); - $options = array_merge($options, unserialize($config['convert_db_server']), unserialize($config['convert_db_user']), unserialize($config['convert_options'])); - } - - // This information should have already been checked once, but do it again for safety - if (!empty($options) && !empty($options['tag']) && - isset($options['dbms']) && - isset($options['dbhost']) && - isset($options['dbport']) && - isset($options['dbuser']) && - isset($options['dbpasswd']) && - isset($options['dbname']) && - isset($options['table_prefix'])) - { - $this->page_title = $lang['CONTINUE_CONVERT']; - - $template->assign_vars(array( - 'TITLE' => $lang['CONTINUE_CONVERT'], - 'BODY' => $lang['CONTINUE_CONVERT_BODY'], - 'L_NEW' => $lang['CONVERT_NEW_CONVERSION'], - 'L_CONTINUE' => $lang['CONTINUE_OLD_CONVERSION'], - 'S_CONTINUE' => true, - - 'U_NEW_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=intro&new_conv=1&language=$language", - 'U_CONTINUE_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$options['tag']}{$options['step']}&language=$language", - )); - - return; - } - - $this->list_convertors($sub); - - break; - - case 'settings': - $this->get_convert_settings($sub); - break; - - case 'in_progress': - $this->convert_data($sub); - break; - - case 'final': - $this->page_title = $lang['CONVERT_COMPLETE']; - - $template->assign_vars(array( - 'TITLE' => $lang['CONVERT_COMPLETE'], - 'BODY' => $lang['CONVERT_COMPLETE_EXPLAIN'], - )); - - // If we reached this step (conversion completed) we want to purge the cache and log the user out. - // This is for making sure the session get not screwed due to the 3.0.x users table being completely new. - $cache->purge(); - - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); - - $dbms = phpbb_convert_30_dbms_to_31($dbms); - - $db = new $dbms(); - $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); - unset($dbpasswd); - - $sql = 'SELECT config_value - FROM ' . CONFIG_TABLE . ' - WHERE config_name = \'search_type\''; - $result = $db->sql_query($sql); - - if ($db->sql_fetchfield('config_value') != 'fulltext_mysql') - { - $template->assign_vars(array( - 'S_ERROR_BOX' => true, - 'ERROR_TITLE' => $lang['SEARCH_INDEX_UNCONVERTED'], - 'ERROR_MSG' => $lang['SEARCH_INDEX_UNCONVERTED_EXPLAIN'], - )); - } - - switch ($db->sql_layer) - { - case 'sqlite': - case 'firebird': - $db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE); - $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); - break; - - default: - $db->sql_query('TRUNCATE TABLE ' . SESSIONS_KEYS_TABLE); - $db->sql_query('TRUNCATE TABLE ' . SESSIONS_TABLE); - break; - } - - break; - } - } - - /** - * Generate a list of all available conversion modules - */ - function list_convertors($sub) - { - global $lang, $language, $template, $phpbb_root_path, $phpEx; - - $this->page_title = $lang['SUB_INTRO']; - - $template->assign_vars(array( - 'TITLE' => $lang['CONVERT_INTRO'], - 'BODY' => $lang['CONVERT_INTRO_BODY'], - - 'L_AUTHOR' => $lang['AUTHOR'], - 'L_AVAILABLE_CONVERTORS' => $lang['AVAILABLE_CONVERTORS'], - 'L_CONVERT' => $lang['CONVERT'], - 'L_NO_CONVERTORS' => $lang['NO_CONVERTORS'], - 'L_OPTIONS' => $lang['CONVERT_OPTIONS'], - 'L_SOFTWARE' => $lang['SOFTWARE'], - 'L_VERSION' => $lang['VERSION'], - - 'S_LIST' => true, - )); - - $convertors = $sort = array(); - $get_info = true; - - $handle = @opendir('./convertors/'); - - if (!$handle) - { - $this->error('Unable to access the convertors directory', __LINE__, __FILE__); - } - - while ($entry = readdir($handle)) - { - if (preg_match('/^convert_([a-z0-9_]+).' . $phpEx . '$/i', $entry, $m)) - { - include('./convertors/' . $entry); - if (isset($convertor_data)) - { - $sort[strtolower($convertor_data['forum_name'])] = sizeof($convertors); - - $convertors[] = array( - 'tag' => $m[1], - 'forum_name' => $convertor_data['forum_name'], - 'version' => $convertor_data['version'], - 'dbms' => $convertor_data['dbms'], - 'dbhost' => $convertor_data['dbhost'], - 'dbport' => $convertor_data['dbport'], - 'dbuser' => $convertor_data['dbuser'], - 'dbpasswd' => $convertor_data['dbpasswd'], - 'dbname' => $convertor_data['dbname'], - 'table_prefix' => $convertor_data['table_prefix'], - 'author' => $convertor_data['author'] - ); - } - unset($convertor_data); - } - } - closedir($handle); - - @ksort($sort); - - foreach ($sort as $void => $index) - { - $template->assign_block_vars('convertors', array( - 'AUTHOR' => $convertors[$index]['author'], - 'SOFTWARE' => $convertors[$index]['forum_name'], - 'VERSION' => $convertors[$index]['version'], - - 'U_CONVERT' => $this->p_master->module_url . "?mode={$this->mode}&language=$language&sub=settings&tag=" . $convertors[$index]['tag'], - )); - } - } - - /** - */ - function get_convert_settings($sub) - { - global $lang, $language, $template, $db, $phpbb_root_path, $phpEx, $config, $cache; - - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); - - $dbms = phpbb_convert_30_dbms_to_31($dbms); - - $db = new $dbms(); - $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); - unset($dbpasswd); - - $this->page_title = $lang['STAGE_SETTINGS']; - - // We need to fill the config to let internal functions correctly work - $config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); - - $convertor_tag = request_var('tag', ''); - - if (empty($convertor_tag)) - { - $this->p_master->error($lang['NO_CONVERT_SPECIFIED'], __LINE__, __FILE__); - } - $get_info = true; - - // check security implications of direct inclusion - $convertor_tag = basename($convertor_tag); - if (!file_exists('./convertors/convert_' . $convertor_tag . '.' . $phpEx)) - { - $this->p_master->error($lang['CONVERT_NOT_EXIST'], __LINE__, __FILE__); - } - - include('./convertors/convert_' . $convertor_tag . '.' . $phpEx); - - // The test_file is a file that should be present in the location of the old board. - if (!isset($test_file)) - { - $this->p_master->error($lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__); - } - - $submit = (isset($_POST['submit'])) ? true : false; - - $src_dbms = request_var('src_dbms', $convertor_data['dbms']); - $src_dbhost = request_var('src_dbhost', $convertor_data['dbhost']); - $src_dbport = request_var('src_dbport', $convertor_data['dbport']); - $src_dbuser = request_var('src_dbuser', $convertor_data['dbuser']); - $src_dbpasswd = request_var('src_dbpasswd', $convertor_data['dbpasswd']); - $src_dbname = request_var('src_dbname', $convertor_data['dbname']); - $src_table_prefix = request_var('src_table_prefix', $convertor_data['table_prefix']); - $forum_path = request_var('forum_path', $convertor_data['forum_path']); - $refresh = request_var('refresh', 1); - - // Default URL of the old board - // @todo Are we going to use this for attempting to convert URL references in posts, or should we remove it? - // -> We should convert old urls to the new relative urls format - // $src_url = request_var('src_url', 'Not in use at the moment'); - - // strip trailing slash from old forum path - $forum_path = (strlen($forum_path) && $forum_path[strlen($forum_path) - 1] == '/') ? substr($forum_path, 0, -1) : $forum_path; - - $error = array(); - if ($submit) - { - if (!@file_exists('./../' . $forum_path . '/' . $test_file)) - { - $error[] = sprintf($lang['COULD_NOT_FIND_PATH'], $forum_path); - } - - $connect_test = false; - $available_dbms = get_available_dbms(false, true, true); - - if (!isset($available_dbms[$src_dbms]) || !$available_dbms[$src_dbms]['AVAILABLE']) - { - $error['db'][] = $lang['INST_ERR_NO_DB']; - $connect_test = false; - } - else - { - $connect_test = connect_check_db(true, $error, $available_dbms[$src_dbms], $src_table_prefix, $src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, true, ($src_dbms == $dbms) ? false : true, false); - } - - // The forum prefix of the old and the new forum can only be the same if two different databases are used. - if ($src_table_prefix == $table_prefix && $src_dbms == $dbms && $src_dbhost == $dbhost && $src_dbport == $dbport && $src_dbname == $dbname) - { - $error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix); - } - $src_dbms = phpbb_convert_30_dbms_to_31($src_dbms); - - // Check table prefix - if (!sizeof($error)) - { - // initiate database connection to old db if old and new db differ - global $src_db, $same_db; - $src_db = $same_db = false; - - if ($src_dbms != $dbms || $src_dbhost != $dbhost || $src_dbport != $dbport || $src_dbname != $dbname || $src_dbuser != $dbuser) - { - $src_db = new $src_dbms(); - $src_db->sql_connect($src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, false, true); - $same_db = false; - } - else - { - $src_db = $db; - $same_db = true; - } - - $src_db->sql_return_on_error(true); - $db->sql_return_on_error(true); - - // Try to select one row from the first table to see if the prefix is OK - $result = $src_db->sql_query_limit('SELECT * FROM ' . $src_table_prefix . $tables[0], 1); - - if (!$result) - { - $prefixes = array(); - - $tables_existing = get_tables($src_db); - $tables_existing = array_map('strtolower', $tables_existing); - foreach ($tables_existing as $table_name) - { - compare_table($tables, $table_name, $prefixes); - } - unset($tables_existing); - - foreach ($prefixes as $prefix => $count) - { - if ($count >= sizeof($tables)) - { - $possible_prefix = $prefix; - break; - } - } - - $msg = ''; - if (!empty($convertor_data['table_prefix'])) - { - $msg .= sprintf($lang['DEFAULT_PREFIX_IS'], $convertor_data['forum_name'], $convertor_data['table_prefix']); - } - - if (!empty($possible_prefix)) - { - $msg .= '<br />'; - $msg .= ($possible_prefix == '*') ? $lang['BLANK_PREFIX_FOUND'] : sprintf($lang['PREFIX_FOUND'], $possible_prefix); - $src_table_prefix = ($possible_prefix == '*') ? '' : $possible_prefix; - } - - $error[] = $msg; - } - $src_db->sql_freeresult($result); - $src_db->sql_return_on_error(false); - } - - if (!sizeof($error)) - { - // Save convertor Status - set_config('convert_progress', serialize(array( - 'step' => '', - 'table_prefix' => $src_table_prefix, - 'tag' => $convertor_tag, - )), true); - set_config('convert_db_server', serialize(array( - 'dbms' => $src_dbms, - 'dbhost' => $src_dbhost, - 'dbport' => $src_dbport, - 'dbname' => $src_dbname, - )), true); - set_config('convert_db_user', serialize(array( - 'dbuser' => $src_dbuser, - 'dbpasswd' => $src_dbpasswd, - )), true); - - // Save options - set_config('convert_options', serialize(array('forum_path' => './../' . $forum_path, 'refresh' => $refresh)), true); - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['VERIFY_OPTIONS'], - 'RESULT' => $lang['CONVERT_SETTINGS_VERIFIED'], - )); - - $template->assign_vars(array( - 'L_SUBMIT' => $lang['BEGIN_CONVERT'], -// 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag=$convertor_tag&language=$language", - )); - - return; - } - else - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['VERIFY_OPTIONS'], - 'RESULT' => '<b style="color:red">' . implode('<br />', $error) . '</b>', - )); - } - } // end submit - - foreach ($this->convert_options as $config_key => $vars) - { - if (!is_array($vars) && strpos($config_key, 'legend') === false) - { - continue; - } - - if (strpos($config_key, 'legend') !== false) - { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang[$vars]) - ); - - continue; - } - - $options = isset($vars['options']) ? $vars['options'] : ''; - - $template->assign_block_vars('options', array( - 'KEY' => $config_key, - 'TITLE' => $lang[$vars['lang']], - 'S_EXPLAIN' => $vars['explain'], - 'S_LEGEND' => false, - 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', - 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $$config_key, $options), - ) - ); - } - - $template->assign_vars(array( - 'TITLE' => $lang['STAGE_SETTINGS'], - 'BODY' => $lang['CONV_OPTIONS_BODY'], - 'L_SUBMIT' => $lang['BEGIN_CONVERT'], - 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=settings&tag=$convertor_tag&language=$language", - )); - } - - /** - * The function which does the actual work (or dispatches it to the relevant places) - */ - function convert_data($sub) - { - global $template, $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache, $auth; - global $convert, $convert_row, $message_parser, $skip_rows, $language; - global $request; - - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); - - $dbms = phpbb_convert_30_dbms_to_31($dbms); - - $db = new $dbms(); - $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); - unset($dbpasswd); - - // We need to fill the config to let internal functions correctly work - $config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); - - // Override a couple of config variables for the duration - $config['max_quote_depth'] = 0; - - // @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues - $config['max_post_chars'] = $config['min_post_chars'] = 0; - - // Set up a user as well. We _should_ have enough of a database here at this point to do this - // and it helps for any core code we call - $user->session_begin(); - $user->page = $user->extract_current_page($phpbb_root_path); - - // This is a little bit of a fudge, but it allows the language entries to be available to the - // core code without us loading them again - $user->lang = &$lang; - - $this->page_title = $user->lang['STAGE_IN_PROGRESS']; - - $convert->options = array(); - if (isset($config['convert_progress'])) - { - $convert->options = unserialize($config['convert_progress']); - $convert->options = array_merge($convert->options, unserialize($config['convert_db_server']), unserialize($config['convert_db_user']), unserialize($config['convert_options'])); - } - - // This information should have already been checked once, but do it again for safety - if (empty($convert->options) || empty($convert->options['tag']) || - !isset($convert->options['dbms']) || - !isset($convert->options['dbhost']) || - !isset($convert->options['dbport']) || - !isset($convert->options['dbuser']) || - !isset($convert->options['dbpasswd']) || - !isset($convert->options['dbname']) || - !isset($convert->options['table_prefix'])) - { - $this->p_master->error($user->lang['NO_CONVERT_SPECIFIED'], __LINE__, __FILE__); - } - - // Make some short variables accessible, for easier referencing - $convert->convertor_tag = basename($convert->options['tag']); - $convert->src_dbms = $convert->options['dbms']; - $convert->src_dbhost = $convert->options['dbhost']; - $convert->src_dbport = $convert->options['dbport']; - $convert->src_dbuser = $convert->options['dbuser']; - $convert->src_dbpasswd = $convert->options['dbpasswd']; - $convert->src_dbname = $convert->options['dbname']; - $convert->src_table_prefix = $convert->options['table_prefix']; - - // initiate database connection to old db if old and new db differ - global $src_db, $same_db; - $src_db = $same_db = null; - if ($convert->src_dbms != $dbms || $convert->src_dbhost != $dbhost || $convert->src_dbport != $dbport || $convert->src_dbname != $dbname || $convert->src_dbuser != $dbuser) - { - $dbms = $convert->src_dbms; - $src_db = new $dbms(); - $src_db->sql_connect($convert->src_dbhost, $convert->src_dbuser, htmlspecialchars_decode($convert->src_dbpasswd), $convert->src_dbname, $convert->src_dbport, false, true); - $same_db = false; - } - else - { - $src_db = $db; - $same_db = true; - } - - $convert->mysql_convert = false; - switch ($src_db->sql_layer) - { - case 'sqlite': - case 'firebird': - $convert->src_truncate_statement = 'DELETE FROM '; - break; - - // Thanks MySQL, for silently converting... - case 'mysql': - case 'mysql4': - if (version_compare($src_db->sql_server_info(true, false), '4.1.3', '>=')) - { - $convert->mysql_convert = true; - } - $convert->src_truncate_statement = 'TRUNCATE TABLE '; - break; - - case 'mysqli': - $convert->mysql_convert = true; - $convert->src_truncate_statement = 'TRUNCATE TABLE '; - break; - - default: - $convert->src_truncate_statement = 'TRUNCATE TABLE '; - break; - } - - if ($convert->mysql_convert && !$same_db) - { - $src_db->sql_query("SET NAMES 'binary'"); - } - - switch ($db->sql_layer) - { - case 'sqlite': - case 'firebird': - $convert->truncate_statement = 'DELETE FROM '; - break; - - default: - $convert->truncate_statement = 'TRUNCATE TABLE '; - break; - } - - $get_info = false; - - // check security implications of direct inclusion - if (!file_exists('./convertors/convert_' . $convert->convertor_tag . '.' . $phpEx)) - { - $this->p_master->error($user->lang['CONVERT_NOT_EXIST'], __LINE__, __FILE__); - } - - if (file_exists('./convertors/functions_' . $convert->convertor_tag . '.' . $phpEx)) - { - include('./convertors/functions_' . $convert->convertor_tag . '.' . $phpEx); - } - - $get_info = true; - include('./convertors/convert_' . $convert->convertor_tag . '.' . $phpEx); - - // Map some variables... - $convert->convertor_data = $convertor_data; - $convert->tables = $tables; - $convert->config_schema = $config_schema; - - // Now include the real data - $get_info = false; - include('./convertors/convert_' . $convert->convertor_tag . '.' . $phpEx); - - $convert->convertor_data = $convertor_data; - $convert->tables = $tables; - $convert->config_schema = $config_schema; - $convert->convertor = $convertor; - - // The test_file is a file that should be present in the location of the old board. - if (!file_exists($convert->options['forum_path'] . '/' . $test_file)) - { - $this->p_master->error(sprintf($user->lang['COULD_NOT_FIND_PATH'], $convert->options['forum_path']), __LINE__, __FILE__); - } - - $search_type = $config['search_type']; - - // For conversions we are a bit less strict and set to a search backend we know exist... - if (!class_exists($search_type)) - { - $search_type = '\phpbb\search\fulltext_native'; - set_config('search_type', $search_type); - } - - if (!class_exists($search_type)) - { - trigger_error('NO_SUCH_SEARCH_MODULE'); - } - - $error = false; - $convert->fulltext_search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); - - if ($error) - { - trigger_error($error); - } - - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); - $message_parser = new parse_message(); - - $jump = request_var('jump', 0); - $final_jump = request_var('final_jump', 0); - $sync_batch = request_var('sync_batch', -1); - $last_statement = request_var('last', 0); - - // We are running sync... - if ($sync_batch >= 0) - { - $this->sync_forums($sync_batch); - return; - } - - if ($jump) - { - $this->jump($jump, $last_statement); - return; - } - - if ($final_jump) - { - $this->final_jump($final_jump); - return; - } - - $current_table = request_var('current_table', 0); - $old_current_table = min(-1, $current_table - 1); - $skip_rows = request_var('skip_rows', 0); - - if (!$current_table && !$skip_rows) - { - if (!$request->variable('confirm', false)) - { - // If avatars / ranks / smilies folders are specified make sure they are writable - $bad_folders = array(); - - $local_paths = array( - 'avatar_path' => path($config['avatar_path']), - 'avatar_gallery_path' => path($config['avatar_gallery_path']), - 'icons_path' => path($config['icons_path']), - 'ranks_path' => path($config['ranks_path']), - 'smilies_path' => path($config['smilies_path']) - ); - - foreach ($local_paths as $folder => $local_path) - { - if (isset($convert->convertor[$folder])) - { - if (empty($convert->convertor['test_file'])) - { - // test_file is mandantory at the moment so this should never be reached, but just in case... - $this->p_master->error($user->lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__); - } - - if (!$local_path || !phpbb_is_writable($phpbb_root_path . $local_path)) - { - if (!$local_path) - { - $bad_folders[] = sprintf($user->lang['CONFIG_PHPBB_EMPTY'], $folder); - } - else - { - $bad_folders[] = $local_path; - } - } - } - } - - if (sizeof($bad_folders)) - { - $msg = (sizeof($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; - sort($bad_folders); - $this->p_master->error(sprintf($msg, implode('<br />', $bad_folders)), __LINE__, __FILE__, true); - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['INSTALL_TEST'], - 'U_ACTION' => $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}&language=$language", - )); - return; - } - - // Grab all the tables used in convertor - $missing_tables = $tables_list = $aliases = array(); - - foreach ($convert->convertor['schema'] as $schema) - { - // Skip those not used (because of addons/plugins not detected) - if (!$schema['target']) - { - continue; - } - - foreach ($schema as $key => $val) - { - // we're dealing with an array like: - // array('forum_status', 'forums.forum_status', 'is_item_locked') - if (is_int($key) && !empty($val[1])) - { - $temp_data = $val[1]; - if (!is_array($temp_data)) - { - $temp_data = array($temp_data); - } - - foreach ($temp_data as $val) - { - if (preg_match('/([a-z0-9_]+)\.([a-z0-9_]+)\)* ?A?S? ?([a-z0-9_]*?)\.?([a-z0-9_]*)$/i', $val, $m)) - { - $table = $convert->src_table_prefix . $m[1]; - $tables_list[$table] = $table; - - if (!empty($m[3])) - { - $aliases[] = $convert->src_table_prefix . $m[3]; - } - } - } - } - // 'left_join' => 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1' - else if ($key == 'left_join') - { - // Convert the value if it wasn't an array already. - if (!is_array($val)) - { - $val = array($val); - } - - for ($j = 0; $j < sizeof($val); ++$j) - { - if (preg_match('/LEFT JOIN ([a-z0-9_]+) AS ([a-z0-9_]+)/i', $val[$j], $m)) - { - $table = $convert->src_table_prefix . $m[1]; - $tables_list[$table] = $table; - - if (!empty($m[2])) - { - $aliases[] = $convert->src_table_prefix . $m[2]; - } - } - } - } - } - } - - // Remove aliased tables from $tables_list - foreach ($aliases as $alias) - { - unset($tables_list[$alias]); - } - - // Check if the tables that we need exist - $src_db->sql_return_on_error(true); - foreach ($tables_list as $table => $null) - { - $sql = 'SELECT 1 FROM ' . $table; - $_result = $src_db->sql_query_limit($sql, 1); - - if (!$_result) - { - $missing_tables[] = $table; - } - $src_db->sql_freeresult($_result); - } - $src_db->sql_return_on_error(false); - - // Throw an error if some tables are missing - // We used to do some guessing here, but since we have a suggestion of possible values earlier, I don't see it adding anything here to do it again - - if (sizeof($missing_tables) == sizeof($tables_list)) - { - $this->p_master->error($user->lang['NO_TABLES_FOUND'] . ' ' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__); - } - else if (sizeof($missing_tables)) - { - $this->p_master->error(sprintf($user->lang['TABLES_MISSING'], implode($user->lang['COMMA_SEPARATOR'], $missing_tables)) . '<br /><br />' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__); - } - - $url = $this->save_convert_progress('&confirm=1'); - $msg = $user->lang['PRE_CONVERT_COMPLETE']; - - if ($convert->convertor_data['author_notes']) - { - $msg .= '</p><p>' . sprintf($user->lang['AUTHOR_NOTES'], $convert->convertor_data['author_notes']); - } - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], - 'L_MESSAGE' => $msg, - 'U_ACTION' => $url, - )); - - return; - } // if (!$request->variable('confirm', false))) - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $user->lang['STARTING_CONVERT'], - )); - - // Convert the config table and load the settings of the old board - if (!empty($convert->config_schema)) - { - restore_config($convert->config_schema); - - // Override a couple of config variables for the duration - $config['max_quote_depth'] = 0; - - // @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues - $config['max_post_chars'] = $config['min_post_chars'] = 0; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $user->lang['CONFIG_CONVERT'], - 'RESULT' => $user->lang['DONE'], - )); - - // Now process queries and execute functions that have to be executed prior to the conversion - if (!empty($convert->convertor['execute_first'])) - { - eval($convert->convertor['execute_first']); - } - - if (!empty($convert->convertor['query_first'])) - { - if (!is_array($convert->convertor['query_first'])) - { - $convert->convertor['query_first'] = array('target', array($convert->convertor['query_first'])); - } - else if (!is_array($convert->convertor['query_first'][0])) - { - $convert->convertor['query_first'] = array(array($convert->convertor['query_first'][0], $convert->convertor['query_first'][1])); - } - - foreach ($convert->convertor['query_first'] as $query_first) - { - if ($query_first[0] == 'src') - { - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'binary'"); - } - - $src_db->sql_query($query_first[1]); - - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'utf8'"); - } - } - else - { - $db->sql_query($query_first[1]); - } - } - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $user->lang['PREPROCESS_STEP'], - 'RESULT' => $user->lang['DONE'], - )); - } // if (!$current_table && !$skip_rows) - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $user->lang['FILLING_TABLES'], - )); - - // This loop takes one target table and processes it - while ($current_table < sizeof($convert->convertor['schema'])) - { - $schema = $convert->convertor['schema'][$current_table]; - - // The target table isn't set, this can be because a module (for example the attachement mod) is taking care of this. - if (empty($schema['target'])) - { - $current_table++; - continue; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => sprintf($user->lang['FILLING_TABLE'], $schema['target']), - )); - - // This is only the case when we first start working on the tables. - if (!$skip_rows) - { - // process execute_first and query_first for this table... - if (!empty($schema['execute_first'])) - { - eval($schema['execute_first']); - } - - if (!empty($schema['query_first'])) - { - if (!is_array($schema['query_first'])) - { - $schema['query_first'] = array('target', array($schema['query_first'])); - } - else if (!is_array($schema['query_first'][0])) - { - $schema['query_first'] = array(array($schema['query_first'][0], $schema['query_first'][1])); - } - - foreach ($schema['query_first'] as $query_first) - { - if ($query_first[0] == 'src') - { - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'binary'"); - } - $src_db->sql_query($query_first[1]); - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'utf8'"); - } - } - else - { - $db->sql_query($query_first[1]); - } - } - } - - if (!empty($schema['autoincrement'])) - { - switch ($db->sql_layer) - { - case 'postgres': - $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));'); - break; - - case 'oracle': - $result = $db->sql_query('SELECT MAX(' . $schema['autoincrement'] . ') as max_id FROM ' . $schema['target']); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $largest_id = (int) $row['max_id']; - - if ($largest_id) - { - $db->sql_query('DROP SEQUENCE ' . $schema['target'] . '_seq'); - $db->sql_query('CREATE SEQUENCE ' . $schema['target'] . '_seq START WITH ' . ($largest_id + 1)); - } - break; - } - } - } - - // Process execute_always for this table - // This is for code which needs to be executed on every pass of this table if - // it gets split because of time restrictions - if (!empty($schema['execute_always'])) - { - eval($schema['execute_always']); - } - - // - // Set up some variables - // - // $waiting_rows holds rows for multirows insertion (MySQL only) - // $src_tables holds unique tables with aliases to select from - // $src_fields will quickly refer source fields (or aliases) corresponding to the current index - // $select_fields holds the names of the fields to retrieve - // - - $sql_data = array( - 'source_fields' => array(), - 'target_fields' => array(), - 'source_tables' => array(), - 'select_fields' => array(), - ); - - // This statement is building the keys for later insertion. - $insert_query = $this->build_insert_query($schema, $sql_data, $current_table); - - // If no source table is affected, we skip the table - if (empty($sql_data['source_tables'])) - { - $skip_rows = 0; - $current_table++; - continue; - } - - $distinct = (!empty($schema['distinct'])) ? 'DISTINCT ' : ''; - - $sql = 'SELECT ' . $distinct . implode(', ', $sql_data['select_fields']) . " \nFROM " . implode(', ', $sql_data['source_tables']); - - // Where - $sql .= (!empty($schema['where'])) ? "\nWHERE (" . $schema['where'] . ')' : ''; - - // Group By - if (!empty($schema['group_by'])) - { - $schema['group_by'] = array($schema['group_by']); - foreach ($sql_data['select_fields'] as $select) - { - $alias = strpos(strtolower($select), ' as '); - $select = ($alias) ? substr($select, 0, $alias) : $select; - if (!in_array($select, $schema['group_by'])) - { - $schema['group_by'][] = $select; - } - } - } - $sql .= (!empty($schema['group_by'])) ? "\nGROUP BY " . implode(', ', $schema['group_by']) : ''; - - // Having - $sql .= (!empty($schema['having'])) ? "\nHAVING " . $schema['having'] : ''; - - // Order By - if (empty($schema['order_by']) && !empty($schema['primary'])) - { - $schema['order_by'] = $schema['primary']; - } - $sql .= (!empty($schema['order_by'])) ? "\nORDER BY " . $schema['order_by'] : ''; - - // Counting basically holds the amount of rows processed. - $counting = -1; - $batch_time = 0; - - while ($counting === -1 || ($counting >= $convert->batch_size && still_on_time())) - { - $old_current_table = $current_table; - - $rows = ''; - $waiting_rows = array(); - - if (!empty($batch_time)) - { - $mtime = explode(' ', microtime()); - $mtime = $mtime[0] + $mtime[1]; - $rows = ceil($counting/($mtime - $batch_time)) . " rows/s ($counting rows) | "; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => "skip_rows = $skip_rows", - 'RESULT' => $rows . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''), - )); - - $mtime = explode(' ', microtime()); - $batch_time = $mtime[0] + $mtime[1]; - - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'binary'"); - } - - // Take skip rows into account and only fetch batch_size amount of rows - $___result = $src_db->sql_query_limit($sql, $convert->batch_size, $skip_rows); - - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'utf8'"); - } - - // This loop processes each row - $counting = 0; - - $convert->row = $convert_row = array(); - - if (!empty($schema['autoincrement'])) - { - switch ($db->sql_layer) - { - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' ON'); - break; - } - } - - // Now handle the rows until time is over or no more rows to process... - while ($counting === 0 || still_on_time()) - { - $convert_row = $src_db->sql_fetchrow($___result); - - if (!$convert_row) - { - // move to the next batch or table - break; - } - - // With this we are able to always save the last state - $convert->row = $convert_row; - - // Increment the counting variable, it stores the number of rows we have processed - $counting++; - - $insert_values = array(); - - $sql_flag = $this->process_row($schema, $sql_data, $insert_values); - - if ($sql_flag === true) - { - switch ($db->sql_layer) - { - // If MySQL, we'll wait to have num_wait_rows rows to submit at once - case 'mysql': - case 'mysql4': - case 'mysqli': - $waiting_rows[] = '(' . implode(', ', $insert_values) . ')'; - - if (sizeof($waiting_rows) >= $convert->num_wait_rows) - { - $errored = false; - - $db->sql_return_on_error(true); - - if (!$db->sql_query($insert_query . implode(', ', $waiting_rows))) - { - $errored = true; - } - $db->sql_return_on_error(false); - - if ($errored) - { - $db->sql_return_on_error(true); - - // Because it errored out we will try to insert the rows one by one... most of the time this - // is caused by duplicate entries - but we also do not want to miss one... - foreach ($waiting_rows as $waiting_sql) - { - if (!$db->sql_query($insert_query . $waiting_sql)) - { - $this->p_master->db_error($user->lang['DB_ERR_INSERT'], htmlspecialchars($insert_query . $waiting_sql) . '<br /><br />' . htmlspecialchars(print_r($db->_sql_error(), true)), __LINE__, __FILE__, true); - } - } - - $db->sql_return_on_error(false); - } - - $waiting_rows = array(); - } - - break; - - default: - $insert_sql = $insert_query . '(' . implode(', ', $insert_values) . ')'; - - $db->sql_return_on_error(true); - - if (!$db->sql_query($insert_sql)) - { - $this->p_master->db_error($user->lang['DB_ERR_INSERT'], htmlspecialchars($insert_sql) . '<br /><br />' . htmlspecialchars(print_r($db->_sql_error(), true)), __LINE__, __FILE__, true); - } - $db->sql_return_on_error(false); - - $waiting_rows = array(); - - break; - } - } - - $skip_rows++; - } - $src_db->sql_freeresult($___result); - - // We might still have some rows waiting - if (sizeof($waiting_rows)) - { - $errored = false; - $db->sql_return_on_error(true); - - if (!$db->sql_query($insert_query . implode(', ', $waiting_rows))) - { - $errored = true; - } - $db->sql_return_on_error(false); - - if ($errored) - { - $db->sql_return_on_error(true); - - // Because it errored out we will try to insert the rows one by one... most of the time this - // is caused by duplicate entries - but we also do not want to miss one... - foreach ($waiting_rows as $waiting_sql) - { - $db->sql_query($insert_query . $waiting_sql); - $this->p_master->db_error($user->lang['DB_ERR_INSERT'], htmlspecialchars($insert_query . $waiting_sql) . '<br /><br />' . htmlspecialchars(print_r($db->_sql_error(), true)), __LINE__, __FILE__, true); - } - - $db->sql_return_on_error(false); - } - - $waiting_rows = array(); - } - - if (!empty($schema['autoincrement'])) - { - switch ($db->sql_layer) - { - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' OFF'); - break; - - case 'postgres': - $db->sql_query("SELECT SETVAL('" . $schema['target'] . "_seq',(select case when max(" . $schema['autoincrement'] . ")>0 then max(" . $schema['autoincrement'] . ")+1 else 1 end from " . $schema['target'] . '));'); - break; - - case 'oracle': - $result = $db->sql_query('SELECT MAX(' . $schema['autoincrement'] . ') as max_id FROM ' . $schema['target']); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $largest_id = (int) $row['max_id']; - - if ($largest_id) - { - $db->sql_query('DROP SEQUENCE ' . $schema['target'] . '_seq'); - $db->sql_query('CREATE SEQUENCE ' . $schema['target'] . '_seq START WITH ' . ($largest_id + 1)); - } - break; - } - } - } - - // When we reach this point, either the current table has been processed or we're running out of time. - if (still_on_time() && $counting < $convert->batch_size/* && !defined('DEBUG')*/) - { - $skip_rows = 0; - $current_table++; - } - else - {/* - if (still_on_time() && $counting < $convert->batch_size) - { - $skip_rows = 0; - $current_table++; - }*/ - - // Looks like we ran out of time. - $url = $this->save_convert_progress('&current_table=' . $current_table . '&skip_rows=' . $skip_rows); - - $current_table++; -// $percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows)); - - $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, sizeof($convert->convertor['schema'])); - - $template->assign_vars(array( - 'L_MESSAGE' => $msg, - 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - } - - // Process execute_last then we'll be done - $url = $this->save_convert_progress('&jump=1'); - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['FINAL_STEP'], - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - - /** - * Sync function being executed at the middle, some functions need to be executed after a successful sync. - */ - function sync_forums($sync_batch) - { - global $template, $user, $db, $phpbb_root_path, $phpEx, $config, $cache; - global $convert; - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $user->lang['SYNC_TOPICS'], - )); - - $batch_size = $convert->batch_size; - - $sql = 'SELECT MIN(topic_id) as min_value, MAX(topic_id) AS max_value - FROM ' . TOPICS_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - // Set values of minimum/maximum primary value for this table. - $primary_min = $row['min_value']; - $primary_max = $row['max_value']; - - if ($sync_batch == 0) - { - $sync_batch = (int) $primary_min; - } - - if ($sync_batch == 0) - { - $sync_batch = 1; - } - - // Fetch a batch of rows, process and insert them. - while ($sync_batch <= $primary_max && still_on_time()) - { - $end = ($sync_batch + $batch_size - 1); - - // Sync all topics in batch mode... - sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true); - - $template->assign_block_vars('checks', array( - 'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''), - 'RESULT' => $user->lang['DONE'], - )); - - $sync_batch += $batch_size; - } - - if ($sync_batch >= $primary_max) - { - $url = $this->save_convert_progress('&final_jump=1'); - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - else - { - $sync_batch--; - } - - $url = $this->save_convert_progress('&sync_batch=' . $sync_batch); - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - - /** - * Save the convertor status - */ - function save_convert_progress($step) - { - global $convert, $language; - - // Save convertor Status - set_config('convert_progress', serialize(array( - 'step' => $step, - 'table_prefix' => $convert->src_table_prefix, - 'tag' => $convert->convertor_tag, - )), true); - - set_config('convert_db_server', serialize(array( - 'dbms' => $convert->src_dbms, - 'dbhost' => $convert->src_dbhost, - 'dbport' => $convert->src_dbport, - 'dbname' => $convert->src_dbname, - )), true); - - set_config('convert_db_user', serialize(array( - 'dbuser' => $convert->src_dbuser, - 'dbpasswd' => $convert->src_dbpasswd, - )), true); - - return $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}$step&language=$language"; - } - - /** - * Finish conversion, the last function to be called. - */ - function finish_conversion() - { - global $db, $phpbb_root_path, $phpEx, $convert, $config, $language, $user, $template; - global $cache, $auth, $phpbb_container, $phpbb_log; - - $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " - WHERE config_name = 'convert_progress' - OR config_name = 'convert_options' - OR config_name = 'convert_db_server' - OR config_name = 'convert_db_user'"); - $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); - - @unlink($phpbb_root_path . 'cache/data_global.' . $phpEx); - phpbb_cache_moderators($db, $cache, $auth); - - // And finally, add a note to the log - $phpbb_log = $phpbb_container->get('log'); - add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']); - - $url = $this->p_master->module_url . "?mode={$this->mode}&sub=final&language=$language"; - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['FINAL_STEP'], - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - - /** - * This function marks the steps after syncing - */ - function final_jump($final_jump) - { - global $template, $user, $src_db, $same_db, $db, $phpbb_root_path, $phpEx, $config, $cache; - global $convert; - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $user->lang['PROCESS_LAST'], - )); - - if ($final_jump == 1) - { - $db->sql_return_on_error(true); - - update_topics_posted(); - - $template->assign_block_vars('checks', array( - 'TITLE' => $user->lang['UPDATE_TOPICS_POSTED'], - 'RESULT' => $user->lang['DONE'], - )); - - if ($db->sql_error_triggered) - { - $template->assign_vars(array( - 'S_ERROR_BOX' => true, - 'ERROR_TITLE' => $user->lang['UPDATE_TOPICS_POSTED'], - 'ERROR_MSG' => $user->lang['UPDATE_TOPICS_POSTED_ERR'], - )); - } - $db->sql_return_on_error(false); - - $this->finish_conversion(); - return; - } - } - - /** - * This function marks the steps before syncing (jump=1) - */ - function jump($jump, $last_statement) - { - global $template, $user, $src_db, $same_db, $db, $phpbb_root_path, $phpEx, $config, $cache; - global $convert; - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $user->lang['PROCESS_LAST'], - )); - - if ($jump == 1) - { - // Execute 'last' statements/queries - if (!empty($convert->convertor['execute_last'])) - { - if (!is_array($convert->convertor['execute_last'])) - { - eval($convert->convertor['execute_last']); - } - else - { - while ($last_statement < sizeof($convert->convertor['execute_last'])) - { - eval($convert->convertor['execute_last'][$last_statement]); - - $template->assign_block_vars('checks', array( - 'TITLE' => $convert->convertor['execute_last'][$last_statement], - 'RESULT' => $user->lang['DONE'], - )); - - $last_statement++; - $url = $this->save_convert_progress('&jump=1&last=' . $last_statement); - - $percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement)); - $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, sizeof($convert->convertor['execute_last']), $percentage); - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['CONTINUE_LAST'], - 'L_MESSAGE' => $msg, - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - } - } - - if (!empty($convert->convertor['query_last'])) - { - if (!is_array($convert->convertor['query_last'])) - { - $convert->convertor['query_last'] = array('target', array($convert->convertor['query_last'])); - } - else if (!is_array($convert->convertor['query_last'][0])) - { - $convert->convertor['query_last'] = array(array($convert->convertor['query_last'][0], $convert->convertor['query_last'][1])); - } - - foreach ($convert->convertor['query_last'] as $query_last) - { - if ($query_last[0] == 'src') - { - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'binary'"); - } - - $src_db->sql_query($query_last[1]); - - if ($convert->mysql_convert && $same_db) - { - $src_db->sql_query("SET NAMES 'utf8'"); - } - } - else - { - $db->sql_query($query_last[1]); - } - } - } - - // Sanity check - $db->sql_return_on_error(false); - $src_db->sql_return_on_error(false); - - fix_empty_primary_groups(); - - $sql = 'SELECT MIN(user_regdate) AS board_startdate - FROM ' . USERS_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!isset($config['board_startdate']) || ($row['board_startdate'] < $config['board_startdate'] && $row['board_startdate'] > 0)) - { - set_config('board_startdate', $row['board_startdate']); - $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_regdate = ' . $row['board_startdate'] . ' WHERE user_id = ' . ANONYMOUS); - } - - update_dynamic_config(); - - $template->assign_block_vars('checks', array( - 'TITLE' => $user->lang['CLEAN_VERIFY'], - 'RESULT' => $user->lang['DONE'], - )); - - $url = $this->save_convert_progress('&jump=2'); - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - - if ($jump == 2) - { - $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_permissions = ''"); - - // TODO: sync() is likely going to bomb out on forums with a considerable amount of topics. - // TODO: the sync function is able to handle FROM-TO values, we should use them here (batch processing) - sync('forum', '', '', false, true); - $cache->destroy('sql', FORUMS_TABLE); - - $template->assign_block_vars('checks', array( - 'TITLE' => $user->lang['SYNC_FORUMS'], - 'RESULT' => $user->lang['DONE'], - )); - - // Continue with synchronizing the forums... - $url = $this->save_convert_progress('&sync_batch=0'); - - $template->assign_vars(array( - 'L_SUBMIT' => $user->lang['CONTINUE_CONVERT'], - 'U_ACTION' => $url, - )); - - $this->meta_refresh($url); - return; - } - } - - function build_insert_query(&$schema, &$sql_data, $current_table) - { - global $db, $user; - global $convert; - - // Can we use IGNORE with this DBMS? - $sql_ignore = (strpos($db->sql_layer, 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : ''; - $insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' ('; - - $aliases = array(); - - $sql_data = array( - 'source_fields' => array(), - 'target_fields' => array(), - 'source_tables' => array(), - 'select_fields' => array(), - ); - - foreach ($schema as $key => $val) - { - // Example: array('group_name', 'extension_groups.group_name', 'htmlspecialchars'), - if (is_int($key)) - { - if (!empty($val[0])) - { - // Target fields - $sql_data['target_fields'][$val[0]] = $key; - $insert_query .= $val[0] . ', '; - } - - if (!is_array($val[1])) - { - $val[1] = array($val[1]); - } - - foreach ($val[1] as $valkey => $value_1) - { - // This should cover about any case: - // - // table.field => SELECT table.field FROM table - // table.field AS alias => SELECT table.field AS alias FROM table - // table.field AS table2.alias => SELECT table2.field AS alias FROM table table2 - // table.field AS table2.field => SELECT table2.field FROM table table2 - // - if (preg_match('/^([a-z0-9_]+)\.([a-z0-9_]+)( +AS +(([a-z0-9_]+?)\.)?([a-z0-9_]+))?$/i', $value_1, $m)) - { - // There is 'AS ...' in the field names - if (!empty($m[3])) - { - $value_1 = ($m[2] == $m[6]) ? $m[1] . '.' . $m[2] : $m[1] . '.' . $m[2] . ' AS ' . $m[6]; - - // Table alias: store it then replace the source table with it - if (!empty($m[5]) && $m[5] != $m[1]) - { - $aliases[$m[5]] = $m[1]; - $value_1 = str_replace($m[1] . '.' . $m[2], $m[5] . '.' . $m[2], $value_1); - } - } - else - { - // No table alias - $sql_data['source_tables'][$m[1]] = (empty($convert->src_table_prefix)) ? $m[1] : $convert->src_table_prefix . $m[1] . ' ' . $m[1]; - } - - $sql_data['select_fields'][$value_1] = $value_1; - $sql_data['source_fields'][$key][$valkey] = (!empty($m[6])) ? $m[6] : $m[2]; - } - } - } - else if ($key == 'where' || $key == 'group_by' || $key == 'order_by' || $key == 'having') - { - if (@preg_match_all('/([a-z0-9_]+)\.([a-z0-9_]+)/i', $val, $m)) - { - foreach ($m[1] as $value) - { - $sql_data['source_tables'][$value] = (empty($convert->src_table_prefix)) ? $value : $convert->src_table_prefix . $value . ' ' . $value; - } - } - } - } - - // Add the aliases to the list of tables - foreach ($aliases as $alias => $table) - { - $sql_data['source_tables'][$alias] = $convert->src_table_prefix . $table . ' ' . $alias; - } - - // 'left_join' => 'forums LEFT JOIN forum_prune ON forums.forum_id = forum_prune.forum_id', - if (!empty($schema['left_join'])) - { - if (!is_array($schema['left_join'])) - { - $schema['left_join'] = array($schema['left_join']); - } - - foreach ($schema['left_join'] as $left_join) - { - // This won't handle concatened LEFT JOINs - if (!preg_match('/([a-z0-9_]+) LEFT JOIN ([a-z0-9_]+) A?S? ?([a-z0-9_]*?) ?(ON|USING)(.*)/i', $left_join, $m)) - { - $this->p_master->error(sprintf($user->lang['NOT_UNDERSTAND'], 'LEFT JOIN', $left_join, $current_table, $schema['target']), __LINE__, __FILE__); - } - - if (!empty($aliases[$m[2]])) - { - if (!empty($m[3])) - { - $this->p_master->error(sprintf($user->lang['NAMING_CONFLICT'], $m[2], $m[3], $schema['left_join']), __LINE__, __FILE__); - } - - $m[2] = $aliases[$m[2]]; - $m[3] = $m[2]; - } - - $right_table = $convert->src_table_prefix . $m[2]; - if (!empty($m[3])) - { - unset($sql_data['source_tables'][$m[3]]); - } - else if ($m[2] != $m[1]) - { - unset($sql_data['source_tables'][$m[2]]); - } - - if (strpos($sql_data['source_tables'][$m[1]], "\nLEFT JOIN") !== false) - { - $sql_data['source_tables'][$m[1]] = '(' . $sql_data['source_tables'][$m[1]] . ")\nLEFT JOIN $right_table"; - } - else - { - $sql_data['source_tables'][$m[1]] .= "\nLEFT JOIN $right_table"; - } - - if (!empty($m[3])) - { - unset($sql_data['source_tables'][$m[3]]); - $sql_data['source_tables'][$m[1]] .= ' AS ' . $m[3]; - } - else if (!empty($convert->src_table_prefix)) - { - $sql_data['source_tables'][$m[1]] .= ' AS ' . $m[2]; - } - $sql_data['source_tables'][$m[1]] .= ' ' . $m[4] . $m[5]; - } - } - - // Remove ", " from the end of the insert query - $insert_query = substr($insert_query, 0, -2) . ') VALUES '; - - return $insert_query; - } - - /** - * Function for processing the currently handled row - */ - function process_row(&$schema, &$sql_data, &$insert_values) - { - global $template, $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache; - global $convert, $convert_row; - - $sql_flag = false; - - foreach ($schema as $key => $fields) - { - // We are only interested in the lines with: - // array('comment', 'attachments_desc.comment', 'htmlspecialchars'), - if (is_int($key)) - { - if (!is_array($fields[1])) - { - $fields[1] = array($fields[1]); - } - - $firstkey_set = false; - $firstkey = 0; - - foreach ($fields[1] as $inner_key => $inner_value) - { - if (!$firstkey_set) - { - $firstkey = $inner_key; - $firstkey_set = true; - } - - $src_field = isset($sql_data['source_fields'][$key][$inner_key]) ? $sql_data['source_fields'][$key][$inner_key] : ''; - - if (!empty($src_field)) - { - $fields[1][$inner_key] = $convert->row[$src_field]; - } - } - - if (!empty($fields[0])) - { - // We have a target field, if we haven't set $sql_flag yet it will be set to TRUE. - // If a function has already set it to FALSE it won't change it. - if ($sql_flag === false) - { - $sql_flag = true; - } - - // No function assigned? - if (empty($fields[2])) - { - $value = $fields[1][$firstkey]; - } - else if (is_array($fields[2])) - { - // Execute complex function/eval/typecast - $value = $fields[1]; - - foreach ($fields[2] as $type => $execution) - { - if (strpos($type, 'typecast') === 0) - { - if (!is_array($value)) - { - $value = array($value); - } - $value = $value[0]; - settype($value, $execution); - } - else if (strpos($type, 'function') === 0) - { - if (!is_array($value)) - { - $value = array($value); - } - - $value = call_user_func_array($execution, $value); - } - else if (strpos($type, 'execute') === 0) - { - if (!is_array($value)) - { - $value = array($value); - } - - $execution = str_replace('{RESULT}', '$value', $execution); - $execution = str_replace('{VALUE}', '$value', $execution); - eval($execution); - } - } - } - else - { - $value = call_user_func_array($fields[2], $fields[1]); - } - - if (is_null($value)) - { - $value = ''; - } - - $insert_values[] = $db->_sql_validate_value($value); - } - else if (!empty($fields[2])) - { - if (is_array($fields[2])) - { - // Execute complex function/eval/typecast - $value = ''; - - foreach ($fields[2] as $type => $execution) - { - if (strpos($type, 'typecast') === 0) - { - $value = settype($value, $execution); - } - else if (strpos($type, 'function') === 0) - { - if (!is_array($value)) - { - $value = array($value); - } - - $value = call_user_func_array($execution, $value); - } - else if (strpos($type, 'execute') === 0) - { - if (!is_array($value)) - { - $value = array($value); - } - - $execution = str_replace('{RESULT}', '$value', $execution); - $execution = str_replace('{VALUE}', '$value', $execution); - eval($execution); - } - } - } - else - { - call_user_func_array($fields[2], $fields[1]); - } - } - } - } - - return $sql_flag; - } - - /** - * Own meta refresh function to be able to change the global time used - */ - function meta_refresh($url) - { - global $convert, $template; - - if ($convert->options['refresh']) - { - // Because we should not rely on correct settings, we simply use the relative path here directly. - $template->assign_vars(array( - 'S_REFRESH' => true, - 'META' => '<meta http-equiv="refresh" content="5; url=' . $url . '" />') - ); - } - } - - /** - * The information below will be used to build the input fields presented to the user - */ - var $convert_options = array( - 'legend1' => 'SPECIFY_OPTIONS', - 'src_dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\', true)', 'explain' => false), - 'src_dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true), - 'src_dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true), - 'src_dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false), - 'src_dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false), - 'src_dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false), - 'src_table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => false), - //'src_url' => array('lang' => 'FORUM_ADDRESS', 'type' => 'text:50:100', 'explain' => true), - 'forum_path' => array('lang' => 'FORUM_PATH', 'type' => 'text:25:100', 'explain' => true), - 'refresh' => array('lang' => 'REFRESH_PAGE', 'type' => 'radio:yes_no', 'explain' => true), - ); -} diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php deleted file mode 100644 index a2d44f2b6c..0000000000 --- a/phpBB/install/install_install.php +++ /dev/null @@ -1,2215 +0,0 @@ -<?php -/** -* -* @package install -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -*/ -if (!defined('IN_INSTALL')) -{ - // Someone has tried to access the file direct. This is not a good idea, so exit - exit; -} - -if (!empty($setmodules)) -{ - // If phpBB is already installed we do not include this module - if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock')) - { - include_once($phpbb_root_path . 'config.' . $phpEx); - - if (defined('PHPBB_INSTALLED')) - { - return; - } - } - - $module[] = array( - 'module_type' => 'install', - 'module_title' => 'INSTALL', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), - 'module_order' => 10, - 'module_subs' => '', - 'module_stages' => array('INTRO', 'REQUIREMENTS', 'DATABASE', 'ADMINISTRATOR', 'CONFIG_FILE', 'ADVANCED', 'CREATE_TABLE', 'FINAL'), - 'module_reqs' => '' - ); -} - -/** -* Installation -* @package install -*/ -class install_install extends module -{ - function install_install(&$p_master) - { - $this->p_master = &$p_master; - } - - function main($mode, $sub) - { - global $lang, $template, $language, $phpbb_root_path, $phpEx; - global $phpbb_container, $cache, $phpbb_log, $request; - - switch ($sub) - { - case 'intro': - $phpbb_container->get('cache.driver')->purge(); - - $this->page_title = $lang['SUB_INTRO']; - - $template->assign_vars(array( - 'TITLE' => $lang['INSTALL_INTRO'], - 'BODY' => $lang['INSTALL_INTRO_BODY'], - 'L_SUBMIT' => $lang['NEXT_STEP'], - 'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select($language) . '</select>', - 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language", - )); - - break; - - case 'requirements': - $this->check_server_requirements($mode, $sub); - - break; - - case 'database': - $this->obtain_database_settings($mode, $sub); - - break; - - case 'administrator': - $this->obtain_admin_settings($mode, $sub); - - break; - - case 'config_file': - $this->create_config_file($mode, $sub); - - break; - - case 'advanced': - $this->obtain_advanced_settings($mode, $sub); - - break; - - case 'create_table': - $this->load_schema($mode, $sub); - break; - - case 'final': - // Enable super globals to prevent issues with the new \phpbb\request\request object - $request->enable_super_globals(); - - // Create a normal container now - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); - - // Sets the global variables - $cache = $phpbb_container->get('cache'); - $phpbb_log = $phpbb_container->get('log'); - - $this->build_search_index($mode, $sub); - $this->add_modules($mode, $sub); - $this->add_language($mode, $sub); - $this->add_bots($mode, $sub); - $this->email_admin($mode, $sub); - $this->disable_avatars_if_unwritable(); - $this->populate_migrations($phpbb_container->get('ext.manager'), $phpbb_container->get('migrator')); - - // Remove the lock file - @unlink($phpbb_root_path . 'cache/install_lock'); - - break; - } - - $this->tpl_name = 'install_install'; - } - - /** - * Checks that the server we are installing on meets the requirements for running phpBB - */ - function check_server_requirements($mode, $sub) - { - global $lang, $template, $phpbb_root_path, $phpEx, $language; - - $this->page_title = $lang['STAGE_REQUIREMENTS']; - - $template->assign_vars(array( - 'TITLE' => $lang['REQUIREMENTS_TITLE'], - 'BODY' => $lang['REQUIREMENTS_EXPLAIN'], - )); - - $passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false, 'json' => false,); - - // Test for basic PHP settings - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['PHP_SETTINGS'], - 'LEGEND_EXPLAIN' => $lang['PHP_SETTINGS_EXPLAIN'], - )); - - // Test the minimum PHP version - $php_version = PHP_VERSION; - - if (version_compare($php_version, '5.3.3') < 0) - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - } - else - { - $passed['php'] = true; - - // We also give feedback on whether we're running in safe mode - $result = '<strong style="color:green">' . $lang['YES']; - if (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on') - { - $result .= ', ' . $lang['PHP_SAFE_MODE']; - } - $result .= '</strong>'; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_VERSION_REQD'], - 'RESULT' => $result, - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - - // Don't check for register_globals on 5.4+ - if (version_compare($php_version, '5.4.0-dev') < 0) - { - // Check for register_globals being enabled - if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on') - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - } - else - { - $result = '<strong style="color:green">' . $lang['YES'] . '</strong>'; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_REGISTER_GLOBALS'], - 'TITLE_EXPLAIN' => $lang['PHP_REGISTER_GLOBALS_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - } - - // Check for url_fopen - if (@ini_get('allow_url_fopen') == '1' || strtolower(@ini_get('allow_url_fopen')) == 'on') - { - $result = '<strong style="color:green">' . $lang['YES'] . '</strong>'; - } - else - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_URL_FOPEN_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PHP_URL_FOPEN_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - - // Check for getimagesize - if (@function_exists('getimagesize')) - { - $passed['imagesize'] = true; - $result = '<strong style="color:green">' . $lang['YES'] . '</strong>'; - } - else - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_GETIMAGESIZE_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - // Check for PCRE UTF-8 support - if (@preg_match('//u', '')) - { - $passed['pcre'] = true; - $result = '<strong style="color:green">' . $lang['YES'] . '</strong>'; - } - else - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PCRE_UTF_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PCRE_UTF_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - // Check for php json support - if (@extension_loaded('json')) - { - $passed['json'] = true; - $result = '<strong style="color:green">' . $lang['YES'] . '</strong>'; - } - else - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_JSON_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PHP_JSON_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - $passed['mbstring'] = true; - if (@extension_loaded('mbstring')) - { - // Test for available database modules - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['MBSTRING_CHECK'], - 'LEGEND_EXPLAIN' => $lang['MBSTRING_CHECK_EXPLAIN'], - )); - - $checks = array( - array('func_overload', '&', MB_OVERLOAD_MAIL|MB_OVERLOAD_STRING), - array('encoding_translation', '!=', 0), - array('http_input', '!=', 'pass'), - array('http_output', '!=', 'pass') - ); - - foreach ($checks as $mb_checks) - { - $ini_val = @ini_get('mbstring.' . $mb_checks[0]); - switch ($mb_checks[1]) - { - case '&': - if (intval($ini_val) & $mb_checks[2]) - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - $passed['mbstring'] = false; - } - else - { - $result = '<strong style="color:green">' . $lang['YES'] . '</strong>'; - } - break; - - case '!=': - if ($ini_val != $mb_checks[2]) - { - $result = '<strong style="color:red">' . $lang['NO'] . '</strong>'; - $passed['mbstring'] = false; - } - else - { - $result = '<strong style="color:green">' . $lang['YES'] . '</strong>'; - } - break; - } - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['MBSTRING_' . strtoupper($mb_checks[0])], - 'TITLE_EXPLAIN' => $lang['MBSTRING_' . strtoupper($mb_checks[0]) . '_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - } - } - - // Test for available database modules - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['PHP_SUPPORTED_DB'], - 'LEGEND_EXPLAIN' => $lang['PHP_SUPPORTED_DB_EXPLAIN'], - )); - - $available_dbms = get_available_dbms(false, true); - $passed['db'] = $available_dbms['ANY_DB_SUPPORT']; - unset($available_dbms['ANY_DB_SUPPORT']); - - foreach ($available_dbms as $db_name => $db_ary) - { - if (!$db_ary['AVAILABLE']) - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($db_name)], - 'RESULT' => '<span style="color:red">' . $lang['UNAVAILABLE'] . '</span>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - else - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($db_name)], - 'RESULT' => '<strong style="color:green">' . $lang['AVAILABLE'] . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - } - - // Test for other modules - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['PHP_OPTIONAL_MODULE'], - 'LEGEND_EXPLAIN' => $lang['PHP_OPTIONAL_MODULE_EXPLAIN'], - )); - - foreach ($this->php_dlls_other as $dll) - { - if (!@extension_loaded($dll)) - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($dll)], - 'RESULT' => '<strong style="color:red">' . $lang['UNAVAILABLE'] . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - continue; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($dll)], - 'RESULT' => '<strong style="color:green">' . $lang['AVAILABLE'] . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - - // Can we find Imagemagick anywhere on the system? - $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : ''; - - $magic_home = getenv('MAGICK_HOME'); - $img_imagick = ''; - if (empty($magic_home)) - { - $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/'); - $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH')))); - - $locations = array_merge($path_locations, $locations); - foreach ($locations as $location) - { - // The path might not end properly, fudge it - if (substr($location, -1, 1) !== '/') - { - $location .= '/'; - } - - if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000) - { - $img_imagick = str_replace('\\', '/', $location); - continue; - } - } - } - else - { - $img_imagick = str_replace('\\', '/', $magic_home); - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['APP_MAGICK'], - 'RESULT' => ($img_imagick) ? '<strong style="color:green">' . $lang['AVAILABLE'] . ', ' . $img_imagick . '</strong>' : '<strong style="color:blue">' . $lang['NO_LOCATION'] . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - - // Check permissions on files/directories we need access to - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['FILES_REQUIRED'], - 'LEGEND_EXPLAIN' => $lang['FILES_REQUIRED_EXPLAIN'], - )); - - $directories = array('cache/', 'files/', 'store/'); - - umask(0); - - $passed['files'] = true; - foreach ($directories as $dir) - { - $exists = $write = false; - - // Try to create the directory if it does not exist - if (!file_exists($phpbb_root_path . $dir)) - { - @mkdir($phpbb_root_path . $dir, 0777); - phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); - } - - // Now really check - if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir)) - { - phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); - $exists = true; - } - - // Now check if it is writable by storing a simple file - $fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb'); - if ($fp !== false) - { - $write = true; - } - @fclose($fp); - - @unlink($phpbb_root_path . $dir . 'test_lock'); - - $passed['files'] = ($exists && $write && $passed['files']) ? true : false; - - $exists = ($exists) ? '<strong style="color:green">' . $lang['FOUND'] . '</strong>' : '<strong style="color:red">' . $lang['NOT_FOUND'] . '</strong>'; - $write = ($write) ? ', <strong style="color:green">' . $lang['WRITABLE'] . '</strong>' : (($exists) ? ', <strong style="color:red">' . $lang['UNWRITABLE'] . '</strong>' : ''); - - $template->assign_block_vars('checks', array( - 'TITLE' => $dir, - 'RESULT' => $exists . $write, - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - - // Check permissions on files/directories it would be useful access to - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['FILES_OPTIONAL'], - 'LEGEND_EXPLAIN' => $lang['FILES_OPTIONAL_EXPLAIN'], - )); - - $directories = array('config.' . $phpEx, 'images/avatars/upload/'); - - foreach ($directories as $dir) - { - $write = $exists = true; - if (file_exists($phpbb_root_path . $dir)) - { - if (!phpbb_is_writable($phpbb_root_path . $dir)) - { - $write = false; - } - } - else - { - $write = $exists = false; - } - - $exists_str = ($exists) ? '<strong style="color:green">' . $lang['FOUND'] . '</strong>' : '<strong style="color:red">' . $lang['NOT_FOUND'] . '</strong>'; - $write_str = ($write) ? ', <strong style="color:green">' . $lang['WRITABLE'] . '</strong>' : (($exists) ? ', <strong style="color:red">' . $lang['UNWRITABLE'] . '</strong>' : ''); - - $template->assign_block_vars('checks', array( - 'TITLE' => $dir, - 'RESULT' => $exists_str . $write_str, - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - - // And finally where do we want to go next (well today is taken isn't it :P) - $s_hidden_fields = ($img_imagick) ? '<input type="hidden" name="img_imagick" value="' . addslashes($img_imagick) . '" />' : ''; - - $url = (!in_array(false, $passed)) ? $this->p_master->module_url . "?mode=$mode&sub=database&language=$language" : $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language "; - $submit = (!in_array(false, $passed)) ? $lang['INSTALL_START'] : $lang['INSTALL_TEST']; - - - $template->assign_vars(array( - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Obtain the information required to connect to the database - */ - function obtain_database_settings($mode, $sub) - { - global $lang, $template, $phpEx; - - $this->page_title = $lang['STAGE_DATABASE']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - $connect_test = false; - $error = array(); - $available_dbms = get_available_dbms(false, true); - - // Has the user opted to test the connection? - if (isset($_POST['testdb'])) - { - if (!isset($available_dbms[$data['dbms']]) || !$available_dbms[$data['dbms']]['AVAILABLE']) - { - $error[] = $lang['INST_ERR_NO_DB']; - $connect_test = false; - } - else if (!preg_match(get_preg_expression('table_prefix'), $data['table_prefix'])) - { - $error[] = $lang['INST_ERR_DB_INVALID_PREFIX']; - $connect_test = false; - } - else - { - $connect_test = connect_check_db(true, $error, $available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport']); - } - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['DB_CONNECTION'], - 'LEGEND_EXPLAIN' => false, - )); - - if ($connect_test) - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DB_TEST'], - 'RESULT' => '<strong style="color:green">' . $lang['SUCCESSFUL_CONNECT'] . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - else - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DB_TEST'], - 'RESULT' => '<strong style="color:red">' . implode('<br />', $error) . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - } - - if (!$connect_test) - { - // Update the list of available DBMS modules to only contain those which can be used - $available_dbms_temp = array(); - foreach ($available_dbms as $type => $dbms_ary) - { - if (!$dbms_ary['AVAILABLE']) - { - continue; - } - - $available_dbms_temp[$type] = $dbms_ary; - } - - $available_dbms = &$available_dbms_temp; - - // And now for the main part of this page - $data['table_prefix'] = (!empty($data['table_prefix']) ? $data['table_prefix'] : 'phpbb_'); - - foreach ($this->db_config_options as $config_key => $vars) - { - if (!is_array($vars) && strpos($config_key, 'legend') === false) - { - continue; - } - - if (strpos($config_key, 'legend') !== false) - { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang[$vars]) - ); - - continue; - } - - $options = isset($vars['options']) ? $vars['options'] : ''; - - $template->assign_block_vars('options', array( - 'KEY' => $config_key, - 'TITLE' => $lang[$vars['lang']], - 'S_EXPLAIN' => $vars['explain'], - 'S_LEGEND' => false, - 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', - 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), - ) - ); - } - } - - // And finally where do we want to go next (well today is taken isn't it :P) - $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; - $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />'; - if ($connect_test) - { - foreach ($this->db_config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />'; - } - } - - $url = ($connect_test) ? $this->p_master->module_url . "?mode=$mode&sub=administrator" : $this->p_master->module_url . "?mode=$mode&sub=database"; - $s_hidden_fields .= ($connect_test) ? '' : '<input type="hidden" name="testdb" value="true" />'; - - $submit = $lang['NEXT_STEP']; - - $template->assign_vars(array( - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Obtain the administrator's name, password and email address - */ - function obtain_admin_settings($mode, $sub) - { - global $lang, $template, $phpEx; - - $this->page_title = $lang['STAGE_ADMINISTRATOR']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; - $passed = false; - - $data['default_lang'] = ($data['default_lang'] !== '') ? $data['default_lang'] : $data['language']; - - if (isset($_POST['check'])) - { - $error = array(); - - // Check the entered email address and password - if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email'] == '') - { - $error[] = $lang['INST_ERR_MISSING_DATA']; - } - - if ($data['admin_pass1'] != $data['admin_pass2'] && $data['admin_pass1'] != '') - { - $error[] = $lang['INST_ERR_PASSWORD_MISMATCH']; - } - - // Test against the default username rules - if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) < 3) - { - $error[] = $lang['INST_ERR_USER_TOO_SHORT']; - } - - if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) > 20) - { - $error[] = $lang['INST_ERR_USER_TOO_LONG']; - } - - // Test against the default password rules - if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) < 6) - { - $error[] = $lang['INST_ERR_PASSWORD_TOO_SHORT']; - } - - if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) > 30) - { - $error[] = $lang['INST_ERR_PASSWORD_TOO_LONG']; - } - - if ($data['board_email'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email'])) - { - $error[] = $lang['INST_ERR_EMAIL_INVALID']; - } - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['STAGE_ADMINISTRATOR'], - 'LEGEND_EXPLAIN' => false, - )); - - if (!sizeof($error)) - { - $passed = true; - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['ADMIN_TEST'], - 'RESULT' => '<strong style="color:green">' . $lang['TESTS_PASSED'] . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - else - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['ADMIN_TEST'], - 'RESULT' => '<strong style="color:red">' . implode('<br />', $error) . '</strong>', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - } - - if (!$passed) - { - foreach ($this->admin_config_options as $config_key => $vars) - { - if (!is_array($vars) && strpos($config_key, 'legend') === false) - { - continue; - } - - if (strpos($config_key, 'legend') !== false) - { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang[$vars]) - ); - - continue; - } - - $options = isset($vars['options']) ? $vars['options'] : ''; - - $template->assign_block_vars('options', array( - 'KEY' => $config_key, - 'TITLE' => $lang[$vars['lang']], - 'S_EXPLAIN' => $vars['explain'], - 'S_LEGEND' => false, - 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', - 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), - ) - ); - } - } - else - { - foreach ($this->admin_config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />'; - } - } - - $s_hidden_fields .= ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; - $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />'; - - foreach ($this->db_config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />'; - } - - $submit = $lang['NEXT_STEP']; - - $url = ($passed) ? $this->p_master->module_url . "?mode=$mode&sub=config_file" : $this->p_master->module_url . "?mode=$mode&sub=administrator"; - $s_hidden_fields .= ($passed) ? '' : '<input type="hidden" name="check" value="true" />'; - - $template->assign_vars(array( - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Writes the config file to disk, or if unable to do so offers alternative methods - */ - function create_config_file($mode, $sub) - { - global $lang, $template, $phpbb_root_path, $phpEx; - - $this->page_title = $lang['STAGE_CONFIG_FILE']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; - $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />'; - $written = false; - - // Create a list of any PHP modules we wish to have loaded - $available_dbms = get_available_dbms($data['dbms']); - - // Create a lock file to indicate that there is an install in progress - $fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb'); - if ($fp === false) - { - // We were unable to create the lock file - abort - $this->p_master->error($lang['UNABLE_WRITE_LOCK'], __LINE__, __FILE__); - } - @fclose($fp); - - @chmod($phpbb_root_path . 'cache/install_lock', 0777); - - // Time to convert the data provided into a config file - $config_data = phpbb_create_config_file_data($data, $available_dbms[$data['dbms']]['DRIVER']); - - // Attempt to write out the config file directly. If it works, this is the easiest way to do it ... - if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) || phpbb_is_writable($phpbb_root_path)) - { - // Assume it will work ... if nothing goes wrong below - $written = true; - - if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w'))) - { - // Something went wrong ... so let's try another method - $written = false; - } - - if (!(@fwrite($fp, $config_data))) - { - // Something went wrong ... so let's try another method - $written = false; - } - - @fclose($fp); - - if ($written) - { - // We may revert back to chmod() if we see problems with users not able to change their config.php file directly - phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ); - } - } - - if (isset($_POST['dldone'])) - { - // Do a basic check to make sure that the file has been uploaded - // Note that all we check is that the file has _something_ in it - // We don't compare the contents exactly - if they can't upload - // a single file correctly, it's likely they will have other problems.... - if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10) - { - $written = true; - } - } - - $config_options = array_merge($this->db_config_options, $this->admin_config_options); - - foreach ($config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />'; - } - - if (!$written) - { - // OK, so it didn't work let's try the alternatives - - if (isset($_POST['dlconfig'])) - { - // They want a copy of the file to download, so send the relevant headers and dump out the data - header("Content-Type: text/x-delimtext; name=\"config.$phpEx\""); - header("Content-disposition: attachment; filename=config.$phpEx"); - echo $config_data; - exit; - } - - // The option to download the config file is always available, so output it here - $template->assign_vars(array( - 'BODY' => $lang['CONFIG_FILE_UNABLE_WRITE'], - 'L_DL_CONFIG' => $lang['DL_CONFIG'], - 'L_DL_CONFIG_EXPLAIN' => $lang['DL_CONFIG_EXPLAIN'], - 'L_DL_DONE' => $lang['DONE'], - 'L_DL_DOWNLOAD' => $lang['DL_DOWNLOAD'], - 'S_HIDDEN' => $s_hidden_fields, - 'S_SHOW_DOWNLOAD' => true, - 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=config_file", - )); - return; - } - else - { - $template->assign_vars(array( - 'BODY' => $lang['CONFIG_FILE_WRITTEN'], - 'L_SUBMIT' => $lang['NEXT_STEP'], - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=advanced", - )); - return; - } - } - - /** - * Provide an opportunity to customise some advanced settings during the install - * in case it is necessary for them to be set to access later - */ - function obtain_advanced_settings($mode, $sub) - { - global $lang, $template, $phpEx, $request; - - $this->page_title = $lang['STAGE_ADVANCED']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; - $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />'; - - // HTTP_HOST is having the correct browser url in most cases... - $server_name = strtolower(htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME')))); - - // HTTP HOST can carry a port number... - if (strpos($server_name, ':') !== false) - { - $server_name = substr($server_name, 0, strpos($server_name, ':')); - } - - $data['email_enable'] = ($data['email_enable'] !== '') ? $data['email_enable'] : true; - $data['server_name'] = ($data['server_name'] !== '') ? $data['server_name'] : $server_name; - $data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : $request->server('SERVER_PORT', 0); - $data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ($request->is_secure() ? 'https://' : 'http://'); - $data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : $request->is_secure(); - - if ($data['script_path'] === '') - { - $name = htmlspecialchars_decode($request->server('PHP_SELF')); - if (!$name) - { - $name = htmlspecialchars_decode($request->server('REQUEST_URI')); - } - - // Replace backslashes and doubled slashes (could happen on some proxy setups) - $name = str_replace(array('\\', '//'), '/', $name); - $data['script_path'] = trim(dirname(dirname($name))); - } - - foreach ($this->advanced_config_options as $config_key => $vars) - { - if (!is_array($vars) && strpos($config_key, 'legend') === false) - { - continue; - } - - if (strpos($config_key, 'legend') !== false) - { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang[$vars]) - ); - - continue; - } - - $options = isset($vars['options']) ? $vars['options'] : ''; - - $template->assign_block_vars('options', array( - 'KEY' => $config_key, - 'TITLE' => $lang[$vars['lang']], - 'S_EXPLAIN' => $vars['explain'], - 'S_LEGEND' => false, - 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', - 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), - ) - ); - } - - $config_options = array_merge($this->db_config_options, $this->admin_config_options); - foreach ($config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />'; - } - - $submit = $lang['NEXT_STEP']; - - $url = $this->p_master->module_url . "?mode=$mode&sub=create_table"; - - $template->assign_vars(array( - 'BODY' => $lang['STAGE_ADVANCED_EXPLAIN'], - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Load the contents of the schema into the database and then alter it based on what has been input during the installation - */ - function load_schema($mode, $sub) - { - global $db, $lang, $template, $phpbb_root_path, $phpEx, $request; - - $this->page_title = $lang['STAGE_CREATE_TABLE']; - $s_hidden_fields = ''; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - // HTTP_HOST is having the correct browser url in most cases... - $server_name = strtolower(htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME')))); - $referer = strtolower($request->header('Referer')); - - // HTTP HOST can carry a port number... - if (strpos($server_name, ':') !== false) - { - $server_name = substr($server_name, 0, strpos($server_name, ':')); - } - - $cookie_domain = ($data['server_name'] != '') ? $data['server_name'] : $server_name; - - // Try to come up with the best solution for cookie domain... - if (strpos($cookie_domain, 'www.') === 0) - { - $cookie_domain = str_replace('www.', '.', $cookie_domain); - } - - // If we get here and the extension isn't loaded it should be safe to just go ahead and load it - $available_dbms = get_available_dbms($data['dbms']); - - if (!isset($available_dbms[$data['dbms']])) - { - // Someone's been silly and tried providing a non-existant dbms - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $dbms = $available_dbms[$data['dbms']]['DRIVER']; - - // Instantiate the database - $db = new $dbms(); - $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); - - // NOTE: trigger_error does not work here. - $db->sql_return_on_error(true); - - // If mysql is chosen, we need to adjust the schema filename slightly to reflect the correct version. ;) - if ($data['dbms'] == 'mysql') - { - if (version_compare($db->sql_server_info(true), '4.1.3', '>=')) - { - $available_dbms[$data['dbms']]['SCHEMA'] .= '_41'; - } - else - { - $available_dbms[$data['dbms']]['SCHEMA'] .= '_40'; - } - } - - // Ok we have the db info go ahead and read in the relevant schema - // and work on building the table - $dbms_schema = 'schemas/' . $available_dbms[$data['dbms']]['SCHEMA'] . '_schema.sql'; - - // How should we treat this schema? - $delimiter = $available_dbms[$data['dbms']]['DELIM']; - - $sql_query = @file_get_contents($dbms_schema); - - $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); - - $sql_query = phpbb_remove_comments($sql_query); - - $sql_query = split_sql_file($sql_query, $delimiter); - - foreach ($sql_query as $sql) - { - //$sql = trim(str_replace('|', ';', $sql)); - if (!$db->sql_query($sql)) - { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); - } - } - unset($sql_query); - - // Ok tables have been built, let's fill in the basic information - $sql_query = file_get_contents('schemas/schema_data.sql'); - - // Deal with any special comments and characters - switch ($data['dbms']) - { - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query); - break; - - case 'postgres': - $sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query); - break; - - case 'mysql': - case 'mysqli': - $sql_query = str_replace('\\', '\\\\', $sql_query); - break; - } - - // Change prefix - $sql_query = preg_replace('# phpbb_([^\s]*) #i', ' ' . $data['table_prefix'] . '\1 ', $sql_query); - - // Change language strings... - $sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query); - - $sql_query = phpbb_remove_comments($sql_query); - $sql_query = split_sql_file($sql_query, ';'); - - foreach ($sql_query as $sql) - { - //$sql = trim(str_replace('|', ';', $sql)); - if (!$db->sql_query($sql)) - { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); - } - } - unset($sql_query); - - $current_time = time(); - - $user_ip = $request->server('REMOTE_ADDR') ? phpbb_ip_normalise($request->server('REMOTE_ADDR')) : ''; - - if ($data['script_path'] !== '/') - { - // Adjust destination path (no trailing slash) - if (substr($data['script_path'], -1) == '/') - { - $data['script_path'] = substr($data['script_path'], 0, -1); - } - - $data['script_path'] = str_replace(array('../', './'), '', $data['script_path']); - - if ($data['script_path'][0] != '/') - { - $data['script_path'] = '/' . $data['script_path']; - } - } - - // Set default config and post data, this applies to all DB's - $sql_ary = array( - 'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value) - VALUES ('board_startdate', '$current_time')", - - 'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value) - VALUES ('default_lang', '" . $db->sql_escape($data['default_lang']) . "')", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['img_imagick']) . "' - WHERE config_name = 'img_imagick'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['server_name']) . "' - WHERE config_name = 'server_name'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['server_port']) . "' - WHERE config_name = 'server_port'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email']) . "' - WHERE config_name = 'board_email'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email']) . "' - WHERE config_name = 'board_contact'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($cookie_domain) . "' - WHERE config_name = 'cookie_domain'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($lang['default_dateformat']) . "' - WHERE config_name = 'default_dateformat'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['email_enable']) . "' - WHERE config_name = 'email_enable'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_delivery']) . "' - WHERE config_name = 'smtp_delivery'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_host']) . "' - WHERE config_name = 'smtp_host'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_auth']) . "' - WHERE config_name = 'smtp_auth_method'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_user']) . "' - WHERE config_name = 'smtp_username'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_pass']) . "' - WHERE config_name = 'smtp_password'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['cookie_secure']) . "' - WHERE config_name = 'cookie_secure'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['force_server_vars']) . "' - WHERE config_name = 'force_server_vars'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['script_path']) . "' - WHERE config_name = 'script_path'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['server_protocol']) . "' - WHERE config_name = 'server_protocol'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['admin_name']) . "' - WHERE config_name = 'newest_username'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . md5(mt_rand()) . "' - WHERE config_name = 'avatar_salt'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . md5(mt_rand()) . "' - WHERE config_name = 'plupload_salt'", - - 'UPDATE ' . $data['table_prefix'] . "users - SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' - WHERE username = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "moderator_cache - SET username = '" . $db->sql_escape($data['admin_name']) . "' - WHERE username = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "forums - SET forum_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "' - WHERE forum_last_poster_name = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "topics - SET topic_first_poster_name = '" . $db->sql_escape($data['admin_name']) . "', topic_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "' - WHERE topic_first_poster_name = 'Admin' - OR topic_last_poster_name = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "users - SET user_regdate = $current_time", - - 'UPDATE ' . $data['table_prefix'] . "posts - SET post_time = $current_time, poster_ip = '" . $db->sql_escape($user_ip) . "'", - - 'UPDATE ' . $data['table_prefix'] . "topics - SET topic_time = $current_time, topic_last_post_time = $current_time", - - 'UPDATE ' . $data['table_prefix'] . "forums - SET forum_last_post_time = $current_time", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($db->sql_server_info(true)) . "' - WHERE config_name = 'dbms_version'", - ); - - if (@extension_loaded('gd')) - { - $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = 'phpbb_captcha_gd' - WHERE config_name = 'captcha_plugin'"; - - $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '1' - WHERE config_name = 'captcha_gd'"; - } - - $ref = substr($referer, strpos($referer, '://') + 3); - - if (!(stripos($ref, $server_name) === 0)) - { - $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '0' - WHERE config_name = 'referer_validation'"; - } - - // We set a (semi-)unique cookie name to bypass login issues related to the cookie name. - $cookie_name = 'phpbb3_'; - $rand_str = md5(mt_rand()); - $rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35)); - $rand_str = substr($rand_str, 0, 5); - $cookie_name .= strtolower($rand_str); - - $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($cookie_name) . "' - WHERE config_name = 'cookie_name'"; - - foreach ($sql_ary as $sql) - { - //$sql = trim(str_replace('|', ';', $sql)); - - if (!$db->sql_query($sql)) - { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); - } - } - - $submit = $lang['NEXT_STEP']; - - $url = $this->p_master->module_url . "?mode=$mode&sub=final"; - - $template->assign_vars(array( - 'BODY' => $lang['STAGE_CREATE_TABLE_EXPLAIN'], - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => build_hidden_fields($data), - 'U_ACTION' => $url, - )); - } - - /** - * Build the search index... - */ - function build_search_index($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpEx, $config, $auth, $user; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - $table_prefix = $data['table_prefix']; - - // If we get here and the extension isn't loaded it should be safe to just go ahead and load it - $available_dbms = get_available_dbms($data['dbms']); - - if (!isset($available_dbms[$data['dbms']])) - { - // Someone's been silly and tried providing a non-existant dbms - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $dbms = $available_dbms[$data['dbms']]['DRIVER']; - - // Instantiate the database - $db = new $dbms(); - $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); - - // NOTE: trigger_error does not work here. - $db->sql_return_on_error(true); - - include_once($phpbb_root_path . 'includes/constants.' . $phpEx); - include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx); - - // We need to fill the config to let internal functions correctly work - $config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); - - $error = false; - $search = new \phpbb\search\fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); - - $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id - FROM ' . POSTS_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']); - } - $db->sql_freeresult($result); - } - - /** - * Populate the module tables - */ - function add_modules($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpEx, $phpbb_extension_manager, $config, $phpbb_container; - - // modules require an extension manager - if (empty($phpbb_extension_manager)) - { - $phpbb_extension_manager = $phpbb_container->get('ext.manager'); - } - - include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); - - $_module = new acp_modules(); - $module_classes = array('acp', 'mcp', 'ucp'); - - // Add categories - foreach ($module_classes as $module_class) - { - $categories = array(); - - // Set the module class - $_module->module_class = $module_class; - - foreach ($this->module_categories[$module_class] as $cat_name => $subs) - { - $basename = ''; - // Check if this sub-category has a basename. If it has, use it. - if (isset($this->module_categories_basenames[$cat_name])) - { - $basename = $this->module_categories_basenames[$cat_name]; - } - $module_data = array( - 'module_basename' => $basename, - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => 0, - 'module_class' => $module_class, - 'module_langname' => $cat_name, - 'module_mode' => '', - 'module_auth' => '', - ); - - // Add category - $_module->update_module_data($module_data, true); - - // Check for last sql error happened - if ($db->sql_error_triggered) - { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); - } - - $categories[$cat_name]['id'] = (int) $module_data['module_id']; - $categories[$cat_name]['parent_id'] = 0; - - // Create sub-categories... - if (is_array($subs)) - { - foreach ($subs as $level2_name) - { - $basename = ''; - // Check if this sub-category has a basename. If it has, use it. - if (isset($this->module_categories_basenames[$level2_name])) - { - $basename = $this->module_categories_basenames[$level2_name]; - } - $module_data = array( - 'module_basename' => $basename, - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => (int) $categories[$cat_name]['id'], - 'module_class' => $module_class, - 'module_langname' => $level2_name, - 'module_mode' => '', - 'module_auth' => '', - ); - - $_module->update_module_data($module_data, true); - - // Check for last sql error happened - if ($db->sql_error_triggered) - { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); - } - - $categories[$level2_name]['id'] = (int) $module_data['module_id']; - $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id']; - } - } - } - - // Get the modules we want to add... returned sorted by name - $module_info = $_module->get_module_infos('', $module_class); - - foreach ($module_info as $module_basename => $fileinfo) - { - foreach ($fileinfo['modes'] as $module_mode => $row) - { - foreach ($row['cat'] as $cat_name) - { - if (!isset($categories[$cat_name])) - { - continue; - } - - $module_data = array( - 'module_basename' => $module_basename, - 'module_enabled' => 1, - 'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1, - 'parent_id' => (int) $categories[$cat_name]['id'], - 'module_class' => $module_class, - 'module_langname' => $row['title'], - 'module_mode' => $module_mode, - 'module_auth' => $row['auth'], - ); - - $_module->update_module_data($module_data, true); - - // Check for last sql error happened - if ($db->sql_error_triggered) - { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); - } - } - } - } - - // Move some of the modules around since the code above will put them in the wrong place - if ($module_class == 'acp') - { - // Move main module 4 up... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'acp_main' - AND module_class = 'acp' - AND module_mode = 'main'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'move_up', 4); - - // Move permissions intro screen module 4 up... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'acp_permissions' - AND module_class = 'acp' - AND module_mode = 'intro'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'move_up', 4); - - // Move manage users screen module 5 up... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'acp_users' - AND module_class = 'acp' - AND module_mode = 'overview'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'move_up', 5); - } - - if ($module_class == 'ucp') - { - // Move attachment module 4 down... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'ucp_attachments' - AND module_class = 'ucp' - AND module_mode = 'attachments'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'move_down', 4); - } - - // And now for the special ones - // (these are modules which appear in multiple categories and thus get added manually to some for more control) - if (isset($this->module_extras[$module_class])) - { - foreach ($this->module_extras[$module_class] as $cat_name => $mods) - { - $sql = 'SELECT module_id, left_id, right_id - FROM ' . MODULES_TABLE . " - WHERE module_langname = '" . $db->sql_escape($cat_name) . "' - AND module_class = '" . $db->sql_escape($module_class) . "'"; - $result = $db->sql_query_limit($sql, 1); - $row2 = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - foreach ($mods as $mod_name) - { - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_langname = '" . $db->sql_escape($mod_name) . "' - AND module_class = '" . $db->sql_escape($module_class) . "' - AND module_basename <> ''"; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $module_data = array( - 'module_basename' => $row['module_basename'], - 'module_enabled' => (int) $row['module_enabled'], - 'module_display' => (int) $row['module_display'], - 'parent_id' => (int) $row2['module_id'], - 'module_class' => $row['module_class'], - 'module_langname' => $row['module_langname'], - 'module_mode' => $row['module_mode'], - 'module_auth' => $row['module_auth'], - ); - - $_module->update_module_data($module_data, true); - - // Check for last sql error happened - if ($db->sql_error_triggered) - { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); - } - } - } - } - - $_module->remove_cache_file(); - } - } - - /** - * Populate the language tables - */ - function add_language($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpEx; - - $dir = @opendir($phpbb_root_path . 'language'); - - if (!$dir) - { - $this->error('Unable to access the language directory', __LINE__, __FILE__); - } - - $installed_languages = array(); - while (($file = readdir($dir)) !== false) - { - $path = $phpbb_root_path . 'language/' . $file; - - if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS') - { - continue; - } - - if (is_dir($path) && file_exists($path . '/iso.txt')) - { - $lang_file = file("$path/iso.txt"); - - $lang_pack = array( - 'lang_iso' => basename($path), - 'lang_dir' => basename($path), - 'lang_english_name' => trim(htmlspecialchars($lang_file[0])), - 'lang_local_name' => trim(htmlspecialchars($lang_file[1], ENT_COMPAT, 'UTF-8')), - 'lang_author' => trim(htmlspecialchars($lang_file[2], ENT_COMPAT, 'UTF-8')), - ); - - $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack)); - - $installed_languages[] = (int) $db->sql_nextid(); - if ($db->sql_error_triggered) - { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); - } - } - } - closedir($dir); - - $sql = 'SELECT * - FROM ' . PROFILE_FIELDS_TABLE; - $result = $db->sql_query($sql); - - $profile_fields = array(); - $insert_buffer = new \phpbb\db\sql_insert_buffer($db, PROFILE_LANG_TABLE); - while ($row = $db->sql_fetchrow($result)) - { - foreach ($installed_languages as $lang_id) - { - $insert_buffer->insert(array( - 'field_id' => $row['field_id'], - 'lang_id' => $lang_id, - 'lang_name' => strtoupper(substr($row['field_name'], 6)),// Remove phpbb_ from field name - 'lang_explain' => '', - 'lang_default_value' => '', - )); - } - } - $db->sql_freeresult($result); - - $insert_buffer->flush(); - } - - /** - * Add search robots to the database - */ - function add_bots($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpEx, $config; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - // We need to fill the config to let internal functions correctly work - $config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); - - $sql = 'SELECT group_id - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'BOTS'"; - $result = $db->sql_query($sql); - $group_id = (int) $db->sql_fetchfield('group_id'); - $db->sql_freeresult($result); - - if (!$group_id) - { - // If we reach this point then something has gone very wrong - $this->p_master->error($lang['NO_GROUP'], __LINE__, __FILE__); - } - - if (!function_exists('user_add')) - { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - } - - foreach ($this->bot_list as $bot_name => $bot_ary) - { - $user_row = array( - 'user_type' => USER_IGNORE, - 'group_id' => $group_id, - 'username' => $bot_name, - 'user_regdate' => time(), - 'user_password' => '', - 'user_colour' => '9E8DA7', - 'user_email' => '', - 'user_lang' => $data['default_lang'], - 'user_style' => 1, - 'user_timezone' => 'UTC', - 'user_dateformat' => $lang['default_dateformat'], - 'user_allow_massemail' => 0, - 'user_allow_pm' => 0, - ); - - $user_id = user_add($user_row); - - if (!$user_id) - { - // If we can't insert this user then continue to the next one to avoid inconsistent data - $this->p_master->db_error('Unable to insert bot into users table', $db->sql_error_sql, __LINE__, __FILE__, true); - continue; - } - - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'bot_active' => 1, - 'bot_name' => (string) $bot_name, - 'user_id' => (int) $user_id, - 'bot_agent' => (string) $bot_ary[0], - 'bot_ip' => (string) $bot_ary[1], - )); - - $result = $db->sql_query($sql); - } - } - - /** - * Sends an email to the board administrator with their password and some useful links - */ - function email_admin($mode, $sub) - { - global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx; - - $this->page_title = $lang['STAGE_FINAL']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - // We need to fill the config to let internal functions correctly work - $config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); - - $user->session_begin(); - $auth->login($data['admin_name'], $data['admin_pass1'], false, true, true); - - // OK, Now that we've reached this point we can be confident that everything - // is installed and working......I hope :) - // So it's time to send an email to the administrator confirming the details - // they entered - - if ($config['email_enable']) - { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - - $messenger = new messenger(false); - - $messenger->template('installed', $data['language']); - - $messenger->to($data['board_email'], $data['admin_name']); - - $messenger->anti_abuse_headers($config, $user); - - $messenger->assign_vars(array( - 'USERNAME' => htmlspecialchars_decode($data['admin_name']), - 'PASSWORD' => htmlspecialchars_decode($data['admin_pass1'])) - ); - - $messenger->send(NOTIFY_EMAIL); - } - - // And finally, add a note to the log - add_log('admin', 'LOG_INSTALL_INSTALLED', $config['version']); - - $template->assign_vars(array( - 'TITLE' => $lang['INSTALL_CONGRATS'], - 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'), - 'L_SUBMIT' => $lang['INSTALL_LOGIN'], - 'U_ACTION' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=send_statistics&mode=send_statistics'), - )); - } - - /** - * Check if the avatar directory is writable and disable avatars - * if it isn't writable. - */ - function disable_avatars_if_unwritable() - { - global $phpbb_root_path; - - if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/')) - { - set_config('allow_avatar', 0); - set_config('allow_avatar_upload', 0); - } - } - - /** - * Populate migrations for the installation - * - * This "installs" all migrations from (root path)/phpbb/db/migrations/data. - * "installs" means it adds all migrations to the migrations table, but does not - * perform any of the actions in the migrations. - * - * @param \phpbb\extension\manager $extension_manager - * @param \phpbb\db\migrator $migrator - */ - function populate_migrations($extension_manager, $migrator) - { - $finder = $extension_manager->get_finder(); - - $migrations = $finder - ->core_path('phpbb/db/migration/data/') - ->get_classes(); - $migrator->populate_migrations($migrations); - } - - /** - * Generate a list of available mail server authentication methods - */ - function mail_auth_select($selected_method) - { - global $lang; - - $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); - $s_smtp_auth_options = ''; - - foreach ($auth_methods as $method) - { - $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; - } - - return $s_smtp_auth_options; - } - - /** - * Get submitted data - */ - function get_submitted_data() - { - return array( - 'language' => basename(request_var('language', '')), - 'dbms' => request_var('dbms', ''), - 'dbhost' => request_var('dbhost', ''), - 'dbport' => request_var('dbport', ''), - 'dbuser' => request_var('dbuser', ''), - 'dbpasswd' => request_var('dbpasswd', '', true), - 'dbname' => request_var('dbname', ''), - 'table_prefix' => request_var('table_prefix', ''), - 'default_lang' => basename(request_var('default_lang', '')), - 'admin_name' => utf8_normalize_nfc(request_var('admin_name', '', true)), - 'admin_pass1' => request_var('admin_pass1', '', true), - 'admin_pass2' => request_var('admin_pass2', '', true), - 'board_email' => strtolower(request_var('board_email', '')), - 'img_imagick' => request_var('img_imagick', ''), - 'ftp_path' => request_var('ftp_path', ''), - 'ftp_user' => request_var('ftp_user', ''), - 'ftp_pass' => request_var('ftp_pass', ''), - 'email_enable' => request_var('email_enable', ''), - 'smtp_delivery' => request_var('smtp_delivery', ''), - 'smtp_host' => request_var('smtp_host', ''), - 'smtp_auth' => request_var('smtp_auth', ''), - 'smtp_user' => request_var('smtp_user', ''), - 'smtp_pass' => request_var('smtp_pass', ''), - 'cookie_secure' => request_var('cookie_secure', ''), - 'force_server_vars' => request_var('force_server_vars', ''), - 'server_protocol' => request_var('server_protocol', ''), - 'server_name' => request_var('server_name', ''), - 'server_port' => request_var('server_port', ''), - 'script_path' => request_var('script_path', ''), - ); - } - - /** - * The information below will be used to build the input fields presented to the user - */ - var $db_config_options = array( - 'legend1' => 'DB_CONFIG', - 'dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false), - 'dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true), - 'dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true), - 'dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false), - 'dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false), - 'dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false), - 'table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => true), - ); - var $admin_config_options = array( - 'legend1' => 'ADMIN_CONFIG', - 'default_lang' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false), - 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true), - 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true), - 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false), - 'board_email' => array('lang' => 'CONTACT_EMAIL', 'type' => 'email:25:100', 'explain' => false), - ); - var $advanced_config_options = array( - 'legend1' => 'ACP_EMAIL_SETTINGS', - 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true), - 'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false), - 'smtp_auth' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => '$this->module->mail_auth_select(\'{VALUE}\')', 'explain' => true), - 'smtp_user' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true), - 'smtp_pass' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true), - - 'legend2' => 'SERVER_URL_SETTINGS', - 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'type' => 'radio:yes_no', 'explain' => true), - 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'type' => 'text:10:10', 'explain' => true), - 'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true), - 'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true), - 'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true), - ); - - /** - * Specific PHP modules we may require for certain optional or extended features - */ - var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml'); - - /** - * A list of the web-crawlers/bots we recognise by default - * - * Candidates but not included: - * 'Accoona [Bot]' 'Accoona-AI-Agent/' - * 'ASPseek [Crawler]' 'ASPseek/' - * 'Boitho [Crawler]' 'boitho.com-dc/' - * 'Bunnybot [Bot]' 'powered by www.buncat.de' - * 'Cosmix [Bot]' 'cfetch/' - * 'Crawler Search [Crawler]' '.Crawler-Search.de' - * 'Findexa [Crawler]' 'Findexa Crawler (' - * 'GBSpider [Spider]' 'GBSpider v' - * 'genie [Bot]' 'genieBot (' - * 'Hogsearch [Bot]' 'oegp v. 1.3.0' - * 'Insuranco [Bot]' 'InsurancoBot' - * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' - * 'ISC Systems [Bot]' 'ISC Systems iRc Search' - * 'Jyxobot [Bot]' 'Jyxobot/' - * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' - * 'LinkWalker' 'LinkWalker' - * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' - * 'Naver [Bot]' 'nhnbot@naver.com)' - * 'NetResearchServer' 'NetResearchServer/' - * 'Nimble [Crawler]' 'NimbleCrawler' - * 'Ocelli [Bot]' 'Ocelli/' - * 'Onsearch [Bot]' 'onCHECK-Robot' - * 'Orange [Spider]' 'OrangeSpider' - * 'Sproose [Bot]' 'http://www.sproose.com/bot' - * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' - * 'Tbot [Bot]' 'Tbot/' - * 'Thumbshots [Capture]' 'thumbshots-de-Bot' - * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' - * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' - * 'WissenOnline [Bot]' 'WissenOnline-Bot' - * 'WWWeasel [Bot]' 'WWWeasel Robot v' - * 'Xaldon [Spider]' 'Xaldon WebSpider' - */ - var $bot_list = array( - 'AdsBot [Google]' => array('AdsBot-Google', ''), - 'Alexa [Bot]' => array('ia_archiver', ''), - 'Alta Vista [Bot]' => array('Scooter/', ''), - 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), - 'Baidu [Spider]' => array('Baiduspider', ''), - 'Bing [Bot]' => array('bingbot/', ''), - 'Exabot [Bot]' => array('Exabot', ''), - 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), - 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), - 'Francis [Bot]' => array('http://www.neomo.de/', ''), - 'Gigabot [Bot]' => array('Gigabot/', ''), - 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), - 'Google Desktop' => array('Google Desktop', ''), - 'Google Feedfetcher' => array('Feedfetcher-Google', ''), - 'Google [Bot]' => array('Googlebot', ''), - 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), - 'Heritrix [Crawler]' => array('heritrix/1.', ''), - 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), - 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), - 'ichiro [Crawler]' => array('ichiro/', ''), - 'Majestic-12 [Bot]' => array('MJ12bot/', ''), - 'Metager [Bot]' => array('MetagerBot/', ''), - 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), - 'MSN [Bot]' => array('msnbot/', ''), - 'MSNbot Media' => array('msnbot-media/', ''), - 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), - 'Online link [Validator]' => array('online link validator', ''), - 'psbot [Picsearch]' => array('psbot/0', ''), - 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), - 'SEO Crawler' => array('SEO search Crawler/', ''), - 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), - 'SEOSearch [Crawler]' => array('SEOsearch/', ''), - 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), - 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), - 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), - 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), - 'Voyager [Bot]' => array('voyager/', ''), - 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), - 'W3C [Linkcheck]' => array('W3C-checklink/', ''), - 'W3C [Validator]' => array('W3C_Validator', ''), - 'YaCy [Bot]' => array('yacybot', ''), - 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), - 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), - 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), - 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), - ); - - /** - * Define the module structure so that we can populate the database without - * needing to hard-code module_id values - */ - var $module_categories = array( - 'acp' => array( - 'ACP_CAT_GENERAL' => array( - 'ACP_QUICK_ACCESS', - 'ACP_BOARD_CONFIGURATION', - 'ACP_CLIENT_COMMUNICATION', - 'ACP_SERVER_CONFIGURATION', - ), - 'ACP_CAT_FORUMS' => array( - 'ACP_MANAGE_FORUMS', - 'ACP_FORUM_BASED_PERMISSIONS', - ), - 'ACP_CAT_POSTING' => array( - 'ACP_MESSAGES', - 'ACP_ATTACHMENTS', - ), - 'ACP_CAT_USERGROUP' => array( - 'ACP_CAT_USERS', - 'ACP_GROUPS', - 'ACP_USER_SECURITY', - ), - 'ACP_CAT_PERMISSIONS' => array( - 'ACP_GLOBAL_PERMISSIONS', - 'ACP_FORUM_BASED_PERMISSIONS', - 'ACP_PERMISSION_ROLES', - 'ACP_PERMISSION_MASKS', - ), - 'ACP_CAT_CUSTOMISE' => array( - 'ACP_STYLE_MANAGEMENT', - 'ACP_EXTENSION_MANAGEMENT', - 'ACP_LANGUAGE', - ), - 'ACP_CAT_MAINTENANCE' => array( - 'ACP_FORUM_LOGS', - 'ACP_CAT_DATABASE', - ), - 'ACP_CAT_SYSTEM' => array( - 'ACP_AUTOMATION', - 'ACP_GENERAL_TASKS', - 'ACP_MODULE_MANAGEMENT', - ), - 'ACP_CAT_DOT_MODS' => null, - ), - 'mcp' => array( - 'MCP_MAIN' => null, - 'MCP_QUEUE' => null, - 'MCP_REPORTS' => null, - 'MCP_NOTES' => null, - 'MCP_WARN' => null, - 'MCP_LOGS' => null, - 'MCP_BAN' => null, - ), - 'ucp' => array( - 'UCP_MAIN' => null, - 'UCP_PROFILE' => null, - 'UCP_PREFS' => null, - 'UCP_PM' => null, - 'UCP_USERGROUPS' => null, - 'UCP_ZEBRA' => null, - ), - ); - var $module_categories_basenames = array( - 'UCP_PM' => 'ucp_pm', - ); - - var $module_extras = array( - 'acp' => array( - 'ACP_QUICK_ACCESS' => array( - 'ACP_MANAGE_USERS', - 'ACP_GROUPS_MANAGE', - 'ACP_MANAGE_FORUMS', - 'ACP_MOD_LOGS', - 'ACP_BOTS', - 'ACP_PHP_INFO', - ), - 'ACP_FORUM_BASED_PERMISSIONS' => array( - 'ACP_FORUM_PERMISSIONS', - 'ACP_FORUM_PERMISSIONS_COPY', - 'ACP_FORUM_MODERATORS', - 'ACP_USERS_FORUM_PERMISSIONS', - 'ACP_GROUPS_FORUM_PERMISSIONS', - ), - ), - ); -} diff --git a/phpBB/install/install_main.php b/phpBB/install/install_main.php deleted file mode 100644 index 974b006db3..0000000000 --- a/phpBB/install/install_main.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** -* -* @package install -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -*/ - -if ( !defined('IN_INSTALL') ) -{ - // Someone has tried to access the file direct. This is not a good idea, so exit - exit; -} - -if (!empty($setmodules)) -{ - $module[] = array( - 'module_type' => 'install', - 'module_title' => 'OVERVIEW', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), - 'module_order' => 0, - 'module_subs' => array('INTRO', 'LICENSE', 'SUPPORT'), - 'module_stages' => '', - 'module_reqs' => '' - ); -} - -/** -* Main Tab - Installation -* @package install -*/ -class install_main extends module -{ - function install_main(&$p_master) - { - $this->p_master = &$p_master; - } - - function main($mode, $sub) - { - global $lang, $template, $language; - - switch ($sub) - { - case 'intro' : - $title = $lang['SUB_INTRO']; - $body = $lang['OVERVIEW_BODY']; - break; - - case 'license' : - $title = $lang['GPL']; - $body = implode("<br/>\n", file('../docs/COPYING')); - break; - - case 'support' : - $title = $lang['SUB_SUPPORT']; - $body = $lang['SUPPORT_BODY']; - break; - } - - $this->tpl_name = 'install_main'; - $this->page_title = $title; - - $template->assign_vars(array( - 'TITLE' => $title, - 'BODY' => $body, - - 'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select($language) . '</select>', - )); - } -} diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php deleted file mode 100644 index dc6e57c851..0000000000 --- a/phpBB/install/install_update.php +++ /dev/null @@ -1,1751 +0,0 @@ -<?php -/** -* -* @package install -* @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -* @todo check for writable cache/store/files directory -*/ - -/** -*/ -if (!defined('IN_INSTALL')) -{ - // Someone has tried to access the file directly. This is not a good idea, so exit - exit; -} - -if (!empty($setmodules)) -{ - // If phpBB is not installed we do not include this module - if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !@file_exists($phpbb_root_path . 'cache/install_lock')) - { - include_once($phpbb_root_path . 'config.' . $phpEx); - - if (!defined('PHPBB_INSTALLED')) - { - return; - } - } - else - { - return; - } - - $module[] = array( - 'module_type' => 'update', - 'module_title' => 'UPDATE', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), - 'module_order' => 30, - 'module_subs' => '', - 'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'), - 'module_reqs' => '' - ); -} - -/** -* Update Installation -* @package install -*/ -class install_update extends module -{ - var $p_master; - var $update_info; - - var $old_location; - var $new_location; - var $latest_version; - var $current_version; - - var $update_to_version; - - // Set to false - var $test_update = false; - - function install_update(&$p_master) - { - $this->p_master = &$p_master; - } - - function main($mode, $sub) - { - global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; - global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container; - - // We must enable super globals, otherwise creating a new instance of the request class, - // using the new container with a dbal connection will fail with the following PHP Notice: - // Object of class phpbb_request_deactivated_super_global could not be converted to int - $request->enable_super_globals(); - - // Create a normal container now - $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config'); - - // Writes into global $cache - $cache = $phpbb_container->get('cache'); - - $this->tpl_name = 'install_update'; - $this->page_title = 'UPDATE_INSTALLATION'; - - $this->old_location = $phpbb_root_path . 'install/update/old/'; - $this->new_location = $phpbb_root_path . 'install/update/new/'; - - // Init DB - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - - // Special options for conflicts/modified files - define('MERGE_NO_MERGE_NEW', 1); - define('MERGE_NO_MERGE_MOD', 2); - define('MERGE_NEW_FILE', 3); - define('MERGE_MOD_FILE', 4); - - $dbms = phpbb_convert_30_dbms_to_31($dbms); - - $db = new $dbms(); - - // Connect to DB - $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); - - // We do not need this any longer, unset for safety purposes - unset($dbpasswd); - - // We need to fill the config to let internal functions correctly work - $config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); - - // Force template recompile - $config['load_tplcompile'] = 1; - - // First of all, init the user session - $user->session_begin(); - $auth->acl($user->data); - - // Overwrite user's language with the selected one. - // Config needs to be changed to ensure that guests also get the selected language. - $config_default_lang = $config['default_lang']; - $config['default_lang'] = $language; - $user->data['user_lang'] = $language; - - $user->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); - - // Reset the default_lang - $config['default_lang'] = $config_default_lang; - unset($config_default_lang); - - // If we are within the intro page we need to make sure we get up-to-date version info - if ($sub == 'intro') - { - $cache->destroy('_version_info'); - } - - // Set custom template again. ;) - $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); - $paths = array_filter($paths, 'is_dir'); - $template->set_custom_style('adm', $paths); - - $template->assign_vars(array( - 'S_USER_LANG' => $user->lang['USER_LANG'], - 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], - 'S_CONTENT_ENCODING' => 'UTF-8', - 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', - 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', - )); - - // Get current and latest version - if (($latest_version = $cache->get('_version_info')) === false) - { - $this->latest_version = $this->get_file('version_info'); - $cache->put('_version_info', $this->latest_version); - } - else - { - $this->latest_version = $latest_version; - } - - // For the current version we trick a bit. ;) - $this->current_version = (!empty($config['version_update_from'])) ? $config['version_update_from'] : $config['version']; - - $up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->latest_version)), '<')) ? false : true; - - // Check for a valid update directory, else point the user to the phpbb.com website - if (!file_exists($phpbb_root_path . 'install/update') || !file_exists($phpbb_root_path . 'install/update/index.' . $phpEx) || !file_exists($this->old_location) || !file_exists($this->new_location)) - { - $template->assign_vars(array( - 'S_ERROR' => true, - 'ERROR_MSG' => ($up_to_date) ? $user->lang['NO_UPDATE_FILES_UP_TO_DATE'] : sprintf($user->lang['NO_UPDATE_FILES_OUTDATED'], $config['version'], $this->current_version, $this->latest_version)) - ); - - return; - } - - $this->update_info = $this->get_file('update_info'); - - // Make sure the update directory holds the correct information - // Since admins are able to run the update/checks more than once we only check if the current version is lower or equal than the version to which we update to. - if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '>')) - { - $template->assign_vars(array( - 'S_ERROR' => true, - 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $config['version'], $this->update_info['version']['from'], $this->update_info['version']['to'])) - ); - - return; - } - - // Check if the update files are actually meant to update from the current version - if ($this->current_version != $this->update_info['version']['from']) - { - $template->assign_vars(array( - 'S_ERROR' => true, - 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $this->current_version, $this->update_info['version']['from'], $this->update_info['version']['to']), - )); - } - - // Check if the update files stored are for the latest version... - if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>')) - { - $template->assign_vars(array( - 'S_WARNING' => true, - 'WARNING_MSG' => sprintf($user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version)) - ); - } - - // We store the "update to" version, because it is not always the latest. ;) - $this->update_to_version = $this->update_info['version']['to']; - - // Fill DB version - if (empty($config['dbms_version'])) - { - set_config('dbms_version', $db->sql_server_info(true)); - } - - if ($this->test_update === false) - { - // What about the language file? Got it updated? - if (in_array('language/' . $language . '/install.' . $phpEx, $this->update_info['files'])) - { - $lang = array(); - include($this->new_location . 'language/' . $language . '/install.' . $phpEx); - // this is the user's language.. just merge it - $user->lang = array_merge($user->lang, $lang); - } - if ($language != 'en' && in_array('language/en/install.' . $phpEx, $this->update_info['files'])) - { - $lang = array(); - include($this->new_location . 'language/en/install.' . $phpEx); - // only add new keys to user's language in english - $new_keys = array_diff(array_keys($lang), array_keys($user->lang)); - foreach ($new_keys as $i => $new_key) - { - $user->lang[$new_key] = $lang[$new_key]; - } - } - } - - // Include renderer and engine - $this->include_file('includes/diff/diff.' . $phpEx); - $this->include_file('includes/diff/engine.' . $phpEx); - $this->include_file('includes/diff/renderer.' . $phpEx); - - // Make sure we stay at the file check if checking the files again - if ($request->variable('check_again', false, false, \phpbb\request\request_interface::POST)) - { - $sub = $this->p_master->sub = 'file_check'; - } - - switch ($sub) - { - case 'intro': - $this->page_title = 'UPDATE_INSTALLATION'; - - $template->assign_vars(array( - 'S_INTRO' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=version_check"), - )); - - // Make sure the update list is destroyed. - $cache->destroy('_update_list'); - $cache->destroy('_diff_files'); - $cache->destroy('_expected_files'); - break; - - case 'version_check': - $this->page_title = 'STAGE_VERSION_CHECK'; - - $template->assign_vars(array( - 'S_VERSION_CHECK' => true, - - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), - - 'S_UP_TO_DATE' => $up_to_date, - 'LATEST_VERSION' => $this->latest_version, - 'CURRENT_VERSION' => $this->current_version, - )); - - // Print out version the update package updates to - if ($this->latest_version != $this->update_info['version']['to']) - { - $template->assign_var('PACKAGE_VERSION', $this->update_info['version']['to']); - } - - // Since some people try to update to RC releases, but phpBB.com tells them the last version is the version they currently run - // we are faced with the updater thinking the database schema is up-to-date; which it is, but should be updated none-the-less - // We now try to cope with this by triggering the update process - if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '<')) - { - $template->assign_vars(array( - 'S_UP_TO_DATE' => false, - )); - } - - break; - - case 'update_db': - // Redirect the user to the database update script with some explanations... - $template->assign_vars(array( - 'S_DB_UPDATE' => true, - 'S_DB_UPDATE_FINISHED' => ($config['version'] == $this->update_info['version']['to']) ? true : false, - 'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&language=' . $user->data['user_lang']), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), - 'L_EVERYTHING_UP_TO_DATE' => $user->lang('EVERYTHING_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), - )); - - // Do not display incompatible package note after successful update - if ($config['version'] == $this->update_info['version']['to']) - { - $template->assign_var('S_ERROR', false); - } - break; - - case 'file_check': - - // retrieve info on what changes should have already been made to the files. - $expected_files = $cache->get('_expected_files'); - if (!$expected_files) - { - $expected_files = array(); - } - - // Now make sure the previous file collection is no longer valid... - $cache->destroy('_diff_files'); - - $this->page_title = 'STAGE_FILE_CHECK'; - - // Now make sure our update list is correct if the admin refreshes - $action = request_var('action', ''); - - // We are directly within an update. To make sure our update list is correct we check its status. - $update_list = ($request->variable('check_again', false, false, \phpbb\request\request_interface::POST)) ? false : $cache->get('_update_list'); - $modified = ($update_list !== false) ? @filemtime($cache->get_driver()->cache_dir . 'data_update_list.' . $phpEx) : 0; - - // Make sure the list is up-to-date - if ($update_list !== false) - { - $get_new_list = false; - foreach ($this->update_info['files'] as $file) - { - if (file_exists($phpbb_root_path . $file) && filemtime($phpbb_root_path . $file) > $modified) - { - $get_new_list = true; - break; - } - } - } - else - { - $get_new_list = true; - } - - if (!$get_new_list && $update_list['status'] != -1) - { - $get_new_list = true; - } - - if ($get_new_list) - { - $this->get_update_structure($update_list, $expected_files); - $cache->put('_update_list', $update_list); - - // Refresh the page if we are still not finished... - if ($update_list['status'] != -1) - { - $refresh_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"); - meta_refresh(2, $refresh_url); - - $template->assign_vars(array( - 'S_IN_PROGRESS' => true, - 'S_COLLECTED' => (int) $update_list['status'], - 'S_TO_COLLECT' => sizeof($this->update_info['files']), - 'L_IN_PROGRESS' => $user->lang['COLLECTING_FILE_DIFFS'], - 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files'])), - )); - - return; - } - } - - if ($action == 'diff') - { - $this->show_diff($update_list); - return; - } - - if (sizeof($update_list['no_update'])) - { - $template->assign_vars(array( - 'S_NO_UPDATE_FILES' => true, - 'NO_UPDATE_FILES' => implode(', ', array_map('htmlspecialchars', $update_list['no_update']))) - ); - } - - $new_expected_files = array(); - - // Now assign the list to the template - foreach ($update_list as $status => $filelist) - { - if ($status == 'no_update' || !sizeof($filelist) || $status == 'status') - { - continue; - } - -/* $template->assign_block_vars('files', array( - 'S_STATUS' => true, - 'STATUS' => $status, - 'L_STATUS' => $user->lang['STATUS_' . strtoupper($status)], - 'TITLE' => $user->lang['FILES_' . strtoupper($status)], - 'EXPLAIN' => $user->lang['FILES_' . strtoupper($status) . '_EXPLAIN'], - ) - );*/ - - foreach ($filelist as $file_struct) - { - $s_binary = (!empty($this->update_info['binary']) && in_array($file_struct['filename'], $this->update_info['binary'])) ? true : false; - - $filename = htmlspecialchars($file_struct['filename']); - if (strrpos($filename, '/') !== false) - { - $dir_part = substr($filename, 0, strrpos($filename, '/') + 1); - $file_part = substr($filename, strrpos($filename, '/') + 1); - } - else - { - $dir_part = ''; - $file_part = $filename; - } - - $diff_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename'])); - - if (isset($file_struct['as_expected']) && $file_struct['as_expected']) - { - $new_expected_files[$file_struct['filename']] = $expected_files[$file_struct['filename']]; - } - else - { - $template->assign_block_vars($status, array( - 'STATUS' => $status, - - 'FILENAME' => $filename, - 'DIR_PART' => $dir_part, - 'FILE_PART' => $file_part, - 'NUM_CONFLICTS' => (isset($file_struct['conflicts'])) ? $file_struct['conflicts'] : 0, - - 'S_CUSTOM' => ($file_struct['custom']) ? true : false, - 'S_BINARY' => $s_binary, - 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '', - - 'U_SHOW_DIFF' => $diff_url, - 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '', - - 'U_VIEW_MOD_FILE' => $diff_url . '&op=' . MERGE_MOD_FILE, - 'U_VIEW_NEW_FILE' => $diff_url . '&op=' . MERGE_NEW_FILE, - 'U_VIEW_NO_MERGE_MOD' => $diff_url . '&op=' . MERGE_NO_MERGE_MOD, - 'U_VIEW_NO_MERGE_NEW' => $diff_url . '&op=' . MERGE_NO_MERGE_NEW, - )); - } - } - } - - $cache->put('_expected_files', $new_expected_files); - - $all_up_to_date = true; - foreach ($update_list as $status => $filelist) - { - if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && sizeof($filelist)) - { - $all_up_to_date = false; - break; - } - } - - $template->assign_vars(array( - 'S_FILE_CHECK' => true, - 'S_ALL_UP_TO_DATE' => $all_up_to_date, - 'S_VERSION_UP_TO_DATE' => $up_to_date, - 'S_UP_TO_DATE' => $up_to_date, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), - 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), - )); - - // Since some people try to update to RC releases, but phpBB.com tells them the last version is the version they currently run - // we are faced with the updater thinking the database schema is up-to-date; which it is, but should be updated none-the-less - // We now try to cope with this by triggering the update process - if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '<')) - { - $template->assign_vars(array( - 'S_UP_TO_DATE' => false, - )); - } - - if ($all_up_to_date) - { - global $phpbb_container; - $phpbb_log = $phpbb_container->get('log'); - - // Add database update to log - $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_PHPBB', time(), array($this->current_version, $this->update_to_version)); - - $db->sql_return_on_error(true); - $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); - $db->sql_return_on_error(false); - - $cache->purge(); - } - - break; - - case 'update_files': - - $this->page_title = 'STAGE_UPDATE_FILES'; - - $s_hidden_fields = ''; - $params = array(); - $conflicts = request_var('conflict', array('' => 0)); - $modified = request_var('modified', array('' => 0)); - - foreach ($conflicts as $filename => $merge_option) - { - $s_hidden_fields .= '<input type="hidden" name="conflict[' . htmlspecialchars($filename) . ']" value="' . $merge_option . '" />'; - $params[] = 'conflict[' . urlencode($filename) . ']=' . urlencode($merge_option); - } - - foreach ($modified as $filename => $merge_option) - { - if (!$merge_option) - { - continue; - } - $s_hidden_fields .= '<input type="hidden" name="modified[' . htmlspecialchars($filename) . ']" value="' . $merge_option . '" />'; - $params[] = 'modified[' . urlencode($filename) . ']=' . urlencode($merge_option); - } - - $no_update = request_var('no_update', array(0 => '')); - - foreach ($no_update as $index => $filename) - { - $s_hidden_fields .= '<input type="hidden" name="no_update[]" value="' . htmlspecialchars($filename) . '" />'; - $params[] = 'no_update[]=' . urlencode($filename); - } - - // Before the user is choosing his preferred method, let's create the content list... - $update_list = $cache->get('_update_list'); - - if ($update_list === false) - { - trigger_error($user->lang['NO_UPDATE_INFO'], E_USER_ERROR); - } - - // Check if the conflicts data is valid - if (sizeof($conflicts)) - { - $conflict_filenames = array(); - foreach ($update_list['conflict'] as $files) - { - $conflict_filenames[] = $files['filename']; - } - - $new_conflicts = array(); - foreach ($conflicts as $filename => $diff_method) - { - if (in_array($filename, $conflict_filenames)) - { - $new_conflicts[$filename] = $diff_method; - } - } - - $conflicts = $new_conflicts; - } - - // Build list for modifications - if (sizeof($modified)) - { - $modified_filenames = array(); - foreach ($update_list['modified'] as $files) - { - $modified_filenames[] = $files['filename']; - } - - $new_modified = array(); - foreach ($modified as $filename => $diff_method) - { - if (in_array($filename, $modified_filenames)) - { - $new_modified[$filename] = $diff_method; - } - } - - $modified = $new_modified; - } - - // Check number of conflicting files, they need to be equal. For modified files the number can differ - if (sizeof($update_list['conflict']) != sizeof($conflicts)) - { - trigger_error($user->lang['MERGE_SELECT_ERROR'], E_USER_ERROR); - } - - // Before we do anything, let us diff the files and store the raw file information "somewhere" - $get_files = false; - $file_list = $cache->get('_diff_files'); - $expected_files = $cache->get('_expected_files'); - - if ($file_list === false || $file_list['status'] != -1) - { - $get_files = true; - } - - if ($get_files) - { - if ($file_list === false) - { - $file_list = array( - 'status' => 0, - ); - } - - if (!isset($expected_files) || $expected_files === false) - { - $expected_files = array(); - } - - $processed = 0; - foreach ($update_list as $status => $files) - { - if (!is_array($files)) - { - continue; - } - - foreach ($files as $file_struct) - { - // Skip this file if the user selected to not update it - if (in_array($file_struct['filename'], $no_update)) - { - $expected_files[$file_struct['filename']] = false; - continue; - } - - // Already handled... then skip of course... - if (isset($file_list[$file_struct['filename']])) - { - continue; - } - - // Refresh if we reach 5 diffs... - if ($processed >= 5) - { - $cache->put('_diff_files', $file_list); - - if ($request->variable('download', false)) - { - $params[] = 'download=1'; - } - - $redirect_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files&" . implode('&', $params)); - meta_refresh(3, $redirect_url); - - $template->assign_vars(array( - 'S_IN_PROGRESS' => true, - 'L_IN_PROGRESS' => $user->lang['MERGING_FILES'], - 'L_IN_PROGRESS_EXPLAIN' => $user->lang['MERGING_FILES_EXPLAIN'], - )); - - return; - } - - if (file_exists($phpbb_root_path . $file_struct['filename'])) - { - $contents = file_get_contents($phpbb_root_path . $file_struct['filename']); - if (isset($expected_files[$file_struct['filename']]) && md5($contents) == $expected_files[$file_struct['filename']]) - { - continue; - } - } - - $original_filename = ($file_struct['custom']) ? $file_struct['original'] : $file_struct['filename']; - - switch ($status) - { - case 'modified': - - $option = (isset($modified[$file_struct['filename']])) ? $modified[$file_struct['filename']] : 0; - - switch ($option) - { - case MERGE_NO_MERGE_NEW: - $contents = file_get_contents($this->new_location . $original_filename); - break; - - case MERGE_NO_MERGE_MOD: - $contents = file_get_contents($phpbb_root_path . $file_struct['filename']); - break; - - default: - $diff = $this->return_diff($this->old_location . $original_filename, $phpbb_root_path . $file_struct['filename'], $this->new_location . $original_filename); - - $contents = implode("\n", $diff->merged_output()); - unset($diff); - break; - } - - $expected_files[$file_struct['filename']] = md5($contents); - $file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']); - $cache->put($file_list[$file_struct['filename']], base64_encode($contents)); - - $file_list['status']++; - $processed++; - - break; - - case 'conflict': - - $option = $conflicts[$file_struct['filename']]; - $contents = ''; - - switch ($option) - { - case MERGE_NO_MERGE_NEW: - $contents = file_get_contents($this->new_location . $original_filename); - break; - - case MERGE_NO_MERGE_MOD: - $contents = file_get_contents($phpbb_root_path . $file_struct['filename']); - break; - - default: - - $diff = $this->return_diff($this->old_location . $original_filename, $phpbb_root_path . $file_struct['filename'], $this->new_location . $original_filename); - - if ($option == MERGE_NEW_FILE) - { - $contents = implode("\n", $diff->merged_new_output()); - } - else if ($option == MERGE_MOD_FILE) - { - $contents = implode("\n", $diff->merged_orig_output()); - } - else - { - unset($diff); - break 2; - } - - unset($diff); - break; - } - - $expected_files[$file_struct['filename']] = md5($contents); - $file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']); - $cache->put($file_list[$file_struct['filename']], base64_encode($contents)); - - $file_list['status']++; - $processed++; - - break; - } - } - } - $cache->put('_expected_files', $expected_files); - } - - $file_list['status'] = -1; - $cache->put('_diff_files', $file_list); - - if ($request->variable('download', false)) - { - $this->include_file('includes/functions_compress.' . $phpEx); - - $use_method = request_var('use_method', ''); - $methods = array('.tar'); - - $available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib'); - foreach ($available_methods as $type => $module) - { - if (!@extension_loaded($module)) - { - continue; - } - - $methods[] = $type; - } - - // Let the user decide in which format he wants to have the pack - if (!$use_method) - { - $this->page_title = 'SELECT_DOWNLOAD_FORMAT'; - - $radio_buttons = ''; - foreach ($methods as $method) - { - $radio_buttons .= '<label><input type="radio"' . ((!$radio_buttons) ? ' id="use_method"' : '') . ' class="radio" value="' . $method . '" name="use_method" /> ' . $method . '</label>'; - } - - $template->assign_vars(array( - 'S_DOWNLOAD_FILES' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), - 'RADIO_BUTTONS' => $radio_buttons, - 'S_HIDDEN_FIELDS' => $s_hidden_fields) - ); - - // To ease the update process create a file location map - $update_list = $cache->get('_update_list'); - $script_path = ($config['force_server_vars']) ? (($config['script_path'] == '/') ? '/' : $config['script_path'] . '/') : $user->page['root_script_path']; - - foreach ($update_list as $status => $files) - { - if ($status == 'up_to_date' || $status == 'no_update' || $status == 'status') - { - continue; - } - - foreach ($files as $file_struct) - { - if (in_array($file_struct['filename'], $no_update)) - { - continue; - } - - $template->assign_block_vars('location', array( - 'SOURCE' => htmlspecialchars($file_struct['filename']), - 'DESTINATION' => $script_path . htmlspecialchars($file_struct['filename']), - )); - } - } - return; - } - - if (!in_array($use_method, $methods)) - { - $use_method = '.tar'; - } - - $update_mode = 'download'; - } - else - { - $this->include_file('includes/functions_transfer.' . $phpEx); - - // Choose FTP, if not available use fsock... - $method = basename(request_var('method', '')); - $submit = (isset($_POST['submit'])) ? true : false; - $test_ftp_connection = request_var('test_connection', ''); - - if (!$method || !class_exists($method)) - { - $method = 'ftp'; - $methods = transfer::methods(); - - if (!in_array('ftp', $methods)) - { - $method = $methods[0]; - } - } - - $test_connection = false; - if ($test_ftp_connection || $submit) - { - $transfer = new $method( - request_var('host', ''), - request_var('username', ''), - htmlspecialchars_decode($request->untrimmed_variable('password', '')), - request_var('root_path', ''), - request_var('port', ''), - request_var('timeout', '') - ); - $test_connection = $transfer->open_session(); - - // Make sure that the directory is correct by checking for the existence of common.php - if ($test_connection === true) - { - // Check for common.php file - if (!$transfer->file_exists($phpbb_root_path, 'common.' . $phpEx)) - { - $test_connection = 'ERR_WRONG_PATH_TO_PHPBB'; - } - } - - $transfer->close_session(); - - // Make sure the login details are correct before continuing - if ($submit && $test_connection !== true) - { - $submit = false; - $test_ftp_connection = true; - } - } - - $s_hidden_fields .= build_hidden_fields(array('method' => $method)); - - if (!$submit) - { - $this->page_title = 'SELECT_FTP_SETTINGS'; - - if (!class_exists($method)) - { - trigger_error('Method does not exist.', E_USER_ERROR); - } - - $requested_data = call_user_func(array($method, 'data')); - foreach ($requested_data as $data => $default) - { - $template->assign_block_vars('data', array( - 'DATA' => $data, - 'NAME' => $user->lang[strtoupper($method . '_' . $data)], - 'EXPLAIN' => $user->lang[strtoupper($method . '_' . $data) . '_EXPLAIN'], - 'DEFAULT' => $request->variable($data, (string) $default), - )); - } - - $template->assign_vars(array( - 'S_CONNECTION_SUCCESS' => ($test_ftp_connection && $test_connection === true) ? true : false, - 'S_CONNECTION_FAILED' => ($test_ftp_connection && $test_connection !== true) ? true : false, - 'ERROR_MSG' => ($test_ftp_connection && $test_connection !== true) ? $user->lang[$test_connection] : '', - - 'S_FTP_UPLOAD' => true, - 'UPLOAD_METHOD' => $method, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), - 'U_DOWNLOAD_METHOD' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files&download=1"), - 'S_HIDDEN_FIELDS' => $s_hidden_fields, - )); - - return; - } - - $update_mode = 'upload'; - } - - // Now update the installation or download the archive... - $download_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to']; - $archive_filename = $download_filename . '_' . time() . '_' . unique_id(); - - // Now init the connection - if ($update_mode == 'download') - { - if (function_exists('phpbb_is_writable') && !phpbb_is_writable($phpbb_root_path . 'store/')) - { - trigger_error(sprintf('The directory “%s†is not writable.', $phpbb_root_path . 'store/'), E_USER_ERROR); - } - - if ($use_method == '.zip') - { - $compress = new compress_zip('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method); - } - else - { - $compress = new compress_tar('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method, $use_method); - } - } - else - { - $transfer = new $method( - request_var('host', ''), - request_var('username', ''), - htmlspecialchars_decode($request->untrimmed_variable('password', '')), - request_var('root_path', ''), - request_var('port', ''), - request_var('timeout', '') - ); - $transfer->open_session(); - } - - // Ok, go through the update list and do the operations based on their status - foreach ($update_list as $status => $files) - { - if (!is_array($files)) - { - continue; - } - - foreach ($files as $file_struct) - { - // Skip this file if the user selected to not update it - if (in_array($file_struct['filename'], $no_update)) - { - continue; - } - - $original_filename = ($file_struct['custom']) ? $file_struct['original'] : $file_struct['filename']; - - switch ($status) - { - case 'new': - case 'new_conflict': - case 'not_modified': - - if ($update_mode == 'download') - { - $compress->add_custom_file($this->new_location . $original_filename, $file_struct['filename']); - } - else - { - if ($status != 'new') - { - $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak'); - } - - // New directory too? - $dirname = dirname($file_struct['filename']); - - if ($dirname && !file_exists($phpbb_root_path . $dirname)) - { - $transfer->make_dir($dirname); - } - - $transfer->copy_file($this->new_location . $original_filename, $file_struct['filename']); - } - break; - - case 'modified': - - $contents = base64_decode($cache->get($file_list[$file_struct['filename']])); - - if ($update_mode == 'download') - { - $compress->add_data($contents, $file_struct['filename']); - } - else - { - // @todo add option to specify if a backup file should be created? - $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak'); - $transfer->write_file($file_struct['filename'], $contents); - } - break; - - case 'conflict': - - $contents = base64_decode($cache->get($file_list[$file_struct['filename']])); - - if ($update_mode == 'download') - { - $compress->add_data($contents, $file_struct['filename']); - } - else - { - $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak'); - $transfer->write_file($file_struct['filename'], $contents); - } - break; - } - } - } - - if ($update_mode == 'download') - { - $compress->close(); - - $compress->download($archive_filename, $download_filename); - @unlink($phpbb_root_path . 'store/' . $archive_filename . $use_method); - - exit; - } - else - { - $transfer->close_session(); - - $template->assign_vars(array( - 'S_UPLOAD_SUCCESS' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check")) - ); - return; - } - - break; - - } - } - - /** - * Show file diff - */ - function show_diff(&$update_list) - { - global $phpbb_root_path, $template, $user, $phpbb_adm_relative_path; - - $this->tpl_name = 'install_update_diff'; - - $this->page_title = 'VIEWING_FILE_DIFF'; - - $status = request_var('status', ''); - $file = request_var('file', ''); - $diff_mode = request_var('diff_mode', 'inline'); - - // First of all make sure the file is within our file update list with the correct status - $found_entry = array(); - foreach ($update_list[$status] as $index => $file_struct) - { - if ($file_struct['filename'] === $file) - { - $found_entry = $update_list[$status][$index]; - } - } - - if (empty($found_entry)) - { - trigger_error($user->lang['FILE_DIFF_NOT_ALLOWED'], E_USER_ERROR); - } - - // If the status is 'up_to_date' then we do not need to show a diff - if ($status == 'up_to_date') - { - trigger_error($user->lang['FILE_ALREADY_UP_TO_DATE'], E_USER_ERROR); - } - - $original_file = ($found_entry['custom']) ? $found_entry['original'] : $file; - - // Get the correct diff - switch ($status) - { - case 'conflict': - $option = request_var('op', 0); - - switch ($option) - { - case MERGE_NO_MERGE_NEW: - case MERGE_NO_MERGE_MOD: - - $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : $phpbb_root_path . $file); - - $template->assign_var('S_DIFF_NEW_FILE', true); - $diff_mode = 'inline'; - $this->page_title = 'VIEWING_FILE_CONTENTS'; - - break; - - // Merge differences and use new phpBB code for conflicted blocks - case MERGE_NEW_FILE: - case MERGE_MOD_FILE: - - $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); - - $template->assign_vars(array( - 'S_DIFF_CONFLICT_FILE' => true, - 'NUM_CONFLICTS' => $diff->get_num_conflicts()) - ); - - $diff = $this->return_diff($phpbb_root_path . $file, ($option == MERGE_NEW_FILE) ? $diff->merged_new_output() : $diff->merged_orig_output()); - break; - - // Download conflict file - default: - - $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); - - header('Pragma: no-cache'); - header("Content-Type: application/octetstream; name=\"$file\""); - header("Content-disposition: attachment; filename=$file"); - - @set_time_limit(0); - - echo implode("\n", $diff->get_conflicts_content()); - - flush(); - exit; - - break; - } - - break; - - case 'modified': - $option = request_var('op', 0); - - switch ($option) - { - case MERGE_NO_MERGE_NEW: - case MERGE_NO_MERGE_MOD: - - $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : $phpbb_root_path . $file); - - $template->assign_var('S_DIFF_NEW_FILE', true); - $diff_mode = 'inline'; - $this->page_title = 'VIEWING_FILE_CONTENTS'; - - break; - - default: - $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $original_file, $this->new_location . $file); - $diff = $this->return_diff($phpbb_root_path . $file, $diff->merged_output()); - break; - } - break; - - case 'not_modified': - case 'new_conflict': - $diff = $this->return_diff($phpbb_root_path . $file, $this->new_location . $original_file); - break; - - case 'new': - - $diff = $this->return_diff(array(), $this->new_location . $original_file); - - $template->assign_var('S_DIFF_NEW_FILE', true); - $diff_mode = 'inline'; - $this->page_title = 'VIEWING_FILE_CONTENTS'; - - break; - } - - $diff_mode_options = ''; - foreach (array('side_by_side', 'inline', 'unified', 'raw') as $option) - { - $diff_mode_options .= '<option value="' . $option . '"' . (($diff_mode == $option) ? ' selected="selected"' : '') . '>' . $user->lang['DIFF_' . strtoupper($option)] . '</option>'; - } - - // Now the correct renderer - $render_class = 'diff_renderer_' . $diff_mode; - - if (!class_exists($render_class)) - { - trigger_error('Chosen diff mode is not supported', E_USER_ERROR); - } - - $renderer = new $render_class(); - - $template->assign_vars(array( - 'DIFF_CONTENT' => $renderer->get_diff_content($diff), - 'DIFF_MODE' => $diff_mode, - 'S_DIFF_MODE_OPTIONS' => $diff_mode_options, - 'S_SHOW_DIFF' => true, - )); - - unset($diff, $renderer); - } - - /** - * Collect all file status infos we need for the update by diffing all files - */ - function get_update_structure(&$update_list, $expected_files) - { - global $phpbb_root_path, $phpEx, $user; - - if ($update_list === false) - { - $update_list = array( - 'up_to_date' => array(), - 'new' => array(), - 'not_modified' => array(), - 'modified' => array(), - 'new_conflict' => array(), - 'conflict' => array(), - 'no_update' => array(), - 'status' => 0, - ); - } - - /* if (!empty($this->update_info['custom'])) - { - foreach ($this->update_info['custom'] as $original_file => $file_ary) - { - foreach ($file_ary as $index => $file) - { - $this->make_update_diff($update_list, $original_file, $file, true); - } - } - } */ - - // Get a list of those files which are completely new by checking with file_exists... - $num_bytes_processed = 0; - - foreach ($this->update_info['files'] as $index => $file) - { - if (is_int($update_list['status']) && $index < $update_list['status']) - { - continue; - } - - if ($num_bytes_processed >= 500 * 1024) - { - return; - } - - if (!file_exists($phpbb_root_path . $file)) - { - // Make sure the update files are consistent by checking if the file is in new_files... - if (!file_exists($this->new_location . $file)) - { - trigger_error($user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); - } - - // If the file exists within the old directory the file got removed and we will write it back - // not a biggie, but we might want to state this circumstance separately later. - // if (file_exists($this->old_location . $file)) - // { - // $update_list['removed'][] = $file; - // } - - /* Only include a new file as new if the underlying path exist - // The path normally do not exist if the original style or language has been removed - if (file_exists($phpbb_root_path . dirname($file))) - { - $this->get_custom_info($update_list['new'], $file); - $update_list['new'][] = array('filename' => $file, 'custom' => false); - } - else - { - // Do not include style-related or language-related content - if (strpos($file, 'styles/') !== 0 && strpos($file, 'language/') !== 0) - { - $update_list['no_update'][] = $file; - } - }*/ - - if (!phpbb_ignore_new_file_on_update($phpbb_root_path, $file)) - { - $this->get_custom_info($update_list['new'], $file); - $update_list['new'][] = array('filename' => $file, 'custom' => false); - } - - // unset($this->update_info['files'][$index]); - } - else - { - // not modified? - $this->make_update_diff($update_list, $file, $file, $expected_files); - } - - $num_bytes_processed += (file_exists($this->new_location . $file)) ? filesize($this->new_location . $file) : 100 * 1024; - $update_list['status']++; - } - - $update_list['status'] = -1; -/* if (!sizeof($this->update_info['files'])) - { - return $update_list; - } - - // Now diff the remaining files to get information about their status (not modified/modified/up-to-date) - - // not modified? - foreach ($this->update_info['files'] as $index => $file) - { - $this->make_update_diff($update_list, $file, $file); - } - - // Now to the styles... - if (empty($this->update_info['custom'])) - { - return $update_list; - } - - foreach ($this->update_info['custom'] as $original_file => $file_ary) - { - foreach ($file_ary as $index => $file) - { - $this->make_update_diff($update_list, $original_file, $file, true); - } - } - - return $update_list;*/ - } - - /** - * Compare files for storage in update_list - */ - function make_update_diff(&$update_list, $original_file, $file, $expected_files, $custom = false) - { - global $phpbb_root_path, $user; - - $update_ary = array('filename' => $file, 'custom' => $custom, 'as_expected' => false); - - if ($custom) - { - $update_ary['original'] = $original_file; - } - - if (file_exists($phpbb_root_path . $file)) - { - $content = file_get_contents($phpbb_root_path . $file); - - if (isset($expected_files[$file]) && // the user already selected what to do with this file - ($expected_files[$file] === false || // the user wanted this file to stay the same, so just assume it's alright - $expected_files[$file] === md5($content))) - { - // the file contains what it was supposed to contain after the merge - $update_ary['as_expected'] = true; - $update_ary['was_ignored'] = ($expected_files[$file] === false); - $update_list['up_to_date'][] = $update_ary; - - return; - } - } - - // we only want to know if the files are successfully merged and newlines could result in errors (duplicate addition of lines and such things) - // Therefore we check for empty diffs with two methods, preserving newlines and not preserving them (which mostly works best, therefore the first option) - - // On a successfull update the new location file exists but the old one does not exist. - // Check for this circumstance, the new file need to be up-to-date with the current file then... - if (!file_exists($this->old_location . $original_file) && file_exists($this->new_location . $original_file) && file_exists($phpbb_root_path . $file)) - { - $tmp = array( - 'file1' => file_get_contents($this->new_location . $original_file), - 'file2' => $content, - ); - - // We need to diff the contents here to make sure the file is really the one we expect - $diff = new diff($tmp['file1'], $tmp['file2'], false); - $empty = $diff->is_empty(); - - unset($tmp, $diff); - - // if there are no differences we have an up-to-date file... - if ($empty) - { - $update_list['up_to_date'][] = $update_ary; - return; - } - - // If no other status matches we have another file in the way... - $update_list['new_conflict'][] = $update_ary; - return; - } - - // Old file removed? - if (file_exists($this->old_location . $original_file) && !file_exists($this->new_location . $original_file)) - { - return; - } - - // Check for existance, else abort immediately - if (!file_exists($this->old_location . $original_file) || !file_exists($this->new_location . $original_file)) - { - trigger_error($user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); - } - - $preserve_cr_ary = array(false, true); - - foreach ($preserve_cr_ary as $preserve_cr) - { - $tmp = array( - 'file1' => file_get_contents($this->old_location . $original_file), - 'file2' => $content, - ); - - // We need to diff the contents here to make sure the file is really the one we expect - $diff = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); - $empty_1 = $diff->is_empty(); - - unset($tmp, $diff); - - $tmp = array( - 'file1' => file_get_contents($this->new_location . $original_file), - 'file2' => $content, - ); - - $diff = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); - $empty_2 = $diff->is_empty(); - - unset($tmp, $diff); - - // If the file is not modified we are finished here... - if ($empty_1) - { - // Further check if it is already up to date - it could happen that non-modified files - // slip through - if ($empty_2) - { - $update_list['up_to_date'][] = $update_ary; - return; - } - - $update_list['not_modified'][] = $update_ary; - return; - } - - // If the file had been modified then we need to check if it is already up to date - - // if there are no differences we have an up-to-date file... - if ($empty_2) - { - $update_list['up_to_date'][] = $update_ary; - return; - } - } - - $conflicts = false; - - foreach ($preserve_cr_ary as $preserve_cr) - { - // if the file is modified we try to make sure a merge succeed - $tmp = array( - 'orig' => file_get_contents($this->old_location . $original_file), - 'final1' => file_get_contents($phpbb_root_path . $file), - 'final2' => file_get_contents($this->new_location . $original_file), - ); - - $diff = new diff3($tmp['orig'], $tmp['final1'], $tmp['final2'], $preserve_cr); - unset($tmp); - - if (!$diff->get_num_conflicts()) - { - $tmp = array( - 'file1' => file_get_contents($phpbb_root_path . $file), - 'file2' => implode("\n", $diff->merged_output()), - ); - - // now compare the merged output with the original file to see if the modified file is up to date - $diff2 = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); - $empty = $diff2->is_empty(); - - unset($diff, $diff2); - - if ($empty) - { - $update_list['up_to_date'][] = $update_ary; - return; - } - - // If we preserve cr tag it as modified because the conflict would not show in this mode anyway - if ($preserve_cr) - { - $update_list['modified'][] = $update_ary; - return; - } - } - else - { - // There is one special case... users having merged with a conflicting file... we need to check this - $tmp = array( - 'file1' => file_get_contents($phpbb_root_path . $file), - 'file2' => implode("\n", $diff->merged_new_output()), - ); - - $diff2 = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); - $empty = $diff2->is_empty(); - - if (!$empty) - { - unset($tmp, $diff2); - - // We check if the user merged with his output - $tmp = array( - 'file1' => file_get_contents($phpbb_root_path . $file), - 'file2' => implode("\n", $diff->merged_orig_output()), - ); - - $diff2 = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); - $empty = $diff2->is_empty(); - } - - if (!$empty) - { - $conflicts = $diff->get_num_conflicts(); - } - - unset($diff, $diff2); - - if ($empty) - { - // A conflict got resolved... - $update_list['up_to_date'][] = $update_ary; - return; - } - } - } - - if ($conflicts !== false) - { - $update_ary['conflicts'] = $conflicts; - $update_list['conflict'][] = $update_ary; - return; - } - - // If no other status matches we have a modified file... - $update_list['modified'][] = $update_ary; - } - - /** - * Update update_list with custom new files - */ - function get_custom_info(&$update_list, $file) - { - if (empty($this->update_info['custom'])) - { - return; - } - - if (isset($this->update_info['custom'][$file])) - { - foreach ($this->update_info['custom'][$file] as $_file) - { - $update_list[] = array('filename' => $_file, 'custom' => true, 'original' => $file); - } - } - } - - /** - * Get remote file - */ - function get_file($mode) - { - global $user, $db; - - $errstr = ''; - $errno = 0; - - switch ($mode) - { - case 'version_info': - global $phpbb_root_path, $phpEx; - - $info = get_remote_file('version.phpbb.com', '/phpbb', - ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); - - if ($info !== false) - { - $info = explode("\n", $info); - $info = trim($info[0]); - } - - if ($this->test_update !== false) - { - $info = $this->test_update; - } - - // If info is false the fsockopen function may not be working. Instead get the latest version from our update file (and pray it is up-to-date) - if ($info === false) - { - $update_info = array(); - include($phpbb_root_path . 'install/update/index.' . $phpEx); - $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; - - if ($info !== false) - { - $info = (!empty($info['version']['to'])) ? trim($info['version']['to']) : false; - } - } - break; - - case 'update_info': - global $phpbb_root_path, $phpEx; - - $update_info = array(); - include($phpbb_root_path . 'install/update/index.' . $phpEx); - - $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; - $errstr = ($info === false) ? $user->lang['WRONG_INFO_FILE_FORMAT'] : ''; - - if ($info !== false) - { - // We assume that all file extensions have been renamed to .$phpEx, - // if someone is using a non .php file extension for php files. - // However, in $update_info['files'] we use hardcoded .php. - // We therefore replace .php with .$phpEx. - $info['files'] = preg_replace('/\.php$/i', ".$phpEx", $info['files']); - - // Adjust the update info file to hold some specific style-related information - $info['custom'] = array(); -/* - // Get custom installed styles... - $sql = 'SELECT style_name, style_path - FROM ' . STYLES_TABLE . " - WHERE LOWER(style_name) NOT IN ('subsilver2', 'prosilver')"; - $result = $db->sql_query($sql); - - $templates = array(); - while ($row = $db->sql_fetchrow($result)) - { - $templates[] = $row; - } - $db->sql_freeresult($result); - - if (sizeof($templates)) - { - foreach ($info['files'] as $filename) - { - // Template update? - if (strpos(strtolower($filename), 'styles/prosilver/template/') === 0) - { - foreach ($templates as $row) - { - $info['custom'][$filename][] = str_replace('/prosilver/', '/' . $row['style_path'] . '/', $filename); - } - } - } - } -*/ - } - break; - - default: - trigger_error('Mode for getting remote file not specified', E_USER_ERROR); - break; - } - - if ($info === false) - { - trigger_error($errstr, E_USER_ERROR); - } - - return $info; - } - - /** - * Function for including files... - */ - function include_file($filename) - { - global $phpbb_root_path, $phpEx; - - if (!empty($this->update_info['files']) && in_array($filename, $this->update_info['files'])) - { - include_once($this->new_location . $filename); - } - else - { - include_once($phpbb_root_path . $filename); - } - } - - /** - * Wrapper for returning a diff object - */ - function return_diff() - { - $args = func_get_args(); - $three_way_diff = (func_num_args() > 2) ? true : false; - - $file1 = array_shift($args); - $file2 = array_shift($args); - - $tmp['file1'] = (!empty($file1) && is_string($file1)) ? file_get_contents($file1) : $file1; - $tmp['file2'] = (!empty($file2) && is_string($file2)) ? file_get_contents($file2) : $file2; - - if ($three_way_diff) - { - $file3 = array_shift($args); - $tmp['file3'] = (!empty($file3) && is_string($file3)) ? file_get_contents($file3) : $file3; - - $diff = new diff3($tmp['file1'], $tmp['file2'], $tmp['file3']); - } - else - { - $diff = new diff($tmp['file1'], $tmp['file2']); - } - - unset($tmp); - - return $diff; - } -} diff --git a/phpBB/install/phpbbcli.php b/phpBB/install/phpbbcli.php new file mode 100755 index 0000000000..649d0c4283 --- /dev/null +++ b/phpBB/install/phpbbcli.php @@ -0,0 +1,49 @@ +#!/usr/bin/env php +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\Console\Input\ArgvInput; + +if (php_sapi_name() !== 'cli') +{ + echo 'This program must be run from the command line.' . PHP_EOL; + exit(1); +} + +define('IN_PHPBB', true); +define('IN_INSTALL', true); +define('PHPBB_ENVIRONMENT', 'production'); +define('PHPBB_VERSION', '3.2.0-a2-dev'); +$phpbb_root_path = __DIR__ . '/../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); + +// +// Let's do the common.php logic +// +$startup_new_path = $phpbb_root_path . 'install/update/update/new/install/startup.' . $phpEx; +$startup_path = (file_exists($startup_new_path)) ? $startup_new_path : $phpbb_root_path . 'install/startup.' . $phpEx; +require($startup_path); + +$input = new ArgvInput(); + +/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */ +$phpbb_filesystem = $phpbb_installer_container->get('filesystem'); + +/** @var \phpbb\language\language $language */ +$language = $phpbb_installer_container->get('language'); +$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting', 'cli')); + +$application = new \phpbb\console\application('phpBB Installer', PHPBB_VERSION, $language); +$application->setDispatcher($phpbb_installer_container->get('dispatcher')); +$application->register_container_commands($phpbb_installer_container->get('console.installer.command_collection')); +$application->run($input); diff --git a/phpBB/install/phpinfo.php b/phpBB/install/phpinfo.php deleted file mode 100644 index 83f154933a..0000000000 --- a/phpBB/install/phpinfo.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -phpinfo(); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql deleted file mode 100644 index 263ebb4490..0000000000 --- a/phpBB/install/schemas/firebird_schema.sql +++ /dev/null @@ -1,1509 +0,0 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. - -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id INTEGER NOT NULL, - post_msg_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - in_message INTEGER DEFAULT 0 NOT NULL, - poster_id INTEGER DEFAULT 0 NOT NULL, - is_orphan INTEGER DEFAULT 1 NOT NULL, - physical_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - real_filename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - download_count INTEGER DEFAULT 0 NOT NULL, - attach_comment BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - mimetype VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - filesize INTEGER DEFAULT 0 NOT NULL, - filetime INTEGER DEFAULT 0 NOT NULL, - thumbnail INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_attachments ADD PRIMARY KEY (attach_id);; - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments(filetime);; -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments(post_msg_id);; -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments(topic_id);; -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments(poster_id);; -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments(is_orphan);; - -CREATE GENERATOR phpbb_attachments_gen;; -SET GENERATOR phpbb_attachments_gen TO 0;; - -CREATE TRIGGER t_phpbb_attachments FOR phpbb_attachments -BEFORE INSERT -AS -BEGIN - NEW.attach_id = GEN_ID(phpbb_attachments_gen, 1); -END;; - - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_role_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups(group_id);; -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups(auth_option_id);; -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups(auth_role_id);; - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id INTEGER NOT NULL, - auth_option VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, - is_global INTEGER DEFAULT 0 NOT NULL, - is_local INTEGER DEFAULT 0 NOT NULL, - founder_only INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_acl_options ADD PRIMARY KEY (auth_option_id);; - -CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options(auth_option);; - -CREATE GENERATOR phpbb_acl_options_gen;; -SET GENERATOR phpbb_acl_options_gen TO 0;; - -CREATE TRIGGER t_phpbb_acl_options FOR phpbb_acl_options -BEFORE INSERT -AS -BEGIN - NEW.auth_option_id = GEN_ID(phpbb_acl_options_gen, 1); -END;; - - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id INTEGER NOT NULL, - role_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - role_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - role_type VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - role_order INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_acl_roles ADD PRIMARY KEY (role_id);; - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles(role_type);; -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles(role_order);; - -CREATE GENERATOR phpbb_acl_roles_gen;; -SET GENERATOR phpbb_acl_roles_gen TO 0;; - -CREATE TRIGGER t_phpbb_acl_roles FOR phpbb_acl_roles -BEFORE INSERT -AS -BEGIN - NEW.role_id = GEN_ID(phpbb_acl_roles_gen, 1); -END;; - - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_acl_roles_data ADD PRIMARY KEY (role_id, auth_option_id);; - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data(auth_option_id);; - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - auth_option_id INTEGER DEFAULT 0 NOT NULL, - auth_role_id INTEGER DEFAULT 0 NOT NULL, - auth_setting INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users(user_id);; -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users(auth_option_id);; -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users(auth_role_id);; - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id INTEGER NOT NULL, - ban_userid INTEGER DEFAULT 0 NOT NULL, - ban_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - ban_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - ban_start INTEGER DEFAULT 0 NOT NULL, - ban_end INTEGER DEFAULT 0 NOT NULL, - ban_exclude INTEGER DEFAULT 0 NOT NULL, - ban_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - ban_give_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_banlist ADD PRIMARY KEY (ban_id);; - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist(ban_end);; -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist(ban_userid, ban_exclude);; -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist(ban_email, ban_exclude);; -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist(ban_ip, ban_exclude);; - -CREATE GENERATOR phpbb_banlist_gen;; -SET GENERATOR phpbb_banlist_gen TO 0;; - -CREATE TRIGGER t_phpbb_banlist FOR phpbb_banlist -BEFORE INSERT -AS -BEGIN - NEW.ban_id = GEN_ID(phpbb_banlist_gen, 1); -END;; - - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id INTEGER DEFAULT 0 NOT NULL, - bbcode_tag VARCHAR(16) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_helpline VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - display_on_posting INTEGER DEFAULT 0 NOT NULL, - bbcode_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - bbcode_tpl BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - first_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - first_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - second_pass_match BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - second_pass_replace BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_bbcodes ADD PRIMARY KEY (bbcode_id);; - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes(display_on_posting);; - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_bookmarks ADD PRIMARY KEY (topic_id, user_id);; - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id INTEGER NOT NULL, - bot_active INTEGER DEFAULT 1 NOT NULL, - bot_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_id INTEGER DEFAULT 0 NOT NULL, - bot_agent VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - bot_ip VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_bots ADD PRIMARY KEY (bot_id);; - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots(bot_active);; - -CREATE GENERATOR phpbb_bots_gen;; -SET GENERATOR phpbb_bots_gen TO 0;; - -CREATE TRIGGER t_phpbb_bots FOR phpbb_bots -BEFORE INSERT -AS -BEGIN - NEW.bot_id = GEN_ID(phpbb_bots_gen, 1); -END;; - - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - config_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - is_dynamic INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_config ADD PRIMARY KEY (config_name);; - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config(is_dynamic);; - -# Table: 'phpbb_config_text' -CREATE TABLE phpbb_config_text ( - config_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - config_value BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_config_text ADD PRIMARY KEY (config_name);; - - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - confirm_type INTEGER DEFAULT 0 NOT NULL, - code VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - seed INTEGER DEFAULT 0 NOT NULL, - attempts INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_confirm ADD PRIMARY KEY (session_id, confirm_id);; - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm(confirm_type);; - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id INTEGER NOT NULL, - disallow_username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_disallow ADD PRIMARY KEY (disallow_id);; - - -CREATE GENERATOR phpbb_disallow_gen;; -SET GENERATOR phpbb_disallow_gen TO 0;; - -CREATE TRIGGER t_phpbb_disallow FOR phpbb_disallow -BEFORE INSERT -AS -BEGIN - NEW.disallow_id = GEN_ID(phpbb_disallow_gen, 1); -END;; - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - save_time INTEGER DEFAULT 0 NOT NULL, - draft_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - draft_message BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_drafts ADD PRIMARY KEY (draft_id);; - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts(save_time);; - -CREATE GENERATOR phpbb_drafts_gen;; -SET GENERATOR phpbb_drafts_gen TO 0;; - -CREATE TRIGGER t_phpbb_drafts FOR phpbb_drafts -BEFORE INSERT -AS -BEGIN - NEW.draft_id = GEN_ID(phpbb_drafts_gen, 1); -END;; - - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - ext_active INTEGER DEFAULT 0 NOT NULL, - ext_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);; - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id INTEGER NOT NULL, - group_id INTEGER DEFAULT 0 NOT NULL, - extension VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_extensions ADD PRIMARY KEY (extension_id);; - - -CREATE GENERATOR phpbb_extensions_gen;; -SET GENERATOR phpbb_extensions_gen TO 0;; - -CREATE TRIGGER t_phpbb_extensions FOR phpbb_extensions -BEFORE INSERT -AS -BEGIN - NEW.extension_id = GEN_ID(phpbb_extensions_gen, 1); -END;; - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id INTEGER NOT NULL, - group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - cat_id INTEGER DEFAULT 0 NOT NULL, - allow_group INTEGER DEFAULT 0 NOT NULL, - download_mode INTEGER DEFAULT 1 NOT NULL, - upload_icon VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - max_filesize INTEGER DEFAULT 0 NOT NULL, - allowed_forums BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - allow_in_pm INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_extension_groups ADD PRIMARY KEY (group_id);; - - -CREATE GENERATOR phpbb_extension_groups_gen;; -SET GENERATOR phpbb_extension_groups_gen TO 0;; - -CREATE TRIGGER t_phpbb_extension_groups FOR phpbb_extension_groups -BEFORE INSERT -AS -BEGIN - NEW.group_id = GEN_ID(phpbb_extension_groups_gen, 1); -END;; - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id INTEGER NOT NULL, - parent_id INTEGER DEFAULT 0 NOT NULL, - left_id INTEGER DEFAULT 0 NOT NULL, - right_id INTEGER DEFAULT 0 NOT NULL, - forum_parents BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - forum_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_desc_options INTEGER DEFAULT 7 NOT NULL, - forum_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_password VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_style INTEGER DEFAULT 0 NOT NULL, - forum_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_rules BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - forum_rules_link VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_rules_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_rules_options INTEGER DEFAULT 7 NOT NULL, - forum_rules_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_topics_per_page INTEGER DEFAULT 0 NOT NULL, - forum_type INTEGER DEFAULT 0 NOT NULL, - forum_status INTEGER DEFAULT 0 NOT NULL, - forum_posts_approved INTEGER DEFAULT 0 NOT NULL, - forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL, - forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, - forum_topics_approved INTEGER DEFAULT 0 NOT NULL, - forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL, - forum_topics_softdeleted INTEGER DEFAULT 0 NOT NULL, - forum_last_post_id INTEGER DEFAULT 0 NOT NULL, - forum_last_poster_id INTEGER DEFAULT 0 NOT NULL, - forum_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_last_post_time INTEGER DEFAULT 0 NOT NULL, - forum_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - forum_flags INTEGER DEFAULT 32 NOT NULL, - forum_options INTEGER DEFAULT 0 NOT NULL, - display_subforum_list INTEGER DEFAULT 1 NOT NULL, - display_on_index INTEGER DEFAULT 1 NOT NULL, - enable_indexing INTEGER DEFAULT 1 NOT NULL, - enable_icons INTEGER DEFAULT 1 NOT NULL, - enable_prune INTEGER DEFAULT 0 NOT NULL, - prune_next INTEGER DEFAULT 0 NOT NULL, - prune_days INTEGER DEFAULT 0 NOT NULL, - prune_viewed INTEGER DEFAULT 0 NOT NULL, - prune_freq INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_forums ADD PRIMARY KEY (forum_id);; - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums(left_id, right_id);; -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums(forum_last_post_id);; - -CREATE GENERATOR phpbb_forums_gen;; -SET GENERATOR phpbb_forums_gen TO 0;; - -CREATE TRIGGER t_phpbb_forums FOR phpbb_forums -BEFORE INSERT -AS -BEGIN - NEW.forum_id = GEN_ID(phpbb_forums_gen, 1); -END;; - - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_forums_access ADD PRIMARY KEY (forum_id, user_id, session_id);; - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - mark_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_forums_track ADD PRIMARY KEY (user_id, forum_id);; - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - notify_status INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch(forum_id);; -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch(user_id);; -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch(notify_status);; - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id INTEGER NOT NULL, - group_type INTEGER DEFAULT 1 NOT NULL, - group_founder_manage INTEGER DEFAULT 0 NOT NULL, - group_skip_auth INTEGER DEFAULT 0 NOT NULL, - group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - group_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - group_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_desc_options INTEGER DEFAULT 7 NOT NULL, - group_desc_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_display INTEGER DEFAULT 0 NOT NULL, - group_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_avatar_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_avatar_width INTEGER DEFAULT 0 NOT NULL, - group_avatar_height INTEGER DEFAULT 0 NOT NULL, - group_rank INTEGER DEFAULT 0 NOT NULL, - group_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - group_sig_chars INTEGER DEFAULT 0 NOT NULL, - group_receive_pm INTEGER DEFAULT 0 NOT NULL, - group_message_limit INTEGER DEFAULT 0 NOT NULL, - group_max_recipients INTEGER DEFAULT 0 NOT NULL, - group_legend INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);; - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups(group_legend, group_name);; - -CREATE GENERATOR phpbb_groups_gen;; -SET GENERATOR phpbb_groups_gen TO 0;; - -CREATE TRIGGER t_phpbb_groups FOR phpbb_groups -BEFORE INSERT -AS -BEGIN - NEW.group_id = GEN_ID(phpbb_groups_gen, 1); -END;; - - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id INTEGER NOT NULL, - icons_url VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - icons_width INTEGER DEFAULT 0 NOT NULL, - icons_height INTEGER DEFAULT 0 NOT NULL, - icons_order INTEGER DEFAULT 0 NOT NULL, - display_on_posting INTEGER DEFAULT 1 NOT NULL -);; - -ALTER TABLE phpbb_icons ADD PRIMARY KEY (icons_id);; - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons(display_on_posting);; - -CREATE GENERATOR phpbb_icons_gen;; -SET GENERATOR phpbb_icons_gen TO 0;; - -CREATE TRIGGER t_phpbb_icons FOR phpbb_icons -BEFORE INSERT -AS -BEGIN - NEW.icons_id = GEN_ID(phpbb_icons_gen, 1); -END;; - - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id INTEGER NOT NULL, - lang_iso VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, - lang_dir VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, - lang_english_name VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - lang_local_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - lang_author VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_lang ADD PRIMARY KEY (lang_id);; - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang(lang_iso);; - -CREATE GENERATOR phpbb_lang_gen;; -SET GENERATOR phpbb_lang_gen TO 0;; - -CREATE TRIGGER t_phpbb_lang FOR phpbb_lang -BEFORE INSERT -AS -BEGIN - NEW.lang_id = GEN_ID(phpbb_lang_gen, 1); -END;; - - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id INTEGER NOT NULL, - log_type INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - reportee_id INTEGER DEFAULT 0 NOT NULL, - log_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - log_time INTEGER DEFAULT 0 NOT NULL, - log_operation BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - log_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_log ADD PRIMARY KEY (log_id);; - -CREATE INDEX phpbb_log_log_type ON phpbb_log(log_type);; -CREATE INDEX phpbb_log_log_time ON phpbb_log(log_time);; -CREATE INDEX phpbb_log_forum_id ON phpbb_log(forum_id);; -CREATE INDEX phpbb_log_topic_id ON phpbb_log(topic_id);; -CREATE INDEX phpbb_log_reportee_id ON phpbb_log(reportee_id);; -CREATE INDEX phpbb_log_user_id ON phpbb_log(user_id);; - -CREATE GENERATOR phpbb_log_gen;; -SET GENERATOR phpbb_log_gen TO 0;; - -CREATE TRIGGER t_phpbb_log FOR phpbb_log -BEFORE INSERT -AS -BEGIN - NEW.log_id = GEN_ID(phpbb_log_gen, 1); -END;; - - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - attempt_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, - attempt_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - attempt_time INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE, - username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT 0 NOT NULL COLLATE UNICODE -);; - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts(attempt_ip, attempt_time);; -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts(attempt_forwarded_for, attempt_time);; -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts(attempt_time);; -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts(user_id);; - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - group_id INTEGER DEFAULT 0 NOT NULL, - group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - display_on_index INTEGER DEFAULT 1 NOT NULL -);; - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache(display_on_index);; -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache(forum_id);; - -# Table: 'phpbb_migrations' -CREATE TABLE phpbb_migrations ( - migration_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - migration_depends_on BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - migration_schema_done INTEGER DEFAULT 0 NOT NULL, - migration_data_done INTEGER DEFAULT 0 NOT NULL, - migration_data_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - migration_start_time INTEGER DEFAULT 0 NOT NULL, - migration_end_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_migrations ADD PRIMARY KEY (migration_name);; - - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id INTEGER NOT NULL, - module_enabled INTEGER DEFAULT 1 NOT NULL, - module_display INTEGER DEFAULT 1 NOT NULL, - module_basename VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - module_class VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - parent_id INTEGER DEFAULT 0 NOT NULL, - left_id INTEGER DEFAULT 0 NOT NULL, - right_id INTEGER DEFAULT 0 NOT NULL, - module_langname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - module_mode VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - module_auth VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_modules ADD PRIMARY KEY (module_id);; - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules(left_id, right_id);; -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules(module_enabled);; -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules(module_class, left_id);; - -CREATE GENERATOR phpbb_modules_gen;; -SET GENERATOR phpbb_modules_gen TO 0;; - -CREATE TRIGGER t_phpbb_modules FOR phpbb_modules -BEFORE INSERT -AS -BEGIN - NEW.module_id = GEN_ID(phpbb_modules_gen, 1); -END;; - - -# Table: 'phpbb_notification_types' -CREATE TABLE phpbb_notification_types ( - notification_type_id INTEGER NOT NULL, - notification_type_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - notification_type_enabled INTEGER DEFAULT 1 NOT NULL -);; - -ALTER TABLE phpbb_notification_types ADD PRIMARY KEY (notification_type_id);; - -CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types(notification_type_name);; - -CREATE GENERATOR phpbb_notification_types_gen;; -SET GENERATOR phpbb_notification_types_gen TO 0;; - -CREATE TRIGGER t_phpbb_notification_types FOR phpbb_notification_types -BEFORE INSERT -AS -BEGIN - NEW.notification_type_id = GEN_ID(phpbb_notification_types_gen, 1); -END;; - - -# Table: 'phpbb_notifications' -CREATE TABLE phpbb_notifications ( - notification_id INTEGER NOT NULL, - notification_type_id INTEGER DEFAULT 0 NOT NULL, - item_id INTEGER DEFAULT 0 NOT NULL, - item_parent_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - notification_read INTEGER DEFAULT 0 NOT NULL, - notification_time INTEGER DEFAULT 1 NOT NULL, - notification_data BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_notifications ADD PRIMARY KEY (notification_id);; - -CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications(notification_type_id, item_id);; -CREATE INDEX phpbb_notifications_user ON phpbb_notifications(user_id, notification_read);; - -CREATE GENERATOR phpbb_notifications_gen;; -SET GENERATOR phpbb_notifications_gen TO 0;; - -CREATE TRIGGER t_phpbb_notifications FOR phpbb_notifications -BEFORE INSERT -AS -BEGIN - NEW.notification_id = GEN_ID(phpbb_notifications_gen, 1); -END;; - - -# Table: 'phpbb_oauth_accounts' -CREATE TABLE phpbb_oauth_accounts ( - user_id INTEGER DEFAULT 0 NOT NULL, - provider VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - oauth_provider_id BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_oauth_accounts ADD PRIMARY KEY (user_id, provider);; - - -# Table: 'phpbb_oauth_tokens' -CREATE TABLE phpbb_oauth_tokens ( - user_id INTEGER DEFAULT 0 NOT NULL, - session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - provider VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - oauth_token BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens(user_id);; -CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens(provider);; - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - poll_option_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - poll_option_total INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options(poll_option_id);; -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options(topic_id);; - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id INTEGER DEFAULT 0 NOT NULL, - poll_option_id INTEGER DEFAULT 0 NOT NULL, - vote_user_id INTEGER DEFAULT 0 NOT NULL, - vote_user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes(topic_id);; -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes(vote_user_id);; -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes(vote_user_ip);; - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id INTEGER NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - poster_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 0 NOT NULL, - poster_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - post_time INTEGER DEFAULT 0 NOT NULL, - post_visibility INTEGER DEFAULT 0 NOT NULL, - post_reported INTEGER DEFAULT 0 NOT NULL, - enable_bbcode INTEGER DEFAULT 1 NOT NULL, - enable_smilies INTEGER DEFAULT 1 NOT NULL, - enable_magic_url INTEGER DEFAULT 1 NOT NULL, - enable_sig INTEGER DEFAULT 1 NOT NULL, - post_username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - post_checksum VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - post_attachment INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - post_postcount INTEGER DEFAULT 1 NOT NULL, - post_edit_time INTEGER DEFAULT 0 NOT NULL, - post_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - post_edit_user INTEGER DEFAULT 0 NOT NULL, - post_edit_count INTEGER DEFAULT 0 NOT NULL, - post_edit_locked INTEGER DEFAULT 0 NOT NULL, - post_delete_time INTEGER DEFAULT 0 NOT NULL, - post_delete_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - post_delete_user INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_posts ADD PRIMARY KEY (post_id);; - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts(forum_id);; -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts(topic_id);; -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts(poster_ip);; -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts(poster_id);; -CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts(post_visibility);; -CREATE INDEX phpbb_posts_post_username ON phpbb_posts(post_username);; -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts(topic_id, post_time);; - -CREATE GENERATOR phpbb_posts_gen;; -SET GENERATOR phpbb_posts_gen TO 0;; - -CREATE TRIGGER t_phpbb_posts FOR phpbb_posts -BEFORE INSERT -AS -BEGIN - NEW.post_id = GEN_ID(phpbb_posts_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id INTEGER NOT NULL, - root_level INTEGER DEFAULT 0 NOT NULL, - author_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 0 NOT NULL, - author_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - message_time INTEGER DEFAULT 0 NOT NULL, - enable_bbcode INTEGER DEFAULT 1 NOT NULL, - enable_smilies INTEGER DEFAULT 1 NOT NULL, - enable_magic_url INTEGER DEFAULT 1 NOT NULL, - enable_sig INTEGER DEFAULT 1 NOT NULL, - message_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - message_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - message_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - message_edit_user INTEGER DEFAULT 0 NOT NULL, - message_attachment INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - message_edit_time INTEGER DEFAULT 0 NOT NULL, - message_edit_count INTEGER DEFAULT 0 NOT NULL, - to_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - message_reported INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_privmsgs ADD PRIMARY KEY (msg_id);; - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs(author_ip);; -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs(message_time);; -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs(author_id);; -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs(root_level);; - -CREATE GENERATOR phpbb_privmsgs_gen;; -SET GENERATOR phpbb_privmsgs_gen TO 0;; - -CREATE TRIGGER t_phpbb_privmsgs FOR phpbb_privmsgs -BEFORE INSERT -AS -BEGIN - NEW.msg_id = GEN_ID(phpbb_privmsgs_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - folder_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - pm_count INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_privmsgs_folder ADD PRIMARY KEY (folder_id);; - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder(user_id);; - -CREATE GENERATOR phpbb_privmsgs_folder_gen;; -SET GENERATOR phpbb_privmsgs_folder_gen TO 0;; - -CREATE TRIGGER t_phpbb_privmsgs_folder FOR phpbb_privmsgs_folder -BEFORE INSERT -AS -BEGIN - NEW.folder_id = GEN_ID(phpbb_privmsgs_folder_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - rule_check INTEGER DEFAULT 0 NOT NULL, - rule_connection INTEGER DEFAULT 0 NOT NULL, - rule_string VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - rule_user_id INTEGER DEFAULT 0 NOT NULL, - rule_group_id INTEGER DEFAULT 0 NOT NULL, - rule_action INTEGER DEFAULT 0 NOT NULL, - rule_folder_id INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_privmsgs_rules ADD PRIMARY KEY (rule_id);; - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules(user_id);; - -CREATE GENERATOR phpbb_privmsgs_rules_gen;; -SET GENERATOR phpbb_privmsgs_rules_gen TO 0;; - -CREATE TRIGGER t_phpbb_privmsgs_rules FOR phpbb_privmsgs_rules -BEFORE INSERT -AS -BEGIN - NEW.rule_id = GEN_ID(phpbb_privmsgs_rules_gen, 1); -END;; - - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - author_id INTEGER DEFAULT 0 NOT NULL, - pm_deleted INTEGER DEFAULT 0 NOT NULL, - pm_new INTEGER DEFAULT 1 NOT NULL, - pm_unread INTEGER DEFAULT 1 NOT NULL, - pm_replied INTEGER DEFAULT 0 NOT NULL, - pm_marked INTEGER DEFAULT 0 NOT NULL, - pm_forwarded INTEGER DEFAULT 0 NOT NULL, - folder_id INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to(msg_id);; -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to(author_id);; -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to(user_id, folder_id);; - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id INTEGER NOT NULL, - field_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_type VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_ident VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_length VARCHAR(20) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_minlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_maxlen VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - field_novalue VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_validation VARCHAR(20) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - field_required INTEGER DEFAULT 0 NOT NULL, - field_show_novalue INTEGER DEFAULT 0 NOT NULL, - field_show_on_reg INTEGER DEFAULT 0 NOT NULL, - field_show_on_pm INTEGER DEFAULT 0 NOT NULL, - field_show_on_vt INTEGER DEFAULT 0 NOT NULL, - field_show_on_ml INTEGER DEFAULT 0 NOT NULL, - field_show_profile INTEGER DEFAULT 0 NOT NULL, - field_hide INTEGER DEFAULT 0 NOT NULL, - field_no_view INTEGER DEFAULT 0 NOT NULL, - field_active INTEGER DEFAULT 0 NOT NULL, - field_order INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_profile_fields ADD PRIMARY KEY (field_id);; - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields(field_type);; -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields(field_order);; - -CREATE GENERATOR phpbb_profile_fields_gen;; -SET GENERATOR phpbb_profile_fields_gen TO 0;; - -CREATE TRIGGER t_phpbb_profile_fields FOR phpbb_profile_fields -BEFORE INSERT -AS -BEGIN - NEW.field_id = GEN_ID(phpbb_profile_fields_gen, 1); -END;; - - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id INTEGER DEFAULT 0 NOT NULL, - pf_phpbb_location VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - pf_phpbb_interests BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - pf_phpbb_occupation BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_profile_fields_data ADD PRIMARY KEY (user_id);; - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id INTEGER DEFAULT 0 NOT NULL, - lang_id INTEGER DEFAULT 0 NOT NULL, - option_id INTEGER DEFAULT 0 NOT NULL, - field_type VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - lang_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_profile_fields_lang ADD PRIMARY KEY (field_id, lang_id, option_id);; - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id INTEGER DEFAULT 0 NOT NULL, - lang_id INTEGER DEFAULT 0 NOT NULL, - lang_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - lang_explain BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - lang_default_value VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_profile_lang ADD PRIMARY KEY (field_id, lang_id);; - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id INTEGER NOT NULL, - rank_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - rank_min INTEGER DEFAULT 0 NOT NULL, - rank_special INTEGER DEFAULT 0 NOT NULL, - rank_image VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_ranks ADD PRIMARY KEY (rank_id);; - - -CREATE GENERATOR phpbb_ranks_gen;; -SET GENERATOR phpbb_ranks_gen TO 0;; - -CREATE TRIGGER t_phpbb_ranks FOR phpbb_ranks -BEFORE INSERT -AS -BEGIN - NEW.rank_id = GEN_ID(phpbb_ranks_gen, 1); -END;; - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id INTEGER NOT NULL, - reason_id INTEGER DEFAULT 0 NOT NULL, - post_id INTEGER DEFAULT 0 NOT NULL, - pm_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - user_notify INTEGER DEFAULT 0 NOT NULL, - report_closed INTEGER DEFAULT 0 NOT NULL, - report_time INTEGER DEFAULT 0 NOT NULL, - report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reported_post_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - reported_post_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - reported_post_enable_magic_url INTEGER DEFAULT 1 NOT NULL, - reported_post_enable_smilies INTEGER DEFAULT 1 NOT NULL, - reported_post_enable_bbcode INTEGER DEFAULT 1 NOT NULL -);; - -ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports(post_id);; -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports(pm_id);; - -CREATE GENERATOR phpbb_reports_gen;; -SET GENERATOR phpbb_reports_gen TO 0;; - -CREATE TRIGGER t_phpbb_reports FOR phpbb_reports -BEFORE INSERT -AS -BEGIN - NEW.report_id = GEN_ID(phpbb_reports_gen, 1); -END;; - - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id INTEGER NOT NULL, - reason_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - reason_description BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reason_order INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_reports_reasons ADD PRIMARY KEY (reason_id);; - - -CREATE GENERATOR phpbb_reports_reasons_gen;; -SET GENERATOR phpbb_reports_reasons_gen TO 0;; - -CREATE TRIGGER t_phpbb_reports_reasons FOR phpbb_reports_reasons -BEFORE INSERT -AS -BEGIN - NEW.reason_id = GEN_ID(phpbb_reports_reasons_gen, 1); -END;; - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - search_time INTEGER DEFAULT 0 NOT NULL, - search_keywords BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - search_authors BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_search_results ADD PRIMARY KEY (search_key);; - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id INTEGER NOT NULL, - word_text VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - word_common INTEGER DEFAULT 0 NOT NULL, - word_count INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_search_wordlist ADD PRIMARY KEY (word_id);; - -CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist(word_text);; -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist(word_count);; - -CREATE GENERATOR phpbb_search_wordlist_gen;; -SET GENERATOR phpbb_search_wordlist_gen TO 0;; - -CREATE TRIGGER t_phpbb_search_wordlist FOR phpbb_search_wordlist -BEFORE INSERT -AS -BEGIN - NEW.word_id = GEN_ID(phpbb_search_wordlist_gen, 1); -END;; - - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id INTEGER DEFAULT 0 NOT NULL, - word_id INTEGER DEFAULT 0 NOT NULL, - title_match INTEGER DEFAULT 0 NOT NULL -);; - -CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch(word_id, post_id, title_match);; -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch(word_id);; -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch(post_id);; - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_user_id INTEGER DEFAULT 0 NOT NULL, - session_forum_id INTEGER DEFAULT 0 NOT NULL, - session_last_visit INTEGER DEFAULT 0 NOT NULL, - session_start INTEGER DEFAULT 0 NOT NULL, - session_time INTEGER DEFAULT 0 NOT NULL, - session_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_browser VARCHAR(150) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_forwarded_for VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - session_page VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - session_viewonline INTEGER DEFAULT 1 NOT NULL, - session_autologin INTEGER DEFAULT 0 NOT NULL, - session_admin INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_sessions ADD PRIMARY KEY (session_id);; - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions(session_time);; -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions(session_user_id);; -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions(session_forum_id);; - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - last_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - last_login INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_sessions_keys ADD PRIMARY KEY (key_id, user_id);; - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys(last_login);; - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id INTEGER NOT NULL, - site_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - site_hostname VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - ip_exclude INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_sitelist ADD PRIMARY KEY (site_id);; - - -CREATE GENERATOR phpbb_sitelist_gen;; -SET GENERATOR phpbb_sitelist_gen TO 0;; - -CREATE TRIGGER t_phpbb_sitelist FOR phpbb_sitelist -BEFORE INSERT -AS -BEGIN - NEW.site_id = GEN_ID(phpbb_sitelist_gen, 1); -END;; - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id INTEGER NOT NULL, - code VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - emotion VARCHAR(50) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - smiley_url VARCHAR(50) CHARACTER SET NONE DEFAULT '' NOT NULL, - smiley_width INTEGER DEFAULT 0 NOT NULL, - smiley_height INTEGER DEFAULT 0 NOT NULL, - smiley_order INTEGER DEFAULT 0 NOT NULL, - display_on_posting INTEGER DEFAULT 1 NOT NULL -);; - -ALTER TABLE phpbb_smilies ADD PRIMARY KEY (smiley_id);; - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies(display_on_posting);; - -CREATE GENERATOR phpbb_smilies_gen;; -SET GENERATOR phpbb_smilies_gen TO 0;; - -CREATE TRIGGER t_phpbb_smilies FOR phpbb_smilies -BEFORE INSERT -AS -BEGIN - NEW.smiley_id = GEN_ID(phpbb_smilies_gen, 1); -END;; - - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id INTEGER NOT NULL, - style_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - style_copyright VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - style_active INTEGER DEFAULT 1 NOT NULL, - style_path VARCHAR(100) CHARACTER SET NONE DEFAULT '' NOT NULL, - bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT 'kNg=' NOT NULL, - style_parent_id INTEGER DEFAULT 0 NOT NULL, - style_parent_tree BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL -);; - -ALTER TABLE phpbb_styles ADD PRIMARY KEY (style_id);; - -CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles(style_name);; - -CREATE GENERATOR phpbb_styles_gen;; -SET GENERATOR phpbb_styles_gen TO 0;; - -CREATE TRIGGER t_phpbb_styles FOR phpbb_styles -BEFORE INSERT -AS -BEGIN - NEW.style_id = GEN_ID(phpbb_styles_gen, 1); -END;; - - -# Table: 'phpbb_teampage' -CREATE TABLE phpbb_teampage ( - teampage_id INTEGER NOT NULL, - group_id INTEGER DEFAULT 0 NOT NULL, - teampage_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - teampage_position INTEGER DEFAULT 0 NOT NULL, - teampage_parent INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_teampage ADD PRIMARY KEY (teampage_id);; - - -CREATE GENERATOR phpbb_teampage_gen;; -SET GENERATOR phpbb_teampage_gen TO 0;; - -CREATE TRIGGER t_phpbb_teampage FOR phpbb_teampage -BEFORE INSERT -AS -BEGIN - NEW.teampage_id = GEN_ID(phpbb_teampage_gen, 1); -END;; - - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id INTEGER NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - icon_id INTEGER DEFAULT 0 NOT NULL, - topic_attachment INTEGER DEFAULT 0 NOT NULL, - topic_visibility INTEGER DEFAULT 0 NOT NULL, - topic_reported INTEGER DEFAULT 0 NOT NULL, - topic_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_poster INTEGER DEFAULT 0 NOT NULL, - topic_time INTEGER DEFAULT 0 NOT NULL, - topic_time_limit INTEGER DEFAULT 0 NOT NULL, - topic_views INTEGER DEFAULT 0 NOT NULL, - topic_posts_approved INTEGER DEFAULT 0 NOT NULL, - topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL, - topic_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, - topic_status INTEGER DEFAULT 0 NOT NULL, - topic_type INTEGER DEFAULT 0 NOT NULL, - topic_first_post_id INTEGER DEFAULT 0 NOT NULL, - topic_first_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_first_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - topic_last_post_id INTEGER DEFAULT 0 NOT NULL, - topic_last_poster_id INTEGER DEFAULT 0 NOT NULL, - topic_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - topic_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_last_post_time INTEGER DEFAULT 0 NOT NULL, - topic_last_view_time INTEGER DEFAULT 0 NOT NULL, - topic_moved_id INTEGER DEFAULT 0 NOT NULL, - topic_bumped INTEGER DEFAULT 0 NOT NULL, - topic_bumper INTEGER DEFAULT 0 NOT NULL, - poll_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - poll_start INTEGER DEFAULT 0 NOT NULL, - poll_length INTEGER DEFAULT 0 NOT NULL, - poll_max_options INTEGER DEFAULT 1 NOT NULL, - poll_last_vote INTEGER DEFAULT 0 NOT NULL, - poll_vote_change INTEGER DEFAULT 0 NOT NULL, - topic_delete_time INTEGER DEFAULT 0 NOT NULL, - topic_delete_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - topic_delete_user INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_topics ADD PRIMARY KEY (topic_id);; - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics(forum_id);; -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics(forum_id, topic_type);; -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics(topic_last_post_time);; -CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics(topic_visibility);; -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics(forum_id, topic_visibility, topic_last_post_id);; -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics(forum_id, topic_last_post_time, topic_moved_id);; - -CREATE GENERATOR phpbb_topics_gen;; -SET GENERATOR phpbb_topics_gen TO 0;; - -CREATE TRIGGER t_phpbb_topics FOR phpbb_topics -BEFORE INSERT -AS -BEGIN - NEW.topic_id = GEN_ID(phpbb_topics_gen, 1); -END;; - - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - forum_id INTEGER DEFAULT 0 NOT NULL, - mark_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_topics_track ADD PRIMARY KEY (user_id, topic_id);; - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track(topic_id);; -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track(forum_id);; - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id INTEGER DEFAULT 0 NOT NULL, - topic_id INTEGER DEFAULT 0 NOT NULL, - topic_posted INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_topics_posted ADD PRIMARY KEY (user_id, topic_id);; - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - notify_status INTEGER DEFAULT 0 NOT NULL -);; - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch(topic_id);; -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch(user_id);; -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch(notify_status);; - -# Table: 'phpbb_user_notifications' -CREATE TABLE phpbb_user_notifications ( - item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - item_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - method VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - notify INTEGER DEFAULT 1 NOT NULL -);; - - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id INTEGER DEFAULT 0 NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - group_leader INTEGER DEFAULT 0 NOT NULL, - user_pending INTEGER DEFAULT 1 NOT NULL -);; - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group(group_id);; -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group(user_id);; -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group(group_leader);; - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id INTEGER NOT NULL, - user_type INTEGER DEFAULT 0 NOT NULL, - group_id INTEGER DEFAULT 3 NOT NULL, - user_permissions BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL, - user_perm_from INTEGER DEFAULT 0 NOT NULL, - user_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_regdate INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - username_clean VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_password VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_passchg INTEGER DEFAULT 0 NOT NULL, - user_pass_convert INTEGER DEFAULT 0 NOT NULL, - user_actkey VARCHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_newpasswd VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_email VARCHAR(100) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_email_hash DOUBLE PRECISION DEFAULT 0 NOT NULL, - user_birthday VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_lastvisit INTEGER DEFAULT 0 NOT NULL, - user_lastmark INTEGER DEFAULT 0 NOT NULL, - user_lastpost_time INTEGER DEFAULT 0 NOT NULL, - user_lastpage VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_last_confirm_key VARCHAR(10) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_last_search INTEGER DEFAULT 0 NOT NULL, - user_warnings INTEGER DEFAULT 0 NOT NULL, - user_last_warning INTEGER DEFAULT 0 NOT NULL, - user_login_attempts INTEGER DEFAULT 0 NOT NULL, - user_inactive_reason INTEGER DEFAULT 0 NOT NULL, - user_inactive_time INTEGER DEFAULT 0 NOT NULL, - user_posts INTEGER DEFAULT 0 NOT NULL, - user_lang VARCHAR(30) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_timezone VARCHAR(100) CHARACTER SET NONE DEFAULT 'UTC' NOT NULL, - user_dateformat VARCHAR(30) CHARACTER SET UTF8 DEFAULT 'd M Y H:i' NOT NULL COLLATE UNICODE, - user_style INTEGER DEFAULT 0 NOT NULL, - user_rank INTEGER DEFAULT 0 NOT NULL, - user_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_new_privmsg INTEGER DEFAULT 0 NOT NULL, - user_unread_privmsg INTEGER DEFAULT 0 NOT NULL, - user_last_privmsg INTEGER DEFAULT 0 NOT NULL, - user_message_rules INTEGER DEFAULT 0 NOT NULL, - user_full_folder INTEGER DEFAULT -3 NOT NULL, - user_emailtime INTEGER DEFAULT 0 NOT NULL, - user_topic_show_days INTEGER DEFAULT 0 NOT NULL, - user_topic_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, - user_topic_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'd' NOT NULL, - user_post_show_days INTEGER DEFAULT 0 NOT NULL, - user_post_sortby_type VARCHAR(1) CHARACTER SET NONE DEFAULT 't' NOT NULL, - user_post_sortby_dir VARCHAR(1) CHARACTER SET NONE DEFAULT 'a' NOT NULL, - user_notify INTEGER DEFAULT 0 NOT NULL, - user_notify_pm INTEGER DEFAULT 1 NOT NULL, - user_notify_type INTEGER DEFAULT 0 NOT NULL, - user_allow_pm INTEGER DEFAULT 1 NOT NULL, - user_allow_viewonline INTEGER DEFAULT 1 NOT NULL, - user_allow_viewemail INTEGER DEFAULT 1 NOT NULL, - user_allow_massemail INTEGER DEFAULT 1 NOT NULL, - user_options INTEGER DEFAULT 230271 NOT NULL, - user_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_avatar_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_avatar_width INTEGER DEFAULT 0 NOT NULL, - user_avatar_height INTEGER DEFAULT 0 NOT NULL, - user_sig BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - user_sig_bbcode_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_icq VARCHAR(15) CHARACTER SET NONE DEFAULT '' NOT NULL, - user_aim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_yim VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_msnm VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_jabber VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_website VARCHAR(200) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_form_salt VARCHAR(32) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - user_new INTEGER DEFAULT 1 NOT NULL, - user_reminded INTEGER DEFAULT 0 NOT NULL, - user_reminded_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_users ADD PRIMARY KEY (user_id);; - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users(user_birthday);; -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users(user_email_hash);; -CREATE INDEX phpbb_users_user_type ON phpbb_users(user_type);; -CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users(username_clean);; - -CREATE GENERATOR phpbb_users_gen;; -SET GENERATOR phpbb_users_gen TO 0;; - -CREATE TRIGGER t_phpbb_users FOR phpbb_users -BEFORE INSERT -AS -BEGIN - NEW.user_id = GEN_ID(phpbb_users_gen, 1); -END;; - - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id INTEGER NOT NULL, - user_id INTEGER DEFAULT 0 NOT NULL, - post_id INTEGER DEFAULT 0 NOT NULL, - log_id INTEGER DEFAULT 0 NOT NULL, - warning_time INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_warnings ADD PRIMARY KEY (warning_id);; - - -CREATE GENERATOR phpbb_warnings_gen;; -SET GENERATOR phpbb_warnings_gen TO 0;; - -CREATE TRIGGER t_phpbb_warnings FOR phpbb_warnings -BEFORE INSERT -AS -BEGIN - NEW.warning_id = GEN_ID(phpbb_warnings_gen, 1); -END;; - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id INTEGER NOT NULL, - word VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, - replacement VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE -);; - -ALTER TABLE phpbb_words ADD PRIMARY KEY (word_id);; - - -CREATE GENERATOR phpbb_words_gen;; -SET GENERATOR phpbb_words_gen TO 0;; - -CREATE TRIGGER t_phpbb_words FOR phpbb_words -BEFORE INSERT -AS -BEGIN - NEW.word_id = GEN_ID(phpbb_words_gen, 1); -END;; - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id INTEGER DEFAULT 0 NOT NULL, - zebra_id INTEGER DEFAULT 0 NOT NULL, - friend INTEGER DEFAULT 0 NOT NULL, - foe INTEGER DEFAULT 0 NOT NULL -);; - -ALTER TABLE phpbb_zebra ADD PRIMARY KEY (user_id, zebra_id);; - - diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql deleted file mode 100644 index 11309d67a5..0000000000 --- a/phpBB/install/schemas/mssql_schema.sql +++ /dev/null @@ -1,1831 +0,0 @@ -/* - * DO NOT EDIT THIS FILE, IT IS GENERATED - * - * To change the contents of this file, edit - * phpBB/develop/create_schema_files.php and - * run it. - */ - -/* - Table: 'phpbb_attachments' -*/ -CREATE TABLE [phpbb_attachments] ( - [attach_id] [int] IDENTITY (1, 1) NOT NULL , - [post_msg_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [in_message] [int] DEFAULT (0) NOT NULL , - [poster_id] [int] DEFAULT (0) NOT NULL , - [is_orphan] [int] DEFAULT (1) NOT NULL , - [physical_filename] [varchar] (255) DEFAULT ('') NOT NULL , - [real_filename] [varchar] (255) DEFAULT ('') NOT NULL , - [download_count] [int] DEFAULT (0) NOT NULL , - [attach_comment] [varchar] (4000) DEFAULT ('') NOT NULL , - [extension] [varchar] (100) DEFAULT ('') NOT NULL , - [mimetype] [varchar] (100) DEFAULT ('') NOT NULL , - [filesize] [int] DEFAULT (0) NOT NULL , - [filetime] [int] DEFAULT (0) NOT NULL , - [thumbnail] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_attachments] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_attachments] PRIMARY KEY CLUSTERED - ( - [attach_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [filetime] ON [phpbb_attachments]([filetime]) ON [PRIMARY] -GO - -CREATE INDEX [post_msg_id] ON [phpbb_attachments]([post_msg_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_attachments]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [poster_id] ON [phpbb_attachments]([poster_id]) ON [PRIMARY] -GO - -CREATE INDEX [is_orphan] ON [phpbb_attachments]([is_orphan]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_groups' -*/ -CREATE TABLE [phpbb_acl_groups] ( - [group_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [group_id] ON [phpbb_acl_groups]([group_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_opt_id] ON [phpbb_acl_groups]([auth_option_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_role_id] ON [phpbb_acl_groups]([auth_role_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_options' -*/ -CREATE TABLE [phpbb_acl_options] ( - [auth_option_id] [int] IDENTITY (1, 1) NOT NULL , - [auth_option] [varchar] (50) DEFAULT ('') NOT NULL , - [is_global] [int] DEFAULT (0) NOT NULL , - [is_local] [int] DEFAULT (0) NOT NULL , - [founder_only] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_acl_options] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_options] PRIMARY KEY CLUSTERED - ( - [auth_option_id] - ) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [auth_option] ON [phpbb_acl_options]([auth_option]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_roles' -*/ -CREATE TABLE [phpbb_acl_roles] ( - [role_id] [int] IDENTITY (1, 1) NOT NULL , - [role_name] [varchar] (255) DEFAULT ('') NOT NULL , - [role_description] [varchar] (4000) DEFAULT ('') NOT NULL , - [role_type] [varchar] (10) DEFAULT ('') NOT NULL , - [role_order] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_acl_roles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles] PRIMARY KEY CLUSTERED - ( - [role_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [role_type] ON [phpbb_acl_roles]([role_type]) ON [PRIMARY] -GO - -CREATE INDEX [role_order] ON [phpbb_acl_roles]([role_order]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_roles_data' -*/ -CREATE TABLE [phpbb_acl_roles_data] ( - [role_id] [int] DEFAULT (0) NOT NULL , - [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_acl_roles_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_acl_roles_data] PRIMARY KEY CLUSTERED - ( - [role_id], - [auth_option_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [ath_op_id] ON [phpbb_acl_roles_data]([auth_option_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_acl_users' -*/ -CREATE TABLE [phpbb_acl_users] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [auth_option_id] [int] DEFAULT (0) NOT NULL , - [auth_role_id] [int] DEFAULT (0) NOT NULL , - [auth_setting] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_acl_users]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_option_id] ON [phpbb_acl_users]([auth_option_id]) ON [PRIMARY] -GO - -CREATE INDEX [auth_role_id] ON [phpbb_acl_users]([auth_role_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_banlist' -*/ -CREATE TABLE [phpbb_banlist] ( - [ban_id] [int] IDENTITY (1, 1) NOT NULL , - [ban_userid] [int] DEFAULT (0) NOT NULL , - [ban_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [ban_email] [varchar] (100) DEFAULT ('') NOT NULL , - [ban_start] [int] DEFAULT (0) NOT NULL , - [ban_end] [int] DEFAULT (0) NOT NULL , - [ban_exclude] [int] DEFAULT (0) NOT NULL , - [ban_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [ban_give_reason] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED - ( - [ban_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [ban_end] ON [phpbb_banlist]([ban_end]) ON [PRIMARY] -GO - -CREATE INDEX [ban_user] ON [phpbb_banlist]([ban_userid], [ban_exclude]) ON [PRIMARY] -GO - -CREATE INDEX [ban_email] ON [phpbb_banlist]([ban_email], [ban_exclude]) ON [PRIMARY] -GO - -CREATE INDEX [ban_ip] ON [phpbb_banlist]([ban_ip], [ban_exclude]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_bbcodes' -*/ -CREATE TABLE [phpbb_bbcodes] ( - [bbcode_id] [int] DEFAULT (0) NOT NULL , - [bbcode_tag] [varchar] (16) DEFAULT ('') NOT NULL , - [bbcode_helpline] [varchar] (255) DEFAULT ('') NOT NULL , - [display_on_posting] [int] DEFAULT (0) NOT NULL , - [bbcode_match] [varchar] (4000) DEFAULT ('') NOT NULL , - [bbcode_tpl] [text] DEFAULT ('') NOT NULL , - [first_pass_match] [text] DEFAULT ('') NOT NULL , - [first_pass_replace] [text] DEFAULT ('') NOT NULL , - [second_pass_match] [text] DEFAULT ('') NOT NULL , - [second_pass_replace] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_bbcodes] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bbcodes] PRIMARY KEY CLUSTERED - ( - [bbcode_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [display_on_post] ON [phpbb_bbcodes]([display_on_posting]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_bookmarks' -*/ -CREATE TABLE [phpbb_bookmarks] ( - [topic_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_bookmarks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bookmarks] PRIMARY KEY CLUSTERED - ( - [topic_id], - [user_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_bots' -*/ -CREATE TABLE [phpbb_bots] ( - [bot_id] [int] IDENTITY (1, 1) NOT NULL , - [bot_active] [int] DEFAULT (1) NOT NULL , - [bot_name] [varchar] (255) DEFAULT ('') NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [bot_agent] [varchar] (255) DEFAULT ('') NOT NULL , - [bot_ip] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_bots] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_bots] PRIMARY KEY CLUSTERED - ( - [bot_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [bot_active] ON [phpbb_bots]([bot_active]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_config' -*/ -CREATE TABLE [phpbb_config] ( - [config_name] [varchar] (255) DEFAULT ('') NOT NULL , - [config_value] [varchar] (255) DEFAULT ('') NOT NULL , - [is_dynamic] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_config] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_config] PRIMARY KEY CLUSTERED - ( - [config_name] - ) ON [PRIMARY] -GO - -CREATE INDEX [is_dynamic] ON [phpbb_config]([is_dynamic]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_config_text' -*/ -CREATE TABLE [phpbb_config_text] ( - [config_name] [varchar] (255) DEFAULT ('') NOT NULL , - [config_value] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_config_text] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_config_text] PRIMARY KEY CLUSTERED - ( - [config_name] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_confirm' -*/ -CREATE TABLE [phpbb_confirm] ( - [confirm_id] [char] (32) DEFAULT ('') NOT NULL , - [session_id] [char] (32) DEFAULT ('') NOT NULL , - [confirm_type] [int] DEFAULT (0) NOT NULL , - [code] [varchar] (8) DEFAULT ('') NOT NULL , - [seed] [int] DEFAULT (0) NOT NULL , - [attempts] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED - ( - [session_id], - [confirm_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [confirm_type] ON [phpbb_confirm]([confirm_type]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_disallow' -*/ -CREATE TABLE [phpbb_disallow] ( - [disallow_id] [int] IDENTITY (1, 1) NOT NULL , - [disallow_username] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED - ( - [disallow_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_drafts' -*/ -CREATE TABLE [phpbb_drafts] ( - [draft_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [save_time] [int] DEFAULT (0) NOT NULL , - [draft_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [draft_message] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_drafts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_drafts] PRIMARY KEY CLUSTERED - ( - [draft_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_ext' -*/ -CREATE TABLE [phpbb_ext] ( - [ext_name] [varchar] (255) DEFAULT ('') NOT NULL , - [ext_active] [int] DEFAULT (0) NOT NULL , - [ext_state] [varchar] (8000) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [ext_name] ON [phpbb_ext]([ext_name]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_extensions' -*/ -CREATE TABLE [phpbb_extensions] ( - [extension_id] [int] IDENTITY (1, 1) NOT NULL , - [group_id] [int] DEFAULT (0) NOT NULL , - [extension] [varchar] (100) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_extensions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extensions] PRIMARY KEY CLUSTERED - ( - [extension_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_extension_groups' -*/ -CREATE TABLE [phpbb_extension_groups] ( - [group_id] [int] IDENTITY (1, 1) NOT NULL , - [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [cat_id] [int] DEFAULT (0) NOT NULL , - [allow_group] [int] DEFAULT (0) NOT NULL , - [download_mode] [int] DEFAULT (1) NOT NULL , - [upload_icon] [varchar] (255) DEFAULT ('') NOT NULL , - [max_filesize] [int] DEFAULT (0) NOT NULL , - [allowed_forums] [varchar] (8000) DEFAULT ('') NOT NULL , - [allow_in_pm] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_extension_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_extension_groups] PRIMARY KEY CLUSTERED - ( - [group_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums' -*/ -CREATE TABLE [phpbb_forums] ( - [forum_id] [int] IDENTITY (1, 1) NOT NULL , - [parent_id] [int] DEFAULT (0) NOT NULL , - [left_id] [int] DEFAULT (0) NOT NULL , - [right_id] [int] DEFAULT (0) NOT NULL , - [forum_parents] [text] DEFAULT ('') NOT NULL , - [forum_name] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_desc] [varchar] (4000) DEFAULT ('') NOT NULL , - [forum_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_desc_options] [int] DEFAULT (7) NOT NULL , - [forum_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [forum_link] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_password] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_style] [int] DEFAULT (0) NOT NULL , - [forum_image] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_rules] [varchar] (4000) DEFAULT ('') NOT NULL , - [forum_rules_link] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_rules_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_rules_options] [int] DEFAULT (7) NOT NULL , - [forum_rules_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [forum_topics_per_page] [int] DEFAULT (0) NOT NULL , - [forum_type] [int] DEFAULT (0) NOT NULL , - [forum_status] [int] DEFAULT (0) NOT NULL , - [forum_posts_approved] [int] DEFAULT (0) NOT NULL , - [forum_posts_unapproved] [int] DEFAULT (0) NOT NULL , - [forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL , - [forum_topics_approved] [int] DEFAULT (0) NOT NULL , - [forum_topics_unapproved] [int] DEFAULT (0) NOT NULL , - [forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL , - [forum_last_post_id] [int] DEFAULT (0) NOT NULL , - [forum_last_poster_id] [int] DEFAULT (0) NOT NULL , - [forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_last_post_time] [int] DEFAULT (0) NOT NULL , - [forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [forum_flags] [int] DEFAULT (32) NOT NULL , - [forum_options] [int] DEFAULT (0) NOT NULL , - [display_subforum_list] [int] DEFAULT (1) NOT NULL , - [display_on_index] [int] DEFAULT (1) NOT NULL , - [enable_indexing] [int] DEFAULT (1) NOT NULL , - [enable_icons] [int] DEFAULT (1) NOT NULL , - [enable_prune] [int] DEFAULT (0) NOT NULL , - [prune_next] [int] DEFAULT (0) NOT NULL , - [prune_days] [int] DEFAULT (0) NOT NULL , - [prune_viewed] [int] DEFAULT (0) NOT NULL , - [prune_freq] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_forums] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED - ( - [forum_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [left_right_id] ON [phpbb_forums]([left_id], [right_id]) ON [PRIMARY] -GO - -CREATE INDEX [forum_lastpost_id] ON [phpbb_forums]([forum_last_post_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums_access' -*/ -CREATE TABLE [phpbb_forums_access] ( - [forum_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [session_id] [char] (32) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_forums_access] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_access] PRIMARY KEY CLUSTERED - ( - [forum_id], - [user_id], - [session_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums_track' -*/ -CREATE TABLE [phpbb_forums_track] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_forums_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_forums_track] PRIMARY KEY CLUSTERED - ( - [user_id], - [forum_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_forums_watch' -*/ -CREATE TABLE [phpbb_forums_watch] ( - [forum_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_forums_watch]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_forums_watch]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [notify_stat] ON [phpbb_forums_watch]([notify_status]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_groups' -*/ -CREATE TABLE [phpbb_groups] ( - [group_id] [int] IDENTITY (1, 1) NOT NULL , - [group_type] [int] DEFAULT (1) NOT NULL , - [group_founder_manage] [int] DEFAULT (0) NOT NULL , - [group_skip_auth] [int] DEFAULT (0) NOT NULL , - [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [group_desc] [varchar] (4000) DEFAULT ('') NOT NULL , - [group_desc_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [group_desc_options] [int] DEFAULT (7) NOT NULL , - [group_desc_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [group_display] [int] DEFAULT (0) NOT NULL , - [group_avatar] [varchar] (255) DEFAULT ('') NOT NULL , - [group_avatar_type] [varchar] (255) DEFAULT ('') NOT NULL , - [group_avatar_width] [int] DEFAULT (0) NOT NULL , - [group_avatar_height] [int] DEFAULT (0) NOT NULL , - [group_rank] [int] DEFAULT (0) NOT NULL , - [group_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [group_sig_chars] [int] DEFAULT (0) NOT NULL , - [group_receive_pm] [int] DEFAULT (0) NOT NULL , - [group_message_limit] [int] DEFAULT (0) NOT NULL , - [group_max_recipients] [int] DEFAULT (0) NOT NULL , - [group_legend] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_groups] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED - ( - [group_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [group_legend_name] ON [phpbb_groups]([group_legend], [group_name]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_icons' -*/ -CREATE TABLE [phpbb_icons] ( - [icons_id] [int] IDENTITY (1, 1) NOT NULL , - [icons_url] [varchar] (255) DEFAULT ('') NOT NULL , - [icons_width] [int] DEFAULT (0) NOT NULL , - [icons_height] [int] DEFAULT (0) NOT NULL , - [icons_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_icons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_icons] PRIMARY KEY CLUSTERED - ( - [icons_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [display_on_posting] ON [phpbb_icons]([display_on_posting]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_lang' -*/ -CREATE TABLE [phpbb_lang] ( - [lang_id] [int] IDENTITY (1, 1) NOT NULL , - [lang_iso] [varchar] (30) DEFAULT ('') NOT NULL , - [lang_dir] [varchar] (30) DEFAULT ('') NOT NULL , - [lang_english_name] [varchar] (100) DEFAULT ('') NOT NULL , - [lang_local_name] [varchar] (255) DEFAULT ('') NOT NULL , - [lang_author] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_lang] PRIMARY KEY CLUSTERED - ( - [lang_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [lang_iso] ON [phpbb_lang]([lang_iso]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_log' -*/ -CREATE TABLE [phpbb_log] ( - [log_id] [int] IDENTITY (1, 1) NOT NULL , - [log_type] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [reportee_id] [int] DEFAULT (0) NOT NULL , - [log_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [log_time] [int] DEFAULT (0) NOT NULL , - [log_operation] [varchar] (4000) DEFAULT ('') NOT NULL , - [log_data] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_log] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_log] PRIMARY KEY CLUSTERED - ( - [log_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [log_type] ON [phpbb_log]([log_type]) ON [PRIMARY] -GO - -CREATE INDEX [log_time] ON [phpbb_log]([log_time]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_log]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_log]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [reportee_id] ON [phpbb_log]([reportee_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_log]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_login_attempts' -*/ -CREATE TABLE [phpbb_login_attempts] ( - [attempt_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [attempt_browser] [varchar] (150) DEFAULT ('') NOT NULL , - [attempt_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , - [attempt_time] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [username] [varchar] (255) DEFAULT (0) NOT NULL , - [username_clean] [varchar] (255) DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [att_ip] ON [phpbb_login_attempts]([attempt_ip], [attempt_time]) ON [PRIMARY] -GO - -CREATE INDEX [att_for] ON [phpbb_login_attempts]([attempt_forwarded_for], [attempt_time]) ON [PRIMARY] -GO - -CREATE INDEX [att_time] ON [phpbb_login_attempts]([attempt_time]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_login_attempts]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_moderator_cache' -*/ -CREATE TABLE [phpbb_moderator_cache] ( - [forum_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [username] [varchar] (255) DEFAULT ('') NOT NULL , - [group_id] [int] DEFAULT (0) NOT NULL , - [group_name] [varchar] (255) DEFAULT ('') NOT NULL , - [display_on_index] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [disp_idx] ON [phpbb_moderator_cache]([display_on_index]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_moderator_cache]([forum_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_migrations' -*/ -CREATE TABLE [phpbb_migrations] ( - [migration_name] [varchar] (255) DEFAULT ('') NOT NULL , - [migration_depends_on] [varchar] (8000) DEFAULT ('') NOT NULL , - [migration_schema_done] [int] DEFAULT (0) NOT NULL , - [migration_data_done] [int] DEFAULT (0) NOT NULL , - [migration_data_state] [varchar] (8000) DEFAULT ('') NOT NULL , - [migration_start_time] [int] DEFAULT (0) NOT NULL , - [migration_end_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_migrations] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_migrations] PRIMARY KEY CLUSTERED - ( - [migration_name] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_modules' -*/ -CREATE TABLE [phpbb_modules] ( - [module_id] [int] IDENTITY (1, 1) NOT NULL , - [module_enabled] [int] DEFAULT (1) NOT NULL , - [module_display] [int] DEFAULT (1) NOT NULL , - [module_basename] [varchar] (255) DEFAULT ('') NOT NULL , - [module_class] [varchar] (10) DEFAULT ('') NOT NULL , - [parent_id] [int] DEFAULT (0) NOT NULL , - [left_id] [int] DEFAULT (0) NOT NULL , - [right_id] [int] DEFAULT (0) NOT NULL , - [module_langname] [varchar] (255) DEFAULT ('') NOT NULL , - [module_mode] [varchar] (255) DEFAULT ('') NOT NULL , - [module_auth] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_modules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_modules] PRIMARY KEY CLUSTERED - ( - [module_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [left_right_id] ON [phpbb_modules]([left_id], [right_id]) ON [PRIMARY] -GO - -CREATE INDEX [module_enabled] ON [phpbb_modules]([module_enabled]) ON [PRIMARY] -GO - -CREATE INDEX [class_left_id] ON [phpbb_modules]([module_class], [left_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_notification_types' -*/ -CREATE TABLE [phpbb_notification_types] ( - [notification_type_id] [int] IDENTITY (1, 1) NOT NULL , - [notification_type_name] [varchar] (255) DEFAULT ('') NOT NULL , - [notification_type_enabled] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_notification_types] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_notification_types] PRIMARY KEY CLUSTERED - ( - [notification_type_id] - ) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [type] ON [phpbb_notification_types]([notification_type_name]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_notifications' -*/ -CREATE TABLE [phpbb_notifications] ( - [notification_id] [int] IDENTITY (1, 1) NOT NULL , - [notification_type_id] [int] DEFAULT (0) NOT NULL , - [item_id] [int] DEFAULT (0) NOT NULL , - [item_parent_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [notification_read] [int] DEFAULT (0) NOT NULL , - [notification_time] [int] DEFAULT (1) NOT NULL , - [notification_data] [varchar] (4000) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_notifications] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_notifications] PRIMARY KEY CLUSTERED - ( - [notification_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [item_ident] ON [phpbb_notifications]([notification_type_id], [item_id]) ON [PRIMARY] -GO - -CREATE INDEX [user] ON [phpbb_notifications]([user_id], [notification_read]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_oauth_accounts' -*/ -CREATE TABLE [phpbb_oauth_accounts] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [provider] [varchar] (255) DEFAULT ('') NOT NULL , - [oauth_provider_id] [varchar] (4000) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_oauth_accounts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_oauth_accounts] PRIMARY KEY CLUSTERED - ( - [user_id], - [provider] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_oauth_tokens' -*/ -CREATE TABLE [phpbb_oauth_tokens] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [session_id] [char] (32) DEFAULT ('') NOT NULL , - [provider] [varchar] (255) DEFAULT ('') NOT NULL , - [oauth_token] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_oauth_tokens]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [provider] ON [phpbb_oauth_tokens]([provider]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_poll_options' -*/ -CREATE TABLE [phpbb_poll_options] ( - [poll_option_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [poll_option_text] [varchar] (4000) DEFAULT ('') NOT NULL , - [poll_option_total] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [poll_opt_id] ON [phpbb_poll_options]([poll_option_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_poll_options]([topic_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_poll_votes' -*/ -CREATE TABLE [phpbb_poll_votes] ( - [topic_id] [int] DEFAULT (0) NOT NULL , - [poll_option_id] [int] DEFAULT (0) NOT NULL , - [vote_user_id] [int] DEFAULT (0) NOT NULL , - [vote_user_ip] [varchar] (40) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_poll_votes]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [vote_user_id] ON [phpbb_poll_votes]([vote_user_id]) ON [PRIMARY] -GO - -CREATE INDEX [vote_user_ip] ON [phpbb_poll_votes]([vote_user_ip]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_posts' -*/ -CREATE TABLE [phpbb_posts] ( - [post_id] [int] IDENTITY (1, 1) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [poster_id] [int] DEFAULT (0) NOT NULL , - [icon_id] [int] DEFAULT (0) NOT NULL , - [poster_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [post_time] [int] DEFAULT (0) NOT NULL , - [post_visibility] [int] DEFAULT (0) NOT NULL , - [post_reported] [int] DEFAULT (0) NOT NULL , - [enable_bbcode] [int] DEFAULT (1) NOT NULL , - [enable_smilies] [int] DEFAULT (1) NOT NULL , - [enable_magic_url] [int] DEFAULT (1) NOT NULL , - [enable_sig] [int] DEFAULT (1) NOT NULL , - [post_username] [varchar] (255) DEFAULT ('') NOT NULL , - [post_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [post_text] [text] DEFAULT ('') NOT NULL , - [post_checksum] [varchar] (32) DEFAULT ('') NOT NULL , - [post_attachment] [int] DEFAULT (0) NOT NULL , - [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [post_postcount] [int] DEFAULT (1) NOT NULL , - [post_edit_time] [int] DEFAULT (0) NOT NULL , - [post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [post_edit_user] [int] DEFAULT (0) NOT NULL , - [post_edit_count] [int] DEFAULT (0) NOT NULL , - [post_edit_locked] [int] DEFAULT (0) NOT NULL , - [post_delete_time] [int] DEFAULT (0) NOT NULL , - [post_delete_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [post_delete_user] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_posts] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED - ( - [post_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_posts]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_posts]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [poster_ip] ON [phpbb_posts]([poster_ip]) ON [PRIMARY] -GO - -CREATE INDEX [poster_id] ON [phpbb_posts]([poster_id]) ON [PRIMARY] -GO - -CREATE INDEX [post_visibility] ON [phpbb_posts]([post_visibility]) ON [PRIMARY] -GO - -CREATE INDEX [post_username] ON [phpbb_posts]([post_username]) ON [PRIMARY] -GO - -CREATE INDEX [tid_post_time] ON [phpbb_posts]([topic_id], [post_time]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs' -*/ -CREATE TABLE [phpbb_privmsgs] ( - [msg_id] [int] IDENTITY (1, 1) NOT NULL , - [root_level] [int] DEFAULT (0) NOT NULL , - [author_id] [int] DEFAULT (0) NOT NULL , - [icon_id] [int] DEFAULT (0) NOT NULL , - [author_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [message_time] [int] DEFAULT (0) NOT NULL , - [enable_bbcode] [int] DEFAULT (1) NOT NULL , - [enable_smilies] [int] DEFAULT (1) NOT NULL , - [enable_magic_url] [int] DEFAULT (1) NOT NULL , - [enable_sig] [int] DEFAULT (1) NOT NULL , - [message_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [message_text] [text] DEFAULT ('') NOT NULL , - [message_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [message_edit_user] [int] DEFAULT (0) NOT NULL , - [message_attachment] [int] DEFAULT (0) NOT NULL , - [bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [message_edit_time] [int] DEFAULT (0) NOT NULL , - [message_edit_count] [int] DEFAULT (0) NOT NULL , - [to_address] [varchar] (4000) DEFAULT ('') NOT NULL , - [bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL , - [message_reported] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED - ( - [msg_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [author_ip] ON [phpbb_privmsgs]([author_ip]) ON [PRIMARY] -GO - -CREATE INDEX [message_time] ON [phpbb_privmsgs]([message_time]) ON [PRIMARY] -GO - -CREATE INDEX [author_id] ON [phpbb_privmsgs]([author_id]) ON [PRIMARY] -GO - -CREATE INDEX [root_level] ON [phpbb_privmsgs]([root_level]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs_folder' -*/ -CREATE TABLE [phpbb_privmsgs_folder] ( - [folder_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [folder_name] [varchar] (255) DEFAULT ('') NOT NULL , - [pm_count] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_privmsgs_folder] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_folder] PRIMARY KEY CLUSTERED - ( - [folder_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_privmsgs_folder]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs_rules' -*/ -CREATE TABLE [phpbb_privmsgs_rules] ( - [rule_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [rule_check] [int] DEFAULT (0) NOT NULL , - [rule_connection] [int] DEFAULT (0) NOT NULL , - [rule_string] [varchar] (255) DEFAULT ('') NOT NULL , - [rule_user_id] [int] DEFAULT (0) NOT NULL , - [rule_group_id] [int] DEFAULT (0) NOT NULL , - [rule_action] [int] DEFAULT (0) NOT NULL , - [rule_folder_id] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_privmsgs_rules] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_privmsgs_rules] PRIMARY KEY CLUSTERED - ( - [rule_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_privmsgs_rules]([user_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_privmsgs_to' -*/ -CREATE TABLE [phpbb_privmsgs_to] ( - [msg_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [author_id] [int] DEFAULT (0) NOT NULL , - [pm_deleted] [int] DEFAULT (0) NOT NULL , - [pm_new] [int] DEFAULT (1) NOT NULL , - [pm_unread] [int] DEFAULT (1) NOT NULL , - [pm_replied] [int] DEFAULT (0) NOT NULL , - [pm_marked] [int] DEFAULT (0) NOT NULL , - [pm_forwarded] [int] DEFAULT (0) NOT NULL , - [folder_id] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [msg_id] ON [phpbb_privmsgs_to]([msg_id]) ON [PRIMARY] -GO - -CREATE INDEX [author_id] ON [phpbb_privmsgs_to]([author_id]) ON [PRIMARY] -GO - -CREATE INDEX [usr_flder_id] ON [phpbb_privmsgs_to]([user_id], [folder_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_fields' -*/ -CREATE TABLE [phpbb_profile_fields] ( - [field_id] [int] IDENTITY (1, 1) NOT NULL , - [field_name] [varchar] (255) DEFAULT ('') NOT NULL , - [field_type] [varchar] (100) DEFAULT ('') NOT NULL , - [field_ident] [varchar] (20) DEFAULT ('') NOT NULL , - [field_length] [varchar] (20) DEFAULT ('') NOT NULL , - [field_minlen] [varchar] (255) DEFAULT ('') NOT NULL , - [field_maxlen] [varchar] (255) DEFAULT ('') NOT NULL , - [field_novalue] [varchar] (255) DEFAULT ('') NOT NULL , - [field_default_value] [varchar] (255) DEFAULT ('') NOT NULL , - [field_validation] [varchar] (20) DEFAULT ('') NOT NULL , - [field_required] [int] DEFAULT (0) NOT NULL , - [field_show_novalue] [int] DEFAULT (0) NOT NULL , - [field_show_on_reg] [int] DEFAULT (0) NOT NULL , - [field_show_on_pm] [int] DEFAULT (0) NOT NULL , - [field_show_on_vt] [int] DEFAULT (0) NOT NULL , - [field_show_on_ml] [int] DEFAULT (0) NOT NULL , - [field_show_profile] [int] DEFAULT (0) NOT NULL , - [field_hide] [int] DEFAULT (0) NOT NULL , - [field_no_view] [int] DEFAULT (0) NOT NULL , - [field_active] [int] DEFAULT (0) NOT NULL , - [field_order] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_fields] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields] PRIMARY KEY CLUSTERED - ( - [field_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [fld_type] ON [phpbb_profile_fields]([field_type]) ON [PRIMARY] -GO - -CREATE INDEX [fld_ordr] ON [phpbb_profile_fields]([field_order]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_fields_data' -*/ -CREATE TABLE [phpbb_profile_fields_data] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [pf_phpbb_location] [varchar] (255) DEFAULT ('') NOT NULL , - [pf_phpbb_interests] [varchar] (4000) DEFAULT ('') NOT NULL , - [pf_phpbb_occupation] [varchar] (4000) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_fields_data] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_data] PRIMARY KEY CLUSTERED - ( - [user_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_fields_lang' -*/ -CREATE TABLE [phpbb_profile_fields_lang] ( - [field_id] [int] DEFAULT (0) NOT NULL , - [lang_id] [int] DEFAULT (0) NOT NULL , - [option_id] [int] DEFAULT (0) NOT NULL , - [field_type] [varchar] (100) DEFAULT ('') NOT NULL , - [lang_value] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_fields_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_fields_lang] PRIMARY KEY CLUSTERED - ( - [field_id], - [lang_id], - [option_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_profile_lang' -*/ -CREATE TABLE [phpbb_profile_lang] ( - [field_id] [int] DEFAULT (0) NOT NULL , - [lang_id] [int] DEFAULT (0) NOT NULL , - [lang_name] [varchar] (255) DEFAULT ('') NOT NULL , - [lang_explain] [varchar] (4000) DEFAULT ('') NOT NULL , - [lang_default_value] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_profile_lang] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_profile_lang] PRIMARY KEY CLUSTERED - ( - [field_id], - [lang_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_ranks' -*/ -CREATE TABLE [phpbb_ranks] ( - [rank_id] [int] IDENTITY (1, 1) NOT NULL , - [rank_title] [varchar] (255) DEFAULT ('') NOT NULL , - [rank_min] [int] DEFAULT (0) NOT NULL , - [rank_special] [int] DEFAULT (0) NOT NULL , - [rank_image] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED - ( - [rank_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_reports' -*/ -CREATE TABLE [phpbb_reports] ( - [report_id] [int] IDENTITY (1, 1) NOT NULL , - [reason_id] [int] DEFAULT (0) NOT NULL , - [post_id] [int] DEFAULT (0) NOT NULL , - [pm_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [user_notify] [int] DEFAULT (0) NOT NULL , - [report_closed] [int] DEFAULT (0) NOT NULL , - [report_time] [int] DEFAULT (0) NOT NULL , - [report_text] [text] DEFAULT ('') NOT NULL , - [reported_post_text] [text] DEFAULT ('') NOT NULL , - [reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [reported_post_enable_magic_url] [int] DEFAULT (1) NOT NULL , - [reported_post_enable_smilies] [int] DEFAULT (1) NOT NULL , - [reported_post_enable_bbcode] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_reports] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports] PRIMARY KEY CLUSTERED - ( - [report_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [post_id] ON [phpbb_reports]([post_id]) ON [PRIMARY] -GO - -CREATE INDEX [pm_id] ON [phpbb_reports]([pm_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_reports_reasons' -*/ -CREATE TABLE [phpbb_reports_reasons] ( - [reason_id] [int] IDENTITY (1, 1) NOT NULL , - [reason_title] [varchar] (255) DEFAULT ('') NOT NULL , - [reason_description] [text] DEFAULT ('') NOT NULL , - [reason_order] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_reports_reasons] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_reports_reasons] PRIMARY KEY CLUSTERED - ( - [reason_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_search_results' -*/ -CREATE TABLE [phpbb_search_results] ( - [search_key] [varchar] (32) DEFAULT ('') NOT NULL , - [search_time] [int] DEFAULT (0) NOT NULL , - [search_keywords] [text] DEFAULT ('') NOT NULL , - [search_authors] [text] DEFAULT ('') NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED - ( - [search_key] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_search_wordlist' -*/ -CREATE TABLE [phpbb_search_wordlist] ( - [word_id] [int] IDENTITY (1, 1) NOT NULL , - [word_text] [varchar] (255) DEFAULT ('') NOT NULL , - [word_common] [int] DEFAULT (0) NOT NULL , - [word_count] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED - ( - [word_id] - ) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [wrd_txt] ON [phpbb_search_wordlist]([word_text]) ON [PRIMARY] -GO - -CREATE INDEX [wrd_cnt] ON [phpbb_search_wordlist]([word_count]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_search_wordmatch' -*/ -CREATE TABLE [phpbb_search_wordmatch] ( - [post_id] [int] DEFAULT (0) NOT NULL , - [word_id] [int] DEFAULT (0) NOT NULL , - [title_match] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [unq_mtch] ON [phpbb_search_wordmatch]([word_id], [post_id], [title_match]) ON [PRIMARY] -GO - -CREATE INDEX [word_id] ON [phpbb_search_wordmatch]([word_id]) ON [PRIMARY] -GO - -CREATE INDEX [post_id] ON [phpbb_search_wordmatch]([post_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_sessions' -*/ -CREATE TABLE [phpbb_sessions] ( - [session_id] [char] (32) DEFAULT ('') NOT NULL , - [session_user_id] [int] DEFAULT (0) NOT NULL , - [session_forum_id] [int] DEFAULT (0) NOT NULL , - [session_last_visit] [int] DEFAULT (0) NOT NULL , - [session_start] [int] DEFAULT (0) NOT NULL , - [session_time] [int] DEFAULT (0) NOT NULL , - [session_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [session_browser] [varchar] (150) DEFAULT ('') NOT NULL , - [session_forwarded_for] [varchar] (255) DEFAULT ('') NOT NULL , - [session_page] [varchar] (255) DEFAULT ('') NOT NULL , - [session_viewonline] [int] DEFAULT (1) NOT NULL , - [session_autologin] [int] DEFAULT (0) NOT NULL , - [session_admin] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_sessions] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions] PRIMARY KEY CLUSTERED - ( - [session_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [session_time] ON [phpbb_sessions]([session_time]) ON [PRIMARY] -GO - -CREATE INDEX [session_user_id] ON [phpbb_sessions]([session_user_id]) ON [PRIMARY] -GO - -CREATE INDEX [session_fid] ON [phpbb_sessions]([session_forum_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_sessions_keys' -*/ -CREATE TABLE [phpbb_sessions_keys] ( - [key_id] [char] (32) DEFAULT ('') NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [last_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [last_login] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_sessions_keys] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sessions_keys] PRIMARY KEY CLUSTERED - ( - [key_id], - [user_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [last_login] ON [phpbb_sessions_keys]([last_login]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_sitelist' -*/ -CREATE TABLE [phpbb_sitelist] ( - [site_id] [int] IDENTITY (1, 1) NOT NULL , - [site_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [site_hostname] [varchar] (255) DEFAULT ('') NOT NULL , - [ip_exclude] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_sitelist] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_sitelist] PRIMARY KEY CLUSTERED - ( - [site_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_smilies' -*/ -CREATE TABLE [phpbb_smilies] ( - [smiley_id] [int] IDENTITY (1, 1) NOT NULL , - [code] [varchar] (50) DEFAULT ('') NOT NULL , - [emotion] [varchar] (50) DEFAULT ('') NOT NULL , - [smiley_url] [varchar] (50) DEFAULT ('') NOT NULL , - [smiley_width] [int] DEFAULT (0) NOT NULL , - [smiley_height] [int] DEFAULT (0) NOT NULL , - [smiley_order] [int] DEFAULT (0) NOT NULL , - [display_on_posting] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED - ( - [smiley_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [display_on_post] ON [phpbb_smilies]([display_on_posting]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_styles' -*/ -CREATE TABLE [phpbb_styles] ( - [style_id] [int] IDENTITY (1, 1) NOT NULL , - [style_name] [varchar] (255) DEFAULT ('') NOT NULL , - [style_copyright] [varchar] (255) DEFAULT ('') NOT NULL , - [style_active] [int] DEFAULT (1) NOT NULL , - [style_path] [varchar] (100) DEFAULT ('') NOT NULL , - [bbcode_bitfield] [varchar] (255) DEFAULT ('kNg=') NOT NULL , - [style_parent_id] [int] DEFAULT (0) NOT NULL , - [style_parent_tree] [varchar] (8000) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_styles] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_styles] PRIMARY KEY CLUSTERED - ( - [style_id] - ) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [style_name] ON [phpbb_styles]([style_name]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_teampage' -*/ -CREATE TABLE [phpbb_teampage] ( - [teampage_id] [int] IDENTITY (1, 1) NOT NULL , - [group_id] [int] DEFAULT (0) NOT NULL , - [teampage_name] [varchar] (255) DEFAULT ('') NOT NULL , - [teampage_position] [int] DEFAULT (0) NOT NULL , - [teampage_parent] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_teampage] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_teampage] PRIMARY KEY CLUSTERED - ( - [teampage_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics' -*/ -CREATE TABLE [phpbb_topics] ( - [topic_id] [int] IDENTITY (1, 1) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [icon_id] [int] DEFAULT (0) NOT NULL , - [topic_attachment] [int] DEFAULT (0) NOT NULL , - [topic_visibility] [int] DEFAULT (0) NOT NULL , - [topic_reported] [int] DEFAULT (0) NOT NULL , - [topic_title] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_poster] [int] DEFAULT (0) NOT NULL , - [topic_time] [int] DEFAULT (0) NOT NULL , - [topic_time_limit] [int] DEFAULT (0) NOT NULL , - [topic_views] [int] DEFAULT (0) NOT NULL , - [topic_posts_approved] [int] DEFAULT (0) NOT NULL , - [topic_posts_unapproved] [int] DEFAULT (0) NOT NULL , - [topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL , - [topic_status] [int] DEFAULT (0) NOT NULL , - [topic_type] [int] DEFAULT (0) NOT NULL , - [topic_first_post_id] [int] DEFAULT (0) NOT NULL , - [topic_first_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_first_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [topic_last_post_id] [int] DEFAULT (0) NOT NULL , - [topic_last_poster_id] [int] DEFAULT (0) NOT NULL , - [topic_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [topic_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_last_post_time] [int] DEFAULT (0) NOT NULL , - [topic_last_view_time] [int] DEFAULT (0) NOT NULL , - [topic_moved_id] [int] DEFAULT (0) NOT NULL , - [topic_bumped] [int] DEFAULT (0) NOT NULL , - [topic_bumper] [int] DEFAULT (0) NOT NULL , - [poll_title] [varchar] (255) DEFAULT ('') NOT NULL , - [poll_start] [int] DEFAULT (0) NOT NULL , - [poll_length] [int] DEFAULT (0) NOT NULL , - [poll_max_options] [int] DEFAULT (1) NOT NULL , - [poll_last_vote] [int] DEFAULT (0) NOT NULL , - [poll_vote_change] [int] DEFAULT (0) NOT NULL , - [topic_delete_time] [int] DEFAULT (0) NOT NULL , - [topic_delete_reason] [varchar] (255) DEFAULT ('') NOT NULL , - [topic_delete_user] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_topics] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED - ( - [topic_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_topics]([forum_id]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id_type] ON [phpbb_topics]([forum_id], [topic_type]) ON [PRIMARY] -GO - -CREATE INDEX [last_post_time] ON [phpbb_topics]([topic_last_post_time]) ON [PRIMARY] -GO - -CREATE INDEX [topic_visibility] ON [phpbb_topics]([topic_visibility]) ON [PRIMARY] -GO - -CREATE INDEX [forum_appr_last] ON [phpbb_topics]([forum_id], [topic_visibility], [topic_last_post_id]) ON [PRIMARY] -GO - -CREATE INDEX [fid_time_moved] ON [phpbb_topics]([forum_id], [topic_last_post_time], [topic_moved_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics_track' -*/ -CREATE TABLE [phpbb_topics_track] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [forum_id] [int] DEFAULT (0) NOT NULL , - [mark_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_topics_track] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_track] PRIMARY KEY CLUSTERED - ( - [user_id], - [topic_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_topics_track]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [forum_id] ON [phpbb_topics_track]([forum_id]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics_posted' -*/ -CREATE TABLE [phpbb_topics_posted] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [topic_id] [int] DEFAULT (0) NOT NULL , - [topic_posted] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED - ( - [user_id], - [topic_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_topics_watch' -*/ -CREATE TABLE [phpbb_topics_watch] ( - [topic_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [notify_status] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [topic_id] ON [phpbb_topics_watch]([topic_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_topics_watch]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [notify_stat] ON [phpbb_topics_watch]([notify_status]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_user_notifications' -*/ -CREATE TABLE [phpbb_user_notifications] ( - [item_type] [varchar] (255) DEFAULT ('') NOT NULL , - [item_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [method] [varchar] (255) DEFAULT ('') NOT NULL , - [notify] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_user_group' -*/ -CREATE TABLE [phpbb_user_group] ( - [group_id] [int] DEFAULT (0) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [group_leader] [int] DEFAULT (0) NOT NULL , - [user_pending] [int] DEFAULT (1) NOT NULL -) ON [PRIMARY] -GO - -CREATE INDEX [group_id] ON [phpbb_user_group]([group_id]) ON [PRIMARY] -GO - -CREATE INDEX [user_id] ON [phpbb_user_group]([user_id]) ON [PRIMARY] -GO - -CREATE INDEX [group_leader] ON [phpbb_user_group]([group_leader]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_users' -*/ -CREATE TABLE [phpbb_users] ( - [user_id] [int] IDENTITY (1, 1) NOT NULL , - [user_type] [int] DEFAULT (0) NOT NULL , - [group_id] [int] DEFAULT (3) NOT NULL , - [user_permissions] [text] DEFAULT ('') NOT NULL , - [user_perm_from] [int] DEFAULT (0) NOT NULL , - [user_ip] [varchar] (40) DEFAULT ('') NOT NULL , - [user_regdate] [int] DEFAULT (0) NOT NULL , - [username] [varchar] (255) DEFAULT ('') NOT NULL , - [username_clean] [varchar] (255) DEFAULT ('') NOT NULL , - [user_password] [varchar] (255) DEFAULT ('') NOT NULL , - [user_passchg] [int] DEFAULT (0) NOT NULL , - [user_pass_convert] [int] DEFAULT (0) NOT NULL , - [user_actkey] [varchar] (32) DEFAULT ('') NOT NULL , - [user_newpasswd] [varchar] (255) DEFAULT ('') NOT NULL , - [user_email] [varchar] (100) DEFAULT ('') NOT NULL , - [user_email_hash] [float] DEFAULT (0) NOT NULL , - [user_birthday] [varchar] (10) DEFAULT ('') NOT NULL , - [user_lastvisit] [int] DEFAULT (0) NOT NULL , - [user_lastmark] [int] DEFAULT (0) NOT NULL , - [user_lastpost_time] [int] DEFAULT (0) NOT NULL , - [user_lastpage] [varchar] (200) DEFAULT ('') NOT NULL , - [user_last_confirm_key] [varchar] (10) DEFAULT ('') NOT NULL , - [user_last_search] [int] DEFAULT (0) NOT NULL , - [user_warnings] [int] DEFAULT (0) NOT NULL , - [user_last_warning] [int] DEFAULT (0) NOT NULL , - [user_login_attempts] [int] DEFAULT (0) NOT NULL , - [user_inactive_reason] [int] DEFAULT (0) NOT NULL , - [user_inactive_time] [int] DEFAULT (0) NOT NULL , - [user_posts] [int] DEFAULT (0) NOT NULL , - [user_lang] [varchar] (30) DEFAULT ('') NOT NULL , - [user_timezone] [varchar] (100) DEFAULT ('UTC') NOT NULL , - [user_dateformat] [varchar] (30) DEFAULT ('d M Y H:i') NOT NULL , - [user_style] [int] DEFAULT (0) NOT NULL , - [user_rank] [int] DEFAULT (0) NOT NULL , - [user_colour] [varchar] (6) DEFAULT ('') NOT NULL , - [user_new_privmsg] [int] DEFAULT (0) NOT NULL , - [user_unread_privmsg] [int] DEFAULT (0) NOT NULL , - [user_last_privmsg] [int] DEFAULT (0) NOT NULL , - [user_message_rules] [int] DEFAULT (0) NOT NULL , - [user_full_folder] [int] DEFAULT (-3) NOT NULL , - [user_emailtime] [int] DEFAULT (0) NOT NULL , - [user_topic_show_days] [int] DEFAULT (0) NOT NULL , - [user_topic_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , - [user_topic_sortby_dir] [varchar] (1) DEFAULT ('d') NOT NULL , - [user_post_show_days] [int] DEFAULT (0) NOT NULL , - [user_post_sortby_type] [varchar] (1) DEFAULT ('t') NOT NULL , - [user_post_sortby_dir] [varchar] (1) DEFAULT ('a') NOT NULL , - [user_notify] [int] DEFAULT (0) NOT NULL , - [user_notify_pm] [int] DEFAULT (1) NOT NULL , - [user_notify_type] [int] DEFAULT (0) NOT NULL , - [user_allow_pm] [int] DEFAULT (1) NOT NULL , - [user_allow_viewonline] [int] DEFAULT (1) NOT NULL , - [user_allow_viewemail] [int] DEFAULT (1) NOT NULL , - [user_allow_massemail] [int] DEFAULT (1) NOT NULL , - [user_options] [int] DEFAULT (230271) NOT NULL , - [user_avatar] [varchar] (255) DEFAULT ('') NOT NULL , - [user_avatar_type] [varchar] (255) DEFAULT ('') NOT NULL , - [user_avatar_width] [int] DEFAULT (0) NOT NULL , - [user_avatar_height] [int] DEFAULT (0) NOT NULL , - [user_sig] [text] DEFAULT ('') NOT NULL , - [user_sig_bbcode_uid] [varchar] (8) DEFAULT ('') NOT NULL , - [user_sig_bbcode_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , - [user_icq] [varchar] (15) DEFAULT ('') NOT NULL , - [user_aim] [varchar] (255) DEFAULT ('') NOT NULL , - [user_yim] [varchar] (255) DEFAULT ('') NOT NULL , - [user_msnm] [varchar] (255) DEFAULT ('') NOT NULL , - [user_jabber] [varchar] (255) DEFAULT ('') NOT NULL , - [user_website] [varchar] (200) DEFAULT ('') NOT NULL , - [user_form_salt] [varchar] (32) DEFAULT ('') NOT NULL , - [user_new] [int] DEFAULT (1) NOT NULL , - [user_reminded] [int] DEFAULT (0) NOT NULL , - [user_reminded_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -ALTER TABLE [phpbb_users] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED - ( - [user_id] - ) ON [PRIMARY] -GO - -CREATE INDEX [user_birthday] ON [phpbb_users]([user_birthday]) ON [PRIMARY] -GO - -CREATE INDEX [user_email_hash] ON [phpbb_users]([user_email_hash]) ON [PRIMARY] -GO - -CREATE INDEX [user_type] ON [phpbb_users]([user_type]) ON [PRIMARY] -GO - -CREATE UNIQUE INDEX [username_clean] ON [phpbb_users]([username_clean]) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_warnings' -*/ -CREATE TABLE [phpbb_warnings] ( - [warning_id] [int] IDENTITY (1, 1) NOT NULL , - [user_id] [int] DEFAULT (0) NOT NULL , - [post_id] [int] DEFAULT (0) NOT NULL , - [log_id] [int] DEFAULT (0) NOT NULL , - [warning_time] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_warnings] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_warnings] PRIMARY KEY CLUSTERED - ( - [warning_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_words' -*/ -CREATE TABLE [phpbb_words] ( - [word_id] [int] IDENTITY (1, 1) NOT NULL , - [word] [varchar] (255) DEFAULT ('') NOT NULL , - [replacement] [varchar] (255) DEFAULT ('') NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_words] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED - ( - [word_id] - ) ON [PRIMARY] -GO - - -/* - Table: 'phpbb_zebra' -*/ -CREATE TABLE [phpbb_zebra] ( - [user_id] [int] DEFAULT (0) NOT NULL , - [zebra_id] [int] DEFAULT (0) NOT NULL , - [friend] [int] DEFAULT (0) NOT NULL , - [foe] [int] DEFAULT (0) NOT NULL -) ON [PRIMARY] -GO - -ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD - CONSTRAINT [PK_phpbb_zebra] PRIMARY KEY CLUSTERED - ( - [user_id], - [zebra_id] - ) ON [PRIMARY] -GO - - diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql deleted file mode 100644 index 93a90e3a7c..0000000000 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ /dev/null @@ -1,1081 +0,0 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, - post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - physical_filename varbinary(255) DEFAULT '' NOT NULL, - real_filename varbinary(255) DEFAULT '' NOT NULL, - download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - attach_comment blob NOT NULL, - extension varbinary(100) DEFAULT '' NOT NULL, - mimetype varbinary(100) DEFAULT '' NOT NULL, - filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, - thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (attach_id), - KEY filetime (filetime), - KEY post_msg_id (post_msg_id), - KEY topic_id (topic_id), - KEY poster_id (poster_id), - KEY is_orphan (is_orphan) -); - - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY group_id (group_id), - KEY auth_opt_id (auth_option_id), - KEY auth_role_id (auth_role_id) -); - - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, - auth_option varbinary(50) DEFAULT '' NOT NULL, - is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (auth_option_id), - UNIQUE auth_option (auth_option) -); - - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id mediumint(8) UNSIGNED NOT NULL auto_increment, - role_name blob NOT NULL, - role_description blob NOT NULL, - role_type varbinary(10) DEFAULT '' NOT NULL, - role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id), - KEY role_type (role_type), - KEY role_order (role_order) -); - - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id, auth_option_id), - KEY ath_op_id (auth_option_id) -); - - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY user_id (user_id), - KEY auth_option_id (auth_option_id), - KEY auth_role_id (auth_role_id) -); - - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, - ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - ban_ip varbinary(40) DEFAULT '' NOT NULL, - ban_email blob NOT NULL, - ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ban_reason blob NOT NULL, - ban_give_reason blob NOT NULL, - PRIMARY KEY (ban_id), - KEY ban_end (ban_end), - KEY ban_user (ban_userid, ban_exclude), - KEY ban_email (ban_email(255), ban_exclude), - KEY ban_ip (ban_ip, ban_exclude) -); - - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_tag varbinary(16) DEFAULT '' NOT NULL, - bbcode_helpline blob NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_match blob NOT NULL, - bbcode_tpl mediumblob NOT NULL, - first_pass_match mediumblob NOT NULL, - first_pass_replace mediumblob NOT NULL, - second_pass_match mediumblob NOT NULL, - second_pass_replace mediumblob NOT NULL, - PRIMARY KEY (bbcode_id), - KEY display_on_post (display_on_posting) -); - - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id, user_id) -); - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, - bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - bot_name blob NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - bot_agent varbinary(255) DEFAULT '' NOT NULL, - bot_ip varbinary(255) DEFAULT '' NOT NULL, - PRIMARY KEY (bot_id), - KEY bot_active (bot_active) -); - - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name varbinary(255) DEFAULT '' NOT NULL, - config_value blob NOT NULL, - is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (config_name), - KEY is_dynamic (is_dynamic) -); - - -# Table: 'phpbb_config_text' -CREATE TABLE phpbb_config_text ( - config_name varbinary(255) DEFAULT '' NOT NULL, - config_value mediumblob NOT NULL, - PRIMARY KEY (config_name) -); - - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id binary(32) DEFAULT '' NOT NULL, - session_id binary(32) DEFAULT '' NOT NULL, - confirm_type tinyint(3) DEFAULT '0' NOT NULL, - code varbinary(8) DEFAULT '' NOT NULL, - seed int(10) UNSIGNED DEFAULT '0' NOT NULL, - attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id, confirm_id), - KEY confirm_type (confirm_type) -); - - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, - disallow_username blob NOT NULL, - PRIMARY KEY (disallow_id) -); - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - draft_subject blob NOT NULL, - draft_message mediumblob NOT NULL, - PRIMARY KEY (draft_id), - KEY save_time (save_time) -); - - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name varbinary(255) DEFAULT '' NOT NULL, - ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ext_state blob NOT NULL, - UNIQUE ext_name (ext_name) -); - - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - extension varbinary(100) DEFAULT '' NOT NULL, - PRIMARY KEY (extension_id) -); - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_name blob NOT NULL, - cat_id tinyint(2) DEFAULT '0' NOT NULL, - allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - upload_icon varbinary(255) DEFAULT '' NOT NULL, - max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - allowed_forums blob NOT NULL, - allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id) -); - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_parents mediumblob NOT NULL, - forum_name blob NOT NULL, - forum_desc blob NOT NULL, - forum_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, - forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_desc_uid varbinary(8) DEFAULT '' NOT NULL, - forum_link blob NOT NULL, - forum_password blob NOT NULL, - forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_image varbinary(255) DEFAULT '' NOT NULL, - forum_rules blob NOT NULL, - forum_rules_link blob NOT NULL, - forum_rules_bitfield varbinary(255) DEFAULT '' NOT NULL, - forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_rules_uid varbinary(8) DEFAULT '' NOT NULL, - forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, - forum_type tinyint(4) DEFAULT '0' NOT NULL, - forum_status tinyint(4) DEFAULT '0' NOT NULL, - forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_subject blob NOT NULL, - forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_name blob NOT NULL, - forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, - forum_flags tinyint(4) DEFAULT '32' NOT NULL, - forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, - display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, - prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (forum_id), - KEY left_right_id (left_id, right_id), - KEY forum_lastpost_id (forum_last_post_id) -); - - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - session_id binary(32) DEFAULT '' NOT NULL, - PRIMARY KEY (forum_id, user_id, session_id) -); - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, forum_id) -); - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY forum_id (forum_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -); - - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_type tinyint(4) DEFAULT '1' NOT NULL, - group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_name blob NOT NULL, - group_desc blob NOT NULL, - group_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, - group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - group_desc_uid varbinary(8) DEFAULT '' NOT NULL, - group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar varbinary(255) DEFAULT '' NOT NULL, - group_avatar_type varbinary(255) DEFAULT '' NOT NULL, - group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_colour varbinary(6) DEFAULT '' NOT NULL, - group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id), - KEY group_legend_name (group_legend, group_name(255)) -); - - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, - icons_url varbinary(255) DEFAULT '' NOT NULL, - icons_width tinyint(4) DEFAULT '0' NOT NULL, - icons_height tinyint(4) DEFAULT '0' NOT NULL, - icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (icons_id), - KEY display_on_posting (display_on_posting) -); - - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id tinyint(4) NOT NULL auto_increment, - lang_iso varbinary(30) DEFAULT '' NOT NULL, - lang_dir varbinary(30) DEFAULT '' NOT NULL, - lang_english_name blob NOT NULL, - lang_local_name blob NOT NULL, - lang_author blob NOT NULL, - PRIMARY KEY (lang_id), - KEY lang_iso (lang_iso) -); - - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id mediumint(8) UNSIGNED NOT NULL auto_increment, - log_type tinyint(4) DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - log_ip varbinary(40) DEFAULT '' NOT NULL, - log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - log_operation blob NOT NULL, - log_data mediumblob NOT NULL, - PRIMARY KEY (log_id), - KEY log_type (log_type), - KEY log_time (log_time), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY reportee_id (reportee_id), - KEY user_id (user_id) -); - - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip varbinary(40) DEFAULT '' NOT NULL, - attempt_browser varbinary(150) DEFAULT '' NOT NULL, - attempt_forwarded_for varbinary(255) DEFAULT '' NOT NULL, - attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - username blob NOT NULL, - username_clean blob NOT NULL, - KEY att_ip (attempt_ip, attempt_time), - KEY att_for (attempt_forwarded_for, attempt_time), - KEY att_time (attempt_time), - KEY user_id (user_id) -); - - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - username blob NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_name blob NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY disp_idx (display_on_index), - KEY forum_id (forum_id) -); - - -# Table: 'phpbb_migrations' -CREATE TABLE phpbb_migrations ( - migration_name varbinary(255) DEFAULT '' NOT NULL, - migration_depends_on blob NOT NULL, - migration_schema_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - migration_data_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - migration_data_state blob NOT NULL, - migration_start_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - migration_end_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (migration_name) -); - - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id mediumint(8) UNSIGNED NOT NULL auto_increment, - module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_basename varbinary(255) DEFAULT '' NOT NULL, - module_class varbinary(10) DEFAULT '' NOT NULL, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - module_langname varbinary(255) DEFAULT '' NOT NULL, - module_mode varbinary(255) DEFAULT '' NOT NULL, - module_auth varbinary(255) DEFAULT '' NOT NULL, - PRIMARY KEY (module_id), - KEY left_right_id (left_id, right_id), - KEY module_enabled (module_enabled), - KEY class_left_id (module_class, left_id) -); - - -# Table: 'phpbb_notification_types' -CREATE TABLE phpbb_notification_types ( - notification_type_id smallint(4) UNSIGNED NOT NULL auto_increment, - notification_type_name varbinary(255) DEFAULT '' NOT NULL, - notification_type_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (notification_type_id), - UNIQUE type (notification_type_name) -); - - -# Table: 'phpbb_notifications' -CREATE TABLE phpbb_notifications ( - notification_id int(10) UNSIGNED NOT NULL auto_increment, - notification_type_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - notification_read tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL, - notification_data blob NOT NULL, - PRIMARY KEY (notification_id), - KEY item_ident (notification_type_id, item_id), - KEY user (user_id, notification_read) -); - - -# Table: 'phpbb_oauth_accounts' -CREATE TABLE phpbb_oauth_accounts ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - provider varbinary(255) DEFAULT '' NOT NULL, - oauth_provider_id blob NOT NULL, - PRIMARY KEY (user_id, provider) -); - - -# Table: 'phpbb_oauth_tokens' -CREATE TABLE phpbb_oauth_tokens ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - session_id binary(32) DEFAULT '' NOT NULL, - provider varbinary(255) DEFAULT '' NOT NULL, - oauth_token mediumblob NOT NULL, - KEY user_id (user_id), - KEY provider (provider) -); - - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_text blob NOT NULL, - poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - KEY poll_opt_id (poll_option_id), - KEY topic_id (topic_id) -); - - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - vote_user_ip varbinary(40) DEFAULT '' NOT NULL, - KEY topic_id (topic_id), - KEY vote_user_id (vote_user_id), - KEY vote_user_ip (vote_user_ip) -); - - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id INT(10) UNSIGNED NOT NULL auto_increment, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_ip varbinary(40) DEFAULT '' NOT NULL, - post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_visibility tinyint(3) DEFAULT '0' NOT NULL, - post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_username blob NOT NULL, - post_subject blob NOT NULL, - post_text mediumblob NOT NULL, - post_checksum varbinary(32) DEFAULT '' NOT NULL, - post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, - bbcode_uid varbinary(8) DEFAULT '' NOT NULL, - post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_reason blob NOT NULL, - post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - post_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_delete_reason blob NOT NULL, - post_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (post_id), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY poster_ip (poster_ip), - KEY poster_id (poster_id), - KEY post_visibility (post_visibility), - KEY post_username (post_username(255)), - KEY tid_post_time (topic_id, post_time) -); - - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, - root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_ip varbinary(40) DEFAULT '' NOT NULL, - message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - message_subject blob NOT NULL, - message_text mediumblob NOT NULL, - message_edit_reason blob NOT NULL, - message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, - bbcode_uid varbinary(8) DEFAULT '' NOT NULL, - message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - to_address blob NOT NULL, - bcc_address blob NOT NULL, - message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (msg_id), - KEY author_ip (author_ip), - KEY message_time (message_time), - KEY author_id (author_id), - KEY root_level (root_level) -); - - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - folder_name blob NOT NULL, - pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (folder_id), - KEY user_id (user_id) -); - - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_string blob NOT NULL, - rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_folder_id int(11) DEFAULT '0' NOT NULL, - PRIMARY KEY (rule_id), - KEY user_id (user_id) -); - - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - folder_id int(11) DEFAULT '0' NOT NULL, - KEY msg_id (msg_id), - KEY author_id (author_id), - KEY usr_flder_id (user_id, folder_id) -); - - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id mediumint(8) UNSIGNED NOT NULL auto_increment, - field_name blob NOT NULL, - field_type varbinary(100) DEFAULT '' NOT NULL, - field_ident varbinary(20) DEFAULT '' NOT NULL, - field_length varbinary(20) DEFAULT '' NOT NULL, - field_minlen varbinary(255) DEFAULT '' NOT NULL, - field_maxlen varbinary(255) DEFAULT '' NOT NULL, - field_novalue blob NOT NULL, - field_default_value blob NOT NULL, - field_validation varbinary(60) DEFAULT '' NOT NULL, - field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_ml tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (field_id), - KEY fld_type (field_type), - KEY fld_ordr (field_order) -); - - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - pf_phpbb_location varbinary(255) DEFAULT '' NOT NULL, - pf_phpbb_interests blob NOT NULL, - pf_phpbb_occupation blob NOT NULL, - PRIMARY KEY (user_id) -); - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - field_type varbinary(100) DEFAULT '' NOT NULL, - lang_value blob NOT NULL, - PRIMARY KEY (field_id, lang_id, option_id) -); - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_name blob NOT NULL, - lang_explain blob NOT NULL, - lang_default_value blob NOT NULL, - PRIMARY KEY (field_id, lang_id) -); - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, - rank_title blob NOT NULL, - rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - rank_image varbinary(255) DEFAULT '' NOT NULL, - PRIMARY KEY (rank_id) -); - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id mediumint(8) UNSIGNED NOT NULL auto_increment, - reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - report_text mediumblob NOT NULL, - reported_post_text mediumblob NOT NULL, - reported_post_uid varbinary(8) DEFAULT '' NOT NULL, - reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL, - reported_post_enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - reported_post_enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - reported_post_enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (report_id), - KEY post_id (post_id), - KEY pm_id (pm_id) -); - - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id smallint(4) UNSIGNED NOT NULL auto_increment, - reason_title blob NOT NULL, - reason_description mediumblob NOT NULL, - reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (reason_id) -); - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key varbinary(32) DEFAULT '' NOT NULL, - search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - search_keywords mediumblob NOT NULL, - search_authors mediumblob NOT NULL, - PRIMARY KEY (search_key) -); - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word_text blob NOT NULL, - word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (word_id), - UNIQUE wrd_txt (word_text(255)), - KEY wrd_cnt (word_count) -); - - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - UNIQUE unq_mtch (word_id, post_id, title_match), - KEY word_id (word_id), - KEY post_id (post_id) -); - - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id binary(32) DEFAULT '' NOT NULL, - session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_ip varbinary(40) DEFAULT '' NOT NULL, - session_browser varbinary(150) DEFAULT '' NOT NULL, - session_forwarded_for varbinary(255) DEFAULT '' NOT NULL, - session_page blob NOT NULL, - session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id), - KEY session_time (session_time), - KEY session_user_id (session_user_id), - KEY session_fid (session_forum_id) -); - - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id binary(32) DEFAULT '' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - last_ip varbinary(40) DEFAULT '' NOT NULL, - last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (key_id, user_id), - KEY last_login (last_login) -); - - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id mediumint(8) UNSIGNED NOT NULL auto_increment, - site_ip varbinary(40) DEFAULT '' NOT NULL, - site_hostname varbinary(255) DEFAULT '' NOT NULL, - ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (site_id) -); - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, - code varbinary(150) DEFAULT '' NOT NULL, - emotion varbinary(150) DEFAULT '' NOT NULL, - smiley_url varbinary(50) DEFAULT '' NOT NULL, - smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (smiley_id), - KEY display_on_post (display_on_posting) -); - - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id mediumint(8) UNSIGNED NOT NULL auto_increment, - style_name blob NOT NULL, - style_copyright blob NOT NULL, - style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - style_path varbinary(100) DEFAULT '' NOT NULL, - bbcode_bitfield varbinary(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, - style_parent_tree blob NOT NULL, - PRIMARY KEY (style_id), - UNIQUE style_name (style_name(255)) -); - - -# Table: 'phpbb_teampage' -CREATE TABLE phpbb_teampage ( - teampage_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - teampage_name blob NOT NULL, - teampage_position mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - teampage_parent mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (teampage_id) -); - - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id INT(10) UNSIGNED NOT NULL auto_increment, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_visibility tinyint(3) DEFAULT '0' NOT NULL, - topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_title blob NOT NULL, - topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_status tinyint(3) DEFAULT '0' NOT NULL, - topic_type tinyint(3) DEFAULT '0' NOT NULL, - topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_first_poster_name blob NOT NULL, - topic_first_poster_colour varbinary(6) DEFAULT '' NOT NULL, - topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_name blob NOT NULL, - topic_last_poster_colour varbinary(6) DEFAULT '' NOT NULL, - topic_last_post_subject blob NOT NULL, - topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_title blob NOT NULL, - poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_max_options tinyint(4) DEFAULT '1' NOT NULL, - poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_delete_reason blob NOT NULL, - topic_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id), - KEY forum_id (forum_id), - KEY forum_id_type (forum_id, topic_type), - KEY last_post_time (topic_last_post_time), - KEY topic_visibility (topic_visibility), - KEY forum_appr_last (forum_id, topic_visibility, topic_last_post_id), - KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) -); - - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id), - KEY topic_id (topic_id), - KEY forum_id (forum_id) -); - - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id) -); - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY topic_id (topic_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -); - - -# Table: 'phpbb_user_notifications' -CREATE TABLE phpbb_user_notifications ( - item_type varbinary(255) DEFAULT '' NOT NULL, - item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - method varbinary(255) DEFAULT '' NOT NULL, - notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL -); - - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY group_id (group_id), - KEY user_id (user_id), - KEY group_leader (group_leader) -); - - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id INT(10) UNSIGNED NOT NULL auto_increment, - user_type tinyint(2) DEFAULT '0' NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, - user_permissions mediumblob NOT NULL, - user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_ip varbinary(40) DEFAULT '' NOT NULL, - user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, - username blob NOT NULL, - username_clean blob NOT NULL, - user_password blob NOT NULL, - user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_actkey varbinary(32) DEFAULT '' NOT NULL, - user_newpasswd blob NOT NULL, - user_email blob NOT NULL, - user_email_hash bigint(20) DEFAULT '0' NOT NULL, - user_birthday varbinary(10) DEFAULT '' NOT NULL, - user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpage blob NOT NULL, - user_last_confirm_key varbinary(10) DEFAULT '' NOT NULL, - user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_warnings tinyint(4) DEFAULT '0' NOT NULL, - user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, - user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, - user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_lang varbinary(30) DEFAULT '' NOT NULL, - user_timezone varbinary(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varbinary(90) DEFAULT 'd M Y H:i' NOT NULL, - user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_colour varbinary(6) DEFAULT '' NOT NULL, - user_new_privmsg int(4) DEFAULT '0' NOT NULL, - user_unread_privmsg int(4) DEFAULT '0' NOT NULL, - user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_full_folder int(11) DEFAULT '-3' NOT NULL, - user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_sortby_type varbinary(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varbinary(1) DEFAULT 'd' NOT NULL, - user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_post_sortby_type varbinary(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varbinary(1) DEFAULT 'a' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_notify_type tinyint(4) DEFAULT '0' NOT NULL, - user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, - user_avatar varbinary(255) DEFAULT '' NOT NULL, - user_avatar_type varbinary(255) DEFAULT '' NOT NULL, - user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_sig mediumblob NOT NULL, - user_sig_bbcode_uid varbinary(8) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield varbinary(255) DEFAULT '' NOT NULL, - user_icq varbinary(15) DEFAULT '' NOT NULL, - user_aim blob NOT NULL, - user_yim blob NOT NULL, - user_msnm blob NOT NULL, - user_jabber blob NOT NULL, - user_website blob NOT NULL, - user_form_salt varbinary(96) DEFAULT '' NOT NULL, - user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_reminded tinyint(4) DEFAULT '0' NOT NULL, - user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id), - KEY user_birthday (user_birthday), - KEY user_email_hash (user_email_hash), - KEY user_type (user_type), - UNIQUE username_clean (username_clean(255)) -); - - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - post_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (warning_id) -); - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word blob NOT NULL, - replacement blob NOT NULL, - PRIMARY KEY (word_id) -); - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, zebra_id) -); - - diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql deleted file mode 100644 index 38db154905..0000000000 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ /dev/null @@ -1,1081 +0,0 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, - post_msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - in_message tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - is_orphan tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - physical_filename varchar(255) DEFAULT '' NOT NULL, - real_filename varchar(255) DEFAULT '' NOT NULL, - download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - attach_comment text NOT NULL, - extension varchar(100) DEFAULT '' NOT NULL, - mimetype varchar(100) DEFAULT '' NOT NULL, - filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - filetime int(11) UNSIGNED DEFAULT '0' NOT NULL, - thumbnail tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (attach_id), - KEY filetime (filetime), - KEY post_msg_id (post_msg_id), - KEY topic_id (topic_id), - KEY poster_id (poster_id), - KEY is_orphan (is_orphan) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY group_id (group_id), - KEY auth_opt_id (auth_option_id), - KEY auth_role_id (auth_role_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id mediumint(8) UNSIGNED NOT NULL auto_increment, - auth_option varchar(50) DEFAULT '' NOT NULL, - is_global tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - is_local tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - founder_only tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (auth_option_id), - UNIQUE auth_option (auth_option) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id mediumint(8) UNSIGNED NOT NULL auto_increment, - role_name varchar(255) DEFAULT '' NOT NULL, - role_description text NOT NULL, - role_type varchar(10) DEFAULT '' NOT NULL, - role_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id), - KEY role_type (role_type), - KEY role_order (role_order) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id, auth_option_id), - KEY ath_op_id (auth_option_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_role_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - auth_setting tinyint(2) DEFAULT '0' NOT NULL, - KEY user_id (user_id), - KEY auth_option_id (auth_option_id), - KEY auth_role_id (auth_role_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, - ban_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - ban_ip varchar(40) DEFAULT '' NOT NULL, - ban_email varchar(100) DEFAULT '' NOT NULL, - ban_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_end int(11) UNSIGNED DEFAULT '0' NOT NULL, - ban_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ban_reason varchar(255) DEFAULT '' NOT NULL, - ban_give_reason varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (ban_id), - KEY ban_end (ban_end), - KEY ban_user (ban_userid, ban_exclude), - KEY ban_email (ban_email, ban_exclude), - KEY ban_ip (ban_ip, ban_exclude) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_tag varchar(16) DEFAULT '' NOT NULL, - bbcode_helpline varchar(255) DEFAULT '' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_match text NOT NULL, - bbcode_tpl mediumtext NOT NULL, - first_pass_match mediumtext NOT NULL, - first_pass_replace mediumtext NOT NULL, - second_pass_match mediumtext NOT NULL, - second_pass_replace mediumtext NOT NULL, - PRIMARY KEY (bbcode_id), - KEY display_on_post (display_on_posting) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id, user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id mediumint(8) UNSIGNED NOT NULL auto_increment, - bot_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - bot_name varchar(255) DEFAULT '' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - bot_agent varchar(255) DEFAULT '' NOT NULL, - bot_ip varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (bot_id), - KEY bot_active (bot_active) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name varchar(255) DEFAULT '' NOT NULL, - config_value varchar(255) DEFAULT '' NOT NULL, - is_dynamic tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (config_name), - KEY is_dynamic (is_dynamic) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_config_text' -CREATE TABLE phpbb_config_text ( - config_name varchar(255) DEFAULT '' NOT NULL, - config_value mediumtext NOT NULL, - PRIMARY KEY (config_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id char(32) DEFAULT '' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - confirm_type tinyint(3) DEFAULT '0' NOT NULL, - code varchar(8) DEFAULT '' NOT NULL, - seed int(10) UNSIGNED DEFAULT '0' NOT NULL, - attempts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id, confirm_id), - KEY confirm_type (confirm_type) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, - disallow_username varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (disallow_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - save_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - draft_subject varchar(255) DEFAULT '' NOT NULL, - draft_message mediumtext NOT NULL, - PRIMARY KEY (draft_id), - KEY save_time (save_time) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name varchar(255) DEFAULT '' NOT NULL, - ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - ext_state text NOT NULL, - UNIQUE ext_name (ext_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - extension varchar(100) DEFAULT '' NOT NULL, - PRIMARY KEY (extension_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_name varchar(255) DEFAULT '' NOT NULL, - cat_id tinyint(2) DEFAULT '0' NOT NULL, - allow_group tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - download_mode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - upload_icon varchar(255) DEFAULT '' NOT NULL, - max_filesize int(20) UNSIGNED DEFAULT '0' NOT NULL, - allowed_forums text NOT NULL, - allow_in_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id mediumint(8) UNSIGNED NOT NULL auto_increment, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_parents mediumtext NOT NULL, - forum_name varchar(255) DEFAULT '' NOT NULL, - forum_desc text NOT NULL, - forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_desc_uid varchar(8) DEFAULT '' NOT NULL, - forum_link varchar(255) DEFAULT '' NOT NULL, - forum_password varchar(255) DEFAULT '' NOT NULL, - forum_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_image varchar(255) DEFAULT '' NOT NULL, - forum_rules text NOT NULL, - forum_rules_link varchar(255) DEFAULT '' NOT NULL, - forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_rules_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - forum_rules_uid varchar(8) DEFAULT '' NOT NULL, - forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, - forum_type tinyint(4) DEFAULT '0' NOT NULL, - forum_status tinyint(4) DEFAULT '0' NOT NULL, - forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, - forum_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, - forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - forum_flags tinyint(4) DEFAULT '32' NOT NULL, - forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL, - display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - prune_next int(11) UNSIGNED DEFAULT '0' NOT NULL, - prune_days mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_viewed mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - prune_freq mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (forum_id), - KEY left_right_id (left_id, right_id), - KEY forum_lastpost_id (forum_last_post_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - PRIMARY KEY (forum_id, user_id, session_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY forum_id (forum_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_type tinyint(4) DEFAULT '1' NOT NULL, - group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_name varchar(255) DEFAULT '' NOT NULL, - group_desc text NOT NULL, - group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - group_desc_options int(11) UNSIGNED DEFAULT '7' NOT NULL, - group_desc_uid varchar(8) DEFAULT '' NOT NULL, - group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar varchar(255) DEFAULT '' NOT NULL, - group_avatar_type varchar(255) DEFAULT '' NOT NULL, - group_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - group_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_colour varchar(6) DEFAULT '' NOT NULL, - group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (group_id), - KEY group_legend_name (group_legend, group_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id mediumint(8) UNSIGNED NOT NULL auto_increment, - icons_url varchar(255) DEFAULT '' NOT NULL, - icons_width tinyint(4) DEFAULT '0' NOT NULL, - icons_height tinyint(4) DEFAULT '0' NOT NULL, - icons_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (icons_id), - KEY display_on_posting (display_on_posting) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id tinyint(4) NOT NULL auto_increment, - lang_iso varchar(30) DEFAULT '' NOT NULL, - lang_dir varchar(30) DEFAULT '' NOT NULL, - lang_english_name varchar(100) DEFAULT '' NOT NULL, - lang_local_name varchar(255) DEFAULT '' NOT NULL, - lang_author varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (lang_id), - KEY lang_iso (lang_iso) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id mediumint(8) UNSIGNED NOT NULL auto_increment, - log_type tinyint(4) DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - reportee_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - log_ip varchar(40) DEFAULT '' NOT NULL, - log_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - log_operation text NOT NULL, - log_data mediumtext NOT NULL, - PRIMARY KEY (log_id), - KEY log_type (log_type), - KEY log_time (log_time), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY reportee_id (reportee_id), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar(40) DEFAULT '' NOT NULL, - attempt_browser varchar(150) DEFAULT '' NOT NULL, - attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, - attempt_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '0' NOT NULL, - username_clean varchar(255) DEFAULT '0' NOT NULL, - KEY att_ip (attempt_ip, attempt_time), - KEY att_for (attempt_forwarded_for, attempt_time), - KEY att_time (attempt_time), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '' NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_name varchar(255) DEFAULT '' NOT NULL, - display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY disp_idx (display_on_index), - KEY forum_id (forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_migrations' -CREATE TABLE phpbb_migrations ( - migration_name varchar(255) DEFAULT '' NOT NULL, - migration_depends_on text NOT NULL, - migration_schema_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - migration_data_done tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - migration_data_state text NOT NULL, - migration_start_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - migration_end_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (migration_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id mediumint(8) UNSIGNED NOT NULL auto_increment, - module_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_display tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - module_basename varchar(255) DEFAULT '' NOT NULL, - module_class varchar(10) DEFAULT '' NOT NULL, - parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - left_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - right_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - module_langname varchar(255) DEFAULT '' NOT NULL, - module_mode varchar(255) DEFAULT '' NOT NULL, - module_auth varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (module_id), - KEY left_right_id (left_id, right_id), - KEY module_enabled (module_enabled), - KEY class_left_id (module_class, left_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_notification_types' -CREATE TABLE phpbb_notification_types ( - notification_type_id smallint(4) UNSIGNED NOT NULL auto_increment, - notification_type_name varchar(255) DEFAULT '' NOT NULL, - notification_type_enabled tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (notification_type_id), - UNIQUE type (notification_type_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_notifications' -CREATE TABLE phpbb_notifications ( - notification_id int(10) UNSIGNED NOT NULL auto_increment, - notification_type_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - item_parent_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - notification_read tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - notification_time int(11) UNSIGNED DEFAULT '1' NOT NULL, - notification_data text NOT NULL, - PRIMARY KEY (notification_id), - KEY item_ident (notification_type_id, item_id), - KEY user (user_id, notification_read) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_oauth_accounts' -CREATE TABLE phpbb_oauth_accounts ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - provider varchar(255) DEFAULT '' NOT NULL, - oauth_provider_id text NOT NULL, - PRIMARY KEY (user_id, provider) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_oauth_tokens' -CREATE TABLE phpbb_oauth_tokens ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - provider varchar(255) DEFAULT '' NOT NULL, - oauth_token mediumtext NOT NULL, - KEY user_id (user_id), - KEY provider (provider) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_text text NOT NULL, - poll_option_total mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - KEY poll_opt_id (poll_option_id), - KEY topic_id (topic_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - poll_option_id tinyint(4) DEFAULT '0' NOT NULL, - vote_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - vote_user_ip varchar(40) DEFAULT '' NOT NULL, - KEY topic_id (topic_id), - KEY vote_user_id (vote_user_id), - KEY vote_user_ip (vote_user_ip) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id INT(10) UNSIGNED NOT NULL auto_increment, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poster_ip varchar(40) DEFAULT '' NOT NULL, - post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_visibility tinyint(3) DEFAULT '0' NOT NULL, - post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_username varchar(255) DEFAULT '' NOT NULL, - post_subject varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, - post_text mediumtext NOT NULL, - post_checksum varchar(32) DEFAULT '' NOT NULL, - post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_reason varchar(255) DEFAULT '' NOT NULL, - post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - post_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - post_delete_reason varchar(255) DEFAULT '' NOT NULL, - post_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (post_id), - KEY forum_id (forum_id), - KEY topic_id (topic_id), - KEY poster_ip (poster_ip), - KEY poster_id (poster_id), - KEY post_visibility (post_visibility), - KEY post_username (post_username), - KEY tid_post_time (topic_id, post_time) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id mediumint(8) UNSIGNED NOT NULL auto_increment, - root_level mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - author_ip varchar(40) DEFAULT '' NOT NULL, - message_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - enable_sig tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - message_subject varchar(255) DEFAULT '' NOT NULL, - message_text mediumtext NOT NULL, - message_edit_reason varchar(255) DEFAULT '' NOT NULL, - message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - to_address text NOT NULL, - bcc_address text NOT NULL, - message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (msg_id), - KEY author_ip (author_ip), - KEY message_time (message_time), - KEY author_id (author_id), - KEY root_level (root_level) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - folder_name varchar(255) DEFAULT '' NOT NULL, - pm_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (folder_id), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - rule_check mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_connection mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_string varchar(255) DEFAULT '' NOT NULL, - rule_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_action mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rule_folder_id int(11) DEFAULT '0' NOT NULL, - PRIMARY KEY (rule_id), - KEY user_id (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - author_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - pm_deleted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_unread tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - pm_replied tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_marked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - pm_forwarded tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - folder_id int(11) DEFAULT '0' NOT NULL, - KEY msg_id (msg_id), - KEY author_id (author_id), - KEY usr_flder_id (user_id, folder_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id mediumint(8) UNSIGNED NOT NULL auto_increment, - field_name varchar(255) DEFAULT '' NOT NULL, - field_type varchar(100) DEFAULT '' NOT NULL, - field_ident varchar(20) DEFAULT '' NOT NULL, - field_length varchar(20) DEFAULT '' NOT NULL, - field_minlen varchar(255) DEFAULT '' NOT NULL, - field_maxlen varchar(255) DEFAULT '' NOT NULL, - field_novalue varchar(255) DEFAULT '' NOT NULL, - field_default_value varchar(255) DEFAULT '' NOT NULL, - field_validation varchar(20) DEFAULT '' NOT NULL, - field_required tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_novalue tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_reg tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_vt tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_on_ml tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_show_profile tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_hide tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_no_view tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - field_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (field_id), - KEY fld_type (field_type), - KEY fld_ordr (field_order) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - pf_phpbb_location varchar(255) DEFAULT '' NOT NULL, - pf_phpbb_interests text NOT NULL, - pf_phpbb_occupation text NOT NULL, - PRIMARY KEY (user_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - option_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - field_type varchar(100) DEFAULT '' NOT NULL, - lang_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id, option_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - lang_name varchar(255) DEFAULT '' NOT NULL, - lang_explain text NOT NULL, - lang_default_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id mediumint(8) UNSIGNED NOT NULL auto_increment, - rank_title varchar(255) DEFAULT '' NOT NULL, - rank_min mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - rank_special tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - rank_image varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (rank_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id mediumint(8) UNSIGNED NOT NULL auto_increment, - reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - post_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - report_text mediumtext NOT NULL, - reported_post_text mediumtext NOT NULL, - reported_post_uid varchar(8) DEFAULT '' NOT NULL, - reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, - reported_post_enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - reported_post_enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - reported_post_enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (report_id), - KEY post_id (post_id), - KEY pm_id (pm_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id smallint(4) UNSIGNED NOT NULL auto_increment, - reason_title varchar(255) DEFAULT '' NOT NULL, - reason_description mediumtext NOT NULL, - reason_order smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (reason_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key varchar(32) DEFAULT '' NOT NULL, - search_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - search_keywords mediumtext NOT NULL, - search_authors mediumtext NOT NULL, - PRIMARY KEY (search_key) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word_text varchar(255) DEFAULT '' NOT NULL, - word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - word_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (word_id), - UNIQUE wrd_txt (word_text), - KEY wrd_cnt (word_count) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - word_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - title_match tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - UNIQUE unq_mtch (word_id, post_id, title_match), - KEY word_id (word_id), - KEY post_id (post_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id char(32) DEFAULT '' NOT NULL, - session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - session_ip varchar(40) DEFAULT '' NOT NULL, - session_browser varchar(150) DEFAULT '' NOT NULL, - session_forwarded_for varchar(255) DEFAULT '' NOT NULL, - session_page varchar(255) DEFAULT '' NOT NULL, - session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (session_id), - KEY session_time (session_time), - KEY session_user_id (session_user_id), - KEY session_fid (session_forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) DEFAULT '' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - last_ip varchar(40) DEFAULT '' NOT NULL, - last_login int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (key_id, user_id), - KEY last_login (last_login) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id mediumint(8) UNSIGNED NOT NULL auto_increment, - site_ip varchar(40) DEFAULT '' NOT NULL, - site_hostname varchar(255) DEFAULT '' NOT NULL, - ip_exclude tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (site_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id mediumint(8) UNSIGNED NOT NULL auto_increment, - code varchar(50) DEFAULT '' NOT NULL, - emotion varchar(50) DEFAULT '' NOT NULL, - smiley_url varchar(50) DEFAULT '' NOT NULL, - smiley_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - smiley_order mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (smiley_id), - KEY display_on_post (display_on_posting) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id mediumint(8) UNSIGNED NOT NULL auto_increment, - style_name varchar(255) DEFAULT '' NOT NULL, - style_copyright varchar(255) DEFAULT '' NOT NULL, - style_active tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - style_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id int(4) UNSIGNED DEFAULT '0' NOT NULL, - style_parent_tree text NOT NULL, - PRIMARY KEY (style_id), - UNIQUE style_name (style_name) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_teampage' -CREATE TABLE phpbb_teampage ( - teampage_id mediumint(8) UNSIGNED NOT NULL auto_increment, - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - teampage_name varchar(255) DEFAULT '' NOT NULL, - teampage_position mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - teampage_parent mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (teampage_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id INT(10) UNSIGNED NOT NULL auto_increment, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_visibility tinyint(3) DEFAULT '0' NOT NULL, - topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_title varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci, - topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_status tinyint(3) DEFAULT '0' NOT NULL, - topic_type tinyint(3) DEFAULT '0' NOT NULL, - topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, - topic_last_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_last_view_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumped tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_bumper mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - poll_title varchar(255) DEFAULT '' NOT NULL, - poll_start int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_length int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_max_options tinyint(4) DEFAULT '1' NOT NULL, - poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL, - poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - topic_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - topic_delete_reason varchar(255) DEFAULT '' NOT NULL, - topic_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id), - KEY forum_id (forum_id), - KEY forum_id_type (forum_id, topic_type), - KEY last_post_time (topic_last_post_time), - KEY topic_visibility (topic_visibility), - KEY forum_appr_last (forum_id, topic_visibility, topic_last_post_id), - KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - mark_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id), - KEY topic_id (topic_id), - KEY forum_id (forum_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - topic_posted tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, topic_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - notify_status tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - KEY topic_id (topic_id), - KEY user_id (user_id), - KEY notify_stat (notify_status) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_user_notifications' -CREATE TABLE phpbb_user_notifications ( - item_type varchar(255) DEFAULT '' NOT NULL, - item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - method varchar(255) DEFAULT '' NOT NULL, - notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - group_leader tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_pending tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - KEY group_id (group_id), - KEY user_id (user_id), - KEY group_leader (group_leader) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id INT(10) UNSIGNED NOT NULL auto_increment, - user_type tinyint(2) DEFAULT '0' NOT NULL, - group_id mediumint(8) UNSIGNED DEFAULT '3' NOT NULL, - user_permissions mediumtext NOT NULL, - user_perm_from mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_ip varchar(40) DEFAULT '' NOT NULL, - user_regdate int(11) UNSIGNED DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '' NOT NULL, - username_clean varchar(255) DEFAULT '' NOT NULL, - user_password varchar(255) DEFAULT '' NOT NULL, - user_passchg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_pass_convert tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_actkey varchar(32) DEFAULT '' NOT NULL, - user_newpasswd varchar(255) DEFAULT '' NOT NULL, - user_email varchar(100) DEFAULT '' NOT NULL, - user_email_hash bigint(20) DEFAULT '0' NOT NULL, - user_birthday varchar(10) DEFAULT '' NOT NULL, - user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastmark int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpost_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_lastpage varchar(200) DEFAULT '' NOT NULL, - user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, - user_last_search int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_warnings tinyint(4) DEFAULT '0' NOT NULL, - user_last_warning int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_login_attempts tinyint(4) DEFAULT '0' NOT NULL, - user_inactive_reason tinyint(2) DEFAULT '0' NOT NULL, - user_inactive_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_lang varchar(30) DEFAULT '' NOT NULL, - user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, - user_style mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_rank mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - user_colour varchar(6) DEFAULT '' NOT NULL, - user_new_privmsg int(4) DEFAULT '0' NOT NULL, - user_unread_privmsg int(4) DEFAULT '0' NOT NULL, - user_last_privmsg int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_message_rules tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_full_folder int(11) DEFAULT '-3' NOT NULL, - user_emailtime int(11) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, - user_post_show_days smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, - user_notify tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - user_notify_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_notify_type tinyint(4) DEFAULT '0' NOT NULL, - user_allow_pm tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL, - user_avatar varchar(255) DEFAULT '' NOT NULL, - user_avatar_type varchar(255) DEFAULT '' NOT NULL, - user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_avatar_height smallint(4) UNSIGNED DEFAULT '0' NOT NULL, - user_sig mediumtext NOT NULL, - user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - user_icq varchar(15) DEFAULT '' NOT NULL, - user_aim varchar(255) DEFAULT '' NOT NULL, - user_yim varchar(255) DEFAULT '' NOT NULL, - user_msnm varchar(255) DEFAULT '' NOT NULL, - user_jabber varchar(255) DEFAULT '' NOT NULL, - user_website varchar(200) DEFAULT '' NOT NULL, - user_form_salt varchar(32) DEFAULT '' NOT NULL, - user_new tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_reminded tinyint(4) DEFAULT '0' NOT NULL, - user_reminded_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id), - KEY user_birthday (user_birthday), - KEY user_email_hash (user_email_hash), - KEY user_type (user_type), - UNIQUE username_clean (username_clean) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id mediumint(8) UNSIGNED NOT NULL auto_increment, - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - post_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - log_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - warning_time int(11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (warning_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id mediumint(8) UNSIGNED NOT NULL auto_increment, - word varchar(255) DEFAULT '' NOT NULL, - replacement varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (word_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id INT(10) UNSIGNED DEFAULT '0' NOT NULL, - zebra_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - friend tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - foe tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (user_id, zebra_id) -) CHARACTER SET `utf8` COLLATE `utf8_bin`; - - diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index fe3cd8312e..2473d31aab 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1,12 +1,4 @@ /* - * DO NOT EDIT THIS FILE, IT IS GENERATED - * - * To change the contents of this file, edit - * phpBB/develop/create_schema_files.php and - * run it. - */ - -/* This first section is optional, however its probably the best method of running phpBB on Oracle. If you already have a tablespace and user created for phpBB you can leave this section commented out! @@ -43,1924 +35,3 @@ DISCONNECT; CONNECT phpbb/phpbb_password; */ -/* - Table: 'phpbb_attachments' -*/ -CREATE TABLE phpbb_attachments ( - attach_id number(8) NOT NULL, - post_msg_id number(8) DEFAULT '0' NOT NULL, - topic_id number(10) DEFAULT '0' NOT NULL, - in_message number(1) DEFAULT '0' NOT NULL, - poster_id number(8) DEFAULT '0' NOT NULL, - is_orphan number(1) DEFAULT '1' NOT NULL, - physical_filename varchar2(255) DEFAULT '' , - real_filename varchar2(255) DEFAULT '' , - download_count number(8) DEFAULT '0' NOT NULL, - attach_comment clob DEFAULT '' , - extension varchar2(100) DEFAULT '' , - mimetype varchar2(100) DEFAULT '' , - filesize number(20) DEFAULT '0' NOT NULL, - filetime number(11) DEFAULT '0' NOT NULL, - thumbnail number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_attachments PRIMARY KEY (attach_id) -) -/ - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime) -/ -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id) -/ -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id) -/ -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id) -/ -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan) -/ - -CREATE SEQUENCE phpbb_attachments_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_attachments -BEFORE INSERT ON phpbb_attachments -FOR EACH ROW WHEN ( - new.attach_id IS NULL OR new.attach_id = 0 -) -BEGIN - SELECT phpbb_attachments_seq.nextval - INTO :new.attach_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_acl_groups' -*/ -CREATE TABLE phpbb_acl_groups ( - group_id number(8) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - auth_option_id number(8) DEFAULT '0' NOT NULL, - auth_role_id number(8) DEFAULT '0' NOT NULL, - auth_setting number(2) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id) -/ -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id) -/ -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id) -/ - -/* - Table: 'phpbb_acl_options' -*/ -CREATE TABLE phpbb_acl_options ( - auth_option_id number(8) NOT NULL, - auth_option varchar2(50) DEFAULT '' , - is_global number(1) DEFAULT '0' NOT NULL, - is_local number(1) DEFAULT '0' NOT NULL, - founder_only number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_acl_options PRIMARY KEY (auth_option_id), - CONSTRAINT u_phpbb_auth_option UNIQUE (auth_option) -) -/ - - -CREATE SEQUENCE phpbb_acl_options_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_acl_options -BEFORE INSERT ON phpbb_acl_options -FOR EACH ROW WHEN ( - new.auth_option_id IS NULL OR new.auth_option_id = 0 -) -BEGIN - SELECT phpbb_acl_options_seq.nextval - INTO :new.auth_option_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_acl_roles' -*/ -CREATE TABLE phpbb_acl_roles ( - role_id number(8) NOT NULL, - role_name varchar2(765) DEFAULT '' , - role_description clob DEFAULT '' , - role_type varchar2(10) DEFAULT '' , - role_order number(4) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_acl_roles PRIMARY KEY (role_id) -) -/ - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type) -/ -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order) -/ - -CREATE SEQUENCE phpbb_acl_roles_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_acl_roles -BEFORE INSERT ON phpbb_acl_roles -FOR EACH ROW WHEN ( - new.role_id IS NULL OR new.role_id = 0 -) -BEGIN - SELECT phpbb_acl_roles_seq.nextval - INTO :new.role_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_acl_roles_data' -*/ -CREATE TABLE phpbb_acl_roles_data ( - role_id number(8) DEFAULT '0' NOT NULL, - auth_option_id number(8) DEFAULT '0' NOT NULL, - auth_setting number(2) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_acl_roles_data PRIMARY KEY (role_id, auth_option_id) -) -/ - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id) -/ - -/* - Table: 'phpbb_acl_users' -*/ -CREATE TABLE phpbb_acl_users ( - user_id number(10) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - auth_option_id number(8) DEFAULT '0' NOT NULL, - auth_role_id number(8) DEFAULT '0' NOT NULL, - auth_setting number(2) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id) -/ -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id) -/ -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id) -/ - -/* - Table: 'phpbb_banlist' -*/ -CREATE TABLE phpbb_banlist ( - ban_id number(8) NOT NULL, - ban_userid number(8) DEFAULT '0' NOT NULL, - ban_ip varchar2(40) DEFAULT '' , - ban_email varchar2(300) DEFAULT '' , - ban_start number(11) DEFAULT '0' NOT NULL, - ban_end number(11) DEFAULT '0' NOT NULL, - ban_exclude number(1) DEFAULT '0' NOT NULL, - ban_reason varchar2(765) DEFAULT '' , - ban_give_reason varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_banlist PRIMARY KEY (ban_id) -) -/ - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end) -/ -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude) -/ -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude) -/ -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude) -/ - -CREATE SEQUENCE phpbb_banlist_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_banlist -BEFORE INSERT ON phpbb_banlist -FOR EACH ROW WHEN ( - new.ban_id IS NULL OR new.ban_id = 0 -) -BEGIN - SELECT phpbb_banlist_seq.nextval - INTO :new.ban_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_bbcodes' -*/ -CREATE TABLE phpbb_bbcodes ( - bbcode_id number(4) DEFAULT '0' NOT NULL, - bbcode_tag varchar2(16) DEFAULT '' , - bbcode_helpline varchar2(765) DEFAULT '' , - display_on_posting number(1) DEFAULT '0' NOT NULL, - bbcode_match clob DEFAULT '' , - bbcode_tpl clob DEFAULT '' , - first_pass_match clob DEFAULT '' , - first_pass_replace clob DEFAULT '' , - second_pass_match clob DEFAULT '' , - second_pass_replace clob DEFAULT '' , - CONSTRAINT pk_phpbb_bbcodes PRIMARY KEY (bbcode_id) -) -/ - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting) -/ - -/* - Table: 'phpbb_bookmarks' -*/ -CREATE TABLE phpbb_bookmarks ( - topic_id number(10) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_bookmarks PRIMARY KEY (topic_id, user_id) -) -/ - - -/* - Table: 'phpbb_bots' -*/ -CREATE TABLE phpbb_bots ( - bot_id number(8) NOT NULL, - bot_active number(1) DEFAULT '1' NOT NULL, - bot_name varchar2(765) DEFAULT '' , - user_id number(10) DEFAULT '0' NOT NULL, - bot_agent varchar2(255) DEFAULT '' , - bot_ip varchar2(255) DEFAULT '' , - CONSTRAINT pk_phpbb_bots PRIMARY KEY (bot_id) -) -/ - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active) -/ - -CREATE SEQUENCE phpbb_bots_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_bots -BEFORE INSERT ON phpbb_bots -FOR EACH ROW WHEN ( - new.bot_id IS NULL OR new.bot_id = 0 -) -BEGIN - SELECT phpbb_bots_seq.nextval - INTO :new.bot_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_config' -*/ -CREATE TABLE phpbb_config ( - config_name varchar2(255) DEFAULT '' , - config_value varchar2(765) DEFAULT '' , - is_dynamic number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_config PRIMARY KEY (config_name) -) -/ - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic) -/ - -/* - Table: 'phpbb_config_text' -*/ -CREATE TABLE phpbb_config_text ( - config_name varchar2(255) DEFAULT '' , - config_value clob DEFAULT '' , - CONSTRAINT pk_phpbb_config_text PRIMARY KEY (config_name) -) -/ - - -/* - Table: 'phpbb_confirm' -*/ -CREATE TABLE phpbb_confirm ( - confirm_id char(32) DEFAULT '' , - session_id char(32) DEFAULT '' , - confirm_type number(3) DEFAULT '0' NOT NULL, - code varchar2(8) DEFAULT '' , - seed number(10) DEFAULT '0' NOT NULL, - attempts number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_confirm PRIMARY KEY (session_id, confirm_id) -) -/ - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type) -/ - -/* - Table: 'phpbb_disallow' -*/ -CREATE TABLE phpbb_disallow ( - disallow_id number(8) NOT NULL, - disallow_username varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_disallow PRIMARY KEY (disallow_id) -) -/ - - -CREATE SEQUENCE phpbb_disallow_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_disallow -BEFORE INSERT ON phpbb_disallow -FOR EACH ROW WHEN ( - new.disallow_id IS NULL OR new.disallow_id = 0 -) -BEGIN - SELECT phpbb_disallow_seq.nextval - INTO :new.disallow_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_drafts' -*/ -CREATE TABLE phpbb_drafts ( - draft_id number(8) NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - topic_id number(10) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - save_time number(11) DEFAULT '0' NOT NULL, - draft_subject varchar2(765) DEFAULT '' , - draft_message clob DEFAULT '' , - CONSTRAINT pk_phpbb_drafts PRIMARY KEY (draft_id) -) -/ - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time) -/ - -CREATE SEQUENCE phpbb_drafts_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_drafts -BEFORE INSERT ON phpbb_drafts -FOR EACH ROW WHEN ( - new.draft_id IS NULL OR new.draft_id = 0 -) -BEGIN - SELECT phpbb_drafts_seq.nextval - INTO :new.draft_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_ext' -*/ -CREATE TABLE phpbb_ext ( - ext_name varchar2(255) DEFAULT '' , - ext_active number(1) DEFAULT '0' NOT NULL, - ext_state clob DEFAULT '' , - CONSTRAINT u_phpbb_ext_name UNIQUE (ext_name) -) -/ - - -/* - Table: 'phpbb_extensions' -*/ -CREATE TABLE phpbb_extensions ( - extension_id number(8) NOT NULL, - group_id number(8) DEFAULT '0' NOT NULL, - extension varchar2(100) DEFAULT '' , - CONSTRAINT pk_phpbb_extensions PRIMARY KEY (extension_id) -) -/ - - -CREATE SEQUENCE phpbb_extensions_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_extensions -BEFORE INSERT ON phpbb_extensions -FOR EACH ROW WHEN ( - new.extension_id IS NULL OR new.extension_id = 0 -) -BEGIN - SELECT phpbb_extensions_seq.nextval - INTO :new.extension_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_extension_groups' -*/ -CREATE TABLE phpbb_extension_groups ( - group_id number(8) NOT NULL, - group_name varchar2(765) DEFAULT '' , - cat_id number(2) DEFAULT '0' NOT NULL, - allow_group number(1) DEFAULT '0' NOT NULL, - download_mode number(1) DEFAULT '1' NOT NULL, - upload_icon varchar2(255) DEFAULT '' , - max_filesize number(20) DEFAULT '0' NOT NULL, - allowed_forums clob DEFAULT '' , - allow_in_pm number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_extension_groups PRIMARY KEY (group_id) -) -/ - - -CREATE SEQUENCE phpbb_extension_groups_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_extension_groups -BEFORE INSERT ON phpbb_extension_groups -FOR EACH ROW WHEN ( - new.group_id IS NULL OR new.group_id = 0 -) -BEGIN - SELECT phpbb_extension_groups_seq.nextval - INTO :new.group_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_forums' -*/ -CREATE TABLE phpbb_forums ( - forum_id number(8) NOT NULL, - parent_id number(8) DEFAULT '0' NOT NULL, - left_id number(8) DEFAULT '0' NOT NULL, - right_id number(8) DEFAULT '0' NOT NULL, - forum_parents clob DEFAULT '' , - forum_name varchar2(765) DEFAULT '' , - forum_desc clob DEFAULT '' , - forum_desc_bitfield varchar2(255) DEFAULT '' , - forum_desc_options number(11) DEFAULT '7' NOT NULL, - forum_desc_uid varchar2(8) DEFAULT '' , - forum_link varchar2(765) DEFAULT '' , - forum_password varchar2(765) DEFAULT '' , - forum_style number(8) DEFAULT '0' NOT NULL, - forum_image varchar2(255) DEFAULT '' , - forum_rules clob DEFAULT '' , - forum_rules_link varchar2(765) DEFAULT '' , - forum_rules_bitfield varchar2(255) DEFAULT '' , - forum_rules_options number(11) DEFAULT '7' NOT NULL, - forum_rules_uid varchar2(8) DEFAULT '' , - forum_topics_per_page number(4) DEFAULT '0' NOT NULL, - forum_type number(4) DEFAULT '0' NOT NULL, - forum_status number(4) DEFAULT '0' NOT NULL, - forum_posts_approved number(8) DEFAULT '0' NOT NULL, - forum_posts_unapproved number(8) DEFAULT '0' NOT NULL, - forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL, - forum_topics_approved number(8) DEFAULT '0' NOT NULL, - forum_topics_unapproved number(8) DEFAULT '0' NOT NULL, - forum_topics_softdeleted number(8) DEFAULT '0' NOT NULL, - forum_last_post_id number(8) DEFAULT '0' NOT NULL, - forum_last_poster_id number(8) DEFAULT '0' NOT NULL, - forum_last_post_subject varchar2(765) DEFAULT '' , - forum_last_post_time number(11) DEFAULT '0' NOT NULL, - forum_last_poster_name varchar2(765) DEFAULT '' , - forum_last_poster_colour varchar2(6) DEFAULT '' , - forum_flags number(4) DEFAULT '32' NOT NULL, - forum_options number(20) DEFAULT '0' NOT NULL, - display_subforum_list number(1) DEFAULT '1' NOT NULL, - display_on_index number(1) DEFAULT '1' NOT NULL, - enable_indexing number(1) DEFAULT '1' NOT NULL, - enable_icons number(1) DEFAULT '1' NOT NULL, - enable_prune number(1) DEFAULT '0' NOT NULL, - prune_next number(11) DEFAULT '0' NOT NULL, - prune_days number(8) DEFAULT '0' NOT NULL, - prune_viewed number(8) DEFAULT '0' NOT NULL, - prune_freq number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_forums PRIMARY KEY (forum_id) -) -/ - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id) -/ -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id) -/ - -CREATE SEQUENCE phpbb_forums_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_forums -BEFORE INSERT ON phpbb_forums -FOR EACH ROW WHEN ( - new.forum_id IS NULL OR new.forum_id = 0 -) -BEGIN - SELECT phpbb_forums_seq.nextval - INTO :new.forum_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_forums_access' -*/ -CREATE TABLE phpbb_forums_access ( - forum_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' , - CONSTRAINT pk_phpbb_forums_access PRIMARY KEY (forum_id, user_id, session_id) -) -/ - - -/* - Table: 'phpbb_forums_track' -*/ -CREATE TABLE phpbb_forums_track ( - user_id number(10) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - mark_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_forums_track PRIMARY KEY (user_id, forum_id) -) -/ - - -/* - Table: 'phpbb_forums_watch' -*/ -CREATE TABLE phpbb_forums_watch ( - forum_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - notify_status number(1) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id) -/ -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id) -/ -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status) -/ - -/* - Table: 'phpbb_groups' -*/ -CREATE TABLE phpbb_groups ( - group_id number(8) NOT NULL, - group_type number(4) DEFAULT '1' NOT NULL, - group_founder_manage number(1) DEFAULT '0' NOT NULL, - group_skip_auth number(1) DEFAULT '0' NOT NULL, - group_name varchar2(255) DEFAULT '' , - group_desc clob DEFAULT '' , - group_desc_bitfield varchar2(255) DEFAULT '' , - group_desc_options number(11) DEFAULT '7' NOT NULL, - group_desc_uid varchar2(8) DEFAULT '' , - group_display number(1) DEFAULT '0' NOT NULL, - group_avatar varchar2(255) DEFAULT '' , - group_avatar_type varchar2(255) DEFAULT '' , - group_avatar_width number(4) DEFAULT '0' NOT NULL, - group_avatar_height number(4) DEFAULT '0' NOT NULL, - group_rank number(8) DEFAULT '0' NOT NULL, - group_colour varchar2(6) DEFAULT '' , - group_sig_chars number(8) DEFAULT '0' NOT NULL, - group_receive_pm number(1) DEFAULT '0' NOT NULL, - group_message_limit number(8) DEFAULT '0' NOT NULL, - group_max_recipients number(8) DEFAULT '0' NOT NULL, - group_legend number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id) -) -/ - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name) -/ - -CREATE SEQUENCE phpbb_groups_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_groups -BEFORE INSERT ON phpbb_groups -FOR EACH ROW WHEN ( - new.group_id IS NULL OR new.group_id = 0 -) -BEGIN - SELECT phpbb_groups_seq.nextval - INTO :new.group_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_icons' -*/ -CREATE TABLE phpbb_icons ( - icons_id number(8) NOT NULL, - icons_url varchar2(255) DEFAULT '' , - icons_width number(4) DEFAULT '0' NOT NULL, - icons_height number(4) DEFAULT '0' NOT NULL, - icons_order number(8) DEFAULT '0' NOT NULL, - display_on_posting number(1) DEFAULT '1' NOT NULL, - CONSTRAINT pk_phpbb_icons PRIMARY KEY (icons_id) -) -/ - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting) -/ - -CREATE SEQUENCE phpbb_icons_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_icons -BEFORE INSERT ON phpbb_icons -FOR EACH ROW WHEN ( - new.icons_id IS NULL OR new.icons_id = 0 -) -BEGIN - SELECT phpbb_icons_seq.nextval - INTO :new.icons_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_lang' -*/ -CREATE TABLE phpbb_lang ( - lang_id number(4) NOT NULL, - lang_iso varchar2(30) DEFAULT '' , - lang_dir varchar2(30) DEFAULT '' , - lang_english_name varchar2(300) DEFAULT '' , - lang_local_name varchar2(765) DEFAULT '' , - lang_author varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_lang PRIMARY KEY (lang_id) -) -/ - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso) -/ - -CREATE SEQUENCE phpbb_lang_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_lang -BEFORE INSERT ON phpbb_lang -FOR EACH ROW WHEN ( - new.lang_id IS NULL OR new.lang_id = 0 -) -BEGIN - SELECT phpbb_lang_seq.nextval - INTO :new.lang_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_log' -*/ -CREATE TABLE phpbb_log ( - log_id number(8) NOT NULL, - log_type number(4) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - topic_id number(10) DEFAULT '0' NOT NULL, - reportee_id number(8) DEFAULT '0' NOT NULL, - log_ip varchar2(40) DEFAULT '' , - log_time number(11) DEFAULT '0' NOT NULL, - log_operation clob DEFAULT '' , - log_data clob DEFAULT '' , - CONSTRAINT pk_phpbb_log PRIMARY KEY (log_id) -) -/ - -CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type) -/ -CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time) -/ -CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id) -/ -CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id) -/ -CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id) -/ -CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id) -/ - -CREATE SEQUENCE phpbb_log_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_log -BEFORE INSERT ON phpbb_log -FOR EACH ROW WHEN ( - new.log_id IS NULL OR new.log_id = 0 -) -BEGIN - SELECT phpbb_log_seq.nextval - INTO :new.log_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_login_attempts' -*/ -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar2(40) DEFAULT '' , - attempt_browser varchar2(150) DEFAULT '' , - attempt_forwarded_for varchar2(255) DEFAULT '' , - attempt_time number(11) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - username varchar2(765) DEFAULT '0' NOT NULL, - username_clean varchar2(255) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time) -/ -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time) -/ -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time) -/ -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id) -/ - -/* - Table: 'phpbb_moderator_cache' -*/ -CREATE TABLE phpbb_moderator_cache ( - forum_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - username varchar2(765) DEFAULT '' , - group_id number(8) DEFAULT '0' NOT NULL, - group_name varchar2(765) DEFAULT '' , - display_on_index number(1) DEFAULT '1' NOT NULL -) -/ - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index) -/ -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id) -/ - -/* - Table: 'phpbb_migrations' -*/ -CREATE TABLE phpbb_migrations ( - migration_name varchar2(255) DEFAULT '' , - migration_depends_on clob DEFAULT '' , - migration_schema_done number(1) DEFAULT '0' NOT NULL, - migration_data_done number(1) DEFAULT '0' NOT NULL, - migration_data_state clob DEFAULT '' , - migration_start_time number(11) DEFAULT '0' NOT NULL, - migration_end_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_migrations PRIMARY KEY (migration_name) -) -/ - - -/* - Table: 'phpbb_modules' -*/ -CREATE TABLE phpbb_modules ( - module_id number(8) NOT NULL, - module_enabled number(1) DEFAULT '1' NOT NULL, - module_display number(1) DEFAULT '1' NOT NULL, - module_basename varchar2(255) DEFAULT '' , - module_class varchar2(10) DEFAULT '' , - parent_id number(8) DEFAULT '0' NOT NULL, - left_id number(8) DEFAULT '0' NOT NULL, - right_id number(8) DEFAULT '0' NOT NULL, - module_langname varchar2(255) DEFAULT '' , - module_mode varchar2(255) DEFAULT '' , - module_auth varchar2(255) DEFAULT '' , - CONSTRAINT pk_phpbb_modules PRIMARY KEY (module_id) -) -/ - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id) -/ -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled) -/ -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id) -/ - -CREATE SEQUENCE phpbb_modules_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_modules -BEFORE INSERT ON phpbb_modules -FOR EACH ROW WHEN ( - new.module_id IS NULL OR new.module_id = 0 -) -BEGIN - SELECT phpbb_modules_seq.nextval - INTO :new.module_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_notification_types' -*/ -CREATE TABLE phpbb_notification_types ( - notification_type_id number(4) NOT NULL, - notification_type_name varchar2(255) DEFAULT '' , - notification_type_enabled number(1) DEFAULT '1' NOT NULL, - CONSTRAINT pk_phpbb_notification_types PRIMARY KEY (notification_type_id), - CONSTRAINT u_phpbb_type UNIQUE (notification_type_name) -) -/ - - -CREATE SEQUENCE phpbb_notification_types_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_notification_types -BEFORE INSERT ON phpbb_notification_types -FOR EACH ROW WHEN ( - new.notification_type_id IS NULL OR new.notification_type_id = 0 -) -BEGIN - SELECT phpbb_notification_types_seq.nextval - INTO :new.notification_type_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_notifications' -*/ -CREATE TABLE phpbb_notifications ( - notification_id number(10) NOT NULL, - notification_type_id number(4) DEFAULT '0' NOT NULL, - item_id number(8) DEFAULT '0' NOT NULL, - item_parent_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - notification_read number(1) DEFAULT '0' NOT NULL, - notification_time number(11) DEFAULT '1' NOT NULL, - notification_data clob DEFAULT '' , - CONSTRAINT pk_phpbb_notifications PRIMARY KEY (notification_id) -) -/ - -CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id) -/ -CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read) -/ - -CREATE SEQUENCE phpbb_notifications_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_notifications -BEFORE INSERT ON phpbb_notifications -FOR EACH ROW WHEN ( - new.notification_id IS NULL OR new.notification_id = 0 -) -BEGIN - SELECT phpbb_notifications_seq.nextval - INTO :new.notification_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_oauth_accounts' -*/ -CREATE TABLE phpbb_oauth_accounts ( - user_id number(10) DEFAULT '0' NOT NULL, - provider varchar2(255) DEFAULT '' , - oauth_provider_id clob DEFAULT '' , - CONSTRAINT pk_phpbb_oauth_accounts PRIMARY KEY (user_id, provider) -) -/ - - -/* - Table: 'phpbb_oauth_tokens' -*/ -CREATE TABLE phpbb_oauth_tokens ( - user_id number(10) DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' , - provider varchar2(255) DEFAULT '' , - oauth_token clob DEFAULT '' -) -/ - -CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id) -/ -CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider) -/ - -/* - Table: 'phpbb_poll_options' -*/ -CREATE TABLE phpbb_poll_options ( - poll_option_id number(4) DEFAULT '0' NOT NULL, - topic_id number(10) DEFAULT '0' NOT NULL, - poll_option_text clob DEFAULT '' , - poll_option_total number(8) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id) -/ -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id) -/ - -/* - Table: 'phpbb_poll_votes' -*/ -CREATE TABLE phpbb_poll_votes ( - topic_id number(10) DEFAULT '0' NOT NULL, - poll_option_id number(4) DEFAULT '0' NOT NULL, - vote_user_id number(8) DEFAULT '0' NOT NULL, - vote_user_ip varchar2(40) DEFAULT '' -) -/ - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id) -/ -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id) -/ -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip) -/ - -/* - Table: 'phpbb_posts' -*/ -CREATE TABLE phpbb_posts ( - post_id number(10) NOT NULL, - topic_id number(10) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - poster_id number(8) DEFAULT '0' NOT NULL, - icon_id number(8) DEFAULT '0' NOT NULL, - poster_ip varchar2(40) DEFAULT '' , - post_time number(11) DEFAULT '0' NOT NULL, - post_visibility number(3) DEFAULT '0' NOT NULL, - post_reported number(1) DEFAULT '0' NOT NULL, - enable_bbcode number(1) DEFAULT '1' NOT NULL, - enable_smilies number(1) DEFAULT '1' NOT NULL, - enable_magic_url number(1) DEFAULT '1' NOT NULL, - enable_sig number(1) DEFAULT '1' NOT NULL, - post_username varchar2(765) DEFAULT '' , - post_subject varchar2(765) DEFAULT '' , - post_text clob DEFAULT '' , - post_checksum varchar2(32) DEFAULT '' , - post_attachment number(1) DEFAULT '0' NOT NULL, - bbcode_bitfield varchar2(255) DEFAULT '' , - bbcode_uid varchar2(8) DEFAULT '' , - post_postcount number(1) DEFAULT '1' NOT NULL, - post_edit_time number(11) DEFAULT '0' NOT NULL, - post_edit_reason varchar2(765) DEFAULT '' , - post_edit_user number(8) DEFAULT '0' NOT NULL, - post_edit_count number(4) DEFAULT '0' NOT NULL, - post_edit_locked number(1) DEFAULT '0' NOT NULL, - post_delete_time number(11) DEFAULT '0' NOT NULL, - post_delete_reason varchar2(765) DEFAULT '' , - post_delete_user number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_posts PRIMARY KEY (post_id) -) -/ - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id) -/ -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id) -/ -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip) -/ -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id) -/ -CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility) -/ -CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username) -/ -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time) -/ - -CREATE SEQUENCE phpbb_posts_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_posts -BEFORE INSERT ON phpbb_posts -FOR EACH ROW WHEN ( - new.post_id IS NULL OR new.post_id = 0 -) -BEGIN - SELECT phpbb_posts_seq.nextval - INTO :new.post_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs' -*/ -CREATE TABLE phpbb_privmsgs ( - msg_id number(8) NOT NULL, - root_level number(8) DEFAULT '0' NOT NULL, - author_id number(8) DEFAULT '0' NOT NULL, - icon_id number(8) DEFAULT '0' NOT NULL, - author_ip varchar2(40) DEFAULT '' , - message_time number(11) DEFAULT '0' NOT NULL, - enable_bbcode number(1) DEFAULT '1' NOT NULL, - enable_smilies number(1) DEFAULT '1' NOT NULL, - enable_magic_url number(1) DEFAULT '1' NOT NULL, - enable_sig number(1) DEFAULT '1' NOT NULL, - message_subject varchar2(765) DEFAULT '' , - message_text clob DEFAULT '' , - message_edit_reason varchar2(765) DEFAULT '' , - message_edit_user number(8) DEFAULT '0' NOT NULL, - message_attachment number(1) DEFAULT '0' NOT NULL, - bbcode_bitfield varchar2(255) DEFAULT '' , - bbcode_uid varchar2(8) DEFAULT '' , - message_edit_time number(11) DEFAULT '0' NOT NULL, - message_edit_count number(4) DEFAULT '0' NOT NULL, - to_address clob DEFAULT '' , - bcc_address clob DEFAULT '' , - message_reported number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id) -) -/ - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip) -/ -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time) -/ -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id) -/ -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level) -/ - -CREATE SEQUENCE phpbb_privmsgs_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_privmsgs -BEFORE INSERT ON phpbb_privmsgs -FOR EACH ROW WHEN ( - new.msg_id IS NULL OR new.msg_id = 0 -) -BEGIN - SELECT phpbb_privmsgs_seq.nextval - INTO :new.msg_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs_folder' -*/ -CREATE TABLE phpbb_privmsgs_folder ( - folder_id number(8) NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - folder_name varchar2(765) DEFAULT '' , - pm_count number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_privmsgs_folder PRIMARY KEY (folder_id) -) -/ - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id) -/ - -CREATE SEQUENCE phpbb_privmsgs_folder_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_folder -BEFORE INSERT ON phpbb_privmsgs_folder -FOR EACH ROW WHEN ( - new.folder_id IS NULL OR new.folder_id = 0 -) -BEGIN - SELECT phpbb_privmsgs_folder_seq.nextval - INTO :new.folder_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs_rules' -*/ -CREATE TABLE phpbb_privmsgs_rules ( - rule_id number(8) NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - rule_check number(8) DEFAULT '0' NOT NULL, - rule_connection number(8) DEFAULT '0' NOT NULL, - rule_string varchar2(765) DEFAULT '' , - rule_user_id number(8) DEFAULT '0' NOT NULL, - rule_group_id number(8) DEFAULT '0' NOT NULL, - rule_action number(8) DEFAULT '0' NOT NULL, - rule_folder_id number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_privmsgs_rules PRIMARY KEY (rule_id) -) -/ - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id) -/ - -CREATE SEQUENCE phpbb_privmsgs_rules_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_privmsgs_rules -BEFORE INSERT ON phpbb_privmsgs_rules -FOR EACH ROW WHEN ( - new.rule_id IS NULL OR new.rule_id = 0 -) -BEGIN - SELECT phpbb_privmsgs_rules_seq.nextval - INTO :new.rule_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_privmsgs_to' -*/ -CREATE TABLE phpbb_privmsgs_to ( - msg_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - author_id number(8) DEFAULT '0' NOT NULL, - pm_deleted number(1) DEFAULT '0' NOT NULL, - pm_new number(1) DEFAULT '1' NOT NULL, - pm_unread number(1) DEFAULT '1' NOT NULL, - pm_replied number(1) DEFAULT '0' NOT NULL, - pm_marked number(1) DEFAULT '0' NOT NULL, - pm_forwarded number(1) DEFAULT '0' NOT NULL, - folder_id number(11) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id) -/ -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id) -/ -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id) -/ - -/* - Table: 'phpbb_profile_fields' -*/ -CREATE TABLE phpbb_profile_fields ( - field_id number(8) NOT NULL, - field_name varchar2(765) DEFAULT '' , - field_type varchar2(100) DEFAULT '' , - field_ident varchar2(20) DEFAULT '' , - field_length varchar2(20) DEFAULT '' , - field_minlen varchar2(255) DEFAULT '' , - field_maxlen varchar2(255) DEFAULT '' , - field_novalue varchar2(765) DEFAULT '' , - field_default_value varchar2(765) DEFAULT '' , - field_validation varchar2(60) DEFAULT '' , - field_required number(1) DEFAULT '0' NOT NULL, - field_show_novalue number(1) DEFAULT '0' NOT NULL, - field_show_on_reg number(1) DEFAULT '0' NOT NULL, - field_show_on_pm number(1) DEFAULT '0' NOT NULL, - field_show_on_vt number(1) DEFAULT '0' NOT NULL, - field_show_on_ml number(1) DEFAULT '0' NOT NULL, - field_show_profile number(1) DEFAULT '0' NOT NULL, - field_hide number(1) DEFAULT '0' NOT NULL, - field_no_view number(1) DEFAULT '0' NOT NULL, - field_active number(1) DEFAULT '0' NOT NULL, - field_order number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_profile_fields PRIMARY KEY (field_id) -) -/ - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type) -/ -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order) -/ - -CREATE SEQUENCE phpbb_profile_fields_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_profile_fields -BEFORE INSERT ON phpbb_profile_fields -FOR EACH ROW WHEN ( - new.field_id IS NULL OR new.field_id = 0 -) -BEGIN - SELECT phpbb_profile_fields_seq.nextval - INTO :new.field_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_profile_fields_data' -*/ -CREATE TABLE phpbb_profile_fields_data ( - user_id number(10) DEFAULT '0' NOT NULL, - pf_phpbb_location varchar2(255) DEFAULT '' , - pf_phpbb_interests clob DEFAULT '' , - pf_phpbb_occupation clob DEFAULT '' , - CONSTRAINT pk_phpbb_profile_fields_data PRIMARY KEY (user_id) -) -/ - - -/* - Table: 'phpbb_profile_fields_lang' -*/ -CREATE TABLE phpbb_profile_fields_lang ( - field_id number(8) DEFAULT '0' NOT NULL, - lang_id number(8) DEFAULT '0' NOT NULL, - option_id number(8) DEFAULT '0' NOT NULL, - field_type varchar2(100) DEFAULT '' , - lang_value varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_profile_fields_lang PRIMARY KEY (field_id, lang_id, option_id) -) -/ - - -/* - Table: 'phpbb_profile_lang' -*/ -CREATE TABLE phpbb_profile_lang ( - field_id number(8) DEFAULT '0' NOT NULL, - lang_id number(8) DEFAULT '0' NOT NULL, - lang_name varchar2(765) DEFAULT '' , - lang_explain clob DEFAULT '' , - lang_default_value varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_profile_lang PRIMARY KEY (field_id, lang_id) -) -/ - - -/* - Table: 'phpbb_ranks' -*/ -CREATE TABLE phpbb_ranks ( - rank_id number(8) NOT NULL, - rank_title varchar2(765) DEFAULT '' , - rank_min number(8) DEFAULT '0' NOT NULL, - rank_special number(1) DEFAULT '0' NOT NULL, - rank_image varchar2(255) DEFAULT '' , - CONSTRAINT pk_phpbb_ranks PRIMARY KEY (rank_id) -) -/ - - -CREATE SEQUENCE phpbb_ranks_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_ranks -BEFORE INSERT ON phpbb_ranks -FOR EACH ROW WHEN ( - new.rank_id IS NULL OR new.rank_id = 0 -) -BEGIN - SELECT phpbb_ranks_seq.nextval - INTO :new.rank_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_reports' -*/ -CREATE TABLE phpbb_reports ( - report_id number(8) NOT NULL, - reason_id number(4) DEFAULT '0' NOT NULL, - post_id number(10) DEFAULT '0' NOT NULL, - pm_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - user_notify number(1) DEFAULT '0' NOT NULL, - report_closed number(1) DEFAULT '0' NOT NULL, - report_time number(11) DEFAULT '0' NOT NULL, - report_text clob DEFAULT '' , - reported_post_text clob DEFAULT '' , - reported_post_uid varchar2(8) DEFAULT '' , - reported_post_bitfield varchar2(255) DEFAULT '' , - reported_post_enable_magic_url number(1) DEFAULT '1' NOT NULL, - reported_post_enable_smilies number(1) DEFAULT '1' NOT NULL, - reported_post_enable_bbcode number(1) DEFAULT '1' NOT NULL, - CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) -) -/ - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id) -/ -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id) -/ - -CREATE SEQUENCE phpbb_reports_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_reports -BEFORE INSERT ON phpbb_reports -FOR EACH ROW WHEN ( - new.report_id IS NULL OR new.report_id = 0 -) -BEGIN - SELECT phpbb_reports_seq.nextval - INTO :new.report_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_reports_reasons' -*/ -CREATE TABLE phpbb_reports_reasons ( - reason_id number(4) NOT NULL, - reason_title varchar2(765) DEFAULT '' , - reason_description clob DEFAULT '' , - reason_order number(4) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_reports_reasons PRIMARY KEY (reason_id) -) -/ - - -CREATE SEQUENCE phpbb_reports_reasons_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_reports_reasons -BEFORE INSERT ON phpbb_reports_reasons -FOR EACH ROW WHEN ( - new.reason_id IS NULL OR new.reason_id = 0 -) -BEGIN - SELECT phpbb_reports_reasons_seq.nextval - INTO :new.reason_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_search_results' -*/ -CREATE TABLE phpbb_search_results ( - search_key varchar2(32) DEFAULT '' , - search_time number(11) DEFAULT '0' NOT NULL, - search_keywords clob DEFAULT '' , - search_authors clob DEFAULT '' , - CONSTRAINT pk_phpbb_search_results PRIMARY KEY (search_key) -) -/ - - -/* - Table: 'phpbb_search_wordlist' -*/ -CREATE TABLE phpbb_search_wordlist ( - word_id number(8) NOT NULL, - word_text varchar2(765) DEFAULT '' , - word_common number(1) DEFAULT '0' NOT NULL, - word_count number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_id), - CONSTRAINT u_phpbb_wrd_txt UNIQUE (word_text) -) -/ - -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count) -/ - -CREATE SEQUENCE phpbb_search_wordlist_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_search_wordlist -BEFORE INSERT ON phpbb_search_wordlist -FOR EACH ROW WHEN ( - new.word_id IS NULL OR new.word_id = 0 -) -BEGIN - SELECT phpbb_search_wordlist_seq.nextval - INTO :new.word_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_search_wordmatch' -*/ -CREATE TABLE phpbb_search_wordmatch ( - post_id number(10) DEFAULT '0' NOT NULL, - word_id number(8) DEFAULT '0' NOT NULL, - title_match number(1) DEFAULT '0' NOT NULL, - CONSTRAINT u_phpbb_unq_mtch UNIQUE (word_id, post_id, title_match) -) -/ - -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id) -/ -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id) -/ - -/* - Table: 'phpbb_sessions' -*/ -CREATE TABLE phpbb_sessions ( - session_id char(32) DEFAULT '' , - session_user_id number(8) DEFAULT '0' NOT NULL, - session_forum_id number(8) DEFAULT '0' NOT NULL, - session_last_visit number(11) DEFAULT '0' NOT NULL, - session_start number(11) DEFAULT '0' NOT NULL, - session_time number(11) DEFAULT '0' NOT NULL, - session_ip varchar2(40) DEFAULT '' , - session_browser varchar2(150) DEFAULT '' , - session_forwarded_for varchar2(255) DEFAULT '' , - session_page varchar2(765) DEFAULT '' , - session_viewonline number(1) DEFAULT '1' NOT NULL, - session_autologin number(1) DEFAULT '0' NOT NULL, - session_admin number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_sessions PRIMARY KEY (session_id) -) -/ - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time) -/ -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id) -/ -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id) -/ - -/* - Table: 'phpbb_sessions_keys' -*/ -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) DEFAULT '' , - user_id number(10) DEFAULT '0' NOT NULL, - last_ip varchar2(40) DEFAULT '' , - last_login number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_sessions_keys PRIMARY KEY (key_id, user_id) -) -/ - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login) -/ - -/* - Table: 'phpbb_sitelist' -*/ -CREATE TABLE phpbb_sitelist ( - site_id number(8) NOT NULL, - site_ip varchar2(40) DEFAULT '' , - site_hostname varchar2(255) DEFAULT '' , - ip_exclude number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_sitelist PRIMARY KEY (site_id) -) -/ - - -CREATE SEQUENCE phpbb_sitelist_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_sitelist -BEFORE INSERT ON phpbb_sitelist -FOR EACH ROW WHEN ( - new.site_id IS NULL OR new.site_id = 0 -) -BEGIN - SELECT phpbb_sitelist_seq.nextval - INTO :new.site_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_smilies' -*/ -CREATE TABLE phpbb_smilies ( - smiley_id number(8) NOT NULL, - code varchar2(150) DEFAULT '' , - emotion varchar2(150) DEFAULT '' , - smiley_url varchar2(50) DEFAULT '' , - smiley_width number(4) DEFAULT '0' NOT NULL, - smiley_height number(4) DEFAULT '0' NOT NULL, - smiley_order number(8) DEFAULT '0' NOT NULL, - display_on_posting number(1) DEFAULT '1' NOT NULL, - CONSTRAINT pk_phpbb_smilies PRIMARY KEY (smiley_id) -) -/ - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting) -/ - -CREATE SEQUENCE phpbb_smilies_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_smilies -BEFORE INSERT ON phpbb_smilies -FOR EACH ROW WHEN ( - new.smiley_id IS NULL OR new.smiley_id = 0 -) -BEGIN - SELECT phpbb_smilies_seq.nextval - INTO :new.smiley_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_styles' -*/ -CREATE TABLE phpbb_styles ( - style_id number(8) NOT NULL, - style_name varchar2(765) DEFAULT '' , - style_copyright varchar2(765) DEFAULT '' , - style_active number(1) DEFAULT '1' NOT NULL, - style_path varchar2(100) DEFAULT '' , - bbcode_bitfield varchar2(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id number(4) DEFAULT '0' NOT NULL, - style_parent_tree clob DEFAULT '' , - CONSTRAINT pk_phpbb_styles PRIMARY KEY (style_id), - CONSTRAINT u_phpbb_style_name UNIQUE (style_name) -) -/ - - -CREATE SEQUENCE phpbb_styles_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_styles -BEFORE INSERT ON phpbb_styles -FOR EACH ROW WHEN ( - new.style_id IS NULL OR new.style_id = 0 -) -BEGIN - SELECT phpbb_styles_seq.nextval - INTO :new.style_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_teampage' -*/ -CREATE TABLE phpbb_teampage ( - teampage_id number(8) NOT NULL, - group_id number(8) DEFAULT '0' NOT NULL, - teampage_name varchar2(765) DEFAULT '' , - teampage_position number(8) DEFAULT '0' NOT NULL, - teampage_parent number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_teampage PRIMARY KEY (teampage_id) -) -/ - - -CREATE SEQUENCE phpbb_teampage_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_teampage -BEFORE INSERT ON phpbb_teampage -FOR EACH ROW WHEN ( - new.teampage_id IS NULL OR new.teampage_id = 0 -) -BEGIN - SELECT phpbb_teampage_seq.nextval - INTO :new.teampage_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_topics' -*/ -CREATE TABLE phpbb_topics ( - topic_id number(10) NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - icon_id number(8) DEFAULT '0' NOT NULL, - topic_attachment number(1) DEFAULT '0' NOT NULL, - topic_visibility number(3) DEFAULT '0' NOT NULL, - topic_reported number(1) DEFAULT '0' NOT NULL, - topic_title varchar2(765) DEFAULT '' , - topic_poster number(8) DEFAULT '0' NOT NULL, - topic_time number(11) DEFAULT '0' NOT NULL, - topic_time_limit number(11) DEFAULT '0' NOT NULL, - topic_views number(8) DEFAULT '0' NOT NULL, - topic_posts_approved number(8) DEFAULT '0' NOT NULL, - topic_posts_unapproved number(8) DEFAULT '0' NOT NULL, - topic_posts_softdeleted number(8) DEFAULT '0' NOT NULL, - topic_status number(3) DEFAULT '0' NOT NULL, - topic_type number(3) DEFAULT '0' NOT NULL, - topic_first_post_id number(8) DEFAULT '0' NOT NULL, - topic_first_poster_name varchar2(765) DEFAULT '' , - topic_first_poster_colour varchar2(6) DEFAULT '' , - topic_last_post_id number(8) DEFAULT '0' NOT NULL, - topic_last_poster_id number(8) DEFAULT '0' NOT NULL, - topic_last_poster_name varchar2(765) DEFAULT '' , - topic_last_poster_colour varchar2(6) DEFAULT '' , - topic_last_post_subject varchar2(765) DEFAULT '' , - topic_last_post_time number(11) DEFAULT '0' NOT NULL, - topic_last_view_time number(11) DEFAULT '0' NOT NULL, - topic_moved_id number(8) DEFAULT '0' NOT NULL, - topic_bumped number(1) DEFAULT '0' NOT NULL, - topic_bumper number(8) DEFAULT '0' NOT NULL, - poll_title varchar2(765) DEFAULT '' , - poll_start number(11) DEFAULT '0' NOT NULL, - poll_length number(11) DEFAULT '0' NOT NULL, - poll_max_options number(4) DEFAULT '1' NOT NULL, - poll_last_vote number(11) DEFAULT '0' NOT NULL, - poll_vote_change number(1) DEFAULT '0' NOT NULL, - topic_delete_time number(11) DEFAULT '0' NOT NULL, - topic_delete_reason varchar2(765) DEFAULT '' , - topic_delete_user number(8) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_topics PRIMARY KEY (topic_id) -) -/ - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id) -/ -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type) -/ -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time) -/ -CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility) -/ -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id) -/ -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id) -/ - -CREATE SEQUENCE phpbb_topics_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_topics -BEFORE INSERT ON phpbb_topics -FOR EACH ROW WHEN ( - new.topic_id IS NULL OR new.topic_id = 0 -) -BEGIN - SELECT phpbb_topics_seq.nextval - INTO :new.topic_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_topics_track' -*/ -CREATE TABLE phpbb_topics_track ( - user_id number(10) DEFAULT '0' NOT NULL, - topic_id number(10) DEFAULT '0' NOT NULL, - forum_id number(8) DEFAULT '0' NOT NULL, - mark_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_topics_track PRIMARY KEY (user_id, topic_id) -) -/ - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id) -/ -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id) -/ - -/* - Table: 'phpbb_topics_posted' -*/ -CREATE TABLE phpbb_topics_posted ( - user_id number(10) DEFAULT '0' NOT NULL, - topic_id number(10) DEFAULT '0' NOT NULL, - topic_posted number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_topics_posted PRIMARY KEY (user_id, topic_id) -) -/ - - -/* - Table: 'phpbb_topics_watch' -*/ -CREATE TABLE phpbb_topics_watch ( - topic_id number(10) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - notify_status number(1) DEFAULT '0' NOT NULL -) -/ - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id) -/ -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id) -/ -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status) -/ - -/* - Table: 'phpbb_user_notifications' -*/ -CREATE TABLE phpbb_user_notifications ( - item_type varchar2(255) DEFAULT '' , - item_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - method varchar2(255) DEFAULT '' , - notify number(1) DEFAULT '1' NOT NULL -) -/ - - -/* - Table: 'phpbb_user_group' -*/ -CREATE TABLE phpbb_user_group ( - group_id number(8) DEFAULT '0' NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - group_leader number(1) DEFAULT '0' NOT NULL, - user_pending number(1) DEFAULT '1' NOT NULL -) -/ - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id) -/ -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id) -/ -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader) -/ - -/* - Table: 'phpbb_users' -*/ -CREATE TABLE phpbb_users ( - user_id number(10) NOT NULL, - user_type number(2) DEFAULT '0' NOT NULL, - group_id number(8) DEFAULT '3' NOT NULL, - user_permissions clob DEFAULT '' , - user_perm_from number(8) DEFAULT '0' NOT NULL, - user_ip varchar2(40) DEFAULT '' , - user_regdate number(11) DEFAULT '0' NOT NULL, - username varchar2(255) DEFAULT '' , - username_clean varchar2(255) DEFAULT '' , - user_password varchar2(765) DEFAULT '' , - user_passchg number(11) DEFAULT '0' NOT NULL, - user_pass_convert number(1) DEFAULT '0' NOT NULL, - user_actkey varchar2(32) DEFAULT '' , - user_newpasswd varchar2(765) DEFAULT '' , - user_email varchar2(300) DEFAULT '' , - user_email_hash number(20) DEFAULT '0' NOT NULL, - user_birthday varchar2(10) DEFAULT '' , - user_lastvisit number(11) DEFAULT '0' NOT NULL, - user_lastmark number(11) DEFAULT '0' NOT NULL, - user_lastpost_time number(11) DEFAULT '0' NOT NULL, - user_lastpage varchar2(600) DEFAULT '' , - user_last_confirm_key varchar2(10) DEFAULT '' , - user_last_search number(11) DEFAULT '0' NOT NULL, - user_warnings number(4) DEFAULT '0' NOT NULL, - user_last_warning number(11) DEFAULT '0' NOT NULL, - user_login_attempts number(4) DEFAULT '0' NOT NULL, - user_inactive_reason number(2) DEFAULT '0' NOT NULL, - user_inactive_time number(11) DEFAULT '0' NOT NULL, - user_posts number(8) DEFAULT '0' NOT NULL, - user_lang varchar2(30) DEFAULT '' , - user_timezone varchar2(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varchar2(90) DEFAULT 'd M Y H:i' NOT NULL, - user_style number(8) DEFAULT '0' NOT NULL, - user_rank number(8) DEFAULT '0' NOT NULL, - user_colour varchar2(6) DEFAULT '' , - user_new_privmsg number(4) DEFAULT '0' NOT NULL, - user_unread_privmsg number(4) DEFAULT '0' NOT NULL, - user_last_privmsg number(11) DEFAULT '0' NOT NULL, - user_message_rules number(1) DEFAULT '0' NOT NULL, - user_full_folder number(11) DEFAULT '-3' NOT NULL, - user_emailtime number(11) DEFAULT '0' NOT NULL, - user_topic_show_days number(4) DEFAULT '0' NOT NULL, - user_topic_sortby_type varchar2(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varchar2(1) DEFAULT 'd' NOT NULL, - user_post_show_days number(4) DEFAULT '0' NOT NULL, - user_post_sortby_type varchar2(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varchar2(1) DEFAULT 'a' NOT NULL, - user_notify number(1) DEFAULT '0' NOT NULL, - user_notify_pm number(1) DEFAULT '1' NOT NULL, - user_notify_type number(4) DEFAULT '0' NOT NULL, - user_allow_pm number(1) DEFAULT '1' NOT NULL, - user_allow_viewonline number(1) DEFAULT '1' NOT NULL, - user_allow_viewemail number(1) DEFAULT '1' NOT NULL, - user_allow_massemail number(1) DEFAULT '1' NOT NULL, - user_options number(11) DEFAULT '230271' NOT NULL, - user_avatar varchar2(255) DEFAULT '' , - user_avatar_type varchar2(255) DEFAULT '' , - user_avatar_width number(4) DEFAULT '0' NOT NULL, - user_avatar_height number(4) DEFAULT '0' NOT NULL, - user_sig clob DEFAULT '' , - user_sig_bbcode_uid varchar2(8) DEFAULT '' , - user_sig_bbcode_bitfield varchar2(255) DEFAULT '' , - user_icq varchar2(15) DEFAULT '' , - user_aim varchar2(765) DEFAULT '' , - user_yim varchar2(765) DEFAULT '' , - user_msnm varchar2(765) DEFAULT '' , - user_jabber varchar2(765) DEFAULT '' , - user_website varchar2(600) DEFAULT '' , - user_form_salt varchar2(96) DEFAULT '' , - user_new number(1) DEFAULT '1' NOT NULL, - user_reminded number(4) DEFAULT '0' NOT NULL, - user_reminded_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_users PRIMARY KEY (user_id), - CONSTRAINT u_phpbb_username_clean UNIQUE (username_clean) -) -/ - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday) -/ -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash) -/ -CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type) -/ - -CREATE SEQUENCE phpbb_users_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_users -BEFORE INSERT ON phpbb_users -FOR EACH ROW WHEN ( - new.user_id IS NULL OR new.user_id = 0 -) -BEGIN - SELECT phpbb_users_seq.nextval - INTO :new.user_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_warnings' -*/ -CREATE TABLE phpbb_warnings ( - warning_id number(8) NOT NULL, - user_id number(10) DEFAULT '0' NOT NULL, - post_id number(10) DEFAULT '0' NOT NULL, - log_id number(8) DEFAULT '0' NOT NULL, - warning_time number(11) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_warnings PRIMARY KEY (warning_id) -) -/ - - -CREATE SEQUENCE phpbb_warnings_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_warnings -BEFORE INSERT ON phpbb_warnings -FOR EACH ROW WHEN ( - new.warning_id IS NULL OR new.warning_id = 0 -) -BEGIN - SELECT phpbb_warnings_seq.nextval - INTO :new.warning_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_words' -*/ -CREATE TABLE phpbb_words ( - word_id number(8) NOT NULL, - word varchar2(765) DEFAULT '' , - replacement varchar2(765) DEFAULT '' , - CONSTRAINT pk_phpbb_words PRIMARY KEY (word_id) -) -/ - - -CREATE SEQUENCE phpbb_words_seq -/ - -CREATE OR REPLACE TRIGGER t_phpbb_words -BEFORE INSERT ON phpbb_words -FOR EACH ROW WHEN ( - new.word_id IS NULL OR new.word_id = 0 -) -BEGIN - SELECT phpbb_words_seq.nextval - INTO :new.word_id - FROM dual; -END; -/ - - -/* - Table: 'phpbb_zebra' -*/ -CREATE TABLE phpbb_zebra ( - user_id number(10) DEFAULT '0' NOT NULL, - zebra_id number(8) DEFAULT '0' NOT NULL, - friend number(1) DEFAULT '0' NOT NULL, - foe number(1) DEFAULT '0' NOT NULL, - CONSTRAINT pk_phpbb_zebra PRIMARY KEY (user_id, zebra_id) -) -/ - - diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 031a473a84..890580a8b8 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1,10 +1,3 @@ -/* - * DO NOT EDIT THIS FILE, IT IS GENERATED - * - * To change the contents of this file, edit - * phpBB/develop/create_schema_files.php and - * run it. - */ BEGIN; @@ -83,1283 +76,4 @@ CREATE OPERATOR =( MERGES, SORT1= <); -/* - Table: 'phpbb_attachments' -*/ -CREATE SEQUENCE phpbb_attachments_seq; - -CREATE TABLE phpbb_attachments ( - attach_id INT4 DEFAULT nextval('phpbb_attachments_seq'), - post_msg_id INT4 DEFAULT '0' NOT NULL CHECK (post_msg_id >= 0), - topic_id INT4 DEFAULT '0' NOT NULL, - in_message INT2 DEFAULT '0' NOT NULL CHECK (in_message >= 0), - poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), - is_orphan INT2 DEFAULT '1' NOT NULL CHECK (is_orphan >= 0), - physical_filename varchar(255) DEFAULT '' NOT NULL, - real_filename varchar(255) DEFAULT '' NOT NULL, - download_count INT4 DEFAULT '0' NOT NULL CHECK (download_count >= 0), - attach_comment varchar(4000) DEFAULT '' NOT NULL, - extension varchar(100) DEFAULT '' NOT NULL, - mimetype varchar(100) DEFAULT '' NOT NULL, - filesize INT4 DEFAULT '0' NOT NULL CHECK (filesize >= 0), - filetime INT4 DEFAULT '0' NOT NULL CHECK (filetime >= 0), - thumbnail INT2 DEFAULT '0' NOT NULL CHECK (thumbnail >= 0), - PRIMARY KEY (attach_id) -); - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); - -/* - Table: 'phpbb_acl_groups' -*/ -CREATE TABLE phpbb_acl_groups ( - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), - auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), - auth_setting INT2 DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); - -/* - Table: 'phpbb_acl_options' -*/ -CREATE SEQUENCE phpbb_acl_options_seq; - -CREATE TABLE phpbb_acl_options ( - auth_option_id INT4 DEFAULT nextval('phpbb_acl_options_seq'), - auth_option varchar(50) DEFAULT '' NOT NULL, - is_global INT2 DEFAULT '0' NOT NULL CHECK (is_global >= 0), - is_local INT2 DEFAULT '0' NOT NULL CHECK (is_local >= 0), - founder_only INT2 DEFAULT '0' NOT NULL CHECK (founder_only >= 0), - PRIMARY KEY (auth_option_id) -); - -CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); - -/* - Table: 'phpbb_acl_roles' -*/ -CREATE SEQUENCE phpbb_acl_roles_seq; - -CREATE TABLE phpbb_acl_roles ( - role_id INT4 DEFAULT nextval('phpbb_acl_roles_seq'), - role_name varchar(255) DEFAULT '' NOT NULL, - role_description varchar(4000) DEFAULT '' NOT NULL, - role_type varchar(10) DEFAULT '' NOT NULL, - role_order INT2 DEFAULT '0' NOT NULL CHECK (role_order >= 0), - PRIMARY KEY (role_id) -); - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); - -/* - Table: 'phpbb_acl_roles_data' -*/ -CREATE TABLE phpbb_acl_roles_data ( - role_id INT4 DEFAULT '0' NOT NULL CHECK (role_id >= 0), - auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), - auth_setting INT2 DEFAULT '0' NOT NULL, - PRIMARY KEY (role_id, auth_option_id) -); - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); - -/* - Table: 'phpbb_acl_users' -*/ -CREATE TABLE phpbb_acl_users ( - user_id INT4 DEFAULT '0' NOT NULL, - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - auth_option_id INT4 DEFAULT '0' NOT NULL CHECK (auth_option_id >= 0), - auth_role_id INT4 DEFAULT '0' NOT NULL CHECK (auth_role_id >= 0), - auth_setting INT2 DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); - -/* - Table: 'phpbb_banlist' -*/ -CREATE SEQUENCE phpbb_banlist_seq; - -CREATE TABLE phpbb_banlist ( - ban_id INT4 DEFAULT nextval('phpbb_banlist_seq'), - ban_userid INT4 DEFAULT '0' NOT NULL CHECK (ban_userid >= 0), - ban_ip varchar(40) DEFAULT '' NOT NULL, - ban_email varchar(100) DEFAULT '' NOT NULL, - ban_start INT4 DEFAULT '0' NOT NULL CHECK (ban_start >= 0), - ban_end INT4 DEFAULT '0' NOT NULL CHECK (ban_end >= 0), - ban_exclude INT2 DEFAULT '0' NOT NULL CHECK (ban_exclude >= 0), - ban_reason varchar(255) DEFAULT '' NOT NULL, - ban_give_reason varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (ban_id) -); - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); - -/* - Table: 'phpbb_bbcodes' -*/ -CREATE TABLE phpbb_bbcodes ( - bbcode_id INT2 DEFAULT '0' NOT NULL CHECK (bbcode_id >= 0), - bbcode_tag varchar(16) DEFAULT '' NOT NULL, - bbcode_helpline varchar(255) DEFAULT '' NOT NULL, - display_on_posting INT2 DEFAULT '0' NOT NULL CHECK (display_on_posting >= 0), - bbcode_match varchar(4000) DEFAULT '' NOT NULL, - bbcode_tpl TEXT DEFAULT '' NOT NULL, - first_pass_match TEXT DEFAULT '' NOT NULL, - first_pass_replace TEXT DEFAULT '' NOT NULL, - second_pass_match TEXT DEFAULT '' NOT NULL, - second_pass_replace TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (bbcode_id) -); - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); - -/* - Table: 'phpbb_bookmarks' -*/ -CREATE TABLE phpbb_bookmarks ( - topic_id INT4 DEFAULT '0' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL, - PRIMARY KEY (topic_id, user_id) -); - - -/* - Table: 'phpbb_bots' -*/ -CREATE SEQUENCE phpbb_bots_seq; - -CREATE TABLE phpbb_bots ( - bot_id INT4 DEFAULT nextval('phpbb_bots_seq'), - bot_active INT2 DEFAULT '1' NOT NULL CHECK (bot_active >= 0), - bot_name varchar(255) DEFAULT '' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL, - bot_agent varchar(255) DEFAULT '' NOT NULL, - bot_ip varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (bot_id) -); - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); - -/* - Table: 'phpbb_config' -*/ -CREATE TABLE phpbb_config ( - config_name varchar(255) DEFAULT '' NOT NULL, - config_value varchar(255) DEFAULT '' NOT NULL, - is_dynamic INT2 DEFAULT '0' NOT NULL CHECK (is_dynamic >= 0), - PRIMARY KEY (config_name) -); - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); - -/* - Table: 'phpbb_config_text' -*/ -CREATE TABLE phpbb_config_text ( - config_name varchar(255) DEFAULT '' NOT NULL, - config_value TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (config_name) -); - - -/* - Table: 'phpbb_confirm' -*/ -CREATE TABLE phpbb_confirm ( - confirm_id char(32) DEFAULT '' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - confirm_type INT2 DEFAULT '0' NOT NULL, - code varchar(8) DEFAULT '' NOT NULL, - seed INT4 DEFAULT '0' NOT NULL CHECK (seed >= 0), - attempts INT4 DEFAULT '0' NOT NULL CHECK (attempts >= 0), - PRIMARY KEY (session_id, confirm_id) -); - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); - -/* - Table: 'phpbb_disallow' -*/ -CREATE SEQUENCE phpbb_disallow_seq; - -CREATE TABLE phpbb_disallow ( - disallow_id INT4 DEFAULT nextval('phpbb_disallow_seq'), - disallow_username varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (disallow_id) -); - - -/* - Table: 'phpbb_drafts' -*/ -CREATE SEQUENCE phpbb_drafts_seq; - -CREATE TABLE phpbb_drafts ( - draft_id INT4 DEFAULT nextval('phpbb_drafts_seq'), - user_id INT4 DEFAULT '0' NOT NULL, - topic_id INT4 DEFAULT '0' NOT NULL, - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - save_time INT4 DEFAULT '0' NOT NULL CHECK (save_time >= 0), - draft_subject varchar(255) DEFAULT '' NOT NULL, - draft_message TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (draft_id) -); - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); - -/* - Table: 'phpbb_ext' -*/ -CREATE TABLE phpbb_ext ( - ext_name varchar(255) DEFAULT '' NOT NULL, - ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0), - ext_state varchar(8000) DEFAULT '' NOT NULL -); - -CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); - -/* - Table: 'phpbb_extensions' -*/ -CREATE SEQUENCE phpbb_extensions_seq; - -CREATE TABLE phpbb_extensions ( - extension_id INT4 DEFAULT nextval('phpbb_extensions_seq'), - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - extension varchar(100) DEFAULT '' NOT NULL, - PRIMARY KEY (extension_id) -); - - -/* - Table: 'phpbb_extension_groups' -*/ -CREATE SEQUENCE phpbb_extension_groups_seq; - -CREATE TABLE phpbb_extension_groups ( - group_id INT4 DEFAULT nextval('phpbb_extension_groups_seq'), - group_name varchar(255) DEFAULT '' NOT NULL, - cat_id INT2 DEFAULT '0' NOT NULL, - allow_group INT2 DEFAULT '0' NOT NULL CHECK (allow_group >= 0), - download_mode INT2 DEFAULT '1' NOT NULL CHECK (download_mode >= 0), - upload_icon varchar(255) DEFAULT '' NOT NULL, - max_filesize INT4 DEFAULT '0' NOT NULL CHECK (max_filesize >= 0), - allowed_forums varchar(8000) DEFAULT '' NOT NULL, - allow_in_pm INT2 DEFAULT '0' NOT NULL CHECK (allow_in_pm >= 0), - PRIMARY KEY (group_id) -); - - -/* - Table: 'phpbb_forums' -*/ -CREATE SEQUENCE phpbb_forums_seq; - -CREATE TABLE phpbb_forums ( - forum_id INT4 DEFAULT nextval('phpbb_forums_seq'), - parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), - left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), - right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), - forum_parents TEXT DEFAULT '' NOT NULL, - forum_name varchar(255) DEFAULT '' NOT NULL, - forum_desc varchar(4000) DEFAULT '' NOT NULL, - forum_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_desc_options INT4 DEFAULT '7' NOT NULL CHECK (forum_desc_options >= 0), - forum_desc_uid varchar(8) DEFAULT '' NOT NULL, - forum_link varchar(255) DEFAULT '' NOT NULL, - forum_password varchar(255) DEFAULT '' NOT NULL, - forum_style INT4 DEFAULT '0' NOT NULL CHECK (forum_style >= 0), - forum_image varchar(255) DEFAULT '' NOT NULL, - forum_rules varchar(4000) DEFAULT '' NOT NULL, - forum_rules_link varchar(255) DEFAULT '' NOT NULL, - forum_rules_bitfield varchar(255) DEFAULT '' NOT NULL, - forum_rules_options INT4 DEFAULT '7' NOT NULL CHECK (forum_rules_options >= 0), - forum_rules_uid varchar(8) DEFAULT '' NOT NULL, - forum_topics_per_page INT2 DEFAULT '0' NOT NULL, - forum_type INT2 DEFAULT '0' NOT NULL, - forum_status INT2 DEFAULT '0' NOT NULL, - forum_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_approved >= 0), - forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0), - forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0), - forum_topics_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_approved >= 0), - forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0), - forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0), - forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), - forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0), - forum_last_post_subject varchar(255) DEFAULT '' NOT NULL, - forum_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_time >= 0), - forum_last_poster_name varchar(255) DEFAULT '' NOT NULL, - forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - forum_flags INT2 DEFAULT '32' NOT NULL, - forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0), - display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0), - display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0), - enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0), - enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0), - enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0), - prune_next INT4 DEFAULT '0' NOT NULL CHECK (prune_next >= 0), - prune_days INT4 DEFAULT '0' NOT NULL CHECK (prune_days >= 0), - prune_viewed INT4 DEFAULT '0' NOT NULL CHECK (prune_viewed >= 0), - prune_freq INT4 DEFAULT '0' NOT NULL CHECK (prune_freq >= 0), - PRIMARY KEY (forum_id) -); - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); - -/* - Table: 'phpbb_forums_access' -*/ -CREATE TABLE phpbb_forums_access ( - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - PRIMARY KEY (forum_id, user_id, session_id) -); - - -/* - Table: 'phpbb_forums_track' -*/ -CREATE TABLE phpbb_forums_track ( - user_id INT4 DEFAULT '0' NOT NULL, - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), - PRIMARY KEY (user_id, forum_id) -); - - -/* - Table: 'phpbb_forums_watch' -*/ -CREATE TABLE phpbb_forums_watch ( - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) -); - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); - -/* - Table: 'phpbb_groups' -*/ -CREATE SEQUENCE phpbb_groups_seq; - -CREATE TABLE phpbb_groups ( - group_id INT4 DEFAULT nextval('phpbb_groups_seq'), - group_type INT2 DEFAULT '1' NOT NULL, - group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0), - group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0), - group_name varchar_ci DEFAULT '' NOT NULL, - group_desc varchar(4000) DEFAULT '' NOT NULL, - group_desc_bitfield varchar(255) DEFAULT '' NOT NULL, - group_desc_options INT4 DEFAULT '7' NOT NULL CHECK (group_desc_options >= 0), - group_desc_uid varchar(8) DEFAULT '' NOT NULL, - group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0), - group_avatar varchar(255) DEFAULT '' NOT NULL, - group_avatar_type varchar(255) DEFAULT '' NOT NULL, - group_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_width >= 0), - group_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (group_avatar_height >= 0), - group_rank INT4 DEFAULT '0' NOT NULL CHECK (group_rank >= 0), - group_colour varchar(6) DEFAULT '' NOT NULL, - group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0), - group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0), - group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0), - group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0), - group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0), - PRIMARY KEY (group_id) -); - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); - -/* - Table: 'phpbb_icons' -*/ -CREATE SEQUENCE phpbb_icons_seq; - -CREATE TABLE phpbb_icons ( - icons_id INT4 DEFAULT nextval('phpbb_icons_seq'), - icons_url varchar(255) DEFAULT '' NOT NULL, - icons_width INT2 DEFAULT '0' NOT NULL, - icons_height INT2 DEFAULT '0' NOT NULL, - icons_order INT4 DEFAULT '0' NOT NULL CHECK (icons_order >= 0), - display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), - PRIMARY KEY (icons_id) -); - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); - -/* - Table: 'phpbb_lang' -*/ -CREATE SEQUENCE phpbb_lang_seq; - -CREATE TABLE phpbb_lang ( - lang_id INT2 DEFAULT nextval('phpbb_lang_seq'), - lang_iso varchar(30) DEFAULT '' NOT NULL, - lang_dir varchar(30) DEFAULT '' NOT NULL, - lang_english_name varchar(100) DEFAULT '' NOT NULL, - lang_local_name varchar(255) DEFAULT '' NOT NULL, - lang_author varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (lang_id) -); - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); - -/* - Table: 'phpbb_log' -*/ -CREATE SEQUENCE phpbb_log_seq; - -CREATE TABLE phpbb_log ( - log_id INT4 DEFAULT nextval('phpbb_log_seq'), - log_type INT2 DEFAULT '0' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL, - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - topic_id INT4 DEFAULT '0' NOT NULL, - reportee_id INT4 DEFAULT '0' NOT NULL CHECK (reportee_id >= 0), - log_ip varchar(40) DEFAULT '' NOT NULL, - log_time INT4 DEFAULT '0' NOT NULL CHECK (log_time >= 0), - log_operation varchar(4000) DEFAULT '' NOT NULL, - log_data TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (log_id) -); - -CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); -CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); -CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); -CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); -CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); -CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); - -/* - Table: 'phpbb_login_attempts' -*/ -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar(40) DEFAULT '' NOT NULL, - attempt_browser varchar(150) DEFAULT '' NOT NULL, - attempt_forwarded_for varchar(255) DEFAULT '' NOT NULL, - attempt_time INT4 DEFAULT '0' NOT NULL CHECK (attempt_time >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '0' NOT NULL, - username_clean varchar_ci DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); - -/* - Table: 'phpbb_moderator_cache' -*/ -CREATE TABLE phpbb_moderator_cache ( - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - username varchar(255) DEFAULT '' NOT NULL, - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - group_name varchar(255) DEFAULT '' NOT NULL, - display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0) -); - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); - -/* - Table: 'phpbb_migrations' -*/ -CREATE TABLE phpbb_migrations ( - migration_name varchar(255) DEFAULT '' NOT NULL, - migration_depends_on varchar(8000) DEFAULT '' NOT NULL, - migration_schema_done INT2 DEFAULT '0' NOT NULL CHECK (migration_schema_done >= 0), - migration_data_done INT2 DEFAULT '0' NOT NULL CHECK (migration_data_done >= 0), - migration_data_state varchar(8000) DEFAULT '' NOT NULL, - migration_start_time INT4 DEFAULT '0' NOT NULL CHECK (migration_start_time >= 0), - migration_end_time INT4 DEFAULT '0' NOT NULL CHECK (migration_end_time >= 0), - PRIMARY KEY (migration_name) -); - - -/* - Table: 'phpbb_modules' -*/ -CREATE SEQUENCE phpbb_modules_seq; - -CREATE TABLE phpbb_modules ( - module_id INT4 DEFAULT nextval('phpbb_modules_seq'), - module_enabled INT2 DEFAULT '1' NOT NULL CHECK (module_enabled >= 0), - module_display INT2 DEFAULT '1' NOT NULL CHECK (module_display >= 0), - module_basename varchar(255) DEFAULT '' NOT NULL, - module_class varchar(10) DEFAULT '' NOT NULL, - parent_id INT4 DEFAULT '0' NOT NULL CHECK (parent_id >= 0), - left_id INT4 DEFAULT '0' NOT NULL CHECK (left_id >= 0), - right_id INT4 DEFAULT '0' NOT NULL CHECK (right_id >= 0), - module_langname varchar(255) DEFAULT '' NOT NULL, - module_mode varchar(255) DEFAULT '' NOT NULL, - module_auth varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (module_id) -); - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); - -/* - Table: 'phpbb_notification_types' -*/ -CREATE SEQUENCE phpbb_notification_types_seq; - -CREATE TABLE phpbb_notification_types ( - notification_type_id INT2 DEFAULT nextval('phpbb_notification_types_seq'), - notification_type_name varchar(255) DEFAULT '' NOT NULL, - notification_type_enabled INT2 DEFAULT '1' NOT NULL CHECK (notification_type_enabled >= 0), - PRIMARY KEY (notification_type_id) -); - -CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types (notification_type_name); - -/* - Table: 'phpbb_notifications' -*/ -CREATE SEQUENCE phpbb_notifications_seq; - -CREATE TABLE phpbb_notifications ( - notification_id INT4 DEFAULT nextval('phpbb_notifications_seq'), - notification_type_id INT2 DEFAULT '0' NOT NULL CHECK (notification_type_id >= 0), - item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0), - item_parent_id INT4 DEFAULT '0' NOT NULL CHECK (item_parent_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - notification_read INT2 DEFAULT '0' NOT NULL CHECK (notification_read >= 0), - notification_time INT4 DEFAULT '1' NOT NULL CHECK (notification_time >= 0), - notification_data varchar(4000) DEFAULT '' NOT NULL, - PRIMARY KEY (notification_id) -); - -CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id); -CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read); - -/* - Table: 'phpbb_oauth_accounts' -*/ -CREATE TABLE phpbb_oauth_accounts ( - user_id INT4 DEFAULT '0' NOT NULL, - provider varchar(255) DEFAULT '' NOT NULL, - oauth_provider_id varchar(4000) DEFAULT '' NOT NULL, - PRIMARY KEY (user_id, provider) -); - - -/* - Table: 'phpbb_oauth_tokens' -*/ -CREATE TABLE phpbb_oauth_tokens ( - user_id INT4 DEFAULT '0' NOT NULL, - session_id char(32) DEFAULT '' NOT NULL, - provider varchar(255) DEFAULT '' NOT NULL, - oauth_token TEXT DEFAULT '' NOT NULL -); - -CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id); -CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider); - -/* - Table: 'phpbb_poll_options' -*/ -CREATE TABLE phpbb_poll_options ( - poll_option_id INT2 DEFAULT '0' NOT NULL, - topic_id INT4 DEFAULT '0' NOT NULL, - poll_option_text varchar(4000) DEFAULT '' NOT NULL, - poll_option_total INT4 DEFAULT '0' NOT NULL CHECK (poll_option_total >= 0) -); - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); - -/* - Table: 'phpbb_poll_votes' -*/ -CREATE TABLE phpbb_poll_votes ( - topic_id INT4 DEFAULT '0' NOT NULL, - poll_option_id INT2 DEFAULT '0' NOT NULL, - vote_user_id INT4 DEFAULT '0' NOT NULL CHECK (vote_user_id >= 0), - vote_user_ip varchar(40) DEFAULT '' NOT NULL -); - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); - -/* - Table: 'phpbb_posts' -*/ -CREATE SEQUENCE phpbb_posts_seq; - -CREATE TABLE phpbb_posts ( - post_id INT4 DEFAULT nextval('phpbb_posts_seq'), - topic_id INT4 DEFAULT '0' NOT NULL, - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - poster_id INT4 DEFAULT '0' NOT NULL CHECK (poster_id >= 0), - icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), - poster_ip varchar(40) DEFAULT '' NOT NULL, - post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0), - post_visibility INT2 DEFAULT '0' NOT NULL, - post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0), - enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), - enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), - enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), - enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), - post_username varchar(255) DEFAULT '' NOT NULL, - post_subject varchar(255) DEFAULT '' NOT NULL, - post_text TEXT DEFAULT '' NOT NULL, - post_checksum varchar(32) DEFAULT '' NOT NULL, - post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0), - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0), - post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0), - post_edit_reason varchar(255) DEFAULT '' NOT NULL, - post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0), - post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0), - post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0), - post_delete_time INT4 DEFAULT '0' NOT NULL CHECK (post_delete_time >= 0), - post_delete_reason varchar(255) DEFAULT '' NOT NULL, - post_delete_user INT4 DEFAULT '0' NOT NULL CHECK (post_delete_user >= 0), - PRIMARY KEY (post_id) -); - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); -CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility); -CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); - -/* - Table: 'phpbb_privmsgs' -*/ -CREATE SEQUENCE phpbb_privmsgs_seq; - -CREATE TABLE phpbb_privmsgs ( - msg_id INT4 DEFAULT nextval('phpbb_privmsgs_seq'), - root_level INT4 DEFAULT '0' NOT NULL CHECK (root_level >= 0), - author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), - icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), - author_ip varchar(40) DEFAULT '' NOT NULL, - message_time INT4 DEFAULT '0' NOT NULL CHECK (message_time >= 0), - enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0), - enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0), - enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (enable_magic_url >= 0), - enable_sig INT2 DEFAULT '1' NOT NULL CHECK (enable_sig >= 0), - message_subject varchar(255) DEFAULT '' NOT NULL, - message_text TEXT DEFAULT '' NOT NULL, - message_edit_reason varchar(255) DEFAULT '' NOT NULL, - message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0), - message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0), - bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - bbcode_uid varchar(8) DEFAULT '' NOT NULL, - message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0), - message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0), - to_address varchar(4000) DEFAULT '' NOT NULL, - bcc_address varchar(4000) DEFAULT '' NOT NULL, - message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0), - PRIMARY KEY (msg_id) -); - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); - -/* - Table: 'phpbb_privmsgs_folder' -*/ -CREATE SEQUENCE phpbb_privmsgs_folder_seq; - -CREATE TABLE phpbb_privmsgs_folder ( - folder_id INT4 DEFAULT nextval('phpbb_privmsgs_folder_seq'), - user_id INT4 DEFAULT '0' NOT NULL, - folder_name varchar(255) DEFAULT '' NOT NULL, - pm_count INT4 DEFAULT '0' NOT NULL CHECK (pm_count >= 0), - PRIMARY KEY (folder_id) -); - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); - -/* - Table: 'phpbb_privmsgs_rules' -*/ -CREATE SEQUENCE phpbb_privmsgs_rules_seq; - -CREATE TABLE phpbb_privmsgs_rules ( - rule_id INT4 DEFAULT nextval('phpbb_privmsgs_rules_seq'), - user_id INT4 DEFAULT '0' NOT NULL, - rule_check INT4 DEFAULT '0' NOT NULL CHECK (rule_check >= 0), - rule_connection INT4 DEFAULT '0' NOT NULL CHECK (rule_connection >= 0), - rule_string varchar(255) DEFAULT '' NOT NULL, - rule_user_id INT4 DEFAULT '0' NOT NULL CHECK (rule_user_id >= 0), - rule_group_id INT4 DEFAULT '0' NOT NULL CHECK (rule_group_id >= 0), - rule_action INT4 DEFAULT '0' NOT NULL CHECK (rule_action >= 0), - rule_folder_id INT4 DEFAULT '0' NOT NULL, - PRIMARY KEY (rule_id) -); - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); - -/* - Table: 'phpbb_privmsgs_to' -*/ -CREATE TABLE phpbb_privmsgs_to ( - msg_id INT4 DEFAULT '0' NOT NULL CHECK (msg_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - author_id INT4 DEFAULT '0' NOT NULL CHECK (author_id >= 0), - pm_deleted INT2 DEFAULT '0' NOT NULL CHECK (pm_deleted >= 0), - pm_new INT2 DEFAULT '1' NOT NULL CHECK (pm_new >= 0), - pm_unread INT2 DEFAULT '1' NOT NULL CHECK (pm_unread >= 0), - pm_replied INT2 DEFAULT '0' NOT NULL CHECK (pm_replied >= 0), - pm_marked INT2 DEFAULT '0' NOT NULL CHECK (pm_marked >= 0), - pm_forwarded INT2 DEFAULT '0' NOT NULL CHECK (pm_forwarded >= 0), - folder_id INT4 DEFAULT '0' NOT NULL -); - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); - -/* - Table: 'phpbb_profile_fields' -*/ -CREATE SEQUENCE phpbb_profile_fields_seq; - -CREATE TABLE phpbb_profile_fields ( - field_id INT4 DEFAULT nextval('phpbb_profile_fields_seq'), - field_name varchar(255) DEFAULT '' NOT NULL, - field_type varchar(100) DEFAULT '' NOT NULL, - field_ident varchar(20) DEFAULT '' NOT NULL, - field_length varchar(20) DEFAULT '' NOT NULL, - field_minlen varchar(255) DEFAULT '' NOT NULL, - field_maxlen varchar(255) DEFAULT '' NOT NULL, - field_novalue varchar(255) DEFAULT '' NOT NULL, - field_default_value varchar(255) DEFAULT '' NOT NULL, - field_validation varchar(20) DEFAULT '' NOT NULL, - field_required INT2 DEFAULT '0' NOT NULL CHECK (field_required >= 0), - field_show_novalue INT2 DEFAULT '0' NOT NULL CHECK (field_show_novalue >= 0), - field_show_on_reg INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_reg >= 0), - field_show_on_pm INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_pm >= 0), - field_show_on_vt INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_vt >= 0), - field_show_on_ml INT2 DEFAULT '0' NOT NULL CHECK (field_show_on_ml >= 0), - field_show_profile INT2 DEFAULT '0' NOT NULL CHECK (field_show_profile >= 0), - field_hide INT2 DEFAULT '0' NOT NULL CHECK (field_hide >= 0), - field_no_view INT2 DEFAULT '0' NOT NULL CHECK (field_no_view >= 0), - field_active INT2 DEFAULT '0' NOT NULL CHECK (field_active >= 0), - field_order INT4 DEFAULT '0' NOT NULL CHECK (field_order >= 0), - PRIMARY KEY (field_id) -); - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); - -/* - Table: 'phpbb_profile_fields_data' -*/ -CREATE TABLE phpbb_profile_fields_data ( - user_id INT4 DEFAULT '0' NOT NULL, - pf_phpbb_location varchar(255) DEFAULT '' NOT NULL, - pf_phpbb_interests varchar(4000) DEFAULT '' NOT NULL, - pf_phpbb_occupation varchar(4000) DEFAULT '' NOT NULL, - PRIMARY KEY (user_id) -); - - -/* - Table: 'phpbb_profile_fields_lang' -*/ -CREATE TABLE phpbb_profile_fields_lang ( - field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), - lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), - option_id INT4 DEFAULT '0' NOT NULL CHECK (option_id >= 0), - field_type varchar(100) DEFAULT '' NOT NULL, - lang_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id, option_id) -); - - -/* - Table: 'phpbb_profile_lang' -*/ -CREATE TABLE phpbb_profile_lang ( - field_id INT4 DEFAULT '0' NOT NULL CHECK (field_id >= 0), - lang_id INT4 DEFAULT '0' NOT NULL CHECK (lang_id >= 0), - lang_name varchar(255) DEFAULT '' NOT NULL, - lang_explain varchar(4000) DEFAULT '' NOT NULL, - lang_default_value varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (field_id, lang_id) -); - - -/* - Table: 'phpbb_ranks' -*/ -CREATE SEQUENCE phpbb_ranks_seq; - -CREATE TABLE phpbb_ranks ( - rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'), - rank_title varchar(255) DEFAULT '' NOT NULL, - rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0), - rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0), - rank_image varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (rank_id) -); - - -/* - Table: 'phpbb_reports' -*/ -CREATE SEQUENCE phpbb_reports_seq; - -CREATE TABLE phpbb_reports ( - report_id INT4 DEFAULT nextval('phpbb_reports_seq'), - reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0), - post_id INT4 DEFAULT '0' NOT NULL, - pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), - report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), - report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), - report_text TEXT DEFAULT '' NOT NULL, - reported_post_text TEXT DEFAULT '' NOT NULL, - reported_post_uid varchar(8) DEFAULT '' NOT NULL, - reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, - reported_post_enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_magic_url >= 0), - reported_post_enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_smilies >= 0), - reported_post_enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_bbcode >= 0), - PRIMARY KEY (report_id) -); - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); - -/* - Table: 'phpbb_reports_reasons' -*/ -CREATE SEQUENCE phpbb_reports_reasons_seq; - -CREATE TABLE phpbb_reports_reasons ( - reason_id INT2 DEFAULT nextval('phpbb_reports_reasons_seq'), - reason_title varchar(255) DEFAULT '' NOT NULL, - reason_description TEXT DEFAULT '' NOT NULL, - reason_order INT2 DEFAULT '0' NOT NULL CHECK (reason_order >= 0), - PRIMARY KEY (reason_id) -); - - -/* - Table: 'phpbb_search_results' -*/ -CREATE TABLE phpbb_search_results ( - search_key varchar(32) DEFAULT '' NOT NULL, - search_time INT4 DEFAULT '0' NOT NULL CHECK (search_time >= 0), - search_keywords TEXT DEFAULT '' NOT NULL, - search_authors TEXT DEFAULT '' NOT NULL, - PRIMARY KEY (search_key) -); - - -/* - Table: 'phpbb_search_wordlist' -*/ -CREATE SEQUENCE phpbb_search_wordlist_seq; - -CREATE TABLE phpbb_search_wordlist ( - word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'), - word_text varchar(255) DEFAULT '' NOT NULL, - word_common INT2 DEFAULT '0' NOT NULL CHECK (word_common >= 0), - word_count INT4 DEFAULT '0' NOT NULL CHECK (word_count >= 0), - PRIMARY KEY (word_id) -); - -CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); - -/* - Table: 'phpbb_search_wordmatch' -*/ -CREATE TABLE phpbb_search_wordmatch ( - post_id INT4 DEFAULT '0' NOT NULL, - word_id INT4 DEFAULT '0' NOT NULL CHECK (word_id >= 0), - title_match INT2 DEFAULT '0' NOT NULL CHECK (title_match >= 0) -); - -CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); - -/* - Table: 'phpbb_sessions' -*/ -CREATE TABLE phpbb_sessions ( - session_id char(32) DEFAULT '' NOT NULL, - session_user_id INT4 DEFAULT '0' NOT NULL CHECK (session_user_id >= 0), - session_forum_id INT4 DEFAULT '0' NOT NULL CHECK (session_forum_id >= 0), - session_last_visit INT4 DEFAULT '0' NOT NULL CHECK (session_last_visit >= 0), - session_start INT4 DEFAULT '0' NOT NULL CHECK (session_start >= 0), - session_time INT4 DEFAULT '0' NOT NULL CHECK (session_time >= 0), - session_ip varchar(40) DEFAULT '' NOT NULL, - session_browser varchar(150) DEFAULT '' NOT NULL, - session_forwarded_for varchar(255) DEFAULT '' NOT NULL, - session_page varchar(255) DEFAULT '' NOT NULL, - session_viewonline INT2 DEFAULT '1' NOT NULL CHECK (session_viewonline >= 0), - session_autologin INT2 DEFAULT '0' NOT NULL CHECK (session_autologin >= 0), - session_admin INT2 DEFAULT '0' NOT NULL CHECK (session_admin >= 0), - PRIMARY KEY (session_id) -); - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); - -/* - Table: 'phpbb_sessions_keys' -*/ -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) DEFAULT '' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL, - last_ip varchar(40) DEFAULT '' NOT NULL, - last_login INT4 DEFAULT '0' NOT NULL CHECK (last_login >= 0), - PRIMARY KEY (key_id, user_id) -); - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); - -/* - Table: 'phpbb_sitelist' -*/ -CREATE SEQUENCE phpbb_sitelist_seq; - -CREATE TABLE phpbb_sitelist ( - site_id INT4 DEFAULT nextval('phpbb_sitelist_seq'), - site_ip varchar(40) DEFAULT '' NOT NULL, - site_hostname varchar(255) DEFAULT '' NOT NULL, - ip_exclude INT2 DEFAULT '0' NOT NULL CHECK (ip_exclude >= 0), - PRIMARY KEY (site_id) -); - - -/* - Table: 'phpbb_smilies' -*/ -CREATE SEQUENCE phpbb_smilies_seq; - -CREATE TABLE phpbb_smilies ( - smiley_id INT4 DEFAULT nextval('phpbb_smilies_seq'), - code varchar(50) DEFAULT '' NOT NULL, - emotion varchar(50) DEFAULT '' NOT NULL, - smiley_url varchar(50) DEFAULT '' NOT NULL, - smiley_width INT2 DEFAULT '0' NOT NULL CHECK (smiley_width >= 0), - smiley_height INT2 DEFAULT '0' NOT NULL CHECK (smiley_height >= 0), - smiley_order INT4 DEFAULT '0' NOT NULL CHECK (smiley_order >= 0), - display_on_posting INT2 DEFAULT '1' NOT NULL CHECK (display_on_posting >= 0), - PRIMARY KEY (smiley_id) -); - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); - -/* - Table: 'phpbb_styles' -*/ -CREATE SEQUENCE phpbb_styles_seq; - -CREATE TABLE phpbb_styles ( - style_id INT4 DEFAULT nextval('phpbb_styles_seq'), - style_name varchar(255) DEFAULT '' NOT NULL, - style_copyright varchar(255) DEFAULT '' NOT NULL, - style_active INT2 DEFAULT '1' NOT NULL CHECK (style_active >= 0), - style_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield varchar(255) DEFAULT 'kNg=' NOT NULL, - style_parent_id INT4 DEFAULT '0' NOT NULL CHECK (style_parent_id >= 0), - style_parent_tree varchar(8000) DEFAULT '' NOT NULL, - PRIMARY KEY (style_id) -); - -CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); - -/* - Table: 'phpbb_teampage' -*/ -CREATE SEQUENCE phpbb_teampage_seq; - -CREATE TABLE phpbb_teampage ( - teampage_id INT4 DEFAULT nextval('phpbb_teampage_seq'), - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - teampage_name varchar(255) DEFAULT '' NOT NULL, - teampage_position INT4 DEFAULT '0' NOT NULL CHECK (teampage_position >= 0), - teampage_parent INT4 DEFAULT '0' NOT NULL CHECK (teampage_parent >= 0), - PRIMARY KEY (teampage_id) -); - - -/* - Table: 'phpbb_topics' -*/ -CREATE SEQUENCE phpbb_topics_seq; - -CREATE TABLE phpbb_topics ( - topic_id INT4 DEFAULT nextval('phpbb_topics_seq'), - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0), - topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0), - topic_visibility INT2 DEFAULT '0' NOT NULL, - topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0), - topic_title varchar(255) DEFAULT '' NOT NULL, - topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0), - topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), - topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), - topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), - topic_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_approved >= 0), - topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0), - topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0), - topic_status INT2 DEFAULT '0' NOT NULL, - topic_type INT2 DEFAULT '0' NOT NULL, - topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0), - topic_first_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_first_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_id >= 0), - topic_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (topic_last_poster_id >= 0), - topic_last_poster_name varchar(255) DEFAULT '' NOT NULL, - topic_last_poster_colour varchar(6) DEFAULT '' NOT NULL, - topic_last_post_subject varchar(255) DEFAULT '' NOT NULL, - topic_last_post_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_post_time >= 0), - topic_last_view_time INT4 DEFAULT '0' NOT NULL CHECK (topic_last_view_time >= 0), - topic_moved_id INT4 DEFAULT '0' NOT NULL CHECK (topic_moved_id >= 0), - topic_bumped INT2 DEFAULT '0' NOT NULL CHECK (topic_bumped >= 0), - topic_bumper INT4 DEFAULT '0' NOT NULL CHECK (topic_bumper >= 0), - poll_title varchar(255) DEFAULT '' NOT NULL, - poll_start INT4 DEFAULT '0' NOT NULL CHECK (poll_start >= 0), - poll_length INT4 DEFAULT '0' NOT NULL CHECK (poll_length >= 0), - poll_max_options INT2 DEFAULT '1' NOT NULL, - poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0), - poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0), - topic_delete_time INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_time >= 0), - topic_delete_reason varchar(255) DEFAULT '' NOT NULL, - topic_delete_user INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_user >= 0), - PRIMARY KEY (topic_id) -); - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); -CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility); -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id); -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); - -/* - Table: 'phpbb_topics_track' -*/ -CREATE TABLE phpbb_topics_track ( - user_id INT4 DEFAULT '0' NOT NULL, - topic_id INT4 DEFAULT '0' NOT NULL, - forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0), - mark_time INT4 DEFAULT '0' NOT NULL CHECK (mark_time >= 0), - PRIMARY KEY (user_id, topic_id) -); - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); - -/* - Table: 'phpbb_topics_posted' -*/ -CREATE TABLE phpbb_topics_posted ( - user_id INT4 DEFAULT '0' NOT NULL, - topic_id INT4 DEFAULT '0' NOT NULL, - topic_posted INT2 DEFAULT '0' NOT NULL CHECK (topic_posted >= 0), - PRIMARY KEY (user_id, topic_id) -); - - -/* - Table: 'phpbb_topics_watch' -*/ -CREATE TABLE phpbb_topics_watch ( - topic_id INT4 DEFAULT '0' NOT NULL, - user_id INT4 DEFAULT '0' NOT NULL, - notify_status INT2 DEFAULT '0' NOT NULL CHECK (notify_status >= 0) -); - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); - -/* - Table: 'phpbb_user_notifications' -*/ -CREATE TABLE phpbb_user_notifications ( - item_type varchar(255) DEFAULT '' NOT NULL, - item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - method varchar(255) DEFAULT '' NOT NULL, - notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0) -); - - -/* - Table: 'phpbb_user_group' -*/ -CREATE TABLE phpbb_user_group ( - group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), - user_id INT4 DEFAULT '0' NOT NULL, - group_leader INT2 DEFAULT '0' NOT NULL CHECK (group_leader >= 0), - user_pending INT2 DEFAULT '1' NOT NULL CHECK (user_pending >= 0) -); - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); - -/* - Table: 'phpbb_users' -*/ -CREATE SEQUENCE phpbb_users_seq; - -CREATE TABLE phpbb_users ( - user_id INT4 DEFAULT nextval('phpbb_users_seq'), - user_type INT2 DEFAULT '0' NOT NULL, - group_id INT4 DEFAULT '3' NOT NULL CHECK (group_id >= 0), - user_permissions TEXT DEFAULT '' NOT NULL, - user_perm_from INT4 DEFAULT '0' NOT NULL CHECK (user_perm_from >= 0), - user_ip varchar(40) DEFAULT '' NOT NULL, - user_regdate INT4 DEFAULT '0' NOT NULL CHECK (user_regdate >= 0), - username varchar_ci DEFAULT '' NOT NULL, - username_clean varchar_ci DEFAULT '' NOT NULL, - user_password varchar(255) DEFAULT '' NOT NULL, - user_passchg INT4 DEFAULT '0' NOT NULL CHECK (user_passchg >= 0), - user_pass_convert INT2 DEFAULT '0' NOT NULL CHECK (user_pass_convert >= 0), - user_actkey varchar(32) DEFAULT '' NOT NULL, - user_newpasswd varchar(255) DEFAULT '' NOT NULL, - user_email varchar(100) DEFAULT '' NOT NULL, - user_email_hash INT8 DEFAULT '0' NOT NULL, - user_birthday varchar(10) DEFAULT '' NOT NULL, - user_lastvisit INT4 DEFAULT '0' NOT NULL CHECK (user_lastvisit >= 0), - user_lastmark INT4 DEFAULT '0' NOT NULL CHECK (user_lastmark >= 0), - user_lastpost_time INT4 DEFAULT '0' NOT NULL CHECK (user_lastpost_time >= 0), - user_lastpage varchar(200) DEFAULT '' NOT NULL, - user_last_confirm_key varchar(10) DEFAULT '' NOT NULL, - user_last_search INT4 DEFAULT '0' NOT NULL CHECK (user_last_search >= 0), - user_warnings INT2 DEFAULT '0' NOT NULL, - user_last_warning INT4 DEFAULT '0' NOT NULL CHECK (user_last_warning >= 0), - user_login_attempts INT2 DEFAULT '0' NOT NULL, - user_inactive_reason INT2 DEFAULT '0' NOT NULL, - user_inactive_time INT4 DEFAULT '0' NOT NULL CHECK (user_inactive_time >= 0), - user_posts INT4 DEFAULT '0' NOT NULL CHECK (user_posts >= 0), - user_lang varchar(30) DEFAULT '' NOT NULL, - user_timezone varchar(100) DEFAULT 'UTC' NOT NULL, - user_dateformat varchar(30) DEFAULT 'd M Y H:i' NOT NULL, - user_style INT4 DEFAULT '0' NOT NULL CHECK (user_style >= 0), - user_rank INT4 DEFAULT '0' NOT NULL CHECK (user_rank >= 0), - user_colour varchar(6) DEFAULT '' NOT NULL, - user_new_privmsg INT4 DEFAULT '0' NOT NULL, - user_unread_privmsg INT4 DEFAULT '0' NOT NULL, - user_last_privmsg INT4 DEFAULT '0' NOT NULL CHECK (user_last_privmsg >= 0), - user_message_rules INT2 DEFAULT '0' NOT NULL CHECK (user_message_rules >= 0), - user_full_folder INT4 DEFAULT '-3' NOT NULL, - user_emailtime INT4 DEFAULT '0' NOT NULL CHECK (user_emailtime >= 0), - user_topic_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_topic_show_days >= 0), - user_topic_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_topic_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, - user_post_show_days INT2 DEFAULT '0' NOT NULL CHECK (user_post_show_days >= 0), - user_post_sortby_type varchar(1) DEFAULT 't' NOT NULL, - user_post_sortby_dir varchar(1) DEFAULT 'a' NOT NULL, - user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0), - user_notify_pm INT2 DEFAULT '1' NOT NULL CHECK (user_notify_pm >= 0), - user_notify_type INT2 DEFAULT '0' NOT NULL, - user_allow_pm INT2 DEFAULT '1' NOT NULL CHECK (user_allow_pm >= 0), - user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0), - user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0), - user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0), - user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0), - user_avatar varchar(255) DEFAULT '' NOT NULL, - user_avatar_type varchar(255) DEFAULT '' NOT NULL, - user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0), - user_avatar_height INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_height >= 0), - user_sig TEXT DEFAULT '' NOT NULL, - user_sig_bbcode_uid varchar(8) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL, - user_icq varchar(15) DEFAULT '' NOT NULL, - user_aim varchar(255) DEFAULT '' NOT NULL, - user_yim varchar(255) DEFAULT '' NOT NULL, - user_msnm varchar(255) DEFAULT '' NOT NULL, - user_jabber varchar(255) DEFAULT '' NOT NULL, - user_website varchar(200) DEFAULT '' NOT NULL, - user_form_salt varchar(32) DEFAULT '' NOT NULL, - user_new INT2 DEFAULT '1' NOT NULL CHECK (user_new >= 0), - user_reminded INT2 DEFAULT '0' NOT NULL, - user_reminded_time INT4 DEFAULT '0' NOT NULL CHECK (user_reminded_time >= 0), - PRIMARY KEY (user_id) -); - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); -CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); -CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); - -/* - Table: 'phpbb_warnings' -*/ -CREATE SEQUENCE phpbb_warnings_seq; - -CREATE TABLE phpbb_warnings ( - warning_id INT4 DEFAULT nextval('phpbb_warnings_seq'), - user_id INT4 DEFAULT '0' NOT NULL, - post_id INT4 DEFAULT '0' NOT NULL, - log_id INT4 DEFAULT '0' NOT NULL CHECK (log_id >= 0), - warning_time INT4 DEFAULT '0' NOT NULL CHECK (warning_time >= 0), - PRIMARY KEY (warning_id) -); - - -/* - Table: 'phpbb_words' -*/ -CREATE SEQUENCE phpbb_words_seq; - -CREATE TABLE phpbb_words ( - word_id INT4 DEFAULT nextval('phpbb_words_seq'), - word varchar(255) DEFAULT '' NOT NULL, - replacement varchar(255) DEFAULT '' NOT NULL, - PRIMARY KEY (word_id) -); - - -/* - Table: 'phpbb_zebra' -*/ -CREATE TABLE phpbb_zebra ( - user_id INT4 DEFAULT '0' NOT NULL, - zebra_id INT4 DEFAULT '0' NOT NULL CHECK (zebra_id >= 0), - friend INT2 DEFAULT '0' NOT NULL CHECK (friend >= 0), - foe INT2 DEFAULT '0' NOT NULL CHECK (foe >= 0), - PRIMARY KEY (user_id, zebra_id) -); - - - -COMMIT;
\ No newline at end of file +COMMIT; diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 2aff81a6a5..6e5cefc624 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -21,6 +21,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_cdn', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_emailreuse', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_password_reset', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forum_notify', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_live_searches', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_mass_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', 'USERNAME_CHARS_ANY'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange', '0'); @@ -40,6 +41,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_pm', '1' INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_smilies', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_topic_notify', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allowed_schemes_links', 'http,https,ftp'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('assets_version', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('attachment_quota', '52428800'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_bbcode_pm', '1'); @@ -56,6 +58,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_min_width', INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path', 'images/avatars/upload'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_salt', 'phpbb_avatar'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact', 'contact@yourdomain.tld'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact_name', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email', 'address@yourdomain.tld'); @@ -68,7 +71,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('browser_check', '1 INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_interval', '10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_type', 'd'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('cache_gc', '7200'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_plugin', 'phpbb_captcha_nogd'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_plugin', 'core.captcha.plugins.nogd'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foreground_noise', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25'); @@ -80,6 +83,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('confirm_refresh', INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('contact_admin_form_enable', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_domain', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_name', 'phpbb3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_path', '/'); @@ -95,6 +99,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edite INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subject', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('extension_force_unstable', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); @@ -103,6 +108,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_si INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_mod_rewrite', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_board_notifications', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '1'); @@ -171,13 +177,13 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_birthdays', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_memberlist', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_pm', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_memberlist', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofile', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_track', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jumpbox', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_moderators', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_notifications', '1'); @@ -269,7 +275,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0 INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-a4-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.0-a3-dev'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); @@ -296,9 +302,16 @@ INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('sessio INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('upload_dir_size', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('warnings_last_gc', '0', 1); +# Config text +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info', ''); +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_uid', ''); +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_bitfield', ''); +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_flags', '7'); + # -- Forum related auth options INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_announce', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_announce_global', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_attach', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_bbcode', 1); INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_bump', 1); @@ -345,6 +358,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_soft # -- Global moderator auth option (not a local option) INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_pm_report', 0, 1); INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_warn', 0, 1); # -- Admin related auth options @@ -459,7 +473,7 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', 10); # -- phpbb_styles -INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Group', 1, 'prosilver', 'kNg=', 0, ''); +INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Limited', 1, 'prosilver', 'kNg=', 0, ''); # -- Forums INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, ''); @@ -467,10 +481,10 @@ INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48); # -- Users / Anonymous user -INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', 0); +INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', 0); # -- username: Admin password: admin (change this or remove it once everything is working!) -INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', ''); +INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', ''); # -- Groups INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5); @@ -532,7 +546,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 11, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option NOT IN ('m_ban', 'm_chgposter'); # Simple Moderator (m_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_softdelete', 'm_edit', 'm_info', 'm_report'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_softdelete', 'm_edit', 'm_info', 'm_report', 'm_pm_report'); # Queue Moderator (m_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 13, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_approve', 'm_edit'); @@ -541,7 +555,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 14, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%'; # Standard Access (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_flash', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_announce_global', 'f_flash', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock'); # No Access (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = 'f_'; @@ -550,20 +564,20 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 17, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_search', 'f_subscribe', 'f_print'); # Limited Access (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 18, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 18, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_announce_global', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg'); # Bot Access (f_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 19, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_print'); # On Moderation Queue (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_announce_global', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove'); INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove'); # Standard Access + Polls (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_flash', 'f_ignoreflood', 'f_sticky', 'f_user_lock'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_announce_global', 'f_flash', 'f_ignoreflood', 'f_sticky', 'f_user_lock'); # Limited Access + Polls (f_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_announce_global', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg'); # New Member (u_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group', 'u_chgprofileinfo'); @@ -622,7 +636,7 @@ INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, # Bots having bot access INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (6, 2, 0, 19, 0); -# NEW MEMBERS aren't allowed to PM +# NEW MEMBERS are not allowed to send private messages INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 0, 0, 23, 0); # NEW MEMBERS on the queue @@ -705,10 +719,7 @@ INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mo INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('ARCHIVES', 0, 1, 1, '', 0, ''); INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('PLAIN_TEXT', 0, 0, 1, '', 0, ''); INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('DOCUMENTS', 0, 0, 1, '', 0, ''); -INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('REAL_MEDIA', 3, 0, 1, '', 0, ''); -INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('WINDOWS_MEDIA', 2, 0, 1, '', 0, ''); INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('FLASH_FILES', 5, 0, 1, '', 0, ''); -INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('QUICKTIME_MEDIA', 6, 0, 1, '', 0, ''); INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('DOWNLOADABLE_FILES', 0, 0, 1, '', 0, ''); # -- extensions @@ -765,37 +776,32 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ods'); INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odt'); INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'rtf'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'rm'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'ram'); - -INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'wma'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'wmv'); - -INSERT INTO phpbb_extensions (group_id, extension) VALUES (7, 'swf'); - -INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'mov'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'm4v'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'm4a'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'mp4'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, '3gp'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, '3g2'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'qt'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'swf'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mpeg'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mpg'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mp3'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg'); -INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'mp3'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'mpeg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'mpg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'ogg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'ogm'); # Add default profile fields -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order) VALUES ('phpbb_location', 'profilefields.type.string', 'phpbb_location', '20', '2', '100', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order) VALUES ('phpbb_interests', 'profilefields.type.text', 'phpbb_interests', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 2); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order) VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 3); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_location', 'profilefields.type.string', 'phpbb_location', '20', '2', '100', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_website', 'profilefields.type.url', 'phpbb_website', '40', '12', '255', '', '', '', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 2, 1, 'VISIT_WEBSITE', '%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_interests', 'profilefields.type.text', 'phpbb_interests', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_aol', 'profilefields.type.string', 'phpbb_aol', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 5, 1, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'ymsgr:sendim?%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_facebook', 'profilefields.type.string', 'phpbb_facebook', '20', '5', '50', '', '', '[\w.]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 9, 1, 'VIEW_FACEBOOK_PROFILE', 'http://facebook.com/%s/'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_skype', 'profilefields.type.string', 'phpbb_skype', '20', '6', '32', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 11, 1, 'VIEW_SKYPE_PROFILE', 'skype:%s?userinfo'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_youtube', 'profilefields.type.string', 'phpbb_youtube', '20', '3', '60', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 12, 1, 'VIEW_YOUTUBE_CHANNEL', 'http://youtube.com/user/%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_googleplus', 'profilefields.type.googleplus', 'phpbb_googleplus', '20', '3', '255', '', '', '[\w]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 13, 1, 'VIEW_GOOGLEPLUS_PROFILE', 'http://plus.google.com/%s'); # User Notification Options (for first user) -INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, ''); -INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, 'email'); -INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, ''); -INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, 'email'); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.board'); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.email'); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, 'notification.method.board'); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, 'notification.method.email'); # POSTGRES COMMIT # diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql deleted file mode 100644 index 717b242a57..0000000000 --- a/phpBB/install/schemas/sqlite_schema.sql +++ /dev/null @@ -1,1051 +0,0 @@ -# DO NOT EDIT THIS FILE, IT IS GENERATED -# -# To change the contents of this file, edit -# phpBB/develop/create_schema_files.php and -# run it. -BEGIN TRANSACTION; - -# Table: 'phpbb_attachments' -CREATE TABLE phpbb_attachments ( - attach_id INTEGER PRIMARY KEY NOT NULL , - post_msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - in_message INTEGER UNSIGNED NOT NULL DEFAULT '0', - poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - is_orphan INTEGER UNSIGNED NOT NULL DEFAULT '1', - physical_filename varchar(255) NOT NULL DEFAULT '', - real_filename varchar(255) NOT NULL DEFAULT '', - download_count INTEGER UNSIGNED NOT NULL DEFAULT '0', - attach_comment text(65535) NOT NULL DEFAULT '', - extension varchar(100) NOT NULL DEFAULT '', - mimetype varchar(100) NOT NULL DEFAULT '', - filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', - filetime INTEGER UNSIGNED NOT NULL DEFAULT '0', - thumbnail INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); -CREATE INDEX phpbb_attachments_is_orphan ON phpbb_attachments (is_orphan); - -# Table: 'phpbb_acl_groups' -CREATE TABLE phpbb_acl_groups ( - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_setting tinyint(2) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); -CREATE INDEX phpbb_acl_groups_auth_opt_id ON phpbb_acl_groups (auth_option_id); -CREATE INDEX phpbb_acl_groups_auth_role_id ON phpbb_acl_groups (auth_role_id); - -# Table: 'phpbb_acl_options' -CREATE TABLE phpbb_acl_options ( - auth_option_id INTEGER PRIMARY KEY NOT NULL , - auth_option varchar(50) NOT NULL DEFAULT '', - is_global INTEGER UNSIGNED NOT NULL DEFAULT '0', - is_local INTEGER UNSIGNED NOT NULL DEFAULT '0', - founder_only INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE UNIQUE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); - -# Table: 'phpbb_acl_roles' -CREATE TABLE phpbb_acl_roles ( - role_id INTEGER PRIMARY KEY NOT NULL , - role_name varchar(255) NOT NULL DEFAULT '', - role_description text(65535) NOT NULL DEFAULT '', - role_type varchar(10) NOT NULL DEFAULT '', - role_order INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); - -# Table: 'phpbb_acl_roles_data' -CREATE TABLE phpbb_acl_roles_data ( - role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_setting tinyint(2) NOT NULL DEFAULT '0', - PRIMARY KEY (role_id, auth_option_id) -); - -CREATE INDEX phpbb_acl_roles_data_ath_op_id ON phpbb_acl_roles_data (auth_option_id); - -# Table: 'phpbb_acl_users' -CREATE TABLE phpbb_acl_users ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_role_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - auth_setting tinyint(2) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); -CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id); - -# Table: 'phpbb_banlist' -CREATE TABLE phpbb_banlist ( - ban_id INTEGER PRIMARY KEY NOT NULL , - ban_userid INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_ip varchar(40) NOT NULL DEFAULT '', - ban_email varchar(100) NOT NULL DEFAULT '', - ban_start INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_end INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_exclude INTEGER UNSIGNED NOT NULL DEFAULT '0', - ban_reason varchar(255) NOT NULL DEFAULT '', - ban_give_reason varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_banlist_ban_end ON phpbb_banlist (ban_end); -CREATE INDEX phpbb_banlist_ban_user ON phpbb_banlist (ban_userid, ban_exclude); -CREATE INDEX phpbb_banlist_ban_email ON phpbb_banlist (ban_email, ban_exclude); -CREATE INDEX phpbb_banlist_ban_ip ON phpbb_banlist (ban_ip, ban_exclude); - -# Table: 'phpbb_bbcodes' -CREATE TABLE phpbb_bbcodes ( - bbcode_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_tag varchar(16) NOT NULL DEFAULT '', - bbcode_helpline varchar(255) NOT NULL DEFAULT '', - display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_match text(65535) NOT NULL DEFAULT '', - bbcode_tpl mediumtext(16777215) NOT NULL DEFAULT '', - first_pass_match mediumtext(16777215) NOT NULL DEFAULT '', - first_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', - second_pass_match mediumtext(16777215) NOT NULL DEFAULT '', - second_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', - PRIMARY KEY (bbcode_id) -); - -CREATE INDEX phpbb_bbcodes_display_on_post ON phpbb_bbcodes (display_on_posting); - -# Table: 'phpbb_bookmarks' -CREATE TABLE phpbb_bookmarks ( - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (topic_id, user_id) -); - - -# Table: 'phpbb_bots' -CREATE TABLE phpbb_bots ( - bot_id INTEGER PRIMARY KEY NOT NULL , - bot_active INTEGER UNSIGNED NOT NULL DEFAULT '1', - bot_name text(65535) NOT NULL DEFAULT '', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - bot_agent varchar(255) NOT NULL DEFAULT '', - bot_ip varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); - -# Table: 'phpbb_config' -CREATE TABLE phpbb_config ( - config_name varchar(255) NOT NULL DEFAULT '', - config_value varchar(255) NOT NULL DEFAULT '', - is_dynamic INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (config_name) -); - -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); - -# Table: 'phpbb_config_text' -CREATE TABLE phpbb_config_text ( - config_name varchar(255) NOT NULL DEFAULT '', - config_value mediumtext(16777215) NOT NULL DEFAULT '', - PRIMARY KEY (config_name) -); - - -# Table: 'phpbb_confirm' -CREATE TABLE phpbb_confirm ( - confirm_id char(32) NOT NULL DEFAULT '', - session_id char(32) NOT NULL DEFAULT '', - confirm_type tinyint(3) NOT NULL DEFAULT '0', - code varchar(8) NOT NULL DEFAULT '', - seed INTEGER UNSIGNED NOT NULL DEFAULT '0', - attempts INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (session_id, confirm_id) -); - -CREATE INDEX phpbb_confirm_confirm_type ON phpbb_confirm (confirm_type); - -# Table: 'phpbb_disallow' -CREATE TABLE phpbb_disallow ( - disallow_id INTEGER PRIMARY KEY NOT NULL , - disallow_username varchar(255) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_drafts' -CREATE TABLE phpbb_drafts ( - draft_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - save_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - draft_subject text(65535) NOT NULL DEFAULT '', - draft_message mediumtext(16777215) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); - -# Table: 'phpbb_ext' -CREATE TABLE phpbb_ext ( - ext_name varchar(255) NOT NULL DEFAULT '', - ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0', - ext_state text(65535) NOT NULL DEFAULT '' -); - -CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name); - -# Table: 'phpbb_extensions' -CREATE TABLE phpbb_extensions ( - extension_id INTEGER PRIMARY KEY NOT NULL , - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - extension varchar(100) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_extension_groups' -CREATE TABLE phpbb_extension_groups ( - group_id INTEGER PRIMARY KEY NOT NULL , - group_name varchar(255) NOT NULL DEFAULT '', - cat_id tinyint(2) NOT NULL DEFAULT '0', - allow_group INTEGER UNSIGNED NOT NULL DEFAULT '0', - download_mode INTEGER UNSIGNED NOT NULL DEFAULT '1', - upload_icon varchar(255) NOT NULL DEFAULT '', - max_filesize INTEGER UNSIGNED NOT NULL DEFAULT '0', - allowed_forums text(65535) NOT NULL DEFAULT '', - allow_in_pm INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_forums' -CREATE TABLE phpbb_forums ( - forum_id INTEGER PRIMARY KEY NOT NULL , - parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_parents mediumtext(16777215) NOT NULL DEFAULT '', - forum_name text(65535) NOT NULL DEFAULT '', - forum_desc text(65535) NOT NULL DEFAULT '', - forum_desc_bitfield varchar(255) NOT NULL DEFAULT '', - forum_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', - forum_desc_uid varchar(8) NOT NULL DEFAULT '', - forum_link varchar(255) NOT NULL DEFAULT '', - forum_password varchar(255) NOT NULL DEFAULT '', - forum_style INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_image varchar(255) NOT NULL DEFAULT '', - forum_rules text(65535) NOT NULL DEFAULT '', - forum_rules_link varchar(255) NOT NULL DEFAULT '', - forum_rules_bitfield varchar(255) NOT NULL DEFAULT '', - forum_rules_options INTEGER UNSIGNED NOT NULL DEFAULT '7', - forum_rules_uid varchar(8) NOT NULL DEFAULT '', - forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', - forum_type tinyint(4) NOT NULL DEFAULT '0', - forum_status tinyint(4) NOT NULL DEFAULT '0', - forum_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_topics_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_post_subject text(65535) NOT NULL DEFAULT '', - forum_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_last_poster_name varchar(255) NOT NULL DEFAULT '', - forum_last_poster_colour varchar(6) NOT NULL DEFAULT '', - forum_flags tinyint(4) NOT NULL DEFAULT '32', - forum_options INTEGER UNSIGNED NOT NULL DEFAULT '0', - display_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1', - display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_icons INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_prune INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_next INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_days INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_viewed INTEGER UNSIGNED NOT NULL DEFAULT '0', - prune_freq INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); -CREATE INDEX phpbb_forums_forum_lastpost_id ON phpbb_forums (forum_last_post_id); - -# Table: 'phpbb_forums_access' -CREATE TABLE phpbb_forums_access ( - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_id char(32) NOT NULL DEFAULT '', - PRIMARY KEY (forum_id, user_id, session_id) -); - - -# Table: 'phpbb_forums_track' -CREATE TABLE phpbb_forums_track ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, forum_id) -); - - -# Table: 'phpbb_forums_watch' -CREATE TABLE phpbb_forums_watch ( - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); -CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch (notify_status); - -# Table: 'phpbb_groups' -CREATE TABLE phpbb_groups ( - group_id INTEGER PRIMARY KEY NOT NULL , - group_type tinyint(4) NOT NULL DEFAULT '1', - group_founder_manage INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_skip_auth INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_name varchar(255) NOT NULL DEFAULT '', - group_desc text(65535) NOT NULL DEFAULT '', - group_desc_bitfield varchar(255) NOT NULL DEFAULT '', - group_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '7', - group_desc_uid varchar(8) NOT NULL DEFAULT '', - group_display INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_avatar varchar(255) NOT NULL DEFAULT '', - group_avatar_type varchar(255) NOT NULL DEFAULT '', - group_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_colour varchar(6) NOT NULL DEFAULT '', - group_sig_chars INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_message_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); - -# Table: 'phpbb_icons' -CREATE TABLE phpbb_icons ( - icons_id INTEGER PRIMARY KEY NOT NULL , - icons_url varchar(255) NOT NULL DEFAULT '', - icons_width tinyint(4) NOT NULL DEFAULT '0', - icons_height tinyint(4) NOT NULL DEFAULT '0', - icons_order INTEGER UNSIGNED NOT NULL DEFAULT '0', - display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_icons_display_on_posting ON phpbb_icons (display_on_posting); - -# Table: 'phpbb_lang' -CREATE TABLE phpbb_lang ( - lang_id INTEGER PRIMARY KEY NOT NULL , - lang_iso varchar(30) NOT NULL DEFAULT '', - lang_dir varchar(30) NOT NULL DEFAULT '', - lang_english_name varchar(100) NOT NULL DEFAULT '', - lang_local_name varchar(255) NOT NULL DEFAULT '', - lang_author varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); - -# Table: 'phpbb_log' -CREATE TABLE phpbb_log ( - log_id INTEGER PRIMARY KEY NOT NULL , - log_type tinyint(4) NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - reportee_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - log_ip varchar(40) NOT NULL DEFAULT '', - log_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - log_operation text(65535) NOT NULL DEFAULT '', - log_data mediumtext(16777215) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); -CREATE INDEX phpbb_log_log_time ON phpbb_log (log_time); -CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); -CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); -CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); -CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); - -# Table: 'phpbb_login_attempts' -CREATE TABLE phpbb_login_attempts ( - attempt_ip varchar(40) NOT NULL DEFAULT '', - attempt_browser varchar(150) NOT NULL DEFAULT '', - attempt_forwarded_for varchar(255) NOT NULL DEFAULT '', - attempt_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - username varchar(255) NOT NULL DEFAULT '0', - username_clean varchar(255) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_login_attempts_att_ip ON phpbb_login_attempts (attempt_ip, attempt_time); -CREATE INDEX phpbb_login_attempts_att_for ON phpbb_login_attempts (attempt_forwarded_for, attempt_time); -CREATE INDEX phpbb_login_attempts_att_time ON phpbb_login_attempts (attempt_time); -CREATE INDEX phpbb_login_attempts_user_id ON phpbb_login_attempts (user_id); - -# Table: 'phpbb_moderator_cache' -CREATE TABLE phpbb_moderator_cache ( - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - username varchar(255) NOT NULL DEFAULT '', - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_name varchar(255) NOT NULL DEFAULT '', - display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_moderator_cache_disp_idx ON phpbb_moderator_cache (display_on_index); -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); - -# Table: 'phpbb_migrations' -CREATE TABLE phpbb_migrations ( - migration_name varchar(255) NOT NULL DEFAULT '', - migration_depends_on text(65535) NOT NULL DEFAULT '', - migration_schema_done INTEGER UNSIGNED NOT NULL DEFAULT '0', - migration_data_done INTEGER UNSIGNED NOT NULL DEFAULT '0', - migration_data_state text(65535) NOT NULL DEFAULT '', - migration_start_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - migration_end_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (migration_name) -); - - -# Table: 'phpbb_modules' -CREATE TABLE phpbb_modules ( - module_id INTEGER PRIMARY KEY NOT NULL , - module_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1', - module_display INTEGER UNSIGNED NOT NULL DEFAULT '1', - module_basename varchar(255) NOT NULL DEFAULT '', - module_class varchar(10) NOT NULL DEFAULT '', - parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - left_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - right_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - module_langname varchar(255) NOT NULL DEFAULT '', - module_mode varchar(255) NOT NULL DEFAULT '', - module_auth varchar(255) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); - -# Table: 'phpbb_notification_types' -CREATE TABLE phpbb_notification_types ( - notification_type_id INTEGER PRIMARY KEY NOT NULL , - notification_type_name varchar(255) NOT NULL DEFAULT '', - notification_type_enabled INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types (notification_type_name); - -# Table: 'phpbb_notifications' -CREATE TABLE phpbb_notifications ( - notification_id INTEGER PRIMARY KEY NOT NULL , - notification_type_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - item_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - item_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - notification_read INTEGER UNSIGNED NOT NULL DEFAULT '0', - notification_time INTEGER UNSIGNED NOT NULL DEFAULT '1', - notification_data text(65535) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications (notification_type_id, item_id); -CREATE INDEX phpbb_notifications_user ON phpbb_notifications (user_id, notification_read); - -# Table: 'phpbb_oauth_accounts' -CREATE TABLE phpbb_oauth_accounts ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - provider varchar(255) NOT NULL DEFAULT '', - oauth_provider_id text(65535) NOT NULL DEFAULT '', - PRIMARY KEY (user_id, provider) -); - - -# Table: 'phpbb_oauth_tokens' -CREATE TABLE phpbb_oauth_tokens ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_id char(32) NOT NULL DEFAULT '', - provider varchar(255) NOT NULL DEFAULT '', - oauth_token mediumtext(16777215) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id); -CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider); - -# Table: 'phpbb_poll_options' -CREATE TABLE phpbb_poll_options ( - poll_option_id tinyint(4) NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_option_text text(65535) NOT NULL DEFAULT '', - poll_option_total INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options (poll_option_id); -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); - -# Table: 'phpbb_poll_votes' -CREATE TABLE phpbb_poll_votes ( - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_option_id tinyint(4) NOT NULL DEFAULT '0', - vote_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - vote_user_ip varchar(40) NOT NULL DEFAULT '' -); - -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); - -# Table: 'phpbb_posts' -CREATE TABLE phpbb_posts ( - post_id INTEGER PRIMARY KEY NOT NULL , - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - poster_ip varchar(40) NOT NULL DEFAULT '', - post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_visibility tinyint(3) NOT NULL DEFAULT '0', - post_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', - enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', - post_username varchar(255) NOT NULL DEFAULT '', - post_subject text(65535) NOT NULL DEFAULT '', - post_text mediumtext(16777215) NOT NULL DEFAULT '', - post_checksum varchar(32) NOT NULL DEFAULT '', - post_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield varchar(255) NOT NULL DEFAULT '', - bbcode_uid varchar(8) NOT NULL DEFAULT '', - post_postcount INTEGER UNSIGNED NOT NULL DEFAULT '1', - post_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_edit_reason text(65535) NOT NULL DEFAULT '', - post_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_edit_locked INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_delete_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_delete_reason text(65535) NOT NULL DEFAULT '', - post_delete_user INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); -CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility); -CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username); -CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time); - -# Table: 'phpbb_privmsgs' -CREATE TABLE phpbb_privmsgs ( - msg_id INTEGER PRIMARY KEY NOT NULL , - root_level INTEGER UNSIGNED NOT NULL DEFAULT '0', - author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - author_ip varchar(40) NOT NULL DEFAULT '', - message_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', - enable_sig INTEGER UNSIGNED NOT NULL DEFAULT '1', - message_subject text(65535) NOT NULL DEFAULT '', - message_text mediumtext(16777215) NOT NULL DEFAULT '', - message_edit_reason text(65535) NOT NULL DEFAULT '', - message_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', - message_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield varchar(255) NOT NULL DEFAULT '', - bbcode_uid varchar(8) NOT NULL DEFAULT '', - message_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - message_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', - to_address text(65535) NOT NULL DEFAULT '', - bcc_address text(65535) NOT NULL DEFAULT '', - message_reported INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); - -# Table: 'phpbb_privmsgs_folder' -CREATE TABLE phpbb_privmsgs_folder ( - folder_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - folder_name varchar(255) NOT NULL DEFAULT '', - pm_count INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); - -# Table: 'phpbb_privmsgs_rules' -CREATE TABLE phpbb_privmsgs_rules ( - rule_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_check INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_connection INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_string varchar(255) NOT NULL DEFAULT '', - rule_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_action INTEGER UNSIGNED NOT NULL DEFAULT '0', - rule_folder_id int(11) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_rules_user_id ON phpbb_privmsgs_rules (user_id); - -# Table: 'phpbb_privmsgs_to' -CREATE TABLE phpbb_privmsgs_to ( - msg_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - author_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_deleted INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_new INTEGER UNSIGNED NOT NULL DEFAULT '1', - pm_unread INTEGER UNSIGNED NOT NULL DEFAULT '1', - pm_replied INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_marked INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_forwarded INTEGER UNSIGNED NOT NULL DEFAULT '0', - folder_id int(11) NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); -CREATE INDEX phpbb_privmsgs_to_author_id ON phpbb_privmsgs_to (author_id); -CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to (user_id, folder_id); - -# Table: 'phpbb_profile_fields' -CREATE TABLE phpbb_profile_fields ( - field_id INTEGER PRIMARY KEY NOT NULL , - field_name varchar(255) NOT NULL DEFAULT '', - field_type varchar(100) NOT NULL DEFAULT '', - field_ident varchar(20) NOT NULL DEFAULT '', - field_length varchar(20) NOT NULL DEFAULT '', - field_minlen varchar(255) NOT NULL DEFAULT '', - field_maxlen varchar(255) NOT NULL DEFAULT '', - field_novalue varchar(255) NOT NULL DEFAULT '', - field_default_value varchar(255) NOT NULL DEFAULT '', - field_validation varchar(20) NOT NULL DEFAULT '', - field_required INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_novalue INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_on_reg INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_on_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_on_vt INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_on_ml INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_show_profile INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_hide INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_no_view INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_active INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_order INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_profile_fields_fld_type ON phpbb_profile_fields (field_type); -CREATE INDEX phpbb_profile_fields_fld_ordr ON phpbb_profile_fields (field_order); - -# Table: 'phpbb_profile_fields_data' -CREATE TABLE phpbb_profile_fields_data ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - pf_phpbb_location varchar(255) NOT NULL DEFAULT '', - pf_phpbb_interests text(65535) NOT NULL DEFAULT '', - pf_phpbb_occupation text(65535) NOT NULL DEFAULT '', - PRIMARY KEY (user_id) -); - - -# Table: 'phpbb_profile_fields_lang' -CREATE TABLE phpbb_profile_fields_lang ( - field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - option_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - field_type varchar(100) NOT NULL DEFAULT '', - lang_value varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (field_id, lang_id, option_id) -); - - -# Table: 'phpbb_profile_lang' -CREATE TABLE phpbb_profile_lang ( - field_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - lang_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - lang_name varchar(255) NOT NULL DEFAULT '', - lang_explain text(65535) NOT NULL DEFAULT '', - lang_default_value varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (field_id, lang_id) -); - - -# Table: 'phpbb_ranks' -CREATE TABLE phpbb_ranks ( - rank_id INTEGER PRIMARY KEY NOT NULL , - rank_title varchar(255) NOT NULL DEFAULT '', - rank_min INTEGER UNSIGNED NOT NULL DEFAULT '0', - rank_special INTEGER UNSIGNED NOT NULL DEFAULT '0', - rank_image varchar(255) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_reports' -CREATE TABLE phpbb_reports ( - report_id INTEGER PRIMARY KEY NOT NULL , - reason_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - pm_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', - report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', - report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - report_text mediumtext(16777215) NOT NULL DEFAULT '', - reported_post_text mediumtext(16777215) NOT NULL DEFAULT '', - reported_post_uid varchar(8) NOT NULL DEFAULT '', - reported_post_bitfield varchar(255) NOT NULL DEFAULT '', - reported_post_enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1', - reported_post_enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1', - reported_post_enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); -CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id); - -# Table: 'phpbb_reports_reasons' -CREATE TABLE phpbb_reports_reasons ( - reason_id INTEGER PRIMARY KEY NOT NULL , - reason_title varchar(255) NOT NULL DEFAULT '', - reason_description mediumtext(16777215) NOT NULL DEFAULT '', - reason_order INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_search_results' -CREATE TABLE phpbb_search_results ( - search_key varchar(32) NOT NULL DEFAULT '', - search_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - search_keywords mediumtext(16777215) NOT NULL DEFAULT '', - search_authors mediumtext(16777215) NOT NULL DEFAULT '', - PRIMARY KEY (search_key) -); - - -# Table: 'phpbb_search_wordlist' -CREATE TABLE phpbb_search_wordlist ( - word_id INTEGER PRIMARY KEY NOT NULL , - word_text varchar(255) NOT NULL DEFAULT '', - word_common INTEGER UNSIGNED NOT NULL DEFAULT '0', - word_count INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE UNIQUE INDEX phpbb_search_wordlist_wrd_txt ON phpbb_search_wordlist (word_text); -CREATE INDEX phpbb_search_wordlist_wrd_cnt ON phpbb_search_wordlist (word_count); - -# Table: 'phpbb_search_wordmatch' -CREATE TABLE phpbb_search_wordmatch ( - post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - word_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - title_match INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE UNIQUE INDEX phpbb_search_wordmatch_unq_mtch ON phpbb_search_wordmatch (word_id, post_id, title_match); -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); -CREATE INDEX phpbb_search_wordmatch_post_id ON phpbb_search_wordmatch (post_id); - -# Table: 'phpbb_sessions' -CREATE TABLE phpbb_sessions ( - session_id char(32) NOT NULL DEFAULT '', - session_user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_last_visit INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_start INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_ip varchar(40) NOT NULL DEFAULT '', - session_browser varchar(150) NOT NULL DEFAULT '', - session_forwarded_for varchar(255) NOT NULL DEFAULT '', - session_page varchar(255) NOT NULL DEFAULT '', - session_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', - session_autologin INTEGER UNSIGNED NOT NULL DEFAULT '0', - session_admin INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (session_id) -); - -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); -CREATE INDEX phpbb_sessions_session_fid ON phpbb_sessions (session_forum_id); - -# Table: 'phpbb_sessions_keys' -CREATE TABLE phpbb_sessions_keys ( - key_id char(32) NOT NULL DEFAULT '', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - last_ip varchar(40) NOT NULL DEFAULT '', - last_login INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (key_id, user_id) -); - -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); - -# Table: 'phpbb_sitelist' -CREATE TABLE phpbb_sitelist ( - site_id INTEGER PRIMARY KEY NOT NULL , - site_ip varchar(40) NOT NULL DEFAULT '', - site_hostname varchar(255) NOT NULL DEFAULT '', - ip_exclude INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_smilies' -CREATE TABLE phpbb_smilies ( - smiley_id INTEGER PRIMARY KEY NOT NULL , - code varchar(50) NOT NULL DEFAULT '', - emotion varchar(50) NOT NULL DEFAULT '', - smiley_url varchar(50) NOT NULL DEFAULT '', - smiley_width INTEGER UNSIGNED NOT NULL DEFAULT '0', - smiley_height INTEGER UNSIGNED NOT NULL DEFAULT '0', - smiley_order INTEGER UNSIGNED NOT NULL DEFAULT '0', - display_on_posting INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_smilies_display_on_post ON phpbb_smilies (display_on_posting); - -# Table: 'phpbb_styles' -CREATE TABLE phpbb_styles ( - style_id INTEGER PRIMARY KEY NOT NULL , - style_name varchar(255) NOT NULL DEFAULT '', - style_copyright varchar(255) NOT NULL DEFAULT '', - style_active INTEGER UNSIGNED NOT NULL DEFAULT '1', - style_path varchar(100) NOT NULL DEFAULT '', - bbcode_bitfield varchar(255) NOT NULL DEFAULT 'kNg=', - style_parent_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - style_parent_tree text(65535) NOT NULL DEFAULT '' -); - -CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); - -# Table: 'phpbb_teampage' -CREATE TABLE phpbb_teampage ( - teampage_id INTEGER PRIMARY KEY NOT NULL , - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - teampage_name varchar(255) NOT NULL DEFAULT '', - teampage_position INTEGER UNSIGNED NOT NULL DEFAULT '0', - teampage_parent INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_topics' -CREATE TABLE phpbb_topics ( - topic_id INTEGER PRIMARY KEY NOT NULL , - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_visibility tinyint(3) NOT NULL DEFAULT '0', - topic_reported INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_title text(65535) NOT NULL DEFAULT '', - topic_poster INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_status tinyint(3) NOT NULL DEFAULT '0', - topic_type tinyint(3) NOT NULL DEFAULT '0', - topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_first_poster_name varchar(255) NOT NULL DEFAULT '', - topic_first_poster_colour varchar(6) NOT NULL DEFAULT '', - topic_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_last_poster_name varchar(255) NOT NULL DEFAULT '', - topic_last_poster_colour varchar(6) NOT NULL DEFAULT '', - topic_last_post_subject text(65535) NOT NULL DEFAULT '', - topic_last_post_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_last_view_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_moved_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_bumped INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_bumper INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_title text(65535) NOT NULL DEFAULT '', - poll_start INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_length INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_max_options tinyint(4) NOT NULL DEFAULT '1', - poll_last_vote INTEGER UNSIGNED NOT NULL DEFAULT '0', - poll_vote_change INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_delete_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_delete_reason text(65535) NOT NULL DEFAULT '', - topic_delete_user INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); -CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time); -CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility); -CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id); -CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id); - -# Table: 'phpbb_topics_track' -CREATE TABLE phpbb_topics_track ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - mark_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, topic_id) -); - -CREATE INDEX phpbb_topics_track_topic_id ON phpbb_topics_track (topic_id); -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); - -# Table: 'phpbb_topics_posted' -CREATE TABLE phpbb_topics_posted ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_posted INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, topic_id) -); - - -# Table: 'phpbb_topics_watch' -CREATE TABLE phpbb_topics_watch ( - topic_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - notify_status INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); -CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch (notify_status); - -# Table: 'phpbb_user_notifications' -CREATE TABLE phpbb_user_notifications ( - item_type varchar(255) NOT NULL DEFAULT '', - item_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - method varchar(255) NOT NULL DEFAULT '', - notify INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - - -# Table: 'phpbb_user_group' -CREATE TABLE phpbb_user_group ( - group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_leader INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_pending INTEGER UNSIGNED NOT NULL DEFAULT '1' -); - -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); - -# Table: 'phpbb_users' -CREATE TABLE phpbb_users ( - user_id INTEGER PRIMARY KEY NOT NULL , - user_type tinyint(2) NOT NULL DEFAULT '0', - group_id INTEGER UNSIGNED NOT NULL DEFAULT '3', - user_permissions mediumtext(16777215) NOT NULL DEFAULT '', - user_perm_from INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_ip varchar(40) NOT NULL DEFAULT '', - user_regdate INTEGER UNSIGNED NOT NULL DEFAULT '0', - username varchar(255) NOT NULL DEFAULT '', - username_clean varchar(255) NOT NULL DEFAULT '', - user_password varchar(255) NOT NULL DEFAULT '', - user_passchg INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_pass_convert INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_actkey varchar(32) NOT NULL DEFAULT '', - user_newpasswd varchar(255) NOT NULL DEFAULT '', - user_email varchar(100) NOT NULL DEFAULT '', - user_email_hash bigint(20) NOT NULL DEFAULT '0', - user_birthday varchar(10) NOT NULL DEFAULT '', - user_lastvisit INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lastmark INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lastpost_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lastpage varchar(200) NOT NULL DEFAULT '', - user_last_confirm_key varchar(10) NOT NULL DEFAULT '', - user_last_search INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_warnings tinyint(4) NOT NULL DEFAULT '0', - user_last_warning INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_login_attempts tinyint(4) NOT NULL DEFAULT '0', - user_inactive_reason tinyint(2) NOT NULL DEFAULT '0', - user_inactive_time INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_lang varchar(30) NOT NULL DEFAULT '', - user_timezone varchar(100) NOT NULL DEFAULT 'UTC', - user_dateformat varchar(30) NOT NULL DEFAULT 'd M Y H:i', - user_style INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_rank INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_colour varchar(6) NOT NULL DEFAULT '', - user_new_privmsg int(4) NOT NULL DEFAULT '0', - user_unread_privmsg int(4) NOT NULL DEFAULT '0', - user_last_privmsg INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_message_rules INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_full_folder int(11) NOT NULL DEFAULT '-3', - user_emailtime INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_topic_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_topic_sortby_type varchar(1) NOT NULL DEFAULT 't', - user_topic_sortby_dir varchar(1) NOT NULL DEFAULT 'd', - user_post_show_days INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_post_sortby_type varchar(1) NOT NULL DEFAULT 't', - user_post_sortby_dir varchar(1) NOT NULL DEFAULT 'a', - user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_notify_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_notify_type tinyint(4) NOT NULL DEFAULT '0', - user_allow_pm INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_allow_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_allow_viewemail INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_allow_massemail INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_options INTEGER UNSIGNED NOT NULL DEFAULT '230271', - user_avatar varchar(255) NOT NULL DEFAULT '', - user_avatar_type varchar(255) NOT NULL DEFAULT '', - user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_avatar_height INTEGER UNSIGNED NOT NULL DEFAULT '0', - user_sig mediumtext(16777215) NOT NULL DEFAULT '', - user_sig_bbcode_uid varchar(8) NOT NULL DEFAULT '', - user_sig_bbcode_bitfield varchar(255) NOT NULL DEFAULT '', - user_icq varchar(15) NOT NULL DEFAULT '', - user_aim varchar(255) NOT NULL DEFAULT '', - user_yim varchar(255) NOT NULL DEFAULT '', - user_msnm varchar(255) NOT NULL DEFAULT '', - user_jabber varchar(255) NOT NULL DEFAULT '', - user_website varchar(200) NOT NULL DEFAULT '', - user_form_salt varchar(32) NOT NULL DEFAULT '', - user_new INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_reminded tinyint(4) NOT NULL DEFAULT '0', - user_reminded_time INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - -CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); -CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); -CREATE UNIQUE INDEX phpbb_users_username_clean ON phpbb_users (username_clean); - -# Table: 'phpbb_warnings' -CREATE TABLE phpbb_warnings ( - warning_id INTEGER PRIMARY KEY NOT NULL , - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - log_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - warning_time INTEGER UNSIGNED NOT NULL DEFAULT '0' -); - - -# Table: 'phpbb_words' -CREATE TABLE phpbb_words ( - word_id INTEGER PRIMARY KEY NOT NULL , - word varchar(255) NOT NULL DEFAULT '', - replacement varchar(255) NOT NULL DEFAULT '' -); - - -# Table: 'phpbb_zebra' -CREATE TABLE phpbb_zebra ( - user_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - zebra_id INTEGER UNSIGNED NOT NULL DEFAULT '0', - friend INTEGER UNSIGNED NOT NULL DEFAULT '0', - foe INTEGER UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (user_id, zebra_id) -); - - - -COMMIT;
\ No newline at end of file diff --git a/phpBB/install/startup.php b/phpBB/install/startup.php new file mode 100644 index 0000000000..927f529b73 --- /dev/null +++ b/phpBB/install/startup.php @@ -0,0 +1,132 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** @ignore */ +if (!defined('IN_PHPBB') || !defined('IN_INSTALL')) +{ + exit; +} + +function phpbb_require_updated($path, $phpbb_root_path, $optional = false) +{ + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + require($new_path); + } + else if (!$optional || file_exists($old_path)) + { + require($old_path); + } +} + +function phpbb_include_updated($path, $phpbb_root_path, $optional = false) +{ + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + include($new_path); + } + else if (!$optional || file_exists($old_path)) + { + include($old_path); + } +} + +function installer_msg_handler($errno, $msg_text, $errfile, $errline) +{ + global $phpbb_installer_container; + + if (error_reporting() == 0) + { + return true; + } + + switch ($errno) + { + case E_NOTICE: + case E_WARNING: + case E_USER_WARNING: + case E_USER_NOTICE: + $msg = '[phpBB debug] "' . $msg_text . '" in file ' . $errfile . ' on line ' . $errline; + + try + { + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $phpbb_installer_container->get('installer.helper.iohandler'); + $iohandler->add_warning_message($msg); + } + catch (\phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception $e) + { + print ($msg); + } + break; + case E_USER_ERROR: + $msg = '<b>General Error:</b><br />' . $msg_text . '<br /> in file ' . $errfile . ' on line ' . $errline; + + $backtrace = get_backtrace(); + if ($backtrace) + { + $msg .= '<br /><br />BACKTRACE<br />' . $backtrace; + } + + throw new \phpbb\exception\runtime_exception($msg); + break; + case E_DEPRECATED: + return true; + break; + } + + return false; +} + +phpbb_require_updated('includes/startup.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('phpbb/class_loader.' . $phpEx, $phpbb_root_path); + +$phpbb_class_loader_new = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx); +$phpbb_class_loader_new->register(); +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); +$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); +$phpbb_class_loader_ext->register(); + +// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. +$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; + +// Include files +phpbb_require_updated('includes/functions.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('includes/functions_content.' . $phpEx, $phpbb_root_path); +phpbb_include_updated('includes/functions_compatibility.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('includes/functions_user.' . $phpEx, $phpbb_root_path); +phpbb_require_updated('includes/utf/utf_tools.' . $phpEx, $phpbb_root_path); + +// Set PHP error handler to ours +set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'installer_msg_handler'); + +$phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +$phpbb_installer_container_builder + ->with_environment('installer') + ->without_extensions(); + +$other_config_path = $phpbb_root_path . 'install/update/new/config'; +$config_path = (file_exists($other_config_path . '/installer/config.yml')) ? $other_config_path : $phpbb_root_path . 'config'; + +$phpbb_installer_container = $phpbb_installer_container_builder + ->with_config_path($config_path) + ->with_custom_parameters(array('cache.driver.class' => 'phpbb\cache\driver\file')) + ->get_container(); diff --git a/phpBB/language/en/acp/attachments.php b/phpBB/language/en/acp/attachments.php index c7d68d29c2..5ff904f9fc 100644 --- a/phpBB/language/en/acp/attachments.php +++ b/phpBB/language/en/acp/attachments.php @@ -1,11 +1,13 @@ <?php /** * -* acp_attachments [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -68,9 +70,6 @@ $lang = array_merge($lang, array( 'CAT_FLASH_FILES' => 'Flash files', 'CAT_IMAGES' => 'Images', - 'CAT_QUICKTIME_FILES' => 'Quicktime media files', - 'CAT_RM_FILES' => 'RealMedia media files', - 'CAT_WM_FILES' => 'Windows Media media files', 'CHECK_CONTENT' => 'Check attachment files', 'CHECK_CONTENT_EXPLAIN' => 'Some browsers can be tricked to assume an incorrect mimetype for uploaded files. This option ensures that such files likely to cause this are rejected.', 'CREATE_GROUP' => 'Create new group', @@ -103,9 +102,9 @@ $lang = array_merge($lang, array( 'EXT_GROUP_FLASH_FILES' => 'Flash Files', 'EXT_GROUP_IMAGES' => 'Images', 'EXT_GROUP_PLAIN_TEXT' => 'Plain Text', - 'EXT_GROUP_QUICKTIME_MEDIA' => 'Quicktime Media', - 'EXT_GROUP_REAL_MEDIA' => 'Real Media', - 'EXT_GROUP_WINDOWS_MEDIA' => 'Windows Media', + + 'FILES_GONE' => 'Some of the attachments you selected for deletion do not exist. They may have been already deleted. Attachments that did exist were deleted.', + 'FILES_STATS_WRONG' => 'Your file statistics are likely inaccurate and need to be resynchronised. Actual values: number of attachments = %1$d, total size of attachments = %2$s.<br />Click %3$shere%4$s to resynchronise them.', 'GO_TO_EXTENSIONS' => 'Go to extension management screen', 'GROUP_NAME' => 'Group name', @@ -130,6 +129,7 @@ $lang = array_merge($lang, array( 'NOT_ALLOWED_IN_PM' => 'Only allowed in posts', 'NOT_ALLOWED_IN_PM_POST' => 'Not allowed', 'NOT_ASSIGNED' => 'Not assigned', + 'NO_ATTACHMENTS' => 'No attachments found for this period.', 'NO_EXT_GROUP' => 'None', 'NO_EXT_GROUP_NAME' => 'No group name entered', 'NO_EXT_GROUP_SPECIFIED' => 'No extension group specified.', @@ -143,8 +143,9 @@ $lang = array_merge($lang, array( 'ORDER_ALLOW_DENY' => 'Allow', 'ORDER_DENY_ALLOW' => 'Deny', - 'REMOVE_ALLOWED_IPS' => 'Remove or un-exclude <em>allowed</em> IPs/hostnames', - 'REMOVE_DISALLOWED_IPS' => 'Remove or un-exclude <em>disallowed</em> IPs/hostnames', + 'REMOVE_ALLOWED_IPS' => 'Remove or un-exclude <em>allowed</em> IPs/hostnames', + 'REMOVE_DISALLOWED_IPS' => 'Remove or un-exclude <em>disallowed</em> IPs/hostnames', + 'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise file statistics?', 'SEARCH_IMAGICK' => 'Search for Imagemagick', 'SECURE_ALLOW_DENY' => 'Allow/Deny list', diff --git a/phpBB/language/en/acp/ban.php b/phpBB/language/en/acp/ban.php index 2dc0489030..93d5cf9a8b 100644 --- a/phpBB/language/en/acp/ban.php +++ b/phpBB/language/en/acp/ban.php @@ -1,11 +1,13 @@ <?php /** * -* acp_ban [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -73,10 +75,10 @@ $lang = array_merge($lang, array( 'PERMANENT' => 'Permanent', 'UNTIL' => 'Until', - 'USER_BAN' => 'Ban one or more usernames', + 'USER_BAN' => 'Ban one or more users by username', 'USER_BAN_EXCLUDE_EXPLAIN' => 'Enable this to exclude the entered users from all current bans.', 'USER_BAN_EXPLAIN' => 'You can ban multiple users in one go by entering each name on a new line. Use the <span style="text-decoration: underline;">Find a member</span> facility to look up and add one or more users automatically.', 'USER_NO_BANNED' => 'No banned usernames', - 'USER_UNBAN' => 'Un-ban or un-exclude usernames', + 'USER_UNBAN' => 'Un-ban or un-exclude users by username', 'USER_UNBAN_EXPLAIN' => 'You can unban (or un-exclude) multiple users in one go using the appropriate combination of mouse and keyboard for your computer and browser. Excluded users are emphasised.', )); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 8ca937a58d..ba51595dc3 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -1,11 +1,13 @@ <?php /** * -* acp_board [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -39,17 +41,21 @@ $lang = array_merge($lang, array( 'ACP_BOARD_SETTINGS_EXPLAIN' => 'Here you can determine the basic operation of your board, give it a fitting name and description, and among other settings adjust the default values for timezone and language.', 'BOARD_INDEX_TEXT' => 'Board index text', 'BOARD_INDEX_TEXT_EXPLAIN' => 'This text is displayed as the board index in the board’s breadcrumbs. If not specified, it will default to “Board indexâ€.', + 'BOARD_STYLE' => 'Board style', 'CUSTOM_DATEFORMAT' => 'Custom…', 'DEFAULT_DATE_FORMAT' => 'Date format', 'DEFAULT_DATE_FORMAT_EXPLAIN' => 'The date format is the same as the PHP <code>date</code> function.', 'DEFAULT_LANGUAGE' => 'Default language', 'DEFAULT_STYLE' => 'Default style', + 'DEFAULT_STYLE_EXPLAIN' => 'The default style for new users.', 'DISABLE_BOARD' => 'Disable board', - 'DISABLE_BOARD_EXPLAIN' => 'This will make the board unavailable to users. You can also enter a short (255 character) message to display if you wish.', + 'DISABLE_BOARD_EXPLAIN' => 'This will make the board unavailable to users who are neither administrators nor moderators. You can also enter a short (255 character) message to display if you wish.', 'DISPLAY_LAST_SUBJECT' => 'Display subject of last added post on forum list', 'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'The subject of the last added post will be displayed in the forum list with a hyperlink to the post. Subjects from password protected forums and forums in which user doesn’t have read access are not shown.', + 'GUEST_STYLE' => 'Guest style', + 'GUEST_STYLE_EXPLAIN' => 'The board style for guests.', 'OVERRIDE_STYLE' => 'Override user style', - 'OVERRIDE_STYLE_EXPLAIN' => 'Replaces user’s style with the default.', + 'OVERRIDE_STYLE_EXPLAIN' => 'Replaces user’s (and guest’s) style with the style as defined under "Default style".', 'SITE_DESC' => 'Site description', 'SITE_HOME_TEXT' => 'Main website text', 'SITE_HOME_TEXT_EXPLAIN' => 'This text will be displayed as a link to your website homepage in the board’s breadcrumbs. If not specified, it will default to “Homeâ€.', @@ -93,6 +99,7 @@ $lang = array_merge($lang, array( 'ALLOW_TOPIC_NOTIFY' => 'Allow subscribing to topics', 'BOARD_PM' => 'Private messaging', 'BOARD_PM_EXPLAIN' => 'Enable private messaging for all users.', + 'ALLOW_BOARD_NOTIFICATIONS' => 'Allow board notifications', )); // Avatar Settings @@ -109,9 +116,9 @@ $lang = array_merge($lang, array( 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Allow uploading of avatars from another website.', 'ALLOW_UPLOAD' => 'Enable avatar uploading', 'AVATAR_GALLERY_PATH' => 'Avatar gallery path', - 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. <samp>images/avatars/gallery</samp>.', + 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. <samp>images/avatars/gallery</samp>.<br />Double dots like <samp>../</samp> will be stripped from the path for security reasons.', 'AVATAR_STORAGE_PATH' => 'Avatar storage path', - 'AVATAR_STORAGE_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/avatars/upload</samp>.', + 'AVATAR_STORAGE_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/avatars/upload</samp>.<br />Avatar uploading <strong>will not be available</strong> if this path is not writable.<br />Double dots like <samp>../</samp> will be stripped from the path for security reasons.', 'MAX_AVATAR_SIZE' => 'Maximum avatar dimensions', 'MAX_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', 'MAX_FILESIZE' => 'Maximum avatar file size', @@ -215,7 +222,8 @@ $lang = array_merge($lang, array( 'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.', 'ACC_ACTIVATION' => 'Account activation', - 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. “Board-wide email†must be enabled in order to use user or admin activation.', + 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. <em>“Board-wide email†must be enabled in order to use user or admin activation.</em>', + 'ACC_ACTIVATION_WARNING' => 'Please note that the currently selected activation method requires emails to be enabled, otherwise registration will be disabled. We recommend to either select a different activation method or reenable emails.', 'NEW_MEMBER_POST_LIMIT' => 'New member post limit', 'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the <em>Newly Registered Users</em> group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. <strong>A value of 0 disables this feature.</strong>', 'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default', @@ -296,6 +304,7 @@ $lang = array_merge($lang, array( // Visual Confirmation Settings $lang = array_merge($lang, array( 'ACP_VC_SETTINGS_EXPLAIN' => 'Here you can select and configure plugins, which are designed to block automated form submissions by spambots. These plugins typically work by challenging the user with a <em>CAPTCHA</em>, a test which is designed to be difficult for computers to solve.', + 'ACP_VC_EXT_GET_MORE' => 'For additional (and possibly better) anti-spam plugins, visit the <a href="https://www.phpbb.com/go/anti-spam-ext"><strong>phpBB.com Extensions Database</strong></a>. For more information on preventing spam on your board, visit the <a href="https://www.phpbb.com/go/anti-spam"><strong>phpBB.com Knowledge Base</strong></a>.', 'AVAILABLE_CAPTCHAS' => 'Available plugins', 'CAPTCHA_UNAVAILABLE' => 'The plugin cannot be selected as its requirements are not met.', 'CAPTCHA_GD' => 'GD image', @@ -350,12 +359,27 @@ $lang = array_merge($lang, array( 'SESSION_LENGTH_EXPLAIN' => 'Sessions will expire after this time, in seconds.', )); +// Contact Settings +$lang = array_merge($lang, array( + 'ACP_CONTACT_SETTINGS_EXPLAIN' => 'Here you can enable and disable the contact page and also add a text that is displayed on the page.', + + 'CONTACT_US_ENABLE' => 'Enable contact page', + 'CONTACT_US_ENABLE_EXPLAIN' => 'This page allows users to send emails to board administrators', + + 'CONTACT_US_INFO' => 'Contact information', + 'CONTACT_US_INFO_EXPLAIN' => 'The message is displayed on the contact page', + 'CONTACT_US_INFO_PREVIEW' => 'Contact page information - Preview', + 'CONTACT_US_INFO_UPDATED' => 'Contact page information has been updated.', +)); + // Load Settings $lang = array_merge($lang, array( 'ACP_LOAD_SETTINGS_EXPLAIN' => 'Here you can enable and disable certain board functions to reduce the amount of processing required. On most servers there is no need to disable any functions. However on certain systems or in shared hosting environments it may be beneficial to disable capabilities you do not really need. You can also specify limits for system load and active sessions beyond which the board will go offline.', 'ALLOW_CDN' => 'Allow usage of third party content delivery networks', - 'ALLOW_CDN_EXPLAIN' => 'If this setting is enabled, some files will be served from external third party servers instead of your server. This reduces the network bandwidth required by your server, but may present a privacy issue for some board administrators.', + 'ALLOW_CDN_EXPLAIN' => 'If this setting is enabled, some files will be served from external third party servers instead of your server. This reduces the network bandwidth required by your server, but may present a privacy issue for some board administrators. In a default phpBB installation, this includes loading “jQuery†and the font “Open Sans†from Google’s content delivery network.', + 'ALLOW_LIVE_SEARCHES' => 'Allow live searches', + 'ALLOW_LIVE_SEARCHES_EXPLAIN' => 'If this setting is enabled, users are provided with keyword suggestions as they type in certain fields throughout the board.', 'CUSTOM_PROFILE_FIELDS' => 'Custom profile fields', 'LIMIT_LOAD' => 'Limit system load', 'LIMIT_LOAD_EXPLAIN' => 'If the system’s 1-minute load average exceeds this value the board will automatically go offline. A value of 1.0 equals ~100% utilisation of one processor. This only functions on UNIX based servers and where this information is accessible. The value here resets itself to 0 if phpBB was unable to get the load limit.', @@ -397,13 +421,14 @@ $lang = array_merge($lang, array( 'AUTH_METHOD' => 'Select an authentication method', 'AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING' => 'Both the key and secret of each enabled OAuth service provider must be provided. Only one was provided for an OAuth service provider.', - 'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server.<br />These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.<br />Any service that does not have both a key and a secret entered here will not be available for use by the forum users.', + 'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server. These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.<br />Any service that does not have both a key and a secret entered here will not be available for use by the forum users. Also note, that user can still register and login using the DB authentication plug-in.', 'AUTH_PROVIDER_OAUTH_KEY' => 'Key', 'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth', 'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret', 'APACHE_SETUP_BEFORE_USE' => 'You have to setup apache authentication before you switch phpBB to this authentication method. Keep in mind that the username you use for apache authentication has to be the same as your phpBB username. Apache authentication can only be used with mod_php (not with a CGI version) and safe_mode disabled.', + 'LDAP' => 'LDAP', 'LDAP_DN' => 'LDAP base <var>dn</var>', 'LDAP_DN_EXPLAIN' => 'This is the Distinguished Name, locating the user information, e.g. <samp>o=My Company,c=US</samp>.', 'LDAP_EMAIL' => 'LDAP email attribute', @@ -456,7 +481,7 @@ $lang = array_merge($lang, array( 'UPLOAD_ICONS_PATH' => 'Extension group icons storage path', 'UPLOAD_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/upload_icons</samp>.', 'USE_SYSTEM_CRON' => 'Run periodic tasks from system cron', - 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for <code>cron.php</code> to be invoked by the system cron facility at regular intervals (e.g. every 5 minutes).', + 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for <code>bin/phpbbcli.php cron:run</code> to be run by the system cron facility at regular intervals (e.g. every 5 minutes).', )); // Security Settings @@ -506,8 +531,8 @@ $lang = array_merge($lang, array( 'PASS_TYPE_SYMBOL' => 'Must contain symbols', 'REF_HOST' => 'Only validate host', 'REF_PATH' => 'Also validate path', - 'REFERER_VALID' => 'Validate Referer', - 'REFERER_VALID_EXPLAIN' => 'If enabled, the referer of POST requests will be checked against the host/script path settings. This may cause issues with boards using several domains and or external logins.', + 'REFERRER_VALID' => 'Validate Referrer', + 'REFERRER_VALID_EXPLAIN' => 'If enabled, the referrer of POST requests will be checked against the host/script path settings. This may cause issues with boards using several domains and or external logins.', 'TPL_ALLOW_PHP' => 'Allow php in templates', 'TPL_ALLOW_PHP_EXPLAIN' => 'If this option is enabled, <code>PHP</code> and <code>INCLUDEPHP</code> statements will be recognised and parsed in templates.', )); @@ -524,6 +549,8 @@ $lang = array_merge($lang, array( 'BOARD_HIDE_EMAILS_EXPLAIN' => 'This function keeps email addresses completely private.', 'CONTACT_EMAIL' => 'Contact email address', 'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc. It will always be used as the <samp>From</samp> and <samp>Reply-To</samp> address in emails.', + 'CONTACT_EMAIL_NAME' => 'Contact name', + 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', 'EMAIL_FUNCTION_NAME' => 'Email function name', 'EMAIL_FUNCTION_NAME_EXPLAIN' => 'The email function used to send mails through PHP.', 'EMAIL_PACKAGE_SIZE' => 'Email package size', @@ -531,7 +558,9 @@ $lang = array_merge($lang, array( 'EMAIL_SIG' => 'Email signature', 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.', 'ENABLE_EMAIL' => 'Enable board-wide emails', - 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. <em>Note the user and admin account activation settings require this setting to be enabled. If currently using “user†or “admin†activation in the activation settings, disabling this setting will require no activation of new accounts.</em>', + 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. <em>Note the user and admin account activation settings require this setting to be enabled. If currently using “user†or “admin†activation in the activation settings, disabling this setting will disable registration.</em>', + 'SEND_TEST_EMAIL' => 'Send a test email', + 'SEND_TEST_EMAIL_EXPLAIN' => 'This will send a test email to the address defined in your account.', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', @@ -547,6 +576,7 @@ $lang = array_merge($lang, array( 'SMTP_SETTINGS' => 'SMTP settings', 'SMTP_USERNAME' => 'SMTP username', 'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.', + 'TEST_EMAIL_SENT' => 'The test email has been sent.<br />If you don’t receive it, please check your emails configuration.<br /><br />If you require assistance, please visit the <a href="https://www.phpbb.com/community/">phpBB support forums</a>.', 'USE_SMTP' => 'Use SMTP server for email', 'USE_SMTP_EXPLAIN' => 'Select “Yes†if you want or have to send email via a named server instead of the local mail function.', )); diff --git a/phpBB/language/en/acp/bots.php b/phpBB/language/en/acp/bots.php index b8e1e9742f..142922800c 100644 --- a/phpBB/language/en/acp/bots.php +++ b/phpBB/language/en/acp/bots.php @@ -1,11 +1,13 @@ <?php /** * -* acp_bots [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 0117d85433..a1e2d1ef40 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -1,11 +1,13 @@ <?php /** * -* acp_common [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -49,7 +51,7 @@ $lang = array_merge($lang, array( 'ACP_BAN' => 'Banning', 'ACP_BAN_EMAILS' => 'Ban emails', 'ACP_BAN_IPS' => 'Ban IPs', - 'ACP_BAN_USERNAMES' => 'Ban usernames', + 'ACP_BAN_USERNAMES' => 'Ban users', 'ACP_BBCODES' => 'BBCodes', 'ACP_BOARD_CONFIGURATION' => 'Board configuration', 'ACP_BOARD_FEATURES' => 'Board features', @@ -61,7 +63,7 @@ $lang = array_merge($lang, array( 'ACP_CAT_CUSTOMISE' => 'Customise', 'ACP_CAT_DATABASE' => 'Database', - 'ACP_CAT_DOT_MODS' => '.MODs', + 'ACP_CAT_DOT_MODS' => 'Extensions', 'ACP_CAT_FORUMS' => 'Forums', 'ACP_CAT_GENERAL' => 'General', 'ACP_CAT_MAINTENANCE' => 'Maintenance', @@ -73,6 +75,8 @@ $lang = array_merge($lang, array( 'ACP_CAT_USERS' => 'Users', 'ACP_CLIENT_COMMUNICATION' => 'Client communication', 'ACP_COOKIE_SETTINGS' => 'Cookie settings', + 'ACP_CONTACT' => 'Contact page', + 'ACP_CONTACT_SETTINGS' => 'Contact page settings', 'ACP_CRITICAL_LOGS' => 'Error log', 'ACP_CUSTOM_PROFILE_FIELDS' => 'Custom profile fields', @@ -83,8 +87,7 @@ $lang = array_merge($lang, array( 'ACP_EMAIL_SETTINGS' => 'Email settings', 'ACP_EXTENSION_GROUPS' => 'Manage attachment extension groups', 'ACP_EXTENSION_MANAGEMENT' => 'Extension management', - 'ACP_EXTENSIONS' => 'Extensions', - + 'ACP_EXTENSIONS' => 'Manage extensions', 'ACP_FORUM_BASED_PERMISSIONS' => 'Forum based permissions', 'ACP_FORUM_LOGS' => 'Forum logs', @@ -224,6 +227,11 @@ $lang = array_merge($lang, array( 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', + 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', + 'CRON_NO_SUCH_TASK' => 'Could not find cron task “%sâ€.', + 'CRON_NO_TASK' => 'No cron tasks need to be run right now.', + 'CRON_NO_TASKS' => 'No cron tasks could be found.', + 'CURRENT_VERSION' => 'Current version', 'DEACTIVATE' => 'Deactivate', 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path “%s†does not exist.', @@ -234,16 +242,13 @@ $lang = array_merge($lang, array( 'DOWNLOAD_AS' => 'Download as', 'DOWNLOAD_STORE' => 'Download or store file', 'DOWNLOAD_STORE_EXPLAIN' => 'You may directly download the file or save it in your <samp>store/</samp> folder.', - 'DOWNLOADS' => 'Downloads', + 'DOWNLOADS' => 'Downloads', 'EDIT' => 'Edit', 'ENABLE' => 'Enable', 'EXPORT_DOWNLOAD' => 'Download', 'EXPORT_STORE' => 'Store', - 'FILES_GONE' => 'Some of the attachments you selected for deletion do not exist. They may have been already deleted. Attachments that did exist were deleted.', - 'FILES_STATS_WRONG' => 'Your files statistics are probably inaccurate and need to be resynchronised. Actual values: number of attachments = %1$d, total size of attachments = %2$s.', - 'GENERAL_OPTIONS' => 'General options', 'GENERAL_SETTINGS' => 'General settings', 'GLOBAL_MASK' => 'Global permission mask', @@ -252,6 +257,7 @@ $lang = array_merge($lang, array( 'IP' => 'User IP', 'IP_HOSTNAME' => 'IP addresses or hostnames', + 'LATEST_VERSION' => 'Latest version', 'LOAD_NOTIFICATIONS' => 'Display Notifications', 'LOAD_NOTIFICATIONS_EXPLAIN' => 'Display the notifications list on every page (typically in the header).', 'LOGGED_IN_AS' => 'You are logged in as:', @@ -284,12 +290,12 @@ $lang = array_merge($lang, array( 'PERMISSIONS_TRANSFERRED_EXPLAIN' => 'You currently have the permissions from %1$s. You are able to browse the board with this user’s permissions, but not access the administration control panel since admin permissions were not transferred. You can <a href="%2$s"><strong>revert to your permission set</strong></a> at any time.', 'PROCEED_TO_ACP' => '%sProceed to the ACP%s', + 'RELEASE_ANNOUNCEMENT' => 'Announcement', 'REMIND' => 'Remind', + 'REPARSE_LOCK_ERROR' => 'Reparsing is already in progress by another process.', 'RESYNC' => 'Resynchronise', - 'RESYNC_FILES_STATS' => 'Resynchronise files statistics', - 'RESYNC_FILES_STATS_EXPLAIN' => 'Recalculates the total number and size of files attached to posts and private messages.', - 'RETURN_TO' => 'Return to…', + 'RUNNING_TASK' => 'Running task: %s.', 'SELECT_ANONYMOUS' => 'Select anonymous user', 'SELECT_OPTION' => 'Select option', @@ -300,7 +306,9 @@ $lang = array_merge($lang, array( 'SHOW_ALL_OPERATIONS' => 'Show all operations', - 'TOTAL_SIZE' => 'Total size', + 'TASKS_NOT_READY' => 'Not ready tasks:', + 'TASKS_READY' => 'Ready tasks:', + 'TOTAL_SIZE' => 'Total size', 'UCP' => 'User Control Panel', 'USERNAMES_EXPLAIN' => 'Place each username on a separate line.', @@ -361,7 +369,7 @@ $lang = array_merge($lang, array( 'GZIP_COMPRESSION' => 'GZip compression', - 'NO_SEARCH_INDEX' => 'The selected search backend does not have a search index.<br >Please create the index for “%1$s†in the %2$ssearch index%3$s section.', + 'NO_SEARCH_INDEX' => 'The selected search backend does not have a search index.<br />Please create the index for “%1$s†in the %2$ssearch index%3$s section.', 'NOT_AVAILABLE' => 'Not available', 'NUMBER_FILES' => 'Number of attachments', 'NUMBER_POSTS' => 'Number of posts', @@ -389,7 +397,6 @@ $lang = array_merge($lang, array( 'RESET_ONLINE' => 'Reset most users ever online', 'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?', 'RESET_ONLINE_SUCCESS' => 'Most users ever online reset', - 'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise files statistics?', 'RESYNC_POSTCOUNTS' => 'Resynchronise post counts', 'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.', 'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?', @@ -417,6 +424,11 @@ $lang = array_merge($lang, array( 'VALUE' => 'Value', 'VERSIONCHECK_FAIL' => 'Failed to obtain latest version information.', 'VERSIONCHECK_FORCE_UPDATE' => 'Re-Check version', + 'VERSION_CHECK' => 'Version check', + 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', + 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.<br />Below is a link to the release announcement, which contains more information as well as instructions on updating.', + 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', + 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', 'VIEW_ADMIN_LOG' => 'View administrator log', 'VIEW_INACTIVE_USERS' => 'View inactive users', @@ -547,31 +559,32 @@ $lang = array_merge($lang, array( 'LOG_APPROVE_TOPIC' => '<strong>Approved topic</strong><br />» %s', 'LOG_BUMP_TOPIC' => '<strong>User bumped topic</strong><br />» %s', - 'LOG_DELETE_POST' => '<strong>Deleted post “%1$s†written by</strong><br />» %2$s', + 'LOG_DELETE_POST' => '<strong>Deleted post “%1$s†written by “%2$s†for the following reason</strong><br />» %3$s', 'LOG_DELETE_SHADOW_TOPIC' => '<strong>Deleted shadow topic</strong><br />» %s', - 'LOG_DELETE_TOPIC' => '<strong>Deleted topic “%1$s†written by</strong><br />» %2$s', + 'LOG_DELETE_TOPIC' => '<strong>Deleted topic “%1$s†written by “%2$s†for the following reason</strong><br />» %3$s', 'LOG_FORK' => '<strong>Copied topic</strong><br />» from %s', 'LOG_LOCK' => '<strong>Locked topic</strong><br />» %s', 'LOG_LOCK_POST' => '<strong>Locked post</strong><br />» %s', 'LOG_MERGE' => '<strong>Merged posts</strong> into topic<br />» %s', 'LOG_MOVE' => '<strong>Moved topic</strong><br />» from %1$s to %2$s', + 'LOG_MOVED_TOPIC' => '<strong>Moved topic</strong><br />» %s', 'LOG_PM_REPORT_CLOSED' => '<strong>Closed PM report</strong><br />» %s', 'LOG_PM_REPORT_DELETED' => '<strong>Deleted PM report</strong><br />» %s', 'LOG_POST_APPROVED' => '<strong>Approved post</strong><br />» %s', - 'LOG_POST_DISAPPROVED' => '<strong>Disapproved post “%1$s†with the following reason</strong><br />» %2$s', - 'LOG_POST_EDITED' => '<strong>Edited post “%1$s†written by</strong><br />» %2$s', + 'LOG_POST_DISAPPROVED' => '<strong>Disapproved post “%1$s†written by “%3$s†for the following reason</strong><br />» %2$s', + 'LOG_POST_EDITED' => '<strong>Edited post “%1$s†written by “%2$s†for the following reason</strong><br />» %3$s', 'LOG_POST_RESTORED' => '<strong>Restored post</strong><br />» %s', 'LOG_REPORT_CLOSED' => '<strong>Closed report</strong><br />» %s', 'LOG_REPORT_DELETED' => '<strong>Deleted report</strong><br />» %s', 'LOG_RESTORE_TOPIC' => '<strong>Restored topic “%1$s†written by</strong><br />» %2$s', - 'LOG_SOFTDELETE_POST' => '<strong>Soft deleted post “%1$s†written by</strong><br />» %2$s', - 'LOG_SOFTDELETE_TOPIC' => '<strong>Soft deleted topic “%1$s†written by</strong><br />» %2$s', + 'LOG_SOFTDELETE_POST' => '<strong>Soft deleted post “%1$s†written by “%2$s†for the following reason</strong><br />» %3$s', + 'LOG_SOFTDELETE_TOPIC' => '<strong>Soft deleted topic “%1$s†written by “%2$s†for the following reason</strong><br />» %3$s', 'LOG_SPLIT_DESTINATION' => '<strong>Moved split posts</strong><br />» to %s', 'LOG_SPLIT_SOURCE' => '<strong>Split posts</strong><br />» from %s', 'LOG_TOPIC_APPROVED' => '<strong>Approved topic</strong><br />» %s', 'LOG_TOPIC_RESTORED' => '<strong>Restored topic</strong><br />» %s', - 'LOG_TOPIC_DISAPPROVED' => '<strong>Disapproved topic “%1$s†with the following reason</strong><br />%2$s', + 'LOG_TOPIC_DISAPPROVED' => '<strong>Disapproved topic “%1$s†written by “%3$s†for the following reason</strong><br />» %2$s', 'LOG_TOPIC_RESYNC' => '<strong>Resynchronised topic counters</strong><br />» %s', 'LOG_TOPIC_TYPE_CHANGED' => '<strong>Changed topic type</strong><br />» %s', 'LOG_UNLOCK' => '<strong>Unlocked topic</strong><br />» %s', @@ -677,6 +690,7 @@ $lang = array_merge($lang, array( 'LOG_PRUNE' => '<strong>Pruned forums</strong><br />» %s', 'LOG_AUTO_PRUNE' => '<strong>Auto-pruned forums</strong><br />» %s', + 'LOG_PRUNE_SHADOW' => '<strong>Auto-pruned shadow topics</strong><br />» %s', 'LOG_PRUNE_USER_DEAC' => '<strong>Users deactivated</strong><br />» %s', 'LOG_PRUNE_USER_DEL_DEL' => '<strong>Users pruned and posts deleted</strong><br />» %s', 'LOG_PRUNE_USER_DEL_ANON' => '<strong>Users pruned and posts retained</strong><br />» %s', @@ -684,7 +698,6 @@ $lang = array_merge($lang, array( 'LOG_PURGE_CACHE' => '<strong>Purged cache</strong>', 'LOG_PURGE_SESSIONS' => '<strong>Purged sessions</strong>', - 'LOG_RANK_ADDED' => '<strong>Added new rank</strong><br />» %s', 'LOG_RANK_REMOVED' => '<strong>Removed rank</strong><br />» %s', 'LOG_RANK_UPDATED' => '<strong>Updated rank</strong><br />» %s', @@ -693,10 +706,10 @@ $lang = array_merge($lang, array( 'LOG_REASON_REMOVED' => '<strong>Removed report/denial reason</strong><br />» %s', 'LOG_REASON_UPDATED' => '<strong>Updated report/denial reason</strong><br />» %s', - 'LOG_REFERER_INVALID' => '<strong>Referer validation failed</strong><br />»Referer was “<em>%1$s</em>â€. The request was rejected and the session killed.', + 'LOG_REFERER_INVALID' => '<strong>Referrer validation failed</strong><br />»Referrer was “<em>%1$s</em>â€. The request was rejected and the session killed.', 'LOG_RESET_DATE' => '<strong>Board start date reset</strong>', 'LOG_RESET_ONLINE' => '<strong>Most users online reset</strong>', - 'LOG_RESYNC_FILES_STATS' => '<strong>Files statistics resynchronised</strong>', + 'LOG_RESYNC_FILES_STATS' => '<strong>File statistics resynchronised</strong>', 'LOG_RESYNC_POSTCOUNTS' => '<strong>User post counts resynchronised</strong>', 'LOG_RESYNC_POST_MARKING' => '<strong>Dotted topics resynchronised</strong>', 'LOG_RESYNC_STATS' => '<strong>Post, topic and user statistics resynchronised</strong>', @@ -776,10 +789,17 @@ $lang = array_merge($lang, array( 'LOG_USER_GROUP_RESIGN' => '<strong>User resigned membership from group</strong><br />» %s', 'LOG_WARNING_DELETED' => '<strong>Deleted user warning</strong><br />» %s', - 'LOG_WARNINGS_DELETED' => '<strong>Deleted %2$s user warnings</strong><br />» %1$s', // Example: '<strong>Deleted 2 user warnings</strong><br />» username' + 'LOG_WARNINGS_DELETED' => array( + 1 => '<strong>Deleted user warning</strong><br />» %1$s', + 2 => '<strong>Deleted %2$d user warnings</strong><br />» %1$s', // Example: '<strong>Deleted 2 user warnings</strong><br />» username' + ), 'LOG_WARNINGS_DELETED_ALL' => '<strong>Deleted all user warnings</strong><br />» %s', 'LOG_WORD_ADD' => '<strong>Added word censor</strong><br />» %s', 'LOG_WORD_DELETE' => '<strong>Deleted word censor</strong><br />» %s', 'LOG_WORD_EDIT' => '<strong>Edited word censor</strong><br />» %s', + + 'LOG_EXT_ENABLE' => '<strong>Extension enabled</strong><br />» %s', + 'LOG_EXT_DISABLE' => '<strong>Extension disabled</strong><br />» %s', + 'LOG_EXT_PURGE' => '<strong>Extension’s data deleted</strong><br />» %s', )); diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php index e98503ecf5..ab85701eaa 100644 --- a/phpBB/language/en/acp/database.php +++ b/phpBB/language/en/acp/database.php @@ -1,11 +1,13 @@ <?php /** * -* acp_database [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/acp/email.php b/phpBB/language/en/acp/email.php index aacb35b9bb..0d47e37d09 100644 --- a/phpBB/language/en/acp/email.php +++ b/phpBB/language/en/acp/email.php @@ -1,11 +1,13 @@ <?php /** * -* acp_email [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -36,7 +38,7 @@ if (empty($lang) || !is_array($lang)) // Email settings $lang = array_merge($lang, array( - 'ACP_MASS_EMAIL_EXPLAIN' => 'Here you can email a message to either all of your users or all users of a specific group <strong>having the option to receive mass emails enabled</strong>. To achieve this an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. The default setting is to only include 50 recipients in such an email, for more recipients more emails will be sent. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time, you will be notified when the script has completed.', + 'ACP_MASS_EMAIL_EXPLAIN' => 'Here you can email a message to either all of your users or all users of a specific group <strong>having the option to receive mass emails enabled</strong>. To achieve this an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. The default setting is to only include 20 recipients in such an email, for more recipients more emails will be sent. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time, you will be notified when the script has completed.', 'ALL_USERS' => 'All users', 'COMPOSE' => 'Compose', diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 409b800ba6..e5d6789764 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -1,15 +1,16 @@ <?php /** * -* acp_extensions [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -*/ + if (!defined('IN_PHPBB')) { exit; @@ -33,7 +34,6 @@ if (empty($lang) || !is_array($lang)) // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine - $lang = array_merge($lang, array( 'EXTENSION' => 'Extension', 'EXTENSIONS' => 'Extensions', @@ -42,6 +42,7 @@ $lang = array_merge($lang, array( 'EXTENSION_INVALID_LIST' => 'The “%s†extension is not valid.<br />%s<br /><br />', 'EXTENSION_NOT_AVAILABLE' => 'The selected extension is not available for this board, please verify your phpBB and PHP versions are allowed (see the details page).', 'EXTENSION_DIR_INVALID' => 'The selected extension has an invalid directory structure and cannot be enabled.', + 'EXTENSION_NOT_ENABLEABLE' => 'The selected extension cannot be enabled, please verify the extension’s requirements.', 'DETAILS' => 'Details', @@ -67,6 +68,12 @@ $lang = array_merge($lang, array( 'EXTENSION_NAME' => 'Extension Name', 'EXTENSION_ACTIONS' => 'Actions', 'EXTENSION_OPTIONS' => 'Options', + 'EXTENSION_INSTALL_HEADLINE'=> 'Installing an extension', + 'EXTENSION_INSTALL_EXPLAIN' => '<ol> + <li>Download an extension from phpBB’s extensions database</li> + <li>Unzip the extension and upload it to the <samp>ext/</samp> directory of your phpBB board</li> + <li>Enable the extension, here in the Extensions manager</li> + </ol>', 'EXTENSION_UPDATE_HEADLINE' => 'Updating an extension', 'EXTENSION_UPDATE_EXPLAIN' => '<ol> <li>Disable the extension</li> @@ -74,7 +81,7 @@ $lang = array_merge($lang, array( <li>Upload the new files</li> <li>Enable the extension</li> </ol>', - 'EXTENSION_REMOVE_HEADLINE' => 'Completly removing an extension from your board', + 'EXTENSION_REMOVE_HEADLINE' => 'Completely removing an extension from your board', 'EXTENSION_REMOVE_EXPLAIN' => '<ol> <li>Disable the extension</li> <li>Delete the extension’s data</li> @@ -84,6 +91,7 @@ $lang = array_merge($lang, array( 'EXTENSION_DELETE_DATA_CONFIRM' => 'Are you sure that you wish to delete the data associated with “%sâ€?<br /><br />This removes all of its data and settings and cannot be undone!', 'EXTENSION_DISABLE_CONFIRM' => 'Are you sure that you wish to disable the “%s†extension?', 'EXTENSION_ENABLE_CONFIRM' => 'Are you sure that you wish to enable the “%s†extension?', + 'EXTENSION_FORCE_UNSTABLE_CONFIRM' => 'Are you sure that you wish to force the use of unstable version?', 'RETURN_TO_EXTENSION_LIST' => 'Return to the extension list', @@ -96,7 +104,7 @@ $lang = array_merge($lang, array( 'HOMEPAGE' => 'Homepage', 'PATH' => 'File Path', 'TIME' => 'Release Time', - 'LICENCE' => 'Licence', + 'LICENSE' => 'Licence', 'REQUIREMENTS' => 'Requirements', 'PHPBB_VERSION' => 'phpBB Version', @@ -106,4 +114,19 @@ $lang = array_merge($lang, array( 'AUTHOR_EMAIL' => 'Email', 'AUTHOR_HOMEPAGE' => 'Homepage', 'AUTHOR_ROLE' => 'Role', + + 'NOT_UP_TO_DATE' => '%s is not up to date', + 'UP_TO_DATE' => '%s is up to date', + 'ANNOUNCEMENT_TOPIC' => 'Release Announcement', + 'DOWNLOAD_LATEST' => 'Download Version', + 'NO_VERSIONCHECK' => 'No version check information given.', + + 'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all versions', + 'FORCE_UNSTABLE' => 'Always check for unstable versions', + 'EXTENSIONS_VERSION_CHECK_SETTINGS' => 'Version check settings', + + 'BROWSE_EXTENSIONS_DATABASE' => 'Browse extensions database', + + 'META_FIELD_NOT_SET' => 'Required meta field %s has not been set.', + 'META_FIELD_INVALID' => 'Meta field %s is invalid.', )); diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index 756cb7ae0f..541d05c255 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -1,11 +1,13 @@ <?php /** * -* acp_forums [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -42,6 +44,10 @@ $lang = array_merge($lang, array( 'AUTO_PRUNE_FREQ_EXPLAIN' => 'Time in days between pruning events.', 'AUTO_PRUNE_VIEWED' => 'Auto-prune post viewed age', 'AUTO_PRUNE_VIEWED_EXPLAIN' => 'Number of days since topic was viewed after which topic is removed.', + 'AUTO_PRUNE_SHADOW_FREQ' => 'Auto-prune shadow topics frequency', + 'AUTO_PRUNE_SHADOW_DAYS' => 'Auto-prune shadow topics age', + 'AUTO_PRUNE_SHADOW_DAYS_EXPLAIN' => 'Number of days after which shadow topic is removed.', + 'AUTO_PRUNE_SHADOW_FREQ_EXPLAIN' => 'Time in days between pruning events.', 'CONTINUE' => 'Continue', 'COPY_PERMISSIONS' => 'Copy permissions from', @@ -101,6 +107,8 @@ $lang = array_merge($lang, array( 'FORUM_PASSWORD_OLD' => 'The forum password is using an old hashing method and should be changed.', 'FORUM_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', 'FORUM_PRUNE_SETTINGS' => 'Forum prune settings', + 'FORUM_PRUNE_SHADOW' => 'Enable auto-pruning of shadow topics', + 'FORUM_PRUNE_SHADOW_EXPLAIN' => 'Prunes the forum of shadow topics, set the frequency/age parameters below.', 'FORUM_RESYNCED' => 'Forum “%s†successfully resynced', 'FORUM_RULES_EXPLAIN' => 'Forum rules are displayed at any page within the given forum.', 'FORUM_RULES_LINK' => 'Link to forum rules', diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php index 58101e5f60..421075ce5e 100644 --- a/phpBB/language/en/acp/groups.php +++ b/phpBB/language/en/acp/groups.php @@ -1,11 +1,13 @@ <?php /** * -* acp_groups [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -81,7 +83,7 @@ $lang = array_merge($lang, array( 'GROUP_MEMBERS' => 'Group members', 'GROUP_MEMBERS_EXPLAIN' => 'This is a complete listing of all the members of this usergroup. It includes separate sections for leaders, pending and existing members. From here you can manage all aspects of who has membership of this group and what their role is. To remove a leader but keep them in the group use Demote rather than delete. Similarly use Promote to make an existing member a leader.', 'GROUP_MESSAGE_LIMIT' => 'Group private message limit per folder', - 'GROUP_MESSAGE_LIMIT_EXPLAIN' => 'This setting overrides the per-user folder message limit. A value of 0 means the user default limit will be used.', + 'GROUP_MESSAGE_LIMIT_EXPLAIN' => 'This setting overrides the per-user folder message limit. The maximum for all groups of the user is used to determine the actual value.<br />Set this value to 0 to overwrite the setting for all users of this group with the board-wide setting.', 'GROUP_MODS_ADDED' => 'New group leaders added successfully.', 'GROUP_MODS_DEMOTED' => 'Group leaders demoted successfully.', 'GROUP_MODS_PROMOTED' => 'Group members promoted successfully.', @@ -90,7 +92,7 @@ $lang = array_merge($lang, array( 'GROUP_OPEN' => 'Open', 'GROUP_PENDING' => 'Pending members', 'GROUP_MAX_RECIPIENTS' => 'Maximum number of allowed recipients per private message', - 'GROUP_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. If 0 is entered, the board-wide setting is used.', + 'GROUP_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. The maximum for all groups of the user is used to determine the actual value.<br />Set this value to 0 to overwrite the setting for all users of this group with the board-wide setting.', 'GROUP_OPTIONS_SAVE' => 'Group wide options', 'GROUP_PROMOTE' => 'Promote to group leader', 'GROUP_RANK' => 'Group rank', diff --git a/phpBB/language/en/acp/language.php b/phpBB/language/en/acp/language.php index 154551bd6e..d14491ae75 100644 --- a/phpBB/language/en/acp/language.php +++ b/phpBB/language/en/acp/language.php @@ -1,11 +1,13 @@ <?php /** * -* acp_language [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -38,26 +40,15 @@ $lang = array_merge($lang, array( 'ACP_FILES' => 'Admin language files', 'ACP_LANGUAGE_PACKS_EXPLAIN' => 'Here you are able to install/remove language packs. The default language pack is marked with an asterisk (*).', - 'EMAIL_FILES' => 'Email templates', - - 'FILE_CONTENTS' => 'File contents', - 'FILE_FROM_STORAGE' => 'File from storage folder', - - 'HELP_FILES' => 'Help files', + 'DELETE_LANGUAGE_CONFIRM' => 'Are you sure you wish to delete “%sâ€?', - 'INSTALLED_LANGUAGE_PACKS' => 'Installed language packs', - 'INVALID_LANGUAGE_PACK' => 'The selected language pack seems to be not valid. Please verify the language pack and upload it again if necessary.', - 'INVALID_UPLOAD_METHOD' => 'The selected upload method is not valid, please choose a different method.', + 'INSTALLED_LANGUAGE_PACKS' => 'Installed language packs', 'LANGUAGE_DETAILS_UPDATED' => 'Language details successfully updated.', - 'LANGUAGE_ENTRIES' => 'Language entries', - 'LANGUAGE_ENTRIES_EXPLAIN' => 'Here you are able to change existing language pack entries or not already translated ones.<br /><strong>Note:</strong> Once you changed a language file, the changes will be stored within a separate folder for you to download. The changes will not be seen by your users until you replace the original language files at your webspace (by uploading them).', - 'LANGUAGE_FILES' => 'Language files', - 'LANGUAGE_KEY' => 'Language key', 'LANGUAGE_PACK_ALREADY_INSTALLED' => 'This language pack is already installed.', - 'LANGUAGE_PACK_DELETED' => 'The language pack <strong>%s</strong> has been removed successfully. All users using this language have been reset to the boards default language.', + 'LANGUAGE_PACK_DELETED' => 'The language pack “%s†has been removed successfully. All users using this language have been reset to the board’s default language.', 'LANGUAGE_PACK_DETAILS' => 'Language pack details', - 'LANGUAGE_PACK_INSTALLED' => 'The language pack <strong>%s</strong> has been successfully installed.', + 'LANGUAGE_PACK_INSTALLED' => 'The language pack “%s†has been successfully installed.', 'LANGUAGE_PACK_CPF_UPDATE' => 'The custom profile fields’ language strings were copied from the default language. Please change them if necessary.', 'LANGUAGE_PACK_ISO' => 'ISO', 'LANGUAGE_PACK_LOCALNAME' => 'Local name', @@ -70,31 +61,18 @@ $lang = array_merge($lang, array( 'LANG_ISO_CODE' => 'ISO code', 'LANG_LOCAL_NAME' => 'Local name', - 'MISSING_LANGUAGE_FILE' => 'Missing language file: <strong style="color:red">%s</strong>', + 'MISSING_LANG_FILES' => 'Missing language files', 'MISSING_LANG_VARIABLES' => 'Missing language variables', - 'MODS_FILES' => 'MODs language files', 'NO_FILE_SELECTED' => 'You haven’t specified a language file.', 'NO_LANG_ID' => 'You haven’t specified a language pack.', - 'NO_REMOVE_DEFAULT_LANG' => 'You are not able to remove the default language pack.<br />If you want to remove this language pack, change your boards default language first.', + 'NO_REMOVE_DEFAULT_LANG' => 'You are not able to remove the default language pack.<br />If you want to remove this language pack, change your board’s default language first.', 'NO_UNINSTALLED_LANGUAGE_PACKS' => 'No uninstalled language packs', - 'REMOVE_FROM_STORAGE_FOLDER' => 'Remove from storage folder', - - 'SELECT_DOWNLOAD_FORMAT' => 'Select download format', - 'SUBMIT_AND_DOWNLOAD' => 'Submit and download file', - 'SUBMIT_AND_UPLOAD' => 'Submit and upload file', - - 'THOSE_MISSING_LANG_FILES' => 'The following language files are missing from the %s language folder', - 'THOSE_MISSING_LANG_VARIABLES' => 'The following language variables are missing from the <strong>%s</strong> language pack', + 'THOSE_MISSING_LANG_FILES' => 'The following language files are missing from the “%s†language folder', + 'THOSE_MISSING_LANG_VARIABLES' => 'The following language variables are missing from the “%s†language pack', 'UNINSTALLED_LANGUAGE_PACKS' => 'Uninstalled language packs', - 'UNABLE_TO_WRITE_FILE' => 'The file could not be written to %s.', - 'UPLOAD_COMPLETED' => 'The upload was completed successfully.', - 'UPLOAD_FAILED' => 'The upload failed for unknown reasons. You may need to replace the relevant file manually.', - 'UPLOAD_METHOD' => 'Upload method', - 'UPLOAD_SETTINGS' => 'Upload settings', - - 'WRONG_LANGUAGE_FILE' => 'Selected language file is invalid.', + 'BROWSE_LANGUAGE_PACKS_DATABASE' => 'Browse language packs database', )); diff --git a/phpBB/language/en/acp/modules.php b/phpBB/language/en/acp/modules.php index 9c1c799720..1213641366 100644 --- a/phpBB/language/en/acp/modules.php +++ b/phpBB/language/en/acp/modules.php @@ -1,11 +1,13 @@ <?php /** * -* acp_modules [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index 709836e828..1ade2d6eb8 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -1,11 +1,13 @@ <?php /** * -* acp_permissions [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -52,12 +54,12 @@ $lang = array_merge($lang, array( <br /> - <p>For further information on setting up and managing permissions on your phpBB3 board, please see <a href="https://www.phpbb.com/support/documentation/3.0/quickstart/quick_permissions.html">Chapter 1.5 of our Quick Start Guide</a>.</p> + <p>For further information on setting up and managing permissions on your phpBB3 board, please see the section on <a href="https://www.phpbb.com/support/docs/en/3.1/ug/quickstart/permissions/">Setting permissions of our Quick Start Guide</a>.</p> ', 'ACL_NEVER' => 'Never', 'ACL_SET' => 'Setting permissions', - 'ACL_SET_EXPLAIN' => 'Permissions are based on a simple <samp>YES</samp>/<samp>NO</samp> system. Setting an option to <samp>NEVER</samp> for a user or usergroup overrides any other value assigned to it. If you do not wish to assign a value for an option for this user or group select <samp>NO</samp>. If values are assigned for this option elsewhere they will be used in preference, else <samp>NEVER</samp> is assumed. All objects marked (with the checkbox in front of them) will copy the permission set you defined.', + 'ACL_SET_EXPLAIN' => 'Permissions are based on a simple <strong>YES</strong>/<strong>NO</strong> system. Setting an option to <strong>NEVER</strong> for a user or usergroup overrides any other value assigned to it. If you do not wish to assign a value for an option for this user or group select <strong>NO</strong>. If values are assigned for this option elsewhere they will be used in preference, else <strong>NEVER</strong> is assumed. All objects marked (with the checkbox in front of them) will copy the permission set you defined.', 'ACL_SETTING' => 'Setting', 'ACL_TYPE_A_' => 'Administrative permissions', @@ -100,10 +102,10 @@ $lang = array_merge($lang, array( 'ADD_USERS' => 'Add users', 'ADVANCED_PERMISSIONS' => 'Advanced Permissions', 'ALL_GROUPS' => 'Select all groups', - 'ALL_NEVER' => 'All <samp>NEVER</samp>', - 'ALL_NO' => 'All <samp>NO</samp>', + 'ALL_NEVER' => 'All <strong>NEVER</strong>', + 'ALL_NO' => 'All <strong>NO</strong>', 'ALL_USERS' => 'Select all users', - 'ALL_YES' => 'All <samp>YES</samp>', + 'ALL_YES' => 'All <strong>YES</strong>', 'APPLY_ALL_PERMISSIONS' => 'Apply all permissions', 'APPLY_PERMISSIONS' => 'Apply permissions', 'APPLY_PERMISSIONS_EXPLAIN' => 'The permissions and role defined for this item will only be applied to this item and all checked items.', @@ -137,7 +139,7 @@ $lang = array_merge($lang, array( 'NO_AUTH_SETTING_FOUND' => 'Permission settings not defined.', 'NO_ROLE_ASSIGNED' => 'No role assigned…', - 'NO_ROLE_ASSIGNED_EXPLAIN' => 'Setting to this role does not change permissions on the right. If you want to unset/remove all permissions you should use the “All <samp>NO</samp>†link.', + 'NO_ROLE_ASSIGNED_EXPLAIN' => 'Setting to this role does not change permissions on the right. If you want to unset/remove all permissions you should use the “All <strong>NO</strong>†link.', 'NO_ROLE_AVAILABLE' => 'No role available', 'NO_ROLE_NAME_SPECIFIED' => 'Please give the role a name.', 'NO_ROLE_SELECTED' => 'Role could not be found.', @@ -182,7 +184,6 @@ $lang = array_merge($lang, array( 'ROLE_USER_STANDARD' => 'Standard Features', 'ROLE_USER_NEW_MEMBER' => 'Newly Registered User Features', - 'ROLE_DESCRIPTION_ADMIN_FORUM' => 'Can access the forum management and forum permission settings.', 'ROLE_DESCRIPTION_ADMIN_FULL' => 'Has access to all administrative functions of this board.<br />Not recommended.', 'ROLE_DESCRIPTION_ADMIN_STANDARD' => 'Has access to most administrative features but is not allowed to use server or system related tools.', @@ -196,7 +197,7 @@ $lang = array_merge($lang, array( 'ROLE_DESCRIPTION_FORUM_POLLS' => 'Like Standard Access but can also create polls.', 'ROLE_DESCRIPTION_FORUM_READONLY' => 'Can read the forum, but cannot create new topics or reply to posts.', 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments and deleting own topics, but cannot lock own topics, and cannot create polls.', - 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains <samp>NEVER</samp> permissions to lock features for new users.', + 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains <strong>NEVER</strong> permissions to lock features for new users.', 'ROLE_DESCRIPTION_MOD_FULL' => 'Can use all moderating features, including banning.', 'ROLE_DESCRIPTION_MOD_QUEUE' => 'Can use the Moderation Queue to validate and edit posts, but nothing else.', 'ROLE_DESCRIPTION_MOD_SIMPLE' => 'Can only use basic topic actions. Cannot send warnings or use moderation queue.', @@ -206,7 +207,7 @@ $lang = array_merge($lang, array( 'ROLE_DESCRIPTION_USER_NOAVATAR' => 'Has a limited feature set and is not allowed to use the Avatar feature.', 'ROLE_DESCRIPTION_USER_NOPM' => 'Has a limited feature set, and is not allowed to use Private Messages.', 'ROLE_DESCRIPTION_USER_STANDARD' => 'Can access most but not all user features. Cannot change user name or ignore the flood limit, for instance.', - 'ROLE_DESCRIPTION_USER_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains <samp>NEVER</samp> permissions to lock features for new users.', + 'ROLE_DESCRIPTION_USER_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains <strong>NEVER</strong> permissions to lock features for new users.', 'ROLE_DESCRIPTION_EXPLAIN' => 'You are able to enter a short explanation of what the role is doing or for what it is meant for. The text you enter here will be displayed within the permissions screens too.', 'ROLE_DESCRIPTION_LONG' => 'The role description is too long, please limit it to 4000 characters.', @@ -227,48 +228,48 @@ $lang = array_merge($lang, array( 'SET_USERS_PERMISSIONS' => 'Set user permissions', 'SET_USERS_FORUM_PERMISSIONS' => 'Set user forum permissions', - 'TRACE_DEFAULT' => 'By default every permission is <samp>NO</samp> (unset). So the permission can be overwritten by other settings.', + 'TRACE_DEFAULT' => 'By default every permission is <strong>NO</strong> (unset). So the permission can be overwritten by other settings.', 'TRACE_FOR' => 'Trace for', 'TRACE_GLOBAL_SETTING' => '%s (global)', - 'TRACE_GROUP_NEVER_TOTAL_NEVER' => 'This group’s permission is set to <samp>NEVER</samp> like the total result so the old result is kept.', - 'TRACE_GROUP_NEVER_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to <samp>NEVER</samp> like the total result so the old result is kept.', - 'TRACE_GROUP_NEVER_TOTAL_NO' => 'This group’s permission is set to <samp>NEVER</samp> which becomes the new total value because it wasn’t set yet (set to <samp>NO</samp>).', - 'TRACE_GROUP_NEVER_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to <samp>NEVER</samp> which becomes the new total value because it wasn’t set yet (set to <samp>NO</samp>).', - 'TRACE_GROUP_NEVER_TOTAL_YES' => 'This group’s permission is set to <samp>NEVER</samp> which overwrites the total <samp>YES</samp> to a <samp>NEVER</samp> for this user.', - 'TRACE_GROUP_NEVER_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to <samp>NEVER</samp> which overwrites the total <samp>YES</samp> to a <samp>NEVER</samp> for this user.', - 'TRACE_GROUP_NO' => 'The permission is <samp>NO</samp> for this group so the old total value is kept.', - 'TRACE_GROUP_NO_LOCAL' => 'The permission is <samp>NO</samp> for this group within this forum so the old total value is kept.', - 'TRACE_GROUP_YES_TOTAL_NEVER' => 'This group’s permission is set to <samp>YES</samp> but the total <samp>NEVER</samp> cannot be overwritten.', - 'TRACE_GROUP_YES_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to <samp>YES</samp> but the total <samp>NEVER</samp> cannot be overwritten.', - 'TRACE_GROUP_YES_TOTAL_NO' => 'This group’s permission is set to <samp>YES</samp> which becomes the new total value because it wasn’t set yet (set to <samp>NO</samp>).', - 'TRACE_GROUP_YES_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to <samp>YES</samp> which becomes the new total value because it wasn’t set yet (set to <samp>NO</samp>).', - 'TRACE_GROUP_YES_TOTAL_YES' => 'This group’s permission is set to <samp>YES</samp> and the total permission is already set to <samp>YES</samp>, so the total result is kept.', - 'TRACE_GROUP_YES_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to <samp>YES</samp> and the total permission is already set to <samp>YES</samp>, so the total result is kept.', + 'TRACE_GROUP_NEVER_TOTAL_NEVER' => 'This group’s permission is set to <strong>NEVER</strong> like the total result so the old result is kept.', + 'TRACE_GROUP_NEVER_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to <strong>NEVER</strong> like the total result so the old result is kept.', + 'TRACE_GROUP_NEVER_TOTAL_NO' => 'This group’s permission is set to <strong>NEVER</strong> which becomes the new total value because it wasn’t set yet (set to <strong>NO</strong>).', + 'TRACE_GROUP_NEVER_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to <strong>NEVER</strong> which becomes the new total value because it wasn’t set yet (set to <strong>NO</strong>).', + 'TRACE_GROUP_NEVER_TOTAL_YES' => 'This group’s permission is set to <strong>NEVER</strong> which overwrites the total <strong>YES</strong> to a <strong>NEVER</strong> for this user.', + 'TRACE_GROUP_NEVER_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to <strong>NEVER</strong> which overwrites the total <strong>YES</strong> to a <strong>NEVER</strong> for this user.', + 'TRACE_GROUP_NO' => 'The permission is <strong>NO</strong> for this group so the old total value is kept.', + 'TRACE_GROUP_NO_LOCAL' => 'The permission is <strong>NO</strong> for this group within this forum so the old total value is kept.', + 'TRACE_GROUP_YES_TOTAL_NEVER' => 'This group’s permission is set to <strong>YES</strong> but the total <strong>NEVER</strong> cannot be overwritten.', + 'TRACE_GROUP_YES_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to <strong>YES</strong> but the total <strong>NEVER</strong> cannot be overwritten.', + 'TRACE_GROUP_YES_TOTAL_NO' => 'This group’s permission is set to <strong>YES</strong> which becomes the new total value because it wasn’t set yet (set to <strong>NO</strong>).', + 'TRACE_GROUP_YES_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to <strong>YES</strong> which becomes the new total value because it wasn’t set yet (set to <strong>NO</strong>).', + 'TRACE_GROUP_YES_TOTAL_YES' => 'This group’s permission is set to <strong>YES</strong> and the total permission is already set to <strong>YES</strong>, so the total result is kept.', + 'TRACE_GROUP_YES_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to <strong>YES</strong> and the total permission is already set to <strong>YES</strong>, so the total result is kept.', 'TRACE_PERMISSION' => 'Trace permission - %s', 'TRACE_RESULT' => 'Trace result', 'TRACE_SETTING' => 'Trace setting', - 'TRACE_USER_GLOBAL_YES_TOTAL_YES' => 'The forum independent user permission evaluates to <samp>YES</samp> but the total permission is already set to <samp>YES</samp>, so the total result is kept. %sTrace global permission%s', - 'TRACE_USER_GLOBAL_YES_TOTAL_NEVER' => 'The forum independent user permission evaluates to <samp>YES</samp> which overwrites the current local result <samp>NEVER</samp>. %sTrace global permission%s', - 'TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT' => 'The forum independent user permission evaluates to <samp>NEVER</samp> which doesn’t influence the local permission. %sTrace global permission%s', - - 'TRACE_USER_FOUNDER' => 'The user is a founder, therefore admin permissions are always set to <samp>YES</samp>.', - 'TRACE_USER_KEPT' => 'The user’s permission is <samp>NO</samp> so the old total value is kept.', - 'TRACE_USER_KEPT_LOCAL' => 'The user’s permission for this forum is <samp>NO</samp> so the old total value is kept.', - 'TRACE_USER_NEVER_TOTAL_NEVER' => 'The user’s permission is set to <samp>NEVER</samp> and the total value is set to <samp>NEVER</samp>, so nothing is changed.', - 'TRACE_USER_NEVER_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to <samp>NEVER</samp> and the total value is set to <samp>NEVER</samp>, so nothing is changed.', - 'TRACE_USER_NEVER_TOTAL_NO' => 'The user’s permission is set to <samp>NEVER</samp> which becomes the total value because it was set to NO.', - 'TRACE_USER_NEVER_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to <samp>NEVER</samp> which becomes the total value because it was set to NO.', - 'TRACE_USER_NEVER_TOTAL_YES' => 'The user’s permission is set to <samp>NEVER</samp> and overwrites the previous <samp>YES</samp>.', - 'TRACE_USER_NEVER_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to <samp>NEVER</samp> and overwrites the previous <samp>YES</samp>.', - 'TRACE_USER_NO_TOTAL_NO' => 'The user’s permission is <samp>NO</samp> and the total value was set to NO so it defaults to <samp>NEVER</samp>.', - 'TRACE_USER_NO_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is <samp>NO</samp> and the total value was set to NO so it defaults to <samp>NEVER</samp>.', - 'TRACE_USER_YES_TOTAL_NEVER' => 'The user’s permission is set to <samp>YES</samp> but the total <samp>NEVER</samp> cannot be overwritten.', - 'TRACE_USER_YES_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to <samp>YES</samp> but the total <samp>NEVER</samp> cannot be overwritten.', - 'TRACE_USER_YES_TOTAL_NO' => 'The user’s permission is set to <samp>YES</samp> which becomes the total value because it was set to <samp>NO</samp>.', - 'TRACE_USER_YES_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to <samp>YES</samp> which becomes the total value because it was set to <samp>NO</samp>.', - 'TRACE_USER_YES_TOTAL_YES' => 'The user’s permission is set to <samp>YES</samp> and the total value is set to <samp>YES</samp>, so nothing is changed.', - 'TRACE_USER_YES_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to <samp>YES</samp> and the total value is set to <samp>YES</samp>, so nothing is changed.', + 'TRACE_USER_GLOBAL_YES_TOTAL_YES' => 'The forum independent user permission evaluates to <strong>YES</strong> but the total permission is already set to <strong>YES</strong>, so the total result is kept. %sTrace global permission%s', + 'TRACE_USER_GLOBAL_YES_TOTAL_NEVER' => 'The forum independent user permission evaluates to <strong>YES</strong> which overwrites the current local result <strong>NEVER</strong>. %sTrace global permission%s', + 'TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT' => 'The forum independent user permission evaluates to <strong>NEVER</strong> which doesn’t influence the local permission. %sTrace global permission%s', + + 'TRACE_USER_FOUNDER' => 'The user is a founder, therefore admin permissions are always set to <strong>YES</strong>.', + 'TRACE_USER_KEPT' => 'The user’s permission is <strong>NO</strong> so the old total value is kept.', + 'TRACE_USER_KEPT_LOCAL' => 'The user’s permission for this forum is <strong>NO</strong> so the old total value is kept.', + 'TRACE_USER_NEVER_TOTAL_NEVER' => 'The user’s permission is set to <strong>NEVER</strong> and the total value is set to <strong>NEVER</strong>, so nothing is changed.', + 'TRACE_USER_NEVER_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to <strong>NEVER</strong> and the total value is set to <strong>NEVER</strong>, so nothing is changed.', + 'TRACE_USER_NEVER_TOTAL_NO' => 'The user’s permission is set to <strong>NEVER</strong> which becomes the total value because it was set to NO.', + 'TRACE_USER_NEVER_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to <strong>NEVER</strong> which becomes the total value because it was set to NO.', + 'TRACE_USER_NEVER_TOTAL_YES' => 'The user’s permission is set to <strong>NEVER</strong> and overwrites the previous <strong>YES</strong>.', + 'TRACE_USER_NEVER_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to <strong>NEVER</strong> and overwrites the previous <strong>YES</strong>.', + 'TRACE_USER_NO_TOTAL_NO' => 'The user’s permission is <strong>NO</strong> and the total value was set to NO so it defaults to <strong>NEVER</strong>.', + 'TRACE_USER_NO_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is <strong>NO</strong> and the total value was set to NO so it defaults to <strong>NEVER</strong>.', + 'TRACE_USER_YES_TOTAL_NEVER' => 'The user’s permission is set to <strong>YES</strong> but the total <strong>NEVER</strong> cannot be overwritten.', + 'TRACE_USER_YES_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to <strong>YES</strong> but the total <strong>NEVER</strong> cannot be overwritten.', + 'TRACE_USER_YES_TOTAL_NO' => 'The user’s permission is set to <strong>YES</strong> which becomes the total value because it was set to <strong>NO</strong>.', + 'TRACE_USER_YES_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to <strong>YES</strong> which becomes the total value because it was set to <strong>NO</strong>.', + 'TRACE_USER_YES_TOTAL_YES' => 'The user’s permission is set to <strong>YES</strong> and the total value is set to <strong>YES</strong>, so nothing is changed.', + 'TRACE_USER_YES_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to <strong>YES</strong> and the total value is set to <strong>YES</strong>, so nothing is changed.', 'TRACE_WHO' => 'Who', 'TRACE_TOTAL' => 'Total', diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 5ea151f6ea..f986eced38 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -1,10 +1,14 @@ <?php /** -* acp_permissions_phpbb (phpBB Permission Set) [English] * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* */ /** @@ -116,6 +120,7 @@ $lang = array_merge($lang, array( 'ACL_F_POST' => 'Can start new topics', 'ACL_F_STICKY' => 'Can post stickies', 'ACL_F_ANNOUNCE' => 'Can post announcements', + 'ACL_F_ANNOUNCE_GLOBAL' => 'Can post global announcements', 'ACL_F_REPLY' => 'Can reply to topics', 'ACL_F_EDIT' => 'Can edit own posts', 'ACL_F_DELETE' => 'Can permanently delete own posts', @@ -142,7 +147,7 @@ $lang = array_merge($lang, array( 'ACL_M_EDIT' => 'Can edit posts', 'ACL_M_DELETE' => 'Can permanently delete posts', 'ACL_M_SOFTDELETE' => 'Can soft delete posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>', - 'ACL_M_APPROVE' => 'Can approve posts', + 'ACL_M_APPROVE' => 'Can approve and restore posts', 'ACL_M_REPORT' => 'Can close and delete reports', 'ACL_M_CHGPOSTER' => 'Can change post author', @@ -151,9 +156,10 @@ $lang = array_merge($lang, array( 'ACL_M_SPLIT' => 'Can split topics', 'ACL_M_MERGE' => 'Can merge topics', - 'ACL_M_INFO' => 'Can view post details', - 'ACL_M_WARN' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local) - 'ACL_M_BAN' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local) + 'ACL_M_INFO' => 'Can view post details', + 'ACL_M_WARN' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local) + 'ACL_M_PM_REPORT' => 'Can close and delete reports of private messages<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local) + 'ACL_M_BAN' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local) )); // Admin Permissions diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index ea3eadb0dd..119ad2d7e9 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -1,11 +1,13 @@ <?php /** * -* acp_posting [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -85,8 +87,8 @@ $lang = array_merge($lang, array( 'URL' => 'A valid URL using any protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, “http://†is prefixed to the string.', 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol, as links are prefixed with “%sâ€', 'RELATIVE_URL' => 'A relative URL. You can use this to match parts of a URL, but be careful: a full URL is a valid relative URL. When you want to use relative URLs of your board, use the LOCAL_URL token.', - 'COLOR' => 'A HTML colour, can be either in the numeric form <samp>#FF1234</samp> or a <a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-color">CSS colour keyword</a> such as <samp>fuchsia</samp> or <samp>InactiveBorder</samp>' - ) + 'COLOR' => 'A HTML colour, can be either in the numeric form <samp>#FF1234</samp> or a <a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-color">CSS colour keyword</a> such as <samp>fuchsia</samp> or <samp>InactiveBorder</samp>', + ), )); // Smilies and topic icons @@ -109,8 +111,6 @@ $lang = array_merge($lang, array( 'DISPLAY_POSTING' => 'On posting page', 'DISPLAY_POSTING_NO' => 'Not on posting page', - - 'EDIT_ICONS' => 'Edit icons', 'EDIT_SMILIES' => 'Edit smilies', 'EMOTION' => 'Emotion', diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php index 726a9bac82..d365aeb183 100644 --- a/phpBB/language/en/acp/profile.php +++ b/phpBB/language/en/acp/profile.php @@ -1,11 +1,13 @@ <?php /** * -* acp_profile [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -37,8 +39,11 @@ if (empty($lang) || !is_array($lang)) // Custom profile fields $lang = array_merge($lang, array( 'ADDED_PROFILE_FIELD' => 'Successfully added custom profile field.', + 'ALPHA_DOTS' => 'Alphanumeric and dots (periods)', 'ALPHA_ONLY' => 'Alphanumeric only', 'ALPHA_SPACERS' => 'Alphanumeric and spacers', + 'ALPHA_UNDERSCORE' => 'Alphanumeric and underscores', + 'ALPHA_PUNCTUATION' => 'Alphanumeric with comma, dots, underscore and dashes beginning with a letter', 'ALWAYS_TODAY' => 'Always the current date', 'BOOL_ENTRIES_EXPLAIN' => 'Enter your options now', @@ -67,8 +72,8 @@ $lang = array_merge($lang, array( 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.', 'DISPLAY_ON_MEMBERLIST' => 'Display on memberlist screen', 'DISPLAY_ON_MEMBERLIST_EXPLAIN' => 'If this option is enabled, the field will be displayed in the user rows on the memberlist screen.', - 'DISPLAY_ON_PM' => 'Display on view pm screen', - 'DISPLAY_ON_PM_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the pm screen.', + 'DISPLAY_ON_PM' => 'Display on view private message screen', + 'DISPLAY_ON_PM_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the private message screen.', 'DISPLAY_ON_VT' => 'Display on viewtopic screen', 'DISPLAY_ON_VT_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the topic screen.', 'DISPLAY_PROFILE_FIELD' => 'Publicly display profile field', @@ -82,20 +87,26 @@ $lang = array_merge($lang, array( 'EVERYTHING_OK' => 'Everything OK', 'FIELD_BOOL' => 'Boolean (Yes/No)', + 'FIELD_CONTACT_DESC' => 'Contact description', + 'FIELD_CONTACT_URL' => 'Contact link', 'FIELD_DATE' => 'Date', 'FIELD_DESCRIPTION' => 'Field description', 'FIELD_DESCRIPTION_EXPLAIN' => 'The explanation for this field presented to the user.', 'FIELD_DROPDOWN' => 'Dropdown box', + 'FIELD_GOOGLEPLUS' => 'Google+', 'FIELD_IDENT' => 'Field identification', 'FIELD_IDENT_ALREADY_EXIST' => 'The chosen field identification already exist. Please choose another name.', 'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.', 'FIELD_INT' => 'Numbers', + 'FIELD_IS_CONTACT' => 'Display field as a contact field', + 'FIELD_IS_CONTACT_EXPLAIN' => 'Contact fields are displayed within the contact section of the user profile and are displayed differently in the mini profile next to posts and private messages. You can use <samp>%s</samp> as a placeholder variable which will be replaced by a value provided by the user.', 'FIELD_LENGTH' => 'Length of input box', 'FIELD_NOT_FOUND' => 'Profile field not found.', 'FIELD_STRING' => 'Single text field', 'FIELD_TEXT' => 'Textarea', 'FIELD_TYPE' => 'Field type', 'FIELD_TYPE_EXPLAIN' => 'You are not able to change the field type later.', + 'FIELD_URL' => 'URL (Link)', 'FIELD_VALIDATION' => 'Field validation', 'FIRST_OPTION' => 'First option', @@ -108,6 +119,12 @@ $lang = array_merge($lang, array( 'LANG_SPECIFIC_OPTIONS' => 'Language specific options [<strong>%s</strong>]', + 'LETTER_NUM_DOTS' => 'Any letters, numbers and dots (periods)', + 'LETTER_NUM_ONLY' => 'Any letters and numbers', + 'LETTER_NUM_PUNCTUATION' => 'Any letters, numbers, comma, dots, underscores and dashes beginning with any letter', + 'LETTER_NUM_SPACERS' => 'Any letters, numbers and spacers', + 'LETTER_NUM_UNDERSCORE' => 'Any letters, numbers and underscores', + 'MAX_FIELD_CHARS' => 'Maximum number of characters', 'MAX_FIELD_NUMBER' => 'Highest allowed number', 'MIN_FIELD_CHARS' => 'Minimum number of characters', diff --git a/phpBB/language/en/acp/prune.php b/phpBB/language/en/acp/prune.php index 7134efd765..130d1dbf84 100644 --- a/phpBB/language/en/acp/prune.php +++ b/phpBB/language/en/acp/prune.php @@ -1,11 +1,13 @@ <?php /** * -* acp_prune [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php index 8d9443b481..bda965b615 100644 --- a/phpBB/language/en/acp/search.php +++ b/phpBB/language/en/acp/search.php @@ -1,11 +1,13 @@ <?php /** * -* acp_search [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -58,7 +60,6 @@ $lang = array_merge($lang, array( 'FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN' => 'Words with no more than this many characters will be indexed for searching. You or your host can only change this setting by changing the mysql configuration.', 'FULLTEXT_POSTGRES_INCOMPATIBLE_DATABASE' => 'The PostgreSQL fulltext backend can only be used with PostgreSQL.', - 'FULLTEXT_POSTGRES_TS_NOT_USABLE' => 'The PostgreSQL fulltext backend can only be used with PostgreSQL 8.3 and above.', 'FULLTEXT_POSTGRES_TOTAL_POSTS' => 'Total number of indexed posts', 'FULLTEXT_POSTGRES_VERSION_CHECK' => 'PostgreSQL version', 'FULLTEXT_POSTGRES_TS_NAME' => 'Text search Configuration Profile:', @@ -82,8 +83,8 @@ $lang = array_merge($lang, array( 'FULLTEXT_SPHINX_PORT_EXPLAIN' => 'Port on which the sphinx search daemon (searchd) listens. Leave empty to use the default Sphinx API port 9312', 'FULLTEXT_SPHINX_WRONG_DATABASE' => 'The sphinx search for phpBB supports MySQL and PostgreSQL only.', 'FULLTEXT_SPHINX_CONFIG_FILE' => 'Sphinx config file', - 'FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN' => 'The generated content of the sphinx config file. This data needs to be pasted into the sphinx.conf which is used by sphinx search daemon.', - 'FULLTEXT_SPHINX_NO_CONFIG_DATA' => 'The sphinx data and config directory paths are not defined. Please define them to generate the config file.', + 'FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN' => 'The generated content of the sphinx config file. This data needs to be pasted into the sphinx.conf which is used by sphinx search daemon. Replace the [dbuser] and [dbpassword] placeholders with your database credentials.', + 'FULLTEXT_SPHINX_NO_CONFIG_DATA' => 'The sphinx data directory path is not defined. Please define the path and submit to generate the config file.', 'GENERAL_SEARCH_SETTINGS' => 'General search settings', 'GO_TO_SEARCH_INDEX' => 'Go to search index page', diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index e7954ff148..0d91eb3704 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -1,11 +1,13 @@ <?php /** * -* acp_styles [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -36,337 +38,51 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'ACP_STYLES_EXPLAIN' => 'Here you can manage the available styles on your board. You may alter existing styles, delete, deactivate, reactivate, install new ones. You can also see what a style will look like using the preview function. Also listed is the total user count for each style, note that overriding user styles will not be reflected here.', - 'ADD_TEMPLATE' => 'Create template', - 'ADD_TEMPLATE_EXPLAIN' => 'Here you can add a new template. Depending on your server configuration and file permissions you may have additional options here. For example you may be able to base this template set on an existing one. You may also be able to upload or import (from the store directory) a template archive. If you upload or import an archive the template name can be optionally taken from the archive name (to do this leave the template name blank).', - 'ARCHIVE_FORMAT' => 'Archive file type', - 'AUTOMATIC_EXPLAIN' => 'Leave blank to attempt automatic detection.', - - 'BACKGROUND' => 'Background', - 'BACKGROUND_COLOUR' => 'Background colour', - 'BACKGROUND_IMAGE' => 'Background image', - 'BACKGROUND_REPEAT' => 'Background repeat', - 'BOLD' => 'Bold', - 'CACHE' => 'Cache', - 'CACHE_CACHED' => 'Cached', - 'CACHE_FILENAME' => 'Template file', - 'CACHE_FILESIZE' => 'File size', - 'CACHE_MODIFIED' => 'Modified', 'CANNOT_BE_INSTALLED' => 'Cannot be installed', - 'CONFIRM_TEMPLATE_CLEAR_CACHE' => 'Are you sure you wish to clear all cached versions of your template files?', - 'CONFIRM_DELETE_STYLES' => 'Are you sure you wish to delete selected styles?', 'CONFIRM_UNINSTALL_STYLES' => 'Are you sure you wish to uninstall selected styles?', 'COPYRIGHT' => 'Copyright', - 'CREATE_STYLE' => 'Create new style', - 'CREATE_TEMPLATE' => 'Create new template set', - 'CREATE_THEME' => 'Create new theme', - 'CURRENT_IMAGE' => 'Current image', 'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.', 'DELETE_FROM_FS' => 'Delete from filesystem', - 'DELETE_STYLE' => 'Delete style', - 'DELETE_STYLE_EXPLAIN' => 'Here you can remove the selected style. Take care in deleting styles, there is no undo capability.', 'DELETE_STYLE_FILES_FAILED' => 'Error deleting files for style "%s".', 'DELETE_STYLE_FILES_SUCCESS' => 'Files for style "%s" have been deleted.', - 'DELETE_TEMPLATE' => 'Delete template', - 'DELETE_TEMPLATE_EXPLAIN' => 'Here you can remove the selected template set from the database. Please note that there is no undo capability. It is recommended that you first export your set for possible future use.', 'DETAILS' => 'Details', - 'DIMENSIONS_EXPLAIN' => 'Selecting yes here will include width/height parameters.', - - - 'EDIT_DETAILS_STYLE' => 'Edit style', - 'EDIT_DETAILS_STYLE_EXPLAIN' => 'Using the form below you can modify this existing style. You may alter the combination of template and theme which define the style itself. You may also make the style the default one.', - 'EDIT_DETAILS_TEMPLATE' => 'Edit template details', - 'EDIT_DETAILS_TEMPLATE_EXPLAIN' => 'Here you can edit certain template details such as its name.', - 'EDIT_DETAILS_THEME' => 'Edit theme details', - 'EDIT_DETAILS_THEME_EXPLAIN' => 'Here you can edit certain theme details such as its name.', - 'EDIT_TEMPLATE' => 'Edit template', - 'EDIT_TEMPLATE_EXPLAIN' => 'Here you can edit your template set directly. Please remember that these edits are permanent and cannot be undone once submitted. Please take care when editing your template set, remember to close all replacement variable terms {XXXX} and conditional statements.', - 'EDIT_THEME' => 'Edit theme', - 'EDIT_THEME_EXPLAIN' => 'Here you can edit the selected theme, changing colours, images, etc.', - 'EDITOR_DISABLED' => 'The template editor is disabled.', - 'EXPORT' => 'Export', - - 'FOREGROUND' => 'Foreground', - 'FONT_COLOUR' => 'Font colour', - 'FONT_FACE' => 'Font face', - 'FONT_FACE_EXPLAIN' => 'You can specify multiple fonts separated by commas. If a user doesn’t have the first font installed the first other working font will be chosen.', - 'FONT_SIZE' => 'Font size', - - 'GLOBAL_IMAGES' => 'Global', - - 'HIDE_CSS' => 'Hide raw CSS', - - 'IMAGE_WIDTH' => 'Image width', - 'IMAGE_HEIGHT' => 'Image height', - 'IMAGE' => 'Image', - 'IMAGE_NAME' => 'Image name', - 'IMAGE_PARAMETER' => 'Parameter', - 'IMAGE_VALUE' => 'Value', - - 'ITALIC' => 'Italic', - - 'IMG_CAT_BUTTONS' => 'Localised buttons', - 'IMG_CAT_CUSTOM' => 'Custom images', - 'IMG_CAT_FOLDERS' => 'Topic icons', - 'IMG_CAT_FORUMS' => 'Forum icons', - 'IMG_CAT_ICONS' => 'General icons', - 'IMG_CAT_LOGOS' => 'Logos', - 'IMG_CAT_POLLS' => 'Polling images', - 'IMG_CAT_UI' => 'General user interface elements', - 'IMG_CAT_USER' => 'Additional images', - - 'IMG_SITE_LOGO' => 'Main logo', - 'IMG_UPLOAD_BAR' => 'Upload progress bar', - 'IMG_POLL_LEFT' => 'Poll left end', - 'IMG_POLL_CENTER' => 'Poll centre', - 'IMG_POLL_RIGHT' => 'Poll right end', - 'IMG_ICON_FRIEND' => 'Add as friend', - 'IMG_ICON_FOE' => 'Add as foe', - - 'IMG_FORUM_LINK' => 'Forum link', - 'IMG_FORUM_READ' => 'Forum', - 'IMG_FORUM_READ_LOCKED' => 'Forum locked', - 'IMG_FORUM_READ_SUBFORUM' => 'Subforum', - 'IMG_FORUM_UNREAD' => 'Forum unread posts', - 'IMG_FORUM_UNREAD_LOCKED' => 'Forum unread posts locked', - 'IMG_FORUM_UNREAD_SUBFORUM' => 'Subforum unread posts', - 'IMG_SUBFORUM_READ' => 'Legend subforum', - 'IMG_SUBFORUM_UNREAD' => 'Legend subforum unread posts', - - 'IMG_TOPIC_MOVED' => 'Topic moved', - - 'IMG_TOPIC_READ' => 'Topic', - 'IMG_TOPIC_READ_MINE' => 'Topic posted to', - 'IMG_TOPIC_READ_HOT' => 'Topic popular', - 'IMG_TOPIC_READ_HOT_MINE' => 'Topic popular posted to', - 'IMG_TOPIC_READ_LOCKED' => 'Topic locked', - 'IMG_TOPIC_READ_LOCKED_MINE' => 'Topic locked posted to', - - 'IMG_TOPIC_UNREAD' => 'Topic unread posts', - 'IMG_TOPIC_UNREAD_MINE' => 'Topic posted to unread', - 'IMG_TOPIC_UNREAD_HOT' => 'Topic popular unread posts', - 'IMG_TOPIC_UNREAD_HOT_MINE' => 'Topic popular posted to unread', - 'IMG_TOPIC_UNREAD_LOCKED' => 'Topic locked unread', - 'IMG_TOPIC_UNREAD_LOCKED_MINE' => 'Topic locked posted to unread', - - 'IMG_STICKY_READ' => 'Sticky topic', - 'IMG_STICKY_READ_MINE' => 'Sticky topic posted to', - 'IMG_STICKY_READ_LOCKED' => 'Sticky topic locked', - 'IMG_STICKY_READ_LOCKED_MINE' => 'Sticky topic locked posted to', - 'IMG_STICKY_UNREAD' => 'Sticky topic unread posts', - 'IMG_STICKY_UNREAD_MINE' => 'Sticky topic posted to unread', - 'IMG_STICKY_UNREAD_LOCKED' => 'Sticky topic locked unread posts', - 'IMG_STICKY_UNREAD_LOCKED_MINE' => 'Sticky topic locked posted to unread', - 'IMG_ANNOUNCE_READ' => 'Announcement', - 'IMG_ANNOUNCE_READ_MINE' => 'Announcement posted to', - 'IMG_ANNOUNCE_READ_LOCKED' => 'Announcement locked', - 'IMG_ANNOUNCE_READ_LOCKED_MINE' => 'Announcement locked posted to', - 'IMG_ANNOUNCE_UNREAD' => 'Announcement unread posts', - 'IMG_ANNOUNCE_UNREAD_MINE' => 'Announcement posted to unread', - 'IMG_ANNOUNCE_UNREAD_LOCKED' => 'Announcement locked unread posts', - 'IMG_ANNOUNCE_UNREAD_LOCKED_MINE' => 'Announcement locked posted to unread', - - 'IMG_GLOBAL_READ' => 'Global', - 'IMG_GLOBAL_READ_MINE' => 'Global posted to', - 'IMG_GLOBAL_READ_LOCKED' => 'Global locked', - 'IMG_GLOBAL_READ_LOCKED_MINE' => 'Global locked posted to', - 'IMG_GLOBAL_UNREAD' => 'Global unread posts', - 'IMG_GLOBAL_UNREAD_MINE' => 'Global posted to unread', - 'IMG_GLOBAL_UNREAD_LOCKED' => 'Global locked unread posts', - 'IMG_GLOBAL_UNREAD_LOCKED_MINE' => 'Global locked posted to unread', - - 'IMG_PM_READ' => 'Read private message', - 'IMG_PM_UNREAD' => 'Unread private message', - - 'IMG_ICON_BACK_TOP' => 'Top', - - 'IMG_ICON_CONTACT_AIM' => 'AIM', - 'IMG_ICON_CONTACT_EMAIL' => 'Send email', - 'IMG_ICON_CONTACT_ICQ' => 'ICQ', - 'IMG_ICON_CONTACT_JABBER' => 'Jabber', - 'IMG_ICON_CONTACT_MSNM' => 'WLM', - 'IMG_ICON_CONTACT_PM' => 'Send message', - 'IMG_ICON_CONTACT_YAHOO' => 'YIM', - 'IMG_ICON_CONTACT_WWW' => 'Website', - - 'IMG_ICON_POST_DELETE' => 'Delete post', - 'IMG_ICON_POST_EDIT' => 'Edit post', - 'IMG_ICON_POST_INFO' => 'Show post details', - 'IMG_ICON_POST_QUOTE' => 'Quote post', - 'IMG_ICON_POST_REPORT' => 'Report post', - 'IMG_ICON_POST_TARGET' => 'Minipost', - 'IMG_ICON_POST_TARGET_UNREAD' => 'New minipost', - - - 'IMG_ICON_TOPIC_ATTACH' => 'Attachment', - 'IMG_ICON_TOPIC_LATEST' => 'Last post', - 'IMG_ICON_TOPIC_NEWEST' => 'Last unread post', - 'IMG_ICON_TOPIC_REPORTED' => 'Post reported', - 'IMG_ICON_TOPIC_UNAPPROVED' => 'Post unapproved', - - 'IMG_ICON_USER_ONLINE' => 'User online', - 'IMG_ICON_USER_OFFLINE' => 'User offline', - 'IMG_ICON_USER_PROFILE' => 'Show profile', - 'IMG_ICON_USER_SEARCH' => 'Search posts', - 'IMG_ICON_USER_WARN' => 'Warn user', - - 'IMG_BUTTON_PM_FORWARD' => 'Forward private message', - 'IMG_BUTTON_PM_NEW' => 'New private message', - 'IMG_BUTTON_PM_REPLY' => 'Reply private message', - 'IMG_BUTTON_TOPIC_LOCKED' => 'Topic locked', - 'IMG_BUTTON_TOPIC_NEW' => 'New topic', - 'IMG_BUTTON_TOPIC_REPLY' => 'Reply topic', - - 'IMG_USER_ICON1' => 'User defined image 1', - 'IMG_USER_ICON2' => 'User defined image 2', - 'IMG_USER_ICON3' => 'User defined image 3', - 'IMG_USER_ICON4' => 'User defined image 4', - 'IMG_USER_ICON5' => 'User defined image 5', - 'IMG_USER_ICON6' => 'User defined image 6', - 'IMG_USER_ICON7' => 'User defined image 7', - 'IMG_USER_ICON8' => 'User defined image 8', - 'IMG_USER_ICON9' => 'User defined image 9', - 'IMG_USER_ICON10' => 'User defined image 10', - - 'INACTIVE_STYLES' => 'Inactive styles', - 'INCLUDE_DIMENSIONS' => 'Include dimensions', - 'INCLUDE_TEMPLATE' => 'Include template', - 'INCLUDE_THEME' => 'Include theme', 'INHERITING_FROM' => 'Inherits from', 'INSTALL_STYLE' => 'Install style', 'INSTALL_STYLES' => 'Install styles', 'INSTALL_STYLES_EXPLAIN' => 'Here you can install new styles.<br />If you cannot find a specific style in list below, check to make sure style is already installed. If it is not installed, check if it was uploaded correctly.', - 'INSTALLED_STYLE' => 'Installed styles', 'INVALID_STYLE_ID' => 'Invalid style ID.', - 'LINE_SPACING' => 'Line spacing', - 'LOCALISED_IMAGES' => 'Localised', - - 'NO_CLASS' => 'Cannot find class in stylesheet.', - 'NO_IMAGE' => 'No image', - 'NO_IMAGE_ERROR' => 'Cannot find image on filesystem.', 'NO_MATCHING_STYLES_FOUND' => 'No styles match your query.', - 'NO_STYLE' => 'Cannot find style on filesystem.', - 'NO_TEMPLATE' => 'Cannot find template on filesystem.', - 'NO_THEME' => 'Cannot find theme on filesystem.', 'NO_UNINSTALLED_STYLE' => 'No uninstalled styles detected.', - 'NO_UNIT' => 'None', - 'ONLY_STYLE' => 'This is the only remaining style, you cannot delete it.', - - 'PARENT_STYLE_NOT_FOUND' => 'Parent style was not found. This style may not work correctly. Please uninstall it.', 'PURGED_CACHE' => 'Cache was purged.', - 'REFRESH' => 'Refresh', - 'REPEAT_NO' => 'None', - 'REPEAT_X' => 'Only horizontally', - 'REPEAT_Y' => 'Only vertically', - 'REPEAT_ALL' => 'Both directions', - 'REPLACE_STYLE' => 'Replace style with', - 'REPLACE_STYLE_EXPLAIN' => 'This style will replace the one being deleted for members that use it.', - 'REPLACE_TEMPLATE' => 'Replace template with', - 'REPLACE_TEMPLATE_EXPLAIN' => 'This template set will replace the one you are deleting in any styles that use it.', - 'REPLACE_THEME' => 'Replace theme with', - 'REPLACE_THEME_EXPLAIN' => 'This theme will replace the one you are deleting in any styles that use it.', - 'REPLACE_WITH_OPTION' => 'Replace with “%sâ€', 'REQUIRES_STYLE' => 'This style requires the style "%s" to be installed.', - 'SELECT_IMAGE' => 'Select image', - 'SELECT_TEMPLATE' => 'Select template file', - 'SELECT_THEME' => 'Select theme file', - 'SELECTED_IMAGE' => 'Selected image', - 'SELECTED_TEMPLATE' => 'Selected template', - 'SELECTED_TEMPLATE_FILE' => 'Selected template file', - 'SELECTED_THEME' => 'Selected theme', - 'SELECTED_THEME_FILE' => 'Selected theme file', - 'STORE_FILESYSTEM' => 'Filesystem', 'STYLE_ACTIVATE' => 'Activate', - 'STYLE_ACTIVATED' => 'Style activated successfully', 'STYLE_ACTIVE' => 'Active', - 'STYLE_ADDED' => 'Style added successfully.', 'STYLE_DEACTIVATE' => 'Deactivate', - 'STYLE_DEACTIVATED' => 'Style deactivated successfully', 'STYLE_DEFAULT' => 'Make default style', - 'STYLE_DEFAULT_CHANGE' => 'Change default style', 'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.', - 'STYLE_DELETED' => 'Style "%s" deleted successfully.', - 'STYLE_DETAILS_UPDATED' => 'Style edited successfully.', - 'STYLE_ERR_ARCHIVE' => 'Please select an archive method.', - 'STYLE_ERR_COPY_LONG' => 'The copyright can be no longer than 60 characters.', 'STYLE_ERR_INVALID_PARENT' => 'Invalid parent style.', - 'STYLE_ERR_MORE_ELEMENTS' => 'You must select at least one style element.', - 'STYLE_ERR_NAME_CHARS' => 'The style name can only contain alphanumeric characters, -, +, _ and space.', 'STYLE_ERR_NAME_EXIST' => 'A style with that name already exists.', - 'STYLE_ERR_NAME_LONG' => 'The style name can be no longer than 30 characters.', - 'STYLE_ERR_NOT_STYLE' => 'The imported or uploaded file did not contain a valid style archive.', 'STYLE_ERR_STYLE_NAME' => 'You must supply a name for this style.', - 'STYLE_EXPORT' => 'Export style', - 'STYLE_EXPORT_EXPLAIN' => 'Here you can export a style in the form of an archive. A style does not need to contain all elements but it must contain at least one. For example if you have created a new theme for a commonly used template you could simply export the theme and omit the template. You may select whether to download the file directly or to place it in your store folder for download later or via FTP.', - 'STYLE_EXPORTED' => 'Style exported successfully and stored in %s.', 'STYLE_INSTALLED' => 'Style "%s" has been installed.', - 'STYLE_INSTALLED_EDIT_DETAILS' => '<a href="%s">Click here</a> to edit style details or to change default style.', - 'STYLE_INSTALLED_RETURN_STYLES' => '<a href="%s">Click here</a> to return to installed styles list.', - 'STYLE_INSTALLED_RETURN_UNINSTALLED' => '<a href="%s">Click here</a> to install more styles.', + 'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list', + 'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles', 'STYLE_NAME' => 'Style name', + 'STYLE_NAME_RESERVED' => 'Style "%s" can not be installed, because the name is reserved.', 'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.', - 'STYLE_PATH' => 'Style path:', - 'STYLE_PARENT' => 'Parent style:', - 'STYLE_TEMPLATE' => 'Template', - 'STYLE_THEME' => 'Theme', + 'STYLE_PATH' => 'Style path', 'STYLE_UNINSTALL' => 'Uninstall', 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', 'STYLE_USED_BY' => 'Used by (including robots)', - 'TEMPLATE_ADDED' => 'Template set added.', - 'TEMPLATE_CACHE' => 'Template cache', - 'TEMPLATE_CACHE_EXPLAIN' => 'By default phpBB caches the compiled version of its templates. This decreases the load on the server each time a page is viewed and thus may reduce the page generation time. Here you can view the cache status of each file and delete individual files or the entire cache.', - 'TEMPLATE_CACHE_CLEARED' => 'Template cache cleared successfully.', - 'TEMPLATE_CACHE_EMPTY' => 'There are no cached templates.', - 'TEMPLATE_DELETED_FS' => 'Template set removed from database but files remain on the filesystem.', - 'TEMPLATE_DETAILS_UPDATED' => 'Template details successfully updated.', - 'TEMPLATE_EDITOR' => 'Raw HTML template editor', - 'TEMPLATE_EDITOR_HEIGHT' => 'Template editor height', - 'TEMPLATE_ERR_ARCHIVE' => 'Please select an archive method.', - 'TEMPLATE_ERR_CACHE_READ' => 'The cache directory used to store cached versions of template files could not be opened.', - 'TEMPLATE_ERR_COPY_LONG' => 'The copyright can be no longer than 60 characters.', - 'TEMPLATE_ERR_NAME_CHARS' => 'The template name can only contain alphanumeric characters, -, +, _ and space.', - 'TEMPLATE_ERR_NAME_LONG' => 'The template name can be no longer than 30 characters.', - 'TEMPLATE_ERR_STYLE_NAME' => 'You must supply a name for this template.', - 'TEMPLATE_EXPORT_EXPLAIN' => 'Here you can export a template set in the form of an archive. This archive will contain all the files necessary to install the templates on another board. You may select whether to download the file directly or to place it in your store folder for download later or via FTP.', - 'TEMPLATE_EXPORTED' => 'Templates exported successfully and stored in %s.', - 'TEMPLATE_FILE' => 'Template file', - 'TEMPLATE_FILE_UPDATED' => 'Template file updated successfully.', - 'TEMPLATE_NAME' => 'Template name', - 'TEMPLATE_FILE_NOT_WRITABLE'=> 'Unable to write to template file %s. Please check the permissions for the directory and the files.', - - 'THEME_ADDED' => 'New theme added.', - 'THEME_CLASS_ADDED' => 'Custom class added successfully.', - 'THEME_DELETED' => 'Theme deleted successfully.', - 'THEME_DELETED_FS' => 'Theme removed from database but files remain on the filesystem.', - 'THEME_DETAILS_UPDATED' => 'Theme details successfully updated.', - 'THEME_EDITOR' => 'Theme editor', - 'THEME_EDITOR_HEIGHT' => 'Theme editor height', - 'THEME_ERR_ARCHIVE' => 'Please select an archive method.', - 'THEME_ERR_CLASS_CHARS' => 'Only alphanumeric characters plus ., :, -, _ and # are valid in class names.', - 'THEME_ERR_COPY_LONG' => 'The copyright can be no longer than 60 characters.', - 'THEME_ERR_NAME_CHARS' => 'The theme name can only contain alphanumeric characters, -, +, _ and space.', - 'THEME_ERR_NAME_EXIST' => 'A theme with that name already exists.', - 'THEME_ERR_NAME_LONG' => 'The theme name can be no longer than 30 characters.', - 'THEME_ERR_NOT_THEME' => 'The archive you specified does not contain a valid theme.', - 'THEME_ERR_STYLE_NAME' => 'You must supply a name for this theme.', - 'THEME_FILE' => 'Theme file', - 'THEME_FILE_NOT_WRITABLE' => 'Unable to write to theme file %s. Please check the permissions for the directory and the files.', - 'THEME_EXPORT' => 'Export Theme', - 'THEME_EXPORT_EXPLAIN' => 'Here you can export a theme in the form of an archive. This archive will contain all the data necessary to install the theme on another board. You may select whether to download the file directly or to place it in your store folder for download later or via FTP.', - 'THEME_EXPORTED' => 'Theme exported successfully and stored in %s.', - 'THEME_NAME' => 'Theme name', - 'THEME_UPDATED' => 'Theme updated successfully.', - - 'UNDERLINE' => 'Underline', 'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.', - 'UNSET' => 'Undefined', + 'BROWSE_STYLES_DATABASE' => 'Browse styles database', )); diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 865a2a0371..980e73a685 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -1,11 +1,13 @@ <?php /** * -* acp_users [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -51,6 +53,7 @@ $lang = array_merge($lang, array( 'CANNOT_FORCE_REACT_FOUNDER' => 'You are not allowed to force reactivation on founder accounts.', 'CANNOT_FORCE_REACT_YOURSELF' => 'You are not allowed to force reactivation of your own account.', 'CANNOT_REMOVE_ANONYMOUS' => 'You are not able to remove the guest user account.', + 'CANNOT_REMOVE_FOUNDER' => 'You are not allowed to remove founder accounts.', 'CANNOT_REMOVE_YOURSELF' => 'You are not allowed to remove your own user account.', 'CANNOT_SET_FOUNDER_IGNORED' => 'You are not able to promote ignored users to be founders.', 'CANNOT_SET_FOUNDER_INACTIVE' => 'You need to activate users before you promote them to founders, only activated users are able to be promoted.', diff --git a/phpBB/language/en/app.php b/phpBB/language/en/app.php index cb56015c30..39c4065ebd 100644 --- a/phpBB/language/en/app.php +++ b/phpBB/language/en/app.php @@ -1,11 +1,13 @@ <?php /** * -* app [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -41,9 +43,6 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'CONTROLLER_ARGUMENT_VALUE_MISSING' => 'Missing value for argument #%1$s: <strong>%3$s</strong> in class <strong>%2$s</strong>', 'CONTROLLER_NOT_SPECIFIED' => 'No controller has been specified.', - 'CONTROLLER_NOT_FOUND' => 'The requested page could not be found.', 'CONTROLLER_METHOD_NOT_SPECIFIED' => 'No method was specified for the controller.', - 'CONTROLLER_SERVICE_NOT_GIVEN' => 'The controller "<strong>%s</strong>" must have a service specified in ./config/routing.yml.', - 'CONTROLLER_SERVICE_UNDEFINED' => 'The service for controller "<strong>%s</strong>" is not defined in ./config/services.yml.', - 'CONTROLLER_RETURN_TYPE_INVALID' => 'The controller object <strong>%s</strong> must return a Symfony\Component\HttpFoundation\Response object.', + 'CONTROLLER_SERVICE_UNDEFINED' => 'The service for controller “<strong>%s</strong>†is not defined in ./config/services.yml.', )); diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index 90e919064e..f764a83f24 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -1,11 +1,13 @@ <?php /** * -* captcha_qa [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/captcha_recaptcha.php b/phpBB/language/en/captcha_recaptcha.php index 3d91a9d110..0acf850043 100644 --- a/phpBB/language/en/captcha_recaptcha.php +++ b/phpBB/language/en/captcha_recaptcha.php @@ -1,11 +1,13 @@ <?php /** * -* recaptcha [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -38,13 +40,13 @@ $lang = array_merge($lang, array( 'RECAPTCHA_LANG' => 'en', 'RECAPTCHA_NOT_AVAILABLE' => 'In order to use reCaptcha, you must create an account on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>.', 'CAPTCHA_RECAPTCHA' => 'reCaptcha', - 'RECAPTCHA_INCORRECT' => 'The visual confirmation code you submitted was incorrect', + 'RECAPTCHA_INCORRECT' => 'The solution you provided was incorrect', + 'RECAPTCHA_NOSCRIPT' => 'Please enable JavaScript in your browser to load the challenge.', 'RECAPTCHA_PUBLIC' => 'Public reCaptcha key', 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your public reCaptcha key. Keys can be obtained on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>.', 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key', 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>.', - 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.', - 'RECAPTCHA_SOCKET_ERROR' => 'There was a problem connecting to the RECAPTCHA service: could not open socket. Try again later.', + 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you complete the following challenge.', )); diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php new file mode 100644 index 0000000000..1c549e5f9f --- /dev/null +++ b/phpBB/language/en/cli.php @@ -0,0 +1,126 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* DO NOT CHANGE +*/ +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'CLI_CONFIG_CANNOT_CACHED' => 'Set this option if the configuration option changes too frequently to be efficiently cached.', + 'CLI_CONFIG_CURRENT' => 'Current configuration value, use 0 and 1 to specify boolean values', + 'CLI_CONFIG_DELETE_SUCCESS' => 'Successfully deleted config %s.', + 'CLI_CONFIG_NEW' => 'New configuration value, use 0 and 1 to specify boolean values', + 'CLI_CONFIG_NOT_EXISTS' => 'Config %s does not exist', + 'CLI_CONFIG_OPTION_NAME' => 'The configuration option’s name', + 'CLI_CONFIG_PRINT_WITHOUT_NEWLINE' => 'Set this option if the value should be printed without a new line at the end.', + 'CLI_CONFIG_INCREMENT_BY' => 'Amount to increment by', + 'CLI_CONFIG_INCREMENT_SUCCESS' => 'Successfully incremented config %s', + 'CLI_CONFIG_SET_FAILURE' => 'Could not set config %s', + 'CLI_CONFIG_SET_SUCCESS' => 'Successfully set config %s', + + 'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.', + 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.', + 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run', + 'CLI_DESCRIPTION_DB_LIST' => 'List all installed and available migrations.', + 'CLI_DESCRIPTION_DB_MIGRATE' => 'Updates the database by applying migrations.', + 'CLI_DESCRIPTION_DB_REVERT' => 'Revert a migration.', + 'CLI_DESCRIPTION_DELETE_CONFIG' => 'Deletes a configuration option', + 'CLI_DESCRIPTION_DISABLE_EXTENSION' => 'Disables the specified extension.', + 'CLI_DESCRIPTION_ENABLE_EXTENSION' => 'Enables the specified extension.', + 'CLI_DESCRIPTION_FIND_MIGRATIONS' => 'Finds migrations that are not depended upon.', + 'CLI_DESCRIPTION_GET_CONFIG' => 'Gets a configuration option’s value', + 'CLI_DESCRIPTION_INCREMENT_CONFIG' => 'Increments a configuration option’s integer value', + 'CLI_DESCRIPTION_LIST_EXTENSIONS' => 'Lists all extensions in the database and on the filesystem.', + + 'CLI_DESCRIPTION_OPTION_ENV' => 'The Environment name.', + 'CLI_DESCRIPTION_OPTION_SAFE_MODE' => 'Run in Safe Mode (without extensions).', + 'CLI_DESCRIPTION_OPTION_SHELL' => 'Launch the shell.', + + 'CLI_DESCRIPTION_PURGE_EXTENSION' => 'Purges the specified extension.', + 'CLI_DESCRIPTION_REPARSER_LIST' => 'Lists the types of text that can be reparsed.', + 'CLI_DESCRIPTION_REPARSER_REPARSE' => 'Reparses stored text with the current text_formatter services.', + 'CLI_DESCRIPTION_REPARSER_REPARSE_ARG_1' => 'Type of text to reparse. Leave blank to reparse everything.', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_DRY_RUN' => 'Do not save any changes; just print what would happen', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MIN' => 'Lowest record ID to process', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MAX' => 'Highest record ID to process', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_SIZE' => 'Approximate number of records to process at a time', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RESUME' => 'Start reparsing where the last execution stopped', + 'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH' => 'Recalculates the user_email_hash column of the users table.', + 'CLI_DESCRIPTION_SET_ATOMIC_CONFIG' => 'Sets a configuration option’s value only if the old matches the current value', + 'CLI_DESCRIPTION_SET_CONFIG' => 'Sets a configuration option’s value', + + 'CLI_DESCRIPTION_THUMBNAIL_DELETE' => 'Delete all existing thumbnails.', + 'CLI_DESCRIPTION_THUMBNAIL_GENERATE' => 'Generate all missing thumbnails.', + 'CLI_DESCRIPTION_THUMBNAIL_RECREATE' => 'Recreate all thumbnails.', + + 'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s', + 'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s', + 'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s', + 'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s', + 'CLI_EXTENSION_NAME' => 'Name of the extension', + 'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s', + 'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s', + 'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.', + 'CLI_EXTENSIONS_AVAILABLE' => 'Available', + 'CLI_EXTENSIONS_DISABLED' => 'Disabled', + 'CLI_EXTENSIONS_ENABLED' => 'Enabled', + + 'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.', + + 'CLI_MIGRATION_NAME' => 'Migration name, including the namespace (use forward slashes instead of backslashes to avoid problems).', + 'CLI_MIGRATIONS_AVAILABLE' => 'Available migrations', + 'CLI_MIGRATIONS_INSTALLED' => 'Installed migrations', + 'CLI_MIGRATIONS_ONLY_AVAILABLE' => 'Show only available migrations', + 'CLI_MIGRATIONS_EMPTY' => 'No migrations.', + + 'CLI_REPARSER_REPARSE_REPARSING' => 'Reparsing %1$s (range %2$d..%3$d)', + 'CLI_REPARSER_REPARSE_REPARSING_START' => 'Reparsing %s...', + 'CLI_REPARSER_REPARSE_SUCCESS' => 'Reparsing ended with success', + + // In all the case %1$s is the logical name of the file and %2$s the real name on the filesystem + // eg: big_image.png (2_a51529ae7932008cf8454a95af84cacd) generated. + 'CLI_THUMBNAIL_DELETED' => '%1$s (%2$s) deleted.', + 'CLI_THUMBNAIL_DELETING' => 'Deleting thumbnails', + 'CLI_THUMBNAIL_SKIPPED' => '%1$s (%2$s) skipped.', + 'CLI_THUMBNAIL_GENERATED' => '%1$s (%2$s) generated.', + 'CLI_THUMBNAIL_GENERATING' => 'Generating thumbnails', + 'CLI_THUMBNAIL_GENERATING_DONE' => 'All thumbnails have been regenerated.', + 'CLI_THUMBNAIL_DELETING_DONE' => 'All thumbnails have been deleted.', + + 'CLI_THUMBNAIL_NOTHING_TO_GENERATE' => 'No thumbnails to generate.', + 'CLI_THUMBNAIL_NOTHING_TO_DELETE' => 'No thumbnails to delete.', +)); + +// Additional help for commands. +$lang = array_merge($lang, array( + 'CLI_HELP_CRON_RUN' => $lang['CLI_DESCRIPTION_CRON_RUN'] . ' Optionally you can specify a cron task name to run only the specified cron task.', +)); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 896d2ef811..a473e0d091 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -1,11 +1,13 @@ <?php /** * -* common [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -62,7 +64,7 @@ $lang = array_merge($lang, array( 'ACCOUNT_DEACTIVATED' => 'Your account has been manually deactivated and is only able to be reactivated by an administrator.', 'ACCOUNT_NOT_ACTIVATED' => 'Your account has not been activated yet.', 'ACP' => 'Administration Control Panel', - 'ACP_SHORT' => 'Administer', + 'ACP_SHORT' => 'ACP', 'ACTIVE' => 'active', 'ACTIVE_ERROR' => 'The specified username is currently inactive. If you have problems activating your account, please contact a board administrator.', 'ADMINISTRATOR' => 'Administrator', @@ -79,8 +81,9 @@ $lang = array_merge($lang, array( 'ALL_FORUMS' => 'All forums', 'ALL_MESSAGES' => 'All messages', 'ALL_POSTS' => 'All posts', - 'ALL_TIMES' => 'All times are <abbr title="%2$s">%1$s</abbr>', + 'ALL_TIMES' => 'All times are <span title="%2$s">%1$s</span>', 'ALL_TOPICS' => 'All Topics', + 'ALT_TEXT' => 'Alternative text', 'AND' => 'And', 'ARE_WATCHING_FORUM' => 'You have subscribed to be notified of new posts in this forum.', 'ARE_WATCHING_TOPIC' => 'You have subscribed to be notified of new posts in this topic.', @@ -103,13 +106,16 @@ $lang = array_merge($lang, array( 'AVATAR_EMPTY_FILEUPLOAD' => 'The uploaded avatar file is empty.', 'AVATAR_INVALID_FILENAME' => '%s is an invalid filename.', 'AVATAR_NOT_UPLOADED' => 'Avatar could not be uploaded.', + 'AVATAR_NO_TEMP_DIR' => 'Temporary folder could not be found or is not writable.', 'AVATAR_NO_SIZE' => 'The width or height of the linked avatar could not be determined. Please enter them manually.', 'AVATAR_PARTIAL_UPLOAD' => 'The specified file was only partially uploaded.', 'AVATAR_PHP_SIZE_NA' => 'The avatar’s filesize is too large.<br />The maximum allowed filesize set in php.ini could not be determined.', 'AVATAR_PHP_SIZE_OVERRUN' => 'The avatar’s filesize is too large. The maximum allowed upload size is %1$d %2$s.<br />Please note this is set in php.ini and cannot be overridden.', + 'AVATAR_REMOTE_UPLOAD_TIMEOUT' => 'The specified avatar could not be uploaded because the request timed out.', + 'AVATAR_PHP_UPLOAD_STOPPED' => 'A PHP extension has stopped the file upload.', 'AVATAR_URL_INVALID' => 'The URL you specified is invalid.', 'AVATAR_URL_NOT_FOUND' => 'The file specified could not be found.', - 'AVATAR_WRONG_FILESIZE' => 'The avatar’s filesize must be between 0 and %1d %2s.', + 'AVATAR_WRONG_FILESIZE' => 'The avatar’s filesize must be between 0 and %1$d %2$s.', 'AVATAR_WRONG_SIZE' => 'The submitted avatar is %5$s wide and %6$s high. Avatars must be at least %1$s wide and %2$s high, but no larger than %3$s wide and %4$s high.', 'BACK_TO_TOP' => 'Top', @@ -164,9 +170,13 @@ $lang = array_merge($lang, array( 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears. All letters are case insensitive.', 'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.', 'CONFIRM_OPERATION' => 'Are you sure you wish to carry out this operation?', + 'CONFIRM_AVATAR_DELETE' => 'Are you sure you wish to delete this avatar?', 'CONGRATULATIONS' => 'Congratulations to', 'CONNECTION_FAILED' => 'Connection failed.', 'CONNECTION_SUCCESS' => 'Connection was successful!', + 'CONTACT' => 'Contact', + 'CONTACT_USER' => 'Contact %s', + 'CONTACT_US' => 'Contact us', 'COOKIES_DELETED' => 'All board cookies successfully deleted.', 'CURRENT_TIME' => 'It is currently %s', @@ -185,8 +195,6 @@ $lang = array_merge($lang, array( 'DISPLAY_MESSAGES' => 'Display messages from previous', 'DISPLAY_POSTS' => 'Display posts from previous', 'DISPLAY_TOPICS' => 'Display topics from previous', - 'DOWNLOAD_ALL' => 'Download all', - 'DOWNLOAD_ALL_ATTACHMENTS' => 'Download all attachments', 'DOWNLOADED' => 'Downloaded', 'DOWNLOADING_FILE' => 'Downloading file', 'DOWNLOAD_COUNTS' => array( @@ -210,8 +218,6 @@ $lang = array_merge($lang, array( 'ERR_CONNECTING_SERVER' => 'Error connecting to the server.', 'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.', 'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.', - 'ERR_TEMPLATE_EVENT_LOCATION' => 'The specified template event location <em>[%s]</em> is improperly formatted.', - 'ERR_TEMPLATE_COMPILATION' => 'The file could not be compiled: %s', 'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.', 'ERR_UNWATCHING' => 'An error occurred while trying to unsubscribe.', 'ERR_WATCHING' => 'An error occurred while trying to subscribe.', @@ -219,19 +225,21 @@ $lang = array_merge($lang, array( 'ERROR' => 'Error', 'EXPAND_VIEW' => 'Expand view', 'EXTENSION' => 'Extension', - 'EXTENSION_CONTROLLER_MISSING' => 'The extension <strong>%s</strong> is missing a controller class and cannot be accessed through the front-end.', - 'EXTENSION_CLASS_WRONG_TYPE' => 'The extension controller class <strong>%s</strong> is not an instance of the phpbb_extension_controller_interface.', 'EXTENSION_DISABLED' => 'The extension <strong>%s</strong> is not enabled.', 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension <strong>%s</strong> has been deactivated and can no longer be displayed.', 'EXTENSION_DOES_NOT_EXIST' => 'The extension <strong>%s</strong> does not exist.', + 'FACEBOOK' => 'Facebook', 'FAQ' => 'FAQ', 'FAQ_EXPLAIN' => 'Frequently Asked Questions', + 'FEATURE_NOT_AVAILABLE' => 'The requested feature is not available on this board.', 'FILENAME' => 'Filename', 'FILESIZE' => 'File size', 'FILEDATE' => 'File date', 'FILE_COMMENT' => 'File comment', - 'FILE_NOT_FOUND' => 'The requested file could not be found.', + 'FILE_CONTENT_ERR' => 'Could not read the contents of file: %s', + 'FILE_JSON_DECODE_ERR' => 'Failed to decode json file: %s', + 'FILE_NOT_FOUND' => 'The requested file could not be found: %s', 'FIND_USERNAME' => 'Find a member', 'FOLDER' => 'Folder', 'FORGOT_PASS' => 'I forgot my password', @@ -280,6 +288,7 @@ $lang = array_merge($lang, array( 'GB' => 'GB', 'GIB' => 'GiB', 'GO' => 'Go', + 'GOOGLEPLUS' => 'Google+', 'GOTO_FIRST_POST' => 'Go to first post', 'GOTO_LAST_POST' => 'Go to last post', 'GOTO_PAGE' => 'Go to page', @@ -293,7 +302,7 @@ $lang = array_merge($lang, array( 1 => 'There is %d guest user online', 2 => 'There are %d guest users online', ), - 'GUEST_USERS_TOTAL' => array( + 'GUEST_USERS_TOTAL' => array( 1 => '%d guest', 2 => '%d guests', ), @@ -319,12 +328,12 @@ $lang = array_merge($lang, array( 'HOME' => 'Home', 'ICQ' => 'ICQ', - 'ICQ_STATUS' => 'ICQ status', 'IF' => 'If', 'IMAGE' => 'Image', 'IMAGE_FILETYPE_INVALID' => 'Image file type %d for mimetype %s not supported.', 'IMAGE_FILETYPE_MISMATCH' => 'Image file type mismatch: expected extension %1$s but extension %2$s given.', 'IN' => 'in', + 'INACTIVE' => 'Inactive', 'INDEX' => 'Index page', 'INFORMATION' => 'Information', 'INSECURE_REDIRECT' => 'Tried to redirect to potentially insecure url.', @@ -339,7 +348,8 @@ $lang = array_merge($lang, array( 'JOINED' => 'Joined', 'JUMP_PAGE' => 'Enter the page number you wish to go to', 'JUMP_TO' => 'Jump to', - 'JUMP_TO_PAGE' => 'Click to jump to page…', + 'JUMP_TO_PAGE' => 'Jump to page', + 'JUMP_TO_PAGE_CLICK' => 'Click to jump to page…', 'KB' => 'KB', 'KIB' => 'KiB', @@ -351,6 +361,7 @@ $lang = array_merge($lang, array( 'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.', 'LDAP_SEARCH_FAILED' => 'An error occurred while searching the LDAP directory.', 'LEGEND' => 'Legend', + 'LIVE_SEARCHES_NOT_ALLOWED' => 'Live searches are not allowed.', 'LOADING' => 'Loading', 'LOCATION' => 'Location', 'LOCK_POST' => 'Lock post', @@ -386,7 +397,7 @@ $lang = array_merge($lang, array( 'MB' => 'MB', 'MIB' => 'MiB', 'MCP' => 'Moderator Control Panel', - 'MCP_SHORT' => 'Moderate', + 'MCP_SHORT' => 'MCP', 'MEMBERLIST' => 'Members', 'MEMBERLIST_EXPLAIN' => 'View complete list of members', 'MERGE' => 'Merge', @@ -394,14 +405,20 @@ $lang = array_merge($lang, array( 'MERGE_TOPIC' => 'Merge topic', 'MESSAGE' => 'Message', 'MESSAGES' => 'Messages', + 'MESSAGES_COUNT' => array( + 1 => '%d message', + 2 => '%d messages', + ), 'MESSAGE_BODY' => 'Message body', 'MINUTES' => 'Minutes', 'MODERATE' => 'Moderate', 'MODERATOR' => 'Moderator', 'MODERATORS' => 'Moderators', + 'MODULE_NOT_ACCESS' => 'Module not accessible', + 'MODULE_NOT_FIND' => 'Cannot find module %s', + 'MODULE_FILE_INCORRECT_CLASS' => 'Module file %s does not contain correct class [%s]', 'MONTH' => 'Month', 'MOVE' => 'Move', - 'MSNM' => 'WLM', 'NA' => 'N/A', 'NEWEST_USER' => 'Our newest member <strong>%s</strong>', @@ -419,27 +436,49 @@ $lang = array_merge($lang, array( 'NOT_WATCHING_FORUM' => 'You are no longer subscribed to updates on this forum.', 'NOT_WATCHING_TOPIC' => 'You are no longer subscribed to this topic.', 'NOTIFICATIONS' => 'Notifications', - 'NOTIFICATION_BOOKMARK' => '%1$s replied to the topic "%2$s" you have bookmarked.', - 'NOTIFICATION_BOOKMARK_TRIMMED' => '%1$s and %3$d others replied to the topic “%2$s†you have bookmarked.', - 'NOTIFICATION_GROUP_REQUEST' => '%1$s is requesting to join the group %2$s.', - 'NOTIFICATION_GROUP_REQUEST_APPROVED' => 'Your request to join the group %1$s has been approved.', - 'NOTIFICATION_PM' => '%1$s sent you a Private Message "%2$s".', - 'NOTIFICATION_POST' => '%1$s replied to the topic "%2$s".', - 'NOTIFICATION_POST_TRIMMED' => '%1$s and %3$d others replied to the topic “%2$sâ€', - 'NOTIFICATION_POST_APPROVED' => 'Your post was approved "%2$s".', - 'NOTIFICATION_POST_DISAPPROVED' => 'Your post "%1$s" was disapproved for reason: "%2$s".', - 'NOTIFICATION_POST_IN_QUEUE' => 'A new post titled "%2$s" was posted by %1$s and needs approval.', - 'NOTIFICATION_QUOTE' => '%1$s quoted you in the post "%2$s".', - 'NOTIFICATION_QUOTE_TRIMMED' => '%1$s and %3$d others replied to the topic “%2$sâ€', - 'NOTIFICATION_REPORT_PM' => '%1$s reported a Private Message "%2$s" for reason: "%3$s".', - 'NOTIFICATION_REPORT_POST' => '%1$s reported a post "%2$s" for reason: "%3$s".', - 'NOTIFICATION_REPORT_CLOSED' => '%1$s closed the report you made for "%2$s".', - 'NOTIFICATION_TOPIC' => '%1$s posted a new topic "%2$s" in the forum "%3$s".', - 'NOTIFICATION_TOPIC_APPROVED' => 'Your topic "%2$s" in the forum "%3$s" was approved.', - 'NOTIFICATION_TOPIC_DISAPPROVED' => 'Your topic "%1$s" was disapproved for reason: "%2$s".', - 'NOTIFICATION_TOPIC_IN_QUEUE' => 'A new topic titled "%2$s" was posted by %1$s and needs approval.', + // This applies for NOTIFICATION_BOOKMARK and NOTIFICATION_POST. + // %1$s will return a list of users that's concatenated using "," and "and" - see STRING_LIST + // Once the user count reaches 5 users or more, the list is trimmed using NOTIFICATION_X_OTHERS + // Once the user count reaches 20 users or more, the list is trimmed using NOTIFICATION_MANY_OTHERS + // Examples: + // A replied... + // A and B replied... + // A, B and C replied... + // A, B, C and 2 others replied... + // A, B, C and others replied... + 'NOTIFICATION_BOOKMARK' => array( + 1 => '<strong>Reply</strong> from %1$s in bookmarked topic:', + ), + 'NOTIFICATION_FORUM' => '<em>Forum:</em> %1$s', + 'NOTIFICATION_GROUP_REQUEST' => '<strong>Group request</strong> from %1$s to join the group %2$s.', + 'NOTIFICATION_GROUP_REQUEST_APPROVED' => '<strong>Group request approved</strong> to join the group %1$s.', + 'NOTIFICATION_METHOD_INVALID' => 'The method "%s" does not refer to a valid notification method.', + 'NOTIFICATION_PM' => '<strong>Private Message</strong> from %1$s:', + 'NOTIFICATION_POST' => array( + 1 => '<strong>Reply</strong> from %1$s in topic:', + ), + 'NOTIFICATION_POST_APPROVED' => '<strong>Post approved</strong>:', + 'NOTIFICATION_POST_DISAPPROVED' => '<strong>Post disapproved</strong>:', + 'NOTIFICATION_POST_IN_QUEUE' => '<strong>Post approval</strong> request by %1$s:', + 'NOTIFICATION_QUOTE' => array( + 1 => '<strong>Quoted</strong> by %1$s in:', + ), + 'NOTIFICATION_REFERENCE' => '"%1$s"', + 'NOTIFICATION_REASON' => '<em>Reason:</em> %1$s.', + 'NOTIFICATION_REPORT_PM' => '<strong>Private Message reported</strong> by %1$s:', + 'NOTIFICATION_REPORT_POST' => '<strong>Post reported</strong> by %1$s:', + 'NOTIFICATION_REPORT_CLOSED' => '<strong>Report closed</strong> by %1$s for:', + 'NOTIFICATION_TOPIC' => '<strong>New topic</strong> by %1$s:', + 'NOTIFICATION_TOPIC_APPROVED' => '<strong>Topic approved</strong>:', + 'NOTIFICATION_TOPIC_DISAPPROVED' => '<strong>Topic disapproved</strong>:', + 'NOTIFICATION_TOPIC_IN_QUEUE' => '<strong>Topic approval</strong> request by %1$s:', 'NOTIFICATION_TYPE_NOT_EXIST' => 'The notification type "%s" is missing from the file system.', - 'NOTIFICATION_ADMIN_ACTIVATE_USER' => 'The user “%1$s†is newly registered and requires activation.', + 'NOTIFICATION_ADMIN_ACTIVATE_USER' => '<strong>Activation required</strong> for deactivated or newly registered user: “%1$sâ€', + // Used in conjuction with NOTIFICATION_BOOKMARK and NOTIFICATION_POST. + 'NOTIFICATION_MANY_OTHERS' => 'others', + 'NOTIFICATION_X_OTHERS' => array( + 2 => '%d others', + ), 'NOTIFY_ADMIN' => 'Please notify the board administrator or webmaster.', 'NOTIFY_ADMIN_EMAIL' => 'Please notify the board administrator or webmaster: <a href="mailto:%1$s">%1$s</a>', 'NO_ACCESS_ATTACHMENT' => 'You are not allowed to access this file.', @@ -449,7 +488,6 @@ $lang = array_merge($lang, array( 'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.', 'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.', 'NO_AVATARS' => 'No avatars currently available', - 'NO_AVATAR_SELECTED' => 'You have not selected any avatar.', 'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %1$s : %2$s', 'NO_BIRTHDAYS' => 'No birthdays today', 'NO_EMAIL_MESSAGE' => 'Email message was blank.', @@ -486,6 +524,10 @@ $lang = array_merge($lang, array( 'NO_USER_SPECIFIED' => 'No username was specified.', // Nullar/Singular/Plural language entry. The key numbers define the number range in which a certain grammatical expression is valid. + 'NUM_ATTACHMENTS' => array( + 1 => '%d attachment', + 2 => '%d attachments', + ), 'NUM_POSTS_IN_QUEUE' => array( 0 => 'No posts in queue', // 0 1 => '1 post in queue', // 1 @@ -516,7 +558,6 @@ $lang = array_merge($lang, array( 1 => '%d pixel', 2 => '%d pixels', ), - 'PLAY_QUICKTIME_FILE' => 'Play Quicktime file', 'PLEASE_WAIT' => 'Please wait.', 'PM' => 'PM', 'PM_REPORTED' => 'Click to view report', @@ -530,11 +571,13 @@ $lang = array_merge($lang, array( 'POSTED_ON_DATE' => 'on', 'POSTS' => 'Posts', 'POSTS_UNAPPROVED' => 'At least one post in this topic has not been approved.', + 'POSTS_UNAPPROVED_FORUM'=> 'At least one post in this forum has not been approved.', 'POST_BY_AUTHOR' => 'by', 'POST_BY_FOE' => '<strong>%1$s</strong>, who is currently on your ignore list, made this post.', 'POST_DISPLAY' => '%1$sDisplay this post%2$s.', 'POST_DAY' => '%.2f posts per day', - 'POST_DELETED' => 'Deleted post:', + 'POST_DELETED_ACTION' => 'Deleted post:', + 'POST_DELETED' => 'This post has been deleted.', 'POST_DELETED_BY' => '<strong>%2$s</strong> deleted the post by <strong>%1$s</strong> on %3$s.', 'POST_DELETED_BY_REASON'=> '<strong>%2$s</strong> deleted the post by <strong>%1$s</strong> on %3$s for the following reason: %4$s', 'POST_DETAILS' => 'Post details', @@ -547,7 +590,8 @@ $lang = array_merge($lang, array( 'POST_SUBJECT' => 'Post subject', 'POST_TIME' => 'Post time', 'POST_TOPIC' => 'Post a new topic', - 'POST_UNAPPROVED' => 'Post awaiting approval:', + 'POST_UNAPPROVED_ACTION' => 'Post awaiting approval:', + 'POST_UNAPPROVED' => 'This post has not been approved.', 'POWERED_BY' => 'Powered by %s', 'PREVIEW' => 'Preview', 'PREVIOUS' => 'Previous', // Used in pagination @@ -558,6 +602,8 @@ $lang = array_merge($lang, array( 'PRIVATE_MESSAGING' => 'Private messaging', 'PROFILE' => 'User Control Panel', + 'QUICK_LINKS' => 'Quick links', + 'RANK' => 'Rank', 'READING_FORUM' => 'Viewing topics in %s', 'READING_GLOBAL_ANNOUNCE' => 'Reading global announcement', @@ -595,7 +641,8 @@ $lang = array_merge($lang, array( 'RETURN_FORUM' => '%sReturn to the forum last visited%s', 'RETURN_PAGE' => '%sReturn to the previous page%s', 'RETURN_TOPIC' => '%sReturn to the topic last visited%s', - 'RETURN_TO' => 'Return to', + 'RETURN_TO' => 'Return to “%sâ€', + 'RETURN_TO_INDEX' => 'Return to Board Index', 'FEED' => 'Feed', 'FEED_NEWS' => 'News', 'FEED_TOPICS_ACTIVE' => 'Active Topics', @@ -623,15 +670,15 @@ $lang = array_merge($lang, array( 'SEARCH_ADV_EXPLAIN' => 'View the advanced search options', 'SEARCH_KEYWORDS' => 'Search for keywords', 'SEARCHING_FORUMS' => 'Searching forums', - 'SEARCH_ACTIVE_TOPICS' => 'View active topics', + 'SEARCH_ACTIVE_TOPICS' => 'Active topics', 'SEARCH_FOR' => 'Search for', 'SEARCH_FORUM' => 'Search this forum…', - 'SEARCH_NEW' => 'View new posts', + 'SEARCH_NEW' => 'New posts', 'SEARCH_POSTS_BY' => 'Search posts by', - 'SEARCH_SELF' => 'View your posts', + 'SEARCH_SELF' => 'Your posts', 'SEARCH_TOPIC' => 'Search this topic…', - 'SEARCH_UNANSWERED' => 'View unanswered posts', - 'SEARCH_UNREAD' => 'View unread posts', + 'SEARCH_UNANSWERED' => 'Unanswered posts', + 'SEARCH_UNREAD' => 'Unread posts', 'SEARCH_USER_POSTS' => 'Search user’s posts', 'SECONDS' => 'Seconds', 'SEE_ALL' => 'See All', @@ -639,18 +686,22 @@ $lang = array_merge($lang, array( 'SELECT_ALL_CODE' => 'Select all', 'SELECT_DESTINATION_FORUM' => 'Please select a destination forum', 'SELECT_FORUM' => 'Select a forum', - 'SEND_EMAIL' => 'Email', // Used for submit buttons - 'SEND_EMAIL_USER' => 'Email', // Used as: {L_SEND_EMAIL_USER} {USERNAME} -> Email UserX + 'SEND_EMAIL' => 'Send email', // Used for submit buttons + 'SEND_EMAIL_USER' => 'Send email to %s', 'SEND_PRIVATE_MESSAGE' => 'Send private message', 'SETTINGS' => 'Settings', 'SIGNATURE' => 'Signature', 'SKIP' => 'Skip to content', + 'SKYPE' => 'Skype', 'SMTP_NO_AUTH_SUPPORT' => 'SMTP server does not support authentication.', 'SORRY_AUTH_READ' => 'You are not authorised to read this forum.', + 'SORRY_AUTH_READ_TOPIC' => 'You are not authorised to read this topic.', 'SORRY_AUTH_VIEW_ATTACH' => 'You are not authorised to download this attachment.', 'SORT_BY' => 'Sort by', + 'SORT_DIRECTION' => 'Direction', 'SORT_JOINED' => 'Joined date', 'SORT_LOCATION' => 'Location', + 'SORT_OPTIONS' => 'Display and sorting options', 'SORT_RANK' => 'Rank', 'SORT_POSTS' => 'Posts', 'SORT_TOPIC_TITLE' => 'Topic title', @@ -662,6 +713,8 @@ $lang = array_merge($lang, array( 'START_WATCHING_TOPIC' => 'Subscribe topic', 'STOP_WATCHING_FORUM' => 'Unsubscribe forum', 'STOP_WATCHING_TOPIC' => 'Unsubscribe topic', + 'STRING_LIST_MULTI' => '%1$s, and %2$s', + 'STRING_LIST_SIMPLE' => '%1$s and %2$s', 'SUBFORUM' => 'Subforum', 'SUBFORUMS' => 'Subforums', 'SUBJECT' => 'Subject', @@ -680,38 +733,28 @@ $lang = array_merge($lang, array( 'TOO_LONG' => 'The value you entered is too long.', - 'TOO_LONG_AIM' => 'The screenname you entered is too long.', 'TOO_LONG_CONFIRM_CODE' => 'The confirm code you entered is too long.', 'TOO_LONG_DATEFORMAT' => 'The date format you entered is too long.', - 'TOO_LONG_ICQ' => 'The ICQ number you entered is too long.', 'TOO_LONG_JABBER' => 'The Jabber account name you entered is too long.', - 'TOO_LONG_MSN' => 'The WLM name you entered is too long.', 'TOO_LONG_NEW_PASSWORD' => 'The password you entered is too long.', 'TOO_LONG_PASSWORD_CONFIRM' => 'The password confirmation you entered is too long.', 'TOO_LONG_USER_PASSWORD' => 'The password you entered is too long.', 'TOO_LONG_USERNAME' => 'The username you entered is too long.', 'TOO_LONG_EMAIL' => 'The email address you entered is too long.', - 'TOO_LONG_WEBSITE' => 'The website address you entered is too long.', - 'TOO_LONG_YIM' => 'The Yahoo! Messenger name you entered is too long.', 'TOO_MANY_VOTE_OPTIONS' => 'You have tried to vote for too many options.', 'TOO_SHORT' => 'The value you entered is too short.', - 'TOO_SHORT_AIM' => 'The screenname you entered is too short.', 'TOO_SHORT_CONFIRM_CODE' => 'The confirm code you entered is too short.', 'TOO_SHORT_DATEFORMAT' => 'The date format you entered is too short.', - 'TOO_SHORT_ICQ' => 'The ICQ number you entered is too short.', 'TOO_SHORT_JABBER' => 'The Jabber account name you entered is too short.', - 'TOO_SHORT_MSN' => 'The WLM name you entered is too short.', 'TOO_SHORT_NEW_PASSWORD' => 'The password you entered is too short.', 'TOO_SHORT_PASSWORD_CONFIRM' => 'The password confirmation you entered is too short.', 'TOO_SHORT_USER_PASSWORD' => 'The password you entered is too short.', 'TOO_SHORT_USERNAME' => 'The username you entered is too short.', 'TOO_SHORT_EMAIL' => 'The email address you entered is too short.', - 'TOO_SHORT_WEBSITE' => 'The website address you entered is too short.', - 'TOO_SHORT_YIM' => 'The Yahoo! Messenger name you entered is too short.', - + 'TOO_SHORT_EMAIL_CONFIRM' => 'The email address confirmation you entered is too short.', 'TOO_SMALL' => 'The value you entered is too small.', 'TOO_SMALL_MAX_RECIPIENTS' => 'The value of <strong>Maximum number of allowed recipients per private message</strong> setting you entered is too small.', @@ -724,7 +767,8 @@ $lang = array_merge($lang, array( 'TOPIC_MOVED' => 'Moved topic', 'TOPIC_REVIEW' => 'Topic review', 'TOPIC_TITLE' => 'Topic title', - 'TOPIC_UNAPPROVED' => 'This topic has not been approved', + 'TOPIC_UNAPPROVED' => 'This topic has not been approved.', + 'TOPIC_DELETED' => 'This topic has been deleted.', 'TOTAL_ATTACHMENTS' => 'Attachment(s)', 'TOTAL_LOGS' => array( 1 => '%d log', @@ -734,6 +778,7 @@ $lang = array_merge($lang, array( 1 => '%d private message in total', 2 => '%d private messages in total', ), + 'TOPIC_POLL' => 'This topic has a poll.', 'TOTAL_POSTS' => 'Total posts', 'TOTAL_POSTS_COUNT' => array( 2 => 'Total posts <strong>%d</strong>', @@ -746,8 +791,9 @@ $lang = array_merge($lang, array( 2 => 'Total members <strong>%d</strong>', ), 'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s', + 'TWITTER' => 'Twitter', - 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image.', + 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image. Please verify that the URL you entered is correct.', 'UNABLE_TO_DELIVER_FILE'=> 'Unable to deliver file.', 'UNKNOWN_BROWSER' => 'Unknown browser', 'UNMARK_ALL' => 'Unmark all', @@ -785,6 +831,7 @@ $lang = array_merge($lang, array( 1 => 'Viewed %d time', 2 => 'Viewed %d times', ), + 'VIEWING_CONTACT_ADMIN' => 'Viewing contact page', 'VIEWING_FAQ' => 'Viewing FAQ', 'VIEWING_MEMBERS' => 'Viewing member details', 'VIEWING_ONLINE' => 'Viewing who is online', @@ -826,16 +873,19 @@ $lang = array_merge($lang, array( 'WRONG_PASSWORD' => 'You entered an incorrect password.', 'WRONG_DATA_COLOUR' => 'The colour value you entered is invalid.', - 'WRONG_DATA_ICQ' => 'The number you entered is not a valid ICQ number.', 'WRONG_DATA_JABBER' => 'The name you entered is not a valid Jabber account name.', 'WRONG_DATA_LANG' => 'The language you specified is not valid.', - 'WRONG_DATA_WEBSITE' => 'The website address has to be a valid URL, including the protocol. For example http://www.example.com/.', + 'WRONG_DATA_POST_SD' => 'The post sort direction you specified is not valid.', + 'WRONG_DATA_POST_SK' => 'The post sort option you specified is not valid.', + 'WRONG_DATA_TOPIC_SD' => 'The topic sort direction you specified is not valid.', + 'WRONG_DATA_TOPIC_SK' => 'The topic sort option you specified is not valid.', 'WROTE' => 'wrote', + 'YAHOO' => 'Yahoo Messenger', + 'YOUTUBE' => 'YouTube', 'YEAR' => 'Year', 'YEAR_MONTH_DAY' => '(YYYY-MM-DD)', 'YES' => 'Yes', - 'YIM' => 'YIM', 'YOU_LAST_VISIT' => 'Last visit was: %s', 'datetime' => array( @@ -894,32 +944,34 @@ $lang = array_merge($lang, array( // Timezones can be translated. We use this for the Etc/GMT timezones here, // because they are named invers to their offset. 'timezones' => array( - 'UTC' => 'UTC', - - 'Etc/GMT-12' => 'GMT+12', - 'Etc/GMT-11' => 'GMT+11', - 'Etc/GMT-10' => 'GMT+10', - 'Etc/GMT-9' => 'GMT+9', - 'Etc/GMT-8' => 'GMT+8', - 'Etc/GMT-7' => 'GMT+7', - 'Etc/GMT-6' => 'GMT+6', - 'Etc/GMT-5' => 'GMT+5', - 'Etc/GMT-4' => 'GMT+4', - 'Etc/GMT-3' => 'GMT+3', - 'Etc/GMT-2' => 'GMT+2', - 'Etc/GMT-1' => 'GMT+1', - 'Etc/GMT+1' => 'GMT-1', - 'Etc/GMT+2' => 'GMT-2', - 'Etc/GMT+3' => 'GMT-3', - 'Etc/GMT+4' => 'GMT-4', - 'Etc/GMT+5' => 'GMT-5', - 'Etc/GMT+6' => 'GMT-6', - 'Etc/GMT+7' => 'GMT-7', - 'Etc/GMT+8' => 'GMT-8', - 'Etc/GMT+9' => 'GMT-9', - 'Etc/GMT+10' => 'GMT-10', - 'Etc/GMT+11' => 'GMT-11', - 'Etc/GMT+12' => 'GMT-12', + 'UTC' => 'UTC', + 'UTC_OFFSET' => 'UTC%1$s', + 'UTC_OFFSET_CURRENT' => 'UTC%1$s - %2$s', + + 'Etc/GMT-12' => 'UTC+12', + 'Etc/GMT-11' => 'UTC+11', + 'Etc/GMT-10' => 'UTC+10', + 'Etc/GMT-9' => 'UTC+9', + 'Etc/GMT-8' => 'UTC+8', + 'Etc/GMT-7' => 'UTC+7', + 'Etc/GMT-6' => 'UTC+6', + 'Etc/GMT-5' => 'UTC+5', + 'Etc/GMT-4' => 'UTC+4', + 'Etc/GMT-3' => 'UTC+3', + 'Etc/GMT-2' => 'UTC+2', + 'Etc/GMT-1' => 'UTC+1', + 'Etc/GMT+1' => 'UTC-1', + 'Etc/GMT+2' => 'UTC-2', + 'Etc/GMT+3' => 'UTC-3', + 'Etc/GMT+4' => 'UTC-4', + 'Etc/GMT+5' => 'UTC-5', + 'Etc/GMT+6' => 'UTC-6', + 'Etc/GMT+7' => 'UTC-7', + 'Etc/GMT+8' => 'UTC-8', + 'Etc/GMT+9' => 'UTC-9', + 'Etc/GMT+10' => 'UTC-10', + 'Etc/GMT+11' => 'UTC-11', + 'Etc/GMT+12' => 'UTC-12', 'Africa/Abidjan' => 'Africa/Abidjan', 'Africa/Accra' => 'Africa/Accra', @@ -1360,7 +1412,7 @@ $lang = array_merge($lang, array( 'D M d, Y g:i a' => 'Mon Jan 01, 2007 1:37 pm', 'F jS, Y, g:i a' => 'January 1st, 2007, 1:37 pm', '|d M Y|, H:i' => 'Today, 13:37 / 01 Jan 2007, 13:37', - '|F jS, Y|, g:i a' => 'Today, 1:37 pm / January 1st, 2007, 1:37 pm' + '|F jS, Y|, g:i a' => 'Today, 1:37 pm / January 1st, 2007, 1:37 pm', ), // The default dateformat which will be used on new installs in this language diff --git a/phpBB/language/en/email/admin_activate.txt b/phpBB/language/en/email/admin_activate.txt index 8b11f1b450..a53ab1269e 100644 --- a/phpBB/language/en/email/admin_activate.txt +++ b/phpBB/language/en/email/admin_activate.txt @@ -10,5 +10,4 @@ Use this link to view the user's profile: Use this link to activate the account: {U_ACTIVATE} - -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/admin_send_email.txt b/phpBB/language/en/email/admin_send_email.txt index b778496258..7345a040fd 100644 --- a/phpBB/language/en/email/admin_send_email.txt +++ b/phpBB/language/en/email/admin_send_email.txt @@ -10,5 +10,4 @@ Message sent to you follows: {MESSAGE} - {EMAIL_SIG} diff --git a/phpBB/language/en/email/admin_welcome_activated.txt b/phpBB/language/en/email/admin_welcome_activated.txt index cfdb69bdcb..2e136ac530 100644 --- a/phpBB/language/en/email/admin_welcome_activated.txt +++ b/phpBB/language/en/email/admin_welcome_activated.txt @@ -6,4 +6,4 @@ Your account on "{SITENAME}" has been activated by an administrator, you may log Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/admin_welcome_inactive.txt b/phpBB/language/en/email/admin_welcome_inactive.txt index 8605956318..f9a57b9fe3 100644 --- a/phpBB/language/en/email/admin_welcome_inactive.txt +++ b/phpBB/language/en/email/admin_welcome_inactive.txt @@ -16,4 +16,4 @@ Your password has been securely stored in our database and cannot be retrieved. Thank you for registering. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/contact_admin.txt b/phpBB/language/en/email/contact_admin.txt new file mode 100644 index 0000000000..c895c4d687 --- /dev/null +++ b/phpBB/language/en/email/contact_admin.txt @@ -0,0 +1,23 @@ + +Hello {TO_USERNAME}, + +The following is an e-mail sent to you through the administration contact page on "{SITENAME}". + +<!-- IF S_IS_REGISTERED --> +The message has been sent from an account on the site. +Username: {FROM_USERNAME} +E-mail address: {FROM_EMAIL_ADDRESS} +IP Address: {FROM_IP_ADDRESS} +Profile: {U_FROM_PROFILE} +<!-- ELSE --> +The message was sent from a guest who specified the following contact information: +Name: {FROM_USERNAME} +E-mail address: {FROM_EMAIL_ADDRESS} +IP Address: {FROM_IP_ADDRESS} +<!-- ENDIF --> + + +Message sent to you follows +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +{MESSAGE} diff --git a/phpBB/language/en/email/email_notify.txt b/phpBB/language/en/email/email_notify.txt index 725b52f0cc..43c9098a4f 100644 --- a/phpBB/language/en/email/email_notify.txt +++ b/phpBB/language/en/email/email_notify.txt @@ -14,4 +14,4 @@ A message from {FROM_USERNAME} may also be included below. Please note that this ---------- -{MESSAGE}
\ No newline at end of file +{MESSAGE} diff --git a/phpBB/language/en/email/installed.txt b/phpBB/language/en/email/installed.txt index 8f63d07635..93444581f2 100644 --- a/phpBB/language/en/email/installed.txt +++ b/phpBB/language/en/email/installed.txt @@ -16,4 +16,4 @@ Useful information regarding the phpBB software can be found in the docs folder In order to keep your board safe and secure, we highly recommended keeping current with software releases. For your convenience, a mailing list is available at the page referenced above. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/pm_report_closed.txt b/phpBB/language/en/email/pm_report_closed.txt index 1b9f4a6658..0202b9d374 100644 --- a/phpBB/language/en/email/pm_report_closed.txt +++ b/phpBB/language/en/email/pm_report_closed.txt @@ -4,5 +4,4 @@ Hello {USERNAME}, You are receiving this notification because the report you filed regarding the private message "{PM_SUBJECT}" at "{SITENAME}" has been tended to by a moderator or administrator. The report is now closed. If you have further questions, please contact {CLOSER_NAME} by private message. - -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/pm_report_deleted.txt b/phpBB/language/en/email/pm_report_deleted.txt index a868837841..991ed59f31 100644 --- a/phpBB/language/en/email/pm_report_deleted.txt +++ b/phpBB/language/en/email/pm_report_deleted.txt @@ -4,5 +4,4 @@ Hello {USERNAME}, You are receiving this notification because the report you filed regarding the private message "{PM_SUBJECT}" at "{SITENAME}" was deleted by a moderator or administrator. - -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/post_approved.txt b/phpBB/language/en/email/post_approved.txt index a02dba142a..854d785f5f 100644 --- a/phpBB/language/en/email/post_approved.txt +++ b/phpBB/language/en/email/post_approved.txt @@ -10,4 +10,4 @@ If you want to view the post, click the following link: If you want to view the topic, click the following link: {U_VIEW_TOPIC} -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/short/newtopic_notify.txt b/phpBB/language/en/email/short/newtopic_notify.txt index bf6799e5be..5089e7dcb8 100644 --- a/phpBB/language/en/email/short/newtopic_notify.txt +++ b/phpBB/language/en/email/short/newtopic_notify.txt @@ -2,7 +2,7 @@ Subject: New topic notification - "{FORUM_NAME}" Hello {USERNAME}, -You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum. +You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum. {U_FORUM} diff --git a/phpBB/language/en/email/short/post_approved.txt b/phpBB/language/en/email/short/post_approved.txt index a02dba142a..854d785f5f 100644 --- a/phpBB/language/en/email/short/post_approved.txt +++ b/phpBB/language/en/email/short/post_approved.txt @@ -10,4 +10,4 @@ If you want to view the post, click the following link: If you want to view the topic, click the following link: {U_VIEW_TOPIC} -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/short/topic_notify.txt b/phpBB/language/en/email/short/topic_notify.txt index 472375fb22..529478eae2 100644 --- a/phpBB/language/en/email/short/topic_notify.txt +++ b/phpBB/language/en/email/short/topic_notify.txt @@ -2,7 +2,7 @@ Subject: Topic reply notification - "{TOPIC_TITLE}" Hello {USERNAME}, -You are receiving this notification because you are watching the topic "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic. +You are receiving this notification because you are watching the topic "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic. If you want to view the newest post made since your last visit, click the following link: {U_NEWEST_POST} diff --git a/phpBB/language/en/email/test.txt b/phpBB/language/en/email/test.txt new file mode 100644 index 0000000000..91a737248b --- /dev/null +++ b/phpBB/language/en/email/test.txt @@ -0,0 +1,9 @@ +Subject: phpBB is correctly configured to send emails + +Hello {USERNAME}, + +Congratulations. If you received this email, phpBB is correctly configured to send emails. + +In case you require assistance, please visit the phpBB support forums - https://www.phpbb.com/community/ + +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_activate.txt b/phpBB/language/en/email/user_activate.txt index 7d7960c4c5..b949b68651 100644 --- a/phpBB/language/en/email/user_activate.txt +++ b/phpBB/language/en/email/user_activate.txt @@ -6,4 +6,4 @@ Your account on "{SITENAME}" has been deactivated, most likely due to changes ma {U_ACTIVATE} -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_activate_inactive.txt b/phpBB/language/en/email/user_activate_inactive.txt index a90773d48c..7743420698 100644 --- a/phpBB/language/en/email/user_activate_inactive.txt +++ b/phpBB/language/en/email/user_activate_inactive.txt @@ -4,4 +4,4 @@ Hello {USERNAME}, Your account on "{SITENAME}" has been deactivated, most likely due to changes made to your profile. The administrator of the board will need to activate it before you can log in. You will receive another notification when this has occurred. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_activate_passwd.txt b/phpBB/language/en/email/user_activate_passwd.txt index 695be115f8..965d5a552c 100644 --- a/phpBB/language/en/email/user_activate_passwd.txt +++ b/phpBB/language/en/email/user_activate_passwd.txt @@ -14,4 +14,4 @@ Password: {PASSWORD} You can of course change this password yourself via the profile page. If you have any difficulties please contact the board administrator. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_reactivate_account.txt b/phpBB/language/en/email/user_reactivate_account.txt index 385c09f4c5..7564b0a8e4 100644 --- a/phpBB/language/en/email/user_reactivate_account.txt +++ b/phpBB/language/en/email/user_reactivate_account.txt @@ -15,4 +15,4 @@ Please visit the following link to reactivate your account: {U_ACTIVATE} -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_remind_inactive.txt b/phpBB/language/en/email/user_remind_inactive.txt index 1ba28329f6..1f136b56f2 100644 --- a/phpBB/language/en/email/user_remind_inactive.txt +++ b/phpBB/language/en/email/user_remind_inactive.txt @@ -8,4 +8,4 @@ This notification is a reminder that your account at "{SITENAME}", created on {R Thank you for registering at "{SITENAME}", we look forward to your participation. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_resend_inactive.txt b/phpBB/language/en/email/user_resend_inactive.txt index b9b95ce9e5..d975a07b13 100644 --- a/phpBB/language/en/email/user_resend_inactive.txt +++ b/phpBB/language/en/email/user_resend_inactive.txt @@ -16,4 +16,4 @@ Please visit the following link in order to activate your account: Thank you for registering. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_welcome.txt b/phpBB/language/en/email/user_welcome.txt index aaead86afc..f299b7b23e 100644 --- a/phpBB/language/en/email/user_welcome.txt +++ b/phpBB/language/en/email/user_welcome.txt @@ -14,4 +14,4 @@ Your password has been securely stored in our database and cannot be retrieved. Thank you for registering. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/email/user_welcome_inactive.txt b/phpBB/language/en/email/user_welcome_inactive.txt index 5cbb3af3de..b4300d0032 100644 --- a/phpBB/language/en/email/user_welcome_inactive.txt +++ b/phpBB/language/en/email/user_welcome_inactive.txt @@ -18,4 +18,4 @@ Your password has been securely stored in our database and cannot be retrieved. Thank you for registering. -{EMAIL_SIG}
\ No newline at end of file +{EMAIL_SIG} diff --git a/phpBB/language/en/groups.php b/phpBB/language/en/groups.php index 6155d34a8c..6d25fea247 100644 --- a/phpBB/language/en/groups.php +++ b/phpBB/language/en/groups.php @@ -1,11 +1,13 @@ <?php /** * -* groups [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -81,7 +83,7 @@ $lang = array_merge($lang, array( 'NOT_LEADER_OF_GROUP' => 'The requested operation cannot be taken because you are not a leader of the selected group.', 'NOT_MEMBER_OF_GROUP' => 'The requested operation cannot be taken because you are not a member of the selected group or your membership has not been approved yet.', 'NOT_RESIGN_FROM_DEFAULT_GROUP' => 'You are not allowed to resign from your default group.', - + 'PRIMARY_GROUP' => 'Primary group', 'REMOVE_SELECTED' => 'Remove selected', diff --git a/phpBB/language/en/help/bbcode.php b/phpBB/language/en/help/bbcode.php new file mode 100644 index 0000000000..e9f3562646 --- /dev/null +++ b/phpBB/language/en/help/bbcode.php @@ -0,0 +1,66 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * DO NOT CHANGE + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +$lang = array_merge($lang, array( + 'HELP_BBCODE_BLOCK_IMAGES' => 'Showing images in posts', + 'HELP_BBCODE_BLOCK_INTRO' => 'Introduction', + 'HELP_BBCODE_BLOCK_LINKS' => 'Creating Links', + 'HELP_BBCODE_BLOCK_LISTS' => 'Generating lists', + 'HELP_BBCODE_BLOCK_OTHERS' => 'Other matters', + 'HELP_BBCODE_BLOCK_QUOTES' => 'Quoting and outputting fixed-width text', + 'HELP_BBCODE_BLOCK_TEXT' => 'Text Formatting', + + 'HELP_BBCODE_IMAGES_ATTACHMENT_ANSWER' => 'Attachments can now be placed in any part of a post by using the new <strong>[attachment=][/attachment]</strong> BBCode, if the attachments functionality has been enabled by a board administrator and if you are given the appropriate permissions to create attachments. Within the posting screen is a drop-down box (respectively a button) for placing attachments inline.', + 'HELP_BBCODE_IMAGES_ATTACHMENT_QUESTION' => 'Adding attachments into a post', + 'HELP_BBCODE_IMAGES_BASIC_ANSWER' => 'phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are: many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). To display an image you must surround the URL pointing to the image with <strong>[img][/img]</strong> tags. For example:<br /><br /><strong>[img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img]</strong><br /><br />As noted in the URL section above you can wrap an image in a <strong>[url][/url]</strong> tag if you wish, e.g.<br /><br /><strong>[url=https://www.phpbb.com/][img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img][/url]</strong><br /><br />would generate:<br /><br /><a href="https://www.phpbb.com/"><img src="https://www.phpbb.com/theme/images/logos/blue/160x52.png" alt="" /></a>', + 'HELP_BBCODE_IMAGES_BASIC_QUESTION' => 'Adding an image to a post', + + 'HELP_BBCODE_INTRO_BBCODE_ANSWER' => 'BBCode is a special implementation of HTML. Whether you can actually use BBCode in your posts on the forum is determined by the administrator. In addition you can disable BBCode on a per post basis via the posting form. BBCode itself is similar in style to HTML, tags are enclosed in square brackets [ and ] rather than < and > and it offers greater control over what and how something is displayed. Depending on the template you are using you may find adding BBCode to your posts is made much easier through a clickable interface above the message area on the posting form. Even with this you may find the following guide useful.', + 'HELP_BBCODE_INTRO_BBCODE_QUESTION' => 'What is BBCode?', + + 'HELP_BBCODE_LINKS_BASIC_ANSWER' => 'phpBB BBCode supports a number of ways of creating URIs (Uniform Resource Indicators) better known as URLs.<ul><li>The first of these uses the <strong>[url=][/url]</strong> tag, whatever you type after the = sign will cause the contents of that tag to act as a URL. For example to link to phpBB.com you could use:<br /><br /><strong>[url=https://www.phpbb.com/]</strong>Visit phpBB!<strong>[/url]</strong><br /><br />This would generate the following link, <a href="https://www.phpbb.com/">Visit phpBB!</a> Please notice that the link opens in the same window or a new window depending on the users browser preferences.</li><li>If you want the URL itself displayed as the link you can do this by simply using:<br /><br /><strong>[url]</strong>https://www.phpbb.com/<strong>[/url]</strong><br /><br />This would generate the following link, <a href="https://www.phpbb.com/">https://www.phpbb.com/</a></li><li>Additionally, phpBB features something called <i>Magic Links</i>, this will turn any syntactically correct URL into a link without you needing to specify any tags or even the leading http://. For example typing www.phpbb.com into your message will automatically lead to <a href="http://www.phpbb.com/">www.phpbb.com</a> being output when you view the message.</li><li>The same thing applies equally to email addresses, you can either specify an address explicitly for example:<br /><br /><strong>[email]</strong>no.one@domain.adr<strong>[/email]</strong><br /><br />which will output <a href="mailto:no.one@domain.adr">no.one@domain.adr</a> or you can just type no.one@domain.adr into your message and it will be automatically converted when you view.</li></ul>As with all the BBCode tags you can wrap URLs around any of the other tags such as <strong>[img][/img]</strong> (see next entry), <strong>[b][/b]</strong>, etc. As with the formatting tags it is up to you to ensure the correct open and close order is following, for example:<br /><br /><strong>[url=https://www.phpbb.com/][img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/url][/img]</strong><br /><br />is <span style="text-decoration: underline">not</span> correct which may lead to your post being deleted so take care.', + 'HELP_BBCODE_LINKS_BASIC_QUESTION' => 'Linking to another site', + + 'HELP_BBCODE_LISTS_ORDERER_ANSWER' => 'The second type of list, an ordered list, gives you control over what is output before each item. To create an ordered list you use <strong>[list=1][/list]</strong> to create a numbered list or alternatively <strong>[list=a][/list]</strong> for an alphabetical list. As with the unordered list, items are specified using <strong>[*]</strong>. For example:<br /><br /><strong>[list=1]</strong><br /><strong>[*]</strong>Go to the shops<br /><strong>[*]</strong>Buy a new computer<br /><strong>[*]</strong>Swear at computer when it crashes<br /><strong>[/list]</strong><br /><br />will generate the following:<ol style="list-style-type: decimal;"><li>Go to the shops</li><li>Buy a new computer</li><li>Swear at computer when it crashes</li></ol>Whereas for an alphabetical list you would use:<br /><br /><strong>[list=a]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: lower-alpha"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol>', + 'HELP_BBCODE_LISTS_ORDERER_QUESTION' => 'Creating an Ordered list', + 'HELP_BBCODE_LISTS_UNORDERER_ANSWER' => 'BBCode supports two types of lists, unordered and ordered. They are essentially the same as their HTML equivalents. An unordered list outputs each item in your list sequentially one after the other indenting each with a bullet character. To create an unordered list you use <strong>[list][/list]</strong> and define each item within the list using <strong>[*]</strong>. For example to list your favourite colours you could use:<br /><br /><strong>[list]</strong><br /><strong>[*]</strong>Red<br /><strong>[*]</strong>Blue<br /><strong>[*]</strong>Yellow<br /><strong>[/list]</strong><br /><br />This would generate the following list:<ul><li>Red</li><li>Blue</li><li>Yellow</li></ul>', + 'HELP_BBCODE_LISTS_UNORDERER_QUESTION' => 'Creating an Unordered list', + + 'HELP_BBCODE_OTHERS_CUSTOM_ANSWER' => 'If you are an administrator on this board and have the proper permissions, you can add further BBCodes through the Custom BBCodes section.', + 'HELP_BBCODE_OTHERS_CUSTOM_QUESTION' => 'Can I add my own tags?', + + 'HELP_BBCODE_QUOTES_CODE_ANSWER' => 'If you want to output a piece of code or in fact anything that requires a fixed width, e.g. Courier type font you should enclose the text in <strong>[code][/code]</strong> tags, e.g.<br /><br /><strong>[code]</strong>echo "This is some code";<strong>[/code]</strong><br /><br />All formatting used within <strong>[code][/code]</strong> tags is retained when you later view it. PHP syntax highlighting can be enabled using <strong>[code=php][/code]</strong> and is recommended when posting PHP code samples as it improves readability.', + 'HELP_BBCODE_QUOTES_CODE_QUESTION' => 'Outputting code or fixed width data', + 'HELP_BBCODE_QUOTES_TEXT_ANSWER' => 'There are two ways you can quote text, with a reference or without.<ul><li>When you utilise the Quote function to reply to a post on the board you should notice that the post text is added to the message window enclosed in a <strong>[quote=""][/quote]</strong> block. This method allows you to quote with a reference to a person or whatever else you choose to put! For example to quote a piece of text Mr. Blobby wrote you would enter:<br /><br /><strong>[quote="Mr. Blobby"]</strong>The text Mr. Blobby wrote would go here<strong>[/quote]</strong><br /><br />The resulting output will automatically add "Mr. Blobby wrote:" before the actual text. Remember you <strong>must</strong> include the quotation marks "" around the name you are quoting, they are not optional.</li><li>The second method allows you to blindly quote something. To utilise this enclose the text in <strong>[quote][/quote]</strong> tags. When you view the message it will simply show the text within a quotation block.</li></ul>', + 'HELP_BBCODE_QUOTES_TEXT_QUESTION' => 'Quoting text in replies', + + 'HELP_BBCODE_TEXT_BASIC_ANSWER' => 'BBCode includes tags to allow you to quickly change the basic style of your text. This is achieved in the following ways: <ul><li>To make a piece of text bold enclose it in <strong>[b][/b]</strong>, e.g. <br /><br /><strong>[b]</strong>Hello<strong>[/b]</strong><br /><br />will become <strong>Hello</strong></li><li>For underlining use <strong>[u][/u]</strong>, for example:<br /><br /><strong>[u]</strong>Good Morning<strong>[/u]</strong><br /><br />becomes <span style="text-decoration: underline">Good Morning</span></li><li>To italicise text use <strong>[i][/i]</strong>, e.g.<br /><br />This is <strong>[i]</strong>Great!<strong>[/i]</strong><br /><br />would give This is <i>Great!</i></li></ul>', + 'HELP_BBCODE_TEXT_BASIC_QUESTION' => 'How to create bold, italic and underlined text', + 'HELP_BBCODE_TEXT_COLOR_ANSWER' => 'To alter the colour or size of your text the following tags can be used. Keep in mind that how the output appears will depend on the viewers browser and system: <ul><li>Changing the colour of text is achieved by wrapping it in <strong>[color=][/color]</strong>. You can specify either a recognised colour name (eg. red, blue, yellow, etc.) or the hexadecimal triplet alternative, e.g. #FFFFFF, #000000. For example, to create red text you could use:<br /><br /><strong>[color=red]</strong>Hello!<strong>[/color]</strong><br /><br />or<br /><br /><strong>[color=#FF0000]</strong>Hello!<strong>[/color]</strong><br /><br />Both will output <span style="color:red">Hello!</span></li><li>Changing the text size is achieved in a similar way using <strong>[size=][/size]</strong>. This tag is dependent on the template the user has selected but the recommended format is a numerical value representing the text size in percent, starting at 20 (very small) through to 200 (very large) by default. For example:<br /><br /><strong>[size=30]</strong>SMALL<strong>[/size]</strong><br /><br />will generally be <span style="font-size:30%;">SMALL</span><br /><br />whereas:<br /><br /><strong>[size=200]</strong>HUGE!<strong>[/size]</strong><br /><br />will be <span style="font-size:200%;">HUGE!</span></li></ul>', + 'HELP_BBCODE_TEXT_COLOR_QUESTION' => 'How to change the text colour or size', + 'HELP_BBCODE_TEXT_COMBINE_ANSWER' => 'Yes, of course you can, for example to get someones attention you may write:<br /><br /><strong>[size=200][color=red][b]</strong>LOOK AT ME!<strong>[/b][/color][/size]</strong><br /><br />this would output <span style="color:red;font-size:200%;"><strong>LOOK AT ME!</strong></span><br /><br />We don’t recommend you output lots of text that looks like this though! Remember it is up to you, the poster, to ensure tags are closed correctly. For example the following is incorrect:<br /><br /><strong>[b][u]</strong>This is wrong<strong>[/b][/u]</strong>', + 'HELP_BBCODE_TEXT_COMBINE_QUESTION' => 'Can I combine formatting tags?', +)); diff --git a/phpBB/language/en/help/faq.php b/phpBB/language/en/help/faq.php new file mode 100644 index 0000000000..e59d950948 --- /dev/null +++ b/phpBB/language/en/help/faq.php @@ -0,0 +1,186 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * DO NOT CHANGE + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +$lang = array_merge($lang, array( + 'HELP_FAQ_ATTACHMENTS_ALLOWED_ANSWER' => 'Each board administrator can allow or disallow certain attachment types. If you are unsure what is allowed to be uploaded, contact the board administrator for assistance.', + 'HELP_FAQ_ATTACHMENTS_ALLOWED_QUESTION' => 'What attachments are allowed on this board?', + 'HELP_FAQ_ATTACHMENTS_OWN_ANSWER' => 'To find your list of attachments that you have uploaded, go to your User Control Panel and follow the links to the attachments section.', + 'HELP_FAQ_ATTACHMENTS_OWN_QUESTION' => 'How do I find all my attachments?', + + 'HELP_FAQ_BLOCK_ATTACHMENTS' => 'Attachments', + 'HELP_FAQ_BLOCK_BOOKMARKS' => 'Subscriptions and Bookmarks', + 'HELP_FAQ_BLOCK_FORMATTING' => 'Formatting and Topic Types', + 'HELP_FAQ_BLOCK_FRIENDS' => 'Friends and Foes', + 'HELP_FAQ_BLOCK_GROUPS' => 'User Levels and Groups', + 'HELP_FAQ_BLOCK_ISSUES' => 'phpBB Issues', + 'HELP_FAQ_BLOCK_LOGIN' => 'Login and Registration Issues', + 'HELP_FAQ_BLOCK_PMS' => 'Private Messaging', + 'HELP_FAQ_BLOCK_POSTING' => 'Posting Issues', + 'HELP_FAQ_BLOCK_SEARCH' => 'Searching the Forums', + 'HELP_FAQ_BLOCK_USERSETTINGS' => 'User Preferences and settings', + + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER' => 'In phpBB 3.0, bookmarking topics worked much like bookmarking in a web browser. You were not alerted when there was an update. As of phpBB 3.1, bookmarking is more like subscribing to a topic. You can be notified when a bookmarked topic is updated. Subscribing, however, will notify you when there is an update to a topic or forum on the board. Notification options for bookmarks and subscriptions can be configured in the User Control Panel, under “Board preferencesâ€.', + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_QUESTION' => 'What is the difference between bookmarking and subscribing?', + 'HELP_FAQ_BOOKMARKS_FORUM_ANSWER' => 'To subscribe to a specific forum, click the “Subscribe forum†link, at the bottom of page, upon entering the forum.', + 'HELP_FAQ_BOOKMARKS_FORUM_QUESTION' => 'How do I subscribe to specific forums?', + 'HELP_FAQ_BOOKMARKS_REMOVE_ANSWER' => 'To remove your subscriptions, go to your User Control Panel and follow the links to your subscriptions.', + 'HELP_FAQ_BOOKMARKS_REMOVE_QUESTION' => 'How do I remove my subscriptions?', + 'HELP_FAQ_BOOKMARKS_TOPIC_ANSWER' => 'You can bookmark or subscribe to a specific topic by clicking the appropriate link in the “Topic tools†menu, conveniently located near the top and bottom of a topic discussion.<br />Replying to a topic with the “Notify me when a reply is posted†option checked will also subscribe you to the topic.', + 'HELP_FAQ_BOOKMARKS_TOPIC_QUESTION' => 'How do I bookmark or subscribe to specific topics?', + + 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_ANSWER' => 'Announcements often contain important information for the forum you are currently reading and you should read them whenever possible. Announcements appear at the top of every page in the forum to which they are posted. As with global announcements, announcement permissions are granted by the board administrator.', + 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_QUESTION' => 'What are announcements?', + 'HELP_FAQ_FORMATTING_BBOCDE_ANSWER' => 'BBCode is a special implementation of HTML, offering great formatting control on particular objects in a post. The use of BBCode is granted by the administrator, but it can also be disabled on a per post basis from the posting form. BBCode itself is similar in style to HTML, but tags are enclosed in square brackets [ and ] rather than < and >. For more information on BBCode see the guide which can be accessed from the posting page.', + 'HELP_FAQ_FORMATTING_BBOCDE_QUESTION' => 'What is BBCode?', + 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_ANSWER' => 'Global announcements contain important information and you should read them whenever possible. They will appear at the top of every forum and within your User Control Panel. Global announcement permissions are granted by the board administrator.', + 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_QUESTION' => 'What are global announcements?', + 'HELP_FAQ_FORMATTING_HTML_ANSWER' => 'No. It is not possible to post HTML on this board and have it rendered as HTML. Most formatting which can be carried out using HTML can be applied using BBCode instead.', + 'HELP_FAQ_FORMATTING_HTML_QUESTION' => 'Can I use HTML?', + 'HELP_FAQ_FORMATTING_ICONS_ANSWER' => 'Topic icons are author chosen images associated with posts to indicate their content. The ability to use topic icons depends on the permissions set by the board administrator.', + 'HELP_FAQ_FORMATTING_ICONS_QUESTION' => 'What are topic icons?', + 'HELP_FAQ_FORMATTING_IMAGES_ANSWER' => 'Yes, images can be shown in your posts. If the administrator has allowed attachments, you may be able to upload the image to the board. Otherwise, you must link to an image stored on a publicly accessible web server, e.g. http://www.example.com/my-picture.gif. You cannot link to pictures stored on your own PC (unless it is a publicly accessible server) nor images stored behind authentication mechanisms, e.g. hotmail or yahoo mailboxes, password protected sites, etc. To display the image use the BBCode [img] tag.', + 'HELP_FAQ_FORMATTING_IMAGES_QUESTION' => 'Can I post images?', + 'HELP_FAQ_FORMATTING_LOCKED_ANSWER' => 'Locked topics are topics where users can no longer reply and any poll it contained was automatically ended. Topics may be locked for many reasons and were set this way by either the forum moderator or board administrator. You may also be able to lock your own topics depending on the permissions you are granted by the board administrator.', + 'HELP_FAQ_FORMATTING_LOCKED_QUESTION' => 'What are locked topics?', + 'HELP_FAQ_FORMATTING_SMILIES_ANSWER' => 'Smilies, or Emoticons, are small images which can be used to express a feeling using a short code, e.g. :) denotes happy, while :( denotes sad. The full list of emoticons can be seen in the posting form. Try not to overuse smilies, however, as they can quickly render a post unreadable and a moderator may edit them out or remove the post altogether. The board administrator may also have set a limit to the number of smilies you may use within a post.', + 'HELP_FAQ_FORMATTING_SMILIES_QUESTION' => 'What are Smilies?', + 'HELP_FAQ_FORMATTING_STICKIES_ANSWER' => 'Sticky topics within the forum appear below announcements and only on the first page. They are often quite important so you should read them whenever possible. As with announcements and global announcements, sticky topic permissions are granted by the board administrator.', + 'HELP_FAQ_FORMATTING_STICKIES_QUESTION' => 'What are sticky topics?', + + 'HELP_FAQ_FRIENDS_BASIC_ANSWER' => 'You can use these lists to organise other members of the board. Members added to your friends list will be listed within your User Control Panel for quick access to see their online status and to send them private messages. Subject to template support, posts from these users may also be highlighted. If you add a user to your foes list, any posts they make will be hidden by default.', + 'HELP_FAQ_FRIENDS_BASIC_QUESTION' => 'What are my Friends and Foes lists?', + 'HELP_FAQ_FRIENDS_MANAGE_ANSWER' => 'You can add users to your list in two ways. Within each user’s profile, there is a link to add them to either your Friend or Foe list. Alternatively, from your User Control Panel, you can directly add users by entering their member name. You may also remove users from your list using the same page.', + 'HELP_FAQ_FRIENDS_MANAGE_QUESTION' => 'How can I add / remove users to my Friends or Foes list?', + + 'HELP_FAQ_GROUPS_ADMINISTRATORS_ANSWER' => 'Administrators are members assigned with the highest level of control over the entire board. These members can control all facets of board operation, including setting permissions, banning users, creating usergroups or moderators, etc., dependent upon the board founder and what permissions he or she has given the other administrators. They may also have full moderator capabilities in all forums, depending on the settings put forth by the board founder.', + 'HELP_FAQ_GROUPS_ADMINISTRATORS_QUESTION' => 'What are Administrators?', + 'HELP_FAQ_GROUPS_COLORS_ANSWER' => 'It is possible for the board administrator to assign a colour to the members of a usergroup to make it easy to identify the members of this group.', + 'HELP_FAQ_GROUPS_COLORS_QUESTION' => 'Why do some usergroups appear in a different colour?', + 'HELP_FAQ_GROUPS_DEFAULT_ANSWER' => 'If you are a member of more than one usergroup, your default is used to determine which group colour and group rank should be shown for you by default. The board administrator may grant you permission to change your default usergroup via your User Control Panel.', + 'HELP_FAQ_GROUPS_DEFAULT_QUESTION' => 'What is a “Default usergroupâ€?', + 'HELP_FAQ_GROUPS_MODERATORS_ANSWER' => 'Moderators are individuals (or groups of individuals) who look after the forums from day to day. They have the authority to edit or delete posts and lock, unlock, move, delete and split topics in the forum they moderate. Generally, moderators are present to prevent users from going off-topic or posting abusive or offensive material.', + 'HELP_FAQ_GROUPS_MODERATORS_QUESTION' => 'What are Moderators?', + 'HELP_FAQ_GROUPS_TEAM_ANSWER' => 'This page provides you with a list of board staff, including board administrators and moderators and other details such as the forums they moderate.', + 'HELP_FAQ_GROUPS_TEAM_QUESTION' => 'What is “The team†link?', + 'HELP_FAQ_GROUPS_USERGROUPS_ANSWER' => 'Usergroups are groups of users that divide the community into manageable sections board administrators can work with. Each user can belong to several groups and each group can be assigned individual permissions. This provides an easy way for administrators to change permissions for many users at once, such as changing moderator permissions or granting users access to a private forum.', + 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_ANSWER' => 'You can view all usergroups via the “Usergroups†link within your User Control Panel. If you would like to join one, proceed by clicking the appropriate button. Not all groups have open access, however. Some may require approval to join, some may be closed and some may even have hidden memberships. If the group is open, you can join it by clicking the appropriate button. If a group requires approval to join you may request to join by clicking the appropriate button. The user group leader will need to approve your request and may ask why you want to join the group. Please do not harass a group leader if they reject your request; they will have their reasons.', + 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_QUESTION' => 'Where are the usergroups and how do I join one?', + 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_ANSWER' => 'A usergroup leader is usually assigned when usergroups are initially created by a board administrator. If you are interested in creating a usergroup, your first point of contact should be an administrator; try sending a private message.', + 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_QUESTION' => 'How do I become a usergroup leader?', + 'HELP_FAQ_GROUPS_USERGROUPS_QUESTION' => 'What are usergroups?', + + 'HELP_FAQ_ISSUES_ADMIN_ANSWER' => 'All users of the board can use the “Contact us†form, if the option was enabled by the board administrator.<br />Members of the board can also use the “The team†link.', + 'HELP_FAQ_ISSUES_ADMIN_QUESTION' => 'How do I contact a board administrator?', + 'HELP_FAQ_ISSUES_FEATURE_ANSWER' => 'This software was written by and licensed through phpBB Limited. If you believe a feature needs to be added please visit the <a href="https://www.phpbb.com/ideas/">phpBB Ideas Centre</a>, where you can upvote existing ideas or suggest new features.', + 'HELP_FAQ_ISSUES_FEATURE_QUESTION' => 'Why isn’t X feature available?', + 'HELP_FAQ_ISSUES_LEGAL_ANSWER' => 'Any of the administrators listed on the “The team†page should be an appropriate point of contact for your complaints. If this still gets no response then you should contact the owner of the domain (do a <a href="http://www.google.com/search?q=whois">whois lookup</a>) or, if this is running on a free service (e.g. Yahoo!, free.fr, f2s.com, etc.), the management or abuse department of that service. Please note that the phpBB Limited has <strong>absolutely no jurisdiction</strong> and cannot in any way be held liable over how, where or by whom this board is used. Do not contact the phpBB Limited in relation to any legal (cease and desist, liable, defamatory comment, etc.) matter <strong>not directly related</strong> to the phpBB.com website or the discrete software of phpBB itself. If you do email phpBB Limited <strong>about any third party</strong> use of this software then you should expect a terse response or no response at all.', + 'HELP_FAQ_ISSUES_LEGAL_QUESTION' => 'Who do I contact about abusive and/or legal matters related to this board?', + 'HELP_FAQ_ISSUES_WHOIS_PHPBB_ANSWER' => 'This software (in its unmodified form) is produced, released and is copyright <a href="https://www.phpbb.com/">phpBB Limited</a>. It is made available under the GNU General Public License, version 2 (GPL-2.0) and may be freely distributed. See <a href="https://www.phpbb.com/about/">About phpBB</a> for more details.', + 'HELP_FAQ_ISSUES_WHOIS_PHPBB_QUESTION' => 'Who wrote this bulletin board?', + + 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER' => 'If you do not check the <em>Remember me</em> box when you login, the board will only keep you logged in for a preset time. This prevents misuse of your account by anyone else. To stay logged in, check the <em>Remember me</em> box during login. This is not recommended if you access the board from a shared computer, e.g. library, internet cafe, university computer lab, etc. If you do not see this checkbox, it means a board administrator has disabled this feature.', + 'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => 'Why do I get logged off automatically?', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER' => 'There are several reasons why this could occur. First, ensure your username and password are correct. If they are, contact a board administrator to make sure you haven’t been banned. It is also possible the website owner has a configuration error on their end, and they would need to fix it.', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER' => 'It is possible an administrator has deactivated or deleted your account for some reason. Also, many boards periodically remove users who have not posted for a long time to reduce the size of the database. If this has happened, try registering again and being more involved in discussions.', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => 'I registered in the past but cannot login any more?!', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => 'Why can’t I login?', + 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER' => 'It is possible a board administrator has disabled registration to prevent new visitors from signing up. A board administrator could have also banned your IP address or disallowed the username you are attempting to register. Contact a board administrator for assistance.', + 'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => 'Why can’t I register?', + 'HELP_FAQ_LOGIN_COPPA_ANSWER' => 'COPPA, or the Children’s Online Privacy Protection Act of 1998, is a law in the United States requiring websites which can potentially collect information from minors under the age of 13 to have written parental consent or some other method of legal guardian acknowledgment, allowing the collection of personally identifiable information from a minor under the age of 13. If you are unsure if this applies to you as someone trying to register or to the website you are trying to register on, contact legal counsel for assistance. Please note that phpBB Limited and the owners of this board cannot provide legal advice and is not a point of contact for legal concerns of any kind, except as outlined in question “Who do I contact about abusive and/or legal matters related to this board?â€.', + 'HELP_FAQ_LOGIN_COPPA_QUESTION' => 'What is COPPA?', + 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER' => '“Delete all board cookies†deletes the cookies created by phpBB which keep you authenticated and logged into the board. Cookies also provide functions such as read tracking if they have been enabled by a board administrator. If you are having login or logout problems, deleting board cookies may help.', + 'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => 'What does the “Delete all board cookies†do?', + 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER' => 'Don’t panic! While your password cannot be retrieved, it can easily be reset. Visit the login page and click <em>I forgot my password</em>. Follow the instructions and you should be able to log in again shortly.<br />However, if you are not able to reset your password, contact a board administrator.', + 'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => 'I’ve lost my password!', + 'HELP_FAQ_LOGIN_REGISTER_ANSWER' => 'You may not have to, it is up to the administrator of the board as to whether you need to register in order to post messages. However; registration will give you access to additional features not available to guest users such as definable avatar images, private messaging, emailing of fellow users, usergroup subscription, etc. It only takes a few moments to register so it is recommended you do so.', + 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER' => 'First, check your username and password. If they are correct, then one of two things may have happened. If COPPA support is enabled and you specified being under 13 years old during registration, you will have to follow the instructions you received. Some boards will also require new registrations to be activated, either by yourself or by an administrator before you can logon; this information was present during registration. If you were sent an email, follow the instructions. If you did not receive an email, you may have provided an incorrect email address or the email may have been picked up by a spam filer. If you are sure the email address you provided is correct, try contacting an administrator.', + 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => 'I registered but cannot login!', + 'HELP_FAQ_LOGIN_REGISTER_QUESTION' => 'Why do I need to register?', + + 'HELP_FAQ_PMS_CANNOT_SEND_ANSWER' => 'There are three reasons for this; you are not registered and/or not logged on, the board administrator has disabled private messaging for the entire board, or the board administrator has prevented you from sending messages. Contact a board administrator for more information.', + 'HELP_FAQ_PMS_CANNOT_SEND_QUESTION' => 'I cannot send private messages!', + 'HELP_FAQ_PMS_SPAM_ANSWER' => 'We are sorry to hear that. The email form feature of this board includes safeguards to try and track users who send such posts, so email the board administrator with a full copy of the email you received. It is very important that this includes the headers that contain the details of the user that sent the email. The board administrator can then take action.', + 'HELP_FAQ_PMS_SPAM_QUESTION' => 'I have received a spamming or abusive email from someone on this board!', + 'HELP_FAQ_PMS_UNWANTED_ANSWER' => 'You can automatically delete private messages from a user by using message rules within your User Control Panel. If you are receiving abusive private messages from a particular user, report the messages to the moderators; they have the power to prevent a user from sending private messages.', + 'HELP_FAQ_PMS_UNWANTED_QUESTION' => 'I keep getting unwanted private messages!', + + 'HELP_FAQ_POSTING_BUMP_ANSWER' => 'By clicking the “Bump topic†link when you are viewing it, you can “bump†the topic to the top of the forum on the first page. However, if you do not see this, then topic bumping may be disabled or the time allowance between bumps has not yet been reached. It is also possible to bump the topic simply by replying to it, however, be sure to follow the board rules when doing so.', + 'HELP_FAQ_POSTING_BUMP_QUESTION' => 'How do I bump my topic?', + 'HELP_FAQ_POSTING_CREATE_ANSWER' => 'To post a new topic in a forum, click "New Topic". To post a reply to a topic, click "Post Reply". You may need to register before you can post a message. A list of your permissions in each forum is available at the bottom of the forum and topic screens. Example: You can post new topics, You can post attachments, etc.', + 'HELP_FAQ_POSTING_CREATE_QUESTION' => 'How do I create a new topic or post a reply?', + 'HELP_FAQ_POSTING_DRAFT_ANSWER' => 'This allows you to save drafts to be completed and submitted at a later date. To reload a saved draft, visit the User Control Panel.', + 'HELP_FAQ_POSTING_DRAFT_QUESTION' => 'What is the “Save†button for in topic posting?', + 'HELP_FAQ_POSTING_EDIT_DELETE_ANSWER' => 'Unless you are a board administrator or moderator, you can only edit or delete your own posts. You can edit a post by clicking the edit button for the relevant post, sometimes for only a limited time after the post was made. If someone has already replied to the post, you will find a small piece of text output below the post when you return to the topic which lists the number of times you edited it along with the date and time. This will only appear if someone has made a reply; it will not appear if a moderator or administrator edited the post, though they may leave a note as to why they’ve edited the post at their own discretion. Please note that normal users cannot delete a post once someone has replied.', + 'HELP_FAQ_POSTING_EDIT_DELETE_QUESTION' => 'How do I edit or delete a post?', + 'HELP_FAQ_POSTING_FORUM_RESTRICTED_ANSWER' => 'Some forums may be limited to certain users or groups. To view, read, post or perform another action you may need special permissions. Contact a moderator or board administrator to grant you access.', + 'HELP_FAQ_POSTING_FORUM_RESTRICTED_QUESTION' => 'Why can’t I access a forum?', + 'HELP_FAQ_POSTING_NO_ATTACHMENTS_ANSWER' => 'Attachment permissions are granted on a per forum, per group, or per user basis. The board administrator may not have allowed attachments to be added for the specific forum you are posting in, or perhaps only certain groups can post attachments. Contact the board administrator if you are unsure about why you are unable to add attachments.', + 'HELP_FAQ_POSTING_NO_ATTACHMENTS_QUESTION' => 'Why can’t I add attachments?', + 'HELP_FAQ_POSTING_POLL_ADD_ANSWER' => 'The limit for poll options is set by the board administrator. If you feel you need to add more options to your poll than the allowed amount, contact the board administrator.', + 'HELP_FAQ_POSTING_POLL_ADD_QUESTION' => 'Why can’t I add more poll options?', + 'HELP_FAQ_POSTING_POLL_CREATE_ANSWER' => 'When posting a new topic or editing the first post of a topic, click the “Poll creation†tab below the main posting form; if you cannot see this, you do not have appropriate permissions to create polls. Enter a title and at least two options in the appropriate fields, making sure each option is on a separate line in the textarea. You can also set the number of options users may select during voting under “Options per userâ€, a time limit in days for the poll (0 for infinite duration) and lastly the option to allow users to amend their votes.', + 'HELP_FAQ_POSTING_POLL_CREATE_QUESTION' => 'How do I create a poll?', + 'HELP_FAQ_POSTING_POLL_EDIT_ANSWER' => 'As with posts, polls can only be edited by the original poster, a moderator or an administrator. To edit a poll, click to edit the first post in the topic; this always has the poll associated with it. If no one has cast a vote, users can delete the poll or edit any poll option. However, if members have already placed votes, only moderators or administrators can edit or delete it. This prevents the poll’s options from being changed mid-way through a poll.', + 'HELP_FAQ_POSTING_POLL_EDIT_QUESTION' => 'How do I edit or delete a poll?', + 'HELP_FAQ_POSTING_QUEUE_ANSWER' => 'The board administrator may have decided that posts in the forum you are posting to require review before submission. It is also possible that the administrator has placed you in a group of users whose posts require review before submission. Please contact the board administrator for further details.', + 'HELP_FAQ_POSTING_QUEUE_QUESTION' => 'Why does my post need to be approved?', + 'HELP_FAQ_POSTING_REPORT_ANSWER' => 'If the board administrator has allowed it, you should see a button for reporting posts next to the post you wish to report. Clicking this will walk you through the steps necessary to report the post.', + 'HELP_FAQ_POSTING_REPORT_QUESTION' => 'How can I report posts to a moderator?', + 'HELP_FAQ_POSTING_SIGNATURE_ANSWER' => 'To add a signature to a post you must first create one via your User Control Panel. Once created, you can check the <em>Attach a signature</em> box on the posting form to add your signature. You can also add a signature by default to all your posts by checking the appropriate radio button in the User Control Panel. If you do so, you can still prevent a signature being added to individual posts by un-checking the add signature box within the posting form.', + 'HELP_FAQ_POSTING_SIGNATURE_QUESTION' => 'How do I add a signature to my post?', + 'HELP_FAQ_POSTING_WARNING_ANSWER' => 'Each board administrator has their own set of rules for their site. If you have broken a rule, you may be issued a warning. Please note that this is the board administrator’s decision, and the phpBB Limited has nothing to do with the warnings on the given site. Contact the board administrator if you are unsure about why you were issued a warning.', + 'HELP_FAQ_POSTING_WARNING_QUESTION' => 'Why did I receive a warning?', + + 'HELP_FAQ_SEARCH_BLANK_ANSWER' => 'Your search returned too many results for the webserver to handle. Use “Advanced search†and be more specific in the terms used and forums that are to be searched.', + 'HELP_FAQ_SEARCH_BLANK_QUESTION' => 'Why does my search return a blank page!?', + 'HELP_FAQ_SEARCH_FORUM_ANSWER' => 'Enter a search term in the search box located on the index, forum or topic pages. Advanced search can be accessed by clicking the “Advance Search†link which is available on all pages on the forum. How to access the search may depend on the style used.', + 'HELP_FAQ_SEARCH_FORUM_QUESTION' => 'How can I search a forum or forums?', + 'HELP_FAQ_SEARCH_MEMBERS_ANSWER' => 'Visit to the “Members†page and click the “Find a member†link.', + 'HELP_FAQ_SEARCH_MEMBERS_QUESTION' => 'How do I search for members?', + 'HELP_FAQ_SEARCH_NO_RESULT_ANSWER' => 'Your search was probably too vague and included many common terms which are not indexed by phpBB. Be more specific and use the options available within Advanced search.', + 'HELP_FAQ_SEARCH_NO_RESULT_QUESTION' => 'Why does my search return no results?', + 'HELP_FAQ_SEARCH_OWN_ANSWER' => 'Your own posts can be retrieved either by clicking the “Show your posts†link within the User Control Panel or by clicking the “Search user’s posts†link via your own profile page or by clicking the “Quick links†menu at the top of the board. To search for your topics, use the Advanced search page and fill in the various options appropriately.', + 'HELP_FAQ_SEARCH_OWN_QUESTION' => 'How can I find my own posts and topics?', + + 'HELP_FAQ_USERSETTINGS_AVATAR_ANSWER' => 'There are two images which may appear along with a username when viewing posts. One of them may be an image associated with your rank, generally in the form of stars, blocks or dots, indicating how many posts you have made or your status on the board. Another, usually larger, image is known as an avatar and is generally unique or personal to each user.', + 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_ANSWER' => 'Within your User Control Panel, under “Profile†you can add an avatar by using one of the four following methods: Gravatar, Gallery, Remote or Upload. It is up to the board administrator to enable avatars and to choose the way in which avatars can be made available. If you are unable to use avatars, contact a board administrator.', + 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_QUESTION' => 'How do I display an avatar?', + 'HELP_FAQ_USERSETTINGS_AVATAR_QUESTION' => 'What are the images next to my username?', + 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_ANSWER' => 'If you are a registered user, all your settings are stored in the board database. To alter them, visit your User Control Panel; a link can usually be found by clicking on your username at the top of board pages. This system will allow you to change all your settings and preferences.', + 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_QUESTION' => 'How do I change my settings?', + 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_ANSWER' => 'Only registered users can send email to other users via the built-in email form, and only if the administrator has enabled this feature. This is to prevent malicious use of the email system by anonymous users.', + 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_QUESTION' => 'When I click the email link for a user it asks me to login?', + 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_ANSWER' => 'Within your User Control Panel, under “Board preferencesâ€, you will find the option <em>Hide your online status</em>. Enable this option and you will only appear to the administrators, moderators and yourself. You will be counted as a hidden user.', + 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_QUESTION' => 'How do I prevent my username appearing in the online user listings?', + 'HELP_FAQ_USERSETTINGS_LANGUAGE_ANSWER' => 'Either the administrator has not installed your language or nobody has translated this board into your language. Try asking a board administrator if they can install the language pack you need. If the language pack does not exist, feel free to create a new translation. More information can be found at the <a href="https://www.phpbb.com/">phpBB</a>® website.', + 'HELP_FAQ_USERSETTINGS_LANGUAGE_QUESTION' => 'My language is not in the list!', + 'HELP_FAQ_USERSETTINGS_RANK_ANSWER' => 'Ranks, which appear below your username, indicate the number of posts you have made or identify certain users, e.g. moderators and administrators. In general, you cannot directly change the wording of any board ranks as they are set by the board administrator. Please do not abuse the board by posting unnecessarily just to increase your rank. Most boards will not tolerate this and the moderator or administrator will simply lower your post count.', + 'HELP_FAQ_USERSETTINGS_RANK_QUESTION' => 'What is my rank and how do I change it?', + 'HELP_FAQ_USERSETTINGS_SERVERTIME_ANSWER' => 'If you are sure you have set the timezone correctly and the time is still incorrect, then the time stored on the server clock is incorrect. Please notify an administrator to correct the problem.', + 'HELP_FAQ_USERSETTINGS_SERVERTIME_QUESTION' => 'I changed the timezone and the time is still wrong!', + 'HELP_FAQ_USERSETTINGS_TIMEZONE_ANSWER' => 'It is possible the time displayed is from a timezone different from the one you are in. If this is the case, visit your User Control Panel and change your timezone to match your particular area, e.g. London, Paris, New York, Sydney, etc. Please note that changing the timezone, like most settings, can only be done by registered users. If you are not registered, this is a good time to do so.', + 'HELP_FAQ_USERSETTINGS_TIMEZONE_QUESTION' => 'The times are not correct!', +)); diff --git a/phpBB/language/en/help_bbcode.php b/phpBB/language/en/help_bbcode.php index e0cda9df04..800ce3dfb7 100644 --- a/phpBB/language/en/help_bbcode.php +++ b/phpBB/language/en/help_bbcode.php @@ -1,11 +1,13 @@ <?php /** * -* help_bbcode [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -71,11 +73,11 @@ $help = array( ), array( 0 => 'Creating an Unordered list', - 1 => 'BBCode supports two types of lists, unordered and ordered. They are essentially the same as their HTML equivalents. An unordered list outputs each item in your list sequentially one after the other indenting each with a bullet character. To create an unordered list you use <strong>[list][/list]</strong> and define each item within the list using <strong>[*]</strong>. For example to list your favourite colours you could use:<br /><br /><strong>[list]</strong><br /><strong>[*]</strong>Red<br /><strong>[*]</strong>Blue<br /><strong>[*]</strong>Yellow<br /><strong>[/list]</strong><br /><br />This would generate the following list:<ul><li>Red</li><li>Blue</li><li>Yellow</li></ul>' + 1 => 'BBCode supports two types of lists, unordered and ordered. They are essentially the same as their HTML equivalents. An unordered list outputs each item in your list sequentially one after the other indenting each with a bullet character. To create an unordered list you use <strong>[list][/list]</strong> and define each item within the list using <strong>[*]</strong>. For example to list your favourite colours you could use:<br /><br /><strong>[list]</strong><br /><strong>[*]</strong>Red<br /><strong>[*]</strong>Blue<br /><strong>[*]</strong>Yellow<br /><strong>[/list]</strong><br /><br />This would generate the following list:<ul><li>Red</li><li>Blue</li><li>Yellow</li></ul><br />Alternatively you can specify the list’s bullet style using <strong>[list=disc][/list]</strong>, <strong>[list=circle][/list]</strong>, or <strong>[list=square][/list]</strong>.' ), array( 0 => 'Creating an Ordered list', - 1 => 'The second type of list, an ordered list, gives you control over what is output before each item. To create an ordered list you use <strong>[list=1][/list]</strong> to create a numbered list or alternatively <strong>[list=a][/list]</strong> for an alphabetical list. As with the unordered list, items are specified using <strong>[*]</strong>. For example:<br /><br /><strong>[list=1]</strong><br /><strong>[*]</strong>Go to the shops<br /><strong>[*]</strong>Buy a new computer<br /><strong>[*]</strong>Swear at computer when it crashes<br /><strong>[/list]</strong><br /><br />will generate the following:<ol style="list-style-type: decimal;"><li>Go to the shops</li><li>Buy a new computer</li><li>Swear at computer when it crashes</li></ol>Whereas for an alphabetical list you would use:<br /><br /><strong>[list=a]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: lower-alpha"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol>' + 1 => 'The second type of list, an ordered list, gives you control over what is output before each item. To create an ordered list you use <strong>[list=1][/list]</strong> to create a numbered list or alternatively <strong>[list=a][/list]</strong> for an alphabetical list. As with the unordered list, items are specified using <strong>[*]</strong>. For example:<br /><br /><strong>[list=1]</strong><br /><strong>[*]</strong>Go to the shops<br /><strong>[*]</strong>Buy a new computer<br /><strong>[*]</strong>Swear at computer when it crashes<br /><strong>[/list]</strong><br /><br />will generate the following:<ol style="list-style-type: decimal;"><li>Go to the shops</li><li>Buy a new computer</li><li>Swear at computer when it crashes</li></ol>Whereas for an alphabetical list you would use:<br /><br /><strong>[list=a]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: lower-alpha"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol><br /><strong>[list=A]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: upper-alpha"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol><br /><strong>[list=i]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: lower-roman"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol><br /><strong>[list=I]</strong><br /><strong>[*]</strong>The first possible answer<br /><strong>[*]</strong>The second possible answer<br /><strong>[*]</strong>The third possible answer<br /><strong>[/list]</strong><br /><br />giving<ol style="list-style-type: upper-roman"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol>' ), // This block will switch the FAQ-Questions to the second template column array( @@ -88,7 +90,7 @@ $help = array( ), array( 0 => 'Linking to another site', - 1 => 'phpBB BBCode supports a number of ways of creating URIs (Uniform Resource Indicators) better known as URLs.<ul><li>The first of these uses the <strong>[url=][/url]</strong> tag, whatever you type after the = sign will cause the contents of that tag to act as a URL. For example to link to phpBB.com you could use:<br /><br /><strong>[url=http://www.phpbb.com/]</strong>Visit phpBB!<strong>[/url]</strong><br /><br />This would generate the following link, <a href="http://www.phpbb.com/">Visit phpBB!</a> Please notice that the link opens in the same window or a new window depending on the users browser preferences.</li><li>If you want the URL itself displayed as the link you can do this by simply using:<br /><br /><strong>[url]</strong>http://www.phpbb.com/<strong>[/url]</strong><br /><br />This would generate the following link, <a href="http://www.phpbb.com/">http://www.phpbb.com/</a></li><li>Additionally, phpBB features something called <i>Magic Links</i>, this will turn any syntactically correct URL into a link without you needing to specify any tags or even the leading http://. For example typing www.phpbb.com into your message will automatically lead to <a href="http://www.phpbb.com/">www.phpbb.com</a> being output when you view the message.</li><li>The same thing applies equally to email addresses, you can either specify an address explicitly for example:<br /><br /><strong>[email]</strong>no.one@domain.adr<strong>[/email]</strong><br /><br />which will output <a href="mailto:no.one@domain.adr">no.one@domain.adr</a> or you can just type no.one@domain.adr into your message and it will be automatically converted when you view.</li></ul>As with all the BBCode tags you can wrap URLs around any of the other tags such as <strong>[img][/img]</strong> (see next entry), <strong>[b][/b]</strong>, etc. As with the formatting tags it is up to you to ensure the correct open and close order is following, for example:<br /><br /><strong>[url=http://www.google.com/][img]</strong>http://www.google.com/intl/en_ALL/images/logo.gif<strong>[/url][/img]</strong><br /><br />is <span style="text-decoration: underline">not</span> correct which may lead to your post being deleted so take care.' + 1 => 'phpBB BBCode supports a number of ways of creating URIs (Uniform Resource Indicators) better known as URLs.<ul><li>The first of these uses the <strong>[url=][/url]</strong> tag, whatever you type after the = sign will cause the contents of that tag to act as a URL. For example to link to phpBB.com you could use:<br /><br /><strong>[url=https://www.phpbb.com/]</strong>Visit phpBB!<strong>[/url]</strong><br /><br />This would generate the following link, <a href="https://www.phpbb.com/">Visit phpBB!</a> Please notice that the link opens in the same window or a new window depending on the users browser preferences.</li><li>If you want the URL itself displayed as the link you can do this by simply using:<br /><br /><strong>[url]</strong>https://www.phpbb.com/<strong>[/url]</strong><br /><br />This would generate the following link, <a href="https://www.phpbb.com/">https://www.phpbb.com/</a></li><li>Additionally, phpBB features something called <i>Magic Links</i>, this will turn any syntactically correct URL into a link without you needing to specify any tags or even the leading http://. For example typing www.phpbb.com into your message will automatically lead to <a href="http://www.phpbb.com/">www.phpbb.com</a> being output when you view the message.</li><li>The same thing applies equally to email addresses, you can either specify an address explicitly for example:<br /><br /><strong>[email]</strong>no.one@domain.adr<strong>[/email]</strong><br /><br />which will output <a href="mailto:no.one@domain.adr">no.one@domain.adr</a> or you can just type no.one@domain.adr into your message and it will be automatically converted when you view.</li></ul>As with all the BBCode tags you can wrap URLs around any of the other tags such as <strong>[img][/img]</strong> (see next entry), <strong>[b][/b]</strong>, etc. As with the formatting tags it is up to you to ensure the correct open and close order is following, for example:<br /><br /><strong>[url=https://www.phpbb.com/][img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/url][/img]</strong><br /><br />is <span style="text-decoration: underline">not</span> correct which may lead to your post being deleted so take care.' ), array( 0 => '--', @@ -96,7 +98,7 @@ $help = array( ), array( 0 => 'Adding an image to a post', - 1 => 'phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are: many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). To display an image you must surround the URL pointing to the image with <strong>[img][/img]</strong> tags. For example:<br /><br /><strong>[img]</strong>http://www.google.com/intl/en_ALL/images/logo.gif<strong>[/img]</strong><br /><br />As noted in the URL section above you can wrap an image in a <strong>[url][/url]</strong> tag if you wish, e.g.<br /><br /><strong>[url=http://www.google.com/][img]</strong>http://www.google.com/intl/en_ALL/images/logo.gif<strong>[/img][/url]</strong><br /><br />would generate:<br /><br /><a href="http://www.google.com/"><img src="http://www.google.com/intl/en_ALL/images/logo.gif" alt="" /></a>' + 1 => 'phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are: many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). To display an image you must surround the URL pointing to the image with <strong>[img][/img]</strong> tags. For example:<br /><br /><strong>[img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img]</strong><br /><br />As noted in the URL section above you can wrap an image in a <strong>[url][/url]</strong> tag if you wish, e.g.<br /><br /><strong>[url=https://www.phpbb.com/][img]</strong>https://www.phpbb.com/theme/images/logos/blue/160x52.png<strong>[/img][/url]</strong><br /><br />would generate:<br /><br /><a href="https://www.phpbb.com/"><img src="https://www.phpbb.com/theme/images/logos/blue/160x52.png" alt="" /></a>' ), array( 0 => 'Adding attachments into a post', @@ -109,5 +111,5 @@ $help = array( array( 0 => 'Can I add my own tags?', 1 => 'If you are an administrator on this board and have the proper permissions, you can add further BBCodes through the Custom BBCodes section.' - ) + ), ); diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index 94e6622685..8f08ac1cd3 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -1,11 +1,13 @@ <?php /** * -* help_faq [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -34,44 +36,40 @@ $help = array( 1 => 'Login and Registration Issues' ), array( - 0 => 'Why can’t I login?', - 1 => 'There are several reasons why this could occur. First, ensure your username and password are correct. If they are, contact the board owner to make sure you haven’t been banned. It is also possible the website owner has a configuration error on their end, and they would need to fix it.' - ), - array( - 0 => 'Why do I need to register at all?', + 0 => 'Why do I need to register?', 1 => 'You may not have to, it is up to the administrator of the board as to whether you need to register in order to post messages. However; registration will give you access to additional features not available to guest users such as definable avatar images, private messaging, emailing of fellow users, usergroup subscription, etc. It only takes a few moments to register so it is recommended you do so.' ), array( - 0 => 'Why do I get logged off automatically?', - 1 => 'If you do not check the <em>Remember me</em> box when you login, the board will only keep you logged in for a preset time. This prevents misuse of your account by anyone else. To stay logged in, check the box during login. This is not recommended if you access the board from a shared computer, e.g. library, internet cafe, university computer lab, etc. If you do not see this checkbox, it means the board administrator has disabled this feature.' - ), - array( - 0 => 'How do I prevent my username appearing in the online user listings?', - 1 => 'Within your User Control Panel, under “Board preferencesâ€, you will find the option <em>Hide your online status</em>. Enable this option with <samp>Yes</samp> and you will only appear to the administrators, moderators and yourself. You will be counted as a hidden user.' + 0 => 'What is COPPA?', + 1 => 'COPPA, or the Children’s Online Privacy Protection Act of 1998, is a law in the United States requiring websites which can potentially collect information from minors under the age of 13 to have written parental consent or some other method of legal guardian acknowledgment, allowing the collection of personally identifiable information from a minor under the age of 13. If you are unsure if this applies to you as someone trying to register or to the website you are trying to register on, contact legal counsel for assistance. Please note that phpBB Limited and the owners of this board cannot provide legal advice and is not a point of contact for legal concerns of any kind, except as outlined in question “Who do I contact about abusive and/or legal matters related to this board?â€.', ), array( - 0 => 'I’ve lost my password!', - 1 => 'Don’t panic! While your password cannot be retrieved, it can easily be reset. Visit the login page and click <em>I’ve forgotten my password</em>. Follow the instructions and you should be able to log in again shortly.' + 0 => 'Why can’t I register?', + 1 => 'It is possible a board administrator has disabled registration to prevent new visitors from signing up. A board administrator could have also banned your IP address or disallowed the username you are attempting to register. Contact a board administrator for assistance.', ), array( 0 => 'I registered but cannot login!', 1 => 'First, check your username and password. If they are correct, then one of two things may have happened. If COPPA support is enabled and you specified being under 13 years old during registration, you will have to follow the instructions you received. Some boards will also require new registrations to be activated, either by yourself or by an administrator before you can logon; this information was present during registration. If you were sent an email, follow the instructions. If you did not receive an email, you may have provided an incorrect email address or the email may have been picked up by a spam filer. If you are sure the email address you provided is correct, try contacting an administrator.' ), array( + 0 => 'Why can’t I login?', + 1 => 'There are several reasons why this could occur. First, ensure your username and password are correct. If they are, contact a board administrator to make sure you haven’t been banned. It is also possible the website owner has a configuration error on their end, and they would need to fix it.', + ), + array( 0 => 'I registered in the past but cannot login any more?!', 1 => 'It is possible an administrator has deactivated or deleted your account for some reason. Also, many boards periodically remove users who have not posted for a long time to reduce the size of the database. If this has happened, try registering again and being more involved in discussions.' ), array( - 0 => 'What is COPPA?', - 1 => 'COPPA, or the Child Online Privacy and Protection Act of 1998, is a law in the United States requiring websites which can potentially collect information from minors under the age of 13 to have written parental consent or some other method of legal guardian acknowledgment, allowing the collection of personally identifiable information from a minor under the age of 13. If you are unsure if this applies to you as someone trying to register or to the website you are trying to register on, contact legal counsel for assistance. Please note that the phpBB Group cannot provide legal advice and is not a point of contact for legal concerns of any kind, except as outlined below.', + 0 => 'I’ve lost my password!', + 1 => 'Don’t panic! While your password cannot be retrieved, it can easily be reset. Visit the login page and click <em>I forgot my password</em>. Follow the instructions and you should be able to log in again shortly.<br />However, if you are not able to reset your password, contact a board administrator.', ), array( - 0 => 'Why can’t I register?', - 1 => 'It is possible the website owner has banned your IP address or disallowed the username you are attempting to register. The website owner could have also disabled registration to prevent new visitors from signing up. Contact a board administrator for assistance.', + 0 => 'Why do I get logged off automatically?', + 1 => 'If you do not check the <em>Remember me</em> box when you login, the board will only keep you logged in for a preset time. This prevents misuse of your account by anyone else. To stay logged in, check the <em>Remember me</em> box during login. This is not recommended if you access the board from a shared computer, e.g. library, internet cafe, university computer lab, etc. If you do not see this checkbox, it means a board administrator has disabled this feature.', ), array( 0 => 'What does the “Delete all board cookies†do?', - 1 => '“Delete all board cookies†deletes the cookies created by phpBB which keep you authenticated and logged into the board. It also provides functions such as read tracking if they have been enabled by the board owner. If you are having login or logout problems, deleting board cookies may help.', + 1 => '“Delete all board cookies†deletes the cookies created by phpBB which keep you authenticated and logged into the board. Cookies also provide functions such as read tracking if they have been enabled by a board administrator. If you are having login or logout problems, deleting board cookies may help.', ), array( 0 => '--', @@ -79,7 +77,11 @@ $help = array( ), array( 0 => 'How do I change my settings?', - 1 => 'If you are a registered user, all your settings are stored in the board database. To alter them, visit your User Control Panel; a link can usually be found at the top of board pages. This system will allow you to change all your settings and preferences.' + 1 => 'If you are a registered user, all your settings are stored in the board database. To alter them, visit your User Control Panel; a link can usually be found by clicking on your username at the top of board pages. This system will allow you to change all your settings and preferences.', + ), + array( + 0 => 'How do I prevent my username appearing in the online user listings?', + 1 => 'Within your User Control Panel, under “Board preferencesâ€, you will find the option <em>Hide your online status</em>. Enable this option and you will only appear to the administrators, moderators and yourself. You will be counted as a hidden user.' ), array( 0 => 'The times are not correct!', @@ -91,11 +93,15 @@ $help = array( ), array( 0 => 'My language is not in the list!', - 1 => 'Either the administrator has not installed your language or nobody has translated this board into your language. Try asking the board administrator if they can install the language pack you need. If the language pack does not exist, feel free to create a new translation. More information can be found at the phpBB website (see link at the bottom of board pages).' + 1 => 'Either the administrator has not installed your language or nobody has translated this board into your language. Try asking a board administrator if they can install the language pack you need. If the language pack does not exist, feel free to create a new translation. More information can be found at the <a href="https://www.phpbb.com/">phpBB</a>® website.', ), array( - 0 => 'How do I show an image along with my username?', - 1 => 'There are two images which may appear along with a username when viewing posts. One of them may be an image associated with your rank, generally in the form of stars, blocks or dots, indicating how many posts you have made or your status on the board. Another, usually a larger image, is known as an avatar and is generally unique or personal to each user. It is up to the board administrator to enable avatars and to choose the way in which avatars can be made available. If you are unable to use avatars, contact a board administrator and ask them for their reasons.' + 0 => 'What are the images next to my username?', + 1 => 'There are two images which may appear along with a username when viewing posts. One of them may be an image associated with your rank, generally in the form of stars, blocks or dots, indicating how many posts you have made or your status on the board. Another, usually larger, image is known as an avatar and is generally unique or personal to each user.', + ), + array( + 0 => 'How do I display an avatar?', + 1 => 'Within your User Control Panel, under “Profile†you can add an avatar by using one of the four following methods: Gravatar, Gallery, Remote or Upload. It is up to the board administrator to enable avatars and to choose the way in which avatars can be made available. If you are unable to use avatars, contact a board administrator.', ), array( 0 => 'What is my rank and how do I change it?', @@ -110,8 +116,8 @@ $help = array( 1 => 'Posting Issues' ), array( - 0 => 'How do I post a topic in a forum?', - 1 => 'To post a new topic in a forum, click the relevant button on either the forum or topic screens. You may need to register before you can post a message. A list of your permissions in each forum is available at the bottom of the forum and topic screens. Example: You can post new topics, You can vote in polls, etc.' + 0 => 'How do I create a new topic or post a reply?', + 1 => 'To post a new topic in a forum, click "New Topic". To post a reply to a topic, click "Post Reply". You may need to register before you can post a message. A list of your permissions in each forum is available at the bottom of the forum and topic screens. Example: You can post new topics, You can post attachments, etc.', ), array( 0 => 'How do I edit or delete a post?', @@ -119,7 +125,7 @@ $help = array( ), array( 0 => 'How do I add a signature to my post?', - 1 => 'To add a signature to a post you must first create one via your User Control Panel. Once created, you can check the <em>Attach a signature</em> box on the posting form to add your signature. You can also add a signature by default to all your posts by checking the appropriate radio button in your profile. If you do so, you can still prevent a signature being added to individual posts by un-checking the add signature box within the posting form.' + 1 => 'To add a signature to a post you must first create one via your User Control Panel. Once created, you can check the <em>Attach a signature</em> box on the posting form to add your signature. You can also add a signature by default to all your posts by checking the appropriate radio button in the User Control Panel. If you do so, you can still prevent a signature being added to individual posts by un-checking the add signature box within the posting form.' ), array( 0 => 'How do I create a poll?', @@ -143,7 +149,7 @@ $help = array( ), array( 0 => 'Why did I receive a warning?', - 1 => 'Each board administrator has their own set of rules for their site. If you have broken a rule, you may be issued a warning. Please note that this is the board administrator’s decision, and the phpBB Group has nothing to do with the warnings on the given site. Contact the board administrator if you are unsure about why you were issued a warning.' + 1 => 'Each board administrator has their own set of rules for their site. If you have broken a rule, you may be issued a warning. Please note that this is the board administrator’s decision, and the phpBB Limited has nothing to do with the warnings on the given site. Contact the board administrator if you are unsure about why you were issued a warning.' ), array( 0 => 'How can I report posts to a moderator?', @@ -151,7 +157,7 @@ $help = array( ), array( 0 => 'What is the “Save†button for in topic posting?', - 1 => 'This allows you to save passages to be completed and submitted at a later date. To reload a saved passage, visit the User Control Panel.' + 1 => 'This allows you to save drafts to be completed and submitted at a later date. To reload a saved draft, visit the User Control Panel.' ), array( 0 => 'Why does my post need to be approved?', @@ -252,7 +258,7 @@ $help = array( ), array( 0 => 'I keep getting unwanted private messages!', - 1 => 'You can block a user from sending you private messages by using message rules within your User Control Panel. If you are receiving abusive private messages from a particular user, inform a board administrator; they have the power to prevent a user from sending private messages.' + 1 => 'You can automatically delete private messages from a user by using message rules within your User Control Panel. If you are receiving abusive private messages from a particular user, report the messages to the moderators; they have the power to prevent a user from sending private messages.' ), array( 0 => 'I have received a spamming or abusive email from someone on this board!', @@ -280,7 +286,7 @@ $help = array( ), array( 0 => 'Why does my search return no results?', - 1 => 'Your search was probably too vague and included many common terms which are not indexed by phpBB3. Be more specific and use the options available within Advanced search.' + 1 => 'Your search was probably too vague and included many common terms which are not indexed by phpBB. Be more specific and use the options available within Advanced search.', ), array( 0 => 'Why does my search return a blank page!?', @@ -292,19 +298,23 @@ $help = array( ), array( 0 => 'How can I find my own posts and topics?', - 1 => 'Your own posts can be retrieved either by clicking the “Search user’s posts†within the User Control Panel or via your own profile page. To search for your topics, use the Advanced search page and fill in the various options appropriately.' + 1 => 'Your own posts can be retrieved either by clicking the “Show your posts†link within the User Control Panel or by clicking the “Search user’s posts†link via your own profile page or by clicking the “Quick links†menu at the top of the board. To search for your topics, use the Advanced search page and fill in the various options appropriately.', ), array( 0 => '--', - 1 => 'Topic Subscriptions and Bookmarks' + 1 => 'Subscriptions and Bookmarks', ), array( 0 => 'What is the difference between bookmarking and subscribing?', - 1 => 'Bookmarking in phpBB3 is much like bookmarking in your web browser. You aren’t alerted when there’s an update, but you can come back to the topic later. Subscribing, however, will notify you when there is an update to the topic or forum on the board via your preferred method or methods.' + 1 => 'In phpBB 3.0, bookmarking topics worked much like bookmarking in a web browser. You were not alerted when there was an update. As of phpBB 3.1, bookmarking is more like subscribing to a topic. You can be notified when a bookmarked topic is updated. Subscribing, however, will notify you when there is an update to a topic or forum on the board. Notification options for bookmarks and subscriptions can be configured in the User Control Panel, under “Board preferencesâ€.', + ), + array( + 0 => 'How do I bookmark or subscribe to specific topics?', + 1 => 'You can bookmark or subscribe to a specific topic by clicking the appropriate link in the “Topic tools†menu, conveniently located near the top and bottom of a topic discussion.<br />Replying to a topic with the “Notify me when a reply is posted†option checked will also subscribe you to the topic.', ), array( - 0 => 'How do I subscribe to specific forums or topics?', - 1 => 'To subscribe to a specific forum, click the “Subscribe forum†link upon entering the forum. To subscribe to a topic, reply to the topic with the subscribe checkbox checked or click the “Subscribe topic†link within the topic itself.' + 0 => 'How do I subscribe to specific forums?', + 1 => 'To subscribe to a specific forum, click the “Subscribe forum†link, at the bottom of page, upon entering the forum.', ), array( 0 => 'How do I remove my subscriptions?', @@ -324,18 +334,22 @@ $help = array( ), array( 0 => '--', - 1 => 'phpBB 3 Issues' + 1 => 'phpBB Issues', ), array( 0 => 'Who wrote this bulletin board?', - 1 => 'This software (in its unmodified form) is produced, released and is copyright <a href="https://www.phpbb.com/">phpBB Group</a>. It is made available under the GNU General Public License and may be freely distributed. See the link for more details.' + 1 => 'This software (in its unmodified form) is produced, released and is copyright <a href="https://www.phpbb.com/">phpBB Limited</a>. It is made available under the GNU General Public License, version 2 (GPL-2.0) and may be freely distributed. See <a href="https://www.phpbb.com/about/">About phpBB</a> for more details.', ), array( 0 => 'Why isn’t X feature available?', - 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added please visit the <a href="https://www.phpbb.com/ideas/">phpBB Ideas Centre</a>, where you can upvote existing ideas or suggest new features.' + 1 => 'This software was written by and licensed through phpBB Limited. If you believe a feature needs to be added please visit the <a href="https://www.phpbb.com/ideas/">phpBB Ideas Centre</a>, where you can upvote existing ideas or suggest new features.' ), array( 0 => 'Who do I contact about abusive and/or legal matters related to this board?', - 1 => 'Any of the administrators listed on the “The team†page should be an appropriate point of contact for your complaints. If this still gets no response then you should contact the owner of the domain (do a <a href="http://www.google.com/search?q=whois">whois lookup</a>) or, if this is running on a free service (e.g. Yahoo!, free.fr, f2s.com, etc.), the management or abuse department of that service. Please note that the phpBB Group has <strong>absolutely no jurisdiction</strong> and cannot in any way be held liable over how, where or by whom this board is used. Do not contact the phpBB Group in relation to any legal (cease and desist, liable, defamatory comment, etc.) matter <strong>not directly related</strong> to the phpBB.com website or the discrete software of phpBB itself. If you do email phpBB Group <strong>about any third party</strong> use of this software then you should expect a terse response or no response at all.' - ) + 1 => 'Any of the administrators listed on the “The team†page should be an appropriate point of contact for your complaints. If this still gets no response then you should contact the owner of the domain (do a <a href="http://www.google.com/search?q=whois">whois lookup</a>) or, if this is running on a free service (e.g. Yahoo!, free.fr, f2s.com, etc.), the management or abuse department of that service. Please note that the phpBB Limited has <strong>absolutely no jurisdiction</strong> and cannot in any way be held liable over how, where or by whom this board is used. Do not contact the phpBB Limited in relation to any legal (cease and desist, liable, defamatory comment, etc.) matter <strong>not directly related</strong> to the phpBB.com website or the discrete software of phpBB itself. If you do email phpBB Limited <strong>about any third party</strong> use of this software then you should expect a terse response or no response at all.' + ), + array( + 0 => 'How do I contact a board administrator?', + 1 => 'All users of the board can use the “Contact us†form, if the option was enabled by the board administrator.<br />Members of the board can also use the “The team†link.', + ), ); diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 03c9562983..0c539a7309 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -1,17 +1,19 @@ <?php /** -* -* install [English] -* -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ /** -* DO NOT CHANGE -*/ + * DO NOT CHANGE + */ if (!defined('IN_PHPBB')) { exit; @@ -34,168 +36,27 @@ if (empty($lang) || !is_array($lang)) // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine +// Common installer pages $lang = array_merge($lang, array( - 'ADMIN_CONFIG' => 'Administrator configuration', - 'ADMIN_PASSWORD' => 'Administrator password', - 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', - 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', - 'ADMIN_TEST' => 'Check administrator settings', - 'ADMIN_USERNAME' => 'Administrator username', - 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', - 'APP_MAGICK' => 'Imagemagick support [ Attachments ]', - 'AUTHOR_NOTES' => 'Author notes<br />» %s', - 'AVAILABLE' => 'Available', - 'AVAILABLE_CONVERTORS' => 'Available convertors', - - 'BEGIN_CONVERT' => 'Begin conversion', - 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', - 'BOARD_NOT_INSTALLED' => 'No installation found', - 'BOARD_NOT_INSTALLED_EXPLAIN' => 'The phpBB Unified Convertor Framework requires a default installation of phpBB3 to function, please <a href="%s">proceed by first installing phpBB3</a>.', - 'BACKUP_NOTICE' => 'Please backup your board before updating in case any problems arise during the update process.', - - 'CATEGORY' => 'Category', - 'CACHE_STORE' => 'Cache type', - 'CACHE_STORE_EXPLAIN' => 'The physical location where data is cached, filesystem is preferred.', - 'CAT_CONVERT' => 'Convert', - 'CAT_INSTALL' => 'Install', - 'CAT_OVERVIEW' => 'Overview', - 'CAT_UPDATE' => 'Update', - 'CHANGE' => 'Change', - 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', - 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', - 'CLEANING_USERNAMES' => 'Cleaning usernames', - 'COLLIDING_CLEAN_USERNAME' => '<strong>%s</strong> is the clean username for:', - 'COLLIDING_USERNAMES_FOUND' => 'Colliding usernames were found on your old board. In order to complete the conversion please delete or rename these users so that there is only one user on your old board for each clean username.', - 'COLLIDING_USER' => '» user id: <strong>%d</strong> username: <strong>%s</strong> (%d posts)', - 'CONFIG_CONVERT' => 'Converting the configuration', - 'CONFIG_FILE_UNABLE_WRITE' => 'It was not possible to write the configuration file. Alternative methods for this file to be created are presented below.', - 'CONFIG_FILE_WRITTEN' => 'The configuration file has been written. You may now proceed to the next step of the installation.', - 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s†is empty.', - 'CONFIG_RETRY' => 'Retry', - 'CONTINUE_CONVERT' => 'Continue conversion', - 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', - 'CONTINUE_LAST' => 'Continue last statements', - 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', - 'CONVERT' => 'Convert', - 'CONVERT_COMPLETE' => 'Conversion completed', - 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and <a href="../">access your board</a>. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the <a href="https://www.phpbb.com/support/documentation/3.0/">Documentation</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=46">support forums</a>.', - 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', - 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', - 'CONVERT_NEW_CONVERSION' => 'New conversion', - 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist.', - 'CONVERT_OPTIONS' => 'Options', - 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion process, please push the button below.', - 'CONV_ERR_FATAL' => 'Fatal conversion error', - - 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', - 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', - 'CONV_ERROR_FORUM_ACCESS' => 'Unable to get forum access information.', - 'CONV_ERROR_GET_CATEGORIES' => 'Unable to get categories.', - 'CONV_ERROR_GET_CONFIG' => 'Could not retrieve your board configuration.', - 'CONV_ERROR_COULD_NOT_READ' => 'Unable to access/read “%sâ€.', - 'CONV_ERROR_GROUP_ACCESS' => 'Unable to get group authentication information.', - 'CONV_ERROR_INCONSISTENT_GROUPS' => 'Inconsistency in groups table detected in add_bots() - you need to add all special groups if you do it manually.', - 'CONV_ERROR_INSERT_BOT' => 'Unable to insert bot into users table.', - 'CONV_ERROR_INSERT_BOTGROUP' => 'Unable to insert bot into bots table.', - 'CONV_ERROR_INSERT_USER_GROUP' => 'Unable to insert user into user_group table.', - 'CONV_ERROR_MESSAGE_PARSER' => 'Message parser error', - 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', - 'CONV_ERROR_NO_FORUM_PATH' => 'The relative path to the source board has not been specified.', - 'CONV_ERROR_NO_GALLERY_PATH' => 'Note to developer: you must specify $convertor[\'avatar_gallery_path\'] to use %s.', - 'CONV_ERROR_NO_GROUP' => 'Group “%1$s†could not be found in %2$s.', - 'CONV_ERROR_NO_RANKS_PATH' => 'Note to developer: you must specify $convertor[\'ranks_path\'] to use %s.', - 'CONV_ERROR_NO_SMILIES_PATH' => 'Note to developer: you must specify $convertor[\'smilies_path\'] to use %s.', - 'CONV_ERROR_NO_UPLOAD_DIR' => 'Note to developer: you must specify $convertor[\'upload_path\'] to use %s.', - 'CONV_ERROR_PERM_SETTING' => 'Unable to insert/update permission setting.', - 'CONV_ERROR_PM_COUNT' => 'Unable to select folder pm count.', - 'CONV_ERROR_REPLACE_CATEGORY' => 'Unable to insert new forum replacing old category.', - 'CONV_ERROR_REPLACE_FORUM' => 'Unable to insert new forum replacing old forum.', - 'CONV_ERROR_USER_ACCESS' => 'Unable to get user authentication information.', - 'CONV_ERROR_WRONG_GROUP' => 'Wrong group “%1$s†defined in %2$s.', - 'CONV_OPTIONS_BODY' => 'This page collects the data required to access the source board. Enter the database details of your former board; the converter will not change anything in the database given below. The source board should be disabled to allow a consistent conversion.', - 'CONV_SAVED_MESSAGES' => 'Saved messages', - - 'COULD_NOT_COPY' => 'Could not copy file <strong>%1$s</strong> to <strong>%2$s</strong><br /><br />Please check that the target directory exists and is writable by the webserver.', - 'COULD_NOT_FIND_PATH' => 'Could not find path to your former board. Please check your settings and try again.<br />» %s was specified as the source path.', - - 'DBMS' => 'Database type', - 'DB_CONFIG' => 'Database configuration', - 'DB_CONNECTION' => 'Database connection', - 'DB_ERR_INSERT' => 'Error while processing <code>INSERT</code> query.', - 'DB_ERR_LAST' => 'Error while processing <var>query_last</var>.', - 'DB_ERR_QUERY_FIRST' => 'Error while executing <var>query_first</var>.', - 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing <var>query_first</var>, %s (“%sâ€).', - 'DB_ERR_SELECT' => 'Error while running <code>SELECT</code> query.', - 'DB_HOST' => 'Database server hostname or DSN', - 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', - 'DB_NAME' => 'Database name', - 'DB_PASSWORD' => 'Database password', - 'DB_PORT' => 'Database server port', - 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', - 'DB_UPDATE_NOT_SUPPORTED' => 'We are sorry, but this script does not support updating from versions of phpBB prior to “%1$sâ€. The version you currently have installed is “%2$sâ€. Please update to a previous version before running this script. Assistance with this is available in the Support Forum on phpBB.com.', - 'DB_USERNAME' => 'Database username', - 'DB_TEST' => 'Test connection', - 'DEFAULT_LANG' => 'Default board language', - 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the board you are converting from. The default table prefix for %1$s is <strong>%2$s</strong>.', - 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', - 'DIRECTORIES_AND_FILES' => 'Directory and file setup', - 'DISABLE_KEYS' => 'Disabling keys', - 'DLL_FIREBIRD' => 'Firebird', - 'DLL_FTP' => 'Remote FTP support [ Installation ]', - 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', - 'DLL_MBSTRING' => 'Multi-byte character support', - 'DLL_MSSQL' => 'MSSQL Server 2000+', - 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', - 'DLL_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', - 'DLL_MYSQL' => 'MySQL', - 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', - 'DLL_ORACLE' => 'Oracle', - 'DLL_POSTGRES' => 'PostgreSQL', - 'DLL_SQLITE' => 'SQLite', - 'DLL_XML' => 'XML support [ Jabber ]', - 'DLL_ZLIB' => 'zlib compression support [ gz, .tar.gz, .zip ]', - 'DL_CONFIG' => 'Download config', - 'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.1 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click “Done†to move to the next stage.', - 'DL_DOWNLOAD' => 'Download', - 'DONE' => 'Done', - - 'ENABLE_KEYS' => 'Re-enabling keys. This can take a while.', - - 'FILES_OPTIONAL' => 'Optional files and directories', - 'FILES_OPTIONAL_EXPLAIN' => '<strong>Optional</strong> - These files, directories or permission settings are not required. The installation system will attempt to use various techniques to create them if they do not exist or cannot be written to. However, the presence of these will speed installation.', - 'FILES_REQUIRED' => 'Files and Directories', - 'FILES_REQUIRED_EXPLAIN' => '<strong>Required</strong> - In order to function correctly phpBB needs to be able to access or write to certain files or directories. If you see “Not Found†you need to create the relevant file or directory. If you see “Unwritable†you need to change the permissions on the file or directory to allow phpBB to write to it.', - 'FILLING_TABLE' => 'Filling table <strong>%s</strong>', - 'FILLING_TABLES' => 'Filling tables', - - 'FIREBIRD_DBMS_UPDATE_REQUIRED' => 'phpBB no longer supports Firebird/Interbase prior to Version 2.1. Please update your Firebird installation to at least 2.1.0 before proceeding with the update.', - - 'FINAL_STEP' => 'Process final step', - 'FORUM_ADDRESS' => 'Board address', - 'FORUM_ADDRESS_EXPLAIN' => 'This is the URL of your former board, for example <samp>http://www.example.com/phpBB2/</samp>. If an address is entered here and not left empty every instance of this address will be replaced by your new board address within messages, private messages and signatures.', - 'FORUM_PATH' => 'Board path', - 'FORUM_PATH_EXPLAIN' => 'This is the <strong>relative</strong> path on disk to your former board from the <strong>root of this phpBB3 installation</strong>.', - 'FOUND' => 'Found', - 'FTP_CONFIG' => 'Transfer config by FTP', - 'FTP_CONFIG_EXPLAIN' => 'phpBB has detected the presence of the FTP module on this server. You may attempt to install your config.php via this if you wish. You will need to supply the information listed below. Remember your username and password are those to your server! (ask your hosting provider for details if you are unsure what these are).', - 'FTP_PATH' => 'FTP path', - 'FTP_PATH_EXPLAIN' => 'This is the path from your root directory to that of phpBB, e.g. <samp>htdocs/phpBB3/</samp>.', - 'FTP_UPLOAD' => 'Upload', - - 'GPL' => 'General Public License', - - 'INITIAL_CONFIG' => 'Basic configuration', - 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', - 'INSTALL_CONGRATS' => 'Congratulations!', - 'INSTALL_CONGRATS_EXPLAIN' => ' - You have successfully installed phpBB %1$s. Please proceed by choosing one of the following options:</p> - <h2>Convert an existing board to phpBB3</h2> - <p>The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please <a href="%2$s">proceed to the convertor</a>.</p> - <h2>Go live with your phpBB3!</h2> - <p>Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the <a href="https://www.phpbb.com/support/documentation/3.0/">Documentation</a>, <a href="%3$s">README</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=46">Support Forums</a>.</p><p><strong>Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.</strong>', - 'INSTALL_INTRO' => 'Welcome to Installation', - - 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.</p><p>In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:</p> + 'INSTALL_PANEL' => 'Installation Panel', + 'SELECT_LANG' => 'Select language', + + 'STAGE_INSTALL' => 'Installing phpBB', + + // Introduction page + 'INTRODUCTION_TITLE' => 'Introduction', + 'INTRODUCTION_BODY' => 'Welcome to phpBB3!<br /><br />phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.<br /><br />This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read <a href="../docs/INSTALL.html">the installation guide</a>.<br /><br />To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', + + // Support page + 'SUPPORT_TITLE' => 'Support', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:</p><ul><li>installation</li><li>configuration</li><li>technical questions</li><li>problems relating to potential bugs in the software</li><li>updating from Release Candidate (RC) versions to the latest stable version</li><li>converting from phpBB 2.0.x to phpBB3</li><li>converting from other discussion board software to phpBB3 (please see the <a href="https://www.phpbb.com/community/viewforum.php?f=486">Convertors Forum</a>)</li></ul><p>We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.</p><h2>Extensions / Styles</h2><p>For issues relating to Extensions, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=451">Extensions Forum</a>.<br />For issues relating to styles, templates and themes, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=471">Styles Forum</a>.<br /><br />If your question relates to a specific package, please post directly in the topic dedicated to the package.</p><h2>Obtaining Support</h2><p><a href="https://www.phpbb.com/community/viewtopic.php?f=14&t=571070">The phpBB Welcome Package</a><br /><a href="https://www.phpbb.com/support/">Support Section</a><br /><a href="https://www.phpbb.com/support/docs/en/3.1/ug/quickstart/">Quick Start Guide</a><br /><br />To ensure you stay up to date with the latest news and releases, why not <a href="https://www.phpbb.com/support/">subscribe to our mailing list</a>?<br /><br />', + + // License + 'LICENSE_TITLE' => 'General Public License', + + // Install page + 'INSTALL_INTRO' => 'Welcome to Installation', + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.</p><p>In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:</p> <ul> <li>The Database Type - the database you will be using.</li> @@ -212,380 +73,146 @@ $lang = array_merge($lang, array( <li>MySQL 3.23 or above (MySQLi supported)</li> <li>PostgreSQL 8.3+</li> <li>SQLite 2.8.2+</li> - <li>Firebird 2.1+</li> + <li>SQLite 3.6.15+</li> <li>MS SQL Server 2000 or above (directly or via ODBC)</li> <li>MS SQL Server 2005 or above (native)</li> <li>Oracle</li> </ul> <p>Only those databases supported on your server will be displayed.', - 'INSTALL_INTRO_NEXT' => 'To commence the installation, please press the button below.', - 'INSTALL_LOGIN' => 'Login', - 'INSTALL_NEXT' => 'Next stage', - 'INSTALL_NEXT_FAIL' => 'Some tests failed and you should correct these problems before proceeding to the next stage. Failure to do so may result in an incomplete installation.', - 'INSTALL_NEXT_PASS' => 'All the basic tests have been passed and you may proceed to the next stage of installation. If you have changed any permissions, modules, etc. and wish to re-test you can do so if you wish.', - 'INSTALL_PANEL' => 'Installation Panel', - 'INSTALL_SEND_CONFIG' => 'Unfortunately phpBB could not write the configuration information directly to your config.php. This may be because the file does not exist or is not writable. A number of options will be listed below enabling you to complete installation of config.php.', - 'INSTALL_START' => 'Start install', - 'INSTALL_TEST' => 'Test again', - 'INST_ERR' => 'Installation error', - 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', - 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', - 'INST_ERR_DB_INVALID_PREFIX'=> 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', - 'INST_ERR_DB_NO_ERROR' => 'No error message given.', - 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension†option you have selected. Please try the “MySQL†option instead.', - 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', - 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the <var>NLS_CHARACTERSET</var> parameter to <var>UTF8</var>. Either upgrade your installation to 9.2+ or change the parameter.', - 'INST_ERR_DB_NO_FIREBIRD' => 'The version of Firebird installed on this machine is older than 2.1, please upgrade to a newer version.', - 'INST_ERR_DB_NO_FIREBIRD_PS'=> 'The database you selected for Firebird has a page size less than 8192, it must be at least 8192.', - 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.', - 'INST_ERR_DB_NO_NAME' => 'No database name specified.', - 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', - 'INST_ERR_EMAIL_MISMATCH' => 'The emails you entered did not match.', - 'INST_ERR_FATAL' => 'Fatal installation error', - 'INST_ERR_FATAL_DB' => 'A fatal and unrecoverable database error has occurred. This may be because the specified user does not have appropriate permissions to <code>CREATE TABLES</code> or <code>INSERT</code> data, etc. Further information may be given below. Please contact your hosting provider in the first instance or the support forums of phpBB for further assistance.', - 'INST_ERR_FTP_PATH' => 'Could not change to the given directory, please check the path.', - 'INST_ERR_FTP_LOGIN' => 'Could not login to FTP server, check your username and password.', - 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', - 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', - 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', - 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', - 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', - 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', - 'INST_ERR_PREFIX_INVALID' => 'The table prefix you have specified is invalid for your database. Please try another, removing characters such as the hyphen.', - 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', - 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', - 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', - 'INVALID_PRIMARY_KEY' => 'Invalid primary key : %s', - - 'LONG_SCRIPT_EXECUTION' => 'Please note that this can take a while... Please do not stop the script.', - - // mbstring - 'MBSTRING_CHECK' => '<samp>mbstring</samp> extension check', - 'MBSTRING_CHECK_EXPLAIN' => '<strong>Required</strong> - <samp>mbstring</samp> is a PHP extension that provides multibyte string functions. Certain features of mbstring are not compatible with phpBB and must be disabled.', - 'MBSTRING_FUNC_OVERLOAD' => 'Function overloading', - 'MBSTRING_FUNC_OVERLOAD_EXPLAIN' => '<var>mbstring.func_overload</var> must be set to either 0 or 4.', - 'MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding', - 'MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => '<var>mbstring.encoding_translation</var> must be set to 0.', - 'MBSTRING_HTTP_INPUT' => 'HTTP input character conversion', - 'MBSTRING_HTTP_INPUT_EXPLAIN' => '<var>mbstring.http_input</var> must be set to <samp>pass</samp>.', - 'MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion', - 'MBSTRING_HTTP_OUTPUT_EXPLAIN' => '<var>mbstring.http_output</var> must be set to <samp>pass</samp>.', - - 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:<br />»<strong>%s</strong>.', - 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:<br />»<strong>%s</strong>.', - - 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.<br /><strong>Before you proceed the update, you need to upgrade the schema.</strong><br /><br />Please refer to the <a href="https://www.phpbb.com/kb/article/doesnt-have-a-default-value-errors/">Knowledge Base article about upgrading the MySQL schema</a>. If you encounter problems, please use <a href="https://www.phpbb.com/community/viewforum.php?f=46">our support forums</a>.', - - 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases<br /><br />%s', - 'NEXT_STEP' => 'Proceed to next step', - 'NOT_FOUND' => 'Cannot find', - 'NOT_UNDERSTAND' => 'Could not understand %s #%d, table %s (“%sâ€)', - 'NO_CONVERTORS' => 'No convertors are available for use.', - 'NO_CONVERT_SPECIFIED' => 'No convertor specified.', - 'NO_LOCATION' => 'Cannot determine location. If you know Imagemagick is installed, you may specify the location later within your administration control panel', - 'NO_TABLES_FOUND' => 'No tables found.', - - 'OVERVIEW_BODY' => 'Welcome to phpBB3!<br /><br />phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.<br /><br />This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read <a href="../docs/INSTALL.html">the installation guide</a>.<br /><br />To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', - - 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', - 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will <strong>not</strong> run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', - 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP function getimagesize() is available', - 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => '<strong>Required</strong> - In order for phpBB to function correctly, the getimagesize function needs to be available.', - 'PHP_JSON_SUPPORT' => 'PHP JSON support', - 'PHP_JSON_SUPPORT_EXPLAIN' => '<strong>Required</strong> - In order for phpBB to function correctly, the PHP JSON extension needs to be available.', - 'PHP_OPTIONAL_MODULE' => 'Optional modules', - 'PHP_OPTIONAL_MODULE_EXPLAIN' => '<strong>Optional</strong> - These modules or applications are optional. However, if they are available they will enable extra features.', - 'PHP_SUPPORTED_DB' => 'Supported databases', - 'PHP_SUPPORTED_DB_EXPLAIN' => '<strong>Required</strong> - You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', - 'PHP_REGISTER_GLOBALS' => 'PHP setting <var>register_globals</var> is disabled', - 'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.', - 'PHP_SAFE_MODE' => 'Safe mode', - 'PHP_SETTINGS' => 'PHP version and settings', - 'PHP_SETTINGS_EXPLAIN' => '<strong>Required</strong> - You must be running at least version 5.3.3 of PHP in order to install phpBB. If <var>safe mode</var> is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', - 'PHP_URL_FOPEN_SUPPORT' => 'PHP setting <var>allow_url_fopen</var> is enabled', - 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => '<strong>Optional</strong> - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.', - 'PHP_VERSION_REQD' => 'PHP version >= 5.3.3', - 'POST_ID' => 'Post ID', - 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using <strong>%s</strong> as table prefix.', - 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', - 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually do and adjust several things. After conversion, especially check the permissions assigned, rebuild your search index which is not converted and also make sure files got copied correctly, for example avatars and smilies.', - 'PROCESS_LAST' => 'Processing last statements', - - 'REFRESH_PAGE' => 'Refresh page to continue conversion', - 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', - 'REQUIREMENTS_TITLE' => 'Installation compatibility', - 'REQUIREMENTS_EXPLAIN' => 'Before proceeding with the full installation phpBB will carry out some tests on your server configuration and files to ensure that you are able to install and run phpBB. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed. If you wish to use any of the features depending on the optional tests, you should ensure that these tests are passed also.', - 'RETRY_WRITE' => 'Retry writing config', - 'RETRY_WRITE_EXPLAIN' => 'If you wish you can change the permissions on config.php to allow phpBB to write to it. Should you wish to do that you can click Retry below to try again. Remember to return the permissions on config.php after phpBB has finished installation.', - 'SCRIPT_PATH' => 'Script path', - 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. <samp>/phpBB3</samp>.', - 'SELECT_LANG' => 'Select language', - 'SERVER_CONFIG' => 'Server configuration', - 'SEARCH_INDEX_UNCONVERTED' => 'Search index was not converted', - 'SEARCH_INDEX_UNCONVERTED_EXPLAIN' => 'Your old search index was not converted. Searching will always yield an empty result. To create a new search index go to the Administration Control Panel, select Maintenance and then choose Search index from the submenu.', - 'SELECT_FORUM_GA' => 'In phpBB 3.1 the global announcements are linked to forums. Select a forum for your current global announcements (can be moved later):', - 'SOFTWARE' => 'Board software', - 'SPECIFY_OPTIONS' => 'Specify conversion options', - 'STAGE_ADMINISTRATOR' => 'Administrator details', - 'STAGE_ADVANCED' => 'Advanced settings', - 'STAGE_ADVANCED_EXPLAIN' => 'The settings on this page are only necessary to set if you know that you require something different from the default. If you are unsure, just proceed to the next page, as these settings can be altered from the Administration Control Panel later.', - 'STAGE_CONFIG_FILE' => 'Configuration file', - 'STAGE_CREATE_TABLE' => 'Create database tables', - 'STAGE_CREATE_TABLE_EXPLAIN' => 'The database tables used by phpBB 3.1 have been created and populated with some initial data. Proceed to the next screen to finish installing phpBB.', - 'STAGE_DATABASE' => 'Database settings', - 'STAGE_FINAL' => 'Final stage', - 'STAGE_INTRO' => 'Introduction', - 'STAGE_IN_PROGRESS' => 'Conversion in progress', - 'STAGE_REQUIREMENTS' => 'Requirements', - 'STAGE_SETTINGS' => 'Settings', - 'STARTING_CONVERT' => 'Starting conversion process', - 'STEP_PERCENT_COMPLETED' => 'Step <strong>%d</strong> of <strong>%d</strong>', - 'SUB_INTRO' => 'Introduction', - 'SUB_LICENSE' => 'License', - 'SUB_SUPPORT' => 'Support', - 'SUCCESSFUL_CONNECT' => 'Successful connection', - 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:</p><ul><li>installation</li><li>configuration</li><li>technical questions</li><li>problems relating to potential bugs in the software</li><li>updating from Release Candidate (RC) versions to the latest stable version</li><li>converting from phpBB 2.0.x to phpBB3</li><li>converting from other discussion board software to phpBB3 (please see the <a href="https://www.phpbb.com/community/viewforum.php?f=65">Convertors Forum</a>)</li></ul><p>We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.</p><h2>MODs / Styles</h2><p>For issues relating to MODs, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=81">Modifications Forum</a>.<br />For issues relating to styles, templates and themes, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=80">Styles Forum</a>.<br /><br />If your question relates to a specific package, please post directly in the topic dedicated to the package.</p><h2>Obtaining Support</h2><p><a href="https://www.phpbb.com/community/viewtopic.php?f=14&t=571070">The phpBB Welcome Package</a><br /><a href="https://www.phpbb.com/support/">Support Section</a><br /><a href="https://www.phpbb.com/support/documentation/3.0/quickstart/">Quick Start Guide</a><br /><br />To ensure you stay up to date with the latest news and releases, why not <a href="https://www.phpbb.com/support/">subscribe to our mailing list</a>?<br /><br />', - 'SYNC_FORUMS' => 'Starting to synchronise forums', - 'SYNC_POST_COUNT' => 'Synchronising post_counts', - 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from <var>entry</var> %1$s to %2$s.', - 'SYNC_TOPICS' => 'Starting to synchronise topics', - 'SYNC_TOPIC_ID' => 'Synchronising topics from <var>topic_id</var> %1$s to %2$s.', - - 'TABLES_MISSING' => 'Could not find these tables<br />» <strong>%s</strong>.', - 'TABLE_PREFIX' => 'Prefix for tables in database', - 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', - 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.<br />» Specified table prefix was %s.', - 'TESTS_PASSED' => 'Tests passed', - 'TESTS_FAILED' => 'Tests failed', - - 'UNABLE_WRITE_LOCK' => 'Unable to write lock file.', - 'UNAVAILABLE' => 'Unavailable', - 'UNWRITABLE' => 'Unwritable', - 'UPDATE_TOPICS_POSTED' => 'Generating topics posted information', - 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.', - 'VERIFY_OPTIONS' => 'Verifying conversion options', - 'VERSION' => 'Version', - - 'WELCOME_INSTALL' => 'Welcome to phpBB3 Installation', - 'WRITABLE' => 'Writable', + 'ACP_LINK' => 'Take me to <a href="%1$s">the ACP</a>', + + 'INSTALL_PHPBB_INSTALLED' => 'phpBB is already installed.', + 'INSTALL_PHPBB_NOT_INSTALLED' => 'phpBB is not installed yet.' )); -// Updater +// Requirements translation $lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', - 'ARCHIVE_FILE' => 'Source file within archive', - - 'BACK' => 'Back', - 'BINARY_FILE' => 'Binary file', - 'BOT' => 'Spider/Robot', - - 'CHANGE_CLEAN_NAMES' => 'The method used to make sure a username is not used by multiple users has been changed. There are some users which have the same name when compared with the new method. You have to delete or rename these users to make sure that each name is only used by one user before you can proceed.', - 'CHECK_FILES' => 'Check files', - 'CHECK_FILES_AGAIN' => 'Check files again', - 'CHECK_FILES_EXPLAIN' => 'Within the next step all files will be checked against the update files - this can take a while if this is the first file check.', - 'CHECK_FILES_UP_TO_DATE' => 'According to your database your version is up to date. You may want to proceed with the file check to make sure all files are really up to date with the latest phpBB version.', - 'CHECK_UPDATE_DATABASE' => 'Continue update process', - 'COLLECTED_INFORMATION' => 'File information', - 'COLLECTED_INFORMATION_EXPLAIN' => 'The list below shows information about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.', - 'COLLECTING_FILE_DIFFS' => 'Collecting file differences', - 'COMPLETE_LOGIN_TO_BOARD' => 'You should now <a href="../ucp.php?mode=login">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory!', - 'CONTINUE_UPDATE_NOW' => 'Continue the update process now', // Shown within the database update script at the end if called from the updater - 'CONTINUE_UPDATE' => 'Continue update now', // Shown after file upload to indicate the update process is not yet finished - 'CURRENT_FILE' => 'Begin of Conflict - Original File code before update', - 'CURRENT_VERSION' => 'Current version', - - 'DATABASE_TYPE' => 'Database type', - 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', - 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', - 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', - 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', - 'DELETE_USER_REMOVE' => 'Delete user and remove posts', - 'DELETE_USER_RETAIN' => 'Delete user but keep posts', - 'DESTINATION' => 'Destination file', - 'DIFF_INLINE' => 'Inline', - 'DIFF_RAW' => 'Raw unified diff', - 'DIFF_SEP_EXPLAIN' => 'Code block used within the updated/new file', - 'DIFF_SIDE_BY_SIDE' => 'Side by Side', - 'DIFF_UNIFIED' => 'Unified diff', - 'DO_NOT_UPDATE' => 'Do not update this file', - 'DONE' => 'Done', - 'DOWNLOAD' => 'Download', - 'DOWNLOAD_AS' => 'Download as', - 'DOWNLOAD_UPDATE_METHOD_BUTTON' => 'Download modified files archive (recommended)', - 'DOWNLOAD_CONFLICTS' => 'Download conflicts for this file', - 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', - 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', - 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', - - 'EDIT_USERNAME' => 'Edit username', - 'ERROR' => 'Error', - 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.', - - 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', - 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', - 'FILE_USED' => 'Information used from', // Single file - 'FILES_CONFLICT' => 'Conflict files', - 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', - 'FILES_MODIFIED' => 'Modified files', - 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', - 'FILES_NEW' => 'New files', - 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', - 'FILES_NEW_CONFLICT' => 'New conflicting files', - 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', - 'FILES_NOT_MODIFIED' => 'Not modified files', - 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', - 'FILES_UP_TO_DATE' => 'Already updated files', - 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', - 'FTP_SETTINGS' => 'FTP settings', - 'FTP_UPDATE_METHOD' => 'FTP upload', - - 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', - 'INCOMPLETE_UPDATE_FILES' => 'The update files are incomplete.', - 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful. Now you need to continue the update process.', - - 'KEEP_OLD_NAME' => 'Keep username', - - 'LATEST_VERSION' => 'Latest version', - 'LINE' => 'Line', - 'LINE_ADDED' => 'Added', - 'LINE_MODIFIED' => 'Modified', - 'LINE_REMOVED' => 'Removed', - 'LINE_UNMODIFIED' => 'Unmodified', - 'LOGIN_UPDATE_EXPLAIN' => 'In order to update your installation you need to login first.', - - 'MAPPING_FILE_STRUCTURE' => 'To ease the upload here are the file locations which map your phpBB installation.', - - 'MERGE_MODIFICATIONS_OPTION' => 'Merge modifications', - - 'MERGE_NO_MERGE_NEW_OPTION' => 'Do not merge - use new file', - 'MERGE_NO_MERGE_MOD_OPTION' => 'Do not merge - use currently installed file', - 'MERGE_MOD_FILE_OPTION' => 'Merge modifications (removes new phpBB code within conflicting block)', - 'MERGE_NEW_FILE_OPTION' => 'Merge modifications (removes modified code within conflicting block)', - 'MERGE_SELECT_ERROR' => 'Conflicting file merge modes are not correctly selected.', - 'MERGING_FILES' => 'Merging differences', - 'MERGING_FILES_EXPLAIN' => 'Currently collecting final file changes.<br /><br />Please wait until phpBB has completed all operations on changed files.', - - 'NEW_FILE' => 'End of Conflict', - 'NEW_USERNAME' => 'New username', - 'NO_AUTH_UPDATE' => 'Not authorised to update', - 'NO_ERRORS' => 'No errors', - 'NO_UPDATE_FILES' => 'Not updating the following files', - 'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.', - 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.<br /><br />Your installation does <strong>not</strong> seem to be up to date. Updates are available for your version of phpBB %1$s, please visit <a href="https://www.phpbb.com/downloads/" rel="external">https://www.phpbb.com/downloads/</a> to obtain the correct package to update from Version %2$s to Version %3$s.', - 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', - 'NO_UPDATE_INFO' => 'Update file information could not be found.', - 'NO_UPDATES_REQUIRED' => 'No updates required', - 'NO_VISIBLE_CHANGES' => 'No visible changes', - 'NOTICE' => 'Notice', - 'NUM_CONFLICTS' => 'Number of conflicts', - 'NUMBER_OF_FILES_COLLECTED' => 'Currently differences from %1$d of %2$d files have been checked.<br />Please wait until all files are checked.', - - 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', - - 'PACKAGE_UPDATES_TO' => 'Current package updates to version', - 'PERFORM_DATABASE_UPDATE' => 'Perform database update', - 'PERFORM_DATABASE_UPDATE_EXPLAIN' => 'Below you will find a button to the database update script. The database update can take a while, so please do not stop the execution if it seems to hang. After the database update has been performed just follow the instructions to continue the update process.', - 'PREVIOUS_VERSION' => 'Previous version', - 'PROGRESS' => 'Progress', - - 'RESULT' => 'Result', - 'RUN_DATABASE_SCRIPT' => 'Update my database now', - - 'SELECT_DIFF_MODE' => 'Select diff mode', - 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', - 'SELECT_FTP_SETTINGS' => 'Select FTP settings', - 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', - 'SHOW_DIFF_FINAL' => 'Show resulting file', - 'SHOW_DIFF_MODIFIED' => 'Show merged differences', - 'SHOW_DIFF_NEW' => 'Show file contents', - 'SHOW_DIFF_NEW_CONFLICT' => 'Show differences', - 'SHOW_DIFF_NOT_MODIFIED' => 'Show differences', - 'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listed below.', - 'SQL' => 'SQL', - 'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See <a href="../docs/README.html">README</a> for details on how to obtain advice.', - 'STAGE_FILE_CHECK' => 'Check files', - 'STAGE_UPDATE_DB' => 'Update database', - 'STAGE_UPDATE_FILES' => 'Update files', - 'STAGE_VERSION_CHECK' => 'Version check', - 'STATUS_CONFLICT' => 'Modified file producing conflicts', - 'STATUS_MODIFIED' => 'Modified file', - 'STATUS_NEW' => 'New file', - 'STATUS_NEW_CONFLICT' => 'Conflicting new file', - 'STATUS_NOT_MODIFIED' => 'Not modified file', - 'STATUS_UP_TO_DATE' => 'Already updated file', - - 'TOGGLE_DISPLAY' => 'View/Hide file list', - 'TRY_DOWNLOAD_METHOD' => 'You may want to try the download modified files method.<br />This method always works and is also the recommended update path.', - 'TRY_DOWNLOAD_METHOD_BUTTON'=> 'Try this method now', - - 'UPDATE_COMPLETED' => 'Update completed', - 'UPDATE_DATABASE' => 'Update database', - 'UPDATE_DATABASE_EXPLAIN' => 'Within the next step the database will be updated.', - 'UPDATE_DATABASE_SCHEMA' => 'Updating database schema', - 'UPDATE_FILES' => 'Update files', - 'UPDATE_FILES_NOTICE' => 'Please make sure you have updated your board files too, this file is only updating your database.', - 'UPDATE_INSTALLATION' => 'Update phpBB installation', - 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.<br />During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.<br /><br />The file update itself can be done in two different ways.</p><h2>Manual Update</h2><p>With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.</p><h2>Automatic Update with FTP</h2><p>This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.<br /><br />', - 'UPDATE_INSTRUCTIONS' => ' - - <h1>Release announcement</h1> - - <p>Please read <a href="%1$s" title="%1$s"><strong>the release announcement for the latest version</strong></a> before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.</p> - - <br /> + // Filesystem requirements + 'FILE_NOT_EXISTS' => 'File not exists', + 'FILE_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s file need to exist.', + 'FILE_NOT_WRITABLE' => 'File not writable', + 'FILE_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s file need to be writable.', + + 'DIRECTORY_NOT_EXISTS' => 'Directory not exists', + 'DIRECTORY_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s directory need to exist.', + 'DIRECTORY_NOT_WRITABLE' => 'Directory not writable', + 'DIRECTORY_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s directory need to be writable.', + + // Server requirements + 'PHP_VERSION_REQD' => 'PHP version', + 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requires PHP version 5.4.0 or higher.', + 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP getimagesize() function is required', + 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the getimagesize function needs to be available.', + 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', + 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', + 'PHP_JSON_SUPPORT' => 'PHP JSON support', + 'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.', + 'PHP_SUPPORTED_DB' => 'Supported databases', + 'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', + + 'RETEST_REQUIREMENTS' => 'Retest requirements', + + 'STAGE_REQUIREMENTS' => 'Check requirements' +)); - <h1>How to update your installation with the Automatic Update Package</h1> +// General error messages +$lang = array_merge($lang, array( + 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', + 'PHPBB_ALREADY_INSTALLED' => 'phpBB is already installed.' +)); - <p>The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:</p> +// Data obtaining translations +$lang = array_merge($lang, array( + 'STAGE_OBTAIN_DATA' => 'Set installation data', - <ul style="margin-left: 20px; font-size: 1.1em;"> - <li>Go to the <a href="https://www.phpbb.com/downloads/" title="https://www.phpbb.com/downloads/">phpBB.com downloads page</a> and download the "Automatic Update Package" archive.<br /><br /></li> - <li>Unpack the archive.<br /><br /></li> - <li>Upload the complete uncompressed install folder to your phpBB root directory (where your config.php file is).<br /><br /></li> - </ul> + // + // Admin data + // + 'STAGE_ADMINISTRATOR' => 'Administrator details', - <p>Once uploaded your board will be offline for normal users due to the install directory you uploaded now present.<br /><br /> - <strong><a href="%2$s" title="%2$s">Now start the update process by pointing your browser to the install folder</a>.</strong><br /> - <br /> - You will then be guided through the update process. You will be notified once the update is complete. - </p> - ', - 'UPDATE_INSTRUCTIONS_INCOMPLETE' => ' - - <h1>Incomplete update detected</h1> + // Form labels + 'ADMIN_CONFIG' => 'Administrator configuration', + 'ADMIN_PASSWORD' => 'Administrator password', + 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', + 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', + 'ADMIN_USERNAME' => 'Administrator username', + 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', - <p>phpBB detected an incomplete automatic update. Please make sure you followed every step within the automatic update tool. Below you will find the link again, or go directly to your install directory.</p> - ', - 'UPDATE_METHOD' => 'Update method', - 'UPDATE_METHOD_EXPLAIN' => 'You are now able to choose your preferred update method. Using the FTP upload will present you with a form you need to enter your FTP account details into. With this method the files will be automatically moved to the new location and backups of the old files being created by appending .bak to the filename. If you choose to download the modified files you are able to unpack and upload them to their correct location manually later.', - 'UPDATE_REQUIRES_FILE' => 'The updater requires that the following file is present: %s', - 'UPDATE_SUCCESS' => 'Update was successful', - 'UPDATE_SUCCESS_EXPLAIN' => 'Successfully updated all files. The next step involves checking all files again to make sure the files got updated correctly.', - 'UPDATE_VERSION_OPTIMIZE' => 'Updating version and optimising tables', - 'UPDATING_DATA' => 'Updating data', - 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', - 'UPDATED_VERSION' => 'Updated version', - 'UPGRADE_INSTRUCTIONS' => 'A new feature release <strong>%1$s</strong> is available. Please read <a href="%2$s" title="%2$s"><strong>the release announcement</strong></a> to learn about what it has to offer, and how to upgrade.', - 'UPLOAD_METHOD' => 'Upload method', - - 'UPDATE_DB_SUCCESS' => 'Database update was successful.', - 'UPDATE_FILE_SUCCESS' => 'File update was successful.', - 'USER_ACTIVE' => 'Active user', - 'USER_INACTIVE' => 'Inactive user', - - 'VERSION_CHECK' => 'Version check', - 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', - 'VERSION_NOT_UP_TO_DATE' => 'Your phpBB installation is not up to date. Please continue the update process.', - 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.<br />Below is a link to the release announcement, which contains more information as well as instructions on updating.', - 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', - 'VERSION_UP_TO_DATE' => 'Your phpBB installation is up to date. Although there are no updates available at this time, you may continue in order to perform a file validity check.', - 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', - 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', - 'VIEWING_FILE_DIFF' => 'Viewing file differences', - - 'WRONG_INFO_FILE_FORMAT' => 'Wrong info file format', + // Errors + 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', + 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', + 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', + 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', + 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', + + // + // Board data + // + // Form labels + 'BOARD_CONFIG' => 'Bulletin board configuration', + 'DEFAULT_LANGUAGE' => 'Default language', + 'BOARD_NAME' => 'Title of the board', + 'BOARD_DESCRIPTION' => 'Short description of the board', + + // + // Database data + // + 'STAGE_DATABASE' => 'Database settings', + + // Form labels + 'DB_CONFIG' => 'Database configuration', + 'DBMS' => 'Database type', + 'DB_HOST' => 'Database server hostname or DSN', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', + 'DB_PORT' => 'Database server port', + 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_PASSWORD' => 'Database password', + 'DB_NAME' => 'Database name', + 'DB_USERNAME' => 'Database username', + 'TABLE_PREFIX' => 'Prefix for tables in database', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', + + // Database options + 'DB_OPTION_MSSQL' => 'MSSQL Server 2000+', + 'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', + 'DB_OPTION_MYSQL' => 'MySQL', + 'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension', + 'DB_OPTION_ORACLE' => 'Oracle', + 'DB_OPTION_POSTGRES' => 'PostgreSQL', + 'DB_OPTION_SQLITE' => 'SQLite 2', + 'DB_OPTION_SQLITE3' => 'SQLite 3', + + // Errors + 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', + 'INST_ERR_DB_INVALID_PREFIX' => 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', + 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', + 'INST_ERR_DB_NO_NAME' => 'No database name specified.', + 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', + 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', + 'INST_ERR_DB_NO_ERROR' => 'No error message given.', + 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', + 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension†option you have selected. Please try the “MySQL†option instead.', + 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', + 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', + 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the <var>NLS_CHARACTERSET</var> parameter to <var>UTF8</var>. Either upgrade your installation to 9.2+ or change the parameter.', + 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.', + + // + // Email data + // + 'EMAIL_CONFIG' => 'E-mail configuration', + + // + // Server data + // + // Form labels + 'SERVER_CONFIG' => 'Server configuration', + 'SCRIPT_PATH' => 'Script path', + 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. <samp>/phpBB3</samp>.', )); // Default database schema entries... @@ -633,3 +260,182 @@ $lang = array_merge($lang, array( 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', )); + +// Common navigation items' translation +$lang = array_merge($lang, array( + 'MENU_OVERVIEW' => 'Overview', + 'MENU_INTRO' => 'Introduction', + 'MENU_LICENSE' => 'License', + 'MENU_SUPPORT' => 'Support', +)); + +// Task names +$lang = array_merge($lang, array( + // Install filesystem + 'TASK_CREATE_CONFIG_FILE' => 'Creating configuration file', + + // Install database + 'TASK_ADD_CONFIG_SETTINGS' => 'Adding configuration settings', + 'TASK_ADD_DEFAULT_DATA' => 'Adding default settings to the database', + 'TASK_CREATE_DATABASE_SCHEMA' => 'Creating database schema', + + // Install data + 'TASK_ADD_BOTS' => 'Registering bots', + 'TASK_ADD_LANGUAGES' => 'Installing available languages', + 'TASK_ADD_MODULES' => 'Installing modules', + + // Install finish tasks + 'TASK_NOTIFY_USER' => 'Sending notification e-mail', + 'TASK_POPULATE_MIGRATIONS' => 'Populating migrations', + + // Installer general progress messages + 'INSTALLER_FINISHED' => 'The installer has finished successfully', +)); + +// Installer's general messages +$lang = array_merge($lang, array( + 'MODULE_NOT_FOUND' => 'Module not found', + 'MODULE_NOT_FOUND_DESCRIPTION' => 'A module could not be found because the service, %s, is undefined.', + + 'TASK_NOT_FOUND' => 'Task not found', + 'TASK_NOT_FOUND_DESCRIPTION' => 'A task could not be found because the service, %s, is undefined.', + + 'SKIP_MODULE' => 'Skip “%s†module', + 'SKIP_TASK' => 'Skip “%s†task', + + 'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installerâ€', + 'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s†given, the expected class namespace is “%2$s†for that. For more information please see the documentation of task_interface.', + + 'INSTALLER_CONFIG_NOT_WRITABLE' => 'The installer config file is not writable.', +)); + +// CLI messages +$lang = array_merge($lang, array( + 'CLI_INSTALL_BOARD' => 'Install phpBB', + 'CLI_INSTALL_SHOW_CONFIG' => 'Show the configuration which will be used', + 'CLI_INSTALL_VALIDATE_CONFIG' => 'Validate a configuration file', + 'CLI_CONFIG_FILE' => 'Config file to use', + 'MISSING_FILE' => 'Unable to access file %1$s', + 'MISSING_DATA' => 'Config file is missing data or might contain invalid settings.', + 'INVALID_YAML_FILE' => 'Could not parse YAML file %1$s', +)); + +// Common updater messages +$lang = array_merge($lang, array( + 'UPDATE_INSTALLATION' => 'Update phpBB installation', + 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.<br />During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.<br /><br />The file update itself can be done in two different ways.</p><h2>Manual Update</h2><p>With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.</p><h2>Automatic Update with FTP</h2><p>This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.<br /><br />', + 'UPDATE_INSTRUCTIONS' => ' + + <h1>Release announcement</h1> + + <p>Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.</p> + + <br /> + + <h1>How to update your installation with the Automatic Update Package</h1> + + <p>The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:</p> + + <ul style="margin-left: 20px; font-size: 1.1em;"> + <li>Go to the <a href="https://www.phpbb.com/downloads/" title="https://www.phpbb.com/downloads/">phpBB.com downloads page</a> and download the "Automatic Update Package" archive.<br /><br /></li> + <li>Unpack the archive.<br /><br /></li> + <li>Upload the complete uncompressed "install" and "vendor" folders to your phpBB root directory (where your config.php file is).<br /><br /></li> + </ul> + + <p>Once uploaded your board will be offline for normal users due to the install directory you uploaded now present.<br /><br /> + <strong><a href="%1$s" title="%1$s">Now start the update process by pointing your browser to the install folder</a>.</strong><br /> + <br /> + You will then be guided through the update process. You will be notified once the update is complete. + </p> + ', +)); + +// Updater forms +$lang = array_merge($lang, array( + // Updater types + 'UPDATE_TYPE' => 'Type of update to run', + + 'UPDATE_TYPE_ALL' => 'Update filesystem and database', + 'UPDATE_TYPE_DB_ONLY' => 'Update database only', + + // File updater methods + 'UPDATE_FILE_METHOD_TITLE' => 'File updater methods', + + 'UPDATE_FILE_METHOD' => 'File updater method', + 'UPDATE_FILE_METHOD_DOWNLOAD' => 'Download modified files in an archive', + 'UPDATE_FILE_METHOD_FTP' => 'Update files via FTP (Automatic)', + 'UPDATE_FILE_METHOD_FILESYSTEM' => 'Update files via direct file access (Automatic)', + + // File updater archives + 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', + + // FTP settings + 'FTP_SETTINGS' => 'FTP settings', +)); + +// Requirements messages +$lang = array_merge($lang, array( + 'UPDATE_FILES_NOT_FOUND' => 'No valid update directory was found, please make sure you uploaded the relevant files.', + + 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', + 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', + 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', +)); + +// Update files +$lang = array_merge($lang, array( + 'STAGE_UPDATE_FILES' => 'Update files', + + // Check files + 'UPDATE_CHECK_FILES' => 'Check files to update', + + // Update file differ + 'FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ' => 'The file differ failed to open %s.', + + 'UPDATE_FILE_DIFF' => 'Diffing changed files', + 'ALL_FILES_DIFFED' => 'All modified files has been diffed.', + + // File status + 'UPDATE_CONTINUE_FILE_UPDATE' => 'Update files', + + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_CONFLICTS' => 'Download merge conflicts archive', + 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', + 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', + 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, you may continue with the update process.', + + 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', + 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', + 'FILE_USED' => 'Information used from', // Single file + 'FILES_CONFLICT' => 'Conflict files', + 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', + 'FILES_DELETED' => 'Deleted files', + 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', + 'FILES_MODIFIED' => 'Modified files', + 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', + 'FILES_NEW' => 'New files', + 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', + 'FILES_NEW_CONFLICT' => 'New conflicting files', + 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', + 'FILES_NOT_MODIFIED' => 'Not modified files', + 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', + 'FILES_UP_TO_DATE' => 'Already updated files', + 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', + 'TOGGLE_DISPLAY' => 'View/Hide file list', + + // File updater + 'UPDATE_UPDATING_FILES' => 'Updating files', + + 'UPDATE_FILE_UPDATER_HAS_FAILED' => 'File updater “%1$s“ has failed. The installer will try to fallback to “%2$s“.', + 'UPDATE_FILE_UPDATERS_HAVE_FAILED' => 'The file updater failed. No further fallback methods are available.', + + 'UPDATE_CONTINUE_UPDATE_PROCESS' => 'Continue update process', + 'UPDATE_RECHECK_UPDATE_FILES' => 'Check files again', +)); + +// Update database +$lang = array_merge($lang, array( + 'STAGE_UPDATE_DATABASE' => 'Update database', + + 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful.', +)); diff --git a/phpBB/language/en/iso.txt b/phpBB/language/en/iso.txt index c421dd4316..2e45cc56d0 100644 --- a/phpBB/language/en/iso.txt +++ b/phpBB/language/en/iso.txt @@ -1,3 +1,3 @@ British English British English -phpBB Group
\ No newline at end of file +phpBB Limited
\ No newline at end of file diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index b75e0ea495..b196a1d658 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -1,11 +1,13 @@ <?php /** * -* mcp [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -133,6 +135,7 @@ $lang = array_merge($lang, array( 'LOCK_TOPICS_CONFIRM' => 'Are you sure you want to lock all selected topics?', 'LOGS_CURRENT_TOPIC' => 'Currently viewing logs of:', 'LOGIN_EXPLAIN_MCP' => 'To moderate this forum you must login.', + 'LOGVIEW_VIEWPOST' => 'View post', 'LOGVIEW_VIEWTOPIC' => 'View topic', 'LOGVIEW_VIEWLOGS' => 'View topic log', 'LOGVIEW_VIEWFORUM' => 'View forum', @@ -235,7 +238,7 @@ $lang = array_merge($lang, array( 'NOT_MODERATOR' => 'You are not a moderator of this forum.', 'NO_DESTINATION_FORUM' => 'Please select a forum for destination.', 'NO_DESTINATION_FORUM_FOUND' => 'There is no destination forum available.', - 'NO_ENTRIES' => 'No log entries for this period.', + 'NO_ENTRIES' => 'No log entries.', 'NO_FEEDBACK' => 'No feedback exists for this user.', 'NO_FINAL_TOPIC_SELECTED' => 'You have to select a destination topic for merging posts.', 'NO_MATCHES_FOUND' => 'No matches found.', @@ -426,6 +429,6 @@ $lang = array_merge($lang, array( 'SPAM' => 'The reported message has the only purpose to advertise for a website or another product.', 'OFF_TOPIC' => 'The reported message is off topic.', 'OTHER' => 'The reported message does not fit into any other category, please use the further information field.', - ) + ), ), )); diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index 8162f195eb..c7b2bf55d1 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -1,11 +1,13 @@ <?php /** * -* memberlist [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -46,12 +48,14 @@ $lang = array_merge($lang, array( 'BEFORE' => 'Before', - 'CC_EMAIL' => 'Send a copy of this email to yourself.', - 'CONTACT_USER' => 'Contact', + 'CC_SENDER' => 'Send a copy of this email to yourself.', + 'CONTACT_ADMIN' => 'Contact a Board Administrator', 'DEST_LANG' => 'Language', 'DEST_LANG_EXPLAIN' => 'Select an appropriate language (if available) for the recipient of this message.', + 'EDIT_PROFILE' => 'Edit profile', + 'EMAIL_BODY_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.', 'EMAIL_DISABLED' => 'Sorry but all email related functions have been disabled.', 'EMAIL_SENT' => 'The email has been sent.', @@ -60,6 +64,8 @@ $lang = array_merge($lang, array( 'EMPTY_MESSAGE_EMAIL' => 'You must enter a message to be emailed.', 'EMPTY_MESSAGE_IM' => 'You must enter a message to be send.', 'EMPTY_NAME_EMAIL' => 'You must enter the real name of the recipient.', + 'EMPTY_SENDER_EMAIL' => 'You must provide a valid email address.', + 'EMPTY_SENDER_NAME' => 'You must provide a name.', 'EMPTY_SUBJECT_EMAIL' => 'You must specify a subject for the email.', 'EQUAL_TO' => 'Equal to', @@ -71,16 +77,10 @@ $lang = array_merge($lang, array( 'HIDE_MEMBER_SEARCH' => 'Hide member search', 'IM_ADD_CONTACT' => 'Add Contact', - 'IM_AIM' => 'Please note that you need AOL Instant Messenger installed to use this.', - 'IM_AIM_EXPRESS' => 'AIM Express', 'IM_DOWNLOAD_APP' => 'Download application', - 'IM_ICQ' => 'Please note that users may have selected to not receive unsolicited instant messages.', 'IM_JABBER' => 'Please note that users may have selected to not receive unsolicited instant messages.', 'IM_JABBER_SUBJECT' => 'This is an automated message please do not reply! Message from user %1$s at %2$s.', 'IM_MESSAGE' => 'Your message', - 'IM_MSNM' => 'Please note that you need Windows Live Messenger installed to use this.', - 'IM_MSNM_BROWSER' => 'Your browser does not support this.', - 'IM_MSNM_CONNECT' => 'WLM is not connected.\nYou have to connect to WLM to continue.', 'IM_NAME' => 'Your Name', 'IM_NO_DATA' => 'There is no suitable contact information for this user.', 'IM_NO_JABBER' => 'Sorry, direct messaging of Jabber users is not supported on this board. You will need a Jabber client installed on your system to contact the recipient above.', @@ -96,13 +96,16 @@ $lang = array_merge($lang, array( 1 => '%d user', 2 => '%d users', ), - 'LOGIN_EXPLAIN_LEADERS' => 'The board requires you to be registered and logged in to view the team listing.', + 'LOGIN_EXPLAIN_TEAM' => 'The board requires you to be registered and logged in to view the team listing.', 'LOGIN_EXPLAIN_MEMBERLIST' => 'The board requires you to be registered and logged in to access the memberlist.', 'LOGIN_EXPLAIN_SEARCHUSER' => 'The board requires you to be registered and logged in to search users.', 'LOGIN_EXPLAIN_VIEWPROFILE' => 'The board requires you to be registered and logged in to view profiles.', + 'MANAGE_GROUP' => 'Manage Group', 'MORE_THAN' => 'More than', + 'NO_CONTACT_FORM' => 'The board administrator contact form has been disabled.', + 'NO_CONTACT_PAGE' => 'The board administrator contact page has been disabled.', 'NO_EMAIL' => 'You are not permitted to send email to this user.', 'NO_VIEW_USERS' => 'You are not authorised to view the member list or profiles.', @@ -118,12 +121,12 @@ $lang = array_merge($lang, array( 'SELECT_MARKED' => 'Select marked', 'SELECT_SORT_METHOD' => 'Select sort method', - 'SEND_AIM_MESSAGE' => 'Send AIM message', + 'SENDER_EMAIL_ADDRESS' => 'Your email address', + 'SENDER_NAME' => 'Your name', 'SEND_ICQ_MESSAGE' => 'Send ICQ message', 'SEND_IM' => 'Instant messaging', 'SEND_JABBER_MESSAGE' => 'Send Jabber message', 'SEND_MESSAGE' => 'Message', - 'SEND_MSNM_MESSAGE' => 'Send WLM message', 'SEND_YIM_MESSAGE' => 'Send YIM message', 'SORT_EMAIL' => 'Email', 'SORT_LAST_ACTIVE' => 'Last active', @@ -143,7 +146,9 @@ $lang = array_merge($lang, array( 'USERS_PER_PAGE' => 'Users per page', 'VIEWING_PROFILE' => 'Viewing profile - %s', - 'VISITED' => 'Last visited', - - 'WWW' => 'Website', + 'VIEW_FACEBOOK_PROFILE' => 'View Facebook Profile', + 'VIEW_SKYPE_PROFILE' => 'View Skype Profile', + 'VIEW_TWITTER_PROFILE' => 'View Twitter Profile', + 'VIEW_YOUTUBE_CHANNEL' => 'View YouTube Channel', + 'VIEW_GOOGLEPLUS_PROFILE' => 'View Google+ Profile', )); diff --git a/phpBB/language/en/migrator.php b/phpBB/language/en/migrator.php index 1d8886d12b..fcf1c4063b 100644 --- a/phpBB/language/en/migrator.php +++ b/phpBB/language/en/migrator.php @@ -1,11 +1,13 @@ <?php /** * -* migrator [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -39,12 +41,30 @@ $lang = array_merge($lang, array( 'GROUP_NOT_EXIST' => 'The group "%s" unexpectedly does not exist.', + 'MIGRATION_APPLY_DEPENDENCIES' => 'Apply dependencies of %s.', 'MIGRATION_DATA_DONE' => 'Installed Data: %1$s; Time: %2$.2f seconds', 'MIGRATION_DATA_IN_PROGRESS' => 'Installing Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_DATA_RUNNING' => 'Installing Data: %s.', 'MIGRATION_EFFECTIVELY_INSTALLED' => 'Migration already effectively installed (skipped): %s', 'MIGRATION_EXCEPTION_ERROR' => 'Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.', 'MIGRATION_NOT_FULFILLABLE' => 'The migration "%1$s" is not fulfillable, missing migration "%2$s".', + 'MIGRATION_NOT_INSTALLED' => 'The migration "%s" is not installed.', + 'MIGRATION_NOT_VALID' => '%s is not a valid migration.', 'MIGRATION_SCHEMA_DONE' => 'Installed Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_SCHEMA_RUNNING' => 'Installing Schema: %s.', + + 'MIGRATION_REVERT_DATA_DONE' => 'Reverted Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_DATA_IN_PROGRESS' => 'Reverting Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_DATA_RUNNING' => 'Reverting Data: %s.', + 'MIGRATION_REVERT_SCHEMA_DONE' => 'Reverted Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_SCHEMA_RUNNING' => 'Reverting Schema: %s.', + + 'MIGRATION_INVALID_DATA_MISSING_CONDITION' => 'A migration is invalid. An if statement helper is missing a condition.', + 'MIGRATION_INVALID_DATA_MISSING_STEP' => 'A migration is invalid. An if statement helper is missing a valid call to a migration step.', + 'MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE' => 'A migration is invalid. A custom callable function could not be called.', + 'MIGRATION_INVALID_DATA_UNKNOWN_TYPE' => 'A migration is invalid. An unknown migration tool type was encountered.', + 'MIGRATION_INVALID_DATA_UNDEFINED_TOOL' => 'A migration is invalid. An undefined migration tool was encountered.', + 'MIGRATION_INVALID_DATA_UNDEFINED_METHOD' => 'A migration is invalid. An undefined migration tool method was encountered.', 'MODULE_ERROR' => 'An error occurred while creating a module: %s', 'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s', diff --git a/phpBB/language/en/plupload.php b/phpBB/language/en/plupload.php index f174920f6b..15c3955a1a 100644 --- a/phpBB/language/en/plupload.php +++ b/phpBB/language/en/plupload.php @@ -1,12 +1,14 @@ <?php /** * -* plupload [English] +* This file is part of the phpBB Forum Software package. * -* @package language +* @copyright (c) phpBB Limited <https://www.phpbb.com> * @copyright (c) 2010-2013 Moxiecode Systems AB -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index ab851638ae..0e2d706f19 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -1,11 +1,13 @@ <?php /** * -* posting [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -53,12 +55,12 @@ $lang = array_merge($lang, array( 'BBCODE_IS_OFF' => '%sBBCode%s is <em>OFF</em>', 'BBCODE_IS_ON' => '%sBBCode%s is <em>ON</em>', 'BBCODE_I_HELP' => 'Italic text: [i]text[/i]', - 'BBCODE_L_HELP' => 'List: [list][*]text[/list]', + 'BBCODE_L_HELP' => 'List: [list][*]text[/list]', 'BBCODE_LISTITEM_HELP' => 'List item: [*]text', 'BBCODE_O_HELP' => 'Ordered list: e.g. [list=1][*]First point[/list] or [list=a][*]Point a[/list]', 'BBCODE_P_HELP' => 'Insert image: [img]http://image_url[/img]', 'BBCODE_Q_HELP' => 'Quote text: [quote]text[/quote]', - 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] Tip: you can also use color=#FF0000', + 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] or [color=#FF0000]text[/color]', 'BBCODE_U_HELP' => 'Underline text: [u]text[/u]', 'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]', 'BBCODE_Y_HELP' => 'List: Add list element', @@ -70,6 +72,14 @@ $lang = array_merge($lang, array( 'CANNOT_POST_ANNOUNCE' => 'Sorry but you cannot post announcements.', 'CANNOT_POST_STICKY' => 'Sorry but you cannot post sticky topics.', 'CHANGE_TOPIC_TO' => 'Change topic type to', + 'CHARS_POST_CONTAINS' => array( + 1 => 'Your message contains %1$d character.', + 2 => 'Your message contains %1$d characters.', + ), + 'CHARS_SIG_CONTAINS' => array( + 1 => 'Your signature contains %1$d character.', + 2 => 'Your signature contains %1$d characters.', + ), 'CLOSE_TAGS' => 'Close tags', 'CURRENT_TOPIC' => 'Current topic', @@ -83,7 +93,7 @@ $lang = array_merge($lang, array( 'DELETE_POST_PERMANENTLY' => 'Permanently delete this post so it can not be recovered', 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?', 'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete these posts?', - 'DELETE_REASON' => 'Soft delete reason', + 'DELETE_REASON' => 'Reason for deletion', 'DELETE_REASON_EXPLAIN' => 'The specified reason for deletion will be visible to moderators.', 'DELETE_POST_WARN' => 'Delete this post', 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?', @@ -166,8 +176,10 @@ $lang = array_merge($lang, array( 'NO_POLL_TITLE' => 'You have to enter a poll title.', 'NO_POST' => 'The requested post does not exist.', 'NO_POST_MODE' => 'No post mode specified.', + 'NO_TEMP_DIR' => 'Temporary folder could not be found or is not writable.', 'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded.', + 'PHP_UPLOAD_STOPPED' => 'A PHP extension has stopped the file upload.', 'PHP_SIZE_NA' => 'The attachment’s file size is too large.<br />Could not determine the maximum size defined by PHP in php.ini.', 'PHP_SIZE_OVERRUN' => 'The attachment’s file size is too large, the maximum upload size is %1$d %2$s.<br />Please note this is set in php.ini and cannot be overridden.', 'PLACE_INLINE' => 'Place inline', @@ -194,9 +206,9 @@ $lang = array_merge($lang, array( 'POST_APPROVAL_NOTIFY' => 'You will be notified when your post has been approved.', 'POST_CONFIRMATION' => 'Confirmation of post', 'POST_CONFIRM_EXPLAIN' => 'To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', - 'POST_DELETED' => 'This message has been deleted successfully.', - 'POST_EDITED' => 'This message has been edited successfully.', - 'POST_EDITED_MOD' => 'This message has been edited successfully, but it will need to be approved by a moderator before it is publicly viewable.', + 'POST_DELETED' => 'This post has been deleted successfully.', + 'POST_EDITED' => 'This post has been edited successfully.', + 'POST_EDITED_MOD' => 'This post has been edited successfully, but it will need to be approved by a moderator before it is publicly viewable.', 'POST_GLOBAL' => 'Global', 'POST_ICON' => 'Post icon', 'POST_NORMAL' => 'Normal', @@ -213,7 +225,9 @@ $lang = array_merge($lang, array( 1 => 'You may embed only %d quote within each other.', 2 => 'You may embed only %d quotes within each other.', ), + 'QUOTE_NO_NESTING' => 'You may not embed quotes within each other.', + 'REMOTE_UPLOAD_TIMEOUT' => 'The specified file could not be uploaded because the request timed out.', 'SAVE' => 'Save', 'SAVE_DATE' => 'Saved at', 'SAVE_DRAFT' => 'Save draft', @@ -228,17 +242,14 @@ $lang = array_merge($lang, array( 'TOO_FEW_CHARS' => 'Your message contains too few characters.', 'TOO_FEW_CHARS_LIMIT' => array( - 1 => 'Your message contains %1$d character. The minimum number of characters you need to enter is %2$d.', - 2 => 'Your message contains %1$d characters. The minimum number of characters you need to enter is %2$d.', + 1 => 'You need to enter at least %1$d character.', + 2 => 'You need to enter at least %1$d characters.', ), 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attachment, %d is the maximum.', 'TOO_MANY_CHARS' => 'Your message contains too many characters.', - 'TOO_MANY_CHARS_POST' => array( - 2 => 'Your message contains %1$d characters. The maximum number of allowed characters is %2$d.', - ), - 'TOO_MANY_CHARS_SIG' => array( - 2 => 'Your signature contains %1$d characters. The maximum number of allowed characters is %2$d.', + 'TOO_MANY_CHARS_LIMIT' => array( + 2 => 'The maximum number of allowed characters is %1$d.', ), 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', 'TOO_MANY_SMILIES' => 'Your message contains too many smilies. The maximum number of smilies allowed is %d.', @@ -248,6 +259,8 @@ $lang = array_merge($lang, array( 'UNAUTHORISED_BBCODE' => 'You cannot use certain BBCodes: %s.', 'UNGLOBALISE_EXPLAIN' => 'To switch this topic back from being global to a normal topic, you need to select the forum you wish this topic to be displayed.', + 'UNSUPPORTED_CHARACTERS_MESSAGE' => 'Your message contains the following unsupported characters:<br />%s', + 'UNSUPPORTED_CHARACTERS_SUBJECT' => 'Your subject contains the following unsupported characters:<br />%s', 'UPDATE_COMMENT' => 'Update comment', 'URL_INVALID' => 'The URL you specified is invalid.', 'URL_NOT_FOUND' => 'The file specified could not be found.', @@ -262,6 +275,6 @@ $lang = array_merge($lang, array( 'VIEW_MESSAGE' => '%sView your submitted message%s', 'VIEW_PRIVATE_MESSAGE' => '%sView your submitted private message%s', - 'WRONG_FILESIZE' => 'The file is too big, maximum allowed size is %1d %2s.', + 'WRONG_FILESIZE' => 'The file is too big, maximum allowed size is %1$d %2$s.', 'WRONG_SIZE' => 'The image must be at least %1$s wide, %2$s high and at most %3$s wide and %4$s high. The submitted image is %5$s wide and %6$s high.', )); diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php index f65022fbcb..13e5bf7a97 100644 --- a/phpBB/language/en/search.php +++ b/phpBB/language/en/search.php @@ -1,11 +1,13 @@ <?php /** * -* search [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -69,7 +71,11 @@ $lang = array_merge($lang, array( 'NO_RECENT_SEARCHES' => 'No searches have been carried out recently.', 'NO_SEARCH' => 'Sorry but you are not permitted to use the search system.', 'NO_SEARCH_RESULTS' => 'No suitable matches were found.', - 'NO_SEARCH_TIME' => 'Sorry but you cannot use search at this time. Please try again in a few minutes.', + 'NO_SEARCH_LOAD' => 'Sorry but you cannot use search at this time. The server has high load. Please try again later.', + 'NO_SEARCH_TIME' => array( + 1 => 'Sorry but you cannot use search at this time. Please try again in %d second.', + 2 => 'Sorry but you cannot use search at this time. Please try again in %d seconds.', + ), 'NO_SEARCH_UNREADS' => 'Sorry but searching for unread posts has been disabled on this board.', 'WORD_IN_NO_POST' => 'No posts were found because the word <strong>%s</strong> is not contained in any post.', 'WORDS_IN_NO_POST' => 'No posts were found because the words <strong>%s</strong> are not contained in any post.', @@ -81,7 +87,7 @@ $lang = array_merge($lang, array( 'RESULT_DAYS' => 'Limit results to previous', 'RESULT_SORT' => 'Sort results by', 'RETURN_FIRST' => 'Return first', - 'RETURN_TO_SEARCH_ADV' => 'Return to advanced search', + 'GO_TO_SEARCH_ADV' => 'Go to advanced search', 'SEARCHED_FOR' => 'Search term used', 'SEARCHED_TOPIC' => 'Searched topic', diff --git a/phpBB/language/en/search_ignore_words.php b/phpBB/language/en/search_ignore_words.php index afdbe6eecb..3db209d120 100644 --- a/phpBB/language/en/search_ignore_words.php +++ b/phpBB/language/en/search_ignore_words.php @@ -1,11 +1,13 @@ <?php /** * -* search_ignore_words [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/search_synonyms.php b/phpBB/language/en/search_synonyms.php index 18f938258c..6a8c257f0b 100644 --- a/phpBB/language/en/search_synonyms.php +++ b/phpBB/language/en/search_synonyms.php @@ -1,11 +1,13 @@ <?php /** * -* search_synonyms [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 6f392d6efe..6063f71d98 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -1,11 +1,13 @@ <?php /** * -* ucp [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -38,12 +40,12 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s†(hereinafter “weâ€, “usâ€, “ourâ€, “%1$sâ€, “%2$sâ€), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$sâ€. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s†after changes mean you agree to be legally bound by these terms as they are updated and/or amended.<br /> <br /> - Our forums are powered by phpBB (hereinafter “theyâ€, “themâ€, “theirâ€, “phpBB softwareâ€, “www.phpbb.comâ€, “phpBB Groupâ€, “phpBB Teamsâ€) which is a bulletin board solution released under the “<a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>†(hereinafter “GPLâ€) and can be downloaded from <a href="https://www.phpbb.com/">www.phpbb.com</a>. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: <a href="https://www.phpbb.com/">https://www.phpbb.com/</a>.<br /> + Our forums are powered by phpBB (hereinafter “theyâ€, “themâ€, “theirâ€, “phpBB softwareâ€, “www.phpbb.comâ€, “phpBB Limitedâ€, “phpBB Teamsâ€) which is a bulletin board solution released under the “<a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>†(hereinafter “GPLâ€) and can be downloaded from <a href="https://www.phpbb.com/">www.phpbb.com</a>. The phpBB software only facilitates internet based discussions; phpBB Limited is not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: <a href="https://www.phpbb.com/">https://www.phpbb.com/</a>.<br /> <br /> You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s†is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s†have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s†nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised. ', - 'PRIVACY_POLICY' => 'This policy explains in detail how “%1$s†along with its affiliated companies (hereinafter “weâ€, “usâ€, “ourâ€, “%1$sâ€, “%2$sâ€) and phpBB (hereinafter “theyâ€, “themâ€, “theirâ€, “phpBB softwareâ€, “www.phpbb.comâ€, “phpBB Groupâ€, “phpBB Teamsâ€) use any information collected during any session of usage by you (hereinafter “your informationâ€).<br /> + 'PRIVACY_POLICY' => 'This policy explains in detail how “%1$s†along with its affiliated companies (hereinafter “weâ€, “usâ€, “ourâ€, “%1$sâ€, “%2$sâ€) and phpBB (hereinafter “theyâ€, “themâ€, “theirâ€, “phpBB softwareâ€, “www.phpbb.comâ€, “phpBB Limitedâ€, “phpBB Teamsâ€) use any information collected during any session of usage by you (hereinafter “your informationâ€).<br /> <br /> Your information is collected via two ways. Firstly, by browsing “%1$s†will cause the phpBB software to create a number of cookies, which are small text files that are downloaded on to your computer’s web browser temporary files. The first two cookies just contain a user identifier (hereinafter “user-idâ€) and an anonymous session identifier (hereinafter “session-idâ€), automatically assigned to you by the phpBB software. A third cookie will be created once you have browsed topics within “%1$s†and is used to store which topics have been read, thereby improving your user experience.<br /> <br /> @@ -205,10 +207,20 @@ $lang = array_merge($lang, array( ), 'FIELD_TOO_SMALL' => 'The value of “%2$s†is too small, a minimum value of %1$d is required.', 'FIELD_TOO_LARGE' => 'The value of “%2$s†is too large, a maximum value of %1$d is allowed.', + 'FIELD_INVALID_CHARS_INVALID' => 'The field “%s†has invalid characters.', 'FIELD_INVALID_CHARS_NUMBERS_ONLY' => 'The field “%s†has invalid characters, only numbers are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_DOTS' => 'The field “%s†has invalid characters, only alphanumeric or . characters are allowed.', 'FIELD_INVALID_CHARS_ALPHA_ONLY' => 'The field “%s†has invalid characters, only alphanumeric characters are allowed.', - 'FIELD_INVALID_CHARS_SPACERS_ONLY' => 'The field “%s†has invalid characters, only alphanumeric, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_PUNCTUATION' => 'The field “%s†has invalid characters, only alphanumeric or _,-. characters are allowed and the first character must be alphabetic.', + 'FIELD_INVALID_CHARS_ALPHA_SPACERS' => 'The field “%s†has invalid characters, only alphanumeric, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_UNDERSCORE' => 'The field “%s†has invalid characters, only alphanumeric or _ characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_DOTS' => 'The field “%s†has invalid characters, only letter, number or . characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_ONLY' => 'The field “%s†has invalid characters, only letter and number characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_PUNCTUATION' => 'The field “%s†has invalid characters, only letter, number or _,-. characters are allowed and the first character must be alphabetic.', + 'FIELD_INVALID_CHARS_LETTER_NUM_SPACERS' => 'The field “%s†has invalid characters, only letter, number, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_UNDERSCORE' => 'The field “%s†has invalid characters, only letter, number or _ characters are allowed.', 'FIELD_INVALID_DATE' => 'The field “%s†has an invalid date.', + 'FIELD_INVALID_URL' => 'The field “%s†has an invalid url.', 'FIELD_INVALID_VALUE' => 'The field “%s†has an invalid value.', 'FOE_MESSAGE' => 'Message from foe', @@ -216,8 +228,8 @@ $lang = array_merge($lang, array( 'FOES_UPDATED' => 'Your foes list has been updated successfully.', 'FOLDER_ADDED' => 'Folder successfully added.', 'FOLDER_MESSAGE_STATUS' => array( - 1 => '%2$d from %1$d message stored', - 2 => '%2$d from %1$d messages stored', + 1 => '%2$d out of %1$s stored', + 2 => '%2$d out of %1$s stored', ), 'FOLDER_NAME_EMPTY' => 'You must enter a name for this folder.', 'FOLDER_NAME_EXIST' => 'Folder <strong>%s</strong> already exists.', @@ -225,8 +237,8 @@ $lang = array_merge($lang, array( 'FOLDER_RENAMED' => 'Folder successfully renamed.', 'FOLDER_REMOVED' => 'Folder successfully removed.', 'FOLDER_STATUS_MSG' => array( - 1 => 'Folder is %3$d%% full (%2$d from %1$d message stored)', - 2 => 'Folder is %3$d%% full (%2$d from %1$d messages stored)', + 1 => 'Folder is %3$d%% full (%2$d out of %1$s stored)', + 2 => 'Folder is %3$d%% full (%2$d out of %1$s stored)', ), 'FORWARD_PM' => 'Forward PM', 'FORCE_PASSWORD_EXPLAIN' => 'Before you may continue browsing the board you are required to change your password.', @@ -297,7 +309,8 @@ $lang = array_merge($lang, array( 'MOVE_DOWN' => 'Move down', 'MOVE_MARKED_TO_FOLDER' => 'Move marked to %s', 'MOVE_PM_ERROR' => array( - 2 => 'An error occurred while moving the messages to the new folder, only %2d from %1d messages were moved.', + 1 => 'An error occurred while moving the messages to the new folder, only %2$d out of %1$s was moved.', + 2 => 'An error occurred while moving the messages to the new folder, only %2$d out of %1$s were moved.', ), 'MOVE_TO_FOLDER' => 'Move to folder', 'MOVE_UP' => 'Move up', @@ -314,19 +327,20 @@ $lang = array_merge($lang, array( 'NOTIFICATION_GROUP_MODERATION' => 'Moderation Notifications', 'NOTIFICATION_GROUP_ADMINISTRATION' => 'Administration Notifications', 'NOTIFICATION_GROUP_POSTING' => 'Posting Notifications', + 'NOTIFICATION_METHOD_BOARD' => 'Notifications', 'NOTIFICATION_METHOD_EMAIL' => 'Email', 'NOTIFICATION_METHOD_JABBER' => 'Jabber', 'NOTIFICATION_TYPE' => 'Notification type', 'NOTIFICATION_TYPE_BOOKMARK' => 'Someone replies to a topic you have bookmarked', 'NOTIFICATION_TYPE_GROUP_REQUEST' => 'Someone requests to join a group you lead', 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE' => 'A post or topic needs approval', - 'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator', + 'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator', 'NOTIFICATION_TYPE_PM' => 'Someone sends you a private message', 'NOTIFICATION_TYPE_POST' => 'Someone replies to a topic to which you are subscribed', 'NOTIFICATION_TYPE_QUOTE' => 'Someone quotes you in a post', 'NOTIFICATION_TYPE_REPORT' => 'Someone reports a post', - 'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed', - 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'Newly registered user requiring activation', + 'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed', + 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'User requiring activation', 'NOTIFY_METHOD' => 'Notification method', 'NOTIFY_METHOD_BOTH' => 'Both', @@ -351,6 +365,7 @@ $lang = array_merge($lang, array( ), 'NO_ACTION_MODE' => 'No message action specified.', 'NO_AUTHOR' => 'No author defined for this message', + 'NO_AVATAR' => 'No avatar selected', 'NO_AVATAR_CATEGORY' => 'None', 'NO_AUTH_DELETE_MESSAGE' => 'You are not authorised to delete private messages.', @@ -403,11 +418,15 @@ $lang = array_merge($lang, array( 'PM_FROM_REMOVED_AUTHOR' => 'This message was sent by a user no longer registered.', 'PM_ICON' => 'PM icon', 'PM_INBOX' => 'Inbox', + 'PM_MARK_ALL_READ' => 'Mark all messages read', + 'PM_MARK_ALL_READ_SUCCESS' => 'All private messages in this folder have been marked read', 'PM_NO_USERS' => 'The requested users to be added do not exist.', 'PM_OUTBOX' => 'Outbox', 'PM_SENTBOX' => 'Sent messages', 'PM_SUBJECT' => 'Message subject', 'PM_TO' => 'Send to', + 'PM_TOOLS' => 'Message tools', + 'PM_USERS_REMOVED_NO_PERMISSION' => 'Some users couldn’t be added as they do not have permission to read private messages.', 'PM_USERS_REMOVED_NO_PM' => 'Some users couldn’t be added as they have disabled private message receipt.', 'POST_EDIT_PM' => 'Edit message', 'POST_FORWARD_PM' => 'Forward message', @@ -472,14 +491,17 @@ $lang = array_merge($lang, array( 'TIMEZONE' => 'Timezone', 'TIMEZONE_DATE_SUGGESTION' => 'Suggestion: %s', 'TIMEZONE_INVALID' => 'The timezone you selected is invalid.', - 'TO' => 'To', + 'TO' => 'Recipient', + 'TO_MASS' => 'Recipients', + 'TO_ADD' => 'Add recipient', + 'TO_ADD_MASS' => 'Add recipients', + 'TO_ADD_GROUPS' => 'Add groups', 'TOO_MANY_RECIPIENTS' => 'You tried to send a private message to too many recipients.', 'TOO_MANY_REGISTERS' => 'You have exceeded the maximum number of registration attempts for this session. Please try again later.', 'UCP' => 'User Control Panel', 'UCP_ACTIVATE' => 'Activate account', 'UCP_ADMIN_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. The administrator will review your account and if approved you will receive an email at the address you specified.', - 'UCP_AIM' => 'AOL Instant Messenger', 'UCP_ATTACHMENTS' => 'Attachments', 'UCP_AUTH_LINK' => 'External accounts', 'UCP_AUTH_LINK_ASK' => 'You currently have no account associated with this external service. Click the button below to link your board account to an account with this external service.', @@ -492,7 +514,6 @@ $lang = array_merge($lang, array( 'UCP_COPPA_BEFORE' => 'Before %s', 'UCP_COPPA_ON_AFTER' => 'On or after %s', 'UCP_EMAIL_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. You will receive an email at the address you provide that contains an account activation link.', - 'UCP_ICQ' => 'ICQ number', 'UCP_JABBER' => 'Jabber address', 'UCP_LOGIN_LINK' => 'Set up an external account association', @@ -503,7 +524,6 @@ $lang = array_merge($lang, array( 'UCP_MAIN_FRONT' => 'Front page', 'UCP_MAIN_SUBSCRIBED' => 'Manage subscriptions', - 'UCP_MSNM' => 'Windows Live Messenger', 'UCP_NO_ATTACHMENTS' => 'You have posted no files.', 'UCP_NOTIFICATION_LIST' => 'Manage notifications', @@ -539,7 +559,6 @@ $lang = array_merge($lang, array( 'UCP_REMIND' => 'Send password', 'UCP_RESEND' => 'Send activation email', 'UCP_WELCOME' => 'Welcome to the User Control Panel. From here you can monitor, view and update your profile, preferences, subscribed forums and topics. You can also send messages to other users (if permitted). Please ensure you read any announcements before continuing.', - 'UCP_YIM' => 'Yahoo Messenger', 'UCP_ZEBRA' => 'Friends & Foes', 'UCP_ZEBRA_FOES' => 'Manage foes', 'UCP_ZEBRA_FRIENDS' => 'Manage friends', @@ -573,6 +592,7 @@ $lang = array_merge($lang, array( ), 'VIEW_PREVIOUS_HISTORY' => 'Previous PM in history', 'VIEW_PREVIOUS_PM' => 'Previous PM', + 'VIEW_PROFILE' => 'View profile', 'VIEW_SIGS' => 'Display signatures', 'VIEW_SMILIES' => 'Display smilies as images', 'VIEW_TOPICS_DAYS' => 'Display topics from previous days', @@ -598,14 +618,14 @@ $lang = array_merge($lang, array( 'PLACE_INTO_FOLDER' => 'Place into folder', 'MARK_AS_READ' => 'Mark as read', 'MARK_AS_IMPORTANT' => 'Mark message', - 'DELETE_MESSAGE' => 'Delete message' + 'DELETE_MESSAGE' => 'Delete message', ), 'PM_CHECK' => array( 'SUBJECT' => 'Subject', 'SENDER' => 'Sender', 'MESSAGE' => 'Message', 'STATUS' => 'Message status', - 'TO' => 'Sent To' + 'TO' => 'Sent To', ), 'PM_RULE' => array( 'IS_LIKE' => 'is like', @@ -621,10 +641,9 @@ $lang = array_merge($lang, array( 'ANSWERED' => 'answered', 'FORWARDED' => 'forwarded', 'TO_GROUP' => 'to my default usergroup', - 'TO_ME' => 'to me' + 'TO_ME' => 'to me', ), - 'GROUPS_EXPLAIN' => 'Usergroups enable board admins to better administer users. By default you will be placed in a specific group, this is your default group. This group defines how you may appear to other users, for example your username colouration, avatar, rank, etc. Depending on whether the administrator allows it you may be allowed to change your default group. You may also be placed in or allowed to join other groups. Some groups may give you additional permissions to view content or increase your capabilities in other areas.', 'GROUP_LEADER' => 'Leaderships', 'GROUP_MEMBER' => 'Memberships', diff --git a/phpBB/language/en/viewforum.php b/phpBB/language/en/viewforum.php index 1dee5d2e57..9946a3eda4 100644 --- a/phpBB/language/en/viewforum.php +++ b/phpBB/language/en/viewforum.php @@ -1,11 +1,13 @@ <?php /** * -* viewforum [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php index 424cb9da3e..5890eecdb6 100644 --- a/phpBB/language/en/viewtopic.php +++ b/phpBB/language/en/viewtopic.php @@ -1,11 +1,13 @@ <?php /** * -* viewtopic [English] +* This file is part of the phpBB Forum Software package. * -* @package language -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -58,7 +60,7 @@ $lang = array_merge($lang, array( 1 => 'Last edited by %2$s on %3$s, edited %1$d time in total.', 2 => 'Last edited by %2$s on %3$s, edited %1$d times in total.', ), - 'EMAIL_TOPIC' => 'Email friend', + 'EMAIL_TOPIC' => 'Email topic', 'ERROR_NO_ATTACHMENT' => 'The selected attachment does not exist anymore.', 'FILE_NOT_FOUND_404' => 'The file <strong>%s</strong> does not exist.', @@ -118,7 +120,6 @@ $lang = array_merge($lang, array( 2 => '%d posts', ), 'VIEW_UNREAD_POST' => 'First unread post', - 'VISIT_WEBSITE' => 'WWW', 'VOTE_SUBMITTED' => 'Your vote has been cast.', 'VOTE_CONVERTED' => 'Changing votes is not supported for converted polls.', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 313b24b6f1..a5fa09ba2b 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -1,9 +1,13 @@ <?php /** * -* @package mcp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,6 +19,7 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +include($phpbb_root_path . 'includes/functions_mcp.' . $phpEx); require($phpbb_root_path . 'includes/functions_module.' . $phpEx); // Start session management @@ -28,10 +33,10 @@ $module = new p_master(); $template->assign_var('S_IN_MCP', true); // Basic parameter data -$id = request_var('i', ''); +$id = $request->variable('i', ''); -$mode = request_var('mode', array('')); -$mode = sizeof($mode) ? array_shift($mode) : request_var('mode', ''); +$mode = $request->variable('mode', array('')); +$mode = sizeof($mode) ? array_shift($mode) : $request->variable('mode', ''); // Only Moderators can go beyond this point if (!$user->data['is_registered']) @@ -45,10 +50,10 @@ if (!$user->data['is_registered']) } $quickmod = (isset($_REQUEST['quickmod'])) ? true : false; -$action = request_var('action', ''); -$action_ary = request_var('action', array('' => 0)); +$action = $request->variable('action', ''); +$action_ary = $request->variable('action', array('' => 0)); -$forum_action = request_var('forum_action', ''); +$forum_action = $request->variable('forum_action', ''); if ($forum_action !== '' && $request->variable('sort', false, false, \phpbb\request\request_interface::POST)) { $action = $forum_action; @@ -66,12 +71,12 @@ if ($mode == 'topic_logs') $quickmod = false; } -$post_id = request_var('p', 0); -$topic_id = request_var('t', 0); -$forum_id = request_var('f', 0); -$report_id = request_var('r', 0); -$user_id = request_var('u', 0); -$username = utf8_normalize_nfc(request_var('username', '', true)); +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$forum_id = $request->variable('f', 0); +$report_id = $request->variable('r', 0); +$user_id = $request->variable('u', 0); +$username = $request->variable('username', '', true); if ($post_id) { @@ -106,14 +111,14 @@ if (!$auth->acl_getf_global('m_')) 'lock' => 'f_user_lock', 'make_sticky' => 'f_sticky', 'make_announce' => 'f_announce', - 'make_global' => 'f_announce', - 'make_normal' => array('f_announce', 'f_sticky') + 'make_global' => 'f_announce_global', + 'make_normal' => array('f_announce', 'f_announce_global', 'f_sticky') ); $allow_user = false; if ($quickmod && isset($user_quickmod_actions[$action]) && $user->data['is_registered'] && $auth->acl_gets($user_quickmod_actions[$action], $forum_id)) { - $topic_info = get_topic_data(array($topic_id)); + $topic_info = phpbb_get_topic_data(array($topic_id)); if ($topic_info[$topic_id]['topic_poster'] == $user->data['user_id']) { $allow_user = true; @@ -132,6 +137,28 @@ if ($forum_id && !$auth->acl_get('f_read', $forum_id)) trigger_error('NOT_AUTHORISED'); } +/** +* Allow applying additional permissions to MCP access besides f_read +* +* @event core.mcp_global_f_read_auth_after +* @var string action The action the user tried to execute +* @var int forum_id The forum the user tried to access +* @var string mode The MCP module the user is trying to access +* @var p_master module Module system class +* @var bool quickmod True if the user is accessing using quickmod tools +* @var int topic_id The topic the user tried to access +* @since 3.1.3-RC1 +*/ +$vars = array( + 'action', + 'forum_id', + 'mode', + 'module', + 'quickmod', + 'topic_id', +); +extract($phpbb_dispatcher->trigger_event('core.mcp_global_f_read_auth_after', compact($vars))); + if ($forum_id) { $module->acl_forum_id = $forum_id; @@ -165,7 +192,7 @@ if ($quickmod) case 'topic_logs': // Reset start parameter if we jumped from the quickmod dropdown - if (request_var('start', 0)) + if ($request->variable('start', 0)) { $request->overwrite('start', 0); } @@ -186,7 +213,7 @@ if ($quickmod) // If needed, the flag can be set to true within event listener // to indicate that the action was handled properly // and to pass by the trigger_error() call below - $break = false; + $is_valid_action = false; /** * This event allows you to add custom quickmod options @@ -194,12 +221,13 @@ if ($quickmod) * @event core.modify_quickmod_options * @var object module Instance of module system class * @var string action Quickmod option - * @var bool break Flag indicating if the action was handled properly + * @var bool is_valid_action Flag indicating if the action was handled properly * @since 3.1.0-a4 */ - extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_options', compact(array('module', 'action', 'break')))); + $vars = array('module', 'action', 'is_valid_action'); + extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_options', compact($vars))); - if (!$break) + if (!$is_valid_action) { trigger_error($user->lang('QUICKMOD_ACTION_NOT_ALLOWED', $action), E_USER_ERROR); } @@ -252,6 +280,32 @@ if (!$user_id && $username == '') $module->set_display('warn', 'warn_user', false); } +/** +* This event allows you to set display option for custom MCP modules +* +* @event core.modify_mcp_modules_display_option +* @var p_master module Module system class +* @var string mode MCP mode +* @var int user_id User id +* @var int forum_id Forum id +* @var int topic_id Topic id +* @var int post_id Post id +* @var string username User name +* @var int id Parent module id +* @since 3.1.0-b2 +*/ +$vars = array( + 'module', + 'mode', + 'user_id', + 'forum_id', + 'topic_id', + 'post_id', + 'username', + 'id', +); +extract($phpbb_dispatcher->trigger_event('core.modify_mcp_modules_display_option', compact($vars))); + // Load and execute the relevant module $module->load_active(); @@ -267,650 +321,4 @@ $template->assign_vars(array( )); // Generate the page, do not display/query online list -$module->display($module->get_page_title(), false); - -/** -* Functions used to generate additional URL paramters -*/ -function _module__url($mode, &$module_row) -{ - return extra_url(); -} - -function _module_notes_url($mode, &$module_row) -{ - if ($mode == 'front') - { - return ''; - } - - global $user_id; - return ($user_id) ? "&u=$user_id" : ''; -} - -function _module_warn_url($mode, &$module_row) -{ - if ($mode == 'front' || $mode == 'list') - { - global $forum_id; - - return ($forum_id) ? "&f=$forum_id" : ''; - } - - if ($mode == 'warn_post') - { - global $forum_id, $post_id; - - $url_extra = ($forum_id) ? "&f=$forum_id" : ''; - $url_extra .= ($post_id) ? "&p=$post_id" : ''; - - return $url_extra; - } - else - { - global $user_id; - - return ($user_id) ? "&u=$user_id" : ''; - } -} - -function _module_main_url($mode, &$module_row) -{ - return extra_url(); -} - -function _module_logs_url($mode, &$module_row) -{ - return extra_url(); -} - -function _module_ban_url($mode, &$module_row) -{ - return extra_url(); -} - -function _module_queue_url($mode, &$module_row) -{ - return extra_url(); -} - -function _module_reports_url($mode, &$module_row) -{ - return extra_url(); -} - -function extra_url() -{ - global $forum_id, $topic_id, $post_id, $report_id, $user_id; - - $url_extra = ''; - $url_extra .= ($forum_id) ? "&f=$forum_id" : ''; - $url_extra .= ($topic_id) ? "&t=$topic_id" : ''; - $url_extra .= ($post_id) ? "&p=$post_id" : ''; - $url_extra .= ($user_id) ? "&u=$user_id" : ''; - $url_extra .= ($report_id) ? "&r=$report_id" : ''; - - return $url_extra; -} - -/** -* Get simple topic data -*/ -function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) -{ - global $auth, $db, $config, $user; - static $rowset = array(); - - $topics = array(); - - if (!sizeof($topic_ids)) - { - return array(); - } - - // cache might not contain read tracking info, so we can't use it if read - // tracking information is requested - if (!$read_tracking) - { - $cache_topic_ids = array_intersect($topic_ids, array_keys($rowset)); - $topic_ids = array_diff($topic_ids, array_keys($rowset)); - } - else - { - $cache_topic_ids = array(); - } - - if (sizeof($topic_ids)) - { - $sql_array = array( - 'SELECT' => 't.*, f.*', - - 'FROM' => array( - TOPICS_TABLE => 't', - ), - - 'LEFT_JOIN' => array( - array( - 'FROM' => array(FORUMS_TABLE => 'f'), - 'ON' => 'f.forum_id = t.forum_id' - ) - ), - - 'WHERE' => $db->sql_in_set('t.topic_id', $topic_ids) - ); - - if ($read_tracking && $config['load_db_lastread']) - { - $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; - - $sql_array['LEFT_JOIN'][] = array( - 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), - 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' - ); - - $sql_array['LEFT_JOIN'][] = array( - 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' - ); - } - - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $rowset[$row['topic_id']] = $row; - - if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) - { - continue; - } - - $topics[$row['topic_id']] = $row; - } - $db->sql_freeresult($result); - } - - foreach ($cache_topic_ids as $id) - { - if (!$acl_list || $auth->acl_gets($acl_list, $rowset[$id]['forum_id'])) - { - $topics[$id] = $rowset[$id]; - } - } - - return $topics; -} - -/** -* Get simple post data -*/ -function get_post_data($post_ids, $acl_list = false, $read_tracking = false) -{ - global $db, $auth, $config, $user; - - $rowset = array(); - - if (!sizeof($post_ids)) - { - return array(); - } - - $sql_array = array( - 'SELECT' => 'p.*, u.*, t.*, f.*', - - 'FROM' => array( - USERS_TABLE => 'u', - POSTS_TABLE => 'p', - TOPICS_TABLE => 't', - ), - - 'LEFT_JOIN' => array( - array( - 'FROM' => array(FORUMS_TABLE => 'f'), - 'ON' => 'f.forum_id = t.forum_id' - ) - ), - - 'WHERE' => $db->sql_in_set('p.post_id', $post_ids) . ' - AND u.user_id = p.poster_id - AND t.topic_id = p.topic_id', - ); - - if ($read_tracking && $config['load_db_lastread']) - { - $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; - - $sql_array['LEFT_JOIN'][] = array( - 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), - 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' - ); - - $sql_array['LEFT_JOIN'][] = array( - 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' - ); - } - - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query($sql); - unset($sql_array); - - while ($row = $db->sql_fetchrow($result)) - { - if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) - { - continue; - } - - if ($row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) - { - // Moderators without the permission to approve post should at least not see them. ;) - continue; - } - - $rowset[$row['post_id']] = $row; - } - $db->sql_freeresult($result); - - return $rowset; -} - -/** -* Get simple forum data -*/ -function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false) -{ - global $auth, $db, $user, $config, $phpbb_container; - - $rowset = array(); - - if (!is_array($forum_id)) - { - $forum_id = array($forum_id); - } - - if (!sizeof($forum_id)) - { - return array(); - } - - if ($read_tracking && $config['load_db_lastread']) - { - $read_tracking_join = ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' - AND ft.forum_id = f.forum_id)'; - $read_tracking_select = ', ft.mark_time'; - } - else - { - $read_tracking_join = $read_tracking_select = ''; - } - - $sql = "SELECT f.* $read_tracking_select - FROM " . FORUMS_TABLE . " f$read_tracking_join - WHERE " . $db->sql_in_set('f.forum_id', $forum_id); - $result = $db->sql_query($sql); - - $phpbb_content_visibility = $phpbb_container->get('content.visibility'); - - while ($row = $db->sql_fetchrow($result)) - { - if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) - { - continue; - } - - $row['forum_topics_approved'] = $phpbb_content_visibility->get_count('forum_topics', $row, $row['forum_id']); - - $rowset[$row['forum_id']] = $row; - } - $db->sql_freeresult($result); - - return $rowset; -} - -/** -* Get simple pm data -*/ -function get_pm_data($pm_ids) -{ - global $db, $auth, $config, $user; - - $rowset = array(); - - if (!sizeof($pm_ids)) - { - return array(); - } - - $sql_array = array( - 'SELECT' => 'p.*, u.*', - - 'FROM' => array( - USERS_TABLE => 'u', - PRIVMSGS_TABLE => 'p', - ), - - 'WHERE' => $db->sql_in_set('p.msg_id', $pm_ids) . ' - AND u.user_id = p.author_id', - ); - - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query($sql); - unset($sql_array); - - while ($row = $db->sql_fetchrow($result)) - { - $rowset[$row['msg_id']] = $row; - } - $db->sql_freeresult($result); - - return $rowset; -} - -/** -* sorting in mcp -* -* @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR -* -* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table -* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table -*/ -function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE') -{ - global $db, $user, $auth, $template; - - $sort_days = request_var('st', 0); - $min_time = ($sort_days) ? time() - ($sort_days * 86400) : 0; - - switch ($mode) - { - case 'viewforum': - $type = 'topics'; - $default_key = 't'; - $default_dir = 'd'; - - $sql = 'SELECT COUNT(topic_id) AS total - FROM ' . TOPICS_TABLE . " - $where_sql forum_id = $forum_id - AND topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ") - AND topic_last_post_time >= $min_time"; - - if (!$auth->acl_get('m_approve', $forum_id)) - { - $sql .= 'AND topic_visibility = ' . ITEM_APPROVED; - } - break; - - case 'viewtopic': - $type = 'posts'; - $default_key = 't'; - $default_dir = 'a'; - - $sql = 'SELECT COUNT(post_id) AS total - FROM ' . POSTS_TABLE . " - $where_sql topic_id = $topic_id - AND post_time >= $min_time"; - - if (!$auth->acl_get('m_approve', $forum_id)) - { - $sql .= 'AND post_visibility = ' . ITEM_APPROVED; - } - break; - - case 'unapproved_posts': - case 'deleted_posts': - $visibility_const = ($mode == 'unapproved_posts') ? ITEM_UNAPPROVED : ITEM_DELETED; - $type = 'posts'; - $default_key = 't'; - $default_dir = 'd'; - $where_sql .= ($topic_id) ? ' p.topic_id = ' . $topic_id . ' AND' : ''; - - $sql = 'SELECT COUNT(p.post_id) AS total - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - $where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' - AND p.post_visibility = ' . $visibility_const . ' - AND t.topic_id = p.topic_id - AND t.topic_visibility <> p.post_visibility'; - - if ($min_time) - { - $sql .= ' AND post_time >= ' . $min_time; - } - break; - - case 'unapproved_topics': - case 'deleted_topics': - $visibility_const = ($mode == 'unapproved_topics') ? ITEM_UNAPPROVED : ITEM_DELETED; - $type = 'topics'; - $default_key = 't'; - $default_dir = 'd'; - - $sql = 'SELECT COUNT(topic_id) AS total - FROM ' . TOPICS_TABLE . " - $where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . ' - AND topic_visibility = ' . $visibility_const; - - if ($min_time) - { - $sql .= ' AND topic_time >= ' . $min_time; - } - break; - - case 'pm_reports': - case 'pm_reports_closed': - case 'reports': - case 'reports_closed': - $pm = (strpos($mode, 'pm_') === 0) ? true : false; - - $type = ($pm) ? 'pm_reports' : 'reports'; - $default_key = 't'; - $default_dir = 'd'; - $limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : ''; - - if ($topic_id) - { - $where_sql .= ' p.topic_id = ' . $topic_id . ' AND '; - } - else if ($forum_id) - { - $where_sql .= ' p.forum_id = ' . $forum_id . ' AND '; - } - else if (!$pm) - { - $where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND '; - } - - if ($mode == 'reports' || $mode == 'pm_reports') - { - $where_sql .= ' r.report_closed = 0 AND '; - } - else - { - $where_sql .= ' r.report_closed = 1 AND '; - } - - if ($pm) - { - $sql = 'SELECT COUNT(r.report_id) AS total - FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . " p - $where_sql r.post_id = 0 - AND p.msg_id = r.pm_id - $limit_time_sql"; - } - else - { - $sql = 'SELECT COUNT(r.report_id) AS total - FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p - $where_sql r.pm_id = 0 - AND p.post_id = r.post_id - $limit_time_sql"; - } - break; - - case 'viewlogs': - $type = 'logs'; - $default_key = 't'; - $default_dir = 'd'; - - $sql = 'SELECT COUNT(log_id) AS total - FROM ' . LOG_TABLE . " - $where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_'))) . ' - AND log_time >= ' . $min_time . ' - AND log_type = ' . LOG_MOD; - break; - } - - $sort_key = request_var('sk', $default_key); - $sort_dir = request_var('sd', $default_dir); - $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); - - switch ($type) - { - case 'topics': - $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); - - $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views'); - $limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : ''; - break; - - case 'posts': - $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject'); - $limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : ''; - break; - - case 'reports': - $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject'); - break; - - case 'pm_reports': - $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.message_time', 't' => 'r.report_time', 's' => 'p.message_subject'); - break; - - case 'logs': - $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); - $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); - - $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); - $limit_time_sql = ($min_time) ? "AND l.log_time >= $min_time" : ''; - break; - } - - if (!isset($sort_by_sql[$sort_key])) - { - $sort_key = $default_key; - } - - $sort_order_sql = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - - $s_limit_days = $s_sort_key = $s_sort_dir = $sort_url = ''; - gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url); - - $template->assign_vars(array( - 'S_SELECT_SORT_DIR' => $s_sort_dir, - 'S_SELECT_SORT_KEY' => $s_sort_key, - 'S_SELECT_SORT_DAYS' => $s_limit_days) - ); - - if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts', 'deleted_topics', 'deleted_posts')) || $where_sql != 'WHERE') - { - $result = $db->sql_query($sql); - $total = (int) $db->sql_fetchfield('total'); - $db->sql_freeresult($result); - } - else - { - $total = -1; - } -} - -/** -* Validate ids -* -* @param array &$ids The relevant ids to check -* @param string $table The table to find the ids in -* @param string $sql_id The ids relevant column name -* @param array $acl_list A list of permissions the user need to have -* @param mixed $singe_forum Limit to one forum id (int) or the first forum found (true) -* -* @return mixed False if no ids were able to be retrieved, true if at least one id left. -* Additionally, this value can be the forum_id assigned if $single_forum was set. -* Therefore checking the result for with !== false is the best method. -*/ -function check_ids(&$ids, $table, $sql_id, $acl_list = false, $single_forum = false) -{ - global $db, $auth; - - if (!is_array($ids) || empty($ids)) - { - return false; - } - - $sql = "SELECT $sql_id, forum_id FROM $table - WHERE " . $db->sql_in_set($sql_id, $ids); - $result = $db->sql_query($sql); - - $ids = array(); - $forum_id = false; - - while ($row = $db->sql_fetchrow($result)) - { - if ($acl_list && $row['forum_id'] && !$auth->acl_gets($acl_list, $row['forum_id'])) - { - continue; - } - - if ($acl_list && !$row['forum_id'] && !$auth->acl_getf_global($acl_list)) - { - continue; - } - - // Limit forum? If not, just assign the id. - if ($single_forum === false) - { - $ids[] = $row[$sql_id]; - continue; - } - - // Limit forum to a specific forum id? - // This can get really tricky, because we do not want to create a failure on global topics. :) - if ($row['forum_id']) - { - if ($single_forum !== true && $row['forum_id'] == (int) $single_forum) - { - $forum_id = (int) $single_forum; - } - else if ($forum_id === false) - { - $forum_id = $row['forum_id']; - } - - if ($row['forum_id'] == $forum_id) - { - $ids[] = $row[$sql_id]; - } - } - else - { - // Always add a global topic - $ids[] = $row[$sql_id]; - } - } - $db->sql_freeresult($result); - - if (!sizeof($ids)) - { - return false; - } - - // If forum id is false and ids populated we may have only global announcements selected (returning 0 because of (int) $forum_id) - - return ($single_forum === false) ? true : (int) $forum_id; -} +$module->display($module->get_page_title()); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index e927429810..c23a409ae7 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,21 +20,38 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +$mode = $request->variable('mode', ''); + +if ($mode === 'contactadmin') +{ + define('SKIP_CHECK_BAN', true); + define('SKIP_CHECK_DISABLED', true); +} + // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(array('memberlist', 'groups')); +// Setting a variable to let the style designer know where he is... +$template->assign_var('S_IN_MEMBERLIST', true); + // Grab data -$mode = request_var('mode', ''); -$action = request_var('action', ''); -$user_id = request_var('u', ANONYMOUS); -$username = request_var('un', '', true); -$group_id = request_var('g', 0); -$topic_id = request_var('t', 0); +$action = $request->variable('action', ''); +$user_id = $request->variable('u', ANONYMOUS); +$username = $request->variable('un', '', true); +$group_id = $request->variable('g', 0); +$topic_id = $request->variable('t', 0); + +// Redirect when old mode is used +if ($mode == 'leaders') +{ + send_status_line(301, 'Moved Permanently'); + redirect(append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team')); +} // Check our mode... -if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'searchuser', 'leaders'))) +if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'contactadmin', 'searchuser', 'team', 'livesearch'))) { trigger_error('NO_MODE'); } @@ -38,8 +59,16 @@ if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'sear switch ($mode) { case 'email': + case 'contactadmin': break; + case 'livesearch': + if (!$config['allow_live_searches']) + { + trigger_error('LIVE_SEARCHES_NOT_ALLOWED'); + } + // No break + default: // Can this user view profiles/memberlist? if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) @@ -54,22 +83,25 @@ switch ($mode) break; } -$start = request_var('start', 0); +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + +$start = $request->variable('start', 0); $submit = (isset($_POST['submit'])) ? true : false; $default_key = 'c'; -$sort_key = request_var('sk', $default_key); -$sort_dir = request_var('sd', 'a'); +$sort_key = $request->variable('sk', $default_key); +$sort_dir = $request->variable('sd', 'a'); // What do you want to do today? ... oops, I think that line is taken ... switch ($mode) { - case 'leaders': + case 'team': // Display a listing of board admins, moderators include($phpbb_root_path . 'includes/functions_user.' . $phpEx); $page_title = $user->lang['THE_TEAM']; - $template_html = 'memberlist_leaders.html'; + $template_html = 'memberlist_team.html'; $sql = 'SELECT * FROM ' . TEAMPAGE_TABLE . ' @@ -107,7 +139,7 @@ switch ($mode) } else { - $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + $row['group_name'] = $group_helper->get_name($row['group_name']); $row['u_group'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']); } @@ -122,7 +154,7 @@ switch ($mode) $db->sql_freeresult($result); $sql_ary = array( - 'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id', + 'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_type, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id', 'FROM' => array( USER_GROUP_TABLE => 'ug', @@ -144,6 +176,22 @@ switch ($mode) 'ORDER_BY' => 'u.username_clean ASC', ); + /** + * Modify the query used to get the users for the team page + * + * @event core.memberlist_team_modify_query + * @var array sql_ary Array containing the query + * @var array group_ids Array of group ids + * @var array teampage_data The teampage data + * @since 3.1.3-RC1 + */ + $vars = array( + 'sql_ary', + 'group_ids', + 'teampage_data', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_query', compact($vars))); + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); $user_ary = $user_ids = $group_users = array(); @@ -254,21 +302,22 @@ switch ($mode) continue; } - $rank_title = $rank_img = $rank_img_src = ''; - get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($row, (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts'])); - $template->assign_block_vars('group.user', array( + $template_vars = array( 'USER_ID' => $row['user_id'], 'FORUMS' => $row['forums'], 'FORUM_OPTIONS' => (isset($row['forums_options'])) ? true : false, - 'RANK_TITLE' => $rank_title, + 'RANK_TITLE' => $user_rank_data['title'], 'GROUP_NAME' => $groups_ary[$row['default_group']]['group_name'], 'GROUP_COLOR' => $groups_ary[$row['default_group']]['group_colour'], 'U_GROUP' => $groups_ary[$row['default_group']]['u_group'], - 'RANK_IMG' => $rank_img, - 'RANK_IMG_SRC' => $rank_img_src, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], + + 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '', @@ -276,7 +325,25 @@ switch ($mode) 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), - )); + ); + + /** + * Modify the template vars for displaying the user in the groups on the teampage + * + * @event core.memberlist_team_modify_template_vars + * @var array template_vars Array containing the query + * @var array row Array containing the action user row + * @var array groups_ary Array of groups with all users that should be displayed + * @since 3.1.3-RC1 + */ + $vars = array( + 'template_vars', + 'row', + 'groups_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_template_vars', compact($vars))); + + $template->assign_block_vars('group.user', $template_vars); if ($config['teampage_memberships'] != 2) { @@ -305,20 +372,6 @@ switch ($mode) $presence_img = ''; switch ($action) { - case 'aim': - $lang = 'AIM'; - $sql_field = 'user_aim'; - $s_select = 'S_SEND_AIM'; - $s_action = ''; - break; - - case 'msnm': - $lang = 'MSNM'; - $sql_field = 'user_msnm'; - $s_select = 'S_SEND_MSNM'; - $s_action = ''; - break; - case 'jabber': $lang = 'JABBER'; $sql_field = 'user_jabber'; @@ -363,7 +416,7 @@ switch ($mode) include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], $config['server_name']); - $message = utf8_normalize_nfc(request_var('message', '', true)); + $message = $request->variable('message', '', true); if (empty($message)) { @@ -379,7 +432,7 @@ switch ($mode) $messenger->set_addresses($row); $messenger->assign_vars(array( - 'BOARD_CONTACT' => $config['board_contact'], + 'BOARD_CONTACT' => phpbb_get_board_contact($config, $phpEx), 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), 'TO_USERNAME' => htmlspecialchars_decode($row['username']), 'MESSAGE' => htmlspecialchars_decode($message)) @@ -402,9 +455,6 @@ switch ($mode) 'IM_CONTACT' => $row[$sql_field], 'A_IM_CONTACT' => addslashes($row[$sql_field]), - 'U_AIM_CONTACT' => ($action == 'aim') ? 'aim:addbuddy?screenname=' . urlencode($row[$sql_field]) : '', - 'U_AIM_MESSAGE' => ($action == 'aim') ? 'aim:goim?screenname=' . urlencode($row[$sql_field]) . '&message=' . urlencode($config['sitename']) : '', - 'USERNAME' => $row['username'], 'CONTACT_NAME' => $row[$sql_field], 'SITENAME' => $config['sitename'], @@ -491,20 +541,14 @@ switch ($mode) $group_data = $group_sort = array(); foreach ($profile_groups as $row) { - if ($row['group_type'] == GROUP_SPECIAL) - { - // Lookup group name in language dictionary - if (isset($user->lang['G_' . $row['group_name']])) - { - $row['group_name'] = $user->lang['G_' . $row['group_name']]; - } - } - else if (!$auth_hidden_groups && $row['group_type'] == GROUP_HIDDEN && !isset($user_groups[$row['group_id']])) + if (!$auth_hidden_groups && $row['group_type'] == GROUP_HIDDEN && !isset($user_groups[$row['group_id']])) { // Skip over hidden groups the user cannot see continue; } + $row['group_name'] = $group_helper->get_name($row['group_name']); + $group_sort[$row['group_id']] = utf8_clean_string($row['group_name']); $group_data[$row['group_id']] = $row; } @@ -565,8 +609,6 @@ switch ($mode) $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], $parse_flags, true); } - $poster_avatar = phpbb_get_user_avatar($member); - // We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links $zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false; @@ -591,36 +633,47 @@ switch ($mode) unset($module); } + // Custom Profile Fields + $profile_fields = array(); + if ($config['load_cpf_viewprofile']) + { + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + $profile_fields = $cp->grab_profile_fields_data($user_id); + $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields[$user_id]) : array(); + } + /** * Modify user data before we display the profile * * @event core.memberlist_view_profile * @var array member Array with user's data - * @var bool user_notes_enabled Is the mcp user notes module - * enabled? - * @var bool warn_user_enabled Is the mcp warnings module - * enabled? - * @var bool zebra_enabled Is the ucp zebra module - * enabled? - * @var bool friends_enabled Is the ucp friends module - * enabled? - * @var bool foes_enabled Is the ucp foes module - * enabled? - * @since 3.1-A1 + * @var bool user_notes_enabled Is the mcp user notes module enabled? + * @var bool warn_user_enabled Is the mcp warnings module enabled? + * @var bool zebra_enabled Is the ucp zebra module enabled? + * @var bool friends_enabled Is the ucp friends module enabled? + * @var bool foes_enabled Is the ucp foes module enabled? + * @var bool friend Is the user friend? + * @var bool foe Is the user foe? + * @var array profile_fields Array with user's profile field data + * @since 3.1.0-a1 + * @changed 3.1.0-b2 Added friend and foe status + * @changed 3.1.0-b3 Added profile fields data */ - $vars = array('member', 'user_notes_enabled', 'warn_user_enabled', 'zebra_enabled', 'friends_enabled', 'foes_enabled'); + $vars = array( + 'member', + 'user_notes_enabled', + 'warn_user_enabled', + 'zebra_enabled', + 'friends_enabled', + 'foes_enabled', + 'friend', + 'foe', + 'profile_fields', + ); extract($phpbb_dispatcher->trigger_event('core.memberlist_view_profile', compact($vars))); - $template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled)); - - // Custom Profile Fields - $profile_fields = array(); - if ($config['load_cpf_viewprofile']) - { - $cp = $phpbb_container->get('profilefields.manager'); - $profile_fields = $cp->generate_profile_fields_template('grab', $user_id); - $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array(); - } + $template->assign_vars(phpbb_show_profile($member, $user_notes_enabled, $warn_user_enabled)); // If the user has m_approve permission or a_user permission, then list then display unapproved posts if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) @@ -628,7 +681,7 @@ switch ($mode) $sql = 'SELECT COUNT(post_id) as posts_in_queue FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $user_id . ' - AND post_visibility = ' . ITEM_UNAPPROVED; + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); $result = $db->sql_query($sql); $member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); @@ -647,14 +700,9 @@ switch ($mode) 'SIGNATURE' => $member['user_sig'], 'POSTS_IN_QUEUE'=> $member['posts_in_queue'], - 'AVATAR_IMG' => $poster_avatar, 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), + 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $member['username']), 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), - 'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']), - 'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']), - 'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']), - 'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']), - 'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']), 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), @@ -667,6 +715,7 @@ switch ($mode) 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}&hash=" . generate_link_hash('switchperm')) : '', + 'U_EDIT_SELF' => ($user_id == $user->data['user_id'] && $auth->acl_get('u_chgprofileinfo')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '', 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, 'S_WARN_USER' => ($warn_user_enabled) ? true : false, @@ -675,6 +724,8 @@ switch ($mode) 'U_ADD_FOE' => (!$friend && !$foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_REMOVE_FRIEND' => ($friend && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', 'U_REMOVE_FOE' => ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '', + + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id, true, ''), )); if (!empty($profile_fields['row'])) @@ -728,265 +779,81 @@ switch ($mode) break; + case 'contactadmin': case 'email': - - // Send an email - $page_title = $user->lang['SEND_EMAIL']; - $template_html = 'memberlist_email.html'; - - add_form_key('memberlist_email'); - - if (!$config['email_enable']) + if (!class_exists('messenger')) { - trigger_error('EMAIL_DISABLED'); + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); } - if (!$auth->acl_get('u_sendemail')) - { - trigger_error('NO_EMAIL'); - } - - // Are we trying to abuse the facility? - if (time() - $user->data['user_emailtime'] < $config['flood_interval']) - { - trigger_error('FLOOD_EMAIL_LIMIT'); - } - - // Determine action... - $user_id = request_var('u', 0); - $topic_id = request_var('t', 0); + $user_id = $request->variable('u', 0); + $topic_id = $request->variable('t', 0); - // Send email to user... if ($user_id) { - if ($user_id == ANONYMOUS || !$config['board_email_form']) - { - trigger_error('NO_EMAIL'); - } - - // Get the appropriate username, etc. - $sql = 'SELECT username, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type - FROM ' . USERS_TABLE . " - WHERE user_id = $user_id - AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - trigger_error('NO_USER'); - } - - // Can we send email to this user? - if (!$row['user_allow_viewemail'] && !$auth->acl_get('a_user')) - { - trigger_error('NO_EMAIL'); - } + $form_name = 'user'; } else if ($topic_id) { - // Send topic heads-up to email address - $sql = 'SELECT forum_id, topic_title - FROM ' . TOPICS_TABLE . " - WHERE topic_id = $topic_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$row) - { - trigger_error('NO_TOPIC'); - } - - if ($row['forum_id']) - { - if (!$auth->acl_get('f_read', $row['forum_id'])) - { - trigger_error('SORRY_AUTH_READ'); - } - - if (!$auth->acl_get('f_email', $row['forum_id'])) - { - trigger_error('NO_EMAIL'); - } - } - else - { - // If global announcement, we need to check if the user is able to at least read and email in one forum... - if (!$auth->acl_getf_global('f_read')) - { - trigger_error('SORRY_AUTH_READ'); - } - - if (!$auth->acl_getf_global('f_email')) - { - trigger_error('NO_EMAIL'); - } - } + $form_name = 'topic'; + } + else if ($mode === 'contactadmin') + { + $form_name = 'admin'; } else { trigger_error('NO_EMAIL'); } - $error = array(); + /** @var $form \phpbb\message\form */ + $form = $phpbb_container->get('message.form.' . $form_name); - $name = utf8_normalize_nfc(request_var('name', '', true)); - $email = request_var('email', ''); - $email_lang = request_var('lang', $config['default_lang']); - $subject = utf8_normalize_nfc(request_var('subject', '', true)); - $message = utf8_normalize_nfc(request_var('message', '', true)); - $cc = (isset($_POST['cc_email'])) ? true : false; - $submit = (isset($_POST['submit'])) ? true : false; - - if ($submit) + $form->bind($request); + $error = $form->check_allow(); + if ($error) { - if (!check_form_key('memberlist_email')) - { - $error[] = 'FORM_INVALID'; - } - if ($user_id) - { - if (!$subject) - { - $error[] = $user->lang['EMPTY_SUBJECT_EMAIL']; - } - - if (!$message) - { - $error[] = $user->lang['EMPTY_MESSAGE_EMAIL']; - } - - $name = $row['username']; - $email_lang = $row['user_lang']; - $email = $row['user_email']; - } - else - { - if (!$email || !preg_match('/^' . get_preg_expression('email') . '$/i', $email)) - { - $error[] = $user->lang['EMPTY_ADDRESS_EMAIL']; - } - - if (!$name) - { - $error[] = $user->lang['EMPTY_NAME_EMAIL']; - } - } - - if (!sizeof($error)) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_emailtime = ' . time() . ' - WHERE user_id = ' . $user->data['user_id']; - $result = $db->sql_query($sql); - - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - $messenger = new messenger(false); - $email_tpl = ($user_id) ? 'profile_send_email' : 'email_notify'; - - $mail_to_users = array(); - - $mail_to_users[] = array( - 'email_lang' => $email_lang, - 'email' => $email, - 'name' => $name, - 'username' => ($user_id) ? $row['username'] : '', - 'to_name' => $name, - 'user_jabber' => ($user_id) ? $row['user_jabber'] : '', - 'user_notify_type' => ($user_id) ? $row['user_notify_type'] : NOTIFY_EMAIL, - 'topic_title' => (!$user_id) ? $row['topic_title'] : '', - 'forum_id' => (!$user_id) ? $row['forum_id'] : 0, - ); - - // Ok, now the same email if CC specified, but without exposing the users email address - if ($cc) - { - $mail_to_users[] = array( - 'email_lang' => $user->data['user_lang'], - 'email' => $user->data['user_email'], - 'name' => $user->data['username'], - 'username' => $user->data['username'], - 'to_name' => $name, - 'user_jabber' => $user->data['user_jabber'], - 'user_notify_type' => ($user_id) ? $user->data['user_notify_type'] : NOTIFY_EMAIL, - 'topic_title' => (!$user_id) ? $row['topic_title'] : '', - 'forum_id' => (!$user_id) ? $row['forum_id'] : 0, - ); - } - - foreach ($mail_to_users as $row) - { - $messenger->template($email_tpl, $row['email_lang']); - $messenger->replyto($user->data['user_email']); - $messenger->to($row['email'], $row['name']); - - if ($user_id) - { - $messenger->subject(htmlspecialchars_decode($subject)); - $messenger->im($row['user_jabber'], $row['username']); - $notify_type = $row['user_notify_type']; - } - else - { - $notify_type = NOTIFY_EMAIL; - } + trigger_error($error); + } - $messenger->anti_abuse_headers($config, $user); + if ($request->is_set_post('submit')) + { + $messenger = new messenger(false); + $form->submit($messenger); + } - $messenger->assign_vars(array( - 'BOARD_CONTACT' => $config['board_contact'], - 'TO_USERNAME' => htmlspecialchars_decode($row['to_name']), - 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), - 'MESSAGE' => htmlspecialchars_decode($message)) - ); + $page_title = $form->get_page_title(); + $template_html = $form->get_template_file(); + $form->render($template); - if ($topic_id) - { - $messenger->assign_vars(array( - 'TOPIC_NAME' => htmlspecialchars_decode($row['topic_title']), - 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=" . $row['forum_id'] . "&t=$topic_id") - ); - } + break; - $messenger->send($notify_type); - } + case 'livesearch': - meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); - $message = ($user_id) ? sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>') : sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$row['forum_id']}&t=$topic_id") . '">', '</a>'); - trigger_error($user->lang['EMAIL_SENT'] . '<br /><br />' . $message); - } - } + $username_chars = $request->variable('username', '', true); - if ($user_id) - { - $template->assign_vars(array( - 'S_SEND_USER' => true, - 'USERNAME' => $row['username'], + $sql = 'SELECT username, user_id, user_colour + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . ' + AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->get_any_char()); + $result = $db->sql_query_limit($sql, 10); + $user_list = array(); - 'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_BODY_EXPLAIN'], - 'S_POST_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id)) - ); - } - else + while ($row = $db->sql_fetchrow($result)) { - $template->assign_vars(array( - 'EMAIL' => $email, - 'NAME' => $name, - 'S_LANG_OPTIONS' => language_select($email_lang), - - 'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_TOPIC_EXPLAIN'], - 'S_POST_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&t=' . $topic_id)) + $user_list[] = array( + 'user_id' => (int) $row['user_id'], + 'result' => $row['username'], + 'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'display' => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']), ); } - - $template->assign_vars(array( - 'ERROR_MESSAGE' => (sizeof($error)) ? implode('<br />', $error) : '', - 'SUBJECT' => $subject, - 'MESSAGE' => $message, - ) - ); + $db->sql_freeresult($result); + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'keyword' => $username_chars, + 'results' => $user_list, + )); break; @@ -995,11 +862,19 @@ switch ($mode) // The basic memberlist $page_title = $user->lang['MEMBERLIST']; $template_html = 'memberlist_body.html'; + + /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); // Sorting - $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['JABBER']); - $sort_key_sql = array('a' => 'u.username_clean', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber'); + $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT']); + $sort_key_sql = array('a' => 'u.username_clean', 'c' => 'u.user_regdate', 'd' => 'u.user_posts'); + + if ($config['jab_enable']) + { + $sort_key_text['k'] = $user->lang['JABBER']; + $sort_key_sql['k'] = 'u.user_jabber'; + } if ($auth->acl_get('a_user')) { @@ -1037,36 +912,32 @@ switch ($mode) $sql_select = $sql_where_data = $sql_from = $sql_where = $order_by = ''; - $form = request_var('form', ''); - $field = request_var('field', ''); - $select_single = request_var('select_single', false); + $form = $request->variable('form', ''); + $field = $request->variable('field', ''); + $select_single = $request->variable('select_single', false); // Search URL parameters, if any of these are in the URL we do a search - $search_params = array('username', 'email', 'icq', 'aim', 'yahoo', 'msn', 'jabber', 'search_group_id', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'ip'); + $search_params = array('username', 'email', 'jabber', 'search_group_id', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'ip'); // We validate form and field here, only id/class allowed $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form; $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field; if ((($mode == '' || $mode == 'searchuser') || sizeof(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) { - $username = request_var('username', '', true); - $email = strtolower(request_var('email', '')); - $icq = request_var('icq', ''); - $aim = request_var('aim', ''); - $yahoo = request_var('yahoo', ''); - $msn = request_var('msn', ''); - $jabber = request_var('jabber', ''); - $search_group_id = request_var('search_group_id', 0); + $username = $request->variable('username', '', true); + $email = strtolower($request->variable('email', '')); + $jabber = $request->variable('jabber', ''); + $search_group_id = $request->variable('search_group_id', 0); // when using these, make sure that we actually have values defined in $find_key_match - $joined_select = request_var('joined_select', 'lt'); - $active_select = request_var('active_select', 'lt'); - $count_select = request_var('count_select', 'eq'); + $joined_select = $request->variable('joined_select', 'lt'); + $active_select = $request->variable('active_select', 'lt'); + $count_select = $request->variable('count_select', 'eq'); - $joined = explode('-', request_var('joined', '')); - $active = explode('-', request_var('active', '')); - $count = (request_var('count', '') !== '') ? request_var('count', 0) : ''; - $ipdomain = request_var('ip', ''); + $joined = explode('-', $request->variable('joined', '')); + $active = explode('-', $request->variable('active', '')); + $count = ($request->variable('count', '') !== '') ? $request->variable('count', 0) : ''; + $ipdomain = $request->variable('ip', ''); $find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); @@ -1093,13 +964,9 @@ switch ($mode) $s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; } - $sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : ''; - $sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : ''; - $sql_where .= ($icq) ? ' AND u.user_icq ' . $db->sql_like_expression(str_replace('*', $db->any_char, $icq)) . ' ' : ''; - $sql_where .= ($aim) ? ' AND u.user_aim ' . $db->sql_like_expression(str_replace('*', $db->any_char, $aim)) . ' ' : ''; - $sql_where .= ($yahoo) ? ' AND u.user_yim ' . $db->sql_like_expression(str_replace('*', $db->any_char, $yahoo)) . ' ' : ''; - $sql_where .= ($msn) ? ' AND u.user_msnm ' . $db->sql_like_expression(str_replace('*', $db->any_char, $msn)) . ' ' : ''; - $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->any_char, $jabber)) . ' ' : ''; + $sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : ''; + $sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : ''; + $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $jabber)) . ' ' : ''; $sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : ''; if (isset($find_key_match[$joined_select]) && sizeof($joined) == 3) @@ -1162,6 +1029,23 @@ switch ($mode) FROM ' . POSTS_TABLE . ' WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips) AND " . $db->sql_in_set('forum_id', $ip_forums); + + /** + * Modify sql query for members search by ip address / hostname + * + * @event core.memberlist_modify_ip_search_sql_query + * @var string ipdomain The host name + * @var string ips IP address list for the given host name + * @var string sql The SQL query for searching members by IP address + * @since 3.1.7-RC1 + */ + $vars = array( + 'ipdomain', + 'ips', + 'sql', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_ip_search_sql_query', compact($vars))); + $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -1187,18 +1071,18 @@ switch ($mode) } } - $first_char = request_var('first_char', ''); + $first_char = $request->variable('first_char', ''); if ($first_char == 'other') { for ($i = 97; $i < 123; $i++) { - $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->any_char); + $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->get_any_char()); } } else if ($first_char) { - $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->any_char); + $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->get_any_char()); } // Are we looking at a usergroup? If so, fetch additional info @@ -1206,7 +1090,7 @@ switch ($mode) if ($mode == 'group') { // We JOIN here to save a query for determining membership for hidden groups. ;) - $sql = 'SELECT g.*, ug.user_id + $sql = 'SELECT g.*, ug.user_id, ug.group_leader FROM ' . GROUPS_TABLE . ' g LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] . " AND ug.group_id = $group_id) WHERE g.group_id = $group_id"; @@ -1251,29 +1135,52 @@ switch ($mode) $avatar_img = phpbb_get_group_avatar($group_row); // ... same for group rank - $rank_title = $rank_img = $rank_img_src = ''; + $user_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); if ($group_row['group_rank']) { - get_user_rank($group_row['group_rank'], false, $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($group_row, false); - if ($rank_img) + if ($user_rank_data['img']) { - $rank_img .= '<br />'; + $user_rank_data['img'] .= '<br />'; } } + // include modules for manage groups link display or not + // need to ensure the module is active + $can_manage_group = false; + if ($user->data['is_registered'] && $group_row['group_leader']) + { + if (!class_exists('p_master')) + { + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); + } + $module = new p_master; + $module->list_modules('ucp'); + + if ($module->is_active('ucp_groups', 'manage')) + { + $can_manage_group = true; + } + unset($module); + } $template->assign_vars(array( 'GROUP_DESC' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), - 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], + 'GROUP_NAME' => $group_helper->get_name($group_row['group_name']), 'GROUP_COLOR' => $group_row['group_colour'], 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']], - 'GROUP_RANK' => $rank_title, + 'GROUP_RANK' => $user_rank_data['title'], 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, - 'RANK_IMG_SRC' => $rank_img_src, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], - 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '',) + 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '', + 'U_MANAGE' => ($can_manage_group) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_groups&mode=manage') : false,) ); $sql_select = ', ug.group_leader'; @@ -1298,6 +1205,32 @@ switch ($mode) $order_by .= ', u.user_posts DESC'; } + /** + * Modify sql query data for members search + * + * @event core.memberlist_modify_sql_query_data + * @var string order_by SQL ORDER BY clause condition + * @var string sort_dir The sorting direction + * @var string sort_key The sorting key + * @var array sort_key_sql Arraty with the sorting conditions data + * @var string sql_from SQL FROM clause condition + * @var string sql_select SQL SELECT fields list + * @var string sql_where SQL WHERE clause condition + * @var string sql_where_data SQL WHERE clause additional conditions data + * @since 3.1.7-RC1 + */ + $vars = array( + 'order_by', + 'sort_dir', + 'sort_key', + 'sort_key_sql', + 'sql_from', + 'sql_select', + 'sql_where', + 'sql_where_data', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_sql_query_data', compact($vars))); + // Count the users ... if ($sql_where) { @@ -1317,7 +1250,7 @@ switch ($mode) // Build a relevant pagination_url $params = $sort_params = array(); - // We do not use request_var() here directly to save some calls (not all variables are set) + // We do not use $request->variable() here directly to save some calls (not all variables are set) $check_params = array( 'g' => array('g', 0), 'sk' => array('sk', $default_key), @@ -1327,10 +1260,6 @@ switch ($mode) 'select_single' => array('select_single', $select_single), 'username' => array('username', '', true), 'email' => array('email', ''), - 'icq' => array('icq', ''), - 'aim' => array('aim', ''), - 'yahoo' => array('yahoo', ''), - 'msn' => array('msn', ''), 'jabber' => array('jabber', ''), 'search_group_id' => array('search_group_id', 0), 'joined_select' => array('joined_select', 'lt'), @@ -1338,7 +1267,7 @@ switch ($mode) 'count_select' => array('count_select', 'eq'), 'joined' => array('joined', ''), 'active' => array('active', ''), - 'count' => (request_var('count', '') !== '') ? array('count', 0) : array('count', ''), + 'count' => ($request->variable('count', '') !== '') ? array('count', 0) : array('count', ''), 'ip' => array('ip', ''), 'first_char' => array('first_char', ''), ); @@ -1351,7 +1280,7 @@ switch ($mode) continue; } - $param = call_user_func_array('request_var', $call); + $param = call_user_func_array(array($request, 'variable'), $call); $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param); $params[] = $param; @@ -1403,7 +1332,7 @@ switch ($mode) // Some search user specific data if (($mode == '' || $mode == 'searchuser') && ($config['load_search'] || $auth->acl_get('a_'))) { - $group_selected = request_var('search_group_id', 0); + $group_selected = $request->variable('search_group_id', 0); $s_group_select = '<option value="0"' . ((!$group_selected) ? ' selected="selected"' : '') . '> </option>'; $group_ids = array(); @@ -1447,7 +1376,7 @@ switch ($mode) while ($row = $db->sql_fetchrow($result)) { $group_ids[] = $row['group_id']; - $s_group_select .= '<option value="' . $row['group_id'] . '"' . (($group_selected == $row['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; + $s_group_select .= '<option value="' . $row['group_id'] . '"' . (($group_selected == $row['group_id']) ? ' selected="selected"' : '') . '>' . $group_helper->get_name($row['group_name']) . '</option>'; } $db->sql_freeresult($result); @@ -1459,10 +1388,6 @@ switch ($mode) $template->assign_vars(array( 'USERNAME' => $username, 'EMAIL' => $email, - 'ICQ' => $icq, - 'AIM' => $aim, - 'YAHOO' => $yahoo, - 'MSNM' => $msn, 'JABBER' => $jabber, 'JOINED' => implode('-', $joined), 'ACTIVE' => implode('-', $active), @@ -1471,6 +1396,7 @@ switch ($mode) 'S_IP_SEARCH_ALLOWED' => ($auth->acl_getf_global('m_info')) ? true : false, 'S_EMAIL_SEARCH_ALLOWED'=> ($auth->acl_get('a_user')) ? true : false, + 'S_JABBER_ENABLED' => $config['jab_enable'], 'S_IN_SEARCH_POPUP' => ($form && $field) ? true : false, 'S_SEARCH_USER' => ($mode == 'searchuser' || ($mode == '' && $submit)), 'S_FORM_NAME' => $form, @@ -1485,13 +1411,19 @@ switch ($mode) ); } + $user_types = array(USER_NORMAL, USER_FOUNDER); + if ($auth->acl_get('a_user')) + { + $user_types[] = USER_INACTIVE; + } + $start = $pagination->validate_start($start, $config['topics_per_page'], $config['num_users']); // Get us some users :D $sql = "SELECT u.user_id FROM " . USERS_TABLE . " u $sql_from - WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ") + WHERE " . $db->sql_in_set('u.user_type', $user_types) . " $sql_where ORDER BY $order_by"; $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); @@ -1506,6 +1438,7 @@ switch ($mode) // Load custom profile fields if ($config['load_cpf_memberlist']) { + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); $cp_row = $cp->generate_profile_fields_template_headlines('field_show_on_ml'); @@ -1566,7 +1499,7 @@ switch ($mode) if ($config['load_cpf_memberlist']) { // Grab all profile fields from users in id cache for later use - similar to the poster cache - $profile_fields_cache = $cp->generate_profile_fields_template('grab', $user_list); + $profile_fields_cache = $cp->grab_profile_fields_data($user_list); // Filter the fields we don't want to show foreach ($profile_fields_cache as $user_id => $user_profile_fields) @@ -1585,9 +1518,23 @@ switch ($mode) if ($sort_key == 'l') { // uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));")); - usort($user_list, '_sort_last_active'); + usort($user_list, 'phpbb_sort_last_active'); } + // do we need to display contact fields as such + $use_contact_fields = false; + + /** + * Modify list of users before member row is created + * + * @event core.memberlist_memberrow_before + * @var array user_list Array containing list of users + * @var bool use_contact_fields Should we display contact fields as such? + * @since 3.1.7-RC1 + */ + $vars = array('user_list', 'use_contact_fields'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_memberrow_before', compact($vars))); + for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) { $user_id = $user_list[$i]; @@ -1598,17 +1545,18 @@ switch ($mode) $cp_row = array(); if ($config['load_cpf_memberlist']) { - $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array(); + $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], $use_contact_fields) : array(); } - $memberrow = array_merge(show_profile($row), array( + $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array( 'ROW_NUMBER' => $i + ($start + 1), 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, 'S_GROUP_LEADER' => $is_leader, + 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, - 'U_VIEW_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id)) - ); + 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $row['username']), + )); if (isset($cp_row['row']) && sizeof($cp_row['row'])) { @@ -1638,28 +1586,19 @@ switch ($mode) 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']), 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), - 'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']), - 'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']), - 'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']), - 'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']), - 'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']), 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), 'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '', 'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser' || ($mode == '' && $submit)) ? $u_hide_find_member : '', + 'U_LIVE_SEARCH' => ($config['allow_live_searches']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=livesearch') : false, 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_WEBSITE' => $sort_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_ICQ' => $sort_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_AIM' => $sort_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_MSN' => $sort_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_YIM' => $sort_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '', - 'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd') : '', + 'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd'), 'S_SHOW_GROUP' => ($mode == 'group') ? true : false, 'S_VIEWONLINE' => $auth->acl_get('u_viewonline'), @@ -1671,7 +1610,7 @@ switch ($mode) } // Output the page -page_header($page_title, false); +page_header($page_title); $template->set_filenames(array( 'body' => $template_html) @@ -1679,152 +1618,3 @@ $template->set_filenames(array( make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); page_footer(); - -/** -* Prepare profile data -*/ -function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false) -{ - global $config, $auth, $template, $user, $phpEx, $phpbb_root_path, $phpbb_dispatcher; - - $username = $data['username']; - $user_id = $data['user_id']; - - $rank_title = $rank_img = $rank_img_src = ''; - get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src); - - if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user')) - { - $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']); - } - else - { - $email = ''; - } - - if ($config['load_onlinetrack']) - { - $update_time = $config['load_online_time'] * 60; - $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; - } - else - { - $online = false; - } - - if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) - { - $last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit']; - } - else - { - $last_visit = ''; - } - - $age = ''; - - if ($config['allow_birthdays'] && $data['user_birthday']) - { - list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday'])); - - if ($bday_year) - { - $now = $user->create_datetime(); - $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); - - $diff = $now['mon'] - $bday_month; - if ($diff == 0) - { - $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; - } - else - { - $diff = ($diff < 0) ? 1 : 0; - } - - $age = max(0, (int) ($now['year'] - $bday_year - $diff)); - } - } - - // Dump it out to the template - $template_data = array( - 'AGE' => $age, - 'RANK_TITLE' => $rank_title, - 'JOINED' => $user->format_date($data['user_regdate']), - 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit), - 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, - 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, - - 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), - 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), - 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), - 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), - - 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), - - 'AVATAR_IMG' => phpbb_get_user_avatar($data), - 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), - 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, - 'RANK_IMG' => $rank_img, - 'RANK_IMG_SRC' => $rank_img_src, - 'ICQ_STATUS_IMG' => (!empty($data['user_icq'])) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" />' : '', - 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, - - 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false, - - 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '', - 'U_NOTES' => ($user_notes_enabled && $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', - 'U_WARN' => ($warn_user_enabled && $auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', - 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '', - 'U_EMAIL' => $email, - 'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '', - 'U_SHORT_WWW' => (!empty($data['user_website'])) ? ((strlen($data['user_website']) > 55) ? substr($data['user_website'], 0, 39) . ' ... ' . substr($data['user_website'], -10) : $data['user_website']) : '', - 'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/' . urlencode($data['user_icq']) . '/' : '', - 'U_AIM' => ($data['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=aim&u=' . $user_id) : '', - 'U_YIM' => ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($data['user_yim']) . '&.src=pg' : '', - 'U_MSN' => ($data['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=msnm&u=' . $user_id) : '', - 'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '', - - 'USER_ICQ' => $data['user_icq'], - 'USER_AIM' => $data['user_aim'], - 'USER_YIM' => $data['user_yim'], - 'USER_MSN' => $data['user_msnm'], - 'USER_JABBER' => $data['user_jabber'], - 'USER_JABBER_IMG' => ($data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', - - 'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username), - ); - - /** - * Preparing a user's data before displaying it in profile and memberlist - * - * @event core.memberlist_prepare_profile_data - * @var array data Array with user's data - * @var array template_data Template array with user's data - * @since 3.1-A1 - */ - $vars = array('data', 'template_data'); - extract($phpbb_dispatcher->trigger_event('core.memberlist_prepare_profile_data', compact($vars))); - - return $template_data; -} - -function _sort_last_active($first, $second) -{ - global $id_cache, $sort_dir; - - $lesser_than = ($sort_dir === 'd') ? -1 : 1; - - if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader'])) - { - return -1; - } - else if (isset($id_cache[$second]['group_leader']) && (!isset($id_cache[$first]['group_leader']) || !$id_cache[$first]['group_leader']) && $id_cache[$second]['group_leader']) - { - return 1; - } - else - { - return $lesser_than * (int) ($id_cache[$first]['last_visit'] - $id_cache[$second]['last_visit']); - } -} diff --git a/phpBB/phpbb/attachment/delete.php b/phpBB/phpbb/attachment/delete.php new file mode 100644 index 0000000000..e093da8865 --- /dev/null +++ b/phpBB/phpbb/attachment/delete.php @@ -0,0 +1,432 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\attachment; + +use \phpbb\config\config; +use \phpbb\db\driver\driver_interface; +use \phpbb\event\dispatcher; +use \phpbb\filesystem\filesystem; + +/** + * Attachment delete class + */ +class delete +{ + /** @var config */ + protected $config; + + /** @var driver_interface */ + protected $db; + + /** @var \phpbb\event\dispatcher */ + protected $dispatcher; + + /** @var filesystem */ + protected $filesystem; + + /** @var resync */ + protected $resync; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var array Attachement IDs */ + protected $ids; + + /** @var string SQL ID string */ + private $sql_id; + + /** @var string SQL where string */ + private $sql_where = ''; + + /** @var int Number of deleted items */ + private $num_deleted; + + /** @var array Post IDs */ + private $post_ids = array(); + + /** @var array Message IDs */ + private $message_ids = array(); + + /** @var array Topic IDs */ + private $topic_ids = array(); + + /** @var array Info of physical file */ + private $physical = array(); + + /** + * Attachment delete class constructor + * + * @param config $config + * @param driver_interface $db + * @param dispatcher $dispatcher + * @param filesystem $filesystem + * @param resync $resync + * @param string $phpbb_root_path + */ + public function __construct(config $config, driver_interface $db, dispatcher $dispatcher, filesystem $filesystem, resync $resync, $phpbb_root_path) + { + $this->config = $config; + $this->db = $db; + $this->dispatcher = $dispatcher; + $this->filesystem = $filesystem; + $this->resync = $resync; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Delete Attachments + * + * @param string $mode can be: post|message|topic|attach|user + * @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids + * @param bool $resync set this to false if you are deleting posts or topics + * + * @return int|bool Number of deleted attachments or false if something + * went wrong during attachment deletion + */ + public function delete($mode, $ids, $resync = true) + { + if (!$this->set_attachment_ids($ids)) + { + return false; + } + + $this->set_sql_constraints($mode); + + /** + * Perform additional actions before collecting data for attachment(s) deletion + * + * @event core.delete_attachments_collect_data_before + * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user + * @var mixed ids Array or comma separated list of ids corresponding to the mode + * @var bool resync Flag indicating if posts/messages/topics should be synchronized + * @var string sql_id The field name to collect/delete data for depending on the mode + * @since 3.1.7-RC1 + */ + $vars = array( + 'mode', + 'ids', + 'resync', + 'sql_id', + ); + extract($this->dispatcher->trigger_event('core.delete_attachments_collect_data_before', compact($vars))); + + // Collect post and topic ids for later use if we need to touch remaining entries (if resync is enabled) + $this->collect_attachment_info($resync); + + // Delete attachments from database + $this->delete_attachments_from_db(); + + /** + * Perform additional actions after attachment(s) deletion from the database + * + * @event core.delete_attachments_from_database_after + * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user + * @var mixed ids Array or comma separated list of ids corresponding to the mode + * @var bool resync Flag indicating if posts/messages/topics should be synchronized + * @var string sql_id The field name to collect/delete data for depending on the mode + * @var array post_ids Array with post ids for deleted attachment(s) + * @var array topic_ids Array with topic ids for deleted attachment(s) + * @var array message_ids Array with private message ids for deleted attachment(s) + * @var array physical Array with deleted attachment(s) physical file(s) data + * @var int num_deleted The number of deleted attachment(s) from the database + * @since 3.1.7-RC1 + */ + $vars = array( + 'mode', + 'ids', + 'resync', + 'sql_id', + 'post_ids', + 'topic_ids', + 'message_ids', + 'physical', + 'num_deleted', + ); + extract($this->dispatcher->trigger_event('core.delete_attachments_from_database_after', compact($vars))); + + if (!$this->num_deleted) + { + return 0; + } + + // Delete attachments from filesystem + $this->remove_from_filesystem(); + + // If we do not resync, we do not need to adjust any message, post, topic or user entries + if (!$resync) + { + return $this->num_deleted; + } + + // No more use for the original ids + unset($ids); + + // Update post indicators for posts now no longer having attachments + $this->resync->resync('post', $this->post_ids); + + // Update message table if messages are affected + $this->resync->resync('message', $this->message_ids); + + // Now update the topics. This is a bit trickier, because there could be posts still having attachments within the topic + $this->resync->resync('topic', $this->topic_ids); + + return $this->num_deleted; + } + + /** + * Set attachment IDs + * + * @param mixed $ids ID or array of IDs + * + * @return bool True if attachment IDs were set, false if not + */ + protected function set_attachment_ids($ids) + { + // 0 is as bad as an empty array + if (empty($ids)) + { + return false; + } + + if (is_array($ids)) + { + $ids = array_unique($ids); + $this->ids = array_map('intval', $ids); + } + else + { + $this->ids = array((int) $ids); + } + + return true; + } + + /** + * Set SQL constraints based on mode + * + * @param string $mode Delete mode; can be: post|message|topic|attach|user + */ + private function set_sql_constraints($mode) + { + switch ($mode) + { + case 'post': + case 'message': + $this->sql_id = 'post_msg_id'; + $this->sql_where = ' AND in_message = ' . ($mode == 'message' ? 1 : 0); + break; + + case 'topic': + $this->sql_id = 'topic_id'; + break; + + case 'user': + $this->sql_id = 'poster_id'; + break; + + case 'attach': + default: + $this->sql_id = 'attach_id'; + break; + } + } + + /** + * Collect info about attachment IDs + * + * @param bool $resync Whether topics/posts should be resynced after delete + */ + protected function collect_attachment_info($resync) + { + // Collect post and topic ids for later use if we need to touch remaining entries (if resync is enabled) + $sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $this->db->sql_in_set($this->sql_id, $this->ids); + + $sql .= $this->sql_where; + + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // We only need to store post/message/topic ids if resync is enabled and the file is not orphaned + if ($resync && !$row['is_orphan']) + { + if (!$row['in_message']) + { + $this->post_ids[] = $row['post_msg_id']; + $this->topic_ids[] = $row['topic_id']; + } + else + { + $this->message_ids[] = $row['post_msg_id']; + } + } + + $this->physical[] = array('filename' => $row['physical_filename'], 'thumbnail' => $row['thumbnail'], 'filesize' => $row['filesize'], 'is_orphan' => $row['is_orphan']); + } + $this->db->sql_freeresult($result); + + // IDs should be unique + $this->post_ids = array_unique($this->post_ids); + $this->message_ids = array_unique($this->message_ids); + $this->topic_ids = array_unique($this->topic_ids); + } + + /** + * Delete attachments from database table + */ + protected function delete_attachments_from_db() + { + /** + * Perform additional actions before attachment(s) deletion + * + * @event core.delete_attachments_before + * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user + * @var mixed ids Array or comma separated list of ids corresponding to the mode + * @var bool resync Flag indicating if posts/messages/topics should be synchronized + * @var string sql_id The field name to collect/delete data for depending on the mode + * @var array post_ids Array with post ids for deleted attachment(s) + * @var array topic_ids Array with topic ids for deleted attachment(s) + * @var array message_ids Array with private message ids for deleted attachment(s) + * @var array physical Array with deleted attachment(s) physical file(s) data + * @since 3.1.7-RC1 + */ + $vars = array( + 'mode', + 'ids', + 'resync', + 'sql_id', + 'post_ids', + 'topic_ids', + 'message_ids', + 'physical', + ); + extract($this->dispatcher->trigger_event('core.delete_attachments_before', compact($vars))); + + // Delete attachments + $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $this->db->sql_in_set($this->sql_id, $this->ids); + + $sql .= $this->sql_where; + + $this->db->sql_query($sql); + $this->num_deleted = $this->db->sql_affectedrows(); + } + + /** + * Delete attachments from filesystem + */ + protected function remove_from_filesystem() + { + $space_removed = $files_removed = 0; + + foreach ($this->physical as $file_ary) + { + if ($this->unlink_attachment($file_ary['filename'], 'file', true) && !$file_ary['is_orphan']) + { + // Only non-orphaned files count to the file size + $space_removed += $file_ary['filesize']; + $files_removed++; + } + + if ($file_ary['thumbnail']) + { + $this->unlink_attachment($file_ary['filename'], 'thumbnail', true); + } + } + + /** + * Perform additional actions after attachment(s) deletion from the filesystem + * + * @event core.delete_attachments_from_filesystem_after + * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user + * @var mixed ids Array or comma separated list of ids corresponding to the mode + * @var bool resync Flag indicating if posts/messages/topics should be synchronized + * @var string sql_id The field name to collect/delete data for depending on the mode + * @var array post_ids Array with post ids for deleted attachment(s) + * @var array topic_ids Array with topic ids for deleted attachment(s) + * @var array message_ids Array with private message ids for deleted attachment(s) + * @var array physical Array with deleted attachment(s) physical file(s) data + * @var int num_deleted The number of deleted attachment(s) from the database + * @var int space_removed The size of deleted files(s) from the filesystem + * @var int files_removed The number of deleted file(s) from the filesystem + * @since 3.1.7-RC1 + */ + $vars = array( + 'mode', + 'ids', + 'resync', + 'sql_id', + 'post_ids', + 'topic_ids', + 'message_ids', + 'physical', + 'num_deleted', + 'space_removed', + 'files_removed', + ); + extract($this->dispatcher->trigger_event('core.delete_attachments_from_filesystem_after', compact($vars))); + + if ($space_removed || $files_removed) + { + $this->config->increment('upload_dir_size', $space_removed * (-1), false); + $this->config->increment('num_files', $files_removed * (-1), false); + } + } + + /** + * Delete attachment from filesystem + * + * @param string $filename Filename of attachment + * @param string $mode Delete mode + * @param bool $entry_removed Whether entry was removed. Defaults to false + * @return bool True if file was removed, false if not + */ + public function unlink_attachment($filename, $mode = 'file', $entry_removed = false) + { + // Because of copying topics or modifications a physical filename could be assigned more than once. If so, do not remove the file itself. + $sql = 'SELECT COUNT(attach_id) AS num_entries + FROM ' . ATTACHMENTS_TABLE . " + WHERE physical_filename = '" . $this->db->sql_escape(utf8_basename($filename)) . "'"; + $result = $this->db->sql_query($sql); + $num_entries = (int) $this->db->sql_fetchfield('num_entries'); + $this->db->sql_freeresult($result); + + // Do not remove file if at least one additional entry with the same name exist. + if (($entry_removed && $num_entries > 0) || (!$entry_removed && $num_entries > 1)) + { + return false; + } + + $filename = ($mode == 'thumbnail') ? 'thumb_' . utf8_basename($filename) : utf8_basename($filename); + $filepath = $this->phpbb_root_path . $this->config['upload_path'] . '/' . $filename; + + try + { + if ($this->filesystem->exists($filepath)) + { + $this->filesystem->remove($this->phpbb_root_path . $this->config['upload_path'] . '/' . $filename); + return true; + } + } + catch (\phpbb\filesystem\exception\filesystem_exception $exception) + { + // Fail is covered by return statement below + } + + return false; + } +} diff --git a/phpBB/phpbb/attachment/manager.php b/phpBB/phpbb/attachment/manager.php new file mode 100644 index 0000000000..3c47171b2f --- /dev/null +++ b/phpBB/phpbb/attachment/manager.php @@ -0,0 +1,99 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\attachment; + +/** + * Attachment manager + */ +class manager +{ + /** @var delete Attachment delete class */ + protected $delete; + + /** @var resync Attachment resync class */ + protected $resync; + + /** @var upload Attachment upload class */ + protected $upload; + + /** + * Constructor for attachment manager + * + * @param delete $delete Attachment delete class + * @param resync $resync Attachment resync class + * @param upload $upload Attachment upload class + */ + public function __construct(delete $delete, resync $resync, upload $upload) + { + $this->delete = $delete; + $this->resync = $resync; + $this->upload = $upload; + } + + /** + * Wrapper method for deleting attachments + * + * @param string $mode can be: post|message|topic|attach|user + * @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids + * @param bool $resync set this to false if you are deleting posts or topics + * + * @return int|bool Number of deleted attachments or false if something + * went wrong during attachment deletion + */ + public function delete($mode, $ids, $resync = true) + { + return $this->delete->delete($mode, $ids, $resync); + } + + /** + * Wrapper method for deleting attachments from filesystem + * + * @param string $filename Filename of attachment + * @param string $mode Delete mode + * @param bool $entry_removed Whether entry was removed. Defaults to false + * @return bool True if file was removed, false if not + */ + public function unlink($filename, $mode = 'file', $entry_removed = false) + { + return $this->delete->unlink_attachment($filename, $mode, $entry_removed); + } + + /** + * Wrapper method for resyncing specified type + * + * @param string $type Type of resync + * @param array $ids IDs to resync + */ + public function resync($type, $ids) + { + $this->resync->resync($type, $ids); + } + + /** + * Wrapper method for uploading attachment + * + * @param string $form_name The form name of the file upload input + * @param int $forum_id The id of the forum + * @param bool $local Whether the file is local or not + * @param string $local_storage The path to the local file + * @param bool $is_message Whether it is a PM or not + * @param array $local_filedata An file data object created for the local file + * + * @return array File data array + */ + public function upload($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = []) + { + return $this->upload->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata); + } +} diff --git a/phpBB/phpbb/attachment/resync.php b/phpBB/phpbb/attachment/resync.php new file mode 100644 index 0000000000..6c2e0a8b0d --- /dev/null +++ b/phpBB/phpbb/attachment/resync.php @@ -0,0 +1,124 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\attachment; + +use \phpbb\db\driver\driver_interface; + +/** + * Attachment resync class + */ +class resync +{ + /** @var driver_interface */ + protected $db; + + /** @var string Attachment table SQL ID */ + private $attach_sql_id; + + /** @var string Resync table SQL ID */ + private $resync_sql_id; + + /** @var string Resync SQL table */ + private $resync_table; + + /** @var string SQL where statement */ + private $sql_where; + + /** + * Constructor for attachment resync class + * + * @param driver_interface $db Database driver + */ + public function __construct(driver_interface $db) + { + $this->db = $db; + } + + /** + * Set type constraints for attachment resync + * + * @param string $type Type of resync; can be: message|post|topic + */ + protected function set_type_constraints($type) + { + switch ($type) + { + case 'message': + $this->attach_sql_id = 'post_msg_id'; + $this->sql_where = ' AND in_message = 1 + AND is_orphan = 0'; + $this->resync_table = PRIVMSGS_TABLE; + $this->resync_sql_id = 'msg_id'; + break; + + case 'post': + $this->attach_sql_id = 'post_msg_id'; + $this->sql_where = ' AND in_message = 0 + AND is_orphan = 0'; + $this->resync_table = POSTS_TABLE; + $this->resync_sql_id = 'post_id'; + break; + + case 'topic': + $this->attach_sql_id = 'topic_id'; + $this->sql_where = ' AND is_orphan = 0'; + $this->resync_table = TOPICS_TABLE; + $this->resync_sql_id = 'topic_id'; + break; + } + } + + /** + * Resync specified type + * + * @param string $type Type of resync + * @param array $ids IDs to resync + */ + public function resync($type, $ids) + { + if (empty($type) || !is_array($ids) || !sizeof($ids) || !in_array($type, array('post', 'topic', 'message'))) + { + return; + } + + $this->set_type_constraints($type); + + // Just check which elements are still having an assigned attachment + // not orphaned by querying the attachments table + $sql = 'SELECT ' . $this->attach_sql_id . ' + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $this->db->sql_in_set($this->attach_sql_id, $ids) + . $this->sql_where; + $result = $this->db->sql_query($sql); + + $remaining_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $remaining_ids[] = $row[$this->attach_sql_id]; + } + $this->db->sql_freeresult($result); + + // Now only unset those ids remaining + $ids = array_diff($ids, $remaining_ids); + + if (sizeof($ids)) + { + $sql = 'UPDATE ' . $this->resync_table . ' + SET ' . $type . '_attachment = 0 + WHERE ' . $this->db->sql_in_set($this->resync_sql_id, $ids); + $this->db->sql_query($sql); + } + } + +} diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php new file mode 100644 index 0000000000..957558768b --- /dev/null +++ b/phpBB/phpbb/attachment/upload.php @@ -0,0 +1,334 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\attachment; + +use phpbb\auth\auth; +use \phpbb\cache\service; +use \phpbb\config\config; +use \phpbb\event\dispatcher; +use \phpbb\language\language; +use \phpbb\mimetype\guesser; +use \phpbb\plupload\plupload; +use \phpbb\user; + +/** + * Attachment upload class + */ +class upload +{ + /** @var auth */ + protected $auth; + + /** @var service */ + protected $cache; + + /** @var config */ + protected $config; + + /** @var \phpbb\files\upload Upload class */ + protected $files_upload; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var guesser Mimetype guesser */ + protected $mimetype_guesser; + + /** @var dispatcher */ + protected $phpbb_dispatcher; + + /** @var plupload Plupload */ + protected $plupload; + + /** @var user */ + protected $user; + + /** @var \phpbb\files\filespec Current filespec instance */ + private $file; + + /** @var array File data */ + private $file_data = array( + 'error' => array() + ); + + /** @var array Extensions array */ + private $extensions; + + /** + * Constructor for attachments upload class + * + * @param auth $auth + * @param service $cache + * @param config $config + * @param \phpbb\files\upload $files_upload + * @param language $language + * @param guesser $mimetype_guesser + * @param dispatcher $phpbb_dispatcher + * @param plupload $plupload + * @param user $user + * @param $phpbb_root_path + */ + public function __construct(auth $auth, service $cache, config $config, \phpbb\files\upload $files_upload, language $language, guesser $mimetype_guesser, dispatcher $phpbb_dispatcher, plupload $plupload, user $user, $phpbb_root_path) + { + $this->auth = $auth; + $this->cache = $cache; + $this->config = $config; + $this->files_upload = $files_upload; + $this->language = $language; + $this->mimetype_guesser = $mimetype_guesser; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->plupload = $plupload; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Upload Attachment - filedata is generated here + * Uses upload class + * + * @param string $form_name The form name of the file upload input + * @param int $forum_id The id of the forum + * @param bool $local Whether the file is local or not + * @param string $local_storage The path to the local file + * @param bool $is_message Whether it is a PM or not + * @param array $local_filedata An file data object created for the local file + * + * @return array File data array + */ + public function upload($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = array()) + { + $this->init_files_upload($forum_id, $is_message); + + $this->file_data['post_attach'] = $local || $this->files_upload->is_valid($form_name); + + if (!$this->file_data['post_attach']) + { + $this->file_data['error'][] = $this->language->lang('NO_UPLOAD_FORM_FOUND'); + return $this->file_data; + } + + $this->file = ($local) ? $this->files_upload->handle_upload('files.types.local', $local_storage, $local_filedata) : $this->files_upload->handle_upload('files.types.form', $form_name); + + if ($this->file->init_error()) + { + $this->file_data['post_attach'] = false; + return $this->file_data; + } + + // Whether the uploaded file is in the image category + $is_image = (isset($this->extensions[$this->file->get('extension')]['display_cat'])) ? $this->extensions[$this->file->get('extension')]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE : false; + + if (!$this->auth->acl_get('a_') && !$this->auth->acl_get('m_', $forum_id)) + { + // Check Image Size, if it is an image + if ($is_image) + { + $this->file->upload->set_allowed_dimensions(0, 0, $this->config['img_max_width'], $this->config['img_max_height']); + } + + // Admins and mods are allowed to exceed the allowed filesize + if (!empty($this->extensions[$this->file->get('extension')]['max_filesize'])) + { + $allowed_filesize = $this->extensions[$this->file->get('extension')]['max_filesize']; + } + else + { + $allowed_filesize = ($is_message) ? $this->config['max_filesize_pm'] : $this->config['max_filesize']; + } + + $this->file->upload->set_max_filesize($allowed_filesize); + } + + $this->file->clean_filename('unique', $this->user->data['user_id'] . '_'); + + // Are we uploading an image *and* this image being within the image category? + // Only then perform additional image checks. + $this->file->move_file($this->config['upload_path'], false, !$is_image); + + // Do we have to create a thumbnail? + $this->file_data['thumbnail'] = ($is_image && $this->config['img_create_thumbnail']) ? 1 : 0; + + // Make sure the image category only holds valid images... + $this->check_image($is_image); + + if (sizeof($this->file->error)) + { + $this->file->remove(); + $this->file_data['error'] = array_merge($this->file_data['error'], $this->file->error); + $this->file_data['post_attach'] = false; + + return $this->file_data; + } + + $this->fill_file_data(); + + $filedata = $this->file_data; + + /** + * Event to modify uploaded file before submit to the post + * + * @event core.modify_uploaded_file + * @var array filedata Array containing uploaded file data + * @var bool is_image Flag indicating if the file is an image + * @since 3.1.0-RC3 + */ + $vars = array( + 'filedata', + 'is_image', + ); + extract($this->phpbb_dispatcher->trigger_event('core.modify_uploaded_file', compact($vars))); + $this->file_data = $filedata; + unset($filedata); + + // Check for attachment quota and free space + if (!$this->check_attach_quota() || !$this->check_disk_space()) + { + return $this->file_data; + } + + // Create Thumbnail + $this->create_thumbnail(); + + return $this->file_data; + } + + /** + * Create thumbnail for file if necessary + * + * @return array Updated $filedata + */ + protected function create_thumbnail() + { + if ($this->file_data['thumbnail']) + { + $source = $this->file->get('destination_file'); + $destination = $this->file->get('destination_path') . '/thumb_' . $this->file->get('realname'); + + if (!create_thumbnail($source, $destination, $this->file->get('mimetype'))) + { + $this->file_data['thumbnail'] = 0; + } + } + } + + /** + * Init files upload class + * + * @param int $forum_id Forum ID + * @param bool $is_message Whether attachment is inside PM or not + */ + protected function init_files_upload($forum_id, $is_message) + { + if ($this->config['check_attachment_content'] && isset($this->config['mime_triggers'])) + { + $this->files_upload->set_disallowed_content(explode('|', $this->config['mime_triggers'])); + } + else if (!$this->config['check_attachment_content']) + { + $this->files_upload->set_disallowed_content(array()); + } + + $this->extensions = $this->cache->obtain_attach_extensions((($is_message) ? false : (int) $forum_id)); + $this->files_upload->set_allowed_extensions(array_keys($this->extensions['_allowed_'])); + } + + /** + * Check if uploaded file is really an image + * + * @param bool $is_image Whether file is image + */ + protected function check_image($is_image) + { + // Make sure the image category only holds valid images... + if ($is_image && !$this->file->is_image()) + { + $this->file->remove(); + + if ($this->plupload && $this->plupload->is_active()) + { + $this->plupload->emit_error(104, 'ATTACHED_IMAGE_NOT_IMAGE'); + } + + // If this error occurs a user tried to exploit an IE Bug by renaming extensions + // Since the image category is displaying content inline we need to catch this. + $this->file->set_error($this->language->lang('ATTACHED_IMAGE_NOT_IMAGE')); + } + } + + /** + * Check if attachment quota was reached + * + * @return bool False if attachment quota was reached, true if not + */ + protected function check_attach_quota() + { + if ($this->config['attachment_quota']) + { + if (intval($this->config['upload_dir_size']) + $this->file->get('filesize') > $this->config['attachment_quota']) + { + $this->file_data['error'][] = $this->language->lang('ATTACH_QUOTA_REACHED'); + $this->file_data['post_attach'] = false; + + $this->file->remove(); + + return false; + } + } + + return true; + } + + /** + * Check if there is enough free space available on disk + * + * @return bool True if disk space is available, false if not + */ + protected function check_disk_space() + { + if ($free_space = @disk_free_space($this->phpbb_root_path . $this->config['upload_path'])) + { + if ($free_space <= $this->file->get('filesize')) + { + if ($this->auth->acl_get('a_')) + { + $this->file_data['error'][] = $this->language->lang('ATTACH_DISK_FULL'); + } + else + { + $this->file_data['error'][] = $this->language->lang('ATTACH_QUOTA_REACHED'); + } + $this->file_data['post_attach'] = false; + + $this->file->remove(); + + return false; + } + } + + return true; + } + + /** + * Fills file data with file information and current time as filetime + */ + protected function fill_file_data() + { + $this->file_data['filesize'] = $this->file->get('filesize'); + $this->file_data['mimetype'] = $this->file->get('mimetype'); + $this->file_data['extension'] = $this->file->get('extension'); + $this->file_data['physical_filename'] = $this->file->get('realname'); + $this->file_data['real_filename'] = $this->file->get('uploadname'); + $this->file_data['filetime'] = time(); + } +} diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index 81676e75fc..fc7cc1a0b1 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\auth; /** * Permission/Auth class -* @package phpBB3 */ class auth { @@ -205,9 +208,12 @@ class auth /** * Get forums with the specified permission setting - * if the option is prefixed with !, then the result becomes negated * - * @param bool $clean set to true if only values needs to be returned which are set/unset + * @param string $opt The permission name to lookup. If prefixed with !, the result is negated. + * @param bool $clean set to true if only values needs to be returned which are set/unset + * + * @return array Contains the forum ids with the specified permission set to true. + This is a nested array: array => forum_id => permission => true */ function acl_getf($opt, $clean = false) { @@ -921,11 +927,13 @@ class auth */ function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0) { - global $config, $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; + global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; + global $phpbb_dispatcher; - $method = trim(basename($config['auth_method'])); + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); - $provider = $phpbb_container->get('auth.provider.' . $method); + $provider = $provider_collection->get_provider(); if ($provider) { $login = $provider->login($username, $password); @@ -976,6 +984,24 @@ class auth redirect($url); } + /** + * Event is triggered after checking for valid username and password, and before the actual session creation. + * + * @event core.auth_login_session_create_before + * @var array login Variable containing login array + * @var bool admin Boolean variable whether user is logging into the ACP + * @var string username Username of user to log in + * @var bool autologin Boolean variable signaling whether login is triggered via auto login + * @since 3.1.7-RC1 + */ + $vars = array( + 'login', + 'admin', + 'username', + 'autologin', + ); + extract($phpbb_dispatcher->trigger_event('core.auth_login_session_create_before', compact($vars))); + // If login succeeded, we will log the user in... else we pass the login array through... if ($login['status'] == LOGIN_SUCCESS) { @@ -1040,7 +1066,7 @@ class auth { if (strpos($auth_options, '%') !== false) { - $sql_opts = "AND $key " . $db->sql_like_expression(str_replace('%', $db->any_char, $auth_options)); + $sql_opts = "AND $key " . $db->sql_like_expression(str_replace('%', $db->get_any_char(), $auth_options)); } else { @@ -1071,7 +1097,7 @@ class auth { if (strpos($option, '%') !== false) { - $sql[] = $key . ' ' . $db->sql_like_expression(str_replace('%', $db->any_char, $option)); + $sql[] = $key . ' ' . $db->sql_like_expression(str_replace('%', $db->get_any_char(), $option)); } else { diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php index 23cdc89829..aa5bf64335 100644 --- a/phpBB/phpbb/auth/provider/apache.php +++ b/phpBB/phpbb/auth/provider/apache.php @@ -1,19 +1,21 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\auth\provider; /** - * Apache authentication provider for phpBB3 - * - * @package auth - */ +* Apache authentication provider for phpBB3 +*/ class apache extends \phpbb\auth\provider\base { /** @@ -26,15 +28,15 @@ class apache extends \phpbb\auth\provider\base /** * Apache Authentication Constructor * - * @param \phpbb\db\driver\driver $db - * @param \phpbb\config\config $config - * @param \phpbb\passwords\manager $passwords_manager - * @param \phpbb\request\request $request - * @param \phpbb\user $user - * @param string $phpbb_root_path - * @param string $php_ext + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\config\config $config Config object + * @param \phpbb\passwords\manager $passwords_manager Passwords Manager object + * @param \phpbb\request\request $request Request object + * @param \phpbb\user $user User object + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -135,7 +137,7 @@ class apache extends \phpbb\auth\provider\base return array( 'status' => LOGIN_SUCCESS_CREATE_PROFILE, 'error_msg' => false, - 'user_row' => user_row_apache($php_auth_user, $php_auth_pw), + 'user_row' => $this->user_row($php_auth_user, $php_auth_pw), ); } @@ -183,7 +185,7 @@ class apache extends \phpbb\auth\provider\base } // create the user if he does not exist yet - user_add(user_row_apache($php_auth_user, $php_auth_pw)); + user_add($this->user_row($php_auth_user, $php_auth_pw)); $sql = 'SELECT * FROM ' . USERS_TABLE . " diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php index 78a3289356..dea27ccc25 100644 --- a/phpBB/phpbb/auth/provider/base.php +++ b/phpBB/phpbb/auth/provider/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\auth\provider; /** * Base authentication provider class that all other providers should implement -* -* @package auth */ abstract class base implements \phpbb\auth\provider\provider_interface { @@ -59,7 +61,7 @@ abstract class base implements \phpbb\auth\provider\provider_interface /** * {@inheritdoc} */ - public function get_auth_link_data() + public function get_auth_link_data($user_id = 0) { return; } diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index 6bbbc0be16..1adf85ee05 100644 --- a/phpBB/phpbb/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,10 +15,7 @@ namespace phpbb\auth\provider; /** * Database authentication provider for phpBB3 - * * This is for authentication via the integrated user table - * - * @package auth */ class db extends \phpbb\auth\provider\base { @@ -26,17 +27,25 @@ class db extends \phpbb\auth\provider\base protected $passwords_manager; /** + * DI container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $phpbb_container; + + /** * Database Authentication Constructor * - * @param \phpbb\db\driver\driver $db + * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\config\config $config * @param \phpbb\passwords\manager $passwords_manager * @param \phpbb\request\request $request * @param \phpbb\user $user + * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -45,6 +54,7 @@ class db extends \phpbb\auth\provider\base $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; + $this->phpbb_container = $phpbb_container; } /** @@ -77,7 +87,7 @@ class db extends \phpbb\auth\provider\base $username_clean = utf8_clean_string($username); - $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts + $sql = 'SELECT * FROM ' . USERS_TABLE . " WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'"; $result = $this->db->sql_query($sql); @@ -113,7 +123,7 @@ class db extends \phpbb\auth\provider\base 'username_clean' => $username_clean, ); $sql = 'INSERT INTO ' . LOGIN_ATTEMPT_TABLE . $this->db->sql_build_array('INSERT', $attempt_data); - $result = $this->db->sql_query($sql); + $this->db->sql_query($sql); } else { @@ -145,13 +155,9 @@ class db extends \phpbb\auth\provider\base // Every auth module is able to define what to do by itself... if ($show_captcha) { - // Visual Confirmation handling - if (!class_exists('phpbb_captcha_factory', false)) - { - include ($this->phpbb_root_path . 'includes/captcha/captcha_factory.' . $this->php_ext); - } - - $captcha = \phpbb_captcha_factory::get_instance($this->config['captcha_plugin']); + /* @var $captcha_factory \phpbb\captcha\factory */ + $captcha_factory = $this->phpbb_container->get('captcha.factory'); + $captcha = $captcha_factory->get_instance($this->config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); $vc_response = $captcha->validate($row); if ($vc_response) @@ -169,72 +175,8 @@ class db extends \phpbb\auth\provider\base } - // If the password convert flag is set we need to convert it - if ($row['user_pass_convert']) - { - // enable super globals to get literal value - // this is needed to prevent unicode normalization - $super_globals_disabled = $this->request->super_globals_disabled(); - if ($super_globals_disabled) - { - $this->request->enable_super_globals(); - } - - // in phpBB2 passwords were used exactly as they were sent, with addslashes applied - $password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : ''; - $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format; - $password_new_format = $this->request->variable('password', '', true); - - if ($super_globals_disabled) - { - $this->request->disable_super_globals(); - } - - if ($password == $password_new_format) - { - if (!function_exists('utf8_to_cp1252')) - { - include($this->phpbb_root_path . 'includes/utf/data/recode_basic.' . $this->php_ext); - } - - // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding - // plain md5 support left in for conversions from other systems. - if ((strlen($row['user_password']) == 34 && ($this->passwords_manager->check(md5($password_old_format), $row['user_password']) || $this->passwords_manager->check(md5(utf8_to_cp1252($password_old_format)), $row['user_password']))) - || (strlen($row['user_password']) == 32 && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password']))) - { - $hash = $this->passwords_manager->hash($password_new_format); - - // Update the password in the users table to the new format and remove user_pass_convert flag - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_password = \'' . $this->db->sql_escape($hash) . '\', - user_pass_convert = 0 - WHERE user_id = ' . $row['user_id']; - $this->db->sql_query($sql); - - $row['user_pass_convert'] = 0; - $row['user_password'] = $hash; - } - else - { - // Although we weren't able to convert this password we have to - // increase login attempt count to make sure this cannot be exploited - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_login_attempts = user_login_attempts + 1 - WHERE user_id = ' . (int) $row['user_id'] . ' - AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX; - $this->db->sql_query($sql); - - return array( - 'status' => LOGIN_ERROR_PASSWORD_CONVERT, - 'error_msg' => 'LOGIN_ERROR_PASSWORD_CONVERT', - 'user_row' => $row, - ); - } - } - } - // Check password ... - if (!$row['user_pass_convert'] && $this->passwords_manager->check($password, $row['user_password'])) + if ($this->passwords_manager->check($password, $row['user_password'], $row)) { // Check for old password hash... if ($this->passwords_manager->convert_flag || strlen($row['user_password']) == 32) @@ -243,8 +185,7 @@ class db extends \phpbb\auth\provider\base // Update the password in the users table to the new format $sql = 'UPDATE ' . USERS_TABLE . " - SET user_password = '" . $this->db->sql_escape($hash) . "', - user_pass_convert = 0 + SET user_password = '" . $this->db->sql_escape($hash) . "' WHERE user_id = {$row['user_id']}"; $this->db->sql_query($sql); @@ -292,7 +233,7 @@ class db extends \phpbb\auth\provider\base // Give status about wrong password... return array( 'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD, - 'error_msg' => ($show_captcha) ? 'LOGIN_ERROR_ATTEMPTS' : 'LOGIN_ERROR_PASSWORD', + 'error_msg' => 'LOGIN_ERROR_PASSWORD', 'user_row' => $row, ); } diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php index e92a227e16..c48b771ab0 100644 --- a/phpBB/phpbb/auth/provider/ldap.php +++ b/phpBB/phpbb/auth/provider/ldap.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,10 +15,7 @@ namespace phpbb\auth\provider; /** * Database authentication provider for phpBB3 - * * This is for authentication via the integrated user table - * - * @package auth */ class ldap extends \phpbb\auth\provider\base { @@ -28,12 +29,12 @@ class ldap extends \phpbb\auth\provider\base /** * LDAP Authentication Constructor * - * @param \phpbb\db\driver\driver $db - * @param \phpbb\config\config $config - * @param \phpbb\passwords\manager $passwords_manager - * @param \phpbb\user $user + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\config\config $config Config object + * @param \phpbb\passwords\manager $passwords_manager Passwords manager object + * @param \phpbb\user $user User object */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user) { $this->db = $db; $this->config = $config; @@ -288,7 +289,6 @@ class ldap extends \phpbb\auth\provider\base /** * {@inheritdoc} */ - public function acp() { // These are fields required in the config table @@ -305,9 +305,9 @@ class ldap extends \phpbb\auth\provider\base return array( 'TEMPLATE_FILE' => 'auth_provider_ldap.html', 'TEMPLATE_VARS' => array( - 'AUTH_LDAP_DN' => $new_config['ldap_base_dn'], + 'AUTH_LDAP_BASE_DN' => $new_config['ldap_base_dn'], 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'], - 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'], + 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'] !== '' ? '********' : '', 'AUTH_LDAP_PORT' => $new_config['ldap_port'], 'AUTH_LDAP_SERVER' => $new_config['ldap_server'], 'AUTH_LDAP_UID' => $new_config['ldap_uid'], diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index 0128c89248..bfeac2dd32 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -1,28 +1,29 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\auth\provider\oauth; use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Uri\Uri; /** * OAuth authentication provider for phpBB3 -* -* @package auth */ class oauth extends \phpbb\auth\provider\base { /** * Database driver * - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -62,6 +63,13 @@ class oauth extends \phpbb\auth\provider\base protected $auth_provider_oauth_token_storage_table; /** + * OAuth state table + * + * @var string + */ + protected $auth_provider_oauth_state_table; + + /** * OAuth account association table * * @var string @@ -90,6 +98,13 @@ class oauth extends \phpbb\auth\provider\base protected $current_uri; /** + * DI container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $phpbb_container; + + /** * phpBB root path * * @var string @@ -97,7 +112,7 @@ class oauth extends \phpbb\auth\provider\base protected $phpbb_root_path; /** - * PHP extenstion + * PHP file extension * * @var string */ @@ -106,19 +121,21 @@ class oauth extends \phpbb\auth\provider\base /** * OAuth Authentication Constructor * - * @param \phpbb\db\driver\driver $db + * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\config\config $config * @param \phpbb\passwords\manager $passwords_manager * @param \phpbb\request\request_interface $request * @param \phpbb\user $user * @param string $auth_provider_oauth_token_storage_table + * @param string $auth_provider_oauth_state_table * @param string $auth_provider_oauth_token_account_assoc * @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface * @param string $users_table + * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_state_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -126,9 +143,11 @@ class oauth extends \phpbb\auth\provider\base $this->request = $request; $this->user = $user; $this->auth_provider_oauth_token_storage_table = $auth_provider_oauth_token_storage_table; + $this->auth_provider_oauth_state_table = $auth_provider_oauth_state_table; $this->auth_provider_oauth_token_account_assoc = $auth_provider_oauth_token_account_assoc; $this->service_providers = $service_providers; $this->users_table = $users_table; + $this->phpbb_container = $phpbb_container; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } @@ -159,7 +178,7 @@ class oauth extends \phpbb\auth\provider\base // Temporary workaround for only having one authentication provider available if (!$this->request->is_set('oauth_service')) { - $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->passwords_manager, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext); + $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->passwords_manager, $this->request, $this->user, $this->phpbb_container, $this->phpbb_root_path, $this->php_ext); return $provider->login($username, $password); } @@ -178,7 +197,7 @@ class oauth extends \phpbb\auth\provider\base // Get the service credentials for the given service $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); - $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); $query = 'mode=login&login=external&oauth_service=' . $service_name_original; $service = $this->get_service($service_name_original, $storage, $service_credentials, $query, $this->service_providers[$service_name]->get_auth_scope()); @@ -213,7 +232,7 @@ class oauth extends \phpbb\auth\provider\base } // Retrieve the user's account - $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type, user_login_attempts FROM ' . $this->users_table . ' WHERE user_id = ' . (int) $row['user_id']; $result = $this->db->sql_query($sql); @@ -222,7 +241,7 @@ class oauth extends \phpbb\auth\provider\base if (!$row) { - throw new Exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY'); + throw new \Exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY'); } // Update token storage to store the user_id @@ -276,9 +295,10 @@ class oauth extends \phpbb\auth\provider\base * @param array $service_credentials {@see \phpbb\auth\provider\oauth\oauth::get_service_credentials} * @param string $query The query string of the * current_uri used in redirection - * @param array $scope The scope of the request against + * @param array $scopes The scope of the request against * the api. * @return \OAuth\Common\Service\ServiceInterface + * @throws \Exception */ protected function get_service($service_name, \phpbb\auth\provider\oauth\token_storage $storage, array $service_credentials, $query, array $scopes = array()) { @@ -296,7 +316,7 @@ class oauth extends \phpbb\auth\provider\base if (!$service) { - throw new Exception('AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED'); + throw new \Exception('AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED'); } return $service; @@ -445,7 +465,7 @@ class oauth extends \phpbb\auth\provider\base */ protected function link_account_login_link(array $link_data, $service_name) { - $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); // Check for an access token, they should have one if (!$storage->has_access_token_by_session($service_name)) @@ -488,7 +508,7 @@ class oauth extends \phpbb\auth\provider\base */ protected function link_account_auth_link(array $link_data, $service_name) { - $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); $query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']); $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); $scopes = $this->service_providers[$service_name]->get_auth_scope(); @@ -533,7 +553,7 @@ class oauth extends \phpbb\auth\provider\base public function logout($data, $new_session) { // Clear all tokens belonging to the user - $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); $storage->clearAllTokens(); return; @@ -542,13 +562,13 @@ class oauth extends \phpbb\auth\provider\base /** * {@inheritdoc} */ - public function get_auth_link_data() + public function get_auth_link_data($user_id = 0) { $block_vars = array(); // Get all external accounts tied to the current user $data = array( - 'user_id' => (int) $this->user->data['user_id'], + 'user_id' => ($user_id <= 0) ? (int) $this->user->data['user_id'] : (int) $user_id, ); $sql = 'SELECT oauth_provider_id, provider FROM ' . $this->auth_provider_oauth_token_account_assoc . ' WHERE ' . $this->db->sql_build_array('SELECT', $data); @@ -605,17 +625,18 @@ class oauth extends \phpbb\auth\provider\base return 'LOGIN_LINK_MISSING_DATA'; } + // Remove user specified in $link_data if possible + $user_id = isset($link_data['user_id']) ? $link_data['user_id'] : $this->user->data['user_id']; + // Remove the link $sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_account_assoc . " WHERE provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "' - AND user_id = " . (int) $this->user->data['user_id']; + AND user_id = " . (int) $user_id; $this->db->sql_query($sql); // Clear all tokens belonging to the user on this servce $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']); - $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); $storage->clearToken($service_name); - - return; } } diff --git a/phpBB/phpbb/auth/provider/oauth/service/base.php b/phpBB/phpbb/auth/provider/oauth/service/base.php index 7a144d2f51..6adf64aa30 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/base.php +++ b/phpBB/phpbb/auth/provider/oauth/service/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\auth\provider\oauth\service; /** * Base OAuth abstract class that all OAuth services should implement -* -* @package auth */ abstract class base implements \phpbb\auth\provider\oauth\service\service_interface { diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php index b4050033a6..25e731a02c 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/bitly.php +++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\auth\provider\oauth\service; /** * Bitly OAuth service -* -* @package auth */ class bitly extends \phpbb\auth\provider\oauth\service\base { diff --git a/phpBB/phpbb/auth/provider/oauth/service/exception.php b/phpBB/phpbb/auth/provider/oauth/service/exception.php index 3bc93be01e..d3e95bef0d 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/exception.php +++ b/phpBB/phpbb/auth/provider/oauth/service/exception.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\auth\provider\oauth\service; /** * OAuth service exception class -* -* @package auth */ class exception extends \RuntimeException { diff --git a/phpBB/phpbb/auth/provider/oauth/service/facebook.php b/phpBB/phpbb/auth/provider/oauth/service/facebook.php index 2698be8b18..bb98835e07 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/facebook.php +++ b/phpBB/phpbb/auth/provider/oauth/service/facebook.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,30 +15,28 @@ namespace phpbb\auth\provider\oauth\service; /** * Facebook OAuth service -* -* @package auth */ class facebook extends base { /** * phpBB config * - * @var phpbb\config\config + * @var \phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb\request\request_interface + * @var \phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb\config\config $config - * @param phpbb\request\request_interface $request + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request */ public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php index 08cb025c2d..cb9f83a94f 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/google.php +++ b/phpBB/phpbb/auth/provider/oauth/service/google.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,30 +15,28 @@ namespace phpbb\auth\provider\oauth\service; /** * Google OAuth service -* -* @package auth */ class google extends base { /** * phpBB config * - * @var phpbb\config\config + * @var \phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb\request\request_interface + * @var \phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb\config\config $config - * @param phpbb\request\request_interface $request + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request */ public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { diff --git a/phpBB/phpbb/auth/provider/oauth/service/service_interface.php b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php index eee3a51cac..e84eb247b6 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/service_interface.php +++ b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\auth\provider\oauth\service; /** * OAuth service interface -* -* @package auth */ interface service_interface { @@ -65,7 +67,7 @@ interface service_interface /** * Sets the external library service provider * - * @param \OAuth\Common\Service\ServiceInterface $service + * @param \OAuth\Common\Service\ServiceInterface $service_provider */ public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider); } diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php index 43574288dc..e922342ef6 100644 --- a/phpBB/phpbb/auth/provider/oauth/token_storage.php +++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php @@ -1,32 +1,33 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\auth\provider\oauth; - use OAuth\OAuth1\Token\StdOAuth1Token; use OAuth\Common\Token\TokenInterface; use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Storage\Exception\StorageException; use OAuth\Common\Storage\Exception\TokenNotFoundException; +use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException; /** * OAuth storage wrapper for phpbb's cache -* -* @package auth */ class token_storage implements TokenStorageInterface { /** * Cache driver. * - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -42,7 +43,14 @@ class token_storage implements TokenStorageInterface * * @var string */ - protected $auth_provider_oauth_table; + protected $oauth_token_table; + + /** + * OAuth state table + * + * @var string + */ + protected $oauth_state_table; /** * @var object|TokenInterface @@ -50,17 +58,24 @@ class token_storage implements TokenStorageInterface protected $cachedToken; /** + * @var string + */ + protected $cachedState; + + /** * Creates token storage for phpBB. * - * @param \phpbb\db\driver\driver $db + * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\user $user - * @param string $auth_provider_oauth_table + * @param string $oauth_token_table + * @param string $oauth_state_table */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, $auth_provider_oauth_table) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $oauth_token_table, $oauth_state_table) { $this->db = $db; $this->user = $user; - $this->auth_provider_oauth_table = $auth_provider_oauth_table; + $this->oauth_token_table = $oauth_token_table; + $this->oauth_state_table = $oauth_state_table; } /** @@ -104,9 +119,11 @@ class token_storage implements TokenStorageInterface 'session_id' => $this->user->data['session_id'], ); - $sql = 'INSERT INTO ' . $this->auth_provider_oauth_table . ' + $sql = 'INSERT INTO ' . $this->oauth_token_table . ' ' . $this->db->sql_build_array('INSERT', $data); $this->db->sql_query($sql); + + return $this; } /** @@ -116,7 +133,8 @@ class token_storage implements TokenStorageInterface { $service = $this->get_service_name_for_db($service); - if ($this->cachedToken) { + if ($this->cachedToken) + { return true; } @@ -142,7 +160,7 @@ class token_storage implements TokenStorageInterface $this->cachedToken = null; - $sql = 'DELETE FROM ' . $this->auth_provider_oauth_table . ' + $sql = 'DELETE FROM ' . $this->oauth_token_table . ' WHERE user_id = ' . (int) $this->user->data['user_id'] . " AND provider = '" . $this->db->sql_escape($service) . "'"; @@ -152,6 +170,8 @@ class token_storage implements TokenStorageInterface } $this->db->sql_query($sql); + + return $this; } /** @@ -161,7 +181,7 @@ class token_storage implements TokenStorageInterface { $this->cachedToken = null; - $sql = 'DELETE FROM ' . $this->auth_provider_oauth_table . ' + $sql = 'DELETE FROM ' . $this->oauth_token_table . ' WHERE user_id = ' . (int) $this->user->data['user_id']; if ((int) $this->user->data['user_id'] === ANONYMOUS) @@ -170,6 +190,124 @@ class token_storage implements TokenStorageInterface } $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function storeAuthorizationState($service, $state) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedState = $state; + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + 'oauth_state' => $state, + 'session_id' => $this->user->data['session_id'], + ); + + $sql = 'INSERT INTO ' . $this->oauth_state_table . ' + ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return true; + } + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ); + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return (bool) $this->get_state_row($data); + } + + /** + * {@inheritdoc} + */ + public function retrieveAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return $this->cachedState; + } + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ); + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return $this->get_state_row($data); + } + + /** + * {@inheritdoc} + */ + public function clearAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedState = null; + + $sql = 'DELETE FROM ' . $this->oauth_state_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND provider = '" . $this->db->sql_escape($service) . "'"; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function clearAllAuthorizationStates() + { + $this->cachedState = null; + + $sql = 'DELETE FROM ' . $this->oauth_state_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id']; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; } /** @@ -184,7 +322,7 @@ class token_storage implements TokenStorageInterface return; } - $sql = 'UPDATE ' . $this->auth_provider_oauth_table . ' + $sql = 'UPDATE ' . $this->oauth_token_table . ' SET ' . $this->db->sql_build_array('UPDATE', array( 'user_id' => (int) $user_id )) . ' @@ -196,6 +334,7 @@ class token_storage implements TokenStorageInterface /** * Checks to see if an access token exists solely by the session_id of the user * + * @param string $service The name of the OAuth service * @return bool true if they have token, false if they don't */ public function has_access_token_by_session($service) @@ -216,6 +355,29 @@ class token_storage implements TokenStorageInterface } /** + * Checks to see if a state exists solely by the session_id of the user + * + * @param string $service The name of the OAuth service + * @return bool true if they have state, false if they don't + */ + public function has_state_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return true; + } + + $data = array( + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ); + + return (bool) $this->get_state_row($data); + } + + /** * A helper function that performs the query for has access token functions * * @param array $data @@ -230,7 +392,8 @@ class token_storage implements TokenStorageInterface { $service = $this->get_service_name_for_db($service); - if ($this->cachedToken instanceof TokenInterface) { + if ($this->cachedToken instanceof TokenInterface) + { return $this->cachedToken; } @@ -242,12 +405,30 @@ class token_storage implements TokenStorageInterface return $this->_retrieve_access_token($data); } + public function retrieve_state_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return $this->cachedState; + } + + $data = array( + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ); + + return $this->_retrieve_state($data); + } + /** * A helper function that performs the query for retrieve access token functions * Also checks if the token is a valid token * * @param array $data * @return mixed + * @throws \OAuth\Common\Storage\Exception\TokenNotFoundException */ protected function _retrieve_access_token($data) { @@ -263,7 +444,7 @@ class token_storage implements TokenStorageInterface // Ensure that the token was serialized/unserialized correctly if (!($token instanceof TokenInterface)) { - $this->clearToken(); + $this->clearToken($data['provider']); throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED'); } @@ -272,6 +453,26 @@ class token_storage implements TokenStorageInterface } /** + * A helper function that performs the query for retrieve state functions + * + * @param array $data + * @return mixed + * @throws \OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException + */ + protected function _retrieve_state($data) + { + $row = $this->get_state_row($data); + + if (!$row) + { + throw new AuthorizationStateNotFoundException(); + } + + $this->cachedState = $row['oauth_state']; + return $this->cachedState; + } + + /** * A helper function that performs the query for retrieving an access token * * @param array $data @@ -279,7 +480,24 @@ class token_storage implements TokenStorageInterface */ protected function get_access_token_row($data) { - $sql = 'SELECT oauth_token FROM ' . $this->auth_provider_oauth_table . ' + $sql = 'SELECT oauth_token FROM ' . $this->oauth_token_table . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + /** + * A helper function that performs the query for retrieving a state + * + * @param array $data + * @return mixed + */ + protected function get_state_row($data) + { + $sql = 'SELECT oauth_state FROM ' . $this->oauth_state_table . ' WHERE ' . $this->db->sql_build_array('SELECT', $data); $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php index 946731f52d..35e0f559a1 100644 --- a/phpBB/phpbb/auth/provider/provider_interface.php +++ b/phpBB/phpbb/auth/provider/provider_interface.php @@ -1,19 +1,21 @@ <?php /** * -* @package auth -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\auth\provider; /** - * The interface authentication provider classes have to implement. - * - * @package auth - */ +* The interface authentication provider classes have to implement. +*/ interface provider_interface { /** @@ -146,7 +148,7 @@ interface provider_interface * user_id of an account needed to successfully link an external account to * a forum account. * - * @param array $link_data Any data needed to link a phpBB account to + * @param array $login_link_data Any data needed to link a phpBB account to * an external account. * @return string|null Returns a string with a language constant if there * is data missing or null if there is no error. @@ -164,6 +166,10 @@ interface provider_interface /** * Returns an array of data necessary to build the ucp_auth_link page * + * @param int $user_id User ID for whom the data should be retrieved. + * defaults to 0, which is not a valid ID. The method + * should fall back to the current user's ID in this + * case. * @return array|null If this function is not implemented on an auth * provider then it returns null. If it is implemented * it will return an array of up to four elements of @@ -179,7 +185,7 @@ interface provider_interface * 'VARS' => array(...), * ) */ - public function get_auth_link_data(); + public function get_auth_link_data($user_id = 0); /** * Unlinks an external account from a phpBB account. diff --git a/phpBB/phpbb/auth/provider_collection.php b/phpBB/phpbb/auth/provider_collection.php new file mode 100644 index 0000000000..8e7e9e2cc1 --- /dev/null +++ b/phpBB/phpbb/auth/provider_collection.php @@ -0,0 +1,67 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth; + +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Collection of auth providers to be configured at container compile time. +*/ +class provider_collection extends \phpbb\di\service_collection +{ + /** @var \phpbb\config\config phpBB Config */ + protected $config; + + /** + * Constructor + * + * @param ContainerInterface $container Container object + * @param \phpbb\config\config $config phpBB config + */ + public function __construct(ContainerInterface $container, \phpbb\config\config $config) + { + $this->container = $container; + $this->config = $config; + } + + /** + * Get an auth provider. + * + * @param string $provider_name The name of the auth provider + * @return object Default auth provider selected in config if it + * does exist. Otherwise the standard db auth + * provider. + * @throws \RuntimeException If neither the auth provider that + * is specified by the phpBB config nor the db + * auth provider exist. The db auth provider + * should always exist in a phpBB installation. + */ + public function get_provider($provider_name = '') + { + $provider_name = ($provider_name !== '') ? $provider_name : basename(trim($this->config['auth_method'])); + if ($this->offsetExists('auth.provider.' . $provider_name)) + { + return $this->offsetGet('auth.provider.' . $provider_name); + } + // Revert to db auth provider if selected method does not exist + else if ($this->offsetExists('auth.provider.db')) + { + return $this->offsetGet('auth.provider.db'); + } + else + { + throw new \RuntimeException(sprintf('The authentication provider for the authentication method "%1$s" does not exist. It was not possible to recover from this by reverting to the database authentication provider.', $this->config['auth_method'])); + } + } +} diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index dd55f09119..45681f3e59 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\avatar\driver; /** * Base class for avatar drivers -* @package phpBB3 */ abstract class driver implements \phpbb\avatar\driver\driver_interface { @@ -27,6 +30,9 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface */ protected $config; + /** @var \FastImageSize\FastImageSize */ + protected $imagesize; + /** * Current $phpbb_root_path * @var string @@ -70,15 +76,16 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface * Construct a driver object * * @param \phpbb\config\config $config phpBB configuration - * @param \phpbb\request\request $request Request object + * @param \FastImageSize\FastImageSize $imagesize FastImageSize class * @param string $phpbb_root_path Path to the phpBB root * @param string $php_ext PHP file extension - * @param \phpbb_path_helper $path_helper phpBB path helper + * @param \phpbb\path_helper $path_helper phpBB path helper * @param \phpbb\cache\driver\driver_interface $cache Cache driver */ - public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null) + public function __construct(\phpbb\config\config $config, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null) { $this->config = $config; + $this->imagesize = $imagesize; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->path_helper = $path_helper; @@ -86,7 +93,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function get_custom_html($user, $row, $alt = '') { @@ -94,7 +101,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function prepare_form_acp($user) { @@ -102,7 +109,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function delete($row) { @@ -110,7 +117,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function get_name() { @@ -118,6 +125,22 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface } /** + * {@inheritdoc} + */ + public function get_config_name() + { + return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this)); + } + + /** + * {@inheritdoc} + */ + public function get_acp_template_name() + { + return 'acp_avatar_options_' . $this->get_config_name() . '.html'; + } + + /** * Sets the name of the driver. * * @param string $name Driver name diff --git a/phpBB/phpbb/avatar/driver/driver_interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php index 7f049469a2..7d6c2cff8a 100644 --- a/phpBB/phpbb/avatar/driver/driver_interface.php +++ b/phpBB/phpbb/avatar/driver/driver_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\avatar\driver; /** * Interface for avatar drivers -* @package phpBB3 */ interface driver_interface { @@ -23,6 +26,13 @@ interface driver_interface public function get_name(); /** + * Returns the config name of the driver. To be used in accessing the CONFIG variables. + * + * @return string Config name of driver. + */ + public function get_config_name(); + + /** * Get the avatar url and dimensions * * @param array $row User data or group data that has been cleaned with @@ -107,4 +117,11 @@ interface driver_interface * @return string Avatar driver's template name */ public function get_template_name(); + + /** + * Get the avatar driver's template name (ACP) + * + * @return string Avatar driver's template name + */ + public function get_acp_template_name(); } diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php index 9f14b7f468..b8cf84424a 100644 --- a/phpBB/phpbb/avatar/driver/gravatar.php +++ b/phpBB/phpbb/avatar/driver/gravatar.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\avatar\driver; /** * Handles avatars hosted at gravatar.com -* @package phpBB3 */ class gravatar extends \phpbb\avatar\driver\driver { @@ -21,7 +24,7 @@ class gravatar extends \phpbb\avatar\driver\driver const GRAVATAR_URL = '//secure.gravatar.com/avatar/'; /** - * @inheritdoc + * {@inheritdoc} */ public function get_data($row) { @@ -33,7 +36,7 @@ class gravatar extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function get_custom_html($user, $row, $alt = '') { @@ -44,7 +47,7 @@ class gravatar extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function prepare_form($request, $template, $user, $row, &$error) { @@ -58,7 +61,7 @@ class gravatar extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function process_form($request, $template, $user, $row, &$error) { @@ -66,6 +69,11 @@ class gravatar extends \phpbb\avatar\driver\driver $row['avatar_width'] = $request->variable('avatar_gravatar_width', 0); $row['avatar_height'] = $request->variable('avatar_gravatar_height', 0); + if (empty($row['avatar'])) + { + return false; + } + if (!function_exists('validate_data')) { require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); @@ -78,7 +86,8 @@ class gravatar extends \phpbb\avatar\driver\driver array( 'email' => array( array('string', false, 6, 60), - array('email')) + array('email'), + ), ) ); @@ -89,8 +98,8 @@ class gravatar extends \phpbb\avatar\driver\driver return false; } - // Make sure getimagesize works... - if (function_exists('getimagesize') && ($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0)) + // Get image dimensions if they are not set + if ($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) { /** * default to the minimum of the maximum allowed avatar size if the size @@ -99,20 +108,20 @@ class gravatar extends \phpbb\avatar\driver\driver $row['avatar_width'] = $row['avatar_height'] = min($this->config['avatar_max_width'], $this->config['avatar_max_height']); $url = $this->get_gravatar_url($row); - if (($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) && (($image_data = getimagesize($url)) === false)) + if (($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false)) { $error[] = 'UNABLE_GET_IMAGE_SIZE'; return false; } - if (!empty($image_data) && ($image_data[0] <= 0 || $image_data[1] <= 0)) + if (!empty($image_data) && ($image_data['width'] <= 0 || $image_data['width'] <= 0)) { $error[] = 'AVATAR_NO_SIZE'; return false; } - $row['avatar_width'] = ($row['avatar_width'] && $row['avatar_height']) ? $row['avatar_width'] : $image_data[0]; - $row['avatar_height'] = ($row['avatar_width'] && $row['avatar_height']) ? $row['avatar_height'] : $image_data[1]; + $row['avatar_width'] = ($row['avatar_width'] && $row['avatar_height']) ? $row['avatar_width'] : $image_data['width']; + $row['avatar_height'] = ($row['avatar_width'] && $row['avatar_height']) ? $row['avatar_height'] : $image_data['height']; } if ($row['avatar_width'] <= 0 || $row['avatar_height'] <= 0) @@ -147,7 +156,7 @@ class gravatar extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function get_template_name() { @@ -157,10 +166,14 @@ class gravatar extends \phpbb\avatar\driver\driver /** * Build gravatar URL for output on page * + * @param array $row User data or group data that has been cleaned with + * \phpbb\avatar\manager::clean_row * @return string Gravatar URL */ protected function get_gravatar_url($row) { + global $phpbb_dispatcher; + $url = self::GRAVATAR_URL; $url .= md5(strtolower(trim($row['avatar']))); @@ -169,6 +182,17 @@ class gravatar extends \phpbb\avatar\driver\driver $url .= '?s=' . max($row['avatar_width'], $row['avatar_height']); } + /** + * Modify gravatar url + * + * @event core.get_gravatar_url_after + * @var string row User data or group data + * @var string url Gravatar URL + * @since 3.1.7-RC1 + */ + $vars = array('row', 'url'); + extract($phpbb_dispatcher->trigger_event('core.get_gravatar_url_after', compact($vars))); + return $url; } } diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index 611a44cb3d..f5547c4bc6 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,29 +15,30 @@ namespace phpbb\avatar\driver; /** * Handles avatars selected from the board gallery -* @package phpBB3 */ class local extends \phpbb\avatar\driver\driver { /** - * @inheritdoc + * {@inheritdoc} */ public function get_data($row) { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $this->path_helper->get_web_root_path(); + return array( - 'src' => $this->path_helper->get_web_root_path() . $this->config['avatar_gallery_path'] . '/' . $row['avatar'], + 'src' => $root_path . $this->config['avatar_gallery_path'] . '/' . $row['avatar'], 'width' => $row['avatar_width'], 'height' => $row['avatar_height'], ); } /** - * @inheritdoc + * {@inheritdoc} */ public function prepare_form($request, $template, $user, $row, &$error) { $avatar_list = $this->get_avatar_list($user); - $category = $request->variable('avatar_local_cat', ''); + $category = $request->variable('avatar_local_cat', key($avatar_list)); foreach ($avatar_list as $cat => $null) { @@ -79,11 +84,13 @@ class local extends \phpbb\avatar\driver\driver 'AVATAR_IMAGE' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $img['file'], 'AVATAR_NAME' => $img['name'], 'AVATAR_FILE' => $img['filename'], + 'CHECKED' => $img['file'] === $row['avatar'], )); $template->assign_block_vars('avatar_local_row.avatar_local_option', array( 'AVATAR_FILE' => $img['filename'], - 'S_OPTIONS_AVATAR' => $img['filename'] + 'S_OPTIONS_AVATAR' => $img['filename'], + 'CHECKED' => $img['file'] === $row['avatar'], )); $col_count = ($col_count + 1) % $table_cols; @@ -96,7 +103,7 @@ class local extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function prepare_form_acp($user) { @@ -106,7 +113,7 @@ class local extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function process_form($request, $template, $user, $row, &$error) { @@ -117,7 +124,6 @@ class local extends \phpbb\avatar\driver\driver if (empty($category) || empty($file)) { - $error[] = 'NO_AVATAR_SELECTED'; return false; } @@ -128,14 +134,14 @@ class local extends \phpbb\avatar\driver\driver } return array( - 'avatar' => ($category != $user->lang['MAIN']) ? $category . '/' . $file : $file, + 'avatar' => ($category != $user->lang['NO_AVATAR_CATEGORY']) ? $category . '/' . $file : $file, 'avatar_width' => $avatar_list[$category][urldecode($file)]['width'], 'avatar_height' => $avatar_list[$category][urldecode($file)]['height'], ); } /** - * @inheritdoc + * {@inheritdoc} */ public function get_template_name() { @@ -152,7 +158,7 @@ class local extends \phpbb\avatar\driver\driver */ protected function get_avatar_list($user) { - $avatar_list = ($this->cache == null) ? false : $this->cache->get('avatar_local_list'); + $avatar_list = ($this->cache == null) ? false : $this->cache->get('_avatar_local_list'); if ($avatar_list === false) { @@ -168,17 +174,19 @@ class local extends \phpbb\avatar\driver\driver // Match all images in the gallery folder if (preg_match('#^[^&\'"<>]+\.(?:' . implode('|', $this->allowed_extensions) . ')$#i', $image) && is_file($file_path . '/' . $image)) { - if (function_exists('getimagesize')) + $dims = $this->imagesize->getImageSize($file_path . '/' . $image); + + if ($dims === false) { - $dims = getimagesize($file_path . '/' . $image); + $dims = array(0, 0); } else { - $dims = array(0, 0); + $dims = array($dims['width'], $dims['height']); } - $cat = ($path == $file_path) ? $user->lang['MAIN'] : str_replace("$path/", '', $file_path); + $cat = ($path == $file_path) ? $user->lang['NO_AVATAR_CATEGORY'] : str_replace("$path/", '', $file_path); $avatar_list[$cat][$image] = array( - 'file' => ($cat != $user->lang['MAIN']) ? rawurlencode($cat) . '/' . rawurlencode($image) : rawurlencode($image), + 'file' => ($cat != $user->lang['NO_AVATAR_CATEGORY']) ? str_replace('%2F', '/', rawurlencode($cat)) . '/' . rawurlencode($image) : rawurlencode($image), 'filename' => rawurlencode($image), 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $image))), 'width' => $dims[0], @@ -190,7 +198,7 @@ class local extends \phpbb\avatar\driver\driver if ($this->cache != null) { - $this->cache->put('avatar_local_list', $avatar_list, 86400); + $this->cache->put('_avatar_local_list', $avatar_list, 86400); } } diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php index 36623942df..0526b9184e 100644 --- a/phpBB/phpbb/avatar/driver/remote.php +++ b/phpBB/phpbb/avatar/driver/remote.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,12 +15,11 @@ namespace phpbb\avatar\driver; /** * Handles avatars hosted remotely -* @package phpBB3 */ class remote extends \phpbb\avatar\driver\driver { /** - * @inheritdoc + * {@inheritdoc} */ public function get_data($row) { @@ -28,7 +31,7 @@ class remote extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function prepare_form($request, $template, $user, $row, &$error) { @@ -42,7 +45,7 @@ class remote extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function process_form($request, $template, $user, $row, &$error) { @@ -50,6 +53,11 @@ class remote extends \phpbb\avatar\driver\driver $width = $request->variable('avatar_remote_width', 0); $height = $request->variable('avatar_remote_height', 0); + if (empty($url)) + { + return false; + } + if (!preg_match('#^(http|https|ftp)://#i', $url)) { $url = 'http://' . $url; @@ -84,46 +92,54 @@ class remote extends \phpbb\avatar\driver\driver return false; } - // Make sure getimagesize works... - if (function_exists('getimagesize')) + // Get image dimensions + if (($width <= 0 || $height <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false)) { - if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false)) - { - $error[] = 'UNABLE_GET_IMAGE_SIZE'; - return false; - } - - if (!empty($image_data) && ($image_data[0] <= 0 || $image_data[1] <= 0)) - { - $error[] = 'AVATAR_NO_SIZE'; - return false; - } - - $width = ($width && $height) ? $width : $image_data[0]; - $height = ($width && $height) ? $height : $image_data[1]; + $error[] = 'UNABLE_GET_IMAGE_SIZE'; + return false; } - if ($width <= 0 || $height <= 0) + if (!empty($image_data) && ($image_data['width'] <= 0 || $image_data['height'] <= 0)) { $error[] = 'AVATAR_NO_SIZE'; return false; } - if (!class_exists('fileupload')) + $width = ($width && $height) ? $width : $image_data['width']; + $height = ($width && $height) ? $height : $image_data['height']; + + if ($width <= 0 || $height <= 0) { - include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext); + $error[] = 'AVATAR_NO_SIZE'; + return false; } - $types = \fileupload::image_types(); - $extension = strtolower(\filespec::get_extension($url)); + $types = \phpbb\files\upload::image_types(); + $extension = strtolower(\phpbb\files\filespec::get_extension($url)); // Check if this is actually an image if ($file_stream = @fopen($url, 'r')) { // Timeout after 1 second stream_set_timeout($file_stream, 1); + // read some data to ensure headers are present + fread($file_stream, 1024); $meta = stream_get_meta_data($file_stream); - foreach ($meta['wrapper_data'] as $header) + + if (isset($meta['wrapper_data']['headers']) && is_array($meta['wrapper_data']['headers'])) + { + $headers = $meta['wrapper_data']['headers']; + } + else if (isset($meta['wrapper_data']) && is_array($meta['wrapper_data'])) + { + $headers = $meta['wrapper_data']; + } + else + { + $headers = array(); + } + + foreach ($headers as $header) { $header = preg_split('/ /', $header, 2); if (strtr(strtolower(trim($header[0], ':')), '_', '-') === 'content-type') @@ -148,15 +164,15 @@ class remote extends \phpbb\avatar\driver\driver return false; } - if (!empty($image_data) && (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]]))) + if (!empty($image_data) && (!isset($types[$image_data['type']]) || !in_array($extension, $types[$image_data['type']]))) { - if (!isset($types[$image_data[2]])) + if (!isset($types[$image_data['type']])) { $error[] = 'UNABLE_GET_IMAGE_SIZE'; } else { - $error[] = array('IMAGE_FILETYPE_MISMATCH', $types[$image_data[2]][0], $extension); + $error[] = array('IMAGE_FILETYPE_MISMATCH', $types[$image_data['type']][0], $extension); } return false; @@ -188,7 +204,7 @@ class remote extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function get_template_name() { diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 1e50e135e4..a0c23cb624 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,24 +15,64 @@ namespace phpbb\avatar\driver; /** * Handles avatars uploaded to the board -* @package phpBB3 */ class upload extends \phpbb\avatar\driver\driver { /** - * @inheritdoc + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\files\factory + */ + protected $files_factory; + + /** + * Construct a driver object + * + * @param \phpbb\config\config $config phpBB configuration + * @param string $phpbb_root_path Path to the phpBB root + * @param string $php_ext PHP file extension + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper + * @param \phpbb\path_helper $path_helper phpBB path helper + * @param \phpbb\event\dispatcher_interface $dispatcher phpBB Event dispatcher object + * @param \phpbb\files\factory $files_factory File classes factory + * @param \phpbb\cache\driver\driver_interface $cache Cache driver + */ + public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\filesystem\filesystem_interface $filesystem, \phpbb\path_helper $path_helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\files\factory $files_factory, \phpbb\cache\driver\driver_interface $cache = null) + { + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->filesystem = $filesystem; + $this->path_helper = $path_helper; + $this->dispatcher = $dispatcher; + $this->files_factory = $files_factory; + $this->cache = $cache; + } + + /** + * {@inheritdoc} */ - public function get_data($row, $ignore_config = false) + public function get_data($row) { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $this->path_helper->get_web_root_path(); + return array( - 'src' => $this->path_helper->get_web_root_path() . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'], + 'src' => $root_path . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'], 'width' => $row['avatar_width'], 'height' => $row['avatar_height'], ); } /** - * @inheritdoc + * {@inheritdoc} */ public function prepare_form($request, $template, $user, $row, &$error) { @@ -46,7 +90,7 @@ class upload extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function process_form($request, $template, $user, $row, &$error) { @@ -55,21 +99,26 @@ class upload extends \phpbb\avatar\driver\driver return false; } - if (!class_exists('fileupload')) - { - include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext); - } - - $upload = new \fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false)); + /** @var \phpbb\files\upload $upload */ + $upload = $this->files_factory->get('upload') + ->set_error_prefix('AVATAR_') + ->set_allowed_extensions($this->allowed_extensions) + ->set_max_filesize($this->config['avatar_filesize']) + ->set_allowed_dimensions( + $this->config['avatar_min_width'], + $this->config['avatar_min_height'], + $this->config['avatar_max_width'], + $this->config['avatar_max_height']) + ->set_disallowed_content((isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false)); $url = $request->variable('avatar_upload_url', ''); $upload_file = $request->file('avatar_upload_file'); if (!empty($upload_file['name'])) { - $file = $upload->form_upload('avatar_upload_file'); + $file = $upload->handle_upload('files.types.form', 'avatar_upload_file'); } - elseif (!empty($this->config['allow_avatar_remote_upload']) && !empty($url)) + else if (!empty($this->config['allow_avatar_remote_upload']) && !empty($url)) { if (!preg_match('#^(http|https|ftp)://#i', $url)) { @@ -97,17 +146,25 @@ class upload extends \phpbb\avatar\driver\driver return false; } - $file = $upload->remote_upload($url); + $file = $upload->handle_upload('files.types.remote', $url); } else { - $error[] = 'NO_AVATAR_SELECTED'; return false; } $prefix = $this->config['avatar_salt'] . '_'; $file->clean_filename('avatar', $prefix, $row['id']); + // If there was an error during upload, then abort operation + if (sizeof($file->error)) + { + $file->remove(); + $error = $file->error; + return false; + } + + // Calculate new destination $destination = $this->config['avatar_path']; // Adjust destination path (no trailing slash) @@ -122,16 +179,45 @@ class upload extends \phpbb\avatar\driver\driver $destination = ''; } - // Move file and overwrite any existing image - $file->move_file($destination, true); + /** + * Before moving new file in place (and eventually overwriting the existing avatar with the newly uploaded avatar) + * + * @event core.avatar_driver_upload_move_file_before + * @var string destination Destination directory where the file is going to be moved + * @var string prefix Prefix for the avatar filename + * @var array row Array with avatar row data + * @var array error Array of errors, if filled in by this event file will not be moved + * @since 3.1.6-RC1 + */ + $vars = array( + 'destination', + 'prefix', + 'row', + 'error', + ); + extract($this->dispatcher->trigger_event('core.avatar_driver_upload_move_file_before', compact($vars))); - if (sizeof($file->error)) + if (!sizeof($error)) + { + // Move file and overwrite any existing image + $file->move_file($destination, true); + } + + // If there was an error during move, then clean up leftovers + $error = array_merge($error, $file->error); + if (sizeof($error)) { $file->remove(); - $error = array_merge($error, $file->error); return false; } + // Delete current avatar if not overwritten + $ext = substr(strrchr($row['avatar'], '.'), 1); + if ($ext && $ext !== $file->get('extension')) + { + $this->delete($row); + } + return array( 'avatar' => $row['id'] . '_' . time() . '.' . $file->get('extension'), 'avatar_width' => $file->get('width'), @@ -140,26 +226,48 @@ class upload extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function prepare_form_acp($user) { return array( 'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), - 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true), + 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), ); } /** - * @inheritdoc + * {@inheritdoc} */ public function delete($row) { + + $error = array(); + $destination = $this->config['avatar_path']; + $prefix = $this->config['avatar_salt'] . '_'; $ext = substr(strrchr($row['avatar'], '.'), 1); - $filename = $this->phpbb_root_path . $this->config['avatar_path'] . '/' . $this->config['avatar_salt'] . '_' . $row['id'] . '.' . $ext; + $filename = $this->phpbb_root_path . $destination . '/' . $prefix . $row['id'] . '.' . $ext; + + /** + * Before deleting an existing avatar + * + * @event core.avatar_driver_upload_delete_before + * @var string destination Destination directory where the file is going to be deleted + * @var string prefix Prefix for the avatar filename + * @var array row Array with avatar row data + * @var array error Array of errors, if filled in by this event file will not be deleted + * @since 3.1.6-RC1 + */ + $vars = array( + 'destination', + 'prefix', + 'row', + 'error', + ); + extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars))); - if (file_exists($filename)) + if (!sizeof($error) && file_exists($filename)) { @unlink($filename); } @@ -168,7 +276,7 @@ class upload extends \phpbb\avatar\driver\driver } /** - * @inheritdoc + * {@inheritdoc} */ public function get_template_name() { @@ -182,6 +290,6 @@ class upload extends \phpbb\avatar\driver\driver */ protected function can_upload() { - return (file_exists($this->phpbb_root_path . $this->config['avatar_path']) && phpbb_is_writable($this->phpbb_root_path . $this->config['avatar_path']) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')); + return (file_exists($this->phpbb_root_path . $this->config['avatar_path']) && $this->filesystem->is_writable($this->phpbb_root_path . $this->config['avatar_path']) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')); } } diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 6ce924d2eb..26eb17c265 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -1,17 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\avatar; -/** -* @package avatar -*/ class manager { /** @@ -40,8 +41,8 @@ class manager static protected $default_row = array( 'avatar' => '', 'avatar_type' => '', - 'avatar_width' => '', - 'avatar_height' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, ); /** @@ -245,7 +246,7 @@ class manager */ public function is_enabled($driver) { - $config_name = $this->get_driver_config_name($driver); + $config_name = $driver->get_config_name(); return $this->config["allow_avatar_{$config_name}"]; } @@ -259,7 +260,7 @@ class manager */ public function get_avatar_settings($driver) { - $config_name = $this->get_driver_config_name($driver); + $config_name = $driver->get_config_name(); return array( 'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper(str_replace('\\', '_', $config_name)), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), @@ -267,18 +268,6 @@ class manager } /** - * Get the config name of an avatar driver - * - * @param object $driver Avatar driver object - * - * @return string Avatar driver config name - */ - public function get_driver_config_name($driver) - { - return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver)); - } - - /** * Replace "error" strings with their real, localized form * * @param \phpbb\user phpBB User object @@ -306,4 +295,60 @@ class manager return $error; } + + /** + * Handle deleting avatars + * + * @param \phpbb\db\driver\driver_interface $db phpBB dbal + * @param \phpbb\user $user phpBB user object + * @param array $avatar_data Cleaned user data containing the user's + * avatar data + * @param string $table Database table from which the avatar should be deleted + * @param string $prefix Prefix of user data columns in database + * @return null + */ + public function handle_avatar_delete(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $avatar_data, $table, $prefix) + { + if ($driver = $this->get_driver($avatar_data['avatar_type'])) + { + $driver->delete($avatar_data); + } + + $result = $this->prefix_avatar_columns($prefix, self::$default_row); + + $sql = 'UPDATE ' . $table . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE ' . $prefix . 'id = ' . (int) $avatar_data['id']; + $db->sql_query($sql); + + // Make sure we also delete this avatar from the users + if ($prefix === 'group_') + { + $result = $this->prefix_avatar_columns('user_', self::$default_row); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . " + WHERE user_avatar = '" . $db->sql_escape($avatar_data['avatar']) . "'"; + $db->sql_query($sql); + } + } + + /** + * Prefix avatar columns + * + * @param string $prefix Column prefix + * @param array $data Column data + * + * @return array Column data with prefixed column names + */ + public function prefix_avatar_columns($prefix, $data) + { + foreach ($data as $key => $value) + { + $data[$prefix . $key] = $value; + unset($data[$key]); + } + + return $data; + } } diff --git a/phpBB/phpbb/cache/driver/apc.php b/phpBB/phpbb/cache/driver/apc.php index a28d91c00a..521d5d41ea 100644 --- a/phpBB/phpbb/cache/driver/apc.php +++ b/phpBB/phpbb/cache/driver/apc.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2005, 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,16 +15,13 @@ namespace phpbb\cache\driver; /** * ACM for APC -* @package acm */ class apc extends \phpbb\cache\driver\memory { var $extension = 'apc'; /** - * Purge cache data - * - * @return null + * {@inheritDoc} */ function purge() { diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index feaca25a5b..55cd4668de 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -1,17 +1,228 @@ <?php /** * -* @package acm -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\cache\driver; -/** -* @package acm -*/ abstract class base implements \phpbb\cache\driver\driver_interface { + var $vars = array(); + var $is_modified = false; + + var $sql_rowset = array(); + var $sql_row_pointer = array(); + var $cache_dir = ''; + + /** + * {@inheritDoc} + */ + function purge() + { + // Purge all phpbb cache files + try + { + $iterator = new \DirectoryIterator($this->cache_dir); + } + catch (\Exception $e) + { + return; + } + + foreach ($iterator as $fileInfo) + { + if ($fileInfo->isDot()) + { + continue; + } + $filename = $fileInfo->getFilename(); + if ($fileInfo->isDir()) + { + $this->remove_dir($fileInfo->getPathname()); + } + else if (strpos($filename, 'container_') === 0 || + strpos($filename, 'url_matcher') === 0 || + strpos($filename, 'url_generator') === 0 || + strpos($filename, 'sql_') === 0 || + strpos($filename, 'data_') === 0) + { + $this->remove_file($fileInfo->getPathname()); + } + } + + unset($this->vars); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + $this->vars = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); + + $this->is_modified = false; + } + + /** + * {@inheritDoc} + */ + function unload() + { + $this->save(); + unset($this->vars); + unset($this->sql_rowset); + unset($this->sql_row_pointer); + + $this->vars = array(); + $this->sql_rowset = array(); + $this->sql_row_pointer = array(); + } + + /** + * {@inheritDoc} + */ + function sql_load($query) + { + // Remove extra spaces and tabs + $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $query_id = md5($query); + + if (($result = $this->_read('sql_' . $query_id)) === false) + { + return false; + } + + $this->sql_rowset[$query_id] = $result; + $this->sql_row_pointer[$query_id] = 0; + + return $query_id; + } + + /** + * {@inheritDoc} + */ + function sql_exists($query_id) + { + return isset($this->sql_rowset[$query_id]); + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id) + { + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchfield($query_id, $field) + { + if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + { + return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, $query_id) + { + if ($rownum >= sizeof($this->sql_rowset[$query_id])) + { + return false; + } + + $this->sql_row_pointer[$query_id] = $rownum; + return true; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id) + { + if (!isset($this->sql_rowset[$query_id])) + { + return false; + } + + unset($this->sql_rowset[$query_id]); + unset($this->sql_row_pointer[$query_id]); + + return true; + } + + /** + * Removes/unlinks file + * + * @param string $filename Filename to remove + * @param bool $check Check file permissions + * @return bool True if the file was successfully removed, otherwise false + */ + function remove_file($filename, $check = false) + { + global $phpbb_filesystem; + + if ($check && !$phpbb_filesystem->is_writable($this->cache_dir)) + { + // E_USER_ERROR - not using language entry - intended. + trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); + } + + return @unlink($filename); + } + + /** + * Remove directory + * + * @param string $dir Directory to remove + * + * @return null + */ + protected function remove_dir($dir) + { + try + { + $iterator = new \DirectoryIterator($dir); + } + catch (\Exception $e) + { + return; + } + + foreach ($iterator as $fileInfo) + { + if ($fileInfo->isDot()) + { + continue; + } + + if ($fileInfo->isDir()) + { + $this->remove_dir($fileInfo->getPathname()); + } + else + { + $this->remove_file($fileInfo->getPathname()); + } + } + + @rmdir($dir); + } } diff --git a/phpBB/phpbb/cache/driver/driver_interface.php b/phpBB/phpbb/cache/driver/driver_interface.php index 0715a4b934..9ac9ca0c59 100644 --- a/phpBB/phpbb/cache/driver/driver_interface.php +++ b/phpBB/phpbb/cache/driver/driver_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,53 +15,78 @@ namespace phpbb\cache\driver; /** * An interface that all cache drivers must implement -* -* @package acm */ interface driver_interface { /** * Load global cache + * + * @return mixed False if an error was encountered, otherwise the data type of the cached data */ public function load(); /** * Unload cache object + * + * @return null */ public function unload(); /** * Save modified objects + * + * @return null */ public function save(); /** * Tidy cache + * + * @return null */ public function tidy(); /** * Get saved cache object + * + * @param string $var_name Cache key + * @return mixed False if an error was encountered, otherwise the saved cached object */ public function get($var_name); /** * Put data into cache + * + * @param string $var_name Cache key + * @param mixed $var Cached data to store + * @param int $ttl Time-to-live of cached data + * @return null */ public function put($var_name, $var, $ttl = 0); /** * Purge cache data + * + * @return null */ public function purge(); /** * Destroy cache data + * + * @param string $var_name Cache key + * @param string $table Table name + * @return null */ public function destroy($var_name, $table = ''); /** * Check if a given cache entry exists + * + * @param string $var_name Cache key + * + * @return bool True if cache file exists and has not expired. + * False otherwise. */ public function _exists($var_name); @@ -79,7 +108,7 @@ interface driver_interface * result to persistent storage. In other words, there is no need * to call save() afterwards. * - * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\db\driver\driver_interface $db Database connection * @param string $query SQL query, should be used for generating storage key * @param mixed $query_result The result from \dbal::sql_query, to be passed to * \dbal::sql_fetchrow to get all rows and store them @@ -90,7 +119,7 @@ interface driver_interface * representing the query should be returned. Otherwise * the original $query_result should be returned. */ - public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl); + public function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl); /** * Check if result for a given SQL query exists in cache. @@ -113,7 +142,7 @@ interface driver_interface * Fetch a field from the current row of a cached database result (database) * * @param int $query_id - * @param $field The name of the column. + * @param string $field The name of the column. * @return string|bool The field of the query result if found in the cache, * otherwise false. */ diff --git a/phpBB/phpbb/cache/driver/dummy.php b/phpBB/phpbb/cache/driver/dummy.php new file mode 100644 index 0000000000..1f74f6dd77 --- /dev/null +++ b/phpBB/phpbb/cache/driver/dummy.php @@ -0,0 +1,153 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cache\driver; + +/** +* ACM dummy Caching +*/ +class dummy extends \phpbb\cache\driver\base +{ + /** + * Set cache path + */ + function __construct() + { + } + + /** + * {@inheritDoc} + */ + function load() + { + return true; + } + + /** + * {@inheritDoc} + */ + function unload() + { + } + + /** + * {@inheritDoc} + */ + function save() + { + } + + /** + * {@inheritDoc} + */ + function tidy() + { + global $config; + + // This cache always has a tidy room. + $config->set('cache_last_gc', time(), false); + } + + /** + * {@inheritDoc} + */ + function get($var_name) + { + return false; + } + + /** + * {@inheritDoc} + */ + function put($var_name, $var, $ttl = 0) + { + } + + /** + * {@inheritDoc} + */ + function purge() + { + } + + /** + * {@inheritDoc} + */ + function destroy($var_name, $table = '') + { + } + + /** + * {@inheritDoc} + */ + function _exists($var_name) + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_load($query) + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl) + { + return $query_result; + } + + /** + * {@inheritDoc} + */ + function sql_exists($query_id) + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id) + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchfield($query_id, $field) + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, $query_id) + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id) + { + return false; + } +} diff --git a/phpBB/phpbb/cache/driver/eaccelerator.php b/phpBB/phpbb/cache/driver/eaccelerator.php index 2629cb53e5..740855144f 100644 --- a/phpBB/phpbb/cache/driver/eaccelerator.php +++ b/phpBB/phpbb/cache/driver/eaccelerator.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2005, 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\cache\driver; /** * ACM for eAccelerator -* @package acm * @todo Missing locks from destroy() talk with David */ class eaccelerator extends \phpbb\cache\driver\memory @@ -22,9 +25,7 @@ class eaccelerator extends \phpbb\cache\driver\memory var $serialize_header = '#phpbb-serialized#'; /** - * Purge cache data - * - * @return null + * {@inheritDoc} */ function purge() { @@ -39,15 +40,15 @@ class eaccelerator extends \phpbb\cache\driver\memory } /** - * Perform cache garbage collection - * - * @return null - */ + * {@inheritDoc} + */ function tidy() { + global $config; + eaccelerator_gc(); - set_config('cache_last_gc', time(), true); + $config->set('cache_last_gc', time(), false); } /** diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 6686da6953..bb055d3acf 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2005, 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,29 +15,36 @@ namespace phpbb\cache\driver; /** * ACM File Based Caching -* @package acm */ class file extends \phpbb\cache\driver\base { - var $vars = array(); var $var_expires = array(); - var $is_modified = false; - var $sql_rowset = array(); - var $sql_row_pointer = array(); - var $cache_dir = ''; + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; /** * Set cache path + * + * @param string $cache_dir Define the path to the cache directory (default: $phpbb_root_path . 'cache/') */ function __construct($cache_dir = null) { - global $phpbb_root_path; - $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/'; + global $phpbb_root_path, $phpbb_container; + + $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/'; + $this->filesystem = new \phpbb\filesystem\filesystem(); + + if (!is_dir($this->cache_dir)) + { + @mkdir($this->cache_dir, 0777, true); + } } /** - * Load global cache + * {@inheritDoc} */ function load() { @@ -41,24 +52,17 @@ class file extends \phpbb\cache\driver\base } /** - * Unload cache object + * {@inheritDoc} */ function unload() { - $this->save(); - unset($this->vars); + parent::unload(); unset($this->var_expires); - unset($this->sql_rowset); - unset($this->sql_row_pointer); - - $this->vars = array(); $this->var_expires = array(); - $this->sql_rowset = array(); - $this->sql_row_pointer = array(); } /** - * Save modified objects + * {@inheritDoc} */ function save() { @@ -71,14 +75,8 @@ class file extends \phpbb\cache\driver\base if (!$this->_write('data_global')) { - if (!function_exists('phpbb_is_writable')) - { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - // Now, this occurred how often? ... phew, just tell the user then... - if (!phpbb_is_writable($this->cache_dir)) + if (!$this->filesystem->is_writable($this->cache_dir)) { // We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload()) die('Fatal: ' . $this->cache_dir . ' is NOT writable.'); @@ -93,11 +91,11 @@ class file extends \phpbb\cache\driver\base } /** - * Tidy cache + * {@inheritDoc} */ function tidy() { - global $phpEx; + global $config, $phpEx; $dir = @opendir($this->cache_dir); @@ -151,18 +149,16 @@ class file extends \phpbb\cache\driver\base } } - set_config('cache_last_gc', time(), true); + $config->set('cache_last_gc', time(), false); } /** - * Get saved cache object + * {@inheritDoc} */ function get($var_name) { if ($var_name[0] == '_') { - global $phpEx; - if (!$this->_exists($var_name)) { return false; @@ -177,7 +173,7 @@ class file extends \phpbb\cache\driver\base } /** - * Put data into cache + * {@inheritDoc} */ function put($var_name, $var, $ttl = 31536000) { @@ -194,93 +190,16 @@ class file extends \phpbb\cache\driver\base } /** - * Purge cache data + * {@inheritDoc} */ function purge() { - // Purge all phpbb cache files - try - { - $iterator = new \DirectoryIterator($this->cache_dir); - } - catch (Exception $e) - { - return; - } - - foreach ($iterator as $fileInfo) - { - if ($fileInfo->isDot()) - { - continue; - } - $filename = $fileInfo->getFilename(); - if ($fileInfo->isDir()) - { - $this->remove_dir($fileInfo->getPathname()); - } - elseif (strpos($filename, 'container_') === 0 || - strpos($filename, 'url_matcher') === 0 || - strpos($filename, 'sql_') === 0 || - strpos($filename, 'data_') === 0) - { - $this->remove_file($fileInfo->getPathname()); - } - } - - unset($this->vars); - unset($this->var_expires); - unset($this->sql_rowset); - unset($this->sql_row_pointer); - - $this->vars = array(); + parent::purge(); $this->var_expires = array(); - $this->sql_rowset = array(); - $this->sql_row_pointer = array(); - - $this->is_modified = false; - } - - /** - * Remove directory - * - * @param string $dir Directory to remove - * - * @return null - */ - protected function remove_dir($dir) - { - try - { - $iterator = new \DirectoryIterator($dir); - } - catch (Exception $e) - { - return; - } - - foreach ($iterator as $fileInfo) - { - if ($fileInfo->isDot()) - { - continue; - } - - if ($fileInfo->isDir()) - { - $this->remove_dir($fileInfo->getPathname()); - } - else - { - $this->remove_file($fileInfo->getPathname()); - } - } - - @rmdir($dir); } /** - * Destroy cache data + * {@inheritDoc} */ function destroy($var_name, $table = '') { @@ -359,13 +278,14 @@ class file extends \phpbb\cache\driver\base } /** - * Check if a given cache entry exist + * {@inheritDoc} */ function _exists($var_name) { if ($var_name[0] == '_') { global $phpEx; + $var_name = $this->clean_varname($var_name); return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx"); } else @@ -385,34 +305,14 @@ class file extends \phpbb\cache\driver\base } /** - * Load cached sql query - */ - function sql_load($query) - { - // Remove extra spaces and tabs - $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - - if (($rowset = $this->_read('sql_' . md5($query))) === false) - { - return false; - } - - $query_id = sizeof($this->sql_rowset); - $this->sql_rowset[$query_id] = $rowset; - $this->sql_row_pointer[$query_id] = 0; - - return $query_id; - } - - /** * {@inheritDoc} */ - function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) + function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $query_id = sizeof($this->sql_rowset); + $query_id = md5($query); $this->sql_rowset[$query_id] = array(); $this->sql_row_pointer[$query_id] = 0; @@ -422,7 +322,7 @@ class file extends \phpbb\cache\driver\base } $db->sql_freeresult($query_result); - if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query)) + if ($this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl + time(), $query)) { return $query_id; } @@ -431,70 +331,6 @@ class file extends \phpbb\cache\driver\base } /** - * Ceck if a given sql query exist in cache - */ - function sql_exists($query_id) - { - return isset($this->sql_rowset[$query_id]); - } - - /** - * Fetch row from cache (database) - */ - function sql_fetchrow($query_id) - { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) - { - return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; - } - - return false; - } - - /** - * Fetch a field from the current row of a cached database result (database) - */ - function sql_fetchfield($query_id, $field) - { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) - { - return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false; - } - - return false; - } - - /** - * Seek a specific row in an a cached database result (database) - */ - function sql_rowseek($rownum, $query_id) - { - if ($rownum >= sizeof($this->sql_rowset[$query_id])) - { - return false; - } - - $this->sql_row_pointer[$query_id] = $rownum; - return true; - } - - /** - * Free memory used for a cached database result (database) - */ - function sql_freeresult($query_id) - { - if (!isset($this->sql_rowset[$query_id])) - { - return false; - } - - unset($this->sql_rowset[$query_id]); - unset($this->sql_row_pointer[$query_id]); - - return true; - } - - /** * Read cached data from a specified file * * @access private @@ -505,6 +341,7 @@ class file extends \phpbb\cache\driver\base { global $phpEx; + $filename = $this->clean_varname($filename); $file = "{$this->cache_dir}$filename.$phpEx"; $type = substr($filename, 0, strpos($filename, '_')); @@ -687,6 +524,7 @@ class file extends \phpbb\cache\driver\base { global $phpEx; + $filename = $this->clean_varname($filename); $file = "{$this->cache_dir}$filename.$phpEx"; $lock = new \phpbb\lock\flock($file); @@ -736,13 +574,14 @@ class file extends \phpbb\cache\driver\base fclose($handle); - if (!function_exists('phpbb_chmod')) + try { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/functions.' . $phpEx); + $this->filesystem->phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing } - - phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE); $return_value = true; } @@ -757,22 +596,13 @@ class file extends \phpbb\cache\driver\base } /** - * Removes/unlinks file + * Replace slashes in the file name + * + * @param string $varname name of a cache variable + * @return string $varname name that is safe to use as a filename */ - function remove_file($filename, $check = false) + protected function clean_varname($varname) { - if (!function_exists('phpbb_is_writable')) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - - if ($check && !phpbb_is_writable($this->cache_dir)) - { - // E_USER_ERROR - not using language entry - intended. - trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); - } - - return @unlink($filename); + return str_replace('/', '-', $varname); } } diff --git a/phpBB/phpbb/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php index c725ec0fb0..caa82fb0b1 100644 --- a/phpBB/phpbb/cache/driver/memcache.php +++ b/phpBB/phpbb/cache/driver/memcache.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2005, 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -32,7 +36,6 @@ if (!defined('PHPBB_ACM_MEMCACHE')) /** * ACM for Memcached -* @package acm */ class memcache extends \phpbb\cache\driver\memory { @@ -47,7 +50,7 @@ class memcache extends \phpbb\cache\driver\memory parent::__construct(); $this->memcache = new \Memcache; - foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u) + foreach (explode(',', PHPBB_ACM_MEMCACHE) as $u) { $parts = explode('/', $u); $this->memcache->addServer(trim($parts[0]), trim($parts[1])); @@ -56,9 +59,7 @@ class memcache extends \phpbb\cache\driver\memory } /** - * Unload the cache resources - * - * @return null + * {@inheritDoc} */ function unload() { @@ -68,9 +69,7 @@ class memcache extends \phpbb\cache\driver\memory } /** - * Purge cache data - * - * @return null + * {@inheritDoc} */ function purge() { diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index 292024212b..baae22d809 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,19 +15,11 @@ namespace phpbb\cache\driver; /** * ACM Abstract Memory Class -* @package acm */ abstract class memory extends \phpbb\cache\driver\base { var $key_prefix; - var $vars = array(); - var $is_modified = false; - - var $sql_rowset = array(); - var $sql_row_pointer = array(); - var $cache_dir = ''; - /** * Set cache path */ @@ -50,7 +46,7 @@ abstract class memory extends \phpbb\cache\driver\base } /** - * Load global cache + * {@inheritDoc} */ function load() { @@ -66,22 +62,7 @@ abstract class memory extends \phpbb\cache\driver\base } /** - * Unload cache object - */ - function unload() - { - $this->save(); - unset($this->vars); - unset($this->sql_rowset); - unset($this->sql_row_pointer); - - $this->vars = array(); - $this->sql_rowset = array(); - $this->sql_row_pointer = array(); - } - - /** - * Save modified objects + * {@inheritDoc} */ function save() { @@ -96,17 +77,18 @@ abstract class memory extends \phpbb\cache\driver\base } /** - * Tidy cache + * {@inheritDoc} */ function tidy() { - // cache has auto GC, no need to have any code here :) + global $config; - set_config('cache_last_gc', time(), true); + // cache has auto GC, no need to have any code here :) + $config->set('cache_last_gc', time(), false); } /** - * Get saved cache object + * {@inheritDoc} */ function get($var_name) { @@ -126,7 +108,7 @@ abstract class memory extends \phpbb\cache\driver\base } /** - * Put data into cache + * {@inheritDoc} */ function put($var_name, $var, $ttl = 2592000) { @@ -142,48 +124,7 @@ abstract class memory extends \phpbb\cache\driver\base } /** - * Purge cache data - */ - function purge() - { - // Purge all phpbb cache files - $dir = @opendir($this->cache_dir); - - if (!$dir) - { - return; - } - - while (($entry = readdir($dir)) !== false) - { - if (strpos($entry, 'container_') !== 0 && - strpos($entry, 'url_matcher') !== 0 && - strpos($entry, 'sql_') !== 0 && - strpos($entry, 'data_') !== 0 && - strpos($entry, 'ctpl_') !== 0 && - strpos($entry, 'tpl_') !== 0) - { - continue; - } - - $this->remove_file($this->cache_dir . $entry); - } - closedir($dir); - - unset($this->vars); - unset($this->sql_rowset); - unset($this->sql_row_pointer); - - $this->vars = array(); - $this->sql_rowset = array(); - $this->sql_row_pointer = array(); - - $this->is_modified = false; - } - - - /** - * Destroy cache data + * {@inheritDoc} */ function destroy($var_name, $table = '') { @@ -237,7 +178,7 @@ abstract class memory extends \phpbb\cache\driver\base } /** - * Check if a given cache entry exist + * {@inheritDoc} */ function _exists($var_name) { @@ -257,43 +198,35 @@ abstract class memory extends \phpbb\cache\driver\base } /** - * Load cached sql query - */ - function sql_load($query) - { - // Remove extra spaces and tabs - $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $query_id = sizeof($this->sql_rowset); - - if (($result = $this->_read('sql_' . md5($query))) === false) - { - return false; - } - - $this->sql_rowset[$query_id] = $result; - $this->sql_row_pointer[$query_id] = 0; - - return $query_id; - } - - /** * {@inheritDoc} */ - function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) + function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $hash = md5($query); + $query_id = md5($query); // determine which tables this query belongs to // Some queries use backticks, namely the get_database_size() query // don't check for conformity, the SQL would error and not reach here. - if (!preg_match('/FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?/', $query, $regs)) + if (!preg_match_all('/(?:FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?)|(?:JOIN (`?\\w+`?(?: \\w+)?))/', $query, $regs, PREG_SET_ORDER)) { // Bail out if the match fails. return $query_result; } - $tables = array_map('trim', explode(',', $regs[1])); + + $tables = array(); + foreach ($regs as $match) + { + if ($match[0][0] == 'F') + { + $tables = array_merge($tables, array_map('trim', explode(',', $match[1]))); + } + else + { + $tables[] = $match[2]; + } + } foreach ($tables as $table_name) { @@ -312,14 +245,13 @@ abstract class memory extends \phpbb\cache\driver\base $temp = array(); } - $temp[$hash] = true; + $temp[$query_id] = true; // This must never expire $this->_write('sql_' . $table_name, $temp, 0); } // store them in the right place - $query_id = sizeof($this->sql_rowset); $this->sql_rowset[$query_id] = array(); $this->sql_row_pointer[$query_id] = 0; @@ -329,96 +261,12 @@ abstract class memory extends \phpbb\cache\driver\base } $db->sql_freeresult($query_result); - $this->_write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl); + $this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl); return $query_id; } /** - * Ceck if a given sql query exist in cache - */ - function sql_exists($query_id) - { - return isset($this->sql_rowset[$query_id]); - } - - /** - * Fetch row from cache (database) - */ - function sql_fetchrow($query_id) - { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) - { - return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; - } - - return false; - } - - /** - * Fetch a field from the current row of a cached database result (database) - */ - function sql_fetchfield($query_id, $field) - { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) - { - return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false; - } - - return false; - } - - /** - * Seek a specific row in an a cached database result (database) - */ - function sql_rowseek($rownum, $query_id) - { - if ($rownum >= sizeof($this->sql_rowset[$query_id])) - { - return false; - } - - $this->sql_row_pointer[$query_id] = $rownum; - return true; - } - - /** - * Free memory used for a cached database result (database) - */ - function sql_freeresult($query_id) - { - if (!isset($this->sql_rowset[$query_id])) - { - return false; - } - - unset($this->sql_rowset[$query_id]); - unset($this->sql_row_pointer[$query_id]); - - return true; - } - - /** - * Removes/unlinks file - */ - function remove_file($filename, $check = false) - { - if (!function_exists('phpbb_is_writable')) - { - global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - - if ($check && !phpbb_is_writable($this->cache_dir)) - { - // E_USER_ERROR - not using language entry - intended. - trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); - } - - return @unlink($filename); - } - - /** * Check if a cache var exists * * @access protected diff --git a/phpBB/phpbb/cache/driver/null.php b/phpBB/phpbb/cache/driver/null.php deleted file mode 100644 index ea535ca1e1..0000000000 --- a/phpBB/phpbb/cache/driver/null.php +++ /dev/null @@ -1,148 +0,0 @@ -<?php -/** -* -* @package acm -* @copyright (c) 2005, 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\cache\driver; - -/** -* ACM Null Caching -* @package acm -*/ -class null extends \phpbb\cache\driver\base -{ - /** - * Set cache path - */ - function __construct() - { - } - - /** - * Load global cache - */ - function load() - { - return true; - } - - /** - * Unload cache object - */ - function unload() - { - } - - /** - * Save modified objects - */ - function save() - { - } - - /** - * Tidy cache - */ - function tidy() - { - // This cache always has a tidy room. - set_config('cache_last_gc', time(), true); - } - - /** - * Get saved cache object - */ - function get($var_name) - { - return false; - } - - /** - * Put data into cache - */ - function put($var_name, $var, $ttl = 0) - { - } - - /** - * Purge cache data - */ - function purge() - { - } - - /** - * Destroy cache data - */ - function destroy($var_name, $table = '') - { - } - - /** - * Check if a given cache entry exist - */ - function _exists($var_name) - { - return false; - } - - /** - * Load cached sql query - */ - function sql_load($query) - { - return false; - } - - /** - * {@inheritDoc} - */ - function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) - { - return $query_result; - } - - /** - * Ceck if a given sql query exist in cache - */ - function sql_exists($query_id) - { - return false; - } - - /** - * Fetch row from cache (database) - */ - function sql_fetchrow($query_id) - { - return false; - } - - /** - * Fetch a field from the current row of a cached database result (database) - */ - function sql_fetchfield($query_id, $field) - { - return false; - } - - /** - * Seek a specific row in an a cached database result (database) - */ - function sql_rowseek($rownum, $query_id) - { - return false; - } - - /** - * Free memory used for a cached database result (database) - */ - function sql_freeresult($query_id) - { - return false; - } -} diff --git a/phpBB/phpbb/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php index 2b6f9bf36d..eda774491c 100644 --- a/phpBB/phpbb/cache/driver/redis.php +++ b/phpBB/phpbb/cache/driver/redis.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -25,7 +29,6 @@ if (!defined('PHPBB_ACM_REDIS_HOST')) * Compatible with the php extension phpredis available * at https://github.com/nicolasff/phpredis * -* @package acm */ class redis extends \phpbb\cache\driver\memory { @@ -92,9 +95,7 @@ class redis extends \phpbb\cache\driver\memory } /** - * Unload the cache resources - * - * @return null + * {@inheritDoc} */ function unload() { @@ -104,9 +105,7 @@ class redis extends \phpbb\cache\driver\memory } /** - * Purge cache data - * - * @return null + * {@inheritDoc} */ function purge() { diff --git a/phpBB/phpbb/cache/driver/wincache.php b/phpBB/phpbb/cache/driver/wincache.php index 1f040e9ab2..632b534362 100644 --- a/phpBB/phpbb/cache/driver/wincache.php +++ b/phpBB/phpbb/cache/driver/wincache.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,16 +15,13 @@ namespace phpbb\cache\driver; /** * ACM for WinCache -* @package acm */ class wincache extends \phpbb\cache\driver\memory { var $extension = 'wincache'; /** - * Purge cache data - * - * @return null + * {@inheritDoc} */ function purge() { diff --git a/phpBB/phpbb/cache/driver/xcache.php b/phpBB/phpbb/cache/driver/xcache.php index 4d0d683b3d..0c845a6a8d 100644 --- a/phpBB/phpbb/cache/driver/xcache.php +++ b/phpBB/phpbb/cache/driver/xcache.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2005, 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\cache\driver; /** * ACM for XCache -* @package acm * * To use this module you need ini_get() enabled and the following INI settings configured as follows: * - xcache.var_size > 0 @@ -33,9 +36,7 @@ class xcache extends \phpbb\cache\driver\memory } /** - * Purge cache data - * - * @return null + * {@inheritDoc} */ function purge() { diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index ebbcfb8cdb..a022c00bc6 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -1,9 +1,13 @@ <?php /** * -* @package acm -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\cache; /** * Class for grabbing/handling cached entries -* @package acm */ class service { @@ -32,7 +35,7 @@ class service /** * Database connection. * - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -44,7 +47,7 @@ class service protected $phpbb_root_path; /** - * PHP extension. + * PHP file extension. * * @var string */ @@ -55,11 +58,11 @@ class service * * @param \phpbb\cache\driver\driver_interface $driver The cache driver * @param \phpbb\config\config $config The config - * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\db\driver\driver_interface $db Database connection * @param string $phpbb_root_path Root path - * @param string $php_ext PHP extension + * @param string $php_ext PHP file extension */ - public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext) { $this->set_driver($driver); $this->config = $config; @@ -138,6 +141,7 @@ class service $icons[$row['icons_id']]['img'] = $row['icons_url']; $icons[$row['icons_id']]['width'] = (int) $row['icons_width']; $icons[$row['icons_id']]['height'] = (int) $row['icons_height']; + $icons[$row['icons_id']]['alt'] = ($row['icons_alt']) ? $row['icons_alt'] : ''; $icons[$row['icons_id']]['display'] = (bool) $row['display_on_posting']; } $this->db->sql_freeresult($result); @@ -165,18 +169,12 @@ class service { if ($row['rank_special']) { - $ranks['special'][$row['rank_id']] = array( - 'rank_title' => $row['rank_title'], - 'rank_image' => $row['rank_image'] - ); + unset($row['rank_min']); + $ranks['special'][$row['rank_id']] = $row; } else { - $ranks['normal'][] = array( - 'rank_title' => $row['rank_title'], - 'rank_min' => $row['rank_min'], - 'rank_image' => $row['rank_image'] - ); + $ranks['normal'][$row['rank_id']] = $row; } } $this->db->sql_freeresult($result); @@ -302,7 +300,7 @@ class service { if (($bots = $this->driver->get('_bots')) === false) { - switch ($this->db->sql_layer) + switch ($this->db->get_sql_layer()) { case 'mssql': case 'mssql_odbc': @@ -313,13 +311,6 @@ class service ORDER BY LEN(bot_agent) DESC'; break; - case 'firebird': - $sql = 'SELECT user_id, bot_agent, bot_ip - FROM ' . BOTS_TABLE . ' - WHERE bot_active = 1 - ORDER BY CHAR_LENGTH(bot_agent) DESC'; - break; - // LENGTH supported by MySQL, IBM DB2 and Oracle for sure... default: $sql = 'SELECT user_id, bot_agent, bot_ip diff --git a/phpBB/phpbb/captcha/char_cube3d.php b/phpBB/phpbb/captcha/char_cube3d.php new file mode 100644 index 0000000000..a712b16dce --- /dev/null +++ b/phpBB/phpbb/captcha/char_cube3d.php @@ -0,0 +1,277 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +class char_cube3d +{ + var $bitmap; + var $bitmap_width; + var $bitmap_height; + + var $basis_matrix = array(array(1, 0, 0), array(0, 1, 0), array(0, 0, 1)); + var $abs_x = array(1, 0); + var $abs_y = array(0, 1); + var $x = 0; + var $y = 1; + var $z = 2; + var $letter = ''; + + /** + */ + function __construct(&$bitmaps, $letter) + { + $this->bitmap = $bitmaps['data'][$letter]; + $this->bitmap_width = $bitmaps['width']; + $this->bitmap_height = $bitmaps['height']; + + $this->basis_matrix[0][0] = mt_rand(-600, 600); + $this->basis_matrix[0][1] = mt_rand(-600, 600); + $this->basis_matrix[0][2] = (mt_rand(0, 1) * 2000) - 1000; + $this->basis_matrix[1][0] = mt_rand(-1000, 1000); + $this->basis_matrix[1][1] = mt_rand(-1000, 1000); + $this->basis_matrix[1][2] = mt_rand(-1000, 1000); + + $this->normalize($this->basis_matrix[0]); + $this->normalize($this->basis_matrix[1]); + $this->basis_matrix[2] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[1]); + $this->normalize($this->basis_matrix[2]); + + // $this->basis_matrix[1] might not be (probably isn't) orthogonal to $basis_matrix[0] + $this->basis_matrix[1] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[2]); + $this->normalize($this->basis_matrix[1]); + + // Make sure our cube is facing into the canvas (assuming +z == in) + for ($i = 0; $i < 3; ++$i) + { + if ($this->basis_matrix[$i][2] < 0) + { + $this->basis_matrix[$i][0] *= -1; + $this->basis_matrix[$i][1] *= -1; + $this->basis_matrix[$i][2] *= -1; + } + } + + // Force our "z" basis vector to be the one with greatest absolute z value + $this->x = 0; + $this->y = 1; + $this->z = 2; + + // Swap "y" with "z" + if ($this->basis_matrix[1][2] > $this->basis_matrix[2][2]) + { + $this->z = 1; + $this->y = 2; + } + + // Swap "x" with "z" + if ($this->basis_matrix[0][2] > $this->basis_matrix[$this->z][2]) + { + $this->x = $this->z; + $this->z = 0; + } + + // Still need to determine which of $x,$y are which. + // wrong orientation if y's y-component is less than it's x-component + // likewise if x's x-component is less than it's y-component + // if they disagree, go with the one with the greater weight difference. + // rotate if positive + $weight = (abs($this->basis_matrix[$this->x][1]) - abs($this->basis_matrix[$this->x][0])) + (abs($this->basis_matrix[$this->y][0]) - abs($this->basis_matrix[$this->y][1])); + + // Swap "x" with "y" + if ($weight > 0) + { + list($this->x, $this->y) = array($this->y, $this->x); + } + + $this->abs_x = array($this->basis_matrix[$this->x][0], $this->basis_matrix[$this->x][1]); + $this->abs_y = array($this->basis_matrix[$this->y][0], $this->basis_matrix[$this->y][1]); + + if ($this->abs_x[0] < 0) + { + $this->abs_x[0] *= -1; + $this->abs_x[1] *= -1; + } + + if ($this->abs_y[1] > 0) + { + $this->abs_y[0] *= -1; + $this->abs_y[1] *= -1; + } + + $this->letter = $letter; + } + + /** + * Draw a character + */ + function drawchar($scale, $xoff, $yoff, $img, $background, $colours) + { + $width = $this->bitmap_width; + $height = $this->bitmap_height; + $bitmap = $this->bitmap; + + $colour1 = $colours[array_rand($colours)]; + $colour2 = $colours[array_rand($colours)]; + + $swapx = ($this->basis_matrix[$this->x][0] > 0); + $swapy = ($this->basis_matrix[$this->y][1] < 0); + + for ($y = 0; $y < $height; ++$y) + { + for ($x = 0; $x < $width; ++$x) + { + $xp = ($swapx) ? ($width - $x - 1) : $x; + $yp = ($swapy) ? ($height - $y - 1) : $y; + + if ($bitmap[$height - $yp - 1][$xp]) + { + $dx = $this->scale($this->abs_x, ($xp - ($swapx ? ($width / 2) : ($width / 2) - 1)) * $scale); + $dy = $this->scale($this->abs_y, ($yp - ($swapy ? ($height / 2) : ($height / 2) - 1)) * $scale); + $xo = $xoff + $dx[0] + $dy[0]; + $yo = $yoff + $dx[1] + $dy[1]; + + $origin = array(0, 0, 0); + $xvec = $this->scale($this->basis_matrix[$this->x], $scale); + $yvec = $this->scale($this->basis_matrix[$this->y], $scale); + $face_corner = $this->sum2($xvec, $yvec); + + $zvec = $this->scale($this->basis_matrix[$this->z], $scale); + $x_corner = $this->sum2($xvec, $zvec); + $y_corner = $this->sum2($yvec, $zvec); + + imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $xvec, $x_corner,$zvec), 4, $colour1); + imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $yvec, $y_corner,$zvec), 4, $colour2); + + $face = $this->gen_poly($xo, $yo, $origin, $xvec, $face_corner, $yvec); + + imagefilledpolygon($img, $face, 4, $background); + imagepolygon($img, $face, 4, $colour1); + } + } + } + } + + /* + * return a roughly acceptable range of sizes for rendering with this texttype + */ + function range() + { + return array(3, 4); + } + + /** + * Vector length + */ + function vectorlen($vector) + { + return sqrt(pow($vector[0], 2) + pow($vector[1], 2) + pow($vector[2], 2)); + } + + /** + * Normalize + */ + function normalize(&$vector, $length = 1) + { + $length = (( $length < 1) ? 1 : $length); + $length /= $this->vectorlen($vector); + $vector[0] *= $length; + $vector[1] *= $length; + $vector[2] *= $length; + } + + /** + */ + function cross_product($vector1, $vector2) + { + $retval = array(0, 0, 0); + $retval[0] = (($vector1[1] * $vector2[2]) - ($vector1[2] * $vector2[1])); + $retval[1] = -(($vector1[0] * $vector2[2]) - ($vector1[2] * $vector2[0])); + $retval[2] = (($vector1[0] * $vector2[1]) - ($vector1[1] * $vector2[0])); + + return $retval; + } + + /** + */ + function sum($vector1, $vector2) + { + return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1], $vector1[2] + $vector2[2]); + } + + /** + */ + function sum2($vector1, $vector2) + { + return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1]); + } + + /** + */ + function scale($vector, $length) + { + if (sizeof($vector) == 2) + { + return array($vector[0] * $length, $vector[1] * $length); + } + + return array($vector[0] * $length, $vector[1] * $length, $vector[2] * $length); + } + + /** + */ + function gen_poly($xoff, $yoff, &$vec1, &$vec2, &$vec3, &$vec4) + { + $poly = array(); + $poly[0] = $xoff + $vec1[0]; + $poly[1] = $yoff + $vec1[1]; + $poly[2] = $xoff + $vec2[0]; + $poly[3] = $yoff + $vec2[1]; + $poly[4] = $xoff + $vec3[0]; + $poly[5] = $yoff + $vec3[1]; + $poly[6] = $xoff + $vec4[0]; + $poly[7] = $yoff + $vec4[1]; + + return $poly; + } + + /** + * dimensions + */ + function dimensions($size) + { + $xn = $this->scale($this->basis_matrix[$this->x], -($this->bitmap_width / 2) * $size); + $xp = $this->scale($this->basis_matrix[$this->x], ($this->bitmap_width / 2) * $size); + $yn = $this->scale($this->basis_matrix[$this->y], -($this->bitmap_height / 2) * $size); + $yp = $this->scale($this->basis_matrix[$this->y], ($this->bitmap_height / 2) * $size); + + $p = array(); + $p[0] = $this->sum2($xn, $yn); + $p[1] = $this->sum2($xp, $yn); + $p[2] = $this->sum2($xp, $yp); + $p[3] = $this->sum2($xn, $yp); + + $min_x = $max_x = $p[0][0]; + $min_y = $max_y = $p[0][1]; + + for ($i = 1; $i < 4; ++$i) + { + $min_x = ($min_x > $p[$i][0]) ? $p[$i][0] : $min_x; + $min_y = ($min_y > $p[$i][1]) ? $p[$i][1] : $min_y; + $max_x = ($max_x < $p[$i][0]) ? $p[$i][0] : $max_x; + $max_y = ($max_y < $p[$i][1]) ? $p[$i][1] : $max_y; + } + + return array($min_x, $min_y, $max_x, $max_y); + } +} diff --git a/phpBB/phpbb/captcha/colour_manager.php b/phpBB/phpbb/captcha/colour_manager.php new file mode 100644 index 0000000000..6ca3c3fd2c --- /dev/null +++ b/phpBB/phpbb/captcha/colour_manager.php @@ -0,0 +1,527 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +class colour_manager +{ + var $img; + var $mode; + var $colours; + var $named_colours; + + /** + * Create the colour manager, link it to the image resource + */ + function __construct($img, $background = false, $mode = 'ahsv') + { + $this->img = $img; + $this->mode = $mode; + $this->colours = array(); + $this->named_colours = array(); + + if ($background !== false) + { + $bg = $this->allocate_named('background', $background); + imagefill($this->img, 0, 0, $bg); + } + } + + /** + * Lookup a named colour resource + */ + function get_resource($named_colour) + { + if (isset($this->named_colours[$named_colour])) + { + return $this->named_colours[$named_colour]; + } + + if (isset($this->named_rgb[$named_colour])) + { + return $this->allocate_named($named_colour, $this->named_rgb[$named_colour], 'rgb'); + } + + return false; + } + + /** + * Assign a name to a colour resource + */ + function name_colour($name, $resource) + { + $this->named_colours[$name] = $resource; + } + + /** + * names and allocates a colour resource + */ + function allocate_named($name, $colour, $mode = false) + { + $resource = $this->allocate($colour, $mode); + + if ($resource !== false) + { + $this->name_colour($name, $resource); + } + return $resource; + } + + /** + * allocates a specified colour into the image + */ + function allocate($colour, $mode = false) + { + if ($mode === false) + { + $mode = $this->mode; + } + + if (!is_array($colour)) + { + if (isset($this->named_rgb[$colour])) + { + return $this->allocate_named($colour, $this->named_rgb[$colour], 'rgb'); + } + + if (!is_int($colour)) + { + return false; + } + + $mode = 'rgb'; + $colour = array(255 & ($colour >> 16), 255 & ($colour >> 8), 255 & $colour); + } + + if (isset($colour['mode'])) + { + $mode = $colour['mode']; + unset($colour['mode']); + } + + if (isset($colour['random'])) + { + unset($colour['random']); + // everything else is params + return $this->random_colour($colour, $mode); + } + + $rgb = $this->model_convert($colour, $mode, 'rgb'); + $store = ($this->mode == 'rgb') ? $rgb : $this->model_convert($colour, $mode, $this->mode); + $resource = imagecolorallocate($this->img, $rgb[0], $rgb[1], $rgb[2]); + $this->colours[$resource] = $store; + + return $resource; + } + + /** + * randomly generates a colour, with optional params + */ + function random_colour($params = array(), $mode = false) + { + if ($mode === false) + { + $mode = $this->mode; + } + + switch ($mode) + { + case 'rgb': + // @TODO random rgb generation. do we intend to do this, or is it just too tedious? + break; + + case 'ahsv': + case 'hsv': + default: + + $default_params = array( + 'hue_bias' => false, // degree / 'r'/'g'/'b'/'c'/'m'/'y' /'o' + 'hue_range' => false, // if hue bias, then difference range +/- from bias + 'min_saturation' => 30, // 0 - 100 + 'max_saturation' => 80, // 0 - 100 + 'min_value' => 30, // 0 - 100 + 'max_value' => 80, // 0 - 100 + ); + + $alt = ($mode == 'ahsv') ? true : false; + $params = array_merge($default_params, $params); + + $min_hue = 0; + $max_hue = 359; + $min_saturation = max(0, $params['min_saturation']); + $max_saturation = min(100, $params['max_saturation']); + $min_value = max(0, $params['min_value']); + $max_value = min(100, $params['max_value']); + + if ($params['hue_bias'] !== false) + { + if (is_numeric($params['hue_bias'])) + { + $h = intval($params['hue_bias']) % 360; + } + else + { + switch ($params['hue_bias']) + { + case 'o': + $h = $alt ? 60 : 30; + break; + + case 'y': + $h = $alt ? 120 : 60; + break; + + case 'g': + $h = $alt ? 180 : 120; + break; + + case 'c': + $h = $alt ? 210 : 180; + break; + + case 'b': + $h = 240; + break; + + case 'm': + $h = 300; + break; + + case 'r': + default: + $h = 0; + break; + } + } + + $min_hue = $h + 360; + $max_hue = $h + 360; + + if ($params['hue_range']) + { + $min_hue -= min(180, $params['hue_range']); + $max_hue += min(180, $params['hue_range']); + } + } + + $h = mt_rand($min_hue, $max_hue); + $s = mt_rand($min_saturation, $max_saturation); + $v = mt_rand($min_value, $max_value); + + return $this->allocate(array($h, $s, $v), $mode); + + break; + } + } + + /** + */ + function colour_scheme($resource, $include_original = true) + { + $mode = 'hsv'; + + if (($pre = $this->get_resource($resource)) !== false) + { + $resource = $pre; + } + + $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode); + $results = ($include_original) ? array($resource) : array(); + $colour2 = $colour3 = $colour4 = $colour; + $colour2[0] += 150; + $colour3[0] += 180; + $colour4[0] += 210; + + $results[] = $this->allocate($colour2, $mode); + $results[] = $this->allocate($colour3, $mode); + $results[] = $this->allocate($colour4, $mode); + + return $results; + } + + /** + */ + function mono_range($resource, $count = 5, $include_original = true) + { + if (is_array($resource)) + { + $results = array(); + for ($i = 0, $size = sizeof($resource); $i < $size; ++$i) + { + $results = array_merge($results, $this->mono_range($resource[$i], $count, $include_original)); + } + return $results; + } + + $mode = (in_array($this->mode, array('hsv', 'ahsv'), true) ? $this->mode : 'ahsv'); + if (($pre = $this->get_resource($resource)) !== false) + { + $resource = $pre; + } + + $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode); + + $results = array(); + if ($include_original) + { + $results[] = $resource; + $count--; + } + + // This is a hard problem. I chicken out and try to maintain readability at the cost of less randomness. + + while ($count > 0) + { + $colour[1] = ($colour[1] + mt_rand(40,60)) % 99; + $colour[2] = ($colour[2] + mt_rand(40,60)); + $results[] = $this->allocate($colour, $mode); + $count--; + } + return $results; + } + + /** + * Convert from one colour model to another + */ + function model_convert($colour, $from_model, $to_model) + { + if ($from_model == $to_model) + { + return $colour; + } + + switch ($to_model) + { + case 'hsv': + + switch ($from_model) + { + case 'ahsv': + return $this->ah2h($colour); + break; + + case 'rgb': + return $this->rgb2hsv($colour); + break; + } + break; + + case 'ahsv': + + switch ($from_model) + { + case 'hsv': + return $this->h2ah($colour); + break; + + case 'rgb': + return $this->h2ah($this->rgb2hsv($colour)); + break; + } + break; + + case 'rgb': + switch ($from_model) + { + case 'hsv': + return $this->hsv2rgb($colour); + break; + + case 'ahsv': + return $this->hsv2rgb($this->ah2h($colour)); + break; + } + break; + } + return false; + } + + /** + * Slightly altered from wikipedia's algorithm + */ + function hsv2rgb($hsv) + { + $this->normalize_hue($hsv[0]); + + $h = $hsv[0]; + $s = min(1, max(0, $hsv[1] / 100)); + $v = min(1, max(0, $hsv[2] / 100)); + + // calculate hue sector + $hi = floor($hsv[0] / 60); + + // calculate opposite colour + $p = $v * (1 - $s); + + // calculate distance between hex vertices + $f = ($h / 60) - $hi; + + // coming in or going out? + if (!($hi & 1)) + { + $f = 1 - $f; + } + + // calculate adjacent colour + $q = $v * (1 - ($f * $s)); + + switch ($hi) + { + case 0: + $rgb = array($v, $q, $p); + break; + + case 1: + $rgb = array($q, $v, $p); + break; + + case 2: + $rgb = array($p, $v, $q); + break; + + case 3: + $rgb = array($p, $q, $v); + break; + + case 4: + $rgb = array($q, $p, $v); + break; + + case 5: + $rgb = array($v, $p, $q); + break; + + default: + return array(0, 0, 0); + break; + } + + return array(255 * $rgb[0], 255 * $rgb[1], 255 * $rgb[2]); + } + + /** + * (more than) Slightly altered from wikipedia's algorithm + */ + function rgb2hsv($rgb) + { + $r = min(255, max(0, $rgb[0])); + $g = min(255, max(0, $rgb[1])); + $b = min(255, max(0, $rgb[2])); + $max = max($r, $g, $b); + $min = min($r, $g, $b); + + $v = $max / 255; + $s = (!$max) ? 0 : 1 - ($min / $max); + + // if max - min is 0, we want hue to be 0 anyway. + $h = $max - $min; + + if ($h) + { + switch ($max) + { + case $g: + $h = 120 + (60 * ($b - $r) / $h); + break; + + case $b: + $h = 240 + (60 * ($r - $g) / $h); + break; + + case $r: + $h = 360 + (60 * ($g - $b) / $h); + break; + } + } + $this->normalize_hue($h); + + return array($h, $s * 100, $v * 100); + } + + /** + */ + function normalize_hue(&$hue) + { + $hue %= 360; + + if ($hue < 0) + { + $hue += 360; + } + } + + /** + * Alternate hue to hue + */ + function ah2h($ahue) + { + if (is_array($ahue)) + { + $ahue[0] = $this->ah2h($ahue[0]); + return $ahue; + } + $this->normalize_hue($ahue); + + // blue through red is already ok + if ($ahue >= 240) + { + return $ahue; + } + + // ahue green is at 180 + if ($ahue >= 180) + { + // return (240 - (2 * (240 - $ahue))); + return (2 * $ahue) - 240; // equivalent + } + + // ahue yellow is at 120 (RYB rather than RGB) + if ($ahue >= 120) + { + return $ahue - 60; + } + + return $ahue / 2; + } + + /** + * hue to Alternate hue + */ + function h2ah($hue) + { + if (is_array($hue)) + { + $hue[0] = $this->h2ah($hue[0]); + return $hue; + } + $this->normalize_hue($hue); + + // blue through red is already ok + if ($hue >= 240) + { + return $hue; + } + else if ($hue <= 60) + { + return $hue * 2; + } + else if ($hue <= 120) + { + return $hue + 60; + } + else + { + return ($hue + 240) / 2; + } + } +} diff --git a/phpBB/phpbb/captcha/factory.php b/phpBB/phpbb/captcha/factory.php new file mode 100644 index 0000000000..dd44aca8bb --- /dev/null +++ b/phpBB/phpbb/captcha/factory.php @@ -0,0 +1,88 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +class factory +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + private $container; + + /** + * @var \phpbb\di\service_collection + */ + private $plugins; + + /** + * Constructor + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + * @param \phpbb\di\service_collection $plugins + */ + public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, \phpbb\di\service_collection $plugins) + { + $this->container = $container; + $this->plugins = $plugins; + } + + /** + * Return a new instance of a given plugin + * + * @param $name + * @return object + */ + public function get_instance($name) + { + return $this->container->get($name); + } + + /** + * Call the garbage collector + * + * @param string $name The name to the captcha service. + */ + function garbage_collect($name) + { + $captcha = $this->get_instance($name); + $captcha->garbage_collect(0); + } + + /** + * Return a list of all registered CAPTCHA plugins + * + * @returns array + */ + function get_captcha_types() + { + $captchas = array( + 'available' => array(), + 'unavailable' => array(), + ); + + foreach ($this->plugins as $plugin => $plugin_instance) + { + if ($plugin_instance->is_available()) + { + $captchas['available'][$plugin] = $plugin_instance->get_name(); + } + else + { + $captchas['unavailable'][$plugin] = $plugin_instance->get_name(); + } + } + + return $captchas; + } +} diff --git a/phpBB/phpbb/captcha/gd.php b/phpBB/phpbb/captcha/gd.php new file mode 100644 index 0000000000..e9538439c6 --- /dev/null +++ b/phpBB/phpbb/captcha/gd.php @@ -0,0 +1,1844 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +class gd +{ + var $width = 360; + var $height = 96; + + /** + * Create the image containing $code with a seed of $seed + */ + function execute($code, $seed) + { + global $config; + + mt_srand($seed); + + // Create image + $img = imagecreatetruecolor($this->width, $this->height); + + // Generate colours + $colour = new colour_manager($img, array( + 'random' => true, + 'min_value' => 60, + ), 'hsv'); + + $scheme = $colour->colour_scheme('background', false); + $scheme = $colour->mono_range($scheme, 10, false); + shuffle($scheme); + + $bg_colours = array_splice($scheme, mt_rand(6, 12)); + + // Generate code characters + $characters = $sizes = $bounding_boxes = $noise = array(); + $width_avail = $this->width - 15; + $code_len = strlen($code); + $captcha_bitmaps = $this->captcha_bitmaps(); + + for ($i = 0; $i < $code_len; ++$i) + { + $characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]); + + list($min, $max) = $characters[$i]->range(); + $sizes[$i] = mt_rand($min, $max); + + $box = $characters[$i]->dimensions($sizes[$i]); + $width_avail -= ($box[2] - $box[0]); + $bounding_boxes[$i] = $box; + } + + // Redistribute leftover x-space + $offset = array(); + for ($i = 0; $i < $code_len; ++$i) + { + $denom = ($code_len - $i); + $denom = max(1.3, $denom); + $offset[$i] = phpbb_mt_rand(0, (int) round((1.5 * $width_avail) / $denom)); + $width_avail -= $offset[$i]; + } + + if ($config['captcha_gd_x_grid']) + { + $grid = (int) $config['captcha_gd_x_grid']; + for ($y = 0; $y < $this->height; $y += mt_rand($grid - 2, $grid + 2)) + { + $current_colour = $scheme[array_rand($scheme)]; + imageline($img, mt_rand(0,4), mt_rand($y - 3, $y), mt_rand($this->width - 5, $this->width), mt_rand($y - 3, $y), $current_colour); + } + } + + if ($config['captcha_gd_y_grid']) + { + $grid = (int) $config['captcha_gd_y_grid']; + for ($x = 0; $x < $this->width; $x += mt_rand($grid - 2, $grid + 2)) + { + $current_colour = $scheme[array_rand($scheme)]; + imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour); + } + } + + if ($config['captcha_gd_wave'] && ($config['captcha_gd_y_grid'] || $config['captcha_gd_y_grid'])) + { + $this->wave($img); + } + + if ($config['captcha_gd_3d_noise']) + { + $noise_bitmaps = $this->captcha_noise_bg_bitmaps(); + for ($i = 0; $i < $code_len; ++$i) + { + $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data']))); + + $noise[$i]->range(); + //$box = $noise[$i]->dimensions($sizes[$i]); + } + $xoffset = 0; + for ($i = 0; $i < $code_len; ++$i) + { + $dimm = $bounding_boxes[$i]; + $xoffset += ($offset[$i] - $dimm[0]); + $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]); + + $noise[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); + $xoffset += $dimm[2]; + } + } + + $xoffset = 5; + for ($i = 0; $i < $code_len; ++$i) + { + $dimm = $bounding_boxes[$i]; + $xoffset += ($offset[$i] - $dimm[0]); + $yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]); + + $characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme); + $xoffset += $dimm[2]; + } + + if ($config['captcha_gd_wave']) + { + $this->wave($img); + } + + if ($config['captcha_gd_foreground_noise']) + { + $this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours); + } + + // Send image + header('Content-Type: image/png'); + header('Cache-control: no-cache, no-store'); + imagepng($img); + imagedestroy($img); + } + + /** + * Sinus + */ + function wave($img) + { + $period_x = mt_rand(12,18); + $period_y = mt_rand(7,14); + $amp_x = mt_rand(5,10); + $amp_y = mt_rand(2,4); + $socket = mt_rand(0,100); + + $dampen_x = mt_rand($this->width/5, $this->width/2); + $dampen_y = mt_rand($this->height/5, $this->height/2); + $direction_x = (mt_rand (0, 1)); + $direction_y = (mt_rand (0, 1)); + + for ($i = 0; $i < $this->width; $i++) + { + $dir = ($direction_x) ? $i : ($this->width - $i); + imagecopy($img, $img, $i-1, sin($socket+ $i/($period_x + $dir/$dampen_x)) * $amp_x, $i, 0, 1, $this->height); + } + $socket = mt_rand(0,100); + for ($i = 0; $i < $this->height; $i++) + { + $dir = ($direction_y) ? $i : ($this->height - $i); + imagecopy($img, $img ,sin($socket + $i/($period_y + ($dir)/$dampen_y)) * $amp_y, $i-1, 0, $i, $this->width, 1); + } + return $img; + } + + /** + * Noise line + */ + function noise_line($img, $min_x, $min_y, $max_x, $max_y, $bg, $font, $non_font) + { + imagesetthickness($img, 2); + + $x1 = $min_x; + $x2 = $max_x; + $y1 = $min_y; + $y2 = $min_y; + + do + { + $line = array_merge( + array_fill(0, mt_rand(30, 60), $non_font[array_rand($non_font)]), + array_fill(0, mt_rand(30, 60), $bg) + ); + + imagesetstyle($img, $line); + imageline($img, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED); + + $y1 += mt_rand(12, 35); + $y2 += mt_rand(12, 35); + } + while ($y1 < $max_y && $y2 < $max_y); + + $x1 = $min_x; + $x2 = $min_x; + $y1 = $min_y; + $y2 = $max_y; + + do + { + $line = array_merge( + array_fill(0, mt_rand(30, 60), $non_font[array_rand($non_font)]), + array_fill(0, mt_rand(30, 60), $bg) + ); + + imagesetstyle($img, $line); + imageline($img, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED); + + $x1 += mt_rand(20, 35); + $x2 += mt_rand(20, 35); + } + while ($x1 < $max_x && $x2 < $max_x); + imagesetthickness($img, 1); + } + + function captcha_noise_bg_bitmaps() + { + return array( + 'width' => 15, + 'height' => 5, + 'data' => array( + + 1 => array( + array(1,0,0,0,1,0,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,1,0,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0,0,0,1,0,0,0), + ), + 2 => array( + array(1,1,mt_rand(0,1),1,0,1,1,1,1,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,1,1,0,1,1,1), + ), + 3 => array( + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), + array(0,0,0,0,1,0,0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,1), + ), + 4 => array( + array(1,0,1,0,1,0,0,1,1,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), + ), + 5 => array( + array(1,1,1,1,0,0,0,1,1,1,0,0,1,0,1), + array(0,0,0,0,0,0,0,1,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0), + ), + 6 => array( + array(mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),mt_rand(0,1),0,mt_rand(0,1),mt_rand(0,1),mt_rand(0,1)), + array(0,0,0,0,0,0,0,mt_rand(0,1),0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(mt_rand(0,1),0,mt_rand(0,1),0,0,0,0,0,0,0,0,0,0,0,0), + ), + 7 => array( + array(0,0,0,0,0,0,0,0,0,0,1,1,0,1,1), + array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + array(0,0,1,1,0,0,0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,1,0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), + ), + )); + } + + /** + * Return bitmaps + */ + function captcha_bitmaps() + { + global $config; + + $chars = array( + 'A' => array( + array( + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,1,0,1,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,1,0,0,0,1,1,0), + array(1,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,1), + array(0,0,0,0,0,1,1,1,1), + array(0,0,0,1,1,1,0,0,1), + array(0,1,1,1,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,1,1,1), + array(0,1,1,1,1,1,1,0,1), + ), + ), + 'B' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,0,0), + ), + ), + 'C' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,1), + array(0,0,1,1,1,1,1,0,1), + ), + ), + 'D' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,1,1,1,1,1,0,1), + array(0,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,1,0,0,0,1,1,1), + array(0,0,1,1,1,1,1,0,1), + ), + ), + 'E' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,1,0,0,0,1,1,0), + array(1,1,0,0,0,0,0,1,1), + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,1,1), + array(0,1,1,1,1,1,1,1,0), + ), + ), + 'F' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + array( + array(0,1,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,0,0,0), + ), + array( + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,1,1,1,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + ), + ), + 'G' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,1,1,1,1,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,1), + array(0,0,1,1,1,1,1,0,1), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,1,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,0,0,0,0,0,1), + array(0,0,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,1), + array(1,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'H' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,1,1,1,0,0,0), + array(1,1,1,1,0,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + ), + ), + 'I' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + ), + 'J' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,1,0,0,1,0,0,0,0), + array(1,0,1,1,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + ), + ), + 'K' => array( + array( // New 'K', supplied by NeoThermic + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,1,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,0,1,0,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,1,0,0,0,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + ), + ), + 'L' => array( + array( + array(0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,0,1,1,1,0,0,0,0), + ), + ), + 'M' => array( + array( + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,0,1,1,1,0), + array(1,1,0,1,1,1,0,1,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + ), + ), + 'N' => array( + array( + array(1,1,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,0,1), + array(1,0,1,0,0,0,0,0,1), + array(1,0,1,0,0,0,0,0,1), + array(1,0,0,1,0,0,0,0,1), + array(1,0,0,1,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,0,1,0,1), + array(1,0,0,0,0,0,1,0,1), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,0,1,0), + array(0,1,1,0,0,0,0,1,0), + array(0,1,1,0,0,0,0,1,0), + array(0,1,0,1,0,0,0,1,0), + array(0,1,0,1,0,0,0,1,0), + array(0,1,0,1,0,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,1,0,1,0), + array(0,1,0,0,0,1,0,1,0), + array(0,1,0,0,0,1,1,1,0), + array(0,1,0,0,0,0,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,1,1,1,1,0,0,0), + array(1,1,1,0,0,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + ), + ), + 'O' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,0,0,0), + array(1,1,1,0,0,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,0,0,0,1,1,0,0), + array(0,1,1,1,1,1,0,0,0), + ), + ), + 'P' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,1,1,0,0,0,0,0), + array(1,1,0,1,1,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,1,1,0,0,0,0), + array(1,1,1,1,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + ), + 'Q' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,0,1,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,1), + ), + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,1,0,0,1,1,0,1,1), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,1,1,0), + array(0,0,0,0,0,0,0,1,1), + array(0,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,1,1,1,1), + array(0,0,0,0,1,1,0,0,1), + array(0,0,0,0,1,0,0,0,1), + array(0,0,0,0,1,0,0,0,1), + array(0,0,0,0,1,1,0,1,1), + array(0,0,0,0,0,1,1,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + ), + ), + 'R' => array( + array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(1,1,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(1,1,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,1,1,0,0,0,0,0,0), + array(0,1,1,1,0,0,0,0,0), + array(0,1,0,1,1,0,0,0,0), + array(0,1,0,0,1,1,0,0,0), + array(0,1,0,0,0,1,1,0,0), + array(0,1,0,0,0,0,1,1,0), + array(1,1,1,0,0,0,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,0,0,0,0), + array(1,1,0,0,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + ), + 'S' => array( + array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,1,1,1,1,1,0,1), + array(0,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,1,0), + array(1,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,0,0,0,0,0,0,0), + array(0,1,1,1,1,0,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(1,0,0,0,1,1,0,0,0), + array(0,1,1,1,1,0,0,0,0), + ), + ), + 'T' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,1,0,0,0,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + array( + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,1,1,1,1,1,1,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,1,0,0,0), + array(0,0,0,0,0,1,1,1,0), + ), + ), + 'U' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,1), + array(0,0,1,1,0,0,1,1,1), + array(0,0,0,1,1,1,1,0,1), + ), + ), + 'V' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + ), + 'W' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,1,0,0,0,0,0,1,1), + array(1,1,0,0,0,0,0,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,1,1,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,1,1,0,1,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,1,1,1,0,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,1,1,0,1,1,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'X' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,1,1,0,0,0,1,1,1), + array(0,0,0,0,0,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,0,1,1,0,1,1,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,1,0,1,1,0,0), + array(0,1,1,0,0,0,1,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'Y' => array( + array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(1,1,1,0,0,0,1,1,1), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,1,0,0,0), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,1,0,0,0,0,1), + array(0,0,0,1,1,0,0,0,1), + array(0,0,0,0,1,0,0,1,1), + array(0,0,0,0,1,1,0,1,0), + array(0,0,0,0,0,1,1,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,1,0,0,0), + array(0,0,1,1,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + ), + 'Z' => array( + array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + ), + array( + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,1,1,0,0,0), + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + ), + ), + ); + return array( + 'width' => 9, + 'height' => 15, + 'data' => array( + + 'A' => $chars['A'][mt_rand(0, min(sizeof($chars['A']), $config['captcha_gd_fonts']) -1)], + 'B' => $chars['B'][mt_rand(0, min(sizeof($chars['B']), $config['captcha_gd_fonts']) -1)], + 'C' => $chars['C'][mt_rand(0, min(sizeof($chars['C']), $config['captcha_gd_fonts']) -1)], + 'D' => $chars['D'][mt_rand(0, min(sizeof($chars['D']), $config['captcha_gd_fonts']) -1)], + 'E' => $chars['E'][mt_rand(0, min(sizeof($chars['E']), $config['captcha_gd_fonts']) -1)], + 'F' => $chars['F'][mt_rand(0, min(sizeof($chars['F']), $config['captcha_gd_fonts']) -1)], + 'G' => $chars['G'][mt_rand(0, min(sizeof($chars['G']), $config['captcha_gd_fonts']) -1)], + 'H' => $chars['H'][mt_rand(0, min(sizeof($chars['H']), $config['captcha_gd_fonts']) -1)], + 'I' => $chars['I'][mt_rand(0, min(sizeof($chars['I']), $config['captcha_gd_fonts']) -1)], + 'J' => $chars['J'][mt_rand(0, min(sizeof($chars['J']), $config['captcha_gd_fonts']) -1)], + 'K' => $chars['K'][mt_rand(0, min(sizeof($chars['K']), $config['captcha_gd_fonts']) -1)], + 'L' => $chars['L'][mt_rand(0, min(sizeof($chars['L']), $config['captcha_gd_fonts']) -1)], + 'M' => $chars['M'][mt_rand(0, min(sizeof($chars['M']), $config['captcha_gd_fonts']) -1)], + 'N' => $chars['N'][mt_rand(0, min(sizeof($chars['N']), $config['captcha_gd_fonts']) -1)], + 'O' => $chars['O'][mt_rand(0, min(sizeof($chars['O']), $config['captcha_gd_fonts']) -1)], + 'P' => $chars['P'][mt_rand(0, min(sizeof($chars['P']), $config['captcha_gd_fonts']) -1)], + 'Q' => $chars['Q'][mt_rand(0, min(sizeof($chars['Q']), $config['captcha_gd_fonts']) -1)], + 'R' => $chars['R'][mt_rand(0, min(sizeof($chars['R']), $config['captcha_gd_fonts']) -1)], + 'S' => $chars['S'][mt_rand(0, min(sizeof($chars['S']), $config['captcha_gd_fonts']) -1)], + 'T' => $chars['T'][mt_rand(0, min(sizeof($chars['T']), $config['captcha_gd_fonts']) -1)], + 'U' => $chars['U'][mt_rand(0, min(sizeof($chars['U']), $config['captcha_gd_fonts']) -1)], + 'V' => $chars['V'][mt_rand(0, min(sizeof($chars['V']), $config['captcha_gd_fonts']) -1)], + 'W' => $chars['W'][mt_rand(0, min(sizeof($chars['W']), $config['captcha_gd_fonts']) -1)], + 'X' => $chars['X'][mt_rand(0, min(sizeof($chars['X']), $config['captcha_gd_fonts']) -1)], + 'Y' => $chars['Y'][mt_rand(0, min(sizeof($chars['Y']), $config['captcha_gd_fonts']) -1)], + 'Z' => $chars['Z'][mt_rand(0, min(sizeof($chars['Z']), $config['captcha_gd_fonts']) -1)], + + '1' => array( + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,0,1,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + ), + '2' => array( // New '2' supplied by Anon + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,1,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + ), + '3' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + '4' => array( + array(0,0,0,0,0,0,1,1,0), + array(0,0,0,0,0,1,0,1,0), + array(0,0,0,0,1,0,0,1,0), + array(0,0,0,1,0,0,0,1,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + ), + '5' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + '6' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,1,1,1,1,0,0), + array(1,0,1,0,0,0,0,1,0), + array(1,1,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + '7' => array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + ), + '8' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + '9' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,1), + array(0,1,0,0,0,0,1,0,1), + array(0,0,1,1,1,1,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + ), + ) + ); + } +} diff --git a/phpBB/phpbb/captcha/gd_wave.php b/phpBB/phpbb/captcha/gd_wave.php new file mode 100644 index 0000000000..f2ec4137d2 --- /dev/null +++ b/phpBB/phpbb/captcha/gd_wave.php @@ -0,0 +1,842 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +/** +* Wave3D CAPTCHA +*/ +class gd_wave +{ + var $width = 360; + var $height = 96; + + function execute($code, $seed) + { + // seed the random generator + mt_srand($seed); + + // set height and width + $img_x = $this->width; + $img_y = $this->height; + + // Generate image + $img = imagecreatetruecolor($img_x, $img_y); + $x_grid = mt_rand(6, 10); + $y_grid = mt_rand(6, 10); + + // Ok, so lets cut to the chase. We could accurately represent this in 3d and + // do all the appropriate linear transforms. my questions is... why bother? + // The computational overhead is unnecessary when you consider the simple fact: + // we're not here to accurately represent a model, but to just show off some random-ish + // polygons + + // Conceive of 3 spaces. + // 1) planar-space (discrete "pixel" grid) + // 2) 3-space. (planar-space with z/height aspect) + // 3) image space (pixels on the screen) + // resolution of the planar-space we're embedding the text code in + $plane_x = 100; + $plane_y = 30; + + $subdivision_factor = 3; + + // $box is the 4 points in img_space that correspond to the corners of the plane in 3-space + $box = array( + 'upper_left' => array( + 'x' => mt_rand(5, 15), + 'y' => mt_rand(10, 15) + ), + 'upper_right' => array( + 'x' => mt_rand($img_x - 35, $img_x - 19), + 'y' => mt_rand(10, 17) + ), + 'lower_left' => array( + 'x' => mt_rand($img_x - 45, $img_x - 5), + 'y' => mt_rand($img_y - 15, $img_y - 0), + ), + ); + + $box['lower_right'] = array( + 'x' => $box['lower_left']['x'] + $box['upper_left']['x'] - $box['upper_right']['x'], + 'y' => $box['lower_left']['y'] + $box['upper_left']['y'] - $box['upper_right']['y'], + ); + + // TODO + $background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255)); + imagefill($img, 0, 0, $background); + + $random = array(); + $fontcolors = array(); + + for ($i = 0; $i < 15; ++$i) + { + $random[$i] = imagecolorallocate($img, mt_rand(120, 255), mt_rand(120, 255), mt_rand(120, 255)); + } + + $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120)); + + $colors = array(); + + $minr = mt_rand(20, 30); + $ming = mt_rand(20, 30); + $minb = mt_rand(20, 30); + + $maxr = mt_rand(150, 230); + $maxg = mt_rand(150, 230); + $maxb = mt_rand(150, 230); + + for ($i = -30; $i <= 30; ++$i) + { + $coeff1 = ($i + 12) / 45; + $coeff2 = 1 - $coeff1; + $colors[$i] = imagecolorallocate($img, ($coeff2 * $maxr) + ($coeff1 * $minr), ($coeff2 * $maxg) + ($coeff1 * $ming), ($coeff2 * $maxb) + ($coeff1 * $minb)); + } + + // $img_buffer is the last row of 3-space positions (converted to img-space), cached + // (using this means we don't need to recalculate all 4 positions for each new polygon, + // merely the newest point that we're adding, which is then cached. + $img_buffer = array(array(), array()); + + // In image-space, the x- and y-offset necessary to move one unit in the x-direction in planar-space + $dxx = ($box['upper_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_x); + $dxy = ($box['upper_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_x); + + // In image-space, the x- and y-offset necessary to move one unit in the y-direction in planar-space + $dyx = ($box['lower_right']['x'] - $box['upper_left']['x']) / ($subdivision_factor * $plane_y); + $dyy = ($box['lower_right']['y'] - $box['upper_left']['y']) / ($subdivision_factor * $plane_y); + + // Initial captcha-letter offset in planar-space + $plane_offset_x = mt_rand(3, 8); + $plane_offset_y = mt_rand( 12, 15); + + // character map + $map = $this->captcha_bitmaps(); + + // matrix + $plane = array(); + + // for each character, we'll silkscreen it into our boolean pixel plane + for ($c = 0, $code_num = strlen($code); $c < $code_num; ++$c) + { + $letter = $code[$c]; + + for ($x = $map['width'] - 1; $x >= 0; --$x) + { + for ($y = $map['height'] - 1; $y >= 0; --$y) + { + if ($map['data'][$letter][$y][$x]) + { + $plane[$y + $plane_offset_y + (($c & 1) ? 1 : -1)][$x + $plane_offset_x] = true; + } + } + } + $plane_offset_x += 11; + } + + // calculate our first buffer, we can't actually draw polys with these yet + // img_pos_prev == screen x,y location to our immediate left. + // img_pos_cur == current screen x,y location + // we calculate screen position of our + // current cell based on the difference from the previous cell + // rather than recalculating from absolute coordinates + // What we cache into the $img_buffer contains the raised text coordinates. + $img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']); + $prev_height = $this->wave_height(0, 0, $subdivision_factor); + $full_x = $plane_x * $subdivision_factor; + $full_y = $plane_y * $subdivision_factor; + + for ($x = 1; $x <= $full_x; ++$x) + { + $cur_height = $this->wave_height($x, 0, $subdivision_factor); + $offset = $cur_height - $prev_height; + $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); + + $img_buffer[0][$x] = $img_pos_cur; + $img_pos_prev = $img_pos_cur; + $prev_height = $cur_height; + } + + for ($y = 1; $y <= $full_y; ++$y) + { + // swap buffers + $buffer_cur = $y & 1; + $buffer_prev = 1 - $buffer_cur; + + $prev_height = $this->wave_height(0, $y, $subdivision_factor); + $offset = $prev_height - $this->wave_height(0, $y - 1, $subdivision_factor); + $img_pos_cur = array($img_buffer[$buffer_prev][0][0] + $dyx, min($img_buffer[$buffer_prev][0][1] + $dyy + $offset, $img_y - 1)); + + // make sure we don't try to write off the page + $img_pos_prev = $img_pos_cur; + + $img_buffer[$buffer_cur][0] = $img_pos_cur; + + for ($x = 1; $x <= $full_x; ++$x) + { + $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, $x_grid, $y_grid, 1); + + // height is a z-factor, not a y-factor + $offset = $cur_height - $prev_height; + $img_pos_cur = array($img_pos_prev[0] + $dxx, $img_pos_prev[1] + $dxy + $offset); + + // height is float, index it to an int, get closest color + $color = $colors[intval($cur_height)]; + $img_pos_prev = $img_pos_cur; + $prev_height = $cur_height; + + $y_index_old = intval(($y - 1) / $subdivision_factor); + $y_index_new = intval($y / $subdivision_factor); + $x_index_old = intval(($x - 1) / $subdivision_factor); + $x_index_new = intval($x / $subdivision_factor); + + if (!empty($plane[$y_index_new][$x_index_new])) + { + $img_pos_cur[1] += $this->wave_height($x, $y, $subdivision_factor, 1) - 30 - $cur_height; + $color = $colors[20]; + } + $img_pos_cur[1] = min($img_pos_cur[1], $img_y - 1); + $img_buffer[$buffer_cur][$x] = $img_pos_cur; + + // Smooth the edges as much as possible by having not more than one low<->high traingle per square + // Otherwise, just + $diag_down = (empty($plane[$y_index_old][$x_index_old]) == empty($plane[$y_index_new][$x_index_new])); + $diag_up = (empty($plane[$y_index_old][$x_index_new]) == empty($plane[$y_index_new][$x_index_old])); + + // natural switching + $mode = ($x + $y) & 1; + + // override if it requires it + if ($diag_down != $diag_up) + { + $mode = $diag_up; + } + + if ($mode) + { + // +-/ / + // 1 |/ 2 /| + // / /-+ + $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x]); + $poly2 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_cur][$x], $img_buffer[$buffer_prev][$x]); + } + else + { + // \ \-+ + // 1 |\ 2 \| + // +-\ \ + $poly1 = array_merge($img_buffer[$buffer_cur][$x - 1], $img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_cur][$x]); + $poly2 = array_merge($img_buffer[$buffer_prev][$x - 1], $img_buffer[$buffer_prev][$x], $img_buffer[$buffer_cur][$x]); + } + + imagefilledpolygon($img, $poly1, 3, $color); + imagefilledpolygon($img, $poly2, 3, $color); + } + } + + // Output image + header('Content-Type: image/png'); + header('Cache-control: no-cache, no-store'); + //$mtime = explode(' ', microtime()); + //$totaltime = $mtime[0] + $mtime[1] - $starttime; + + //echo $totaltime . "<br />\n"; + //echo memory_get_usage() - $tmp; + imagepng($img); + imagedestroy($img); + } + + function wave_height($x, $y, $factor = 1, $tweak = 0.7) + { + // stretch the wave. TODO: pretty it up + $x = $x/5 + 180; + $y = $y/4; + return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak); + } + + function grid_height($x, $y, $x_grid, $y_grid, $factor = 1) + { + return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0); + } + + function captcha_bitmaps() + { + return array( + 'width' => 9, + 'height' => 13, + 'data' => array( + 'A' => array( + array(0,0,1,1,1,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'B' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'C' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'D' => array( + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'E' => array( + array(0,0,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'F' => array( + array(0,0,1,1,1,1,1,1,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'G' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'H' => array( + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'I' => array( + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'J' => array( + array(0,0,0,0,0,0,1,1,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'K' => array( + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,1,0,0,0,0,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'L' => array( + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'M' => array( + array(0,1,0,0,0,0,0,1,0), + array(0,1,1,0,0,0,1,1,0), + array(0,1,0,1,0,1,0,1,0), + array(0,1,0,0,1,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'N' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,1,0,0,0,0,0,0,1), + array(1,0,1,0,0,0,0,0,1), + array(1,0,0,1,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,0,0,1,0,0,1), + array(1,0,0,0,0,0,1,0,1), + array(1,0,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'O' => array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,1,1,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'P' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Q' => array( + array(0,0,1,1,1,1,0,0,0), + array(0,1,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,1,0,0,1,0), + array(1,0,0,0,0,1,0,1,0), + array(0,1,0,0,0,0,1,0,0), + array(0,0,1,1,1,1,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'R' => array( + array(1,1,1,1,1,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,1,0,0), + array(1,1,1,1,1,1,0,0,0), + array(1,0,1,0,0,0,0,0,0), + array(1,0,0,1,0,0,0,0,0), + array(1,0,0,0,1,0,0,0,0), + array(1,0,0,0,0,1,0,0,0), + array(1,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'S' => array( + array(0,0,1,1,1,1,1,1,1), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(1,1,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'T' => array( + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'U' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'V' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'W' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,1,0,0,0,1), + array(1,0,0,1,0,1,0,0,1), + array(1,0,1,0,0,0,1,0,1), + array(1,1,0,0,0,0,0,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'X' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Y' => array( + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,0,0,0,1,0,0), + array(0,0,0,1,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + 'Z' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,1), + array(1,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '1' => array( + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,1,0,0,0,0), + array(0,0,1,0,1,0,0,0,0), + array(0,1,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,1,1,1,1,1,1,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '2' => array( + array(0,0,0,1,1,1,0,0,0), + array(0,0,1,0,0,0,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,1,0,0,0,0,0), + array(0,0,1,0,0,0,0,0,0), + array(0,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,0,0), + ), + '3' => array( + array(0,0,0,1,1,1,1,0,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '4' => array( + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,1,0), + array(0,0,0,0,0,1,0,1,0), + array(0,0,0,0,1,0,0,1,0), + array(0,0,0,1,0,0,0,1,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,1,1,1,1,1,1,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '5' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(0,1,0,0,0,0,0,0,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '6' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,0,0,0,0,0,0), + array(1,0,0,1,1,1,1,0,0), + array(1,0,1,0,0,0,0,1,0), + array(1,1,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '7' => array( + array(1,1,1,1,1,1,1,1,1), + array(1,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,1,0), + array(0,0,0,0,0,0,1,0,0), + array(0,0,0,0,0,1,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,1,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '8' => array( + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,1,0,0,0,0,0,1,0), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(1,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,0), + array(0,0,1,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + '9' => array( + array(0,0,0,1,1,1,1,0,0), + array(0,0,1,0,0,0,0,1,0), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,1,1), + array(0,0,1,1,1,1,1,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,0,0,0,0,0,0,0,1), + array(0,1,0,0,0,0,0,0,1), + array(0,0,1,0,0,0,0,1,0), + array(0,0,0,1,1,1,1,0,0), + array(0,0,0,0,0,0,0,0,0), + array(0,0,0,0,0,0,0,0,0), + ), + ) + ); + } +} diff --git a/phpBB/phpbb/captcha/non_gd.php b/phpBB/phpbb/captcha/non_gd.php new file mode 100644 index 0000000000..3818672f17 --- /dev/null +++ b/phpBB/phpbb/captcha/non_gd.php @@ -0,0 +1,386 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +/** +* Main non-gd captcha class +* @ignore +*/ +class non_gd +{ + var $filtered_pngs; + var $width = 320; + var $height = 50; + + /** + * Define filtered pngs on init + */ + function __construct() + { + // If we can we will generate a single filtered png, we avoid nastiness via emulation of some Zlib stuff + $this->define_filtered_pngs(); + } + + /** + * Create the image containing $code with a seed of $seed + */ + function execute($code, $seed) + { + $img_height = $this->height - 10; + $img_width = 0; + + mt_srand($seed); + + $char_widths = $hold_chars = array(); + $code_len = strlen($code); + + for ($i = 0; $i < $code_len; $i++) + { + $char = $code[$i]; + + $width = mt_rand(0, 4); + $raw_width = $this->filtered_pngs[$char]['width']; + $char_widths[$i] = $width; + $img_width += $raw_width - $width; + + // Split the char into chunks of $raw_width + 1 length + if (empty($hold_chars[$char])) + { + $hold_chars[$char] = str_split(base64_decode($this->filtered_pngs[$char]['data']), $raw_width + 1); + } + } + + $offset_x = mt_rand(0, $this->width - $img_width); + $offset_y = mt_rand(0, $this->height - $img_height); + + $image = ''; + for ($i = 0; $i < $this->height; $i++) + { + $image .= chr(0); + + if ($i > $offset_y && $i < $offset_y + $img_height) + { + for ($j = 0; $j < $offset_x; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + + for ($j = 0; $j < $code_len; $j++) + { + $image .= $this->randomise(substr($hold_chars[$code{$j}][$i - $offset_y - 1], 1), $char_widths[$j]); + } + + for ($j = $offset_x + $img_width; $j < $this->width; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + } + else + { + for ($j = 0; $j < $this->width; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + } + } + unset($hold_chars); + + $image = $this->create_png($image, $this->width, $this->height); + + // Output image + header('Content-Type: image/png'); + header('Cache-control: no-cache, no-store'); + echo $image; + exit; + } + + /** + * This is designed to randomise the pixels of the image data within + * certain limits so as to keep it readable. It also varies the image + * width a little + */ + function randomise($scanline, $width) + { + $new_line = ''; + + $end = strlen($scanline) - ceil($width/2); + for ($i = (int) floor($width / 2); $i < $end; $i++) + { + $pixel = ord($scanline{$i}); + + if ($pixel < 190) + { + $new_line .= chr(mt_rand(0, 205)); + } + else if ($pixel > 190) + { + $new_line .= chr(mt_rand(145, 255)); + } + else + { + $new_line .= $scanline{$i}; + } + } + + return $new_line; + } + + /** + * This creates a chunk of the given type, with the given data + * of the given length adding the relevant crc + */ + function png_chunk($length, $type, $data) + { + $raw = $type . $data; + + return pack('N', $length) . $raw . pack('N', crc32($raw)); + } + + /** + * Creates greyscale 8bit png - The PNG spec can be found at + * http://www.libpng.org/pub/png/spec/PNG-Contents.html we use + * png because it's a fully recognised open standard and supported + * by practically all modern browsers and OSs + */ + function create_png($raw_image, $width, $height) + { + // SIG + $image = pack('C8', 137, 80, 78, 71, 13, 10, 26, 10); + + // IHDR + $raw = pack('N2', $width, $height); + $raw .= pack('C5', 8, 0, 0, 0, 0); + $image .= $this->png_chunk(13, 'IHDR', $raw); + + // IDAT + if (@extension_loaded('zlib')) + { + $raw_image = gzcompress($raw_image); + $length = strlen($raw_image); + } + else + { + // The total length of this image, uncompressed, is just a calculation of pixels + $length = ($width + 1) * $height; + + // Adler-32 hash generation + // Note: The hash is _backwards_ so we must reverse it + + if (@extension_loaded('hash')) + { + $adler_hash = strrev(hash('adler32', $raw_image, true)); + } + else if (@extension_loaded('mhash')) + { + $adler_hash = strrev(mhash(MHASH_ADLER32, $raw_image)); + } + else + { + // Optimized Adler-32 loop ported from the GNU Classpath project + $temp_length = $length; + $s1 = 1; + $s2 = $index = 0; + + while ($temp_length > 0) + { + // We can defer the modulo operation: + // s1 maximally grows from 65521 to 65521 + 255 * 3800 + // s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31 + $substract_value = ($temp_length < 3800) ? $temp_length : 3800; + $temp_length -= $substract_value; + + while (--$substract_value >= 0) + { + $s1 += ord($raw_image[$index]); + $s2 += $s1; + + $index++; + } + + $s1 %= 65521; + $s2 %= 65521; + } + $adler_hash = pack('N', ($s2 << 16) | $s1); + } + + // This is the same thing as gzcompress($raw_image, 0) but does not need zlib + $raw_image = pack('C3v2', 0x78, 0x01, 0x01, $length, ~$length) . $raw_image . $adler_hash; + + // The Zlib header + Adler hash make us add on 11 + $length += 11; + } + + // IDAT + $image .= $this->png_chunk($length, 'IDAT', $raw_image); + + // IEND + $image .= $this->png_chunk(0, 'IEND', ''); + + return $image; + } + + /** + * png image data + * Each 'data' element is base64_encoded uncompressed IDAT + */ + function define_filtered_pngs() + { + $this->filtered_pngs = array( + '0' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////olFAkBAAAGDyA4P///M31/////////////wD////////////////0dAgAAAAAAAAAAAAEcPipFGHn////////////AP//////////////6DAAAAAAAAAAAAAAAAAALSEAN+T///////////8A//////////////xAAAAAAAAAAAAAAAAAAAAAACPA/////////////wD/////////////oAAAAAAAAAAAAAAAAAAAAAAAev//////////////AP////////////8oAAAAAAAAPNj/zDAAAAAAAABD//////////////8A////////////1AAAAAAAABjw////5BAAAAAAAADo/////////////wD///////////+QAAAAAAAAbP//////QgAAAAAAAKj/////////////AP///////////1wAAAAAAACs/////8AXAAAAAAAAcP////////////8A////////////OAAAAAAAAND////dNwAAAAAAAABI/////////////wD///////////8gAAAAAAAA4P//7koACwAAAAAAACT/////////////AP///////////wgAAAAAAAD///VqAwaPAAAAAAAAEP////////////8A////////////AAAAAAAAAP/8kQYDavUAAAAAAAAA/////////////wD///////////8AAAAAAAAA/6kNAEru/wAAAAAAAAD/////////////AP///////////wAAAAAAAADAIwA33f//AAAAAAAAAP////////////8A////////////FAAAAAAAADYAI8D///8AAAAAAAAQ/////////////wD///////////8kAAAAAAAAAA2p////5AAAAAAAACD/////////////AP///////////0gAAAAAAAAFkfz////UAAAAAAAAQP////////////8A////////////cAAAAAAAAET1/////7AAAAAAAABo/////////////wD///////////+oAAAAAAAAXfX/////sAAAAAAAAGj/////////////AAAAALgAAAAAAAAwAAAAAAAAAAAAAAD////////////oAAAAAAAACOT////oEAAAAAAAAOD/////////////AP////////////8+AAAAAAAAKMz/zDQAAAAAAAA0//////////////8A////////////7jgAAAAAAAAAAAAAAAAAAAAAAKT//////////////wD///////////VqAwIAAAAAAAAAAAAAAAAAAAA8////////////////AP//////////rQcDaVEAAAAAAAAAAAAAAAAAKOj///////////////8A///////////nblnu/IAIAAAAAAAAAAAAAFzw/////////////////wD////////////79////+iITCAAAAAgSITg////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////w==', + 'width' => 40 + ), + '1' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////8BAAAAAAAP//////////////////AP////////////////////////9sAAAAAAAA//////////////////8A////////////////////////pAAAAAAAAAD//////////////////wD//////////////////////6wEAAAAAAAAAP//////////////////AP////////////////////h4AAAAAAAAAAAA//////////////////8A//////////////////ygJAAAAAAAAAAAAAD//////////////////wD//////////////9x8HAAAAAAAAAAAAAAAAP//////////////////AP//////////////AAAAAAAAAAAAAAAAAAAA//////////////////8A//////////////8AAAAAAAAAAAAAAAAAAAD//////////////////wD//////////////wAAAAAAAAR4AAAAAAAAAP//////////////////AP//////////////AAAAAAA4zP8AAAAAAAAA//////////////////8A//////////////8AAAA4sP///wAAAAAAAAD//////////////////wD//////////////yR80P//////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '2' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////okFAkCAAABCBIfNT///////////////////8A///////////////8hAgAAAAAAAAAAAAAAFTo/////////////////wD//////////////1QAAAAAAAAAAAAAAAAAACjo////////////////AP////////////+MAAAAAAAAAAAAAAAAAAAAADj///////////////8A////////////9BAAAAAAAAAAAAAAAAAAAAAAALD//////////////wD///////////+gAAAAAAAAAHjs+KwMAAAAAAAAVP//////////////AP///////////1gAAAAAAABM/////6QAAAAAAAAU//////////////8A////////////KAAAAAAAALj/////+AAAAAAAAAD//////////////wD///////////+MfGBMOCAI8P/////wAAAAAAAACP//////////////AP///////////////////////////5wAAAAAAAAw//////////////8A///////////////////////////oFAAAAAAAAHz//////////////wD/////////////////////////6CgAAAAAAAAE3P//////////////AP///////////////////////9ggAAAAAAAAAHT///////////////8A//////////////////////+0DAAAAAAAAAA8+P///////////////wD/////////////////////gAAAAAAAAAAAKOj/////////////////AP//////////////////9FAAAAAAAAAAADzw//////////////////8A/////////////////+g4AAAAAAAAAABk/P///////////////////wD////////////////oKAAAAAAAAAAMqP//////////////////////AP//////////////6CgAAAAAAAAAMNz///////////////////////8A//////////////g4AAAAAAAAAFT0/////////////////////////wD/////////////bAAAAAAAAABU/P//////////////////////////AP///////////8wAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A////////////SAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////9AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////xAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '3' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////8sGg0FAAAACA4cLz8////////////////////AP//////////////rBgAAAAAAAAAAAAAACTA//////////////////8A/////////////3QAAAAAAAAAAAAAAAAAAASs/////////////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAjc////////////////AP//////////6AwAAAAAAAAAAAAAAAAAAAAAAGT///////////////8A//////////94AAAAAAAABJDw/8g4AAAAAAAAHP///////////////wD//////////yAAAAAAAACE/////9gAAAAAAAAA////////////////AP///////////NSwiGQ4FOT//////AAAAAAAABD///////////////8A//////////////////////////+YAAAAAAAAVP///////////////wD//////////////////////P/ggAQAAAAAAATM////////////////AP////////////////////9gAAAAAAAAAAAElP////////////////8A/////////////////////0AAAAAAAAAAHLj//////////////////wD/////////////////////OAAAAAAAAAAwkPj/////////////////AP////////////////////8gAAAAAAAAAAAAINj///////////////8A/////////////////////xAAAAAAAAAAAAAAIPD//////////////wD/////////////////////uOz/4HgEAAAAAAAAhP//////////////AP///////////////////////////3wAAAAAAAAw//////////////8A////////////////////////////6AAAAAAAAAj//////////////wD/////////////////////////////AAAAAAAAAP//////////////AP//////////tJh8YEQoDNz//////+AAAAAAAAAY//////////////8A//////////88AAAAAAAAaP//////dAAAAAAAAEz//////////////wD//////////6QAAAAAAAAAdOD/5HQAAAAAAAAApP//////////////AP///////////CgAAAAAAAAAAAAAAAAAAAAAACD4//////////////8A////////////yAQAAAAAAAAAAAAAAAAAAAAEuP///////////////wD/////////////rAQAAAAAAAAAAAAAAAAABJD/////////////////AP//////////////zDQAAAAAAAAAAAAAACTA//////////////////8A/////////////////8BwOCAAAAAUNGi0/P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '4' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////////////nAAAAAAAAAD///////////////8A/////////////////////////8AEAAAAAAAAAP///////////////wD////////////////////////gGAAAAAAAAAAA////////////////AP//////////////////////9DAAAAAAAAAAAAD///////////////8A//////////////////////9UAAAAAAAAAAAAAP///////////////wD/////////////////////hAAAAAAAAAAAAAAA////////////////AP///////////////////7QAAAAAAAAAAAAAAAD///////////////8A///////////////////UDAAAAAAUAAAAAAAAAP///////////////wD/////////////////7CQAAAAABMAAAAAAAAAA////////////////AP////////////////xEAAAAAACU/wAAAAAAAAD///////////////8A////////////////cAAAAAAAZP//AAAAAAAAAP///////////////wD//////////////6AAAAAAADz8//8AAAAAAAAA////////////////AP/////////////IBAAAAAAc6P///wAAAAAAAAD///////////////8A////////////5BgAAAAADMz/////AAAAAAAAAP///////////////wD///////////g0AAAAAACk//////8AAAAAAAAA////////////////AP//////////XAAAAAAAfP///////wAAAAAAAAD///////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP///////////////////////////wAAAAAAAAD///////////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '5' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////8AAAAAAAAAAAAAAAAAAAAAAA//////////////8A///////////////MAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////6wAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////iAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////////9kAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////0QAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////IAAAAAAAYP////////////////////////////8A//////////////wAAAAAAAB8/////////////////////////////wD/////////////3AAAAAAAAIj/////////////////////////////AP////////////+4AAAAAAAAoLRYHAAEKGTE//////////////////8A/////////////5QAAAAAAAAQAAAAAAAAAABY9P///////////////wD/////////////dAAAAAAAAAAAAAAAAAAAAAA89P//////////////AP////////////9QAAAAAAAAAAAAAAAAAAAAAABg//////////////8A/////////////zAAAAAAAAAAAAAAAAAAAAAAAADQ/////////////wD/////////////IAAAAAAAAGjY/+h4BAAAAAAAAGz/////////////AP//////////////9NS0lHSc//////90AAAAAAAALP////////////8A/////////////////////////////9QAAAAAAAAE/////////////wD//////////////////////////////wAAAAAAAAD/////////////AP/////////////////////////////8AAAAAAAAEP////////////8A////////////pIRwWEAgDOD//////8wAAAAAAAA8/////////////wD///////////9EAAAAAAAAaP//////ZAAAAAAAAHz/////////////AP///////////6QAAAAAAAAAaOD/4GQAAAAAAAAE4P////////////8A/////////////CQAAAAAAAAAAAAAAAAAAAAAAGD//////////////wD/////////////yAQAAAAAAAAAAAAAAAAAAAAc7P//////////////AP//////////////rAwAAAAAAAAAAAAAAAAAGNj///////////////8A////////////////0EAAAAAAAAAAAAAAAFTo/////////////////wD//////////////////8h4QCAAAAAcQHzU////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '6' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////+0ZCwMAAAUNGjI////////////////////AP/////////////////EMAAAAAAAAAAAAABM6P////////////////8A////////////////lAQAAAAAAAAAAAAAAAAo6P///////////////wD//////////////6wAAAAAAAAAAAAAAAAAAABI////////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAACw//////////////8A/////////////3AAAAAAAAAoxP/YPAAAAAAAAEj//////////////wD////////////4EAAAAAAACOD////YDCBAVGiAoP//////////////AP///////////7gAAAAAAABY//////////////////////////////8A////////////eAAAAAAAAJT//////////////////////////////wD///////////9MAAAAAAAAvP/IXBgABCx03P//////////////////AP///////////ygAAAAAAADcdAAAAAAAAAAEiP////////////////8A////////////FAAAAAAAAFAAAAAAAAAAAAAAcP///////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAlP//////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAQ8P////////////8A////////////AAAAAAAAAABAyP/kZAAAAAAAAACQ/////////////wD///////////8MAAAAAAAALPj/////WAAAAAAAAET/////////////AP///////////yQAAAAAAACY///////MAAAAAAAAFP////////////8A////////////SAAAAAAAAMD///////wAAAAAAAAA/////////////wD///////////9wAAAAAAAAvP///////wAAAAAAAAD/////////////AP///////////7QAAAAAAACI///////UAAAAAAAAJP////////////8A////////////+AwAAAAAACDw/////2wAAAAAAABY/////////////wD/////////////cAAAAAAAADC8/Ox4AAAAAAAAAKj/////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAAAk/P////////////8A//////////////+oAAAAAAAAAAAAAAAAAAAABLj//////////////wD///////////////+QAAAAAAAAAAAAAAAAAACQ////////////////AP////////////////+0JAAAAAAAAAAAAAAkuP////////////////8A///////////////////8sGg0FAAADCxgqPz//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '7' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAABP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAy4/////////////wD//////////////////////////+QUAAAAAAAEuP//////////////AP/////////////////////////8QAAAAAAAAKT///////////////8A/////////////////////////4wAAAAAAAB0/////////////////wD////////////////////////cCAAAAAAANPz/////////////////AP///////////////////////0QAAAAAAATY//////////////////8A//////////////////////+0AAAAAAAAeP///////////////////wD//////////////////////CQAAAAAABTw////////////////////AP////////////////////+gAAAAAAAAkP////////////////////8A/////////////////////ywAAAAAABDw/////////////////////wD///////////////////+4AAAAAAAAbP//////////////////////AP///////////////////1wAAAAAAADQ//////////////////////8A///////////////////4DAAAAAAAMP///////////////////////wD//////////////////7QAAAAAAAB8////////////////////////AP//////////////////aAAAAAAAAMj///////////////////////8A//////////////////8oAAAAAAAM/P///////////////////////wD/////////////////8AAAAAAAAET/////////////////////////AP////////////////+0AAAAAAAAcP////////////////////////8A/////////////////4wAAAAAAACY/////////////////////////wD/////////////////WAAAAAAAAMD/////////////////////////AP////////////////80AAAAAAAA4P////////////////////////8A/////////////////xAAAAAAAAD4/////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '8' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////////IdDQUAAAEIEiA1P//////////////////AP/////////////////gRAAAAAAAAAAAAAAAROD///////////////8A////////////////0BgAAAAAAAAAAAAAAAAAEMj//////////////wD///////////////AcAAAAAAAAAAAAAAAAAAAAHPD/////////////AP//////////////hAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A//////////////8sAAAAAAAAKMz/zCgAAAAAAAAs/////////////wD//////////////wAAAAAAAADM////zAAAAAAAAAD/////////////AP//////////////BAAAAAAAAP//////AAAAAAAABP////////////8A//////////////8sAAAAAAAAzP///9QAAAAAAAAw/////////////wD//////////////3wAAAAAAAAoyP/YNAAAAAAAAIT/////////////AP//////////////7BgAAAAAAAAAAAAAAAAAAAAc8P////////////8A////////////////xBgAAAAAAAAAAAAAAAAAGNj//////////////wD/////////////////tAQAAAAAAAAAAAAAAACo////////////////AP///////////////HAAAAAAAAAAAAAAAAAAAAB8//////////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB8/////////////wD/////////////wAAAAAAAAABk4P/UWAAAAAAAAATQ////////////AP////////////9UAAAAAAAAaP//////XAAAAAAAAGT///////////8A/////////////xgAAAAAAADg///////cAAAAAAAAJP///////////wD/////////////AAAAAAAAAP////////8AAAAAAAAA////////////AP////////////8AAAAAAAAA4P//////3AAAAAAAAAT///////////8A/////////////ygAAAAAAABg//////9cAAAAAAAALP///////////wD/////////////ZAAAAAAAAABY1P/cXAAAAAAAAABw////////////AP/////////////QAAAAAAAAAAAAAAAAAAAAAAAABNz///////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB0/////////////wD///////////////Q8AAAAAAAAAAAAAAAAAAAAUPz/////////////AP////////////////x4CAAAAAAAAAAAAAAAEIT8//////////////8A///////////////////smFQwGAAAABg0ZKT0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '9' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////ysYCwMAAAUNGiw/P//////////////////AP////////////////+4JAAAAAAAAAAAAAAkuP////////////////8A////////////////lAQAAAAAAAAAAAAAAAAAkP///////////////wD//////////////8AEAAAAAAAAAAAAAAAAAAAAqP//////////////AP/////////////8JAAAAAAAAAAAAAAAAAAAAAAQ7P////////////8A/////////////6wAAAAAAAAAfOz8vCwAAAAAAABw/////////////wD/////////////WAAAAAAAAHD/////7BgAAAAAAAz4////////////AP////////////8kAAAAAAAA1P//////hAAAAAAAALT///////////8A/////////////wAAAAAAAAD///////+4AAAAAAAAcP///////////wD/////////////AAAAAAAAAPz//////8AAAAAAAABI////////////AP////////////8UAAAAAAAAzP//////lAAAAAAAACT///////////8A/////////////0QAAAAAAABY//////gsAAAAAAAADP///////////wD/////////////kAAAAAAAAABw5P/IPAAAAAAAAAAA////////////AP/////////////wEAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////////+UAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////9wAAAAAAAAAAAAAFAAAAAAAAAU////////////AP////////////////+IBAAAAAAAAABw3AAAAAAAACj///////////8A///////////////////cdCwEABhcxP+8AAAAAAAATP///////////wD//////////////////////////////5AAAAAAAAB4////////////AP//////////////////////////////UAAAAAAAALj///////////8A//////////////+kgGxUQCAM2P///+AIAAAAAAAQ+P///////////wD//////////////0gAAAAAAAA42P/EKAAAAAAAAHD/////////////AP//////////////sAAAAAAAAAAAAAAAAAAAAAAQ6P////////////8A////////////////TAAAAAAAAAAAAAAAAAAAAKz//////////////wD////////////////oKAAAAAAAAAAAAAAAAASU////////////////AP/////////////////sUAAAAAAAAAAAAAAwxP////////////////8A////////////////////yHA0FAAADCxktP///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'A' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////+QAAAAAAAAAAAAAAOT/////////////////AP//////////////////kAAAAAAAAAAAAAAAkP////////////////8A//////////////////88AAAAAAAAAAAAAAA8/////////////////wD/////////////////5AAAAAAAAAAAAAAAAADk////////////////AP////////////////+QAAAAAAAAAAAAAAAAAJD///////////////8A/////////////////zwAAAAAAAAAAAAAAAAAPP///////////////wD////////////////kAAAAAAAAAAgAAAAAAAAA5P//////////////AP///////////////5AAAAAAAAAAgAAAAAAAAACQ//////////////8A////////////////PAAAAAAAAAz8HAAAAAAAADz//////////////wD//////////////+QAAAAAAAAAWP9kAAAAAAAAANz/////////////AP//////////////kAAAAAAAAACk/7wAAAAAAAAAhP////////////8A//////////////88AAAAAAAABOz//BQAAAAAAAAw/////////////wD/////////////4AAAAAAAAAA8////ZAAAAAAAAADc////////////AP////////////+EAAAAAAAAAIj///+8AAAAAAAAAIT///////////8A/////////////zAAAAAAAAAA2P////wQAAAAAAAAMP///////////wD////////////cAAAAAAAAACT//////1wAAAAAAAAA3P//////////AP///////////4QAAAAAAAAAAAAAAAAAAAAAAAAAAACE//////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAAAAAADD//////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANz/////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhP////////8A//////////8wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw/////////wD/////////3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc////////AP////////+EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIT///////8A/////////zAAAAAAAAAAhP///////////2QAAAAAAAAAMP///////wD////////cAAAAAAAAAADM////////////vAAAAAAAAAAA3P//////AP///////4QAAAAAAAAAHP/////////////4DAAAAAAAAACE//////8A////////MAAAAAAAAABk//////////////9cAAAAAAAAADD//////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'B' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAEDh83P///////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAEhP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAeP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAABY////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAABT///////////8A//////////8AAAAAAAAAAP/////4zEwAAAAAAAAAAP///////////wD//////////wAAAAAAAAAA////////7AAAAAAAAAAQ////////////AP//////////AAAAAAAAAAD////////sAAAAAAAAAEj///////////8A//////////8AAAAAAAAAAP/////4zEQAAAAAAAAAtP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAFz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAiA/P////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAIjPj//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAGKz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJT///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAABNz//////////wD//////////wAAAAAAAAAA///////sqCAAAAAAAAAAbP//////////AP//////////AAAAAAAAAAD/////////yAAAAAAAAAAs//////////8A//////////8AAAAAAAAAAP//////////AAAAAAAAAAT//////////wD//////////wAAAAAAAAAA/////////7wAAAAAAAAAAP//////////AP//////////AAAAAAAAAAD//////+ikGAAAAAAAAAAY//////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFT//////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsP//////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAADj///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAc6P///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAATOj/////////////AP//////////AAAAAAAAAAAAAAAAAAAEIEBkkNj///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'C' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////5JRULBAAAAgkTIDQ//////////////////8A////////////////1FAAAAAAAAAAAAAAAABAyP///////////////wD//////////////4gEAAAAAAAAAAAAAAAAAAAElP//////////////AP////////////9wAAAAAAAAAAAAAAAAAAAAAAAAlP////////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAEyP///////////wD//////////9wIAAAAAAAAAAAAAAAAAAAAAAAAAAAw////////////AP//////////WAAAAAAAAAAAWMz/8JwQAAAAAAAAAACw//////////8A/////////+wEAAAAAAAAAID//////9QMAAAAAAAAAET//////////wD/////////nAAAAAAAAAAo/P///////3wAAAAABDBspP//////////AP////////9gAAAAAAAAAIz/////////3BxQjMT0//////////////8A/////////zQAAAAAAAAAzP///////////////////////////////wD/////////GAAAAAAAAADo////////////////////////////////AP////////8AAAAAAAAAAP////////////////////////////////8A/////////wAAAAAAAAAA/////////////////////////////////wD/////////AAAAAAAAAAD/////////////////////////////////AP////////8cAAAAAAAAAOj///////////////////////////////8A/////////zgAAAAAAAAA0P/////////kIGio7P///////////////wD/////////bAAAAAAAAACg/////////5wAAAAAMHS49P//////////AP////////+oAAAAAAAAAEz/////////PAAAAAAAAAAc//////////8A//////////QIAAAAAAAAALz//////6QAAAAAAAAAAGT//////////wD//////////3AAAAAAAAAADIzo/+SEBAAAAAAAAAAAyP//////////AP//////////7BAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////rAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD/////////////fAAAAAAAAAAAAAAAAAAAAAAAAJz/////////////AP//////////////iAQAAAAAAAAAAAAAAAAAAASY//////////////8A////////////////yEAAAAAAAAAAAAAAAAA8yP///////////////wD//////////////////9yIUCwQAAAAIEB4yP//////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'D' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAADChQkOT/////////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAABGjw//////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAACDY/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAABjk////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKj//////////wD///////////8AAAAAAAAAAP///+isSAAAAAAAAAAANP//////////AP///////////wAAAAAAAAAA////////hAAAAAAAAAAA2P////////8A////////////AAAAAAAAAAD/////////MAAAAAAAAACQ/////////wD///////////8AAAAAAAAAAP////////+MAAAAAAAAAFj/////////AP///////////wAAAAAAAAAA/////////8gAAAAAAAAAMP////////8A////////////AAAAAAAAAAD/////////5AAAAAAAAAAY/////////wD///////////8AAAAAAAAAAP//////////AAAAAAAAAAD/////////AP///////////wAAAAAAAAAA//////////8AAAAAAAAAAP////////8A////////////AAAAAAAAAAD//////////wAAAAAAAAAA/////////wD///////////8AAAAAAAAAAP/////////wAAAAAAAAABD/////////AP///////////wAAAAAAAAAA/////////9QAAAAAAAAAJP////////8A////////////AAAAAAAAAAD/////////qAAAAAAAAABI/////////wD///////////8AAAAAAAAAAP////////9QAAAAAAAAAHj/////////AP///////////wAAAAAAAAAA////////uAAAAAAAAAAAvP////////8A////////////AAAAAAAAAAD////w0HwEAAAAAAAAACT8/////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAADz8//////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAY6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAKNz/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAACHT0//////////////8A////////////AAAAAAAAAAAAAAAAABg4bKj0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'E' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'F' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'G' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////MB8TCgQAAAACCA4YJzs////////////////AP///////////////JQcAAAAAAAAAAAAAAAAAAhw8P////////////8A/////////////9gwAAAAAAAAAAAAAAAAAAAAAAAk2P///////////wD////////////EDAAAAAAAAAAAAAAAAAAAAAAAAAAc7P//////////AP//////////2AwAAAAAAAAAAAAAAAAAAAAAAAAAAABY//////////8A//////////wwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQ/////////wD/////////kAAAAAAAAAAAEHzQ/P/gmCAAAAAAAAAAAFz/////////AP////////wcAAAAAAAAACjg////////8CwAAAAAAAAgWP////////8A////////vAAAAAAAAAAI2P//////////yBRAcJjI8P///////////wD///////94AAAAAAAAAGD/////////////////////////////////AP///////0AAAAAAAAAAsP////////////////////////////////8A////////IAAAAAAAAADc/////////////////////////////////wD///////8AAAAAAAAAAP///////wAAAAAAAAAAAAAAAAD/////////AP///////wAAAAAAAAAA////////AAAAAAAAAAAAAAAAAP////////8A////////AAAAAAAAAAD///////8AAAAAAAAAAAAAAAAA/////////wD///////8gAAAAAAAAAOD//////wAAAAAAAAAAAAAAAAD/////////AP///////0AAAAAAAAAAtP//////AAAAAAAAAAAAAAAAAP////////8A////////cAAAAAAAAABw//////8AAAAAAAAAAAAAAAAA/////////wD///////+8AAAAAAAAABDs////////////AAAAAAAAAAD/////////AP////////wYAAAAAAAAADz0//////////AAAAAAAAAAAP////////8A/////////5AAAAAAAAAAACCY4P//3KhcCAAAAAAAAAAA/////////wD/////////+CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////AP//////////xAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIP////////8A////////////rAQAAAAAAAAAAAAAAAAAAAAAAAAAAGTw/////////wD/////////////vBQAAAAAAAAAAAAAAAAAAAAAADjI////////////AP//////////////8HAQAAAAAAAAAAAAAAAAAEiw//////////////8A//////////////////iwcEAgBAAABCA4aKDk/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'H' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'I' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'J' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAj//////////////wD//////////+zMrIxwUDAQ//////wAAAAAAAAAIP//////////////AP//////////DAAAAAAAAADo////2AAAAAAAAAA0//////////////8A//////////8wAAAAAAAAAKj///+YAAAAAAAAAFj//////////////wD//////////2gAAAAAAAAAIND/yBgAAAAAAAAAkP//////////////AP//////////vAAAAAAAAAAAAAAAAAAAAAAAAADc//////////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAUP///////////////wD////////////EBAAAAAAAAAAAAAAAAAAAABjk////////////////AP////////////+sBAAAAAAAAAAAAAAAAAAY2P////////////////8A///////////////EMAAAAAAAAAAAAAAAVOj//////////////////wD/////////////////vHBAIAAAABg8fNT/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'K' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////8AAAAAAAAAAP//////////wAQAAAAAAAAAAABw////////AP///////wAAAAAAAAAA/////////9AMAAAAAAAAAAAAcP////////8A////////AAAAAAAAAAD////////cGAAAAAAAAAAAAHD//////////wD///////8AAAAAAAAAAP//////6CgAAAAAAAAAAABs////////////AP///////wAAAAAAAAAA//////Q0AAAAAAAAAAAAVPz///////////8A////////AAAAAAAAAAD////8RAAAAAAAAAAAAFT8/////////////wD///////8AAAAAAAAAAP///1gAAAAAAAAAAABU/P//////////////AP///////wAAAAAAAAAA//9wAAAAAAAAAAAASPz///////////////8A////////AAAAAAAAAAD/jAAAAAAAAAAAADz0/////////////////wD///////8AAAAAAAAAAKQAAAAAAAAAAAA89P//////////////////AP///////wAAAAAAAAAABAAAAAAAAAAAFPT///////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAApP///////////////////wD///////8AAAAAAAAAAAAAAAAAAAAAAAAU8P//////////////////AP///////wAAAAAAAAAAAAAAAAAAAAAAAABk//////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAAAADE/////////////////wD///////8AAAAAAAAAAAAAAAAoEAAAAAAAACz8////////////////AP///////wAAAAAAAAAAAAAAGNiAAAAAAAAAAIj///////////////8A////////AAAAAAAAAAAAABjY//gYAAAAAAAACOD//////////////wD///////8AAAAAAAAAAAAY2P///5wAAAAAAAAASP//////////////AP///////wAAAAAAAAAAGNj//////CgAAAAAAAAAqP////////////8A////////AAAAAAAAAADI////////sAAAAAAAAAAc8P///////////wD///////8AAAAAAAAAAP//////////QAAAAAAAAABs////////////AP///////wAAAAAAAAAA///////////IAAAAAAAAAATI//////////8A////////AAAAAAAAAAD///////////9YAAAAAAAAADD8/////////wD///////8AAAAAAAAAAP///////////9wEAAAAAAAAAJD/////////AP///////wAAAAAAAAAA/////////////3AAAAAAAAAADOT///////8A////////AAAAAAAAAAD/////////////7BAAAAAAAAAAUP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'L' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'M' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////8AAAAAAAAAAAAAAHz//////3wAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAATP//////UAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAc//////8cAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAADw////8AAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAAALz////AAAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAAkP///5AAAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAABc////ZAAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAoAAAAADD///8wAAAAACQAAAAAAAAA////////AP//////AAAAAAAAAFwAAAAABPz//AgAAAAAXAAAAAAAAAD///////8A//////8AAAAAAAAAkAAAAAAA0P/UAAAAAACQAAAAAAAAAP///////wD//////wAAAAAAAADMAAAAAACg/6gAAAAAAMQAAAAAAAAA////////AP//////AAAAAAAAAPgEAAAAAHD/dAAAAAAE+AAAAAAAAAD///////8A//////8AAAAAAAAA/zQAAAAAQP9IAAAAADD/AAAAAAAAAP///////wD//////wAAAAAAAAD/bAAAAAAQ/xQAAAAAaP8AAAAAAAAA////////AP//////AAAAAAAAAP+gAAAAAADQAAAAAACc/wAAAAAAAAD///////8A//////8AAAAAAAAA/9QAAAAAAGgAAAAAAND/AAAAAAAAAP///////wD//////wAAAAAAAAD//wwAAAAAFAAAAAAM/P8AAAAAAAAA////////AP//////AAAAAAAAAP//RAAAAAAAAAAAADz//wAAAAAAAAD///////8A//////8AAAAAAAAA//94AAAAAAAAAAAAcP//AAAAAAAAAP///////wD//////wAAAAAAAAD//7AAAAAAAAAAAACo//8AAAAAAAAA////////AP//////AAAAAAAAAP//5AAAAAAAAAAAANz//wAAAAAAAAD///////8A//////8AAAAAAAAA////HAAAAAAAAAAQ////AAAAAAAAAP///////wD//////wAAAAAAAAD///9QAAAAAAAAAEz///8AAAAAAAAA////////AP//////AAAAAAAAAP///4gAAAAAAAAAfP///wAAAAAAAAD///////8A//////8AAAAAAAAA////vAAAAAAAAACw////AAAAAAAAAP///////wD//////wAAAAAAAAD////wAAAAAAAAAOz///8AAAAAAAAA////////AP//////AAAAAAAAAP////8sAAAAAAAc/////wAAAAAAAAD///////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'N' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAALD/////////////AAAAAAAAAP//////////AP////////8AAAAAAAAAFOj///////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAASP///////////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAkP//////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAI1P////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAw+P///////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAABw////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAC8//////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAABzs/////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAFD/////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAJz///8AAAAAAAAA//////////8A/////////wAAAAAAAAAUAAAAAAAADNz//wAAAAAAAAD//////////wD/////////AAAAAAAAALQAAAAAAAAANPz/AAAAAAAAAP//////////AP////////8AAAAAAAAA/2wAAAAAAAAAfP8AAAAAAAAA//////////8A/////////wAAAAAAAAD/+CwAAAAAAAAExAAAAAAAAAD//////////wD/////////AAAAAAAAAP//0AQAAAAAAAAgAAAAAAAAAP//////////AP////////8AAAAAAAAA////jAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////RAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP/////kFAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA//////+sAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD///////9kAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP////////QkAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA/////////8wEAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD//////////4QAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP///////////DwAAAAAAAAAAP//////////AP////////8AAAAAAAAA////////////4BAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////////////qAAAAAAAAAD//////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'O' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////0qGw4HAAAABw4aKT0/////////////////wD////////////////wcAwAAAAAAAAAAAAAAAho6P//////////////AP//////////////uBQAAAAAAAAAAAAAAAAAAAAMoP////////////8A/////////////6AEAAAAAAAAAAAAAAAAAAAAAAAAkP///////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP//////////8BQAAAAAAAAAAAAAAAAAAAAAAAAAAAAM5P////////8A//////////9wAAAAAAAAAAAsrPD/7KQsAAAAAAAAAABg/////////wD/////////+BAAAAAAAAAAUPj///////hQAAAAAAAAAAjs////////AP////////+sAAAAAAAAABDw//////////AYAAAAAAAAAKD///////8A/////////2wAAAAAAAAAdP///////////3wAAAAAAAAAYP///////wD/////////OAAAAAAAAAC4////////////xAAAAAAAAAAw////////AP////////8cAAAAAAAAAOD////////////oAAAAAAAAABT///////8A/////////wAAAAAAAAAA//////////////8AAAAAAAAAAP///////wD/////////AAAAAAAAAAD//////////////wAAAAAAAAAA////////AP////////8AAAAAAAAAAP/////////////8AAAAAAAAAAD///////8A/////////xwAAAAAAAAA5P///////////+AAAAAAAAAAHP///////wD/////////NAAAAAAAAAC8////////////uAAAAAAAAAA4////////AP////////9oAAAAAAAAAHj///////////98AAAAAAAAAGT///////8A/////////6gAAAAAAAAAGPD/////////+BgAAAAAAAAApP///////wD/////////9AwAAAAAAAAAUPz///////xcAAAAAAAAAAjs////////AP//////////cAAAAAAAAAAALKjs//CwOAAAAAAAAAAAYP////////8A///////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzk/////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP////////////+QAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A//////////////+sEAAAAAAAAAAAAAAAAAAAAAyg/////////////wD////////////////oZAgAAAAAAAAAAAAAAARg4P//////////////AP//////////////////9KhsOCAAAAAUMFyc7P////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'P' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////wAAAAAAAAAAAAAAAAAACCxguP////////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAOOD//////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAGOD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAARP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAABo////////////AP///////////wAAAAAAAAAA////6JwMAAAAAAAAADD///////////8A////////////AAAAAAAAAAD//////6AAAAAAAAAADP///////////wD///////////8AAAAAAAAAAP//////9AAAAAAAAAAA////////////AP///////////wAAAAAAAAAA///////0AAAAAAAAAAD///////////8A////////////AAAAAAAAAAD//////5gAAAAAAAAAHP///////////wD///////////8AAAAAAAAAAP///9iICAAAAAAAAABI////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAIT/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAABU/P////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAIhPz//////////////wD///////////8AAAAAAAAAAAAAAAAABCRMkOz/////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Q' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////SoaDQcAAAAHDhoqPT///////////////////8A//////////////BwDAAAAAAAAAAAAAAACHDo/////////////////wD///////////+4FAAAAAAAAAAAAAAAAAAAABCo////////////////AP//////////nAQAAAAAAAAAAAAAAAAAAAAAAACQ//////////////8A/////////7gEAAAAAAAAAAAAAAAAAAAAAAAAAACg/////////////wD////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzo////////////AP///////3AAAAAAAAAAACyo8P/sqCwAAAAAAAAAAGT///////////8A///////4EAAAAAAAAABM+P///////FQAAAAAAAAACPT//////////wD//////7AAAAAAAAAAFPD/////////9BgAAAAAAAAApP//////////AP//////bAAAAAAAAAB4////////////fAAAAAAAAABk//////////8A//////84AAAAAAAAALz///////////+8AAAAAAAAADT//////////wD//////xwAAAAAAAAA6P///////////+QAAAAAAAAAHP//////////AP//////AAAAAAAAAAD//////////////wAAAAAAAAAA//////////8A//////8AAAAAAAAAAP//////////////AAAAAAAAAAD//////////wD//////wAAAAAAAAAA/P////////////8AAAAAAAAAAP//////////AP//////GAAAAAAAAADg////////////4AAAAAAAAAAc//////////8A//////84AAAAAAAAALT////MJHTo//+8AAAAAAAAADT//////////wD//////2wAAAAAAAAAdP///2AAABCg/3wAAAAAAAAAZP//////////AP//////rAAAAAAAAAAY9P/sCAAAAABMGAAAAAAAAACk//////////8A///////4EAAAAAAAAABU/P+0OAAAAAAAAAAAAAAACPT//////////wD///////94AAAAAAAAAAA4sPD/gAAAAAAAAAAAAABk////////////AP////////AcAAAAAAAAAAAAAAAAAAAAAAAAAAAADOT///////////8A/////////7wEAAAAAAAAAAAAAAAAAAAAAAAAAACQ/////////////wD//////////6wEAAAAAAAAAAAAAAAAAAAAAAAAABSs////////////AP///////////7gUAAAAAAAAAAAAAAAAAAAAAAAAAABAwP////////8A//////////////BwDAAAAAAAAAAAAAAABAgAAAAAAAA8/////////wD////////////////0qGg0GAAAABgwXJjkxBgAAAAAALD/////////AP//////////////////////////////////5DQAAAAk/P////////8A////////////////////////////////////+GwAAJD//////////wD//////////////////////////////////////8A49P//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'R' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////wAAAAAAAAAAAAAAAAAAAAQgOGSk+P///////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAcuP//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAEsP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ6P///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADD///////////8A/////////wAAAAAAAAAA///////svDgAAAAAAAAACP///////////wD/////////AAAAAAAAAAD/////////7AAAAAAAAAAA////////////AP////////8AAAAAAAAAAP/////////cAAAAAAAAABD///////////8A/////////wAAAAAAAAAA//////DQoCQAAAAAAAAAQP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACU////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIPj///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAzU/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAA02P//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAxctPz///////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAEDY/////////////////wD/////////AAAAAAAAAAD/9LAsAAAAAAAAAAzc////////////////AP////////8AAAAAAAAAAP///+wkAAAAAAAAADD8//////////////8A/////////wAAAAAAAAAA/////8QAAAAAAAAAAJD//////////////wD/////////AAAAAAAAAAD//////1QAAAAAAAAAFPD/////////////AP////////8AAAAAAAAAAP//////3AQAAAAAAAAAgP////////////8A/////////wAAAAAAAAAA////////aAAAAAAAAAAM6P///////////wD/////////AAAAAAAAAAD////////oCAAAAAAAAABs////////////AP////////8AAAAAAAAAAP////////+AAAAAAAAAAATc//////////8A/////////wAAAAAAAAAA//////////AUAAAAAAAAAFj//////////wD/////////AAAAAAAAAAD//////////5AAAAAAAAAAAND/////////AP////////8AAAAAAAAAAP//////////+CQAAAAAAAAAQP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'S' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////8vHBEIAgAAAQgQHC8/P////////////////8A////////////////pCQAAAAAAAAAAAAAAAAcoP///////////////wD//////////////FwAAAAAAAAAAAAAAAAAAAAAXP//////////////AP////////////9oAAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A////////////zAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////9cAAAAAAAAAAAAAAAAAAAAAAAAAACA////////////AP///////////xgAAAAAAAAAUOD/8KwkAAAAAAAAADj///////////8A////////////AAAAAAAAAAD0/////8wABCAgICxASP///////////wD///////////8MAAAAAAAAAMz/////////////////////////////AP///////////0AAAAAAAAAACFiQxPT///////////////////////8A////////////oAAAAAAAAAAAAAAAADBwtPT//////////////////wD////////////8QAAAAAAAAAAAAAAAAAAACFTA////////////////AP/////////////oOAAAAAAAAAAAAAAAAAAAAABM6P////////////8A///////////////4fAgAAAAAAAAAAAAAAAAAAAAY2P///////////wD/////////////////7IwwAAAAAAAAAAAAAAAAAAAo+P//////////AP/////////////////////koGw0BAAAAAAAAAAAAACU//////////8A///////////////////////////4uFgAAAAAAAAAADz//////////wD//////////2BgSEA0IBwA6P///////5QAAAAAAAAADP//////////AP//////////JAAAAAAAAACc/////////AAAAAAAAAAA//////////8A//////////9YAAAAAAAAACDo///////AAAAAAAAAABT//////////wD//////////6QAAAAAAAAAACCk7P/snBQAAAAAAAAAUP//////////AP//////////+BAAAAAAAAAAAAAAAAAAAAAAAAAAAACs//////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAAOP///////////wD////////////8RAAAAAAAAAAAAAAAAAAAAAAAABjc////////////AP/////////////0PAAAAAAAAAAAAAAAAAAAAAAg2P////////////8A///////////////8hBQAAAAAAAAAAAAAAAAMdPT//////////////wD/////////////////+LRwSCAMAAAAHDhoqPT/////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'T' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'U' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////JAAAAAAAAADk/////////+gAAAAAAAAAHP//////////AP////////9MAAAAAAAAAJz/////////nAAAAAAAAABE//////////8A/////////4gAAAAAAAAAHOj//////+ggAAAAAAAAAHz//////////wD/////////0AAAAAAAAAAAIJzs/+ykIAAAAAAAAAAA0P//////////AP//////////QAAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A///////////IBAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAAAAJj/////////////AP////////////+UBAAAAAAAAAAAAAAAAAAAAASU//////////////8A///////////////IPAAAAAAAAAAAAAAAAAAwyP///////////////wD/////////////////0IxYOCAIAAAEIEiAyP//////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'V' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////zAAAAAAAAAAYP//////////////ZAAAAAAAAAAw////////AP//////kAAAAAAAAAAU/P////////////8UAAAAAAAAAJD///////8A///////oBAAAAAAAAADE////////////xAAAAAAAAAAE7P///////wD///////9MAAAAAAAAAHD///////////94AAAAAAAAAEz/////////AP///////6gAAAAAAAAAJP///////////yQAAAAAAAAArP////////8A////////+BAAAAAAAAAA1P/////////YAAAAAAAAABT4/////////wD/////////aAAAAAAAAACE/////////4QAAAAAAAAAbP//////////AP/////////EAAAAAAAAADT/////////OAAAAAAAAADM//////////8A//////////8kAAAAAAAAAOT//////+QAAAAAAAAAKP///////////wD//////////4QAAAAAAAAAmP//////nAAAAAAAAACI////////////AP//////////5AAAAAAAAABE//////9EAAAAAAAABOT///////////8A////////////QAAAAAAAAAT0////9AgAAAAAAABI/////////////wD///////////+gAAAAAAAAAKT///+kAAAAAAAAAKj/////////////AP////////////QIAAAAAAAAXP///1wAAAAAAAAM+P////////////8A/////////////1wAAAAAAAAM+P/8DAAAAAAAAGT//////////////wD/////////////vAAAAAAAAAC8/7wAAAAAAAAAxP//////////////AP//////////////HAAAAAAAAGj/aAAAAAAAACT///////////////8A//////////////94AAAAAAAAHP8cAAAAAAAAhP///////////////wD//////////////9gAAAAAAAAAkAAAAAAAAADk////////////////AP///////////////zgAAAAAAAAQAAAAAAAAQP////////////////8A////////////////lAAAAAAAAAAAAAAAAACg/////////////////wD////////////////sCAAAAAAAAAAAAAAADPT/////////////////AP////////////////9QAAAAAAAAAAAAAABg//////////////////8A/////////////////7AAAAAAAAAAAAAAAMD//////////////////wD//////////////////BQAAAAAAAAAAAAc////////////////////AP//////////////////cAAAAAAAAAAAAHz///////////////////8A///////////////////MAAAAAAAAAAAA3P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'W' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//8cAAAAAAAAALz/////4AAAAAAAAAAA6P////+8AAAAAAAAABz//wD//1QAAAAAAAAAjP////+gAAAAAAAAAACo/////4wAAAAAAAAAUP//AP//jAAAAAAAAABU/////2AAAAAAAAAAAGj/////VAAAAAAAAACM//8A///EAAAAAAAAACT/////IAAAAAAAAAAAKP////8kAAAAAAAAAMT//wD///gEAAAAAAAAAPD//+AAAAAAAAAAAAAA6P//8AAAAAAAAAAE9P//AP///zAAAAAAAAAAvP//oAAAAAAAAAAAAACo//+8AAAAAAAAADD///8A////bAAAAAAAAACM//9gAAAAAAAAAAAAAGT//4wAAAAAAAAAaP///wD///+kAAAAAAAAAFT//yAAAAAAAAAAAAAAIP//VAAAAAAAAACc////AP///9gAAAAAAAAAJP/gAAAAAAAAAAAAAAAA4P8kAAAAAAAAANT///8A/////xAAAAAAAAAA8KAAAAAAAAAAAAAAAACg8AAAAAAAAAAQ/////wD/////TAAAAAAAAAC8YAAAAAAAAAAAAAAAAGC8AAAAAAAAAET/////AP////+AAAAAAAAAAIwgAAAAAAAAAAAAAAAAIIwAAAAAAAAAfP////8A/////7gAAAAAAAAANAAAAAAAACwwAAAAAAAANAAAAAAAAACw/////wD/////8AAAAAAAAAAAAAAAAAAAdHgAAAAAAAAAAAAAAAAAAOz/////AP//////KAAAAAAAAAAAAAAAAAC4vAAAAAAAAAAAAAAAAAAg//////8A//////9gAAAAAAAAAAAAAAAACPj4CAAAAAAAAAAAAAAAAFj//////wD//////5QAAAAAAAAAAAAAAABE//9IAAAAAAAAAAAAAAAAkP//////AP//////0AAAAAAAAAAAAAAAAIj//4wAAAAAAAAAAAAAAADI//////8A///////8DAAAAAAAAAAAAAAAzP//1AAAAAAAAAAAAAAABPj//////wD///////88AAAAAAAAAAAAABT/////GAAAAAAAAAAAAAA0////////AP///////3QAAAAAAAAAAAAAWP////9gAAAAAAAAAAAAAHD///////8A////////sAAAAAAAAAAAAACg/////6QAAAAAAAAAAAAApP///////wD////////kAAAAAAAAAAAAAOT/////6AAAAAAAAAAAAADc////////AP////////8cAAAAAAAAAAAo////////MAAAAAAAAAAAEP////////8A/////////1QAAAAAAAAAAHD///////94AAAAAAAAAABM/////////wD/////////jAAAAAAAAAAAtP///////7wAAAAAAAAAAID/////////AP/////////EAAAAAAAAAAT0////////+AgAAAAAAAAAuP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'X' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////9UAAAAAAAAAKz///////////+sAAAAAAAAAFD/////////AP///////+QQAAAAAAAAFOT/////////8BwAAAAAAAAM5P////////8A/////////5gAAAAAAAAATP////////9kAAAAAAAAAJD//////////wD//////////0AAAAAAAAAAoP//////wAAAAAAAAAA0/P//////////AP//////////2AgAAAAAAAAQ4P////gkAAAAAAAABMz///////////8A////////////iAAAAAAAAABA////dAAAAAAAAABw/////////////wD////////////8MAAAAAAAAACU/9AEAAAAAAAAHPD/////////////AP/////////////IBAAAAAAAAAzYMAAAAAAAAACs//////////////8A//////////////90AAAAAAAAABAAAAAAAAAATP///////////////wD///////////////QgAAAAAAAAAAAAAAAAAAzg////////////////AP///////////////7wAAAAAAAAAAAAAAAAAjP////////////////8A/////////////////2AAAAAAAAAAAAAAADD8/////////////////wD/////////////////7BQAAAAAAAAAAAAEyP//////////////////AP/////////////////gDAAAAAAAAAAAAAjY//////////////////8A/////////////////0AAAAAAAAAAAAAAADj8/////////////////wD///////////////+UAAAAAAAAAAAAAAAAAJD/////////////////AP//////////////4AwAAAAAAAAAAAAAAAAADOD///////////////8A//////////////9AAAAAAAAAAAAAAAAAAAAAQP///////////////wD/////////////nAAAAAAAAAAAWAAAAAAAAAAAlP//////////////AP///////////+QQAAAAAAAAAGD/YAAAAAAAAAAM4P////////////8A////////////TAAAAAAAAAAs9P/0LAAAAAAAAABM/////////////wD//////////6AAAAAAAAAADNT////UDAAAAAAAAACg////////////AP/////////kEAAAAAAAAACg//////+gAAAAAAAAABDk//////////8A/////////0wAAAAAAAAAYP////////9gAAAAAAAAAEz//////////wD///////+oAAAAAAAAACz0//////////QsAAAAAAAAAKT/////////AP//////7BQAAAAAAAAM1P///////////9QMAAAAAAAAFOz///////8A//////9UAAAAAAAAAKD//////////////6AAAAAAAAAAVP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Y' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////1QAAAAAAAAAAGj//////////2gAAAAAAAAAAFT///////8A////////5BAAAAAAAAAAAMT////////EAAAAAAAAAAAQ5P///////wD/////////mAAAAAAAAAAAKPj/////+CgAAAAAAAAAAJj/////////AP//////////PAAAAAAAAAAAgP////+AAAAAAAAAAAA8//////////8A///////////YCAAAAAAAAAAE2P//2AQAAAAAAAAACNj//////////wD///////////+AAAAAAAAAAAA4//84AAAAAAAAAACA////////////AP////////////woAAAAAAAAAACUlAAAAAAAAAAAKPz///////////8A/////////////8gAAAAAAAAAABAQAAAAAAAAAADI/////////////wD//////////////2wAAAAAAAAAAAAAAAAAAAAAbP//////////////AP//////////////8BwAAAAAAAAAAAAAAAAAABzw//////////////8A////////////////tAAAAAAAAAAAAAAAAAAAtP///////////////wD/////////////////VAAAAAAAAAAAAAAAAFT/////////////////AP/////////////////oEAAAAAAAAAAAAAAQ6P////////////////8A//////////////////+cAAAAAAAAAAAAAJz//////////////////wD///////////////////9AAAAAAAAAAABA////////////////////AP///////////////////9gAAAAAAAAAANj///////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Z' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAQ//////////////8A/////////////////////////1AAAAAAAAAABLz//////////////wD///////////////////////98AAAAAAAAAACY////////////////AP//////////////////////pAAAAAAAAAAAaP////////////////8A/////////////////////8QIAAAAAAAAAET8/////////////////wD////////////////////gGAAAAAAAAAAo9P//////////////////AP//////////////////9CwAAAAAAAAAFNz///////////////////8A//////////////////xMAAAAAAAAAATA/////////////////////wD/////////////////eAAAAAAAAAAAnP//////////////////////AP///////////////5wAAAAAAAAAAHT///////////////////////8A///////////////ABAAAAAAAAABM/P///////////////////////wD/////////////3BQAAAAAAAAALPT/////////////////////////AP////////////QoAAAAAAAAABjg//////////////////////////8A///////////8SAAAAAAAAAAExP///////////////////////////wD//////////2wAAAAAAAAAAKD/////////////////////////////AP////////+YAAAAAAAAAAB8//////////////////////////////8A/////////wQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + ); + } +} diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php new file mode 100644 index 0000000000..82b08704ff --- /dev/null +++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php @@ -0,0 +1,390 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +/** +* This class holds the code shared by the two default 3.0.x CAPTCHAs. +*/ +abstract class captcha_abstract +{ + var $confirm_id; + var $confirm_code; + var $code; + var $seed; + var $attempts = 0; + var $type; + var $solved = 0; + var $captcha_vars = false; + + /** + * @var string name of the service. + */ + protected $service_name; + + function init($type) + { + global $config, $request; + + // read input + $this->confirm_id = $request->variable('confirm_id', ''); + $this->confirm_code = $request->variable('confirm_code', ''); + $refresh = $request->variable('refresh_vc', false) && $config['confirm_refresh']; + + $this->type = (int) $type; + + if (!strlen($this->confirm_id) || !$this->load_code()) + { + // we have no confirm ID, better get ready to display something + $this->generate_code(); + } + else if ($refresh) + { + $this->regenerate_code(); + } + } + + function execute_demo() + { + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + + $generator = $this->get_generator_class(); + $captcha = new $generator(); + define('IMAGE_OUTPUT', 1); + $captcha->execute($this->code, $this->seed); + } + + function execute() + { + if (empty($this->code)) + { + if (!$this->load_code()) + { + // invalid request, bail out + return false; + } + } + $generator = $this->get_generator_class(); + $captcha = new $generator(); + define('IMAGE_OUTPUT', 1); + $captcha->execute($this->code, $this->seed); + } + + function get_template() + { + global $config, $user, $template, $phpEx, $phpbb_root_path; + + if ($this->is_solved()) + { + return false; + } + else + { + $link = append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=confirm&confirm_id=' . $this->confirm_id . '&type=' . $this->type); + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); + $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '<a href="' . $contact_link . '">', '</a>'); + + $template->assign_vars(array( + 'CONFIRM_IMAGE_LINK' => $link, + 'CONFIRM_IMAGE' => '<img src="' . $link . '" />', + 'CONFIRM_IMG' => '<img src="' . $link . '" />', + 'CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh'] && $this->type == CONFIRM_REG) ? true : false, + 'L_CONFIRM_EXPLAIN' => $explain, + )); + + return 'captcha_default.html'; + } + } + + function get_demo_template($id) + { + global $config, $template, $request, $phpbb_admin_path, $phpEx; + + $variables = ''; + + if (is_array($this->captcha_vars)) + { + foreach ($this->captcha_vars as $captcha_var => $template_var) + { + $variables .= '&' . rawurlencode($captcha_var) . '=' . $request->variable($captcha_var, (int) $config[$captcha_var]); + } + } + + // acp_captcha has a delivery function; let's use it + $template->assign_vars(array( + 'CONFIRM_IMAGE' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'captcha_demo=1&mode=visual&i=' . $id . '&select_captcha=' . $this->get_service_name()) . $variables, + 'CONFIRM_ID' => $this->confirm_id, + )); + + return 'captcha_default_acp_demo.html'; + } + + function get_hidden_fields() + { + $hidden_fields = array(); + + // this is required for posting.php - otherwise we would forget about the captcha being already solved + if ($this->solved) + { + $hidden_fields['confirm_code'] = $this->confirm_code; + } + $hidden_fields['confirm_id'] = $this->confirm_id; + return $hidden_fields; + } + + function garbage_collect($type) + { + global $db; + + $sql = 'SELECT DISTINCT c.session_id + FROM ' . CONFIRM_TABLE . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL' . + ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + do + { + $sql_in[] = (string) $row['session_id']; + } + while ($row = $db->sql_fetchrow($result)); + + if (sizeof($sql_in)) + { + $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' + WHERE ' . $db->sql_in_set('session_id', $sql_in); + $db->sql_query($sql); + } + } + $db->sql_freeresult($result); + } + + function uninstall() + { + $this->garbage_collect(0); + } + + function install() + { + return; + } + + function validate() + { + global $user; + + if (!$user->is_setup()) + { + $user->setup(); + } + + $error = ''; + if (!$this->confirm_id) + { + $error = $user->lang['CONFIRM_CODE_WRONG']; + } + else + { + if ($this->check_code()) + { + $this->solved = true; + } + else + { + $error = $user->lang['CONFIRM_CODE_WRONG']; + } + } + + if (strlen($error)) + { + // okay, incorrect answer. Let's ask a new question. + $this->new_attempt(); + return $error; + } + else + { + return false; + } + } + + /** + * The old way to generate code, suitable for GD and non-GD. Resets the internal state. + */ + function generate_code() + { + global $db, $user; + + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->confirm_id = md5(unique_id($user->ip)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + $this->solved = 0; + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + + $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'confirm_id' => (string) $this->confirm_id, + 'session_id' => (string) $user->session_id, + 'confirm_type' => (int) $this->type, + 'code' => (string) $this->code, + 'seed' => (int) $this->seed) + ); + $db->sql_query($sql); + } + + /** + * New Question, if desired. + */ + function regenerate_code() + { + global $db, $user; + + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + $this->solved = 0; + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + + $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'code' => (string) $this->code, + 'seed' => (int) $this->seed)) . ' + WHERE + confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' + AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; + $db->sql_query($sql); + } + + /** + * New Question, if desired. + */ + function new_attempt() + { + global $db, $user; + + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->seed = hexdec(substr(unique_id(), 4, 10)); + $this->solved = 0; + // compute $seed % 0x7fffffff + $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); + + $sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'code' => (string) $this->code, + 'seed' => (int) $this->seed)) . ' + , attempts = attempts + 1 + WHERE + confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\' + AND session_id = \'' . $db->sql_escape($user->session_id) . '\''; + $db->sql_query($sql); + } + + /** + * Look up everything we need for painting&checking. + */ + function load_code() + { + global $db, $user; + + $sql = 'SELECT code, seed, attempts + FROM ' . CONFIRM_TABLE . " + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $this->code = $row['code']; + $this->seed = $row['seed']; + $this->attempts = $row['attempts']; + return true; + } + + return false; + } + + function check_code() + { + return (strcasecmp($this->code, $this->confirm_code) === 0); + } + + function get_attempt_count() + { + return $this->attempts; + } + + function reset() + { + global $db, $user; + + $sql = 'DELETE FROM ' . CONFIRM_TABLE . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . (int) $this->type; + $db->sql_query($sql); + + // we leave the class usable by generating a new question + $this->generate_code(); + } + + function is_solved() + { + global $request; + + if ($request->variable('confirm_code', false) && $this->solved === 0) + { + $this->validate(); + } + return (bool) $this->solved; + } + + /** + * API function + */ + function has_config() + { + return false; + } + + /** + * @return string the name of the service corresponding to the plugin + */ + function get_service_name() + { + return $this->service_name; + } + + /** + * Set the name of the plugin + * + * @param string $name + */ + public function set_name($name) + { + $this->service_name = $name; + } + + /** + * @return string the name of the class used to generate the captcha + */ + abstract function get_generator_class(); +} diff --git a/phpBB/phpbb/captcha/plugins/gd.php b/phpBB/phpbb/captcha/plugins/gd.php new file mode 100644 index 0000000000..831e5bcfdf --- /dev/null +++ b/phpBB/phpbb/captcha/plugins/gd.php @@ -0,0 +1,123 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +class gd extends captcha_abstract +{ + var $captcha_vars = array( + 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', + 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', + 'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE', +// 'captcha_gd' => 'CAPTCHA_GD_PREVIEWED', + 'captcha_gd_wave' => 'CAPTCHA_GD_WAVE', + 'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE', + 'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS', + ); + + public function is_available() + { + return @extension_loaded('gd'); + } + + /** + * @return string the name of the class used to generate the captcha + */ + function get_generator_class() + { + return '\\phpbb\\captcha\\gd'; + } + + /** + * API function + */ + function has_config() + { + return true; + } + + public function get_name() + { + return 'CAPTCHA_GD'; + } + + function acp_page($id, &$module) + { + global $user, $template, $phpbb_log, $request; + global $config; + + $user->add_lang('acp/board'); + + $module->tpl_name = 'captcha_gd_acp'; + $module->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = $request->variable('submit', ''); + + if ($submit && check_form_key($form_key)) + { + $captcha_vars = array_keys($this->captcha_vars); + foreach ($captcha_vars as $captcha_var) + { + $value = $request->variable($captcha_var, 0); + if ($value >= 0) + { + $config->set($captcha_var, $value); + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL'); + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); + } + else + { + foreach ($this->captcha_vars as $captcha_var => $template_var) + { + $var = (isset($_REQUEST[$captcha_var])) ? $request->variable($captcha_var, 0) : $config[$captcha_var]; + $template->assign_var($template_var, $var); + } + + $template->assign_vars(array( + 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), + 'CAPTCHA_NAME' => $this->get_service_name(), + 'U_ACTION' => $module->u_action, + )); + } + } + + function execute_demo() + { + global $config, $request; + + $config_old = $config; + + $config = new \phpbb\config\config(array()); + foreach ($config_old as $key => $value) + { + $config->set($key, $value); + } + + foreach ($this->captcha_vars as $captcha_var => $template_var) + { + $config->set($captcha_var, $request->variable($captcha_var, (int) $config[$captcha_var])); + } + parent::execute_demo(); + $config = $config_old; + } + +} diff --git a/phpBB/phpbb/captcha/plugins/gd_wave.php b/phpBB/phpbb/captcha/plugins/gd_wave.php new file mode 100644 index 0000000000..bde46f8815 --- /dev/null +++ b/phpBB/phpbb/captcha/plugins/gd_wave.php @@ -0,0 +1,42 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +class gd_wave extends captcha_abstract +{ + public function is_available() + { + return @extension_loaded('gd'); + } + + public function get_name() + { + return 'CAPTCHA_GD_3D'; + } + + /** + * @return string the name of the class used to generate the captcha + */ + function get_generator_class() + { + return '\\phpbb\\captcha\\gd_wave'; + } + + function acp_page($id, &$module) + { + global $user; + + trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); + } +} diff --git a/phpBB/phpbb/captcha/plugins/nogd.php b/phpBB/phpbb/captcha/plugins/nogd.php new file mode 100644 index 0000000000..6845e5935c --- /dev/null +++ b/phpBB/phpbb/captcha/plugins/nogd.php @@ -0,0 +1,42 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +class nogd extends captcha_abstract +{ + public function is_available() + { + return true; + } + + public function get_name() + { + return 'CAPTCHA_NO_GD'; + } + + /** + * @return string the name of the class used to generate the captcha + */ + function get_generator_class() + { + return '\\phpbb\\captcha\\non_gd'; + } + + function acp_page($id, &$module) + { + global $user; + + trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action)); + } +} diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php new file mode 100644 index 0000000000..4df8a86432 --- /dev/null +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -0,0 +1,1011 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +/** +* And now to something completely different. Let's make a captcha without extending the abstract class. +* QA CAPTCHA sample implementation +*/ +class qa +{ + var $confirm_id; + var $answer; + var $question_ids; + var $question_text; + var $question_lang; + var $question_strict; + var $attempts = 0; + var $type; + // dirty trick: 0 is false, but can still encode that the captcha is not yet validated + var $solved = 0; + + protected $table_captcha_questions; + protected $table_captcha_answers; + protected $table_qa_confirm; + + /** + * @var string name of the service. + */ + protected $service_name; + + /** + * Constructor + * + * @param string $table_captcha_questions + * @param string $table_captcha_answers + * @param string $table_qa_confirm + */ + function __construct($table_captcha_questions, $table_captcha_answers, $table_qa_confirm) + { + $this->table_captcha_questions = $table_captcha_questions; + $this->table_captcha_answers = $table_captcha_answers; + $this->table_qa_confirm = $table_qa_confirm; + } + + /** + * @param int $type as per the CAPTCHA API docs, the type + */ + function init($type) + { + global $config, $db, $user, $request; + + // load our language file + $user->add_lang('captcha_qa'); + + // read input + $this->confirm_id = $request->variable('qa_confirm_id', ''); + $this->answer = $request->variable('qa_answer', '', true); + + $this->type = (int) $type; + $this->question_lang = $user->lang_name; + + // we need all defined questions - shouldn't be too many, so we can just grab them + // try the user's lang first + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($user->lang_name) . "'"; + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + + // fallback to the board default lang + if (!sizeof($this->question_ids)) + { + $this->question_lang = $config['default_lang']; + + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + + // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one + if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) + { + // we have no valid confirm ID, better get ready to ask something + $this->select_question(); + } + } + + /** + * See if the captcha has created its tables. + */ + public function is_installed() + { + global $phpbb_container; + + $db_tool = $phpbb_container->get('dbal.tools'); + + return $db_tool->sql_table_exists($this->table_captcha_questions); + } + + /** + * API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang + */ + public function is_available() + { + global $config, $db, $user; + + // load language file for pretty display in the ACP dropdown + $user->add_lang('captcha_qa'); + + if (!$this->is_installed()) + { + return false; + } + + $sql = 'SELECT COUNT(question_id) AS question_count + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + return ((bool) $row['question_count']); + } + + /** + * API function + */ + function has_config() + { + return true; + } + + /** + * API function + */ + static public function get_name() + { + return 'CAPTCHA_QA'; + } + + /** + * @return string the name of the service corresponding to the plugin + */ + function get_service_name() + { + return $this->service_name; + } + + /** + * Set the name of the plugin + * + * @param string $name + */ + public function set_name($name) + { + $this->service_name = $name; + } + + /** + * API function - not needed as we don't display an image + */ + function execute_demo() + { + } + + /** + * API function - not needed as we don't display an image + */ + function execute() + { + } + + /** + * API function - send the question to the template + */ + function get_template() + { + global $template; + + if ($this->is_solved()) + { + return false; + } + else + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $this->question_text, + 'QA_CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + )); + + return 'captcha_qa.html'; + } + } + + /** + * API function - we just display a mockup so that the captcha doesn't need to be installed + */ + function get_demo_template() + { + global $config, $db, $template; + + if ($this->is_available()) + { + $sql = 'SELECT question_text + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query_limit($sql, 1); + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $row['question_text'], + )); + } + $db->sql_freeresult($result); + } + return 'captcha_qa_acp_demo.html'; + } + + /** + * API function + */ + function get_hidden_fields() + { + $hidden_fields = array(); + + // this is required - otherwise we would forget about the captcha being already solved + if ($this->solved) + { + $hidden_fields['qa_answer'] = $this->answer; + } + $hidden_fields['qa_confirm_id'] = $this->confirm_id; + + return $hidden_fields; + } + + /** + * API function + */ + function garbage_collect($type = 0) + { + global $db; + + $sql = 'SELECT c.confirm_id + FROM ' . $this->table_qa_confirm . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s + ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL' . + ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + + do + { + $sql_in[] = (string) $row['confirm_id']; + } + while ($row = $db->sql_fetchrow($result)); + + if (sizeof($sql_in)) + { + $sql = 'DELETE FROM ' . $this->table_qa_confirm . ' + WHERE ' . $db->sql_in_set('confirm_id', $sql_in); + $db->sql_query($sql); + } + } + $db->sql_freeresult($result); + } + + /** + * API function - we don't drop the tables here, as that would cause the loss of all entered questions. + */ + function uninstall() + { + $this->garbage_collect(0); + } + + /** + * API function - set up shop + */ + function install() + { + global $phpbb_container; + + $db_tool = $phpbb_container->get('dbal.tools'); + $schemas = array( + $this->table_captcha_questions => array ( + 'COLUMNS' => array( + 'question_id' => array('UINT', null, 'auto_increment'), + 'strict' => array('BOOL', 0), + 'lang_id' => array('UINT', 0), + 'lang_iso' => array('VCHAR:30', ''), + 'question_text' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'question_id', + 'KEYS' => array( + 'lang' => array('INDEX', 'lang_iso'), + ), + ), + $this->table_captcha_answers => array ( + 'COLUMNS' => array( + 'question_id' => array('UINT', 0), + 'answer_text' => array('STEXT_UNI', ''), + ), + 'KEYS' => array( + 'qid' => array('INDEX', 'question_id'), + ), + ), + $this->table_qa_confirm => array ( + 'COLUMNS' => array( + 'session_id' => array('CHAR:32', ''), + 'confirm_id' => array('CHAR:32', ''), + 'lang_iso' => array('VCHAR:30', ''), + 'question_id' => array('UINT', 0), + 'attempts' => array('UINT', 0), + 'confirm_type' => array('USINT', 0), + ), + 'KEYS' => array( + 'session_id' => array('INDEX', 'session_id'), + 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso')), + ), + 'PRIMARY_KEY' => 'confirm_id', + ), + ); + + foreach ($schemas as $table => $schema) + { + if (!$db_tool->sql_table_exists($table)) + { + $db_tool->sql_create_table($table, $schema); + } + } + } + + /** + * API function - see what has to be done to validate + */ + function validate() + { + global $user; + + $error = ''; + + if (!sizeof($this->question_ids)) + { + return false; + } + + if (!$this->confirm_id) + { + $error = $user->lang['CONFIRM_QUESTION_WRONG']; + } + else + { + if ($this->check_answer()) + { + $this->solved = true; + } + else + { + $error = $user->lang['CONFIRM_QUESTION_WRONG']; + } + } + + if (strlen($error)) + { + // okay, incorrect answer. Let's ask a new question. + $this->new_attempt(); + $this->solved = false; + + return $error; + } + else + { + return false; + } + } + + /** + * Select a question + */ + function select_question() + { + global $db, $user; + + if (!sizeof($this->question_ids)) + { + return; + } + $this->confirm_id = md5(unique_id($user->ip)); + $this->question = (int) array_rand($this->question_ids); + + $sql = 'INSERT INTO ' . $this->table_qa_confirm . ' ' . $db->sql_build_array('INSERT', array( + 'confirm_id' => (string) $this->confirm_id, + 'session_id' => (string) $user->session_id, + 'lang_iso' => (string) $this->question_lang, + 'confirm_type' => (int) $this->type, + 'question_id' => (int) $this->question, + )); + $db->sql_query($sql); + + $this->load_answer(); + } + + /** + * New Question, if desired. + */ + function reselect_question() + { + global $db, $user; + + if (!sizeof($this->question_ids)) + { + return; + } + + $this->question = (int) array_rand($this->question_ids); + $this->solved = 0; + + $sql = 'UPDATE ' . $this->table_qa_confirm . ' + SET question_id = ' . (int) $this->question . " + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $db->sql_query($sql); + + $this->load_answer(); + } + + /** + * Wrong answer, so we increase the attempts and use a different question. + */ + function new_attempt() + { + global $db, $user; + + // yah, I would prefer a stronger rand, but this should work + $this->question = (int) array_rand($this->question_ids); + $this->solved = 0; + + $sql = 'UPDATE ' . $this->table_qa_confirm . ' + SET question_id = ' . (int) $this->question . ", + attempts = attempts + 1 + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $db->sql_query($sql); + + $this->load_answer(); + } + + + /** + * See if there is already an entry for the current session. + */ + function load_confirm_id() + { + global $db, $user; + + $sql = 'SELECT confirm_id + FROM ' . $this->table_qa_confirm . " + WHERE + session_id = '" . $db->sql_escape($user->session_id) . "' + AND lang_iso = '" . $db->sql_escape($this->question_lang) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $this->confirm_id = $row['confirm_id']; + return true; + } + return false; + } + + /** + * Look up everything we need and populate the instance variables. + */ + function load_answer() + { + global $db, $user; + + if (!strlen($this->confirm_id) || !sizeof($this->question_ids)) + { + return false; + } + + $sql = 'SELECT con.question_id, attempts, question_text, strict + FROM ' . $this->table_qa_confirm . ' con, ' . $this->table_captcha_questions . " qes + WHERE con.question_id = qes.question_id + AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND qes.lang_iso = '" . $db->sql_escape($this->question_lang) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $this->question = $row['question_id']; + + $this->attempts = $row['attempts']; + $this->question_strict = $row['strict']; + $this->question_text = $row['question_text']; + + return true; + } + + return false; + } + + /** + * The actual validation + */ + function check_answer() + { + global $db, $request; + + $answer = ($this->question_strict) ? $request->variable('qa_answer', '', true) : utf8_clean_string($request->variable('qa_answer', '', true)); + + $sql = 'SELECT answer_text + FROM ' . $this->table_captcha_answers . ' + WHERE question_id = ' . (int) $this->question; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $solution = ($this->question_strict) ? $row['answer_text'] : utf8_clean_string($row['answer_text']); + + if ($solution === $answer) + { + $this->solved = true; + + break; + } + } + $db->sql_freeresult($result); + + return $this->solved; + } + + /** + * API function + */ + function get_attempt_count() + { + return $this->attempts; + } + + /** + * API function + */ + function reset() + { + global $db, $user; + + $sql = 'DELETE FROM ' . $this->table_qa_confirm . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . (int) $this->type; + $db->sql_query($sql); + + // we leave the class usable by generating a new question + $this->select_question(); + } + + /** + * API function + */ + function is_solved() + { + global $request; + + if ($request->variable('qa_answer', false) && $this->solved === 0) + { + $this->validate(); + } + + return (bool) $this->solved; + } + + /** + * API function - The ACP backend, this marks the end of the easy methods + */ + function acp_page($id, &$module) + { + global $config, $request, $phpbb_log, $template, $user; + + $user->add_lang('acp/board'); + $user->add_lang('captcha_qa'); + + if (!self::is_installed()) + { + $this->install(); + } + + $module->tpl_name = 'captcha_qa_acp'; + $module->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = $request->variable('submit', false); + $question_id = $request->variable('question_id', 0); + $action = $request->variable('action', ''); + + // we have two pages, so users might want to navigate from one to the other + $list_url = $module->u_action . "&configure=1&select_captcha=" . $this->get_service_name(); + + $template->assign_vars(array( + 'U_ACTION' => $module->u_action, + 'QUESTION_ID' => $question_id , + 'CLASS' => $this->get_service_name(), + )); + + // show the list? + if (!$question_id && $action != 'add') + { + $this->acp_question_list($module); + } + else if ($question_id && $action == 'delete') + { + if ($this->get_service_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id)) + { + if (confirm_box(true)) + { + $this->acp_delete_question($question_id); + + trigger_error($user->lang['QUESTION_DELETED'] . adm_back_link($list_url)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'question_id' => $question_id, + 'action' => $action, + 'configure' => 1, + 'select_captcha' => $this->get_service_name(), + )) + ); + } + } + else + { + trigger_error($user->lang['QA_LAST_QUESTION'] . adm_back_link($list_url), E_USER_WARNING); + } + } + else + { + // okay, show the editor + $question_input = $this->acp_get_question_input(); + $langs = $this->get_languages(); + + foreach ($langs as $lang => $entry) + { + $template->assign_block_vars('langs', array( + 'ISO' => $lang, + 'NAME' => $entry['name'], + )); + } + + $template->assign_vars(array( + 'U_LIST' => $list_url, + )); + + if ($question_id) + { + if ($question = $this->acp_get_question_data($question_id)) + { + $template->assign_vars(array( + 'QUESTION_TEXT' => ($question_input['question_text']) ? $question_input['question_text'] : $question['question_text'], + 'LANG_ISO' => ($question_input['lang_iso']) ? $question_input['lang_iso'] : $question['lang_iso'], + 'STRICT' => (isset($_REQUEST['strict'])) ? $question_input['strict'] : $question['strict'], + 'ANSWERS' => implode("\n", $question['answers']), + )); + } + else + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url)); + } + } + else + { + $template->assign_vars(array( + 'QUESTION_TEXT' => $question_input['question_text'], + 'LANG_ISO' => $question_input['lang_iso'], + 'STRICT' => $question_input['strict'], + 'ANSWERS' => (is_array($question_input['answers'])) ? implode("\n", $question_input['answers']) : '', + )); + } + + if ($submit && check_form_key($form_key)) + { + if (!$this->validate_input($question_input)) + { + $template->assign_vars(array( + 'S_ERROR' => true, + )); + } + else + { + if ($question_id) + { + $this->acp_update_question($question_input, $question_id); + } + else + { + $this->acp_add_question($question_input); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL'); + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($list_url)); + } + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url), E_USER_WARNING); + } + } + } + + /** + * This handles the list overview + */ + function acp_question_list(&$module) + { + global $db, $template; + + $sql = 'SELECT * + FROM ' . $this->table_captcha_questions; + $result = $db->sql_query($sql); + + $template->assign_vars(array( + 'S_LIST' => true, + )); + + while ($row = $db->sql_fetchrow($result)) + { + $url = $module->u_action . "&question_id={$row['question_id']}&configure=1&select_captcha=" . $this->get_service_name() . '&'; + + $template->assign_block_vars('questions', array( + 'QUESTION_TEXT' => $row['question_text'], + 'QUESTION_ID' => $row['question_id'], + 'QUESTION_LANG' => $row['lang_iso'], + 'U_DELETE' => "{$url}action=delete", + 'U_EDIT' => "{$url}action=edit", + )); + } + $db->sql_freeresult($result); + } + + /** + * Grab a question and bring it into a format the editor understands + */ + function acp_get_question_data($question_id) + { + global $db; + + if ($question_id) + { + $sql = 'SELECT * + FROM ' . $this->table_captcha_questions . ' + WHERE question_id = ' . $question_id; + $result = $db->sql_query($sql); + $question = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$question) + { + return false; + } + + $question['answers'] = array(); + + $sql = 'SELECT * + FROM ' . $this->table_captcha_answers . ' + WHERE question_id = ' . $question_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $question['answers'][] = $row['answer_text']; + } + $db->sql_freeresult($result); + + return $question; + } + + return false; + } + + /** + * Grab a question from input and bring it into a format the editor understands + */ + function acp_get_question_input() + { + global $request; + + $answers = $request->variable('answers', '', true); + + // Convert answers into array and filter if answers are set + if (strlen($answers)) + { + $answers = array_filter(array_map('trim', explode("\n", $answers)), function ($value) { + return $value !== ''; + }); + } + + $question = array( + 'question_text' => $request->variable('question_text', '', true), + 'strict' => $request->variable('strict', false), + 'lang_iso' => $request->variable('lang_iso', ''), + 'answers' => $answers, + ); + return $question; + } + + /** + * Update a question. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_update_question($data, $question_id) + { + global $db, $cache; + + // easier to delete all answers than to figure out which to update + $sql = 'DELETE FROM ' . $this->table_captcha_answers . " WHERE question_id = $question_id"; + $db->sql_query($sql); + + $langs = $this->get_languages(); + $question_ary = $data; + $question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id']; + unset($question_ary['answers']); + + $sql = 'UPDATE ' . $this->table_captcha_questions . ' + SET ' . $db->sql_build_array('UPDATE', $question_ary) . " + WHERE question_id = $question_id"; + $db->sql_query($sql); + + $this->acp_insert_answers($data, $question_id); + + $cache->destroy('sql', $this->table_captcha_questions); + } + + /** + * Insert a question. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_add_question($data) + { + global $db, $cache; + + $langs = $this->get_languages(); + $question_ary = $data; + + $question_ary['lang_id'] = $langs[$data['lang_iso']]['id']; + unset($question_ary['answers']); + + $sql = 'INSERT INTO ' . $this->table_captcha_questions . ' ' . $db->sql_build_array('INSERT', $question_ary); + $db->sql_query($sql); + + $question_id = $db->sql_nextid(); + + $this->acp_insert_answers($data, $question_id); + + $cache->destroy('sql', $this->table_captcha_questions); + } + + /** + * Insert the answers. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_insert_answers($data, $question_id) + { + global $db, $cache; + + foreach ($data['answers'] as $answer) + { + $answer_ary = array( + 'question_id' => $question_id, + 'answer_text' => $answer, + ); + + $sql = 'INSERT INTO ' . $this->table_captcha_answers . ' ' . $db->sql_build_array('INSERT', $answer_ary); + $db->sql_query($sql); + } + + $cache->destroy('sql', $this->table_captcha_answers); + } + + /** + * Delete a question. + */ + function acp_delete_question($question_id) + { + global $db, $cache; + + $tables = array($this->table_captcha_questions, $this->table_captcha_answers); + + foreach ($tables as $table) + { + $sql = "DELETE FROM $table + WHERE question_id = $question_id"; + $db->sql_query($sql); + } + + $cache->destroy('sql', $tables); + } + + /** + * Check if the entered data can be inserted/used + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function validate_input($question_data) + { + $langs = $this->get_languages(); + + if (!isset($question_data['lang_iso']) || + !isset($question_data['question_text']) || + !isset($question_data['strict']) || + !isset($question_data['answers'])) + { + return false; + } + + if (!isset($langs[$question_data['lang_iso']]) || + !strlen($question_data['question_text']) || + !sizeof($question_data['answers']) || + !is_array($question_data['answers'])) + { + return false; + } + + return true; + } + + /** + * List the installed language packs + */ + function get_languages() + { + global $db; + + $sql = 'SELECT * + FROM ' . LANG_TABLE; + $result = $db->sql_query($sql); + + $langs = array(); + while ($row = $db->sql_fetchrow($result)) + { + $langs[$row['lang_iso']] = array( + 'name' => $row['lang_local_name'], + 'id' => (int) $row['lang_id'], + ); + } + $db->sql_freeresult($result); + + return $langs; + } + + + + /** + * See if there is a question other than the one we have + */ + function acp_is_last($question_id) + { + global $config, $db; + + if ($question_id) + { + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "' + AND question_id <> " . (int) $question_id; + $result = $db->sql_query_limit($sql, 1); + $question = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$question) + { + return true; + } + return false; + } + } +} diff --git a/phpBB/phpbb/captcha/plugins/recaptcha.php b/phpBB/phpbb/captcha/plugins/recaptcha.php new file mode 100644 index 0000000000..152709a9ea --- /dev/null +++ b/phpBB/phpbb/captcha/plugins/recaptcha.php @@ -0,0 +1,225 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +class recaptcha extends captcha_abstract +{ + var $recaptcha_server = 'http://www.google.com/recaptcha/api'; + var $recaptcha_server_secure = 'https://www.google.com/recaptcha/api'; // class constants :( + + var $response; + + /** + * Constructor + */ + public function __construct() + { + global $request; + $this->recaptcha_server = $request->is_secure() ? $this->recaptcha_server_secure : $this->recaptcha_server; + } + + function init($type) + { + global $user, $request; + + $user->add_lang('captcha_recaptcha'); + parent::init($type); + $this->response = $request->variable('g-recaptcha-response', ''); + } + + public function is_available() + { + global $config, $user; + $user->add_lang('captcha_recaptcha'); + return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey'])); + } + + /** + * API function + */ + function has_config() + { + return true; + } + + static public function get_name() + { + return 'CAPTCHA_RECAPTCHA'; + } + + /** + * This function is implemented because required by the upper class, but is never used for reCaptcha. + */ + function get_generator_class() + { + throw new \Exception('No generator class given.'); + } + + function acp_page($id, &$module) + { + global $config, $template, $user, $phpbb_log, $request; + + $captcha_vars = array( + 'recaptcha_pubkey' => 'RECAPTCHA_PUBKEY', + 'recaptcha_privkey' => 'RECAPTCHA_PRIVKEY', + ); + + $module->tpl_name = 'captcha_recaptcha_acp'; + $module->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = $request->variable('submit', ''); + + if ($submit && check_form_key($form_key)) + { + $captcha_vars = array_keys($captcha_vars); + foreach ($captcha_vars as $captcha_var) + { + $value = $request->variable($captcha_var, ''); + if ($value) + { + $config->set($captcha_var, $value); + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL'); + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action)); + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($module->u_action)); + } + else + { + foreach ($captcha_vars as $captcha_var => $template_var) + { + $var = (isset($_REQUEST[$captcha_var])) ? $request->variable($captcha_var, '') : ((isset($config[$captcha_var])) ? $config[$captcha_var] : ''); + $template->assign_var($template_var, $var); + } + + $template->assign_vars(array( + 'CAPTCHA_PREVIEW' => $this->get_demo_template($id), + 'CAPTCHA_NAME' => $this->get_service_name(), + 'U_ACTION' => $module->u_action, + )); + + } + } + + // not needed + function execute_demo() + { + } + + // not needed + function execute() + { + } + + function get_template() + { + global $config, $user, $template, $phpbb_root_path, $phpEx; + + if ($this->is_solved()) + { + return false; + } + else + { + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); + $explain = $user->lang(($this->type != CONFIRM_POST) ? 'CONFIRM_EXPLAIN' : 'POST_CONFIRM_EXPLAIN', '<a href="' . $contact_link . '">', '</a>'); + + $template->assign_vars(array( + 'RECAPTCHA_SERVER' => $this->recaptcha_server, + 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '', + 'S_RECAPTCHA_AVAILABLE' => self::is_available(), + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + 'L_CONFIRM_EXPLAIN' => $explain, + )); + + return 'captcha_recaptcha.html'; + } + } + + function get_demo_template($id) + { + return $this->get_template(); + } + + function get_hidden_fields() + { + $hidden_fields = array(); + + // this is required for posting.php - otherwise we would forget about the captcha being already solved + if ($this->solved) + { + $hidden_fields['confirm_code'] = $this->code; + } + $hidden_fields['confirm_id'] = $this->confirm_id; + return $hidden_fields; + } + + function uninstall() + { + $this->garbage_collect(0); + } + + function install() + { + return; + } + + function validate() + { + if (!parent::validate()) + { + return false; + } + else + { + return $this->recaptcha_check_answer(); + } + } + + /** + * Calls an HTTP POST function to verify if the user's guess was correct + * + * @return bool|string Returns false on success or error string on failure. + */ + function recaptcha_check_answer() + { + global $config, $user; + + //discard spam submissions + if ($this->response == null || strlen($this->response) == 0) + { + return $user->lang['RECAPTCHA_INCORRECT']; + } + + $recaptcha = new \ReCaptcha\ReCaptcha($config['recaptcha_privkey']); + $result = $recaptcha->verify($this->response, $user->ip); + + if ($result->isSuccess()) + { + $this->solved = true; + return false; + } + else + { + return $user->lang['RECAPTCHA_INCORRECT']; + } + } +} diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php index 37b62fff24..cfdcc2af0b 100644 --- a/phpBB/phpbb/class_loader.php +++ b/phpBB/phpbb/class_loader.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,8 +23,6 @@ namespace phpbb; * * If every part of the class name is a directory, the last directory name is * also used as the filename, e.g. phpbb_dir would resolve to dir/dir.php. -* -* @package phpBB3 */ class class_loader { @@ -142,7 +144,13 @@ class class_loader */ public function load_class($class) { - $class = '\\' . $class; + // In general $class is not supposed to contain a leading backslash, + // but sometimes it does. See tickets PHP-50731 and HHVM-1840. + if ($class[0] !== '\\') + { + $class = '\\' . $class; + } + if (substr($class, 0, strlen($this->namespace)) === $this->namespace) { $path = $this->resolve_path($class); diff --git a/phpBB/phpbb/composer.json b/phpBB/phpbb/composer.json new file mode 100644 index 0000000000..758125234f --- /dev/null +++ b/phpBB/phpbb/composer.json @@ -0,0 +1,32 @@ +{ + "name": "phpbb/phpbb-core", + "description": "Collection of core phpBB libraries", + "type": "library", + "keywords": ["phpbb", "forum"], + "homepage": "https://www.phpbb.com", + "license": "GPL-2.0", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "support": { + "issues": "https://tracker.phpbb.com", + "forum": "https://www.phpbb.com/community/", + "wiki": "https://wiki.phpbb.com", + "irc": "irc://irc.freenode.org/phpbb" + }, + "autoload": { + "classmap": [""] + }, + "require": { + "php": ">=5.4" + }, + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + } +} diff --git a/phpBB/phpbb/config/config.php b/phpBB/phpbb/config/config.php index d37922acf1..aaad333006 100644 --- a/phpBB/phpbb/config/config.php +++ b/phpBB/phpbb/config/config.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\config; /** * Configuration container class -* @package phpBB3 */ class config implements \ArrayAccess, \IteratorAggregate, \Countable { @@ -34,7 +37,7 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable /** * Retrieves an ArrayIterator over the configuration values. * - * @return ArrayIterator An iterator over all config data + * @return \ArrayIterator An iterator over all config data */ public function getIterator() { diff --git a/phpBB/phpbb/config/db.php b/phpBB/phpbb/config/db.php index c1a3630a14..26489bdd34 100644 --- a/phpBB/phpbb/config/db.php +++ b/phpBB/phpbb/config/db.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\config; /** * Configuration container class -* @package phpBB3 */ class db extends \phpbb\config\config { @@ -23,7 +26,7 @@ class db extends \phpbb\config\config /** * Database connection - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -36,11 +39,11 @@ class db extends \phpbb\config\config /** * Creates a configuration container with a default set of values * - * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\cache\driver\driver_interface $cache Cache instance * @param string $table Configuration table name */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $table) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, $table) { $this->db = $db; $this->cache = $cache; @@ -142,9 +145,9 @@ class db extends \phpbb\config\config $sql .= " AND config_value = '" . $this->db->sql_escape($old_value) . "'"; } - $result = $this->db->sql_query($sql); + $this->db->sql_query($sql); - if (!$this->db->sql_affectedrows($result) && isset($this->config[$key])) + if (!$this->db->sql_affectedrows() && isset($this->config[$key])) { return false; } diff --git a/phpBB/phpbb/config/db_text.php b/phpBB/phpbb/config/db_text.php index b1ea112b53..818f6bdcc9 100644 --- a/phpBB/phpbb/config/db_text.php +++ b/phpBB/phpbb/config/db_text.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,14 +17,12 @@ namespace phpbb\config; * Manages configuration options with an arbitrary length value stored in a TEXT * column. In constrast to class \phpbb\config\db, values are never cached and * prefetched, but every get operation sends a query to the database. -* -* @package phpBB3 */ class db_text { /** * Database connection - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -31,10 +33,10 @@ class db_text protected $table; /** - * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\db\driver\driver_interface $db Database connection * @param string $table Table name */ - public function __construct(\phpbb\db\driver\driver $db, $table) + public function __construct(\phpbb\db\driver\driver_interface $db, $table) { $this->db = $db; $this->table = $this->db->sql_escape($table); @@ -98,13 +100,13 @@ class db_text $sql = 'UPDATE ' . $this->table . " SET config_value = '" . $this->db->sql_escape($value) . "' WHERE config_name = '" . $this->db->sql_escape($key) . "'"; - $result = $this->db->sql_query($sql); + $this->db->sql_query($sql); - if (!$this->db->sql_affectedrows($result)) + if (!$this->db->sql_affectedrows()) { $sql = 'INSERT INTO ' . $this->table . ' ' . $this->db->sql_build_array('INSERT', array( - 'config_name' => $key, - 'config_value' => $value, + 'config_name' => (string) $key, + 'config_value' => (string) $value, )); $this->db->sql_query($sql); } @@ -152,6 +154,6 @@ class db_text $sql = 'DELETE FROM ' . $this->table . ' WHERE ' . $this->db->sql_in_set('config_name', $keys, false, true); - $result = $this->db->sql_query($sql); + $this->db->sql_query($sql); } } diff --git a/phpBB/phpbb/config_php_file.php b/phpBB/phpbb/config_php_file.php new file mode 100644 index 0000000000..7445e7df22 --- /dev/null +++ b/phpBB/phpbb/config_php_file.php @@ -0,0 +1,160 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +class config_php_file +{ + /** @var string phpBB Root Path */ + protected $phpbb_root_path; + + /** @var string php file extension */ + protected $php_ext; + + /** + * Indicates whether the php config file has been loaded. + * + * @var bool + */ + protected $config_loaded = false; + + /** + * The content of the php config file + * + * @var array + */ + protected $config_data = array(); + + /** + * The path to the config file. (Default: $phpbb_root_path . 'config.' . $php_ext) + * + * @var string + */ + protected $config_file; + + private $defined_vars; + + /** + * Constructor + * + * @param string $phpbb_root_path phpBB Root Path + * @param string $php_ext php file extension + */ + function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->config_file = $this->phpbb_root_path . 'config.' . $this->php_ext; + } + + /** + * Set the path to the config file. + * + * @param string $config_file + */ + public function set_config_file($config_file) + { + $this->config_file = $config_file; + $this->config_loaded = false; + } + + /** + * Returns an associative array containing the variables defined by the config file. + * + * @return array Return the content of the config file or an empty array if the file does not exists. + */ + public function get_all() + { + $this->load_config_file(); + + return $this->config_data; + } + + /** + * Return the value of a variable defined into the config.php file or null if the variable does not exist. + * + * @param string $variable The name of the variable + * @return mixed Value of the variable or null if the variable is not defined. + */ + public function get($variable) + { + $this->load_config_file(); + + return isset($this->config_data[$variable]) ? $this->config_data[$variable] : null; + } + + /** + * Load the config file and store the information. + * + * @return null + */ + protected function load_config_file() + { + if (!$this->config_loaded && file_exists($this->config_file)) + { + $this->defined_vars = get_defined_vars(); + + require($this->config_file); + $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars); + + $this->config_loaded = true; + } + } + + /** + * Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name. + * + * If $dbms is a valid 3.1 db driver class name, returns it unchanged. + * Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms + * to 3.1 db driver class name. + * + * @param string $dbms dbms parameter + * @return string driver class + * @throws \RuntimeException + */ + public function convert_30_dbms_to_31($dbms) + { + // Note: this check is done first because mysqli extension + // supplies a mysqli class, and class_exists($dbms) would return + // true for mysqli class. + // However, per the docblock any valid 3.1 driver name should be + // recognized by this function, and have priority over 3.0 dbms. + if (strpos($dbms, 'phpbb\db\driver') === false && class_exists('phpbb\db\driver\\' . $dbms)) + { + return 'phpbb\db\driver\\' . $dbms; + } + + if (class_exists($dbms)) + { + // Additionally we could check that $dbms extends phpbb\db\driver\driver. + // http://php.net/manual/en/class.reflectionclass.php + // Beware of possible performance issues: + // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance + // We could check for interface implementation in all paths or + // only when we do not prepend phpbb\db\driver\. + + /* + $reflection = new \ReflectionClass($dbms); + + if ($reflection->isSubclassOf('phpbb\db\driver\driver')) + { + return $dbms; + } + */ + + return $dbms; + } + + throw new \RuntimeException("You have specified an invalid dbms driver: $dbms"); + } +} diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index fdcd9d42f6..dc9b8016b2 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -1,23 +1,153 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console; -use Symfony\Component\DependencyInjection\TaggedContainerInterface; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Shell; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; class application extends \Symfony\Component\Console\Application { - function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command') + /** + * @var bool Indicates whether or not we are in a shell + */ + protected $in_shell = false; + + /** + * @var \phpbb\language\language User object + */ + protected $language; + + /** + * @param string $name The name of the application + * @param string $version The version of the application + * @param \phpbb\language\language $language The user which runs the application (used for translation) + */ + public function __construct($name, $version, \phpbb\language\language $language) + { + $this->language = $language; + + parent::__construct($name, $version); + } + + /** + * {@inheritdoc} + */ + protected function getDefaultInputDefinition() + { + $input_definition = parent::getDefaultInputDefinition(); + + $this->register_global_options($input_definition); + + return $input_definition; + } + + /** + * Gets the help message. + * + * It's a hack of the default help message to display the --shell + * option only for the application and not for all the commands. + * + * @return string A help message. + */ + public function getHelp() { - foreach($container->findTaggedServiceIds($tag) as $id => $void) + // If we are already in a shell + // we do not want to have the --shell option available + if ($this->in_shell) + { + return parent::getHelp(); + } + + try + { + $definition = $this->getDefinition(); + $definition->addOption(new InputOption( + '--shell', + '-s', + InputOption::VALUE_NONE, + $this->language->lang('CLI_DESCRIPTION_OPTION_SHELL') + )); + } + catch (\LogicException $e) + { + // Do nothing + } + + return parent::getHelp(); + } + + /** + * Register a set of commands from the container + * + * @param \phpbb\di\service_collection $command_collection The console service collection + */ + public function register_container_commands(\phpbb\di\service_collection $command_collection) + { + foreach ($command_collection as $service_command) + { + $this->add($service_command); + } + } + + /** + * {@inheritdoc} + */ + public function doRun(InputInterface $input, OutputInterface $output) + { + // Run a shell if the --shell (or -s) option is set and if no command name is specified + // Also, we do not want to have the --shell option available if we are already in a shell + if (!$this->in_shell && $this->getCommandName($input) === null && $input->hasParameterOption(array('--shell', '-s'))) + { + $shell = new Shell($this); + $this->in_shell = true; + $shell->run(); + + return 0; + } + + return parent::doRun($input, $output); + } + + /** + * Register global options + * + * @param InputDefinition $definition An InputDefinition instance + */ + protected function register_global_options(InputDefinition $definition) + { + try + { + $definition->addOption(new InputOption( + 'safe-mode', + null, + InputOption::VALUE_NONE, + $this->language->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') + )); + + $definition->addOption(new InputOption( + 'env', + 'e', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_OPTION_ENV') + )); + } + catch (\LogicException $e) { - $this->add($container->get($id)); + // Do nothing } } } diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php new file mode 100644 index 0000000000..d0c2ef6f72 --- /dev/null +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -0,0 +1,89 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\cache; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class purge extends \phpbb\console\command\command +{ + /** @var \phpbb\cache\driver\driver_interface */ + protected $cache; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var \phpbb\log\log_interface */ + protected $log; + + /** @var \phpbb\config\config */ + protected $config; + + /** + * Constructor + * + * @param \phpbb\user $user User instance + * @param \phpbb\cache\driver\driver_interface $cache Cache instance + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param \phpbb\auth\auth $auth Auth instance + * @param \phpbb\log\log $log Logger instance + * @param \phpbb\config\config $config Config instance + */ + public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\config\config $config) + { + $this->cache = $cache; + $this->db = $db; + $this->auth = $auth; + $this->log = $log; + $this->config = $config; + parent::__construct($user); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('cache:purge') + ->setDescription($this->user->lang('PURGE_CACHE')) + ; + } + + /** + * Executes the command cache:purge. + * + * Purge the cache (including permissions) and increment the asset_version number + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->config->increment('assets_version', 1); + $this->cache->purge(); + + // Clear permissions + $this->auth->acl_clear_prefetch(); + phpbb_cache_moderators($this->db, $this->cache, $this->auth); + + $this->log->add('admin', ANONYMOUS, '', 'LOG_PURGE_CACHE', time(), array()); + + $output->writeln($this->user->lang('PURGE_CACHE_SUCCESS')); + } +} diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php index 6abbdd203c..638c989da2 100644 --- a/phpBB/phpbb/console/command/command.php +++ b/phpBB/phpbb/console/command/command.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,4 +15,17 @@ namespace phpbb\console\command; abstract class command extends \Symfony\Component\Console\Command\Command { + /** @var \phpbb\user */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\user $user User instance (mostly for translation) + */ + public function __construct(\phpbb\user $user) + { + $this->user = $user; + parent::__construct(); + } } diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php index b105bc826d..f0ad5d4d19 100644 --- a/phpBB/phpbb/console/command/config/command.php +++ b/phpBB/phpbb/console/command/config/command.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; @@ -13,10 +17,10 @@ abstract class command extends \phpbb\console\command\command /** @var \phpbb\config\config */ protected $config; - function __construct(\phpbb\config\config $config) + function __construct(\phpbb\user $user, \phpbb\config\config $config) { $this->config = $config; - parent::__construct(); + parent::__construct($user); } } diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 9a2d00561d..efd276d7e3 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -1,33 +1,50 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class delete extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this ->setName('config:delete') - ->setDescription('Deletes a configuration option') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ; } + /** + * Executes the command config:delete. + * + * Removes a configuration option + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::delete() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); @@ -36,11 +53,11 @@ class delete extends command { $this->config->delete($key); - $output->writeln("<info>Successfully deleted config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key) . '</info>'); } else { - $output->writeln("<error>Config $key does not exist</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>'); } } } diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 275c82b53f..9c03b49a3d 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; @@ -15,25 +19,39 @@ use Symfony\Component\Console\Output\OutputInterface; class get extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this ->setName('config:get') - ->setDescription("Gets a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addOption( 'no-newline', null, InputOption::VALUE_NONE, - 'Set this option if the value should be printed without a new line at the end.' + $this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE') ) ; } + /** + * Executes the command config:get. + * + * Retrieves a configuration value. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::offsetGet() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); @@ -42,13 +60,13 @@ class get extends command { $output->write($this->config[$key]); } - elseif (isset($this->config[$key])) + else if (isset($this->config[$key])) { $output->writeln($this->config[$key]); } else { - $output->writeln("<error>Could not get config $key</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>'); } } } diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index bc6b63c6ff..b4d7438b66 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; @@ -15,30 +19,44 @@ use Symfony\Component\Console\Output\OutputInterface; class increment extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this ->setName('config:increment') - ->setDescription("Increments a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'increment', InputArgument::REQUIRED, - 'Amount to increment by' + $this->user->lang('CLI_CONFIG_INCREMENT_BY') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } + /** + * Executes the command config:increment. + * + * Increments an integer configuration value. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::increment() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); @@ -47,6 +65,6 @@ class increment extends command $this->config->increment($key, $increment, $use_cache); - $output->writeln("<info>Successfully incremented config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . '</info>'); } } diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 9d471a96ad..695de31013 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; @@ -15,30 +19,44 @@ use Symfony\Component\Console\Output\OutputInterface; class set extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this ->setName('config:set') - ->setDescription("Sets a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'value', InputArgument::REQUIRED, - 'New configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_NEW') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } + /** + * Executes the command config:set. + * + * Sets a configuration option's value. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::set() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); @@ -47,6 +65,6 @@ class set extends command $this->config->set($key, $value, $use_cache); - $output->writeln("<info>Successfully set config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>'); } } diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 03e7a60210..e8c69a0885 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; @@ -15,35 +19,50 @@ use Symfony\Component\Console\Output\OutputInterface; class set_atomic extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this ->setName('config:set-atomic') - ->setDescription("Sets a configuration option's value only if the old matches the current value.") + ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'old', InputArgument::REQUIRED, - 'Current configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_CURRENT') ) ->addArgument( 'new', InputArgument::REQUIRED, - 'New configuration value, use 0 and 1 to specify boolean values' + $this->user->lang('CLI_CONFIG_NEW') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } + /** + * Executes the command config:set-atomic. + * + * Sets a configuration option's value only if the old_value matches the + * current configuration value or the configuration value does not exist yet. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return bool True if the value was changed, false otherwise. + * @see \phpbb\config\config::set_atomic() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); @@ -53,12 +72,12 @@ class set_atomic extends command if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) { - $output->writeln("<info>Successfully set config $key</info>"); + $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>'); return 0; } else { - $output->writeln("<error>Could not set config $key</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . '</error>'); return 1; } } diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php new file mode 100644 index 0000000000..c515fd9e80 --- /dev/null +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -0,0 +1,111 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\cron; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class cron_list extends \phpbb\console\command\command +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** + * Constructor + * + * @param \phpbb\user $user User instance + * @param \phpbb\cron\manager $cron_manager Cron manager + */ + public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager) + { + $this->cron_manager = $cron_manager; + parent::__construct($user); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('cron:list') + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST')) + ; + } + + /** + * Executes the command cron:list. + * + * Prints a list of ready and unready cron jobs. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $tasks = $this->cron_manager->get_tasks(); + + if (empty($tasks)) + { + $output->writeln($this->user->lang('CRON_NO_TASKS')); + return; + } + + $ready_tasks = array(); + $not_ready_tasks = array(); + foreach ($tasks as $task) + { + if ($task->is_ready()) + { + $ready_tasks[] = $task; + } + else + { + $not_ready_tasks[] = $task; + } + } + + if (!empty($ready_tasks)) + { + $output->writeln('<info>' . $this->user->lang('TASKS_READY') . '</info>'); + $this->print_tasks_names($ready_tasks, $output); + } + + if (!empty($ready_tasks) && !empty($not_ready_tasks)) + { + $output->writeln(''); + } + + if (!empty($not_ready_tasks)) + { + $output->writeln('<info>' . $this->user->lang('TASKS_NOT_READY') . '</info>'); + $this->print_tasks_names($not_ready_tasks, $output); + } + } + + /** + * Print a list of cron jobs + * + * @param array $tasks A list of task to display + * @param OutputInterface $output An OutputInterface instance + */ + protected function print_tasks_names(array $tasks, OutputInterface $output) + { + foreach ($tasks as $task) + { + $output->writeln($task->get_name()); + } + } +} diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php new file mode 100644 index 0000000000..dea6493007 --- /dev/null +++ b/phpBB/phpbb/console/command/cron/run.php @@ -0,0 +1,171 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\cron; + +use phpbb\exception\runtime_exception; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Output\OutputInterface; + +class run extends \phpbb\console\command\command +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\lock\db */ + protected $lock_db; + + /** + * Construct method + * + * @param \phpbb\user $user The user object (used to get language information) + * @param \phpbb\cron\manager $cron_manager The cron manager containing + * the cron tasks to be executed. + * @param \phpbb\lock\db $lock_db The lock for accessing database. + */ + public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db) + { + $this->cron_manager = $cron_manager; + $this->lock_db = $lock_db; + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('cron:run') + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_RUN')) + ->setHelp($this->user->lang('CLI_HELP_CRON_RUN')) + ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1')) + ; + } + + /** + * Executes the command cron:run. + * + * Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks. + * If the cron lock can not be obtained, an error message is printed + * and the exit status is set to 1. + * If the verbose option is specified, each start of a task is printed. + * Otherwise there is no output. + * If an argument is given to the command, only the task whose name matches the + * argument will be started. If verbose option is specified, + * an info message containing the name of the task is printed. + * If no task matches the argument given, an error message is printed + * and the exit status is set to 2. + * + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a lock error occured and 2 if no task matching the argument was found. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->lock_db->acquire()) + { + $task_name = $input->getArgument('name'); + if ($task_name) + { + $exit_status = $this->run_one($input, $output, $task_name); + } + else + { + $exit_status = $this->run_all($input, $output); + } + + $this->lock_db->release(); + return $exit_status; + } + else + { + throw new runtime_exception('CRON_LOCK_ERROR', array(), null, 1); + } + } + + /** + * Executes all ready cron tasks. + * + * If verbose mode is set, an info message will be printed if there is no task to + * be run, or else for each starting task. + * + * @see execute + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 + */ + protected function run_all(InputInterface $input, OutputInterface $output) + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); + + if ($run_tasks) + { + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln('<info>' . $this->user->lang('RUNNING_TASK', $task->get_name()) . '</info>'); + } + + $task->run(); + } + } + else + { + if ($input->getOption('verbose')) + { + $output->writeln('<info>' . $this->user->lang('CRON_NO_TASK') . '</info>'); + } + } + + return 0; + } + + /** + * Executes a given cron task, if it is ready. + * + * If there is a task whose name matches $task_name, it is run and 0 is returned. + * and if verbose mode is set, print an info message with the name of the task. + * If there is no task matching $task_name, the function prints an error message + * and returns with status 2. + * + * @see execute + * @param string $task_name The name of the task that should be run. + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 if all is well, 2 if no task matches $task_name. + */ + protected function run_one(InputInterface $input, OutputInterface $output, $task_name) + { + $task = $this->cron_manager->find_task($task_name); + if ($task) + { + if ($input->getOption('verbose')) + { + $output->writeln('<info>' . $this->user->lang('RUNNING_TASK', $task_name) . '</info>'); + } + + $task->run(); + return 0; + } + else + { + throw new runtime_exception('CRON_NO_SUCH_TASK', array( $task_name), null, 2); + } + } +} diff --git a/phpBB/phpbb/console/command/db/console_migrator_output_handler.php b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php new file mode 100644 index 0000000000..568b2646d4 --- /dev/null +++ b/phpBB/phpbb/console/command/db/console_migrator_output_handler.php @@ -0,0 +1,69 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\db; + +use phpbb\db\output_handler\migrator_output_handler_interface; +use phpbb\user; +use Symfony\Component\Console\Output\OutputInterface; + +class console_migrator_output_handler implements migrator_output_handler_interface +{ + /** + * User object. + * + * @var user + */ + private $user; + + /** + * Console output object. + * + * @var OutputInterface + */ + private $output; + + /** + * Constructor + * + * @param user $user User object + * @param OutputInterface $output Console output object + */ + public function __construct(user $user, OutputInterface $output) + { + $this->user = $user; + $this->output = $output; + } + + /** + * {@inheritdoc} + */ + public function write($message, $verbosity) + { + if ($verbosity <= $this->output->getVerbosity()) + { + $translated_message = call_user_func_array(array($this->user, 'lang'), $message); + + if ($verbosity === migrator_output_handler_interface::VERBOSITY_NORMAL) + { + $translated_message = '<info>' . $translated_message . '</info>'; + } + else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERBOSE) + { + $translated_message = '<comment>' . $translated_message . '</comment>'; + } + + $this->output->writeln($translated_message); + } + } +} diff --git a/phpBB/phpbb/console/command/db/list_command.php b/phpBB/phpbb/console/command/db/list_command.php new file mode 100644 index 0000000000..708107b592 --- /dev/null +++ b/phpBB/phpbb/console/command/db/list_command.php @@ -0,0 +1,73 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\db; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +class list_command extends \phpbb\console\command\db\migration_command +{ + protected function configure() + { + $this + ->setName('db:list') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_LIST')) + ->addOption( + 'available', + 'u', + InputOption::VALUE_NONE, + $this->user->lang('CLI_MIGRATIONS_ONLY_AVAILABLE') + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $show_installed = !$input->getOption('available'); + $installed = $available = array(); + + foreach ($this->load_migrations() as $name) + { + if ($this->migrator->migration_state($name) !== false) + { + $installed[] = $name; + } + else + { + $available[] = $name; + } + } + + if ($show_installed) + { + $output->writeln('<info>' . $this->user->lang('CLI_MIGRATIONS_INSTALLED') . $this->user->lang('COLON') . '</info>'); + $output->writeln($installed); + + if (empty($installed)) + { + $output->writeln($this->user->lang('CLI_MIGRATIONS_EMPTY')); + } + + $output->writeln(''); + } + + $output->writeln('<info>' . $this->user->lang('CLI_MIGRATIONS_AVAILABLE') . $this->user->lang('COLON') . '</info>'); + $output->writeln($available); + + if (empty($available)) + { + $output->writeln($this->user->lang('CLI_MIGRATIONS_EMPTY')); + } + } +} diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php new file mode 100644 index 0000000000..ae4211f7be --- /dev/null +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -0,0 +1,83 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\db; + +use phpbb\db\output_handler\log_wrapper_migrator_output_handler; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class migrate extends \phpbb\console\command\db\migration_command +{ + /** @var \phpbb\log\log */ + protected $log; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \phpbb\language\language */ + protected $language; + + function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) + { + $this->language = $language; + $this->log = $log; + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + parent::__construct($user, $migrator, $extension_manager, $config, $cache); + $this->user->add_lang(array('common', 'install', 'migrator')); + } + + protected function configure() + { + $this + ->setName('db:migrate') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE')) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem)); + + $this->migrator->create_migrations_table(); + + $this->cache->purge(); + + $this->load_migrations(); + $orig_version = $this->config['version']; + while (!$this->migrator->finished()) + { + try + { + $this->migrator->update(); + } + catch (\phpbb\db\migration\exception $e) + { + $output->writeln('<error>' . $e->getLocalisedMessage($this->user) . '</error>'); + $this->finalise_update(); + return 1; + } + } + + if ($orig_version != $this->config['version']) + { + $this->log->add('admin', ANONYMOUS, '', 'LOG_UPDATE_DATABASE', time(), array($orig_version, $this->config['version'])); + } + + $this->finalise_update(); + $output->writeln($this->user->lang['DATABASE_UPDATE_COMPLETE']); + } +} diff --git a/phpBB/phpbb/console/command/db/migration_command.php b/phpBB/phpbb/console/command/db/migration_command.php new file mode 100644 index 0000000000..d44ef8c5cb --- /dev/null +++ b/phpBB/phpbb/console/command/db/migration_command.php @@ -0,0 +1,56 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\db; + +abstract class migration_command extends \phpbb\console\command\command +{ + /** @var \phpbb\db\migrator */ + protected $migrator; + + /** @var \phpbb\extension\manager */ + protected $extension_manager; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\cache\service */ + protected $cache; + + function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache) + { + $this->migrator = $migrator; + $this->extension_manager = $extension_manager; + $this->config = $config; + $this->cache = $cache; + parent::__construct($user); + } + + protected function load_migrations() + { + $migrations = $this->extension_manager + ->get_finder() + ->core_path('phpbb/db/migration/data/') + ->extension_directory('/migrations') + ->get_classes(); + + $this->migrator->set_migrations($migrations); + + return $migrations; + } + + protected function finalise_update() + { + $this->cache->purge(); + $this->config->increment('assets_version', 1); + } +} diff --git a/phpBB/phpbb/console/command/db/revert.php b/phpBB/phpbb/console/command/db/revert.php new file mode 100644 index 0000000000..3fa2e17515 --- /dev/null +++ b/phpBB/phpbb/console/command/db/revert.php @@ -0,0 +1,88 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\db; + +use phpbb\db\output_handler\log_wrapper_migrator_output_handler; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class revert extends \phpbb\console\command\db\migration_command +{ + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \phpbb\language\language */ + protected $language; + + function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->language = $language; + $this->phpbb_root_path = $phpbb_root_path; + parent::__construct($user, $migrator, $extension_manager, $config, $cache); + $this->user->add_lang(array('common', 'migrator')); + } + + protected function configure() + { + $this + ->setName('db:revert') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_REVERT')) + ->addArgument( + 'name', + InputArgument::REQUIRED, + $this->user->lang('CLI_MIGRATION_NAME') + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $name = str_replace('/', '\\', $input->getArgument('name')); + + $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem)); + + $this->cache->purge(); + + if (!in_array($name, $this->load_migrations())) + { + $output->writeln('<error>' . $this->user->lang('MIGRATION_NOT_VALID', $name) . '</error>'); + return 1; + } + else if ($this->migrator->migration_state($name) === false) + { + $output->writeln('<error>' . $this->user->lang('MIGRATION_NOT_INSTALLED', $name) . '</error>'); + return 1; + } + + try + { + while ($this->migrator->migration_state($name) !== false) + { + $this->migrator->revert($name); + } + } + catch (\phpbb\db\migration\exception $e) + { + $output->writeln('<error>' . $e->getLocalisedMessage($this->user) . '</error>'); + $this->finalise_update(); + return 1; + } + + $this->finalise_update(); + } +} diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php new file mode 100644 index 0000000000..f9047bdac8 --- /dev/null +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -0,0 +1,64 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\dev; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class migration_tips extends \phpbb\console\command\command +{ + /** @var \phpbb\extension\manager */ + protected $extension_manager; + + function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager) + { + $this->extension_manager = $extension_manager; + parent::__construct($user); + } + + protected function configure() + { + $this + ->setName('dev:migration-tips') + ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS')) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $migrations = $this->extension_manager->get_finder() + ->set_extensions(array()) + ->core_path('phpbb/db/migration/data/') + ->get_classes(); + $tips = $migrations; + + foreach ($migrations as $migration_class) + { + foreach ($migration_class::depends_on() as $dependency) + { + $tips_key = array_search($dependency, $tips); + if ($tips_key !== false) + { + unset($tips[$tips_key]); + } + } + } + + $output->writeln("\t\tarray("); + foreach ($tips as $migration) + { + $output->writeln("\t\t\t'{$migration}',"); + } + $output->writeln("\t\t);"); + } +} diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php index edde7ce2e2..364d954082 100644 --- a/phpBB/phpbb/console/command/extension/command.php +++ b/phpBB/phpbb/console/command/extension/command.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; @@ -13,10 +17,14 @@ abstract class command extends \phpbb\console\command\command /** @var \phpbb\extension\manager */ protected $manager; - function __construct(\phpbb\extension\manager $manager) + /** @var \phpbb\log\log */ + protected $log; + + public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log) { $this->manager = $manager; + $this->log = $log; - parent::__construct(); + parent::__construct($user); } } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index e4de70ca34..1eee16cbd9 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; @@ -18,11 +22,11 @@ class disable extends command { $this ->setName('extension:disable') - ->setDescription('Disables the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -33,14 +37,15 @@ class disable extends command $this->manager->disable($name); $this->manager->load_extensions(); - if ($this->manager->enabled($name)) + if ($this->manager->is_enabled($name)) { - $output->writeln("<error>Could not disable extension $name</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name) . '</error>'); return 1; } else { - $output->writeln("<info>Successfully disabled extension $name</info>"); + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); + $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name) . '</info>'); return 0; } } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index ee7dae76aa..59ff11e9b7 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; @@ -18,11 +22,11 @@ class enable extends command { $this ->setName('extension:enable') - ->setDescription('Enables the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -33,14 +37,15 @@ class enable extends command $this->manager->enable($name); $this->manager->load_extensions(); - if ($this->manager->enabled($name)) + if ($this->manager->is_enabled($name)) { - $output->writeln("<info>Successfully enabled extension $name</info>"); + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); + $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>'); return 0; } else { - $output->writeln("<error>Could not enable extension $name</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>'); return 1; } } diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index c2e1d2928c..517e9a74c9 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; @@ -18,11 +22,11 @@ class purge extends command { $this ->setName('extension:purge') - ->setDescription('Purges the specified extension.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION')) ->addArgument( 'extension-name', InputArgument::REQUIRED, - 'Name of the extension' + $this->user->lang('CLI_EXTENSION_NAME') ) ; } @@ -33,14 +37,15 @@ class purge extends command $this->manager->purge($name); $this->manager->load_extensions(); - if ($this->manager->enabled($name)) + if ($this->manager->is_enabled($name)) { - $output->writeln("<error>Could not purge extension $name</error>"); + $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name) . '</error>'); return 1; } else { - $output->writeln("<info>Successfully purge extension $name</info>"); + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); + $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name) . '</info>'); return 0; } } diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 0f48ac2379..f9322034d7 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\extension; @@ -17,7 +21,7 @@ class show extends command { $this ->setName('extension:show') - ->setDescription('Lists all extensions in the database and on the filesystem.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS')) ; } @@ -28,27 +32,27 @@ class show extends command if (empty($all)) { - $output->writeln('<comment>No extensions were found.</comment>'); + $output->writeln('<comment>' . $this->user->lang('CLI_EXTENSION_NOT_FOUND') . '</comment>'); return 3; } $enabled = array_keys($this->manager->all_enabled()); - $this->print_extension_list($output, 'Enabled', $enabled); + $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_ENABLED') . $this->user->lang('COLON'), $enabled); $output->writeln(''); $disabled = array_keys($this->manager->all_disabled()); - $this->print_extension_list($output, 'Disabled', $disabled); + $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_DISABLED') . $this->user->lang('COLON'), $disabled); $output->writeln(''); $purged = array_diff($all, $enabled, $disabled); - $this->print_extension_list($output, 'Available', $purged); + $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_AVAILABLE') . $this->user->lang('COLON'), $purged); } protected function print_extension_list(OutputInterface $output, $type, array $extensions) { - $output->writeln("<info>$type:</info>"); + $output->writeln("<info>$type</info>"); foreach ($extensions as $extension) { diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index 04db880091..ec4e1b0ee7 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\fixup; @@ -13,21 +17,21 @@ use Symfony\Component\Console\Output\OutputInterface; class recalculate_email_hash extends \phpbb\console\command\command { - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; - function __construct(\phpbb\db\driver\driver $db) + function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db) { $this->db = $db; - parent::__construct(); + parent::__construct($user); } protected function configure() { $this ->setName('fixup:recalculate-email-hash') - ->setDescription('Recalculates the user_email_hash column of the users table.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH')) ; } @@ -66,6 +70,6 @@ class recalculate_email_hash extends \phpbb\console\command\command } $this->db->sql_freeresult($result); - $output->writeln('<info>Successfully recalculated all email hashes.</info>'); + $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>'); } } diff --git a/phpBB/phpbb/console/command/reparser/list_all.php b/phpBB/phpbb/console/command/reparser/list_all.php new file mode 100644 index 0000000000..e42c3ac782 --- /dev/null +++ b/phpBB/phpbb/console/command/reparser/list_all.php @@ -0,0 +1,69 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\reparser; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class list_all extends \phpbb\console\command\command +{ + /** + * @var string[] Names of the reparser services + */ + protected $reparser_names; + + /** + * Constructor + * + * @param \phpbb\user $user + * @param \phpbb\di\service_collection $reparsers + */ + public function __construct(\phpbb\user $user, \phpbb\di\service_collection $reparsers) + { + parent::__construct($user); + $this->reparser_names = array(); + foreach ($reparsers as $name => $reparser) + { + // Store the names without the "text_reparser." prefix + $this->reparser_names[] = preg_replace('(^text_reparser\\.)', '', $name); + } + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('reparser:list') + ->setDescription($this->user->lang('CLI_DESCRIPTION_REPARSER_LIST')) + ; + } + + /** + * Executes the command reparser:reparse + * + * @param InputInterface $input + * @param OutputInterface $output + * @return integer + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $output->writeln('<info>' . implode(', ', $this->reparser_names) . '</info>'); + + return 0; + } +} diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php new file mode 100644 index 0000000000..ddc97a1d1d --- /dev/null +++ b/phpBB/phpbb/console/command/reparser/reparse.php @@ -0,0 +1,284 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\reparser; + +use phpbb\exception\runtime_exception; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; + +class reparse extends \phpbb\console\command\command +{ + /** + * @var InputInterface + */ + protected $input; + + /** + * @var SymfonyStyle + */ + protected $io; + + /** + * @var OutputInterface + */ + protected $output; + + /** + * @var \phpbb\lock\db + */ + protected $reparse_lock; + + /** + * @var \phpbb\textreparser\manager + */ + protected $reparser_manager; + + /** + * @var \phpbb\di\service_collection + */ + protected $reparsers; + + /** + * @var array The reparser's last $current ID as values + */ + protected $resume_data; + + /** + * Constructor + * + * @param \phpbb\user $user + * @param \phpbb\lock\db $reparse_lock + * @param \phpbb\textreparser\manager $reparser_manager + * @param \phpbb\di\service_collection $reparsers + */ + public function __construct(\phpbb\user $user, \phpbb\lock\db $reparse_lock, \phpbb\textreparser\manager $reparser_manager, \phpbb\di\service_collection $reparsers) + { + require_once __DIR__ . '/../../../../includes/functions_content.php'; + + $this->reparse_lock = $reparse_lock; + $this->reparser_manager = $reparser_manager; + $this->reparsers = $reparsers; + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('reparser:reparse') + ->setDescription($this->user->lang('CLI_DESCRIPTION_REPARSER_REPARSE')) + ->addArgument('reparser-name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_REPARSER_REPARSE_ARG_1')) + ->addOption( + 'dry-run', + null, + InputOption::VALUE_NONE, + $this->user->lang('CLI_DESCRIPTION_REPARSER_REPARSE_OPT_DRY_RUN') + ) + ->addOption( + 'resume', + null, + InputOption::VALUE_NONE, + $this->user->lang('CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RESUME') + ) + ->addOption( + 'range-min', + null, + InputOption::VALUE_REQUIRED, + $this->user->lang('CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MIN'), + 1 + ) + ->addOption( + 'range-max', + null, + InputOption::VALUE_REQUIRED, + $this->user->lang('CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MAX') + ) + ->addOption( + 'range-size', + null, + InputOption::VALUE_REQUIRED, + $this->user->lang('CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_SIZE'), + 100 + ); + ; + } + + /** + * Create a styled progress bar + * + * @param integer $max Max value for the progress bar + * @return \Symfony\Component\Console\Helper\ProgressBar + */ + protected function create_progress_bar($max) + { + $progress = $this->io->createProgressBar($max); + if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) + { + $progress->setFormat('<info>[%percent:3s%%]</info> %message%'); + $progress->setOverwrite(false); + } + else if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) + { + $progress->setFormat('<info>[%current:s%/%max:s%]</info><comment>[%elapsed%/%estimated%][%memory%]</comment> %message%'); + $progress->setOverwrite(false); + } + else + { + $this->io->newLine(2); + $progress->setFormat( + " %current:s%/%max:s% %bar% %percent:3s%%\n" . + " %message% %elapsed:6s%/%estimated:-6s% %memory:6s%\n"); + $progress->setBarWidth(60); + } + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) + { + $progress->setEmptyBarCharacter('â–‘'); // light shade character \u2591 + $progress->setProgressCharacter(''); + $progress->setBarCharacter('â–“'); // dark shade character \u2593 + } + + return $progress; + } + + /** + * Executes the command reparser:reparse + * + * @param InputInterface $input + * @param OutputInterface $output + * @return integer + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->input = $input; + $this->output = $output; + $this->io = new SymfonyStyle($input, $output); + + if (!$this->reparse_lock->acquire()) + { + throw new runtime_exception('REPARSE_LOCK_ERROR', array(), null, 1); + } + + $name = $input->getArgument('reparser-name'); + if (isset($name)) + { + // Allow "post_text" to be an alias for "text_reparser.post_text" + if (!isset($this->reparsers[$name])) + { + $name = 'text_reparser.' . $name; + } + $this->reparse($name); + } + else + { + foreach ($this->reparsers as $name => $service) + { + $this->reparse($name); + } + } + + $this->io->success($this->user->lang('CLI_REPARSER_REPARSE_SUCCESS')); + + $this->reparse_lock->release(); + + return 0; + } + + /** + * Get an option value, adjusted for given reparser + * + * Will use the last saved value if --resume is set and the option was not specified + * on the command line + * + * @param string $option_name Option name + * @return integer + */ + protected function get_option($option_name) + { + // Return the option from the resume_data if applicable + if ($this->input->getOption('resume') && isset($this->resume_data[$option_name]) && !$this->input->hasParameterOption('--' . $option_name)) + { + return $this->resume_data[$option_name]; + } + + return $this->input->getOption($option_name); + } + + /** + * Reparse all text handled by given reparser within given range + * + * @param string $name Reparser name + */ + protected function reparse($name) + { + $reparser = $this->reparsers[$name]; + $this->resume_data = $this->reparser_manager->get_resume_data($name); + if ($this->input->getOption('dry-run')) + { + $reparser->disable_save(); + } + else + { + $reparser->enable_save(); + } + + // Start at range-max if specified or at the highest ID otherwise + $max = $this->get_option('range-max'); + $min = $this->get_option('range-min'); + $size = $this->get_option('range-size'); + + // range-max has no default value, it must be computed for each reparser + if ($max == null) + { + $max = $reparser->get_max_id(); + } + + if ($max < $min) + { + return; + } + + $this->io->section($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', preg_replace('(^text_reparser\\.)', '', $name), $min, $max)); + + $progress = $this->create_progress_bar($max); + $progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING_START', preg_replace('(^text_reparser\\.)', '', $name))); + $progress->start(); + + // Start from $max and decrement $current by $size until we reach $min + $current = $max; + while ($current >= $min) + { + $start = max($min, $current + 1 - $size); + $end = max($min, $current); + + $progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', preg_replace('(^text_reparser\\.)', '', $name), $start, $end)); + $reparser->reparse_range($start, $end); + + $current = $start - 1; + $progress->setProgress($max + 1 - $start); + + $this->reparser_manager->update_resume_data($name, $min, $current, $size, !$this->input->getOption('dry-run')); + } + $progress->finish(); + + $this->io->newLine(2); + } +} diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php new file mode 100644 index 0000000000..e8e4cf568e --- /dev/null +++ b/phpBB/phpbb/console/command/thumbnail/delete.php @@ -0,0 +1,178 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\thumbnail; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; + +class delete extends \phpbb\console\command\command +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB root path + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param \phpbb\user $user The user object (used to get language information) + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param string $phpbb_root_path Root path + */ + public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, $phpbb_root_path) + { + $this->db = $db; + $this->phpbb_root_path = $phpbb_root_path; + + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('thumbnail:delete') + ->setDescription($this->user->lang('CLI_DESCRIPTION_THUMBNAIL_DELETE')) + ; + } + + /** + * Executes the command thumbnail:delete. + * + * Deletes all existing thumbnails and updates the database accordingly. + * + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a thumbnail couldn't be deleted. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + $io->section($this->user->lang('CLI_THUMBNAIL_DELETING')); + + $sql = 'SELECT COUNT(*) AS nb_missing_thumbnails + FROM ' . ATTACHMENTS_TABLE . ' + WHERE thumbnail = 1'; + $result = $this->db->sql_query($sql); + $nb_missing_thumbnails = (int) $this->db->sql_fetchfield('nb_missing_thumbnails'); + $this->db->sql_freeresult($result); + + if ($nb_missing_thumbnails === 0) + { + $io->warning($this->user->lang('CLI_THUMBNAIL_NOTHING_TO_DELETE')); + return 0; + } + + $sql = 'SELECT attach_id, physical_filename, extension, real_filename, mimetype + FROM ' . ATTACHMENTS_TABLE . ' + WHERE thumbnail = 1'; + $result = $this->db->sql_query($sql); + + $progress = $io->createProgressBar($nb_missing_thumbnails); + if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) + { + $progress->setFormat('<info>[%percent:3s%%]</info> %message%'); + $progress->setOverwrite(false); + } + else if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) + { + $progress->setFormat('<info>[%current:s%/%max:s%]</info><comment>[%elapsed%/%estimated%][%memory%]</comment> %message%'); + $progress->setOverwrite(false); + } + else + { + $io->newLine(2); + $progress->setFormat( + " %current:s%/%max:s% %bar% %percent:3s%%\n" . + " %elapsed:6s%/%estimated:-6s% %memory:6s%\n"); + $progress->setBarWidth(60); + } + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) + { + $progress->setEmptyBarCharacter('â–‘'); // light shade character \u2591 + $progress->setProgressCharacter(''); + $progress->setBarCharacter('â–“'); // dark shade character \u2593 + } + + $progress->setMessage($this->user->lang('CLI_THUMBNAIL_DELETING')); + + $progress->start(); + + $thumbnail_deleted = array(); + $return = 0; + while ($row = $this->db->sql_fetchrow($result)) + { + $thumbnail_path = $this->phpbb_root_path . 'files/thumb_' . $row['physical_filename']; + + if (@unlink($thumbnail_path)) + { + $thumbnail_deleted[] = $row['attach_id']; + + if (sizeof($thumbnail_deleted) === 250) + { + $this->commit_changes($thumbnail_deleted); + $thumbnail_deleted = array(); + } + + $progress->setMessage($this->user->lang('CLI_THUMBNAIL_DELETED', $row['real_filename'], $row['physical_filename'])); + } + else + { + $return = 1; + $progress->setMessage('<error>' . $this->user->lang('CLI_THUMBNAIL_SKIPPED', $row['real_filename'], $row['physical_filename']) . '</error>'); + } + + $progress->advance(); + } + $this->db->sql_freeresult($result); + + if (!empty($thumbnail_deleted)) + { + $this->commit_changes($thumbnail_deleted); + } + + $progress->finish(); + + $io->newLine(2); + $io->success($this->user->lang('CLI_THUMBNAIL_DELETING_DONE')); + + return $return; + } + + /** + * Commits the changes to the database + * + * @param array $thumbnail_deleted + */ + protected function commit_changes(array $thumbnail_deleted) + { + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET thumbnail = 0 + WHERE ' . $this->db->sql_in_set('attach_id', $thumbnail_deleted); + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php new file mode 100644 index 0000000000..e677db3a97 --- /dev/null +++ b/phpBB/phpbb/console/command/thumbnail/generate.php @@ -0,0 +1,204 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\thumbnail; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; + +class generate extends \phpbb\console\command\command +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\cache\service + */ + protected $cache; + + /** + * phpBB root path + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP extension. + * + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\user $user The user object (used to get language information) + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param \phpbb\cache\service $cache The cache service + * @param string $phpbb_root_path Root path + * @param string $php_ext PHP extension + */ + public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->cache = $cache; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('thumbnail:generate') + ->setDescription($this->user->lang('CLI_DESCRIPTION_THUMBNAIL_GENERATE')) + ; + } + + /** + * Executes the command thumbnail:generate. + * + * Generate a thumbnail for all attachments which need one and don't have it yet. + * + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + $io->section($this->user->lang('CLI_THUMBNAIL_GENERATING')); + + $sql = 'SELECT COUNT(*) AS nb_missing_thumbnails + FROM ' . ATTACHMENTS_TABLE . ' + WHERE thumbnail = 0'; + $result = $this->db->sql_query($sql); + $nb_missing_thumbnails = (int) $this->db->sql_fetchfield('nb_missing_thumbnails'); + $this->db->sql_freeresult($result); + + if ($nb_missing_thumbnails === 0) + { + $io->warning($this->user->lang('CLI_THUMBNAIL_NOTHING_TO_GENERATE')); + return 0; + } + + $extensions = $this->cache->obtain_attach_extensions(true); + + $sql = 'SELECT attach_id, physical_filename, extension, real_filename, mimetype + FROM ' . ATTACHMENTS_TABLE . ' + WHERE thumbnail = 0'; + $result = $this->db->sql_query($sql); + + if (!function_exists('create_thumbnail')) + { + require($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext); + } + + $progress = $io->createProgressBar($nb_missing_thumbnails); + if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) + { + $progress->setFormat('<info>[%percent:3s%%]</info> %message%'); + $progress->setOverwrite(false); + } + else if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) + { + $progress->setFormat('<info>[%current:s%/%max:s%]</info><comment>[%elapsed%/%estimated%][%memory%]</comment> %message%'); + $progress->setOverwrite(false); + } + else + { + $io->newLine(2); + $progress->setFormat( + " %current:s%/%max:s% %bar% %percent:3s%%\n" . + " %elapsed:6s%/%estimated:-6s% %memory:6s%\n"); + $progress->setBarWidth(60); + } + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) + { + $progress->setEmptyBarCharacter('â–‘'); // light shade character \u2591 + $progress->setProgressCharacter(''); + $progress->setBarCharacter('â–“'); // dark shade character \u2593 + } + + $progress->setMessage($this->user->lang('CLI_THUMBNAIL_GENERATING')); + + $progress->start(); + + $thumbnail_created = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + if (isset($extensions[$row['extension']]['display_cat']) && $extensions[$row['extension']]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE) + { + $source = $this->phpbb_root_path . 'files/' . $row['physical_filename']; + $destination = $this->phpbb_root_path . 'files/thumb_' . $row['physical_filename']; + + if (create_thumbnail($source, $destination, $row['mimetype'])) + { + $thumbnail_created[] = (int) $row['attach_id']; + + if (count($thumbnail_created) === 250) + { + $this->commit_changes($thumbnail_created); + $thumbnail_created = array(); + } + + $progress->setMessage($this->user->lang('CLI_THUMBNAIL_GENERATED', $row['real_filename'], $row['physical_filename'])); + } + else + { + $progress->setMessage('<info>' . $this->user->lang('CLI_THUMBNAIL_SKIPPED', $row['real_filename'], $row['physical_filename']) . '</info>'); + } + } + + $progress->advance(); + } + $this->db->sql_freeresult($result); + + if (!empty($thumbnail_created)) + { + $this->commit_changes($thumbnail_created); + } + + $progress->finish(); + + $io->newLine(2); + $io->success($this->user->lang('CLI_THUMBNAIL_GENERATING_DONE')); + + return 0; + } + + /** + * Commits the changes to the database + * + * @param array $thumbnail_created + */ + protected function commit_changes(array $thumbnail_created) + { + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET thumbnail = 1 + WHERE ' . $this->db->sql_in_set('attach_id', $thumbnail_created); + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php new file mode 100644 index 0000000000..382da290bf --- /dev/null +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -0,0 +1,72 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\thumbnail; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\OutputInterface; + +class recreate extends \phpbb\console\command\command +{ + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('thumbnail:recreate') + ->setDescription($this->user->lang('CLI_DESCRIPTION_THUMBNAIL_RECREATE')) + ; + } + + /** + * Executes the command thumbnail:recreate. + * + * This command is a "macro" to execute thumbnail:delete and then thumbnail:generate. + * + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a thumbnail couldn't be deleted. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $parameters = array( + 'command' => 'thumbnail:delete' + ); + + if ($input->getOption('verbose')) + { + $parameters['-' . str_repeat('v', $output->getVerbosity() - 1)] = true; + } + + $this->getApplication()->setAutoExit(false); + + $input_delete = new ArrayInput($parameters); + $return = $this->getApplication()->run($input_delete, $output); + + if ($return === 0) + { + $parameters['command'] = 'thumbnail:generate'; + + $input_create = new ArrayInput($parameters); + $return = $this->getApplication()->run($input_create, $output); + } + + $this->getApplication()->setAutoExit(true); + + return $return; + } +} diff --git a/phpBB/phpbb/console/exception_subscriber.php b/phpBB/phpbb/console/exception_subscriber.php new file mode 100644 index 0000000000..b920d4abae --- /dev/null +++ b/phpBB/phpbb/console/exception_subscriber.php @@ -0,0 +1,74 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\console; + +use phpbb\exception\exception_interface; +use Symfony\Component\Console\ConsoleEvents; +use Symfony\Component\Console\Event\ConsoleExceptionEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +class exception_subscriber implements EventSubscriberInterface +{ + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * Construct method + * + * @param \phpbb\language\language $language Language object + * @param bool $debug Debug mode + */ + public function __construct(\phpbb\language\language $language, $debug = false) + { + $this->language = $language; + $this->debug = $debug; + } + + /** + * This listener is run when the ConsoleEvents::EXCEPTION event is triggered. + * It translate the exception message. If din debug mode the original exception is embedded. + * + * @param ConsoleExceptionEvent $event + */ + public function on_exception(ConsoleExceptionEvent $event) + { + $original_exception = $event->getException(); + + if ($original_exception instanceof exception_interface) + { + $parameters = array_merge(array($original_exception->getMessage()), $original_exception->get_parameters()); + $message = call_user_func_array(array($this->language, 'lang'), $parameters); + + if ($this->debug) + { + $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception); + } + else + { + $exception = new \RuntimeException($message , $original_exception->getCode()); + } + + $event->setException($exception); + } + } + + static public function getSubscribedEvents() + { + return array( + ConsoleEvents::EXCEPTION => 'on_exception', + ); + } +} diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 874889015a..0ba0489cb7 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpbb -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,13 +16,12 @@ namespace phpbb; /** * phpbb_visibility * Handle fetching and setting the visibility for topics and posts -* @package phpbb */ class content_visibility { /** * Database object - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -35,6 +38,18 @@ class content_visibility protected $auth; /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * phpBB root path * @var string */ @@ -50,15 +65,22 @@ class content_visibility * Constructor * * @param \phpbb\auth\auth $auth Auth object - * @param \phpbb\db\driver\driver $db Database object - * @param \phpbb\user $user User object + * @param \phpbb\config\config $config Config object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\user $user User object * @param string $phpbb_root_path Root path * @param string $php_ext PHP Extension - * @return null + * @param string $forums_table Forums table name + * @param string $posts_table Posts table name + * @param string $topics_table Topics table name + * @param string $users_table Users table name */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) { $this->auth = $auth; + $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->db = $db; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; @@ -121,12 +143,43 @@ class content_visibility */ public function get_visibility_sql($mode, $forum_id, $table_alias = '') { + $where_sql = ''; + + $get_visibility_sql_overwrite = false; + + /** + * Allow changing the result of calling get_visibility_sql + * + * @event core.phpbb_content_visibility_get_visibility_sql_before + * @var string where_sql Extra visibility conditions. It must end with either an SQL "AND" or an "OR" + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array forum_id The forum id in which the search is made. + * @var string table_alias Table alias to prefix in SQL queries + * @var mixed get_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event + * If false, get_visibility_sql continues normally + * It must be either boolean or string + * @since 3.1.4-RC1 + */ + $vars = array( + 'where_sql', + 'mode', + 'forum_id', + 'table_alias', + 'get_visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_visibility_sql_before', compact($vars))); + + if ($get_visibility_sql_overwrite !== false) + { + return $get_visibility_sql_overwrite; + } + if ($this->auth->acl_get('m_approve', $forum_id)) { - return '1 = 1'; + return $where_sql . '1 = 1'; } - return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; + return $where_sql . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; } /** @@ -146,6 +199,36 @@ class content_visibility $approve_forums = array_intersect($forum_ids, array_keys($this->auth->acl_getf('m_approve', true))); + $get_forums_visibility_sql_overwrite = false; + /** + * Allow changing the result of calling get_forums_visibility_sql + * + * @event core.phpbb_content_visibility_get_forums_visibility_before + * @var string where_sql The action the user tried to execute + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array forum_ids Array of forum ids which the posts/topics are limited to + * @var string table_alias Table alias to prefix in SQL queries + * @var array approve_forums Array of forums where the user has m_approve permissions + * @var mixed get_forums_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event + * If false, get_forums_visibility_sql continues normally + * It must be either boolean or string + * @since 3.1.3-RC1 + */ + $vars = array( + 'where_sql', + 'mode', + 'forum_ids', + 'table_alias', + 'approve_forums', + 'get_forums_visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_forums_visibility_before', compact($vars))); + + if ($get_forums_visibility_sql_overwrite !== false) + { + return $get_forums_visibility_sql_overwrite; + } + if (sizeof($approve_forums)) { // Remove moderator forums from the rest @@ -154,7 +237,7 @@ class content_visibility if (!sizeof($forum_ids)) { // The user can see all posts/topics in all specified forums - return $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums); + return $where_sql . $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ')'; } else { @@ -165,8 +248,8 @@ class content_visibility else { // The user is just a normal user - return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' - AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true); + return $where_sql . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' + AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true) . ')'; } $where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' @@ -192,6 +275,35 @@ class content_visibility $approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids); + $visibility_sql_overwrite = null; + + /** + * Allow changing the result of calling get_global_visibility_sql + * + * @event core.phpbb_content_visibility_get_global_visibility_before + * @var array where_sqls The action the user tried to execute + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array exclude_forum_ids Array of forum ids the current user doesn't have access to + * @var string table_alias Table alias to prefix in SQL queries + * @var array approve_forums Array of forums where the user has m_approve permissions + * @var string visibility_sql_overwrite Forces the function to return an implosion of where_sqls (joined by "OR") + * @since 3.1.3-RC1 + */ + $vars = array( + 'where_sqls', + 'mode', + 'exclude_forum_ids', + 'table_alias', + 'approve_forums', + 'visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_global_visibility_before', compact($vars))); + + if ($visibility_sql_overwrite) + { + return $visibility_sql_overwrite; + } + if (sizeof($exclude_forum_ids)) { $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . ' @@ -215,23 +327,23 @@ class content_visibility /** * Change visibility status of one post or all posts of a topic * - * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED} + * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} * @param $post_id mixed Post ID or array of post IDs to act on, * if it is empty, all posts of topic_id will be modified * @param $topic_id int Topic where $post_id is found * @param $forum_id int Forum where $topic_id is found * @param $user_id int User performing the action * @param $time int Timestamp when the action is performed - * @param $reason string Reason why the visibilty was changed. + * @param $reason string Reason why the visibility was changed. * @param $is_starter bool Is this the first post of the topic changed? * @param $is_latest bool Is this the last post of the topic changed? * @param $limit_visibility mixed Limit updating per topic_id to a certain visibility * @param $limit_delete_time mixed Limit updating per topic_id to a certain deletion time - * @return array Changed post data, empty array if an error occured. + * @return array Changed post data, empty array if an error occurred. */ public function set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $limit_visibility = false, $limit_delete_time = false) { - if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED))) + if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE))) { return array(); } @@ -326,7 +438,7 @@ class content_visibility // Update users postcounts foreach ($postcounts as $num_posts => $poster_ids) { - if ($visibility == ITEM_DELETED) + if (in_array($visibility, array(ITEM_REAPPROVE, ITEM_DELETED))) { $sql = 'UPDATE ' . $this->users_table . ' SET user_posts = 0 @@ -384,75 +496,52 @@ class content_visibility $update_topic_postcount = false; } + $topic_update_array = array(); // Update the topic's reply count and the forum's post count if ($update_topic_postcount) { - $cur_posts = $cur_unapproved_posts = $cur_softdeleted_posts = 0; + $field_alias = array( + ITEM_APPROVED => 'posts_approved', + ITEM_UNAPPROVED => 'posts_unapproved', + ITEM_DELETED => 'posts_softdeleted', + ITEM_REAPPROVE => 'posts_unapproved', + ); + $cur_posts = array_fill_keys($field_alias, 0); + foreach ($postcount_visibility as $post_visibility => $visibility_posts) { - // We need to substract the posts from the counters ... - if ($post_visibility == ITEM_APPROVED) - { - $cur_posts += $visibility_posts; - } - else if ($post_visibility == ITEM_UNAPPROVED) - { - $cur_unapproved_posts += $visibility_posts; - } - else if ($post_visibility == ITEM_DELETED) - { - $cur_softdeleted_posts += $visibility_posts; - } + $cur_posts[$field_alias[(int) $post_visibility]] += $visibility_posts; } $sql_ary = array(); - if ($visibility == ITEM_DELETED) + $recipient_field = $field_alias[$visibility]; + + foreach ($cur_posts as $field => $count) { - if ($cur_posts) + // Decrease the count for the old statuses. + if ($count && $field != $recipient_field) { - $sql_ary['posts_approved'] = ' - ' . $cur_posts; - } - if ($cur_unapproved_posts) - { - $sql_ary['posts_unapproved'] = ' - ' . $cur_unapproved_posts; - } - if ($cur_posts + $cur_unapproved_posts) - { - $sql_ary['posts_softdeleted'] = ' + ' . ($cur_posts + $cur_unapproved_posts); + $sql_ary[$field] = " - $count"; } } - else + // Add up the count from all statuses excluding the recipient status. + $count_increase = array_sum(array_diff($cur_posts, array($recipient_field))); + + if ($count_increase) { - if ($cur_unapproved_posts) - { - $sql_ary['posts_unapproved'] = ' - ' . $cur_unapproved_posts; - } - if ($cur_softdeleted_posts) - { - $sql_ary['posts_softdeleted'] = ' - ' . $cur_softdeleted_posts; - } - if ($cur_softdeleted_posts + $cur_unapproved_posts) - { - $sql_ary['posts_approved'] = ' + ' . ($cur_softdeleted_posts + $cur_unapproved_posts); - } + $sql_ary[$recipient_field] = " + $count_increase"; } if (sizeof($sql_ary)) { - $topic_sql = $forum_sql = array(); + $forum_sql = array(); foreach ($sql_ary as $field => $value_change) { - $topic_sql[] = 'topic_' . $field . ' = topic_' . $field . $value_change; + $topic_update_array[] = 'topic_' . $field . ' = topic_' . $field . $value_change; $forum_sql[] = 'forum_' . $field . ' = forum_' . $field . $value_change; } - // Update the number for replies and posts - $sql = 'UPDATE ' . $this->topics_table . ' - SET ' . implode(', ', $topic_sql) . ' - WHERE topic_id = ' . (int) $topic_id; - $this->db->sql_query($sql); - $sql = 'UPDATE ' . $this->forums_table . ' SET ' . implode(', ', $forum_sql) . ' WHERE forum_id = ' . (int) $forum_id; @@ -460,6 +549,38 @@ class content_visibility } } + if ($post_id) + { + $sql = 'SELECT 1 AS has_attachments + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . (int) $topic_id . ' + AND post_attachment = 1 + AND post_visibility = ' . ITEM_APPROVED . ' + AND ' . $this->db->sql_in_set('post_id', $post_id, true); + $result = $this->db->sql_query_limit($sql, 1); + + $has_attachment = (bool) $this->db->sql_fetchfield('has_attachments'); + $this->db->sql_freeresult($result); + + if ($has_attachment && $visibility == ITEM_APPROVED) + { + $topic_update_array[] = 'topic_attachment = 1'; + } + else if (!$has_attachment && $visibility != ITEM_APPROVED) + { + $topic_update_array[] = 'topic_attachment = 0'; + } + } + + if (!empty($topic_update_array)) + { + // Update the number for replies and posts, and update the attachments flag + $sql = 'UPDATE ' . $this->topics_table . ' + SET ' . implode(', ', $topic_update_array) . ' + WHERE topic_id = ' . (int) $topic_id; + $this->db->sql_query($sql); + } + return $data; } @@ -475,7 +596,7 @@ class content_visibility * as soft deleted. * If you want to update all posts, use the force option. * - * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED} + * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} * @param $topic_id mixed Topic ID to act on * @param $forum_id int Forum where $topic_id is found * @param $user_id int User performing the action @@ -486,7 +607,7 @@ class content_visibility */ public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all = false) { - if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED))) + if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE))) { return array(); } @@ -528,16 +649,16 @@ class content_visibility if (!$force_update_all && $original_topic_data['topic_delete_time'] && $original_topic_data['topic_visibility'] == ITEM_DELETED && $visibility == ITEM_APPROVED) { // If we're restoring a topic we only restore posts, that were soft deleted through the topic soft deletion. - self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']); + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']); } else if (!$force_update_all && $original_topic_data['topic_visibility'] == ITEM_APPROVED && $visibility == ITEM_DELETED) { - // If we're soft deleting a topic we only approved posts are soft deleted. - self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility']); + // If we're soft deleting a topic we only mark approved posts as soft deleted. + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility']); } else { - self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true); + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true); } return $data; @@ -547,7 +668,7 @@ class content_visibility * Add post to topic and forum statistics * * @param $data array Contains information from the topics table about given topic - * @param $sql_data array Populated with the SQL changes, may be empty at call time + * @param &$sql_data array Populated with the SQL changes, may be empty at call time * @return null */ public function add_post_to_statistic($data, &$sql_data) @@ -561,90 +682,68 @@ class content_visibility $sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1'; } - set_config_count('num_posts', 1, true); + $this->config->increment('num_posts', 1, false); } /** * Remove post from topic and forum statistics * * @param $data array Contains information from the topics table about given topic - * @param $sql_data array Populated with the SQL changes, may be empty at call time + * @param &$sql_data array Populated with the SQL changes, may be empty at call time * @return null */ public function remove_post_from_statistic($data, &$sql_data) { - $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1'; - $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1'; + if ($data['post_visibility'] == ITEM_APPROVED) + { + $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1'; + $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1'; - if ($data['post_postcount']) + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + } + + $this->config->increment('num_posts', -1, false); + } + else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) { - $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1'; + } + else if ($data['post_visibility'] == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1'; } - - set_config_count('num_posts', -1, true); } /** * Remove topic from forum statistics * - * @param $topic_id int The topic to act on - * @param $forum_id int Forum where the topic is found - * @param $topic_row array Contains information from the topic, may be empty at call time - * @param $sql_data array Populated with the SQL changes, may be empty at call time + * @param $data array Post and topic data + * @param &$sql_data array Populated with the SQL changes, may be empty at call time * @return null */ - public function remove_topic_from_statistic($topic_id, $forum_id, &$topic_row, &$sql_data) + public function remove_topic_from_statistic($data, &$sql_data) { - // Do we need to grab some topic informations? - if (!sizeof($topic_row)) + if ($data['topic_visibility'] == ITEM_APPROVED) { - $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility - FROM ' . $this->topics_table . ' - WHERE topic_id = ' . (int) $topic_id; - $result = $this->db->sql_query($sql); - $topic_row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - } - - // If this is an edited topic or the first post the topic gets completely disapproved later on... - $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_topics_approved = forum_topics_approved - 1'; - $sql_data[$this->forums_table] .= ', forum_posts_approved = forum_posts_approved - ' . $topic_row['topic_posts_approved']; - $sql_data[$this->forums_table] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved']; - $sql_data[$this->forums_table] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted']; - - set_config_count('num_topics', -1, true); - set_config_count('num_posts', $topic_row['topic_posts_approved'] * (-1), true); - - // Get user post count information - $sql = 'SELECT poster_id, COUNT(post_id) AS num_posts - FROM ' . $this->posts_table . ' - WHERE topic_id = ' . (int) $topic_id . ' - AND post_postcount = 1 - AND post_visibility = ' . ITEM_APPROVED . ' - GROUP BY poster_id'; - $result = $this->db->sql_query($sql); + $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1'; - $postcounts = array(); - while ($row = $this->db->sql_fetchrow($result)) + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + } + } + else if ($data['topic_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) { - $postcounts[(int) $row['num_posts']][] = (int) $row['poster_id']; + $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1'; } - $this->db->sql_freeresult($result); - - // Decrement users post count - foreach ($postcounts as $num_posts => $poster_ids) + else if ($data['topic_visibility'] == ITEM_DELETED) { - $sql = 'UPDATE ' . $this->users_table . ' - SET user_posts = 0 - WHERE user_posts < ' . $num_posts . ' - AND ' . $this->db->sql_in_set('user_id', $poster_ids); - $this->db->sql_query($sql); - - $sql = 'UPDATE ' . $this->users_table . ' - SET user_posts = user_posts - ' . $num_posts . ' - WHERE user_posts >= ' . $num_posts . ' - AND ' . $this->db->sql_in_set('user_id', $poster_ids); - $this->db->sql_query($sql); + $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1'; } + } } diff --git a/phpBB/phpbb/controller/exception.php b/phpBB/phpbb/controller/exception.php index 06ece8d1d5..e227c7c37b 100644 --- a/phpBB/phpbb/controller/exception.php +++ b/phpBB/phpbb/controller/exception.php @@ -1,9 +1,13 @@ <?php /** * -* @package controller -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,7 @@ namespace phpbb\controller; /** * Controller exception class -* @package phpBB3 */ -class exception extends \RuntimeException +class exception extends \phpbb\exception\runtime_exception { } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 05a05d1e57..e98de0e771 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -1,19 +1,24 @@ <?php /** * -* @package controller -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\controller; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** * Controller helper class, contains methods that do things for controllers -* @package phpBB3 */ class helper { @@ -35,47 +40,52 @@ class helper */ protected $config; - /** - * phpBB root path - * @var string - */ - protected $phpbb_root_path; + /* @var \phpbb\symfony_request */ + protected $symfony_request; + + /* @var \phpbb\request\request_interface */ + protected $request; /** - * PHP extension - * @var string - */ - protected $php_ext; + * @var \phpbb\routing\helper + */ + protected $routing_helper; /** * Constructor * * @param \phpbb\template\template $template Template object - * @param \phpbb\user $user User object - * @param \phpbb\config\config $config Config object - * @param string $phpbb_root_path phpBB root path - * @param string $php_ext PHP extension + * @param \phpbb\user $user User object + * @param \phpbb\config\config $config Config object + * @param \phpbb\symfony_request $symfony_request Symfony Request object + * @param \phpbb\request\request_interface $request phpBB request object + * @param \phpbb\routing\helper $routing_helper Helper to generate the routes */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\symfony_request $symfony_request, \phpbb\request\request_interface $request, \phpbb\routing\helper $routing_helper) { $this->template = $template; $this->user = $user; $this->config = $config; - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; + $this->symfony_request = $symfony_request; + $this->request = $request; + $this->routing_helper = $routing_helper; } /** * Automate setting up the page and creating the response object. * - * @param string $handle The template handle to render + * @param string $template_file The template handle to render * @param string $page_title The title of the page to output * @param int $status_code The status code to be sent to the page header + * @param bool $display_online_list Do we display online users list + * @param int $item_id Restrict online users to item id + * @param string $item Restrict online users to a certain session item, e.g. forum for session_forum_id + * * @return Response object containing rendered page */ - public function render($template_file, $page_title = '', $status_code = 200) + public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum') { - page_header($page_title); + page_header($page_title, $display_online_list, $item_id, $item); $this->template->set_filenames(array( 'body' => $template_file, @@ -87,47 +97,96 @@ class helper } /** - * Generate a URL + * Generate a URL to a route * - * @param string $route The route to travel - * @param mixed $params String or array of additional url parameters + * @param string $route Name of the route to travel + * @param array $params String or array of additional url parameters * @param bool $is_amp Is url using & (true) or & (false) - * @param string $session_id Possibility to use a custom session id instead of the global one + * @param string|bool $session_id Possibility to use a custom session id instead of the global one + * @param bool|string $reference_type The type of reference to be generated (one of the constants) * @return string The URL already passed through append_sid() */ - public function url($route, $params = false, $is_amp = true, $session_id = false) + public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH) { - $route_params = ''; - if (($route_delim = strpos($route, '?')) !== false) - { - $route_params = substr($route, $route_delim); - $route = substr($route, 0, $route_delim); - } - - // If enable_mod_rewrite is false, we need to include app.php - $route_prefix = $this->phpbb_root_path; - if (empty($this->config['enable_mod_rewrite'])) - { - $route_prefix .= 'app.' . $this->php_ext . '/'; - } - - return append_sid($route_prefix . "$route" . $route_params, $params, $is_amp, $session_id); + return $this->routing_helper->route($route, $params, $is_amp, $session_id, $reference_type); } /** * Output an error, effectively the same thing as trigger_error * * @param string $message The error message - * @param string $code The error code (e.g. 404, 500, 503, etc.) - * @return Response A Reponse instance + * @param int $code The error code (e.g. 404, 500, 503, etc.) + * @return Response A Response instance + * + * @deprecated 3.1.3 (To be removed: 3.3.0) Use exceptions instead. */ public function error($message, $code = 500) { + return $this->message($message, array(), 'INFORMATION', $code); + } + + /** + * Output a message + * + * In case of an error, please throw an exception instead + * + * @param string $message The message to display (must be a language variable) + * @param array $parameters The parameters to use with the language var + * @param string $title Title for the message (must be a language variable) + * @param int $code The HTTP status code (e.g. 404, 500, 503, etc.) + * @return Response A Response instance + */ + public function message($message, array $parameters = array(), $title = 'INFORMATION', $code = 200) + { + array_unshift($parameters, $message); + $message_text = call_user_func_array(array($this->user, 'lang'), $parameters); + $message_title = $this->user->lang($title); + + if ($this->request->is_ajax()) + { + global $refresh_data; + + return new JsonResponse( + array( + 'MESSAGE_TITLE' => $message_title, + 'MESSAGE_TEXT' => $message_text, + 'S_USER_WARNING' => false, + 'S_USER_NOTICE' => false, + 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null + ), + $code + ); + } + $this->template->assign_vars(array( - 'MESSAGE_TEXT' => $message, - 'MESSAGE_TITLE' => $this->user->lang('INFORMATION'), + 'MESSAGE_TEXT' => $message_text, + 'MESSAGE_TITLE' => $message_title, )); - return $this->render('message_body.html', $this->user->lang('INFORMATION'), $code); + return $this->render('message_body.html', $message_title, $code); + } + + /** + * Assigns automatic refresh time meta tag in template + * + * @param int $time time in seconds, when redirection should occur + * @param string $url the URL where the user should be redirected + * @return null + */ + public function assign_meta_refresh_var($time, $url) + { + $this->template->assign_vars(array( + 'META' => '<meta http-equiv="refresh" content="' . $time . '; url=' . $url . '" />', + )); + } + + /** + * Return the current url + * + * @return string + */ + public function get_current_url() + { + return generate_board_url(true) . $this->request->escape($this->symfony_request->getRequestUri(), true); } } diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php deleted file mode 100644 index fde51696e8..0000000000 --- a/phpBB/phpbb/controller/provider.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** -* -* @package controller -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\controller; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Loader\YamlFileLoader; -use Symfony\Component\Config\FileLocator; - -/** -* Controller interface -* @package phpBB3 -*/ -class provider -{ - /** - * YAML file(s) containing route information - * @var array - */ - protected $routing_files; - - /** - * Construct method - * - * @param array() $routing_files Array of strings containing paths - * to YAML files holding route information - */ - public function __construct($routing_files = array()) - { - $this->routing_files = $routing_files; - } - - /** - * Locate paths containing routing files - * This sets an internal property but does not return the paths. - * - * @return The current instance of this object for method chaining - */ - public function import_paths_from_finder(\phpbb\extension\finder $finder) - { - // We hardcode the path to the core config directory - // because the finder cannot find it - $this->routing_files = array_merge(array('config/routing.yml'), array_keys($finder - ->directory('config') - ->suffix('routing.yml') - ->find() - )); - - return $this; - } - - /** - * Get a list of controllers and return it - * - * @param string $base_path Base path to prepend to file paths - * @return array Array of controllers and their route information - */ - public function find($base_path = '') - { - $routes = new RouteCollection; - foreach ($this->routing_files as $file_path) - { - $loader = new YamlFileLoader(new FileLocator($base_path)); - $routes->addCollection($loader->load($file_path)); - } - - return $routes; - } -} diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 233179e343..4f432c3323 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -1,9 +1,13 @@ <?php /** * -* @package controller -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,17 +19,10 @@ use Symfony\Component\HttpFoundation\Request; /** * Controller manager class -* @package phpBB3 */ class resolver implements ControllerResolverInterface { /** - * User object - * @var \phpbb\user - */ - protected $user; - - /** * ContainerInterface object * @var ContainerInterface */ @@ -33,28 +30,41 @@ class resolver implements ControllerResolverInterface /** * phpbb\template\template object - * @var phpbb\template\template + * @var \phpbb\template\template */ protected $template; /** + * Request type cast helper object + * @var \phpbb\request\type_cast_helper + */ + protected $type_cast_helper; + + /** + * phpBB root path + * @var string + */ + protected $phpbb_root_path; + + /** * Construct method * - * @param \phpbb\user $user User Object * @param ContainerInterface $container ContainerInterface object + * @param string $phpbb_root_path Relative path to phpBB root * @param \phpbb\template\template $template */ - public function __construct(\phpbb\user $user, ContainerInterface $container, \phpbb\template\template $template = null) + public function __construct(ContainerInterface $container, $phpbb_root_path, \phpbb\template\template $template = null) { - $this->user = $user; $this->container = $container; $this->template = $template; + $this->type_cast_helper = new \phpbb\request\type_cast_helper(); + $this->phpbb_root_path = $phpbb_root_path; } /** * Load a controller callable * - * @param Symfony\Component\HttpFoundation\Request $request Symfony Request object + * @param \Symfony\Component\HttpFoundation\Request $request Symfony Request object * @return bool|Callable Callable or false * @throws \phpbb\controller\exception */ @@ -64,20 +74,20 @@ class resolver implements ControllerResolverInterface if (!$controller) { - throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']); + throw new \phpbb\controller\exception('CONTROLLER_NOT_SPECIFIED'); } // Require a method name along with the service name if (stripos($controller, ':') === false) { - throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']); + throw new \phpbb\controller\exception('CONTROLLER_METHOD_NOT_SPECIFIED'); } list($service, $method) = explode(':', $controller); if (!$this->container->has($service)) { - throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service)); + throw new \phpbb\controller\exception('CONTROLLER_SERVICE_UNDEFINED', array($service)); } $controller_object = $this->container->get($service); @@ -94,7 +104,7 @@ class resolver implements ControllerResolverInterface { $controller_style_dir = 'ext/' . $controller_dir[0] . '/' . $controller_dir[1] . '/styles'; - if (is_dir($controller_style_dir)) + if (is_dir($this->phpbb_root_path . $controller_style_dir)) { $this->template->set_style(array($controller_style_dir, 'styles')); } @@ -109,9 +119,9 @@ class resolver implements ControllerResolverInterface * and should match the parameters of the method you are using as your * controller. * - * @param Symfony\Component\HttpFoundation\Request $request Symfony Request object + * @param \Symfony\Component\HttpFoundation\Request $request Symfony Request object * @param mixed $controller A callable (controller class, method) - * @return bool False + * @return array An array of arguments to pass to the controller * @throws \phpbb\controller\exception */ public function getArguments(Request $request, $controller) @@ -127,7 +137,16 @@ class resolver implements ControllerResolverInterface { if (array_key_exists($param->name, $attributes)) { - $arguments[] = $attributes[$param->name]; + if (is_string($attributes[$param->name])) + { + $value = $attributes[$param->name]; + $this->type_cast_helper->set_var($value, $attributes[$param->name], 'string', true, false); + $arguments[] = $value; + } + else + { + $arguments[] = $attributes[$param->name]; + } } else if ($param->getClass() && $param->getClass()->isInstance($request)) { @@ -139,7 +158,7 @@ class resolver implements ControllerResolverInterface } else { - throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name)); + throw new \phpbb\controller\exception('CONTROLLER_ARGUMENT_VALUE_MISSING', array($param->getPosition() + 1, get_class($object) . ':' . $method, $param->name)); } } diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php index b6af07aff7..079ce8107e 100644 --- a/phpBB/phpbb/cron/manager.php +++ b/phpBB/phpbb/cron/manager.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,8 +17,6 @@ namespace phpbb\cron; * Cron manager class. * * Finds installed cron tasks, stores task objects, provides task selection. -* -* @package phpBB3 */ class manager { @@ -32,7 +34,9 @@ class manager /** * Constructor. Loads all available tasks. * - * @param array|Traversable $tasks Provides an iterable set of task names + * @param array|\Traversable $tasks Provides an iterable set of task names + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension */ public function __construct($tasks, $phpbb_root_path, $php_ext) { @@ -46,7 +50,7 @@ class manager * Loads tasks given by name, wraps them * and puts them into $this->tasks. * - * @param array|Traversable $tasks Array of instances of \phpbb\cron\task\task + * @param array|\Traversable $tasks Array of instances of \phpbb\cron\task\task * * @return null */ @@ -69,6 +73,7 @@ class manager */ public function find_one_ready_task() { + shuffle($this->tasks); foreach ($this->tasks as $task) { if ($task->is_ready()) @@ -120,6 +125,16 @@ class manager } /** + * Find all tasks and return them. + * + * @return array List of all tasks. + */ + public function get_tasks() + { + return $this->tasks; + } + + /** * Wraps a task inside an instance of \phpbb\cron\task\wrapper. * * @param \phpbb\cron\task\task $task The task. diff --git a/phpBB/phpbb/cron/task/base.php b/phpBB/phpbb/cron/task/base.php index 63f0407bcd..57c9912d31 100644 --- a/phpBB/phpbb/cron/task/base.php +++ b/phpBB/phpbb/cron/task/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,8 +21,6 @@ namespace phpbb\cron\task; * * Cron tasks need not inherit from this base class. If desired, * they may implement cron task interface directly. -* -* @package phpBB3 */ abstract class base implements \phpbb\cron\task\task { diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php index 90b9a5914b..b47939ccbe 100644 --- a/phpBB/phpbb/cron/task/core/prune_all_forums.php +++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,8 +19,6 @@ namespace phpbb\cron\task\core; * It is intended to be invoked from system cron. * This task will find all forums for which pruning is enabled, and will * prune all forums as necessary. -* -* @package phpBB3 */ class prune_all_forums extends \phpbb\cron\task\base { @@ -29,11 +31,11 @@ class prune_all_forums extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext The PHP file extension * @param \phpbb\config\config $config The config - * @param \phpbb\db\driver\driver $db The db connection + * @param \phpbb\db\driver\driver_interface $db The db connection */ - public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db) + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php index e0d8b067c5..abf91aee19 100644 --- a/phpBB/phpbb/cron/task/core/prune_forum.php +++ b/phpBB/phpbb/cron/task/core/prune_forum.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,8 +19,6 @@ namespace phpbb\cron\task\core; * It is intended to be used when cron is invoked via web. * This task can decide whether it should be run using data obtained by viewforum * code, without making additional database queries. -* -* @package phpBB3 */ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\parametrized { @@ -29,7 +31,7 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para * If $forum_data is given, it is assumed to contain necessary information * about a single forum that is to be pruned. * - * If $forum_data is not given, forum id will be retrieved via request_var + * If $forum_data is not given, forum id will be retrieved via $request->variable() * and a database query will be performed to load the necessary information * about the forum. */ @@ -39,11 +41,11 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext PHP file extension * @param \phpbb\config\config $config The config - * @param \phpbb\db\driver\driver $db The db connection + * @param \phpbb\db\driver\driver_interface $db The db connection */ - public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db) + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/phpbb/cron/task/core/prune_notifications.php b/phpBB/phpbb/cron/task/core/prune_notifications.php index 9f67c54e1c..ffa7e17970 100644 --- a/phpBB/phpbb/cron/task/core/prune_notifications.php +++ b/phpBB/phpbb/cron/task/core/prune_notifications.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\cron\task\core; /** * Prune notifications cron task. -* -* @package phpBB3 */ class prune_notifications extends \phpbb\cron\task\base { diff --git a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php new file mode 100644 index 0000000000..0ab59f9ed5 --- /dev/null +++ b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php @@ -0,0 +1,200 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cron\task\core; + +/** +* Prune one forum of its shadow topics cron task. +* +* It is intended to be used when cron is invoked via web. +* This task can decide whether it should be run using data obtained by viewforum +* code, without making additional database queries. +*/ +class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\task\parametrized +{ + protected $phpbb_root_path; + protected $php_ext; + protected $config; + protected $db; + protected $log; + protected $user; + + /** + * If $forum_data is given, it is assumed to contain necessary information + * about a single forum that is to be pruned. + * + * If $forum_data is not given, forum id will be retrieved via $request->variable() + * and a database query will be performed to load the necessary information + * about the forum. + */ + protected $forum_data; + + /** + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext PHP file extension + * @param \phpbb\config\config $config The config + * @param \phpbb\db\driver\driver_interface $db The db connection + * @param \phpbb\log\log $log The phpBB log system + * @param \phpbb\user $user The phpBB user object + */ + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\log\log $log, \phpbb\user $user) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->config = $config; + $this->db = $db; + $this->log = $log; + $this->user = $user; + } + + /** + * Manually set forum data. + * + * @param array $forum_data Information about a forum to be pruned. + */ + public function set_forum_data($forum_data) + { + $this->forum_data = $forum_data; + } + + /** + * Runs this cron task. + * + * @return null + */ + public function run() + { + if (!function_exists('auto_prune')) + { + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); + } + + if ($this->forum_data['prune_shadow_days']) + { + $this->auto_prune_shadow_topics($this->forum_data['forum_id'], 'shadow', $this->forum_data['forum_flags'], $this->forum_data['prune_shadow_days'], $this->forum_data['prune_shadow_freq']); + } + } + + /** + * Returns whether this cron task can run, given current board configuration. + * + * This cron task will not run when system cron is utilised, as in + * such cases prune_all_forums task would run instead. + * + * Additionally, this task must be given the forum data, either via + * the constructor or parse_parameters method. + * + * @return bool + */ + public function is_runnable() + { + return !$this->config['use_system_cron'] && $this->forum_data; + } + + /** + * Returns whether this cron task should run now, because enough time + * has passed since it was last run. + * + * Forum pruning interval is specified in the forum data. + * + * @return bool + */ + public function should_run() + { + return $this->forum_data['enable_shadow_prune'] && $this->forum_data['prune_shadow_next'] < time(); + } + + /** + * Returns parameters of this cron task as an array. + * The array has one key, f, whose value is id of the forum to be pruned. + * + * @return array + */ + public function get_parameters() + { + return array('f' => $this->forum_data['forum_id']); + } + + /** + * Parses parameters found in $request, which is an instance of + * \phpbb\request\request_interface. + * + * It is expected to have a key f whose value is id of the forum to be pruned. + * + * @param \phpbb\request\request_interface $request Request object. + * + * @return null + */ + public function parse_parameters(\phpbb\request\request_interface $request) + { + $this->forum_data = null; + if ($request->is_set('f')) + { + $forum_id = $request->variable('f', 0); + + $sql = 'SELECT forum_id, prune_shadow_next, enable_shadow_prune, prune_shadow_days, forum_flags, prune_shadow_freq + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + $this->forum_data = $row; + } + } + } + + /** + * Automatically prune shadow topics + * Based on fuunction auto_prune() + * @param int $forum_id Forum ID of forum that should be pruned + * @param string $prune_mode Prune mode + * @param int $prune_flags Prune flags + * @param int $prune_days Prune date in days + * @param int $prune_freq Prune frequency + * @return null + */ + protected function auto_prune_shadow_topics($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_freq) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $this->db->sql_query($sql, 3600); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + $prune_date = time() - ($prune_days * 86400); + $next_prune = time() + ($prune_freq * 86400); + + prune($forum_id, $prune_mode, $prune_date, $prune_flags, true); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET prune_shadow_next = $next_prune + WHERE forum_id = $forum_id"; + $this->db->sql_query($sql); + + $user_id = (empty($this->user->data)) ? ANONYMOUS : $this->user->data['user_id']; + $user_ip = (empty($this->user->ip)) ? '' : $this->user->ip; + + $this->log->add('admin', $user_id, $user_ip, 'LOG_PRUNE_SHADOW', false, array($row['forum_name'])); + } + + return; + } +} diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index cd799b8024..a9345a44df 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\cron\task\core; /** * Queue cron task. Sends email and jabber messages queued by other scripts. -* -* @package phpBB3 */ class queue extends \phpbb\cron\task\base { @@ -24,7 +26,7 @@ class queue extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext PHP file extension * @param \phpbb\config\config $config The config */ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) @@ -71,6 +73,6 @@ class queue extends \phpbb\cron\task\base */ public function should_run() { - return $this->config['last_queue_run'] < time() - $this->config['queue_interval_config']; + return $this->config['last_queue_run'] < time() - $this->config['queue_interval']; } } diff --git a/phpBB/phpbb/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php index a94a85db53..506a245f0f 100644 --- a/phpBB/phpbb/cron/task/core/tidy_cache.php +++ b/phpBB/phpbb/cron/task/core/tidy_cache.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\cron\task\core; /** * Tidy cache cron task. -* -* @package phpBB3 */ class tidy_cache extends \phpbb\cron\task\base { diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php index f712a5047c..949bba8012 100644 --- a/phpBB/phpbb/cron/task/core/tidy_database.php +++ b/phpBB/phpbb/cron/task/core/tidy_database.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\cron\task\core; /** * Tidy database cron task. -* -* @package phpBB3 */ class tidy_database extends \phpbb\cron\task\base { @@ -24,7 +26,7 @@ class tidy_database extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext The PHP file extension * @param \phpbb\config\config $config The config */ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) diff --git a/phpBB/phpbb/cron/task/core/tidy_plupload.php b/phpBB/phpbb/cron/task/core/tidy_plupload.php index 5a98e0bd7b..d7364374af 100644 --- a/phpBB/phpbb/cron/task/core/tidy_plupload.php +++ b/phpBB/phpbb/cron/task/core/tidy_plupload.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\cron\task\core; /** * Cron task for cleaning plupload's temporary upload directory. -* -* @package phpBB3 */ class tidy_plupload extends \phpbb\cron\task\base { @@ -65,6 +67,8 @@ class tidy_plupload extends \phpbb\cron\task\base */ public function run() { + global $user, $phpbb_log; + // Remove old temporary file (perhaps failed uploads?) $last_valid_timestamp = time() - $this->max_file_age; try @@ -86,13 +90,11 @@ class tidy_plupload extends \phpbb\cron\task\base } catch (\UnexpectedValueException $e) { - add_log( - 'critical', - 'LOG_PLUPLOAD_TIDY_FAILED', + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_PLUPLOAD_TIDY_FAILED', false, array( $this->plupload_upload_path, $e->getMessage(), $e->getTraceAsString() - ); + )); } $this->config->set('plupload_last_gc', time(), true); diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php index 42f7df308f..eb3970254f 100644 --- a/phpBB/phpbb/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,29 +17,63 @@ namespace phpbb\cron\task\core; * Tidy search cron task. * * Will only run when the currently selected search backend supports tidying. -* -* @package phpBB3 */ class tidy_search extends \phpbb\cron\task\base { + /** + * phpBB root path + * @var string + */ protected $phpbb_root_path; + + /** + * PHP file extension + * @var string + */ protected $php_ext; + + /** + * Auth object + * @var \phpbb\auth\auth + */ protected $auth; + + /** + * Config object + * @var \phpbb\config\config + */ protected $config; + + /** + * Database object + * @var \phpbb\db\driver\driver_interface + */ protected $db; + + /** + * User object + * @var \phpbb\user + */ protected $user; /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * Constructor. * - * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension - * @param \phpbb\auth\auth $auth The auth - * @param \phpbb\config\config $config The config - * @param \phpbb\db\driver\driver $db The db connection - * @param \phpbb\user $user The user + * @param string $phpbb_root_path The phpBB root path + * @param string $php_ext The PHP file extension + * @param \phpbb\auth\auth $auth The auth object + * @param \phpbb\config\config $config The config object + * @param \phpbb\db\driver\driver_interface $db The database object + * @param \phpbb\user $user The user object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher The event dispatcher object */ - public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\user $user) + public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -43,6 +81,7 @@ class tidy_search extends \phpbb\cron\task\base $this->config = $config; $this->db = $db; $this->user = $user; + $this->phpbb_dispatcher = $phpbb_dispatcher; } /** @@ -52,12 +91,11 @@ class tidy_search extends \phpbb\cron\task\base */ public function run() { - // Select the search method - $search_type = basename($this->config['search_type']); + $search_type = $this->config['search_type']; // We do some additional checks in the module to ensure it can actually be utilised $error = false; - $search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user); + $search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user, $this->phpbb_dispatcher); if (!$error) { @@ -76,10 +114,7 @@ class tidy_search extends \phpbb\cron\task\base */ public function is_runnable() { - // Select the search method - $search_type = basename($this->config['search_type']); - - return class_exists($search_type); + return class_exists($this->config['search_type']); } /** diff --git a/phpBB/phpbb/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php index 68094af1f7..5e6dabdabf 100644 --- a/phpBB/phpbb/cron/task/core/tidy_sessions.php +++ b/phpBB/phpbb/cron/task/core/tidy_sessions.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\cron\task\core; /** * Tidy sessions cron task. -* -* @package phpBB3 */ class tidy_sessions extends \phpbb\cron\task\base { diff --git a/phpBB/phpbb/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php index a0ff23fc57..7b67eae6ef 100644 --- a/phpBB/phpbb/cron/task/core/tidy_warnings.php +++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,8 +17,6 @@ namespace phpbb\cron\task\core; * Tidy warnings cron task. * * Will only run when warnings are configured to expire. -* -* @package phpBB3 */ class tidy_warnings extends \phpbb\cron\task\base { @@ -26,7 +28,7 @@ class tidy_warnings extends \phpbb\cron\task\base * Constructor. * * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension + * @param string $php_ext PHP file extension * @param \phpbb\config\config $config The config */ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) diff --git a/phpBB/phpbb/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php index 1aeead0399..7e190b9b86 100644 --- a/phpBB/phpbb/cron/task/parametrized.php +++ b/phpBB/phpbb/cron/task/parametrized.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,8 +21,6 @@ namespace phpbb\cron\task; * parametrized cron tasks perform actions on a particular object (or objects). * Parametrized cron tasks do not make sense and are not usable without * specifying these objects. -* -* @package phpBB3 */ interface parametrized extends \phpbb\cron\task\task { diff --git a/phpBB/phpbb/cron/task/task.php b/phpBB/phpbb/cron/task/task.php index 3ce3de9598..6d5a383d2d 100644 --- a/phpBB/phpbb/cron/task/task.php +++ b/phpBB/phpbb/cron/task/task.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\cron\task; /** * Cron task interface -* @package phpBB3 */ interface task { diff --git a/phpBB/phpbb/cron/task/text_reparser/reparser.php b/phpBB/phpbb/cron/task/text_reparser/reparser.php new file mode 100644 index 0000000000..aa644de827 --- /dev/null +++ b/phpBB/phpbb/cron/task/text_reparser/reparser.php @@ -0,0 +1,168 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\cron\task\text_reparser; + +/** + * Reparse text cron task + */ +class reparser extends \phpbb\cron\task\base +{ + const MIN = 1; + const SIZE = 100; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var \phpbb\config\db_text + */ + protected $config_text; + + /** + * @var \phpbb\lock\db + */ + protected $reparse_lock; + + /** + * @var \phpbb\textreparser\manager + */ + protected $reparser_manager; + + /** + * @var string + */ + protected $reparser_name; + + /** + * @var \phpbb\di\service_collection + */ + protected $reparsers; + + /** + * @var array + */ + protected $resume_data; + + /** + * Constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\config\db_text $config_text + * @param \phpbb\lock\db $reparse_lock + * @param \phpbb\textreparser\manager $reparser_manager + * @param \phpbb\di\service_collection $reparsers + */ + public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\lock\db $reparse_lock, \phpbb\textreparser\manager $reparser_manager, \phpbb\di\service_collection $reparsers) + { + $this->config = $config; + $this->config_text = $config_text; + $this->reparse_lock = $reparse_lock; + $this->reparser_manager = $reparser_manager; + $this->reparsers = $reparsers; + } + + /** + * Sets the reparser for this cron task + * + * @param string $reparser + */ + public function set_reparser($reparser) + { + $this->reparser_name = (!isset($this->reparsers[$reparser]) ? 'text_reparser.' : '') . $reparser; + + if ($this->resume_data === null) + { + $this->reparser_manager->get_resume_data($this->reparser_name); + } + } + + /** + * {@inheritdoc} + */ + public function is_runnable() + { + if ($this->resume_data === null) + { + $this->reparser_manager->get_resume_data($this->reparser_name); + } + + if (empty($this->resume_data['range-max']) || $this->resume_data['range-max'] >= $this->resume_data['range-min']) + { + return true; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function should_run() + { + if (!empty($this->config['reparse_lock'])) + { + $last_run = explode(' ', $this->config['reparse_lock']); + + if ($last_run[0] + 3600 >= time()) + { + return false; + } + } + + if ($this->config[$this->reparser_name . '_cron_interval']) + { + return $this->config[$this->reparser_name . '_last_cron'] < time() - $this->config[$this->reparser_name . '_cron_interval']; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function run() + { + if ($this->reparse_lock->acquire()) + { + if ($this->resume_data === null) + { + $this->resume_data = $this->reparser_manager->get_resume_data($this->reparser_name); + } + + /** + * @var \phpbb\textreparser\reparser_interface $reparser + */ + $reparser = $this->reparsers[$this->reparser_name]; + + $min = !empty($this->resume_data['range-min']) ? $this->resume_data['range-min'] : self::MIN; + $current = !empty($this->resume_data['range-max']) ? $this->resume_data['range-max'] : $reparser->get_max_id(); + $size = !empty($this->resume_data['range-size']) ? $this->resume_data['range-size'] : self::SIZE; + + if ($current >= $min) + { + $start = max($min, $current + 1 - $size); + $end = max($min, $current); + + $reparser->reparse_range($start, $end); + + $this->reparser_manager->update_resume_data($this->reparser_name, $min, $start - 1, $size); + } + + $this->config->set($this->reparser_name . '_last_cron', time()); + $this->reparse_lock->release(); + } + } +} diff --git a/phpBB/phpbb/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php index fc3f897206..8a4a8b1f0c 100644 --- a/phpBB/phpbb/cron/task/wrapper.php +++ b/phpBB/phpbb/cron/task/wrapper.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,8 +16,6 @@ namespace phpbb\cron\task; /** * Cron task wrapper class. * Enhances cron tasks with convenience methods that work identically for all tasks. -* -* @package phpBB3 */ class wrapper { @@ -27,6 +29,8 @@ class wrapper * Wraps a task $task, which must implement cron_task interface. * * @param \phpbb\cron\task\task $task The cron task to wrap. + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension */ public function __construct(\phpbb\cron\task\task $task, $phpbb_root_path, $php_ext) { diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index dfa21976e0..63cdba90fd 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -1,9 +1,14 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* */ namespace phpbb; @@ -33,9 +38,9 @@ class datetime extends \DateTime * Constructs a new instance of \phpbb\datetime, expanded to include an argument to inject * the user context and modify the timezone to the users selected timezone if one is not set. * + * @param user $user object for context. * @param string $time String in a format accepted by strtotime(). - * @param DateTimeZone $timezone Time zone of the time. - * @param user User object for context. + * @param \DateTimeZone $timezone Time zone of the time. */ public function __construct($user, $time = 'now', \DateTimeZone $timezone = null) { @@ -86,25 +91,28 @@ class datetime extends \DateTime $midnight = $midnight->getTimestamp(); - $day = false; - - if ($timestamp > $midnight + 86400) - { - $day = 'TOMORROW'; - } - else if ($timestamp > $midnight) - { - $day = 'TODAY'; - } - else if ($timestamp > $midnight - 86400) - { - $day = 'YESTERDAY'; - } - - if ($day !== false) + if ($timestamp <= $midnight + 2 * 86400) { - // Format using the short formatting and finally swap out the relative token placeholder with the correct value - return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang'])); + $day = false; + + if ($timestamp > $midnight + 86400) + { + $day = 'TOMORROW'; + } + else if ($timestamp > $midnight) + { + $day = 'TODAY'; + } + else if ($timestamp > $midnight - 86400) + { + $day = 'YESTERDAY'; + } + + if ($day !== false) + { + // Format using the short formatting and finally swap out the relative token placeholder with the correct value + return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang'])); + } } } } @@ -115,7 +123,7 @@ class datetime extends \DateTime /** * Magic method to convert DateTime object to string * - * @return Formatted date time, according to the users default settings. + * @return string Formatted date time, according to the users default settings. */ public function __toString() { diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index d721ed2eb7..30cb667344 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,9 +15,8 @@ namespace phpbb\db\driver; /** * Database Abstraction Layer -* @package dbal */ -class driver +abstract class driver implements driver_interface { var $db_connect_id; var $query_result; @@ -63,6 +66,15 @@ class driver */ var $sql_server_version = false; + const LOGICAL_OP = 0; + const STATEMENTS = 1; + const LEFT_STMT = 0; + const COMPARE_OP = 1; + const RIGHT_STMT = 2; + const SUBQUERY_OP = 3; + const SUBQUERY_SELECT_TYPE = 4; + const SUBQUERY_BUILD = 5; + /** * Constructor */ @@ -84,7 +96,103 @@ class driver } /** - * return on error or display error message + * {@inheritdoc} + */ + public function get_sql_layer() + { + return $this->sql_layer; + } + + /** + * {@inheritdoc} + */ + public function get_db_name() + { + return $this->dbname; + } + + /** + * {@inheritdoc} + */ + public function get_any_char() + { + return $this->any_char; + } + + /** + * {@inheritdoc} + */ + public function get_one_char() + { + return $this->one_char; + } + + /** + * {@inheritdoc} + */ + public function get_db_connect_id() + { + return $this->db_connect_id; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_triggered() + { + return $this->sql_error_triggered; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_sql() + { + return $this->sql_error_sql; + } + + /** + * {@inheritdoc} + */ + public function get_transaction() + { + return $this->transaction; + } + + /** + * {@inheritdoc} + */ + public function get_sql_time() + { + return $this->sql_time; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_returned() + { + return $this->sql_error_returned; + } + + /** + * {@inheritdoc} + */ + public function get_multi_insert() + { + return $this->multi_insert; + } + + /** + * {@inheritdoc} + */ + public function set_multi_insert($multi_insert) + { + $this->multi_insert = $multi_insert; + } + + /** + * {@inheritDoc} */ function sql_return_on_error($fail = false) { @@ -95,7 +203,7 @@ class driver } /** - * Return number of sql queries and cached sql queries used + * {@inheritDoc} */ function sql_num_queries($cached = false) { @@ -103,7 +211,7 @@ class driver } /** - * Add to query count + * {@inheritDoc} */ function sql_add_num_queries($cached = false) { @@ -113,7 +221,7 @@ class driver } /** - * DBAL garbage collection, close sql connection + * {@inheritDoc} */ function sql_close() { @@ -146,8 +254,7 @@ class driver } /** - * Build LIMIT query - * Doing some validation here. + * {@inheritDoc} */ function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) { @@ -164,7 +271,7 @@ class driver } /** - * Fetch all rows + * {@inheritDoc} */ function sql_fetchrowset($query_id = false) { @@ -173,7 +280,7 @@ class driver $query_id = $this->query_result; } - if ($query_id !== false) + if ($query_id) { $result = array(); while ($row = $this->sql_fetchrow($query_id)) @@ -188,8 +295,7 @@ class driver } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -205,7 +311,7 @@ class driver return $cache->sql_rowseek($rownum, $query_id); } - if ($query_id === false) + if (!$query_id) { return false; } @@ -213,7 +319,7 @@ class driver $this->sql_freeresult($query_id); $query_id = $this->sql_query($this->last_query_text); - if ($query_id === false) + if (!$query_id) { return false; } @@ -231,8 +337,7 @@ class driver } /** - * Fetch field - * if rownum is false, the current row is used, else it is pointing to the row (zero-based) + * {@inheritDoc} */ function sql_fetchfield($field, $rownum = false, $query_id = false) { @@ -243,7 +348,7 @@ class driver $query_id = $this->query_result; } - if ($query_id !== false) + if ($query_id) { if ($rownum !== false) { @@ -263,29 +368,29 @@ class driver } /** - * Correctly adjust LIKE expression for special characters - * Some DBMS are handling them in a different way - * - * @param string $expression The expression to use. Every wildcard is escaped, except $this->any_char and $this->one_char - * @return string LIKE expression including the keyword! + * {@inheritDoc} */ function sql_like_expression($expression) { - $expression = utf8_str_replace(array('_', '%'), array("\_", "\%"), $expression); - $expression = utf8_str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); + $expression = str_replace(array('_', '%'), array("\_", "\%"), $expression); + $expression = str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); return $this->_sql_like_expression('LIKE \'' . $this->sql_escape($expression) . '\''); } /** - * Build a case expression - * - * Note: The two statements action_true and action_false must have the same data type (int, vchar, ...) in the database! - * - * @param string $condition The condition which must be true, to use action_true rather then action_else - * @param string $action_true SQL expression that is used, if the condition is true - * @param string $action_else SQL expression that is used, if the condition is false, optional - * @return string CASE expression including the condition and statements + * {@inheritDoc} + */ + function sql_not_like_expression($expression) + { + $expression = str_replace(array('_', '%'), array("\_", "\%"), $expression); + $expression = str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); + + return $this->_sql_not_like_expression('NOT LIKE \'' . $this->sql_escape($expression) . '\''); + } + + /** + * {@inheritDoc} */ public function sql_case($condition, $action_true, $action_false = false) { @@ -297,11 +402,7 @@ class driver } /** - * Build a concatenated expression - * - * @param string $expr1 Base SQL expression where we append the second one - * @param string $expr2 SQL expression that is appended to the first expression - * @return string Concatenated string + * {@inheritDoc} */ public function sql_concatenate($expr1, $expr2) { @@ -309,9 +410,7 @@ class driver } /** - * Returns whether results of a query need to be buffered to run a transaction while iterating over them. - * - * @return bool Whether buffering is required. + * {@inheritDoc} */ function sql_buffer_nested_transactions() { @@ -319,15 +418,14 @@ class driver } /** - * SQL Transaction - * @access private + * {@inheritDoc} */ function sql_transaction($status = 'begin') { switch ($status) { case 'begin': - // If we are within a transaction we will not open another one, but enclose the current one to not loose data (prevening auto commit) + // If we are within a transaction we will not open another one, but enclose the current one to not loose data (preventing auto commit) if ($this->transaction) { $this->transactions++; @@ -345,14 +443,16 @@ class driver break; case 'commit': - // If there was a previously opened transaction we do not commit yet... but count back the number of inner transactions + // If there was a previously opened transaction we do not commit yet... + // but count back the number of inner transactions if ($this->transaction && $this->transactions) { $this->transactions--; return true; } - // Check if there is a transaction (no transaction can happen if there was an error, with a combined rollback and error returning enabled) + // Check if there is a transaction (no transaction can happen if + // there was an error, with a combined rollback and error returning enabled) // This implies we have transaction always set for autocommit db's if (!$this->transaction) { @@ -385,11 +485,7 @@ class driver } /** - * Build sql statement from array for insert/update/select statements - * - * Idea for this from Ikonboard - * Possible query values: INSERT, INSERT_SELECT, UPDATE, SELECT - * + * {@inheritDoc} */ function sql_build_array($query, $assoc_ary = false) { @@ -423,7 +519,7 @@ class driver { trigger_error('The MULTI_INSERT query value is no longer supported. Please use sql_multi_insert() instead.', E_USER_ERROR); } - else if ($query == 'UPDATE' || $query == 'SELECT') + else if ($query == 'UPDATE' || $query == 'SELECT' || $query == 'DELETE') { $values = array(); foreach ($assoc_ary as $key => $var) @@ -437,14 +533,7 @@ class driver } /** - * Build IN or NOT IN sql comparison string, uses <> or = on single element - * arrays to improve comparison speed - * - * @access public - * @param string $field name of the sql column that shall be compared - * @param array $array array of values that are allowed (IN) or not allowed (NOT IN) - * @param bool $negate true for NOT IN (), false for IN () (default) - * @param bool $allow_empty_set If true, allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false. + * {@inheritDoc} */ function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) { @@ -489,12 +578,7 @@ class driver } /** - * Run binary AND operator on DB column. - * Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}" - * - * @param string $column_name The column name to use - * @param int $bit The value to use for the AND operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29 - * @param string $compare Any custom SQL code after the check (for example "= 0") + * {@inheritDoc} */ function sql_bit_and($column_name, $bit, $compare = '') { @@ -507,12 +591,7 @@ class driver } /** - * Run binary OR operator on DB column. - * Results in sql statement: "{$column_name} | (1 << {$bit}) {$compare}" - * - * @param string $column_name The column name to use - * @param int $bit The value to use for the OR operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29 - * @param string $compare Any custom SQL code after the check (for example "= 0") + * {@inheritDoc} */ function sql_bit_or($column_name, $bit, $compare = '') { @@ -525,10 +604,7 @@ class driver } /** - * Returns SQL string to cast a string expression to an int. - * - * @param string $expression An expression evaluating to string - * @return string Expression returning an int + * {@inheritDoc} */ function cast_expr_to_bigint($expression) { @@ -536,10 +612,7 @@ class driver } /** - * Returns SQL string to cast an integer expression to a string. - * - * @param string $expression An expression evaluating to int - * @return string Expression returning a string + * {@inheritDoc} */ function cast_expr_to_string($expression) { @@ -547,11 +620,7 @@ class driver } /** - * Run LOWER() on DB column of type text (i.e. neither varchar nor char). - * - * @param string $column_name The column name to use - * - * @return string A SQL statement like "LOWER($column_name)" + * {@inheritDoc} */ function sql_lower_text($column_name) { @@ -559,13 +628,7 @@ class driver } /** - * Run more than one insert statement. - * - * @param string $table table name to run the statements on - * @param array $sql_ary multi-dimensional array holding the statement data. - * - * @return bool false if no statements were executed. - * @access public + * {@inheritDoc} */ function sql_multi_insert($table, $sql_ary) { @@ -637,9 +700,7 @@ class driver } /** - * Build sql statement from array for select and select distinct statements - * - * Possible query values: SELECT, SELECT_DISTINCT + * {@inheritDoc} */ function sql_build_query($query, $array) { @@ -722,7 +783,18 @@ class driver if (!empty($array['WHERE'])) { - $sql .= ' WHERE ' . $this->_sql_custom_build('WHERE', $array['WHERE']); + $sql .= ' WHERE '; + + if (is_array($array['WHERE'])) + { + $sql_where = $this->_process_boolean_tree_first($array['WHERE']); + } + else + { + $sql_where = $array['WHERE']; + } + + $sql .= $this->_sql_custom_build('WHERE', $sql_where); } if (!empty($array['GROUP_BY'])) @@ -741,8 +813,132 @@ class driver return $sql; } + + protected function _process_boolean_tree_first($operations_ary) + { + // In cases where an array exists but there is no head condition, + // it should be because there's only 1 WHERE clause. This seems the best way to deal with it. + if ($operations_ary[self::LOGICAL_OP] !== 'AND' && + $operations_ary[self::LOGICAL_OP] !== 'OR') + { + $operations_ary = array('AND', array($operations_ary)); + } + return $this->_process_boolean_tree($operations_ary) . "\n"; + } + + protected function _process_boolean_tree($operations_ary) + { + $operation = $operations_ary[self::LOGICAL_OP]; + + foreach ($operations_ary[self::STATEMENTS] as &$condition) + { + switch ($condition[self::LOGICAL_OP]) + { + case 'AND': + case 'OR': + + $condition = ' ( ' . $this->_process_boolean_tree($condition) . ') '; + + break; + case 'NOT': + + $condition = ' NOT (' . $this->_process_boolean_tree($condition) . ') '; + + break; + + default: + + switch (sizeof($condition)) + { + case 3: + + // Typical 3 element clause with {left hand} {operator} {right hand} + switch ($condition[self::COMPARE_OP]) + { + case 'IN': + case 'NOT_IN': + + // As this is used with an IN, assume it is a set of elements for sql_in_set() + $condition = $this->sql_in_set($condition[self::LEFT_STMT], $condition[self::RIGHT_STMT], $condition[self::COMPARE_OP] === 'NOT_IN', true); + + break; + + case 'LIKE': + + $condition = $condition[self::LEFT_STMT] . ' ' . $this->sql_like_expression($condition[self::RIGHT_STMT]) . ' '; + + break; + + case 'NOT_LIKE': + + $condition = $condition[self::LEFT_STMT] . ' ' . $this->sql_not_like_expression($condition[self::RIGHT_STMT]) . ' '; + + break; + + case 'IS_NOT': + + $condition[self::COMPARE_OP] = 'IS NOT'; + + // no break + case 'IS': + + // If the value is NULL, the string of it is the empty string ('') which is not the intended result. + // this should solve that + if ($condition[self::RIGHT_STMT] === null) + { + $condition[self::RIGHT_STMT] = 'NULL'; + } + + $condition = implode(' ', $condition); + + break; + + default: + + $condition = implode(' ', $condition); + + break; + } + + break; + + case 5: + + // Subquery with {left hand} {operator} {compare kind} {SELECT Kind } {Sub Query} + + $condition = $condition[self::LEFT_STMT] . ' ' . $condition[self::COMPARE_OP] . ' ' . $condition[self::SUBQUERY_OP] . ' ( '; + $condition .= $this->sql_build_query($condition[self::SUBQUERY_SELECT_TYPE], $condition[self::SUBQUERY_BUILD]); + $condition .= ' )'; + + break; + + default: + // This is an unpredicted clause setup. Just join all elements. + $condition = implode(' ', $condition); + + break; + } + + break; + } + + } + + if ($operation === 'NOT') + { + $operations_ary = implode("", $operations_ary[self::STATEMENTS]); + } + else + { + $operations_ary = implode(" \n $operation ", $operations_ary[self::STATEMENTS]); + } + + return $operations_ary; + } + + /** - * display sql error page + * {@inheritDoc} */ function sql_error($sql = '') { @@ -812,11 +1008,11 @@ class driver } /** - * Explain queries + * {@inheritDoc} */ function sql_report($mode, $query = '') { - global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper, $user; + global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper; global $request; if (is_object($request) && !$request->variable('explain', false)) @@ -872,7 +1068,7 @@ class driver </div> </div> <div id="page-footer"> - Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group + Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited </div> </div> </body> @@ -910,7 +1106,7 @@ class driver { if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) { - $this->sql_report .= 'Affected rows: <b>' . $this->sql_affectedrows($this->query_result) . '</b> | '; + $this->sql_report .= 'Affected rows: <b>' . $this->sql_affectedrows() . '</b> | '; } $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: <b>' . sprintf('%.5f', $endtime - $this->curtime) . 's</b>'; } @@ -1002,14 +1198,7 @@ class driver } /** - * Gets the estimated number of rows in a specified table. - * - * @param string $table_name Table name - * - * @return string Number of rows in $table_name. - * Prefixed with ~ if estimated (otherwise exact). - * - * @access public + * {@inheritDoc} */ function get_estimated_row_count($table_name) { @@ -1017,13 +1206,7 @@ class driver } /** - * Gets the exact number of rows in a specified table. - * - * @param string $table_name Table name - * - * @return string Exact number of rows in $table_name. - * - * @access public + * {@inheritDoc} */ function get_row_count($table_name) { diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php new file mode 100644 index 0000000000..8b487c5d42 --- /dev/null +++ b/phpBB/phpbb/db/driver/driver_interface.php @@ -0,0 +1,453 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +interface driver_interface +{ + /** + * Gets the name of the sql layer. + * + * @return string + */ + public function get_sql_layer(); + + /** + * Gets the name of the database. + * + * @return string + */ + public function get_db_name(); + + /** + * Wildcards for matching any (%) character within LIKE expressions + * + * @return string + */ + public function get_any_char(); + + /** + * Wildcards for matching exactly one (_) character within LIKE expressions + * + * @return string + */ + public function get_one_char(); + + /** + * Gets the time spent into the queries + * + * @return int + */ + public function get_sql_time(); + + /** + * Gets the connect ID. + * + * @return mixed + */ + public function get_db_connect_id(); + + /** + * Indicates if an error was triggered. + * + * @return bool + */ + public function get_sql_error_triggered(); + + /** + * Gets the last faulty query + * + * @return string + */ + public function get_sql_error_sql(); + + /** + * Indicates if we are in a transaction. + * + * @return bool + */ + public function get_transaction(); + + /** + * Gets the returned error. + * + * @return array + */ + public function get_sql_error_returned(); + + /** + * Indicates if multiple insertion can be used + * + * @return bool + */ + public function get_multi_insert(); + + /** + * Set if multiple insertion can be used + * + * @param bool $multi_insert + */ + public function set_multi_insert($multi_insert); + + /** + * Gets the exact number of rows in a specified table. + * + * @param string $table_name Table name + * @return string Exact number of rows in $table_name. + */ + public function get_row_count($table_name); + + /** + * Gets the estimated number of rows in a specified table. + * + * @param string $table_name Table name + * @return string Number of rows in $table_name. + * Prefixed with ~ if estimated (otherwise exact). + */ + public function get_estimated_row_count($table_name); + + /** + * Run LOWER() on DB column of type text (i.e. neither varchar nor char). + * + * @param string $column_name The column name to use + * @return string A SQL statement like "LOWER($column_name)" + */ + public function sql_lower_text($column_name); + + /** + * Display sql error page + * + * @param string $sql The SQL query causing the error + * @return mixed Returns the full error message, if $this->return_on_error + * is set, null otherwise + */ + public function sql_error($sql = ''); + + /** + * Returns whether results of a query need to be buffered to run a + * transaction while iterating over them. + * + * @return bool Whether buffering is required. + */ + public function sql_buffer_nested_transactions(); + + /** + * Run binary OR operator on DB column. + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the OR operator, + * will be converted to (1 << $bit). Is used by options, + * using the number schema... 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (e.g. "= 0") + * @return string A SQL statement like "$column | (1 << $bit) {$compare}" + */ + public function sql_bit_or($column_name, $bit, $compare = ''); + + /** + * Version information about used database + * + * @param bool $raw Only return the fetched sql_server_version + * @param bool $use_cache Is it safe to retrieve the value from the cache + * @return string sql server version + */ + public function sql_server_info($raw = false, $use_cache = true); + + /** + * Return on error or display error message + * + * @param bool $fail Should we return on errors, or stop + * @return null + */ + public function sql_return_on_error($fail = false); + + /** + * Build sql statement from an array + * + * @param string $query Should be on of the following strings: + * INSERT, INSERT_SELECT, UPDATE, SELECT, DELETE + * @param array $assoc_ary Array with "column => value" pairs + * @return string A SQL statement like "c1 = 'a' AND c2 = 'b'" + */ + public function sql_build_array($query, $assoc_ary = array()); + + /** + * Fetch all rows + * + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed Nested array if the query had rows, false otherwise + */ + public function sql_fetchrowset($query_id = false); + + /** + * SQL Transaction + * + * @param string $status Should be one of the following strings: + * begin, commit, rollback + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_transaction($status = 'begin'); + + /** + * Build a concatenated expression + * + * @param string $expr1 Base SQL expression where we append the second one + * @param string $expr2 SQL expression that is appended to the first expression + * @return string Concatenated string + */ + public function sql_concatenate($expr1, $expr2); + + /** + * Build a case expression + * + * Note: The two statements action_true and action_false must have the same + * data type (int, vchar, ...) in the database! + * + * @param string $condition The condition which must be true, + * to use action_true rather then action_else + * @param string $action_true SQL expression that is used, if the condition is true + * @param mixed $action_false SQL expression that is used, if the condition is false + * @return string CASE expression including the condition and statements + */ + public function sql_case($condition, $action_true, $action_false = false); + + /** + * Build sql statement from array for select and select distinct statements + * + * Possible query values: SELECT, SELECT_DISTINCT + * + * @param string $query Should be one of: SELECT, SELECT_DISTINCT + * @param array $array Array with the query data: + * SELECT A comma imploded list of columns to select + * FROM Array with "table => alias" pairs, + * (alias can also be an array) + * Optional: LEFT_JOIN Array of join entries: + * FROM Table that should be joined + * ON Condition for the join + * Optional: WHERE Where SQL statement + * Optional: GROUP_BY Group by SQL statement + * Optional: ORDER_BY Order by SQL statement + * @return string A SQL statement ready for execution + */ + public function sql_build_query($query, $array); + + /** + * Fetch field + * if rownum is false, the current row is used, else it is pointing to the row (zero-based) + * + * @param string $field Name of the column + * @param mixed $rownum Row number, if false the current row will be used + * and the row curser will point to the next row + * Note: $rownum is 0 based + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed String value of the field in the selected row, + * false, if the row does not exist + */ + public function sql_fetchfield($field, $rownum = false, $query_id = false); + + /** + * Fetch current row + * + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed Array with the current row, + * false, if the row does not exist + */ + public function sql_fetchrow($query_id = false); + + /** + * Returns SQL string to cast a string expression to an int. + * + * @param string $expression An expression evaluating to string + * @return string Expression returning an int + */ + public function cast_expr_to_bigint($expression); + + /** + * Get last inserted id after insert statement + * + * @return string Autoincrement value of the last inserted row + */ + public function sql_nextid(); + + /** + * Add to query count + * + * @param bool $cached Is this query cached? + * @return null + */ + public function sql_add_num_queries($cached = false); + + /** + * Build LIMIT query + * + * @param string $query The SQL query to execute + * @param int $total The number of rows to select + * @param int $offset + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0); + + /** + * Base query method + * + * @param string $query The SQL query to execute + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_query($query = '', $cache_ttl = 0); + + /** + * Returns SQL string to cast an integer expression to a string. + * + * @param string $expression An expression evaluating to int + * @return string Expression returning a string + */ + public function cast_expr_to_string($expression); + + /** + * Connect to server + * + * @param string $sqlserver Address of the database server + * @param string $sqluser User name of the SQL user + * @param string $sqlpassword Password of the SQL user + * @param string $database Name of the database + * @param mixed $port Port of the database server + * @param bool $persistency + * @param bool $new_link Should a new connection be established + * @return mixed Connection ID on success, string error message otherwise + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false); + + /** + * Run binary AND operator on DB column. + * Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}" + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the AND operator, + * will be converted to (1 << $bit). Is used by + * options, using the number schema: 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (for example "= 0") + * @return string A SQL statement like: "{$column} & (1 << {$bit}) {$compare}" + */ + public function sql_bit_and($column_name, $bit, $compare = ''); + + /** + * Free sql result + * + * @param mixed $query_id Already executed query result, + * if false, the last query will be used. + * @return null + */ + public function sql_freeresult($query_id = false); + + /** + * Return number of sql queries and cached sql queries used + * + * @param bool $cached Should we return the number of cached or normal queries? + * @return int Number of queries that have been executed + */ + public function sql_num_queries($cached = false); + + /** + * Run more than one insert statement. + * + * @param string $table Table name to run the statements on + * @param array $sql_ary Multi-dimensional array holding the statement data + * @return bool false if no statements were executed. + */ + public function sql_multi_insert($table, $sql_ary); + + /** + * Return number of affected rows + * + * @return mixed Number of the affected rows by the last query + * false if no query has been run before + */ + public function sql_affectedrows(); + + /** + * DBAL garbage collection, close SQL connection + * + * @return mixed False if no connection was opened before, + * Server response otherwise + */ + public function sql_close(); + + /** + * Seek to given row number + * + * @param mixed $rownum Row number the curser should point to + * Note: $rownum is 0 based + * @param mixed $query_id ID of the query to set the row cursor on + * if false, the last query will be used. + * $query_id will then be set correctly + * @return bool False if something went wrong + */ + public function sql_rowseek($rownum, &$query_id); + + /** + * Escape string used in sql query + * + * @param string $msg String to be escaped + * @return string Escaped version of $msg + */ + public function sql_escape($msg); + + /** + * Correctly adjust LIKE expression for special characters + * Some DBMS are handling them in a different way + * + * @param string $expression The expression to use. Every wildcard is + * escaped, except $this->any_char and $this->one_char + * @return string A SQL statement like: "LIKE 'bertie_%'" + */ + public function sql_like_expression($expression); + + /** + * Correctly adjust NOT LIKE expression for special characters + * Some DBMS are handling them in a different way + * + * @param string $expression The expression to use. Every wildcard is + * escaped, except $this->any_char and $this->one_char + * @return string A SQL statement like: "NOT LIKE 'bertie_%'" + */ + public function sql_not_like_expression($expression); + + /** + * Explain queries + * + * @param string $mode Available modes: display, start, stop, + * add_select_row, fromcache, record_fromcache + * @param string $query The Query that should be explained + * @return mixed Either a full HTML page, boolean or null + */ + public function sql_report($mode, $query = ''); + + /** + * Build IN or NOT IN sql comparison string, uses <> or = on single element + * arrays to improve comparison speed + * + * @param string $field Name of the sql column that shall be compared + * @param array $array Array of values that are (not) allowed + * @param bool $negate true for NOT IN (), false for IN () + * @param bool $allow_empty_set If true, allow $array to be empty, + * this function will return 1=1 or 1=0 then. + * @return string A SQL statement like: "IN (1, 2, 3, 4)" or "= 1" + */ + public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false); +} diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php new file mode 100644 index 0000000000..fb3a826254 --- /dev/null +++ b/phpBB/phpbb/db/driver/factory.php @@ -0,0 +1,443 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +use \Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Database Abstraction Layer +*/ +class factory implements driver_interface +{ + /** + * @var driver_interface + */ + protected $driver = null; + + /** + * @var ContainerInterface + */ + protected $container; + + /** + * Constructor. + * + * @param ContainerInterface $container A ContainerInterface instance + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Return the current driver (and retrieved it from the container if necessary) + * + * @return driver_interface + */ + protected function get_driver() + { + if ($this->driver === null) + { + $this->driver = $this->container->get('dbal.conn.driver'); + } + + return $this->driver; + } + + /** + * Set the current driver + * + * @param driver_interface $driver + */ + public function set_driver(driver_interface $driver) + { + $this->driver = $driver; + } + + /** + * {@inheritdoc} + */ + public function get_sql_layer() + { + return $this->get_driver()->get_sql_layer(); + } + + /** + * {@inheritdoc} + */ + public function get_db_name() + { + return $this->get_driver()->get_db_name(); + } + + /** + * {@inheritdoc} + */ + public function get_any_char() + { + return $this->get_driver()->get_any_char(); + } + + /** + * {@inheritdoc} + */ + public function get_one_char() + { + return $this->get_driver()->get_one_char(); + } + + /** + * {@inheritdoc} + */ + public function get_db_connect_id() + { + return $this->get_driver()->get_db_connect_id(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_triggered() + { + return $this->get_driver()->get_sql_error_triggered(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_sql() + { + return $this->get_driver()->get_sql_error_sql(); + } + + /** + * {@inheritdoc} + */ + public function get_transaction() + { + return $this->get_driver()->get_transaction(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_time() + { + return $this->get_driver()->get_sql_time(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_returned() + { + return $this->get_driver()->get_sql_error_returned(); + } + + /** + * {@inheritdoc} + */ + public function get_multi_insert() + { + return $this->get_driver()->get_multi_insert(); + } + + /** + * {@inheritdoc} + */ + public function set_multi_insert($multi_insert) + { + $this->get_driver()->set_multi_insert($multi_insert); + } + + /** + * {@inheritdoc} + */ + public function get_row_count($table_name) + { + return $this->get_driver()->get_row_count($table_name); + } + + /** + * {@inheritdoc} + */ + public function get_estimated_row_count($table_name) + { + return $this->get_driver()->get_estimated_row_count($table_name); + } + + /** + * {@inheritdoc} + */ + public function sql_lower_text($column_name) + { + return $this->get_driver()->sql_lower_text($column_name); + } + + /** + * {@inheritdoc} + */ + public function sql_error($sql = '') + { + return $this->get_driver()->sql_error($sql); + } + + /** + * {@inheritdoc} + */ + public function sql_buffer_nested_transactions() + { + return $this->get_driver()->sql_buffer_nested_transactions(); + } + + /** + * {@inheritdoc} + */ + public function sql_bit_or($column_name, $bit, $compare = '') + { + return $this->get_driver()->sql_bit_or($column_name, $bit, $compare); + } + + /** + * {@inheritdoc} + */ + public function sql_server_info($raw = false, $use_cache = true) + { + return $this->get_driver()->sql_server_info($raw, $use_cache); + } + + /** + * {@inheritdoc} + */ + public function sql_return_on_error($fail = false) + { + return $this->get_driver()->sql_return_on_error($fail); + } + + /** + * {@inheritdoc} + */ + public function sql_build_array($query, $assoc_ary = array()) + { + return $this->get_driver()->sql_build_array($query, $assoc_ary); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchrowset($query_id = false) + { + return $this->get_driver()->sql_fetchrowset($query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_transaction($status = 'begin') + { + return $this->get_driver()->sql_transaction($status); + } + + /** + * {@inheritdoc} + */ + public function sql_concatenate($expr1, $expr2) + { + return $this->get_driver()->sql_concatenate($expr1, $expr2); + } + + /** + * {@inheritdoc} + */ + public function sql_case($condition, $action_true, $action_false = false) + { + return $this->get_driver()->sql_case($condition, $action_true, $action_false); + } + + /** + * {@inheritdoc} + */ + public function sql_build_query($query, $array) + { + return $this->get_driver()->sql_build_query($query, $array); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchfield($field, $rownum = false, $query_id = false) + { + return $this->get_driver()->sql_fetchfield($field, $rownum, $query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchrow($query_id = false) + { + return $this->get_driver()->sql_fetchrow($query_id); + } + + /** + * {@inheritdoc} + */ + public function cast_expr_to_bigint($expression) + { + return $this->get_driver()->cast_expr_to_bigint($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_nextid() + { + return $this->get_driver()->sql_nextid(); + } + + /** + * {@inheritdoc} + */ + public function sql_add_num_queries($cached = false) + { + return $this->get_driver()->sql_add_num_queries($cached); + } + + /** + * {@inheritdoc} + */ + public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + return $this->get_driver()->sql_query_limit($query, $total, $offset, $cache_ttl); + } + + /** + * {@inheritdoc} + */ + public function sql_query($query = '', $cache_ttl = 0) + { + return $this->get_driver()->sql_query($query, $cache_ttl); + } + + /** + * {@inheritdoc} + */ + public function cast_expr_to_string($expression) + { + return $this->get_driver()->cast_expr_to_string($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + throw new \Exception('Disabled method.'); + } + + /** + * {@inheritdoc} + */ + public function sql_bit_and($column_name, $bit, $compare = '') + { + return $this->get_driver()->sql_bit_and($column_name, $bit, $compare); + } + + /** + * {@inheritdoc} + */ + public function sql_freeresult($query_id = false) + { + return $this->get_driver()->sql_freeresult($query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_num_queries($cached = false) + { + return $this->get_driver()->sql_num_queries($cached); + } + + /** + * {@inheritdoc} + */ + public function sql_multi_insert($table, $sql_ary) + { + return $this->get_driver()->sql_multi_insert($table, $sql_ary); + } + + /** + * {@inheritdoc} + */ + public function sql_affectedrows() + { + return $this->get_driver()->sql_affectedrows(); + } + + /** + * {@inheritdoc} + */ + public function sql_close() + { + return $this->get_driver()->sql_close(); + } + + /** + * {@inheritdoc} + */ + public function sql_rowseek($rownum, &$query_id) + { + return $this->get_driver()->sql_rowseek($rownum, $query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_escape($msg) + { + return $this->get_driver()->sql_escape($msg); + } + + /** + * {@inheritdoc} + */ + public function sql_like_expression($expression) + { + return $this->get_driver()->sql_like_expression($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_not_like_expression($expression) + { + return $this->get_driver()->sql_not_like_expression($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_report($mode, $query = '') + { + return $this->get_driver()->sql_report($mode, $query); + } + + /** + * {@inheritdoc} + */ + public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) + { + return $this->get_driver()->sql_in_set($field, $array, $negate, $allow_empty_set); + } +} diff --git a/phpBB/phpbb/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php deleted file mode 100644 index ed56a5d154..0000000000 --- a/phpBB/phpbb/db/driver/firebird.php +++ /dev/null @@ -1,532 +0,0 @@ -<?php -/** -* -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\db\driver; - -/** -* Firebird/Interbase Database Abstraction Layer -* Minimum Requirement is Firebird 2.1 -* @package dbal -*/ -class firebird extends \phpbb\db\driver\driver -{ - var $last_query_text = ''; - var $service_handle = false; - var $affected_rows = 0; - var $connect_error = ''; - - /** - * Connect to server - */ - function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) - { - $this->persistency = $persistency; - $this->user = $sqluser; - $this->server = $sqlserver . (($port) ? ':' . $port : ''); - $this->dbname = str_replace('\\', '/', $database); - - // There are three possibilities to connect to an interbase db - if (!$this->server) - { - $use_database = $this->dbname; - } - else if (strpos($this->server, '//') === 0) - { - $use_database = $this->server . $this->dbname; - } - else - { - $use_database = $this->server . ':' . $this->dbname; - } - - if ($this->persistency) - { - if (!function_exists('ibase_pconnect')) - { - $this->connect_error = 'ibase_pconnect function does not exist, is interbase extension installed?'; - return $this->sql_error(''); - } - $this->db_connect_id = @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3); - } - else - { - if (!function_exists('ibase_connect')) - { - $this->connect_error = 'ibase_connect function does not exist, is interbase extension installed?'; - return $this->sql_error(''); - } - $this->db_connect_id = @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3); - } - - // Do not call ibase_service_attach if connection failed, - // otherwise error message from ibase_(p)connect call will be clobbered. - if ($this->db_connect_id && function_exists('ibase_service_attach') && $this->server) - { - $this->service_handle = @ibase_service_attach($this->server, $this->user, $sqlpassword); - } - else - { - $this->service_handle = false; - } - - return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); - } - - /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache forced to false for Interbase - * @return string sql server version - */ - function sql_server_info($raw = false, $use_cache = true) - { - /** - * force $use_cache false. I didn't research why the caching code there is no caching code - * but I assume its because the IB extension provides a direct method to access it - * without a query. - */ - - $use_cache = false; - - if ($this->service_handle !== false && function_exists('ibase_server_info')) - { - return @ibase_server_info($this->service_handle, IBASE_SVC_SERVER_VERSION); - } - - return ($raw) ? '2.1' : 'Firebird/Interbase'; - } - - /** - * SQL Transaction - * @access private - */ - function _sql_transaction($status = 'begin') - { - switch ($status) - { - case 'begin': - return true; - break; - - case 'commit': - return @ibase_commit(); - break; - - case 'rollback': - return @ibase_rollback(); - break; - } - - return true; - } - - /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public - */ - function sql_query($query = '', $cache_ttl = 0) - { - if ($query != '') - { - global $cache; - - // EXPLAIN only in extra debug mode - if (defined('DEBUG')) - { - $this->sql_report('start', $query); - } - - $this->last_query_text = $query; - $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; - $this->sql_add_num_queries($this->query_result); - - if ($this->query_result === false) - { - $array = array(); - // We overcome Firebird's 32767 char limit by binding vars - if (strlen($query) > 32767) - { - if (preg_match('/^(INSERT INTO[^(]++)\\(([^()]+)\\) VALUES[^(]++\\((.*?)\\)$/s', $query, $regs)) - { - if (strlen($regs[3]) > 32767) - { - preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER); - - $inserts = $vals[0]; - unset($vals); - - foreach ($inserts as $key => $value) - { - if (!empty($value) && $value[0] === "'" && strlen($value) > 32769) // check to see if this thing is greater than the max + 'x2 - { - $inserts[$key] = '?'; - $array[] = str_replace("''", "'", substr($value, 1, -1)); - } - } - - $query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')'; - } - } - else if (preg_match('/^(UPDATE ([\\w_]++)\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|\\d+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+)\\s+(WHERE.*)$/s', $query, $data)) - { - if (strlen($data[3]) > 32767) - { - $update = $data[1]; - $where = $data[4]; - preg_match_all('/(\\w++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|[\d-.]++)/', $data[3], $temp, PREG_SET_ORDER); - unset($data); - - $cols = array(); - foreach ($temp as $value) - { - if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 32769) // check to see if this thing is greater than the max + 'x2 - { - $array[] = str_replace("''", "'", substr($value[2], 1, -1)); - $cols[] = $value[1] . '=?'; - } - else - { - $cols[] = $value[1] . '=' . $value[2]; - } - } - - $query = $update . implode(', ', $cols) . ' ' . $where; - unset($cols); - } - } - } - - if (!function_exists('ibase_affected_rows') && (preg_match('/^UPDATE ([\w_]++)\s+SET [\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\s*[\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+\s+(WHERE.*)?$/s', $query, $regs) || preg_match('/^DELETE FROM ([\w_]++)\s*(WHERE\s*.*)?$/s', $query, $regs))) - { - $affected_sql = 'SELECT COUNT(*) as num_rows_affected FROM ' . $regs[1]; - if (!empty($regs[2])) - { - $affected_sql .= ' ' . $regs[2]; - } - - if (!($temp_q_id = @ibase_query($this->db_connect_id, $affected_sql))) - { - return false; - } - - $temp_result = @ibase_fetch_assoc($temp_q_id); - @ibase_free_result($temp_q_id); - - $this->affected_rows = ($temp_result) ? $temp_result['NUM_ROWS_AFFECTED'] : false; - } - - if (sizeof($array)) - { - $p_query = @ibase_prepare($this->db_connect_id, $query); - array_unshift($array, $p_query); - $this->query_result = call_user_func_array('ibase_execute', $array); - unset($array); - - if ($this->query_result === false) - { - $this->sql_error($query); - } - } - else if (($this->query_result = @ibase_query($this->db_connect_id, $query)) === false) - { - $this->sql_error($query); - } - - if (defined('DEBUG')) - { - $this->sql_report('stop', $query); - } - - if (!$this->transaction) - { - if (function_exists('ibase_commit_ret')) - { - @ibase_commit_ret(); - } - else - { - // way cooler than ibase_commit_ret :D - @ibase_query('COMMIT RETAIN;'); - } - } - - if ($cache && $cache_ttl) - { - $this->open_queries[(int) $this->query_result] = $this->query_result; - $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); - } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) - { - $this->open_queries[(int) $this->query_result] = $this->query_result; - } - } - else if (defined('DEBUG')) - { - $this->sql_report('fromcache', $query); - } - } - else - { - return false; - } - - return $this->query_result; - } - - /** - * Build LIMIT query - */ - function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) - { - $this->query_result = false; - - $query = 'SELECT FIRST ' . $total . ((!empty($offset)) ? ' SKIP ' . $offset : '') . substr($query, 6); - - return $this->sql_query($query, $cache_ttl); - } - - /** - * Return number of affected rows - */ - function sql_affectedrows() - { - // PHP 5+ function - if (function_exists('ibase_affected_rows')) - { - return ($this->db_connect_id) ? @ibase_affected_rows($this->db_connect_id) : false; - } - else - { - return $this->affected_rows; - } - } - - /** - * Fetch current row - */ - function sql_fetchrow($query_id = false) - { - global $cache; - - if ($query_id === false) - { - $query_id = $this->query_result; - } - - if ($cache && $cache->sql_exists($query_id)) - { - return $cache->sql_fetchrow($query_id); - } - - if ($query_id === false) - { - return false; - } - - $row = array(); - $cur_row = @ibase_fetch_object($query_id, IBASE_TEXT); - - if (!$cur_row) - { - return false; - } - - foreach (get_object_vars($cur_row) as $key => $value) - { - $row[strtolower($key)] = (is_string($value)) ? trim(str_replace(array("\\0", "\\n"), array("\0", "\n"), $value)) : $value; - } - - return (sizeof($row)) ? $row : false; - } - - /** - * Get last inserted id after insert statement - */ - function sql_nextid() - { - $query_id = $this->query_result; - - if ($query_id !== false && $this->last_query_text != '') - { - if ($this->query_result && preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#i', $this->last_query_text, $tablename)) - { - $sql = 'SELECT GEN_ID(' . $tablename[1] . '_gen, 0) AS new_id FROM RDB$DATABASE'; - - if (!($temp_q_id = @ibase_query($this->db_connect_id, $sql))) - { - return false; - } - - $temp_result = @ibase_fetch_assoc($temp_q_id); - @ibase_free_result($temp_q_id); - - return ($temp_result) ? $temp_result['NEW_ID'] : false; - } - } - - return false; - } - - /** - * Free sql result - */ - function sql_freeresult($query_id = false) - { - global $cache; - - if ($query_id === false) - { - $query_id = $this->query_result; - } - - if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) - { - return $cache->sql_freeresult($query_id); - } - - if (isset($this->open_queries[(int) $query_id])) - { - unset($this->open_queries[(int) $query_id]); - return @ibase_free_result($query_id); - } - - return false; - } - - /** - * Escape string used in sql query - */ - function sql_escape($msg) - { - return str_replace(array("'", "\0"), array("''", ''), $msg); - } - - /** - * Build LIKE expression - * @access private - */ - function _sql_like_expression($expression) - { - return $expression . " ESCAPE '\\'"; - } - - /** - * Build db-specific query data - * @access private - */ - function _sql_custom_build($stage, $data) - { - return $data; - } - - function _sql_bit_and($column_name, $bit, $compare = '') - { - return 'BIN_AND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); - } - - function _sql_bit_or($column_name, $bit, $compare = '') - { - return 'BIN_OR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); - } - - /** - * @inheritdoc - */ - function cast_expr_to_bigint($expression) - { - // Precision must be from 1 to 18 - return 'CAST(' . $expression . ' as DECIMAL(18, 0))'; - } - - /** - * @inheritdoc - */ - function cast_expr_to_string($expression) - { - return 'CAST(' . $expression . ' as VARCHAR(255))'; - } - - /** - * return sql error array - * @access private - */ - function _sql_error() - { - // Need special handling here because ibase_errmsg returns - // connection errors, however if the interbase extension - // is not installed then ibase_errmsg does not exist and - // we cannot call it. - if (function_exists('ibase_errmsg')) - { - $msg = @ibase_errmsg(); - if (!$msg) - { - $msg = $this->connect_error; - } - } - else - { - $msg = $this->connect_error; - } - return array( - 'message' => $msg, - 'code' => (@function_exists('ibase_errcode') ? @ibase_errcode() : '') - ); - } - - /** - * Close sql connection - * @access private - */ - function _sql_close() - { - if ($this->service_handle !== false) - { - @ibase_service_detach($this->service_handle); - } - - return @ibase_close($this->db_connect_id); - } - - /** - * Build db-specific report - * @access private - */ - function _sql_report($mode, $query = '') - { - switch ($mode) - { - case 'start': - break; - - case 'fromcache': - $endtime = explode(' ', microtime()); - $endtime = $endtime[0] + $endtime[1]; - - $result = @ibase_query($this->db_connect_id, $query); - while ($void = @ibase_fetch_object($result, IBASE_TEXT)) - { - // Take the time spent on parsing rows into account - } - @ibase_free_result($result); - - $splittime = explode(' ', microtime()); - $splittime = $splittime[0] + $splittime[1]; - - $this->sql_report('record_fromcache', $query, $endtime, $splittime); - - break; - } - } -} diff --git a/phpBB/phpbb/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php index 6ebc891673..dfdbfe15e6 100644 --- a/phpBB/phpbb/db/driver/mssql.php +++ b/phpBB/phpbb/db/driver/mssql.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,14 +16,13 @@ namespace phpbb\db\driver; /** * MSSQL Database Abstraction Layer * Minimum Requirement is MSSQL 2000+ -* @package dbal */ class mssql extends \phpbb\db\driver\driver { var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -55,10 +58,7 @@ class mssql extends \phpbb\db\driver\driver } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache If true, it is safe to retrieve the value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -71,8 +71,8 @@ class mssql extends \phpbb\db\driver\driver $row = false; if ($result_id) { - $row = @mssql_fetch_assoc($result_id); - @mssql_free_result($result_id); + $row = mssql_fetch_assoc($result_id); + mssql_free_result($result_id); } $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; @@ -124,13 +124,7 @@ class mssql extends \phpbb\db\driver\driver } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -143,6 +137,10 @@ class mssql extends \phpbb\db\driver\driver { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); @@ -158,13 +156,22 @@ class mssql extends \phpbb\db\driver\driver { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } if ($cache && $cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) + else if (strpos($query, 'SELECT') === 0 && $this->query_result !== true) { $this->open_queries[(int) $this->query_result] = $this->query_result; } @@ -215,7 +222,7 @@ class mssql extends \phpbb\db\driver\driver } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -223,7 +230,7 @@ class mssql extends \phpbb\db\driver\driver } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -239,12 +246,12 @@ class mssql extends \phpbb\db\driver\driver return $cache->sql_fetchrow($query_id); } - if ($query_id === false) + if (!$query_id || $query_id === true) { return false; } - $row = @mssql_fetch_assoc($query_id); + $row = mssql_fetch_assoc($query_id); // I hope i am able to remove this later... hopefully only a PHP or MSSQL bug if ($row) @@ -259,8 +266,7 @@ class mssql extends \phpbb\db\driver\driver } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -271,35 +277,40 @@ class mssql extends \phpbb\db\driver\driver $query_id = $this->query_result; } + if ($query_id === true) + { + return false; + } + if ($cache && $cache->sql_exists($query_id)) { return $cache->sql_rowseek($rownum, $query_id); } - return ($query_id !== false) ? @mssql_data_seek($query_id, $rownum) : false; + return ($query_id) ? @mssql_data_seek($query_id, $rownum) : false; } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { $result_id = @mssql_query('SELECT SCOPE_IDENTITY()', $this->db_connect_id); if ($result_id) { - if ($row = @mssql_fetch_assoc($result_id)) + if ($row = mssql_fetch_assoc($result_id)) { - @mssql_free_result($result_id); + mssql_free_result($result_id); return $row['computed']; } - @mssql_free_result($result_id); + mssql_free_result($result_id); } return false; } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -310,6 +321,11 @@ class mssql extends \phpbb\db\driver\driver $query_id = $this->query_result; } + if ($query_id === true) + { + return false; + } + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) { return $cache->sql_freeresult($query_id); @@ -318,14 +334,14 @@ class mssql extends \phpbb\db\driver\driver if (isset($this->open_queries[(int) $query_id])) { unset($this->open_queries[(int) $query_id]); - return @mssql_free_result($query_id); + return mssql_free_result($query_id); } return false; } /** - * Escape string used in sql query + * {@inheritDoc} */ function sql_escape($msg) { @@ -350,6 +366,15 @@ class mssql extends \phpbb\db\driver\driver } /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + /** * return sql error array * @access private */ @@ -366,9 +391,9 @@ class mssql extends \phpbb\db\driver\driver $result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id); if ($result_id) { - $row = @mssql_fetch_assoc($result_id); + $row = mssql_fetch_assoc($result_id); $error['code'] = $row['code']; - @mssql_free_result($result_id); + mssql_free_result($result_id); } // Get full error message if possible @@ -379,12 +404,12 @@ class mssql extends \phpbb\db\driver\driver if ($result_id) { - $row = @mssql_fetch_assoc($result_id); + $row = mssql_fetch_assoc($result_id); if (!empty($row['message'])) { $error['message'] .= '<br />' . $row['message']; } - @mssql_free_result($result_id); + mssql_free_result($result_id); } } else @@ -430,13 +455,13 @@ class mssql extends \phpbb\db\driver\driver if ($result = @mssql_query($query, $this->db_connect_id)) { @mssql_next_result($result); - while ($row = @mssql_fetch_row($result)) + while ($row = mssql_fetch_row($result)) { $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } } @mssql_query('SET SHOWPLAN_TEXT OFF;', $this->db_connect_id); - @mssql_free_result($result); + mssql_free_result($result); if ($html_table) { @@ -449,11 +474,14 @@ class mssql extends \phpbb\db\driver\driver $endtime = $endtime[0] + $endtime[1]; $result = @mssql_query($query, $this->db_connect_id); - while ($void = @mssql_fetch_assoc($result)) + if ($result) { - // Take the time spent on parsing rows into account + while ($void = mssql_fetch_assoc($result)) + { + // Take the time spent on parsing rows into account + } + mssql_free_result($result); } - @mssql_free_result($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php index 113f1c6902..514df9eaca 100644 --- a/phpBB/phpbb/db/driver/mssql_base.php +++ b/phpBB/phpbb/db/driver/mssql_base.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\db\driver; /** * MSSQL Database Base Abstraction Layer -* @package dbal */ abstract class mssql_base extends \phpbb\db\driver\driver { @@ -24,7 +27,7 @@ abstract class mssql_base extends \phpbb\db\driver\driver } /** - * Escape string used in sql query + * {@inheritDoc} */ function sql_escape($msg) { @@ -49,6 +52,15 @@ abstract class mssql_base extends \phpbb\db\driver\driver } /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + /** * Build db-specific query data * @access private */ diff --git a/phpBB/phpbb/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php index f8c70f1cd7..9d9ad603e0 100644 --- a/phpBB/phpbb/db/driver/mssql_odbc.php +++ b/phpBB/phpbb/db/driver/mssql_odbc.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,8 +21,6 @@ namespace phpbb\db\driver; * @note number of bytes returned for returning data depends on odbc.defaultlrl php.ini setting. * If it is limited to 4K for example only 4K of data is returned max, resulting in incomplete theme data for example. * @note odbc.defaultbinmode may affect UTF8 characters -* -* @package dbal */ class mssql_odbc extends \phpbb\db\driver\mssql_base { @@ -26,7 +28,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -83,10 +85,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache If true, it is safe to retrieve the value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -99,8 +98,8 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base $row = false; if ($result_id) { - $row = @odbc_fetch_array($result_id); - @odbc_free_result($result_id); + $row = odbc_fetch_array($result_id); + odbc_free_result($result_id); } $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; @@ -144,13 +143,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -163,6 +156,10 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->last_query_text = $query; $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; @@ -179,13 +176,22 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } if ($cache && $cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) + else if (strpos($query, 'SELECT') === 0) { $this->open_queries[(int) $this->query_result] = $this->query_result; } @@ -236,7 +242,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -244,8 +250,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base } /** - * Fetch current row - * @note number of bytes returned depends on odbc.defaultlrl php.ini setting. If it is limited to 4K for example only 4K of data is returned max. + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -261,11 +266,11 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base return $cache->sql_fetchrow($query_id); } - return ($query_id !== false) ? @odbc_fetch_array($query_id) : false; + return ($query_id) ? odbc_fetch_array($query_id) : false; } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { @@ -273,20 +278,20 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base if ($result_id) { - if (@odbc_fetch_array($result_id)) + if (odbc_fetch_array($result_id)) { - $id = @odbc_result($result_id, 1); - @odbc_free_result($result_id); + $id = odbc_result($result_id, 1); + odbc_free_result($result_id); return $id; } - @odbc_free_result($result_id); + odbc_free_result($result_id); } return false; } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -305,7 +310,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base if (isset($this->open_queries[(int) $query_id])) { unset($this->open_queries[(int) $query_id]); - return @odbc_free_result($query_id); + return odbc_free_result($query_id); } return false; @@ -360,11 +365,14 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base $endtime = $endtime[0] + $endtime[1]; $result = @odbc_exec($this->db_connect_id, $query); - while ($void = @odbc_fetch_array($result)) + if ($result) { - // Take the time spent on parsing rows into account + while ($void = odbc_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + odbc_free_result($result); } - @odbc_free_result($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 125db9c8d4..50dce35baa 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -1,10 +1,17 @@ <?php /** * -* @package dbal -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. * +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** * This is the MS SQL Server Native database abstraction layer. * PHP mssql native driver required. * @author Chris Pucci @@ -13,9 +20,6 @@ namespace phpbb\db\driver; -/** -* @package dbal -*/ class mssqlnative extends \phpbb\db\driver\mssql_base { var $m_insert_id = null; @@ -24,7 +28,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -53,10 +57,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache If true, it is safe to retrieve the value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -113,13 +114,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -132,6 +127,10 @@ class mssqlnative extends \phpbb\db\driver\mssql_base { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->last_query_text = $query; $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; @@ -150,13 +149,22 @@ class mssqlnative extends \phpbb\db\driver\mssql_base { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } if ($cache && $cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) + else if (strpos($query, 'SELECT') === 0) { $this->open_queries[(int) $this->query_result] = $this->query_result; } @@ -215,7 +223,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -223,7 +231,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -239,12 +247,12 @@ class mssqlnative extends \phpbb\db\driver\mssql_base return $cache->sql_fetchrow($query_id); } - if ($query_id === false) + if (!$query_id) { return false; } - $row = @sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); + $row = sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); if ($row) { @@ -263,17 +271,17 @@ class mssqlnative extends \phpbb\db\driver\mssql_base } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { $result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY'); - if ($result_id !== false) + if ($result_id) { - $row = @sqlsrv_fetch_array($result_id); + $row = sqlsrv_fetch_array($result_id); $id = $row[0]; - @sqlsrv_free_stmt($result_id); + sqlsrv_free_stmt($result_id); return $id; } else @@ -283,7 +291,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -302,7 +310,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base if (isset($this->open_queries[(int) $query_id])) { unset($this->open_queries[(int) $query_id]); - return @sqlsrv_free_stmt($query_id); + return sqlsrv_free_stmt($query_id); } return false; @@ -324,10 +332,10 @@ class mssqlnative extends \phpbb\db\driver\mssql_base { foreach ($errors as $error) { - $error_message .= "SQLSTATE: " . $error[ 'SQLSTATE'] . "\n"; - $error_message .= "code: " . $error[ 'code'] . "\n"; + $error_message .= "SQLSTATE: " . $error['SQLSTATE'] . "\n"; + $error_message .= "code: " . $error['code'] . "\n"; $code = $error['code']; - $error_message .= "message: " . $error[ 'message'] . "\n"; + $error_message .= "message: " . $error['message'] . "\n"; } $this->last_error_result = $error_message; $error = $this->last_error_result; @@ -375,14 +383,14 @@ class mssqlnative extends \phpbb\db\driver\mssql_base @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;'); if ($result = @sqlsrv_query($this->db_connect_id, $query)) { - @sqlsrv_next_result($result); - while ($row = @sqlsrv_fetch_array($result)) + sqlsrv_next_result($result); + while ($row = sqlsrv_fetch_array($result)) { $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } + sqlsrv_free_stmt($result); } @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;'); - @sqlsrv_free_stmt($result); if ($html_table) { @@ -395,11 +403,14 @@ class mssqlnative extends \phpbb\db\driver\mssql_base $endtime = $endtime[0] + $endtime[1]; $result = @sqlsrv_query($this->db_connect_id, $query); - while ($void = @sqlsrv_fetch_array($result)) + if ($result) { - // Take the time spent on parsing rows into account + while ($void = sqlsrv_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + sqlsrv_free_stmt($result); } - @sqlsrv_free_stmt($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php index e311f0dd74..a94e88b331 100644 --- a/phpBB/phpbb/db/driver/mysql.php +++ b/phpBB/phpbb/db/driver/mysql.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,7 +20,6 @@ namespace phpbb\db\driver; * MySQL 4.0+ * MySQL 4.1+ * MySQL 5.0+ -* @package dbal */ class mysql extends \phpbb\db\driver\mysql_base { @@ -24,8 +27,7 @@ class mysql extends \phpbb\db\driver\mysql_base var $connect_error = ''; /** - * Connect to server - * @access public + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -68,9 +70,16 @@ class mysql extends \phpbb\db\driver\mysql_base if (version_compare($this->sql_server_info(true), '5.0.2', '>=')) { $result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id); - $row = @mysql_fetch_assoc($result); - @mysql_free_result($result); - $modes = array_map('trim', explode(',', $row['sql_mode'])); + if ($result) + { + $row = mysql_fetch_assoc($result); + mysql_free_result($result); + $modes = array_map('trim', explode(',', $row['sql_mode'])); + } + else + { + $modes = array(); + } // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES if (!in_array('TRADITIONAL', $modes)) @@ -103,10 +112,7 @@ class mysql extends \phpbb\db\driver\mysql_base } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache If true, it is safe to retrieve the value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -115,14 +121,17 @@ class mysql extends \phpbb\db\driver\mysql_base if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysql_version')) === false) { $result = @mysql_query('SELECT VERSION() AS version', $this->db_connect_id); - $row = @mysql_fetch_assoc($result); - @mysql_free_result($result); + if ($result) + { + $row = mysql_fetch_assoc($result); + mysql_free_result($result); - $this->sql_server_version = $row['version']; + $this->sql_server_version = $row['version']; - if (!empty($cache) && $use_cache) - { - $cache->put('mysql_version', $this->sql_server_version); + if (!empty($cache) && $use_cache) + { + $cache->put('mysql_version', $this->sql_server_version); + } } } @@ -154,13 +163,7 @@ class mysql extends \phpbb\db\driver\mysql_base } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -173,6 +176,10 @@ class mysql extends \phpbb\db\driver\mysql_base { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); @@ -188,13 +195,22 @@ class mysql extends \phpbb\db\driver\mysql_base { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } if ($cache && $cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) + else if (strpos($query, 'SELECT') === 0) { $this->open_queries[(int) $this->query_result] = $this->query_result; } @@ -213,15 +229,34 @@ class mysql extends \phpbb\db\driver\mysql_base } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { - return ($this->db_connect_id) ? @mysql_affected_rows($this->db_connect_id) : false; + if ($this->db_connect_id) + { + // We always want the number of matched rows + // instead of changed rows, when running an update. + // So when mysql_info() returns the number of matched rows + // we return that one instead of mysql_affected_rows() + $mysql_info = @mysql_info($this->db_connect_id); + if ($mysql_info !== false) + { + $match = array(); + preg_match('#^Rows matched: (\d)+ Changed: (\d)+ Warnings: (\d)+$#', $mysql_info, $match); + if (isset($match[1])) + { + return $match[1]; + } + } + + return @mysql_affected_rows($this->db_connect_id); + } + return false; } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -237,12 +272,11 @@ class mysql extends \phpbb\db\driver\mysql_base return $cache->sql_fetchrow($query_id); } - return ($query_id !== false) ? @mysql_fetch_assoc($query_id) : false; + return ($query_id) ? mysql_fetch_assoc($query_id) : false; } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -262,7 +296,7 @@ class mysql extends \phpbb\db\driver\mysql_base } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { @@ -270,7 +304,7 @@ class mysql extends \phpbb\db\driver\mysql_base } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -289,14 +323,14 @@ class mysql extends \phpbb\db\driver\mysql_base if (isset($this->open_queries[(int) $query_id])) { unset($this->open_queries[(int) $query_id]); - return @mysql_free_result($query_id); + return mysql_free_result($query_id); } return false; } /** - * Escape string used in sql query + * {@inheritDoc} */ function sql_escape($msg) { @@ -392,12 +426,12 @@ class mysql extends \phpbb\db\driver\mysql_base if ($result = @mysql_query("EXPLAIN $explain_query", $this->db_connect_id)) { - while ($row = @mysql_fetch_assoc($result)) + while ($row = mysql_fetch_assoc($result)) { $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } + mysql_free_result($result); } - @mysql_free_result($result); if ($html_table) { @@ -412,7 +446,7 @@ class mysql extends \phpbb\db\driver\mysql_base if ($result = @mysql_query('SHOW PROFILE ALL;', $this->db_connect_id)) { $this->html_hold .= '<br />'; - while ($row = @mysql_fetch_assoc($result)) + while ($row = mysql_fetch_assoc($result)) { // make <unknown> HTML safe if (!empty($row['Source_function'])) @@ -430,8 +464,8 @@ class mysql extends \phpbb\db\driver\mysql_base } $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } + mysql_free_result($result); } - @mysql_free_result($result); if ($html_table) { @@ -449,11 +483,14 @@ class mysql extends \phpbb\db\driver\mysql_base $endtime = $endtime[0] + $endtime[1]; $result = @mysql_query($query, $this->db_connect_id); - while ($void = @mysql_fetch_assoc($result)) + if ($result) { - // Take the time spent on parsing rows into account + while ($void = mysql_fetch_assoc($result)) + { + // Take the time spent on parsing rows into account + } + mysql_free_result($result); } - @mysql_free_result($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php index 87b6d153a9..5e0b359134 100644 --- a/phpBB/phpbb/db/driver/mysql_base.php +++ b/phpBB/phpbb/db/driver/mysql_base.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\db\driver; /** * Abstract MySQL Database Base Abstraction Layer -* @package dbal */ abstract class mysql_base extends \phpbb\db\driver\driver { @@ -43,14 +46,7 @@ abstract class mysql_base extends \phpbb\db\driver\driver } /** - * Gets the estimated number of rows in a specified table. - * - * @param string $table_name Table name - * - * @return string Number of rows in $table_name. - * Prefixed with ~ if estimated (otherwise exact). - * - * @access public + * {@inheritDoc} */ function get_estimated_row_count($table_name) { @@ -72,13 +68,7 @@ abstract class mysql_base extends \phpbb\db\driver\driver } /** - * Gets the exact number of rows in a specified table. - * - * @param string $table_name Table name - * - * @return string Exact number of rows in $table_name. - * - * @access public + * {@inheritDoc} */ function get_row_count($table_name) { @@ -122,6 +112,15 @@ abstract class mysql_base extends \phpbb\db\driver\driver } /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression; + } + + /** * Build db-specific query data * @access private */ diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php index adc8f96302..d43e201526 100644 --- a/phpBB/phpbb/db/driver/mysqli.php +++ b/phpBB/phpbb/db/driver/mysqli.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,7 +17,6 @@ namespace phpbb\db\driver; * MySQLi Database Abstraction Layer * mysqli-extension has to be compiled with: * MySQL 4.1+ or MySQL 5.0+ -* @package dbal */ class mysqli extends \phpbb\db\driver\mysql_base { @@ -21,7 +24,7 @@ class mysqli extends \phpbb\db\driver\mysql_base var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -31,8 +34,7 @@ class mysqli extends \phpbb\db\driver\mysql_base return $this->sql_error(''); } - // Mysqli extension supports persistent connection since PHP 5.3.0 - $this->persistency = (version_compare(PHP_VERSION, '5.3.0', '>=')) ? $persistency : false; + $this->persistency = $persistency; $this->user = $sqluser; // If persistent connection, set dbhost to localhost when empty and prepend it with 'p:' prefix @@ -57,7 +59,12 @@ class mysqli extends \phpbb\db\driver\mysql_base } } - $this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket); + $this->db_connect_id = mysqli_init(); + + if (!@mysqli_real_connect($this->db_connect_id, $this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket, MYSQLI_CLIENT_FOUND_ROWS)) + { + $this->db_connect_id = ''; + } if ($this->db_connect_id && $this->dbname != '') { @@ -67,10 +74,17 @@ class mysqli extends \phpbb\db\driver\mysql_base if (version_compare($this->sql_server_info(true), '5.0.2', '>=')) { $result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode'); - $row = @mysqli_fetch_assoc($result); - @mysqli_free_result($result); + if ($result) + { + $row = mysqli_fetch_assoc($result); + mysqli_free_result($result); - $modes = array_map('trim', explode(',', $row['sql_mode'])); + $modes = array_map('trim', explode(',', $row['sql_mode'])); + } + else + { + $modes = array(); + } // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES if (!in_array('TRADITIONAL', $modes)) @@ -96,10 +110,7 @@ class mysqli extends \phpbb\db\driver\mysql_base } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache If true, it is safe to retrieve the value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -108,14 +119,17 @@ class mysqli extends \phpbb\db\driver\mysql_base if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false) { $result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version'); - $row = @mysqli_fetch_assoc($result); - @mysqli_free_result($result); + if ($result) + { + $row = mysqli_fetch_assoc($result); + mysqli_free_result($result); - $this->sql_server_version = $row['version']; + $this->sql_server_version = $row['version']; - if (!empty($cache) && $use_cache) - { - $cache->put('mysqli_version', $this->sql_server_version); + if (!empty($cache) && $use_cache) + { + $cache->put('mysqli_version', $this->sql_server_version); + } } } @@ -151,13 +165,7 @@ class mysqli extends \phpbb\db\driver\mysql_base } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -170,6 +178,10 @@ class mysqli extends \phpbb\db\driver\mysql_base { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); @@ -185,6 +197,15 @@ class mysqli extends \phpbb\db\driver\mysql_base { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } if ($cache && $cache_ttl) { @@ -205,7 +226,7 @@ class mysqli extends \phpbb\db\driver\mysql_base } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -213,7 +234,7 @@ class mysqli extends \phpbb\db\driver\mysql_base } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -229,9 +250,9 @@ class mysqli extends \phpbb\db\driver\mysql_base return $cache->sql_fetchrow($query_id); } - if ($query_id !== false) + if ($query_id) { - $result = @mysqli_fetch_assoc($query_id); + $result = mysqli_fetch_assoc($query_id); return $result !== null ? $result : false; } @@ -239,8 +260,7 @@ class mysqli extends \phpbb\db\driver\mysql_base } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -256,11 +276,11 @@ class mysqli extends \phpbb\db\driver\mysql_base return $cache->sql_rowseek($rownum, $query_id); } - return ($query_id !== false) ? @mysqli_data_seek($query_id, $rownum) : false; + return ($query_id) ? @mysqli_data_seek($query_id, $rownum) : false; } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { @@ -268,7 +288,7 @@ class mysqli extends \phpbb\db\driver\mysql_base } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -284,11 +304,21 @@ class mysqli extends \phpbb\db\driver\mysql_base return $cache->sql_freeresult($query_id); } - return @mysqli_free_result($query_id); + if (!$query_id) + { + return false; + } + + if ($query_id === true) + { + return true; + } + + return mysqli_free_result($query_id); } /** - * Escape string used in sql query + * {@inheritDoc} */ function sql_escape($msg) { @@ -383,12 +413,12 @@ class mysqli extends \phpbb\db\driver\mysql_base if ($result = @mysqli_query($this->db_connect_id, "EXPLAIN $explain_query")) { - while ($row = @mysqli_fetch_assoc($result)) + while ($row = mysqli_fetch_assoc($result)) { $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } + mysqli_free_result($result); } - @mysqli_free_result($result); if ($html_table) { @@ -403,7 +433,7 @@ class mysqli extends \phpbb\db\driver\mysql_base if ($result = @mysqli_query($this->db_connect_id, 'SHOW PROFILE ALL;')) { $this->html_hold .= '<br />'; - while ($row = @mysqli_fetch_assoc($result)) + while ($row = mysqli_fetch_assoc($result)) { // make <unknown> HTML safe if (!empty($row['Source_function'])) @@ -421,8 +451,8 @@ class mysqli extends \phpbb\db\driver\mysql_base } $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } + mysqli_free_result($result); } - @mysqli_free_result($result); if ($html_table) { @@ -440,11 +470,14 @@ class mysqli extends \phpbb\db\driver\mysql_base $endtime = $endtime[0] + $endtime[1]; $result = @mysqli_query($this->db_connect_id, $query); - while ($void = @mysqli_fetch_assoc($result)) + if ($result) { - // Take the time spent on parsing rows into account + while ($void = mysqli_fetch_assoc($result)) + { + // Take the time spent on parsing rows into account + } + mysqli_free_result($result); } - @mysqli_free_result($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index 36ed43d4a7..54238a15ef 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\db\driver; /** * Oracle Database Abstraction Layer -* @package dbal */ class oracle extends \phpbb\db\driver\driver { @@ -19,7 +22,7 @@ class oracle extends \phpbb\db\driver\driver var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -72,10 +75,7 @@ class oracle extends \phpbb\db\driver\driver } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache forced to false for Oracle - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -84,8 +84,6 @@ class oracle extends \phpbb\db\driver\driver * but I assume its because the Oracle extension provides a direct method to access it * without a query. */ - - $use_cache = false; /* global $cache; @@ -240,13 +238,7 @@ class oracle extends \phpbb\db\driver\driver } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -259,6 +251,10 @@ class oracle extends \phpbb\db\driver\driver { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->last_query_text = $query; $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; @@ -436,13 +432,22 @@ class oracle extends \phpbb\db\driver\driver { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } if ($cache && $cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) + else if (strpos($query, 'SELECT') === 0) { $this->open_queries[(int) $this->query_result] = $this->query_result; } @@ -473,7 +478,7 @@ class oracle extends \phpbb\db\driver\driver } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -481,7 +486,7 @@ class oracle extends \phpbb\db\driver\driver } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -497,10 +502,10 @@ class oracle extends \phpbb\db\driver\driver return $cache->sql_fetchrow($query_id); } - if ($query_id !== false) + if ($query_id) { $row = array(); - $result = @ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); + $result = ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); if (!$result || !$row) { @@ -532,8 +537,7 @@ class oracle extends \phpbb\db\driver\driver } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -549,7 +553,7 @@ class oracle extends \phpbb\db\driver\driver return $cache->sql_rowseek($rownum, $query_id); } - if ($query_id === false) + if (!$query_id) { return false; } @@ -570,7 +574,7 @@ class oracle extends \phpbb\db\driver\driver } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { @@ -582,18 +586,24 @@ class oracle extends \phpbb\db\driver\driver { $query = 'SELECT ' . $tablename[1] . '_seq.currval FROM DUAL'; $stmt = @ociparse($this->db_connect_id, $query); - @ociexecute($stmt, OCI_DEFAULT); + if ($stmt) + { + $success = @ociexecute($stmt, OCI_DEFAULT); - $temp_result = @ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS); - @ocifreestatement($stmt); + if ($success) + { + $temp_result = ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS); + ocifreestatement($stmt); - if ($temp_result) - { - return $temp_array['CURRVAL']; - } - else - { - return false; + if ($temp_result) + { + return $temp_array['CURRVAL']; + } + else + { + return false; + } + } } } } @@ -602,7 +612,7 @@ class oracle extends \phpbb\db\driver\driver } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -621,14 +631,14 @@ class oracle extends \phpbb\db\driver\driver if (isset($this->open_queries[(int) $query_id])) { unset($this->open_queries[(int) $query_id]); - return @ocifreestatement($query_id); + return ocifreestatement($query_id); } return false; } /** - * Escape string used in sql query + * {@inheritDoc} */ function sql_escape($msg) { @@ -644,6 +654,15 @@ class oracle extends \phpbb\db\driver\driver return $expression . " ESCAPE '\\'"; } + /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + function _sql_custom_build($stage, $data) { return $data; @@ -777,14 +796,20 @@ class oracle extends \phpbb\db\driver\driver $endtime = $endtime[0] + $endtime[1]; $result = @ociparse($this->db_connect_id, $query); - $success = @ociexecute($result, OCI_DEFAULT); - $row = array(); - - while (@ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS)) + if ($result) { - // Take the time spent on parsing rows into account + $success = @ociexecute($result, OCI_DEFAULT); + if ($success) + { + $row = array(); + + while (ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS)) + { + // Take the time spent on parsing rows into account + } + @ocifreestatement($result); + } } - @ocifreestatement($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 5dbd1ca74f..44476612c3 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,16 +15,16 @@ namespace phpbb\db\driver; /** * PostgreSQL Database Abstraction Layer -* Minimum Requirement is Version 7.3+ -* @package dbal +* Minimum Requirement is Version 8.3+ */ class postgres extends \phpbb\db\driver\driver { + var $multi_insert = true; var $last_query_text = ''; var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -98,11 +102,6 @@ class postgres extends \phpbb\db\driver\driver if ($this->db_connect_id) { - if (version_compare($this->sql_server_info(true), '8.2', '>=')) - { - $this->multi_insert = true; - } - if ($schema !== '') { @pg_query($this->db_connect_id, 'SET search_path TO ' . $schema); @@ -115,10 +114,7 @@ class postgres extends \phpbb\db\driver\driver } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache If true, it is safe to retrieve the value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -127,14 +123,17 @@ class postgres extends \phpbb\db\driver\driver if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false) { $query_id = @pg_query($this->db_connect_id, 'SELECT VERSION() AS version'); - $row = @pg_fetch_assoc($query_id, null); - @pg_free_result($query_id); + if ($query_id) + { + $row = pg_fetch_assoc($query_id, null); + pg_free_result($query_id); - $this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0; + $this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0; - if (!empty($cache) && $use_cache) - { - $cache->put('pgsql_version', $this->sql_server_version); + if (!empty($cache) && $use_cache) + { + $cache->put('pgsql_version', $this->sql_server_version); + } } } @@ -166,13 +165,7 @@ class postgres extends \phpbb\db\driver\driver } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -185,6 +178,10 @@ class postgres extends \phpbb\db\driver\driver { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->last_query_text = $query; $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; @@ -201,13 +198,22 @@ class postgres extends \phpbb\db\driver\driver { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } if ($cache && $cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) + else if (strpos($query, 'SELECT') === 0) { $this->open_queries[(int) $this->query_result] = $this->query_result; } @@ -253,7 +259,7 @@ class postgres extends \phpbb\db\driver\driver } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -261,7 +267,7 @@ class postgres extends \phpbb\db\driver\driver } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -277,12 +283,11 @@ class postgres extends \phpbb\db\driver\driver return $cache->sql_fetchrow($query_id); } - return ($query_id !== false) ? @pg_fetch_assoc($query_id, null) : false; + return ($query_id) ? pg_fetch_assoc($query_id, null) : false; } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -298,11 +303,11 @@ class postgres extends \phpbb\db\driver\driver return $cache->sql_rowseek($rownum, $query_id); } - return ($query_id !== false) ? @pg_result_seek($query_id, $rownum) : false; + return ($query_id) ? @pg_result_seek($query_id, $rownum) : false; } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { @@ -320,8 +325,8 @@ class postgres extends \phpbb\db\driver\driver return false; } - $temp_result = @pg_fetch_assoc($temp_q_id, null); - @pg_free_result($query_id); + $temp_result = pg_fetch_assoc($temp_q_id, null); + pg_free_result($query_id); return ($temp_result) ? $temp_result['last_value'] : false; } @@ -331,7 +336,7 @@ class postgres extends \phpbb\db\driver\driver } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -350,15 +355,14 @@ class postgres extends \phpbb\db\driver\driver if (isset($this->open_queries[(int) $query_id])) { unset($this->open_queries[(int) $query_id]); - return @pg_free_result($query_id); + return pg_free_result($query_id); } return false; } /** - * Escape string used in sql query - * Note: Do not use for bytea values if we may use them at a later stage + * {@inheritDoc} */ function sql_escape($msg) { @@ -375,7 +379,16 @@ class postgres extends \phpbb\db\driver\driver } /** - * @inheritdoc + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression; + } + + /** + * {@inheritDoc} */ function cast_expr_to_bigint($expression) { @@ -383,7 +396,7 @@ class postgres extends \phpbb\db\driver\driver } /** - * @inheritdoc + * {@inheritDoc} */ function cast_expr_to_string($expression) { @@ -448,12 +461,12 @@ class postgres extends \phpbb\db\driver\driver if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query")) { - while ($row = @pg_fetch_assoc($result, null)) + while ($row = pg_fetch_assoc($result, null)) { $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } + pg_free_result($result); } - @pg_free_result($result); if ($html_table) { @@ -468,11 +481,14 @@ class postgres extends \phpbb\db\driver\driver $endtime = $endtime[0] + $endtime[1]; $result = @pg_query($this->db_connect_id, $query); - while ($void = @pg_fetch_assoc($result, null)) + if ($result) { - // Take the time spent on parsing rows into account + while ($void = pg_fetch_assoc($result, null)) + { + // Take the time spent on parsing rows into account + } + pg_free_result($result); } - @pg_free_result($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php index 59ec895c0f..8e205ebb81 100644 --- a/phpBB/phpbb/db/driver/sqlite.php +++ b/phpBB/phpbb/db/driver/sqlite.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,14 +16,13 @@ namespace phpbb\db\driver; /** * Sqlite Database Abstraction Layer * Minimum Requirement: 2.8.2+ -* @package dbal */ class sqlite extends \phpbb\db\driver\driver { var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -58,10 +61,7 @@ class sqlite extends \phpbb\db\driver\driver } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache if true, it is safe to retrieve the stored value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -70,13 +70,16 @@ class sqlite extends \phpbb\db\driver\driver if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false) { $result = @sqlite_query('SELECT sqlite_version() AS version', $this->db_connect_id); - $row = @sqlite_fetch_array($result, SQLITE_ASSOC); + if ($result) + { + $row = sqlite_fetch_array($result, SQLITE_ASSOC); - $this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0; + $this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0; - if (!empty($cache) && $use_cache) - { - $cache->put('sqlite_version', $this->sql_server_version); + if (!empty($cache) && $use_cache) + { + $cache->put('sqlite_version', $this->sql_server_version); + } } } @@ -108,13 +111,7 @@ class sqlite extends \phpbb\db\driver\driver } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -127,6 +124,10 @@ class sqlite extends \phpbb\db\driver\driver { $this->sql_report('start', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); @@ -142,15 +143,19 @@ class sqlite extends \phpbb\db\driver\driver { $this->sql_report('stop', $query); } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } - if ($cache && $cache_ttl) + if (!$this->query_result) { - $this->open_queries[(int) $this->query_result] = $this->query_result; - $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + return false; } - else if (strpos($query, 'SELECT') === 0 && $this->query_result) + + if ($cache && $cache_ttl) { - $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } } else if (defined('DEBUG')) @@ -185,7 +190,7 @@ class sqlite extends \phpbb\db\driver\driver } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -193,7 +198,7 @@ class sqlite extends \phpbb\db\driver\driver } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -209,12 +214,11 @@ class sqlite extends \phpbb\db\driver\driver return $cache->sql_fetchrow($query_id); } - return ($query_id !== false) ? @sqlite_fetch_array($query_id, SQLITE_ASSOC) : false; + return ($query_id) ? sqlite_fetch_array($query_id, SQLITE_ASSOC) : false; } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -230,11 +234,11 @@ class sqlite extends \phpbb\db\driver\driver return $cache->sql_rowseek($rownum, $query_id); } - return ($query_id !== false) ? @sqlite_seek($query_id, $rownum) : false; + return ($query_id) ? @sqlite_seek($query_id, $rownum) : false; } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { @@ -242,7 +246,7 @@ class sqlite extends \phpbb\db\driver\driver } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -262,7 +266,7 @@ class sqlite extends \phpbb\db\driver\driver } /** - * Escape string used in sql query + * {@inheritDoc} */ function sql_escape($msg) { @@ -270,12 +274,13 @@ class sqlite extends \phpbb\db\driver\driver } /** - * Correctly adjust LIKE expression for special characters + * {@inheritDoc} + * * For SQLite an underscore is a not-known character... this may change with SQLite3 */ function sql_like_expression($expression) { - // Unlike LIKE, GLOB is case sensitive (unfortunatly). SQLite users need to live with it! + // Unlike LIKE, GLOB is unfortunately case sensitive. // We only catch * and ? here, not the character map possible on file globbing. $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); @@ -286,6 +291,23 @@ class sqlite extends \phpbb\db\driver\driver } /** + * {@inheritDoc} + * + * For SQLite an underscore is a not-known character... + */ + function sql_not_like_expression($expression) + { + // Unlike NOT LIKE, NOT GLOB is unfortunately case sensitive. + // We only catch * and ? here, not the character map possible on file globbing. + $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); + + $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression); + $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression); + + return 'NOT GLOB \'' . $this->sql_escape($expression) . '\''; + } + + /** * return sql error array * @access private */ @@ -343,9 +365,12 @@ class sqlite extends \phpbb\db\driver\driver $endtime = $endtime[0] + $endtime[1]; $result = @sqlite_query($query, $this->db_connect_id); - while ($void = @sqlite_fetch_array($result, SQLITE_ASSOC)) + if ($result) { - // Take the time spent on parsing rows into account + while ($void = sqlite_fetch_array($result, SQLITE_ASSOC)) + { + // Take the time spent on parsing rows into account + } } $splittime = explode(' ', microtime()); diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php new file mode 100644 index 0000000000..0508500c52 --- /dev/null +++ b/phpBB/phpbb/db/driver/sqlite3.php @@ -0,0 +1,431 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* SQLite3 Database Abstraction Layer +* Minimum Requirement: 3.6.15+ +*/ +class sqlite3 extends \phpbb\db\driver\driver +{ + /** + * @var string Stores errors during connection setup in case the driver is not available + */ + protected $connect_error = ''; + + /** + * @var \SQLite3 The SQLite3 database object to operate against + */ + protected $dbo = null; + + /** + * {@inheritDoc} + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = false; + $this->user = $sqluser; + $this->server = $sqlserver . (($port) ? ':' . $port : ''); + $this->dbname = $database; + + if (!class_exists('SQLite3', false)) + { + $this->connect_error = 'SQLite3 not found, is the extension installed?'; + return $this->sql_error(''); + } + + try + { + $this->dbo = new \SQLite3($this->server, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); + $this->dbo->busyTimeout(60000); + $this->db_connect_id = true; + } + catch (\Exception $e) + { + $this->connect_error = $e->getMessage(); + return array('message' => $this->connect_error); + } + + return true; + } + + /** + * {@inheritDoc} + */ + public function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false) + { + $version = \SQLite3::version(); + + $this->sql_server_version = $version['versionString']; + + if (!empty($cache) && $use_cache) + { + $cache->put('sqlite_version', $this->sql_server_version); + } + } + + return ($raw) ? $this->sql_server_version : 'SQLite ' . $this->sql_server_version; + } + + /** + * SQL Transaction + * + * @param string $status Should be one of the following strings: + * begin, commit, rollback + * @return bool Success/failure of the transaction query + */ + protected function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return $this->dbo->exec('BEGIN IMMEDIATE'); + break; + + case 'commit': + return $this->dbo->exec('COMMIT'); + break; + + case 'rollback': + return @$this->dbo->exec('ROLLBACK'); + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + public function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG')) + { + $this->sql_report('start', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if ($this->transaction === true && strpos($query, 'INSERT') === 0) + { + $query = preg_replace('/^INSERT INTO/', 'INSERT OR ROLLBACK INTO', $query); + } + + if (($this->query_result = @$this->dbo->query($query)) === false) + { + // Try to recover a lost database connection + if ($this->dbo && !@$this->dbo->lastErrorMsg()) + { + if ($this->sql_connect($this->server, $this->user, '', $this->dbname)) + { + $this->query_result = @$this->dbo->query($query); + } + } + + if ($this->query_result === false) + { + $this->sql_error($query); + } + } + + if (defined('DEBUG')) + { + $this->sql_report('stop', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + } + else if (defined('DEBUG')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build LIMIT query + * + * @param string $query The SQL query to execute + * @param int $total The number of rows to select + * @param int $offset + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + protected function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // if $total is set to 0 we do not want to limit the number of rows + if ($total == 0) + { + $total = -1; + } + + $query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total); + + return $this->sql_query($query, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + public function sql_affectedrows() + { + return ($this->db_connect_id) ? $this->dbo->changes() : false; + } + + /** + * {@inheritDoc} + */ + public function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + /** @var \SQLite3Result $query_id */ + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + return is_object($query_id) ? @$query_id->fetchArray(SQLITE3_ASSOC) : false; + } + + /** + * {@inheritDoc} + */ + public function sql_nextid() + { + return ($this->db_connect_id) ? $this->dbo->lastInsertRowID() : false; + } + + /** + * {@inheritDoc} + */ + public function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if ($query_id) + { + return @$query_id->finalize(); + } + } + + /** + * {@inheritDoc} + */ + public function sql_escape($msg) + { + return \SQLite3::escapeString($msg); + } + + /** + * {@inheritDoc} + * + * For SQLite an underscore is an unknown character. + */ + public function sql_like_expression($expression) + { + // Unlike LIKE, GLOB is unfortunately case sensitive. + // We only catch * and ? here, not the character map possible on file globbing. + $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); + + $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression); + $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression); + + return 'GLOB \'' . $this->sql_escape($expression) . '\''; + } + + /** + * {@inheritDoc} + * + * For SQLite an underscore is an unknown character. + */ + public function sql_not_like_expression($expression) + { + // Unlike NOT LIKE, NOT GLOB is unfortunately case sensitive + // We only catch * and ? here, not the character map possible on file globbing. + $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); + + $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression); + $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression); + + return 'NOT GLOB \'' . $this->sql_escape($expression) . '\''; + } + + /** + * return sql error array + * + * @return array + */ + protected function _sql_error() + { + if (class_exists('SQLite3', false) && isset($this->dbo)) + { + $error = array( + 'message' => $this->dbo->lastErrorMsg(), + 'code' => $this->dbo->lastErrorCode(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Build db-specific query data + * + * @param string $stage Available stages: FROM, WHERE + * @param mixed $data A string containing the CROSS JOIN query or an array of WHERE clauses + * + * @return string The db-specific query fragment + */ + protected function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Close sql connection + * + * @return bool False if failure + */ + protected function _sql_close() + { + return $this->dbo->close(); + } + + /** + * Build db-specific report + * + * @param string $mode Available modes: display, start, stop, + * add_select_row, fromcache, record_fromcache + * @param string $query The Query that should be explained + * @return mixed Either a full HTML page, boolean or null + */ + protected function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $explain_query = $query; + if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + + if (preg_match('/^SELECT/', $explain_query)) + { + $html_table = false; + + if ($result = $this->dbo->query("EXPLAIN QUERY PLAN $explain_query")) + { + while ($row = $result->fetchArray(SQLITE3_ASSOC)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + } + + if ($html_table) + { + $this->html_hold .= '</table>'; + } + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = $this->dbo->query($query); + if ($result) + { + while ($void = $result->fetchArray(SQLITE3_ASSOC)) + { + // Take the time spent on parsing rows into account + } + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/phpBB/phpbb/db/extractor/base_extractor.php b/phpBB/phpbb/db/extractor/base_extractor.php new file mode 100644 index 0000000000..547c85f066 --- /dev/null +++ b/phpBB/phpbb/db/extractor/base_extractor.php @@ -0,0 +1,252 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\invalid_format_exception; +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +/** + * Abstract base class for database extraction + */ +abstract class base_extractor implements extractor_interface +{ + /** + * @var string phpBB root path + */ + protected $phpbb_root_path; + + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var bool + */ + protected $download; + + /** + * @var bool + */ + protected $store; + + /** + * @var int + */ + protected $time; + + /** + * @var string + */ + protected $format; + + /** + * @var resource + */ + protected $fp; + + /** + * @var string + */ + protected $write; + + /** + * @var string + */ + protected $close; + + /** + * @var bool + */ + protected $run_comp; + + /** + * @var bool + */ + protected $is_initialized; + + /** + * Constructor + * + * @param string $phpbb_root_path + * @param \phpbb\request\request_interface $request + * @param \phpbb\db\driver\driver_interface $db + */ + public function __construct($phpbb_root_path, \phpbb\request\request_interface $request, \phpbb\db\driver\driver_interface $db) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->request = $request; + $this->db = $db; + $this->fp = null; + + $this->is_initialized = false; + } + + /** + * {@inheritdoc} + */ + public function init_extractor($format, $filename, $time, $download = false, $store = false) + { + $this->download = $download; + $this->store = $store; + $this->time = $time; + $this->format = $format; + + switch ($format) + { + case 'text': + $ext = '.sql'; + $open = 'fopen'; + $this->write = 'fwrite'; + $this->close = 'fclose'; + $mimetype = 'text/x-sql'; + break; + case 'bzip2': + $ext = '.sql.bz2'; + $open = 'bzopen'; + $this->write = 'bzwrite'; + $this->close = 'bzclose'; + $mimetype = 'application/x-bzip2'; + break; + case 'gzip': + $ext = '.sql.gz'; + $open = 'gzopen'; + $this->write = 'gzwrite'; + $this->close = 'gzclose'; + $mimetype = 'application/x-gzip'; + break; + default: + throw new invalid_format_exception(); + break; + } + + if ($download === true) + { + $name = $filename . $ext; + header('Cache-Control: private, no-cache'); + header("Content-Type: $mimetype; name=\"$name\""); + header("Content-disposition: attachment; filename=$name"); + + switch ($format) + { + case 'bzip2': + ob_start(); + break; + + case 'gzip': + if (strpos($this->request->header('Accept-Encoding'), 'gzip') !== false && strpos(strtolower($this->request->header('User-Agent')), 'msie') === false) + { + ob_start('ob_gzhandler'); + } + else + { + $this->run_comp = true; + } + break; + } + } + + if ($store === true) + { + $file = $this->phpbb_root_path . 'store/' . $filename . $ext; + + $this->fp = $open($file, 'w'); + + if (!$this->fp) + { + trigger_error('FILE_WRITE_FAIL', E_USER_ERROR); + } + } + + $this->is_initialized = true; + } + + /** + * {@inheritdoc} + */ + public function write_end() + { + static $close; + + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($this->store) + { + if ($close === null) + { + $close = $this->close; + } + $close($this->fp); + } + + // bzip2 must be written all the way at the end + if ($this->download && $this->format === 'bzip2') + { + $c = ob_get_clean(); + echo bzcompress($c); + } + } + + /** + * {@inheritdoc} + */ + public function flush($data) + { + static $write; + + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($this->store === true) + { + if ($write === null) + { + $write = $this->write; + } + $write($this->fp, $data); + } + + if ($this->download === true) + { + if ($this->format === 'bzip2' || $this->format === 'text' || ($this->format === 'gzip' && !$this->run_comp)) + { + echo $data; + } + + // we can write the gzip data as soon as we get it + if ($this->format === 'gzip') + { + if ($this->run_comp) + { + echo gzencode($data); + } + else + { + ob_flush(); + flush(); + } + } + } + } +} diff --git a/phpBB/phpbb/db/extractor/exception/extractor_not_initialized_exception.php b/phpBB/phpbb/db/extractor/exception/extractor_not_initialized_exception.php new file mode 100644 index 0000000000..62eb434be1 --- /dev/null +++ b/phpBB/phpbb/db/extractor/exception/extractor_not_initialized_exception.php @@ -0,0 +1,24 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor\exception; + +use phpbb\exception\runtime_exception; + +/** +* This exception is thrown when invalid format is given to the extractor +*/ +class extractor_not_initialized_exception extends runtime_exception +{ + +} diff --git a/phpBB/phpbb/db/extractor/exception/invalid_format_exception.php b/phpBB/phpbb/db/extractor/exception/invalid_format_exception.php new file mode 100644 index 0000000000..6be24cb5dc --- /dev/null +++ b/phpBB/phpbb/db/extractor/exception/invalid_format_exception.php @@ -0,0 +1,22 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor\exception; + +/** +* This exception is thrown when invalid format is given to the extractor +*/ +class invalid_format_exception extends \InvalidArgumentException +{ + +} diff --git a/phpBB/phpbb/db/extractor/extractor_interface.php b/phpBB/phpbb/db/extractor/extractor_interface.php new file mode 100644 index 0000000000..ff45df9bb7 --- /dev/null +++ b/phpBB/phpbb/db/extractor/extractor_interface.php @@ -0,0 +1,80 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +/** +* Database extractor interface +*/ +interface extractor_interface +{ + /** + * Start the extraction of the database + * + * This function initialize the database extraction. It is required to call this + * function before calling any other extractor functions. + * + * @param string $format + * @param string $filename + * @param int $time + * @param bool $download + * @param bool $store + * @return null + * @throws \phpbb\db\extractor\exception\invalid_format_exception when $format is invalid + */ + public function init_extractor($format, $filename, $time, $download = false, $store = false); + + /** + * Writes header comments to the database backup + * + * @param string $table_prefix prefix of phpBB database tables + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_start($table_prefix); + + /** + * Closes file and/or dumps download data + * + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_end(); + + /** + * Extracts database table structure + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_table($table_name); + + /** + * Extracts data from database table + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_data($table_name); + + /** + * Writes data to file/download content + * + * @param string $data + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function flush($data); +} diff --git a/phpBB/phpbb/db/extractor/factory.php b/phpBB/phpbb/db/extractor/factory.php new file mode 100644 index 0000000000..a1ffb65595 --- /dev/null +++ b/phpBB/phpbb/db/extractor/factory.php @@ -0,0 +1,79 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +/** +* A factory which serves the suitable extractor instance for the given dbal +*/ +class factory +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * Extractor factory constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \Symfony\Component\DependencyInjection\ContainerInterface $container) + { + $this->db = $db; + $this->container = $container; + } + + /** + * DB extractor factory getter + * + * @return \phpbb\db\extractor\extractor_interface an appropriate instance of the database extractor for the used database driver + * @throws \InvalidArgumentException when the database driver is unknown + */ + public function get() + { + // Return the appropriate DB extractor + if ($this->db instanceof \phpbb\db\driver\mssql || $this->db instanceof \phpbb\db\driver\mssql_base) + { + return $this->container->get('dbal.extractor.extractors.mssql_extractor'); + } + else if ($this->db instanceof \phpbb\db\driver\mysql_base) + { + return $this->container->get('dbal.extractor.extractors.mysql_extractor'); + } + else if ($this->db instanceof \phpbb\db\driver\oracle) + { + return $this->container->get('dbal.extractor.extractors.oracle_extractor'); + } + else if ($this->db instanceof \phpbb\db\driver\postgres) + { + return $this->container->get('dbal.extractor.extractors.postgres_extractor'); + } + else if ($this->db instanceof \phpbb\db\driver\sqlite) + { + return $this->container->get('dbal.extractor.extractors.sqlite_extractor'); + } + else if ($this->db instanceof \phpbb\db\driver\sqlite3) + { + return $this->container->get('dbal.extractor.extractors.sqlite3_extractor'); + } + + throw new \InvalidArgumentException('Invalid database driver given'); + } +} diff --git a/phpBB/phpbb/db/extractor/mssql_extractor.php b/phpBB/phpbb/db/extractor/mssql_extractor.php new file mode 100644 index 0000000000..fc30f4789d --- /dev/null +++ b/phpBB/phpbb/db/extractor/mssql_extractor.php @@ -0,0 +1,524 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class mssql_extractor extends base_extractor +{ + /** + * Writes closing line(s) to database backup + * + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_end() + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $this->flush("COMMIT\nGO\n"); + parent::write_end(); + } + + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "--\n"; + $sql_data .= "-- phpBB Backup Script\n"; + $sql_data .= "-- Dump of tables for $table_prefix\n"; + $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "--\n"; + $sql_data .= "BEGIN TRANSACTION\n"; + $sql_data .= "GO\n"; + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = '-- Table: ' . $table_name . "\n"; + $sql_data .= "IF OBJECT_ID(N'$table_name', N'U') IS NOT NULL\n"; + $sql_data .= "DROP TABLE $table_name;\n"; + $sql_data .= "GO\n"; + $sql_data .= "\nCREATE TABLE [$table_name] (\n"; + $rows = array(); + + $text_flag = false; + + $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]"; + + if ($row['DATA_TYPE'] == 'text') + { + $text_flag = true; + } + + if ($row['IS_IDENTITY']) + { + $line .= ' IDENTITY (1 , 1)'; + } + + if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text') + { + $line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')'; + } + + if ($row['IS_NULLABLE'] == 'YES') + { + $line .= ' NULL'; + } + else + { + $line .= ' NOT NULL'; + } + + if ($row['COLUMN_DEFAULT']) + { + $line .= ' DEFAULT ' . $row['COLUMN_DEFAULT']; + } + + $rows[] = $line; + } + $this->db->sql_freeresult($result); + + $sql_data .= implode(",\n", $rows); + $sql_data .= "\n) ON [PRIMARY]"; + + if ($text_flag) + { + $sql_data .= " TEXTIMAGE_ON [PRIMARY]"; + } + + $sql_data .= "\nGO\n\n"; + $rows = array(); + + $sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME + FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE + WHERE TABLE_NAME = '$table_name'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (!sizeof($rows)) + { + $sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n"; + $sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY CLUSTERED \n\t(\n"; + } + $rows[] = "\t\t[{$row['COLUMN_NAME']}]"; + } + if (sizeof($rows)) + { + $sql_data .= implode(",\n", $rows); + $sql_data .= "\n\t) ON [PRIMARY] \nGO\n"; + } + $this->db->sql_freeresult($result); + + $index = array(); + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + $index[$row['INDEX_NAME']][] = '[' . $row['COLUMN_NAME'] . ']'; + } + } + $this->db->sql_freeresult($result); + + foreach ($index as $index_name => $column_name) + { + $index[$index_name] = implode(', ', $column_name); + } + + foreach ($index as $index_name => $columns) + { + $sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n"; + } + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($this->db->get_sql_layer() === 'mssql') + { + $this->write_data_mssql($table_name); + } + else if ($this->db->get_sql_layer() === 'mssqlnative') + { + $this->write_data_mssqlnative($table_name); + } + else + { + $this->write_data_odbc($table_name); + } + } + + /** + * Extracts data from database table (for MSSQL driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_mssql($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $ary_type = $ary_name = array(); + $ident_set = false; + $sql_data = ''; + + // Grab all of the data from current table. + $sql = "SELECT * + FROM $table_name"; + $result = $this->db->sql_query($sql); + + $retrieved_data = mssql_num_rows($result); + + $i_num_fields = mssql_num_fields($result); + + for ($i = 0; $i < $i_num_fields; $i++) + { + $ary_type[$i] = mssql_field_type($result, $i); + $ary_name[$i] = mssql_field_name($result, $i); + } + + if ($retrieved_data) + { + $sql = "SELECT 1 as has_identity + FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; + $result2 = $this->db->sql_query($sql); + $row2 = $this->db->sql_fetchrow($result2); + if (!empty($row2['has_identity'])) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; + $ident_set = true; + } + $this->db->sql_freeresult($result2); + } + + while ($row = $this->db->sql_fetchrow($result)) + { + $schema_vals = $schema_fields = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + $str_val = $row[$ary_name[$i]]; + + if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) + { + $str_quote = ''; + $str_empty = "''"; + $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); + } + else if (preg_match('#date|timestamp#i', $ary_type[$i])) + { + if (empty($str_val)) + { + $str_quote = ''; + } + else + { + $str_quote = "'"; + } + } + else + { + $str_quote = ''; + $str_empty = 'NULL'; + } + + if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) + { + $str_val = $str_empty; + } + + $schema_vals[$i] = $str_quote . $str_val . $str_quote; + $schema_fields[$i] = $ary_name[$i]; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; + + $this->flush($sql_data); + $sql_data = ''; + } + $this->db->sql_freeresult($result); + + if ($retrieved_data && $ident_set) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; + } + $this->flush($sql_data); + } + + /** + * Extracts data from database table (for MSSQL Native driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_mssqlnative($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $ary_type = $ary_name = array(); + $ident_set = false; + $sql_data = ''; + + // Grab all of the data from current table. + $sql = "SELECT * FROM $table_name"; + $this->db->mssqlnative_set_query_options(array('Scrollable' => SQLSRV_CURSOR_STATIC)); + $result = $this->db->sql_query($sql); + + $retrieved_data = $this->db->mssqlnative_num_rows($result); + + if (!$retrieved_data) + { + $this->db->sql_freeresult($result); + return; + } + + $sql = "SELECT COLUMN_NAME, DATA_TYPE + FROM INFORMATION_SCHEMA.COLUMNS + WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = '" . $this->db->sql_escape($table_name) . "'"; + $result_fields = $this->db->sql_query($sql); + + $i_num_fields = 0; + while ($row = $this->db->sql_fetchrow($result_fields)) + { + $ary_type[$i_num_fields] = $row['DATA_TYPE']; + $ary_name[$i_num_fields] = $row['COLUMN_NAME']; + $i_num_fields++; + } + $this->db->sql_freeresult($result_fields); + + $sql = "SELECT 1 as has_identity + FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; + $result2 = $this->db->sql_query($sql); + $row2 = $this->db->sql_fetchrow($result2); + + if (!empty($row2['has_identity'])) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; + $ident_set = true; + } + $this->db->sql_freeresult($result2); + + while ($row = $this->db->sql_fetchrow($result)) + { + $schema_vals = $schema_fields = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + $str_val = $row[$ary_name[$i]]; + + // defaults to type number - better quote just to be safe, so check for is_int too + if (is_int($ary_type[$i]) || preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) + { + $str_quote = ''; + $str_empty = "''"; + $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); + } + else if (preg_match('#date|timestamp#i', $ary_type[$i])) + { + if (empty($str_val)) + { + $str_quote = ''; + } + else + { + $str_quote = "'"; + } + } + else + { + $str_quote = ''; + $str_empty = 'NULL'; + } + + if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) + { + $str_val = $str_empty; + } + + $schema_vals[$i] = $str_quote . $str_val . $str_quote; + $schema_fields[$i] = $ary_name[$i]; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; + + $this->flush($sql_data); + $sql_data = ''; + } + $this->db->sql_freeresult($result); + + if ($ident_set) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; + } + $this->flush($sql_data); + } + + /** + * Extracts data from database table (for ODBC driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_odbc($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $ary_type = $ary_name = array(); + $ident_set = false; + $sql_data = ''; + + // Grab all of the data from current table. + $sql = "SELECT * + FROM $table_name"; + $result = $this->db->sql_query($sql); + + $retrieved_data = odbc_num_rows($result); + + if ($retrieved_data) + { + $sql = "SELECT 1 as has_identity + FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; + $result2 = $this->db->sql_query($sql); + $row2 = $this->db->sql_fetchrow($result2); + if (!empty($row2['has_identity'])) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; + $ident_set = true; + } + $this->db->sql_freeresult($result2); + } + + $i_num_fields = odbc_num_fields($result); + + for ($i = 0; $i < $i_num_fields; $i++) + { + $ary_type[$i] = odbc_field_type($result, $i + 1); + $ary_name[$i] = odbc_field_name($result, $i + 1); + } + + while ($row = $this->db->sql_fetchrow($result)) + { + $schema_vals = $schema_fields = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + $str_val = $row[$ary_name[$i]]; + + if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) + { + $str_quote = ''; + $str_empty = "''"; + $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); + } + else if (preg_match('#date|timestamp#i', $ary_type[$i])) + { + if (empty($str_val)) + { + $str_quote = ''; + } + else + { + $str_quote = "'"; + } + } + else + { + $str_quote = ''; + $str_empty = 'NULL'; + } + + if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) + { + $str_val = $str_empty; + } + + $schema_vals[$i] = $str_quote . $str_val . $str_quote; + $schema_fields[$i] = $ary_name[$i]; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; + + $this->flush($sql_data); + + $sql_data = ''; + + } + $this->db->sql_freeresult($result); + + if ($retrieved_data && $ident_set) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; + } + $this->flush($sql_data); + } +} diff --git a/phpBB/phpbb/db/extractor/mysql_extractor.php b/phpBB/phpbb/db/extractor/mysql_extractor.php new file mode 100644 index 0000000000..34e309c19e --- /dev/null +++ b/phpBB/phpbb/db/extractor/mysql_extractor.php @@ -0,0 +1,403 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class mysql_extractor extends base_extractor +{ + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "#\n"; + $sql_data .= "# phpBB Backup Script\n"; + $sql_data .= "# Dump of tables for $table_prefix\n"; + $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "#\n"; + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + static $new_extract; + + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($new_extract === null) + { + if ($this->db->get_sql_layer() === 'mysqli' || version_compare($this->db->sql_server_info(true), '3.23.20', '>=')) + { + $new_extract = true; + } + else + { + $new_extract = false; + } + } + + if ($new_extract) + { + $this->new_write_table($table_name); + } + else + { + $this->old_write_table($table_name); + } + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($this->db->get_sql_layer() === 'mysqli') + { + $this->write_data_mysqli($table_name); + } + else + { + $this->write_data_mysql($table_name); + } + } + + /** + * Extracts data from database table (for MySQLi driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_mysqli($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = "SELECT * + FROM $table_name"; + $result = mysqli_query($this->db->get_db_connect_id(), $sql, MYSQLI_USE_RESULT); + if ($result != false) + { + $fields_cnt = mysqli_num_fields($result); + + // Get field information + $field = mysqli_fetch_fields($result); + $field_set = array(); + + for ($j = 0; $j < $fields_cnt; $j++) + { + $field_set[] = $field[$j]->name; + } + + $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); + $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); + $fields = implode(', ', $field_set); + $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; + $first_set = true; + $query_len = 0; + $max_len = get_usable_memory(); + + while ($row = mysqli_fetch_row($result)) + { + $values = array(); + if ($first_set) + { + $query = $sql_data . '('; + } + else + { + $query .= ',('; + } + + for ($j = 0; $j < $fields_cnt; $j++) + { + if (!isset($row[$j]) || is_null($row[$j])) + { + $values[$j] = 'NULL'; + } + else if (($field[$j]->flags & 32768) && !($field[$j]->flags & 1024)) + { + $values[$j] = $row[$j]; + } + else + { + $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; + } + } + $query .= implode(', ', $values) . ')'; + + $query_len += strlen($query); + if ($query_len > $max_len) + { + $this->flush($query . ";\n\n"); + $query = ''; + $query_len = 0; + $first_set = true; + } + else + { + $first_set = false; + } + } + mysqli_free_result($result); + + // check to make sure we have nothing left to flush + if (!$first_set && $query) + { + $this->flush($query . ";\n\n"); + } + } + } + + /** + * Extracts data from database table (for MySQL driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_mysql($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = "SELECT * + FROM $table_name"; + $result = mysql_unbuffered_query($sql, $this->db->get_db_connect_id()); + + if ($result != false) + { + $fields_cnt = mysql_num_fields($result); + + // Get field information + $field = array(); + for ($i = 0; $i < $fields_cnt; $i++) + { + $field[] = mysql_fetch_field($result, $i); + } + $field_set = array(); + + for ($j = 0; $j < $fields_cnt; $j++) + { + $field_set[] = $field[$j]->name; + } + + $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); + $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); + $fields = implode(', ', $field_set); + $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; + $first_set = true; + $query_len = 0; + $max_len = get_usable_memory(); + + while ($row = mysql_fetch_row($result)) + { + $values = array(); + if ($first_set) + { + $query = $sql_data . '('; + } + else + { + $query .= ',('; + } + + for ($j = 0; $j < $fields_cnt; $j++) + { + if (!isset($row[$j]) || is_null($row[$j])) + { + $values[$j] = 'NULL'; + } + else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp')) + { + $values[$j] = $row[$j]; + } + else + { + $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; + } + } + $query .= implode(', ', $values) . ')'; + + $query_len += strlen($query); + if ($query_len > $max_len) + { + $this->flush($query . ";\n\n"); + $query = ''; + $query_len = 0; + $first_set = true; + } + else + { + $first_set = false; + } + } + mysql_free_result($result); + + // check to make sure we have nothing left to flush + if (!$first_set && $query) + { + $this->flush($query . ";\n\n"); + } + } + } + + /** + * Extracts database table structure (for MySQLi or MySQL 3.23.20+) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function new_write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = 'SHOW CREATE TABLE ' . $table_name; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + + $sql_data = '# Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; + $this->flush($sql_data . $row['Create Table'] . ";\n\n"); + + $this->db->sql_freeresult($result); + } + + /** + * Extracts database table structure (for MySQL verisons older than 3.23.20) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function old_write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = '# Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; + $sql_data .= "CREATE TABLE $table_name(\n"; + $rows = array(); + + $sql = "SHOW FIELDS + FROM $table_name"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $line = ' ' . $row['Field'] . ' ' . $row['Type']; + + if (!is_null($row['Default'])) + { + $line .= " DEFAULT '{$row['Default']}'"; + } + + if ($row['Null'] != 'YES') + { + $line .= ' NOT NULL'; + } + + if ($row['Extra'] != '') + { + $line .= ' ' . $row['Extra']; + } + + $rows[] = $line; + } + $this->db->sql_freeresult($result); + + $sql = "SHOW KEYS + FROM $table_name"; + + $result = $this->db->sql_query($sql); + + $index = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $kname = $row['Key_name']; + + if ($kname != 'PRIMARY') + { + if ($row['Non_unique'] == 0) + { + $kname = "UNIQUE|$kname"; + } + } + + if ($row['Sub_part']) + { + $row['Column_name'] .= '(' . $row['Sub_part'] . ')'; + } + $index[$kname][] = $row['Column_name']; + } + $this->db->sql_freeresult($result); + + foreach ($index as $key => $columns) + { + $line = ' '; + + if ($key == 'PRIMARY') + { + $line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')'; + } + else if (strpos($key, 'UNIQUE') === 0) + { + $line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')'; + } + else if (strpos($key, 'FULLTEXT') === 0) + { + $line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')'; + } + else + { + $line .= "KEY $key (" . implode(', ', $columns) . ')'; + } + + $rows[] = $line; + } + + $sql_data .= implode(",\n", $rows); + $sql_data .= "\n);\n\n"; + + $this->flush($sql_data); + } +} diff --git a/phpBB/phpbb/db/extractor/oracle_extractor.php b/phpBB/phpbb/db/extractor/oracle_extractor.php new file mode 100644 index 0000000000..79a991889b --- /dev/null +++ b/phpBB/phpbb/db/extractor/oracle_extractor.php @@ -0,0 +1,263 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class oracle_extractor extends base_extractor +{ + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = '-- Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE $table_name\n/\n"; + $sql_data .= "\nCREATE TABLE $table_name (\n"; + + $sql = "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION, DATA_LENGTH, NULLABLE, DATA_DEFAULT + FROM ALL_TAB_COLS + WHERE table_name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + + $rows = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $line = ' "' . $row['column_name'] . '" ' . $row['data_type']; + + if ($row['data_type'] !== 'CLOB') + { + if ($row['data_type'] !== 'VARCHAR2' && $row['data_type'] !== 'CHAR') + { + $line .= '(' . $row['data_precision'] . ')'; + } + else + { + $line .= '(' . $row['data_length'] . ')'; + } + } + + if (!empty($row['data_default'])) + { + $line .= ' DEFAULT ' . $row['data_default']; + } + + if ($row['nullable'] == 'N') + { + $line .= ' NOT NULL'; + } + $rows[] = $line; + } + $this->db->sql_freeresult($result); + + $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME + FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B + WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME + AND B.CONSTRAINT_TYPE = 'P' + AND A.TABLE_NAME = '{$table_name}'"; + $result = $this->db->sql_query($sql); + + $primary_key = array(); + $constraint_name = ''; + while ($row = $this->db->sql_fetchrow($result)) + { + $constraint_name = '"' . $row['constraint_name'] . '"'; + $primary_key[] = '"' . $row['column_name'] . '"'; + } + $this->db->sql_freeresult($result); + + if (sizeof($primary_key)) + { + $rows[] = " CONSTRAINT {$constraint_name} PRIMARY KEY (" . implode(', ', $primary_key) . ')'; + } + + $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME + FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B + WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME + AND B.CONSTRAINT_TYPE = 'U' + AND A.TABLE_NAME = '{$table_name}'"; + $result = $this->db->sql_query($sql); + + $unique = array(); + $constraint_name = ''; + while ($row = $this->db->sql_fetchrow($result)) + { + $constraint_name = '"' . $row['constraint_name'] . '"'; + $unique[] = '"' . $row['column_name'] . '"'; + } + $this->db->sql_freeresult($result); + + if (sizeof($unique)) + { + $rows[] = " CONSTRAINT {$constraint_name} UNIQUE (" . implode(', ', $unique) . ')'; + } + + $sql_data .= implode(",\n", $rows); + $sql_data .= "\n)\n/\n"; + + $sql = "SELECT A.REFERENCED_NAME, C.* + FROM USER_DEPENDENCIES A, USER_TRIGGERS B, USER_SEQUENCES C + WHERE A.REFERENCED_TYPE = 'SEQUENCE' + AND A.NAME = B.TRIGGER_NAME + AND B.TABLE_NAME = '{$table_name}' + AND C.SEQUENCE_NAME = A.REFERENCED_NAME"; + $result = $this->db->sql_query($sql); + + $type = $this->request->variable('type', ''); + + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_data .= "\nDROP SEQUENCE \"{$row['referenced_name']}\"\n/\n"; + $sql_data .= "\nCREATE SEQUENCE \"{$row['referenced_name']}\""; + + if ($type == 'full') + { + $sql_data .= ' START WITH ' . $row['last_number']; + } + + $sql_data .= "\n/\n"; + } + $this->db->sql_freeresult($result); + + $sql = "SELECT DESCRIPTION, WHEN_CLAUSE, TRIGGER_BODY + FROM USER_TRIGGERS + WHERE TABLE_NAME = '{$table_name}'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\n/\n"; + } + $this->db->sql_freeresult($result); + + $sql = "SELECT A.INDEX_NAME, B.COLUMN_NAME + FROM USER_INDEXES A, USER_IND_COLUMNS B + WHERE A.UNIQUENESS = 'NONUNIQUE' + AND A.INDEX_NAME = B.INDEX_NAME + AND B.TABLE_NAME = '{$table_name}'"; + $result = $this->db->sql_query($sql); + + $index = array(); + + while ($row = $this->db->sql_fetchrow($result)) + { + $index[$row['index_name']][] = $row['column_name']; + } + + foreach ($index as $index_name => $column_names) + { + $sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n/\n"; + } + $this->db->sql_freeresult($result); + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $ary_type = $ary_name = array(); + + // Grab all of the data from current table. + $sql = "SELECT * + FROM $table_name"; + $result = $this->db->sql_query($sql); + + $i_num_fields = ocinumcols($result); + + for ($i = 0; $i < $i_num_fields; $i++) + { + $ary_type[$i] = ocicolumntype($result, $i + 1); + $ary_name[$i] = ocicolumnname($result, $i + 1); + } + + while ($row = $this->db->sql_fetchrow($result)) + { + $schema_vals = $schema_fields = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + // Oracle uses uppercase - we use lowercase + $str_val = $row[strtolower($ary_name[$i])]; + + if (preg_match('#char|text|bool|raw|clob#i', $ary_type[$i])) + { + $str_quote = ''; + $str_empty = "''"; + $str_val = sanitize_data_oracle($str_val); + } + else if (preg_match('#date|timestamp#i', $ary_type[$i])) + { + if (empty($str_val)) + { + $str_quote = ''; + } + else + { + $str_quote = "'"; + } + } + else + { + $str_quote = ''; + $str_empty = 'NULL'; + } + + if (empty($str_val) && $str_val !== '0') + { + $str_val = $str_empty; + } + + $schema_vals[$i] = $str_quote . $str_val . $str_quote; + $schema_fields[$i] = '"' . $ary_name[$i] . '"'; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ")\n/\n"; + + $this->flush($sql_data); + } + $this->db->sql_freeresult($result); + } + + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "--\n"; + $sql_data .= "-- phpBB Backup Script\n"; + $sql_data .= "-- Dump of tables for $table_prefix\n"; + $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "--\n"; + $this->flush($sql_data); + } +} diff --git a/phpBB/phpbb/db/extractor/postgres_extractor.php b/phpBB/phpbb/db/extractor/postgres_extractor.php new file mode 100644 index 0000000000..a98e39621c --- /dev/null +++ b/phpBB/phpbb/db/extractor/postgres_extractor.php @@ -0,0 +1,339 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class postgres_extractor extends base_extractor +{ + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "--\n"; + $sql_data .= "-- phpBB Backup Script\n"; + $sql_data .= "-- Dump of tables for $table_prefix\n"; + $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "--\n"; + $sql_data .= "BEGIN TRANSACTION;\n"; + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + static $domains_created = array(); + + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = "SELECT a.domain_name, a.data_type, a.character_maximum_length, a.domain_default + FROM INFORMATION_SCHEMA.domains a, INFORMATION_SCHEMA.column_domain_usage b + WHERE a.domain_name = b.domain_name + AND b.table_name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (empty($domains_created[$row['domain_name']])) + { + $domains_created[$row['domain_name']] = true; + //$sql_data = "DROP DOMAIN {$row['domain_name']};\n"; + $sql_data = "CREATE DOMAIN {$row['domain_name']} as {$row['data_type']}"; + if (!empty($row['character_maximum_length'])) + { + $sql_data .= '(' . $row['character_maximum_length'] . ')'; + } + $sql_data .= ' NOT NULL'; + if (!empty($row['domain_default'])) + { + $sql_data .= ' DEFAULT ' . $row['domain_default']; + } + $this->flush($sql_data . ";\n"); + } + } + $this->db->sql_freeresult($result); + + $sql_data = '-- Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE $table_name;\n"; + // PGSQL does not "tightly" bind sequences and tables, we must guess... + $sql = "SELECT relname + FROM pg_class + WHERE relkind = 'S' + AND relname = '{$table_name}_seq'"; + $result = $this->db->sql_query($sql); + // We don't even care about storing the results. We already know the answer if we get rows back. + if ($this->db->sql_fetchrow($result)) + { + $sql_data .= "DROP SEQUENCE {$table_name}_seq;\n"; + $sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n"; + } + $this->db->sql_freeresult($result); + + $field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '" . $this->db->sql_escape($table_name) . "' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.atttypid = t.oid + ORDER BY a.attnum"; + $result = $this->db->sql_query($field_query); + + $sql_data .= "CREATE TABLE $table_name(\n"; + $lines = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + // Get the data from the table + $sql_get_default = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault + FROM pg_attrdef d, pg_class c + WHERE (c.relname = '" . $this->db->sql_escape($table_name) . "') + AND (c.oid = d.adrelid) + AND d.adnum = " . $row['attnum']; + $def_res = $this->db->sql_query($sql_get_default); + $def_row = $this->db->sql_fetchrow($def_res); + $this->db->sql_freeresult($def_res); + + if (empty($def_row)) + { + unset($row['rowdefault']); + } + else + { + $row['rowdefault'] = $def_row['rowdefault']; + } + + if ($row['type'] == 'bpchar') + { + // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement. + $row['type'] = 'char'; + } + + $line = ' ' . $row['field'] . ' ' . $row['type']; + + if (strpos($row['type'], 'char') !== false) + { + if ($row['lengthvar'] > 0) + { + $line .= '(' . ($row['lengthvar'] - 4) . ')'; + } + } + + if (strpos($row['type'], 'numeric') !== false) + { + $line .= '('; + $line .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff)); + $line .= ')'; + } + + if (isset($row['rowdefault'])) + { + $line .= ' DEFAULT ' . $row['rowdefault']; + } + + if ($row['notnull'] == 't') + { + $line .= ' NOT NULL'; + } + + $lines[] = $line; + } + $this->db->sql_freeresult($result); + + // Get the listing of primary keys. + $sql_pri_keys = "SELECT ic.relname as index_name, bc.relname as tab_name, ta.attname as column_name, i.indisunique as unique_key, i.indisprimary as primary_key + FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (ia.attrelid = i.indexrelid) + AND (ta.attrelid = bc.oid) + AND (bc.relname = '" . $this->db->sql_escape($table_name) . "') + AND (ta.attrelid = i.indrelid) + AND (ta.attnum = i.indkey[ia.attnum-1]) + ORDER BY index_name, tab_name, column_name"; + + $result = $this->db->sql_query($sql_pri_keys); + + $index_create = $index_rows = $primary_key = array(); + + // We do this in two steps. It makes placing the comma easier + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['primary_key'] == 't') + { + $primary_key[] = $row['column_name']; + $primary_key_name = $row['index_name']; + } + else + { + // We have to store this all this info because it is possible to have a multi-column key... + // we can loop through it again and build the statement + $index_rows[$row['index_name']]['table'] = $table_name; + $index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? true : false; + $index_rows[$row['index_name']]['column_names'][] = $row['column_name']; + } + } + $this->db->sql_freeresult($result); + + if (!empty($index_rows)) + { + foreach ($index_rows as $idx_name => $props) + { + $index_create[] = 'CREATE ' . ($props['unique'] ? 'UNIQUE ' : '') . "INDEX $idx_name ON $table_name (" . implode(', ', $props['column_names']) . ");"; + } + } + + if (!empty($primary_key)) + { + $lines[] = " CONSTRAINT $primary_key_name PRIMARY KEY (" . implode(', ', $primary_key) . ")"; + } + + // Generate constraint clauses for CHECK constraints + $sql_checks = "SELECT conname as index_name, consrc + FROM pg_constraint, pg_class bc + WHERE conrelid = bc.oid + AND bc.relname = '" . $this->db->sql_escape($table_name) . "' + AND NOT EXISTS ( + SELECT * + FROM pg_constraint as c, pg_inherits as i + WHERE i.inhrelid = pg_constraint.conrelid + AND c.conname = pg_constraint.conname + AND c.consrc = pg_constraint.consrc + AND c.conrelid = i.inhparent + )"; + $result = $this->db->sql_query($sql_checks); + + // Add the constraints to the sql file. + while ($row = $this->db->sql_fetchrow($result)) + { + if (!is_null($row['consrc'])) + { + $lines[] = ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['consrc']; + } + } + $this->db->sql_freeresult($result); + + $sql_data .= implode(", \n", $lines); + $sql_data .= "\n);\n"; + + if (!empty($index_create)) + { + $sql_data .= implode("\n", $index_create) . "\n\n"; + } + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + // Grab all of the data from current table. + $sql = "SELECT * + FROM $table_name"; + $result = $this->db->sql_query($sql); + + $i_num_fields = pg_num_fields($result); + $seq = ''; + + for ($i = 0; $i < $i_num_fields; $i++) + { + $ary_type[] = pg_field_type($result, $i); + $ary_name[] = pg_field_name($result, $i); + + $sql = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault + FROM pg_attrdef d, pg_class c + WHERE (c.relname = '{$table_name}') + AND (c.oid = d.adrelid) + AND d.adnum = " . strval($i + 1); + $result2 = $this->db->sql_query($sql); + if ($row = $this->db->sql_fetchrow($result2)) + { + // Determine if we must reset the sequences + if (strpos($row['rowdefault'], "nextval('") === 0) + { + $seq .= "SELECT SETVAL('{$table_name}_seq',(select case when max({$ary_name[$i]})>0 then max({$ary_name[$i]})+1 else 1 end FROM {$table_name}));\n"; + } + } + } + + $this->flush("COPY $table_name (" . implode(', ', $ary_name) . ') FROM stdin;' . "\n"); + while ($row = $this->db->sql_fetchrow($result)) + { + $schema_vals = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + $str_val = $row[$ary_name[$i]]; + + if (preg_match('#char|text|bool|bytea#i', $ary_type[$i])) + { + $str_val = str_replace(array("\n", "\t", "\r", "\b", "\f", "\v"), array('\n', '\t', '\r', '\b', '\f', '\v'), addslashes($str_val)); + $str_empty = ''; + } + else + { + $str_empty = '\N'; + } + + if (empty($str_val) && $str_val !== '0') + { + $str_val = $str_empty; + } + + $schema_vals[] = $str_val; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $this->flush(implode("\t", $schema_vals) . "\n"); + } + $this->db->sql_freeresult($result); + $this->flush("\\.\n"); + + // Write out the sequence statements + $this->flush($seq); + } + + /** + * Writes closing line(s) to database backup + * + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_end() + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $this->flush("COMMIT;\n"); + parent::write_end(); + } +} diff --git a/phpBB/phpbb/db/extractor/sqlite3_extractor.php b/phpBB/phpbb/db/extractor/sqlite3_extractor.php new file mode 100644 index 0000000000..ce8da6a652 --- /dev/null +++ b/phpBB/phpbb/db/extractor/sqlite3_extractor.php @@ -0,0 +1,151 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class sqlite3_extractor extends base_extractor +{ + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "--\n"; + $sql_data .= "-- phpBB Backup Script\n"; + $sql_data .= "-- Dump of tables for $table_prefix\n"; + $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "--\n"; + $sql_data .= "BEGIN TRANSACTION;\n"; + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = '-- Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE $table_name;\n"; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '" . $this->db->sql_escape($table_name) . "' + ORDER BY name ASC;"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Create Table + $sql_data .= $row['sql'] . ";\n"; + + $result = $this->db->sql_query("PRAGMA index_list('" . $this->db->sql_escape($table_name) . "');"); + + while ($row = $this->db->sql_fetchrow($result)) + { + if (strpos($row['name'], 'autoindex') !== false) + { + continue; + } + + $result2 = $this->db->sql_query("PRAGMA index_info('" . $this->db->sql_escape($row['name']) . "');"); + + $fields = array(); + while ($row2 = $this->db->sql_fetchrow($result2)) + { + $fields[] = $row2['name']; + } + $this->db->sql_freeresult($result2); + + $sql_data .= 'CREATE ' . ($row['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $row['name'] . ' ON ' . $table_name . ' (' . implode(', ', $fields) . ");\n"; + } + $this->db->sql_freeresult($result); + + $this->flush($sql_data . "\n"); + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $result = $this->db->sql_query("PRAGMA table_info('" . $this->db->sql_escape($table_name) . "');"); + + $col_types = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $col_types[$row['name']] = $row['type']; + } + $this->db->sql_freeresult($result); + + $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES ('; + + $sql = "SELECT * + FROM $table_name"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + foreach ($row as $column_name => $column_data) + { + if (is_null($column_data)) + { + $row[$column_name] = 'NULL'; + } + else if ($column_data === '') + { + $row[$column_name] = "''"; + } + else if (stripos($col_types[$column_name], 'text') !== false || stripos($col_types[$column_name], 'char') !== false || stripos($col_types[$column_name], 'blob') !== false) + { + $row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data)); + } + } + $this->flush($sql_insert . implode(', ', $row) . ");\n"); + } + } + + /** + * Writes closing line(s) to database backup + * + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_end() + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $this->flush("COMMIT;\n"); + parent::write_end(); + } +} diff --git a/phpBB/phpbb/db/extractor/sqlite_extractor.php b/phpBB/phpbb/db/extractor/sqlite_extractor.php new file mode 100644 index 0000000000..2734e23235 --- /dev/null +++ b/phpBB/phpbb/db/extractor/sqlite_extractor.php @@ -0,0 +1,149 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class sqlite_extractor extends base_extractor +{ + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "--\n"; + $sql_data .= "-- phpBB Backup Script\n"; + $sql_data .= "-- Dump of tables for $table_prefix\n"; + $sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "--\n"; + $sql_data .= "BEGIN TRANSACTION;\n"; + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = '-- Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE $table_name;\n"; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '" . $this->db->sql_escape($table_name) . "' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Create Table + $sql_data .= $row['sql'] . ";\n"; + + $result = $this->db->sql_query("PRAGMA index_list('" . $this->db->sql_escape($table_name) . "');"); + + $ar = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $ar[] = $row; + } + $this->db->sql_freeresult($result); + + foreach ($ar as $value) + { + if (strpos($value['name'], 'autoindex') !== false) + { + continue; + } + + $result = $this->db->sql_query("PRAGMA index_info('" . $this->db->sql_escape($value['name']) . "');"); + + $fields = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $fields[] = $row['name']; + } + $this->db->sql_freeresult($result); + + $sql_data .= 'CREATE ' . ($value['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $value['name'] . ' on ' . $table_name . ' (' . implode(', ', $fields) . ");\n"; + } + + $this->flush($sql_data . "\n"); + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $col_types = sqlite_fetch_column_types($this->db->get_db_connect_id(), $table_name); + + $sql = "SELECT * + FROM $table_name"; + $result = sqlite_unbuffered_query($this->db->get_db_connect_id(), $sql); + $rows = sqlite_fetch_all($result, SQLITE_ASSOC); + $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES ('; + foreach ($rows as $row) + { + foreach ($row as $column_name => $column_data) + { + if (is_null($column_data)) + { + $row[$column_name] = 'NULL'; + } + else if ($column_data == '') + { + $row[$column_name] = "''"; + } + else if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false) + { + $row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data)); + } + } + $this->flush($sql_insert . implode(', ', $row) . ");\n"); + } + } + + /** + * Writes closing line(s) to database backup + * + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + public function write_end() + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $this->flush("COMMIT;\n"); + parent::write_end(); + } +} diff --git a/phpBB/phpbb/db/migration/container_aware_migration.php b/phpBB/phpbb/db/migration/container_aware_migration.php new file mode 100644 index 0000000000..3b4b49b04b --- /dev/null +++ b/phpBB/phpbb/db/migration/container_aware_migration.php @@ -0,0 +1,36 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration; + +use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Abstract base class for container aware database migrations. +*/ +abstract class container_aware_migration extends migration implements ContainerAwareInterface +{ + /** + * @var ContainerInterface + */ + protected $container; + + /** + * {@inheritdoc} + */ + public function setContainer(ContainerInterface $container = null) + { + $this->container = $container; + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php index 5e6ba90336..648ae9ce96 100644 --- a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php +++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -33,16 +37,23 @@ class local_url_bbcode extends \phpbb\db\migration\migration { $sql = 'SELECT * FROM ' . BBCODES_TABLE . ' - WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->any_char . 'LOCAL_URL' . $this->db->any_char); + WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->get_any_char() . 'LOCAL_URL' . $this->db->get_any_char()); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { if (!class_exists('acp_bbcodes')) { - global $phpEx; - phpbb_require_updated('includes/acp/acp_bbcodes.' . $phpEx); + if (function_exists('phpbb_require_updated')) + { + phpbb_require_updated('includes/acp/acp_bbcodes.' . $this->php_ext); + } + else + { + require($this->phpbb_root_path . 'includes/acp/acp_bbcodes.' . $this->php_ext); + } } + $bbcode_match = $row['bbcode_match']; $bbcode_tpl = $row['bbcode_tpl']; diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_0.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_0.php new file mode 100644 index 0000000000..26937d6d80 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_0.php @@ -0,0 +1,1181 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_0 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.0', '>='); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'attachments' => array( + 'COLUMNS' => array( + 'attach_id' => array('UINT', NULL, 'auto_increment'), + 'post_msg_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'in_message' => array('BOOL', 0), + 'poster_id' => array('UINT', 0), + 'is_orphan' => array('BOOL', 1), + 'physical_filename' => array('VCHAR', ''), + 'real_filename' => array('VCHAR', ''), + 'download_count' => array('UINT', 0), + 'attach_comment' => array('TEXT_UNI', ''), + 'extension' => array('VCHAR:100', ''), + 'mimetype' => array('VCHAR:100', ''), + 'filesize' => array('UINT:20', 0), + 'filetime' => array('TIMESTAMP', 0), + 'thumbnail' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'attach_id', + 'KEYS' => array( + 'filetime' => array('INDEX', 'filetime'), + 'post_msg_id' => array('INDEX', 'post_msg_id'), + 'topic_id' => array('INDEX', 'topic_id'), + 'poster_id' => array('INDEX', 'poster_id'), + 'is_orphan' => array('INDEX', 'is_orphan'), + ), + ), + + $this->table_prefix . 'acl_groups' => array( + 'COLUMNS' => array( + 'group_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'auth_option_id' => array('UINT', 0), + 'auth_role_id' => array('UINT', 0), + 'auth_setting' => array('TINT:2', 0), + ), + 'KEYS' => array( + 'group_id' => array('INDEX', 'group_id'), + 'auth_opt_id' => array('INDEX', 'auth_option_id'), + 'auth_role_id' => array('INDEX', 'auth_role_id'), + ), + ), + + $this->table_prefix . 'acl_options' => array( + 'COLUMNS' => array( + 'auth_option_id' => array('UINT', NULL, 'auto_increment'), + 'auth_option' => array('VCHAR:50', ''), + 'is_global' => array('BOOL', 0), + 'is_local' => array('BOOL', 0), + 'founder_only' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'auth_option_id', + 'KEYS' => array( + 'auth_option' => array('INDEX', 'auth_option'), + ), + ), + + $this->table_prefix . 'acl_roles' => array( + 'COLUMNS' => array( + 'role_id' => array('UINT', NULL, 'auto_increment'), + 'role_name' => array('VCHAR_UNI', ''), + 'role_description' => array('TEXT_UNI', ''), + 'role_type' => array('VCHAR:10', ''), + 'role_order' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'role_id', + 'KEYS' => array( + 'role_type' => array('INDEX', 'role_type'), + 'role_order' => array('INDEX', 'role_order'), + ), + ), + + $this->table_prefix . 'acl_roles_data' => array( + 'COLUMNS' => array( + 'role_id' => array('UINT', 0), + 'auth_option_id' => array('UINT', 0), + 'auth_setting' => array('TINT:2', 0), + ), + 'PRIMARY_KEY' => array('role_id', 'auth_option_id'), + 'KEYS' => array( + 'ath_op_id' => array('INDEX', 'auth_option_id'), + ), + ), + + $this->table_prefix . 'acl_users' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'auth_option_id' => array('UINT', 0), + 'auth_role_id' => array('UINT', 0), + 'auth_setting' => array('TINT:2', 0), + ), + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + 'auth_option_id' => array('INDEX', 'auth_option_id'), + 'auth_role_id' => array('INDEX', 'auth_role_id'), + ), + ), + + $this->table_prefix . 'banlist' => array( + 'COLUMNS' => array( + 'ban_id' => array('UINT', NULL, 'auto_increment'), + 'ban_userid' => array('UINT', 0), + 'ban_ip' => array('VCHAR:40', ''), + 'ban_email' => array('VCHAR_UNI:100', ''), + 'ban_start' => array('TIMESTAMP', 0), + 'ban_end' => array('TIMESTAMP', 0), + 'ban_exclude' => array('BOOL', 0), + 'ban_reason' => array('VCHAR_UNI', ''), + 'ban_give_reason' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => 'ban_id', + 'KEYS' => array( + 'ban_end' => array('INDEX', 'ban_end'), + 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')), + 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')), + 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')), + ), + ), + + $this->table_prefix . 'bbcodes' => array( + 'COLUMNS' => array( + 'bbcode_id' => array('TINT:3', 0), + 'bbcode_tag' => array('VCHAR:16', ''), + 'bbcode_helpline' => array('VCHAR_UNI', ''), + 'display_on_posting' => array('BOOL', 0), + 'bbcode_match' => array('TEXT_UNI', ''), + 'bbcode_tpl' => array('MTEXT_UNI', ''), + 'first_pass_match' => array('MTEXT_UNI', ''), + 'first_pass_replace' => array('MTEXT_UNI', ''), + 'second_pass_match' => array('MTEXT_UNI', ''), + 'second_pass_replace' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'bbcode_id', + 'KEYS' => array( + 'display_on_post' => array('INDEX', 'display_on_posting'), + ), + ), + + $this->table_prefix . 'bookmarks' => array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => array('topic_id', 'user_id'), + ), + + $this->table_prefix . 'bots' => array( + 'COLUMNS' => array( + 'bot_id' => array('UINT', NULL, 'auto_increment'), + 'bot_active' => array('BOOL', 1), + 'bot_name' => array('STEXT_UNI', ''), + 'user_id' => array('UINT', 0), + 'bot_agent' => array('VCHAR', ''), + 'bot_ip' => array('VCHAR', ''), + ), + 'PRIMARY_KEY' => 'bot_id', + 'KEYS' => array( + 'bot_active' => array('INDEX', 'bot_active'), + ), + ), + + $this->table_prefix . 'config' => array( + 'COLUMNS' => array( + 'config_name' => array('VCHAR', ''), + 'config_value' => array('VCHAR_UNI', ''), + 'is_dynamic' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'config_name', + 'KEYS' => array( + 'is_dynamic' => array('INDEX', 'is_dynamic'), + ), + ), + + $this->table_prefix . 'confirm' => array( + 'COLUMNS' => array( + 'confirm_id' => array('CHAR:32', ''), + 'session_id' => array('CHAR:32', ''), + 'confirm_type' => array('TINT:3', 0), + 'code' => array('VCHAR:8', ''), + 'seed' => array('UINT:10', 0), + ), + 'PRIMARY_KEY' => array('session_id', 'confirm_id'), + 'KEYS' => array( + 'confirm_type' => array('INDEX', 'confirm_type'), + ), + ), + + $this->table_prefix . 'disallow' => array( + 'COLUMNS' => array( + 'disallow_id' => array('UINT', NULL, 'auto_increment'), + 'disallow_username' => array('VCHAR_UNI:255', ''), + ), + 'PRIMARY_KEY' => 'disallow_id', + ), + + $this->table_prefix . 'drafts' => array( + 'COLUMNS' => array( + 'draft_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'save_time' => array('TIMESTAMP', 0), + 'draft_subject' => array('XSTEXT_UNI', ''), + 'draft_message' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'draft_id', + 'KEYS' => array( + 'save_time' => array('INDEX', 'save_time'), + ), + ), + + $this->table_prefix . 'extensions' => array( + 'COLUMNS' => array( + 'extension_id' => array('UINT', NULL, 'auto_increment'), + 'group_id' => array('UINT', 0), + 'extension' => array('VCHAR:100', ''), + ), + 'PRIMARY_KEY' => 'extension_id', + ), + + $this->table_prefix . 'extension_groups' => array( + 'COLUMNS' => array( + 'group_id' => array('UINT', NULL, 'auto_increment'), + 'group_name' => array('VCHAR_UNI', ''), + 'cat_id' => array('TINT:2', 0), + 'allow_group' => array('BOOL', 0), + 'download_mode' => array('BOOL', 1), + 'upload_icon' => array('VCHAR', ''), + 'max_filesize' => array('UINT:20', 0), + 'allowed_forums' => array('TEXT', ''), + 'allow_in_pm' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'group_id', + ), + + $this->table_prefix . 'forums' => array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', NULL, 'auto_increment'), + 'parent_id' => array('UINT', 0), + 'left_id' => array('UINT', 0), + 'right_id' => array('UINT', 0), + 'forum_parents' => array('MTEXT', ''), + 'forum_name' => array('STEXT_UNI', ''), + 'forum_desc' => array('TEXT_UNI', ''), + 'forum_desc_bitfield' => array('VCHAR:255', ''), + 'forum_desc_options' => array('UINT:11', 7), + 'forum_desc_uid' => array('VCHAR:8', ''), + 'forum_link' => array('VCHAR_UNI', ''), + 'forum_password' => array('VCHAR_UNI:40', ''), + 'forum_style' => array('USINT', 0), + 'forum_image' => array('VCHAR', ''), + 'forum_rules' => array('TEXT_UNI', ''), + 'forum_rules_link' => array('VCHAR_UNI', ''), + 'forum_rules_bitfield' => array('VCHAR:255', ''), + 'forum_rules_options' => array('UINT:11', 7), + 'forum_rules_uid' => array('VCHAR:8', ''), + 'forum_topics_per_page' => array('TINT:4', 0), + 'forum_type' => array('TINT:4', 0), + 'forum_status' => array('TINT:4', 0), + 'forum_posts' => array('UINT', 0), + 'forum_topics' => array('UINT', 0), + 'forum_topics_real' => array('UINT', 0), + 'forum_last_post_id' => array('UINT', 0), + 'forum_last_poster_id' => array('UINT', 0), + 'forum_last_post_subject' => array('XSTEXT_UNI', ''), + 'forum_last_post_time' => array('TIMESTAMP', 0), + 'forum_last_poster_name'=> array('VCHAR_UNI', ''), + 'forum_last_poster_colour'=> array('VCHAR:6', ''), + 'forum_flags' => array('TINT:4', 32), + 'display_on_index' => array('BOOL', 1), + 'enable_indexing' => array('BOOL', 1), + 'enable_icons' => array('BOOL', 1), + 'enable_prune' => array('BOOL', 0), + 'prune_next' => array('TIMESTAMP', 0), + 'prune_days' => array('UINT', 0), + 'prune_viewed' => array('UINT', 0), + 'prune_freq' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'forum_id', + 'KEYS' => array( + 'left_right_id' => array('INDEX', array('left_id', 'right_id')), + 'forum_lastpost_id' => array('INDEX', 'forum_last_post_id'), + ), + ), + + $this->table_prefix . 'forums_access' => array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'session_id' => array('CHAR:32', ''), + ), + 'PRIMARY_KEY' => array('forum_id', 'user_id', 'session_id'), + ), + + $this->table_prefix . 'forums_track' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'mark_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'forum_id'), + ), + + $this->table_prefix . 'forums_watch' => array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'notify_status' => array('BOOL', 0), + ), + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + 'user_id' => array('INDEX', 'user_id'), + 'notify_stat' => array('INDEX', 'notify_status'), + ), + ), + + $this->table_prefix . 'groups' => array( + 'COLUMNS' => array( + 'group_id' => array('UINT', NULL, 'auto_increment'), + 'group_type' => array('TINT:4', 1), + 'group_founder_manage' => array('BOOL', 0), + 'group_name' => array('VCHAR_CI', ''), + 'group_desc' => array('TEXT_UNI', ''), + 'group_desc_bitfield' => array('VCHAR:255', ''), + 'group_desc_options' => array('UINT:11', 7), + 'group_desc_uid' => array('VCHAR:8', ''), + 'group_display' => array('BOOL', 0), + 'group_avatar' => array('VCHAR', ''), + 'group_avatar_type' => array('TINT:2', 0), + 'group_avatar_width' => array('USINT', 0), + 'group_avatar_height' => array('USINT', 0), + 'group_rank' => array('UINT', 0), + 'group_colour' => array('VCHAR:6', ''), + 'group_sig_chars' => array('UINT', 0), + 'group_receive_pm' => array('BOOL', 0), + 'group_message_limit' => array('UINT', 0), + 'group_legend' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => 'group_id', + 'KEYS' => array( + 'group_legend' => array('INDEX', 'group_legend'), + ), + ), + + $this->table_prefix . 'icons' => array( + 'COLUMNS' => array( + 'icons_id' => array('UINT', NULL, 'auto_increment'), + 'icons_url' => array('VCHAR', ''), + 'icons_width' => array('TINT:4', 0), + 'icons_height' => array('TINT:4', 0), + 'icons_order' => array('UINT', 0), + 'display_on_posting' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => 'icons_id', + 'KEYS' => array( + 'display_on_posting' => array('INDEX', 'display_on_posting'), + ), + ), + + $this->table_prefix . 'lang' => array( + 'COLUMNS' => array( + 'lang_id' => array('TINT:4', NULL, 'auto_increment'), + 'lang_iso' => array('VCHAR:30', ''), + 'lang_dir' => array('VCHAR:30', ''), + 'lang_english_name' => array('VCHAR_UNI:100', ''), + 'lang_local_name' => array('VCHAR_UNI:255', ''), + 'lang_author' => array('VCHAR_UNI:255', ''), + ), + 'PRIMARY_KEY' => 'lang_id', + 'KEYS' => array( + 'lang_iso' => array('INDEX', 'lang_iso'), + ), + ), + + $this->table_prefix . 'log' => array( + 'COLUMNS' => array( + 'log_id' => array('UINT', NULL, 'auto_increment'), + 'log_type' => array('TINT:4', 0), + 'user_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'reportee_id' => array('UINT', 0), + 'log_ip' => array('VCHAR:40', ''), + 'log_time' => array('TIMESTAMP', 0), + 'log_operation' => array('TEXT_UNI', ''), + 'log_data' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'log_id', + 'KEYS' => array( + 'log_type' => array('INDEX', 'log_type'), + 'forum_id' => array('INDEX', 'forum_id'), + 'topic_id' => array('INDEX', 'topic_id'), + 'reportee_id' => array('INDEX', 'reportee_id'), + 'user_id' => array('INDEX', 'user_id'), + ), + ), + + $this->table_prefix . 'moderator_cache' => array( + 'COLUMNS' => array( + 'forum_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR_UNI:255', ''), + 'group_id' => array('UINT', 0), + 'group_name' => array('VCHAR_UNI', ''), + 'display_on_index' => array('BOOL', 1), + ), + 'KEYS' => array( + 'disp_idx' => array('INDEX', 'display_on_index'), + 'forum_id' => array('INDEX', 'forum_id'), + ), + ), + + $this->table_prefix . 'modules' => array( + 'COLUMNS' => array( + 'module_id' => array('UINT', NULL, 'auto_increment'), + 'module_enabled' => array('BOOL', 1), + 'module_display' => array('BOOL', 1), + 'module_basename' => array('VCHAR', ''), + 'module_class' => array('VCHAR:10', ''), + 'parent_id' => array('UINT', 0), + 'left_id' => array('UINT', 0), + 'right_id' => array('UINT', 0), + 'module_langname' => array('VCHAR', ''), + 'module_mode' => array('VCHAR', ''), + 'module_auth' => array('VCHAR', ''), + ), + 'PRIMARY_KEY' => 'module_id', + 'KEYS' => array( + 'left_right_id' => array('INDEX', array('left_id', 'right_id')), + 'module_enabled' => array('INDEX', 'module_enabled'), + 'class_left_id' => array('INDEX', array('module_class', 'left_id')), + ), + ), + + $this->table_prefix . 'poll_options' => array( + 'COLUMNS' => array( + 'poll_option_id' => array('TINT:4', 0), + 'topic_id' => array('UINT', 0), + 'poll_option_text' => array('TEXT_UNI', ''), + 'poll_option_total' => array('UINT', 0), + ), + 'KEYS' => array( + 'poll_opt_id' => array('INDEX', 'poll_option_id'), + 'topic_id' => array('INDEX', 'topic_id'), + ), + ), + + $this->table_prefix . 'poll_votes' => array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', 0), + 'poll_option_id' => array('TINT:4', 0), + 'vote_user_id' => array('UINT', 0), + 'vote_user_ip' => array('VCHAR:40', ''), + ), + 'KEYS' => array( + 'topic_id' => array('INDEX', 'topic_id'), + 'vote_user_id' => array('INDEX', 'vote_user_id'), + 'vote_user_ip' => array('INDEX', 'vote_user_ip'), + ), + ), + + $this->table_prefix . 'posts' => array( + 'COLUMNS' => array( + 'post_id' => array('UINT', NULL, 'auto_increment'), + 'topic_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'poster_id' => array('UINT', 0), + 'icon_id' => array('UINT', 0), + 'poster_ip' => array('VCHAR:40', ''), + 'post_time' => array('TIMESTAMP', 0), + 'post_approved' => array('BOOL', 1), + 'post_reported' => array('BOOL', 0), + 'enable_bbcode' => array('BOOL', 1), + 'enable_smilies' => array('BOOL', 1), + 'enable_magic_url' => array('BOOL', 1), + 'enable_sig' => array('BOOL', 1), + 'post_username' => array('VCHAR_UNI:255', ''), + 'post_subject' => array('XSTEXT_UNI', '', 'true_sort'), + 'post_text' => array('MTEXT_UNI', ''), + 'post_checksum' => array('VCHAR:32', ''), + 'post_attachment' => array('BOOL', 0), + 'bbcode_bitfield' => array('VCHAR:255', ''), + 'bbcode_uid' => array('VCHAR:8', ''), + 'post_postcount' => array('BOOL', 1), + 'post_edit_time' => array('TIMESTAMP', 0), + 'post_edit_reason' => array('STEXT_UNI', ''), + 'post_edit_user' => array('UINT', 0), + 'post_edit_count' => array('USINT', 0), + 'post_edit_locked' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'post_id', + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + 'topic_id' => array('INDEX', 'topic_id'), + 'poster_ip' => array('INDEX', 'poster_ip'), + 'poster_id' => array('INDEX', 'poster_id'), + 'post_approved' => array('INDEX', 'post_approved'), + 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')), + ), + ), + + $this->table_prefix . 'privmsgs' => array( + 'COLUMNS' => array( + 'msg_id' => array('UINT', NULL, 'auto_increment'), + 'root_level' => array('UINT', 0), + 'author_id' => array('UINT', 0), + 'icon_id' => array('UINT', 0), + 'author_ip' => array('VCHAR:40', ''), + 'message_time' => array('TIMESTAMP', 0), + 'enable_bbcode' => array('BOOL', 1), + 'enable_smilies' => array('BOOL', 1), + 'enable_magic_url' => array('BOOL', 1), + 'enable_sig' => array('BOOL', 1), + 'message_subject' => array('XSTEXT_UNI', ''), + 'message_text' => array('MTEXT_UNI', ''), + 'message_edit_reason' => array('STEXT_UNI', ''), + 'message_edit_user' => array('UINT', 0), + 'message_attachment' => array('BOOL', 0), + 'bbcode_bitfield' => array('VCHAR:255', ''), + 'bbcode_uid' => array('VCHAR:8', ''), + 'message_edit_time' => array('TIMESTAMP', 0), + 'message_edit_count' => array('USINT', 0), + 'to_address' => array('TEXT_UNI', ''), + 'bcc_address' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'msg_id', + 'KEYS' => array( + 'author_ip' => array('INDEX', 'author_ip'), + 'message_time' => array('INDEX', 'message_time'), + 'author_id' => array('INDEX', 'author_id'), + 'root_level' => array('INDEX', 'root_level'), + ), + ), + + $this->table_prefix . 'privmsgs_folder' => array( + 'COLUMNS' => array( + 'folder_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'folder_name' => array('VCHAR_UNI', ''), + 'pm_count' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'folder_id', + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + ), + ), + + $this->table_prefix . 'privmsgs_rules' => array( + 'COLUMNS' => array( + 'rule_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'rule_check' => array('UINT', 0), + 'rule_connection' => array('UINT', 0), + 'rule_string' => array('VCHAR_UNI', ''), + 'rule_user_id' => array('UINT', 0), + 'rule_group_id' => array('UINT', 0), + 'rule_action' => array('UINT', 0), + 'rule_folder_id' => array('INT:11', 0), + ), + 'PRIMARY_KEY' => 'rule_id', + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + ), + ), + + $this->table_prefix . 'privmsgs_to' => array( + 'COLUMNS' => array( + 'msg_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'author_id' => array('UINT', 0), + 'pm_deleted' => array('BOOL', 0), + 'pm_new' => array('BOOL', 1), + 'pm_unread' => array('BOOL', 1), + 'pm_replied' => array('BOOL', 0), + 'pm_marked' => array('BOOL', 0), + 'pm_forwarded' => array('BOOL', 0), + 'folder_id' => array('INT:11', 0), + ), + 'KEYS' => array( + 'msg_id' => array('INDEX', 'msg_id'), + 'author_id' => array('INDEX', 'author_id'), + 'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')), + ), + ), + + $this->table_prefix . 'profile_fields' => array( + 'COLUMNS' => array( + 'field_id' => array('UINT', NULL, 'auto_increment'), + 'field_name' => array('VCHAR_UNI', ''), + 'field_type' => array('TINT:4', 0), + 'field_ident' => array('VCHAR:20', ''), + 'field_length' => array('VCHAR:20', ''), + 'field_minlen' => array('VCHAR', ''), + 'field_maxlen' => array('VCHAR', ''), + 'field_novalue' => array('VCHAR_UNI', ''), + 'field_default_value' => array('VCHAR_UNI', ''), + 'field_validation' => array('VCHAR_UNI:20', ''), + 'field_required' => array('BOOL', 0), + 'field_show_on_reg' => array('BOOL', 0), + 'field_hide' => array('BOOL', 0), + 'field_no_view' => array('BOOL', 0), + 'field_active' => array('BOOL', 0), + 'field_order' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'field_id', + 'KEYS' => array( + 'fld_type' => array('INDEX', 'field_type'), + 'fld_ordr' => array('INDEX', 'field_order'), + ), + ), + + $this->table_prefix . 'profile_fields_data' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'user_id', + ), + + $this->table_prefix . 'profile_fields_lang' => array( + 'COLUMNS' => array( + 'field_id' => array('UINT', 0), + 'lang_id' => array('UINT', 0), + 'option_id' => array('UINT', 0), + 'field_type' => array('TINT:4', 0), + 'lang_value' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => array('field_id', 'lang_id', 'option_id'), + ), + + $this->table_prefix . 'profile_lang' => array( + 'COLUMNS' => array( + 'field_id' => array('UINT', 0), + 'lang_id' => array('UINT', 0), + 'lang_name' => array('VCHAR_UNI', ''), + 'lang_explain' => array('TEXT_UNI', ''), + 'lang_default_value' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => array('field_id', 'lang_id'), + ), + + $this->table_prefix . 'ranks' => array( + 'COLUMNS' => array( + 'rank_id' => array('UINT', NULL, 'auto_increment'), + 'rank_title' => array('VCHAR_UNI', ''), + 'rank_min' => array('UINT', 0), + 'rank_special' => array('BOOL', 0), + 'rank_image' => array('VCHAR', ''), + ), + 'PRIMARY_KEY' => 'rank_id', + ), + + $this->table_prefix . 'reports' => array( + 'COLUMNS' => array( + 'report_id' => array('UINT', NULL, 'auto_increment'), + 'reason_id' => array('USINT', 0), + 'post_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'user_notify' => array('BOOL', 0), + 'report_closed' => array('BOOL', 0), + 'report_time' => array('TIMESTAMP', 0), + 'report_text' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'report_id', + ), + + $this->table_prefix . 'reports_reasons' => array( + 'COLUMNS' => array( + 'reason_id' => array('USINT', NULL, 'auto_increment'), + 'reason_title' => array('VCHAR_UNI', ''), + 'reason_description' => array('MTEXT_UNI', ''), + 'reason_order' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'reason_id', + ), + + $this->table_prefix . 'search_results' => array( + 'COLUMNS' => array( + 'search_key' => array('VCHAR:32', ''), + 'search_time' => array('TIMESTAMP', 0), + 'search_keywords' => array('MTEXT_UNI', ''), + 'search_authors' => array('MTEXT', ''), + ), + 'PRIMARY_KEY' => 'search_key', + ), + + $this->table_prefix . 'search_wordlist' => array( + 'COLUMNS' => array( + 'word_id' => array('UINT', NULL, 'auto_increment'), + 'word_text' => array('VCHAR_UNI', ''), + 'word_common' => array('BOOL', 0), + 'word_count' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'word_id', + 'KEYS' => array( + 'wrd_txt' => array('UNIQUE', 'word_text'), + 'wrd_cnt' => array('INDEX', 'word_count'), + ), + ), + + $this->table_prefix . 'search_wordmatch' => array( + 'COLUMNS' => array( + 'post_id' => array('UINT', 0), + 'word_id' => array('UINT', 0), + 'title_match' => array('BOOL', 0), + ), + 'KEYS' => array( + 'unq_mtch' => array('UNIQUE', array('word_id', 'post_id', 'title_match')), + 'word_id' => array('INDEX', 'word_id'), + 'post_id' => array('INDEX', 'post_id'), + ), + ), + + $this->table_prefix . 'sessions' => array( + 'COLUMNS' => array( + 'session_id' => array('CHAR:32', ''), + 'session_user_id' => array('UINT', 0), + 'session_last_visit' => array('TIMESTAMP', 0), + 'session_start' => array('TIMESTAMP', 0), + 'session_time' => array('TIMESTAMP', 0), + 'session_ip' => array('VCHAR:40', ''), + 'session_browser' => array('VCHAR:150', ''), + 'session_forwarded_for' => array('VCHAR:255', ''), + 'session_page' => array('VCHAR_UNI', ''), + 'session_viewonline' => array('BOOL', 1), + 'session_autologin' => array('BOOL', 0), + 'session_admin' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'session_id', + 'KEYS' => array( + 'session_time' => array('INDEX', 'session_time'), + 'session_user_id' => array('INDEX', 'session_user_id'), + ), + ), + + $this->table_prefix . 'sessions_keys' => array( + 'COLUMNS' => array( + 'key_id' => array('CHAR:32', ''), + 'user_id' => array('UINT', 0), + 'last_ip' => array('VCHAR:40', ''), + 'last_login' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('key_id', 'user_id'), + 'KEYS' => array( + 'last_login' => array('INDEX', 'last_login'), + ), + ), + + $this->table_prefix . 'sitelist' => array( + 'COLUMNS' => array( + 'site_id' => array('UINT', NULL, 'auto_increment'), + 'site_ip' => array('VCHAR:40', ''), + 'site_hostname' => array('VCHAR', ''), + 'ip_exclude' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'site_id', + ), + + $this->table_prefix . 'smilies' => array( + 'COLUMNS' => array( + 'smiley_id' => array('UINT', NULL, 'auto_increment'), +// We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed. + 'code' => array('VCHAR_UNI:50', ''), + 'emotion' => array('VCHAR_UNI:50', ''), + 'smiley_url' => array('VCHAR:50', ''), + 'smiley_width' => array('USINT', 0), + 'smiley_height' => array('USINT', 0), + 'smiley_order' => array('UINT', 0), + 'display_on_posting'=> array('BOOL', 1), + ), + 'PRIMARY_KEY' => 'smiley_id', + 'KEYS' => array( + 'display_on_post' => array('INDEX', 'display_on_posting'), + ), + ), + + $this->table_prefix . 'styles' => array( + 'COLUMNS' => array( + 'style_id' => array('USINT', NULL, 'auto_increment'), + 'style_name' => array('VCHAR_UNI:255', ''), + 'style_copyright' => array('VCHAR_UNI', ''), + 'style_active' => array('BOOL', 1), + 'template_id' => array('USINT', 0), + 'theme_id' => array('USINT', 0), + 'imageset_id' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'style_id', + 'KEYS' => array( + 'style_name' => array('UNIQUE', 'style_name'), + 'template_id' => array('INDEX', 'template_id'), + 'theme_id' => array('INDEX', 'theme_id'), + 'imageset_id' => array('INDEX', 'imageset_id'), + ), + ), + + $this->table_prefix . 'styles_template' => array( + 'COLUMNS' => array( + 'template_id' => array('USINT', 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), + ), + 'PRIMARY_KEY' => 'template_id', + 'KEYS' => array( + 'tmplte_nm' => array('UNIQUE', 'template_name'), + ), + ), + + $this->table_prefix . 'styles_template_data' => array( + 'COLUMNS' => array( + 'template_id' => array('USINT', 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'), + ), + ), + + $this->table_prefix . 'styles_theme' => array( + 'COLUMNS' => array( + 'theme_id' => array('USINT', 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'), + ), + ), + + $this->table_prefix . 'styles_imageset' => array( + 'COLUMNS' => array( + 'imageset_id' => array('USINT', NULL, 'auto_increment'), + 'imageset_name' => array('VCHAR_UNI:255', ''), + 'imageset_copyright' => array('VCHAR_UNI', ''), + 'imageset_path' => array('VCHAR:100', ''), + ), + 'PRIMARY_KEY' => 'imageset_id', + 'KEYS' => array( + 'imgset_nm' => array('UNIQUE', 'imageset_name'), + ), + ), + + $this->table_prefix . 'styles_imageset_data' => array( + 'COLUMNS' => array( + 'image_id' => array('USINT', NULL, 'auto_increment'), + 'image_name' => array('VCHAR:200', ''), + 'image_filename' => array('VCHAR:200', ''), + 'image_lang' => array('VCHAR:30', ''), + 'image_height' => array('USINT', 0), + 'image_width' => array('USINT', 0), + 'imageset_id' => array('USINT', 0), + ), + 'PRIMARY_KEY' => 'image_id', + 'KEYS' => array( + 'i_d' => array('INDEX', 'imageset_id'), + ), + ), + + $this->table_prefix . 'topics' => array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', NULL, 'auto_increment'), + 'forum_id' => array('UINT', 0), + 'icon_id' => array('UINT', 0), + 'topic_attachment' => array('BOOL', 0), + 'topic_approved' => array('BOOL', 1), + 'topic_reported' => array('BOOL', 0), + 'topic_title' => array('XSTEXT_UNI', '', 'true_sort'), + 'topic_poster' => array('UINT', 0), + 'topic_time' => array('TIMESTAMP', 0), + 'topic_time_limit' => array('TIMESTAMP', 0), + 'topic_views' => array('UINT', 0), + 'topic_replies' => array('UINT', 0), + 'topic_replies_real' => array('UINT', 0), + 'topic_status' => array('TINT:3', 0), + 'topic_type' => array('TINT:3', 0), + 'topic_first_post_id' => array('UINT', 0), + 'topic_first_poster_name' => array('VCHAR_UNI', ''), + 'topic_first_poster_colour' => array('VCHAR:6', ''), + 'topic_last_post_id' => array('UINT', 0), + 'topic_last_poster_id' => array('UINT', 0), + 'topic_last_poster_name' => array('VCHAR_UNI', ''), + 'topic_last_poster_colour' => array('VCHAR:6', ''), + 'topic_last_post_subject' => array('XSTEXT_UNI', ''), + 'topic_last_post_time' => array('TIMESTAMP', 0), + 'topic_last_view_time' => array('TIMESTAMP', 0), + 'topic_moved_id' => array('UINT', 0), + 'topic_bumped' => array('BOOL', 0), + 'topic_bumper' => array('UINT', 0), + 'poll_title' => array('STEXT_UNI', ''), + 'poll_start' => array('TIMESTAMP', 0), + 'poll_length' => array('TIMESTAMP', 0), + 'poll_max_options' => array('TINT:4', 1), + 'poll_last_vote' => array('TIMESTAMP', 0), + 'poll_vote_change' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => 'topic_id', + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')), + 'last_post_time' => array('INDEX', 'topic_last_post_time'), + 'topic_approved' => array('INDEX', 'topic_approved'), + 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')), + 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')), + ), + ), + + $this->table_prefix . 'topics_track' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'forum_id' => array('UINT', 0), + 'mark_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'topic_id'), + 'KEYS' => array( + 'forum_id' => array('INDEX', 'forum_id'), + ), + ), + + $this->table_prefix . 'topics_posted' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'topic_id' => array('UINT', 0), + 'topic_posted' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'topic_id'), + ), + + $this->table_prefix . 'topics_watch' => array( + 'COLUMNS' => array( + 'topic_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'notify_status' => array('BOOL', 0), + ), + 'KEYS' => array( + 'topic_id' => array('INDEX', 'topic_id'), + 'user_id' => array('INDEX', 'user_id'), + 'notify_stat' => array('INDEX', 'notify_status'), + ), + ), + + $this->table_prefix . 'user_group' => array( + 'COLUMNS' => array( + 'group_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'group_leader' => array('BOOL', 0), + 'user_pending' => array('BOOL', 1), + ), + 'KEYS' => array( + 'group_id' => array('INDEX', 'group_id'), + 'user_id' => array('INDEX', 'user_id'), + 'group_leader' => array('INDEX', 'group_leader'), + ), + ), + + $this->table_prefix . 'users' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', NULL, 'auto_increment'), + 'user_type' => array('TINT:2', 0), + 'group_id' => array('UINT', 3), + 'user_permissions' => array('MTEXT', ''), + 'user_perm_from' => array('UINT', 0), + 'user_ip' => array('VCHAR:40', ''), + 'user_regdate' => array('TIMESTAMP', 0), + 'username' => array('VCHAR_CI', ''), + 'username_clean' => array('VCHAR_CI', ''), + 'user_password' => array('VCHAR_UNI:40', ''), + 'user_passchg' => array('TIMESTAMP', 0), + 'user_pass_convert' => array('BOOL', 0), + 'user_email' => array('VCHAR_UNI:100', ''), + 'user_email_hash' => array('BINT', 0), + 'user_birthday' => array('VCHAR:10', ''), + 'user_lastvisit' => array('TIMESTAMP', 0), + 'user_lastmark' => array('TIMESTAMP', 0), + 'user_lastpost_time' => array('TIMESTAMP', 0), + 'user_lastpage' => array('VCHAR_UNI:200', ''), + 'user_last_confirm_key' => array('VCHAR:10', ''), + 'user_last_search' => array('TIMESTAMP', 0), + 'user_warnings' => array('TINT:4', 0), + 'user_last_warning' => array('TIMESTAMP', 0), + 'user_login_attempts' => array('TINT:4', 0), + 'user_inactive_reason' => array('TINT:2', 0), + 'user_inactive_time' => array('TIMESTAMP', 0), + 'user_posts' => array('UINT', 0), + 'user_lang' => array('VCHAR:30', ''), + 'user_timezone' => array('DECIMAL', 0), + 'user_dst' => array('BOOL', 0), + 'user_dateformat' => array('VCHAR_UNI:30', 'd M Y H:i'), + 'user_style' => array('USINT', 0), + 'user_rank' => array('UINT', 0), + 'user_colour' => array('VCHAR:6', ''), + 'user_new_privmsg' => array('INT:4', 0), + 'user_unread_privmsg' => array('INT:4', 0), + 'user_last_privmsg' => array('TIMESTAMP', 0), + 'user_message_rules' => array('BOOL', 0), + 'user_full_folder' => array('INT:11', -3), + 'user_emailtime' => array('TIMESTAMP', 0), + 'user_topic_show_days' => array('USINT', 0), + 'user_topic_sortby_type' => array('VCHAR:1', 't'), + 'user_topic_sortby_dir' => array('VCHAR:1', 'd'), + 'user_post_show_days' => array('USINT', 0), + 'user_post_sortby_type' => array('VCHAR:1', 't'), + 'user_post_sortby_dir' => array('VCHAR:1', 'a'), + 'user_notify' => array('BOOL', 0), + 'user_notify_pm' => array('BOOL', 1), + 'user_notify_type' => array('TINT:4', 0), + 'user_allow_pm' => array('BOOL', 1), + 'user_allow_viewonline' => array('BOOL', 1), + 'user_allow_viewemail' => array('BOOL', 1), + 'user_allow_massemail' => array('BOOL', 1), + 'user_options' => array('UINT:11', 895), + 'user_avatar' => array('VCHAR', ''), + 'user_avatar_type' => array('TINT:2', 0), + 'user_avatar_width' => array('USINT', 0), + 'user_avatar_height' => array('USINT', 0), + 'user_sig' => array('MTEXT_UNI', ''), + 'user_sig_bbcode_uid' => array('VCHAR:8', ''), + 'user_sig_bbcode_bitfield' => array('VCHAR:255', ''), + 'user_from' => array('VCHAR_UNI:100', ''), + 'user_icq' => array('VCHAR:15', ''), + 'user_aim' => array('VCHAR_UNI', ''), + 'user_yim' => array('VCHAR_UNI', ''), + 'user_msnm' => array('VCHAR_UNI', ''), + 'user_jabber' => array('VCHAR_UNI', ''), + 'user_website' => array('VCHAR_UNI:200', ''), + 'user_occ' => array('TEXT_UNI', ''), + 'user_interests' => array('TEXT_UNI', ''), + 'user_actkey' => array('VCHAR:32', ''), + 'user_newpasswd' => array('VCHAR_UNI:40', ''), + 'user_form_salt' => array('VCHAR_UNI:32', ''), + + ), + 'PRIMARY_KEY' => 'user_id', + 'KEYS' => array( + 'user_birthday' => array('INDEX', 'user_birthday'), + 'user_email_hash' => array('INDEX', 'user_email_hash'), + 'user_type' => array('INDEX', 'user_type'), + 'username_clean' => array('UNIQUE', 'username_clean'), + ), + ), + + $this->table_prefix . 'warnings' => array( + 'COLUMNS' => array( + 'warning_id' => array('UINT', NULL, 'auto_increment'), + 'user_id' => array('UINT', 0), + 'post_id' => array('UINT', 0), + 'log_id' => array('UINT', 0), + 'warning_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'warning_id', + ), + + $this->table_prefix . 'words' => array( + 'COLUMNS' => array( + 'word_id' => array('UINT', NULL, 'auto_increment'), + 'word' => array('VCHAR_UNI', ''), + 'replacement' => array('VCHAR_UNI', ''), + ), + 'PRIMARY_KEY' => 'word_id', + ), + + $this->table_prefix . 'zebra' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'zebra_id' => array('UINT', 0), + 'friend' => array('BOOL', 0), + 'foe' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => array('user_id', 'zebra_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'attachments', + $this->table_prefix . 'acl_groups', + $this->table_prefix . 'acl_options', + $this->table_prefix . 'acl_roles', + $this->table_prefix . 'acl_roles_data', + $this->table_prefix . 'acl_users', + $this->table_prefix . 'banlist', + $this->table_prefix . 'bbcodes', + $this->table_prefix . 'bookmarks', + $this->table_prefix . 'bots', + $this->table_prefix . 'config', + $this->table_prefix . 'confirm', + $this->table_prefix . 'disallow', + $this->table_prefix . 'drafts', + $this->table_prefix . 'extensions', + $this->table_prefix . 'extension_groups', + $this->table_prefix . 'forums', + $this->table_prefix . 'forums_access', + $this->table_prefix . 'forums_track', + $this->table_prefix . 'forums_watch', + $this->table_prefix . 'groups', + $this->table_prefix . 'icons', + $this->table_prefix . 'lang', + $this->table_prefix . 'log', + $this->table_prefix . 'moderator_cache', + $this->table_prefix . 'modules', + $this->table_prefix . 'poll_options', + $this->table_prefix . 'poll_votes', + $this->table_prefix . 'posts', + $this->table_prefix . 'privmsgs', + $this->table_prefix . 'privmsgs_folder', + $this->table_prefix . 'privmsgs_rules', + $this->table_prefix . 'privmsgs_to', + $this->table_prefix . 'profile_fields', + $this->table_prefix . 'profile_fields_data', + $this->table_prefix . 'profile_fields_lang', + $this->table_prefix . 'profile_lang', + $this->table_prefix . 'ranks', + $this->table_prefix . 'reports', + $this->table_prefix . 'reports_reasons', + $this->table_prefix . 'search_results', + $this->table_prefix . 'search_wordlist', + $this->table_prefix . 'search_wordmatch', + $this->table_prefix . 'sessions', + $this->table_prefix . 'sessions_keys', + $this->table_prefix . 'sitelist', + $this->table_prefix . 'smilies', + $this->table_prefix . 'styles', + $this->table_prefix . 'styles_template', + $this->table_prefix . 'styles_template_data', + $this->table_prefix . 'styles_theme', + $this->table_prefix . 'styles_imageset', + $this->table_prefix . 'styles_imageset_data', + $this->table_prefix . 'topics', + $this->table_prefix . 'topics_track', + $this->table_prefix . 'topics_posted', + $this->table_prefix . 'topics_watch', + $this->table_prefix . 'user_group', + $this->table_prefix . 'users', + $this->table_prefix . 'warnings', + $this->table_prefix . 'words', + $this->table_prefix . 'zebra', + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php index aed0f2784b..f5c7e56a81 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php index 305309c3bd..0d3a1ca80b 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php index fb50d67fb5..293c46cb06 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php index 63ba1e8fc2..f2889120e6 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php index 7055063032..9d6697ab7f 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php index 1246597efb..e77b54a1b5 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php index 7e284235e1..ed2dabf51c 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php index 017038855d..45d88708bd 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php index 5a2d569724..c489c0c0e8 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php index 35a3015959..f9f6d9f7f7 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -27,7 +31,6 @@ class release_3_0_12_rc1 extends \phpbb\db\migration\migration { return array( array('custom', array(array(&$this, 'update_module_auth'))), - array('custom', array(array(&$this, 'update_bots'))), array('custom', array(array(&$this, 'disable_bots_from_receiving_pms'))), array('config.update', array('version', '3.0.12-RC1')), @@ -66,60 +69,4 @@ class release_3_0_12_rc1 extends \phpbb\db\migration\migration AND module_mode = \'signature\''; $this->sql_query($sql); } - - public function update_bots() - { - // Update bots - if (!function_exists('user_delete')) - { - include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); - } - - $bots_updates = array( - // Bot Deletions - 'NG-Search [Bot]' => false, - 'Nutch/CVS [Bot]' => false, - 'OmniExplorer [Bot]' => false, - 'Seekport [Bot]' => false, - 'Synoo [Bot]' => false, - 'WiseNut [Bot]' => false, - - // Bot Updates - // Bot name to bot user agent map - 'Baidu [Spider]' => 'Baiduspider', - 'Exabot [Bot]' => 'Exabot', - 'Voyager [Bot]' => 'voyager/', - 'W3C [Validator]' => 'W3C_Validator', - ); - - foreach ($bots_updates as $bot_name => $bot_agent) - { - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . ' - WHERE user_type = ' . USER_IGNORE . " - AND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'"; - $result = $this->db->sql_query($sql); - $bot_user_id = (int) $this->db->sql_fetchfield('user_id'); - $this->db->sql_freeresult($result); - - if ($bot_user_id) - { - if ($bot_agent === false) - { - $sql = 'DELETE FROM ' . BOTS_TABLE . " - WHERE user_id = $bot_user_id"; - $this->sql_query($sql); - - user_delete('retain', $bot_user_id); - } - else - { - $sql = 'UPDATE ' . BOTS_TABLE . " - SET bot_agent = '" . $this->db->sql_escape($bot_agent) . "' - WHERE user_id = $bot_user_id"; - $this->sql_query($sql); - } - } - } - } } diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php index 3edb578fc8..8fac273073 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php index 510693a5b7..fb1b8014a4 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc3.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_13.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_13.php new file mode 100644 index 0000000000..310fcc70fc --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_13.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_13 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.13', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_13_rc1'); + } + + public function update_data() + { + return array( + array('if', array( + phpbb_version_compare($this->config['version'], '3.0.13', '<'), + array('config.update', array('version', '3.0.13')), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_13_pl1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_13_pl1.php new file mode 100644 index 0000000000..b12a96a7fb --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_13_pl1.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_13_pl1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.13-PL1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_13'); + } + + public function update_data() + { + return array( + array('if', array( + phpbb_version_compare($this->config['version'], '3.0.13-PL1', '<'), + array('config.update', array('version', '3.0.13-PL1')), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_13_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_13_rc1.php new file mode 100644 index 0000000000..9ea68fa862 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_13_rc1.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_13_rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.13-RC1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_12'); + } + + public function update_data() + { + return array( + array('if', array( + phpbb_version_compare($this->config['version'], '3.0.13-RC1', '<'), + array('config.update', array('version', '3.0.13-RC1')), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php new file mode 100644 index 0000000000..51475f5a05 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_14 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.14', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_14_rc1'); + } + + public function update_data() + { + return array( + array('if', array( + phpbb_version_compare($this->config['version'], '3.0.14', '<'), + array('config.update', array('version', '3.0.14')), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php new file mode 100644 index 0000000000..421ef06dd3 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_14_rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.14-RC1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_13'); + } + + public function update_data() + { + return array( + array('if', array( + phpbb_version_compare($this->config['version'], '3.0.14-RC1', '<'), + array('config.update', array('version', '3.0.14-RC1')), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php index 862276528d..d1ae0b9cbc 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,6 +20,11 @@ class release_3_0_1_rc1 extends \phpbb\db\migration\migration return phpbb_version_compare($this->config['version'], '3.0.1-RC1', '>='); } + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_0'); + } + public function update_schema() { return array( diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php index 7e2a08590e..c08f01dbeb 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php index 7a856383e2..2e7f141a9b 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php index 61562575eb..bde5febc59 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php index b2adbeaa43..c277da224c 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php index 57bd59bba3..530eaf47e6 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php index 5d6140393b..9b08da0125 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -32,7 +36,7 @@ class release_3_0_4 extends \phpbb\db\migration\migration public function rename_log_delete_topic() { - if ($this->db->sql_layer == 'oracle') + if ($this->db->get_sql_layer() == 'oracle') { // log_operation is CLOB - but we can change this later $sql = 'UPDATE ' . $this->table_prefix . "log diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php index a8af4dd76c..10343438b3 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php index 7bbe7ffed9..09c2bfea50 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php index ffe2c6a44d..084d00a13a 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php @@ -1,15 +1,21 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\db\migration\data\v30x; -class release_3_0_5_rc1 extends \phpbb\db\migration\migration +use phpbb\db\migration\container_aware_migration; + +class release_3_0_5_rc1 extends container_aware_migration { public function effectively_installed() { @@ -51,6 +57,9 @@ class release_3_0_5_rc1 extends \phpbb\db\migration\migration public function hash_old_passwords() { + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $this->container->get('passwords.manager'); + $sql = 'SELECT user_id, user_password FROM ' . $this->table_prefix . 'users WHERE user_pass_convert = 1'; @@ -61,7 +70,7 @@ class release_3_0_5_rc1 extends \phpbb\db\migration\migration if (strlen($row['user_password']) == 32) { $sql_ary = array( - 'user_password' => phpbb_hash($row['user_password']), + 'user_password' => '$CP$' . $passwords_manager->hash($row['user_password'], 'passwords.driver.salted_md5'), ); $this->sql_query('UPDATE ' . $this->table_prefix . 'users SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id']); @@ -103,13 +112,13 @@ class release_3_0_5_rc1 extends \phpbb\db\migration\migration // Select auth_option_ids... the largest id will be preserved $sql = 'SELECT auth_option_id FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option = '" . $db->sql_escape($option) . "' + WHERE auth_option = '" . $this->db->sql_escape($option) . "' ORDER BY auth_option_id DESC"; // sql_query_limit not possible here, due to bug in postgresql layer $result = $this->db->sql_query($sql); // Skip first row, this is our original auth option we want to preserve - $row = $this->db->sql_fetchrow($result); + $this->db->sql_fetchrow($result); while ($row = $this->db->sql_fetchrow($result)) { diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php index 04b14b5189..a9041ef354 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php index 85ea2e9d20..74c338a9c5 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php index 87d5e490f8..faef68121d 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php index 7a0ef28601..c52b71d8fa 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php index 73a1fe9e6a..2db3341b0a 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php index b6e5be2c2f..5734db25e6 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php index 2b0da30bc6..d1d602819d 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php index 3547ee77e1..784e810f14 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php index de4d772808..1843c3f262 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -72,7 +76,7 @@ class release_3_0_7_rc1 extends \phpbb\db\migration\migration { // Delete all text-templates from the template_data $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . ' - WHERE template_filename ' . $this->db->sql_like_expression($this->db->any_char . '.txt'); + WHERE template_filename ' . $this->db->sql_like_expression($this->db->get_any_char() . '.txt'); $this->sql_query($sql); } } diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php index 800803a753..e497a38765 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php index 6c8b1df6fc..04b5bd4a13 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php index 1a14e5c961..22fd51543b 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -26,7 +30,6 @@ class release_3_0_8_rc1 extends \phpbb\db\migration\migration return array( array('custom', array(array(&$this, 'update_file_extension_group_names'))), array('custom', array(array(&$this, 'update_module_auth'))), - array('custom', array(array(&$this, 'update_bots'))), array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))), array('module.add', array( 'acp', @@ -110,70 +113,6 @@ class release_3_0_8_rc1 extends \phpbb\db\migration\migration $this->sql_query($sql); } - public function update_bots() - { - $bot_name = 'Bing [Bot]'; - $bot_name_clean = utf8_clean_string($bot_name); - - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $this->db->sql_escape($bot_name_clean) . "'"; - $result = $this->db->sql_query($sql); - $bing_already_added = (bool) $this->db->sql_fetchfield('user_id'); - $this->db->sql_freeresult($result); - - if (!$bing_already_added) - { - $bot_agent = 'bingbot/'; - $bot_ip = ''; - $sql = 'SELECT group_id, group_colour - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'BOTS'"; - $result = $this->db->sql_query($sql); - $group_row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - if (!$group_row) - { - // default fallback, should never get here - $group_row['group_id'] = 6; - $group_row['group_colour'] = '9E8DA7'; - } - - if (!function_exists('user_add')) - { - include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); - } - - $user_row = array( - 'user_type' => USER_IGNORE, - 'group_id' => $group_row['group_id'], - 'username' => $bot_name, - 'user_regdate' => time(), - 'user_password' => '', - 'user_colour' => $group_row['group_colour'], - 'user_email' => '', - 'user_lang' => $this->config['default_lang'], - 'user_style' => $this->config['default_style'], - 'user_timezone' => 0, - 'user_dateformat' => $this->config['default_dateformat'], - 'user_allow_massemail' => 0, - ); - - $user_id = user_add($user_row); - - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( - 'bot_active' => 1, - 'bot_name' => (string) $bot_name, - 'user_id' => (int) $user_id, - 'bot_agent' => (string) $bot_agent, - 'bot_ip' => (string) $bot_ip, - )); - - $this->sql_query($sql); - } - } - public function delete_orphan_shadow_topics() { // Delete shadow topics pointing to not existing topics diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php index 9af2fce971..e69134c538 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php index 3fb790bc0d..5f928df47c 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -30,7 +34,7 @@ class release_3_0_9_rc1 extends \phpbb\db\migration\migration // this column was removed from the database updater // after 3.0.9-RC3 was released. It might still exist // in 3.0.9-RCX installations and has to be dropped as - // soon as the db_tools class is capable of properly + // soon as the \phpbb\db\tools\tools class is capable of properly // removing a primary key. // 'attempt_id' => array('UINT', NULL, 'auto_increment'), 'attempt_ip' => array('VCHAR:40', ''), @@ -85,7 +89,7 @@ class release_3_0_9_rc1 extends \phpbb\db\migration\migration // Update file extension group names to use language strings, again. $sql = 'SELECT group_id, group_name FROM ' . EXTENSION_GROUPS_TABLE . ' - WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->any_char); + WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->get_any_char()); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php index cd79d24ade..46fd51e7fe 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php index 7e59b8f9e8..1696060735 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php index e71d9defa6..fdc92b52f9 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/acp_prune_users_module.php b/phpBB/phpbb/db/migration/data/v310/acp_prune_users_module.php new file mode 100644 index 0000000000..725c57ca86 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/acp_prune_users_module.php @@ -0,0 +1,76 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class acp_prune_users_module extends \phpbb\db\migration\container_aware_migration +{ + public function effectively_installed() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_CAT_USERS'"; + $result = $this->db->sql_query($sql); + $acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT parent_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_basename = 'acp_prune' + AND module_mode = 'users'"; + $result = $this->db->sql_query($sql); + $acp_prune_users_parent = (int) $this->db->sql_fetchfield('parent_id'); + $this->db->sql_freeresult($result); + + // Skip migration if "Users" category has been deleted + // or the module has already been moved to that category + return !$acp_cat_users_id || $acp_cat_users_id === $acp_prune_users_parent; + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\beta1'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'move_prune_users_module'))), + ); + } + + public function move_prune_users_module() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_basename = 'acp_prune' + AND module_mode = 'users'"; + $result = $this->db->sql_query($sql); + $acp_prune_users_id = (int) $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_CAT_USERS'"; + $result = $this->db->sql_query($sql); + $acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + $module_manager = $this->container->get('module.manager'); + $module_manager->move_module($acp_prune_users_id, $acp_cat_users_id, 'acp'); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php b/phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php index 9f168f4fd6..4bd29f87d7 100644 --- a/phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php +++ b/phpBB/phpbb/db/migration/data/v310/acp_style_components_module.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/allow_cdn.php b/phpBB/phpbb/db/migration/data/v310/allow_cdn.php index aa471df6e7..286d20e20b 100644 --- a/phpBB/phpbb/db/migration/data/v310/allow_cdn.php +++ b/phpBB/phpbb/db/migration/data/v310/allow_cdn.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/alpha1.php b/phpBB/phpbb/db/migration/data/v310/alpha1.php index 403e301e64..1df85bc64c 100644 --- a/phpBB/phpbb/db/migration/data/v310/alpha1.php +++ b/phpBB/phpbb/db/migration/data/v310/alpha1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/alpha2.php b/phpBB/phpbb/db/migration/data/v310/alpha2.php index 3c0853f924..78bc755ec9 100644 --- a/phpBB/phpbb/db/migration/data/v310/alpha2.php +++ b/phpBB/phpbb/db/migration/data/v310/alpha2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/alpha3.php b/phpBB/phpbb/db/migration/data/v310/alpha3.php index 4bd2231bb9..574d19d2f4 100644 --- a/phpBB/phpbb/db/migration/data/v310/alpha3.php +++ b/phpBB/phpbb/db/migration/data/v310/alpha3.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php index 971a7e8504..2d51bd53e4 100644 --- a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php +++ b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth2.php b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth2.php new file mode 100644 index 0000000000..e9e726ae20 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth2.php @@ -0,0 +1,44 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class auth_provider_oauth2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\auth_provider_oauth', + ); + } + + public function update_data() + { + return array( + array('custom', array( + array($this, 'update_auth_link_module_auth'), + )), + ); + } + + public function update_auth_link_module_auth() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET module_auth = 'authmethod_oauth' + WHERE module_class = 'ucp' + AND module_basename = 'ucp_auth_link' + AND module_mode = 'auth_link' + AND module_auth = ''"; + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/avatar_types.php b/phpBB/phpbb/db/migration/data/v310/avatar_types.php index bdbdccf0c5..117e93239d 100644 --- a/phpBB/phpbb/db/migration/data/v310/avatar_types.php +++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/avatars.php b/phpBB/phpbb/db/migration/data/v310/avatars.php index 80ce606f29..9b03a8fa94 100644 --- a/phpBB/phpbb/db/migration/data/v310/avatars.php +++ b/phpBB/phpbb/db/migration/data/v310/avatars.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,7 +17,29 @@ class avatars extends \phpbb\db\migration\migration { public function effectively_installed() { - return isset($this->config['allow_avatar_gravatar']); + // Get current avatar type of guest user + $sql = 'SELECT user_avatar_type + FROM ' . $this->table_prefix . 'users + WHERE user_id = ' . ANONYMOUS; + $result = $this->db->sql_query($sql); + $backup_type = $this->db->sql_fetchfield('user_avatar_type'); + $this->db->sql_freeresult($result); + + // Try to set avatar type to string + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.upload' + WHERE user_id = " . ANONYMOUS; + $this->db->sql_return_on_error(true); + $effectively_installed = $this->db->sql_query($sql); + $this->db->sql_return_on_error(); + + // Restore avatar type of guest user to previous state + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = '{$backup_type}' + WHERE user_id = " . ANONYMOUS; + $this->db->sql_query($sql); + + return $effectively_installed !== false; } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/v310/beta1.php b/phpBB/phpbb/db/migration/data/v310/beta1.php new file mode 100644 index 0000000000..84887bd58e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/beta1.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class beta1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\alpha3', + '\phpbb\db\migration\data\v310\passwords_p2', + '\phpbb\db\migration\data\v310\postgres_fulltext_drop', + '\phpbb\db\migration\data\v310\profilefield_change_load_settings', + '\phpbb\db\migration\data\v310\profilefield_location', + '\phpbb\db\migration\data\v310\soft_delete_mod_convert2', + '\phpbb\db\migration\data\v310\ucp_popuppm_module', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-b1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/beta2.php b/phpBB/phpbb/db/migration/data/v310/beta2.php new file mode 100644 index 0000000000..458e305c7b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/beta2.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class beta2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\beta1', + '\phpbb\db\migration\data\v310\acp_prune_users_module', + '\phpbb\db\migration\data\v310\profilefield_location_cleanup', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-b2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/beta3.php b/phpBB/phpbb/db/migration/data/v310/beta3.php new file mode 100644 index 0000000000..a6c62bf936 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/beta3.php @@ -0,0 +1,36 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class beta3 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\beta2', + '\phpbb\db\migration\data\v310\auth_provider_oauth2', + '\phpbb\db\migration\data\v310\board_contact_name', + '\phpbb\db\migration\data\v310\jquery_update2', + '\phpbb\db\migration\data\v310\live_searches_config', + '\phpbb\db\migration\data\v310\prune_shadow_topics', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-b3')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/beta4.php b/phpBB/phpbb/db/migration/data/v310/beta4.php new file mode 100644 index 0000000000..3e91d95178 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/beta4.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class beta4 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\beta3', + '\phpbb\db\migration\data\v310\extensions_version_check_force_unstable', + '\phpbb\db\migration\data\v310\reset_missing_captcha_plugin', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-b4')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/board_contact_name.php b/phpBB/phpbb/db/migration/data/v310/board_contact_name.php new file mode 100644 index 0000000000..6f5188720b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/board_contact_name.php @@ -0,0 +1,34 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class board_contact_name extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return isset($this->config['board_contact_name']); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\beta2'); + } + + public function update_data() + { + return array( + array('config.add', array('board_contact_name', '')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/boardindex.php b/phpBB/phpbb/db/migration/data/v310/boardindex.php index 27492f2d0d..77a8558f21 100644 --- a/phpBB/phpbb/db/migration/data/v310/boardindex.php +++ b/phpBB/phpbb/db/migration/data/v310/boardindex.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/bot_update.php b/phpBB/phpbb/db/migration/data/v310/bot_update.php new file mode 100644 index 0000000000..39b16c68f8 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/bot_update.php @@ -0,0 +1,150 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class bot_update extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\rc6'); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_bing_bot'))), + array('custom', array(array(&$this, 'update_bots'))), + ); + } + + public function update_bing_bot() + { + $bot_name = 'Bing [Bot]'; + $bot_name_clean = utf8_clean_string($bot_name); + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape($bot_name_clean) . "'"; + $result = $this->db->sql_query($sql); + $bing_already_added = (bool) $this->db->sql_fetchfield('user_id'); + $this->db->sql_freeresult($result); + + if (!$bing_already_added) + { + $bot_agent = 'bingbot/'; + $bot_ip = ''; + $sql = 'SELECT group_id, group_colour + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $this->db->sql_query($sql); + $group_row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$group_row) + { + // default fallback, should never get here + $group_row['group_id'] = 6; + $group_row['group_colour'] = '9E8DA7'; + } + + if (!function_exists('user_add')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_row['group_id'], + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => $group_row['group_colour'], + 'user_email' => '', + 'user_lang' => $this->config['default_lang'], + 'user_style' => $this->config['default_style'], + 'user_timezone' => 0, + 'user_dateformat' => $this->config['default_dateformat'], + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_agent, + 'bot_ip' => (string) $bot_ip, + )); + + $this->sql_query($sql); + } + } + + public function update_bots() + { + // Update bots + if (!function_exists('user_delete')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $bots_updates = array( + // Bot Deletions + 'NG-Search [Bot]' => false, + 'Nutch/CVS [Bot]' => false, + 'OmniExplorer [Bot]' => false, + 'Seekport [Bot]' => false, + 'Synoo [Bot]' => false, + 'WiseNut [Bot]' => false, + + // Bot Updates + // Bot name to bot user agent map + 'Baidu [Spider]' => 'Baiduspider', + 'Exabot [Bot]' => 'Exabot', + 'Voyager [Bot]' => 'voyager/', + 'W3C [Validator]' => 'W3C_Validator', + ); + + foreach ($bots_updates as $bot_name => $bot_agent) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_IGNORE . " + AND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'"; + $result = $this->db->sql_query($sql); + $bot_user_id = (int) $this->db->sql_fetchfield('user_id'); + $this->db->sql_freeresult($result); + + if ($bot_user_id) + { + if ($bot_agent === false) + { + $sql = 'DELETE FROM ' . BOTS_TABLE . " + WHERE user_id = $bot_user_id"; + $this->sql_query($sql); + + user_delete('retain', $bot_user_id); + } + else + { + $sql = 'UPDATE ' . BOTS_TABLE . " + SET bot_agent = '" . $this->db->sql_escape($bot_agent) . "' + WHERE user_id = $bot_user_id"; + $this->sql_query($sql); + } + } + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/captcha_plugins.php b/phpBB/phpbb/db/migration/data/v310/captcha_plugins.php new file mode 100644 index 0000000000..328c08f1ec --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/captcha_plugins.php @@ -0,0 +1,48 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class captcha_plugins extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc2', + ); + } + + public function update_data() + { + $captcha_plugin = $this->config['captcha_plugin']; + if (strpos($captcha_plugin, 'phpbb_captcha_') === 0) + { + $captcha_plugin = substr($captcha_plugin, strlen('phpbb_captcha_')); + } + else if (strpos($captcha_plugin, 'phpbb_') === 0) + { + $captcha_plugin = substr($captcha_plugin, strlen('phpbb_')); + } + + return array( + array('if', array( + (is_file($this->phpbb_root_path . 'phpbb/captcha/plugins/' . $captcha_plugin . '.' . $this->php_ext)), + array('config.update', array('captcha_plugin', 'core.captcha.plugins.' . $captcha_plugin)), + )), + array('if', array( + (!is_file($this->phpbb_root_path . 'phpbb/captcha/plugins/' . $captcha_plugin . '.' . $this->php_ext)), + array('config.update', array('captcha_plugin', 'core.captcha.plugins.nogd')), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/config_db_text.php b/phpBB/phpbb/db/migration/data/v310/config_db_text.php index 1a7ee7a9a6..438883c438 100644 --- a/phpBB/phpbb/db/migration/data/v310/config_db_text.php +++ b/phpBB/phpbb/db/migration/data/v310/config_db_text.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php b/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php new file mode 100644 index 0000000000..20bd547ac3 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class contact_admin_acp_module extends \phpbb\db\migration\migration +{ + public function update_data() + { + return array( + array('module.add', array( + 'acp', + 'ACP_BOARD_CONFIGURATION', + array( + 'module_basename' => 'acp_contact', + 'modes' => array('contact'), + ), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/contact_admin_form.php b/phpBB/phpbb/db/migration/data/v310/contact_admin_form.php new file mode 100644 index 0000000000..5736369f1a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/contact_admin_form.php @@ -0,0 +1,46 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class contact_admin_form extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return isset($this->config['contact_admin_form_enable']); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\config_db_text'); + } + + public function update_data() + { + return array( + array('config.add', array('contact_admin_form_enable', 1)), + array('custom', array(array($this, 'contact_admin_info'))), + ); + } + + public function contact_admin_info() + { + $text_config = new \phpbb\config\db_text($this->db, $this->table_prefix . 'config_text'); + $text_config->set_array(array( + 'contact_admin_info' => '', + 'contact_admin_info_uid' => '', + 'contact_admin_info_bitfield' => '', + 'contact_admin_info_flags' => OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS, + )); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/dev.php b/phpBB/phpbb/db/migration/data/v310/dev.php index c1db883616..250258eea7 100644 --- a/phpBB/phpbb/db/migration/data/v310/dev.php +++ b/phpBB/phpbb/db/migration/data/v310/dev.php @@ -1,15 +1,19 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\db\migration\data\v310; -class dev extends \phpbb\db\migration\migration +class dev extends \phpbb\db\migration\container_aware_migration { public function effectively_installed() { @@ -23,6 +27,7 @@ class dev extends \phpbb\db\migration\migration '\phpbb\db\migration\data\v310\style_update_p2', '\phpbb\db\migration\data\v310\timezone_p2', '\phpbb\db\migration\data\v310\reported_posts_display', + '\phpbb\db\migration\data\v310\migrations_table', ); } @@ -199,18 +204,13 @@ class dev extends \phpbb\db\migration\migration $language_management_module_id = $this->db->sql_fetchfield('module_id'); $this->db->sql_freeresult($result); - if (!class_exists('acp_modules')) - { - include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); - } // acp_modules calls adm_back_link, which is undefined at this point if (!function_exists('adm_back_link')) { include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext); } - $module_manager = new \acp_modules(); - $module_manager->module_class = 'acp'; - $module_manager->move_module($language_module_id, $language_management_module_id); + $module_manager = $this->container->get('module.manager'); + $module_manager->move_module($language_module_id, $language_management_module_id, 'acp'); } public function update_ucp_pm_basename() diff --git a/phpBB/phpbb/db/migration/data/v310/extensions.php b/phpBB/phpbb/db/migration/data/v310/extensions.php index d8b38dbc9e..3171435482 100644 --- a/phpBB/phpbb/db/migration/data/v310/extensions.php +++ b/phpBB/phpbb/db/migration/data/v310/extensions.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php b/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php new file mode 100644 index 0000000000..1d6276f484 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php @@ -0,0 +1,29 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class extensions_version_check_force_unstable extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_data() + { + return array( + array('config.add', array('extension_force_unstable', false)), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/forgot_password.php b/phpBB/phpbb/db/migration/data/v310/forgot_password.php index 814093caa9..362457cf23 100644 --- a/phpBB/phpbb/db/migration/data/v310/forgot_password.php +++ b/phpBB/phpbb/db/migration/data/v310/forgot_password.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/gold.php b/phpBB/phpbb/db/migration/data/v310/gold.php new file mode 100644 index 0000000000..e84c7ee951 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/gold.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class gold extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc6', + '\phpbb\db\migration\data\v310\bot_update', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/jquery_update.php b/phpBB/phpbb/db/migration/data/v310/jquery_update.php index bd2de2b4d4..8011331e80 100644 --- a/phpBB/phpbb/db/migration/data/v310/jquery_update.php +++ b/phpBB/phpbb/db/migration/data/v310/jquery_update.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/jquery_update2.php b/phpBB/phpbb/db/migration/data/v310/jquery_update2.php new file mode 100644 index 0000000000..4061be5940 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/jquery_update2.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class jquery_update2 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->config['load_jquery_url'] !== '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'; + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\jquery_update', + ); + } + + public function update_data() + { + return array( + array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js')), + ); + } + +} diff --git a/phpBB/phpbb/db/migration/data/v310/live_searches_config.php b/phpBB/phpbb/db/migration/data/v310/live_searches_config.php new file mode 100644 index 0000000000..3d87e04ac2 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/live_searches_config.php @@ -0,0 +1,29 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class live_searches_config extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return isset($this->config['allow_live_searches']); + } + + public function update_data() + { + return array( + array('config.add', array('allow_live_searches', '1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/migrations_table.php b/phpBB/phpbb/db/migration/data/v310/migrations_table.php new file mode 100644 index 0000000000..48508b05c2 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/migrations_table.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class migrations_table extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_table_exists($this->table_prefix . 'migrations'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'migrations' => array( + 'COLUMNS' => array( + 'migration_name' => array('VCHAR', ''), + 'migration_depends_on' => array('TEXT', ''), + 'migration_schema_done' => array('BOOL', 0), + 'migration_data_done' => array('BOOL', 0), + 'migration_data_state' => array('TEXT', ''), + 'migration_start_time' => array('TIMESTAMP', 0), + 'migration_end_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'migration_name', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'migrations', + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php index ffb790b135..85e479db59 100644 --- a/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php +++ b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php index 97d174d4bc..e04a705c91 100644 --- a/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php +++ b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,10 +15,18 @@ namespace phpbb\db\migration\data\v310; class mysql_fulltext_drop extends \phpbb\db\migration\migration { + protected $indexes; + public function effectively_installed() { // This migration is irrelevant for all non-MySQL DBMSes. - return strpos($this->db->sql_layer, 'mysql') === false; + if (strpos($this->db->get_sql_layer(), 'mysql') === false) + { + return true; + } + + $this->find_indexes_to_drop(); + return empty($this->indexes); } static public function depends_on() @@ -26,6 +38,11 @@ class mysql_fulltext_drop extends \phpbb\db\migration\migration public function update_schema() { + if (empty($this->indexes)) + { + return array(); + } + /* * Drop FULLTEXT indexes related to MySQL fulltext search. * Doing so is equivalent to dropping the search index from the ACP. @@ -36,12 +53,28 @@ class mysql_fulltext_drop extends \phpbb\db\migration\migration */ return array( 'drop_keys' => array( - $this->table_prefix . 'posts' => array( - 'post_subject', - 'post_text', - 'post_content', - ), + $this->table_prefix . 'posts' => $this->indexes, ), ); } + + public function find_indexes_to_drop() + { + if ($this->indexes !== null) + { + return $this->indexes; + } + + $this->indexes = array(); + $potential_keys = array('post_subject', 'post_text', 'post_content'); + foreach ($potential_keys as $key) + { + if ($this->db_tools->sql_index_exists($this->table_prefix . 'posts', $key)) + { + $this->indexes[] = $key; + } + } + + return $this->indexes; + } } diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php index f74ecbd874..2a4935395e 100644 --- a/phpBB/phpbb/db/migration/data/v310/namespaces.php +++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php index 4195623618..2d4d26ae61 100644 --- a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php +++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/notifications.php b/phpBB/phpbb/db/migration/data/v310/notifications.php index 61be25bb5f..f4d012b5ac 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_cron.php b/phpBB/phpbb/db/migration/data/v310/notifications_cron.php index d5fa9c58a5..ba600f7bf5 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications_cron.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications_cron.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php b/phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php index 050e679cc0..263584b343 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications_cron_p2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php index eb2eb361ee..21a39a7c91 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php new file mode 100644 index 0000000000..112c1e85e8 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php @@ -0,0 +1,184 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class notifications_use_full_name extends \phpbb\db\migration\migration +{ + protected $notification_types = array( + 'admin_activate_user', + 'approve_post', + 'approve_topic', + 'bookmark', + 'disapprove_post', + 'disapprove_topic', + 'group_request', + 'group_request_approved', + 'pm', + 'post', + 'post_in_queue', + 'quote', + 'report_pm', + 'report_pm_closed', + 'report_post', + 'report_post_closed', + 'topic', + 'topic_in_queue'); + + protected $notification_methods = array( + 'email', + 'jabber', + ); + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\rc3'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_notifications_name'))), + array('custom', array(array($this, 'update_notifications_method_name'))), + ); + } + + public function revert_data() + { + return array( + array('custom', array(array($this, 'revert_notifications_name'))), + array('custom', array(array($this, 'revert_notifications_method_name'))), + ); + } + + public function update_notifications_method_name() + { + foreach ($this->notification_methods as $notification_method) + { + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET method = 'notification.method.{$notification_method}' + WHERE method = '{$notification_method}'"; + $this->db->sql_query($sql); + } + } + + public function revert_notifications_method_name() + { + foreach ($this->notification_methods as $notification_method) + { + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET method = '{$notification_method}' + WHERE method = 'notification.method.{$notification_method}'"; + $this->db->sql_query($sql); + } + } + + public function update_notifications_name() + { + $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . ' + SET notification_type_enabled = 0 + WHERE ' . $this->db->sql_in_set('notification_type_name', $this->notification_types, true); + $this->db->sql_query($sql); + + foreach ($this->notification_types as $notification_type) + { + $sql = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = 'notification.type.{$notification_type}'"; + $result = $this->db->sql_query($sql); + $new_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + if ($new_type_id) + { + // New type name already exists, + // so we delete the old type and update the type id of existing entries. + $sql = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = '{$notification_type}'"; + $result = $this->db->sql_query($sql); + $old_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' + SET notification_type_id = ' . (int) $new_type_id . ' + WHERE notification_type_id = ' . (int) $old_type_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = '{$notification_type}'"; + $this->db->sql_query($sql); + } + else + { + // Otherwise we just update the name + $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . " + SET notification_type_name = 'notification.type.{$notification_type}' + WHERE notification_type_name = '{$notification_type}'"; + $this->db->sql_query($sql); + } + + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET item_type = 'notification.type.{$notification_type}' + WHERE item_type = '{$notification_type}'"; + $this->db->sql_query($sql); + } + } + + public function revert_notifications_name() + { + foreach ($this->notification_types as $notification_type) + { + $sql = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = '{$notification_type}'"; + $result = $this->db->sql_query($sql); + $new_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + if ($new_type_id) + { + // New type name already exists, + // so we delete the old type and update the type id of existing entries. + $sql = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = 'notification.type.{$notification_type}'"; + $result = $this->db->sql_query($sql); + $old_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' + SET notification_type_id = ' . (int) $new_type_id . ' + WHERE notification_type_id = ' . (int) $old_type_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = 'notification.type.{$notification_type}'"; + $this->db->sql_query($sql); + } + else + { + // Otherwise we just update the name + $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . " + SET notification_type_name = '{$notification_type}' + WHERE notification_type_name = 'notification.type.{$notification_type}'"; + $this->db->sql_query($sql); + } + + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET item_type = '{$notification_type}' + WHERE item_type = 'notification.type.{$notification_type}'"; + $this->db->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/passwords.php b/phpBB/phpbb/db/migration/data/v310/passwords.php index 3422f75917..adee44147f 100644 --- a/phpBB/phpbb/db/migration/data/v310/passwords.php +++ b/phpBB/phpbb/db/migration/data/v310/passwords.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php new file mode 100644 index 0000000000..aad8e44681 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php @@ -0,0 +1,84 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class passwords_convert_p1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\passwords_p2'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_passwords'))), + ); + } + + public function update_passwords($start) + { + // Nothing to do if user_pass_convert column doesn't exist + if (!$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_pass_convert')) + { + return; + } + + $start = (int) $start; + $limit = 1000; + $converted_users = 0; + + $sql = 'SELECT user_password, user_id + FROM ' . $this->table_prefix . 'users + WHERE user_pass_convert = 1 + ORDER BY user_id'; + $result = $this->db->sql_query_limit($sql, $limit, $start); + + $update_users = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $converted_users++; + + $user_id = (int) $row['user_id']; + // Only prefix passwords without proper prefix + if (!isset($update_users[$user_id]) && !preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $row['user_password'])) + { + // Use $CP$ prefix for passwords that need to + // be converted and set pass convert to false. + $update_users[$user_id] = array( + 'user_password' => '$CP$' . $row['user_password'], + 'user_pass_convert' => 0, + ); + } + } + $this->db->sql_freeresult($result); + + foreach ($update_users as $user_id => $user_data) + { + $sql = 'UPDATE ' . $this->table_prefix . 'users + SET ' . $this->db->sql_build_array('UPDATE', $user_data) . ' + WHERE user_id = ' . $user_id; + $this->sql_query($sql); + } + + if ($converted_users < $limit) + { + // There are no more users to be converted + return; + } + + // There are still more users to query, return the next start value + return $start + $limit; + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/passwords_convert_p2.php b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p2.php new file mode 100644 index 0000000000..26a99184a6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p2.php @@ -0,0 +1,49 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class passwords_convert_p2 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_pass_convert'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\passwords_convert_p1'); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_pass_convert', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_pass_convert' => array('BOOL', 0, 'after' => 'user_passchg'), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/passwords_p2.php b/phpBB/phpbb/db/migration/data/v310/passwords_p2.php index 553e79403d..afc7ba2813 100644 --- a/phpBB/phpbb/db/migration/data/v310/passwords_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/passwords_p2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/plupload.php b/phpBB/phpbb/db/migration/data/v310/plupload.php index 7cdba507a2..69367f86a9 100644 --- a/phpBB/phpbb/db/migration/data/v310/plupload.php +++ b/phpBB/phpbb/db/migration/data/v310/plupload.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php new file mode 100644 index 0000000000..3457c19478 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php @@ -0,0 +1,80 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class postgres_fulltext_drop extends \phpbb\db\migration\migration +{ + protected $indexes; + + public function effectively_installed() + { + // This migration is irrelevant for all non-PostgreSQL DBMSes. + if (strpos($this->db->get_sql_layer(), 'postgres') === false) + { + return true; + } + + $this->find_indexes_to_drop(); + return empty($this->indexes); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + ); + } + + public function update_schema() + { + if (empty($this->indexes)) + { + return array(); + } + + /* + * Drop FULLTEXT indexes related to PostgreSQL fulltext search. + * Doing so is equivalent to dropping the search index from the ACP. + * Possibly time-consuming recreation of the search index (i.e. + * FULLTEXT indexes) is left as a task to the admin to not + * unnecessarily stall the upgrade process. The new search index will + * then require about 40% less table space (also see PHPBB3-11040). + */ + return array( + 'drop_keys' => array( + $this->table_prefix . 'posts' => $this->indexes, + ), + ); + } + + public function find_indexes_to_drop() + { + if ($this->indexes !== null) + { + return $this->indexes; + } + + $this->indexes = array(); + $potential_keys = array('post_subject', 'post_text', 'post_content'); + foreach ($potential_keys as $key) + { + if ($this->db_tools->sql_index_exists($this->table_prefix . 'posts', $key)) + { + $this->indexes[] = $key; + } + } + + return $this->indexes; + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_aol.php b/phpBB/phpbb/db/migration/data/v310/profilefield_aol.php new file mode 100644 index 0000000000..65d4fe1078 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_aol.php @@ -0,0 +1,55 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_aol extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_yahoo_cleanup', + ); + } + + protected $profilefield_name = 'phpbb_aol'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_aol', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_aol', + 'field_length' => '40', + 'field_minlen' => '5', + 'field_maxlen' => '255', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '.*', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 0, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => '', + 'field_contact_url' => '', + ); + + protected $user_column_name = 'user_aim'; +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_aol_cleanup.php b/phpBB/phpbb/db/migration/data/v310/profilefield_aol_cleanup.php new file mode 100644 index 0000000000..f884d83d26 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_aol_cleanup.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_aol_cleanup extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_aim'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_aol', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_aim', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_aim' => array('VCHAR_UNI', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_change_load_settings.php b/phpBB/phpbb/db/migration/data/v310/profilefield_change_load_settings.php new file mode 100644 index 0000000000..7cc4fd8daa --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_change_load_settings.php @@ -0,0 +1,34 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_change_load_settings extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_aol_cleanup', + ); + } + + public function update_data() + { + return array( + array('config.update', array('load_cpf_memberlist', '1')), + array('config.update', array('load_cpf_pm', '1')), + array('config.update', array('load_cpf_viewprofile', '1')), + array('config.update', array('load_cpf_viewtopic', '1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php b/phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php index 9e7ba68327..c44167dbfe 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_contact_field.php b/phpBB/phpbb/db/migration/data/v310/profilefield_contact_field.php new file mode 100644 index 0000000000..02cd420c0f --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_contact_field.php @@ -0,0 +1,55 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_contact_field extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_is_contact'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_on_memberlist', + ); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_is_contact' => array('BOOL', 0), + 'field_contact_desc' => array('VCHAR', ''), + 'field_contact_url' => array('VCHAR', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_is_contact', + 'field_contact_desc', + 'field_contact_url', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php b/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php new file mode 100644 index 0000000000..7324b893cc --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php @@ -0,0 +1,61 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_facebook extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_contact_field', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + '\phpbb\db\migration\data\v310\profilefield_types', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } + + protected $profilefield_name = 'phpbb_facebook'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_facebook', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_facebook', + 'field_length' => '20', + 'field_minlen' => '5', + 'field_maxlen' => '50', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[\w.]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_FACEBOOK_PROFILE', + 'field_contact_url' => 'http://facebook.com/%s/', + ); +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_field_validation_length.php b/phpBB/phpbb/db/migration/data/v310/profilefield_field_validation_length.php new file mode 100644 index 0000000000..c7d8b2dc91 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_field_validation_length.php @@ -0,0 +1,90 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_field_validation_length extends \phpbb\db\migration\migration +{ + protected $validation_options_old = array( + 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+', + ); + + protected $validation_options_new = array( + 'ALPHA_SPACERS' => '[\w\x20_+\-\[\]]+', + ); + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc3', + ); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_validation' => array('VCHAR_UNI:64', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_validation' => array('VCHAR_UNI:20', ''), + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_profile_fields_validation'))), + ); + } + + public function revert_data() + { + return array( + array('custom', array(array($this, 'revert_profile_fields_validation'))), + ); + } + + public function update_profile_fields_validation() + { + foreach ($this->validation_options_new as $validation_type => $regex) + { + $sql = 'UPDATE ' . $this->table_prefix . "profile_fields + SET field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "' + WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "'"; + $this->sql_query($sql); + } + } + + public function revert_profile_fields_validation() + { + foreach ($this->validation_options_new as $validation_type => $regex) + { + $sql = 'UPDATE ' . $this->table_prefix . "profile_fields + SET field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "' + WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "'"; + $this->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php b/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php new file mode 100644 index 0000000000..3b0963fc19 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php @@ -0,0 +1,61 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_googleplus extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_contact_field', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + '\phpbb\db\migration\data\v310\profilefield_types', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } + + protected $profilefield_name = 'phpbb_googleplus'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_googleplus', + 'field_type' => 'profilefields.type.googleplus', + 'field_ident' => 'phpbb_googleplus', + 'field_length' => '20', + 'field_minlen' => '3', + 'field_maxlen' => '255', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[\w]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_GOOGLEPLUS_PROFILE', + 'field_contact_url' => 'http://plus.google.com/%s', + ); +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_icq.php b/phpBB/phpbb/db/migration/data/v310/profilefield_icq.php new file mode 100644 index 0000000000..e61653f3db --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_icq.php @@ -0,0 +1,54 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_icq extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_contact_field', + ); + } + + protected $profilefield_name = 'phpbb_icq'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_icq', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_icq', + 'field_length' => '20', + 'field_minlen' => '3', + 'field_maxlen' => '15', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[0-9]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'SEND_ICQ_MESSAGE', + 'field_contact_url' => 'https://www.icq.com/people/%s/', + ); + + protected $user_column_name = 'user_icq'; +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_icq_cleanup.php b/phpBB/phpbb/db/migration/data/v310/profilefield_icq_cleanup.php new file mode 100644 index 0000000000..516c690093 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_icq_cleanup.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_icq_cleanup extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_icq'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_icq', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_icq', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_icq' => array('VCHAR:20', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_interests.php b/phpBB/phpbb/db/migration/data/v310/profilefield_interests.php index d73bc78edb..33a5ba15ae 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_interests.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_interests.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,6 +19,7 @@ class profilefield_interests extends \phpbb\db\migration\profilefield_base_migra { return array( '\phpbb\db\migration\data\v310\profilefield_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', ); } diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_location.php b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php index 4e62eab2d7..2d27c09e68 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_location.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_location_cleanup.php b/phpBB/phpbb/db/migration/data/v310/profilefield_location_cleanup.php new file mode 100644 index 0000000000..b824e3406a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_location_cleanup.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_location_cleanup extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_from'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_location', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_from', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_from' => array('VCHAR_UNI:100', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_occupation.php b/phpBB/phpbb/db/migration/data/v310/profilefield_occupation.php index b0ea961c08..75df2bcdee 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_occupation.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_occupation.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php b/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php index ce51944c3e..7ce5de0f00 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_show_novalue.php b/phpBB/phpbb/db/migration/data/v310/profilefield_show_novalue.php new file mode 100644 index 0000000000..5fc88b6809 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_show_novalue.php @@ -0,0 +1,49 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_show_novalue extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_show_novalue'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\profilefield_types'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_novalue' => array('BOOL', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_novalue', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php b/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php new file mode 100644 index 0000000000..0dbe9041bb --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php @@ -0,0 +1,61 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_skype extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_contact_field', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + '\phpbb\db\migration\data\v310\profilefield_types', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } + + protected $profilefield_name = 'phpbb_skype'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_skype', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_skype', + 'field_length' => '20', + 'field_minlen' => '6', + 'field_maxlen' => '32', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[a-zA-Z][\w\.,\-_]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_SKYPE_PROFILE', + 'field_contact_url' => 'skype:%s?userinfo', + ); +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php new file mode 100644 index 0000000000..850e096439 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php @@ -0,0 +1,61 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_twitter extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_contact_field', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + '\phpbb\db\migration\data\v310\profilefield_types', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } + + protected $profilefield_name = 'phpbb_twitter'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_twitter', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_twitter', + 'field_length' => '20', + 'field_minlen' => '1', + 'field_maxlen' => '15', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[\w_]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_TWITTER_PROFILE', + 'field_contact_url' => 'http://twitter.com/%s', + ); +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_types.php b/phpBB/phpbb/db/migration/data/v310/profilefield_types.php index 2152aaee20..5045eb8807 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_types.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_types.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_website.php b/phpBB/phpbb/db/migration/data/v310/profilefield_website.php new file mode 100644 index 0000000000..e1e10f09f4 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_website.php @@ -0,0 +1,56 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_website extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_on_memberlist', + '\phpbb\db\migration\data\v310\profilefield_icq_cleanup', + ); + } + + protected $profilefield_name = 'phpbb_website'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_website', + 'field_type' => 'profilefields.type.url', + 'field_ident' => 'phpbb_website', + 'field_length' => '40', + 'field_minlen' => '12', + 'field_maxlen' => '255', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VISIT_WEBSITE', + 'field_contact_url' => '%s', + ); + + protected $user_column_name = 'user_website'; +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_website_cleanup.php b/phpBB/phpbb/db/migration/data/v310/profilefield_website_cleanup.php new file mode 100644 index 0000000000..94442f0497 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_website_cleanup.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_website_cleanup extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_website'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_website', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_website', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_website' => array('VCHAR_UNI:200', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_wlm.php b/phpBB/phpbb/db/migration/data/v310/profilefield_wlm.php new file mode 100644 index 0000000000..2cd333fcbd --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_wlm.php @@ -0,0 +1,55 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_wlm extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_website_cleanup', + ); + } + + protected $profilefield_name = 'phpbb_wlm'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_wlm', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_wlm', + 'field_length' => '40', + 'field_minlen' => '5', + 'field_maxlen' => '255', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '.*', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 0, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => '', + 'field_contact_url' => '', + ); + + protected $user_column_name = 'user_msnm'; +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_wlm_cleanup.php b/phpBB/phpbb/db/migration/data/v310/profilefield_wlm_cleanup.php new file mode 100644 index 0000000000..7ef9e44020 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_wlm_cleanup.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_wlm_cleanup extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_msnm'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_wlm', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_msnm', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_msnm' => array('VCHAR_UNI', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_yahoo.php b/phpBB/phpbb/db/migration/data/v310/profilefield_yahoo.php new file mode 100644 index 0000000000..e269f88420 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_yahoo.php @@ -0,0 +1,55 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_yahoo extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_wlm_cleanup', + ); + } + + protected $profilefield_name = 'phpbb_yahoo'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_yahoo', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_yahoo', + 'field_length' => '40', + 'field_minlen' => '5', + 'field_maxlen' => '255', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '.*', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 0, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'SEND_YIM_MESSAGE', + 'field_contact_url' => 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg', + ); + + protected $user_column_name = 'user_yim'; +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_yahoo_cleanup.php b/phpBB/phpbb/db/migration/data/v310/profilefield_yahoo_cleanup.php new file mode 100644 index 0000000000..bd724ff7db --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_yahoo_cleanup.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_yahoo_cleanup extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_yim'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_yahoo', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_yim', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_yim' => array('VCHAR_UNI', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php b/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php new file mode 100644 index 0000000000..40a569d2a2 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php @@ -0,0 +1,61 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class profilefield_youtube extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_contact_field', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + '\phpbb\db\migration\data\v310\profilefield_types', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } + + protected $profilefield_name = 'phpbb_youtube'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_youtube', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_youtube', + 'field_length' => '20', + 'field_minlen' => '3', + 'field_maxlen' => '60', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[a-zA-Z][\w\.,\-_]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_YOUTUBE_CHANNEL', + 'field_contact_url' => 'http://youtube.com/user/%s', + ); +} diff --git a/phpBB/phpbb/db/migration/data/v310/prune_shadow_topics.php b/phpBB/phpbb/db/migration/data/v310/prune_shadow_topics.php new file mode 100644 index 0000000000..f6d27d385e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/prune_shadow_topics.php @@ -0,0 +1,50 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class prune_shadow_topics extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'enable_shadow_prune' => array('BOOL', 0), + 'prune_shadow_days' => array('UINT', 7), + 'prune_shadow_freq' => array('UINT', 1), + 'prune_shadow_next' => array('INT:11', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'enable_shadow_prune', + 'prune_shadow_days', + 'prune_shadow_freq', + 'prune_shadow_next', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rc1.php b/phpBB/phpbb/db/migration/data/v310/rc1.php new file mode 100644 index 0000000000..10ba7fefff --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc1.php @@ -0,0 +1,39 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\beta4', + '\phpbb\db\migration\data\v310\contact_admin_acp_module', + '\phpbb\db\migration\data\v310\contact_admin_form', + '\phpbb\db\migration\data\v310\passwords_convert_p2', + '\phpbb\db\migration\data\v310\profilefield_facebook', + '\phpbb\db\migration\data\v310\profilefield_googleplus', + '\phpbb\db\migration\data\v310\profilefield_skype', + '\phpbb\db\migration\data\v310\profilefield_twitter', + '\phpbb\db\migration\data\v310\profilefield_youtube', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rc2.php b/phpBB/phpbb/db/migration/data/v310/rc2.php new file mode 100644 index 0000000000..e1323659da --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc2.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rc2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rc3.php b/phpBB/phpbb/db/migration/data/v310/rc3.php new file mode 100644 index 0000000000..0e6a452251 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc3.php @@ -0,0 +1,35 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rc3 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc2', + '\phpbb\db\migration\data\v310\captcha_plugins', + '\phpbb\db\migration\data\v310\rename_too_long_indexes', + '\phpbb\db\migration\data\v310\search_type', + '\phpbb\db\migration\data\v310\topic_sort_username', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC3')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rc4.php b/phpBB/phpbb/db/migration/data/v310/rc4.php new file mode 100644 index 0000000000..47de8291c1 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc4.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rc4 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc3', + '\phpbb\db\migration\data\v310\notifications_use_full_name', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC4')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rc5.php b/phpBB/phpbb/db/migration/data/v310/rc5.php new file mode 100644 index 0000000000..5b6f70e32e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc5.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rc5 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc4', + '\phpbb\db\migration\data\v310\profilefield_field_validation_length', + '\phpbb\db\migration\data\v310\remove_acp_styles_cache', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC5')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rc6.php b/phpBB/phpbb/db/migration/data/v310/rc6.php new file mode 100644 index 0000000000..b84f2edcc9 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc6.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rc6 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc5', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC6')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php b/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php new file mode 100644 index 0000000000..7b84539814 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class remove_acp_styles_cache extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_STYLES_CACHE'"; + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + return !$module_id; + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\rc4'); + } + + public function update_data() + { + return array( + array('module.remove', array( + 'acp', + 'ACP_STYLE_MANAGEMENT', + array( + 'module_basename' => 'acp_styles', + 'module_langname' => 'ACP_STYLES_CACHE', + 'module_mode' => 'cache', + 'module_auth' => 'acl_a_styles', + ), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php b/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php new file mode 100644 index 0000000000..8d2a15d8ea --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php @@ -0,0 +1,38 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class rename_too_long_indexes extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_0'); + } + + public function update_schema() + { + return array( + 'drop_keys' => array( + $this->table_prefix . 'search_wordmatch' => array( + 'unq_mtch', + ), + ), + 'add_unique_index' => array( + $this->table_prefix . 'search_wordmatch' => array( + 'un_mtch' => array('word_id', 'post_id', 'title_match'), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php index 56b7a0916c..575a65d9dd 100644 --- a/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php +++ b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/reset_missing_captcha_plugin.php b/phpBB/phpbb/db/migration/data/v310/reset_missing_captcha_plugin.php new file mode 100644 index 0000000000..8211457dc6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/reset_missing_captcha_plugin.php @@ -0,0 +1,38 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +/** +* Class captcha_plugin +* +* Reset the captcha setting to the default plugin if the defined 'captcha_plugin' is missing. +*/ +class reset_missing_captcha_plugin extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_data() + { + return array( + array('if', array( + (is_dir($this->phpbb_root_path . 'includes/captcha/plugins/') && + !is_file($this->phpbb_root_path . "includes/captcha/plugins/{$this->config['captcha_plugin']}_plugin." . $this->php_ext)), + array('config.update', array('captcha_plugin', 'phpbb_captcha_nogd')), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/search_type.php b/phpBB/phpbb/db/migration/data/v310/search_type.php new file mode 100644 index 0000000000..f89456ae19 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/search_type.php @@ -0,0 +1,34 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class search_type extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + ); + } + + public function update_data() + { + return array( + array('if', array( + (is_file($this->phpbb_root_path . 'phpbb/search/' . $this->config['search_type'] . $this->php_ext)), + array('config.update', array('search_type', '\\phpbb\\search\\' . $this->config['search_type'])), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php index 6da1cb8009..e50f5e53a0 100644 --- a/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php +++ b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php new file mode 100644 index 0000000000..85b90da5fa --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php @@ -0,0 +1,127 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +use phpbb\db\migration\container_aware_migration; + +/** + * Migration to convert the Soft Delete MOD for 3.0 + * + * https://www.phpbb.com/customise/db/mod/soft_delete/ + */ +class soft_delete_mod_convert extends container_aware_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\alpha3', + ); + } + + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_deleted'); + } + + public function update_data() + { + return array( + array('permission.remove', array('m_harddelete', true)), + array('permission.remove', array('m_harddelete', false)), + + array('custom', array(array($this, 'convert_posts'))), + array('custom', array(array($this, 'convert_topics'))), + ); + } + + public function convert_posts($start) + { + $content_visibility = $this->get_content_visibility(); + + $limit = 250; + $i = 0; + + $sql = 'SELECT p.*, t.topic_first_post_id, t.topic_last_post_id + FROM ' . $this->table_prefix . 'posts p, ' . $this->table_prefix . 'topics t + WHERE p.post_deleted > 0 + AND t.topic_id = p.topic_id'; + $result = $this->db->sql_query_limit($sql, $limit, $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $content_visibility->set_post_visibility( + ITEM_DELETED, + $row['post_id'], + $row['topic_id'], + $row['forum_id'], + $row['post_deleted'], + $row['post_deleted_time'], + '', + ($row['post_id'] == $row['topic_first_post_id']) ? true : false, + ($row['post_id'] == $row['topic_last_post_id']) ? true : false + ); + + $i++; + } + + $this->db->sql_freeresult($result); + + if ($i == $limit) + { + return $start + $i; + } + } + + public function convert_topics($start) + { + $content_visibility = $this->get_content_visibility(); + + $limit = 100; + $i = 0; + + $sql = 'SELECT * + FROM ' . $this->table_prefix . 'topics + WHERE topic_deleted > 0'; + $result = $this->db->sql_query_limit($sql, $limit, $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $content_visibility->set_topic_visibility( + ITEM_DELETED, + $row['topic_id'], + $row['forum_id'], + $row['topic_deleted'], + $row['topic_deleted_time'], + '' + ); + + $i++; + } + + $this->db->sql_freeresult($result); + + if ($i == $limit) + { + return $start + $i; + } + } + + /** + * @return \phpbb\content_visibility + */ + protected function get_content_visibility() + { + return $this->container->get('content.visibility'); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert2.php b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert2.php new file mode 100644 index 0000000000..246a267a8c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert2.php @@ -0,0 +1,66 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +/** + * Migration to convert the Soft Delete MOD for 3.0 + * + * https://www.phpbb.com/customise/db/mod/soft_delete/ + */ +class soft_delete_mod_convert2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\soft_delete_mod_convert', + ); + } + + public function effectively_installed() + { + return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_deleted'); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array('forum_deleted_topic_count', 'forum_deleted_reply_count'), + $this->table_prefix . 'posts' => array('post_deleted', 'post_deleted_time'), + $this->table_prefix . 'topics' => array('topic_deleted', 'topic_deleted_time', 'topic_deleted_reply_count'), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_deleted_topic_count' => array('UINT', 0), + 'forum_deleted_reply_count' => array('UINT', 0), + ), + $this->table_prefix . 'posts' => array( + 'post_deleted' => array('UINT', 0), + 'post_deleted_time' => array('TIMESTAMP', 0), + ), + $this->table_prefix . 'topics' => array( + 'topic_deleted' => array('UINT', 0), + 'topic_deleted_time' => array('TIMESTAMP', 0), + 'topic_deleted_reply_count' => array('UINT', 0), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php index d1a31815b2..5e68db5889 100644 --- a/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php index f080c78c50..b1e7486e24 100644 --- a/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -149,6 +153,15 @@ class softdelete_p1 extends \phpbb\db\migration\migration $limit = 10; $converted_forums = 0; + if (!$start) + { + // Preserve the forum_posts value for link forums as it represents redirects. + $sql = 'UPDATE ' . $this->table_prefix . 'forums + SET forum_posts_approved = forum_posts + WHERE forum_type = ' . FORUM_LINK; + $this->db->sql_query($sql); + } + $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved FROM ' . $this->table_prefix . 'topics GROUP BY forum_id, topic_visibility diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php index 38b190c766..849a996c1b 100644 --- a/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php index 26f1046287..2c7b7edf2e 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -88,7 +92,7 @@ class style_update_p1 extends \phpbb\db\migration\migration else { $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_id - FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . "stles_theme c + FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . "styles_theme c WHERE t.template_id = s.template_id AND c.theme_id = s.theme_id"; } @@ -132,11 +136,11 @@ class style_update_p1 extends \phpbb\db\migration\migration if (!sizeof($valid_styles)) { // No valid styles: remove everything and add prosilver - $this->sql_query('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary); + $this->sql_query('DELETE FROM ' . STYLES_TABLE); $sql_ary = array( 'style_name' => 'prosilver', - 'style_copyright' => '© phpBB Group', + 'style_copyright' => '© phpBB Limited', 'style_active' => 1, 'style_path' => 'prosilver', 'bbcode_bitfield' => 'lNg=', @@ -153,13 +157,13 @@ class style_update_p1 extends \phpbb\db\migration\migration $this->sql_query($sql); $sql = 'SELECT style_id - FROM ' . $table . " + FROM ' . STYLES_TABLE . " WHERE style_name = 'prosilver'"; $result = $this->sql_query($sql); - $default_style = $this->db->sql_fetchfield($result); + $default_style = $this->db->sql_fetchfield('style_id'); $this->db->sql_freeresult($result); - set_config('default_style', $default_style); + $this->config->set('default_style', $default_style); $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0'; $this->sql_query($sql); diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php index 40d6a4dbbd..52c8ffb2e2 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php index 172435c672..f8edbc3492 100644 --- a/phpBB/phpbb/db/migration/data/v310/teampage.php +++ b/phpBB/phpbb/db/migration/data/v310/teampage.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/timezone.php b/phpBB/phpbb/db/migration/data/v310/timezone.php index dd0c6a2093..1f6b47ad50 100644 --- a/phpBB/phpbb/db/migration/data/v310/timezone.php +++ b/phpBB/phpbb/db/migration/data/v310/timezone.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -39,23 +43,48 @@ class timezone extends \phpbb\db\migration\migration ); } - public function update_timezones() + public function update_timezones($start) { - // Update user timezones - $sql = 'SELECT user_dst, user_timezone - FROM ' . $this->table_prefix . 'users - GROUP BY user_timezone, user_dst'; - $result = $this->db->sql_query($sql); + $start = (int) $start; + $limit = 500; + $converted = 0; + + $update_blocks = array(); + $sql = 'SELECT user_id, user_timezone, user_dst + FROM ' . $this->table_prefix . 'users + ORDER BY user_id ASC'; + $result = $this->db->sql_query_limit($sql, $limit, $start); while ($row = $this->db->sql_fetchrow($result)) { + $converted++; + + // In case this is somehow run twice on a row. + // Otherwise it would just end up as UTC on the second run + if (is_numeric($row['user_timezone'])) + { + $update_blocks[$row['user_timezone'] . ':' . $row['user_dst']][] = (int) $row['user_id']; + } + } + $this->db->sql_freeresult($result); + + // Update blocks of users who share the same timezone/dst + foreach ($update_blocks as $timezone => $user_ids) + { + $timezone = explode(':', $timezone); + $converted_timezone = $this->convert_phpbb30_timezone($timezone[0], $timezone[1]); + $sql = 'UPDATE ' . $this->table_prefix . "users - SET user_timezone = '" . $this->db->sql_escape($this->convert_phpbb30_timezone($row['user_timezone'], $row['user_dst'])) . "' - WHERE user_timezone = '" . $this->db->sql_escape($row['user_timezone']) . "' - AND user_dst = " . (int) $row['user_dst']; + SET user_timezone = '" . $this->db->sql_escape($converted_timezone) . "' + WHERE " . $this->db->sql_in_set('user_id', $user_ids); $this->sql_query($sql); } - $this->db->sql_freeresult($result); + + if ($converted == $limit) + { + // There are still more to convert + return $start + $limit; + } // Update board default timezone $sql = 'UPDATE ' . $this->table_prefix . "config diff --git a/phpBB/phpbb/db/migration/data/v310/timezone_p2.php b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php index 1066ab8571..3ac7ab3c51 100644 --- a/phpBB/phpbb/db/migration/data/v310/timezone_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v310/topic_sort_username.php b/phpBB/phpbb/db/migration/data/v310/topic_sort_username.php new file mode 100644 index 0000000000..527da20590 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/topic_sort_username.php @@ -0,0 +1,44 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class topic_sort_username extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'topics' => array( + 'topic_first_poster_name' => array('VCHAR_UNI:255', '', 'true_sort'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'topics' => array( + 'topic_first_poster_name' => array('VCHAR_UNI:255', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php b/phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php index f8ada6c6f5..8600f6ee27 100644 --- a/phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php +++ b/phpBB/phpbb/db/migration/data/v310/ucp_popuppm_module.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php new file mode 100644 index 0000000000..bdf83f3d62 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php @@ -0,0 +1,35 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class increase_size_of_dateformat extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v317', + ); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'users' => array( + 'user_dateformat' => array('VCHAR_UNI:64', 'd M Y H:i'), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/m_pm_report.php b/phpBB/phpbb/db/migration/data/v31x/m_pm_report.php new file mode 100644 index 0000000000..9b5710c639 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/m_pm_report.php @@ -0,0 +1,64 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class m_pm_report extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v316rc1'); + } + + public function update_data() + { + return array( + array('permission.add', array('m_pm_report', true, 'm_report')), + array('custom', array( + array($this, 'update_module_auth'), + ), + ), + ); + } + + public function revert_data() + { + return array( + array('permission.remove', array('m_pm_report')), + array('custom', array( + array($this, 'revert_module_auth'), + ), + ), + ); + } + + public function update_module_auth() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET module_auth = 'acl_m_pm_report' + WHERE module_class = 'mcp' + AND module_basename = 'mcp_pm_reports' + AND module_auth = 'aclf_m_report'"; + $this->db->sql_query($sql); + } + + public function revert_module_auth() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET module_auth = 'aclf_m_report' + WHERE module_class = 'mcp' + AND module_basename = 'mcp_pm_reports' + AND module_auth = 'acl_m_pm_report'"; + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/m_softdelete_global.php b/phpBB/phpbb/db/migration/data/v31x/m_softdelete_global.php new file mode 100644 index 0000000000..dd7e20e762 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/m_softdelete_global.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class m_softdelete_global extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v311'); + } + + public function update_data() + { + return array( + // Make m_softdelete global. The add method will take care of updating + // it if it already exists. + array('permission.add', array('m_softdelete', true)), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/plupload_last_gc_dynamic.php b/phpBB/phpbb/db/migration/data/v31x/plupload_last_gc_dynamic.php new file mode 100644 index 0000000000..0783d707c5 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/plupload_last_gc_dynamic.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class plupload_last_gc_dynamic extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v312'); + } + + public function update_data() + { + return array( + // Make plupload_last_gc dynamic. + array('config.remove', array('plupload_last_gc')), + array('config.add', array('plupload_last_gc', 0, 1)), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/profilefield_remove_underscore_from_alpha.php b/phpBB/phpbb/db/migration/data/v31x/profilefield_remove_underscore_from_alpha.php new file mode 100644 index 0000000000..60491f8de8 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/profilefield_remove_underscore_from_alpha.php @@ -0,0 +1,47 @@ +<?php + +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v31x; + +class profilefield_remove_underscore_from_alpha extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v311'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'remove_underscore_from_alpha_validations'))), + ); + } + + public function remove_underscore_from_alpha_validations() + { + $this->update_validation_rule('[\w]+', '[a-zA-Z0-9]+'); + $this->update_validation_rule('[\w_]+', '[\w]+'); + $this->update_validation_rule('[\w.]+', '[a-zA-Z0-9.]+'); + $this->update_validation_rule('[\w\x20_+\-\[\]]+', '[\w\x20+\-\[\]]+'); + $this->update_validation_rule('[a-zA-Z][\w\.,\-_]+', '[a-zA-Z][\w\.,\-]+'); + } + + public function update_validation_rule($old_validation, $new_validation) + { + $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " + SET field_validation = '" . $this->db->sql_escape($new_validation) . "' + WHERE field_validation = '" . $this->db->sql_escape($old_validation) . "'"; + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/profilefield_yahoo_update_url.php b/phpBB/phpbb/db/migration/data/v31x/profilefield_yahoo_update_url.php new file mode 100644 index 0000000000..4df9083bdf --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/profilefield_yahoo_update_url.php @@ -0,0 +1,38 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class profilefield_yahoo_update_url extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v312'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_contact_url'))), + ); + } + + public function update_contact_url() + { + $sql = 'UPDATE ' . $this->table_prefix . "profile_fields + SET field_contact_url = 'ymsgr:sendim?%s' + WHERE field_name = 'phpbb_yahoo' + AND field_contact_url = 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg'"; + $this->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/style_update.php b/phpBB/phpbb/db/migration/data/v31x/style_update.php new file mode 100644 index 0000000000..bb030bbe6d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/style_update.php @@ -0,0 +1,136 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class style_update extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\gold'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_installed_styles'))), + ); + } + + public function update_installed_styles() + { + // Get all currently available styles + $styles = $this->find_style_dirs(); + $style_paths = $style_ids = array(); + + $sql = 'SELECT style_path, style_id + FROM ' . $this->table_prefix . 'styles'; + $result = $this->db->sql_query($sql); + while ($styles_row = $this->db->sql_fetchrow()) + { + if (in_array($styles_row['style_path'], $styles)) + { + $style_paths[] = $styles_row['style_path']; + $style_ids[] = $styles_row['style_id']; + } + } + $this->db->sql_freeresult($result); + + // Install prosilver if no style is available and prosilver can be installed + if (empty($style_paths) && in_array('prosilver', $styles)) + { + // Try to parse config file + $cfg = parse_cfg_file($this->phpbb_root_path . 'styles/prosilver/style.cfg'); + + // Stop running this if prosilver cfg file can't be read + if (empty($cfg)) + { + throw new \RuntimeException('No styles available and could not fall back to prosilver.'); + } + + $style = array( + 'style_name' => 'prosilver', + 'style_copyright' => '© phpBB Limited', + 'style_active' => 1, + 'style_path' => 'prosilver', + 'bbcode_bitfield' => 'kNg=', + 'style_parent_id' => 0, + 'style_parent_tree' => '', + ); + + // Add to database + $this->db->sql_transaction('begin'); + + $sql = 'INSERT INTO ' . $this->table_prefix . 'styles + ' . $this->db->sql_build_array('INSERT', $style); + $this->db->sql_query($sql); + + $style_id = $this->db->sql_nextid(); + $style_ids[] = $style_id; + + $this->db->sql_transaction('commit'); + + // Set prosilver to default style + $this->config->set('default_style', $style_id); + } + else if (empty($styles) && empty($available_styles)) + { + throw new \RuntimeException('No valid styles available'); + } + + // Make sure default style is available + if (!in_array($this->config['default_style'], $style_ids)) + { + $this->config->set('default_style', array_pop($style_ids)); + } + + // Reset users to default style if their user_style is nonexistent + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_style = {$this->config['default_style']} + WHERE " . $this->db->sql_in_set('user_style', $style_ids, true, true); + $this->db->sql_query($sql); + } + + /** + * Find all directories that have styles + * Copied from acp_styles + * + * @return array Directory names + */ + protected function find_style_dirs() + { + $styles = array(); + $styles_path = $this->phpbb_root_path . 'styles/'; + + $dp = @opendir($styles_path); + if ($dp) + { + while (($file = readdir($dp)) !== false) + { + $dir = $styles_path . $file; + if ($file[0] == '.' || !is_dir($dir)) + { + continue; + } + + if (file_exists("{$dir}/style.cfg")) + { + $styles[] = $file; + } + } + closedir($dp); + } + + return $styles; + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php b/phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php new file mode 100644 index 0000000000..14b7b7b0f6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php @@ -0,0 +1,69 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class update_custom_bbcodes_with_idn extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v312', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_bbcodes_table'))), + ); + } + + public function update_bbcodes_table() + { + if (!class_exists('acp_bbcodes')) + { + include($this->phpbb_root_path . 'includes/acp/acp_bbcodes.' . $this->php_ext); + } + + $bbcodes = new \acp_bbcodes(); + + $sql = 'SELECT bbcode_id, bbcode_match, bbcode_tpl + FROM ' . BBCODES_TABLE; + $result = $this->sql_query($sql); + + $sql_ary = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + if (preg_match('/(URL|LOCAL_URL|RELATIVE_URL)/', $row['bbcode_match'])) + { + $data = $bbcodes->build_regexp($row['bbcode_match'], $row['bbcode_tpl']); + $sql_ary[$row['bbcode_id']] = array( + 'first_pass_match' => $data['first_pass_match'], + 'first_pass_replace' => $data['first_pass_replace'], + 'second_pass_match' => $data['second_pass_match'], + 'second_pass_replace' => $data['second_pass_replace'] + ); + } + } + $this->db->sql_freeresult($result); + + foreach ($sql_ary as $bbcode_id => $bbcode_data) + { + $sql = 'UPDATE ' . BBCODES_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $bbcode_data) . ' + WHERE bbcode_id = ' . (int) $bbcode_id; + $this->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v311.php b/phpBB/phpbb/db/migration/data/v31x/v311.php new file mode 100644 index 0000000000..00844dd4c0 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v311.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v311 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\gold', + '\phpbb\db\migration\data\v31x\style_update', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v312.php b/phpBB/phpbb/db/migration/data/v31x/v312.php new file mode 100644 index 0000000000..bf49935f4d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v312.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v312 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v312rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v312rc1.php b/phpBB/phpbb/db/migration/data/v31x/v312rc1.php new file mode 100644 index 0000000000..d4b133fc01 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v312rc1.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v312rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v311', + '\phpbb\db\migration\data\v31x\m_softdelete_global', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.2-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v313.php b/phpBB/phpbb/db/migration/data/v31x/v313.php new file mode 100644 index 0000000000..5a4e21a9b7 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v313.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v313 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v313rc2', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.3')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v313rc1.php b/phpBB/phpbb/db/migration/data/v31x/v313rc1.php new file mode 100644 index 0000000000..e50754f805 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v313rc1.php @@ -0,0 +1,35 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v313rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v30x\release_3_0_13_rc1', + '\phpbb\db\migration\data\v31x\plupload_last_gc_dynamic', + '\phpbb\db\migration\data\v31x\profilefield_remove_underscore_from_alpha', + '\phpbb\db\migration\data\v31x\profilefield_yahoo_update_url', + '\phpbb\db\migration\data\v31x\update_custom_bbcodes_with_idn', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.3-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v313rc2.php b/phpBB/phpbb/db/migration/data/v31x/v313rc2.php new file mode 100644 index 0000000000..d832d6f502 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v313rc2.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v313rc2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v30x\release_3_0_13_pl1', + '\phpbb\db\migration\data\v31x\v313rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.3-RC2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v314.php b/phpBB/phpbb/db/migration/data/v31x/v314.php new file mode 100644 index 0000000000..b7793ca569 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v314.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v314 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v30x\release_3_0_14', + '\phpbb\db\migration\data\v31x\v314rc2', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.4')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc1.php b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php new file mode 100644 index 0000000000..10cdbe3f9c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v314rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v313', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.4-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc2.php b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php new file mode 100644 index 0000000000..b75b7a9be8 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v314rc2 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v30x\release_3_0_14_rc1', + '\phpbb\db\migration\data\v31x\v314rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.4-RC2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v315.php b/phpBB/phpbb/db/migration/data/v31x/v315.php new file mode 100644 index 0000000000..778cdf717e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v315.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v315 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v315rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.5')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v315rc1.php b/phpBB/phpbb/db/migration/data/v31x/v315rc1.php new file mode 100644 index 0000000000..4cf4472aa7 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v315rc1.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v315rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v314', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.5-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v316.php b/phpBB/phpbb/db/migration/data/v31x/v316.php new file mode 100644 index 0000000000..cec113eff2 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v316.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v316 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v316rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.6')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v316rc1.php b/phpBB/phpbb/db/migration/data/v31x/v316rc1.php new file mode 100644 index 0000000000..487cd05e5d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v316rc1.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v316rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v315', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.6-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v317.php b/phpBB/phpbb/db/migration/data/v31x/v317.php new file mode 100644 index 0000000000..15ba2a1feb --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v317.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v317 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v317rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.7')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v317pl1.php b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php new file mode 100644 index 0000000000..2e1b0e9b9d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v317pl1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v317', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.7-pl1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v317rc1.php b/phpBB/phpbb/db/migration/data/v31x/v317rc1.php new file mode 100644 index 0000000000..fa24819094 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v317rc1.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class v317rc1 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\m_pm_report', + '\phpbb\db\migration\data\v31x\v316', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.7-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php new file mode 100644 index 0000000000..726822bc71 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class allowed_schemes_links extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function update_data() + { + return array( + array('config.add', array('allowed_schemes_links', 'http,https,ftp')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php b/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php new file mode 100644 index 0000000000..7afecb884b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php @@ -0,0 +1,43 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class announce_global_permission extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + $sql = 'SELECT auth_option_id + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option = 'f_announce_global'"; + $result = $this->db->sql_query($sql); + $auth_option_id = $this->db->sql_fetchfield('auth_option_id'); + $this->db->sql_freeresult($result); + + return $auth_option_id !== false; + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function update_data() + { + return array( + array('permission.add', array('f_announce_global', false, 'f_announce')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/dev.php b/phpBB/phpbb/db/migration/data/v320/dev.php new file mode 100644 index 0000000000..ad2da3c1f4 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/dev.php @@ -0,0 +1,36 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class dev extends \phpbb\db\migration\container_aware_migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.2.0-dev', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v316', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.0-dev')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php b/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php new file mode 100644 index 0000000000..817b638037 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php @@ -0,0 +1,36 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class font_awesome_update extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function effectively_installed() + { + return isset($this->config['load_font_awesome_url']); + } + + public function update_data() + { + return array( + array('config.add', array('load_font_awesome_url', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/icons_alt.php b/phpBB/phpbb/db/migration/data/v320/icons_alt.php new file mode 100644 index 0000000000..80132e579e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/icons_alt.php @@ -0,0 +1,46 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class icons_alt extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'icons' => array( + 'icons_alt' => array('VCHAR', '', 'after' => 'icons_height'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'icons' => array( + 'icons_alt', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/log_post_id.php b/phpBB/phpbb/db/migration/data/v320/log_post_id.php new file mode 100644 index 0000000000..ead53c8138 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/log_post_id.php @@ -0,0 +1,46 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class log_post_id extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'log' => array( + 'post_id' => array('UINT', 0, 'after' => 'topic_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'log' => array( + 'post_id', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/notifications_board.php b/phpBB/phpbb/db/migration/data/v320/notifications_board.php new file mode 100644 index 0000000000..8a76ebab58 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/notifications_board.php @@ -0,0 +1,75 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class notifications_board extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function update_data() + { + return array( + array('config.add', array('allow_board_notifications', 1)), + array('custom', array(array($this, 'update_user_subscriptions'))), + array('custom', array(array($this, 'update_module'))), + ); + } + + public function update_module() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET auth = 'cfg_allow_board_notifications' + WHERE module_basename = 'ucp_notifications' + AND module_mode = 'notification_list'"; + $this->sql_query($sql); + } + + public function update_user_subscriptions() + { + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET method = 'notification.method.board' + WHERE method = ''"; + $this->sql_query($sql); + } + + public function revert_data() + { + return array( + array('custom', array(array($this, 'revert_user_subscriptions'))), + array('custom', array(array($this, 'revert_module'))), + ); + } + + public function revert_user_subscriptions() + { + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET method = '' + WHERE method = 'notification.method.board'"; + $this->sql_query($sql); + } + + public function revert_module() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET auth = '' + WHERE module_basename = 'ucp_notifications' + AND module_mode = 'notification_list'"; + $this->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/oauth_states.php b/phpBB/phpbb/db/migration/data/v320/oauth_states.php new file mode 100644 index 0000000000..22ab2dabb3 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/oauth_states.php @@ -0,0 +1,56 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class oauth_states extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\auth_provider_oauth'); + } + + public function effectively_installed() + { + return $this->db_tools->sql_table_exists($this->table_prefix . 'oauth_states'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'oauth_states' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'session_id' => array('CHAR:32', ''), + 'provider' => array('VCHAR', ''), + 'oauth_state' => array('VCHAR', ''), + ), + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + 'provider' => array('INDEX', 'provider'), + ), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'oauth_states', + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php new file mode 100644 index 0000000000..c14d31f1c0 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php @@ -0,0 +1,90 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class remove_outdated_media extends \phpbb\db\migration\migration +{ + protected $cat_id = array( + ATTACHMENT_CATEGORY_WM, + ATTACHMENT_CATEGORY_RM, + ATTACHMENT_CATEGORY_QUICKTIME, + ); + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'change_extension_group'))), + ); + } + + public function change_extension_group() + { + // select group ids of outdated media + $sql = 'SELECT group_id + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE ' . $this->db->sql_in_set('cat_id', $this->cat_id); + $result = $this->db->sql_query($sql); + + $group_ids = array(); + while ($group_id = (int) $this->db->sql_fetchfield('group_id')) + { + $group_ids[] = $group_id; + } + $this->db->sql_freeresult($result); + + // nothing to do, admin has removed all the outdated media extension groups + if (empty($group_ids)) + { + return true; + } + + // get the group id of downloadable files + $sql = 'SELECT group_id + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_name = 'DOWNLOADABLE_FILES'"; + $result = $this->db->sql_query($sql); + $download_id = (int) $this->db->sql_fetchfield('group_id'); + $this->db->sql_freeresult($result); + + if (empty($download_id)) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . ' + SET group_id = 0 + WHERE ' . $this->db->sql_in_set('group_id', $group_ids); + } + else + { + // move outdated media extensions to downloadable files + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = $download_id" . ' + WHERE ' . $this->db->sql_in_set('group_id', $group_ids); + } + + $result = $this->db->sql_query($sql); + $this->db->sql_freeresult($result); + + // delete the now empty, outdated media extension groups + $sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE ' . $this->db->sql_in_set('group_id', $group_ids); + $result = $this->db->sql_query($sql); + $this->db->sql_freeresult($result); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php b/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php new file mode 100644 index 0000000000..1cb9070bf9 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php @@ -0,0 +1,152 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class remove_profilefield_wlm extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields_data' => array( + 'pf_phpbb_wlm', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields_data' => array( + 'pf_phpbb_wlm' => array('VCHAR', ''), + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'delete_custom_profile_field_data'))), + ); + } + + public function revert_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } + + public function delete_custom_profile_field_data() + { + $field_id = $this->get_custom_profile_field_id(); + + $sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + } + + /** + * Get custom profile field id + * @return int custom profile filed id + */ + public function get_custom_profile_field_id() + { + $sql = 'SELECT field_id + FROM ' . PROFILE_FIELDS_TABLE . " + WHERE field_name = 'phpbb_wlm'"; + $result = $this->db->sql_query($sql); + $field_id = (int) $this->db->sql_fetchfield('field_id'); + $this->db->sql_freeresult($result); + + return $field_id; + } + + public function create_custom_field() + { + $sql = 'SELECT MAX(field_order) as max_field_order + FROM ' . PROFILE_FIELDS_TABLE; + $result = $this->db->sql_query($sql); + $max_field_order = (int) $this->db->sql_fetchfield('max_field_order'); + $this->db->sql_freeresult($result); + + $sql_ary = array( + 'field_name' => 'phpbb_wlm', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_wlm', + 'field_length' => '40', + 'field_minlen' => '5', + 'field_maxlen' => '255', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '.*', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_on_ml' => 0, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => '', + 'field_contact_url' => '', + 'field_order' => $max_field_order + 1, + ); + + $sql = 'INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + $field_id = (int) $this->db->sql_nextid(); + + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE); + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE; + $result = $this->db->sql_query($sql); + $lang_name = 'WLM'; + while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) + { + $insert_buffer->insert(array( + 'field_id' => (int) $field_id, + 'lang_id' => (int) $lang_id, + 'lang_name' => $lang_name, + 'lang_explain' => '', + 'lang_default_value' => '', + )); + } + $this->db->sql_freeresult($result); + + $insert_buffer->flush(); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/text_reparser.php b/phpBB/phpbb/db/migration/data/v320/text_reparser.php new file mode 100644 index 0000000000..1d73b74a76 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/text_reparser.php @@ -0,0 +1,101 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v320; + +class text_reparser extends \phpbb\db\migration\container_aware_migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\contact_admin_form'); + } + + public function effectively_installed() + { + return isset($this->config['reparse_lock']); + } + + public function update_data() + { + return array( + array('config.add', array('reparse_lock', 0, true)), + array('config.add', array('text_reparser.pm_text_cron_interval', 10)), + array('config.add', array('text_reparser.pm_text_last_cron', 0)), + array('config.add', array('text_reparser.poll_option_cron_interval', 10)), + array('config.add', array('text_reparser.poll_option_last_cron', 0)), + array('config.add', array('text_reparser.poll_title_cron_interval', 10)), + array('config.add', array('text_reparser.poll_title_last_cron', 0)), + array('config.add', array('text_reparser.post_text_cron_interval', 10)), + array('config.add', array('text_reparser.post_text_last_cron', 0)), + array('config.add', array('text_reparser.user_signature_cron_interval', 10)), + array('config.add', array('text_reparser.user_signature_last_cron', 0)), + array('custom', array(array($this, 'reparse'))), + ); + } + + public function reparse($resume_data) + { + // Somtimes a cron job is too much + $limit = 100; + $fast_reparsers = array( + 'text_reparser.contact_admin_info', + 'text_reparser.forum_description', + 'text_reparser.forum_rules', + 'text_reparser.group_description', + ); + + if (!is_array($resume_data)) + { + $resume_data = array( + 'reparser' => 0, + 'current' => $this->container->get($fast_reparsers[0])->get_max_id(), + ); + } + + $fast_reparsers_size = sizeof($fast_reparsers); + $processed_records = 0; + while ($processed_records < $limit && $resume_data['reparser'] < $fast_reparsers_size) + { + $reparser = $this->container->get($fast_reparsers[$resume_data['reparser']]); + + // New reparser + if ($resume_data['current'] === 0) + { + $resume_data['current'] = $reparser->get_max_id(); + } + + $start = max(1, $resume_data['current'] + 1 - ($limit - $processed_records)); + $end = max(1, $resume_data['current']); + $reparser->reparse_range($start, $end); + + $processed_records = $end - $start + 1; + $resume_data['current'] = $start - 1; + + if ($start === 1) + { + // Prevent CLI command from running these reparsers again + $reparser_manager = $this->container->get('text_reparser.manager'); + $reparser_manager->update_resume_data($fast_reparsers[$resume_data['reparser']], 1, 0, $limit); + + $resume_data['reparser']++; + } + } + + if ($resume_data['reparser'] === $fast_reparsers_size) + { + return true; + } + + return $resume_data; + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/v320a1.php b/phpBB/phpbb/db/migration/data/v320/v320a1.php new file mode 100644 index 0000000000..d7ecb36f90 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/v320a1.php @@ -0,0 +1,44 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class v320a1 extends \phpbb\db\migration\container_aware_migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.2.0-a1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v320\dev', + '\phpbb\db\migration\data\v320\allowed_schemes_links', + '\phpbb\db\migration\data\v320\announce_global_permission', + '\phpbb\db\migration\data\v320\remove_profilefield_wlm', + '\phpbb\db\migration\data\v320\font_awesome_update', + '\phpbb\db\migration\data\v320\icons_alt', + '\phpbb\db\migration\data\v320\log_post_id', + '\phpbb\db\migration\data\v320\remove_outdated_media', + '\phpbb\db\migration\data\v320\notifications_board', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.0-dev')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v320/v320a2.php b/phpBB/phpbb/db/migration/data/v320/v320a2.php new file mode 100644 index 0000000000..ae53a73210 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/v320a2.php @@ -0,0 +1,38 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class v320a2 extends \phpbb\db\migration\container_aware_migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.2.0-a2', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v317rc1', + '\phpbb\db\migration\data\v320\text_reparser', + '\phpbb\db\migration\data\v320\v320a1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.0-a2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php index cfe546d1ab..7990e85f2d 100644 --- a/phpBB/phpbb/db/migration/exception.php +++ b/phpBB/phpbb/db/migration/exception.php @@ -1,9 +1,13 @@ <?php /** * -* @package db -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\db\migration; /** * The migrator is responsible for applying new migrations in the correct order. -* -* @package db */ class exception extends \Exception { diff --git a/phpBB/phpbb/db/migration/helper.php b/phpBB/phpbb/db/migration/helper.php index 009ad1da9f..e40deeb37b 100644 --- a/phpBB/phpbb/db/migration/helper.php +++ b/phpBB/phpbb/db/migration/helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package db -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\db\migration; /** * The migrator is responsible for applying new migrations in the correct order. -* -* @package db */ class helper { diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php index b32de00871..2304c8e44c 100644 --- a/phpBB/phpbb/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php @@ -1,9 +1,13 @@ <?php /** * -* @package db -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,18 +19,16 @@ namespace phpbb\db\migration; * Each migration consists of a set of schema and data changes to be implemented * in a subclass. This class provides various utility methods to simplify editing * a phpBB. -* -* @package db */ abstract class migration { /** @var \phpbb\config\config */ protected $config; - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\db\tools */ + /** @var \phpbb\db\tools\tools_interface */ protected $db_tools; /** @var string */ @@ -48,13 +50,13 @@ abstract class migration * Constructor * * @param \phpbb\config\config $config - * @param \phpbb\db\driver\driver $db - * @param \phpbb\db\tools $db_tools + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\db\tools\tools_interface $db_tools * @param string $phpbb_root_path * @param string $php_ext * @param string $table_prefix */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix) + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix) { $this->config = $config; $this->db = $db; @@ -158,11 +160,11 @@ abstract class migration else { $result = $this->db->sql_query($sql); - if ($this->db->sql_error_triggered) + if ($this->db->get_sql_error_triggered()) { $this->errors[] = array( - 'sql' => $this->db->sql_error_sql, - 'code' => $this->db->sql_error_returned, + 'sql' => $this->db->get_sql_error_sql(), + 'code' => $this->db->get_sql_error_returned(), ); } } diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index dec7a4c2bb..3f26a4998c 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -1,15 +1,19 @@ <?php /** * -* @package migration -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\db\migration; -abstract class profilefield_base_migration extends \phpbb\db\migration\migration +abstract class profilefield_base_migration extends container_aware_migration { protected $profilefield_name; @@ -17,6 +21,23 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration protected $profilefield_data; + /** + * Language data should be in array -> each language_data in separate key + * array( + * array( + * 'option_id' => value, + * 'field_type' => value, + * 'lang_value' => value, + * ), + * array( + * 'option_id' => value, + * 'field_type' => value, + * 'lang_value' => value, + * ), + * ) + */ + protected $profilefield_language_data; + protected $user_column_name; public function effectively_installed() @@ -54,6 +75,13 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration ); } + public function revert_data() + { + return array( + array('custom', array(array($this, 'delete_custom_profile_field_data'))), + ); + } + public function create_custom_field() { $sql = 'SELECT MAX(field_order) as max_field_order @@ -75,12 +103,13 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration $sql = 'SELECT lang_id FROM ' . LANG_TABLE; $result = $this->db->sql_query($sql); + $lang_name = (strpos($this->profilefield_name, 'phpbb_') === 0) ? strtoupper(substr($this->profilefield_name, 6)) : strtoupper($this->profilefield_name); while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) { $insert_buffer->insert(array( - 'field_id' => $field_id, - 'lang_id' => $lang_id, - 'lang_name' => strtoupper(substr($this->profilefield_name, 6)),// Remove phpbb_ from field name + 'field_id' => (int) $field_id, + 'lang_id' => (int) $lang_id, + 'lang_name' => $lang_name, 'lang_explain' => '', 'lang_default_value' => '', )); @@ -91,6 +120,69 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration } /** + * Create Custom profile fields languguage entries + */ + public function create_language_entries() + { + $field_id = $this->get_custom_profile_field_id(); + + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_FIELDS_LANG_TABLE); + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE; + $result = $this->db->sql_query($sql); + while ($lang_id = (int) $this->db->sql_fetchfield('lang_id')) + { + foreach ($this->profilefield_language_data as $language_data) + { + $insert_buffer->insert(array_merge(array( + 'field_id' => (int) $field_id, + 'lang_id' => (int) $lang_id, + ), $language_data)); + } + } + $this->db->sql_freeresult($result); + + $insert_buffer->flush(); + } + + /** + * Clean database when reverting the migration + */ + public function delete_custom_profile_field_data() + { + $field_id = $this->get_custom_profile_field_id(); + + $sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' + WHERE field_id = ' . (int) $field_id; + $this->db->sql_query($sql); + } + + /** + * Get custom profile field id + * @return int custom profile filed id + */ + public function get_custom_profile_field_id() + { + $sql = 'SELECT field_id + FROM ' . PROFILE_FIELDS_TABLE . " + WHERE field_name = '" . $this->profilefield_name . "'"; + $result = $this->db->sql_query($sql); + $field_id = (int) $this->db->sql_fetchfield('field_id'); + $this->db->sql_freeresult($result); + + return $field_id; + } + + /** * @param int $start Start of staggering step * @return mixed int start of the next step, null if the end was reached */ @@ -145,8 +237,8 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration if ($profile_row === null) { - global $phpbb_container; - $manager = $phpbb_container->get('profilefields.manager'); + /* @var $manager \phpbb\profilefields\manager */ + $manager = $this->container->get('profilefields.manager'); $profile_row = $manager->build_insert_sql_array(array()); } diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php new file mode 100644 index 0000000000..7003844bc4 --- /dev/null +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -0,0 +1,235 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration; + +/** +* The schema generator generates the schema based on the existing migrations +*/ +class schema_generator +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\db\tools\tools_interface */ + protected $db_tools; + + /** @var array */ + protected $class_names; + + /** @var string */ + protected $table_prefix; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var array */ + protected $tables; + + /** @var array */ + protected $dependencies = array(); + + /** + * Constructor + */ + public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $phpbb_root_path, $php_ext, $table_prefix) + { + $this->config = $config; + $this->db = $db; + $this->db_tools = $db_tools; + $this->class_names = $class_names; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->table_prefix = $table_prefix; + } + + /** + * Loads all migrations and their application state from the database. + * + * @return array + */ + public function get_schema() + { + if (!empty($this->tables)) + { + return $this->tables; + } + + $migrations = $this->class_names; + + $tree = array(); + $check_dependencies = true; + while (!empty($migrations)) + { + foreach ($migrations as $migration_class) + { + $open_dependencies = array_diff($migration_class::depends_on(), $tree); + + if (empty($open_dependencies)) + { + $migration = new $migration_class($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); + $tree[] = $migration_class; + $migration_key = array_search($migration_class, $migrations); + + foreach ($migration->update_schema() as $change_type => $data) + { + if ($change_type === 'add_tables') + { + foreach ($data as $table => $table_data) + { + $this->tables[$table] = $table_data; + } + } + else if ($change_type === 'drop_tables') + { + foreach ($data as $table) + { + unset($this->tables[$table]); + } + } + else if ($change_type === 'add_columns') + { + foreach ($data as $table => $add_columns) + { + foreach ($add_columns as $column => $column_data) + { + if (isset($column_data['after'])) + { + $columns = $this->tables[$table]['COLUMNS']; + $offset = array_search($column_data['after'], array_keys($columns)); + unset($column_data['after']); + + if ($offset === false) + { + $this->tables[$table]['COLUMNS'][$column] = array_values($column_data); + } + else + { + $this->tables[$table]['COLUMNS'] = array_merge(array_slice($columns, 0, $offset + 1, true), array($column => array_values($column_data)), array_slice($columns, $offset)); + } + } + else + { + $this->tables[$table]['COLUMNS'][$column] = $column_data; + } + } + } + } + else if ($change_type === 'change_columns') + { + foreach ($data as $table => $change_columns) + { + foreach ($change_columns as $column => $column_data) + { + $this->tables[$table]['COLUMNS'][$column] = $column_data; + } + } + } + else if ($change_type === 'drop_columns') + { + foreach ($data as $table => $drop_columns) + { + if (is_array($drop_columns)) + { + foreach ($drop_columns as $column) + { + unset($this->tables[$table]['COLUMNS'][$column]); + } + } + else + { + unset($this->tables[$table]['COLUMNS'][$drop_columns]); + } + } + } + else if ($change_type === 'add_unique_index') + { + foreach ($data as $table => $add_index) + { + foreach ($add_index as $key => $index_data) + { + $this->tables[$table]['KEYS'][$key] = array('UNIQUE', $index_data); + } + } + } + else if ($change_type === 'add_index') + { + foreach ($data as $table => $add_index) + { + foreach ($add_index as $key => $index_data) + { + $this->tables[$table]['KEYS'][$key] = array('INDEX', $index_data); + } + } + } + else if ($change_type === 'drop_keys') + { + foreach ($data as $table => $drop_keys) + { + foreach ($drop_keys as $key) + { + unset($this->tables[$table]['KEYS'][$key]); + } + } + } + else + { + var_dump($change_type); + } + } + unset($migrations[$migration_key]); + } + else if ($check_dependencies) + { + $this->dependencies = array_merge($this->dependencies, $open_dependencies); + } + } + + // Only run this check after the first run + if ($check_dependencies) + { + $this->check_dependencies(); + $check_dependencies = false; + } + } + + ksort($this->tables); + return $this->tables; + } + + /** + * Check if one of the migrations files' dependencies can't be resolved + * by the supplied list of migrations + * + * @throws \UnexpectedValueException If a dependency can't be resolved + */ + protected function check_dependencies() + { + // Strip duplicate values from array + $this->dependencies = array_unique($this->dependencies); + + foreach ($this->dependencies as $dependency) + { + if (!in_array($dependency, $this->class_names)) + { + throw new \UnexpectedValueException("Unable to resolve the dependency '$dependency'"); + } + } + } +} diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 36a1931f4e..f93e7118c4 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\db\migration\tool; /** * Migration config tool -* -* @package db */ class config implements \phpbb\db\migration\tool\tool_interface { @@ -64,6 +66,7 @@ class config implements \phpbb\db\migration\tool\tool_interface * like to update * @param mixed $config_value The value of the config setting * @return null + * @throws \phpbb\db\migration\exception */ public function update($config_name, $config_value) { @@ -85,6 +88,7 @@ class config implements \phpbb\db\migration\tool\tool_interface * like to update * @param mixed $config_value The value of the config setting * @return null + * @throws \phpbb\db\migration\exception */ public function update_if_equals($compare, $config_name, $config_value) { diff --git a/phpBB/phpbb/db/migration/tool/config_text.php b/phpBB/phpbb/db/migration/tool/config_text.php new file mode 100644 index 0000000000..bf8ac55023 --- /dev/null +++ b/phpBB/phpbb/db/migration/tool/config_text.php @@ -0,0 +1,125 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\tool; + +/** +* Migration config_text tool +*/ +class config_text implements \phpbb\db\migration\tool\tool_interface +{ + /** @var \phpbb\config\db_text */ + protected $config_text; + + /** + * Constructor + * + * @param \phpbb\config\db_text $config_text + */ + public function __construct(\phpbb\config\db_text $config_text) + { + $this->config_text = $config_text; + } + + /** + * {@inheritdoc} + */ + public function get_name() + { + return 'config_text'; + } + + /** + * Add a config_text setting. + * + * @param string $config_name The name of the config_text setting + * you would like to add + * @param mixed $config_value The value of the config_text setting + * @return null + */ + public function add($config_name, $config_value) + { + if (!is_null($this->config_text->get($config_name))) + { + return; + } + + $this->config_text->set($config_name, $config_value); + } + + /** + * Update an existing config_text setting. + * + * @param string $config_name The name of the config_text setting you would + * like to update + * @param mixed $config_value The value of the config_text setting + * @return null + * @throws \phpbb\db\migration\exception + */ + public function update($config_name, $config_value) + { + if (is_null($this->config_text->get($config_name))) + { + throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name); + } + + $this->config_text->set($config_name, $config_value); + } + + /** + * Remove an existing config_text setting. + * + * @param string $config_name The name of the config_text setting you would + * like to remove + * @return null + */ + public function remove($config_name) + { + if (is_null($this->config_text->get($config_name))) + { + return; + } + + $this->config_text->delete($config_name); + } + + /** + * {@inheritdoc} + */ + public function reverse() + { + $arguments = func_get_args(); + $original_call = array_shift($arguments); + + $call = false; + switch ($original_call) + { + case 'add': + $call = 'remove'; + break; + + case 'remove': + $call = 'add'; + if (sizeof($arguments) == 1) + { + $arguments[] = ''; + } + break; + } + + if ($call) + { + return call_user_func_array(array(&$this, $call), $arguments); + } + } +} diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 3e39d87c04..a5ed62fd65 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -1,30 +1,37 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\db\migration\tool; +use phpbb\module\exception\module_exception; + /** * Migration module management tool -* -* @package db */ class module implements \phpbb\db\migration\tool\tool_interface { /** @var \phpbb\cache\service */ protected $cache; - /** @var dbal */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var \phpbb\user */ protected $user; + /** @var \phpbb\module\module_manager */ + protected $module_manager; + /** @var string */ protected $phpbb_root_path; @@ -37,18 +44,20 @@ class module implements \phpbb\db\migration\tool\tool_interface /** * Constructor * - * @param \phpbb\db\driver\driver $db - * @param mixed $cache + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\service $cache * @param \phpbb\user $user + * @param \phpbb\module\module_manager $module_manager * @param string $phpbb_root_path * @param string $php_ext * @param string $modules_table */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\user $user, $phpbb_root_path, $php_ext, $modules_table) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\user $user, \phpbb\module\module_manager $module_manager, $phpbb_root_path, $php_ext, $modules_table) { $this->db = $db; $this->cache = $cache; $this->user = $user; + $this->module_manager = $module_manager; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->modules_table = $modules_table; @@ -163,12 +172,14 @@ class module implements \phpbb\db\migration\tool\tool_interface * ) * Optionally you may not send 'modes' and it will insert all of the * modules in that info file. - * @param string|bool $include_path If you would like to use a custom include * path, specify that here * @return null + * @throws \phpbb\db\migration\exception */ - public function add($class, $parent = 0, $data = array(), $include_path = false) + public function add($class, $parent = 0, $data = array()) { + global $user, $phpbb_log; + // Allows '' to be sent as 0 $parent = $parent ?: 0; @@ -184,7 +195,6 @@ class module implements \phpbb\db\migration\tool\tool_interface $basename = (isset($data['module_basename'])) ? $data['module_basename'] : ''; $module = $this->get_module_info($class, $basename); - $result = ''; foreach ($module['modes'] as $mode => $module_info) { if (!isset($data['modes']) || in_array($mode, $data['modes'])) @@ -235,13 +245,6 @@ class module implements \phpbb\db\migration\tool\tool_interface return; } - if (!class_exists('acp_modules')) - { - include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); - $this->user->add_lang('acp/modules'); - } - $acp_modules = new \acp_modules(); - $module_data = array( 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, 'module_display' => (isset($data['module_display'])) ? $data['module_display'] : 1, @@ -252,19 +255,14 @@ class module implements \phpbb\db\migration\tool\tool_interface 'module_mode' => (isset($data['module_mode'])) ? $data['module_mode'] : '', 'module_auth' => (isset($data['module_auth'])) ? $data['module_auth'] : '', ); - $result = $acp_modules->update_module_data($module_data, true); - // update_module_data can either return a string or an empty array... - if (is_string($result)) - { - // Error - throw new \phpbb\db\migration\exception('MODULE_ERROR', $result); - } - else + try { + $this->module_manager->update_module_data($module_data); + // Success $module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']); - add_log('admin', 'LOG_MODULE_ADD', $module_log_name); + $phpbb_log->add('admin', (isset($user->data['user_id'])) ? $user->data['user_id'] : ANONYMOUS, $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name)); // Move the module if requested above/below an existing one if (isset($data['before']) && $data['before']) @@ -314,6 +312,11 @@ class module implements \phpbb\db\migration\tool\tool_interface $this->db->sql_query($sql); } } + catch (module_exception $e) + { + // Error + throw new \phpbb\db\migration\exception('MODULE_ERROR', $e->getMessage()); + } // Clear the Modules Cache $this->cache->destroy("_modules_$class"); @@ -328,11 +331,11 @@ class module implements \phpbb\db\migration\tool\tool_interface * @param int|string|bool $parent The parent module_id|module_langname(0 for no parent). * Use false to ignore the parent check and check class wide. * @param int|string $module The module id|module_langname - * @param string|bool $include_path If you would like to use a custom include path, * specify that here * @return null + * @throws \phpbb\db\migration\exception */ - public function remove($class, $parent = 0, $module = '', $include_path = false) + public function remove($class, $parent = 0, $module = '') { // Imitation of module_add's "automatic" and "manual" method so the uninstaller works from the same set of instructions for umil_auto if (is_array($module)) @@ -340,7 +343,7 @@ class module implements \phpbb\db\migration\tool\tool_interface if (isset($module['module_langname'])) { // Manual Method - return $this->remove($class, $parent, $module['module_langname'], $include_path); + return $this->remove($class, $parent, $module['module_langname']); } // Failed. @@ -407,39 +410,15 @@ class module implements \phpbb\db\migration\tool\tool_interface $module_ids[] = (int) $module_id; } $this->db->sql_freeresult($result); - - $module_name = $module; } else { - $module = (int) $module; - $sql = 'SELECT module_langname - FROM ' . $this->modules_table . " - WHERE module_id = $module - AND module_class = '" . $this->db->sql_escape($class) . "' - $parent_sql"; - $result = $this->db->sql_query($sql); - $module_name = $this->db->sql_fetchfield('module_id'); - $this->db->sql_freeresult($result); - - $module_ids[] = $module; + $module_ids[] = (int) $module; } - if (!class_exists('acp_modules')) - { - include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); - $this->user->add_lang('acp/modules'); - } - $acp_modules = new \acp_modules(); - $acp_modules->module_class = $class; - foreach ($module_ids as $module_id) { - $result = $acp_modules->delete_module($module_id); - if (!empty($result)) - { - return; - } + $this->module_manager->delete_module($module_id, $class); } $this->cache->destroy("_modules_$class"); @@ -478,15 +457,11 @@ class module implements \phpbb\db\migration\tool\tool_interface * @param string $class Module Class * @param string $basename Module Basename * @return array Module Information + * @throws \phpbb\db\migration\exception */ protected function get_module_info($class, $basename) { - if (!class_exists('acp_modules')) - { - include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); - } - $acp_modules = new \acp_modules(); - $module = $acp_modules->get_module_infos($basename, $class, true); + $module = $this->module_manager->get_module_infos($class, $basename, true); if (empty($module)) { diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index fd2de9c8fb..ceff6d7d5a 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\db\migration\tool; /** * Migration permission management tool -* -* @package db */ class permission implements \phpbb\db\migration\tool\tool_interface { @@ -22,7 +24,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface /** @var \phpbb\cache\service */ protected $cache; - /** @var dbal */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var string */ @@ -34,13 +36,13 @@ class permission implements \phpbb\db\migration\tool\tool_interface /** * Constructor * - * @param \phpbb\db\driver\driver $db - * @param mixed $cache + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\service $cache * @param \phpbb\auth\auth $auth * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext) { $this->db = $db; $this->cache = $cache; @@ -103,6 +105,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * @param string $auth_option The name of the permission (auth) option * @param bool $global True for checking a global permission setting, * False for a local permission setting + * @param int|false $copy_from If set, contains the id of the permission from which to copy the new one. * @return null */ public function add($auth_option, $global = true, $copy_from = false) @@ -241,7 +244,9 @@ class permission implements \phpbb\db\migration\tool\tool_interface * Add a new permission role * * @param string $role_name The new role name - * @param sting $role_type The type (u_, m_, a_) + * @param string $role_type The type (u_, m_, a_) + * @param string $role_description Description of the new role + * * @return null */ public function role_add($role_name, $role_type, $role_description = '') @@ -281,6 +286,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * @param string $old_role_name The old role name * @param string $new_role_name The new role name * @return null + * @throws \phpbb\db\migration\exception */ public function role_update($old_role_name, $new_role_name) { @@ -343,6 +349,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * @param bool $has_permission True if you want to give them permission, * false if you want to deny them permission * @return null + * @throws \phpbb\db\migration\exception */ public function permission_set($name, $auth_option, $type = 'role', $has_permission = true) { @@ -418,13 +425,27 @@ class permission implements \phpbb\db\migration\tool\tool_interface $role_id = (int) $this->db->sql_fetchfield('auth_role_id'); if ($role_id) { - $sql = 'SELECT role_name + $sql = 'SELECT role_name, role_type FROM ' . ACL_ROLES_TABLE . ' WHERE role_id = ' . $role_id; $this->db->sql_query($sql); - $role_name = $this->db->sql_fetchfield('role_name'); - - return $this->permission_set($role_name, $auth_option, 'role', $has_permission); + $role_data = $this->db->sql_fetchrow(); + $role_name = $role_data['role_name']; + $role_type = $role_data['role_type']; + + // Filter new auth options to match the role type: a_ | f_ | m_ | u_ + // Set new auth options to the role only if options matching the role type were found + $auth_option = array_filter($auth_option, + function ($option) use ($role_type) + { + return strpos($option, $role_type) === 0; + } + ); + + if (sizeof($auth_option)) + { + return $this->permission_set($role_name, $auth_option, 'role', $has_permission); + } } $sql = 'SELECT auth_option_id, auth_setting @@ -488,6 +509,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * auth_options you would like to set * @param string $type The type (role|group) * @return null + * @throws \phpbb\db\migration\exception */ public function permission_unset($name, $auth_option, $type = 'role') { @@ -529,7 +551,8 @@ class permission implements \phpbb\db\migration\tool\tool_interface } $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' - WHERE ' . $this->db->sql_in_set('auth_option_id', $to_remove); + WHERE ' . $this->db->sql_in_set('auth_option_id', $to_remove) . ' + AND role_id = ' . (int) $role_id; $this->db->sql_query($sql); break; diff --git a/phpBB/phpbb/db/migration/tool/tool_interface.php b/phpBB/phpbb/db/migration/tool/tool_interface.php index e7b89d8858..07cd2435e4 100644 --- a/phpBB/phpbb/db/migration/tool/tool_interface.php +++ b/phpBB/phpbb/db/migration/tool/tool_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\db\migration\tool; /** * Migration tool interface -* -* @package db */ interface tool_interface { diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 4fb3f1a241..d91860949a 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -1,28 +1,40 @@ <?php /** * -* @package db -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\db; +use phpbb\db\output_handler\migrator_output_handler_interface; +use phpbb\db\output_handler\null_migrator_output_handler; +use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; + /** * The migrator is responsible for applying new migrations in the correct order. -* -* @package db */ class migrator { + /** + * @var ContainerInterface + */ + protected $container; + /** @var \phpbb\config\config */ protected $config; - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\db\tools */ + /** @var \phpbb\db\tools\tools_interface */ protected $db_tools; /** @var \phpbb\db\migration\helper */ @@ -57,6 +69,13 @@ class migrator protected $migrations = array(); /** + * Array of migrations that have been determined to be fulfillable + * + * @var array + */ + protected $fulfillable_migrations = array(); + + /** * 'name,' 'class,' and 'state' of the last migration run * * 'effectively_installed' set and set to true if the migration was effectively_installed @@ -66,10 +85,18 @@ class migrator public $last_run_migration = false; /** + * The output handler. A null handler is configured by default. + * + * @var migrator_output_handler_interface + */ + public $output_handler; + + /** * Constructor of the database migrator */ - public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper) + public function __construct(ContainerInterface $container, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper) { + $this->container = $container; $this->config = $config; $this->db = $db; $this->db_tools = $db_tools; @@ -82,6 +109,8 @@ class migrator $this->table_prefix = $table_prefix; + $this->output_handler = new null_migrator_output_handler(); + foreach ($tools as $tool) { $this->tools[$tool->get_name()] = $tool; @@ -93,6 +122,16 @@ class migrator } /** + * Set the output handler. + * + * @param migrator_output_handler_interface $handler The output handler + */ + public function set_output_handler(migrator_output_handler_interface $handler) + { + $this->output_handler = $handler; + } + + /** * Loads all migrations and their application state from the database. * * @return null @@ -108,7 +147,7 @@ class migrator FROM " . $this->migrations_table; $result = $this->db->sql_query($sql); - if (!$this->db->sql_error_triggered) + if (!$this->db->get_sql_error_triggered()) { while ($migration = $this->db->sql_fetchrow($result)) { @@ -144,6 +183,18 @@ class migrator */ public function update() { + $this->container->get('dispatcher')->disable(); + $this->update_do(); + $this->container->get('dispatcher')->enable(); + } + + /** + * Effectively runs a single update step from the next migration to be applied. + * + * @return null + */ + protected function update_do() + { foreach ($this->migrations as $name) { if (!isset($this->migration_state[$name]) || @@ -159,19 +210,25 @@ class migrator return; } } + else + { + $this->output_handler->write(array('MIGRATION_EFFECTIVELY_INSTALLED', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + } } } /** * Attempts to apply a step of the given migration or one of its dependencies * - * @param string The class name of the migration + * @param string $name The class name of the migration * @return bool Whether any update step was successfully run + * @throws \phpbb\db\migration\exception */ protected function try_apply($name) { if (!class_exists($name)) { + $this->output_handler->write(array('MIGRATION_NOT_VALID', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); return false; } @@ -188,6 +245,11 @@ class migrator 'migration_end_time' => 0, ); + if (!empty($state['migration_depends_on'])) + { + $this->output_handler->write(array('MIGRATION_APPLY_DEPENDENCIES', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + } + foreach ($state['migration_depends_on'] as $depend) { if ($this->unfulfillable($depend) !== false) @@ -224,6 +286,8 @@ class migrator ); $this->last_run_migration['effectively_installed'] = true; + + $this->output_handler->write(array('MIGRATION_EFFECTIVELY_INSTALLED', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); } else { @@ -235,28 +299,48 @@ class migrator if (!$state['migration_schema_done']) { + $this->output_handler->write(array('MIGRATION_SCHEMA_RUNNING', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); + $this->last_run_migration['task'] = 'process_schema_step'; + $elapsed_time = microtime(true); $steps = $this->helper->get_schema_steps($migration->update_schema()); $result = $this->process_data_step($steps, $state['migration_data_state']); + $elapsed_time = microtime(true) - $elapsed_time; $state['migration_data_state'] = ($result === true) ? '' : $result; $state['migration_schema_done'] = ($result === true); + + $this->output_handler->write(array('MIGRATION_SCHEMA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL); } else if (!$state['migration_data_done']) { try { + $this->output_handler->write(array('MIGRATION_DATA_RUNNING', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); + $this->last_run_migration['task'] = 'process_data_step'; + + $elapsed_time = microtime(true); $result = $this->process_data_step($migration->update_data(), $state['migration_data_state']); + $elapsed_time = microtime(true) - $elapsed_time; $state['migration_data_state'] = ($result === true) ? '' : $result; $state['migration_data_done'] = ($result === true); $state['migration_end_time'] = ($result === true) ? time() : 0; + + if ($state['migration_schema_done']) + { + $this->output_handler->write(array('MIGRATION_DATA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } } catch (\phpbb\db\migration\exception $e) { // Revert the schema changes - $this->revert($name); + $this->revert_do($name); // Rethrow exception throw $e; @@ -276,10 +360,22 @@ class migrator * check if revert() needs to be called again use the migration_state() method. * * @param string $migration String migration name to revert (including any that depend on this migration) - * @return null */ public function revert($migration) { + $this->container->get('dispatcher')->disable(); + $this->revert_do($migration); + $this->container->get('dispatcher')->enable(); + } + + /** + * Effectively runs a single revert step from the last migration installed + * + * @param string $migration String migration name to revert (including any that depend on this migration) + * @return null + */ + protected function revert_do($migration) + { if (!isset($this->migration_state[$migration])) { // Not installed @@ -290,7 +386,7 @@ class migrator { if (!empty($state['migration_depends_on']) && in_array($migration, $state['migration_depends_on'])) { - $this->revert($name); + $this->revert_do($name); } } @@ -300,7 +396,7 @@ class migrator /** * Attempts to revert a step of the given migration or one of its dependencies * - * @param string The class name of the migration + * @param string $name The class name of the migration * @return bool Whether any update step was successfully run */ protected function try_revert($name) @@ -322,6 +418,9 @@ class migrator if ($state['migration_data_done']) { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_RUNNING', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); + $elapsed_time = microtime(true); + if ($state['migration_data_state'] !== 'revert_data') { $result = $this->process_data_step($migration->update_data(), $state['migration_data_state'], true); @@ -337,9 +436,22 @@ class migrator } $this->set_migration_state($name, $state); + + $elapsed_time = microtime(true) - $elapsed_time; + if ($state['migration_data_done']) + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } } else if ($state['migration_schema_done']) { + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_RUNNING', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); + $elapsed_time = microtime(true); + $steps = $this->helper->get_schema_steps($migration->revert_schema()); $result = $this->process_data_step($steps, $state['migration_data_state']); @@ -354,6 +466,9 @@ class migrator unset($this->migration_state[$name]); } + + $elapsed_time = microtime(true) - $elapsed_time; + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_DONE', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_NORMAL); } return true; @@ -366,6 +481,7 @@ class migrator * @param bool|string $state Current state of the migration * @param bool $revert true to revert a data step * @return bool|string migration state. True if completed, serialized array if not finished + * @throws \phpbb\db\migration\exception */ protected function process_data_step($steps, $state, $revert = false) { @@ -419,7 +535,7 @@ class migrator } // Reverse the step that was run - $result = $this->run_step($reverse_step, false, !$revert); + $this->run_step($reverse_step, false, !$revert); } // rethrow the exception @@ -462,6 +578,7 @@ class migrator * @param mixed $last_result Result to pass to the callable (only for 'custom' method) * @param bool $reverse False to install, True to attempt uninstallation by reversing the call * @return array Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters + * @throws \phpbb\db\migration\exception */ protected function get_callable_from_step(array $step, $last_result = 0, $reverse = false) { @@ -509,10 +626,17 @@ class migrator throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step); } - return array( - $parameters[0], - array($last_result), - ); + if ($reverse) + { + return false; + } + else + { + return array( + $parameters[0], + array($last_result), + ); + } break; default: @@ -590,7 +714,7 @@ class migrator */ public function unfulfillable($name) { - if (isset($this->migration_state[$name])) + if (isset($this->migration_state[$name]) || isset($this->fulfillable_migrations[$name])) { return false; } @@ -611,6 +735,7 @@ class migrator return $unfulfillable; } } + $this->fulfillable_migrations[$name] = true; return false; } @@ -671,7 +796,14 @@ class migrator */ protected function get_migration($name) { - return new $name($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); + $migration = new $name($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); + + if ($migration instanceof ContainerAwareInterface) + { + $migration->setContainer($this->container); + } + + return $migration; } /** @@ -703,55 +835,26 @@ class migrator } /** - * Load migration data files from a directory - * - * @param \phpbb\extension\finder $finder - * @param string $path Path to migration data files - * @param bool $check_fulfillable If TRUE (default), we will check - * if all of the migrations are fulfillable after loading them. - * If FALSE, we will not check. You SHOULD check at least once - * to prevent errors (if including multiple directories, check - * with the last call to prevent throwing errors unnecessarily). - * @return array Array of migration names + * Creates the migrations table if it does not exist. + * @return null */ - public function load_migrations(\phpbb\extension\finder $finder, $path, $check_fulfillable = true) + public function create_migrations_table() { - if (!is_dir($path)) - { - throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path); - } - - $migrations = array(); - - $files = $finder - ->extension_directory("/") - ->find_from_paths(array('/' => $path)); - foreach ($files as $file) - { - $migrations[$file['path'] . $file['filename']] = ''; - } - $migrations = $finder->get_classes_from_files($migrations); - - foreach ($migrations as $migration) + // Make sure migrations have been installed. + if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) { - if (!in_array($migration, $this->migrations)) - { - $this->migrations[] = $migration; - } + $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array( + 'COLUMNS' => array( + 'migration_name' => array('VCHAR', ''), + 'migration_depends_on' => array('TEXT', ''), + 'migration_schema_done' => array('BOOL', 0), + 'migration_data_done' => array('BOOL', 0), + 'migration_data_state' => array('TEXT', ''), + 'migration_start_time' => array('TIMESTAMP', 0), + 'migration_end_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'migration_name', + )); } - - if ($check_fulfillable) - { - foreach ($this->migrations as $name) - { - $unfulfillable = $this->unfulfillable($name); - if ($unfulfillable !== false) - { - throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable); - } - } - } - - return $this->migrations; } } diff --git a/phpBB/phpbb/db/output_handler/html_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/html_migrator_output_handler.php new file mode 100644 index 0000000000..67309649c9 --- /dev/null +++ b/phpBB/phpbb/db/output_handler/html_migrator_output_handler.php @@ -0,0 +1,46 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\output_handler; + +class html_migrator_output_handler implements migrator_output_handler_interface +{ + /** + * Language object. + * + * @var \phpbb\language\language + */ + private $language; + + /** + * Constructor + * + * @param \phpbb\language\language $language Language object + */ + public function __construct(\phpbb\language\language $language) + { + $this->language = $language; + } + + /** + * {@inheritdoc} + */ + public function write($message, $verbosity) + { + if ($verbosity <= migrator_output_handler_interface::VERBOSITY_VERBOSE) + { + $final_message = $this->language->lang_array(array_shift($message), $message); + echo $final_message . "<br />\n"; + } + } +} diff --git a/phpBB/phpbb/db/output_handler/installer_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/installer_migrator_output_handler.php new file mode 100644 index 0000000000..56d5cf49a1 --- /dev/null +++ b/phpBB/phpbb/db/output_handler/installer_migrator_output_handler.php @@ -0,0 +1,46 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\output_handler; + +use phpbb\install\helper\iohandler\iohandler_interface; + +class installer_migrator_output_handler implements migrator_output_handler_interface +{ + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * Constructor + * + * @param iohandler_interface $iohandler Installer's IO-handler + */ + public function __construct(iohandler_interface $iohandler) + { + $this->iohandler = $iohandler; + } + + /** + * {@inheritdoc} + */ + public function write($message, $verbosity) + { + if ($verbosity <= migrator_output_handler_interface::VERBOSITY_VERBOSE) + { + $this->iohandler->add_log_message($message); + $this->iohandler->send_response(); + } + } +} diff --git a/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php new file mode 100644 index 0000000000..20991746ac --- /dev/null +++ b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php @@ -0,0 +1,101 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\output_handler; + +class log_wrapper_migrator_output_handler implements migrator_output_handler_interface +{ + /** + * Language object. + * + * @var \phpbb\language\language + */ + protected $language; + + /** + * A migrator output handler + * + * @var migrator_output_handler_interface + */ + protected $migrator; + + /** + * Log file handle + * @var resource + */ + protected $file_handle = false; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + * + * @param \phpbb\language\language $language Language object + * @param migrator_output_handler_interface $migrator Migrator output handler + * @param string $log_file File to log to + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem object + */ + public function __construct(\phpbb\language\language $language, migrator_output_handler_interface $migrator, $log_file, \phpbb\filesystem\filesystem_interface $filesystem) + { + $this->language = $language; + $this->migrator = $migrator; + $this->filesystem = $filesystem; + $this->file_open($log_file); + } + + /** + * Open file for logging + * + * @param string $file File to open + */ + protected function file_open($file) + { + if ($this->filesystem->is_writable(dirname($file))) + { + $this->file_handle = fopen($file, 'w'); + } + else + { + throw new \RuntimeException('Unable to write to migrator log file'); + } + } + + /** + * {@inheritdoc} + */ + public function write($message, $verbosity) + { + $this->migrator->write($message, $verbosity); + + if ($this->file_handle !== false) + { + + $translated_message = $this->language->lang_array(array_shift($message), $message); + + if ($verbosity <= migrator_output_handler_interface::VERBOSITY_NORMAL) + { + $translated_message = '[INFO] ' . $translated_message; + } + else + { + $translated_message = '[DEBUG] ' . $translated_message; + } + + fwrite($this->file_handle, $translated_message); + fflush($this->file_handle); + } + } +} diff --git a/phpBB/phpbb/db/output_handler/migrator_output_handler_interface.php b/phpBB/phpbb/db/output_handler/migrator_output_handler_interface.php new file mode 100644 index 0000000000..7bb5c73fec --- /dev/null +++ b/phpBB/phpbb/db/output_handler/migrator_output_handler_interface.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\output_handler; + +interface migrator_output_handler_interface +{ + const VERBOSITY_QUIET = 0; + const VERBOSITY_NORMAL = 1; + const VERBOSITY_VERBOSE = 2; + const VERBOSITY_VERY_VERBOSE = 3; + const VERBOSITY_DEBUG = 4; + + /** + * Write output using the configured closure. + * + * @param string|array $message The message to write or an array containing the language key and all of its parameters. + * @param int $verbosity The verbosity of the message. + */ + public function write($message, $verbosity); +} diff --git a/phpBB/phpbb/db/output_handler/null_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/null_migrator_output_handler.php new file mode 100644 index 0000000000..5fc2a52577 --- /dev/null +++ b/phpBB/phpbb/db/output_handler/null_migrator_output_handler.php @@ -0,0 +1,24 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\output_handler; + +class null_migrator_output_handler implements migrator_output_handler_interface +{ + /** + * {@inheritdoc} + */ + public function write($message, $verbosity) + { + } +} diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php index 41026ad425..18e4814a77 100644 --- a/phpBB/phpbb/db/sql_insert_buffer.php +++ b/phpBB/phpbb/db/sql_insert_buffer.php @@ -1,9 +1,13 @@ <?php /** * -* @package dbal -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -44,12 +48,10 @@ namespace phpbb\db; * * $buffer->flush(); * </code> -* -* @package dbal */ class sql_insert_buffer { - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var string */ @@ -62,11 +64,11 @@ class sql_insert_buffer protected $buffer = array(); /** - * @param \phpbb\db\driver\driver $db + * @param \phpbb\db\driver\driver_interface $db * @param string $table_name * @param int $max_buffered_rows */ - public function __construct(\phpbb\db\driver\driver $db, $table_name, $max_buffered_rows = 500) + public function __construct(\phpbb\db\driver\driver_interface $db, $table_name, $max_buffered_rows = 500) { $this->db = $db; $this->table_name = $table_name; @@ -90,7 +92,7 @@ class sql_insert_buffer // Flush buffer if it is full or when DB does not support multi inserts. // In the later case, the buffer will always only contain one row. - if (!$this->db->multi_insert || sizeof($this->buffer) >= $this->max_buffered_rows) + if (!$this->db->get_multi_insert() || sizeof($this->buffer) >= $this->max_buffered_rows) { return $this->flush(); } @@ -105,7 +107,7 @@ class sql_insert_buffer * first building a huge rowset. Or at least sizeof($rows) should be kept * small. * - * @param array $rows + * @param array $rows * * @return bool True when some data was flushed to the database. * False otherwise. diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php deleted file mode 100644 index 18e30d309a..0000000000 --- a/phpBB/phpbb/db/tools.php +++ /dev/null @@ -1,2514 +0,0 @@ -<?php -/** -* -* @package dbal -* @copyright (c) 2007 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\db; - -/** -* Database Tools for handling cross-db actions such as altering columns, etc. -* Currently not supported is returning SQL for creating tables. -* -* @package dbal -*/ -class tools -{ - /** - * Current sql layer - */ - var $sql_layer = ''; - - /** - * @var object DB object - */ - var $db = null; - - /** - * The Column types for every database we support - * @var array - */ - var $dbms_type_map = array(); - - /** - * Get the column types for every database we support - * - * @return array - */ - public static function get_dbms_type_map() - { - return array( - 'mysql_41' => array( - 'INT:' => 'int(%d)', - 'BINT' => 'bigint(20)', - 'ULINT' => 'INT(10) UNSIGNED', - 'UINT' => 'mediumint(8) UNSIGNED', - 'UINT:' => 'int(%d) UNSIGNED', - 'TINT:' => 'tinyint(%d)', - 'USINT' => 'smallint(4) UNSIGNED', - 'BOOL' => 'tinyint(1) UNSIGNED', - 'VCHAR' => 'varchar(255)', - 'VCHAR:' => 'varchar(%d)', - 'CHAR:' => 'char(%d)', - 'XSTEXT' => 'text', - 'XSTEXT_UNI'=> 'varchar(100)', - 'STEXT' => 'text', - 'STEXT_UNI' => 'varchar(255)', - 'TEXT' => 'text', - 'TEXT_UNI' => 'text', - 'MTEXT' => 'mediumtext', - 'MTEXT_UNI' => 'mediumtext', - 'TIMESTAMP' => 'int(11) UNSIGNED', - 'DECIMAL' => 'decimal(5,2)', - 'DECIMAL:' => 'decimal(%d,2)', - 'PDECIMAL' => 'decimal(6,3)', - 'PDECIMAL:' => 'decimal(%d,3)', - 'VCHAR_UNI' => 'varchar(255)', - 'VCHAR_UNI:'=> 'varchar(%d)', - 'VCHAR_CI' => 'varchar(255)', - 'VARBINARY' => 'varbinary(255)', - ), - - 'mysql_40' => array( - 'INT:' => 'int(%d)', - 'BINT' => 'bigint(20)', - 'ULINT' => 'INT(10) UNSIGNED', - 'UINT' => 'mediumint(8) UNSIGNED', - 'UINT:' => 'int(%d) UNSIGNED', - 'TINT:' => 'tinyint(%d)', - 'USINT' => 'smallint(4) UNSIGNED', - 'BOOL' => 'tinyint(1) UNSIGNED', - 'VCHAR' => 'varbinary(255)', - 'VCHAR:' => 'varbinary(%d)', - 'CHAR:' => 'binary(%d)', - 'XSTEXT' => 'blob', - 'XSTEXT_UNI'=> 'blob', - 'STEXT' => 'blob', - 'STEXT_UNI' => 'blob', - 'TEXT' => 'blob', - 'TEXT_UNI' => 'blob', - 'MTEXT' => 'mediumblob', - 'MTEXT_UNI' => 'mediumblob', - 'TIMESTAMP' => 'int(11) UNSIGNED', - 'DECIMAL' => 'decimal(5,2)', - 'DECIMAL:' => 'decimal(%d,2)', - 'PDECIMAL' => 'decimal(6,3)', - 'PDECIMAL:' => 'decimal(%d,3)', - 'VCHAR_UNI' => 'blob', - 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')), - 'VCHAR_CI' => 'blob', - 'VARBINARY' => 'varbinary(255)', - ), - - 'firebird' => array( - 'INT:' => 'INTEGER', - 'BINT' => 'DOUBLE PRECISION', - 'ULINT' => 'INTEGER', - 'UINT' => 'INTEGER', - 'UINT:' => 'INTEGER', - 'TINT:' => 'INTEGER', - 'USINT' => 'INTEGER', - 'BOOL' => 'INTEGER', - 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE', - 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE', - 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE', - 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', - 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8', - 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', - 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', - 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', - 'TIMESTAMP' => 'INTEGER', - 'DECIMAL' => 'DOUBLE PRECISION', - 'DECIMAL:' => 'DOUBLE PRECISION', - 'PDECIMAL' => 'DOUBLE PRECISION', - 'PDECIMAL:' => 'DOUBLE PRECISION', - 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', - 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8', - 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8', - 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE', - ), - - 'mssql' => array( - 'INT:' => '[int]', - 'BINT' => '[float]', - 'ULINT' => '[int]', - 'UINT' => '[int]', - 'UINT:' => '[int]', - 'TINT:' => '[int]', - 'USINT' => '[int]', - 'BOOL' => '[int]', - 'VCHAR' => '[varchar] (255)', - 'VCHAR:' => '[varchar] (%d)', - 'CHAR:' => '[char] (%d)', - 'XSTEXT' => '[varchar] (1000)', - 'STEXT' => '[varchar] (3000)', - 'TEXT' => '[varchar] (8000)', - 'MTEXT' => '[text]', - 'XSTEXT_UNI'=> '[varchar] (100)', - 'STEXT_UNI' => '[varchar] (255)', - 'TEXT_UNI' => '[varchar] (4000)', - 'MTEXT_UNI' => '[text]', - 'TIMESTAMP' => '[int]', - 'DECIMAL' => '[float]', - 'DECIMAL:' => '[float]', - 'PDECIMAL' => '[float]', - 'PDECIMAL:' => '[float]', - 'VCHAR_UNI' => '[varchar] (255)', - 'VCHAR_UNI:'=> '[varchar] (%d)', - 'VCHAR_CI' => '[varchar] (255)', - 'VARBINARY' => '[varchar] (255)', - ), - - 'mssqlnative' => array( - 'INT:' => '[int]', - 'BINT' => '[float]', - 'ULINT' => '[int]', - 'UINT' => '[int]', - 'UINT:' => '[int]', - 'TINT:' => '[int]', - 'USINT' => '[int]', - 'BOOL' => '[int]', - 'VCHAR' => '[varchar] (255)', - 'VCHAR:' => '[varchar] (%d)', - 'CHAR:' => '[char] (%d)', - 'XSTEXT' => '[varchar] (1000)', - 'STEXT' => '[varchar] (3000)', - 'TEXT' => '[varchar] (8000)', - 'MTEXT' => '[text]', - 'XSTEXT_UNI'=> '[varchar] (100)', - 'STEXT_UNI' => '[varchar] (255)', - 'TEXT_UNI' => '[varchar] (4000)', - 'MTEXT_UNI' => '[text]', - 'TIMESTAMP' => '[int]', - 'DECIMAL' => '[float]', - 'DECIMAL:' => '[float]', - 'PDECIMAL' => '[float]', - 'PDECIMAL:' => '[float]', - 'VCHAR_UNI' => '[varchar] (255)', - 'VCHAR_UNI:'=> '[varchar] (%d)', - 'VCHAR_CI' => '[varchar] (255)', - 'VARBINARY' => '[varchar] (255)', - ), - - 'oracle' => array( - 'INT:' => 'number(%d)', - 'BINT' => 'number(20)', - 'ULINT' => 'number(10)', - 'UINT' => 'number(8)', - 'UINT:' => 'number(%d)', - 'TINT:' => 'number(%d)', - 'USINT' => 'number(4)', - 'BOOL' => 'number(1)', - 'VCHAR' => 'varchar2(255)', - 'VCHAR:' => 'varchar2(%d)', - 'CHAR:' => 'char(%d)', - 'XSTEXT' => 'varchar2(1000)', - 'STEXT' => 'varchar2(3000)', - 'TEXT' => 'clob', - 'MTEXT' => 'clob', - 'XSTEXT_UNI'=> 'varchar2(300)', - 'STEXT_UNI' => 'varchar2(765)', - 'TEXT_UNI' => 'clob', - 'MTEXT_UNI' => 'clob', - 'TIMESTAMP' => 'number(11)', - 'DECIMAL' => 'number(5, 2)', - 'DECIMAL:' => 'number(%d, 2)', - 'PDECIMAL' => 'number(6, 3)', - 'PDECIMAL:' => 'number(%d, 3)', - 'VCHAR_UNI' => 'varchar2(765)', - 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), - 'VCHAR_CI' => 'varchar2(255)', - 'VARBINARY' => 'raw(255)', - ), - - 'sqlite' => array( - 'INT:' => 'int(%d)', - 'BINT' => 'bigint(20)', - 'ULINT' => 'INTEGER UNSIGNED', // 'int(10) UNSIGNED', - 'UINT' => 'INTEGER UNSIGNED', // 'mediumint(8) UNSIGNED', - 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED', - 'TINT:' => 'tinyint(%d)', - 'USINT' => 'INTEGER UNSIGNED', // 'mediumint(4) UNSIGNED', - 'BOOL' => 'INTEGER UNSIGNED', // 'tinyint(1) UNSIGNED', - 'VCHAR' => 'varchar(255)', - 'VCHAR:' => 'varchar(%d)', - 'CHAR:' => 'char(%d)', - 'XSTEXT' => 'text(65535)', - 'STEXT' => 'text(65535)', - 'TEXT' => 'text(65535)', - 'MTEXT' => 'mediumtext(16777215)', - 'XSTEXT_UNI'=> 'text(65535)', - 'STEXT_UNI' => 'text(65535)', - 'TEXT_UNI' => 'text(65535)', - 'MTEXT_UNI' => 'mediumtext(16777215)', - 'TIMESTAMP' => 'INTEGER UNSIGNED', // 'int(11) UNSIGNED', - 'DECIMAL' => 'decimal(5,2)', - 'DECIMAL:' => 'decimal(%d,2)', - 'PDECIMAL' => 'decimal(6,3)', - 'PDECIMAL:' => 'decimal(%d,3)', - 'VCHAR_UNI' => 'varchar(255)', - 'VCHAR_UNI:'=> 'varchar(%d)', - 'VCHAR_CI' => 'varchar(255)', - 'VARBINARY' => 'blob', - ), - - 'postgres' => array( - 'INT:' => 'INT4', - 'BINT' => 'INT8', - 'ULINT' => 'INT4', // unsigned - 'UINT' => 'INT4', // unsigned - 'UINT:' => 'INT4', // unsigned - 'USINT' => 'INT2', // unsigned - 'BOOL' => 'INT2', // unsigned - 'TINT:' => 'INT2', - 'VCHAR' => 'varchar(255)', - 'VCHAR:' => 'varchar(%d)', - 'CHAR:' => 'char(%d)', - 'XSTEXT' => 'varchar(1000)', - 'STEXT' => 'varchar(3000)', - 'TEXT' => 'varchar(8000)', - 'MTEXT' => 'TEXT', - 'XSTEXT_UNI'=> 'varchar(100)', - 'STEXT_UNI' => 'varchar(255)', - 'TEXT_UNI' => 'varchar(4000)', - 'MTEXT_UNI' => 'TEXT', - 'TIMESTAMP' => 'INT4', // unsigned - 'DECIMAL' => 'decimal(5,2)', - 'DECIMAL:' => 'decimal(%d,2)', - 'PDECIMAL' => 'decimal(6,3)', - 'PDECIMAL:' => 'decimal(%d,3)', - 'VCHAR_UNI' => 'varchar(255)', - 'VCHAR_UNI:'=> 'varchar(%d)', - 'VCHAR_CI' => 'varchar_ci', - 'VARBINARY' => 'bytea', - ), - ); - } - - /** - * A list of types being unsigned for better reference in some db's - * @var array - */ - var $unsigned_types = array('ULINT', 'UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); - - /** - * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. - * @var array - */ - var $supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); - - /** - * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). - * This mode has no effect on some methods (inserting of data for example). This is expressed within the methods command. - */ - var $return_statements = false; - - /** - * Constructor. Set DB Object and set {@link $return_statements return_statements}. - * - * @param \phpbb\db\driver\driver $db Database connection - * @param bool $return_statements True if only statements should be returned and no SQL being executed - */ - public function __construct(\phpbb\db\driver\driver $db, $return_statements = false) - { - $this->db = $db; - $this->return_statements = $return_statements; - - $this->dbms_type_map = self::get_dbms_type_map(); - - // Determine mapping database type - switch ($this->db->sql_layer) - { - case 'mysql': - $this->sql_layer = 'mysql_40'; - break; - - case 'mysql4': - if (version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) - { - $this->sql_layer = 'mysql_41'; - } - else - { - $this->sql_layer = 'mysql_40'; - } - break; - - case 'mysqli': - $this->sql_layer = 'mysql_41'; - break; - - case 'mssql': - case 'mssql_odbc': - $this->sql_layer = 'mssql'; - break; - - case 'mssqlnative': - $this->sql_layer = 'mssqlnative'; - break; - - default: - $this->sql_layer = $this->db->sql_layer; - break; - } - } - - /** - * Setter for {@link $return_statements return_statements}. - * - * @param bool $return_statements True if SQL should not be executed but returned as strings - * @return null - */ - public function set_return_statements($return_statements) - { - $this->return_statements = $return_statements; - } - - /** - * Gets a list of tables in the database. - * - * @return array Array of table names (all lower case) - */ - function sql_list_tables() - { - switch ($this->db->sql_layer) - { - case 'mysql': - case 'mysql4': - case 'mysqli': - $sql = 'SHOW TABLES'; - break; - - case 'sqlite': - $sql = 'SELECT name - FROM sqlite_master - WHERE type = "table"'; - break; - - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $sql = "SELECT name - FROM sysobjects - WHERE type='U'"; - break; - - case 'postgres': - $sql = 'SELECT relname - FROM pg_stat_user_tables'; - break; - - case 'firebird': - $sql = 'SELECT rdb$relation_name - FROM rdb$relations - WHERE rdb$view_source is null - AND rdb$system_flag = 0'; - break; - - case 'oracle': - $sql = 'SELECT table_name - FROM USER_TABLES'; - break; - } - - $result = $this->db->sql_query($sql); - - $tables = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $name = current($row); - $tables[$name] = $name; - } - $this->db->sql_freeresult($result); - - return $tables; - } - - /** - * Check if table exists - * - * - * @param string $table_name The table name to check for - * @return bool true if table exists, else false - */ - function sql_table_exists($table_name) - { - $this->db->sql_return_on_error(true); - $result = $this->db->sql_query_limit('SELECT * FROM ' . $table_name, 1); - $this->db->sql_return_on_error(false); - - if ($result) - { - $this->db->sql_freeresult($result); - return true; - } - - return false; - } - - /** - * Create SQL Table - * - * @param string $table_name The table name to create - * @param array $table_data Array containing table data. - * @return array Statements if $return_statements is true. - */ - function sql_create_table($table_name, $table_data) - { - // holds the DDL for a column - $columns = $statements = array(); - - if ($this->sql_table_exists($table_name)) - { - return $this->_sql_run_sql($statements); - } - - // Begin transaction - $statements[] = 'begin'; - - // Determine if we have created a PRIMARY KEY in the earliest - $primary_key_gen = false; - - // Determine if the table must be created with TEXTIMAGE - $create_textimage = false; - - // Determine if the table requires a sequence - $create_sequence = false; - - // Begin table sql statement - switch ($this->sql_layer) - { - case 'mssql': - case 'mssqlnative': - $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; - break; - - default: - $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; - break; - } - - // Iterate through the columns to create a table - foreach ($table_data['COLUMNS'] as $column_name => $column_data) - { - // here lies an array, filled with information compiled on the column's data - $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); - - if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" - { - trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); - } - - // here we add the definition of the new column to the list of columns - switch ($this->sql_layer) - { - case 'mssql': - case 'mssqlnative': - $columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default']; - break; - - default: - $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; - break; - } - - // see if we have found a primary key set due to a column definition if we have found it, we can stop looking - if (!$primary_key_gen) - { - $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; - } - - // create textimage DDL based off of the existance of certain column types - if (!$create_textimage) - { - $create_textimage = isset($prepared_column['textimage']) && $prepared_column['textimage']; - } - - // create sequence DDL based off of the existance of auto incrementing columns - if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) - { - $create_sequence = $column_name; - } - } - - // this makes up all the columns in the create table statement - $table_sql .= implode(",\n", $columns); - - // Close the table for two DBMS and add to the statements - switch ($this->sql_layer) - { - case 'firebird': - $table_sql .= "\n);"; - $statements[] = $table_sql; - break; - - case 'mssql': - case 'mssqlnative': - $table_sql .= "\n) ON [PRIMARY]" . (($create_textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : ''); - $statements[] = $table_sql; - break; - } - - // we have yet to create a primary key for this table, - // this means that we can add the one we really wanted instead - if (!$primary_key_gen) - { - // Write primary key - if (isset($table_data['PRIMARY_KEY'])) - { - if (!is_array($table_data['PRIMARY_KEY'])) - { - $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); - } - - switch ($this->sql_layer) - { - case 'mysql_40': - case 'mysql_41': - case 'postgres': - case 'sqlite': - $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; - break; - - case 'firebird': - case 'mssql': - case 'mssqlnative': - // We need the data here - $old_return_statements = $this->return_statements; - $this->return_statements = true; - - $primary_key_stmts = $this->sql_create_primary_key($table_name, $table_data['PRIMARY_KEY']); - foreach ($primary_key_stmts as $pk_stmt) - { - $statements[] = $pk_stmt; - } - - $this->return_statements = $old_return_statements; - break; - - case 'oracle': - $table_sql .= ",\n\t CONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; - break; - } - } - } - - // close the table - switch ($this->sql_layer) - { - case 'mysql_41': - // make sure the table is in UTF-8 mode - $table_sql .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;"; - $statements[] = $table_sql; - break; - - case 'mysql_40': - case 'sqlite': - $table_sql .= "\n);"; - $statements[] = $table_sql; - break; - - case 'postgres': - // do we need to add a sequence for auto incrementing columns? - if ($create_sequence) - { - $statements[] = "CREATE SEQUENCE {$table_name}_seq;"; - } - - $table_sql .= "\n);"; - $statements[] = $table_sql; - break; - - case 'oracle': - $table_sql .= "\n)"; - $statements[] = $table_sql; - - // do we need to add a sequence and a tigger for auto incrementing columns? - if ($create_sequence) - { - // create the actual sequence - $statements[] = "CREATE SEQUENCE {$table_name}_seq"; - - // the trigger is the mechanism by which we increment the counter - $trigger = "CREATE OR REPLACE TRIGGER t_{$table_name}\n"; - $trigger .= "BEFORE INSERT ON {$table_name}\n"; - $trigger .= "FOR EACH ROW WHEN (\n"; - $trigger .= "\tnew.{$create_sequence} IS NULL OR new.{$create_sequence} = 0\n"; - $trigger .= ")\n"; - $trigger .= "BEGIN\n"; - $trigger .= "\tSELECT {$table_name}_seq.nextval\n"; - $trigger .= "\tINTO :new.{$create_sequence}\n"; - $trigger .= "\tFROM dual;\n"; - $trigger .= "END;"; - - $statements[] = $trigger; - } - break; - - case 'firebird': - if ($create_sequence) - { - $statements[] = "CREATE GENERATOR {$table_name}_gen;"; - $statements[] = "SET GENERATOR {$table_name}_gen TO 0;"; - - $trigger = "CREATE TRIGGER t_$table_name FOR $table_name\n"; - $trigger .= "BEFORE INSERT\nAS\nBEGIN\n"; - $trigger .= "\tNEW.{$create_sequence} = GEN_ID({$table_name}_gen, 1);\nEND;"; - $statements[] = $trigger; - } - break; - } - - // Write Keys - if (isset($table_data['KEYS'])) - { - foreach ($table_data['KEYS'] as $key_name => $key_data) - { - if (!is_array($key_data[1])) - { - $key_data[1] = array($key_data[1]); - } - - $old_return_statements = $this->return_statements; - $this->return_statements = true; - - $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); - - foreach ($key_stmts as $key_stmt) - { - $statements[] = $key_stmt; - } - - $this->return_statements = $old_return_statements; - } - } - - // Commit Transaction - $statements[] = 'commit'; - - return $this->_sql_run_sql($statements); - } - - /** - * Handle passed database update array. - * Expected structure... - * Key being one of the following - * drop_tables: Drop tables - * add_tables: Add tables - * change_columns: Column changes (only type, not name) - * add_columns: Add columns to a table - * drop_keys: Dropping keys - * drop_columns: Removing/Dropping columns - * add_primary_keys: adding primary keys - * add_unique_index: adding an unique index - * add_index: adding an index (can be column:index_size if you need to provide size) - * - * The values are in this format: - * {TABLE NAME} => array( - * {COLUMN NAME} => array({COLUMN TYPE}, {DEFAULT VALUE}, {OPTIONAL VARIABLES}), - * {KEY/INDEX NAME} => array({COLUMN NAMES}), - * ) - * - * For more information have a look at /develop/create_schema_files.php (only available through SVN) - */ - function perform_schema_changes($schema_changes) - { - if (empty($schema_changes)) - { - return; - } - - $statements = array(); - $sqlite = false; - - // For SQLite we need to perform the schema changes in a much more different way - if ($this->db->sql_layer == 'sqlite' && $this->return_statements) - { - $sqlite_data = array(); - $sqlite = true; - } - - // Drop tables? - if (!empty($schema_changes['drop_tables'])) - { - foreach ($schema_changes['drop_tables'] as $table) - { - // only drop table if it exists - if ($this->sql_table_exists($table)) - { - $result = $this->sql_table_drop($table); - if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - } - - // Add tables? - if (!empty($schema_changes['add_tables'])) - { - foreach ($schema_changes['add_tables'] as $table => $table_data) - { - $result = $this->sql_create_table($table, $table_data); - if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - - // Change columns? - if (!empty($schema_changes['change_columns'])) - { - foreach ($schema_changes['change_columns'] as $table => $columns) - { - foreach ($columns as $column_name => $column_data) - { - // If the column exists we change it, else we add it ;) - if ($column_exists = $this->sql_column_exists($table, $column_name)) - { - $result = $this->sql_column_change($table, $column_name, $column_data, true); - } - else - { - $result = $this->sql_column_add($table, $column_name, $column_data, true); - } - - if ($sqlite) - { - if ($column_exists) - { - $sqlite_data[$table]['change_columns'][] = $result; - } - else - { - $sqlite_data[$table]['add_columns'][] = $result; - } - } - else if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - } - - // Add columns? - if (!empty($schema_changes['add_columns'])) - { - foreach ($schema_changes['add_columns'] as $table => $columns) - { - foreach ($columns as $column_name => $column_data) - { - // Only add the column if it does not exist yet - if ($column_exists = $this->sql_column_exists($table, $column_name)) - { - continue; - // This is commented out here because it can take tremendous time on updates -// $result = $this->sql_column_change($table, $column_name, $column_data, true); - } - else - { - $result = $this->sql_column_add($table, $column_name, $column_data, true); - } - - if ($sqlite) - { - if ($column_exists) - { - continue; -// $sqlite_data[$table]['change_columns'][] = $result; - } - else - { - $sqlite_data[$table]['add_columns'][] = $result; - } - } - else if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - } - - // Remove keys? - if (!empty($schema_changes['drop_keys'])) - { - foreach ($schema_changes['drop_keys'] as $table => $indexes) - { - foreach ($indexes as $index_name) - { - if (!$this->sql_index_exists($table, $index_name)) - { - continue; - } - - $result = $this->sql_index_drop($table, $index_name); - - if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - } - - // Drop columns? - if (!empty($schema_changes['drop_columns'])) - { - foreach ($schema_changes['drop_columns'] as $table => $columns) - { - foreach ($columns as $column) - { - // Only remove the column if it exists... - if ($this->sql_column_exists($table, $column)) - { - $result = $this->sql_column_remove($table, $column, true); - - if ($sqlite) - { - $sqlite_data[$table]['drop_columns'][] = $result; - } - else if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - } - } - - // Add primary keys? - if (!empty($schema_changes['add_primary_keys'])) - { - foreach ($schema_changes['add_primary_keys'] as $table => $columns) - { - $result = $this->sql_create_primary_key($table, $columns, true); - - if ($sqlite) - { - $sqlite_data[$table]['primary_key'] = $result; - } - else if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - - // Add unqiue indexes? - if (!empty($schema_changes['add_unique_index'])) - { - foreach ($schema_changes['add_unique_index'] as $table => $index_array) - { - foreach ($index_array as $index_name => $column) - { - if ($this->sql_unique_index_exists($table, $index_name)) - { - continue; - } - - $result = $this->sql_create_unique_index($table, $index_name, $column); - - if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - } - - // Add indexes? - if (!empty($schema_changes['add_index'])) - { - foreach ($schema_changes['add_index'] as $table => $index_array) - { - foreach ($index_array as $index_name => $column) - { - if ($this->sql_index_exists($table, $index_name)) - { - continue; - } - - $result = $this->sql_create_index($table, $index_name, $column); - - if ($this->return_statements) - { - $statements = array_merge($statements, $result); - } - } - } - } - - if ($sqlite) - { - foreach ($sqlite_data as $table_name => $sql_schema_changes) - { - // Create temporary table with original data - $statements[] = 'begin'; - - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table_name}' - ORDER BY type DESC, name;"; - $result = $this->db->sql_query($sql); - - if (!$result) - { - continue; - } - - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - // Create a backup table and populate it, destroy the existing one - $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); - $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; - $statements[] = 'DROP TABLE ' . $table_name; - - // Get the columns... - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $plain_table_cols = trim($matches[1]); - $new_table_cols = preg_split('/,(?![\s\w]+\))/m', $plain_table_cols); - $column_list = array(); - - foreach ($new_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - continue; - } - $column_list[] = $entities[0]; - } - - // note down the primary key notation because sqlite only supports adding it to the end for the new table - $primary_key = false; - $_new_cols = array(); - - foreach ($new_table_cols as $key => $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - $primary_key = $declaration; - continue; - } - $_new_cols[] = $declaration; - } - - $new_table_cols = $_new_cols; - - // First of all... change columns - if (!empty($sql_schema_changes['change_columns'])) - { - foreach ($sql_schema_changes['change_columns'] as $column_sql) - { - foreach ($new_table_cols as $key => $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if (strpos($column_sql, $entities[0] . ' ') === 0) - { - $new_table_cols[$key] = $column_sql; - } - } - } - } - - if (!empty($sql_schema_changes['add_columns'])) - { - foreach ($sql_schema_changes['add_columns'] as $column_sql) - { - $new_table_cols[] = $column_sql; - } - } - - // Now drop them... - if (!empty($sql_schema_changes['drop_columns'])) - { - foreach ($sql_schema_changes['drop_columns'] as $column_name) - { - // Remove from column list... - $new_column_list = array(); - foreach ($column_list as $key => $value) - { - if ($value === $column_name) - { - continue; - } - - $new_column_list[] = $value; - } - - $column_list = $new_column_list; - - // Remove from table... - $_new_cols = array(); - foreach ($new_table_cols as $key => $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if (strpos($column_name . ' ', $entities[0] . ' ') === 0) - { - continue; - } - $_new_cols[] = $declaration; - } - $new_table_cols = $_new_cols; - } - } - - // Primary key... - if (!empty($sql_schema_changes['primary_key'])) - { - $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; - } - // Add a new one or the old primary key - else if ($primary_key !== false) - { - $new_table_cols[] = $primary_key; - } - - $columns = implode(',', $column_list); - - // create a new table and fill it up. destroy the temp one - $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; - $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; - $statements[] = 'DROP TABLE ' . $table_name . '_temp'; - - $statements[] = 'commit'; - } - } - - if ($this->return_statements) - { - return $statements; - } - } - - /** - * Gets a list of columns of a table. - * - * @param string $table Table name - * - * @return array Array of column names (all lower case) - */ - function sql_list_columns($table) - { - $columns = array(); - - switch ($this->sql_layer) - { - case 'mysql_40': - case 'mysql_41': - $sql = "SHOW COLUMNS FROM $table"; - break; - - // PostgreSQL has a way of doing this in a much simpler way but would - // not allow us to support all versions of PostgreSQL - case 'postgres': - $sql = "SELECT a.attname - FROM pg_class c, pg_attribute a - WHERE c.relname = '{$table}' - AND a.attnum > 0 - AND a.attrelid = c.oid"; - break; - - // same deal with PostgreSQL, we must perform more complex operations than - // we technically could - case 'mssql': - case 'mssqlnative': - $sql = "SELECT c.name - FROM syscolumns c - LEFT JOIN sysobjects o ON c.id = o.id - WHERE o.name = '{$table}'"; - break; - - case 'oracle': - $sql = "SELECT column_name - FROM user_tab_columns - WHERE LOWER(table_name) = '" . strtolower($table) . "'"; - break; - - case 'firebird': - $sql = "SELECT RDB\$FIELD_NAME as FNAME - FROM RDB\$RELATION_FIELDS - WHERE RDB\$RELATION_NAME = '" . strtoupper($table) . "'"; - break; - - case 'sqlite': - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table}'"; - - $result = $this->db->sql_query($sql); - - if (!$result) - { - return false; - } - - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $cols = trim($matches[1]); - $col_array = preg_split('/,(?![\s\w]+\))/m', $cols); - - foreach ($col_array as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - continue; - } - - $column = strtolower($entities[0]); - $columns[$column] = $column; - } - - return $columns; - break; - } - - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $column = strtolower(current($row)); - $columns[$column] = $column; - } - $this->db->sql_freeresult($result); - - return $columns; - } - - /** - * Check whether a specified column exist in a table - * - * @param string $table Table to check - * @param string $column_name Column to check - * - * @return bool True if column exists, false otherwise - */ - function sql_column_exists($table, $column_name) - { - $columns = $this->sql_list_columns($table); - - return isset($columns[$column_name]); - } - - /** - * Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes. - * - * @param string $table_name Table to check the index at - * @param string $index_name The index name to check - * - * @return bool True if index exists, else false - */ - function sql_index_exists($table_name, $index_name) - { - if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') - { - $sql = "EXEC sp_statistics '$table_name'"; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - if ($row['TYPE'] == 3) - { - if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) - { - $this->db->sql_freeresult($result); - return true; - } - } - } - $this->db->sql_freeresult($result); - - return false; - } - - switch ($this->sql_layer) - { - case 'firebird': - $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name - FROM RDB\$INDICES - WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "' - AND RDB\$UNIQUE_FLAG IS NULL - AND RDB\$FOREIGN_KEY IS NULL"; - $col = 'index_name'; - break; - - case 'postgres': - $sql = "SELECT ic.relname as index_name - FROM pg_class bc, pg_class ic, pg_index i - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (bc.relname = '" . $table_name . "') - AND (i.indisunique != 't') - AND (i.indisprimary != 't')"; - $col = 'index_name'; - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'SHOW KEYS - FROM ' . $table_name; - $col = 'Key_name'; - break; - - case 'oracle': - $sql = "SELECT index_name - FROM user_indexes - WHERE table_name = '" . strtoupper($table_name) . "' - AND generated = 'N' - AND uniqueness = 'NONUNIQUE'"; - $col = 'index_name'; - break; - - case 'sqlite': - $sql = "PRAGMA index_list('" . $table_name . "');"; - $col = 'name'; - break; - } - - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique']) - { - continue; - } - - // These DBMS prefix index name with the table name - switch ($this->sql_layer) - { - case 'firebird': - case 'oracle': - case 'postgres': - case 'sqlite': - $row[$col] = substr($row[$col], strlen($table_name) + 1); - break; - } - - if (strtolower($row[$col]) == strtolower($index_name)) - { - $this->db->sql_freeresult($result); - return true; - } - } - $this->db->sql_freeresult($result); - - return false; - } - - /** - * Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes. - * - * @param string $table_name Table to check the index at - * @param string $index_name The index name to check - * - * @return bool True if index exists, else false - */ - function sql_unique_index_exists($table_name, $index_name) - { - if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') - { - $sql = "EXEC sp_statistics '$table_name'"; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - // Usually NON_UNIQUE is the column we want to check, but we allow for both - if ($row['TYPE'] == 3) - { - if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) - { - $this->db->sql_freeresult($result); - return true; - } - } - } - $this->db->sql_freeresult($result); - return false; - } - - switch ($this->sql_layer) - { - case 'firebird': - $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name - FROM RDB\$INDICES - WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "' - AND RDB\$UNIQUE_FLAG IS NOT NULL - AND RDB\$FOREIGN_KEY IS NULL"; - $col = 'index_name'; - break; - - case 'postgres': - $sql = "SELECT ic.relname as index_name, i.indisunique - FROM pg_class bc, pg_class ic, pg_index i - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (bc.relname = '" . $table_name . "') - AND (i.indisprimary != 't')"; - $col = 'index_name'; - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'SHOW KEYS - FROM ' . $table_name; - $col = 'Key_name'; - break; - - case 'oracle': - $sql = "SELECT index_name, table_owner - FROM user_indexes - WHERE table_name = '" . strtoupper($table_name) . "' - AND generated = 'N' - AND uniqueness = 'UNIQUE'"; - $col = 'index_name'; - break; - - case 'sqlite': - $sql = "PRAGMA index_list('" . $table_name . "');"; - $col = 'name'; - break; - } - - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && ($row['Non_unique'] || $row[$col] == 'PRIMARY')) - { - continue; - } - - if ($this->sql_layer == 'sqlite' && !$row['unique']) - { - continue; - } - - if ($this->sql_layer == 'postgres' && $row['indisunique'] != 't') - { - continue; - } - - // These DBMS prefix index name with the table name - switch ($this->sql_layer) - { - case 'oracle': - // Two cases here... prefixed with U_[table_owner] and not prefixed with table_name - if (strpos($row[$col], 'U_') === 0) - { - $row[$col] = substr($row[$col], strlen('U_' . $row['table_owner']) + 1); - } - else if (strpos($row[$col], strtoupper($table_name)) === 0) - { - $row[$col] = substr($row[$col], strlen($table_name) + 1); - } - break; - - case 'firebird': - case 'postgres': - case 'sqlite': - $row[$col] = substr($row[$col], strlen($table_name) + 1); - break; - } - - if (strtolower($row[$col]) == strtolower($index_name)) - { - $this->db->sql_freeresult($result); - return true; - } - } - $this->db->sql_freeresult($result); - - return false; - } - - /** - * Private method for performing sql statements (either execute them or return them) - * @access private - */ - function _sql_run_sql($statements) - { - if ($this->return_statements) - { - return $statements; - } - - // We could add error handling here... - foreach ($statements as $sql) - { - if ($sql === 'begin') - { - $this->db->sql_transaction('begin'); - } - else if ($sql === 'commit') - { - $this->db->sql_transaction('commit'); - } - else - { - $this->db->sql_query($sql); - } - } - - return true; - } - - /** - * Function to prepare some column information for better usage - * @access private - */ - function sql_prepare_column_data($table_name, $column_name, $column_data) - { - if (strlen($column_name) > 30) - { - trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); - } - - // Get type - list($column_type, $orig_column_type) = $this->get_column_type($column_data[0]); - - // Adjust default value if db-dependent specified - if (is_array($column_data[1])) - { - $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; - } - - $sql = ''; - - $return_array = array(); - - switch ($this->sql_layer) - { - case 'firebird': - $sql .= " {$column_type} "; - $return_array['column_type_sql_type'] = " {$column_type} "; - - if (!is_null($column_data[1])) - { - $sql .= 'DEFAULT ' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' '; - $return_array['column_type_sql_default'] = ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' '; - } - - $sql .= 'NOT NULL'; - - // This is a UNICODE column and thus should be given it's fair share - if (preg_match('/^X?STEXT_UNI|VCHAR_(CI|UNI:?)/', $column_data[0])) - { - $sql .= ' COLLATE UNICODE'; - } - - $return_array['auto_increment'] = false; - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $return_array['auto_increment'] = true; - } - - break; - - case 'mssql': - case 'mssqlnative': - $sql .= " {$column_type} "; - $sql_default = " {$column_type} "; - - // For adding columns we need the default definition - if (!is_null($column_data[1])) - { - // For hexadecimal values do not use single quotes - if (strpos($column_data[1], '0x') === 0) - { - $return_array['default'] = 'DEFAULT (' . $column_data[1] . ') '; - $sql_default .= $return_array['default']; - } - else - { - $return_array['default'] = 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; - $sql_default .= $return_array['default']; - } - } - - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { -// $sql .= 'IDENTITY (1, 1) '; - $sql_default .= 'IDENTITY (1, 1) '; - } - - $return_array['textimage'] = $column_type === '[text]'; - - $sql .= 'NOT NULL'; - $sql_default .= 'NOT NULL'; - - $return_array['column_type_sql_default'] = $sql_default; - - break; - - case 'mysql_40': - case 'mysql_41': - $sql .= " {$column_type} "; - - // For hexadecimal values do not use single quotes - if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') - { - $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; - } - $sql .= 'NOT NULL'; - - if (isset($column_data[2])) - { - if ($column_data[2] == 'auto_increment') - { - $sql .= ' auto_increment'; - } - else if ($this->sql_layer === 'mysql_41' && $column_data[2] == 'true_sort') - { - $sql .= ' COLLATE utf8_unicode_ci'; - } - } - - break; - - case 'oracle': - $sql .= " {$column_type} "; - $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; - - // In Oracle empty strings ('') are treated as NULL. - // Therefore in oracle we allow NULL's for all DEFAULT '' entries - // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) - if (!preg_match('/number/i', $column_type)) - { - $sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; - } - - $return_array['auto_increment'] = false; - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $return_array['auto_increment'] = true; - } - - break; - - case 'postgres': - $return_array['column_type'] = $column_type; - - $sql .= " {$column_type} "; - - $return_array['auto_increment'] = false; - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $default_val = "nextval('{$table_name}_seq')"; - $return_array['auto_increment'] = true; - } - else if (!is_null($column_data[1])) - { - $default_val = "'" . $column_data[1] . "'"; - $return_array['null'] = 'NOT NULL'; - $sql .= 'NOT NULL '; - } - - $return_array['default'] = $default_val; - - $sql .= "DEFAULT {$default_val}"; - - // Unsigned? Then add a CHECK contraint - if (in_array($orig_column_type, $this->unsigned_types)) - { - $return_array['constraint'] = "CHECK ({$column_name} >= 0)"; - $sql .= " CHECK ({$column_name} >= 0)"; - } - - break; - - case 'sqlite': - $return_array['primary_key_set'] = false; - if (isset($column_data[2]) && $column_data[2] == 'auto_increment') - { - $sql .= ' INTEGER PRIMARY KEY'; - $return_array['primary_key_set'] = true; - } - else - { - $sql .= ' ' . $column_type; - } - - $sql .= ' NOT NULL '; - $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; - - break; - } - - $return_array['column_type_sql'] = $sql; - - return $return_array; - } - - /** - * Get the column's database type from the type map - * - * @param string $column_map_type - * @return array column type for this database - * and map type without length - */ - function get_column_type($column_map_type) - { - if (strpos($column_map_type, ':') !== false) - { - list($orig_column_type, $column_length) = explode(':', $column_map_type); - if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) - { - $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); - } - else - { - if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) - { - switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) - { - case 'div': - $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; - $column_length = ceil($column_length); - $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); - break; - } - } - - if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) - { - switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) - { - case 'mult': - $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; - if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) - { - $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; - } - else - { - $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); - } - break; - } - } - } - $orig_column_type .= ':'; - } - else - { - $orig_column_type = $column_map_type; - $column_type = $this->dbms_type_map[$this->sql_layer][$column_map_type]; - } - - return array($column_type, $orig_column_type); - } - - /** - * Add new column - */ - function sql_column_add($table_name, $column_name, $column_data, $inline = false) - { - $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); - $statements = array(); - - switch ($this->sql_layer) - { - case 'firebird': - // Does not support AFTER statement, only POSITION (and there you need the column position) - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD "' . strtoupper($column_name) . '" ' . $column_data['column_type_sql']; - break; - - case 'mssql': - case 'mssqlnative': - // Does not support AFTER, only through temporary table - $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; - break; - - case 'mysql_40': - case 'mysql_41': - $after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : ''; - $statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after; - break; - - case 'oracle': - // Does not support AFTER, only through temporary table - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; - break; - - case 'postgres': - // Does not support AFTER, only through temporary table - if (version_compare($this->db->sql_server_info(true), '8.0', '>=')) - { - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; - } - else - { - // old versions cannot add columns with default and null information - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type'] . ' ' . $column_data['constraint']; - - if (isset($column_data['null'])) - { - if ($column_data['null'] == 'NOT NULL') - { - $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET NOT NULL'; - } - } - - if (isset($column_data['default'])) - { - $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; - } - } - - break; - - case 'sqlite': - - if ($inline && $this->return_statements) - { - return $column_name . ' ' . $column_data['column_type_sql']; - } - - if (version_compare(sqlite_libversion(), '3.0') == -1) - { - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table_name}' - ORDER BY type DESC, name;"; - $result = $this->db->sql_query($sql); - - if (!$result) - { - break; - } - - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - $statements[] = 'begin'; - - // Create a backup table and populate it, destroy the existing one - $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); - $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; - $statements[] = 'DROP TABLE ' . $table_name; - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $new_table_cols = trim($matches[1]); - $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - continue; - } - $column_list[] = $entities[0]; - } - - $columns = implode(',', $column_list); - - $new_table_cols = $column_name . ' ' . $column_data['column_type_sql'] . ',' . $new_table_cols; - - // create a new table and fill it up. destroy the temp one - $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; - $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; - $statements[] = 'DROP TABLE ' . $table_name . '_temp'; - - $statements[] = 'commit'; - } - else - { - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' [' . $column_data['column_type_sql'] . ']'; - } - break; - } - - return $this->_sql_run_sql($statements); - } - - /** - * Drop column - */ - function sql_column_remove($table_name, $column_name, $inline = false) - { - $statements = array(); - - switch ($this->sql_layer) - { - case 'firebird': - $statements[] = 'ALTER TABLE ' . $table_name . ' DROP "' . strtoupper($column_name) . '"'; - break; - - case 'mssql': - case 'mssqlnative': - // remove default cosntraints first - // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx - $statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) - SET @drop_default_name = - (SELECT so.name FROM sysobjects so - JOIN sysconstraints sc ON so.id = sc.constid - WHERE object_name(so.parent_obj) = '{$table_name}' - AND so.xtype = 'D' - AND sc.colid = (SELECT colid FROM syscolumns - WHERE id = object_id('{$table_name}') - AND name = '{$column_name}')) - IF @drop_default_name <> '' - BEGIN - SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' - EXEC(@cmd) - END"; - $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; - break; - - case 'mysql_40': - case 'mysql_41': - $statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; - break; - - case 'oracle': - $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; - break; - - case 'postgres': - $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; - break; - - case 'sqlite': - - if ($inline && $this->return_statements) - { - return $column_name; - } - - if (version_compare(sqlite_libversion(), '3.0') == -1) - { - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table_name}' - ORDER BY type DESC, name;"; - $result = $this->db->sql_query($sql); - - if (!$result) - { - break; - } - - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - $statements[] = 'begin'; - - // Create a backup table and populate it, destroy the existing one - $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); - $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; - $statements[] = 'DROP TABLE ' . $table_name; - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $new_table_cols = trim($matches[1]); - $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) - { - continue; - } - $column_list[] = $entities[0]; - } - - $columns = implode(',', $column_list); - - $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); - - // create a new table and fill it up. destroy the temp one - $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; - $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; - $statements[] = 'DROP TABLE ' . $table_name . '_temp'; - - $statements[] = 'commit'; - } - else - { - $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; - } - break; - } - - return $this->_sql_run_sql($statements); - } - - /** - * Drop Index - */ - function sql_index_drop($table_name, $index_name) - { - $statements = array(); - - switch ($this->sql_layer) - { - case 'mssql': - case 'mssqlnative': - $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; - break; - - case 'mysql_40': - case 'mysql_41': - $statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; - break; - - case 'firebird': - case 'oracle': - case 'postgres': - case 'sqlite': - $statements[] = 'DROP INDEX ' . $table_name . '_' . $index_name; - break; - } - - return $this->_sql_run_sql($statements); - } - - /** - * Drop Table - */ - function sql_table_drop($table_name) - { - $statements = array(); - - if (!$this->sql_table_exists($table_name)) - { - return $this->_sql_run_sql($statements); - } - - // the most basic operation, get rid of the table - $statements[] = 'DROP TABLE ' . $table_name; - - switch ($this->sql_layer) - { - case 'firebird': - $sql = 'SELECT RDB$GENERATOR_NAME as gen - FROM RDB$GENERATORS - WHERE RDB$SYSTEM_FLAG = 0 - AND RDB$GENERATOR_NAME = \'' . strtoupper($table_name) . "_GEN'"; - $result = $this->db->sql_query($sql); - - // does a generator exist? - if ($row = $this->db->sql_fetchrow($result)) - { - $statements[] = "DROP GENERATOR {$row['gen']};"; - } - $this->db->sql_freeresult($result); - break; - - case 'oracle': - $sql = 'SELECT A.REFERENCED_NAME - FROM USER_DEPENDENCIES A, USER_TRIGGERS B - WHERE A.REFERENCED_TYPE = \'SEQUENCE\' - AND A.NAME = B.TRIGGER_NAME - AND B.TABLE_NAME = \'' . strtoupper($table_name) . "'"; - $result = $this->db->sql_query($sql); - - // any sequences ref'd to this table's triggers? - while ($row = $this->db->sql_fetchrow($result)) - { - $statements[] = "DROP SEQUENCE {$row['referenced_name']}"; - } - $this->db->sql_freeresult($result); - break; - - case 'postgres': - // PGSQL does not "tightly" bind sequences and tables, we must guess... - $sql = "SELECT relname - FROM pg_class - WHERE relkind = 'S' - AND relname = '{$table_name}_seq'"; - $result = $this->db->sql_query($sql); - - // We don't even care about storing the results. We already know the answer if we get rows back. - if ($this->db->sql_fetchrow($result)) - { - $statements[] = "DROP SEQUENCE {$table_name}_seq;\n"; - } - $this->db->sql_freeresult($result); - break; - } - - return $this->_sql_run_sql($statements); - } - - /** - * Add primary key - */ - function sql_create_primary_key($table_name, $column, $inline = false) - { - $statements = array(); - - switch ($this->sql_layer) - { - case 'firebird': - case 'postgres': - case 'mysql_40': - case 'mysql_41': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; - break; - - case 'mssql': - case 'mssqlnative': - $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; - $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; - $sql .= '[' . implode("],\n\t\t[", $column) . ']'; - $sql .= ') ON [PRIMARY]'; - - $statements[] = $sql; - break; - - case 'oracle': - $statements[] = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; - break; - - case 'sqlite': - - if ($inline && $this->return_statements) - { - return $column; - } - - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table_name}' - ORDER BY type DESC, name;"; - $result = $this->db->sql_query($sql); - - if (!$result) - { - break; - } - - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - $statements[] = 'begin'; - - // Create a backup table and populate it, destroy the existing one - $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); - $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; - $statements[] = 'DROP TABLE ' . $table_name; - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $new_table_cols = trim($matches[1]); - $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - if ($entities[0] == 'PRIMARY') - { - continue; - } - $column_list[] = $entities[0]; - } - - $columns = implode(',', $column_list); - - // create a new table and fill it up. destroy the temp one - $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'; - $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; - $statements[] = 'DROP TABLE ' . $table_name . '_temp'; - - $statements[] = 'commit'; - break; - } - - return $this->_sql_run_sql($statements); - } - - /** - * Add unique index - */ - function sql_create_unique_index($table_name, $index_name, $column) - { - $statements = array(); - - $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) - if (strlen($table_name . $index_name) - strlen($table_prefix) > 24) - { - $max_length = strlen($table_prefix) + 24; - trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR); - } - - switch ($this->sql_layer) - { - case 'firebird': - case 'postgres': - case 'oracle': - case 'sqlite': - $statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; - break; - - case 'mysql_40': - case 'mysql_41': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; - break; - - case 'mssql': - case 'mssqlnative': - $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; - break; - } - - return $this->_sql_run_sql($statements); - } - - /** - * Add index - */ - function sql_create_index($table_name, $index_name, $column) - { - $statements = array(); - - $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) - if (strlen($table_name . $index_name) - strlen($table_prefix) > 24) - { - $max_length = strlen($table_prefix) + 24; - trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR); - } - - // remove index length unless MySQL4 - if ('mysql_40' != $this->sql_layer) - { - $column = preg_replace('#:.*$#', '', $column); - } - - switch ($this->sql_layer) - { - case 'firebird': - case 'postgres': - case 'oracle': - case 'sqlite': - $statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; - break; - - case 'mysql_40': - // add index size to definition as required by MySQL4 - foreach ($column as $i => $col) - { - if (false !== strpos($col, ':')) - { - list($col, $index_size) = explode(':', $col); - $column[$i] = "$col($index_size)"; - } - } - // no break - case 'mysql_41': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; - break; - - case 'mssql': - case 'mssqlnative': - $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; - break; - } - - return $this->_sql_run_sql($statements); - } - - /** - * List all of the indices that belong to a table, - * does not count: - * * UNIQUE indices - * * PRIMARY keys - */ - function sql_list_index($table_name) - { - $index_array = array(); - - if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') - { - $sql = "EXEC sp_statistics '$table_name'"; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if ($row['TYPE'] == 3) - { - $index_array[] = $row['INDEX_NAME']; - } - } - $this->db->sql_freeresult($result); - } - else - { - switch ($this->sql_layer) - { - case 'firebird': - $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name - FROM RDB\$INDICES - WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "' - AND RDB\$UNIQUE_FLAG IS NULL - AND RDB\$FOREIGN_KEY IS NULL"; - $col = 'index_name'; - break; - - case 'postgres': - $sql = "SELECT ic.relname as index_name - FROM pg_class bc, pg_class ic, pg_index i - WHERE (bc.oid = i.indrelid) - AND (ic.oid = i.indexrelid) - AND (bc.relname = '" . $table_name . "') - AND (i.indisunique != 't') - AND (i.indisprimary != 't')"; - $col = 'index_name'; - break; - - case 'mysql_40': - case 'mysql_41': - $sql = 'SHOW KEYS - FROM ' . $table_name; - $col = 'Key_name'; - break; - - case 'oracle': - $sql = "SELECT index_name - FROM user_indexes - WHERE table_name = '" . strtoupper($table_name) . "' - AND generated = 'N' - AND uniqueness = 'NONUNIQUE'"; - $col = 'index_name'; - break; - - case 'sqlite': - $sql = "PRAGMA index_info('" . $table_name . "');"; - $col = 'name'; - break; - } - - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique']) - { - continue; - } - - switch ($this->sql_layer) - { - case 'firebird': - case 'oracle': - case 'postgres': - case 'sqlite': - $row[$col] = substr($row[$col], strlen($table_name) + 1); - break; - } - - $index_array[] = $row[$col]; - } - $this->db->sql_freeresult($result); - } - - return array_map('strtolower', $index_array); - } - - /** - * Change column type (not name!) - */ - function sql_column_change($table_name, $column_name, $column_data, $inline = false) - { - $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); - $statements = array(); - - switch ($this->sql_layer) - { - case 'firebird': - // Change type... - if (!empty($column_data['column_type_sql_default'])) - { - $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" TYPE ' . ' ' . $column_data['column_type_sql_type']; - $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" SET DEFAULT ' . ' ' . $column_data['column_type_sql_default']; - } - else - { - // TODO: try to change pkey without removing trigger, generator or constraints. ATM this query may fail. - $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" TYPE ' . ' ' . $column_data['column_type_sql_type']; - } - break; - - case 'mssql': - case 'mssqlnative': - $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; - - if (!empty($column_data['default'])) - { - // Using TRANSACT-SQL for this statement because we do not want to have colliding data if statements are executed at a later stage - $statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) - SET @drop_default_name = - (SELECT so.name FROM sysobjects so - JOIN sysconstraints sc ON so.id = sc.constid - WHERE object_name(so.parent_obj) = '{$table_name}' - AND so.xtype = 'D' - AND sc.colid = (SELECT colid FROM syscolumns - WHERE id = object_id('{$table_name}') - AND name = '{$column_name}')) - IF @drop_default_name <> '' - BEGIN - SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' - EXEC(@cmd) - END - SET @cmd = 'ALTER TABLE [{$table_name}] ADD CONSTRAINT [DF_{$table_name}_{$column_name}_1] {$column_data['default']} FOR [{$column_name}]' - EXEC(@cmd)"; - } - break; - - case 'mysql_40': - case 'mysql_41': - $statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql']; - break; - - case 'oracle': - $statements[] = 'ALTER TABLE ' . $table_name . ' MODIFY ' . $column_name . ' ' . $column_data['column_type_sql']; - break; - - case 'postgres': - $sql = 'ALTER TABLE ' . $table_name . ' '; - - $sql_array = array(); - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; - - if (isset($column_data['null'])) - { - if ($column_data['null'] == 'NOT NULL') - { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; - } - else if ($column_data['null'] == 'NULL') - { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; - } - } - - if (isset($column_data['default'])) - { - $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; - } - - // we don't want to double up on constraints if we change different number data types - if (isset($column_data['constraint'])) - { - $constraint_sql = "SELECT consrc as constraint_data - FROM pg_constraint, pg_class bc - WHERE conrelid = bc.oid - AND bc.relname = '{$table_name}' - AND NOT EXISTS ( - SELECT * - FROM pg_constraint as c, pg_inherits as i - WHERE i.inhrelid = pg_constraint.conrelid - AND c.conname = pg_constraint.conname - AND c.consrc = pg_constraint.consrc - AND c.conrelid = i.inhparent - )"; - - $constraint_exists = false; - - $result = $this->db->sql_query($constraint_sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if (trim($row['constraint_data']) == trim($column_data['constraint'])) - { - $constraint_exists = true; - break; - } - } - $this->db->sql_freeresult($result); - - if (!$constraint_exists) - { - $sql_array[] = 'ADD ' . $column_data['constraint']; - } - } - - $sql .= implode(', ', $sql_array); - - $statements[] = $sql; - break; - - case 'sqlite': - - if ($inline && $this->return_statements) - { - return $column_name . ' ' . $column_data['column_type_sql']; - } - - $sql = "SELECT sql - FROM sqlite_master - WHERE type = 'table' - AND name = '{$table_name}' - ORDER BY type DESC, name;"; - $result = $this->db->sql_query($sql); - - if (!$result) - { - break; - } - - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - $statements[] = 'begin'; - - // Create a temp table and populate it, destroy the existing one - $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); - $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; - $statements[] = 'DROP TABLE ' . $table_name; - - preg_match('#\((.*)\)#s', $row['sql'], $matches); - - $new_table_cols = trim($matches[1]); - $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); - $column_list = array(); - - foreach ($old_table_cols as $key => $declaration) - { - $entities = preg_split('#\s+#', trim($declaration)); - $column_list[] = $entities[0]; - if ($entities[0] == $column_name) - { - $old_table_cols[$key] = $column_name . ' ' . $column_data['column_type_sql']; - } - } - - $columns = implode(',', $column_list); - - // create a new table and fill it up. destroy the temp one - $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'; - $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; - $statements[] = 'DROP TABLE ' . $table_name . '_temp'; - - $statements[] = 'commit'; - - break; - } - - return $this->_sql_run_sql($statements); - } -} diff --git a/phpBB/phpbb/db/tools/factory.php b/phpBB/phpbb/db/tools/factory.php new file mode 100644 index 0000000000..d204451a63 --- /dev/null +++ b/phpBB/phpbb/db/tools/factory.php @@ -0,0 +1,43 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\tools; + +/** + * A factory which serves the suitable tools instance for the given dbal + */ +class factory +{ + /** + * @param mixed $db_driver + * @param bool $return_statements + * @return \phpbb\db\tools\tools_interface + */ + public function get($db_driver, $return_statements = false) + { + if ($db_driver instanceof \phpbb\db\driver\mssql || $db_driver instanceof \phpbb\db\driver\mssql_base) + { + return new \phpbb\db\tools\mssql($db_driver, $return_statements); + } + else if ($db_driver instanceof \phpbb\db\driver\postgres) + { + return new \phpbb\db\tools\postgres($db_driver, $return_statements); + } + else if ($db_driver instanceof \phpbb\db\driver\driver_interface) + { + return new \phpbb\db\tools\tools($db_driver, $return_statements); + } + + throw new \InvalidArgumentException('Invalid database driver given'); + } +} diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php new file mode 100644 index 0000000000..a90a85bbb2 --- /dev/null +++ b/phpBB/phpbb/db/tools/mssql.php @@ -0,0 +1,795 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\tools; + +/** + * Database Tools for handling cross-db actions such as altering columns, etc. + * Currently not supported is returning SQL for creating tables. + */ +class mssql extends tools +{ + /** + * Is the used MS SQL Server a SQL Server 2000? + * @var bool + */ + protected $is_sql_server_2000; + + /** + * Get the column types for mssql based databases + * + * @return array + */ + public static function get_dbms_type_map() + { + return array( + 'mssql' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'ULINT' => '[int]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'ULINT' => '[int]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + ); + } + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + parent::__construct($db, $return_statements); + + // Determine mapping database type + switch ($this->db->get_sql_layer()) + { + case 'mssql': + case 'mssql_odbc': + $this->sql_layer = 'mssql'; + break; + + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; + } + + $this->dbms_type_map = self::get_dbms_type_map(); + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + $sql = "SELECT name + FROM sysobjects + WHERE type='U'"; + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; + + if (!isset($table_data['PRIMARY_KEY'])) + { + $table_data['COLUMNS']['mssqlindex'] = array('UINT', null, 'auto_increment'); + $table_data['PRIMARY_KEY'] = 'mssqlindex'; + } + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existance of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // Close the table for two DBMS and add to the statements + $table_sql .= "\n);"; + $statements[] = $table_sql; + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $primary_key_stmts = $this->sql_create_primary_key($table_name, $table_data['PRIMARY_KEY']); + foreach ($primary_key_stmts as $pk_stmt) + { + $statements[] = $pk_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + $sql = "SELECT c.name + FROM syscolumns c + LEFT JOIN sysobjects o ON c.id = o.id + WHERE o.name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // Usually NON_UNIQUE is the column we want to check, but we allow for both + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type, ) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = ''; + + $return_array = array(); + + $sql .= " {$column_type} "; + $sql_default = " {$column_type} "; + + // For adding columns we need the default definition + if (!is_null($column_data[1])) + { + // For hexadecimal values do not use single quotes + if (strpos($column_data[1], '0x') === 0) + { + $return_array['default'] = 'DEFAULT (' . $column_data[1] . ') '; + $sql_default .= $return_array['default']; + } + else + { + $return_array['default'] = 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + $sql_default .= $return_array['default']; + } + } + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + // $sql .= 'IDENTITY (1, 1) '; + $sql_default .= 'IDENTITY (1, 1) '; + } + + $return_array['textimage'] = $column_type === '[text]'; + + if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment')) + { + $sql .= 'NOT NULL'; + $sql_default .= 'NOT NULL'; + } + else + { + $sql .= 'NULL'; + $sql_default .= 'NULL'; + } + + $return_array['column_type_sql_default'] = $sql_default; + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // Does not support AFTER, only through temporary table + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $indexes = $this->get_existing_indexes($table_name, $column_name); + $indexes = array_merge($indexes, $this->get_existing_indexes($table_name, $column_name, true)); + + // Drop any indexes + $recreate_indexes = array(); + if (!empty($indexes)) + { + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_index_drop($table_name, $index_name); + $statements = array_merge($statements, $result); + if (sizeof($index_data) > 1) + { + // Remove this column from the index and recreate it + $recreate_indexes[$index_name] = array_diff($index_data, array($column_name)); + } + } + } + + // Drop default value constraint + $result = $this->mssql_get_drop_default_constraints_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Remove the column + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; + + if (!empty($recreate_indexes)) + { + // Recreate indexes after we removed the column + foreach ($recreate_indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + $this->return_statements = $old_return_statements; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; + $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; + $sql .= '[' . implode("],\n\t\t[", $column) . ']'; + $sql .= ')'; + + $statements[] = $sql; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + $statements[] = 'CREATE UNIQUE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + // remove index length + $column = preg_replace('#:.*$#', '', $column); + + $statements[] = 'CREATE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + $index_array[] = strtolower($row['INDEX_NAME']); + } + } + $this->db->sql_freeresult($result); + + return $index_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $indexes = $this->get_existing_indexes($table_name, $column_name); + $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true); + + // Drop any indexes + if (!empty($indexes) || !empty($unique_indexes)) + { + $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes)); + foreach ($drop_indexes as $index_name) + { + $result = $this->sql_index_drop($table_name, $index_name); + $statements = array_merge($statements, $result); + } + } + + // Drop default value constraint + $result = $this->mssql_get_drop_default_constraints_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Change the column + $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; + + if (!empty($column_data['default'])) + { + // Add new default value constraint + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD CONSTRAINT [DF_' . $table_name . '_' . $column_name . '_1] ' . $this->db->sql_escape($column_data['default']) . ' FOR [' . $column_name . ']'; + } + + if (!empty($indexes)) + { + // Recreate indexes after we changed the column + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + if (!empty($unique_indexes)) + { + // Recreate unique indexes after we changed the column + foreach ($unique_indexes as $index_name => $index_data) + { + $result = $this->sql_create_unique_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + $this->return_statements = $old_return_statements; + + return $this->_sql_run_sql($statements); + } + + /** + * Get queries to drop the default constraints of a column + * + * We need to drop the default constraints of a column, + * before being able to change their type or deleting them. + * + * @param string $table_name + * @param string $column_name + * @return array Array with SQL statements + */ + protected function mssql_get_drop_default_constraints_queries($table_name, $column_name) + { + $statements = array(); + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT so.name AS def_name + FROM sysobjects so + JOIN sysconstraints sc ON so.id = sc.constid + WHERE object_name(so.parent_obj) = '{$table_name}' + AND so.xtype = 'D' + AND sc.colid = (SELECT colid FROM syscolumns + WHERE id = object_id('{$table_name}') + AND name = '{$column_name}')"; + } + else + { + $sql = "SELECT dobj.name AS def_name + FROM sys.columns col + LEFT OUTER JOIN sys.objects dobj ON (dobj.object_id = col.default_object_id AND dobj.type = 'D') + WHERE col.object_id = object_id('{$table_name}') + AND col.name = '{$column_name}' + AND dobj.name IS NOT NULL"; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP CONSTRAINT [' . $row['def_name'] . ']'; + } + $this->db->sql_freeresult($result); + + return $statements; + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + $existing_indexes = array(); + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name + FROM sysindexes ix + INNER JOIN sysindexkeys ixc + ON ixc.id = ix.id + AND ixc.indid = ix.indid + INNER JOIN syscolumns cols + ON cols.colid = ixc.colid + AND cols.id = ix.id + WHERE ix.id = object_id('{$table_name}') + AND cols.name = '{$column_name}' + AND INDEXPROPERTY(ix.id, ix.name, 'IsUnique') = " . ($unique ? '1' : '0'); + } + else + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name + FROM sys.indexes ix + INNER JOIN sys.index_columns ixc + ON ixc.object_id = ix.object_id + AND ixc.index_id = ix.index_id + INNER JOIN sys.columns cols + ON cols.column_id = ixc.column_id + AND cols.object_id = ix.object_id + WHERE ix.object_id = object_id('{$table_name}') + AND cols.name = '{$column_name}' + AND ix.is_unique = " . ($unique ? '1' : '0'); + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE')) + { + $existing_indexes[$row['phpbb_index_name']] = array(); + } + } + $this->db->sql_freeresult($result); + + if (empty($existing_indexes)) + { + return array(); + } + + if ($this->mssql_is_sql_server_2000()) + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name + FROM sysindexes ix + INNER JOIN sysindexkeys ixc + ON ixc.id = ix.id + AND ixc.indid = ix.indid + INNER JOIN syscolumns cols + ON cols.colid = ixc.colid + AND cols.id = ix.id + WHERE ix.id = object_id('{$table_name}') + AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes)); + } + else + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name + FROM sys.indexes ix + INNER JOIN sys.index_columns ixc + ON ixc.object_id = ix.object_id + AND ixc.index_id = ix.index_id + INNER JOIN sys.columns cols + ON cols.column_id = ixc.column_id + AND cols.object_id = ix.object_id + WHERE ix.object_id = object_id('{$table_name}') + AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes)); + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name']; + } + $this->db->sql_freeresult($result); + + return $existing_indexes; + } + + /** + * Is the used MS SQL Server a SQL Server 2000? + * + * @return bool + */ + protected function mssql_is_sql_server_2000() + { + if ($this->is_sql_server_2000 === null) + { + $sql = "SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR(25)) AS mssql_version"; + $result = $this->db->sql_query($sql); + $properties = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + $this->is_sql_server_2000 = $properties['mssql_version'][0] == '8'; + } + + return $this->is_sql_server_2000; + } + +} diff --git a/phpBB/phpbb/db/tools/postgres.php b/phpBB/phpbb/db/tools/postgres.php new file mode 100644 index 0000000000..e2a4e668a6 --- /dev/null +++ b/phpBB/phpbb/db/tools/postgres.php @@ -0,0 +1,614 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\tools; + +/** + * Database Tools for handling cross-db actions such as altering columns, etc. + * Currently not supported is returning SQL for creating tables. + */ +class postgres extends tools +{ + /** + * Get the column types for postgres only + * + * @return array + */ + public static function get_dbms_type_map() + { + return array( + 'postgres' => array( + 'INT:' => 'INT4', + 'BINT' => 'INT8', + 'ULINT' => 'INT4', // unsigned + 'UINT' => 'INT4', // unsigned + 'UINT:' => 'INT4', // unsigned + 'USINT' => 'INT2', // unsigned + 'BOOL' => 'INT2', // unsigned + 'TINT:' => 'INT2', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'varchar(1000)', + 'STEXT' => 'varchar(3000)', + 'TEXT' => 'varchar(8000)', + 'MTEXT' => 'TEXT', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT_UNI' => 'varchar(4000)', + 'MTEXT_UNI' => 'TEXT', + 'TIMESTAMP' => 'INT4', // unsigned + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar_ci', + 'VARBINARY' => 'bytea', + ), + ); + } + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + parent::__construct($db, $return_statements); + + // Determine mapping database type + $this->sql_layer = 'postgres'; + + $this->dbms_type_map = self::get_dbms_type_map(); + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + $sql = 'SELECT relname + FROM pg_stat_user_tables'; + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existance of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + } + } + + // do we need to add a sequence for auto incrementing columns? + if ($create_sequence) + { + $statements[] = "CREATE SEQUENCE {$table_name}_seq;"; + } + + // close the table + $table_sql .= "\n);"; + $statements[] = $table_sql; + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + $sql = "SELECT a.attname + FROM pg_class c, pg_attribute a + WHERE c.relname = '{$table_name}' + AND a.attnum > 0 + AND a.attrelid = c.oid"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + $sql = "SELECT ic.relname as index_name + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisunique != 't') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // This DBMS prefixes index names with the table name + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + if (strtolower($row['index_name']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + $sql = "SELECT ic.relname as index_name, i.indisunique + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['indisunique'] != 't') + { + continue; + } + + // This DBMS prefixes index names with the table name + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + if (strtolower($row['index_name']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * Function to prepare some column information for better usage + * @access private + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type, $orig_column_type) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = " {$column_type} "; + + $return_array = array( + 'column_type' => $column_type, + 'auto_increment' => false, + ); + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $default_val = "nextval('{$table_name}_seq')"; + $return_array['auto_increment'] = true; + } + else if (!is_null($column_data[1])) + { + $default_val = "'" . $column_data[1] . "'"; + $return_array['null'] = 'NOT NULL'; + $sql .= 'NOT NULL '; + } + else + { + // Integers need to have 0 instead of empty string as default + if (strpos($column_type, 'INT') === 0) + { + $default_val = '0'; + } + else + { + $default_val = "'" . $column_data[1] . "'"; + } + $return_array['null'] = 'NULL'; + $sql .= 'NULL '; + } + + $return_array['default'] = $default_val; + + $sql .= "DEFAULT {$default_val}"; + + // Unsigned? Then add a CHECK contraint + if (in_array($orig_column_type, $this->unsigned_types)) + { + $return_array['constraint'] = "CHECK ({$column_name} >= 0)"; + $sql .= " CHECK ({$column_name} >= 0)"; + } + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // Does not support AFTER, only through temporary table + if (version_compare($this->db->sql_server_info(true), '8.0', '>=')) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + } + else + { + // old versions cannot add columns with default and null information + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type'] . ' ' . $column_data['constraint']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + $statements[] = 'DROP INDEX ' . $table_name . '_' . $index_name; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + // PGSQL does not "tightly" bind sequences and tables, we must guess... + $sql = "SELECT relname + FROM pg_class + WHERE relkind = 'S' + AND relname = '{$table_name}_seq'"; + $result = $this->db->sql_query($sql); + + // We don't even care about storing the results. We already know the answer if we get rows back. + if ($this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE {$table_name}_seq;\n"; + } + $this->db->sql_freeresult($result); + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + $statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + // remove index length + $column = preg_replace('#:.*$#', '', $column); + + $statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + + $sql = "SELECT ic.relname as index_name + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisunique != 't') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + $index_array[] = $row['index_name']; + } + $this->db->sql_freeresult($result); + + return array_map('strtolower', $index_array); + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + $sql = 'ALTER TABLE ' . $table_name . ' '; + + $sql_array = array(); + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + else if ($column_data['null'] == 'NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + + // we don't want to double up on constraints if we change different number data types + if (isset($column_data['constraint'])) + { + $constraint_sql = "SELECT consrc as constraint_data + FROM pg_constraint, pg_class bc + WHERE conrelid = bc.oid + AND bc.relname = '{$table_name}' + AND NOT EXISTS ( + SELECT * + FROM pg_constraint as c, pg_inherits as i + WHERE i.inhrelid = pg_constraint.conrelid + AND c.conname = pg_constraint.conname + AND c.consrc = pg_constraint.consrc + AND c.conrelid = i.inhparent + )"; + + $constraint_exists = false; + + $result = $this->db->sql_query($constraint_sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (trim($row['constraint_data']) == trim($column_data['constraint'])) + { + $constraint_exists = true; + break; + } + } + $this->db->sql_freeresult($result); + + if (!$constraint_exists) + { + $sql_array[] = 'ADD ' . $column_data['constraint']; + } + } + + $sql .= implode(', ', $sql_array); + + $statements[] = $sql; + + return $this->_sql_run_sql($statements); + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + // Not supported + throw new \Exception('DBMS is not supported'); + } +} diff --git a/phpBB/phpbb/db/tools/tools.php b/phpBB/phpbb/db/tools/tools.php new file mode 100644 index 0000000000..e00683dd46 --- /dev/null +++ b/phpBB/phpbb/db/tools/tools.php @@ -0,0 +1,2023 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\tools; + +/** +* Database Tools for handling cross-db actions such as altering columns, etc. +* Currently not supported is returning SQL for creating tables. +*/ +class tools implements tools_interface +{ + /** + * Current sql layer + */ + var $sql_layer = ''; + + /** + * @var object DB object + */ + var $db = null; + + /** + * The Column types for every database we support + * @var array + */ + var $dbms_type_map = array(); + + /** + * Get the column types for every database we support + * + * @return array + */ + static public function get_dbms_type_map() + { + return array( + 'mysql_41' => array( + 'INT:' => 'int(%d)', + 'BINT' => 'bigint(20)', + 'ULINT' => 'INT(10) UNSIGNED', + 'UINT' => 'mediumint(8) UNSIGNED', + 'UINT:' => 'int(%d) UNSIGNED', + 'TINT:' => 'tinyint(%d)', + 'USINT' => 'smallint(4) UNSIGNED', + 'BOOL' => 'tinyint(1) UNSIGNED', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'text', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT' => 'text', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT' => 'text', + 'TEXT_UNI' => 'text', + 'MTEXT' => 'mediumtext', + 'MTEXT_UNI' => 'mediumtext', + 'TIMESTAMP' => 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'varbinary(255)', + ), + + 'mysql_40' => array( + 'INT:' => 'int(%d)', + 'BINT' => 'bigint(20)', + 'ULINT' => 'INT(10) UNSIGNED', + 'UINT' => 'mediumint(8) UNSIGNED', + 'UINT:' => 'int(%d) UNSIGNED', + 'TINT:' => 'tinyint(%d)', + 'USINT' => 'smallint(4) UNSIGNED', + 'BOOL' => 'tinyint(1) UNSIGNED', + 'VCHAR' => 'varbinary(255)', + 'VCHAR:' => 'varbinary(%d)', + 'CHAR:' => 'binary(%d)', + 'XSTEXT' => 'blob', + 'XSTEXT_UNI'=> 'blob', + 'STEXT' => 'blob', + 'STEXT_UNI' => 'blob', + 'TEXT' => 'blob', + 'TEXT_UNI' => 'blob', + 'MTEXT' => 'mediumblob', + 'MTEXT_UNI' => 'mediumblob', + 'TIMESTAMP' => 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'blob', + 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')), + 'VCHAR_CI' => 'blob', + 'VARBINARY' => 'varbinary(255)', + ), + + 'oracle' => array( + 'INT:' => 'number(%d)', + 'BINT' => 'number(20)', + 'ULINT' => 'number(10)', + 'UINT' => 'number(8)', + 'UINT:' => 'number(%d)', + 'TINT:' => 'number(%d)', + 'USINT' => 'number(4)', + 'BOOL' => 'number(1)', + 'VCHAR' => 'varchar2(255)', + 'VCHAR:' => 'varchar2(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'varchar2(1000)', + 'STEXT' => 'varchar2(3000)', + 'TEXT' => 'clob', + 'MTEXT' => 'clob', + 'XSTEXT_UNI'=> 'varchar2(300)', + 'STEXT_UNI' => 'varchar2(765)', + 'TEXT_UNI' => 'clob', + 'MTEXT_UNI' => 'clob', + 'TIMESTAMP' => 'number(11)', + 'DECIMAL' => 'number(5, 2)', + 'DECIMAL:' => 'number(%d, 2)', + 'PDECIMAL' => 'number(6, 3)', + 'PDECIMAL:' => 'number(%d, 3)', + 'VCHAR_UNI' => 'varchar2(765)', + 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), + 'VCHAR_CI' => 'varchar2(255)', + 'VARBINARY' => 'raw(255)', + ), + + 'sqlite' => array( + 'INT:' => 'int(%d)', + 'BINT' => 'bigint(20)', + 'ULINT' => 'INTEGER UNSIGNED', // 'int(10) UNSIGNED', + 'UINT' => 'INTEGER UNSIGNED', // 'mediumint(8) UNSIGNED', + 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED', + 'TINT:' => 'tinyint(%d)', + 'USINT' => 'INTEGER UNSIGNED', // 'mediumint(4) UNSIGNED', + 'BOOL' => 'INTEGER UNSIGNED', // 'tinyint(1) UNSIGNED', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'text(65535)', + 'STEXT' => 'text(65535)', + 'TEXT' => 'text(65535)', + 'MTEXT' => 'mediumtext(16777215)', + 'XSTEXT_UNI'=> 'text(65535)', + 'STEXT_UNI' => 'text(65535)', + 'TEXT_UNI' => 'text(65535)', + 'MTEXT_UNI' => 'mediumtext(16777215)', + 'TIMESTAMP' => 'INTEGER UNSIGNED', // 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'blob', + ), + + 'sqlite3' => array( + 'INT:' => 'INT(%d)', + 'BINT' => 'BIGINT(20)', + 'ULINT' => 'INTEGER UNSIGNED', + 'UINT' => 'INTEGER UNSIGNED', + 'UINT:' => 'INTEGER UNSIGNED', + 'TINT:' => 'TINYINT(%d)', + 'USINT' => 'INTEGER UNSIGNED', + 'BOOL' => 'INTEGER UNSIGNED', + 'VCHAR' => 'VARCHAR(255)', + 'VCHAR:' => 'VARCHAR(%d)', + 'CHAR:' => 'CHAR(%d)', + 'XSTEXT' => 'TEXT(65535)', + 'STEXT' => 'TEXT(65535)', + 'TEXT' => 'TEXT(65535)', + 'MTEXT' => 'MEDIUMTEXT(16777215)', + 'XSTEXT_UNI'=> 'TEXT(65535)', + 'STEXT_UNI' => 'TEXT(65535)', + 'TEXT_UNI' => 'TEXT(65535)', + 'MTEXT_UNI' => 'MEDIUMTEXT(16777215)', + 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED', + 'DECIMAL' => 'DECIMAL(5,2)', + 'DECIMAL:' => 'DECIMAL(%d,2)', + 'PDECIMAL' => 'DECIMAL(6,3)', + 'PDECIMAL:' => 'DECIMAL(%d,3)', + 'VCHAR_UNI' => 'VARCHAR(255)', + 'VCHAR_UNI:'=> 'VARCHAR(%d)', + 'VCHAR_CI' => 'VARCHAR(255)', + 'VARBINARY' => 'BLOB', + ), + ); + } + + /** + * A list of types being unsigned for better reference in some db's + * @var array + */ + var $unsigned_types = array('ULINT', 'UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); + + /** + * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). + * This mode has no effect on some methods (inserting of data for example). This is expressed within the methods command. + */ + var $return_statements = false; + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + $this->db = $db; + $this->return_statements = $return_statements; + + $this->dbms_type_map = self::get_dbms_type_map(); + + // Determine mapping database type + switch ($this->db->get_sql_layer()) + { + case 'mysql': + $this->sql_layer = 'mysql_40'; + break; + + case 'mysql4': + if (version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $this->sql_layer = 'mysql_41'; + } + else + { + $this->sql_layer = 'mysql_40'; + } + break; + + case 'mysqli': + $this->sql_layer = 'mysql_41'; + break; + + default: + $this->sql_layer = $this->db->get_sql_layer(); + break; + } + } + + /** + * Setter for {@link $return_statements return_statements}. + * + * @param bool $return_statements True if SQL should not be executed but returned as strings + * @return null + */ + public function set_return_statements($return_statements) + { + $this->return_statements = $return_statements; + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + switch ($this->db->get_sql_layer()) + { + case 'mysql': + case 'mysql4': + case 'mysqli': + $sql = 'SHOW TABLES'; + break; + + case 'sqlite': + $sql = 'SELECT name + FROM sqlite_master + WHERE type = "table"'; + break; + + case 'sqlite3': + $sql = 'SELECT name + FROM sqlite_master + WHERE type = "table" + AND name <> "sqlite_sequence"'; + break; + + case 'oracle': + $sql = 'SELECT table_name + FROM USER_TABLES'; + break; + } + + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_table_exists($table_name) + { + $this->db->sql_return_on_error(true); + $result = $this->db->sql_query_limit('SELECT * FROM ' . $table_name, 1); + $this->db->sql_return_on_error(false); + + if ($result) + { + $this->db->sql_freeresult($result); + return true; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existance of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + case 'sqlite': + case 'sqlite3': + $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + + case 'oracle': + $table_sql .= ",\n\t CONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + } + } + } + + // close the table + switch ($this->sql_layer) + { + case 'mysql_41': + // make sure the table is in UTF-8 mode + $table_sql .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;"; + $statements[] = $table_sql; + break; + + case 'mysql_40': + case 'sqlite': + case 'sqlite3': + $table_sql .= "\n);"; + $statements[] = $table_sql; + break; + + case 'oracle': + $table_sql .= "\n)"; + $statements[] = $table_sql; + + // do we need to add a sequence and a tigger for auto incrementing columns? + if ($create_sequence) + { + // create the actual sequence + $statements[] = "CREATE SEQUENCE {$table_name}_seq"; + + // the trigger is the mechanism by which we increment the counter + $trigger = "CREATE OR REPLACE TRIGGER t_{$table_name}\n"; + $trigger .= "BEFORE INSERT ON {$table_name}\n"; + $trigger .= "FOR EACH ROW WHEN (\n"; + $trigger .= "\tnew.{$create_sequence} IS NULL OR new.{$create_sequence} = 0\n"; + $trigger .= ")\n"; + $trigger .= "BEGIN\n"; + $trigger .= "\tSELECT {$table_name}_seq.nextval\n"; + $trigger .= "\tINTO :new.{$create_sequence}\n"; + $trigger .= "\tFROM dual;\n"; + $trigger .= "END;"; + + $statements[] = $trigger; + } + break; + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function perform_schema_changes($schema_changes) + { + if (empty($schema_changes)) + { + return; + } + + $statements = array(); + $sqlite = false; + + // For SQLite we need to perform the schema changes in a much more different way + if (($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3') && $this->return_statements) + { + $sqlite_data = array(); + $sqlite = true; + } + + // Drop tables? + if (!empty($schema_changes['drop_tables'])) + { + foreach ($schema_changes['drop_tables'] as $table) + { + // only drop table if it exists + if ($this->sql_table_exists($table)) + { + $result = $this->sql_table_drop($table); + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add tables? + if (!empty($schema_changes['add_tables'])) + { + foreach ($schema_changes['add_tables'] as $table => $table_data) + { + $result = $this->sql_create_table($table, $table_data); + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + + // Change columns? + if (!empty($schema_changes['change_columns'])) + { + foreach ($schema_changes['change_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // If the column exists we change it, else we add it ;) + if ($column_exists = $this->sql_column_exists($table, $column_name)) + { + $result = $this->sql_column_change($table, $column_name, $column_data, true); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data, true); + } + + if ($sqlite) + { + if ($column_exists) + { + $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add columns? + if (!empty($schema_changes['add_columns'])) + { + foreach ($schema_changes['add_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // Only add the column if it does not exist yet + if ($column_exists = $this->sql_column_exists($table, $column_name)) + { + continue; + // This is commented out here because it can take tremendous time on updates +// $result = $this->sql_column_change($table, $column_name, $column_data, true); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data, true); + } + + if ($sqlite) + { + if ($column_exists) + { + continue; +// $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Remove keys? + if (!empty($schema_changes['drop_keys'])) + { + foreach ($schema_changes['drop_keys'] as $table => $indexes) + { + foreach ($indexes as $index_name) + { + if (!$this->sql_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_index_drop($table, $index_name); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Drop columns? + if (!empty($schema_changes['drop_columns'])) + { + foreach ($schema_changes['drop_columns'] as $table => $columns) + { + foreach ($columns as $column) + { + // Only remove the column if it exists... + if ($this->sql_column_exists($table, $column)) + { + $result = $this->sql_column_remove($table, $column, true); + + if ($sqlite) + { + $sqlite_data[$table]['drop_columns'][] = $result; + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + } + + // Add primary keys? + if (!empty($schema_changes['add_primary_keys'])) + { + foreach ($schema_changes['add_primary_keys'] as $table => $columns) + { + $result = $this->sql_create_primary_key($table, $columns, true); + + if ($sqlite) + { + $sqlite_data[$table]['primary_key'] = $result; + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + + // Add unique indexes? + if (!empty($schema_changes['add_unique_index'])) + { + foreach ($schema_changes['add_unique_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + if ($this->sql_unique_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_create_unique_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add indexes? + if (!empty($schema_changes['add_index'])) + { + foreach ($schema_changes['add_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + if ($this->sql_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_create_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + if ($sqlite) + { + foreach ($sqlite_data as $table_name => $sql_schema_changes) + { + // Create temporary table with original data + $statements[] = 'begin'; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + continue; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + // Get the columns... + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $plain_table_cols = trim($matches[1]); + $new_table_cols = preg_split('/,(?![\s\w]+\))/m', $plain_table_cols); + $column_list = array(); + + foreach ($new_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + // note down the primary key notation because sqlite only supports adding it to the end for the new table + $primary_key = false; + $_new_cols = array(); + + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + $primary_key = $declaration; + continue; + } + $_new_cols[] = $declaration; + } + + $new_table_cols = $_new_cols; + + // First of all... change columns + if (!empty($sql_schema_changes['change_columns'])) + { + foreach ($sql_schema_changes['change_columns'] as $column_sql) + { + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_sql, $entities[0] . ' ') === 0) + { + $new_table_cols[$key] = $column_sql; + } + } + } + } + + if (!empty($sql_schema_changes['add_columns'])) + { + foreach ($sql_schema_changes['add_columns'] as $column_sql) + { + $new_table_cols[] = $column_sql; + } + } + + // Now drop them... + if (!empty($sql_schema_changes['drop_columns'])) + { + foreach ($sql_schema_changes['drop_columns'] as $column_name) + { + // Remove from column list... + $new_column_list = array(); + foreach ($column_list as $key => $value) + { + if ($value === $column_name) + { + continue; + } + + $new_column_list[] = $value; + } + + $column_list = $new_column_list; + + // Remove from table... + $_new_cols = array(); + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_name . ' ', $entities[0] . ' ') === 0) + { + continue; + } + $_new_cols[] = $declaration; + } + $new_table_cols = $_new_cols; + } + } + + // Primary key... + if (!empty($sql_schema_changes['primary_key'])) + { + $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; + } + // Add a new one or the old primary key + else if ($primary_key !== false) + { + $new_table_cols[] = $primary_key; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + } + } + + if ($this->return_statements) + { + return $statements; + } + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = "SHOW COLUMNS FROM $table_name"; + break; + + case 'oracle': + $sql = "SELECT column_name + FROM user_tab_columns + WHERE LOWER(table_name) = '" . strtolower($table_name) . "'"; + break; + + case 'sqlite': + case 'sqlite3': + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}'"; + + $result = $this->db->sql_query($sql); + + if (!$result) + { + return false; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $cols = trim($matches[1]); + $col_array = preg_split('/,(?![\s\w]+\))/m', $cols); + + foreach ($col_array as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + + $column = strtolower($entities[0]); + $columns[$column] = $column; + } + + return $columns; + break; + } + + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_column_exists($table_name, $column_name) + { + $columns = $this->sql_list_columns($table_name); + + return isset($columns[$column_name]); + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'NONUNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite': + case 'sqlite3': + $sql = "PRAGMA index_list('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique']) + { + continue; + } + + // These DBMS prefix index name with the table name + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite': + case 'sqlite3': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + if (strtolower($row[$col]) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name, table_owner + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'UNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite': + case 'sqlite3': + $sql = "PRAGMA index_list('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && ($row['Non_unique'] || $row[$col] == 'PRIMARY')) + { + continue; + } + + if (($this->sql_layer == 'sqlite' || $this->sql_layer == 'sqlite3') && !$row['unique']) + { + continue; + } + + // These DBMS prefix index name with the table name + switch ($this->sql_layer) + { + case 'oracle': + // Two cases here... prefixed with U_[table_owner] and not prefixed with table_name + if (strpos($row[$col], 'U_') === 0) + { + $row[$col] = substr($row[$col], strlen('U_' . $row['table_owner']) + 1); + } + else if (strpos($row[$col], strtoupper($table_name)) === 0) + { + $row[$col] = substr($row[$col], strlen($table_name) + 1); + } + break; + + case 'sqlite': + case 'sqlite3': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + if (strtolower($row[$col]) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * Private method for performing sql statements (either execute them or return them) + * @access private + */ + function _sql_run_sql($statements) + { + if ($this->return_statements) + { + return $statements; + } + + // We could add error handling here... + foreach ($statements as $sql) + { + if ($sql === 'begin') + { + $this->db->sql_transaction('begin'); + } + else if ($sql === 'commit') + { + $this->db->sql_transaction('commit'); + } + else + { + $this->db->sql_query($sql); + } + } + + return true; + } + + /** + * Function to prepare some column information for better usage + * @access private + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = ''; + + $return_array = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql .= " {$column_type} "; + + // For hexadecimal values do not use single quotes + if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') + { + $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; + } + + if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment')) + { + $sql .= 'NOT NULL'; + } + else + { + $sql .= 'NULL'; + } + + if (isset($column_data[2])) + { + if ($column_data[2] == 'auto_increment') + { + $sql .= ' auto_increment'; + } + else if ($this->sql_layer === 'mysql_41' && $column_data[2] == 'true_sort') + { + $sql .= ' COLLATE utf8_unicode_ci'; + } + } + + break; + + case 'oracle': + $sql .= " {$column_type} "; + $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + + // In Oracle empty strings ('') are treated as NULL. + // Therefore in oracle we allow NULL's for all DEFAULT '' entries + // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) + if (!preg_match('/number/i', $column_type)) + { + $sql .= ($column_data[1] === '' || $column_data[1] === null) ? '' : 'NOT NULL'; + } + + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $return_array['auto_increment'] = true; + } + + break; + + case 'sqlite': + case 'sqlite3': + $return_array['primary_key_set'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $sql .= ' INTEGER PRIMARY KEY'; + $return_array['primary_key_set'] = true; + + if ($this->sql_layer === 'sqlite3') + { + $sql .= ' AUTOINCREMENT'; + } + } + else + { + $sql .= ' ' . $column_type; + } + + if (!is_null($column_data[1])) + { + $sql .= ' NOT NULL '; + $sql .= "DEFAULT '{$column_data[1]}'"; + } + + break; + } + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * Get the column's database type from the type map + * + * @param string $column_map_type + * @return array column type for this database + * and map type without length + */ + function get_column_type($column_map_type) + { + $column_type = ''; + if (strpos($column_map_type, ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_map_type); + if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); + } + else + { + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) + { + case 'div': + $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; + $column_length = ceil($column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + break; + } + } + + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) + { + case 'mult': + $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; + if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) + { + $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; + } + else + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + } + break; + } + } + } + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_map_type; + $column_type = $this->dbms_type_map[$this->sql_layer][$column_map_type]; + } + + return array($column_type, $orig_column_type); + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : ''; + $statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after; + break; + + case 'oracle': + // Does not support AFTER, only through temporary table + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + + case 'sqlite': + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + $new_table_cols = $column_name . ' ' . $column_data['column_type_sql'] . ',' . $new_table_cols; + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + + case 'sqlite3': + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; + break; + + case 'sqlite': + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column_name; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name, $column_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + $new_table_cols = trim(preg_replace('/' . $column_name . '\b[^,]+(?:,|$)/m', '', $new_table_cols)); + if (substr($new_table_cols, -1) === ',') + { + // Remove the comma from the last entry again + $new_table_cols = substr($new_table_cols, 0, -1); + } + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; + break; + + case 'oracle': + case 'sqlite': + case 'sqlite3': + $statements[] = 'DROP INDEX ' . $table_name . '_' . $index_name; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + switch ($this->sql_layer) + { + case 'oracle': + $sql = 'SELECT A.REFERENCED_NAME + FROM USER_DEPENDENCIES A, USER_TRIGGERS B + WHERE A.REFERENCED_TYPE = \'SEQUENCE\' + AND A.NAME = B.TRIGGER_NAME + AND B.TABLE_NAME = \'' . strtoupper($table_name) . "'"; + $result = $this->db->sql_query($sql); + + // any sequences ref'd to this table's triggers? + while ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE {$row['referenced_name']}"; + } + $this->db->sql_freeresult($result); + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'sqlite': + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite': + case 'sqlite3': + $statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + // remove index length unless MySQL4 + if ('mysql_40' != $this->sql_layer) + { + $column = preg_replace('#:.*$#', '', $column); + } + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite': + case 'sqlite3': + $statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_40': + // add index size to definition as required by MySQL4 + foreach ($column as $i => $col) + { + if (false !== strpos($col, ':')) + { + list($col, $index_size) = explode(':', $col); + $column[$i] = "$col($index_size)"; + } + } + // no break + case 'mysql_41': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . ' (' . implode(', ', $column) . ')'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Check whether the index name is too long + * + * @param string $table_name + * @param string $index_name + */ + protected function check_index_name_length($table_name, $index_name) + { + $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) + if (strlen($table_name . $index_name) - strlen($table_prefix) > 24) + { + $max_length = strlen($table_prefix) + 24; + trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR); + } + } + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'NONUNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite': + case 'sqlite3': + $sql = "PRAGMA index_info('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique']) + { + continue; + } + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite': + case 'sqlite3': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + $index_array[] = $row[$col]; + } + $this->db->sql_freeresult($result); + + return array_map('strtolower', $index_array); + } + + /** + * Removes table_name from the index_name if it is at the beginning + * + * @param $table_name + * @param $index_name + * @return string + */ + protected function strip_table_name_from_index_name($table_name, $index_name) + { + return (strpos(strtoupper($index_name), strtoupper($table_name)) === 0) ? substr($index_name, strlen($table_name) + 1) : $index_name; + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $original_column_data = $column_data; + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql']; + break; + + case 'oracle': + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + // Get list of existing indexes + $indexes = $this->get_existing_indexes($table_name, $column_name); + $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true); + + // Drop any indexes + if (!empty($indexes) || !empty($unique_indexes)) + { + $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes)); + foreach ($drop_indexes as $index_name) + { + $result = $this->sql_index_drop($table_name, $this->strip_table_name_from_index_name($table_name, $index_name)); + $statements = array_merge($statements, $result); + } + } + + $temp_column_name = 'temp_' . substr(md5($column_name), 0, 25); + // Add a temporary table with the new type + $result = $this->sql_column_add($table_name, $temp_column_name, $original_column_data); + $statements = array_merge($statements, $result); + + // Copy the data to the new column + $statements[] = 'UPDATE ' . $table_name . ' SET ' . $temp_column_name . ' = ' . $column_name; + + // Drop the original column + $result = $this->sql_column_remove($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Recreate the original column with the new type + $result = $this->sql_column_add($table_name, $column_name, $original_column_data); + $statements = array_merge($statements, $result); + + if (!empty($indexes)) + { + // Recreate indexes after we changed the column + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data); + $statements = array_merge($statements, $result); + } + } + + if (!empty($unique_indexes)) + { + // Recreate unique indexes after we changed the column + foreach ($unique_indexes as $index_name => $index_data) + { + $result = $this->sql_create_unique_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data); + $statements = array_merge($statements, $result); + } + } + + // Copy the data to the original column + $statements[] = 'UPDATE ' . $table_name . ' SET ' . $column_name . ' = ' . $temp_column_name; + + // Drop the temporary column again + $result = $this->sql_column_remove($table_name, $temp_column_name); + $statements = array_merge($statements, $result); + + $this->return_statements = $old_return_statements; + break; + + case 'sqlite': + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a temp table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $key => $declaration) + { + $declaration = trim($declaration); + + // Check for the beginning of the constraint section and stop + if (preg_match('/[^\(]*\s*PRIMARY KEY\s+\(/', $declaration) || + preg_match('/[^\(]*\s*UNIQUE\s+\(/', $declaration) || + preg_match('/[^\(]*\s*FOREIGN KEY\s+\(/', $declaration) || + preg_match('/[^\(]*\s*CHECK\s+\(/', $declaration)) + { + break; + } + + $entities = preg_split('#\s+#', $declaration); + $column_list[] = $entities[0]; + if ($entities[0] == $column_name) + { + $old_table_cols[$key] = $column_name . ' ' . $column_data['column_type_sql']; + } + } + + $columns = implode(',', $column_list); + + // Create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + case 'sqlite': + case 'sqlite3': + // Not supported + throw new \Exception('DBMS is not supported'); + break; + } + + $sql = ''; + $existing_indexes = array(); + + switch ($this->sql_layer) + { + case 'oracle': + $sql = "SELECT ix.index_name AS phpbb_index_name, ix.uniqueness AS is_unique + FROM all_ind_columns ixc, all_indexes ix + WHERE ix.index_name = ixc.index_name + AND ixc.table_name = '" . strtoupper($table_name) . "' + AND ixc.column_name = '" . strtoupper($column_name) . "'"; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE')) + { + $existing_indexes[$row['phpbb_index_name']] = array(); + } + } + $this->db->sql_freeresult($result); + + if (empty($existing_indexes)) + { + return array(); + } + + switch ($this->sql_layer) + { + case 'oracle': + $sql = "SELECT index_name AS phpbb_index_name, column_name AS phpbb_column_name + FROM all_ind_columns + WHERE table_name = '" . strtoupper($table_name) . "' + AND " . $this->db->sql_in_set('index_name', array_keys($existing_indexes)); + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name']; + } + $this->db->sql_freeresult($result); + + return $existing_indexes; + } + + /** + * Returns the Queries which are required to recreate a table including indexes + * + * @param string $table_name + * @param string $remove_column When we drop a column, we remove the column + * from all indexes. If the index has no other + * column, we drop it completly. + * @return array + */ + protected function sqlite_get_recreate_table_queries($table_name, $remove_column = '') + { + $queries = array(); + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + $sql_create_table = $this->db->sql_fetchfield('sql'); + $this->db->sql_freeresult($result); + + if (!$sql_create_table) + { + return array(); + } + $queries[] = $sql_create_table; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'index' + AND tbl_name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + while ($sql_create_index = $this->db->sql_fetchfield('sql')) + { + if ($remove_column) + { + $match = array(); + preg_match('#(?:[\w ]+)\((.*)\)#', $sql_create_index, $match); + if (!isset($match[1])) + { + continue; + } + + // Find and remove $remove_column from the index + $columns = explode(', ', $match[1]); + $found_column = array_search($remove_column, $columns); + if ($found_column !== false) + { + unset($columns[$found_column]); + + // If the column list is not empty add the index to the list + if (!empty($columns)) + { + $queries[] = str_replace($match[1], implode(', ', $columns), $sql_create_index); + } + } + else + { + $queries[] = $sql_create_index; + } + } + else + { + $queries[] = $sql_create_index; + } + } + $this->db->sql_freeresult($result); + + return $queries; + } +} diff --git a/phpBB/phpbb/db/tools/tools_interface.php b/phpBB/phpbb/db/tools/tools_interface.php new file mode 100644 index 0000000000..f153f73a54 --- /dev/null +++ b/phpBB/phpbb/db/tools/tools_interface.php @@ -0,0 +1,202 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\tools; + +/** + * Interface for a Database Tools for handling cross-db actions such as altering columns, etc. + */ +interface tools_interface +{ + /** + * Handle passed database update array. + * Expected structure... + * Key being one of the following + * drop_tables: Drop tables + * add_tables: Add tables + * change_columns: Column changes (only type, not name) + * add_columns: Add columns to a table + * drop_keys: Dropping keys + * drop_columns: Removing/Dropping columns + * add_primary_keys: adding primary keys + * add_unique_index: adding an unique index + * add_index: adding an index (can be column:index_size if you need to provide size) + * + * The values are in this format: + * {TABLE NAME} => array( + * {COLUMN NAME} => array({COLUMN TYPE}, {DEFAULT VALUE}, {OPTIONAL VARIABLES}), + * {KEY/INDEX NAME} => array({COLUMN NAMES}), + * ) + * + * + * @param array $schema_changes + * @return null + */ + public function perform_schema_changes($schema_changes); + + /** + * Gets a list of tables in the database. + * + * @return array Array of table names (all lower case) + */ + public function sql_list_tables(); + + /** + * Check if table exists + * + * @param string $table_name The table name to check for + * @return bool true if table exists, else false + */ + public function sql_table_exists($table_name); + + /** + * Create SQL Table + * + * @param string $table_name The table name to create + * @param array $table_data Array containing table data. + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_create_table($table_name, $table_data); + + /** + * Drop Table + * + * @param string $table_name The table name to drop + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_table_drop($table_name); + + /** + * Gets a list of columns of a table. + * + * @param string $table_name Table name + * @return array Array of column names (all lower case) + */ + public function sql_list_columns($table_name); + + /** + * Check whether a specified column exist in a table + * + * @param string $table_name Table to check + * @param string $column_name Column to check + * @return bool True if column exists, false otherwise + */ + public function sql_column_exists($table_name, $column_name); + + /** + * Add new column + * + * @param string $table_name Table to modify + * @param string $column_name Name of the column to add + * @param array $column_data Column data + * @param bool $inline Whether the query should actually be run, + * or return a string for adding the column + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_column_add($table_name, $column_name, $column_data, $inline = false); + + /** + * Change column type (not name!) + * + * @param string $table_name Table to modify + * @param string $column_name Name of the column to modify + * @param array $column_data Column data + * @param bool $inline Whether the query should actually be run, + * or return a string for modifying the column + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_column_change($table_name, $column_name, $column_data, $inline = false); + + /** + * Drop column + * + * @param string $table_name Table to modify + * @param string $column_name Name of the column to drop + * @param bool $inline Whether the query should actually be run, + * or return a string for deleting the column + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_column_remove($table_name, $column_name, $inline = false); + + /** + * List all of the indices that belong to a table + * + * NOTE: does not list + * - UNIQUE indices + * - PRIMARY keys + * + * @param string $table_name Table to check + * @return array Array with index names + */ + public function sql_list_index($table_name); + + /** + * Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes. + * + * @param string $table_name Table to check the index at + * @param string $index_name The index name to check + * @return bool True if index exists, else false + */ + public function sql_index_exists($table_name, $index_name); + + /** + * Add index + * + * @param string $table_name Table to modify + * @param string $index_name Name of the index to create + * @param string|array $column Either a string with a column name, or an array with columns + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_create_index($table_name, $index_name, $column); + + /** + * Drop Index + * + * @param string $table_name Table to modify + * @param string $index_name Name of the index to delete + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_index_drop($table_name, $index_name); + + /** + * Check if a specified index exists in table. + * + * NOTE: Does not return normal and PRIMARY KEY indexes + * + * @param string $table_name Table to check the index at + * @param string $index_name The index name to check + * @return bool True if index exists, else false + */ + public function sql_unique_index_exists($table_name, $index_name); + + /** + * Add unique index + * + * @param string $table_name Table to modify + * @param string $index_name Name of the unique index to create + * @param string|array $column Either a string with a column name, or an array with columns + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_create_unique_index($table_name, $index_name, $column); + + /** + * Add primary key + * + * @param string $table_name Table to modify + * @param string|array $column Either a string with a column name, or an array with columns + * @param bool $inline Whether the query should actually be run, + * or return a string for creating the key + * @return array|true Statements to run, or true if the statements have been executed + */ + public function sql_create_primary_key($table_name, $column, $inline = false); +} diff --git a/phpBB/phpbb/debug/debug.php b/phpBB/phpbb/debug/debug.php new file mode 100644 index 0000000000..c5ffada2e5 --- /dev/null +++ b/phpBB/phpbb/debug/debug.php @@ -0,0 +1,80 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\debug; + +use Symfony\Component\Debug\BufferingLogger; +use Symfony\Component\Debug\DebugClassLoader; +use Symfony\Component\Debug\ExceptionHandler; + +/** + * Registers all the debug tools. + + * @see Symfony\Component\Debug\Debug + */ +class debug +{ + private static $enabled = false; + + /** + * Enables the debug tools. + * + * This method registers an error handler and an exception handler. + * + * If the Symfony ClassLoader component is available, a special + * class loader is also registered. + * + * @param int $errorReportingLevel The level of error reporting you want + * @param bool $displayErrors Whether to display errors (for development) or just log them (for production) + */ + public static function enable($errorReportingLevel = null, $displayErrors = true) + { + if (static::$enabled) + { + return; + } + + static::$enabled = true; + + if ($errorReportingLevel !== null) + { + error_reporting($errorReportingLevel); + } + else + { + error_reporting(-1); + } + + if ('cli' !== php_sapi_name()) + { + ini_set('display_errors', 0); + ExceptionHandler::register(); + } + else if ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) + { + // CLI - display errors only if they're not already logged to STDERR + ini_set('display_errors', 1); + } + + if ($displayErrors) + { + error_handler::register(new error_handler(new BufferingLogger())); + } + else + { + error_handler::register()->throwAt(0, true); + } + + DebugClassLoader::enable(); + } +} diff --git a/phpBB/phpbb/debug/error_handler.php b/phpBB/phpbb/debug/error_handler.php new file mode 100644 index 0000000000..246e724f56 --- /dev/null +++ b/phpBB/phpbb/debug/error_handler.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\debug; + +use Symfony\Component\Debug\ErrorHandler; + +class error_handler extends ErrorHandler +{ + public function handleError($type, $message, $file, $line, array $context, array $backtrace = null) + { + if ($type === E_USER_WARNING || $type === E_USER_NOTICE) + { + $handler = defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'; + + $handler($type, $message, $file, $line); + } + + return parent::handleError($type, $message, $file, $line, $context, $backtrace); + } +} diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php new file mode 100644 index 0000000000..8f175c966c --- /dev/null +++ b/phpBB/phpbb/di/container_builder.php @@ -0,0 +1,551 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di; + +use phpbb\filesystem\filesystem; +use Symfony\Component\Config\ConfigCache; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass; +use Symfony\Component\Filesystem\Exception\IOException; +use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; + +class container_builder +{ + /** + * @var string The environment to use. + */ + protected $environment; + + /** + * @var string phpBB Root Path + */ + protected $phpbb_root_path; + + /** + * @var string php file extension + */ + protected $php_ext; + + /** + * The container under construction + * + * @var ContainerBuilder + */ + protected $container; + + /** + * Indicates whether extensions should be used (default to true). + * + * @var bool + */ + protected $use_extensions = true; + + /** + * Defines a custom path to find the configuration of the container (default to $this->phpbb_root_path . 'config') + * + * @var string + */ + protected $config_path = null; + + /** + * Indicates whether the container should be dumped to the filesystem (default to true). + * + * If DEBUG_CONTAINER is set this option is ignored and a new container is build. + * + * @var bool + */ + protected $use_cache = true; + + /** + * Indicates if the container should be compiled automatically (default to true). + * + * @var bool + */ + protected $compile_container = true; + + /** + * Custom parameters to inject into the container. + * + * Default to: + * array( + * 'core.root_path', $this->phpbb_root_path, + * 'core.php_ext', $this->php_ext, + * ); + * + * @var array + */ + protected $custom_parameters = null; + + /** + * @var \phpbb\config_php_file + */ + protected $config_php_file; + + /** + * @var string + */ + protected $cache_dir; + + /** + * @var array + */ + private $container_extensions; + + /** + * Constructor + * + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension + */ + function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Build and return a new Container respecting the current configuration + * + * @return \phpbb_cache_container|ContainerBuilder + */ + public function get_container() + { + $container_filename = $this->get_container_filename(); + $config_cache = new ConfigCache($container_filename, defined('DEBUG')); + if ($this->use_cache && $config_cache->isFresh()) + { + require($config_cache->getPath()); + $this->container = new \phpbb_cache_container(); + } + else + { + $this->container_extensions = array(new extension\core($this->get_config_path())); + + if ($this->use_extensions) + { + $this->load_extensions(); + } + + // Inject the config + if ($this->config_php_file) + { + $this->container_extensions[] = new extension\config($this->config_php_file); + } + + $this->container = $this->create_container($this->container_extensions); + + // Easy collections through tags + $this->container->addCompilerPass(new pass\collection_pass()); + + // Event listeners "phpBB style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener')); + + // Event listeners "Symfony style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher')); + + if ($this->use_extensions) + { + $this->register_ext_compiler_pass(); + } + + $filesystem = new filesystem(); + $loader = new YamlFileLoader($this->container, new FileLocator($filesystem->realpath($this->get_config_path()))); + $loader->load($this->container->getParameter('core.environment') . '/config.yml'); + + $this->inject_custom_parameters(); + + if ($this->compile_container) + { + $this->container->compile(); + + if ($this->use_cache) + { + $this->dump_container($config_cache); + } + } + } + + if ($this->compile_container && $this->config_php_file) + { + $this->container->set('config.php', $this->config_php_file); + } + + return $this->container; + } + + /** + * Enable the extensions. + * + * @param string $environment The environment to use + * @return $this + */ + public function with_environment($environment) + { + $this->environment = $environment; + + return $this; + } + + /** + * Enable the extensions. + * + * @return $this + */ + public function with_extensions() + { + $this->use_extensions = true; + + return $this; + } + + /** + * Disable the extensions. + * + * @return $this + */ + public function without_extensions() + { + $this->use_extensions = false; + + return $this; + } + + /** + * Enable the caching of the container. + * + * If DEBUG_CONTAINER is set this option is ignored and a new container is build. + * + * @return $this + */ + public function with_cache() + { + $this->use_cache = true; + + return $this; + } + + /** + * Disable the caching of the container. + * + * @return $this + */ + public function without_cache() + { + $this->use_cache = false; + + return $this; + } + + /** + * Set the cache directory. + * + * @param string $cache_dir The cache directory. + * @return $this + */ + public function with_cache_dir($cache_dir) + { + $this->cache_dir = $cache_dir; + + return $this; + } + + /** + * Enable the compilation of the container. + * + * @return $this + */ + public function with_compiled_container() + { + $this->compile_container = true; + + return $this; + } + + /** + * Disable the compilation of the container. + * + * @return $this + */ + public function without_compiled_container() + { + $this->compile_container = false; + + return $this; + } + + /** + * Set a custom path to find the configuration of the container. + * + * @param string $config_path + * @return $this + */ + public function with_config_path($config_path) + { + $this->config_path = $config_path; + + return $this; + } + + /** + * Set custom parameters to inject into the container. + * + * @param array $custom_parameters + * @return $this + */ + public function with_custom_parameters($custom_parameters) + { + $this->custom_parameters = $custom_parameters; + + return $this; + } + + /** + * Set custom parameters to inject into the container. + * + * @param \phpbb\config_php_file $config_php_file + * @return $this + */ + public function with_config(\phpbb\config_php_file $config_php_file) + { + $this->config_php_file = $config_php_file; + + return $this; + } + + /** + * Returns the path to the container configuration (default: root_path/config) + * + * @return string + */ + protected function get_config_path() + { + return $this->config_path ?: $this->phpbb_root_path . 'config'; + } + + /** + * Returns the path to the cache directory (default: root_path/cache/environment). + * + * @return string Path to the cache directory. + */ + protected function get_cache_dir() + { + return $this->cache_dir ?: $this->phpbb_root_path . 'cache/' . $this->get_environment() . '/'; + } + + /** + * Load the enabled extensions. + */ + protected function load_extensions() + { + if ($this->config_php_file !== null) + { + // Build an intermediate container to load the ext list from the database + $container_builder = new container_builder($this->phpbb_root_path, $this->php_ext); + $ext_container = $container_builder + ->without_cache() + ->without_extensions() + ->with_config($this->config_php_file) + ->with_config_path($this->get_config_path()) + ->with_environment('production') + ->without_compiled_container() + ->get_container() + ; + + $ext_container->register('cache.driver', '\\phpbb\\cache\\driver\\dummy'); + $ext_container->compile(); + + $extensions = $ext_container->get('ext.manager')->all_enabled(); + + // Load each extension found + foreach ($extensions as $ext_name => $path) + { + $extension_class = '\\' . str_replace('/', '\\', $ext_name) . '\\di\\extension'; + + if (!class_exists($extension_class)) + { + $extension_class = '\\phpbb\\extension\\di\\extension_base'; + } + + $this->container_extensions[] = new $extension_class($ext_name, $path); + + // Load extension autoloader + $filename = $path . 'vendor/autoload.php'; + if (file_exists($filename)) + { + require $filename; + } + } + } + else + { + // To load the extensions we need the database credentials. + // Automatically disable the extensions if we don't have them. + $this->use_extensions = false; + } + } + + /** + * Dump the container to the disk. + * + * @param ConfigCache $cache The config cache + */ + protected function dump_container($cache) + { + try + { + $dumper = new PhpDumper($this->container); + $cached_container_dump = $dumper->dump(array( + 'class' => 'phpbb_cache_container', + 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder', + )); + + $cache->write($cached_container_dump, $this->container->getResources()); + } + catch (IOException $e) + { + // Don't fail if the cache isn't writeable + } + } + + /** + * Create the ContainerBuilder object + * + * @param array $extensions Array of Container extension objects + * @return ContainerBuilder object + */ + protected function create_container(array $extensions) + { + $container = new ContainerBuilder(new ParameterBag($this->get_core_parameters())); + + $extensions_alias = array(); + + foreach ($extensions as $extension) + { + $container->registerExtension($extension); + $extensions_alias[] = $extension->getAlias(); + } + + $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions_alias)); + + return $container; + } + + /** + * Inject the customs parameters into the container + */ + protected function inject_custom_parameters() + { + if ($this->custom_parameters !== null) + { + foreach ($this->custom_parameters as $key => $value) + { + $this->container->setParameter($key, $value); + } + } + } + + /** + * Returns the core parameters. + * + * @return array An array of core parameters + */ + protected function get_core_parameters() + { + return array_merge( + array( + 'core.root_path' => $this->phpbb_root_path, + 'core.php_ext' => $this->php_ext, + 'core.environment' => $this->get_environment(), + 'core.debug' => defined('DEBUG') ? DEBUG : false, + ), + $this->get_env_parameters() + ); + } + + /** + * Gets the environment parameters. + * + * Only the parameters starting with "PHPBB__" are considered. + * + * @return array An array of parameters + */ + protected function get_env_parameters() + { + $parameters = array(); + foreach ($_SERVER as $key => $value) + { + if (0 === strpos($key, 'PHPBB__')) + { + $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; + } + } + + return $parameters; + } + + /** + * Get the filename under which the dumped container will be stored. + * + * @return string Path for dumped container + */ + protected function get_container_filename() + { + return $this->get_cache_dir() . 'container_' . md5($this->phpbb_root_path) . '.' . $this->php_ext; + } + + /** + * Return the name of the current environment. + * + * @return string + */ + protected function get_environment() + { + return $this->environment ?: PHPBB_ENVIRONMENT; + } + + private function register_ext_compiler_pass() + { + $finder = new Finder(); + $finder + ->name('*_pass.php') + ->path('di/pass') + ->files() + ->ignoreDotFiles(true) + ->ignoreUnreadableDirs(true) + ->ignoreVCS(true) + ->followLinks() + ->in($this->phpbb_root_path . 'ext/') + ; + + /** @var \SplFileInfo $pass */ + foreach ($finder as $pass) + { + $filename = $pass->getPathname(); + $filename = substr($filename, 0, -strlen('.' . $pass->getExtension())); + $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename); + $className = preg_replace('#^.*ext/#', '', $filename); + $className = '\\' . str_replace('/', '\\', $className); + + if (class_exists($className) && in_array('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface', class_implements($className), true)) + { + $this->container->addCompilerPass(new $className()); + } + } + } +} diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index 2603e7b358..7984a783df 100644 --- a/phpBB/phpbb/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,17 +15,18 @@ namespace phpbb\di\extension; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\Config\FileLocator; /** * Container config extension */ class config extends Extension { - public function __construct($config_file) + /** @var array */ + protected $config_php; + + public function __construct(\phpbb\config_php_file $config_php) { - $this->config_file = $config_file; + $this->config_php = $config_php; } /** @@ -30,22 +35,28 @@ class config extends Extension * @param array $config An array of configuration values * @param ContainerBuilder $container A ContainerBuilder instance * - * @throws InvalidArgumentException When provided tag is not defined in this extension + * @throws \InvalidArgumentException When provided tag is not defined in this extension */ public function load(array $config, ContainerBuilder $container) { - require($this->config_file); + $parameters = array( + 'core.adm_relative_path' => $this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/', + 'core.table_prefix' => $this->config_php->get('table_prefix'), + 'cache.driver.class' => $this->convert_30_acm_type($this->config_php->get('acm_type')), + 'dbal.driver.class' => $this->config_php->convert_30_dbms_to_31($this->config_php->get('dbms')), + 'dbal.dbhost' => $this->config_php->get('dbhost'), + 'dbal.dbuser' => $this->config_php->get('dbuser'), + 'dbal.dbpasswd' => $this->config_php->get('dbpasswd'), + 'dbal.dbname' => $this->config_php->get('dbname'), + 'dbal.dbport' => $this->config_php->get('dbport'), + 'dbal.new_link' => defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK, + ); + $parameter_bag = $container->getParameterBag(); - $container->setParameter('core.adm_relative_path', (isset($phpbb_adm_relative_path) ? $phpbb_adm_relative_path : 'adm/')); - $container->setParameter('core.table_prefix', $table_prefix); - $container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type)); - $container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms)); - $container->setParameter('dbal.dbhost', $dbhost); - $container->setParameter('dbal.dbuser', $dbuser); - $container->setParameter('dbal.dbpasswd', $dbpasswd); - $container->setParameter('dbal.dbname', $dbname); - $container->setParameter('dbal.dbport', $dbport); - $container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK); + foreach ($parameters as $parameter => $value) + { + $container->setParameter($parameter, $parameter_bag->escapeValue($value)); + } } /** @@ -64,7 +75,7 @@ class config extends Extension * Convert 3.0 ACM type to 3.1 cache driver class name * * @param string $acm_type ACM type - * @return cache driver class + * @return string cache driver class */ protected function convert_30_acm_type($acm_type) { diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php new file mode 100644 index 0000000000..4585d6509e --- /dev/null +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -0,0 +1,52 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di\extension; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class container_configuration implements ConfigurationInterface +{ + + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('core'); + $rootNode + ->children() + ->booleanNode('require_dev_dependencies')->defaultValue(false)->end() + ->arrayNode('debug') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('exceptions')->defaultValue(false)->end() + ->end() + ->end() + ->arrayNode('twig') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('debug')->defaultValue(null)->end() + ->booleanNode('auto_reload')->defaultValue(null)->end() + ->booleanNode('enable_debug_extension')->defaultValue(false)->end() + ->end() + ->end() + ->end() + ; + return $treeBuilder; + } +} diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 455dfa7ecd..c48a80a558 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -1,18 +1,23 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\di\extension; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\Config\FileLocator; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * Container core extension @@ -20,42 +25,96 @@ use Symfony\Component\Config\FileLocator; class core extends Extension { /** - * Config path - * @var string - */ + * Config path + * @var string + */ protected $config_path; /** - * Constructor - * - * @param string $config_path Config path - */ + * Constructor + * + * @param string $config_path Config path + */ public function __construct($config_path) { $this->config_path = $config_path; } /** - * Loads a specific configuration. - * - * @param array $config An array of configuration values - * @param ContainerBuilder $container A ContainerBuilder instance - * - * @throws InvalidArgumentException When provided tag is not defined in this extension - */ - public function load(array $config, ContainerBuilder $container) + * Loads a specific configuration. + * + * @param array $configs An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws \InvalidArgumentException When provided tag is not defined in this extension + */ + public function load(array $configs, ContainerBuilder $container) { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path))); - $loader->load('services.yml'); + $filesystem = new \phpbb\filesystem\filesystem(); + $loader = new YamlFileLoader($container, new FileLocator($filesystem->realpath($this->config_path))); + $loader->load($container->getParameter('core.environment') . '/container/environment.yml'); + + $config = $this->getConfiguration($configs, $container); + $config = $this->processConfiguration($config, $configs); + + if ($config['require_dev_dependencies']) + { + if (!class_exists('Goutte\Client', true)) + { + trigger_error( + 'Composer development dependencies have not been set up for the ' . $container->getParameter('core.environment') . ' environment yet, run ' . + "'php ../composer.phar install --dev' from the phpBB directory to do so.", + E_USER_ERROR + ); + } + } + + // Set the Twig options if defined in the environment + $definition = $container->getDefinition('template.twig.environment'); + $twig_environment_options = $definition->getArgument(7); + if ($config['twig']['debug']) + { + $twig_environment_options['debug'] = true; + } + if ($config['twig']['auto_reload']) + { + $twig_environment_options['auto_reload'] = true; + } + + // Replace the 8th argument, the options passed to the environment + $definition->replaceArgument(7, $twig_environment_options); + + if ($config['twig']['enable_debug_extension']) + { + $definition = $container->getDefinition('template.twig.extensions.debug'); + $definition->addTag('twig.extension'); + } + + // Set the debug options + foreach ($config['debug'] as $name => $value) + { + $container->setParameter('debug.' . $name, $value); + } + } + + /** + * {@inheritdoc} + */ + public function getConfiguration(array $config, ContainerBuilder $container) + { + $r = new \ReflectionClass('\phpbb\di\extension\container_configuration'); + $container->addResource(new FileResource($r->getFileName())); + + return new container_configuration(); } /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ public function getAlias() { return 'core'; diff --git a/phpBB/phpbb/di/extension/ext.php b/phpBB/phpbb/di/extension/ext.php deleted file mode 100644 index 4f2f24cb1a..0000000000 --- a/phpBB/phpbb/di/extension/ext.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\di\extension; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\Config\FileLocator; - -/** -* Container ext extension -*/ -class ext extends Extension -{ - protected $paths = array(); - - public function __construct($enabled_extensions) - { - foreach ($enabled_extensions as $ext => $path) - { - $this->paths[] = $path; - } - } - - /** - * Loads a specific configuration. - * - * @param array $config An array of configuration values - * @param ContainerBuilder $container A ContainerBuilder instance - * - * @throws InvalidArgumentException When provided tag is not defined in this extension - */ - public function load(array $config, ContainerBuilder $container) - { - foreach ($this->paths as $path) - { - if (file_exists($path . '/config/services.yml')) - { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($path . '/config'))); - $loader->load('services.yml'); - } - } - } - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ - public function getAlias() - { - return 'ext'; - } -} diff --git a/phpBB/phpbb/di/ordered_service_collection.php b/phpBB/phpbb/di/ordered_service_collection.php new file mode 100644 index 0000000000..046012ae5b --- /dev/null +++ b/phpBB/phpbb/di/ordered_service_collection.php @@ -0,0 +1,117 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\di; + +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * Collection of services in a specified order + */ +class ordered_service_collection extends service_collection +{ + /** + * @var bool + */ + protected $is_ordered; + + /** + * @var array + */ + protected $service_ids; + + /** + * Constructor + * + * @param ContainerInterface $container Container object + */ + public function __construct(ContainerInterface $container) + { + $this->is_ordered = false; + $this->service_ids = array(); + + parent::__construct($container); + } + + /** + * {@inheritdoc} + */ + public function getIterator() + { + if (!$this->is_ordered) + { + $this->sort_services(); + } + + return new service_collection_iterator($this); + } + + /** + * {@inheritdoc} + */ + public function offsetExists($index) + { + if (!$this->is_ordered) + { + $this->sort_services(); + } + + return parent::offsetExists($index); + } + + /** + * {@inheritdoc} + */ + public function offsetGet($index) + { + if (!$this->is_ordered) + { + $this->sort_services(); + } + + return parent::offsetGet($index); + } + + /** + * Adds a service ID to the collection + * + * @param string $service_id + * @param int $order + */ + public function add($service_id, $order = 0) + { + $order = (int) $order; + $this->service_ids[$order][] = $service_id; + $this->is_ordered = false; + } + + protected function sort_services() + { + if ($this->is_ordered) + { + return; + } + + $this->exchangeArray(array()); + ksort($this->service_ids); + foreach ($this->service_ids as $service_order_group) + { + foreach ($service_order_group as $service_id) + { + $this->offsetSet($service_id, null); + } + } + + $this->is_ordered = true; + } +} diff --git a/phpBB/phpbb/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php index 507271de3e..341f88518d 100644 --- a/phpBB/phpbb/di/pass/collection_pass.php +++ b/phpBB/phpbb/di/pass/collection_pass.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -30,10 +34,30 @@ class collection_pass implements CompilerPassInterface foreach ($container->findTaggedServiceIds('service_collection') as $id => $data) { $definition = $container->getDefinition($id); + $is_ordered_collection = (substr($definition->getClass(), -strlen('ordered_service_collection')) === 'ordered_service_collection'); + $is_class_name_aware = (isset($data[0]['class_name_aware']) && $data[0]['class_name_aware']); foreach ($container->findTaggedServiceIds($data[0]['tag']) as $service_id => $service_data) { - $definition->addMethodCall('add', array($service_id)); + if ($is_ordered_collection) + { + $arguments = array($service_id, $service_data[0]['order']); + } + else + { + $arguments = array($service_id); + } + + if ($is_class_name_aware) + { + $service_definition = $container->getDefinition($service_id); + $definition->addMethodCall('add_service_class', array( + $service_id, + $service_definition->getClass() + )); + } + + $definition->addMethodCall('add', $arguments); } } } diff --git a/phpBB/phpbb/di/pass/kernel_pass.php b/phpBB/phpbb/di/pass/kernel_pass.php deleted file mode 100644 index 9c2b193361..0000000000 --- a/phpBB/phpbb/di/pass/kernel_pass.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\di\pass; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -class kernel_pass implements CompilerPassInterface -{ - /** - * Modify the container before it is passed to the rest of the code - * - * @param ContainerBuilder $container ContainerBuilder object - * @return null - */ - public function process(ContainerBuilder $container) - { - $definition = $container->getDefinition('dispatcher'); - - foreach ($container->findTaggedServiceIds('kernel.event_listener') as $id => $events) - { - foreach ($events as $event) - { - $priority = isset($event['priority']) ? $event['priority'] : 0; - - if (!isset($event['event'])) - { - throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); - } - - if (!isset($event['method'])) - { - throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id)); - } - - $definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority)); - } - } - - foreach ($container->findTaggedServiceIds('kernel.event_subscriber') as $id => $attributes) - { - // We must assume that the class value has been correctly filled, even if the service is created by a factory - $class = $container->getDefinition($id)->getClass(); - - $refClass = new \ReflectionClass($class); - $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; - if (!$refClass->implementsInterface($interface)) - { - throw new \InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface)); - } - - $definition->addMethodCall('addSubscriberService', array($id, $class)); - } - } -} diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 65df9ab1d1..8e9175e204 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,12 +17,20 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** * Collection of services to be configured at container compile time. -* -* @package phpBB3 */ class service_collection extends \ArrayObject { /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * @var array + */ + protected $service_classes; + + /** * Constructor * * @param ContainerInterface $container Container object @@ -26,6 +38,38 @@ class service_collection extends \ArrayObject public function __construct(ContainerInterface $container) { $this->container = $container; + $this->service_classes = array(); + } + + /** + * {@inheritdoc} + */ + public function getIterator() + { + return new service_collection_iterator($this); + } + + // Because of a PHP issue we have to redefine offsetExists + // (even with a call to the parent): + // https://bugs.php.net/bug.php?id=66834 + // https://bugs.php.net/bug.php?id=67067 + // But it triggers a sniffer issue that we have to skip + // @codingStandardsIgnoreStart + /** + * {@inheritdoc} + */ + public function offsetExists($index) + { + return parent::offsetExists($index); + } + // @codingStandardsIgnoreEnd + + /** + * {@inheritdoc} + */ + public function offsetGet($index) + { + return $this->container->get($index); } /** @@ -36,8 +80,27 @@ class service_collection extends \ArrayObject */ public function add($name) { - $task = $this->container->get($name); + $this->offsetSet($name, null); + } - $this->offsetSet($name, $task); + /** + * Add a service's class to the collection + * + * @param string $service_id + * @param string $class + */ + public function add_service_class($service_id, $class) + { + $this->service_classes[$service_id] = $class; + } + + /** + * Get services' classes + * + * @return array + */ + public function get_service_classes() + { + return $this->service_classes; } } diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php new file mode 100644 index 0000000000..31bc156e99 --- /dev/null +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -0,0 +1,46 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di; + +/** +* Iterator which loads the services when they are requested +*/ +class service_collection_iterator extends \ArrayIterator +{ + /** + * @var \phpbb\di\service_collection + */ + protected $collection; + + /** + * Construct an ArrayIterator for service_collection + * + * @param \phpbb\di\service_collection $collection The collection to iterate over + * @param int $flags Flags to control the behaviour of the ArrayObject object. + * @see ArrayObject::setFlags() + */ + public function __construct(service_collection $collection, $flags = 0) + { + parent::__construct($collection->getArrayCopy(), $flags); + $this->collection = $collection; + } + + /** + * {@inheritdoc} + */ + public function current() + { + return $this->collection->offsetGet($this->key()); + } +} diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 297972c6b8..bf8efd1065 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,15 +16,28 @@ namespace phpbb; class error_collector { var $errors; + var $error_types; - function __construct() + /** + * Constructor. + * + * The variable $error_types may be set to a mask of PHP error types that + * the collector should keep, e.g. `E_ALL`. If unset, the current value of + * the error_reporting() function will be used to determine which errors + * the collector will keep. + * + * @see PHPBB3-13306 + * @param int|null $error_types + */ + function __construct($error_types = null) { $this->errors = array(); + $this->error_types = $error_types; } function install() { - set_error_handler(array(&$this, 'error_handler')); + set_error_handler(array(&$this, 'error_handler'), ($this->error_types !== null) ? $this->error_types : error_reporting()); } function uninstall() diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php index fbb16574ed..c7365aee35 100644 --- a/phpBB/phpbb/event/data.php +++ b/phpBB/phpbb/event/data.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 74b35eb78d..1c4abeb108 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -1,15 +1,20 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\event; use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; +use Symfony\Component\EventDispatcher\Event; /** * Extension of the Symfony2 EventDispatcher @@ -25,12 +30,49 @@ use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; * extract($phpbb_dispatcher->trigger_event('core.index', compact($vars))); * */ -class dispatcher extends ContainerAwareEventDispatcher +class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_interface { + /** + * @var bool + */ + protected $disabled = false; + + /** + * {@inheritdoc} + */ 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)); } + + /** + * {@inheritdoc} + */ + public function dispatch($eventName, Event $event = null) + { + if ($this->disabled) + { + return $event; + } + + return parent::dispatch($eventName, $event); + } + + /** + * {@inheritdoc} + */ + public function disable() + { + $this->disabled = true; + } + + /** + * {@inheritdoc} + */ + public function enable() + { + $this->disabled = false; + } } diff --git a/phpBB/phpbb/event/dispatcher_interface.php b/phpBB/phpbb/event/dispatcher_interface.php new file mode 100644 index 0000000000..c66aa98260 --- /dev/null +++ b/phpBB/phpbb/event/dispatcher_interface.php @@ -0,0 +1,50 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\event; + +/** +* 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))); +* +*/ +interface dispatcher_interface extends \Symfony\Component\EventDispatcher\EventDispatcherInterface +{ + /** + * Construct and dispatch an event + * + * @param string $eventName The event name + * @param array $data An array containing the variables sending with the event + * @return mixed + */ + public function trigger_event($eventName, $data = array()); + + /** + * Disable the event dispatcher. + */ + public function disable(); + + /** + * Enable the event dispatcher. + */ + public function enable(); +} diff --git a/phpBB/phpbb/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php deleted file mode 100644 index 6408f93e2a..0000000000 --- a/phpBB/phpbb/event/extension_subscriber_loader.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\event; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -class extension_subscriber_loader -{ - private $dispatcher; - private $listener_collection; - - public function __construct(EventDispatcherInterface $dispatcher, \phpbb\di\service_collection $listener_collection) - { - $this->dispatcher = $dispatcher; - $this->listener_collection = $listener_collection; - } - - public function load() - { - if (!empty($this->listener_collection)) - { - foreach ($this->listener_collection as $listener) - { - $this->dispatcher->addSubscriber($listener); - } - } - } -} diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php index 8a4de1fbad..e427abf5e3 100644 --- a/phpBB/phpbb/event/kernel_exception_subscriber.php +++ b/phpBB/phpbb/event/kernel_exception_subscriber.php @@ -1,44 +1,51 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\event; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpFoundation\Response; class kernel_exception_subscriber implements EventSubscriberInterface { /** * Template object + * * @var \phpbb\template\template */ protected $template; /** - * User object - * @var \phpbb\user + * Language object + * + * @var \phpbb\language\language */ - protected $user; + protected $language; /** * Construct method * - * @param \phpbb\template\template $template Template object - * @param \phpbb\user $user User object + * @param \phpbb\template\template $template Template object + * @param \phpbb\language\language $language Language object */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user) + public function __construct(\phpbb\template\template $template, \phpbb\language\language $language) { $this->template = $template; - $this->user = $user; + $this->language = $language; } /** @@ -49,27 +56,59 @@ class kernel_exception_subscriber implements EventSubscriberInterface */ public function on_kernel_exception(GetResponseForExceptionEvent $event) { - page_header($this->user->lang('INFORMATION')); - $exception = $event->getException(); - $this->template->assign_vars(array( - 'MESSAGE_TITLE' => $this->user->lang('INFORMATION'), - 'MESSAGE_TEXT' => $exception->getMessage(), - )); + $message = $exception->getMessage(); + + if ($exception instanceof \phpbb\exception\exception_interface) + { + $message = $this->language->lang_array($message, $exception->get_parameters()); + } + + if (!$event->getRequest()->isXmlHttpRequest()) + { + page_header($this->language->lang('INFORMATION')); + + $this->template->assign_vars(array( + 'MESSAGE_TITLE' => $this->language->lang('INFORMATION'), + 'MESSAGE_TEXT' => $message, + )); + + $this->template->set_filenames(array( + 'body' => 'message_body.html', + )); + + page_footer(true, false, false); + + $response = new Response($this->template->assign_display('body'), 500); + } + else + { + $data = array(); + + if (!empty($message)) + { + $data['message'] = $message; + } + + if (defined('DEBUG')) + { + $data['trace'] = $exception->getTrace(); + } - $this->template->set_filenames(array( - 'body' => 'message_body.html', - )); + $response = new JsonResponse($data, 500); + } - page_footer(true, false, false); + if ($exception instanceof HttpExceptionInterface) + { + $response->setStatusCode($exception->getStatusCode()); + $response->headers->add($exception->getHeaders()); + } - $status_code = $exception instanceof HttpException ? $exception->getStatusCode() : 500; - $response = new Response($this->template->assign_display('body'), $status_code); $event->setResponse($response); } - public static function getSubscribedEvents() + static public function getSubscribedEvents() { return array( KernelEvents::EXCEPTION => 'on_kernel_exception', diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php deleted file mode 100644 index 7d5418498b..0000000000 --- a/phpBB/phpbb/event/kernel_request_subscriber.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\event; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\EventListener\RouterListener; -use Symfony\Component\Routing\RequestContext; - -class kernel_request_subscriber implements EventSubscriberInterface -{ - /** - * Extension finder object - * @var \phpbb\extension\finder - */ - protected $finder; - - /** - * PHP extension - * @var string - */ - protected $php_ext; - - /** - * Root path - * @var string - */ - protected $root_path; - - /** - * Construct method - * - * @param \phpbb\extension\finder $finder Extension finder object - * @param string $root_path Root path - * @param string $php_ext PHP extension - */ - public function __construct(\phpbb\extension\finder $finder, $root_path, $php_ext) - { - $this->finder = $finder; - $this->root_path = $root_path; - $this->php_ext = $php_ext; - } - - /** - * This listener is run when the KernelEvents::REQUEST event is triggered - * - * This is responsible for setting up the routing information - * - * @param GetResponseEvent $event - * @return null - */ - public function on_kernel_request(GetResponseEvent $event) - { - $request = $event->getRequest(); - $context = new RequestContext(); - $context->fromRequest($request); - - $matcher = phpbb_get_url_matcher($this->finder, $context, $this->root_path, $this->php_ext); - $router_listener = new RouterListener($matcher, $context); - $router_listener->onKernelRequest($event); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => 'on_kernel_request', - ); - } -} diff --git a/phpBB/phpbb/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php index 32dba322d1..f0d0a2f595 100644 --- a/phpBB/phpbb/event/kernel_terminate_subscriber.php +++ b/phpBB/phpbb/event/kernel_terminate_subscriber.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -28,10 +32,10 @@ class kernel_terminate_subscriber implements EventSubscriberInterface exit_handler(); } - public static function getSubscribedEvents() + static public function getSubscribedEvents() { return array( - KernelEvents::TERMINATE => 'on_kernel_terminate', + KernelEvents::TERMINATE => array('on_kernel_terminate', ~PHP_INT_MAX), ); } } diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php new file mode 100644 index 0000000000..e042d0a5d1 --- /dev/null +++ b/phpBB/phpbb/event/md_exporter.php @@ -0,0 +1,560 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\event; + +/** +* Crawls through a markdown file and grabs all events +*/ +class md_exporter +{ + /** @var string Path where we look for files*/ + protected $path; + + /** @var string phpBB Root Path */ + protected $root_path; + + /** @var string The minimum version for the events to return */ + protected $min_version; + + /** @var string The maximum version for the events to return */ + protected $max_version; + + /** @var string */ + protected $filter; + + /** @var string */ + protected $current_event; + + /** @var array */ + protected $events; + + /** + * @param string $phpbb_root_path + * @param mixed $extension String 'vendor/ext' to filter, null for phpBB core + * @param string $min_version + * @param string $max_version + */ + public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null) + { + $this->root_path = $phpbb_root_path; + $this->path = $this->root_path; + if ($extension) + { + $this->path .= 'ext/' . $extension . '/'; + } + + $this->events = array(); + $this->events_by_file = array(); + $this->filter = $this->current_event = ''; + $this->min_version = $min_version; + $this->max_version = $max_version; + } + + /** + * Get the list of all events + * + * @return array Array with events: name => details + */ + public function get_events() + { + return $this->events; + } + + /** + * @param string $md_file Relative from phpBB root + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_phpbb_directory_adm($md_file) + { + $this->crawl_eventsmd($md_file, 'adm'); + + $file_list = $this->get_recursive_file_list($this->path . 'adm/style/'); + foreach ($file_list as $file) + { + $file_name = 'adm/style/' . $file; + $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); + } + + return sizeof($this->events); + } + + /** + * @param string $md_file Relative from phpBB root + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_phpbb_directory_styles($md_file) + { + $this->crawl_eventsmd($md_file, 'styles'); + + $styles = array('prosilver'); + foreach ($styles as $style) + { + $file_list = $this->get_recursive_file_list( + $this->path . 'styles/' . $style . '/template/' + ); + + foreach ($file_list as $file) + { + $file_name = 'styles/' . $style . '/template/' . $file; + $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); + } + } + + return sizeof($this->events); + } + + /** + * @param string $md_file Relative from phpBB root + * @param string $filter Should be 'styles' or 'adm' + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_eventsmd($md_file, $filter) + { + if (!file_exists($this->path . $md_file)) + { + throw new \LogicException("The event docs file '{$md_file}' could not be found"); + } + + $file_content = file_get_contents($this->path . $md_file); + $this->filter = $filter; + + $events = explode("\n\n", $file_content); + foreach ($events as $event) + { + // Last row of the file + if (strpos($event, "\n===\n") === false) + { + continue; + } + + list($event_name, $details) = explode("\n===\n", $event, 2); + $this->validate_event_name($event_name); + $this->current_event = $event_name; + + if (isset($this->events[$this->current_event])) + { + throw new \LogicException("The event '{$this->current_event}' is defined multiple times"); + } + + if (($this->filter == 'adm' && strpos($this->current_event, 'acp_') !== 0) + || ($this->filter == 'styles' && strpos($this->current_event, 'acp_') === 0)) + { + continue; + } + + list($file_details, $details) = explode("\n* Since: ", $details, 2); + + $changed_versions = array(); + if (strpos($details, "\n* Changed: ") !== false) + { + list($since, $details) = explode("\n* Changed: ", $details, 2); + while (strpos($details, "\n* Changed: ") !== false) + { + list($changed, $details) = explode("\n* Changed: ", $details, 2); + $changed_versions[] = $changed; + } + list($changed, $description) = explode("\n* Purpose: ", $details, 2); + $changed_versions[] = $changed; + } + else + { + list($since, $description) = explode("\n* Purpose: ", $details, 2); + $changed_versions = array(); + } + + $files = $this->validate_file_list($file_details); + $since = $this->validate_since($since); + $changes = array(); + foreach ($changed_versions as $changed) + { + list($changed_version, $changed_description) = $this->validate_changed($changed); + + if (isset($changes[$changed_version])) + { + throw new \LogicException("Duplicate change information found for event '{$this->current_event}'"); + } + + $changes[$changed_version] = $changed_description; + } + $description = trim($description, "\n") . "\n"; + + if (!$this->version_is_filtered($since)) + { + $is_filtered = false; + foreach ($changes as $version => $null) + { + if ($this->version_is_filtered($version)) + { + $is_filtered = true; + break; + } + } + + if (!$is_filtered) + { + continue; + } + } + + $this->events[$event_name] = array( + 'event' => $this->current_event, + 'files' => $files, + 'since' => $since, + 'changed' => $changes, + 'description' => $description, + ); + } + + return sizeof($this->events); + } + + /** + * The version to check + * + * @param string $version + * @return bool + */ + protected function version_is_filtered($version) + { + return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<=')) + && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>=')); + } + + /** + * Format the php events as a wiki table + * + * @param string $action + * @return string Number of events found + */ + public function export_events_for_wiki($action = '') + { + if ($this->filter === 'adm') + { + if ($action === 'diff') + { + $wiki_page = '=== ACP Template Events ===' . "\n"; + } + else + { + $wiki_page = '= ACP Template Events =' . "\n"; + } + $wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; + $wiki_page .= '! Identifier !! Placement !! Added in Release !! Explanation' . "\n"; + } + else + { + if ($action === 'diff') + { + $wiki_page = '=== Template Events ===' . "\n"; + } + else + { + $wiki_page = '= Template Events =' . "\n"; + } + $wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; + $wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Added in Release !! Explanation' . "\n"; + } + + foreach ($this->events as $event_name => $event) + { + $wiki_page .= "|- id=\"{$event_name}\"\n"; + $wiki_page .= "| [[#{$event_name}|{$event_name}]] || "; + + if ($this->filter === 'adm') + { + $wiki_page .= implode(', ', $event['files']['adm']); + } + else + { + $wiki_page .= implode(', ', $event['files']['prosilver']); + } + + $wiki_page .= " || {$event['since']} || " . str_replace("\n", ' ', $event['description']) . "\n"; + } + $wiki_page .= '|}' . "\n"; + + return $wiki_page; + } + + /** + * Validates a template event name + * + * @param $event_name + * @return null + * @throws \LogicException + */ + public function validate_event_name($event_name) + { + if (!preg_match('#^([a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)+)$#', $event_name)) + { + throw new \LogicException("Invalid event name '{$event_name}'"); + } + } + + /** + * Validate "Since" Information + * + * @param string $since + * @return string + * @throws \LogicException + */ + public function validate_since($since) + { + if (!$this->validate_version($since)) + { + throw new \LogicException("Invalid since information found for event '{$this->current_event}'"); + } + + return $since; + } + + /** + * Validate "Changed" Information + * + * @param string $changed + * @return string + * @throws \LogicException + */ + public function validate_changed($changed) + { + if (strpos($changed, ' ') !== false) + { + list($version, $description) = explode(' ', $changed, 2); + } + else + { + $version = $changed; + $description = ''; + } + + if (!$this->validate_version($version)) + { + throw new \LogicException("Invalid changed information found for event '{$this->current_event}'"); + } + + return array($version, $description); + } + + /** + * Validate "version" Information + * + * @param string $version + * @return bool True if valid, false otherwise + */ + public function validate_version($version) + { + return preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version); + } + + /** + * Validate the files list + * + * @param string $file_details + * @return array + * @throws \LogicException + */ + public function validate_file_list($file_details) + { + $files_list = array( + 'prosilver' => array(), + 'adm' => array(), + ); + + // Multi file list + if (strpos($file_details, "* Locations:\n + ") === 0) + { + $file_details = substr($file_details, strlen("* Locations:\n + ")); + $files = explode("\n + ", $file_details); + foreach ($files as $file) + { + if (!file_exists($this->path . $file) || substr($file, -5) !== '.html') + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1); + } + + if (($this->filter !== 'adm') && strpos($file, 'styles/prosilver/template/') === 0) + { + $files_list['prosilver'][] = substr($file, strlen('styles/prosilver/template/')); + } + else if (($this->filter === 'adm') && strpos($file, 'adm/style/') === 0) + { + $files_list['adm'][] = substr($file, strlen('adm/style/')); + } + else + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 2); + } + + $this->events_by_file[$file][] = $this->current_event; + } + } + else if ($this->filter == 'adm') + { + $file = substr($file_details, strlen('* Location: ')); + if (!file_exists($this->path . $file) || substr($file, -5) !== '.html') + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1); + } + + $files_list['adm'][] = substr($file, strlen('adm/style/')); + + $this->events_by_file[$file][] = $this->current_event; + } + else + { + throw new \LogicException("Invalid file list found for event '{$this->current_event}'", 2); + } + + return $files_list; + } + + /** + * Get all template events in a template file + * + * @param string $file + * @return array + * @throws \LogicException + */ + public function crawl_file_for_events($file) + { + if (!file_exists($this->path . $file)) + { + throw new \LogicException("File '{$file}' does not exist", 1); + } + + $event_list = array(); + $file_content = file_get_contents($this->path . $file); + + $events = explode('<!-- EVENT ', $file_content); + // Remove the code before the first event + array_shift($events); + foreach ($events as $event) + { + $event = explode(' -->', $event, 2); + $event_list[] = array_shift($event); + } + + return $event_list; + } + + /** + * Validates whether all events from $file are in the md file and vice-versa + * + * @param string $file + * @param array $events + * @return true + * @throws \LogicException + */ + public function validate_events_from_file($file, array $events) + { + if (empty($this->events_by_file[$file]) && empty($events)) + { + return true; + } + else if (empty($this->events_by_file[$file])) + { + $event_list = implode("', '", $events); + throw new \LogicException("File '{$file}' should not contain events, but contains: " + . "'{$event_list}'", 1); + } + else if (empty($events)) + { + $event_list = implode("', '", $this->events_by_file[$file]); + throw new \LogicException("File '{$file}' contains no events, but should contain: " + . "'{$event_list}'", 1); + } + + $missing_events_from_file = array(); + foreach ($this->events_by_file[$file] as $event) + { + if (!in_array($event, $events)) + { + $missing_events_from_file[] = $event; + } + } + + if (!empty($missing_events_from_file)) + { + $event_list = implode("', '", $missing_events_from_file); + throw new \LogicException("File '{$file}' does not contain events: '{$event_list}'", 2); + } + + $missing_events_from_md = array(); + foreach ($events as $event) + { + if (!in_array($event, $this->events_by_file[$file])) + { + $missing_events_from_md[] = $event; + } + } + + if (!empty($missing_events_from_md)) + { + $event_list = implode("', '", $missing_events_from_md); + throw new \LogicException("File '{$file}' contains additional events: '{$event_list}'", 3); + } + + return true; + } + + /** + * Returns a list of files in $dir + * + * Works recursive with any depth + * + * @param string $dir Directory to go through + * @return array List of files (including directories) + */ + public function get_recursive_file_list($dir) + { + try + { + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $dir, + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + } + catch (\Exception $e) + { + return array(); + } + + $files = array(); + foreach ($iterator as $file_info) + { + /** @var \RecursiveDirectoryIterator $file_info */ + if ($file_info->isDir()) + { + continue; + } + + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + + if (substr($relative_path, -5) == '.html') + { + $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path); + } + } + + return $files; + } +} diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php new file mode 100644 index 0000000000..d2ab0595c0 --- /dev/null +++ b/phpBB/phpbb/event/php_exporter.php @@ -0,0 +1,718 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\event; + +/** +* Class php_exporter +* Crawls through a list of files and grabs all php-events +*/ +class php_exporter +{ + /** @var string Path where we look for files*/ + protected $path; + + /** @var string phpBB Root Path */ + protected $root_path; + + /** @var string The minimum version for the events to return */ + protected $min_version; + + /** @var string The maximum version for the events to return */ + protected $max_version; + + /** @var string */ + protected $current_file; + + /** @var string */ + protected $current_event; + + /** @var int */ + protected $current_event_line; + + /** @var array */ + protected $events; + + /** @var array */ + protected $file_lines; + + /** + * @param string $phpbb_root_path + * @param mixed $extension String 'vendor/ext' to filter, null for phpBB core + * @param string $min_version + * @param string $max_version + */ + public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null) + { + $this->root_path = $phpbb_root_path; + $this->path = $phpbb_root_path; + $this->events = $this->file_lines = array(); + $this->current_file = $this->current_event = ''; + $this->current_event_line = 0; + $this->min_version = $min_version; + $this->max_version = $max_version; + + $this->path = $this->root_path; + if ($extension) + { + $this->path .= 'ext/' . $extension . '/'; + } + } + + /** + * Get the list of all events + * + * @return array Array with events: name => details + */ + public function get_events() + { + return $this->events; + } + + /** + * Set current event data + * + * @param string $name Name of the current event (used for error messages) + * @param int $line Line where the current event is placed in + * @return null + */ + public function set_current_event($name, $line) + { + $this->current_event = $name; + $this->current_event_line = $line; + } + + /** + * Set the content of this file + * + * @param array $content Array with the lines of the file + * @return null + */ + public function set_content($content) + { + $this->file_lines = $content; + } + + /** + * Crawl the phpBB/ directory for php events + * @return int The number of events found + */ + public function crawl_phpbb_directory_php() + { + $files = $this->get_recursive_file_list(); + $this->events = array(); + foreach ($files as $file) + { + $this->crawl_php_file($file); + } + ksort($this->events); + + return sizeof($this->events); + } + + /** + * Returns a list of files in $dir + * + * @return array List of files (including the path) + */ + public function get_recursive_file_list() + { + try + { + $iterator = new \RecursiveIteratorIterator( + new \phpbb\event\recursive_event_filter_iterator( + new \RecursiveDirectoryIterator( + $this->path, + \FilesystemIterator::SKIP_DOTS + ), + $this->path + ), + \RecursiveIteratorIterator::LEAVES_ONLY + ); + } + catch (\Exception $e) + { + return array(); + } + + $files = array(); + foreach ($iterator as $file_info) + { + /** @var \RecursiveDirectoryIterator $file_info */ + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path); + } + + return $files; + } + + /** + * Format the php events as a wiki table + * + * @param string $action + * @return string + */ + public function export_events_for_wiki($action = '') + { + if ($action === 'diff') + { + $wiki_page = '=== PHP Events (Hook Locations) ===' . "\n"; + } + else + { + $wiki_page = '= PHP Events (Hook Locations) =' . "\n"; + } + $wiki_page .= '{| class="sortable zebra" cellspacing="0" cellpadding="5"' . "\n"; + $wiki_page .= '! Identifier !! Placement !! Arguments !! Added in Release !! Explanation' . "\n"; + foreach ($this->events as $event) + { + $wiki_page .= '|- id="' . $event['event'] . '"' . "\n"; + $wiki_page .= '| [[#' . $event['event'] . '|' . $event['event'] . ']] || ' . $event['file'] . ' || ' . implode(', ', $event['arguments']) . ' || ' . $event['since'] . ' || ' . $event['description'] . "\n"; + } + $wiki_page .= '|}' . "\n"; + + return $wiki_page; + } + + /** + * @param string $file + * @return int Number of events found in this file + * @throws \LogicException + */ + public function crawl_php_file($file) + { + $this->current_file = $file; + $this->file_lines = array(); + $content = file_get_contents($this->path . $this->current_file); + $num_events_found = 0; + + if (strpos($content, "dispatcher->trigger_event('") || strpos($content, "dispatcher->dispatch('")) + { + $this->set_content(explode("\n", $content)); + for ($i = 0, $num_lines = sizeof($this->file_lines); $i < $num_lines; $i++) + { + $event_line = false; + $found_trigger_event = strpos($this->file_lines[$i], "dispatcher->trigger_event('"); + $arguments = array(); + if ($found_trigger_event !== false) + { + $event_line = $i; + $this->set_current_event($this->get_event_name($event_line, false), $event_line); + + // Find variables of the event + $arguments = $this->get_vars_from_array(); + $doc_vars = $this->get_vars_from_docblock(); + $this->validate_vars_docblock_array($arguments, $doc_vars); + } + else + { + $found_dispatch = strpos($this->file_lines[$i], "dispatcher->dispatch('"); + if ($found_dispatch !== false) + { + $event_line = $i; + $this->set_current_event($this->get_event_name($event_line, true), $event_line); + } + } + + if ($event_line) + { + // Validate @event + $event_line_num = $this->find_event(); + $this->validate_event($this->current_event, $this->file_lines[$event_line_num]); + + // Validate @since + $since_line_num = $this->find_since(); + $since = $this->validate_since($this->file_lines[$since_line_num]); + + $changed_line_nums = $this->find_changed('changed'); + if (empty($changed_line_nums)) + { + $changed_line_nums = $this->find_changed('change'); + } + $changed_versions = array(); + if (!empty($changed_line_nums)) + { + foreach ($changed_line_nums as $changed_line_num) + { + $changed_versions[] = $this->validate_changed($this->file_lines[$changed_line_num]); + } + } + + if (!$this->version_is_filtered($since)) + { + $valid_version = false; + foreach ($changed_versions as $changed) + { + $valid_version = $valid_version || $this->version_is_filtered($changed); + } + + if (!$valid_version) + { + continue; + } + } + + // Find event description line + $description_line_num = $this->find_description(); + $description = substr(trim($this->file_lines[$description_line_num]), strlen('* ')); + + if (isset($this->events[$this->current_event])) + { + throw new \LogicException("The event '{$this->current_event}' from file " + . "'{$this->current_file}:{$event_line_num}' already exists in file " + . "'{$this->events[$this->current_event]['file']}'", 10); + } + + sort($arguments); + $this->events[$this->current_event] = array( + 'event' => $this->current_event, + 'file' => $this->current_file, + 'arguments' => $arguments, + 'since' => $since, + 'description' => $description, + ); + $num_events_found++; + } + } + } + + return $num_events_found; + } + + /** + * The version to check + * + * @param string $version + * @return bool + */ + protected function version_is_filtered($version) + { + return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<=')) + && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>=')); + } + + /** + * Find the name of the event inside the dispatch() line + * + * @param int $event_line + * @param bool $is_dispatch Do we look for dispatch() or trigger_event() ? + * @return string Name of the event + * @throws \LogicException + */ + public function get_event_name($event_line, $is_dispatch) + { + $event_text_line = $this->file_lines[$event_line]; + $event_text_line = ltrim($event_text_line, "\t "); + + if ($is_dispatch) + { + $regex = '#\$([a-z](?:[a-z0-9_]|->)*)'; + $regex .= '->dispatch\('; + $regex .= '\'' . $this->preg_match_event_name() . '\''; + $regex .= '\);#'; + } + else + { + $regex = '#extract\(\$([a-z](?:[a-z0-9_]|->)*)'; + $regex .= '->trigger_event\('; + $regex .= '\'' . $this->preg_match_event_name() . '\''; + $regex .= ', compact\(\$vars\)\)\);#'; + } + + $match = array(); + preg_match($regex, $event_text_line, $match); + if (!isset($match[2])) + { + throw new \LogicException("Can not find event name in line '{$event_text_line}' " + . "in file '{$this->current_file}:{$event_line}'", 1); + } + + return $match[2]; + } + + /** + * Returns a regex match for the event name + * + * @return string + */ + protected function preg_match_event_name() + { + return '([a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+)'; + } + + /** + * Find the $vars array + * + * @return array List of variables + * @throws \LogicException + */ + public function get_vars_from_array() + { + $line = ltrim($this->file_lines[$this->current_event_line - 1], "\t"); + if ($line === ');') + { + $vars_array = $this->get_vars_from_multi_line_array(); + } + else + { + $vars_array = $this->get_vars_from_single_line_array($line); + } + + foreach ($vars_array as $var) + { + if (!preg_match('#^([a-zA-Z_][a-zA-Z0-9_]*)$#', $var)) + { + throw new \LogicException("Found invalid var '{$var}' in array for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 3); + } + } + + sort($vars_array); + return $vars_array; + } + + /** + * Find the variables in single line array + * + * @param string $line + * @param bool $throw_multiline Throw an exception when there are too + * many arguments in one line. + * @return array List of variables + * @throws \LogicException + */ + public function get_vars_from_single_line_array($line, $throw_multiline = true) + { + $match = array(); + preg_match('#^\$vars = array\(\'([a-zA-Z0-9_\' ,]+)\'\);$#', $line, $match); + + if (isset($match[1])) + { + $vars_array = explode("', '", $match[1]); + if ($throw_multiline && sizeof($vars_array) > 6) + { + throw new \LogicException('Should use multiple lines for $vars definition ' + . "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); + } + return $vars_array; + } + else + { + throw new \LogicException("Can not find '\$vars = array();'-line for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1); + } + } + + /** + * Find the variables in single line array + * + * @return array List of variables + * @throws \LogicException + */ + public function get_vars_from_multi_line_array() + { + $current_vars_line = 2; + $var_lines = array(); + while (ltrim($this->file_lines[$this->current_event_line - $current_vars_line], "\t") !== '$vars = array(') + { + $var_lines[] = substr(trim($this->file_lines[$this->current_event_line - $current_vars_line]), 0, -1); + + $current_vars_line++; + if ($current_vars_line > $this->current_event_line) + { + // Reached the start of the file + throw new \LogicException("Can not find end of \$vars array for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); + } + } + + return $this->get_vars_from_single_line_array('$vars = array(' . implode(", ", $var_lines) . ');', false); + } + + /** + * Find the $vars array + * + * @return array List of variables + * @throws \LogicException + */ + public function get_vars_from_docblock() + { + $doc_vars = array(); + $current_doc_line = 1; + $found_comment_end = false; + while (ltrim($this->file_lines[$this->current_event_line - $current_doc_line], "\t") !== '/**') + { + if (ltrim($this->file_lines[$this->current_event_line - $current_doc_line], "\t ") === '*/') + { + $found_comment_end = true; + } + + if ($found_comment_end) + { + $var_line = trim($this->file_lines[$this->current_event_line - $current_doc_line]); + $var_line = preg_replace('!\s+!', ' ', $var_line); + if (strpos($var_line, '* @var ') === 0) + { + $doc_line = explode(' ', $var_line, 5); + if (sizeof($doc_line) !== 5) + { + throw new \LogicException("Found invalid line '{$this->file_lines[$this->current_event_line - $current_doc_line]}' " + . "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1); + } + $doc_vars[] = $doc_line[3]; + } + } + + $current_doc_line++; + if ($current_doc_line > $this->current_event_line) + { + // Reached the start of the file + throw new \LogicException("Can not find end of docblock for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); + } + } + + if (empty($doc_vars)) + { + // Reached the start of the file + throw new \LogicException("Can not find @var lines for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 3); + } + + foreach ($doc_vars as $var) + { + if (!preg_match('#^([a-zA-Z_][a-zA-Z0-9_]*)$#', $var)) + { + throw new \LogicException("Found invalid @var '{$var}' in docblock for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 4); + } + } + + sort($doc_vars); + return $doc_vars; + } + + /** + * Find the "@since" Information line + * + * @return int Absolute line number + * @throws \LogicException + */ + public function find_since() + { + return $this->find_tag('since', array('event', 'var')); + } + + /** + * Find the "@changed" Information lines + * + * @param string $tag_name Should be 'changed' or 'change' + * @return array Absolute line numbers + * @throws \LogicException + */ + public function find_changed($tag_name) + { + $lines = array(); + $last_line = 0; + try + { + while ($line = $this->find_tag($tag_name, array('since'), $last_line)) + { + $lines[] = $line; + $last_line = $line; + } + } + catch (\LogicException $e) + { + // Not changed? No problem! + } + + return $lines; + } + + /** + * Find the "@event" Information line + * + * @return int Absolute line number + */ + public function find_event() + { + return $this->find_tag('event', array()); + } + + /** + * Find a "@*" Information line + * + * @param string $find_tag Name of the tag we are trying to find + * @param array $disallowed_tags List of tags that must not appear between + * the tag and the actual event + * @param int $skip_to_line Skip lines until this one + * @return int Absolute line number + * @throws \LogicException + */ + public function find_tag($find_tag, $disallowed_tags, $skip_to_line = 0) + { + $find_tag_line = $skip_to_line ? $this->current_event_line - $skip_to_line + 1 : 0; + $found_comment_end = ($skip_to_line) ? true : false; + while (strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t "), '* @' . $find_tag . ' ') !== 0) + { + if ($found_comment_end && ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t") === '/**') + { + // Reached the start of this doc block + throw new \LogicException("Can not find '@{$find_tag}' information for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1); + } + + foreach ($disallowed_tags as $disallowed_tag) + { + if ($found_comment_end && strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t "), '* @' . $disallowed_tag) === 0) + { + // Found @var after the @since + throw new \LogicException("Found '@{$disallowed_tag}' information after '@{$find_tag}' for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 3); + } + } + + if (ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t ") === '*/') + { + $found_comment_end = true; + } + + $find_tag_line++; + if ($find_tag_line >= $this->current_event_line) + { + // Reached the start of the file + throw new \LogicException("Can not find '@{$find_tag}' information for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); + } + } + + return $this->current_event_line - $find_tag_line; + } + + /** + * Find a "@*" Information line + * + * @return int Absolute line number + * @throws \LogicException + */ + public function find_description() + { + $find_desc_line = 0; + while (ltrim($this->file_lines[$this->current_event_line - $find_desc_line], "\t") !== '/**') + { + $find_desc_line++; + if ($find_desc_line > $this->current_event_line) + { + // Reached the start of the file + throw new \LogicException("Can not find a description for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1); + } + } + + $find_desc_line = $this->current_event_line - $find_desc_line + 1; + + $desc = trim($this->file_lines[$find_desc_line]); + if (strpos($desc, '* @') === 0 || $desc[0] !== '*' || substr($desc, 1) == '') + { + // First line of the doc block is a @-line, empty or only contains "*" + throw new \LogicException("Can not find a description for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); + } + + return $find_desc_line; + } + + /** + * Validate "@since" Information + * + * @param string $line + * @return string + * @throws \LogicException + */ + public function validate_since($line) + { + $match = array(); + preg_match('#^\* @since (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)$#', ltrim($line, "\t "), $match); + if (!isset($match[1])) + { + throw new \LogicException("Invalid '@since' information for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'"); + } + + return $match[1]; + } + + /** + * Validate "@changed" Information + * + * @param string $line + * @return string + * @throws \LogicException + */ + public function validate_changed($line) + { + $match = array(); + $line = str_replace("\t", ' ', ltrim($line, "\t ")); + preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match); + if (!isset($match[2])) + { + throw new \LogicException("Invalid '@changed' information for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'"); + } + + return $match[2]; + } + + /** + * Validate "@event" Information + * + * @param string $event_name + * @param string $line + * @return string + * @throws \LogicException + */ + public function validate_event($event_name, $line) + { + $event = substr(ltrim($line, "\t "), strlen('* @event ')); + + if ($event !== trim($event)) + { + throw new \LogicException("Invalid '@event' information for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1); + } + + if ($event !== $event_name) + { + throw new \LogicException("Event name does not match '@event' tag for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); + } + + return $event; + } + + /** + * Validates that two arrays contain the same strings + * + * @param array $vars_array Variables found in the array line + * @param array $vars_docblock Variables found in the doc block + * @return null + * @throws \LogicException + */ + public function validate_vars_docblock_array($vars_array, $vars_docblock) + { + $vars_array = array_unique($vars_array); + $vars_docblock = array_unique($vars_docblock); + $sizeof_vars_array = sizeof($vars_array); + + if ($sizeof_vars_array !== sizeof($vars_docblock) || $sizeof_vars_array !== sizeof(array_intersect($vars_array, $vars_docblock))) + { + throw new \LogicException("\$vars array does not match the list of '@var' tags for event " + . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'"); + } + } +} diff --git a/phpBB/phpbb/event/recursive_event_filter_iterator.php b/phpBB/phpbb/event/recursive_event_filter_iterator.php new file mode 100644 index 0000000000..64e2e56f6a --- /dev/null +++ b/phpBB/phpbb/event/recursive_event_filter_iterator.php @@ -0,0 +1,71 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\event; + +/** +* This filter ignores directories and files starting with a dot. +* It also skips some directories that do not contain events anyway, +* such as e.g. files/, store/ and vendor/ +*/ +class recursive_event_filter_iterator extends \RecursiveFilterIterator +{ + protected $root_path; + + /** + * Construct + * + * @param \RecursiveIterator $iterator + * @param string $root_path + */ + public function __construct(\RecursiveIterator $iterator, $root_path) + { + $this->root_path = str_replace(DIRECTORY_SEPARATOR, '/', $root_path); + parent::__construct($iterator); + } + + /** + * Return the inner iterator's children contained in a recursive_event_filter_iterator + * + * @return recursive_event_filter_iterator + */ + public function getChildren() + { + return new self($this->getInnerIterator()->getChildren(), $this->root_path); + } + + /** + * {@inheritDoc} + */ + public function accept() + { + $relative_path = str_replace(DIRECTORY_SEPARATOR, '/', $this->current()); + $filename = $this->current()->getFilename(); + + return (substr($relative_path, -4) === '.php' || $this->current()->isDir()) + && $filename[0] !== '.' + && strpos($relative_path, $this->root_path . 'cache/') !== 0 + && strpos($relative_path, $this->root_path . 'develop/') !== 0 + && strpos($relative_path, $this->root_path . 'docs/') !== 0 + && strpos($relative_path, $this->root_path . 'ext/') !== 0 + && strpos($relative_path, $this->root_path . 'files/') !== 0 + && strpos($relative_path, $this->root_path . 'includes/utf/') !== 0 + && strpos($relative_path, $this->root_path . 'language/') !== 0 + && strpos($relative_path, $this->root_path . 'phpbb/db/migration/data/') !== 0 + && strpos($relative_path, $this->root_path . 'phpbb/event/') !== 0 + && strpos($relative_path, $this->root_path . 'store/') !== 0 + && strpos($relative_path, $this->root_path . 'tests/') !== 0 + && strpos($relative_path, $this->root_path . 'vendor/') !== 0 + ; + } +} diff --git a/phpBB/phpbb/exception/exception_interface.php b/phpBB/phpbb/exception/exception_interface.php new file mode 100644 index 0000000000..e8526a35f5 --- /dev/null +++ b/phpBB/phpbb/exception/exception_interface.php @@ -0,0 +1,29 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\exception; + +/** + * Interface exception_interface + * + * Define an exception which support a language var as message. + */ +interface exception_interface +{ + /** + * Return the arguments associated with the message if it's a language var. + * + * @return array + */ + public function get_parameters(); +} diff --git a/phpBB/phpbb/exception/http_exception.php b/phpBB/phpbb/exception/http_exception.php new file mode 100644 index 0000000000..0e6ffe4f59 --- /dev/null +++ b/phpBB/phpbb/exception/http_exception.php @@ -0,0 +1,70 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\exception; + +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; + +/** + * Class http_exception + */ +class http_exception extends runtime_exception implements HttpExceptionInterface +{ + /** + * Http status code. + * + * @var integer + */ + private $status_code; + + /** + * Additional headers to set in the response. + * + * @var array + */ + private $headers; + + /** + * Constructor + * + * @param integer $status_code The http status code. + * @param string $message The Exception message to throw (must be a language variable). + * @param array $parameters The parameters to use with the language var. + * @param \Exception $previous The previous exception used for the exception chaining. + * @param array $headers Additional headers to set in the response. + * @param integer $code The Exception code. + */ + public function __construct($status_code, $message = "", array $parameters = array(), \Exception $previous = null, array $headers = array(), $code = 0) + { + $this->status_code = $status_code; + $this->headers = $headers; + + parent::__construct($message, $parameters, $previous, $code); + } + + /** + * {@inheritdoc} + */ + public function getStatusCode() + { + return $this->status_code; + } + + /** + * {@inheritdoc} + */ + public function getHeaders() + { + return $this->headers; + } +} diff --git a/phpBB/phpbb/exception/runtime_exception.php b/phpBB/phpbb/exception/runtime_exception.php new file mode 100644 index 0000000000..6568bbf86f --- /dev/null +++ b/phpBB/phpbb/exception/runtime_exception.php @@ -0,0 +1,52 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\exception; + +/** + * Class runtime_exception + * + * Define an exception which support a language var as message. + */ +class runtime_exception extends \RuntimeException implements exception_interface +{ + /** + * Parameters to use with the language var. + * + * @var array + */ + private $parameters; + + /** + * Constructor + * + * @param string $message The Exception message to throw (must be a language variable). + * @param array $parameters The parameters to use with the language var. + * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining. + * @param integer $code The Exception code. + */ + public function __construct($message = "", array $parameters = array(), \Exception $previous = null, $code = 0) + { + $this->parameters = $parameters; + + parent::__construct($message, $code, $previous); + } + + /** + * {@inheritdoc} + */ + public function get_parameters() + { + return $this->parameters; + } +} diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index 1f871750e0..5bb530bad4 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,15 +17,13 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** * A base class for extensions without custom enable/disable/purge code. -* -* @package extension */ class base implements \phpbb\extension\extension_interface { /** @var ContainerInterface */ protected $container; - /** @var \phpbb\extension\finder */ + /** @var \phpbb\finder */ protected $finder; /** @var \phpbb\db\migrator */ @@ -33,15 +35,19 @@ class base implements \phpbb\extension\extension_interface /** @var string */ protected $extension_path; + /** @var string[] */ + private $migrations = false; + /** * Constructor * * @param ContainerInterface $container Container object - * @param \phpbb\extension\finder $extension_finder + * @param \phpbb\finder $extension_finder + * @param \phpbb\db\migrator $migrator * @param string $extension_name Name of this extension (from ext.manager) * @param string $extension_path Relative path to this extension */ - public function __construct(ContainerInterface $container, \phpbb\extension\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path) + public function __construct(ContainerInterface $container, \phpbb\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path) { $this->container = $container; $this->extension_finder = $extension_finder; @@ -52,6 +58,14 @@ class base implements \phpbb\extension\extension_interface } /** + * {@inheritdoc} + */ + public function is_enableable() + { + return true; + } + + /** * Single enable step that installs any included migrations * * @param mixed $old_state State returned by previous call of this method @@ -111,17 +125,16 @@ class base implements \phpbb\extension\extension_interface */ protected function get_migration_file_list() { - static $migrations = false; - - if ($migrations !== false) + if ($this->migrations !== false) { - return $migrations; + return $this->migrations; } // Only have the finder search in this extension path directory $migrations = $this->extension_finder ->extension_directory('/migrations') ->find_from_extension($this->extension_name, $this->extension_path); + $migrations = $this->extension_finder->get_classes_from_files($migrations); return $migrations; diff --git a/phpBB/phpbb/extension/di/extension_base.php b/phpBB/phpbb/extension/di/extension_base.php new file mode 100644 index 0000000000..ba74615e70 --- /dev/null +++ b/phpBB/phpbb/extension/di/extension_base.php @@ -0,0 +1,138 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\extension\di; + +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; + +/** + * Container core extension + */ +class extension_base extends Extension +{ + /** + * Name of the extension (vendor/name) + * + * @var string + */ + protected $extension_name; + + /** + * Path to the extension. + * + * @var string + */ + protected $ext_path; + + /** + * Constructor + * + * @param string $extension_name Name of the extension (vendor/name) + * @param string $ext_path Path to the extension + */ + public function __construct($extension_name, $ext_path) + { + $this->extension_name = $extension_name; + $this->ext_path = $ext_path; + } + + /** + * Loads a specific configuration. + * + * @param array $configs An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws \InvalidArgumentException When provided tag is not defined in this extension + */ + public function load(array $configs, ContainerBuilder $container) + { + $this->load_services($container); + } + + /** + * Loads the services.yml file. + * + * @param ContainerBuilder $container A ContainerBuilder instance + */ + protected function load_services(ContainerBuilder $container) + { + $services_directory = false; + $services_file = false; + + if (file_exists($this->ext_path . 'config/' . $container->getParameter('core.environment') . '/container/environment.yml')) + { + $services_directory = $this->ext_path . 'config/' . $container->getParameter('core.environment') . '/container/'; + $services_file = 'environment.yml'; + } + else if (!is_dir($this->ext_path . 'config/' . $container->getParameter('core.environment'))) + { + if (file_exists($this->ext_path . 'config/default/container/environment.yml')) + { + $services_directory = $this->ext_path . 'config/default/container/'; + $services_file = 'environment.yml'; + } + else if (!is_dir($this->ext_path . 'config/default') && file_exists($this->ext_path . '/config/services.yml')) + { + $services_directory = $this->ext_path . 'config'; + $services_file = 'services.yml'; + } + } + + if ($services_directory && $services_file) + { + $filesystem = new \phpbb\filesystem\filesystem(); + $loader = new YamlFileLoader($container, new FileLocator($filesystem->realpath($services_directory))); + $loader->load($services_file); + } + } + + /** + * {@inheritdoc} + */ + public function getConfiguration(array $config, ContainerBuilder $container) + { + $reflected = new \ReflectionClass($this); + $namespace = $reflected->getNamespaceName(); + + $class = $namespace . '\\di\configuration'; + if (class_exists($class)) + { + $r = new \ReflectionClass($class); + $container->addResource(new FileResource($r->getFileName())); + + if (!method_exists($class, '__construct')) + { + $configuration = new $class(); + + return $configuration; + } + } + + } + + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ + public function getAlias() + { + return str_replace('/', '_', $this->extension_name); + } +} diff --git a/phpBB/phpbb/extension/exception.php b/phpBB/phpbb/extension/exception.php index 82327c9d5e..9050449bf1 100644 --- a/phpBB/phpbb/extension/exception.php +++ b/phpBB/phpbb/extension/exception.php @@ -1,9 +1,13 @@ <?php /** * -* @package extension -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,10 +16,6 @@ namespace phpbb\extension; /** * Exception class for metadata */ -class exception extends \UnexpectedValueException +class exception extends \phpbb\exception\runtime_exception { - public function __toString() - { - return $this->getMessage(); - } } diff --git a/phpBB/phpbb/extension/extension_interface.php b/phpBB/phpbb/extension/extension_interface.php index bddff51b5a..6a6b6adb8f 100644 --- a/phpBB/phpbb/extension/extension_interface.php +++ b/phpBB/phpbb/extension/extension_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,12 +16,17 @@ namespace phpbb\extension; /** * The interface extension meta classes have to implement to run custom code * on enable/disable/purge. -* -* @package extension */ interface extension_interface { /** + * Indicate whether or not the extension can be enabled. + * + * @return bool + */ + public function is_enableable(); + + /** * enable_step is executed on enabling an extension until it returns false. * * Calls to this function can be made in subsequent requests, when the diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php deleted file mode 100644 index c9c16ae6d5..0000000000 --- a/phpBB/phpbb/extension/finder.php +++ /dev/null @@ -1,525 +0,0 @@ -<?php -/** -* -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\extension; - -/** -* The extension finder provides a simple way to locate files in active extensions -* -* @package extension -*/ -class finder -{ - protected $extension_manager; - protected $filesystem; - protected $phpbb_root_path; - protected $cache; - protected $php_ext; - - /** - * The cache variable name used to store $this->cached_queries in $this->cache. - * - * Allows the use of multiple differently configured finders with the same cache. - * @var string - */ - protected $cache_name; - - /** - * An associative array, containing all search parameters set in methods. - * @var array - */ - protected $query; - - /** - * A map from md5 hashes of serialized queries to their previously retrieved - * results. - * @var array - */ - protected $cached_queries; - - /** - * Creates a new finder instance with its dependencies - * - * @param \phpbb\extension\manager $extension_manager An extension manager - * instance that provides the finder with a list of active - * extensions and their locations - * @param \phpbb\filesystem $filesystem Filesystem instance - * @param string $phpbb_root_path Path to the phpbb root directory - * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null - * @param string $php_ext php file extension - * @param string $cache_name The name of the cache variable, defaults to - * _ext_finder - */ - public function __construct(\phpbb\extension\manager $extension_manager, \phpbb\filesystem $filesystem, $phpbb_root_path = '', \phpbb\cache\driver\driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') - { - $this->extension_manager = $extension_manager; - $this->filesystem = $filesystem; - $this->phpbb_root_path = $phpbb_root_path; - $this->cache = $cache; - $this->php_ext = $php_ext; - $this->cache_name = $cache_name; - - $this->query = array( - 'core_path' => false, - 'core_suffix' => false, - 'core_prefix' => false, - 'core_directory' => false, - 'extension_suffix' => false, - 'extension_prefix' => false, - 'extension_directory' => false, - ); - - $this->cached_queries = ($this->cache) ? $this->cache->get($this->cache_name) : false; - } - - /** - * Sets a core path to be searched in addition to extensions - * - * @param string $core_path The path relative to phpbb_root_path - * @return \phpbb\extension\finder This object for chaining calls - */ - public function core_path($core_path) - { - $this->query['core_path'] = $core_path; - return $this; - } - - /** - * Sets the suffix all files found in extensions and core must match. - * - * There is no default file extension, so to find PHP files only, you will - * have to specify .php as a suffix. However when using get_classes, the .php - * file extension is automatically added to suffixes. - * - * @param string $suffix A filename suffix - * @return \phpbb\extension\finder This object for chaining calls - */ - public function suffix($suffix) - { - $this->core_suffix($suffix); - $this->extension_suffix($suffix); - return $this; - } - - /** - * Sets a suffix all files found in extensions must match - * - * There is no default file extension, so to find PHP files only, you will - * have to specify .php as a suffix. However when using get_classes, the .php - * file extension is automatically added to suffixes. - * - * @param string $extension_suffix A filename suffix - * @return \phpbb\extension\finder This object for chaining calls - */ - public function extension_suffix($extension_suffix) - { - $this->query['extension_suffix'] = $extension_suffix; - return $this; - } - - /** - * Sets a suffix all files found in the core path must match - * - * There is no default file extension, so to find PHP files only, you will - * have to specify .php as a suffix. However when using get_classes, the .php - * file extension is automatically added to suffixes. - * - * @param string $core_suffix A filename suffix - * @return \phpbb\extension\finder This object for chaining calls - */ - public function core_suffix($core_suffix) - { - $this->query['core_suffix'] = $core_suffix; - return $this; - } - - /** - * Sets the prefix all files found in extensions and core must match - * - * @param string $prefix A filename prefix - * @return \phpbb\extension\finder This object for chaining calls - */ - public function prefix($prefix) - { - $this->core_prefix($prefix); - $this->extension_prefix($prefix); - return $this; - } - - /** - * Sets a prefix all files found in extensions must match - * - * @param string $extension_prefix A filename prefix - * @return \phpbb\extension\finder This object for chaining calls - */ - public function extension_prefix($extension_prefix) - { - $this->query['extension_prefix'] = $extension_prefix; - return $this; - } - - /** - * Sets a prefix all files found in the core path must match - * - * @param string $core_prefix A filename prefix - * @return \phpbb\extension\finder This object for chaining calls - */ - public function core_prefix($core_prefix) - { - $this->query['core_prefix'] = $core_prefix; - return $this; - } - - /** - * Sets a directory all files found in extensions and core must be contained in - * - * Automatically sets the core_directory if its value does not differ from - * the current directory. - * - * @param string $directory - * @return \phpbb\extension\finder This object for chaining calls - */ - public function directory($directory) - { - $this->core_directory($directory); - $this->extension_directory($directory); - return $this; - } - - /** - * Sets a directory all files found in extensions must be contained in - * - * @param string $extension_directory - * @return \phpbb\extension\finder This object for chaining calls - */ - public function extension_directory($extension_directory) - { - $this->query['extension_directory'] = $this->sanitise_directory($extension_directory); - return $this; - } - - /** - * Sets a directory all files found in the core path must be contained in - * - * @param string $core_directory - * @return \phpbb\extension\finder This object for chaining calls - */ - public function core_directory($core_directory) - { - $this->query['core_directory'] = $this->sanitise_directory($core_directory); - return $this; - } - - /** - * Removes occurances of /./ and makes sure path ends without trailing slash - * - * @param string $directory A directory pattern - * @return string A cleaned up directory pattern - */ - protected function sanitise_directory($directory) - { - $directory = $this->filesystem->clean_path($directory); - $dir_len = strlen($directory); - - if ($dir_len > 1 && $directory[$dir_len - 1] === '/') - { - $directory = substr($directory, 0, -1); - } - - return $directory; - } - - /** - * Finds classes matching the configured options if they follow phpBB naming rules. - * - * The php file extension is automatically added to suffixes. - * - * Note: If a file is matched but contains a class name not following the - * phpBB naming rules an incorrect class name will be returned. - * - * @param bool $cache Whether the result should be cached - * @param bool $use_all_available Use all available instead of just all - * enabled extensions - * @return array An array of found class names - */ - public function get_classes($cache = true, $use_all_available = false) - { - $this->query['extension_suffix'] .= '.' . $this->php_ext; - $this->query['core_suffix'] .= '.' . $this->php_ext; - - $files = $this->find($cache, false, $use_all_available); - - return $this->get_classes_from_files($files); - } - - /** - * Get class names from a list of files - * - * @param array $files Array of files (from find()) - * @return array Array of class names - */ - public function get_classes_from_files($files) - { - $classes = array(); - foreach ($files as $file => $ext_name) - { - $class = substr($file, 0, -strlen('.' . $this->php_ext)); - if ($ext_name === '/' && preg_match('#^includes/#', $file)) - { - $class = preg_replace('#^includes/#', '', $class); - $classes[] = 'phpbb_' . str_replace('/', '_', $class); - } - else - { - $class = preg_replace('#^ext/#', '', $class); - $classes[] = '\\' . str_replace('/', '\\', $class); - } - } - return $classes; - } - - /** - * Finds all directories matching the configured options - * - * @param bool $cache Whether the result should be cached - * @param bool $use_all_available Use all available instead of just all - * enabled extensions - * @param bool $extension_keys Whether the result should have extension name as array key - * @return array An array of paths to found directories - */ - public function get_directories($cache = true, $use_all_available = false, $extension_keys = false) - { - return $this->find_with_root_path($cache, true, $use_all_available, $extension_keys); - } - - /** - * Finds all files matching the configured options. - * - * @param bool $cache Whether the result should be cached - * @param bool $use_all_available Use all available instead of just all - * enabled extensions - * @return array An array of paths to found files - */ - public function get_files($cache = true, $use_all_available = false) - { - return $this->find_with_root_path($cache, false, $use_all_available); - } - - /** - * A wrapper around the general find which prepends a root path to results - * - * @param bool $cache Whether the result should be cached - * @param bool $is_dir Directories will be returned when true, only files - * otherwise - * @param bool $use_all_available Use all available instead of just all - * enabled extensions - * @param bool $extension_keys If true, result will be associative array - * with extension name as key - * @return array An array of paths to found items - */ - protected function find_with_root_path($cache = true, $is_dir = false, $use_all_available = false, $extension_keys = false) - { - $items = $this->find($cache, $is_dir, $use_all_available); - - $result = array(); - foreach ($items as $item => $ext_name) - { - if ($extension_keys) - { - $result[$ext_name] = $this->phpbb_root_path . $item; - } - else - { - $result[] = $this->phpbb_root_path . $item; - } - } - - return $result; - } - - /** - * Finds all file system entries matching the configured options - * - * @param bool $cache Whether the result should be cached - * @param bool $is_dir Directories will be returned when true, only files - * otherwise - * @param bool $use_all_available Use all available instead of just all - * enabled extensions - * @return array An array of paths to found items - */ - public function find($cache = true, $is_dir = false, $use_all_available = false) - { - if ($use_all_available) - { - $extensions = $this->extension_manager->all_available(); - } - else - { - $extensions = $this->extension_manager->all_enabled(); - } - - if ($this->query['core_path']) - { - $extensions['/'] = $this->phpbb_root_path . $this->query['core_path']; - } - - $files = array(); - $file_list = $this->find_from_paths($extensions, $cache, $is_dir); - - foreach ($file_list as $file) - { - $files[$file['named_path']] = $file['ext_name']; - } - - return $files; - } - - /** - * Finds all file system entries matching the configured options for one - * specific extension - * - * @param string $extension_name Name of the extension - * @param string $extension_path Relative path to the extension root directory - * @param bool $cache Whether the result should be cached - * @param bool $is_dir Directories will be returned when true, only files - * otherwise - * @return array An array of paths to found items - */ - public function find_from_extension($extension_name, $extension_path, $cache = true, $is_dir = false) - { - $extensions = array( - $extension_name => $extension_path, - ); - - $files = array(); - $file_list = $this->find_from_paths($extensions, $cache, $is_dir); - - foreach ($file_list as $file) - { - $files[$file['named_path']] = $file['ext_name']; - } - - return $files; - } - - /** - * Finds all file system entries matching the configured options from - * an array of paths - * - * @param array $extensions Array of extensions (name => full relative path) - * @param bool $cache Whether the result should be cached - * @param bool $is_dir Directories will be returned when true, only files - * otherwise - * @return array An array of paths to found items - */ - public function find_from_paths($extensions, $cache = true, $is_dir = false) - { - $this->query['is_dir'] = $is_dir; - $query = md5(serialize($this->query) . serialize($extensions)); - - if (!defined('DEBUG') && $cache && isset($this->cached_queries[$query])) - { - return $this->cached_queries[$query]; - } - - $files = array(); - - foreach ($extensions as $name => $path) - { - $ext_name = $name; - - if (!file_exists($path)) - { - continue; - } - - if ($name === '/') - { - $location = $this->query['core_path']; - $name = ''; - $suffix = $this->query['core_suffix']; - $prefix = $this->query['core_prefix']; - $directory = $this->query['core_directory']; - } - else - { - $location = 'ext/'; - $name .= '/'; - $suffix = $this->query['extension_suffix']; - $prefix = $this->query['extension_prefix']; - $directory = $this->query['extension_directory']; - } - - // match only first directory if leading slash is given - if ($directory === '/') - { - $directory_pattern = '^' . preg_quote(DIRECTORY_SEPARATOR, '#'); - } - else if ($directory && $directory[0] === '/') - { - $directory_pattern = '^' . preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); - } - else - { - $directory_pattern = preg_quote(DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); - } - if ($is_dir) - { - $directory_pattern .= '$'; - } - $directory_pattern = '#' . $directory_pattern . '#'; - - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::SELF_FIRST); - foreach ($iterator as $file_info) - { - $filename = $file_info->getFilename(); - if ($filename == '.' || $filename == '..') - { - continue; - } - - if ($file_info->isDir() == $is_dir) - { - if ($is_dir) - { - $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; - if ($relative_path[0] !== DIRECTORY_SEPARATOR) - { - $relative_path = DIRECTORY_SEPARATOR . $relative_path; - } - } - else - { - $relative_path = DIRECTORY_SEPARATOR . $iterator->getInnerIterator()->getSubPathname(); - } - - if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && - (!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) && - (!$directory || preg_match($directory_pattern, $relative_path))) - { - $files[] = array( - 'named_path' => str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1)), - 'ext_name' => $ext_name, - 'path' => str_replace(array(DIRECTORY_SEPARATOR, $this->phpbb_root_path), array('/', ''), $file_info->getPath()) . '/', - 'filename' => $filename, - ); - } - } - } - } - - if ($cache && $this->cache) - { - $this->cached_queries[$query] = $files; - $this->cache->put($this->cache_name, $this->cached_queries); - } - - return $files; - } -} diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 23b281deaa..98d2d27278 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -1,9 +1,13 @@ <?php /** * -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,8 +17,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** * The extension manager provides means to activate/deactivate extensions. -* -* @package extension */ class manager { @@ -34,26 +36,26 @@ class manager * Creates a manager and loads information from database * * @param ContainerInterface $container A container - * @param \phpbb\db\driver\driver $db A database connection - * @param \phpbb\config\config $config \phpbb\config\config - * @param \phpbb\filesystem $filesystem + * @param \phpbb\db\driver\driver_interface $db A database connection + * @param \phpbb\config\config $config Config object + * @param \phpbb\filesystem\filesystem_interface $filesystem * @param string $extension_table The name of the table holding extensions * @param string $phpbb_root_path Path to the phpbb includes directory. - * @param string $php_ext php file extension + * @param string $php_ext php file extension, defaults to php * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null * @param string $cache_name The name of the cache variable, defaults to _ext */ - public function __construct(ContainerInterface $container, \phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext') + public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem\filesystem_interface $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext') { + $this->cache = $cache; + $this->cache_name = $cache_name; + $this->config = $config; $this->container = $container; - $this->phpbb_root_path = $phpbb_root_path; $this->db = $db; - $this->config = $config; - $this->cache = $cache; + $this->extension_table = $extension_table; $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->extension_table = $extension_table; - $this->cache_name = $cache_name; $this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false; @@ -72,11 +74,12 @@ class manager { $this->extensions = array(); - // Do not try to load any extensions when installing or updating + // Do not try to load any extensions if the extension table + // does not exist or when installing or updating. // Note: database updater invokes this code, and in 3.0 // there is no extension table therefore the rest of this function // fails - if (defined('IN_INSTALL')) + if (defined('IN_INSTALL') || version_compare($this->config['version'], '3.1.0-dev', '<')) { return; } @@ -143,7 +146,7 @@ class manager * Instantiates the metadata manager for the extension with the given name * * @param string $name The extension name - * @param string $template The template manager + * @param \phpbb\template\template $template The template manager * @return \phpbb\extension\metadata_manager Instance of the metadata manager */ public function create_extension_metadata_manager($name, \phpbb\template\template $template) @@ -172,6 +175,12 @@ class manager $old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false; $extension = $this->get_extension($name); + + if (!$extension->is_enableable()) + { + return false; + } + $state = $extension->enable_step($old_state); $active = ($state === false); @@ -212,6 +221,11 @@ class manager $this->cache->purge(); } + if ($active) + { + $this->config->increment('assets_version', 1); + } + return !$active; } @@ -404,11 +418,16 @@ class manager } $iterator = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', \FilesystemIterator::NEW_CURRENT_AND_KEY | \FilesystemIterator::FOLLOW_SYMLINKS), - \RecursiveIteratorIterator::SELF_FIRST); + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', \FilesystemIterator::NEW_CURRENT_AND_KEY | \FilesystemIterator::FOLLOW_SYMLINKS) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(2); + foreach ($iterator as $file_info) { - if ($file_info->isFile() && $file_info->getFilename() == 'ext.' . $this->php_ext) + if ($file_info->isFile() && $file_info->getFilename() == 'composer.json') { $ext_name = $iterator->getInnerIterator()->getSubPath(); $composer_file = $iterator->getPath() . '/composer.json'; @@ -442,15 +461,17 @@ class manager * All enabled and disabled extensions are considered configured. A purged * extension that is no longer in the database is not configured. * + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * * @return array An array with extension names as keys and and the * database stored extension information as values */ - public function all_configured() + public function all_configured($phpbb_relative = true) { $configured = array(); foreach ($this->extensions as $name => $data) { - $data['ext_path'] = $this->phpbb_root_path . $data['ext_path']; + $data['ext_path'] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; $configured[$name] = $data; } return $configured; @@ -458,18 +479,19 @@ class manager /** * Retrieves all enabled extensions. + * @param bool $phpbb_relative Whether the path should be relative to phpbb root * * @return array An array with extension names as keys and and the * database stored extension information as values */ - public function all_enabled() + public function all_enabled($phpbb_relative = true) { $enabled = array(); foreach ($this->extensions as $name => $data) { if ($data['ext_active']) { - $enabled[$name] = $this->phpbb_root_path . $data['ext_path']; + $enabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; } } return $enabled; @@ -478,17 +500,19 @@ class manager /** * Retrieves all disabled extensions. * + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * * @return array An array with extension names as keys and and the * database stored extension information as values */ - public function all_disabled() + public function all_disabled($phpbb_relative = true) { $disabled = array(); foreach ($this->extensions as $name => $data) { if (!$data['ext_active']) { - $disabled[$name] = $this->phpbb_root_path . $data['ext_path']; + $disabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; } } return $disabled; @@ -500,7 +524,7 @@ class manager * @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) + public function is_available($name) { return file_exists($this->get_extension_path($name, true)); } @@ -511,18 +535,66 @@ class manager * @param string $name Extension name to check * @return bool Depending on whether or not the extension is enabled */ - public function enabled($name) + public function is_enabled($name) { return isset($this->extensions[$name]) && $this->extensions[$name]['ext_active']; } /** - * Instantiates a \phpbb\extension\finder. + * Check to see if a given extension is disabled + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is disabled + */ + public function is_disabled($name) + { + return isset($this->extensions[$name]) && !$this->extensions[$name]['ext_active']; + } + + /** + * Check to see if a given extension is configured * - * @return \phpbb\extension\finder An extension finder instance + * All enabled and disabled extensions are considered configured. A purged + * extension that is no longer in the database is not configured. + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is configured */ - public function get_finder() + public function is_configured($name) { - return new \phpbb\extension\finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); + return isset($this->extensions[$name]); + } + + /** + * Check to see if a given extension is purged + * + * An extension is purged if it is available, not enabled and not disabled. + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is purged + */ + public function is_purged($name) + { + return $this->is_available($name) && !$this->is_configured($name); + } + + /** + * Instantiates a \phpbb\finder. + * + * @param bool $use_all_available Should we load all extensions, or just enabled ones + * @return \phpbb\finder An extension finder instance + */ + public function get_finder($use_all_available = false) + { + $finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); + if ($use_all_available) + { + $finder->set_extensions(array_keys($this->all_available())); + } + else + { + $finder->set_extensions(array_keys($this->all_enabled())); + } + return $finder; } } diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 66cdb86513..4f080647c8 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -1,9 +1,13 @@ <?php /** * -* @package extension -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\extension; /** * The extension metadata manager validates and gets meta-data for extensions -* -* @package extension */ class metadata_manager { @@ -63,8 +65,8 @@ class metadata_manager * * @param string $ext_name Name (including vendor) of the extension * @param \phpbb\config\config $config phpBB Config instance - * @param \phpbb\extension\manager $extension_manager An instance of the phpBBb extension manager - * @param \phpbb\template\template $template phpBB Template instance + * @param \phpbb\extension\manager $extension_manager An instance of the phpBB extension manager + * @param \phpbb\template\template $template phpBB Template instance * @param string $phpbb_root_path Path to the phpbb includes directory. */ public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template, $phpbb_root_path) @@ -80,11 +82,11 @@ class metadata_manager } /** - * Processes and gets the metadata requested - * - * @param string $element All for all metadata that it has and is valid, otherwise specify which section you want by its shorthand term. - * @return array Contains all of the requested metadata, throws an exception on failure - */ + * Processes and gets the metadata requested + * + * @param string $element All for all metadata that it has and is valid, otherwise specify which section you want by its shorthand term. + * @return array Contains all of the requested metadata, throws an exception on failure + */ public function get_metadata($element = 'all') { $this->set_metadata_file(); @@ -126,10 +128,10 @@ class metadata_manager } /** - * Sets the filepath of the metadata file - * - * @return boolean Set to true if it exists, throws an exception on failure - */ + * Sets the filepath of the metadata file + * + * @throws \phpbb\extension\exception + */ private function set_metadata_file() { $ext_filepath = $this->extension_manager->get_extension_path($this->ext_name); @@ -139,33 +141,35 @@ class metadata_manager if (!file_exists($this->metadata_file)) { - throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file); + throw new \phpbb\extension\exception('FILE_NOT_FOUND', array($this->metadata_file)); } } /** - * Gets the contents of the composer.json file - * - * @return bool True if success, throws an exception on failure - */ + * Gets the contents of the composer.json file + * + * @return bool True if success, throws an exception on failure + * @throws \phpbb\extension\exception + */ private function fetch_metadata() { if (!file_exists($this->metadata_file)) { - throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file); + throw new \phpbb\extension\exception('FILE_NOT_FOUND', array($this->metadata_file)); } else { if (!($file_contents = file_get_contents($this->metadata_file))) { - throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file); + throw new \phpbb\extension\exception('FILE_CONTENT_ERR', array($this->metadata_file)); } if (($metadata = json_decode($file_contents, true)) === null) { - throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file); + throw new \phpbb\extension\exception('FILE_JSON_DECODE_ERR', array($this->metadata_file)); } + array_walk_recursive($metadata, array($this, 'sanitize_json')); $this->metadata = $metadata; return true; @@ -173,10 +177,21 @@ class metadata_manager } /** - * This array handles the cleaning of the array + * Sanitize input from JSON array using htmlspecialchars() * - * @return array Contains the cleaned metadata array + * @param mixed $value Value of array row + * @param string $key Key of array row */ + public function sanitize_json(&$value, $key) + { + $value = htmlspecialchars($value); + } + + /** + * This array handles the cleaning of the array + * + * @return array Contains the cleaned metadata array + */ private function clean_metadata_array() { return $this->metadata; @@ -189,6 +204,7 @@ class metadata_manager * "display" for name, type, and authors * "name", "type") * @return Bool True if valid, throws an exception if invalid + * @throws \phpbb\extension\exception */ public function validate($name = 'display') { @@ -196,7 +212,7 @@ class metadata_manager $fields = array( 'name' => '#^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$#', 'type' => '#^phpbb-extension$#', - 'licence' => '#.+#', + 'license' => '#.+#', 'version' => '#.+#', ); @@ -222,12 +238,12 @@ class metadata_manager { if (!isset($this->metadata[$name])) { - throw new \phpbb\extension\exception("Required meta field '$name' has not been set."); + throw new \phpbb\extension\exception('META_FIELD_NOT_SET', array($name)); } if (!preg_match($fields[$name], $this->metadata[$name])) { - throw new \phpbb\extension\exception("Meta field '$name' is invalid."); + throw new \phpbb\extension\exception('META_FIELD_INVALID', array($name)); } } break; @@ -237,22 +253,23 @@ class metadata_manager } /** - * Validates the contents of the authors field - * - * @return boolean True when passes validation, throws exception if invalid - */ + * Validates the contents of the authors field + * + * @return boolean True when passes validation, throws exception if invalid + * @throws \phpbb\extension\exception + */ public function validate_authors() { if (empty($this->metadata['authors'])) { - throw new \phpbb\extension\exception("Required meta field 'authors' has not been set."); + throw new \phpbb\extension\exception('META_FIELD_NOT_SET', array('authors')); } foreach ($this->metadata['authors'] as $author) { if (!isset($author['name'])) { - throw new \phpbb\extension\exception("Required meta field 'author name' has not been set."); + throw new \phpbb\extension\exception('META_FIELD_NOT_SET', array('author name')); } } @@ -260,10 +277,10 @@ class metadata_manager } /** - * This array handles the verification that this extension can be enabled on this board - * - * @return bool True if validation succeeded, False if failed - */ + * This array handles the verification that this extension can be enabled on this board + * + * @return bool True if validation succeeded, False if failed + */ public function validate_enable() { // Check for valid directory & phpBB, PHP versions @@ -276,10 +293,10 @@ class metadata_manager } /** - * Validates the most basic directory structure to ensure it follows <vendor>/<ext> convention. - * - * @return boolean True when passes validation - */ + * Validates the most basic directory structure to ensure it follows <vendor>/<ext> convention. + * + * @return boolean True when passes validation + */ public function validate_dir() { return (substr_count($this->ext_name, '/') === 1 && $this->ext_name == $this->get_metadata('name')); @@ -287,13 +304,13 @@ class metadata_manager /** - * Validates the contents of the phpbb requirement field - * - * @return boolean True when passes validation - */ + * Validates the contents of the phpbb requirement field + * + * @return boolean True when passes validation + */ public function validate_require_phpbb() { - if (!isset($this->metadata['require']['phpbb/phpbb'])) + if (!isset($this->metadata['extra']['soft-require']['phpbb/phpbb'])) { return false; } @@ -302,10 +319,10 @@ class metadata_manager } /** - * Validates the contents of the php requirement field - * - * @return boolean True when passes validation - */ + * Validates the contents of the php requirement field + * + * @return boolean True when passes validation + */ public function validate_require_php() { if (!isset($this->metadata['require']['php'])) @@ -317,58 +334,37 @@ class metadata_manager } /** - * Version validation helper + * Outputs the metadata into the template * - * @param string $string The string for comparing to a version - * @param string $current_version The version to compare to - * @return bool True/False if meets version requirements + * @return null */ - private function _validate_version($string, $current_version) - { - // Allow them to specify their own comparison operator (ex: <3.1.2, >=3.1.0) - $comparison_matches = false; - preg_match('#[=<>]+#', $string, $comparison_matches); - - if (!empty($comparison_matches)) - { - return version_compare($current_version, str_replace(array($comparison_matches[0], ' '), '', $string), $comparison_matches[0]); - } - - return version_compare($current_version, $string, '>='); - } - - /** - * Outputs the metadata into the template - * - * @return null - */ public function output_template_data() { $this->template->assign_vars(array( - 'META_NAME' => htmlspecialchars($this->metadata['name']), - 'META_TYPE' => htmlspecialchars($this->metadata['type']), - 'META_DESCRIPTION' => (isset($this->metadata['description'])) ? htmlspecialchars($this->metadata['description']) : '', + 'META_NAME' => $this->metadata['name'], + 'META_TYPE' => $this->metadata['type'], + 'META_DESCRIPTION' => (isset($this->metadata['description'])) ? $this->metadata['description'] : '', 'META_HOMEPAGE' => (isset($this->metadata['homepage'])) ? $this->metadata['homepage'] : '', - 'META_VERSION' => (isset($this->metadata['version'])) ? htmlspecialchars($this->metadata['version']) : '', - 'META_TIME' => (isset($this->metadata['time'])) ? htmlspecialchars($this->metadata['time']) : '', - 'META_LICENCE' => htmlspecialchars($this->metadata['licence']), + 'META_VERSION' => (isset($this->metadata['version'])) ? $this->metadata['version'] : '', + 'META_TIME' => (isset($this->metadata['time'])) ? $this->metadata['time'] : '', + 'META_LICENSE' => $this->metadata['license'], - 'META_REQUIRE_PHP' => (isset($this->metadata['require']['php'])) ? htmlspecialchars($this->metadata['require']['php']) : '', + 'META_REQUIRE_PHP' => (isset($this->metadata['require']['php'])) ? $this->metadata['require']['php'] : '', 'META_REQUIRE_PHP_FAIL' => !$this->validate_require_php(), - 'META_REQUIRE_PHPBB' => (isset($this->metadata['require']['phpbb/phpbb'])) ? htmlspecialchars($this->metadata['require']['phpbb/phpbb']) : '', + 'META_REQUIRE_PHPBB' => (isset($this->metadata['extra']['soft-require']['phpbb/phpbb'])) ? $this->metadata['extra']['soft-require']['phpbb/phpbb'] : '', 'META_REQUIRE_PHPBB_FAIL' => !$this->validate_require_phpbb(), - 'META_DISPLAY_NAME' => (isset($this->metadata['extra']['display-name'])) ? htmlspecialchars($this->metadata['extra']['display-name']) : '', + 'META_DISPLAY_NAME' => (isset($this->metadata['extra']['display-name'])) ? $this->metadata['extra']['display-name'] : '', )); foreach ($this->metadata['authors'] as $author) { $this->template->assign_block_vars('meta_authors', array( - 'AUTHOR_NAME' => htmlspecialchars($author['name']), + 'AUTHOR_NAME' => $author['name'], 'AUTHOR_EMAIL' => (isset($author['email'])) ? $author['email'] : '', 'AUTHOR_HOMEPAGE' => (isset($author['homepage'])) ? $author['homepage'] : '', - 'AUTHOR_ROLE' => (isset($author['role'])) ? htmlspecialchars($author['role']) : '', + 'AUTHOR_ROLE' => (isset($author['role'])) ? $author['role'] : '', )); } } diff --git a/phpBB/phpbb/extension/provider.php b/phpBB/phpbb/extension/provider.php index bfdc2b66b9..1c42cf7b5e 100644 --- a/phpBB/phpbb/extension/provider.php +++ b/phpBB/phpbb/extension/provider.php @@ -1,9 +1,13 @@ <?php /** * -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,8 +23,6 @@ namespace phpbb\extension; * * Items could be anything, for example template paths or cron task names. * Derived classes completely define what the items are. -* -* @package extension */ abstract class provider implements \IteratorAggregate { @@ -56,7 +58,7 @@ abstract class provider implements \IteratorAggregate /** * Retrieve an iterator over all items * - * @return ArrayIterator An iterator for the array of template paths + * @return \ArrayIterator An iterator for the array of template paths */ public function getIterator() { diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php new file mode 100644 index 0000000000..b14dafe15a --- /dev/null +++ b/phpBB/phpbb/feed/attachments_base.php @@ -0,0 +1,85 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\feed; + +/** +* Abstract class for feeds displaying attachments +*/ +abstract class attachments_base extends base +{ + /** + * Attachments that may be displayed + */ + protected $attachments = array(); + + /** + * Retrieve the list of attachments that may be displayed + */ + protected function fetch_attachments() + { + $sql_array = array( + 'SELECT' => 'a.*', + 'FROM' => array( + ATTACHMENTS_TABLE => 'a' + ), + 'WHERE' => 'a.in_message = 0 ', + 'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC', + ); + + if (isset($this->topic_id)) + { + $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id; + } + else if (isset($this->forum_id)) + { + $sql_array['LEFT_JOIN'] = array( + array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'a.topic_id = t.topic_id', + ) + ); + $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id; + } + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query($sql); + + // Set attachments in feed items + while ($row = $this->db->sql_fetchrow($result)) + { + $this->attachments[$row['post_msg_id']][] = $row; + } + $this->db->sql_freeresult($result); + } + + /** + * {@inheritDoc} + */ + public function open() + { + parent::open(); + $this->fetch_attachments(); + } + + /** + * Get attachments related to a given post + * + * @param $post_id int Post id + * @return mixed Attachments related to $post_id + */ + public function get_attachments($post_id) + { + return $this->attachments[$post_id]; + } +} diff --git a/phpBB/phpbb/feed/base.php b/phpBB/phpbb/feed/base.php index e6c1e606fa..188d229515 100644 --- a/phpBB/phpbb/feed/base.php +++ b/phpBB/phpbb/feed/base.php @@ -1,31 +1,33 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* Base class with some generic functions and settings. -* -* @package phpBB3 -*/ -abstract class base + * Base class with some generic functions and settings. + */ +abstract class base implements feed_interface { /** - * Feed helper object - * @var \phpbb\feed\helper - */ + * Feed helper object + * @var \phpbb\feed\helper + */ protected $helper; /** @var \phpbb\config\config */ protected $config; - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var \phpbb\cache\driver\driver_interface */ @@ -41,44 +43,46 @@ abstract class base protected $phpEx; /** - * SQL Query to be executed to get feed items - */ - var $sql = array(); + * SQL Query to be executed to get feed items + */ + protected $sql = array(); /** - * Keys specified for retrieval of title, content, etc. - */ - var $keys = array(); + * Keys specified for retrieval of title, content, etc. + */ + protected $keys = array(); /** - * Number of items to fetch. Usually overwritten by $config['feed_something'] - */ - var $num_items = 15; + * Number of items to fetch. Usually overwritten by $config['feed_something'] + */ + protected $num_items = 15; /** - * Separator for title elements to separate items (for example forum / topic) - */ - var $separator = "\xE2\x80\xA2"; // • + * Separator for title elements to separate items (for example forum / topic) + */ + protected $separator = "\xE2\x80\xA2"; // • /** - * Separator for the statistics row (Posted by, post date, replies, etc.) - */ - var $separator_stats = "\xE2\x80\x94"; // — + * Separator for the statistics row (Posted by, post date, replies, etc.) + */ + protected $separator_stats = "\xE2\x80\x94"; // — + + /** @var mixed Query result handle */ + protected $result; /** - * Constructor - * - * @param \phpbb\feed\helper $helper Feed helper - * @param \phpbb\config\config $config Config object - * @param \phpbb\db\driver\driver $db Database connection - * @param \phpbb\cache\driver\driver_interface $cache Cache object - * @param \phpbb\user $user User object - * @param \phpbb\auth\auth $auth Auth object - * @param \phpbb\content_visibility $content_visibility Auth object - * @param string $phpEx php file extension - * @return null - */ - function __construct(\phpbb\feed\helper $helper, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, $phpEx) + * Constructor + * + * @param \phpbb\feed\helper $helper Feed helper + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param \phpbb\cache\driver\driver_interface $cache Cache object + * @param \phpbb\user $user User object + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\content_visibility $content_visibility Auth object + * @param string $phpEx php file extension + */ + public function __construct(\phpbb\feed\helper $helper, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, $phpEx) { $this->config = $config; $this->helper = $helper; @@ -105,23 +109,23 @@ abstract class base } /** - * Set keys. - */ - function set_keys() + * {@inheritdoc} + */ + public function set_keys() { } /** - * Open feed - */ - function open() + * {@inheritdoc} + */ + public function open() { } /** - * Close feed - */ - function close() + * {@inheritdoc} + */ + public function close() { if (!empty($this->result)) { @@ -130,22 +134,47 @@ abstract class base } /** - * Set key - */ - function set($key, $value) + * {@inheritdoc} + */ + public function set($key, $value) { $this->keys[$key] = $value; } /** - * Get key - */ - function get($key) + * {@inheritdoc} + */ + public function get($key) { return (isset($this->keys[$key])) ? $this->keys[$key] : null; } - function get_readable_forums() + /** + * {@inheritdoc} + */ + public function get_item() + { + if (!isset($this->result)) + { + if (!$this->get_sql()) + { + return false; + } + + // Query database + $sql = $this->db->sql_build_query('SELECT', $this->sql); + $this->result = $this->db->sql_query_limit($sql, $this->num_items); + } + + return $this->db->sql_fetchrow($this->result); + } + + /** + * Returns the ids of the forums readable by the current user. + * + * @return int[] + */ + protected function get_readable_forums() { static $forum_ids; @@ -157,7 +186,12 @@ abstract class base return $forum_ids; } - function get_moderator_approve_forums() + /** + * Returns the ids of the forum for which the current user can approve the post in the moderation queue. + * + * @return int[] + */ + protected function get_moderator_approve_forums() { static $forum_ids; @@ -169,7 +203,13 @@ abstract class base return $forum_ids; } - function is_moderator_approve_forum($forum_id) + /** + * Returns true if the current user can approve the post of the given forum + * + * @param int $forum_id Forum id to check + * @return bool + */ + protected function is_moderator_approve_forum($forum_id) { static $forum_ids; @@ -181,7 +221,12 @@ abstract class base return (isset($forum_ids[$forum_id])) ? true : false; } - function get_excluded_forums() + /** + * Returns the ids of the forum excluded from the feeds + * + * @return int[] + */ + protected function get_excluded_forums() { static $forum_ids; @@ -208,38 +253,35 @@ abstract class base return $forum_ids; } - function is_excluded_forum($forum_id) + /** + * Returns true if the given id is in the excluded forums list. + * + * @param int $forum_id Id to check + * @return bool + */ + protected function is_excluded_forum($forum_id) { $forum_ids = $this->get_excluded_forums(); return isset($forum_ids[$forum_id]) ? true : false; } - function get_passworded_forums() + /** + * Returns all password protected forum ids the current user is currently NOT authenticated for. + * + * @return array Array of forum ids + */ + protected function get_passworded_forums() { return $this->user->get_passworded_forums(); } - function get_item() - { - static $result; - - if (!isset($result)) - { - if (!$this->get_sql()) - { - return false; - } - - // Query database - $sql = $this->db->sql_build_query('SELECT', $this->sql); - $result = $this->db->sql_query_limit($sql, $this->num_items); - } - - return $this->db->sql_fetchrow($result); - } - - function user_viewprofile($row) + /** + * Returns the link to the user profile. + * + * @return string + */ + protected function user_viewprofile($row) { $author_id = (int) $row[$this->get('author_id')]; @@ -252,4 +294,11 @@ abstract class base return '<a href="' . $this->helper->append_sid('memberlist.' . $this->phpEx, 'mode=viewprofile&u=' . $author_id) . '">' . $row[$this->get('creator')] . '</a>'; } + + /** + * Returns the SQL query used to retrieve the posts of the feed. + * + * @return string SQL SELECT query + */ + protected abstract function get_sql(); } diff --git a/phpBB/phpbb/feed/controller/feed.php b/phpBB/phpbb/feed/controller/feed.php new file mode 100644 index 0000000000..31476b7317 --- /dev/null +++ b/phpBB/phpbb/feed/controller/feed.php @@ -0,0 +1,389 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\feed\controller; + +use phpbb\auth\auth; +use phpbb\config\config; +use phpbb\db\driver\driver_interface; +use phpbb\exception\http_exception; +use phpbb\feed\feed_interface; +use phpbb\feed\exception\feed_unavailable_exception; +use phpbb\feed\exception\unauthorized_exception; +use phpbb\feed\helper as feed_helper; +use phpbb\controller\helper as controller_helper; +use phpbb\symfony_request; +use phpbb\user; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +class feed +{ + /** + * @var \Twig_Environment + */ + protected $template; + + /** + * @var symfony_request + */ + protected $request; + + /** + * @var controller_helper + */ + protected $controller_helper; + + /** + * @var config + */ + protected $config; + + /** + * @var driver_interface + */ + protected $db; + + /** + * @var ContainerInterface + */ + protected $container; + + /** + * @var feed_helper + */ + protected $feed_helper; + + /** + * @var user + */ + protected $user; + + /** + * @var auth + */ + protected $auth; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \Twig_Environment $twig + * @param symfony_request $request + * @param controller_helper $controller_helper + * @param config $config + * @param driver_interface $db + * @param ContainerInterface $container + * @param feed_helper $feed_helper + * @param user $user + * @param auth $auth + * @param string $php_ext + */ + public function __construct(\Twig_Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, $php_ext) + { + $this->request = $request; + $this->controller_helper = $controller_helper; + $this->config = $config; + $this->db = $db; + $this->container = $container; + $this->feed_helper = $feed_helper; + $this->user = $user; + $this->auth = $auth; + $this->php_ext = $php_ext; + $this->template = $twig; + } + + /** + * Controller for /feed/forums route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function forums() + { + if (!$this->config['feed_overall_forums']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.forums')); + } + + /** + * Controller for /feed/news route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function news() + { + // Get at least one news forum + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $this->db->sql_query_limit($sql, 1, 0, 600); + $s_feed_news = (int) $this->db->sql_fetchfield('forum_id'); + $this->db->sql_freeresult($result); + + if (!$s_feed_news) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.news')); + } + + /** + * Controller for /feed/topics route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics() + { + if (!$this->config['feed_topics_new']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topics')); + } + + /** + * Controller for /feed/topics_new route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics_new() + { + return $this->topics(); + } + + /** + * Controller for /feed/topics_active route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics_active() + { + if (!$this->config['feed_topics_active']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topics_active')); + } + + /** + * Controller for /feed/forum/{forum_id} route + * + * @param int $forum_id + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function forum($forum_id) + { + if (!$this->config['feed_forum']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.forum')->set_forum_id($forum_id)); + } + + /** + * Controller for /feed/topic/{topic_id} route + * + * @param int $topic_id + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topic($topic_id) + { + if (!$this->config['feed_topic']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topic')->set_topic_id($topic_id)); + } + + /** + * Controller for /feed/{mode] route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function overall() + { + if (!$this->config['feed_overall']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.overall')); + } + + /** + * Display a given feed + * + * @param feed_interface $feed + * + * @return Response + */ + protected function send_feed(feed_interface $feed) + { + try + { + return $this->send_feed_do($feed); + } + catch (feed_unavailable_exception $e) + { + throw new http_exception(Response::HTTP_NOT_FOUND, $e->getMessage(), $e->get_parameters(), $e); + } + catch (unauthorized_exception $e) + { + throw new http_exception(Response::HTTP_FORBIDDEN, $e->getMessage(), $e->get_parameters(), $e); + } + } + + /** + * Really send the feed + * + * @param feed_interface $feed + * + * @return Response + * + * @throw exception\feed_exception + */ + protected function send_feed_do(feed_interface $feed) + { + $feed_updated_time = 0; + $item_vars = array(); + + $board_url = $this->feed_helper->get_board_url(); + + // Open Feed + $feed->open(); + + // Iterate through items + while ($row = $feed->get_item()) + { + // BBCode options to correctly disable urls, smilies, bbcode... + if ($feed->get('options') === null) + { + // Allow all combinations + $options = 7; + + if ($feed->get('enable_bbcode') !== null && $feed->get('enable_smilies') !== null && $feed->get('enable_magic_url') !== null) + { + $options = (($row[$feed->get('enable_bbcode')]) ? OPTION_FLAG_BBCODE : 0) + (($row[$feed->get('enable_smilies')]) ? OPTION_FLAG_SMILIES : 0) + (($row[$feed->get('enable_magic_url')]) ? OPTION_FLAG_LINKS : 0); + } + } + else + { + $options = $row[$feed->get('options')]; + } + + $title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : ''); + + $published = ($feed->get('published') !== null) ? (int) $row[$feed->get('published')] : 0; + $updated = ($feed->get('updated') !== null) ? (int) $row[$feed->get('updated')] : 0; + + $display_attachments = ($this->auth->acl_get('u_download') && $this->auth->acl_get('f_download', $row['forum_id']) && isset($row['post_attachment']) && $row['post_attachment']) ? true : false; + + $item_row = array( + 'author' => ($feed->get('creator') !== null) ? $row[$feed->get('creator')] : '', + 'published' => ($published > 0) ? $this->feed_helper->format_date($published) : '', + 'updated' => ($updated > 0) ? $this->feed_helper->format_date($updated) : '', + 'link' => '', + 'title' => censor_text($title), + 'category' => ($this->config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $this->php_ext . '?f=' . $row['forum_id'] : '', + 'category_name' => ($this->config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '', + 'description' => censor_text($this->feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ($display_attachments ? $feed->get_attachments($row['post_id']) : array()))), + 'statistics' => '', + ); + + // Adjust items, fill link, etc. + $feed->adjust_item($item_row, $row); + + $item_vars[] = $item_row; + + $feed_updated_time = max($feed_updated_time, $published, $updated); + } + + // If we do not have any items at all, sending the current time is better than sending no time. + if (!$feed_updated_time) + { + $feed_updated_time = time(); + } + + $feed->close(); + + $content = $this->template->render('feed.xml.twig', array( + // Some default assignments + // FEED_IMAGE is not used (atom) + 'FEED_IMAGE' => '', + 'SELF_LINK' => $this->controller_helper->route($this->request->attributes->get('_route'), $this->request->attributes->get('_route_params'), true, '', UrlGeneratorInterface::ABSOLUTE_URL), + 'FEED_LINK' => $board_url . '/index.' . $this->php_ext, + 'FEED_TITLE' => $this->config['sitename'], + 'FEED_SUBTITLE' => $this->config['site_desc'], + 'FEED_UPDATED' => $this->feed_helper->format_date($feed_updated_time), + 'FEED_LANG' => $this->user->lang['USER_LANG'], + 'FEED_AUTHOR' => $this->config['sitename'], + + // Feed entries + 'FEED_ROWS' => $item_vars, + )); + + $response = new Response($content); + $response->headers->set('Content-Type', 'application/atom+xml'); + $response->setCharset('UTF-8'); + $response->setLastModified(new \DateTime('@' . $feed_updated_time)); + + if (!empty($this->user->data['is_bot'])) + { + // Let reverse proxies know we detected a bot. + $response->headers->set('X-PHPBB-IS-BOT', 'yes'); + } + + return $response; + } + + /** + * Throw and exception saying that the feed isn't available + * + * @throw http_exception + */ + protected function send_unavailable() + { + throw new http_exception(404, 'FEATURE_NOT_AVAILABLE'); + } +} diff --git a/phpBB/phpbb/feed/exception/feed_exception.php b/phpBB/phpbb/feed/exception/feed_exception.php new file mode 100644 index 0000000000..c9c888211e --- /dev/null +++ b/phpBB/phpbb/feed/exception/feed_exception.php @@ -0,0 +1,21 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +use phpbb\exception\runtime_exception; + +abstract class feed_exception extends runtime_exception +{ + +} diff --git a/phpBB/phpbb/feed/exception/feed_unavailable_exception.php b/phpBB/phpbb/feed/exception/feed_unavailable_exception.php new file mode 100644 index 0000000000..4b6605b47d --- /dev/null +++ b/phpBB/phpbb/feed/exception/feed_unavailable_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +abstract class feed_unavailable_exception extends feed_exception +{ + +} diff --git a/phpBB/phpbb/feed/exception/no_feed_exception.php b/phpBB/phpbb/feed/exception/no_feed_exception.php new file mode 100644 index 0000000000..af6357b74c --- /dev/null +++ b/phpBB/phpbb/feed/exception/no_feed_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +class no_feed_exception extends feed_unavailable_exception +{ + public function __construct(\Exception $previous = null, $code = 0) + { + parent::__construct('NO_FEED', array(), $previous, $code); + } +} diff --git a/phpBB/phpbb/feed/exception/no_forum_exception.php b/phpBB/phpbb/feed/exception/no_forum_exception.php new file mode 100644 index 0000000000..a60832957a --- /dev/null +++ b/phpBB/phpbb/feed/exception/no_forum_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +class no_forum_exception extends feed_unavailable_exception +{ + public function __construct($forum_id, \Exception $previous = null, $code = 0) + { + parent::__construct('NO_FORUM', array($forum_id), $previous, $code); + } +} diff --git a/phpBB/phpbb/feed/exception/no_topic_exception.php b/phpBB/phpbb/feed/exception/no_topic_exception.php new file mode 100644 index 0000000000..b961a65d1c --- /dev/null +++ b/phpBB/phpbb/feed/exception/no_topic_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +class no_topic_exception extends feed_unavailable_exception +{ + public function __construct($topic_id, \Exception $previous = null, $code = 0) + { + parent::__construct('NO_TOPIC', array($topic_id), $previous, $code); + } +} diff --git a/phpBB/phpbb/feed/exception/unauthorized_exception.php b/phpBB/phpbb/feed/exception/unauthorized_exception.php new file mode 100644 index 0000000000..7868975779 --- /dev/null +++ b/phpBB/phpbb/feed/exception/unauthorized_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +abstract class unauthorized_exception extends feed_exception +{ + +} diff --git a/phpBB/phpbb/feed/exception/unauthorized_forum_exception.php b/phpBB/phpbb/feed/exception/unauthorized_forum_exception.php new file mode 100644 index 0000000000..4384c7b39b --- /dev/null +++ b/phpBB/phpbb/feed/exception/unauthorized_forum_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +class unauthorized_forum_exception extends unauthorized_exception +{ + public function __construct($forum_id, \Exception $previous = null, $code = 0) + { + parent::__construct('SORRY_AUTH_READ', array($forum_id), $previous, $code); + } +} diff --git a/phpBB/phpbb/feed/exception/unauthorized_topic_exception.php b/phpBB/phpbb/feed/exception/unauthorized_topic_exception.php new file mode 100644 index 0000000000..f49f0a0476 --- /dev/null +++ b/phpBB/phpbb/feed/exception/unauthorized_topic_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed\exception; + +class unauthorized_topic_exception extends unauthorized_exception +{ + public function __construct($topic_id, \Exception $previous = null, $code = 0) + { + parent::__construct('SORRY_AUTH_READ_TOPIC', array($topic_id), $previous, $code); + } +} diff --git a/phpBB/phpbb/feed/factory.php b/phpBB/phpbb/feed/factory.php deleted file mode 100644 index d370160563..0000000000 --- a/phpBB/phpbb/feed/factory.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\feed; - -/** -* Factory class to return correct object -* @package phpBB3 -*/ -class factory -{ - /** - * Service container object - * @var object - */ - protected $container; - - /** @var \phpbb\config\config */ - protected $config; - - /** @var \phpbb\db\driver\driver */ - protected $db; - - /** - * Constructor - * - * @param objec $container Container object - * @param \phpbb\config\config $config Config object - * @param \phpbb\db\driver\driver $db Database connection - * @return null - */ - public function __construct($container, \phpbb\config\config $config, \phpbb\db\driver\driver $db) - { - $this->container = $container; - $this->config = $config; - $this->db = $db; - } - - /** - * Return correct object for specified mode - * - * @param string $mode The feeds mode. - * @param int $forum_id Forum id specified by the script if forum feed provided. - * @param int $topic_id Topic id specified by the script if topic feed provided. - * - * @return object Returns correct feeds object for specified mode. - */ - function get_feed($mode, $forum_id, $topic_id) - { - switch ($mode) - { - case 'forums': - if (!$this->config['feed_overall_forums']) - { - return false; - } - - return $this->container->get('feed.forums'); - break; - - case 'topics': - case 'topics_new': - if (!$this->config['feed_topics_new']) - { - return false; - } - - return $this->container->get('feed.topics'); - break; - - case 'topics_active': - if (!$this->config['feed_topics_active']) - { - return false; - } - - return $this->container->get('feed.topics_active'); - break; - - case 'news': - // Get at least one news forum - $sql = 'SELECT forum_id - FROM ' . FORUMS_TABLE . ' - WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); - $result = $this->db->sql_query_limit($sql, 1, 0, 600); - $s_feed_news = (int) $this->db->sql_fetchfield('forum_id'); - $this->db->sql_freeresult($result); - - if (!$s_feed_news) - { - return false; - } - - return $this->container->get('feed.news'); - break; - - default: - if ($topic_id && $this->config['feed_topic']) - { - return $this->container->get('feed.topic') - ->set_topic_id($topic_id); - } - else if ($forum_id && $this->config['feed_forum']) - { - return $this->container->get('feed.forum') - ->set_forum_id($forum_id); - } - else if ($this->config['feed_overall']) - { - return $this->container->get('feed.overall'); - } - - return false; - break; - } - } -} diff --git a/phpBB/phpbb/feed/feed_interface.php b/phpBB/phpbb/feed/feed_interface.php new file mode 100644 index 0000000000..c185cd249c --- /dev/null +++ b/phpBB/phpbb/feed/feed_interface.php @@ -0,0 +1,67 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed; + +/** + * Interface implemented by all feeds types + */ +interface feed_interface +{ + /** + * Set keys. + */ + public function set_keys(); + + /** + * Open feed + */ + public function open(); + + /** + * Close feed + */ + public function close(); + + /** + * Set key + * + * @param string $key Key + * @param mixed $value Value + */ + public function set($key, $value); + + /** + * Get key + * + * @param string $key Key + * @return mixed + */ + public function get($key); + + /** + * Get the next post in the feed + * + * @return array + */ + public function get_item(); + + /** + * Adjust a feed entry + * + * @param $item_row + * @param $row + * @return array + */ + public function adjust_item(&$item_row, &$row); +} diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 8026824ab7..6701c4d9e7 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -1,33 +1,39 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; +use phpbb\feed\exception\no_feed_exception; +use phpbb\feed\exception\no_forum_exception; +use phpbb\feed\exception\unauthorized_forum_exception; + /** -* Forum feed -* -* This will give you the last {$this->num_items} posts made -* within a specific forum. -* -* @package phpBB3 -*/ -class forum extends \phpbb\feed\post_base + * Forum feed + * + * This will give you the last {$this->num_items} posts made + * within a specific forum. + */ +class forum extends post_base { - var $forum_id = 0; - var $forum_data = array(); + protected $forum_id = 0; + protected $forum_data = array(); /** - * Set the Forum ID - * - * @param int $forum_id Forum ID - * @return \phpbb\feed\forum - */ + * Set the Forum ID + * + * @param int $forum_id Forum ID + * @return \phpbb\feed\forum + */ public function set_forum_id($forum_id) { $this->forum_id = (int) $forum_id; @@ -35,7 +41,10 @@ class forum extends \phpbb\feed\post_base return $this; } - function open() + /** + * {@inheritdoc} + */ + public function open() { // Check if forum exists $sql = 'SELECT forum_id, forum_name, forum_password, forum_type, forum_options @@ -47,25 +56,25 @@ class forum extends \phpbb\feed\post_base if (empty($this->forum_data)) { - trigger_error('NO_FORUM'); + throw new no_forum_exception($this->forum_id); } // Forum needs to be postable if ($this->forum_data['forum_type'] != FORUM_POST) { - trigger_error('NO_FEED'); + throw new no_feed_exception(); } // Make sure forum is not excluded from feed if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->forum_data['forum_options'])) { - trigger_error('NO_FEED'); + throw new no_feed_exception(); } // Make sure we can read this forum if (!$this->auth->acl_get('f_read', $this->forum_id)) { - trigger_error('SORRY_AUTH_READ'); + throw new unauthorized_forum_exception($this->forum_id); } // Make sure forum is not passworded or user is authed @@ -75,14 +84,19 @@ class forum extends \phpbb\feed\post_base if (isset($forum_ids_passworded[$this->forum_id])) { - trigger_error('SORRY_AUTH_READ'); + throw new unauthorized_forum_exception($this->forum_id); } unset($forum_ids_passworded); } + + parent::open(); } - function get_sql() + /** + * {@inheritdoc} + */ + protected function get_sql() { // Determine topics with recent activity $sql = 'SELECT topic_id, topic_last_post_time @@ -90,7 +104,7 @@ class forum extends \phpbb\feed\post_base WHERE forum_id = ' . $this->forum_id . ' AND topic_moved_id = 0 AND ' . $this->content_visibility->get_visibility_sql('topic', $this->forum_id) . ' - ORDER BY topic_last_post_time DESC'; + ORDER BY topic_last_post_time DESC, topic_last_post_id DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); $topic_ids = array(); @@ -109,8 +123,8 @@ class forum extends \phpbb\feed\post_base } $this->sql = array( - 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . - 'u.username, u.user_id', + 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . + 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', USERS_TABLE => 'u', @@ -119,20 +133,27 @@ class forum extends \phpbb\feed\post_base AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . ' AND p.post_time >= ' . $min_post_time . ' AND p.poster_id = u.user_id', - 'ORDER_BY' => 'p.post_time DESC', + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', ); return true; } - function adjust_item(&$item_row, &$row) + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) { parent::adjust_item($item_row, $row); $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title']; + $item_row['forum_id'] = $this->forum_id; } - function get_item() + /** + * {@inheritdoc} + */ + public function get_item() { return ($row = parent::get_item()) ? array_merge($this->forum_data, $row) : $row; } diff --git a/phpBB/phpbb/feed/forums.php b/phpBB/phpbb/feed/forums.php index ddbb0bf7b3..92f2b2dd4d 100644 --- a/phpBB/phpbb/feed/forums.php +++ b/phpBB/phpbb/feed/forums.php @@ -1,27 +1,32 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* 'All Forums' feed -* -* This will give you a list of all postable forums where feeds are enabled -* including forum description, topic stats and post stats -* -* @package phpBB3 -*/ -class forums extends \phpbb\feed\base + * 'All Forums' feed + * + * This will give you a list of all postable forums where feeds are enabled + * including forum description, topic stats and post stats + */ +class forums extends base { - var $num_items = 0; + protected $num_items = 0; - function set_keys() + /** + * {@inheritdoc} + */ + public function set_keys() { $this->set('title', 'forum_name'); $this->set('text', 'forum_desc'); @@ -31,7 +36,10 @@ class forums extends \phpbb\feed\base $this->set('options', 'forum_desc_options'); } - function get_sql() + /** + * {@inheritdoc} + */ + public function get_sql() { $in_fid_ary = array_diff($this->get_readable_forums(), $this->get_excluded_forums()); if (empty($in_fid_ary)) @@ -53,7 +61,10 @@ class forums extends \phpbb\feed\base return true; } - function adjust_item(&$item_row, &$row) + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) { $item_row['link'] = $this->helper->append_sid('viewforum.' . $this->phpEx, 'f=' . $row['forum_id']); diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index 3f2759b85e..e15d1e131e 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -1,18 +1,21 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* Class with some helpful functions used in feeds -* @package phpBB3 -*/ + * Class with some helpful functions used in feeds + */ class helper { /** @var \phpbb\config\config */ @@ -24,24 +27,28 @@ class helper /** @var string */ protected $phpbb_root_path; + /** @var string */ + protected $phpEx; + /** - * Constructor - * - * @param \phpbb\config\config $config Config object - * @param \phpbb\user $user User object - * @param string $phpbb_root_path Root path - * @return null - */ - public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path) + * Constructor + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\user $user User object + * @param string $phpbb_root_path Root path + * @param string $phpEx PHP file extension + */ + public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path, $phpEx) { $this->config = $config; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; } /** - * Run links through append_sid(), prepend generate_board_url() and remove session id - */ + * Run links through append_sid(), prepend generate_board_url() and remove session id + */ public function get_board_url() { static $board_url; @@ -55,16 +62,16 @@ class helper } /** - * Run links through append_sid(), prepend generate_board_url() and remove session id - */ + * Run links through append_sid(), prepend generate_board_url() and remove session id + */ public function append_sid($url, $params) { return append_sid($this->get_board_url() . '/' . $url, $params, true, ''); } /** - * Generate ISO 8601 date string (RFC 3339) - */ + * Generate ISO 8601 date string (RFC 3339) + */ public function format_date($time) { static $zone_offset; @@ -80,9 +87,17 @@ class helper } /** - * Generate text content - */ - public function generate_content($content, $uid, $bitfield, $options) + * Generate text content + * + * @param string $content is feed text content + * @param string $uid is bbcode_uid + * @param string $bitfield is bbcode bitfield + * @param int $options bbcode flag options + * @param int $forum_id is the forum id + * @param array $post_attachments is an array containing the attachments and their respective info + * @return string the html content to be printed for the feed + */ + public function generate_content($content, $uid, $bitfield, $options, $forum_id, $post_attachments) { if (empty($content)) { @@ -107,16 +122,16 @@ class helper // Firefox does not support CSS for feeds, though // Remove font sizes - // $content = preg_replace('#<span style="font-size: [0-9]+%; line-height: [0-9]+%;">([^>]+)</span>#iU', '\1', $content); + // $content = preg_replace('#<span style="font-size: [0-9]+%; line-height: [0-9]+%;">([^>]+)</span>#iU', '\1', $content); // Make text strong :P - // $content = preg_replace('#<span style="font-weight: bold?">(.*?)</span>#iU', '<strong>\1</strong>', $content); + // $content = preg_replace('#<span style="font-weight: bold?">(.*?)</span>#iU', '<strong>\1</strong>', $content); // Italic - // $content = preg_replace('#<span style="font-style: italic?">([^<]+)</span>#iU', '<em>\1</em>', $content); + // $content = preg_replace('#<span style="font-style: italic?">([^<]+)</span>#iU', '<em>\1</em>', $content); // Underline - // $content = preg_replace('#<span style="text-decoration: underline?">([^<]+)</span>#iU', '<u>\1</u>', $content); + // $content = preg_replace('#<span style="text-decoration: underline?">([^<]+)</span>#iU', '<u>\1</u>', $content); // Remove embed Windows Media Streams $content = preg_replace( '#<\!--\[if \!IE\]>-->([^[]+)<\!--<!\[endif\]-->#si', '', $content); @@ -129,8 +144,19 @@ class helper // Remove some specials html tag, because somewhere there are a mod to allow html tags ;) $content = preg_replace( '#<(script|iframe)([^[]+)\1>#siU', ' <strong>$1</strong> ', $content); + // Parse inline images to display with the feed + if (!empty($post_attachments)) + { + $update_count = array(); + parse_attachments($forum_id, $content, $post_attachments, $update_count); + $content .= implode('<br />', $post_attachments); + + // Convert attachments' relative path to absolute path + $content = str_replace($this->phpbb_root_path . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $content); + } + // Remove Comments from inline attachments [ia] - $content = preg_replace('#<div class="(inline-attachment|attachtitle)">(.*?)<!-- ia(.*?) -->(.*?)<!-- ia(.*?) -->(.*?)</div>#si','$4',$content); + $content = preg_replace('#<dd>(.*?)</dd>#','',$content); // Replace some entities with their unicode counterpart $entities = array( diff --git a/phpBB/phpbb/feed/news.php b/phpBB/phpbb/feed/news.php index 7888e73239..fb6fa09278 100644 --- a/phpBB/phpbb/feed/news.php +++ b/phpBB/phpbb/feed/news.php @@ -1,25 +1,31 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* News feed -* -* This will give you {$this->num_items} first posts -* of all topics in the selected news forums. -* -* @package phpBB3 -*/ -class news extends \phpbb\feed\topic_base + * News feed + * + * This will give you {$this->num_items} first posts + * of all topics in the selected news forums. + */ +class news extends topic_base { - function get_news_forums() + /** + * Returns the ids of the 'news forums' + * @return int[] + */ + private function get_news_forums() { static $forum_ids; @@ -46,7 +52,10 @@ class news extends \phpbb\feed\topic_base return $forum_ids; } - function get_sql() + /** + * {@inheritdoc} + */ + protected function get_sql() { // Determine forum ids $in_fid_ary = array_intersect($this->get_news_forums(), $this->get_readable_forums()); @@ -64,9 +73,8 @@ class news extends \phpbb\feed\topic_base // We really have to get the post ids first! $sql = 'SELECT topic_first_post_id, topic_time FROM ' . TOPICS_TABLE . ' - WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . ' - AND topic_moved_id = 0 - AND topic_visibility = ' . ITEM_APPROVED . ' + WHERE topic_moved_id = 0 + AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . ' ORDER BY topic_time DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); @@ -85,7 +93,7 @@ class news extends \phpbb\feed\topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, - p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility', 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p', @@ -98,7 +106,7 @@ class news extends \phpbb\feed\topic_base ), 'WHERE' => 'p.topic_id = t.topic_id AND ' . $this->db->sql_in_set('p.post_id', $post_ids), - 'ORDER_BY' => 'p.post_time DESC', + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', ); return true; diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php index 4545ba5c64..40cf94ace0 100644 --- a/phpBB/phpbb/feed/overall.php +++ b/phpBB/phpbb/feed/overall.php @@ -1,25 +1,30 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* Board wide feed (aka overall feed) -* -* This will give you the newest {$this->num_items} posts -* from the whole board. -* -* @package phpBB3 -*/ -class overall extends \phpbb\feed\post_base + * Board wide feed (aka overall feed) + * + * This will give you the newest {$this->num_items} posts + * from the whole board. + */ +class overall extends post_base { - function get_sql() + /** + * {@inheritdoc} + */ + protected function get_sql() { $forum_ids = array_diff($this->get_readable_forums(), $this->get_excluded_forums(), $this->get_passworded_forums()); if (empty($forum_ids)) @@ -32,7 +37,7 @@ class overall extends \phpbb\feed\post_base FROM ' . TOPICS_TABLE . ' WHERE topic_moved_id = 0 AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . ' - ORDER BY topic_last_post_time DESC'; + ORDER BY topic_last_post_time DESC, topic_last_post_id DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); $topic_ids = array(); @@ -53,8 +58,8 @@ class overall extends \phpbb\feed\post_base // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . - 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . - 'u.username, u.user_id', + 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . + 'u.username, u.user_id', 'FROM' => array( USERS_TABLE => 'u', POSTS_TABLE => 'p', @@ -69,13 +74,16 @@ class overall extends \phpbb\feed\post_base AND ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . ' AND p.post_time >= ' . $min_post_time . ' AND u.user_id = p.poster_id', - 'ORDER_BY' => 'p.post_time DESC', + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', ); return true; } - function adjust_item(&$item_row, &$row) + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) { parent::adjust_item($item_row, $row); diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index 42c5eea9e3..f6dc39cbec 100644 --- a/phpBB/phpbb/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php @@ -1,24 +1,29 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* Abstract class for post based feeds -* -* @package phpBB3 -*/ -abstract class post_base extends \phpbb\feed\base + * Abstract class for post based feeds + */ +abstract class post_base extends attachments_base { - var $num_items = 'feed_limit_post'; + protected $num_items = 'feed_limit_post'; - function set_keys() + /** + * {@inheritdoc} + */ + public function set_keys() { $this->set('title', 'post_subject'); $this->set('title2', 'topic_title'); @@ -37,7 +42,10 @@ abstract class post_base extends \phpbb\feed\base $this->set('enable_magic_url', 'enable_magic_url'); } - function adjust_item(&$item_row, &$row) + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) { $item_row['link'] = $this->helper->append_sid('viewtopic.' . $this->phpEx, "t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}"); @@ -45,7 +53,8 @@ abstract class post_base extends \phpbb\feed\base { $item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) . ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')]) - . (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : ''); + . (($this->is_moderator_approve_forum($row['forum_id']) && (int) $row['post_visibility'] === ITEM_UNAPPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '') + . (($this->is_moderator_approve_forum($row['forum_id']) && (int) $row['post_visibility'] === ITEM_DELETED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_DELETED'] : ''); } } } diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 09f377dd10..f029c2b00e 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -1,33 +1,40 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; +use phpbb\feed\exception\no_feed_exception; +use phpbb\feed\exception\no_topic_exception; +use phpbb\feed\exception\unauthorized_forum_exception; +use phpbb\feed\exception\unauthorized_topic_exception; + /** -* Topic feed for a specific topic -* -* This will give you the last {$this->num_items} posts made within this topic. -* -* @package phpBB3 -*/ -class topic extends \phpbb\feed\post_base + * Topic feed for a specific topic + * + * This will give you the last {$this->num_items} posts made within this topic. + */ +class topic extends post_base { - var $topic_id = 0; - var $forum_id = 0; - var $topic_data = array(); + protected $topic_id = 0; + protected $forum_id = 0; + protected $topic_data = array(); /** - * Set the Topic ID - * - * @param int $topic_id Topic ID - * @return \phpbb\feed\topic - */ + * Set the Topic ID + * + * @param int $topic_id Topic ID + * @return \phpbb\feed\topic + */ public function set_topic_id($topic_id) { $this->topic_id = (int) $topic_id; @@ -35,7 +42,10 @@ class topic extends \phpbb\feed\post_base return $this; } - function open() + /** + * {@inheritdoc} + */ + public function open() { $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type FROM ' . TOPICS_TABLE . ' t @@ -48,7 +58,7 @@ class topic extends \phpbb\feed\post_base if (empty($this->topic_data)) { - trigger_error('NO_TOPIC'); + throw new no_topic_exception($this->topic_id); } $this->forum_id = (int) $this->topic_data['forum_id']; @@ -56,19 +66,19 @@ class topic extends \phpbb\feed\post_base // Make sure topic is either approved or user authed if ($this->topic_data['topic_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $this->forum_id)) { - trigger_error('SORRY_AUTH_READ'); + throw new unauthorized_topic_exception($this->topic_id); } // Make sure forum is not excluded from feed if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options'])) { - trigger_error('NO_FEED'); + throw new no_feed_exception(); } // Make sure we can read this forum if (!$this->auth->acl_get('f_read', $this->forum_id)) { - trigger_error('SORRY_AUTH_READ'); + throw new unauthorized_forum_exception($this->forum_id); } // Make sure forum is not passworded or user is authed @@ -78,18 +88,23 @@ class topic extends \phpbb\feed\post_base if (isset($forum_ids_passworded[$this->forum_id])) { - trigger_error('SORRY_AUTH_READ'); + throw new unauthorized_forum_exception($this->forum_id); } unset($forum_ids_passworded); } + + parent::open(); } - function get_sql() + /** + * {@inheritdoc} + */ + protected function get_sql() { $this->sql = array( - 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . - 'u.username, u.user_id', + 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . + 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', USERS_TABLE => 'u', @@ -97,13 +112,26 @@ class topic extends \phpbb\feed\post_base 'WHERE' => 'p.topic_id = ' . $this->topic_id . ' AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . ' AND p.poster_id = u.user_id', - 'ORDER_BY' => 'p.post_time DESC', + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', ); return true; } - function get_item() + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) + { + parent::adjust_item($item_row, $row); + + $item_row['forum_id'] = $this->forum_id; + } + + /** + * {@inheritdoc} + */ + public function get_item() { return ($row = parent::get_item()) ? array_merge($this->topic_data, $row) : $row; } diff --git a/phpBB/phpbb/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php index 7e28e67b82..0f1a9ccb70 100644 --- a/phpBB/phpbb/feed/topic_base.php +++ b/phpBB/phpbb/feed/topic_base.php @@ -1,24 +1,29 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* Abstract class for topic based feeds -* -* @package phpBB3 -*/ -abstract class topic_base extends \phpbb\feed\base + * Abstract class for topic based feeds + */ +abstract class topic_base extends attachments_base { - var $num_items = 'feed_limit_topic'; + protected $num_items = 'feed_limit_topic'; - function set_keys() + /** + * {@inheritdoc} + */ + public function set_keys() { $this->set('title', 'topic_title'); $this->set('title2', 'forum_name'); @@ -37,7 +42,10 @@ abstract class topic_base extends \phpbb\feed\base $this->set('enable_magic_url', 'enable_magic_url'); } - function adjust_item(&$item_row, &$row) + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) { $item_row['link'] = $this->helper->append_sid('viewtopic.' . $this->phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); @@ -45,9 +53,24 @@ abstract class topic_base extends \phpbb\feed\base { $item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) . ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')]) - . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . $this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1 - . ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views'] - . (($this->is_moderator_approve_forum($row['forum_id']) && $row['topic_posts_unapproved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : ''); + . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . ($this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1) + . ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views']; + + if ($this->is_moderator_approve_forum($row['forum_id'])) + { + if ((int) $row['topic_visibility'] === ITEM_DELETED) + { + $item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['TOPIC_DELETED']; + } + else if ((int) $row['topic_visibility'] === ITEM_UNAPPROVED) + { + $item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['TOPIC_UNAPPROVED']; + } + else if ($row['topic_posts_unapproved']) + { + $item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED']; + } + } } } } diff --git a/phpBB/phpbb/feed/topics.php b/phpBB/phpbb/feed/topics.php index bdc858e947..cf4a2e579e 100644 --- a/phpBB/phpbb/feed/topics.php +++ b/phpBB/phpbb/feed/topics.php @@ -1,25 +1,30 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* New Topics feed -* -* This will give you the last {$this->num_items} created topics -* including the first post. -* -* @package phpBB3 -*/ -class topics extends \phpbb\feed\topic_base + * New Topics feed + * + * This will give you the last {$this->num_items} created topics + * including the first post. + */ +class topics extends topic_base { - function get_sql() + /** + * {@inheritdoc} + */ + protected function get_sql() { $forum_ids_read = $this->get_readable_forums(); if (empty($forum_ids_read)) @@ -36,9 +41,8 @@ class topics extends \phpbb\feed\topic_base // We really have to get the post ids first! $sql = 'SELECT topic_first_post_id, topic_time FROM ' . TOPICS_TABLE . ' - WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . ' - AND topic_moved_id = 0 - AND topic_visibility = ' . ITEM_APPROVED . ' + WHERE topic_moved_id = 0 + AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . ' ORDER BY topic_time DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); @@ -57,7 +61,7 @@ class topics extends \phpbb\feed\topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, - p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility', 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p', @@ -70,13 +74,16 @@ class topics extends \phpbb\feed\topic_base ), 'WHERE' => 'p.topic_id = t.topic_id AND ' . $this->db->sql_in_set('p.post_id', $post_ids), - 'ORDER_BY' => 'p.post_time DESC', + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', ); return true; } - function adjust_item(&$item_row, &$row) + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) { parent::adjust_item($item_row, $row); diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php index cc0adac2eb..52340dc2d5 100644 --- a/phpBB/phpbb/feed/topics_active.php +++ b/phpBB/phpbb/feed/topics_active.php @@ -1,28 +1,33 @@ <?php /** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ namespace phpbb\feed; /** -* Active Topics feed -* -* This will give you the last {$this->num_items} topics -* with replies made withing the last {$this->sort_days} days -* including the last post. -* -* @package phpBB3 -*/ -class topics_active extends \phpbb\feed\topic_base + * Active Topics feed + * + * This will give you the last {$this->num_items} topics + * with replies made withing the last {$this->sort_days} days + * including the last post. + */ +class topics_active extends topic_base { - var $sort_days = 7; + protected $sort_days = 7; - function set_keys() + /** + * {@inheritdoc} + */ + public function set_keys() { parent::set_keys(); @@ -30,7 +35,10 @@ class topics_active extends \phpbb\feed\topic_base $this->set('creator', 'topic_last_poster_name'); } - function get_sql() + /** + * {@inheritdoc} + */ + protected function get_sql() { $forum_ids_read = $this->get_readable_forums(); if (empty($forum_ids_read)) @@ -51,11 +59,10 @@ class topics_active extends \phpbb\feed\topic_base // We really have to get the post ids first! $sql = 'SELECT topic_last_post_id, topic_last_post_time FROM ' . TOPICS_TABLE . ' - WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . ' - AND topic_moved_id = 0 - AND topic_visibility = ' . ITEM_APPROVED . ' + WHERE topic_moved_id = 0 + AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . ' ' . $last_post_time_sql . ' - ORDER BY topic_last_post_time DESC'; + ORDER BY topic_last_post_time DESC, topic_last_post_id DESC'; $result = $this->db->sql_query_limit($sql, $this->num_items); $post_ids = array(); @@ -74,7 +81,7 @@ class topics_active extends \phpbb\feed\topic_base 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time, - p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility', 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p', @@ -87,13 +94,18 @@ class topics_active extends \phpbb\feed\topic_base ), 'WHERE' => 'p.topic_id = t.topic_id AND ' . $this->db->sql_in_set('p.post_id', $post_ids), - 'ORDER_BY' => 'p.post_time DESC', + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', ); return true; } - function get_forum_ids() + /** + * Returns the ids of the forums not excluded from the active list + * + * @return int[] + */ + private function get_forum_ids() { static $forum_ids; @@ -121,7 +133,10 @@ class topics_active extends \phpbb\feed\topic_base return $forum_ids; } - function adjust_item(&$item_row, &$row) + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) { parent::adjust_item($item_row, $row); diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php new file mode 100644 index 0000000000..ab9505a14c --- /dev/null +++ b/phpBB/phpbb/file_downloader.php @@ -0,0 +1,120 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +class file_downloader +{ + /** @var string Error string */ + protected $error_string = ''; + + /** @var int Error number */ + protected $error_number = 0; + + /** + * Retrieve contents from remotely stored file + * + * @param string $host File host + * @param string $directory Directory file is in + * @param string $filename Filename of file to retrieve + * @param int $port Port to connect to; default: 80 + * @param int $timeout Connection timeout in seconds; default: 6 + * + * @return mixed File data as string if file can be read and there is no + * timeout, false if there were errors or the connection timed out + * + * @throws \phpbb\exception\runtime_exception If data can't be retrieved and no error + * message is returned + */ + public function get($host, $directory, $filename, $port = 80, $timeout = 6) + { + // Set default values for error variables + $this->error_number = 0; + $this->error_string = ''; + + if ($socket = @fsockopen(($port == 443 ? 'tls://' : '') . $host, $port, $this->error_number, $this->error_string, $timeout)) + { + @fputs($socket, "GET $directory/$filename HTTP/1.0\r\n"); + @fputs($socket, "HOST: $host\r\n"); + @fputs($socket, "Connection: close\r\n\r\n"); + + $timer_stop = time() + $timeout; + stream_set_timeout($socket, $timeout); + + $file_info = ''; + $get_info = false; + + while (!@feof($socket)) + { + if ($get_info) + { + $file_info .= @fread($socket, 1024); + } + else + { + $line = @fgets($socket, 1024); + if ($line == "\r\n") + { + $get_info = true; + } + else if (stripos($line, '404 not found') !== false) + { + throw new \phpbb\exception\runtime_exception('FILE_NOT_FOUND', array($filename)); + } + } + + $stream_meta_data = stream_get_meta_data($socket); + + if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) + { + throw new \phpbb\exception\runtime_exception('FSOCK_TIMEOUT'); + } + } + @fclose($socket); + } + else + { + if ($this->error_string) + { + $this->error_string = utf8_convert_message($this->error_string); + return false; + } + else + { + throw new \phpbb\exception\runtime_exception('FSOCK_DISABLED'); + } + } + + return $file_info; + } + + /** + * Get error string + * + * @return string Error string + */ + public function get_error_string() + { + return $this->error_string; + } + + /** + * Get error number + * + * @return int Error number + */ + public function get_error_number() + { + return $this->error_number; + } +} diff --git a/phpBB/phpbb/files/factory.php b/phpBB/phpbb/files/factory.php new file mode 100644 index 0000000000..84b7cc9449 --- /dev/null +++ b/phpBB/phpbb/files/factory.php @@ -0,0 +1,58 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files; + +class factory +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + private $container; + + /** + * Constructor + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + */ + public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Get files service + * + * @param string $name Service name + * + * @return object|bool Requested service or false if service could not be + * found by the container + */ + public function get($name) + { + $service = false; + + $name = (strpos($name, '.') === false) ? 'files.' . $name : $name; + + try + { + $service = $this->container->get($name); + } + catch (\Exception $e) + { + // do nothing + } + + return $service; + } +} diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php new file mode 100644 index 0000000000..2ff2a92c83 --- /dev/null +++ b/phpBB/phpbb/files/filespec.php @@ -0,0 +1,584 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files; + +use phpbb\language\language; + +/** + * Responsible for holding all file relevant information, as well as doing file-specific operations. + * The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on. + */ +class filespec +{ + /** @var string File name */ + protected $filename = ''; + + /** @var string Real name of file */ + protected $realname = ''; + + /** @var string Upload name of file */ + protected $uploadname = ''; + + /** @var string Mimetype of file */ + protected $mimetype = ''; + + /** @var string File extension */ + protected $extension = ''; + + /** @var int File size */ + protected $filesize = 0; + + /** @var int Width of file */ + protected $width = 0; + + /** @var int Height of file */ + protected $height = 0; + + /** @var array Image info including type and size */ + protected $image_info = array(); + + /** @var string Destination file name */ + protected $destination_file = ''; + + /** @var string Destination file path */ + protected $destination_path = ''; + + /** @var bool Whether file was moved */ + protected $file_moved = false; + + /** @var bool Whether file is local */ + protected $local = false; + + /** @var bool Class initialization flag */ + protected $class_initialized = false; + + /** @var array Error array */ + public $error = array(); + + /** @var upload Instance of upload class */ + public $upload; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper class */ + protected $php_ini; + + /** @var \FastImageSize\FastImageSize */ + protected $imagesize; + + /** @var language Language class */ + protected $language; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var \phpbb\plupload\plupload The plupload object */ + protected $plupload; + + /** @var \phpbb\mimetype\guesser phpBB Mimetype guesser */ + protected $mimetype_guesser; + + /** + * File upload class + * + * @param \phpbb\filesystem\filesystem_interface $phpbb_filesystem Filesystem + * @param language $language Language + * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper + * @param \FastImageSize\FastImageSize $imagesize Imagesize class + * @param string $phpbb_root_path phpBB root path + * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser + * @param \phpbb\plupload\plupload $plupload Plupload + */ + public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) + { + $this->filesystem = $phpbb_filesystem; + $this->language = $language; + $this->php_ini = $php_ini; + $this->imagesize = $imagesize; + $this->phpbb_root_path = $phpbb_root_path; + $this->plupload = $plupload; + $this->mimetype_guesser = $mimetype_guesser; + } + + /** + * Set upload ary + * + * @param array $upload_ary Upload ary + * + * @return filespec This instance of the filespec class + */ + public function set_upload_ary($upload_ary) + { + if (!isset($upload_ary) || !sizeof($upload_ary)) + { + return $this; + } + + $this->class_initialized = true; + $this->filename = $upload_ary['tmp_name']; + $this->filesize = $upload_ary['size']; + $name = (STRIP) ? stripslashes($upload_ary['name']) : $upload_ary['name']; + $name = trim(utf8_basename($name)); + $this->realname = $this->uploadname = $name; + $this->mimetype = $upload_ary['type']; + + // Opera adds the name to the mime type + $this->mimetype = (strpos($this->mimetype, '; name') !== false) ? str_replace(strstr($this->mimetype, '; name'), '', $this->mimetype) : $this->mimetype; + + if (!$this->mimetype) + { + $this->mimetype = 'application/octet-stream'; + } + + $this->extension = strtolower(self::get_extension($this->realname)); + + // Try to get real filesize from temporary folder (not always working) ;) + $this->filesize = ($this->get_filesize($this->filename)) ?: $this->filesize; + + $this->width = $this->height = 0; + $this->file_moved = false; + + $this->local = (isset($upload_ary['local_mode'])) ? true : false; + + return $this; + } + + /** + * Set the upload namespace + * + * @param upload $namespace Instance of upload class + * + * @return filespec This instance of the filespec class + */ + public function set_upload_namespace($namespace) + { + $this->upload = $namespace; + + return $this; + } + + /** + * Check if class members were not properly initialised yet + * + * @return bool True if there was an init error, false if not + */ + public function init_error() + { + return !$this->class_initialized; + } + + /** + * Set error in error array + * + * @param mixed $error Content for error array + * + * @return \phpbb\files\filespec This instance of the filespec class + */ + public function set_error($error) + { + $this->error[] = $error; + + return $this; + } + + /** + * Cleans destination filename + * + * @param string $mode Either real, unique, or unique_ext. Real creates a + * realname, filtering some characters, lowering every + * character. Unique creates a unique filename. + * @param string $prefix Prefix applied to filename + * @param string $user_id The user_id is only needed for when cleaning a user's avatar + */ + public function clean_filename($mode = 'unique', $prefix = '', $user_id = '') + { + if ($this->init_error()) + { + return; + } + + switch ($mode) + { + case 'real': + // Remove every extension from filename (to not let the mime bug being exposed) + if (strpos($this->realname, '.') !== false) + { + $this->realname = substr($this->realname, 0, strpos($this->realname, '.')); + } + + // Replace any chars which may cause us problems with _ + $bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|'); + + $this->realname = rawurlencode(str_replace($bad_chars, '_', strtolower($this->realname))); + $this->realname = preg_replace("/%(\w{2})/", '_', $this->realname); + + $this->realname = $prefix . $this->realname . '.' . $this->extension; + break; + + case 'unique': + $this->realname = $prefix . md5(unique_id()); + break; + + case 'avatar': + $this->extension = strtolower($this->extension); + $this->realname = $prefix . $user_id . '.' . $this->extension; + + break; + + case 'unique_ext': + default: + $this->realname = $prefix . md5(unique_id()) . '.' . $this->extension; + } + } + + /** + * Get property from file object + * + * @param string $property Name of property + * + * @return mixed Content of property + */ + public function get($property) + { + if ($this->init_error() || !isset($this->$property)) + { + return false; + } + + return $this->$property; + } + + /** + * Check if file is an image (mime type) + * + * @return bool true if it is an image, false if not + */ + public function is_image() + { + return (strpos($this->mimetype, 'image/') === 0); + } + + /** + * Check if the file got correctly uploaded + * + * @return bool true if it is a valid upload, false if not + */ + public function is_uploaded() + { + $is_plupload = $this->plupload && $this->plupload->is_active(); + + if (!$this->local && !$is_plupload && !is_uploaded_file($this->filename)) + { + return false; + } + + if (($this->local || $is_plupload) && !file_exists($this->filename)) + { + return false; + } + + return true; + } + + /** + * Remove file + */ + public function remove() + { + if ($this->file_moved) + { + @unlink($this->destination_file); + } + } + + /** + * Get file extension + * + * @param string $filename Filename that needs to be checked + * + * @return string Extension of the supplied filename + */ + static public function get_extension($filename) + { + $filename = utf8_basename($filename); + + if (strpos($filename, '.') === false) + { + return ''; + } + + $filename = explode('.', $filename); + return array_pop($filename); + } + + /** + * Get mime type + * + * @param string $filename Filename that needs to be checked + * @return string Mime type of supplied filename + */ + public function get_mimetype($filename) + { + if ($this->mimetype_guesser !== null) + { + $mimetype = $this->mimetype_guesser->guess($filename, $this->uploadname); + + if ($mimetype !== 'application/octet-stream') + { + $this->mimetype = $mimetype; + } + } + + return $this->mimetype; + } + + /** + * Get file size + * + * @param string $filename File name of file to check + * + * @return int File size + */ + public function get_filesize($filename) + { + return @filesize($filename); + } + + + /** + * Check the first 256 bytes for forbidden content + * + * @param array $disallowed_content Array containg disallowed content + * + * @return bool False if disallowed content found, true if not + */ + public function check_content($disallowed_content) + { + if (empty($disallowed_content)) + { + return true; + } + + $fp = @fopen($this->filename, 'rb'); + + if ($fp !== false) + { + $ie_mime_relevant = fread($fp, 256); + fclose($fp); + foreach ($disallowed_content as $forbidden) + { + if (stripos($ie_mime_relevant, '<' . $forbidden) !== false) + { + return false; + } + } + } + return true; + } + + /** + * Move file to destination folder + * The phpbb_root_path variable will be applied to the destination path + * + * @param string $destination Destination path, for example $config['avatar_path'] + * @param bool $overwrite If set to true, an already existing file will be overwritten + * @param bool $skip_image_check If set to true, the check for the file to be a valid image is skipped + * @param string|bool $chmod Permission mask for chmodding the file after a successful move. + * The mode entered here reflects the mode defined by {@link phpbb_chmod()} + * + * @return bool True if file was moved, false if not + * @access public + */ + public function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) + { + if (sizeof($this->error)) + { + return false; + } + + $chmod = ($chmod === false) ? CHMOD_READ | CHMOD_WRITE : $chmod; + + // We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it... + $this->destination_path = $this->phpbb_root_path . $destination; + + // Check if the destination path exist... + if (!file_exists($this->destination_path)) + { + @unlink($this->filename); + return false; + } + + $upload_mode = ($this->php_ini->getBool('open_basedir') || $this->php_ini->getBool('safe_mode')) ? 'move' : 'copy'; + $upload_mode = ($this->local) ? 'local' : $upload_mode; + $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); + + // Check if the file already exist, else there is something wrong... + if (file_exists($this->destination_file) && !$overwrite) + { + @unlink($this->filename); + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + $this->file_moved = false; + return false; + } + else + { + if (file_exists($this->destination_file)) + { + @unlink($this->destination_file); + } + + switch ($upload_mode) + { + case 'copy': + + if (!@copy($this->filename, $this->destination_file)) + { + if (!@move_uploaded_file($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + } + + break; + + case 'move': + + if (!@move_uploaded_file($this->filename, $this->destination_file)) + { + if (!@copy($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + } + + break; + + case 'local': + + if (!@copy($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + + break; + } + + // Remove temporary filename + @unlink($this->filename); + + if (sizeof($this->error)) + { + return false; + } + + try + { + $this->filesystem->phpbb_chmod($this->destination_file, $chmod); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + // Try to get real filesize from destination folder + $this->filesize = ($this->get_filesize($this->destination_file)) ?: $this->filesize; + + // Get mimetype of supplied file + $this->mimetype = $this->get_mimetype($this->destination_file); + + if ($this->is_image() && !$skip_image_check) + { + $this->width = $this->height = 0; + + $this->image_info = $this->imagesize->getImageSize($this->destination_file, $this->mimetype); + + if ($this->image_info !== false) + { + $this->width = $this->image_info['width']; + $this->height = $this->image_info['height']; + + // Check image type + $types = upload::image_types(); + + if (!isset($types[$this->image_info['type']]) || !in_array($this->extension, $types[$this->image_info['type']])) + { + if (!isset($types[$this->image_info['type']])) + { + $this->error[] = $this->language->lang('IMAGE_FILETYPE_INVALID', $this->image_info['type'], $this->mimetype); + } + else + { + $this->error[] = $this->language->lang('IMAGE_FILETYPE_MISMATCH', $types[$this->image_info['type']][0], $this->extension); + } + } + + // Make sure the dimensions match a valid image + if (empty($this->width) || empty($this->height)) + { + $this->error[] = $this->language->lang('ATTACHED_IMAGE_NOT_IMAGE'); + } + } + else + { + $this->error[] = $this->language->lang('UNABLE_GET_IMAGE_SIZE'); + } + } + + $this->file_moved = true; + $this->additional_checks(); + unset($this->upload); + + return true; + } + + /** + * Performing additional checks + * + * @return bool False if issue was found, true if not + */ + public function additional_checks() + { + if (!$this->file_moved) + { + return false; + } + + // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form + if ($this->upload->max_filesize && ($this->get('filesize') > $this->upload->max_filesize || $this->filesize == 0)) + { + $max_filesize = get_formatted_filesize($this->upload->max_filesize, false); + + $this->error[] = $this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']); + + return false; + } + + if (!$this->upload->valid_dimensions($this)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'WRONG_SIZE', + $this->language->lang('PIXELS', (int) $this->upload->min_width), + $this->language->lang('PIXELS', (int) $this->upload->min_height), + $this->language->lang('PIXELS', (int) $this->upload->max_width), + $this->language->lang('PIXELS', (int) $this->upload->max_height), + $this->language->lang('PIXELS', (int) $this->width), + $this->language->lang('PIXELS', (int) $this->height)); + + return false; + } + + return true; + } +} diff --git a/phpBB/phpbb/files/types/base.php b/phpBB/phpbb/files/types/base.php new file mode 100644 index 0000000000..3313ad040b --- /dev/null +++ b/phpBB/phpbb/files/types/base.php @@ -0,0 +1,65 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files\types; + +abstract class base implements type_interface +{ + /** @var \phpbb\language\language */ + protected $language; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\files\upload */ + protected $upload; + + /** + * Check if upload exceeds maximum file size + * + * @param \phpbb\files\filespec $file Filespec object + * + * @return \phpbb\files\filespec Returns same filespec instance + */ + public function check_upload_size($file) + { + // PHP Upload filesize exceeded + if ($file->get('filename') == 'none') + { + $max_filesize = $this->php_ini->getString('upload_max_filesize'); + $unit = 'MB'; + + if (!empty($max_filesize)) + { + $unit = strtolower(substr($max_filesize, -1, 1)); + $max_filesize = (int) $max_filesize; + + $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB'); + } + + $file->error[] = (empty($max_filesize)) ? $this->language->lang($this->upload->error_prefix . 'PHP_SIZE_NA') : $this->language->lang($this->upload->error_prefix . 'PHP_SIZE_OVERRUN', $max_filesize, $this->language->lang($unit)); + } + + return $file; + } + + /** + * {@inheritdoc} + */ + public function set_upload(\phpbb\files\upload $upload) + { + $this->upload = $upload; + + return $this; + } +} diff --git a/phpBB/phpbb/files/types/form.php b/phpBB/phpbb/files/types/form.php new file mode 100644 index 0000000000..832f090c47 --- /dev/null +++ b/phpBB/phpbb/files/types/form.php @@ -0,0 +1,138 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files\types; + +use bantu\IniGetWrapper\IniGetWrapper; +use phpbb\files\factory; +use phpbb\files\filespec; +use phpbb\language\language; +use phpbb\plupload\plupload; +use phpbb\request\request_interface; + +class form extends base +{ + /** @var factory Files factory */ + protected $factory; + + /** @var language */ + protected $language; + + /** @var IniGetWrapper */ + protected $php_ini; + + /** @var plupload */ + protected $plupload; + + /** @var request_interface */ + protected $request; + + /** @var \phpbb\files\upload */ + protected $upload; + + /** + * Construct a form upload type + * + * @param factory $factory Files factory + * @param language $language Language class + * @param IniGetWrapper $php_ini ini_get() wrapper + * @param plupload $plupload Plupload + * @param request_interface $request Request object + */ + public function __construct(factory $factory, language $language, IniGetWrapper $php_ini, plupload $plupload, request_interface $request) + { + $this->factory = $factory; + $this->language = $language; + $this->php_ini = $php_ini; + $this->plupload = $plupload; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function upload() + { + $args = func_get_args(); + return $this->form_upload($args[0]); + } + + /** + * Form upload method + * Upload file from users harddisk + * + * @param string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified) + * + * @return filespec $file Object "filespec" is returned, all further operations can be done with this object + * @access public + */ + protected function form_upload($form_name) + { + $upload = $this->request->file($form_name); + unset($upload['local_mode']); + + $result = $this->plupload->handle_upload($form_name); + if (is_array($result)) + { + $upload = array_merge($upload, $result); + } + + /** @var filespec $file */ + $file = $this->factory->get('filespec') + ->set_upload_ary($upload) + ->set_upload_namespace($this->upload); + + if ($file->init_error()) + { + $file->error[] = ''; + return $file; + } + + // Error array filled? + if (isset($upload['error'])) + { + $error = $this->upload->assign_internal_error($upload['error']); + + if ($error !== false) + { + $file->error[] = $error; + return $file; + } + } + + // Check if empty file got uploaded (not catched by is_uploaded_file) + if (isset($upload['size']) && $upload['size'] == 0) + { + $file->error[] = $this->language->lang($this->upload->error_prefix . 'EMPTY_FILEUPLOAD'); + return $file; + } + + // PHP Upload file size check + $file = $this->check_upload_size($file); + if (sizeof($file->error)) + { + return $file; + } + + // Not correctly uploaded + if (!$file->is_uploaded()) + { + $file->error[] = $this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED'); + return $file; + } + + $this->upload->common_checks($file); + + return $file; + } +} diff --git a/phpBB/phpbb/files/types/local.php b/phpBB/phpbb/files/types/local.php new file mode 100644 index 0000000000..7e9210b196 --- /dev/null +++ b/phpBB/phpbb/files/types/local.php @@ -0,0 +1,136 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files\types; + +use bantu\IniGetWrapper\IniGetWrapper; +use phpbb\files\factory; +use phpbb\files\filespec; +use phpbb\language\language; +use phpbb\request\request_interface; + +class local extends base +{ + /** @var factory Files factory */ + protected $factory; + + /** @var language */ + protected $language; + + /** @var IniGetWrapper */ + protected $php_ini; + + /** @var request_interface */ + protected $request; + + /** @var \phpbb\files\upload */ + protected $upload; + + /** + * Construct a form upload type + * + * @param factory $factory Files factory + * @param language $language Language class + * @param IniGetWrapper $php_ini ini_get() wrapper + * @param request_interface $request Request object + */ + public function __construct(factory $factory, language $language, IniGetWrapper $php_ini, request_interface $request) + { + $this->factory = $factory; + $this->language = $language; + $this->php_ini = $php_ini; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function upload() + { + $args = func_get_args(); + return $this->local_upload($args[0], isset($args[1]) ? $args[1] : false); + } + + /** + * Move file from another location to phpBB + * + * @param string $source_file Filename of source file + * @param array|bool $filedata Array with filedata or false + * + * @return filespec Object "filespec" is returned, all further operations can be done with this object + */ + protected function local_upload($source_file, $filedata = false) + { + $upload = $this->get_upload_ary($source_file, $filedata); + + /** @var filespec $file */ + $file = $this->factory->get('filespec') + ->set_upload_ary($upload) + ->set_upload_namespace($this->upload); + + if ($file->init_error()) + { + $file->error[] = ''; + return $file; + } + + // PHP Upload file size check + $file = $this->check_upload_size($file); + if (sizeof($file->error)) + { + return $file; + } + + // Not correctly uploaded + if (!$file->is_uploaded()) + { + $file->error[] = $this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED'); + return $file; + } + + $this->upload->common_checks($file); + $this->request->overwrite('local', $upload, request_interface::FILES); + + return $file; + } + + /** + * Retrieve upload array + * + * @param string $source_file Source file name + * @param array $filedata File data array + * + * @return array Upload array + */ + protected function get_upload_ary($source_file, $filedata) + { + $upload = array(); + + $upload['local_mode'] = true; + $upload['tmp_name'] = $source_file; + + if ($filedata === false) + { + $upload['name'] = utf8_basename($source_file); + $upload['size'] = 0; + } + else + { + $upload['name'] = $filedata['realname']; + $upload['size'] = $filedata['size']; + $upload['type'] = $filedata['type']; + } + + return $upload; + } +} diff --git a/phpBB/phpbb/files/types/remote.php b/phpBB/phpbb/files/types/remote.php new file mode 100644 index 0000000000..33cbfb00ae --- /dev/null +++ b/phpBB/phpbb/files/types/remote.php @@ -0,0 +1,258 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files\types; + +use bantu\IniGetWrapper\IniGetWrapper; +use phpbb\files\factory; +use phpbb\files\filespec; +use phpbb\language\language; +use phpbb\request\request_interface; + +class remote extends base +{ + /** @var factory Files factory */ + protected $factory; + + /** @var language */ + protected $language; + + /** @var IniGetWrapper */ + protected $php_ini; + + /** @var request_interface */ + protected $request; + + /** @var \phpbb\files\upload */ + protected $upload; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** + * Construct a form upload type + * + * @param factory $factory Files factory + * @param language $language Language class + * @param IniGetWrapper $php_ini ini_get() wrapper + * @param request_interface $request Request object + * @param string $phpbb_root_path phpBB root path + */ + public function __construct(factory $factory, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path) + { + $this->factory = $factory; + $this->language = $language; + $this->php_ini = $php_ini; + $this->request = $request; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * {@inheritdoc} + */ + public function upload() + { + $args = func_get_args(); + return $this->remote_upload($args[0]); + } + + /** + * Remote upload method + * Uploads file from given url + * + * @param string $upload_url URL pointing to file to upload, for example http://www.foobar.com/example.gif + * @return filespec $file Object "filespec" is returned, all further operations can be done with this object + * @access public + */ + protected function remote_upload($upload_url) + { + $upload_ary = array(); + $upload_ary['local_mode'] = true; + + if (!preg_match('#^(https?://).*?\.(' . implode('|', $this->upload->allowed_extensions) . ')$#i', $upload_url, $match)) + { + return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'URL_INVALID')); + } + + $url = parse_url($upload_url); + + $host = $url['host']; + $path = $url['path']; + $port = (!empty($url['port'])) ? (int) $url['port'] : 80; + + $upload_ary['type'] = 'application/octet-stream'; + + $url['path'] = explode('.', $url['path']); + $ext = array_pop($url['path']); + + $url['path'] = implode('', $url['path']); + $upload_ary['name'] = utf8_basename($url['path']) . (($ext) ? '.' . $ext : ''); + $filesize = 0; + + $remote_max_filesize = $this->get_max_file_size(); + + $errno = 0; + $errstr = ''; + + if (!($fsock = @fsockopen($host, $port, $errno, $errstr))) + { + return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED')); + } + + // Make sure $path not beginning with / + if (strpos($path, '/') === 0) + { + $path = substr($path, 1); + } + + fputs($fsock, 'GET /' . $path . " HTTP/1.1\r\n"); + fputs($fsock, "HOST: " . $host . "\r\n"); + fputs($fsock, "Connection: close\r\n\r\n"); + + // Set a proper timeout for the socket + socket_set_timeout($fsock, $this->upload->upload_timeout); + + $get_info = false; + $data = ''; + $length = false; + $timer_stop = time() + $this->upload->upload_timeout; + + while ((!$length || $filesize < $length) && !@feof($fsock)) + { + if ($get_info) + { + if ($length) + { + // Don't attempt to read past end of file if server indicated length + $block = @fread($fsock, min($length - $filesize, 1024)); + } + else + { + $block = @fread($fsock, 1024); + } + + $filesize += strlen($block); + + if ($remote_max_filesize && $filesize > $remote_max_filesize) + { + $max_filesize = get_formatted_filesize($remote_max_filesize, false); + + return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit'])); + } + + $data .= $block; + } + else + { + $line = @fgets($fsock, 1024); + + if ($line == "\r\n") + { + $get_info = true; + } + else + { + if (stripos($line, 'content-type: ') !== false) + { + $upload_ary['type'] = rtrim(str_replace('content-type: ', '', strtolower($line))); + } + else if ($this->upload->max_filesize && stripos($line, 'content-length: ') !== false) + { + $length = (int) str_replace('content-length: ', '', strtolower($line)); + + if ($remote_max_filesize && $length && $length > $remote_max_filesize) + { + $max_filesize = get_formatted_filesize($remote_max_filesize, false); + + return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit'])); + } + } + else if (stripos($line, '404 not found') !== false) + { + return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'URL_NOT_FOUND'); + } + } + } + + $stream_meta_data = stream_get_meta_data($fsock); + + // Cancel upload if we exceed timeout + if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) + { + return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'REMOTE_UPLOAD_TIMEOUT'); + } + } + @fclose($fsock); + + if (empty($data)) + { + return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'EMPTY_REMOTE_DATA'); + } + + $filename = tempnam(sys_get_temp_dir(), unique_id() . '-'); + + if (!($fp = @fopen($filename, 'wb'))) + { + return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'NOT_UPLOADED'); + } + + $upload_ary['size'] = fwrite($fp, $data); + fclose($fp); + unset($data); + + $upload_ary['tmp_name'] = $filename; + + /** @var filespec $file */ + $file = $this->factory->get('filespec') + ->set_upload_ary($upload_ary) + ->set_upload_namespace($this->upload); + $this->upload->common_checks($file); + + return $file; + } + + /** + * Get maximum file size for remote uploads + * + * @return int Maximum file size + */ + protected function get_max_file_size() + { + $max_file_size = $this->upload->max_filesize; + if (!$max_file_size) + { + $max_file_size = $this->php_ini->getString('upload_max_filesize'); + + if (!empty($max_file_size)) + { + $unit = strtolower(substr($max_file_size, -1, 1)); + $max_file_size = (int) $max_file_size; + + switch ($unit) + { + case 'g': + $max_file_size *= 1024; + // no break + case 'm': + $max_file_size *= 1024; + // no break + case 'k': + $max_file_size *= 1024; + // no break + } + } + } + + return $max_file_size; + } +} diff --git a/phpBB/phpbb/files/types/type_interface.php b/phpBB/phpbb/files/types/type_interface.php new file mode 100644 index 0000000000..e07078349a --- /dev/null +++ b/phpBB/phpbb/files/types/type_interface.php @@ -0,0 +1,38 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files\types; + +use phpbb\files\upload; + +interface type_interface +{ + /** + * Handle upload for upload types. Arguments passed to this method will be + * handled by the upload type classes themselves. + * + * @return \phpbb\files\filespec|bool Filespec instance if upload is + * successful or false if not + */ + public function upload(); + + /** + * Set upload instance + * Needs to be executed before every upload. + * + * @param upload $upload Upload instance + * + * @return type_interface Returns itself + */ + public function set_upload(upload $upload); +} diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php new file mode 100644 index 0000000000..a9bf74094d --- /dev/null +++ b/phpBB/phpbb/files/upload.php @@ -0,0 +1,390 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files; + +use phpbb\filesystem\filesystem_interface; +use phpbb\language\language; +use phpbb\request\request_interface; + +/** + * File upload class + * Init class (all parameters optional and able to be set/overwritten separately) - scope is global and valid for all uploads + */ +class upload +{ + /** @var array Allowed file extensions */ + public $allowed_extensions = array(); + + /** @var array Disallowed content */ + protected $disallowed_content = array('body', 'head', 'html', 'img', 'plaintext', 'a href', 'pre', 'script', 'table', 'title'); + + /** @var int Maximum filesize */ + public $max_filesize = 0; + + /** @var int Minimum width of images */ + public $min_width = 0; + + /** @var int Minimum height of images */ + public $min_height = 0; + + /** @var int Maximum width of images */ + public $max_width = 0; + + /** @var int Maximum height of images */ + public $max_height = 0; + + /** @var string Prefix for language variables of errors */ + public $error_prefix = ''; + + /** @var int Timeout for remote upload */ + public $upload_timeout = 6; + + /** @var filesystem_interface */ + protected $filesystem; + + /** @var \phpbb\files\factory Files factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper */ + protected $php_ini; + + /** @var \phpbb\language\language Language class */ + protected $language; + + /** @var request_interface Request class */ + protected $request; + + /** + * Init file upload class. + * + * @param filesystem_interface $filesystem + * @param factory $factory Files factory + * @param language $language Language class + * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper + * @param request_interface $request Request class + */ + public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request) + { + $this->filesystem = $filesystem; + $this->factory = $factory; + $this->language = $language; + $this->php_ini = $php_ini; + $this->request = $request; + } + + /** + * Reset vars + */ + public function reset_vars() + { + $this->max_filesize = 0; + $this->min_width = $this->min_height = $this->max_width = $this->max_height = 0; + $this->error_prefix = ''; + $this->allowed_extensions = array(); + $this->disallowed_content = array(); + } + + /** + * Set allowed extensions + * + * @param array $allowed_extensions Allowed file extensions + * + * @return \phpbb\files\upload This instance of upload + */ + public function set_allowed_extensions($allowed_extensions) + { + if ($allowed_extensions !== false && is_array($allowed_extensions)) + { + $this->allowed_extensions = $allowed_extensions; + } + + return $this; + } + + /** + * Set allowed dimensions + * + * @param int $min_width Minimum image width + * @param int $min_height Minimum image height + * @param int $max_width Maximum image width + * @param int $max_height Maximum image height + * + * @return \phpbb\files\upload This instance of upload + */ + public function set_allowed_dimensions($min_width, $min_height, $max_width, $max_height) + { + $this->min_width = (int) $min_width; + $this->min_height = (int) $min_height; + $this->max_width = (int) $max_width; + $this->max_height = (int) $max_height; + + return $this; + } + + /** + * Set maximum allowed file size + * + * @param int $max_filesize Maximum file size + * + * @return \phpbb\files\upload This instance of upload + */ + public function set_max_filesize($max_filesize) + { + if ($max_filesize !== false && (int) $max_filesize) + { + $this->max_filesize = (int) $max_filesize; + } + + return $this; + } + + /** + * Set disallowed strings + * + * @param array $disallowed_content Disallowed content + * + * @return \phpbb\files\upload This instance of upload + */ + public function set_disallowed_content($disallowed_content) + { + if ($disallowed_content !== false && is_array($disallowed_content)) + { + $this->disallowed_content = array_diff($disallowed_content, array('')); + } + + return $this; + } + + /** + * Set error prefix + * + * @param string $error_prefix Prefix for language variables of errors + * + * @return \phpbb\files\upload This instance of upload + */ + public function set_error_prefix($error_prefix) + { + $this->error_prefix = $error_prefix; + + return $this; + } + + /** + * Handle upload based on type + * + * @param string $type Upload type + * + * @return \phpbb\files\filespec|bool A filespec instance if upload was + * successful, false if there were issues or the type is not supported + */ + public function handle_upload($type) + { + $args = func_get_args(); + array_shift($args); + $type_class = $this->factory->get($type) + ->set_upload($this); + + return (is_object($type_class)) ? call_user_func_array(array($type_class, 'upload'), $args) : false; + } + + /** + * Assign internal error + * + * @param string $errorcode Error code to assign + * + * @return string Error string + * @access public + */ + public function assign_internal_error($errorcode) + { + switch ($errorcode) + { + case UPLOAD_ERR_INI_SIZE: + $max_filesize = $this->php_ini->getString('upload_max_filesize'); + $unit = 'MB'; + + if (!empty($max_filesize)) + { + $unit = strtolower(substr($max_filesize, -1, 1)); + $max_filesize = (int) $max_filesize; + + $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB'); + } + + $error = (empty($max_filesize)) ? $this->language->lang($this->error_prefix . 'PHP_SIZE_NA') : $this->language->lang($this->error_prefix . 'PHP_SIZE_OVERRUN', $max_filesize, $this->language->lang($unit)); + break; + + case UPLOAD_ERR_FORM_SIZE: + $max_filesize = get_formatted_filesize($this->max_filesize, false); + + $error = $this->language->lang($this->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']); + break; + + case UPLOAD_ERR_PARTIAL: + $error = $this->language->lang($this->error_prefix . 'PARTIAL_UPLOAD'); + break; + + case UPLOAD_ERR_NO_FILE: + $error = $this->language->lang($this->error_prefix . 'NOT_UPLOADED'); + break; + + case UPLOAD_ERR_NO_TMP_DIR: + case UPLOAD_ERR_CANT_WRITE: + $error = $this->language->lang($this->error_prefix . 'NO_TEMP_DIR'); + break; + + case UPLOAD_ERR_EXTENSION: + $error = $this->language->lang($this->error_prefix . 'PHP_UPLOAD_STOPPED'); + break; + + default: + $error = false; + break; + } + + return $error; + } + + /** + * Perform common file checks + * + * @param filespec $file Instance of filespec class + */ + public function common_checks(&$file) + { + // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form + if ($this->max_filesize && ($file->get('filesize') > $this->max_filesize || $file->get('filesize') == 0)) + { + $max_filesize = get_formatted_filesize($this->max_filesize, false); + + $file->error[] = $this->language->lang($this->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']); + } + + // check Filename + if (preg_match("#[\\/:*?\"<>|]#i", $file->get('realname'))) + { + $file->error[] = $this->language->lang($this->error_prefix . 'INVALID_FILENAME', $file->get('realname')); + } + + // Invalid Extension + if (!$this->valid_extension($file)) + { + $file->error[] = $this->language->lang($this->error_prefix . 'DISALLOWED_EXTENSION', $file->get('extension')); + } + + // MIME Sniffing + if (!$this->valid_content($file)) + { + $file->error[] = $this->language->lang($this->error_prefix . 'DISALLOWED_CONTENT'); + } + } + + /** + * Check for allowed extension + * + * @param filespec $file Instance of filespec class + * + * @return bool True if extension is allowed, false if not + */ + public function valid_extension(&$file) + { + return (in_array($file->get('extension'), $this->allowed_extensions)) ? true : false; + } + + /** + * Check for allowed dimension + * + * @param filespec $file Instance of filespec class + * + * @return bool True if dimensions are valid or no constraints set, false + * if not + */ + public function valid_dimensions(&$file) + { + if (!$this->max_width && !$this->max_height && !$this->min_width && !$this->min_height) + { + return true; + } + + if (($file->get('width') > $this->max_width && $this->max_width) || + ($file->get('height') > $this->max_height && $this->max_height) || + ($file->get('width') < $this->min_width && $this->min_width) || + ($file->get('height') < $this->min_height && $this->min_height)) + { + return false; + } + + return true; + } + + /** + * Check if form upload is valid + * + * @param string $form_name Name of form + * + * @return bool True if form upload is valid, false if not + */ + public function is_valid($form_name) + { + $upload = $this->request->file($form_name); + + return (!empty($upload) && $upload['name'] !== 'none'); + } + + + /** + * Check for bad content (IE mime-sniffing) + * + * @param filespec $file Instance of filespec class + * + * @return bool True if content is valid, false if not + */ + public function valid_content(&$file) + { + return ($file->check_content($this->disallowed_content)); + } + + /** + * Get image type/extension mapping + * + * @return array Array containing the image types and their extensions + */ + static public function image_types() + { + $result = array( + IMAGETYPE_GIF => array('gif'), + IMAGETYPE_JPEG => array('jpg', 'jpeg'), + IMAGETYPE_PNG => array('png'), + IMAGETYPE_SWF => array('swf'), + IMAGETYPE_PSD => array('psd'), + IMAGETYPE_BMP => array('bmp'), + IMAGETYPE_TIFF_II => array('tif', 'tiff'), + IMAGETYPE_TIFF_MM => array('tif', 'tiff'), + IMAGETYPE_JPC => array('jpg', 'jpeg'), + IMAGETYPE_JP2 => array('jpg', 'jpeg'), + IMAGETYPE_JPX => array('jpg', 'jpeg'), + IMAGETYPE_JB2 => array('jpg', 'jpeg'), + IMAGETYPE_IFF => array('iff'), + IMAGETYPE_WBMP => array('wbmp'), + IMAGETYPE_XBM => array('xbm'), + ); + + if (defined('IMAGETYPE_SWC')) + { + $result[IMAGETYPE_SWC] = array('swc'); + } + + return $result; + } +} diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 7878be0a5e..af56d78845 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -1,47 +1,21 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb; /** -* A class with various functions that are related to paths, files and the filesystem -* @package phpBB3 -*/ -class filesystem + * @deprecated 3.2.0-dev (To be removed 3.3.0) use \phpbb\filesystem\filesystem instead + */ +class filesystem extends \phpbb\filesystem\filesystem { - /** - * Eliminates useless . and .. components from specified path. - * - * @param string $path Path to clean - * @return string Cleaned path - */ - public function clean_path($path) - { - $exploded = explode('/', $path); - $filtered = array(); - foreach ($exploded as $part) - { - if ($part === '.' && !empty($filtered)) - { - continue; - } - - if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '..') - { - array_pop($filtered); - } - else - { - $filtered[] = $part; - } - } - $path = implode('/', $filtered); - return $path; - } } diff --git a/phpBB/phpbb/filesystem/exception/filesystem_exception.php b/phpBB/phpbb/filesystem/exception/filesystem_exception.php new file mode 100644 index 0000000000..d68fa9adf3 --- /dev/null +++ b/phpBB/phpbb/filesystem/exception/filesystem_exception.php @@ -0,0 +1,42 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\filesystem\exception; + +class filesystem_exception extends \phpbb\exception\runtime_exception +{ + /** + * Constructor + * + * @param string $message The Exception message to throw (must be a language variable). + * @param string $filename The file that caused the error. + * @param array $parameters The parameters to use with the language var. + * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining. + * @param integer $code The Exception code. + */ + public function __construct($message = "", $filename = '', $parameters = array(), \Exception $previous = null, $code = 0) + { + parent::__construct($message, array_merge(array('filename' => $filename), $parameters), $previous, $code); + } + + /** + * Returns the filename that triggered the error + * + * @return string + */ + public function get_filename() + { + $parameters = parent::get_parameters(); + return $parameters['filename']; + } +} diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php new file mode 100644 index 0000000000..2112882d1d --- /dev/null +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -0,0 +1,916 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\filesystem; + +use phpbb\filesystem\exception\filesystem_exception; + +/** + * A class with various functions that are related to paths, files and the filesystem + */ +class filesystem implements filesystem_interface +{ + /** + * Store some information about file ownership for phpBB's chmod function + * + * @var array + */ + protected $chmod_info; + + /** + * Stores current working directory + * + * @var string|bool current working directory or false if it cannot be recovered + */ + protected $working_directory; + + /** + * Symfony's Filesystem component + * + * @var \Symfony\Component\Filesystem\Filesystem + */ + protected $symfony_filesystem; + + /** + * Constructor + */ + public function __construct() + { + $this->chmod_info = array(); + $this->symfony_filesystem = new \Symfony\Component\Filesystem\Filesystem(); + $this->working_directory = null; + } + + /** + * {@inheritdoc} + */ + public function chgrp($files, $group, $recursive = false) + { + try + { + $this->symfony_filesystem->chgrp($files, $group, $recursive); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_CHANGE_FILE_GROUP', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function chmod($files, $perms = null, $recursive = false, $force_chmod_link = false) + { + if (is_null($perms)) + { + // Default to read permission for compatibility reasons + $perms = self::CHMOD_READ; + } + + // Check if we got a permission flag + if ($perms > self::CHMOD_ALL) + { + $file_perm = $perms; + + // Extract permissions + //$owner = ($file_perm >> 6) & 7; // This will be ignored + $group = ($file_perm >> 3) & 7; + $other = ($file_perm >> 0) & 7; + + // Does any permissions provided? if so we add execute bit for directories + $group = ($group !== 0) ? ($group | self::CHMOD_EXECUTE) : $group; + $other = ($other !== 0) ? ($other | self::CHMOD_EXECUTE) : $other; + + // Compute directory permissions + $dir_perm = (self::CHMOD_ALL << 6) + ($group << 3) + ($other << 3); + } + else + { + // Add execute bit to owner if execute bit is among perms + $owner_perm = (self::CHMOD_READ | self::CHMOD_WRITE) | ($perms & self::CHMOD_EXECUTE); + $file_perm = ($owner_perm << 6) + ($perms << 3) + ($perms << 0); + + // Compute directory permissions + $perm = ($perms !== 0) ? ($perms | self::CHMOD_EXECUTE) : $perms; + $dir_perm = (($owner_perm | self::CHMOD_EXECUTE) << 6) + ($perm << 3) + ($perm << 0); + } + + // Symfony's filesystem component does not support extra execution flags on directories + // so we need to implement it again + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + $this->chmod(new \FilesystemIterator($file), $perms, true); + } + + // Don't chmod links as mostly those require 0777 and that cannot be changed + if (is_dir($file) || (is_link($file) && $force_chmod_link)) + { + if (true !== @chmod($file, $dir_perm)) + { + throw new filesystem_exception('CANNOT_CHANGE_FILE_PERMISSIONS', $file, array()); + } + } + else if (is_file($file)) + { + if (true !== @chmod($file, $file_perm)) + { + throw new filesystem_exception('CANNOT_CHANGE_FILE_PERMISSIONS', $file, array()); + } + } + } + } + + /** + * {@inheritdoc} + */ + public function chown($files, $user, $recursive = false) + { + try + { + $this->symfony_filesystem->chown($files, $user, $recursive); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_CHANGE_FILE_GROUP', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function clean_path($path) + { + $exploded = explode('/', $path); + $filtered = array(); + foreach ($exploded as $part) + { + if ($part === '.' && !empty($filtered)) + { + continue; + } + + if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..') + { + array_pop($filtered); + } + else + { + $filtered[] = $part; + } + } + $path = implode('/', $filtered); + return $path; + } + + /** + * {@inheritdoc} + */ + public function copy($origin_file, $target_file, $override = false) + { + try + { + $this->symfony_filesystem->copy($origin_file, $target_file, $override); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('CANNOT_COPY_FILES', '', array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function dump_file($filename, $content) + { + try + { + $this->symfony_filesystem->dumpFile($filename, $content); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('CANNOT_DUMP_FILE', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function exists($files) + { + return $this->symfony_filesystem->exists($files); + } + + /** + * {@inheritdoc} + */ + public function is_absolute_path($path) + { + return (isset($path[0]) && $path[0] === '/' || preg_match('#^[a-z]:[/\\\]#i', $path)) ? true : false; + } + + /** + * {@inheritdoc} + */ + public function is_readable($files, $recursive = false) + { + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_readable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!is_readable($file)) + { + return false; + } + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function is_writable($files, $recursive = false) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR') || !function_exists('is_writable')) + { + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_writable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!$this->phpbb_is_writable($file)) + { + return false; + } + } + } + else + { + // use built in is_writable + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_writable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!is_writable($file)) + { + return false; + } + } + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function make_path_relative($end_path, $start_path) + { + return $this->symfony_filesystem->makePathRelative($end_path, $start_path); + } + + /** + * {@inheritdoc} + */ + public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()) + { + try + { + $this->symfony_filesystem->mirror($origin_dir, $target_dir, $iterator, $options); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('CANNOT_MIRROR_DIRECTORY', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function mkdir($dirs, $mode = 0777) + { + try + { + $this->symfony_filesystem->mkdir($dirs, $mode); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('CANNOT_CREATE_DIRECTORY', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function phpbb_chmod($files, $perms = null, $recursive = false, $force_chmod_link = false) + { + if (is_null($perms)) + { + // Default to read permission for compatibility reasons + $perms = self::CHMOD_READ; + } + + if (empty($this->chmod_info)) + { + if (!function_exists('fileowner') || !function_exists('filegroup')) + { + $this->chmod_info['process'] = false; + } + else + { + $common_php_owner = @fileowner(__FILE__); + $common_php_group = @filegroup(__FILE__); + + // And the owner and the groups PHP is running under. + $php_uid = (function_exists('posic_getuid')) ? @posix_getuid() : false; + $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; + + // If we are unable to get owner/group, then do not try to set them by guessing + if (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group) + { + $this->chmod_info['process'] = false; + } + else + { + $this->chmod_info = array( + 'process' => true, + 'common_owner' => $common_php_owner, + 'common_group' => $common_php_group, + 'php_uid' => $php_uid, + 'php_gids' => $php_gids, + ); + } + } + } + + if ($this->chmod_info['process']) + { + try + { + foreach ($this->to_iterator($files) as $file) + { + $file_uid = @fileowner($file); + $file_gid = @filegroup($file); + + // Change owner + if ($file_uid !== $this->chmod_info['common_owner']) + { + $this->chown($file, $this->chmod_info['common_owner'], $recursive); + } + + // Change group + if ($file_gid !== $this->chmod_info['common_group']) + { + $this->chgrp($file, $this->chmod_info['common_group'], $recursive); + } + + clearstatcache(); + $file_uid = @fileowner($file); + $file_gid = @filegroup($file); + } + } + catch (filesystem_exception $e) + { + $this->chmod_info['process'] = false; + } + } + + // Still able to process? + if ($this->chmod_info['process']) + { + if ($file_uid === $this->chmod_info['php_uid']) + { + $php = 'owner'; + } + else if (in_array($file_gid, $this->chmod_info['php_gids'])) + { + $php = 'group'; + } + else + { + // Since we are setting the everyone bit anyway, no need to do expensive operations + $this->chmod_info['process'] = false; + } + } + + // We are not able to determine or change something + if (!$this->chmod_info['process']) + { + $php = 'other'; + } + + switch ($php) + { + case 'owner': + try + { + $this->chmod($files, $perms, $recursive, $force_chmod_link); + clearstatcache(); + if ($this->is_readable($files) && $this->is_writable($files)) + { + break; + } + } + catch (filesystem_exception $e) + { + // Do nothing + } + case 'group': + try + { + $this->chmod($files, $perms, $recursive, $force_chmod_link); + clearstatcache(); + if ((!($perms & self::CHMOD_READ) || $this->is_readable($files, $recursive)) && (!($perms & self::CHMOD_WRITE) || $this->is_writable($files, $recursive))) + { + break; + } + } + catch (filesystem_exception $e) + { + // Do nothing + } + case 'other': + default: + $this->chmod($files, $perms, $recursive, $force_chmod_link); + break; + } + } + + /** + * {@inheritdoc} + */ + public function realpath($path) + { + if (!function_exists('realpath')) + { + return $this->phpbb_own_realpath($path); + } + + $realpath = realpath($path); + + // Strangely there are provider not disabling realpath but returning strange values. :o + // We at least try to cope with them. + if ((!$this->is_absolute_path($path) && $realpath === $path) || $realpath === false) + { + return $this->phpbb_own_realpath($path); + } + + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($realpath, -1) === DIRECTORY_SEPARATOR) + { + $realpath = substr($realpath, 0, -1); + } + + return $realpath; + } + + /** + * {@inheritdoc} + */ + public function remove($files) + { + try + { + $this->symfony_filesystem->remove($files); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_DELETE_FILES', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function rename($origin, $target, $overwrite = false) + { + try + { + $this->symfony_filesystem->rename($origin, $target, $overwrite); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('CANNOT_RENAME_FILE', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function symlink($origin_dir, $target_dir, $copy_on_windows = false) + { + try + { + $this->symfony_filesystem->symlink($origin_dir, $target_dir, $copy_on_windows); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('CANNOT_CREATE_SYMLINK', $origin_dir, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function touch($files, $time = null, $access_time = null) + { + try + { + $this->symfony_filesystem->touch($files, $time, $access_time); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_TOUCH_FILES', $file, array(), $e); + } + } + + /** + * phpBB's implementation of is_writable + * + * @todo Investigate if is_writable is still buggy + * + * @param string $file file/directory to check if writable + * + * @return bool true if the given path is writable + */ + protected function phpbb_is_writable($file) + { + if (file_exists($file)) + { + // Canonicalise path to absolute path + $file = $this->realpath($file); + + if (is_dir($file)) + { + // Test directory by creating a file inside the directory + $result = @tempnam($file, 'i_w'); + + if (is_string($result) && file_exists($result)) + { + unlink($result); + + // Ensure the file is actually in the directory (returned realpathed) + return (strpos($result, $file) === 0) ? true : false; + } + } + else + { + $handle = @fopen($file, 'c'); + + if (is_resource($handle)) + { + fclose($handle); + return true; + } + } + } + else + { + // file does not exist test if we can write to the directory + $dir = dirname($file); + + if (file_exists($dir) && is_dir($dir) && $this->phpbb_is_writable($dir)) + { + return true; + } + } + + return false; + } + + /** + * Try to resolve real path when PHP's realpath failes to do so + * + * @param string $path + * @return bool|string + */ + protected function phpbb_own_realpath($path) + { + // Replace all directory separators with '/' + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + + $is_absolute_path = false; + $path_prefix = ''; + + if ($this->is_absolute_path($path)) + { + $is_absolute_path = true; + } + else + { + // Resolve working directory and store it + if (is_null($this->working_directory)) + { + if (function_exists('getcwd')) + { + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', getcwd()); + } + + // + // From this point on we really just guessing + // If chdir were called we screwed + // + else if (function_exists('debug_backtrace')) + { + $call_stack = debug_backtrace(0); + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[sizeof($call_stack) - 1]['file'])); + } + else + { + // + // Assuming that the working directory is phpBB root + // we could use this as a fallback, when phpBB will use controllers + // everywhere this will be a safe assumption + // + //$dir_parts = explode(DIRECTORY_SEPARATOR, __DIR__); + //$namespace_parts = explode('\\', trim(__NAMESPACE__, '\\')); + + //$namespace_part_count = sizeof($namespace_parts); + + // Check if we still loading from root + //if (array_slice($dir_parts, -$namespace_part_count) === $namespace_parts) + //{ + // $this->working_directory = implode('/', array_slice($dir_parts, 0, -$namespace_part_count)); + //} + //else + //{ + // $this->working_directory = false; + //} + + $this->working_directory = false; + } + } + + if ($this->working_directory !== false) + { + $is_absolute_path = true; + $path = $this->working_directory . '/' . $path; + } + } + + if ($is_absolute_path) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) + { + $path_prefix = $path[0] . ':'; + $path = substr($path, 2); + } + else + { + $path_prefix = ''; + } + } + + $resolved_path = $this->resolve_path($path, $path_prefix, $is_absolute_path); + if ($resolved_path === false) + { + return false; + } + + if (!@file_exists($resolved_path) || (!@is_dir($resolved_path . '/') && !is_file($resolved_path))) + { + return false; + } + + // Return OS specific directory separators + $resolved = str_replace('/', DIRECTORY_SEPARATOR, $resolved_path); + + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($resolved, -1) === DIRECTORY_SEPARATOR) + { + return substr($resolved, 0, -1); + } + + return $resolved; + } + + /** + * Convert file(s) to \Traversable object + * + * This is the same function as Symfony's toIterator, but that is private + * so we cannot use it. + * + * @param string|array|\Traversable $files filename/list of filenames + * @return \Traversable + */ + protected function to_iterator($files) + { + if (!$files instanceof \Traversable) + { + $files = new \ArrayObject(is_array($files) ? $files : array($files)); + } + + return $files; + } + + /** + * Try to resolve symlinks in path + * + * @param string $path The path to resolve + * @param string $prefix The path prefix (on windows the drive letter) + * @param bool $absolute Whether or not the path is absolute + * @param bool $return_array Whether or not to return path parts + * + * @return string|array|bool returns the resolved path or an array of parts of the path if $return_array is true + * or false if path cannot be resolved + */ + protected function resolve_path($path, $prefix = '', $absolute = false, $return_array = false) + { + if ($return_array) + { + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + } + + trim ($path, '/'); + $path_parts = explode('/', $path); + $resolved = array(); + $resolved_path = $prefix; + $file_found = false; + + foreach ($path_parts as $path_part) + { + if ($file_found) + { + return false; + } + + if (empty($path_part) || ($path_part === '.' && ($absolute || !empty($resolved)))) + { + continue; + } + else if ($absolute && $path_part === '..') + { + if (empty($resolved)) + { + // No directories above root + return false; + } + + array_pop($resolved); + $resolved_path = false; + } + else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[sizeof($resolved) - 1], array('.', '..'))) + { + array_pop($resolved); + $resolved_path = false; + } + else + { + if ($resolved_path === false) + { + if (empty($resolved)) + { + $resolved_path = ($absolute) ? $prefix . '/' . $path_part : $path_part; + } + else + { + $tmp_array = $resolved; + if ($absolute) + { + array_unshift($tmp_array, $prefix); + } + + $resolved_path = implode('/', $tmp_array); + } + } + + $current_path = $resolved_path . '/' . $path_part; + + // Resolve symlinks + if (is_link($current_path)) + { + if (!function_exists('readlink')) + { + return false; + } + + $link = readlink($current_path); + + // Is link has an absolute path in it? + if ($this->is_absolute_path($link)) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) + { + $prefix = $link[0] . ':'; + $link = substr($link, 2); + } + else + { + $prefix = ''; + } + + $resolved = $this->resolve_path($link, $prefix, true, true); + $absolute = true; + } + else + { + $resolved = $this->resolve_path($resolved_path . '/' . $link, $prefix, $absolute, true); + } + + if (!$resolved) + { + return false; + } + + $resolved_path = false; + } + else if (is_dir($current_path . '/')) + { + $resolved[] = $path_part; + $resolved_path = $current_path; + } + else if (is_file($current_path)) + { + $resolved[] = $path_part; + $resolved_path = $current_path; + $file_found = true; + } + else + { + return false; + } + } + } + + // If at the end of the path there were a .. or . + // we need to build the path again. + // Only doing this when a string is expected in return + if ($resolved_path === false && $return_array === false) + { + if (empty($resolved)) + { + $resolved_path = ($absolute) ? $prefix . '/' : './'; + } + else + { + $tmp_array = $resolved; + if ($absolute) + { + array_unshift($tmp_array, $prefix); + } + + $resolved_path = implode('/', $tmp_array); + } + } + + return ($return_array) ? $resolved : $resolved_path; + } +} diff --git a/phpBB/phpbb/filesystem/filesystem_interface.php b/phpBB/phpbb/filesystem/filesystem_interface.php new file mode 100644 index 0000000000..1093be2499 --- /dev/null +++ b/phpBB/phpbb/filesystem/filesystem_interface.php @@ -0,0 +1,284 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\filesystem; + +/** + * Interface for phpBB's filesystem service + */ +interface filesystem_interface +{ + /** + * chmod all permissions flag + * + * @var int + */ + const CHMOD_ALL = 7; + + /** + * chmod read permissions flag + * + * @var int + */ + const CHMOD_READ = 4; + + /** + * chmod write permissions flag + * + * @var int + */ + const CHMOD_WRITE = 2; + + /** + * chmod execute permissions flag + * + * @var int + */ + const CHMOD_EXECUTE = 1; + + /** + * Change owner group of files/directories + * + * @param string|array|\Traversable $files The file(s)/directorie(s) to change group + * @param string $group The group that should own the files/directories + * @param bool $recursive If the group should be changed recursively + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chgrp($files, $group, $recursive = false); + + /** + * Global function for chmodding directories and files for internal use + * + * The function accepts filesystem_interface::CHMOD_ flags in the permission argument + * or the user can specify octal values (or any integer if it makes sense). All directories will have + * an execution bit appended, if the user group (owner, group or other) has any bit specified. + * + * @param string|array|\Traversable $files The file/directory to be chmodded + * @param int $perms Permissions to set + * @param bool $recursive If the permissions should be changed recursively + * @param bool $force_chmod_link Try to apply permissions to symlinks as well + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chmod($files, $perms = null, $recursive = false, $force_chmod_link = false); + + /** + * Change owner group of files/directories + * + * @param string|array|\Traversable $files The file(s)/directorie(s) to change group + * @param string $user The owner user name + * @param bool $recursive Whether change the owner recursively or not + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chown($files, $user, $recursive = false); + + /** + * Eliminates useless . and .. components from specified path. + * + * @param string $path Path to clean + * + * @return string Cleaned path + */ + public function clean_path($path); + + /** + * Copies a file. + * + * This method only copies the file if the origin file is newer than the target file. + * + * By default, if the target already exists, it is not overridden. + * + * @param string $origin_file The original filename + * @param string $target_file The target filename + * @param bool $override Whether to override an existing file or not + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be copied + */ + public function copy($origin_file, $target_file, $override = false); + + /** + * Atomically dumps content into a file. + * + * @param string $filename The file to be written to. + * @param string $content The data to write into the file. + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be written + */ + public function dump_file($filename, $content); + + /** + * Checks the existence of files or directories. + * + * @param string|array|\Traversable $files files/directories to check + * + * @return bool Returns true if all files/directories exist, false otherwise + */ + public function exists($files); + + /** + * Checks if a path is absolute or not + * + * @param string $path Path to check + * + * @return bool true if the path is absolute, false otherwise + */ + public function is_absolute_path($path); + + /** + * Checks if files/directories are readable + * + * @param string|array|\Traversable $files files/directories to check + * @param bool $recursive Whether or not directories should be checked recursively + * + * @return bool True when the files/directories are readable, otherwise false. + */ + public function is_readable($files, $recursive = false); + + /** + * Test if a file/directory is writable + * + * @param string|array|\Traversable $files files/directories to perform write test on + * @param bool $recursive Whether or not directories should be checked recursively + * + * @return bool True when the files/directories are writable, otherwise false. + */ + public function is_writable($files, $recursive = false); + + /** + * Given an existing path, convert it to a path relative to a given starting path + * + * @param string $end_path Absolute path of target + * @param string $start_path Absolute path where traversal begins + * + * @return string Path of target relative to starting path + */ + public function make_path_relative($end_path, $start_path); + + /** + * Mirrors a directory to another. + * + * @param string $origin_dir The origin directory + * @param string $target_dir The target directory + * @param \Traversable $iterator A Traversable instance + * @param array $options An array of boolean options + * Valid options are: + * - $options['override'] Whether to override an existing file on copy or not (see copy()) + * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink()) + * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be copied. + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()); + + /** + * Creates a directory recursively. + * + * @param string|array|\Traversable $dirs The directory path + * @param int $mode The directory mode + * + * @throws \phpbb\filesystem\exception\filesystem_exception On any directory creation failure + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function mkdir($dirs, $mode = 0777); + + /** + * Global function for chmodding directories and files for internal use + * + * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. + * The function determines owner and group from common.php file and sets the same to the provided file. + * The function uses bit fields to build the permissions. + * The function sets the appropiate execute bit on directories. + * + * Supported constants representing bit fields are: + * + * filesystem_interface::CHMOD_ALL - all permissions (7) + * filesystem_interface::CHMOD_READ - read permission (4) + * filesystem_interface::CHMOD_WRITE - write permission (2) + * filesystem_interface::CHMOD_EXECUTE - execute permission (1) + * + * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. + * + * @param string|array|\Traversable $file The file/directory to be chmodded + * @param int $perms Permissions to set + * @param bool $recursive If the permissions should be changed recursively + * @param bool $force_chmod_link Try to apply permissions to symlinks as well + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function phpbb_chmod($file, $perms = null, $recursive = false, $force_chmod_link = false); + + /** + * A wrapper for PHP's realpath + * + * Try to resolve realpath when PHP's realpath is not available, or + * known to be buggy. + * + * @param string $path Path to resolve + * + * @return string Resolved path + */ + public function realpath($path); + + /** + * Removes files or directories. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove + * + * @throws \phpbb\filesystem\exception\filesystem_exception When removal fails. + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function remove($files); + + /** + * Renames a file or a directory. + * + * @param string $origin The origin filename or directory + * @param string $target The new filename or directory + * @param bool $overwrite Whether to overwrite the target if it already exists + * + * @throws \phpbb\filesystem\exception\filesystem_exception When target file or directory already exists, + * or origin cannot be renamed. + */ + public function rename($origin, $target, $overwrite = false); + + /** + * Creates a symbolic link or copy a directory. + * + * @param string $origin_dir The origin directory path + * @param string $target_dir The symbolic link name + * @param bool $copy_on_windows Whether to copy files if on Windows + * + * @throws \phpbb\filesystem\exception\filesystem_exception When symlink fails + */ + public function symlink($origin_dir, $target_dir, $copy_on_windows = false); + + /** + * Sets access and modification time of file. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to create + * @param int $time The touch time as a Unix timestamp + * @param int $access_time The access time as a Unix timestamp + * + * @throws \phpbb\filesystem\exception\filesystem_exception When touch fails + */ + public function touch($files, $time = null, $access_time = null); +} diff --git a/phpBB/phpbb/finder.php b/phpBB/phpbb/finder.php new file mode 100644 index 0000000000..58bc27084e --- /dev/null +++ b/phpBB/phpbb/finder.php @@ -0,0 +1,547 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* The finder provides a simple way to locate files in the core and a set of extensions +*/ +class finder +{ + protected $extensions; + protected $filesystem; + protected $phpbb_root_path; + protected $cache; + protected $php_ext; + + /** + * The cache variable name used to store $this->cached_queries in $this->cache. + * + * Allows the use of multiple differently configured finders with the same cache. + * @var string + */ + protected $cache_name; + + /** + * An associative array, containing all search parameters set in methods. + * @var array + */ + protected $query; + + /** + * A map from md5 hashes of serialized queries to their previously retrieved + * results. + * @var array + */ + protected $cached_queries; + + /** + * Creates a new finder instance with its dependencies + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem instance + * @param string $phpbb_root_path Path to the phpbb root directory + * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null + * @param string $php_ext php file extension + * @param string $cache_name The name of the cache variable, defaults to + * _ext_finder + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path = '', \phpbb\cache\driver\driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->cache = $cache; + $this->php_ext = $php_ext; + $this->cache_name = $cache_name; + + $this->query = array( + 'core_path' => false, + 'core_suffix' => false, + 'core_prefix' => false, + 'core_directory' => false, + 'extension_suffix' => false, + 'extension_prefix' => false, + 'extension_directory' => false, + ); + $this->extensions = array(); + + $this->cached_queries = ($this->cache) ? $this->cache->get($this->cache_name) : false; + } + + /** + * Set the array of extensions + * + * @param array $extensions A list of extensions that should be searched aswell + * @param bool $replace_list Should the list be emptied before adding the extensions + * @return \phpbb\finder This object for chaining calls + */ + public function set_extensions(array $extensions, $replace_list = true) + { + if ($replace_list) + { + $this->extensions = array(); + } + + foreach ($extensions as $ext_name) + { + $this->extensions[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; + } + return $this; + } + + /** + * Sets a core path to be searched in addition to extensions + * + * @param string $core_path The path relative to phpbb_root_path + * @return \phpbb\finder This object for chaining calls + */ + public function core_path($core_path) + { + $this->query['core_path'] = $core_path; + return $this; + } + + /** + * Sets the suffix all files found in extensions and core must match. + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function suffix($suffix) + { + $this->core_suffix($suffix); + $this->extension_suffix($suffix); + return $this; + } + + /** + * Sets a suffix all files found in extensions must match + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $extension_suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function extension_suffix($extension_suffix) + { + $this->query['extension_suffix'] = $extension_suffix; + return $this; + } + + /** + * Sets a suffix all files found in the core path must match + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $core_suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function core_suffix($core_suffix) + { + $this->query['core_suffix'] = $core_suffix; + return $this; + } + + /** + * Sets the prefix all files found in extensions and core must match + * + * @param string $prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function prefix($prefix) + { + $this->core_prefix($prefix); + $this->extension_prefix($prefix); + return $this; + } + + /** + * Sets a prefix all files found in extensions must match + * + * @param string $extension_prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function extension_prefix($extension_prefix) + { + $this->query['extension_prefix'] = $extension_prefix; + return $this; + } + + /** + * Sets a prefix all files found in the core path must match + * + * @param string $core_prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function core_prefix($core_prefix) + { + $this->query['core_prefix'] = $core_prefix; + return $this; + } + + /** + * Sets a directory all files found in extensions and core must be contained in + * + * Automatically sets the core_directory if its value does not differ from + * the current directory. + * + * @param string $directory + * @return \phpbb\finder This object for chaining calls + */ + public function directory($directory) + { + $this->core_directory($directory); + $this->extension_directory($directory); + return $this; + } + + /** + * Sets a directory all files found in extensions must be contained in + * + * @param string $extension_directory + * @return \phpbb\finder This object for chaining calls + */ + public function extension_directory($extension_directory) + { + $this->query['extension_directory'] = $this->sanitise_directory($extension_directory); + return $this; + } + + /** + * Sets a directory all files found in the core path must be contained in + * + * @param string $core_directory + * @return \phpbb\finder This object for chaining calls + */ + public function core_directory($core_directory) + { + $this->query['core_directory'] = $this->sanitise_directory($core_directory); + return $this; + } + + /** + * Removes occurances of /./ and makes sure path ends without trailing slash + * + * @param string $directory A directory pattern + * @return string A cleaned up directory pattern + */ + protected function sanitise_directory($directory) + { + $directory = $this->filesystem->clean_path($directory); + $dir_len = strlen($directory); + + if ($dir_len > 1 && $directory[$dir_len - 1] === '/') + { + $directory = substr($directory, 0, -1); + } + + return $directory; + } + + /** + * Finds classes matching the configured options if they follow phpBB naming rules. + * + * The php file extension is automatically added to suffixes. + * + * Note: If a file is matched but contains a class name not following the + * phpBB naming rules an incorrect class name will be returned. + * + * @param bool $cache Whether the result should be cached + * @return array An array of found class names + */ + public function get_classes($cache = true) + { + $this->query['extension_suffix'] .= '.' . $this->php_ext; + $this->query['core_suffix'] .= '.' . $this->php_ext; + + $files = $this->find($cache, false); + + return $this->get_classes_from_files($files); + } + + /** + * Get class names from a list of files + * + * @param array $files Array of files (from find()) + * @return array Array of class names + */ + public function get_classes_from_files($files) + { + $classes = array(); + foreach ($files as $file => $ext_name) + { + $class = substr($file, 0, -strlen('.' . $this->php_ext)); + if ($ext_name === '/' && preg_match('#^includes/#', $file)) + { + $class = preg_replace('#^includes/#', '', $class); + $classes[] = 'phpbb_' . str_replace('/', '_', $class); + } + else + { + $class = preg_replace('#^ext/#', '', $class); + $classes[] = '\\' . str_replace('/', '\\', $class); + } + } + return $classes; + } + + /** + * Finds all directories matching the configured options + * + * @param bool $cache Whether the result should be cached + * @param bool $extension_keys Whether the result should have extension name as array key + * @return array An array of paths to found directories + */ + public function get_directories($cache = true, $extension_keys = false) + { + return $this->find_with_root_path($cache, true, $extension_keys); + } + + /** + * Finds all files matching the configured options. + * + * @param bool $cache Whether the result should be cached + * @return array An array of paths to found files + */ + public function get_files($cache = true) + { + return $this->find_with_root_path($cache, false); + } + + /** + * A wrapper around the general find which prepends a root path to results + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @param bool $extension_keys If true, result will be associative array + * with extension name as key + * @return array An array of paths to found items + */ + protected function find_with_root_path($cache = true, $is_dir = false, $extension_keys = false) + { + $items = $this->find($cache, $is_dir); + + $result = array(); + foreach ($items as $item => $ext_name) + { + if ($extension_keys) + { + $result[$ext_name] = $this->phpbb_root_path . $item; + } + else + { + $result[] = $this->phpbb_root_path . $item; + } + } + + return $result; + } + + /** + * Finds all file system entries matching the configured options + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find($cache = true, $is_dir = false) + { + $extensions = $this->extensions; + if ($this->query['core_path']) + { + $extensions['/'] = $this->phpbb_root_path . $this->query['core_path']; + } + + $files = array(); + $file_list = $this->find_from_paths($extensions, $cache, $is_dir); + + foreach ($file_list as $file) + { + $files[$file['named_path']] = $file['ext_name']; + } + + return $files; + } + + /** + * Finds all file system entries matching the configured options for one + * specific extension + * + * @param string $extension_name Name of the extension + * @param string $extension_path Relative path to the extension root directory + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find_from_extension($extension_name, $extension_path, $cache = true, $is_dir = false) + { + $extensions = array( + $extension_name => $extension_path, + ); + + $files = array(); + $file_list = $this->find_from_paths($extensions, $cache, $is_dir); + + foreach ($file_list as $file) + { + $files[$file['named_path']] = $file['ext_name']; + } + + return $files; + } + + /** + * Finds all file system entries matching the configured options from + * an array of paths + * + * @param array $extensions Array of extensions (name => full relative path) + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find_from_paths($extensions, $cache = true, $is_dir = false) + { + $this->query['is_dir'] = $is_dir; + $query = md5(serialize($this->query) . serialize($extensions)); + + if (!defined('DEBUG') && $cache && isset($this->cached_queries[$query])) + { + return $this->cached_queries[$query]; + } + + $files = array(); + + foreach ($extensions as $name => $path) + { + $ext_name = $name; + + if (!file_exists($path)) + { + continue; + } + + if ($name === '/') + { + $location = $this->query['core_path']; + $name = ''; + $suffix = $this->query['core_suffix']; + $prefix = $this->query['core_prefix']; + $directory = $this->query['core_directory']; + } + else + { + $location = 'ext/'; + $name .= '/'; + $suffix = $this->query['extension_suffix']; + $prefix = $this->query['extension_prefix']; + $directory = $this->query['extension_directory']; + } + + // match only first directory if leading slash is given + if ($directory === '/') + { + $directory_pattern = '^' . preg_quote(DIRECTORY_SEPARATOR, '#'); + } + else if ($directory && $directory[0] === '/') + { + if (!$is_dir) + { + $path .= substr($directory, 1); + } + $directory_pattern = '^' . preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); + } + else + { + $directory_pattern = preg_quote(DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); + } + if ($is_dir) + { + $directory_pattern .= '$'; + } + $directory_pattern = '#' . $directory_pattern . '#'; + + if (is_dir($path)) + { + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $path, + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + + foreach ($iterator as $file_info) + { + $filename = $file_info->getFilename(); + + if ($file_info->isDir() == $is_dir) + { + if ($is_dir) + { + $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; + if ($relative_path[0] !== DIRECTORY_SEPARATOR) + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } + } + else + { + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + if ($directory && $directory[0] === '/') + { + $relative_path = str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR . $relative_path; + } + else + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } + } + + if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && + (!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) && + (!$directory || preg_match($directory_pattern, $relative_path))) + { + $files[] = array( + 'named_path' => str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1)), + 'ext_name' => $ext_name, + 'path' => str_replace(array(DIRECTORY_SEPARATOR, $this->phpbb_root_path), array('/', ''), $file_info->getPath()) . '/', + 'filename' => $filename, + ); + } + } + } + } + } + + if ($cache && $this->cache) + { + $this->cached_queries[$query] = $files; + $this->cache->put($this->cache_name, $this->cached_queries); + } + + return $files; + } +} diff --git a/phpBB/phpbb/group/helper.php b/phpBB/phpbb/group/helper.php new file mode 100644 index 0000000000..5befddfc53 --- /dev/null +++ b/phpBB/phpbb/group/helper.php @@ -0,0 +1,40 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\group; + +class helper +{ + /** @var \phpbb\language\language */ + protected $language; + + /** + * Constructor + * + * @param \phpbb\language\language $language Language object + */ + public function __construct(\phpbb\language\language $language) + { + $this->language = $language; + } + + /** + * @param $group_name string The stored group name + * + * @return string Group name or translated group name if it exists + */ + public function get_name($group_name) + { + return $this->language->is_set('G_' . utf8_strtoupper($group_name)) ? $this->language->lang('G_' . utf8_strtoupper($group_name)) : $group_name; + } +} diff --git a/phpBB/phpbb/groupposition/exception.php b/phpBB/phpbb/groupposition/exception.php index f43502235d..956c7238f2 100644 --- a/phpBB/phpbb/groupposition/exception.php +++ b/phpBB/phpbb/groupposition/exception.php @@ -1,17 +1,18 @@ <?php /** * -* @package groupposition -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\groupposition; -/** -* @package groupposition -*/ class exception extends \Exception { } diff --git a/phpBB/phpbb/groupposition/groupposition_interface.php b/phpBB/phpbb/groupposition/groupposition_interface.php index 9785172a00..3bd3fcce90 100644 --- a/phpBB/phpbb/groupposition/groupposition_interface.php +++ b/phpBB/phpbb/groupposition/groupposition_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,8 +17,6 @@ namespace phpbb\groupposition; * Interface to manage group positions in various places of phpbb * * The interface provides simple methods to add, delete and move a group -* -* @package phpBB3 */ interface groupposition_interface { diff --git a/phpBB/phpbb/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php index 47ba06c006..efea3389d4 100644 --- a/phpBB/phpbb/groupposition/legend.php +++ b/phpBB/phpbb/groupposition/legend.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,8 +18,6 @@ namespace phpbb\groupposition; * * group_legend is an ascending list 1, 2, ..., n for groups which are displayed. 1 is the first group, n the last. * If the value is 0 (self::GROUP_DISABLED) the group is not displayed. -* -* @package phpBB3 */ class legend implements \phpbb\groupposition\groupposition_interface { @@ -26,7 +28,7 @@ class legend implements \phpbb\groupposition\groupposition_interface /** * Database object - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -39,10 +41,10 @@ class legend implements \phpbb\groupposition\groupposition_interface /** * Constructor * - * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\db\driver\driver_interface $db Database object * @param \phpbb\user $user User object */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user) { $this->db = $db; $this->user = $user; @@ -51,7 +53,9 @@ class legend implements \phpbb\groupposition\groupposition_interface /** * Returns the group_legend for a given group, if the group exists. * - * {@inheritDoc} + * @param int $group_id group_id of the group to be selected + * @return int position of the group + * @throws \phpbb\groupposition\exception */ public function get_group_value($group_id) { @@ -74,7 +78,7 @@ class legend implements \phpbb\groupposition\groupposition_interface /** * Get number of groups, displayed on the legend * - * {@inheritDoc} + * @return int value of the last item displayed */ public function get_group_count() { @@ -89,8 +93,6 @@ class legend implements \phpbb\groupposition\groupposition_interface } /** - * Adds a group by group_id - * * {@inheritDoc} */ public function add_group($group_id) @@ -116,7 +118,9 @@ class legend implements \phpbb\groupposition\groupposition_interface /** * Deletes a group by setting the field to self::GROUP_DISABLED and closing the gap in the list. * - * {@inheritDoc} + * @param int $group_id group_id of the group to be deleted + * @param bool $skip_group Skip setting the value for this group, to save the query, when you need to update it anyway. + * @return bool True if the group was deleted successfully */ public function delete_group($group_id, $skip_group = false) { @@ -148,8 +152,6 @@ class legend implements \phpbb\groupposition\groupposition_interface } /** - * Moves a group up by group_id - * * {@inheritDoc} */ public function move_up($group_id) @@ -158,8 +160,6 @@ class legend implements \phpbb\groupposition\groupposition_interface } /** - * Moves a group down by group_id - * * {@inheritDoc} */ public function move_down($group_id) @@ -168,8 +168,6 @@ class legend implements \phpbb\groupposition\groupposition_interface } /** - * Moves a group up/down - * * {@inheritDoc} */ public function move($group_id, $delta) diff --git a/phpBB/phpbb/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php index d934571ebc..2985c51525 100644 --- a/phpBB/phpbb/groupposition/teampage.php +++ b/phpBB/phpbb/groupposition/teampage.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,8 +17,6 @@ namespace phpbb\groupposition; * Teampage group position class * * Teampage position is an ascending list 1, 2, ..., n for items which are displayed. 1 is the first item, n the last. -* -* @package phpBB3 */ class teampage implements \phpbb\groupposition\groupposition_interface { @@ -30,7 +32,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface /** * Database object - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -49,11 +51,11 @@ class teampage implements \phpbb\groupposition\groupposition_interface /** * Constructor * - * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\db\driver\driver_interface $db Database object * @param \phpbb\user $user User object * @param \phpbb\cache\driver\driver_interface $cache Cache object */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache) { $this->db = $db; $this->user = $user; @@ -63,7 +65,9 @@ class teampage implements \phpbb\groupposition\groupposition_interface /** * Returns the teampage position for a given group, if the group exists. * - * {@inheritDoc} + * @param int $group_id group_id of the group to be selected + * @return int position of the group + * @throws \phpbb\groupposition\exception */ public function get_group_value($group_id) { @@ -91,6 +95,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface * * @param int $group_id group_id of the group to be selected * @return array Data row of the group + * @throws \phpbb\groupposition\exception */ public function get_group_values($group_id) { @@ -118,6 +123,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface * * @param int $teampage_id Teampage_id of the selected item * @return int Teampage position of the item + * @throws \phpbb\groupposition\exception */ public function get_teampage_value($teampage_id) { @@ -142,6 +148,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface * * @param int $teampage_id Teampage_id of the selected item * @return array Teampage row of the item + * @throws \phpbb\groupposition\exception */ public function get_teampage_values($teampage_id) { @@ -163,8 +170,6 @@ class teampage implements \phpbb\groupposition\groupposition_interface /** - * Get number of items displayed - * * {@inheritDoc} */ public function get_group_count() @@ -180,8 +185,6 @@ class teampage implements \phpbb\groupposition\groupposition_interface } /** - * Adds a group by group_id - * * {@inheritDoc} */ public function add_group($group_id) @@ -286,7 +289,9 @@ class teampage implements \phpbb\groupposition\groupposition_interface /** * Deletes a group from the list and closes the gap in the position list. * - * {@inheritDoc} + * @param int $group_id group_id of the group to be deleted + * @param bool $skip_group Skip setting the value for this group, to save the query, when you need to update it anyway. + * @return bool True if the group was deleted successfully */ public function delete_group($group_id, $skip_group = false) { @@ -345,8 +350,6 @@ class teampage implements \phpbb\groupposition\groupposition_interface } /** - * Moves a group up by group_id - * * {@inheritDoc} */ public function move_up($group_id) @@ -357,7 +360,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface /** * Moves an item up by teampage_id * - * @param int $group_id group_id of the group to be moved + * @param int $teampage_id teampage_id of the item to be move * @return bool True if the group was moved successfully */ public function move_up_teampage($teampage_id) @@ -366,8 +369,6 @@ class teampage implements \phpbb\groupposition\groupposition_interface } /** - * Moves a group down by group_id - * * {@inheritDoc} */ public function move_down($group_id) @@ -376,9 +377,9 @@ class teampage implements \phpbb\groupposition\groupposition_interface } /** - * Movesan item down by teampage_id + * Moves an item down by teampage_id * - * @param int $group_id group_id of the group to be moved + * @param int $teampage_id teampage_id of the item to be moved * @return bool True if the group was moved successfully */ public function move_down_teampage($teampage_id) @@ -387,8 +388,6 @@ class teampage implements \phpbb\groupposition\groupposition_interface } /** - * Moves a group up/down - * * {@inheritDoc} */ public function move($group_id, $delta) diff --git a/phpBB/phpbb/help/controller/bbcode.php b/phpBB/phpbb/help/controller/bbcode.php new file mode 100644 index 0000000000..e16f99023d --- /dev/null +++ b/phpBB/phpbb/help/controller/bbcode.php @@ -0,0 +1,85 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +/** + * BBCode help page + */ +class bbcode extends controller +{ + /** + * @return string The title of the page + */ + public function display() + { + $this->language->add_lang('help/bbcode'); + + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_INTRO', + false, + array( + 'HELP_BBCODE_INTRO_BBCODE_QUESTION' => 'HELP_BBCODE_INTRO_BBCODE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_TEXT', + false, + array( + 'HELP_BBCODE_TEXT_BASIC_QUESTION' => 'HELP_BBCODE_TEXT_BASIC_ANSWER', + 'HELP_BBCODE_TEXT_COLOR_QUESTION' => 'HELP_BBCODE_TEXT_COLOR_ANSWER', + 'HELP_BBCODE_TEXT_COMBINE_QUESTION' => 'HELP_BBCODE_TEXT_COMBINE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_QUOTES', + false, + array( + 'HELP_BBCODE_QUOTES_TEXT_QUESTION' => 'HELP_BBCODE_QUOTES_TEXT_ANSWER', + 'HELP_BBCODE_QUOTES_CODE_QUESTION' => 'HELP_BBCODE_QUOTES_CODE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_LISTS', + false, + array( + 'HELP_BBCODE_LISTS_UNORDERER_QUESTION' => 'HELP_BBCODE_LISTS_UNORDERER_ANSWER', + 'HELP_BBCODE_LISTS_ORDERER_QUESTION' => 'HELP_BBCODE_LISTS_ORDERER_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_LINKS', + true, + array( + 'HELP_BBCODE_LINKS_BASIC_QUESTION' => 'HELP_BBCODE_LINKS_BASIC_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_IMAGES', + false, + array( + 'HELP_BBCODE_IMAGES_BASIC_QUESTION' => 'HELP_BBCODE_IMAGES_BASIC_ANSWER', + 'HELP_BBCODE_IMAGES_ATTACHMENT_QUESTION' => 'HELP_BBCODE_IMAGES_ATTACHMENT_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_OTHERS', + false, + array( + 'HELP_BBCODE_OTHERS_CUSTOM_QUESTION' => 'HELP_BBCODE_OTHERS_CUSTOM_ANSWER', + ) + ); + + return $this->language->lang('BBCODE_GUIDE'); + } +} diff --git a/phpBB/phpbb/help/controller/controller.php b/phpBB/phpbb/help/controller/controller.php new file mode 100644 index 0000000000..29494205a9 --- /dev/null +++ b/phpBB/phpbb/help/controller/controller.php @@ -0,0 +1,76 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +/** + * BBCode help page + */ +abstract class controller +{ + /** @var \phpbb\controller\helper */ + protected $helper; + + /** @var \phpbb\help\manager */ + protected $manager; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var string */ + protected $root_path; + + /** @var string */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\controller\helper $helper + * @param \phpbb\help\manager $manager + * @param \phpbb\template\template $template + * @param \phpbb\language\language $language + * @param string $root_path + * @param string $php_ext + */ + public function __construct(\phpbb\controller\helper $helper, \phpbb\help\manager $manager, \phpbb\template\template $template, \phpbb\language\language $language, $root_path, $php_ext) + { + $this->helper = $helper; + $this->manager = $manager; + $this->template = $template; + $this->language = $language; + $this->root_path = $root_path; + $this->php_ext = $php_ext; + } + + /** + * @return string + */ + abstract protected function display(); + + public function handle() + { + $title = $this->display(); + + $this->template->assign_vars(array( + 'L_FAQ_TITLE' => $title, + 'S_IN_FAQ' => true, + )); + + make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}")); + return $this->helper->render('faq_body.html', $title); + } +} diff --git a/phpBB/phpbb/help/controller/faq.php b/phpBB/phpbb/help/controller/faq.php new file mode 100644 index 0000000000..5e45cfe667 --- /dev/null +++ b/phpBB/phpbb/help/controller/faq.php @@ -0,0 +1,165 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +/** + * FAQ help page + */ +class faq extends controller +{ + /** + * @return string The title of the page + */ + public function display() + { + $this->language->add_lang('help/faq'); + + $this->manager->add_block( + 'HELP_FAQ_BLOCK_LOGIN', + false, + array( + 'HELP_FAQ_LOGIN_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_ANSWER', + 'HELP_FAQ_LOGIN_COPPA_QUESTION' => 'HELP_FAQ_LOGIN_COPPA_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER', + 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER', + 'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER', + 'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER', + 'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_USERSETTINGS', + false, + array( + 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_QUESTION' => 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_ANSWER', + 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_QUESTION' => 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_ANSWER', + 'HELP_FAQ_USERSETTINGS_TIMEZONE_QUESTION' => 'HELP_FAQ_USERSETTINGS_TIMEZONE_ANSWER', + 'HELP_FAQ_USERSETTINGS_SERVERTIME_QUESTION' => 'HELP_FAQ_USERSETTINGS_SERVERTIME_ANSWER', + 'HELP_FAQ_USERSETTINGS_LANGUAGE_QUESTION' => 'HELP_FAQ_USERSETTINGS_LANGUAGE_ANSWER', + 'HELP_FAQ_USERSETTINGS_AVATAR_QUESTION' => 'HELP_FAQ_USERSETTINGS_AVATAR_ANSWER', + 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_QUESTION' => 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_ANSWER', + 'HELP_FAQ_USERSETTINGS_RANK_QUESTION' => 'HELP_FAQ_USERSETTINGS_RANK_ANSWER', + 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_QUESTION' => 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_POSTING', + false, + array( + 'HELP_FAQ_POSTING_CREATE_QUESTION' => 'HELP_FAQ_POSTING_CREATE_ANSWER', + 'HELP_FAQ_POSTING_EDIT_DELETE_QUESTION' => 'HELP_FAQ_POSTING_EDIT_DELETE_ANSWER', + 'HELP_FAQ_POSTING_SIGNATURE_QUESTION' => 'HELP_FAQ_POSTING_SIGNATURE_ANSWER', + 'HELP_FAQ_POSTING_POLL_CREATE_QUESTION' => 'HELP_FAQ_POSTING_POLL_CREATE_ANSWER', + 'HELP_FAQ_POSTING_POLL_ADD_QUESTION' => 'HELP_FAQ_POSTING_POLL_ADD_ANSWER', + 'HELP_FAQ_POSTING_POLL_EDIT_QUESTION' => 'HELP_FAQ_POSTING_POLL_EDIT_ANSWER', + 'HELP_FAQ_POSTING_FORUM_RESTRICTED_QUESTION' => 'HELP_FAQ_POSTING_FORUM_RESTRICTED_ANSWER', + 'HELP_FAQ_POSTING_NO_ATTACHMENTS_QUESTION' => 'HELP_FAQ_POSTING_NO_ATTACHMENTS_ANSWER', + 'HELP_FAQ_POSTING_WARNING_QUESTION' => 'HELP_FAQ_POSTING_WARNING_ANSWER', + 'HELP_FAQ_POSTING_REPORT_QUESTION' => 'HELP_FAQ_POSTING_REPORT_ANSWER', + 'HELP_FAQ_POSTING_DRAFT_QUESTION' => 'HELP_FAQ_POSTING_DRAFT_ANSWER', + 'HELP_FAQ_POSTING_QUEUE_QUESTION' => 'HELP_FAQ_POSTING_QUEUE_ANSWER', + 'HELP_FAQ_POSTING_BUMP_QUESTION' => 'HELP_FAQ_POSTING_BUMP_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_FORMATTING', + false, + array( + 'HELP_FAQ_FORMATTING_BBOCDE_QUESTION' => 'HELP_FAQ_FORMATTING_BBOCDE_ANSWER', + 'HELP_FAQ_FORMATTING_HTML_QUESTION' => 'HELP_FAQ_FORMATTING_HTML_ANSWER', + 'HELP_FAQ_FORMATTING_SMILIES_QUESTION' => 'HELP_FAQ_FORMATTING_SMILIES_ANSWER', + 'HELP_FAQ_FORMATTING_IMAGES_QUESTION' => 'HELP_FAQ_FORMATTING_IMAGES_ANSWER', + 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_QUESTION' => 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_ANSWER', + 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_QUESTION' => 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_ANSWER', + 'HELP_FAQ_FORMATTING_STICKIES_QUESTION' => 'HELP_FAQ_FORMATTING_STICKIES_ANSWER', + 'HELP_FAQ_FORMATTING_LOCKED_QUESTION' => 'HELP_FAQ_FORMATTING_LOCKED_ANSWER', + 'HELP_FAQ_FORMATTING_ICONS_QUESTION' => 'HELP_FAQ_FORMATTING_ICONS_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_GROUPS', + true, + array( + 'HELP_FAQ_GROUPS_ADMINISTRATORS_QUESTION' => 'HELP_FAQ_GROUPS_ADMINISTRATORS_ANSWER', + 'HELP_FAQ_GROUPS_MODERATORS_QUESTION' => 'HELP_FAQ_GROUPS_MODERATORS_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_ANSWER', + 'HELP_FAQ_GROUPS_COLORS_QUESTION' => 'HELP_FAQ_GROUPS_COLORS_ANSWER', + 'HELP_FAQ_GROUPS_DEFAULT_QUESTION' => 'HELP_FAQ_GROUPS_DEFAULT_ANSWER', + 'HELP_FAQ_GROUPS_TEAM_QUESTION' => 'HELP_FAQ_GROUPS_TEAM_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_PMS', + false, + array( + 'HELP_FAQ_PMS_CANNOT_SEND_QUESTION' => 'HELP_FAQ_PMS_CANNOT_SEND_ANSWER', + 'HELP_FAQ_PMS_UNWANTED_QUESTION' => 'HELP_FAQ_PMS_UNWANTED_ANSWER', + 'HELP_FAQ_PMS_SPAM_QUESTION' => 'HELP_FAQ_PMS_SPAM_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_FRIENDS', + false, + array( + 'HELP_FAQ_FRIENDS_BASIC_QUESTION' => 'HELP_FAQ_FRIENDS_BASIC_ANSWER', + 'HELP_FAQ_FRIENDS_MANAGE_QUESTION' => 'HELP_FAQ_FRIENDS_MANAGE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_SEARCH', + false, + array( + 'HELP_FAQ_SEARCH_FORUM_QUESTION' => 'HELP_FAQ_SEARCH_FORUM_ANSWER', + 'HELP_FAQ_SEARCH_NO_RESULT_QUESTION' => 'HELP_FAQ_SEARCH_NO_RESULT_ANSWER', + 'HELP_FAQ_SEARCH_BLANK_QUESTION' => 'HELP_FAQ_SEARCH_BLANK_ANSWER', + 'HELP_FAQ_SEARCH_MEMBERS_QUESTION' => 'HELP_FAQ_SEARCH_MEMBERS_ANSWER', + 'HELP_FAQ_SEARCH_OWN_QUESTION' => 'HELP_FAQ_SEARCH_OWN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_BOOKMARKS', + false, + array( + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_QUESTION' => 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER', + 'HELP_FAQ_BOOKMARKS_TOPIC_QUESTION' => 'HELP_FAQ_BOOKMARKS_TOPIC_ANSWER', + 'HELP_FAQ_BOOKMARKS_FORUM_QUESTION' => 'HELP_FAQ_BOOKMARKS_FORUM_ANSWER', + 'HELP_FAQ_BOOKMARKS_REMOVE_QUESTION' => 'HELP_FAQ_BOOKMARKS_REMOVE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_ATTACHMENTS', + false, + array( + 'HELP_FAQ_ATTACHMENTS_ALLOWED_QUESTION' => 'HELP_FAQ_ATTACHMENTS_ALLOWED_ANSWER', + 'HELP_FAQ_ATTACHMENTS_OWN_QUESTION' => 'HELP_FAQ_ATTACHMENTS_OWN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_ISSUES', + false, + array( + 'HELP_FAQ_ISSUES_WHOIS_PHPBB_QUESTION' => 'HELP_FAQ_ISSUES_WHOIS_PHPBB_ANSWER', + 'HELP_FAQ_ISSUES_FEATURE_QUESTION' => 'HELP_FAQ_ISSUES_FEATURE_ANSWER', + 'HELP_FAQ_ISSUES_LEGAL_QUESTION' => 'HELP_FAQ_ISSUES_LEGAL_ANSWER', + 'HELP_FAQ_ISSUES_ADMIN_QUESTION' => 'HELP_FAQ_ISSUES_ADMIN_ANSWER', + ) + ); + + return $this->language->lang('FAQ_EXPLAIN'); + } +} diff --git a/phpBB/phpbb/help/controller/help.php b/phpBB/phpbb/help/controller/help.php new file mode 100644 index 0000000000..9cc3b0c8b4 --- /dev/null +++ b/phpBB/phpbb/help/controller/help.php @@ -0,0 +1,160 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +use phpbb\exception\http_exception; + +class help +{ + /** @var \phpbb\controller\helper */ + protected $helper; + + /** @var \phpbb\event\dispatcher_interface */ + protected $dispatcher; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\user */ + protected $user; + + /** @var string */ + protected $root_path; + + /** @var string */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\controller\helper $helper + * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\template\template $template + * @param \phpbb\user $user + * @param string $root_path + * @param string $php_ext + */ + public function __construct(\phpbb\controller\helper $helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\template\template $template, \phpbb\user $user, $root_path, $php_ext) + { + $this->helper = $helper; + $this->dispatcher = $dispatcher; + $this->template = $template; + $this->user = $user; + $this->root_path = $root_path; + $this->php_ext = $php_ext; + } + + /** + * Controller for /help/{mode} routes + * + * @param string $mode + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object + * @throws http_exception when the $mode is not known by any extension + */ + public function handle($mode) + { + switch ($mode) + { + case 'faq': + case 'bbcode': + $page_title = ($mode === 'faq') ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE']; + $this->user->add_lang($mode, false, true); + break; + + default: + $page_title = $this->user->lang['FAQ_EXPLAIN']; + $ext_name = $lang_file = ''; + + /** + * You can use this event display a custom help page + * + * @event core.faq_mode_validation + * @var string page_title Title of the page + * @var string mode FAQ that is going to be displayed + * @var string lang_file Language file containing the help data + * @var string ext_name Vendor and extension name where the help + * language file can be loaded from + * @since 3.1.4-RC1 + */ + $vars = array( + 'page_title', + 'mode', + 'lang_file', + 'ext_name', + ); + extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars))); + + if ($ext_name === '' || $lang_file === '') + { + throw new http_exception(404, 'Not Found'); + } + + $this->user->add_lang($lang_file, false, true, $ext_name); + break; + + } + + $this->template->assign_vars(array( + 'L_FAQ_TITLE' => $page_title, + 'S_IN_FAQ' => true, + )); + + $this->assign_to_template($this->user->help); + + make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}")); + return $this->helper->render('faq_body.html', $page_title); + } + + /** + * Assigns the help data to the template blocks + * + * @param array $help_data + * @return null + */ + protected function assign_to_template(array $help_data) + { + // Pull the array data from the lang pack + $switch_column = $found_switch = false; + foreach ($help_data as $help_ary) + { + if ($help_ary[0] == '--') + { + if ($help_ary[1] == '--') + { + $switch_column = true; + $found_switch = true; + continue; + } + + $this->template->assign_block_vars('faq_block', array( + 'BLOCK_TITLE' => $help_ary[1], + 'SWITCH_COLUMN' => $switch_column, + )); + + if ($switch_column) + { + $switch_column = false; + } + continue; + } + + $this->template->assign_block_vars('faq_block.faq_row', array( + 'FAQ_QUESTION' => $help_ary[0], + 'FAQ_ANSWER' => $help_ary[1], + )); + } + + $this->template->assign_var('SWITCH_COLUMN_MANUALLY', !$found_switch); + } +} diff --git a/phpBB/phpbb/help/manager.php b/phpBB/phpbb/help/manager.php new file mode 100644 index 0000000000..39f52d343b --- /dev/null +++ b/phpBB/phpbb/help/manager.php @@ -0,0 +1,137 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help; + +/** + * Class help page manager + */ +class manager +{ + /** @var \phpbb\event\dispatcher */ + protected $dispatcher; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var bool */ + protected $switched_column; + + /** + * Constructor + * + * @param \phpbb\event\dispatcher $dispatcher + * @param \phpbb\language\language $language + * @param \phpbb\template\template $template + */ + public function __construct(\phpbb\event\dispatcher $dispatcher, \phpbb\language\language $language, \phpbb\template\template $template) + { + $this->dispatcher = $dispatcher; + $this->language = $language; + $this->template = $template; + } + + /** + * Add a new faq block + * + * @param string $block_name Name or language key with the name of the block + * @param bool $switch_column Switch the column of the menu + * @param array $questions Array of frequently asked questions + */ + public function add_block($block_name, $switch_column = false, $questions = array()) + { + /** + * You can use this event to add a block before the current one. + * + * @event core.help_manager_add_block_before + * @var string block_name Language key of the block headline + * @var bool switch_column Should we switch the menu column before this headline + * @var array questions Array with questions + * @since 3.2.0-a1 + */ + $vars = array('block_name', 'switch_column', 'questions'); + extract($this->dispatcher->trigger_event('core.help_manager_add_block_before', compact($vars))); + + $this->template->assign_block_vars('faq_block', array( + 'BLOCK_TITLE' => $this->language->lang($block_name), + 'SWITCH_COLUMN' => !$this->switched_column && $switch_column, + )); + + foreach ($questions as $question => $answer) + { + $this->add_question($question, $answer); + } + + $this->switched_column = $this->switched_column || $switch_column; + + /** + * You can use this event to add a block after the current one. + * + * @event core.help_manager_add_block_after + * @var string block_name Language key of the block headline + * @var bool switch_column Should we switch the menu column before this headline + * @var array questions Array with questions + * @since 3.2.0-a1 + */ + $vars = array('block_name', 'switch_column', 'questions'); + extract($this->dispatcher->trigger_event('core.help_manager_add_block_after', compact($vars))); + } + + /** + * Add a new faq question + * + * @param string $question Question or language key with the question of the block + * @param string $answer Answer or language key with the answer of the block + */ + public function add_question($question, $answer) + { + /** + * You can use this event to add a question before the current one. + * + * @event core.help_manager_add_question_before + * @var string question Language key of the question + * @var string answer Language key of the answer + * @since 3.2.0-a1 + */ + $vars = array('question', 'answer'); + extract($this->dispatcher->trigger_event('core.help_manager_add_question_before', compact($vars))); + + $this->template->assign_block_vars('faq_block.faq_row', array( + 'FAQ_QUESTION' => $this->language->lang($question), + 'FAQ_ANSWER' => $this->language->lang($answer), + )); + + /** + * You can use this event to add a question after the current one. + * + * @event core.help_manager_add_question_after + * @var string question Language key of the question + * @var string answer Language key of the answer + * @since 3.2.0-a1 + */ + $vars = array('question', 'answer'); + extract($this->dispatcher->trigger_event('core.help_manager_add_question_after', compact($vars))); + } + + /** + * Returns whether the block titles switched side + * @return bool + */ + public function switched_column() + { + return $this->switched_column; + } +} diff --git a/phpBB/phpbb/hook/finder.php b/phpBB/phpbb/hook/finder.php index c8f71861d9..f5a68a1370 100644 --- a/phpBB/phpbb/hook/finder.php +++ b/phpBB/phpbb/hook/finder.php @@ -1,9 +1,13 @@ <?php /** * -* @package extension -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,13 +15,22 @@ namespace phpbb\hook; /** * The hook finder locates installed hooks. -* -* @package phpBB3 */ class finder { - protected $phpbb_root_path; + /** + * @var \phpbb\cache\driver\driver_interface + */ protected $cache; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ protected $php_ext; /** diff --git a/phpBB/phpbb/install/console/command/install/config/show.php b/phpBB/phpbb/install/console/command/install/config/show.php new file mode 100644 index 0000000000..5d82d8d1ef --- /dev/null +++ b/phpBB/phpbb/install/console/command/install/config/show.php @@ -0,0 +1,131 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\install\console\command\install\config; + +use phpbb\install\helper\iohandler\factory; +use phpbb\install\installer; +use phpbb\install\installer_configuration; +use phpbb\language\language; +use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Yaml; + +class show extends \phpbb\console\command\command +{ + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var installer + */ + protected $installer; + + /** + * @var language + */ + protected $language; + + /** + * Constructor + * + * @param language $language + * @param factory $factory + * @param installer $installer + */ + public function __construct(language $language, factory $factory, installer $installer) + { + $this->iohandler_factory = $factory; + $this->installer = $installer; + $this->language = $language; + + parent::__construct(new \phpbb\user($language, 'datetime')); + } + + /** + * + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('install:config:show') + ->addArgument( + 'config-file', + InputArgument::REQUIRED, + $this->language->lang('CLI_CONFIG_FILE')) + ->setDescription($this->language->lang('CLI_INSTALL_SHOW_CONFIG')) + ; + } + + /** + * Show the validated configuration + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->iohandler_factory->set_environment('cli'); + + /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $style = new SymfonyStyle($input, $output); + $iohandler->set_style($style, $output); + + $config_file = $input->getArgument('config-file'); + + if (!is_file($config_file)) + { + $iohandler->add_error_message(array('MISSING_FILE', $config_file)); + + return; + } + + try + { + $config = Yaml::parse(file_get_contents($config_file), true, false); + } + catch (ParseException $e) + { + $iohandler->add_error_message('INVALID_YAML_FILE'); + + return; + } + + $processor = new Processor(); + $configuration = new installer_configuration(); + + try + { + $config = $processor->processConfiguration($configuration, $config); + } + catch (Exception $e) + { + $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); + + return; + } + + $iohandler->add_log_message(Yaml::dump(array('installer' => $config), 10, 4, true, false)); + } +} diff --git a/phpBB/phpbb/install/console/command/install/config/validate.php b/phpBB/phpbb/install/console/command/install/config/validate.php new file mode 100644 index 0000000000..3bbbc23e34 --- /dev/null +++ b/phpBB/phpbb/install/console/command/install/config/validate.php @@ -0,0 +1,132 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\install\console\command\install\config; + +use phpbb\install\helper\iohandler\factory; +use phpbb\install\installer; +use phpbb\install\installer_configuration; +use phpbb\language\language; +use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Yaml; + +class validate extends \phpbb\console\command\command +{ + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var installer + */ + protected $installer; + + /** + * @var language + */ + protected $language; + + /** + * Constructor + * + * @param language $language + * @param factory $factory + * @param installer $installer + */ + public function __construct(language $language, factory $factory, installer $installer) + { + $this->iohandler_factory = $factory; + $this->installer = $installer; + $this->language = $language; + + parent::__construct(new \phpbb\user($language, 'datetime')); + } + + /** + * + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('install:config:validate') + ->addArgument( + 'config-file', + InputArgument::REQUIRED, + $this->language->lang('CLI_CONFIG_FILE')) + ->setDescription($this->language->lang('CLI_INSTALL_VALIDATE_CONFIG')) + ; + } + + /** + * Validate the configuration file + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->iohandler_factory->set_environment('cli'); + + /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $style = new SymfonyStyle($input, $output); + $iohandler->set_style($style, $output); + + $config_file = $input->getArgument('config-file'); + + if (!is_file($config_file)) + { + $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); + + return 1; + } + + try + { + $config = Yaml::parse(file_get_contents($config_file), true, false); + } + catch (ParseException $e) + { + $iohandler->add_error_message('INVALID_YAML_FILE'); + + return 1; + } + + $processor = new Processor(); + $configuration = new installer_configuration(); + + try + { + $processor->processConfiguration($configuration, $config); + } + catch (Exception $e) + { + $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); + + return 1; + } + + $iohandler->add_success_message('CONFIGURATION_VALID'); + return 0; + } +} diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php new file mode 100644 index 0000000000..d76182af92 --- /dev/null +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -0,0 +1,206 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\install\console\command\install; + +use phpbb\install\exception\installer_exception; +use phpbb\install\helper\install_helper; +use phpbb\install\helper\iohandler\cli_iohandler; +use phpbb\install\helper\iohandler\factory; +use phpbb\install\installer; +use phpbb\install\installer_configuration; +use phpbb\language\language; +use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Yaml; + +class install extends \phpbb\console\command\command +{ + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var installer + */ + protected $installer; + + /** + * @var install_helper + */ + protected $install_helper; + + /** + * @var language + */ + protected $language; + + /** + * Constructor + * + * @param language $language + * @param factory $factory + * @param installer $installer + * @param install_helper $install_helper + */ + public function __construct(language $language, factory $factory, installer $installer, install_helper $install_helper) + { + $this->iohandler_factory = $factory; + $this->installer = $installer; + $this->language = $language; + $this->install_helper = $install_helper; + + parent::__construct(new \phpbb\user($language, 'datetime')); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('install') + ->addArgument( + 'config-file', + InputArgument::REQUIRED, + $this->language->lang('CLI_CONFIG_FILE')) + ->setDescription($this->language->lang('CLI_INSTALL_BOARD')) + ; + } + + /** + * Executes the command install. + * + * Install the board + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->iohandler_factory->set_environment('cli'); + + /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $style = new SymfonyStyle($input, $output); + $iohandler->set_style($style, $output); + + $this->installer->set_iohandler($iohandler); + + $config_file = $input->getArgument('config-file'); + + if ($this->install_helper->is_phpbb_installed()) + { + $iohandler->add_error_message('PHPBB_ALREADY_INSTALLED'); + + return 1; + } + + if (!is_file($config_file)) + { + $iohandler->add_error_message(array('MISSING_FILE', $config_file)); + + return 1; + } + + try + { + $config = Yaml::parse(file_get_contents($config_file), true, false); + } + catch (ParseException $e) + { + $iohandler->add_error_message(array('INVALID_YAML_FILE', $config_file)); + + return 1; + } + + $processor = new Processor(); + $configuration = new installer_configuration(); + + try + { + $config = $processor->processConfiguration($configuration, $config); + } + catch (Exception $e) + { + $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); + + return 1; + } + + $this->register_configuration($iohandler, $config); + + try + { + $this->installer->run(); + } + catch (installer_exception $e) + { + $iohandler->add_error_message($e->getMessage()); + return 1; + } + } + + /** + * Register the configuration to simulate the forms. + * + * @param cli_iohandler $iohandler + * @param array $config + */ + private function register_configuration(cli_iohandler $iohandler, $config) + { + $iohandler->set_input('admin_name', $config['admin']['name']); + $iohandler->set_input('admin_pass1', $config['admin']['password']); + $iohandler->set_input('admin_pass2', $config['admin']['password']); + $iohandler->set_input('board_email', $config['admin']['email']); + $iohandler->set_input('submit_admin', 'submit'); + + $iohandler->set_input('default_lang', $config['board']['lang']); + $iohandler->set_input('board_name', $config['board']['name']); + $iohandler->set_input('board_description', $config['board']['description']); + $iohandler->set_input('submit_board', 'submit'); + + $iohandler->set_input('dbms', $config['database']['dbms']); + $iohandler->set_input('dbhost', $config['database']['dbhost']); + $iohandler->set_input('dbport', $config['database']['dbport']); + $iohandler->set_input('dbuser', $config['database']['dbuser']); + $iohandler->set_input('dbpasswd', $config['database']['dbpasswd']); + $iohandler->set_input('dbname', $config['database']['dbname']); + $iohandler->set_input('table_prefix', $config['database']['table_prefix']); + $iohandler->set_input('submit_database', 'submit'); + + $iohandler->set_input('email_enable', $config['email']['enabled']); + $iohandler->set_input('smtp_delivery', $config['email']['smtp_delivery']); + $iohandler->set_input('smtp_host', $config['email']['smtp_host']); + $iohandler->set_input('smtp_auth', $config['email']['smtp_auth']); + $iohandler->set_input('smtp_user', $config['email']['smtp_user']); + $iohandler->set_input('smtp_pass', $config['email']['smtp_pass']); + $iohandler->set_input('submit_email', 'submit'); + + $iohandler->set_input('cookie_secure', $config['server']['cookie_secure']); + $iohandler->set_input('server_protocol', $config['server']['server_protocol']); + $iohandler->set_input('force_server_vars', $config['server']['force_server_vars']); + $iohandler->set_input('server_name', $config['server']['server_name']); + $iohandler->set_input('server_port', $config['server']['server_port']); + $iohandler->set_input('script_path', $config['server']['script_path']); + $iohandler->set_input('submit_server', 'submit'); + } +} diff --git a/phpBB/phpbb/install/controller/archive_download.php b/phpBB/phpbb/install/controller/archive_download.php new file mode 100644 index 0000000000..a0f0ba181d --- /dev/null +++ b/phpBB/phpbb/install/controller/archive_download.php @@ -0,0 +1,93 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +use phpbb\exception\http_exception; +use phpbb\install\helper\config; +use Symfony\Component\HttpFoundation\BinaryFileResponse; +use Symfony\Component\HttpFoundation\ResponseHeaderBag; + +class archive_download +{ + /** + * @var config + */ + protected $installer_config; + + /** + * Constructor + * + * @param config $config + */ + public function __construct(config $config) + { + $this->installer_config = $config; + $this->installer_config->load_config(); + } + + /** + * Sends response with the merge conflict archive + * + * Merge conflicts always have to be resolved manually, + * so we use a different archive for that. + * + * @return BinaryFileResponse + */ + public function conflict_archive() + { + $filename = $this->installer_config->get('update_file_conflict_archive', false); + + if (!$filename) + { + throw new http_exception(404, 'URL_NOT_FOUND'); + } + + return $this->send_response($filename); + } + + /** + * Sends response with the updated files' archive + * + * @return BinaryFileResponse + */ + public function update_archive() + { + $filename = $this->installer_config->get('update_file_archive', ''); + + if (!$filename) + { + throw new http_exception(404, 'URL_NOT_FOUND'); + } + + return $this->send_response($filename); + } + + /** + * Generates a download response + * + * @param string $filename Path to the file to download + * + * @return BinaryFileResponse Response object + */ + private function send_response($filename) + { + $response = new BinaryFileResponse($filename); + $response->setContentDisposition( + ResponseHeaderBag::DISPOSITION_ATTACHMENT, + basename($filename) + ); + + return $response; + } +} diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php new file mode 100644 index 0000000000..2dad42b4b6 --- /dev/null +++ b/phpBB/phpbb/install/controller/helper.php @@ -0,0 +1,417 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +use phpbb\install\helper\config; +use phpbb\install\helper\navigation\navigation_provider; +use phpbb\language\language; +use phpbb\language\language_file_helper; +use phpbb\path_helper; +use phpbb\request\request; +use phpbb\request\request_interface; +use phpbb\routing\router; +use phpbb\symfony_request; +use phpbb\template\template; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Cookie; + +/** + * A duplicate of \phpbb\controller\helper + * + * This class is necessary because of controller\helper's legacy function calls + * to page_header() page_footer() functions which has unavailable dependencies. + */ +class helper +{ + /** + * @var config + */ + protected $installer_config; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var bool|string + */ + protected $language_cookie; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $lang_helper; + + /** + * @var \phpbb\install\helper\navigation\navigation_provider + */ + protected $navigation_provider; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var \phpbb\path_helper + */ + protected $path_helper; + + /** + * @var \phpbb\request\request + */ + protected $phpbb_request; + + /** + * @var \phpbb\symfony_request + */ + protected $request; + + /** + * @var \phpbb\routing\router + */ + protected $router; + + /** + * @var string + */ + protected $phpbb_admin_path; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param config $config + * @param language $language + * @param language_file_helper $lang_helper + * @param navigation_provider $nav + * @param template $template + * @param path_helper $path_helper + * @param request $phpbb_request + * @param symfony_request $request + * @param router $router + * @param string $phpbb_root_path + */ + public function __construct(config $config, language $language, language_file_helper $lang_helper, navigation_provider $nav, template $template, path_helper $path_helper, request $phpbb_request, symfony_request $request, router $router, $phpbb_root_path) + { + $this->installer_config = $config; + $this->language = $language; + $this->language_cookie = false; + $this->lang_helper = $lang_helper; + $this->navigation_provider = $nav; + $this->template = $template; + $this->path_helper = $path_helper; + $this->phpbb_request = $phpbb_request; + $this->request = $request; + $this->router = $router; + $this->phpbb_root_path = $phpbb_root_path; + $this->phpbb_admin_path = $phpbb_root_path . 'adm/'; + } + + /** + * Automate setting up the page and creating the response object. + * + * @param string $template_file The template handle to render + * @param string $page_title The title of the page to output + * @param bool $selected_language True to enable language selector it, false otherwise + * @param int $status_code The status code to be sent to the page header + * + * @return Response object containing rendered page + */ + public function render($template_file, $page_title = '', $selected_language = false, $status_code = 200) + { + $this->page_header($page_title, $selected_language); + + $this->template->set_filenames(array( + 'body' => $template_file, + )); + + $response = new Response($this->template->assign_display('body'), $status_code); + + // Set language cookie + if ($this->language_cookie !== false) + { + $cookie = new Cookie('lang', $this->language_cookie, time() + 3600); + $response->headers->setCookie($cookie); + + $this->language_cookie = false; + } + + return $response; + } + + /** + * Returns path from route name + * + * @param string $route_name + * + * @return string + */ + public function route($route_name) + { + $url = $this->router->generate($route_name); + + return $url; + } + + /** + * Handles language selector form + */ + public function handle_language_select() + { + $lang = null; + + // Check if language form has been submited + $submit = $this->phpbb_request->variable('change_lang', ''); + if (!empty($submit)) + { + $lang = $this->phpbb_request->variable('language', ''); + + if (!empty($lang)) + { + $this->language_cookie = $lang; + } + } + + // Retrieve language from cookie + $lang_cookie = $this->phpbb_request->variable('lang', '', false, request_interface::COOKIE); + if (empty($lang) && !empty($lang_cookie)) + { + $lang = $lang_cookie; + $this->language_cookie = $lang; + } + + $lang = (!empty($lang) && strpos($lang, '/') === false) ? $lang : null; + + $this->render_language_select($lang); + + if ($lang !== null) + { + $this->language->set_user_language($lang, true); + $this->installer_config->set('user_language', $lang); + } + } + + /** + * Process navigation data to reflect active/completed stages + * + * @param \phpbb\install\helper\iohandler\iohandler_interface|null $iohandler + */ + public function handle_navigation($iohandler = null) + { + $nav_data = $this->installer_config->get_navigation_data(); + + // Set active navigation stage + if (isset($nav_data['active']) && is_array($nav_data['active'])) + { + if ($iohandler !== null) + { + $iohandler->set_active_stage_menu($nav_data['active']); + } + + $this->navigation_provider->set_nav_property($nav_data['active'], array( + 'selected' => true, + 'completed' => false, + )); + } + + // Set finished navigation stages + if (isset($nav_data['finished']) && is_array($nav_data['finished'])) + { + foreach ($nav_data['finished'] as $finished_stage) + { + if ($iohandler !== null) + { + $iohandler->set_finished_stage_menu($finished_stage); + } + + $this->navigation_provider->set_nav_property($finished_stage, array( + 'selected' => false, + 'completed' => true, + )); + } + } + } + + /** + * Set default template variables + * + * @param string $page_title Title of the page + * @param bool $selected_language True to enable language selector it, false otherwise + */ + protected function page_header($page_title, $selected_language = false) + { + // Path to templates + $paths = array($this->phpbb_root_path . 'install/update/new/adm/', $this->phpbb_admin_path); + $paths = array_filter($paths, 'is_dir'); + $path = array_shift($paths); + $path = substr($path, strlen($this->phpbb_root_path)); + + $this->template->assign_vars(array( + 'L_CHANGE' => $this->language->lang('CHANGE'), + 'L_COLON' => $this->language->lang('COLON'), + 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), + 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), + 'L_SKIP' => $this->language->lang('SKIP'), + 'PAGE_TITLE' => $this->language->lang($page_title), + 'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . $path . 'images', + 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . $path . '../assets/javascript/jquery.min.js', + 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . $path . 'style', + 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . $path . '../assets', + + 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), + 'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($this->language->lang('DIRECTION') === 'ltr') ? 'right' : 'left', + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_LANG_SELECT' => $selected_language, + + 'S_USER_LANG' => $this->language->lang('USER_LANG'), + )); + + $this->render_navigation(); + } + + /** + * Render navigation + */ + protected function render_navigation() + { + // Get navigation items + $nav_array = $this->navigation_provider->get(); + $nav_array = $this->sort_navigation_level($nav_array); + + $active_main_menu = $this->get_active_main_menu($nav_array); + + // Pass navigation to template + foreach ($nav_array as $key => $entry) + { + $this->template->assign_block_vars('t_block1', array( + 'L_TITLE' => $this->language->lang($entry['label']), + 'S_SELECTED' => ($active_main_menu === $key), + 'U_TITLE' => $this->route($entry['route']), + )); + + if (is_array($entry[0]) && $active_main_menu === $key) + { + $entry[0] = $this->sort_navigation_level($entry[0]); + + foreach ($entry[0] as $name => $sub_entry) + { + if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) + { + $this->template->assign_block_vars('l_block2', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), + 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), + 'STAGE_NAME' => $name, + )); + } + else + { + $this->template->assign_block_vars('l_block1', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), + 'U_TITLE' => $this->route($sub_entry['route']), + )); + } + } + } + } + } + + /** + * Render language select form + * + * @param string $selected_language + */ + protected function render_language_select($selected_language = null) + { + $langs = $this->lang_helper->get_available_languages(); + foreach ($langs as $lang) + { + $this->template->assign_block_vars('language_select_item', array( + 'VALUE' => $lang['iso'], + 'NAME' => $lang['local_name'], + 'SELECTED' => ($lang['iso'] === $selected_language), + )); + } + } + + /** + * Returns the name of the active main menu item + * + * @param array $nav_array + * + * @return string|bool Returns the name of the active main menu element, if the element not found, returns false + */ + protected function get_active_main_menu($nav_array) + { + $active_route = $this->request->get('_route'); + + foreach ($nav_array as $nav_name => $nav_options) + { + $current_menu = $nav_name; + + if (isset($nav_options['route']) && $nav_options['route'] === $active_route) + { + return $nav_name; + } + + if (is_array($nav_options[0])) + { + foreach ($nav_options[0] as $sub_menus) + { + if (isset($sub_menus['route']) && $sub_menus['route'] === $active_route) + { + return $current_menu; + } + } + } + } + + return false; + } + + /** + * Sorts the top level of navigation array + * + * @param array $nav_array Navigation array + * + * @return array + */ + protected function sort_navigation_level($nav_array) + { + $sorted = array(); + foreach ($nav_array as $key => $nav) + { + $order = (isset($nav['order'])) ? $nav['order'] : 0; + $sorted[$order][$key] = $nav; + } + + // Linearization of navigation array + $nav_array = array(); + ksort($sorted); + foreach ($sorted as $nav) + { + $nav_array = array_merge($nav_array, $nav); + } + + return $nav_array; + } +} diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php new file mode 100644 index 0000000000..b987d91c6a --- /dev/null +++ b/phpBB/phpbb/install/controller/install.php @@ -0,0 +1,173 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +use phpbb\exception\http_exception; +use phpbb\install\helper\install_helper; +use phpbb\install\helper\navigation\navigation_provider; +use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpFoundation\Response; +use phpbb\install\helper\iohandler\factory; +use phpbb\template\template; +use phpbb\request\request_interface; +use phpbb\install\installer; +use phpbb\language\language; + +/** + * Controller for installing phpBB + */ +class install +{ + /** + * @var helper + */ + protected $controller_helper; + + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var navigation_provider + */ + protected $menu_provider; + + /** + * @var language + */ + protected $language; + + /** + * @var template + */ + protected $template; + + /** + * @var request_interface + */ + protected $request; + + /** + * @var installer + */ + protected $installer; + + /** + * @var install_helper + */ + protected $install_helper; + + /** + * Constructor + * + * @param helper $helper + * @param factory $factory + * @param navigation_provider $nav_provider + * @param language $language + * @param template $template + * @param request_interface $request + * @param installer $installer + * @param install_helper $install_helper + */ + public function __construct(helper $helper, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer, install_helper $install_helper) + { + $this->controller_helper = $helper; + $this->iohandler_factory = $factory; + $this->menu_provider = $nav_provider; + $this->language = $language; + $this->template = $template; + $this->request = $request; + $this->installer = $installer; + $this->install_helper = $install_helper; + } + + /** + * Controller logic + * + * @return Response|StreamedResponse + * + * @throws http_exception When phpBB is already installed + */ + public function handle() + { + if ($this->install_helper->is_phpbb_installed()) + { + throw new http_exception(403, 'INSTALL_PHPBB_INSTALLED'); + } + + $this->template->assign_vars(array( + 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), + )); + + // Set up input-output handler + if ($this->request->is_ajax()) + { + $this->iohandler_factory->set_environment('ajax'); + } + else + { + $this->iohandler_factory->set_environment('nojs'); + } + + // Set the appropriate input-output handler + $this->installer->set_iohandler($this->iohandler_factory->get()); + + if ($this->request->is_ajax()) + { + $installer = $this->installer; + $response = new StreamedResponse(); + $response->setCallback(function() use ($installer) { + $installer->run(); + }); + + // Try to bypass any server output buffers + $response->headers->set('X-Accel-Buffering', 'no'); + + return $response; + } + else + { + // Determine whether the installation was started or not + if (true) + { + $this->controller_helper->handle_language_select(); + + // Set active stage + $this->menu_provider->set_nav_property( + array('install', 0, 'introduction'), + array( + 'selected' => true, + 'completed' => false, + ) + ); + + // If not, let's render the welcome page + $this->template->assign_vars(array( + 'SHOW_INSTALL_START_FORM' => true, + 'TITLE' => $this->language->lang('INSTALL_INTRO'), + 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'), + )); + + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $this->controller_helper->handle_navigation($iohandler); + + return $this->controller_helper->render('installer_install.html', 'INSTALL', true); + } + + // @todo: implement no js controller logic + } + } +} diff --git a/phpBB/phpbb/install/controller/installer_index.php b/phpBB/phpbb/install/controller/installer_index.php new file mode 100644 index 0000000000..c2d9572284 --- /dev/null +++ b/phpBB/phpbb/install/controller/installer_index.php @@ -0,0 +1,81 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +class installer_index +{ + /** + * @var helper + */ + protected $helper; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param helper $helper + * @param \phpbb\language\language $language + * @param \phpbb\template\template $template + * @param string $phpbb_root_path + */ + public function __construct(helper $helper, \phpbb\language\language $language, \phpbb\template\template $template, $phpbb_root_path) + { + $this->helper = $helper; + $this->language = $language; + $this->template = $template; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function handle($mode) + { + $this->helper->handle_language_select(); + + switch ($mode) + { + case "intro": + $title = $this->language->lang('INTRODUCTION_TITLE'); + $body = $this->language->lang('INTRODUCTION_BODY'); + break; + case "support": + $title = $this->language->lang('SUPPORT_TITLE'); + $body = $this->language->lang('SUPPORT_BODY'); + break; + case "license": + $title = $this->language->lang('LICENSE_TITLE'); + $body = implode("<br/>\n", file($this->phpbb_root_path . 'docs/LICENSE.txt')); + break; + } + + $this->template->assign_vars(array( + 'TITLE' => $title, + 'BODY' => $body, + )); + + return $this->helper->render('installer_main.html', $title, true); + } +} diff --git a/phpBB/phpbb/install/controller/update.php b/phpBB/phpbb/install/controller/update.php new file mode 100644 index 0000000000..9fff11cae8 --- /dev/null +++ b/phpBB/phpbb/install/controller/update.php @@ -0,0 +1,167 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +use phpbb\exception\http_exception; +use phpbb\install\helper\install_helper; +use phpbb\install\helper\iohandler\factory; +use phpbb\install\helper\navigation\navigation_provider; +use phpbb\install\installer; +use phpbb\language\language; +use phpbb\request\request_interface; +use phpbb\template\template; +use Symfony\Component\HttpFoundation\StreamedResponse; + +/** + * Updater controller + */ +class update +{ + /** + * @var helper + */ + protected $controller_helper; + + /** + * @var installer + */ + protected $installer; + + /** + * @var install_helper + */ + protected $install_helper; + + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var language + */ + protected $language; + + /** + * @var navigation_provider + */ + protected $menu_provider; + + /** + * @var request_interface + */ + protected $request; + + /** + * @var template + */ + protected $template; + + /** + * Constructor + * + * @param helper $controller_helper + * @param installer $installer + * @param install_helper $install_helper + * @param factory $iohandler + * @param language $language + * @param navigation_provider $menu_provider + * @param request_interface $request + * @param template $template + */ + public function __construct(helper $controller_helper, installer $installer, install_helper $install_helper, factory $iohandler, language $language, navigation_provider $menu_provider, request_interface $request, template $template) + { + $this->controller_helper = $controller_helper; + $this->installer = $installer; + $this->install_helper = $install_helper; + $this->iohandler_factory = $iohandler; + $this->language = $language; + $this->menu_provider = $menu_provider; + $this->request = $request; + $this->template = $template; + } + + /** + * Controller entry point + * + * @return Response|StreamedResponse + * + * @throws http_exception When phpBB is not installed + */ + public function handle() + { + if (!$this->install_helper->is_phpbb_installed()) + { + throw new http_exception(403, 'INSTALL_PHPBB_NOT_INSTALLED'); + } + + $this->template->assign_vars(array( + 'U_ACTION' => $this->controller_helper->route('phpbb_installer_update'), + )); + + // Set up input-output handler + if ($this->request->is_ajax()) + { + $this->iohandler_factory->set_environment('ajax'); + } + else + { + $this->iohandler_factory->set_environment('nojs'); + } + + // Set the appropriate input-output handler + $this->installer->set_iohandler($this->iohandler_factory->get()); + + // Render the intro page + if ($this->request->is_ajax()) + { + $installer = $this->installer; + $response = new StreamedResponse(); + $response->setCallback(function() use ($installer) { + $installer->run(); + }); + + // Try to bypass any server output buffers + $response->headers->set('X-Accel-Buffering', 'no'); + $response->headers->set('Content-type', 'application/json'); + + return $response; + } + else + { + $this->controller_helper->handle_language_select(); + + // Set active stage + $this->menu_provider->set_nav_property( + array('update', 0, 'introduction'), + array( + 'selected' => true, + 'completed' => false, + ) + ); + + $this->template->assign_vars(array( + 'SHOW_INSTALL_START_FORM' => true, + 'TITLE' => $this->language->lang('UPDATE_INSTALLATION'), + 'CONTENT' => $this->language->lang('UPDATE_INSTALLATION_EXPLAIN'), + )); + + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $this->controller_helper->handle_navigation($iohandler); + + return $this->controller_helper->render('installer_update.html', 'UPDATE_INSTALLATION', true); + } + } +} diff --git a/phpBB/phpbb/install/event/kernel_exception_subscriber.php b/phpBB/phpbb/install/event/kernel_exception_subscriber.php new file mode 100644 index 0000000000..c2960cb13c --- /dev/null +++ b/phpBB/phpbb/install/event/kernel_exception_subscriber.php @@ -0,0 +1,125 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\event; + +use phpbb\exception\exception_interface; +use phpbb\install\controller\helper; +use phpbb\language\language; +use phpbb\template\template; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; + +/** + * Exception handler for the installer + */ +class kernel_exception_subscriber implements EventSubscriberInterface +{ + /** + * @var helper + */ + protected $controller_helper; + + /** + * @var language + */ + protected $language; + + /** + * @var template + */ + protected $template; + + /** + * Constructor + * + * @param helper $controller_helper + * @param language $language + * @param template $template + */ + public function __construct(helper $controller_helper, language $language, template $template) + { + $this->controller_helper = $controller_helper; + $this->language = $language; + $this->template = $template; + } + + /** + * This listener is run when the KernelEvents::EXCEPTION event is triggered + * + * @param GetResponseForExceptionEvent $event + */ + public function on_kernel_exception(GetResponseForExceptionEvent $event) + { + $exception = $event->getException(); + $message = $exception->getMessage(); + + if ($exception instanceof exception_interface) + { + $message = $this->language->lang_array($message, $exception->get_parameters()); + } + + if (!$event->getRequest()->isXmlHttpRequest()) + { + $this->template->assign_vars(array( + 'TITLE' => $this->language->lang('INFORMATION'), + 'BODY' => $message, + )); + + $response = $this->controller_helper->render( + 'installer_main.html', + $this->language->lang('INFORMATION'), + false, + 500 + ); + } + else + { + $data = array(); + + if (!empty($message)) + { + $data['message'] = $message; + } + + if (defined('DEBUG')) + { + $data['trace'] = $exception->getTrace(); + } + + $response = new JsonResponse($data, 500); + } + + if ($exception instanceof HttpExceptionInterface) + { + $response->setStatusCode($exception->getStatusCode()); + $response->headers->add($exception->getHeaders()); + } + + $event->setResponse($response); + } + + /** + * Returns an array of events the object is subscribed to + * + * @return array Array of events the object is subscribed to + */ + static public function getSubscribedEvents() + { + return array( + KernelEvents::EXCEPTION => 'on_kernel_exception', + ); + } +} diff --git a/phpBB/phpbb/install/exception/cannot_build_container_exception.php b/phpBB/phpbb/install/exception/cannot_build_container_exception.php new file mode 100644 index 0000000000..6cf12b008b --- /dev/null +++ b/phpBB/phpbb/install/exception/cannot_build_container_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +/** + * Thrown when the container cannot be built + */ +class cannot_build_container_exception extends installer_exception +{ + +} diff --git a/phpBB/phpbb/install/exception/file_updater_failure_exception.php b/phpBB/phpbb/install/exception/file_updater_failure_exception.php new file mode 100644 index 0000000000..46ba2ed32d --- /dev/null +++ b/phpBB/phpbb/install/exception/file_updater_failure_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +/** + * Thrown when the file updater fails + */ +class file_updater_failure_exception extends installer_exception +{ + +} diff --git a/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php b/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php new file mode 100644 index 0000000000..51864c5dca --- /dev/null +++ b/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +/** + * Thrown when installer config is not writable to disk + */ +class installer_config_not_writable_exception extends installer_exception +{ + +} diff --git a/phpBB/phpbb/install/exception/installer_exception.php b/phpBB/phpbb/install/exception/installer_exception.php new file mode 100644 index 0000000000..f17dca8f17 --- /dev/null +++ b/phpBB/phpbb/install/exception/installer_exception.php @@ -0,0 +1,24 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +use phpbb\exception\runtime_exception; + +/** + * Installer's base exception + */ +class installer_exception extends runtime_exception +{ + +} diff --git a/phpBB/phpbb/install/exception/invalid_dbms_exception.php b/phpBB/phpbb/install/exception/invalid_dbms_exception.php new file mode 100644 index 0000000000..38de5f613a --- /dev/null +++ b/phpBB/phpbb/install/exception/invalid_dbms_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +/** + * Thrown when an unavailable DBMS has been selected + */ +class invalid_dbms_exception extends installer_exception +{ + +} diff --git a/phpBB/phpbb/install/exception/jump_to_restart_point_exception.php b/phpBB/phpbb/install/exception/jump_to_restart_point_exception.php new file mode 100644 index 0000000000..b628c4fbe3 --- /dev/null +++ b/phpBB/phpbb/install/exception/jump_to_restart_point_exception.php @@ -0,0 +1,44 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +class jump_to_restart_point_exception extends installer_exception +{ + /** + * @var string + */ + protected $restart_point_name; + + /** + * Constructor + * + * @param string $restart_point_name + */ + public function __construct($restart_point_name) + { + $this->restart_point_name = $restart_point_name; + + parent::__construct(); + } + + /** + * Returns the restart point's name + * + * @return string + */ + public function get_restart_point_name() + { + return $this->restart_point_name; + } +} diff --git a/phpBB/phpbb/install/exception/resource_limit_reached_exception.php b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php new file mode 100644 index 0000000000..025e09fbd3 --- /dev/null +++ b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +/** + * Thrown when the installer is out of memory or time + */ +class resource_limit_reached_exception extends installer_exception +{ + +} diff --git a/phpBB/phpbb/install/exception/user_interaction_required_exception.php b/phpBB/phpbb/install/exception/user_interaction_required_exception.php new file mode 100644 index 0000000000..d65a448841 --- /dev/null +++ b/phpBB/phpbb/install/exception/user_interaction_required_exception.php @@ -0,0 +1,25 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\exception; + +/** + * This exception should be thrown when user interaction is inevitable + * + * Note: Please note that the output should already be setup for the user + * when you use throw this exception + */ +class user_interaction_required_exception extends installer_exception +{ + +} diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php new file mode 100644 index 0000000000..0f0840f470 --- /dev/null +++ b/phpBB/phpbb/install/helper/config.php @@ -0,0 +1,438 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +use phpbb\install\exception\installer_config_not_writable_exception; + +/** + * Stores common settings and installation status + */ +class config +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Array which contains config settings for the installer + * + * The array will also store all the user input, as well as any + * data that is passed to other tasks by a task. + * + * @var array + */ + protected $installer_config; + + /** + * @var string + */ + protected $install_config_file; + + /** + * @var \bantu\IniGetWrapper\IniGetWrapper + */ + protected $php_ini; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Array containing progress information + * + * @var array + */ + protected $progress_data; + + /** + * Array containing system information + * + * The array contains run time and memory limitations. + * + * @var array + */ + protected $system_data; + + /** + * Array containing navigation bar information + * + * @var array + */ + protected $navigation_data; + + /** + * Flag indicating that config file should be cleaned up + * + * @var bool + */ + protected $do_clean_up; + + /** + * Constructor + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \bantu\IniGetWrapper\IniGetWrapper $php_ini, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->php_ini = $php_ini; + $this->phpbb_root_path = $phpbb_root_path; + $this->do_clean_up = false; + + // Set up data arrays + $this->navigation_data = array(); + $this->installer_config = array(); + $this->system_data = array(); + $this->progress_data = array( + 'last_task_module_name' => '', // Stores the service name of the latest finished module + 'last_task_name' => '', // Stores the service name of the latest finished task + 'max_task_progress' => 0, + 'current_task_progress' => 0, + '_restart_points' => array(), + 'use_restart_point' => false, + ); + + $this->install_config_file = $this->phpbb_root_path . 'store/install_config.php'; + + $this->setup_system_data(); + } + + /** + * Returns data for a specified parameter + * + * @param string $param_name Name of the parameter to return + * @param mixed $default Default value to return when the specified data + * does not exist. + * + * @return mixed value of the specified parameter or the default value if the data + * cannot be recovered. + */ + public function get($param_name, $default = false) + { + return (isset($this->installer_config[$param_name])) ? $this->installer_config[$param_name] : $default; + } + + /** + * Sets a parameter in installer_config + * + * @param string $param_name Name of the parameter + * @param mixed $value Values to set the parameter + */ + public function set($param_name, $value) + { + $this->installer_config = array_merge($this->installer_config, array( + $param_name => $value, + )); + } + + /** + * Returns system parameter + * + * @param string $param_name Name of the parameter + * + * @return mixed Returns system parameter if it is defined, false otherwise + */ + public function system_get($param_name) + { + return (isset($this->system_data[$param_name])) ? $this->system_data[$param_name] : false; + } + + /** + * Returns remaining time until the run time limit + * + * @return int Remaining time until the run time limit in seconds + */ + public function get_time_remaining() + { + if ($this->system_data['max_execution_time'] <= 0) + { + return 1; + } + + return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - time(); + } + + /** + * Returns remaining memory available for PHP + * + * @return int Remaining memory until reaching the limit + */ + public function get_memory_remaining() + { + if ($this->system_data['memory_limit'] <= 0) + { + return 1; + } + + if (function_exists('memory_get_usage')) + { + return ($this->system_data['memory_limit'] - memory_get_usage()); + } + + // If we cannot get the information then just return a positive number (and cross fingers) + return 1; + } + + /** + * Saves the latest executed task + * + * @param string $task_service_name Name of the installer task service + */ + public function set_finished_task($task_service_name) + { + $this->progress_data['last_task_name'] = $task_service_name; + } + + /** + * Set active module + * + * @param string $module_service_name Name of the installer module service + */ + public function set_active_module($module_service_name) + { + $this->progress_data['last_task_module_name'] = $module_service_name; + } + + /** + * Getter for progress data + * + * @return array + */ + public function get_progress_data() + { + return $this->progress_data; + } + + /** + * Recovers install configuration from file + */ + public function load_config() + { + if (!$this->filesystem->exists($this->install_config_file)) + { + return; + } + + $file_content = @file_get_contents($this->install_config_file); + $serialized_data = trim(substr($file_content, 8)); + + $this->installer_config = array(); + $this->progress_data = array(); + $this->navigation_data = array(); + + if (!empty($serialized_data)) + { + $unserialized_data = json_decode($serialized_data, true); + + $this->installer_config = (is_array($unserialized_data['installer_config'])) ? $unserialized_data['installer_config'] : array(); + $this->progress_data = (is_array($unserialized_data['progress_data'])) ? $unserialized_data['progress_data'] : array(); + $this->navigation_data = (is_array($unserialized_data['navigation_data'])) ? $unserialized_data['navigation_data'] : array(); + } + } + + /** + * Creates a progress restart point + * + * Restart points can be used to repeat certain tasks periodically. + * You need to call this method from the first task you want to repeat. + * + * @param string $name Name of the restart point + */ + public function create_progress_restart_point($name) + { + $tmp_progress_data = $this->progress_data; + unset($tmp_progress_data['_restart_points']); + + $this->progress_data['_restart_points'][$name] = $tmp_progress_data; + } + + /** + * Set restart point to continue from + * + * @param string $name Name of the restart point + * + * @return bool Returns false if the restart point name does not exist, otherwise true + */ + public function jump_to_restart_point($name) + { + if (!isset($this->progress_data['_restart_points'][$name]) || empty($this->progress_data['_restart_points'][$name])) + { + return false; + } + + foreach ($this->progress_data['_restart_points'][$name] as $key => $value) + { + $this->progress_data[$key] = $value; + } + + return true; + } + + /** + * Returns whether a restart point with a given name exists or not + * + * @param string $name Name of the restart point + * + * @return bool + */ + public function has_restart_point($name) + { + return isset($this->progress_data['_restart_points'][$name]); + } + + /** + * Dumps install configuration to disk + */ + public function save_config() + { + if ($this->do_clean_up) + { + @unlink($this->install_config_file); + return; + } + + // Create array to save + $save_array = array( + 'installer_config' => $this->installer_config, + 'progress_data' => $this->progress_data, + 'navigation_data' => $this->navigation_data, + ); + + // Create file content + $file_content = '<?php // '; + $file_content .= json_encode($save_array); + $file_content .= "\n"; + + // Dump file_content to disk + $fp = @fopen($this->install_config_file, 'w'); + if (!$fp) + { + throw new installer_config_not_writable_exception(); + } + + fwrite($fp, $file_content); + fclose($fp); + } + + /** + * Increments the task progress + * + * @param int $increment_by The amount to increment by + */ + public function increment_current_task_progress($increment_by = 1) + { + $this->progress_data['current_task_progress'] += $increment_by; + + if ($this->progress_data['current_task_progress'] > $this->progress_data['max_task_progress']) + { + $this->progress_data['current_task_progress'] = $this->progress_data['max_task_progress']; + } + } + + /** + * Sets the task progress to a specific number + * + * @param int $task_progress The task progress number to be set + */ + public function set_current_task_progress($task_progress) + { + $this->progress_data['current_task_progress'] = $task_progress; + } + + /** + * Sets the number of tasks belonging to the installer in the current mode. + * + * @param int $task_progress_count Number of tasks + */ + public function set_task_progress_count($task_progress_count) + { + $this->progress_data['max_task_progress'] = $task_progress_count; + } + + /** + * Returns the number of the current task being executed + * + * @return int + */ + public function get_current_task_progress() + { + return $this->progress_data['current_task_progress']; + } + + /** + * Returns the number of tasks belonging to the installer in the current mode. + * + * @return int + */ + public function get_task_progress_count() + { + return $this->progress_data['max_task_progress']; + } + + /** + * Marks stage as completed in the navigation bar + * + * @param array $nav_path Array to the navigation elem + */ + public function set_finished_navigation_stage($nav_path) + { + $this->navigation_data['finished'][] = $nav_path; + } + + /** + * Marks stage as active in the navigation bar + * + * @param array $nav_path Array to the navigation elem + */ + public function set_active_navigation_stage($nav_path) + { + $this->navigation_data['active'] = $nav_path; + } + + /** + * Returns navigation data + * + * @return array + */ + public function get_navigation_data() + { + return $this->navigation_data; + } + + /** + * Removes install config file + */ + public function clean_up_config_file() + { + $this->do_clean_up = true; + @unlink($this->install_config_file); + } + + /** + * Filling up system_data array + */ + protected function setup_system_data() + { + // Query maximum runtime from php.ini + $execution_time = $this->php_ini->getNumeric('max_execution_time'); + $execution_time = min(15, $execution_time / 2); + $this->system_data['max_execution_time'] = $execution_time; + + // Set start time + $this->system_data['start_time'] = time(); + + // Get memory limit + $this->system_data['memory_limit'] = $this->php_ini->getBytes('memory_limit'); + } +} diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php new file mode 100644 index 0000000000..6c1ecd2d02 --- /dev/null +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -0,0 +1,194 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +use phpbb\cache\driver\dummy; +use phpbb\install\exception\cannot_build_container_exception; +use phpbb\language\language; +use phpbb\request\request; + +class container_factory +{ + /** + * @var language + */ + protected $language; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var \phpbb\request\request + */ + protected $request; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * The full phpBB container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * Constructor + * + * @param language $language Language service + * @param request $request Request interface + * @param update_helper $update_helper Update helper + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(language $language, request $request, update_helper $update_helper, $phpbb_root_path, $php_ext) + { + $this->language = $language; + $this->request = $request; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->container = null; + } + + /** + * Container getter + * + * @param null|string $service_name Name of the service to return + * + * @return \Symfony\Component\DependencyInjection\ContainerInterface|Object phpBB's dependency injection container + * or the service specified in $service_name + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException If the service is not defined + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException When a circular reference is detected + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException When the service is not defined + */ + public function get($service_name = null) + { + // Check if container was built, if not try to build it + if ($this->container === null) + { + $this->build_container(); + } + + return ($service_name === null) ? $this->container : $this->container->get($service_name); + } + + /** + * Returns the specified parameter from the container + * + * @param string $param_name + * + * @return mixed + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + */ + public function get_parameter($param_name) + { + // Check if container was built, if not try to build it + if ($this->container === null) + { + $this->build_container(); + } + + return $this->container->getParameter($param_name); + } + + /** + * Build dependency injection container + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + */ + protected function build_container() + { + // If the container has been already built just return. + // Although this should never happen + if ($this->container instanceof \Symfony\Component\DependencyInjection\ContainerInterface) + { + return; + } + + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (!filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + throw new cannot_build_container_exception(); + } + + $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext); + $phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext); + + // For BC with functions that we need during install + global $phpbb_container, $table_prefix; + + $disable_super_globals = $this->request->super_globals_disabled(); + + // This is needed because container_builder::get_env_parameters() uses $_SERVER + if ($disable_super_globals) + { + $this->request->enable_super_globals(); + } + + $other_config_path = $this->phpbb_root_path . 'install/update/new/config'; + $config_path = (is_dir($other_config_path)) ? $other_config_path : $this->phpbb_root_path . 'config'; + + $this->container = $phpbb_container_builder + ->with_environment('production') + ->with_config($phpbb_config_php_file) + ->with_config_path($config_path) + ->without_cache() + ->without_compiled_container() + ->get_container(); + + // Setting request is required for the compatibility globals as those are generated from + // this container + $this->container->register('request')->setSynthetic(true); + $this->container->set('request', $this->request); + + $this->container->register('language')->setSynthetic(true); + $this->container->set('language', $this->language); + + // Replace cache service, as config gets cached, and we don't want that when we are installing + if (!is_dir($other_config_path)) + { + $this->container->register('cache.driver')->setSynthetic(true); + $this->container->set('cache.driver', new dummy()); + } + + $this->container->compile(); + + $phpbb_container = $this->container; + $table_prefix = $phpbb_config_php_file->get('table_prefix'); + + // Restore super globals to previous state + if ($disable_super_globals) + { + $this->request->disable_super_globals(); + } + + // Get compatibilty globals and constants + $this->update_helper->include_file('includes/compatibility_globals.' . $this->php_ext); + $this->update_helper->include_file('includes/constants.' . $this->php_ext); + } +} diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php new file mode 100644 index 0000000000..c4c90a01a4 --- /dev/null +++ b/phpBB/phpbb/install/helper/database.php @@ -0,0 +1,456 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +use phpbb\install\exception\invalid_dbms_exception; + +/** + * Database related general functionality for installer + */ +class database +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var array + */ + protected $supported_dbms = array( + // Note: php 5.5 alpha 2 deprecated mysql. + // Keep mysqli before mysql in this list. + 'mysqli' => array( + 'LABEL' => 'MySQL with MySQLi Extension', + 'SCHEMA' => 'mysql_41', + 'MODULE' => 'mysqli', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysqli', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mysql' => array( + 'LABEL' => 'MySQL', + 'SCHEMA' => 'mysql', + 'MODULE' => 'mysql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysql', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql' => array( + 'LABEL' => 'MS SQL Server 2000+', + 'SCHEMA' => 'mssql', + 'MODULE' => 'mssql', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssql', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql_odbc'=> array( + 'LABEL' => 'MS SQL Server [ ODBC ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'odbc', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssql_odbc', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssqlnative' => array( + 'LABEL' => 'MS SQL Server 2005+ [ Native ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'sqlsrv', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssqlnative', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'oracle' => array( + 'LABEL' => 'Oracle', + 'SCHEMA' => 'oracle', + 'MODULE' => 'oci8', + 'DELIM' => '/', + 'DRIVER' => 'phpbb\db\driver\oracle', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'postgres' => array( + 'LABEL' => 'PostgreSQL 8.3+', + 'SCHEMA' => 'postgres', + 'MODULE' => 'pgsql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\postgres', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'sqlite' => array( + 'LABEL' => 'SQLite', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'sqlite3' => array( + 'LABEL' => 'SQLite3', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite3', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite3', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + ); + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem interface + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Returns an array of available DBMS supported by phpBB + * + * If a DBMS is specified it will only return data for that DBMS + * and will load its extension if necessary. + * + * @param mixed $dbms name of the DBMS that's info is required or false for all DBMS info + * @param bool $return_unavailable set it to true if you expect unavailable but supported DBMS + * returned as well + * @param bool $only_20x_options set it to true if you only want to recover 2.0.x options + * + * @return array Array of available and supported DBMS + */ + public function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false) + { + $available_dbms = $this->supported_dbms; + + if ($dbms) + { + if (isset($this->supported_dbms[$dbms])) + { + $available_dbms = array($dbms => $this->supported_dbms[$dbms]); + } + else + { + return array(); + } + } + + $any_dbms_available = false; + foreach ($available_dbms as $db_name => $db_array) + { + if ($only_20x_options && !$db_array['2.0.x']) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $dll = $db_array['MODULE']; + if (!@extension_loaded($dll)) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $any_dbms_available = true; + } + + if ($return_unavailable) + { + $available_dbms['ANY_DB_SUPPORT'] = $any_dbms_available; + } + + return $available_dbms; + } + + /** + * Removes "/* style" as well as "# style" comments from $input. + * + * @param string $sql_query Input string + * + * @return string Input string with comments removed + */ + public function remove_comments($sql_query) + { + // Remove /* */ comments (http://ostermiller.org/findcomment.html) + $sql_query = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql_query); + + // Remove # style comments + $sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query)); + + return $sql_query; + } + + /** + * split_sql_file() will split an uploaded sql file into single sql statements. + * + * Note: expects trim() to have already been run on $sql. + * + * @param string $sql SQL statements + * @param string $delimiter Delimiter between sql statements + * + * @return array Array of sql statements + */ + public function split_sql_file($sql, $delimiter) + { + $sql = str_replace("\r" , '', $sql); + $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); + + $data = array_map('trim', $data); + + // The empty case + $end_data = end($data); + + if (empty($end_data)) + { + unset($data[key($data)]); + } + + return $data; + } + + /** + * Validates table prefix + * + * @param string $dbms The selected dbms + * @param string $table_prefix The table prefix to validate + * + * @return bool|array true if table prefix is valid, array of errors otherwise + * + * @throws \phpbb\install\exception\invalid_dbms_exception When $dbms is not a valid + */ + public function validate_table_prefix($dbms, $table_prefix) + { + $errors = array(); + + if (!preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $table_prefix)) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_INVALID_PREFIX', + ); + } + + // Do dbms specific checks + $dbms_info = $this->get_available_dbms($dbms); + switch ($dbms_info[$dbms]['SCHEMA']) + { + case 'mysql': + case 'mysql_41': + $prefix_length = 36; + break; + case 'mssql': + $prefix_length = 90; + break; + case 'oracle': + $prefix_length = 6; + break; + case 'postgres': + $prefix_length = 36; + break; + case 'sqlite': + $prefix_length = 200; + break; + default: + throw new invalid_dbms_exception(); + break; + } + + // Check the prefix length to ensure that index names are not too long + if (strlen($table_prefix) > $prefix_length) + { + $errors[] = array( + 'title' => array('INST_ERR_PREFIX_TOO_LONG', $prefix_length), + ); + } + + return (empty($errors)) ? true : $errors; + } + + /** + * Check if the user provided database parameters are correct + * + * This function checks the database connection data and also checks for + * any other problems that could cause an error during the installation + * such as if there is any database table names conflicting. + * + * Note: The function assumes that $table_prefix has been already validated + * with validate_table_prefix(). + * + * @param string $dbms Selected database type + * @param string $dbhost Database host address + * @param int $dbport Database port number + * @param string $dbuser Database username + * @param string $dbpass Database password + * @param string $dbname Database name + * @param string $table_prefix Database table prefix + * + * @return array|bool Returns true if test is successful, array of errors otherwise + */ + public function check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix) + { + $dbms_info = $this->get_available_dbms($dbms); + $dbms_info = $dbms_info[$dbms]; + $errors = array(); + + // Instantiate it and set return on error true + /** @var \phpbb\db\driver\driver_interface $db */ + $db = new $dbms_info['DRIVER']; + $db->sql_return_on_error(true); + + // Check that we actually have a database name before going any further + if (!in_array($dbms_info['SCHEMA'], array('sqlite', 'oracle'), true) && $dbname === '') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_NAME', + ); + } + + // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea + if ($dbms_info['SCHEMA'] === 'sqlite' + && stripos($this->filesystem->realpath($dbhost), $this->filesystem->realpath($this->phpbb_root_path) === 0)) + { + $errors[] = array( + 'title' =>'INST_ERR_DB_FORUM_PATH', + ); + } + + // Try to connect to db + if (is_array($db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, false, true))) + { + $db_error = $db->sql_error(); + $errors[] = array( + 'title' => 'INST_ERR_DB_CONNECT', + 'description' => ($db_error['message']) ? utf8_convert_message($db_error['message']) : 'INST_ERR_DB_NO_ERROR', + ); + } + else + { + // Check if there is any table name collisions + $temp_prefix = strtolower($table_prefix); + $table_ary = array( + $temp_prefix . 'attachments', + $temp_prefix . 'config', + $temp_prefix . 'sessions', + $temp_prefix . 'topics', + $temp_prefix . 'users', + ); + + $db_tools_factory = new \phpbb\db\tools\factory(); + $db_tools = $db_tools_factory->get($db); + $tables = $db_tools->sql_list_tables(); + $tables = array_map('strtolower', $tables); + $table_intersect = array_intersect($tables, $table_ary); + + if (sizeof($table_intersect)) + { + $errors[] = array( + 'title' => 'INST_ERR_PREFIX', + ); + } + + // Check if database version is supported + switch ($dbms) + { + case 'mysqli': + if (version_compare($db->sql_server_info(true), '4.1.3', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_MYSQLI', + ); + } + break; + case 'sqlite': + if (version_compare($db->sql_server_info(true), '2.8.2', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_SQLITE', + ); + } + break; + case 'sqlite3': + if (version_compare($db->sql_server_info(true), '3.6.15', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_SQLITE3', + ); + } + break; + case 'oracle': + $sql = "SELECT * + FROM NLS_DATABASE_PARAMETERS + WHERE PARAMETER = 'NLS_RDBMS_VERSION' + OR PARAMETER = 'NLS_CHARACTERSET'"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $stats[$row['parameter']] = $row['value']; + } + $db->sql_freeresult($result); + + if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_ORACLE', + ); + } + break; + case 'postgres': + $sql = "SHOW server_encoding;"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_POSTGRES', + ); + } + break; + } + } + + return (empty($errors)) ? true : $errors; + } +} diff --git a/phpBB/phpbb/install/helper/file_updater/compression_file_updater.php b/phpBB/phpbb/install/helper/file_updater/compression_file_updater.php new file mode 100644 index 0000000000..ede992fb6e --- /dev/null +++ b/phpBB/phpbb/install/helper/file_updater/compression_file_updater.php @@ -0,0 +1,133 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\file_updater; + +use phpbb\install\helper\update_helper; + +/** + * File updater for generating archive with updated files + */ +class compression_file_updater implements file_updater_interface +{ + /** + * @var \compress + */ + protected $compress; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param update_helper $update_helper + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(update_helper $update_helper, $phpbb_root_path, $php_ext) + { + $this->compress = null; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Set the compression method + * + * @param string $method Compression method's file extension + * + * @return string Archive's filename + */ + public function init($method) + { + $this->update_helper->include_file('includes/functions_compress.' . $this->php_ext); + + $archive_filename = 'update_archive_' . time() . '_' . uniqid(); + $path = $this->phpbb_root_path . 'store/' . $archive_filename . '' . $method; + + if ($method === '.zip') + { + $this->compress = new \compress_zip('w', $path); + } + else + { + $this->compress = new \compress_tar('w', $path, $method); + } + + return $path; + } + + /** + * Close archive writing process + */ + public function close() + { + $this->compress->close(); + } + + /** + * {@inheritdoc} + */ + public function delete_file($path_to_file) + { + // We do absolutely nothing here, as this function is called when a file should be + // removed from the filesystem, but since this is an archive generator, it clearly + // cannot do that. + } + + /** + * {@inheritdoc} + */ + public function create_new_file($path_to_file_to_create, $source, $create_from_content = false) + { + if ($create_from_content) + { + $this->compress->add_data($source, $path_to_file_to_create); + } + else + { + $this->compress->add_custom_file($source, $path_to_file_to_create); + } + } + + /** + * {@inheritdoc} + */ + public function update_file($path_to_file_to_update, $source, $create_from_content = false) + { + // Both functions are identical here + $this->create_new_file($path_to_file_to_update, $source, $create_from_content); + } + + /** + * {@inheritdoc} + */ + public function get_method_name() + { + return 'compression'; + } +} diff --git a/phpBB/phpbb/install/helper/file_updater/factory.php b/phpBB/phpbb/install/helper/file_updater/factory.php new file mode 100644 index 0000000000..d3a2f22782 --- /dev/null +++ b/phpBB/phpbb/install/helper/file_updater/factory.php @@ -0,0 +1,69 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\file_updater; + +use phpbb\di\service_collection; +use phpbb\install\exception\file_updater_failure_exception; + +/** + * File updater factory + */ +class factory +{ + /** + * @var array + */ + protected $file_updaters; + + /** + * Constructor + * + * @param service_collection $collection File updater service collection + */ + public function __construct(service_collection $collection) + { + foreach ($collection as $service) + { + $this->register($service); + } + } + + /** + * Register updater object + * + * @param file_updater_interface $updater Updater object + */ + public function register(file_updater_interface $updater) + { + $name = $updater->get_method_name(); + $this->file_updaters[$name] = $updater; + } + + /** + * Returns file updater object + * + * @param string $name Name of the updater method + * + * @throws file_updater_failure_exception When the specified file updater does not exist + */ + public function get($name) + { + if (!isset($this->file_updaters[$name])) + { + throw new file_updater_failure_exception(); + } + + return $this->file_updaters[$name]; + } +} diff --git a/phpBB/phpbb/install/helper/file_updater/file_updater.php b/phpBB/phpbb/install/helper/file_updater/file_updater.php new file mode 100644 index 0000000000..cc0f5c6b5f --- /dev/null +++ b/phpBB/phpbb/install/helper/file_updater/file_updater.php @@ -0,0 +1,202 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\file_updater; + +use phpbb\filesystem\exception\filesystem_exception; +use phpbb\filesystem\filesystem; +use phpbb\install\exception\file_updater_failure_exception; + +/** + * File updater for direct filesystem access + */ +class file_updater implements file_updater_interface +{ + /** + * @var filesystem + */ + protected $filesystem; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param filesystem $filesystem + * @param string $phpbb_root_path + */ + public function __construct(filesystem $filesystem, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * {@inheritdoc} + * + * @throws file_updater_failure_exception When the file is not writable + * @throws filesystem_exception When the filesystem class fails + */ + public function delete_file($path_to_file) + { + $this->filesystem->remove($this->phpbb_root_path . $path_to_file); + } + + /** + * {@inheritdoc} + * + * @throws file_updater_failure_exception When the file is not writable + * @throws filesystem_exception When the filesystem class fails + */ + public function create_new_file($path_to_file_to_create, $source, $create_from_content = false) + { + $path_to_file_to_create = $this->phpbb_root_path . $path_to_file_to_create; + + $dir = dirname($path_to_file_to_create); + if (!$this->filesystem->exists($dir)) + { + $this->make_dir($dir); + } + + $original_dir_perms = false; + + if (!$this->filesystem->is_writable($dir)) + { + // Extract last 9 bits we actually need + $original_dir_perms = @fileperms($dir) & 511; + $this->filesystem->phpbb_chmod($dir, filesystem::CHMOD_ALL); + } + + if (!$create_from_content) + { + try + { + $this->filesystem->copy($source, $path_to_file_to_create); + } + catch (filesystem_exception $e) + { + $this->write_file($path_to_file_to_create, $source, $create_from_content); + } + } + else + { + $this->write_file($path_to_file_to_create, $source, $create_from_content); + } + + if ($original_dir_perms !== false) + { + $this->filesystem->phpbb_chmod($dir, $original_dir_perms); + } + } + + /** + * {@inheritdoc} + * + * @throws file_updater_failure_exception When the file is not writable + * @throws filesystem_exception When the filesystem class fails + */ + public function update_file($path_to_file_to_update, $source, $create_from_content = false) + { + $path_to_file_to_update = $this->phpbb_root_path . $path_to_file_to_update; + $original_file_perms = false; + + // Maybe necessary for binary files + $dir = dirname($path_to_file_to_update); + if (!$this->filesystem->exists($dir)) + { + $this->make_dir($dir); + } + + if (!$this->filesystem->is_writable($path_to_file_to_update)) + { + // Extract last 9 bits we actually need + $original_file_perms = @fileperms($path_to_file_to_update) & 511; + $this->filesystem->phpbb_chmod($path_to_file_to_update, filesystem::CHMOD_WRITE); + } + + if (!$create_from_content) + { + try + { + $this->filesystem->copy($source, $path_to_file_to_update, true); + } + catch (filesystem_exception $e) + { + $this->write_file($path_to_file_to_update, $source, $create_from_content); + } + } + else + { + $this->write_file($path_to_file_to_update, $source, $create_from_content); + } + + if ($original_file_perms !== false) + { + $this->filesystem->phpbb_chmod($path_to_file_to_update, $original_file_perms); + } + } + + /** + * Creates directory structure + * + * @param string $path Path to the directory where the file should be placed (and non-existent) + */ + private function make_dir($path) + { + if (is_dir($path)) + { + return; + } + + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + $this->filesystem->mkdir($path, 493); // 493 === 0755 + } + + /** + * Fallback function for file writing + * + * @param string $path_to_file Path to the file's location + * @param string $source Path to file to copy or string with the new file's content + * @param bool|false $create_from_content Whether or not to use $source as the content, false by default + * + * @throws file_updater_failure_exception When the file is not writable + */ + private function write_file($path_to_file, $source, $create_from_content = false) + { + if (!$create_from_content) + { + $source = @file_get_contents($source); + } + + $file_pointer = @fopen($path_to_file, 'w'); + + if (!is_resource($file_pointer)) + { + throw new file_updater_failure_exception(); + } + + @fwrite($file_pointer, $source); + @fclose($file_pointer); + } + + /** + * {@inheritdoc} + */ + public function get_method_name() + { + return 'direct_file'; + } +} diff --git a/phpBB/phpbb/install/helper/file_updater/file_updater_interface.php b/phpBB/phpbb/install/helper/file_updater/file_updater_interface.php new file mode 100644 index 0000000000..b13d7c9fe1 --- /dev/null +++ b/phpBB/phpbb/install/helper/file_updater/file_updater_interface.php @@ -0,0 +1,49 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\file_updater; + +interface file_updater_interface +{ + /** + * Deletes a file + * + * @param string $path_to_file Path to the file to delete + */ + public function delete_file($path_to_file); + + /** + * Creates a new file + * + * @param string $path_to_file_to_create Path to the new file's location + * @param string $source Path to file to copy or string with the new file's content + * @param bool $create_from_content Whether or not to use $source as the content, false by default + */ + public function create_new_file($path_to_file_to_create, $source, $create_from_content = false); + + /** + * Update file + * + * @param string $path_to_file_to_update Path to the file's location + * @param string $source Path to file to copy or string with the new file's content + * @param bool $create_from_content Whether or not to use $source as the content, false by default + */ + public function update_file($path_to_file_to_update, $source, $create_from_content = false); + + /** + * Returns the name of the file updater method + * + * @return string + */ + public function get_method_name(); +} diff --git a/phpBB/phpbb/install/helper/file_updater/ftp_file_updater.php b/phpBB/phpbb/install/helper/file_updater/ftp_file_updater.php new file mode 100644 index 0000000000..258a035768 --- /dev/null +++ b/phpBB/phpbb/install/helper/file_updater/ftp_file_updater.php @@ -0,0 +1,136 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\file_updater; + +use phpbb\install\helper\update_helper; + +/** + * File updater for FTP updates + */ +class ftp_file_updater implements file_updater_interface +{ + /** + * @var \transfer + */ + protected $transfer; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param update_helper $update_helper + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __constructor(update_helper $update_helper, $phpbb_root_path, $php_ext) + { + $this->transfer = null; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Initialize FTP connection + * + * @param string $method + * @param string $host + * @param string $user + * @param string $pass + * @param string $path + * @param int $port + * @param int $timeout + */ + public function init($method, $host, $user, $pass, $path, $port, $timeout) + { + $this->update_helper->include_file('includes/functions_transfer.' . $this->php_ext); + $this->transfer = new $method($host, $user, $pass, $path, $port, $timeout); + $this->transfer->open_session(); + } + + /** + * Close FTP session + */ + public function close() + { + $this->transfer->close_session(); + } + + /** + * {@inheritdoc} + */ + public function delete_file($path_to_file) + { + $this->transfer->delete_file($path_to_file); + } + + /** + * {@inheritdoc} + */ + public function create_new_file($path_to_file_to_create, $source, $create_from_content = false) + { + $dirname = dirname($path_to_file_to_create); + + if ($dirname && !file_exists($this->phpbb_root_path . $dirname)) + { + $this->transfer->make_dir($dirname); + } + + if ($create_from_content) + { + $this->transfer->write_file($path_to_file_to_create, $source); + } + else + { + $this->transfer->copy_file($path_to_file_to_create, $source); + } + } + + /** + * {@inheritdoc} + */ + public function update_file($path_to_file_to_update, $source, $create_from_content = false) + { + if ($create_from_content) + { + $this->transfer->write_file($path_to_file_to_update, $source); + } + else + { + $this->transfer->copy_file($path_to_file_to_update, $source); + } + } + + /** + * {@inheritdoc} + */ + public function get_method_name() + { + return 'ftp'; + } +} diff --git a/phpBB/phpbb/install/helper/install_helper.php b/phpBB/phpbb/install/helper/install_helper.php new file mode 100644 index 0000000000..ffe36cd645 --- /dev/null +++ b/phpBB/phpbb/install/helper/install_helper.php @@ -0,0 +1,60 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +/** + * General helper functionality for the installer + */ +class install_helper +{ + /** + * @var string + */ + protected $php_ext; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param string $phpbb_root_path path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Check whether phpBB is installed. + * + * @return bool + */ + public function is_phpbb_installed() + { + $config_path = $this->phpbb_root_path . 'config.' . $this->php_ext; + $install_lock_path = $this->phpbb_root_path . 'cache/install_lock'; + + if (file_exists($config_path) && !file_exists($install_lock_path) && filesize($config_path)) + { + return true; + } + + return false; + } +} diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php new file mode 100644 index 0000000000..1342ffa30f --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -0,0 +1,390 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler; + +use phpbb\path_helper; +use phpbb\routing\router; + +/** + * Input-Output handler for the AJAX frontend + */ +class ajax_iohandler extends iohandler_base +{ + /** + * @var path_helper + */ + protected $path_helper; + + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var router + */ + protected $router; + + /** + * @var string + */ + protected $file_status; + + /** + * @var string + */ + protected $form; + + /** + * @var bool + */ + protected $request_client_refresh; + + /** + * @var array + */ + protected $nav_data; + + /** + * @var array + */ + protected $cookies; + + /** + * @var array + */ + protected $download; + + /** + * Constructor + * + * @param path_helper $path_helper + * @param \phpbb\request\request_interface $request HTTP request interface + * @param \phpbb\template\template $template Template engine + * @param router $router Router + */ + public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router) + { + $this->path_helper = $path_helper; + $this->request = $request; + $this->router = $router; + $this->template = $template; + $this->form = ''; + $this->nav_data = array(); + $this->cookies = array(); + $this->download = array(); + $this->file_status = ''; + + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + public function get_input($name, $default, $multibyte = false) + { + return $this->request->variable($name, $default, $multibyte); + } + + /** + * {@inheritdoc} + */ + public function get_server_variable($name, $default = '') + { + return $this->request->server($name, $default); + } + + /** + * {@inheritdoc} + */ + public function get_header_variable($name, $default = '') + { + return $this->request->header($name, $default); + } + + /** + * {@inheritdoc} + */ + public function is_secure() + { + return $this->request->is_secure(); + } + + /** + * {@inheritdoc} + */ + public function add_user_form_group($title, $form) + { + $this->template->assign_block_vars('options', array( + 'LEGEND' => $this->language->lang($title), + 'S_LEGEND' => true, + )); + + $not_button_form = false; + + foreach ($form as $input_name => $input_options) + { + if (!isset($input_options['type'])) + { + continue; + } + + $tpl_ary = array(); + $not_button_form = ($input_options['type'] !== 'submit' || $not_button_form); + + $tpl_ary['TYPE'] = $input_options['type']; + $tpl_ary['TITLE'] = $this->language->lang($input_options['label']); + $tpl_ary['KEY'] = $input_name; + $tpl_ary['S_EXPLAIN'] = false; + + if (isset($input_options['default'])) + { + $default = $input_options['default']; + $default = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', array($this, 'lang_replace_callback'), $default); + $tpl_ary['DEFAULT'] = $default; + } + + if (isset($input_options['description'])) + { + $tpl_ary['TITLE_EXPLAIN'] = $this->language->lang($input_options['description']); + $tpl_ary['S_EXPLAIN'] = true; + } + + if (in_array($input_options['type'], array('select', 'radio'), true)) + { + for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) + { + if (isset($input_options['options'][$i]['label'])) + { + $input_options['options'][$i]['label'] = $this->language->lang($input_options['options'][$i]['label']); + } + } + + $tpl_ary['OPTIONS'] = $input_options['options']; + } + + $block_name = ($input_options['type'] === 'submit') ? 'submit_buttons' : 'options'; + $this->template->assign_block_vars($block_name, $tpl_ary); + } + + $this->template->assign_var('S_NOT_ONLY_BUTTON_FORM', $not_button_form); + + $this->template->set_filenames(array( + 'form_install' => 'installer_form.html', + )); + + $this->form = $this->template->assign_display('form_install'); + } + + /** + * {@inheritdoc} + */ + public function send_response() + { + $json_data_array = $this->prepare_json_array(); + $json_data = json_encode($json_data_array); + + // Try to push content to the browser + print(str_pad(' ', 4096) . "\n"); + print($json_data . "\n\n"); + flush(); + } + + /** + * Prepares iohandler's data to be sent out to the client. + * + * @return array + */ + protected function prepare_json_array() + { + $json_array = array( + 'errors' => $this->errors, + 'warnings' => $this->warnings, + 'logs' => $this->logs, + 'success' => $this->success, + 'download' => $this->download, + ); + + $this->errors = array(); + $this->warnings = array(); + $this->logs = array(); + $this->success = array(); + $this->download = array(); + + if (!empty($this->form)) + { + $json_array['form'] = $this->form; + $this->form = ''; + } + + if (!empty($this->file_status)) + { + $json_array['file_status'] = $this->file_status; + $this->file_status = ''; + } + + // If current task name is set, we push progress message to the client side + if (!empty($this->current_task_name)) + { + $json_array['progress'] = array( + 'task_name' => $this->current_task_name, + 'task_num' => $this->current_task_progress, + 'task_count' => $this->task_progress_count, + ); + + if ($this->restart_progress_bar) + { + $json_array['progress']['restart'] = 1; + $this->restart_progress_bar = false; + } + } + + if (!empty($this->nav_data)) + { + $json_array['nav'] = $this->nav_data; + $this->nav_data = array(); + } + + if ($this->request_client_refresh) + { + $json_array['refresh'] = true; + $this->request_client_refresh = false; + } + + if (!empty($this->cookies)) + { + $json_array['cookies'] = $this->cookies; + $this->cookies = array(); + } + + return $json_array; + } + + /** + * {@inheritdoc} + */ + public function set_progress($task_lang_key, $task_number) + { + parent::set_progress($task_lang_key, $task_number); + $this->send_response(); + } + + /** + * {@inheritdoc} + */ + public function request_refresh() + { + $this->request_client_refresh = true; + } + + /** + * {@inheritdoc} + */ + public function set_active_stage_menu($menu_path) + { + $this->nav_data['active'] = $menu_path[sizeof($menu_path) - 1]; + $this->send_response(); + } + + /** + * {@inheritdoc} + */ + public function set_finished_stage_menu($menu_path) + { + $this->nav_data['finished'][] = $menu_path[sizeof($menu_path) - 1]; + $this->send_response(); + } + + /** + * {@inheritdoc} + */ + public function set_cookie($cookie_name, $cookie_value) + { + $this->cookies[] = array( + 'name' => $cookie_name, + 'value' => $cookie_value + ); + } + + /** + * {@inheritdoc} + */ + public function add_download_link($route, $title, $msg = null) + { + $link_properties = array( + 'href' => $this->router->generate($route), + 'title' => $this->language->lang($title), + 'download' => $this->language->lang('DOWNLOAD'), + ); + + if ($msg !== null) + { + $link_properties['msg'] = htmlspecialchars_decode($this->language->lang($msg)); + } + + $this->download[] = $link_properties; + } + + /** + * {@inheritdoc} + */ + public function render_update_file_status($status_array) + { + $this->template->assign_vars(array( + 'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . 'adm/images/', + )); + + foreach ($status_array as $block => $list) + { + foreach ($list as $filename) + { + $dirname = dirname($filename); + + $this->template->assign_block_vars($block, array( + 'STATUS' => $block, + 'FILENAME' => $filename, + 'DIR_PART' => (!empty($dirname) && $dirname !== '.') ? dirname($filename) . '/' : false, + 'FILE_PART' => basename($filename), + )); + } + } + + $this->template->set_filenames(array( + 'file_status' => 'installer_update_file_status.html', + )); + + $this->file_status = $this->template->assign_display('file_status'); + } + + /** + * Callback function for language replacing + * + * @param array $matches + * @return string + */ + public function lang_replace_callback($matches) + { + if (!empty($matches[1])) + { + return $this->language->lang($matches[1]); + } + + return ''; + } +} diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php new file mode 100644 index 0000000000..89f3594378 --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php @@ -0,0 +1,292 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler; + +use phpbb\install\exception\installer_exception; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\OutputStyle; + +/** + * Input-Output handler for the CLI frontend + */ +class cli_iohandler extends iohandler_base +{ + /** + * @var OutputInterface + */ + protected $output; + + /** + * @var OutputStyle + */ + protected $io; + + /** + * @var array + */ + protected $input_values = array(); + + /** + * @var \Symfony\Component\Console\Helper\ProgressBar + */ + protected $progress_bar; + + /** + * Set the style and output used to display feedback; + * + * @param OutputStyle $style + * @param OutputInterface $output + */ + public function set_style(OutputStyle $style, OutputInterface $output) + { + $this->io = $style; + $this->output = $output; + } + + /** + * {@inheritdoc} + */ + public function get_input($name, $default, $multibyte = false) + { + $result = $default; + + if (isset($this->input_values[$name])) + { + $result = $this->input_values[$name]; + } + + if ($multibyte) + { + return utf8_normalize_nfc($result); + } + + return $result; + } + + public function set_input($name, $value) + { + $this->input_values[$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function get_server_variable($name, $default = '') + { + return $default; + } + + /** + * {@inheritdoc} + */ + public function get_header_variable($name, $default = '') + { + return $default; + } + + /** + * {@inheritdoc} + */ + public function is_secure() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function add_user_form_group($title, $form) + { + throw new installer_exception('MISSING_DATA'); + } + + /** + * {@inheritdoc} + */ + public function send_response() + { + } + + /** + * {@inheritdoc + */ + public function add_error_message($error_title, $error_description = false) + { + $this->io->newLine(); + + if (strpos($error_title, '<br />') !== false) + { + $error_title = strip_tags(str_replace('<br />', "\n", $error_title)); + } + $message = $this->translate_message($error_title, $error_description); + $message_string = $message['title'] . (!empty($message['description']) ? "\n" . $message['description'] : ''); + $this->io->error($message_string); + + if ($this->progress_bar !== null) + { + $this->io->newLine(2); + $this->progress_bar->display(); + } + } + + /** + * {@inheritdoc + */ + public function add_warning_message($warning_title, $warning_description = false) + { + $this->io->newLine(); + + $message = $this->translate_message($warning_title, $warning_description); + $message_string = $message['title'] . (!empty($message['description']) ? "\n" . $message['description'] : ''); + $this->io->warning($message_string); + + if ($this->progress_bar !== null) + { + $this->io->newLine(2); + $this->progress_bar->display(); + } + } + + /** + * {@inheritdoc + */ + public function add_log_message($log_title, $log_description = false) + { + if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) + { + $message = $this->translate_message($log_title, $log_description); + $this->output->writeln(sprintf('[%3d/%-3d] ---- %s', $this->current_task_progress, $this->task_progress_count, $message['title'])); + } + } + + /** + * {@inheritdoc + */ + public function add_success_message($error_title, $error_description = false) + { + $this->io->newLine(); + + $message = $this->translate_message($error_title, $error_description); + $message_string = $message['title'] . (!empty($message['description']) ? "\n" . $message['description'] : ''); + $this->io->success($message_string); + + if ($this->progress_bar !== null) + { + $this->io->newLine(2); + $this->progress_bar->display(); + } + } + + /** + * {@inheritdoc} + */ + public function set_task_count($task_count, $restart = false) + { + parent::set_task_count($task_count, $restart); + + if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) + { + $this->progress_bar = $this->io->createProgressBar($task_count); + $this->progress_bar->setFormat( + " %current:3s%/%max:-3s% %bar% %percent:3s%%\n" . + " %message%\n"); + $this->progress_bar->setBarWidth(60); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) + { + $this->progress_bar->setEmptyBarCharacter('â–‘'); // light shade character \u2591 + $this->progress_bar->setProgressCharacter(''); + $this->progress_bar->setBarCharacter('â–“'); // dark shade character \u2593 + } + + $this->progress_bar->setMessage(''); + $this->io->newLine(2); + $this->progress_bar->start(); + } + } + + /** + * {@inheritdoc} + */ + public function set_progress($task_lang_key, $task_number) + { + parent::set_progress($task_lang_key, $task_number); + + if ($this->progress_bar !== null) + { + $this->progress_bar->setProgress($this->current_task_progress); + $this->progress_bar->setMessage($this->current_task_name); + } + else + { + $this->output->writeln(sprintf('[%3d/%-3d] %s', $this->current_task_progress, $this->task_progress_count, $this->current_task_name)); + } + } + + /** + * {@inheritdoc} + */ + public function finish_progress($message_lang_key) + { + parent::finish_progress($message_lang_key); + + if ($this->progress_bar !== null) + { + $this->progress_bar->finish(); + $this->progress_bar = null; + } + } + + /** + * {@inheritdoc} + */ + public function request_refresh() + { + } + + /** + * {@inheritdoc} + */ + public function set_active_stage_menu($menu_path) + { + } + + /** + * {@inheritdoc} + */ + public function set_finished_stage_menu($menu_path) + { + } + + /** + * {@inheritdoc} + */ + public function set_cookie($cookie_name, $cookie_value) + { + } + + /** + * {@inheritdoc} + */ + public function add_download_link($route, $title, $msg = null) + { + } + + /** + * {@inheritdoc} + */ + public function render_update_file_status($status_array) + { + } +} diff --git a/phpBB/phpbb/install/helper/iohandler/exception/iohandler_not_implemented_exception.php b/phpBB/phpbb/install/helper/iohandler/exception/iohandler_not_implemented_exception.php new file mode 100644 index 0000000000..f2ddeda6f7 --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/exception/iohandler_not_implemented_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler\exception; + +class iohandler_not_implemented_exception extends \Exception +{ + +} diff --git a/phpBB/phpbb/install/helper/iohandler/factory.php b/phpBB/phpbb/install/helper/iohandler/factory.php new file mode 100644 index 0000000000..52d24e49b2 --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/factory.php @@ -0,0 +1,81 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler; + +use phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception; + +/** + * Input-output handler factory + */ +class factory +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * @var string + */ + protected $environment; + + /** + * Constructor + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container Dependency injection container + */ + public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container) + { + $this->container = $container; + $this->environment = null; + } + + /** + * @param string $environment The name of the input-output handler to use + */ + public function set_environment($environment) + { + $this->environment = $environment; + } + + /** + * Factory getter for iohandler + * + * @return \phpbb\install\helper\iohandler\iohandler_interface + * + * @throws \phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception + * When the specified iohandler_interface does not exists + */ + public function get() + { + switch ($this->environment) + { + case 'ajax': + return $this->container->get('installer.helper.iohandler_ajax'); + break; + case 'nojs': + // @todo replace this + return $this->container->get('installer.helper.iohandler_ajax'); + break; + case 'cli': + return $this->container->get('installer.helper.iohandler_cli'); + break; + default: + throw new iohandler_not_implemented_exception(); + break; + } + + throw new iohandler_not_implemented_exception(); + } +} diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php new file mode 100644 index 0000000000..7271fe9bc0 --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -0,0 +1,196 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler; + +/** + * Base class for installer input-output handlers + */ +abstract class iohandler_base implements iohandler_interface +{ + /** + * Array of errors + * + * Errors should be added, when the installation cannot continue without + * user interaction. If the aim is to notify the user about something, please + * use a warning instead. + * + * @var array + */ + protected $errors; + + /** + * Array of warnings + * + * @var array + */ + protected $warnings; + + /** + * Array of logs + * + * @var array + */ + protected $logs; + + /** + * Array of success messages + * + * @var array + */ + protected $success; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var int + */ + protected $task_progress_count; + + /** + * @var int + */ + protected $current_task_progress; + + /** + * @var string + */ + protected $current_task_name; + + /** + * Constructor + */ + public function __construct() + { + $this->errors = array(); + $this->warnings = array(); + $this->logs = array(); + $this->success = array(); + + $this->restart_progress_bar = false; + $this->task_progress_count = 0; + $this->current_task_progress = 0; + $this->current_task_name = ''; + } + + /** + * Set language service + * + * @param \phpbb\language\language $language + */ + public function set_language(\phpbb\language\language $language) + { + $this->language = $language; + } + + /** + * {@inheritdoc} + */ + public function add_error_message($error_title, $error_description = false) + { + if (!is_array($error_title) && strpos($error_title, '<br />') !== false) + { + $error_title = strip_tags(htmlspecialchars_decode($error_title)); + } + $this->errors[] = $this->translate_message($error_title, $error_description); + } + + /** + * {@inheritdoc} + */ + public function add_warning_message($warning_title, $warning_description = false) + { + $this->warnings[] = $this->translate_message($warning_title, $warning_description); + } + + /** + * {@inheritdoc} + */ + public function add_log_message($log_title, $log_description = false) + { + $this->logs[] = $this->translate_message($log_title, $log_description); + } + + /** + * {@inheritdoc} + */ + public function add_success_message($success_title, $success_description = false) + { + $this->success[] = $this->translate_message($success_title, $success_description); + } + + /** + * {@inheritdoc} + */ + public function set_task_count($task_count, $restart = false) + { + $this->task_progress_count = $task_count; + $this->restart_progress_bar = $restart; + } + + /** + * {@inheritdoc} + */ + public function set_progress($task_lang_key, $task_number) + { + $this->current_task_name = ''; + + if (!empty($task_lang_key)) + { + $this->current_task_name = $this->language->lang($task_lang_key); + } + + $this->current_task_progress = $task_number; + } + + /** + * {@inheritdoc} + */ + public function finish_progress($message_lang_key) + { + if (!empty($message_lang_key)) + { + $this->current_task_name = $this->language->lang($message_lang_key); + } + + $this->current_task_progress = $this->task_progress_count; + } + + /** + * Localize message. + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param array|string $title Title of the message + * @param array|string|bool $description Description of the message + * + * @return array Localized message in an array + */ + protected function translate_message($title, $description) + { + $message_array = array(); + + $message_array['title'] = call_user_func_array(array($this->language, 'lang'), (array) $title); + + if ($description !== false) + { + $message_array['description'] = call_user_func_array(array($this->language, 'lang'), (array) $description); + } + + return $message_array; + } +} diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php new file mode 100644 index 0000000000..00aab3283e --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php @@ -0,0 +1,191 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler; + +/** + * Input-Output handler interface for the installer + */ +interface iohandler_interface +{ + /** + * Renders or returns response message + */ + public function send_response(); + + /** + * Returns input variable + * + * @param string $name Name of the input variable to obtain + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * + * @return mixed Value of the input variable + */ + public function get_input($name, $default, $multibyte = false); + + /** + * Returns server variable + * + * This function should work the same as request_interterface::server(). + * + * @param string $name Name of the server variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed Value of the server variable + */ + public function get_server_variable($name, $default = ''); + + /** + * Wrapper function for request_interterface::header() + * + * @param string $name Name of the request header variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed + */ + public function get_header_variable($name, $default = ''); + + /** + * Returns true if the connection is encrypted + * + * @return bool + */ + public function is_secure(); + + /** + * Adds an error message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $error_title Title of the error message. + * @param string|bool|array $error_description Description of the error (and possibly guidelines to resolve it), + * or false if the error description is not available. + */ + public function add_error_message($error_title, $error_description = false); + + /** + * Adds a warning message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $warning_title Title of the warning message + * @param string|bool|array $warning_description Description of the warning (and possibly guidelines to resolve it), + * or false if the warning description is not available + */ + public function add_warning_message($warning_title, $warning_description = false); + + /** + * Adds a log message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $log_title Title of the log message + * @param string|bool|array $log_description Description of the log, + * or false if the log description is not available + */ + public function add_log_message($log_title, $log_description = false); + + /** + * Adds a success message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $success_title Title of the success message + * @param string|bool|array $success_description Description of the success, + * or false if the success description is not available + * + * @return null + */ + public function add_success_message($success_title, $success_description = false); + + /** + * Adds a requested data group to the rendering queue + * + * @param string $title Language variable with the title of the form + * @param array $form An array describing the required data (options etc) + */ + public function add_user_form_group($title, $form); + + /** + * Sets the number of tasks belonging to the installer in the current mode. + * + * @param int $task_count Number of tasks + * @param bool $restart Whether or not to restart the progress bar, false by default + */ + public function set_task_count($task_count, $restart = false); + + /** + * Sets the progress information + * + * @param string $task_lang_key Language key for the name of the task + * @param int $task_number Position of the current task in the task queue + */ + public function set_progress($task_lang_key, $task_number); + + /** + * Sends refresh request to the client + */ + public function request_refresh(); + + /** + * Marks stage as active in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_active_stage_menu($menu_path); + + /** + * Marks stage as completed in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_finished_stage_menu($menu_path); + + /** + * Finish the progress bar + * + * @param string $message_lang_key Language key for the message + */ + public function finish_progress($message_lang_key); + + /** + * Adds a download link + * + * @param string $route Route for the link + * @param string $title Language key for the title + * @param string|null|array $msg Language key for the message + */ + public function add_download_link($route, $title, $msg = null); + + /** + * Renders the status of update files + * + * @param array $status_array Array containing files in groups to render + */ + public function render_update_file_status($status_array); + + /** + * Sends and sets cookies + * + * @param string $cookie_name Name of the cookie to set + * @param string $cookie_value Value of the cookie to set + */ + public function set_cookie($cookie_name, $cookie_value); +} diff --git a/phpBB/phpbb/install/helper/navigation/install_navigation.php b/phpBB/phpbb/install/helper/navigation/install_navigation.php new file mode 100644 index 0000000000..f690f8de76 --- /dev/null +++ b/phpBB/phpbb/install/helper/navigation/install_navigation.php @@ -0,0 +1,75 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\navigation; + +use phpbb\install\helper\install_helper; + +class install_navigation implements navigation_interface +{ + /** + * @var install_helper + */ + private $install_helper; + + /** + * Constructor + * + * @param install_helper $install_helper + */ + public function __construct(install_helper $install_helper) + { + $this->install_helper = $install_helper; + } + + /** + * {@inheritdoc} + */ + public function get() + { + if ($this->install_helper->is_phpbb_installed()) + { + return array(); + } + + return array( + 'install' => array( + 'label' => 'INSTALL', + 'route' => 'phpbb_installer_install', + 'order' => 1, + array( + 'introduction' => array( + 'label' => 'INTRODUCTION_TITLE', + 'stage' => true, + 'order' => 0, + ), + 'requirements' => array( + 'label' => 'STAGE_REQUIREMENTS', + 'stage' => true, + 'order' => 1, + ), + 'obtain_data' => array( + 'label' => 'STAGE_OBTAIN_DATA', + 'stage' => true, + 'order' => 2, + ), + 'install' => array( + 'label' => 'STAGE_INSTALL', + 'stage' => true, + 'order' => 3, + ), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/install/helper/navigation/main_navigation.php b/phpBB/phpbb/install/helper/navigation/main_navigation.php new file mode 100644 index 0000000000..214bb04963 --- /dev/null +++ b/phpBB/phpbb/install/helper/navigation/main_navigation.php @@ -0,0 +1,48 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\navigation; + +class main_navigation implements navigation_interface +{ + /** + * {@inheritdoc} + */ + public function get() + { + return array( + 'overview' => array( + 'label' => 'MENU_OVERVIEW', + 'route' => 'phpbb_installer_index', + 'order' => 0, + array( + 'introduction' => array( + 'label' => 'MENU_INTRO', + 'route' => 'phpbb_installer_index', + 'order' => 0, + ), + 'support' => array( + 'label' => 'MENU_SUPPORT', + 'route' => 'phpbb_installer_support', + 'order' => 1, + ), + 'license' => array( + 'label' => 'MENU_LICENSE', + 'route' => 'phpbb_installer_license', + 'order' => 2, + ), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/install/helper/navigation/navigation_interface.php b/phpBB/phpbb/install/helper/navigation/navigation_interface.php new file mode 100644 index 0000000000..eebdbe923f --- /dev/null +++ b/phpBB/phpbb/install/helper/navigation/navigation_interface.php @@ -0,0 +1,43 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\navigation; + +/** + * Interface for installer's navigation defining services + */ +interface navigation_interface +{ + /** + * Returns an array with the navigation items + * + * The returned array should have the following format: + * <code> + * array( + * 'parent_nav_name' => array( + * 'nav_name' => array( + * 'label' => 'MY_MENU', + * 'route' => 'phpbb_route_name', + * ) + * ) + * ) + * </code> + * + * Navigation item setting options: + * - label: The language variable name + * - route: Name of the route which it is belongs to + * + * @return array + */ + public function get(); +} diff --git a/phpBB/phpbb/install/helper/navigation/navigation_provider.php b/phpBB/phpbb/install/helper/navigation/navigation_provider.php new file mode 100644 index 0000000000..d52aec8999 --- /dev/null +++ b/phpBB/phpbb/install/helper/navigation/navigation_provider.php @@ -0,0 +1,121 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\navigation; + +use phpbb\di\service_collection; + +/** + * Installers navigation provider + */ +class navigation_provider +{ + /** + * @var array + */ + private $menu_collection; + + /** + * Constructor + * + * @param service_collection $plugins + */ + public function __construct(service_collection $plugins) + { + $this->menu_collection = array(); + + foreach ($plugins as $plugin => $plugin_instance) + { + $this->register($plugin_instance); + } + } + + /** + * Returns navigation array + * + * @return array + */ + public function get() + { + return $this->menu_collection; + } + + /** + * Registers a navigation provider's navigation items + * + * @param navigation_interface $navigation + */ + public function register(navigation_interface $navigation) + { + $nav_arry = $navigation->get(); + $this->menu_collection = $this->merge($nav_arry, $this->menu_collection); + } + + /** + * Set a property in the navigation array + * + * @param array $nav_element Array to the navigation elem + * @param array $property_array Array with the properties to set + */ + public function set_nav_property($nav_element, $property_array) + { + $array_pointer = array(); + $array_root_pointer = &$array_pointer; + foreach ($nav_element as $array_path) + { + $array_pointer[$array_path] = array(); + $array_pointer = &$array_pointer[$array_path]; + } + + $array_pointer = $property_array; + + $this->menu_collection = $this->merge($array_root_pointer, $this->menu_collection); + } + + /** + * Recursive array merge + * + * This function is necessary to be able to replace the options of + * already set navigation items. + * + * @param array $array_to_merge + * @param array $array_to_merge_into + * + * @return array Merged array + */ + private function merge($array_to_merge, $array_to_merge_into) + { + $merged_array = $array_to_merge_into; + + foreach ($array_to_merge as $key => $value) + { + if (isset($array_to_merge_into[$key])) + { + if (is_array($array_to_merge_into[$key]) && is_array($value)) + { + $merged_array[$key] = $this->merge($value, $array_to_merge_into[$key]); + } + else + { + $merged_array[$key] = $value; + } + } + else + { + $merged_array[$key] = $value; + } + } + + return $merged_array; + } +} diff --git a/phpBB/phpbb/install/helper/navigation/update_navigation.php b/phpBB/phpbb/install/helper/navigation/update_navigation.php new file mode 100644 index 0000000000..3d239c3451 --- /dev/null +++ b/phpBB/phpbb/install/helper/navigation/update_navigation.php @@ -0,0 +1,80 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\navigation; + +use phpbb\install\helper\install_helper; + +class update_navigation implements navigation_interface +{ + /** + * @var install_helper + */ + private $install_helper; + + /** + * Constructor + * + * @param install_helper $install_helper + */ + public function __construct(install_helper $install_helper) + { + $this->install_helper = $install_helper; + } + + /** + * {@inheritdoc} + */ + public function get() + { + if (!$this->install_helper->is_phpbb_installed()) + { + return array(); + } + + return array( + 'update' => array( + 'label' => 'UPDATE', + 'route' => 'phpbb_installer_update', + 'order' => 1, + array( + 'introduction' => array( + 'label' => 'INTRODUCTION_TITLE', + 'stage' => true, + 'order' => 0, + ), + 'requirements' => array( + 'label' => 'STAGE_REQUIREMENTS', + 'stage' => true, + 'order' => 1, + ), + 'obtain_data' => array( + 'label' => 'STAGE_OBTAIN_DATA', + 'stage' => true, + 'order' => 2, + ), + 'update_files' => array( + 'label' => 'STAGE_UPDATE_FILES', + 'stage' => true, + 'order' => 3, + ), + 'update_database' => array( + 'label' => 'STAGE_UPDATE_DATABASE', + 'stage' => true, + 'order' => 4, + ), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/install/helper/update_helper.php b/phpBB/phpbb/install/helper/update_helper.php new file mode 100644 index 0000000000..a00731d317 --- /dev/null +++ b/phpBB/phpbb/install/helper/update_helper.php @@ -0,0 +1,113 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +/** + * General helper functionality for the updater + */ +class update_helper +{ + /** + * @var string + */ + protected $path_to_new_files; + + /** + * @var string + */ + protected $path_to_old_files; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param string $phpbb_root_path + */ + public function __construct($phpbb_root_path) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->path_to_new_files = $phpbb_root_path . 'install/update/new/'; + $this->path_to_old_files = $phpbb_root_path . 'install/update/old/'; + } + + /** + * Returns path to new update files + * + * @return string + */ + public function get_path_to_new_update_files() + { + return $this->path_to_new_files; + } + + /** + * Returns path to new update files + * + * @return string + */ + public function get_path_to_old_update_files() + { + return $this->path_to_old_files; + } + + /** + * Includes the updated file if available + * + * @param string $filename Path to the file relative to phpBB root path + */ + public function include_file($filename) + { + if (is_file($this->path_to_new_files . $filename)) + { + include_once($this->path_to_new_files . $filename); + } + else if (is_file($this->phpbb_root_path . $filename)) + { + include_once($this->phpbb_root_path . $filename); + } + } + + /** + * Customized version_compare() + * + * @param string $version_number1 + * @param string $version_number2 + * @param string|null $operator + * @return int|bool The returned value is identical to the PHP build-in function version_compare() + */ + public function phpbb_version_compare($version_number1, $version_number2, $operator = null) + { + if ($operator === null) + { + $result = version_compare( + str_replace('rc', 'RC', strtolower($version_number1)), + str_replace('rc', 'RC', strtolower($version_number2)) + ); + } + else + { + $result = version_compare( + str_replace('rc', 'RC', strtolower($version_number1)), + str_replace('rc', 'RC', strtolower($version_number2)), + $operator + ); + } + + return $result; + } +} diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php new file mode 100644 index 0000000000..a41b4cd6a6 --- /dev/null +++ b/phpBB/phpbb/install/installer.php @@ -0,0 +1,275 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +use phpbb\cache\driver\driver_interface; +use phpbb\di\ordered_service_collection; +use phpbb\install\exception\installer_config_not_writable_exception; +use phpbb\install\exception\jump_to_restart_point_exception; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\cli_iohandler; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\path_helper; + +class installer +{ + /** + * @var driver_interface + */ + protected $cache; + + /** + * @var config + */ + protected $install_config; + + /** + * @var array + */ + protected $installer_modules; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $web_root; + + /** + * Stores the number of steps that a given module has + * + * @var array + */ + protected $module_step_count; + + /** + * Constructor + * + * @param driver_interface $cache Cache service + * @param config $config Installer config handler + * @param path_helper $path_helper Path helper + */ + public function __construct(driver_interface $cache, config $config, path_helper $path_helper) + { + $this->cache = $cache; + $this->install_config = $config; + $this->installer_modules = null; + $this->web_root = $path_helper->get_web_root_path(); + } + + /** + * Sets modules to execute + * + * Note: The installer will run modules in the order they are set in + * the array. + * + * @param ordered_service_collection $modules Service collection of module service names + */ + public function set_modules(ordered_service_collection $modules) + { + $this->installer_modules = $modules; + } + + /** + * Sets input-output handler objects + * + * @param iohandler_interface $iohandler + */ + public function set_iohandler(iohandler_interface $iohandler) + { + $this->iohandler = $iohandler; + } + + /** + * Run phpBB installer + */ + public function run() + { + // Load install progress + $this->install_config->load_config(); + + // Recover install progress + $module_name = $this->recover_progress(); + $module_found = false; + + // Variable used to check if the install process have been finished + $install_finished = false; + $fail_cleanup = false; + $send_refresh = false; + + // We are installing something, so the introduction stage can go now... + $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); + $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); + + if ($this->install_config->get_task_progress_count() === 0) + { + // Count all tasks in the current installer modules + $step_count = 0; + + /** @var \phpbb\install\module_interface $module */ + foreach ($this->installer_modules as $name => $module) + { + $module_step_count = $module->get_step_count(); + $step_count += $module_step_count; + $this->module_step_count[$name] = $module_step_count; + } + + // Set task count + $this->install_config->set_task_progress_count($step_count); + } + + // Set up progress information + $this->iohandler->set_task_count( + $this->install_config->get_task_progress_count() + ); + + try + { + foreach ($this->installer_modules as $name => $module) + { + // Skip forward until the current task is reached + if (!$module_found) + { + if ($module_name === $name || empty($module_name)) + { + $module_found = true; + } + else + { + continue; + } + } + + // Log progress + $this->install_config->set_active_module($name); + + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + { + throw new resource_limit_reached_exception(); + } + + // Check if module should be executed + if (!$module->is_essential() && !$module->check_requirements()) + { + $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); + + $this->iohandler->add_log_message(array( + 'SKIP_MODULE', + $name, + )); + $this->install_config->increment_current_task_progress($this->module_step_count[$name]); + continue; + } + + // Set the correct stage in the navigation bar + $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); + + $module->run(); + + $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); + } + + // Installation finished + $install_finished = true; + + if ($this->iohandler instanceof cli_iohandler) + { + $this->iohandler->add_success_message('INSTALLER_FINISHED'); + } + else + { + global $SID; + $acp_url = $this->web_root . 'adm/index.php' . $SID; + $this->iohandler->add_success_message('INSTALLER_FINISHED', array( + 'ACP_LINK', + $acp_url, + )); + } + } + catch (user_interaction_required_exception $e) + { + // Do nothing + } + catch (resource_limit_reached_exception $e) + { + $send_refresh = true; + } + catch (jump_to_restart_point_exception $e) + { + $this->install_config->jump_to_restart_point($e->get_restart_point_name()); + $send_refresh = true; + } + catch (\Exception $e) + { + $this->iohandler->add_error_message($e->getMessage()); + $this->iohandler->send_response(); + $fail_cleanup = true; + } + + if ($install_finished) + { + // Send install finished message + $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); + } + else if ($send_refresh) + { + $this->iohandler->request_refresh(); + $this->iohandler->send_response(); + } + + // Save install progress + try + { + if ($install_finished || $fail_cleanup) + { + $this->install_config->clean_up_config_file(); + $this->cache->purge(); + } + else + { + $this->install_config->save_config(); + } + } + catch (installer_config_not_writable_exception $e) + { + // It is allowed to fail this test during requirements testing + $progress_data = $this->install_config->get_progress_data(); + + if ($progress_data['last_task_module_name'] !== 'installer.module.requirements_install') + { + $this->iohandler->add_error_message('INSTALLER_CONFIG_NOT_WRITABLE'); + } + } + } + + /** + * Recover install progress + * + * @return string Index of the next installer module to execute + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + return $progress_array['last_task_module_name']; + } +} diff --git a/phpBB/phpbb/install/installer_configuration.php b/phpBB/phpbb/install/installer_configuration.php new file mode 100644 index 0000000000..ab02da8686 --- /dev/null +++ b/phpBB/phpbb/install/installer_configuration.php @@ -0,0 +1,140 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\install; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class installer_configuration implements ConfigurationInterface +{ + + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('installer'); + $rootNode + ->children() + ->arrayNode('admin') + ->children() + ->scalarNode('name')->defaultValue('admin')->cannotBeEmpty()->end() + ->scalarNode('password')->defaultValue('adminadmin')->cannotBeEmpty()->end() + ->scalarNode('email')->defaultValue('admin@example.org')->cannotBeEmpty()->end() + ->end() + ->end() + ->arrayNode('board') + ->children() + ->scalarNode('lang') + ->defaultValue('en') + ->cannotBeEmpty() + ->end() + ->scalarNode('name') + ->defaultValue('My Board') + ->cannotBeEmpty() + ->end() + ->scalarNode('description') + ->defaultValue('My amazing new phpBB board') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->arrayNode('database') + ->children() + ->scalarNode('dbms') + ->defaultValue('sqlite3') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->scalarNode('dbhost') + ->defaultValue(null) + ->end() + ->scalarNode('dbport') + ->defaultValue(null) + ->end() + ->scalarNode('dbuser') + ->defaultValue(null) + ->end() + ->scalarNode('dbpasswd') + ->defaultValue(null) + ->end() + ->scalarNode('dbname') + ->defaultValue(null) + ->end() + ->scalarNode('table_prefix') + ->defaultValue('phpbb_') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->end() + ->end() + ->arrayNode('email') + ->canBeEnabled() + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('smtp_delivery') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('smtp_host') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_auth') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_user') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_pass') + ->defaultValue(null) + ->end() + ->end() + ->end() + ->arrayNode('server') + ->children() + ->booleanNode('cookie_secure') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_protocol') + ->defaultValue('http://') + ->cannotBeEmpty() + ->end() + ->booleanNode('force_server_vars') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_name') + ->defaultValue('localhost') + ->cannotBeEmpty() + ->end() + ->integerNode('server_port') + ->defaultValue(80) + ->min(1) + ->cannotBeEmpty() + ->end() + ->scalarNode('script_path') + ->defaultValue('/') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->end() + ; + return $treeBuilder; + } +} diff --git a/phpBB/phpbb/install/module/install_data/module.php b/phpBB/phpbb/install/module/install_data/module.php new file mode 100644 index 0000000000..77f1f73f1f --- /dev/null +++ b/phpBB/phpbb/install/module/install_data/module.php @@ -0,0 +1,28 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data; + +/** + * Installer module for recovering and installing default data installation + */ +class module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } +} diff --git a/phpBB/phpbb/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php new file mode 100644 index 0000000000..2ee641ff63 --- /dev/null +++ b/phpBB/phpbb/install/module/install_data/task/add_bots.php @@ -0,0 +1,242 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data\task; + +class add_bots extends \phpbb\install\task_base +{ + /** + * A list of the web-crawlers/bots we recognise by default + * + * Candidates but not included: + * 'Accoona [Bot]' 'Accoona-AI-Agent/' + * 'ASPseek [Crawler]' 'ASPseek/' + * 'Boitho [Crawler]' 'boitho.com-dc/' + * 'Bunnybot [Bot]' 'powered by www.buncat.de' + * 'Cosmix [Bot]' 'cfetch/' + * 'Crawler Search [Crawler]' '.Crawler-Search.de' + * 'Findexa [Crawler]' 'Findexa Crawler (' + * 'GBSpider [Spider]' 'GBSpider v' + * 'genie [Bot]' 'genieBot (' + * 'Hogsearch [Bot]' 'oegp v. 1.3.0' + * 'Insuranco [Bot]' 'InsurancoBot' + * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' + * 'ISC Systems [Bot]' 'ISC Systems iRc Search' + * 'Jyxobot [Bot]' 'Jyxobot/' + * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' + * 'LinkWalker' 'LinkWalker' + * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' + * 'Naver [Bot]' 'nhnbot@naver.com)' + * 'NetResearchServer' 'NetResearchServer/' + * 'Nimble [Crawler]' 'NimbleCrawler' + * 'Ocelli [Bot]' 'Ocelli/' + * 'Onsearch [Bot]' 'onCHECK-Robot' + * 'Orange [Spider]' 'OrangeSpider' + * 'Sproose [Bot]' 'http://www.sproose.com/bot' + * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' + * 'Tbot [Bot]' 'Tbot/' + * 'Thumbshots [Capture]' 'thumbshots-de-Bot' + * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' + * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' + * 'WissenOnline [Bot]' 'WissenOnline-Bot' + * 'WWWeasel [Bot]' 'WWWeasel Robot v' + * 'Xaldon [Spider]' 'Xaldon WebSpider' + * + * @var array + */ + protected $bot_list = array( + 'AdsBot [Google]' => array('AdsBot-Google', ''), + 'Alexa [Bot]' => array('ia_archiver', ''), + 'Alta Vista [Bot]' => array('Scooter/', ''), + 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), + 'Baidu [Spider]' => array('Baiduspider', ''), + 'Bing [Bot]' => array('bingbot/', ''), + 'Exabot [Bot]' => array('Exabot', ''), + 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), + 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), + 'Francis [Bot]' => array('http://www.neomo.de/', ''), + 'Gigabot [Bot]' => array('Gigabot/', ''), + 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), + 'Google Desktop' => array('Google Desktop', ''), + 'Google Feedfetcher' => array('Feedfetcher-Google', ''), + 'Google [Bot]' => array('Googlebot', ''), + 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), + 'Heritrix [Crawler]' => array('heritrix/1.', ''), + 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), + 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), + 'ichiro [Crawler]' => array('ichiro/', ''), + 'Majestic-12 [Bot]' => array('MJ12bot/', ''), + 'Metager [Bot]' => array('MetagerBot/', ''), + 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), + 'MSN [Bot]' => array('msnbot/', ''), + 'MSNbot Media' => array('msnbot-media/', ''), + 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), + 'Online link [Validator]' => array('online link validator', ''), + 'psbot [Picsearch]' => array('psbot/0', ''), + 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), + 'SEO Crawler' => array('SEO search Crawler/', ''), + 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), + 'SEOSearch [Crawler]' => array('SEOsearch/', ''), + 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), + 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), + 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), + 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), + 'Voyager [Bot]' => array('voyager/', ''), + 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), + 'W3C [Linkcheck]' => array('W3C-checklink/', ''), + 'W3C [Validator]' => array('W3C_Validator', ''), + 'YaCy [Bot]' => array('yacybot', ''), + 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), + 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), + 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), + 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), + ); + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $install_config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Input-output handler for the installer + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language $language Language provider + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP extension + */ + public function __construct(\phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container, + \phpbb\language\language $language, + $phpbb_root_path, + $php_ext) + { + parent::__construct(true); + + $this->db = $container->get('dbal.conn'); + $this->install_config = $install_config; + $this->io_handler = $iohandler; + $this->language = $language; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $this->db->sql_query($sql); + $group_id = (int) $this->db->sql_fetchfield('group_id'); + $this->db->sql_freeresult($result); + + if (!$group_id) + { + // If we reach this point then something has gone very wrong + $this->io_handler->add_error_message('NO_GROUP'); + } + + foreach ($this->bot_list as $bot_name => $bot_ary) + { + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_id, + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => '9E8DA7', + 'user_email' => '', + 'user_lang' => $this->install_config->get('default_lang'), + 'user_style' => 1, + 'user_timezone' => 'UTC', + 'user_dateformat' => $this->language->lang('default_dateformat'), + 'user_allow_massemail' => 0, + 'user_allow_pm' => 0, + ); + + if (!function_exists('user_add')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $user_id = user_add($user_row); + + if (!$user_id) + { + // If we can't insert this user then continue to the next one to avoid inconsistent data + $this->io_handler->add_error_message('CONV_ERROR_INSERT_BOT'); + + continue; + } + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_ary[0], + 'bot_ip' => (string) $bot_ary[1], + )); + + $this->db->sql_query($sql); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_BOTS'; + } +} diff --git a/phpBB/phpbb/install/module/install_data/task/add_languages.php b/phpBB/phpbb/install/module/install_data/task/add_languages.php new file mode 100644 index 0000000000..7ffdf4f276 --- /dev/null +++ b/phpBB/phpbb/install/module/install_data/task/add_languages.php @@ -0,0 +1,121 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data\task; + +class add_languages extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $language_helper; + + /** + * Constructor + * + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language_file_helper $language_helper Language file helper service + */ + public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container, + \phpbb\language\language_file_helper $language_helper) + { + $this->db = $container->get('dbal.conn'); + $this->iohandler = $iohandler; + $this->language_helper = $language_helper; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $languages = $this->language_helper->get_available_languages(); + $installed_languages = array(); + + foreach ($languages as $lang_info) + { + $lang_pack = array( + 'lang_iso' => $lang_info['iso'], + 'lang_dir' => $lang_info['iso'], + 'lang_english_name' => htmlspecialchars($lang_info['name']), + 'lang_local_name' => htmlspecialchars($lang_info['local_name'], ENT_COMPAT, 'UTF-8'), + 'lang_author' => htmlspecialchars($lang_info['author'], ENT_COMPAT, 'UTF-8'), + ); + + $this->db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $this->db->sql_build_array('INSERT', $lang_pack)); + + $installed_languages[] = (int) $this->db->sql_nextid(); + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message($error['message']); + } + } + + $sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE; + $result = $this->db->sql_query($sql); + + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE); + while ($row = $this->db->sql_fetchrow($result)) + { + foreach ($installed_languages as $lang_id) + { + $insert_buffer->insert(array( + 'field_id' => $row['field_id'], + 'lang_id' => $lang_id, + + // Remove phpbb_ from field name + 'lang_name' => strtoupper(substr($row['field_name'], 6)), + 'lang_explain' => '', + 'lang_default_value' => '', + )); + } + } + + $this->db->sql_freeresult($result); + + $insert_buffer->flush(); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_LANGUAGES'; + } +} diff --git a/phpBB/phpbb/install/module/install_data/task/add_modules.php b/phpBB/phpbb/install/module/install_data/task/add_modules.php new file mode 100644 index 0000000000..bfbe6282bc --- /dev/null +++ b/phpBB/phpbb/install/module/install_data/task/add_modules.php @@ -0,0 +1,462 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data\task; + +class add_modules extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\extension\manager + */ + protected $extension_manager; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\module\module_manager + */ + protected $module_manager; + + /** + * Define the module structure so that we can populate the database without + * needing to hard-code module_id values + * + * @var array + */ + protected $module_categories = array( + 'acp' => array( + 'ACP_CAT_GENERAL' => array( + 'ACP_QUICK_ACCESS', + 'ACP_BOARD_CONFIGURATION', + 'ACP_CLIENT_COMMUNICATION', + 'ACP_SERVER_CONFIGURATION', + ), + 'ACP_CAT_FORUMS' => array( + 'ACP_MANAGE_FORUMS', + 'ACP_FORUM_BASED_PERMISSIONS', + ), + 'ACP_CAT_POSTING' => array( + 'ACP_MESSAGES', + 'ACP_ATTACHMENTS', + ), + 'ACP_CAT_USERGROUP' => array( + 'ACP_CAT_USERS', + 'ACP_GROUPS', + 'ACP_USER_SECURITY', + ), + 'ACP_CAT_PERMISSIONS' => array( + 'ACP_GLOBAL_PERMISSIONS', + 'ACP_FORUM_BASED_PERMISSIONS', + 'ACP_PERMISSION_ROLES', + 'ACP_PERMISSION_MASKS', + ), + 'ACP_CAT_CUSTOMISE' => array( + 'ACP_STYLE_MANAGEMENT', + 'ACP_EXTENSION_MANAGEMENT', + 'ACP_LANGUAGE', + ), + 'ACP_CAT_MAINTENANCE' => array( + 'ACP_FORUM_LOGS', + 'ACP_CAT_DATABASE', + ), + 'ACP_CAT_SYSTEM' => array( + 'ACP_AUTOMATION', + 'ACP_GENERAL_TASKS', + 'ACP_MODULE_MANAGEMENT', + ), + 'ACP_CAT_DOT_MODS' => null, + ), + 'mcp' => array( + 'MCP_MAIN' => null, + 'MCP_QUEUE' => null, + 'MCP_REPORTS' => null, + 'MCP_NOTES' => null, + 'MCP_WARN' => null, + 'MCP_LOGS' => null, + 'MCP_BAN' => null, + ), + 'ucp' => array( + 'UCP_MAIN' => null, + 'UCP_PROFILE' => null, + 'UCP_PREFS' => null, + 'UCP_PM' => null, + 'UCP_USERGROUPS' => null, + 'UCP_ZEBRA' => null, + ), + ); + + /** + * @var array + */ + protected $module_categories_basenames = array( + 'UCP_PM' => 'ucp_pm', + ); + + /** + * @var array + */ + protected $module_extras = array( + 'acp' => array( + 'ACP_QUICK_ACCESS' => array( + 'ACP_MANAGE_USERS', + 'ACP_GROUPS_MANAGE', + 'ACP_MANAGE_FORUMS', + 'ACP_MOD_LOGS', + 'ACP_BOTS', + 'ACP_PHP_INFO', + ), + 'ACP_FORUM_BASED_PERMISSIONS' => array( + 'ACP_FORUM_PERMISSIONS', + 'ACP_FORUM_PERMISSIONS_COPY', + 'ACP_FORUM_MODERATORS', + 'ACP_USERS_FORUM_PERMISSIONS', + 'ACP_GROUPS_FORUM_PERMISSIONS', + ), + ), + ); + + /** + * Constructor + * + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + */ + public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container) + { + $this->db = $container->get('dbal.conn'); + $this->extension_manager = $container->get('ext.manager'); + $this->iohandler = $iohandler; + $this->module_manager = $container->get('module.manager'); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $module_classes = array('acp', 'mcp', 'ucp'); + foreach ($module_classes as $module_class) + { + $categories = array(); + + foreach ($this->module_categories[$module_class] as $cat_name => $subs) + { + // Check if this sub-category has a basename. If it has, use it. + $basename = (isset($this->module_categories_basenames[$cat_name])) ? $this->module_categories_basenames[$cat_name] : ''; + + $module_data = array( + 'module_basename' => $basename, + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => 0, + 'module_class' => $module_class, + 'module_langname' => $cat_name, + 'module_mode' => '', + 'module_auth' => '', + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + + $categories[$cat_name]['id'] = (int) $module_data['module_id']; + $categories[$cat_name]['parent_id'] = 0; + + if (is_array($subs)) + { + foreach ($subs as $level2_name) + { + // Check if this sub-category has a basename. If it has, use it. + $basename = (isset($this->module_categories_basenames[$level2_name])) ? $this->module_categories_basenames[$level2_name] : ''; + + $module_data = array( + 'module_basename' => $basename, + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => (int) $categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $level2_name, + 'module_mode' => '', + 'module_auth' => '', + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + + $categories[$level2_name]['id'] = (int) $module_data['module_id']; + $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id']; + } + } + } + + // Get the modules we want to add... returned sorted by name + $module_info = $this->module_manager->get_module_infos($module_class); + + foreach ($module_info as $module_basename => $fileinfo) + { + foreach ($fileinfo['modes'] as $module_mode => $row) + { + foreach ($row['cat'] as $cat_name) + { + if (!isset($categories[$cat_name])) + { + continue; + } + + $module_data = array( + 'module_basename' => $module_basename, + 'module_enabled' => 1, + 'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1, + 'parent_id' => (int) $categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $row['title'], + 'module_mode' => $module_mode, + 'module_auth' => $row['auth'], + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + } + } + + // Move some of the modules around since the code above will put them in the wrong place + if ($module_class === 'acp') + { + // Move main module 4 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_main' + AND module_class = 'acp' + AND module_mode = 'main'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 4); + + // Move permissions intro screen module 4 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_permissions' + AND module_class = 'acp' + AND module_mode = 'intro'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 4); + + // Move manage users screen module 5 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_users' + AND module_class = 'acp' + AND module_mode = 'overview'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 5); + + // Move extension management module 1 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_langname = 'ACP_EXTENSION_MANAGEMENT' + AND module_class = 'acp' + AND module_mode = '' + AND module_basename = ''"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 1); + } + + if ($module_class == 'mcp') + { + // Move pm report details module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_report_details'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'mcp', 'move_down', 3); + + // Move closed pm reports module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_reports_closed'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'mcp', 'move_down', 3); + + // Move open pm reports module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_reports'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'mcp', 'move_down', 3); + } + + if ($module_class == 'ucp') + { + // Move attachment module 4 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_attachments' + AND module_class = 'ucp' + AND module_mode = 'attachments'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'ucp', 'move_down', 4); + + // Move notification options module 4 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_notifications' + AND module_class = 'ucp' + AND module_mode = 'notification_options'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'ucp', 'move_down', 4); + + // Move OAuth module 5 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_auth_link' + AND module_class = 'ucp' + AND module_mode = 'auth_link'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'ucp', 'move_down', 5); + } + + // And now for the special ones + // (these are modules which appear in multiple categories and thus get added manually + // to some for more control) + if (isset($this->module_extras[$module_class])) + { + foreach ($this->module_extras[$module_class] as $cat_name => $mods) + { + $sql = 'SELECT module_id, left_id, right_id + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($cat_name) . "' + AND module_class = '" . $this->db->sql_escape($module_class) . "'"; + $result = $this->db->sql_query_limit($sql, 1); + $row2 = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + foreach ($mods as $mod_name) + { + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($mod_name) . "' + AND module_class = '" . $this->db->sql_escape($module_class) . "' + AND module_basename <> ''"; + $result = $this->db->sql_query_limit($sql, 1); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $module_data = array( + 'module_basename' => $row['module_basename'], + 'module_enabled' => (int) $row['module_enabled'], + 'module_display' => (int) $row['module_display'], + 'parent_id' => (int) $row2['module_id'], + 'module_class' => $row['module_class'], + 'module_langname' => $row['module_langname'], + 'module_mode' => $row['module_mode'], + 'module_auth' => $row['module_auth'], + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + } + } + + $this->module_manager->remove_cache_file($module_class); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_MODULES'; + } +} diff --git a/phpBB/phpbb/install/module/install_database/module.php b/phpBB/phpbb/install/module/install_database/module.php new file mode 100644 index 0000000000..0d8b33087f --- /dev/null +++ b/phpBB/phpbb/install/module/install_database/module.php @@ -0,0 +1,28 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database; + +/** + * Installer module for database installation + */ +class module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } +} diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php new file mode 100644 index 0000000000..6fb03ff73d --- /dev/null +++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php @@ -0,0 +1,341 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +/** + * Create database schema + */ +class add_config_settings extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\passwords\manager + */ + protected $password_manager; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $config_table; + + /** + * @var string + */ + protected $user_table; + + /** + * @var string + */ + protected $topics_table; + + /** + * @var string + */ + protected $forums_table; + + /** + * @var string + */ + protected $posts_table; + + /** + * @var string + */ + protected $moderator_cache_table; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service + * @param \phpbb\install\helper\config $install_config Installer's config helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language $language Language service + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container, + \phpbb\language\language $language, + $phpbb_root_path) + { + $this->db = $container->get('dbal.conn'); + $this->filesystem = $filesystem; + $this->install_config = $install_config; + $this->iohandler = $iohandler; + $this->language = $language; + $this->password_manager = $container->get('passwords.manager'); + $this->phpbb_root_path = $phpbb_root_path; + + // Table names + $this->config_table = $container->get_parameter('tables.config'); + $this->forums_table = $container->get_parameter('tables.forums'); + $this->topics_table = $container->get_parameter('tables.topics'); + $this->user_table = $container->get_parameter('tables.users'); + $this->moderator_cache_table = $container->get_parameter('tables.moderator_cache'); + $this->posts_table = $container->get_parameter('tables.posts'); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $server_name = $this->install_config->get('server_name'); + $cookie_domain = $this->install_config->get('cookie_domain'); + $current_time = time(); + $user_ip = phpbb_ip_normalise($this->iohandler->get_server_variable('REMOTE_ADDR')); + $user_ip = ($user_ip === false) ? '' : $user_ip; + $referer = $this->iohandler->get_server_variable('REFERER'); + + // Set default config and post data, this applies to all DB's + $sql_ary = array( + 'INSERT INTO ' . $this->config_table . " (config_name, config_value) + VALUES ('board_startdate', '$current_time')", + + 'INSERT INTO ' . $this->config_table . " (config_name, config_value) + VALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('img_imagick')) . "' + WHERE config_name = 'img_imagick'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "' + WHERE config_name = 'server_name'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_port')) . "' + WHERE config_name = 'server_port'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "' + WHERE config_name = 'board_email'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "' + WHERE config_name = 'board_contact'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($cookie_domain) . "' + WHERE config_name = 'cookie_domain'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "' + WHERE config_name = 'default_dateformat'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('email_enable')) . "' + WHERE config_name = 'email_enable'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_delivery')) . "' + WHERE config_name = 'smtp_delivery'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_host')) . "' + WHERE config_name = 'smtp_host'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_auth')) . "' + WHERE config_name = 'smtp_auth_method'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_user')) . "' + WHERE config_name = 'smtp_username'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_pass')) . "' + WHERE config_name = 'smtp_password'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('cookie_secure')) . "' + WHERE config_name = 'cookie_secure'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('force_server_vars')) . "' + WHERE config_name = 'force_server_vars'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('script_path')) . "' + WHERE config_name = 'script_path'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_protocol')) . "' + WHERE config_name = 'server_protocol'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE config_name = 'newest_username'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'avatar_salt'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'plupload_salt'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_name')) . "' + WHERE config_name = 'sitename'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_description')) . "' + WHERE config_name = 'site_desc'", + + 'UPDATE ' . $this->user_table . " + SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "', + user_password='" . $this->password_manager->hash($this->install_config->get('admin_passwd')) . "', + user_ip = '" . $this->db->sql_escape($user_ip) . "', + user_lang = '" . $this->db->sql_escape($this->install_config->get('user_language', 'en')) . "', + user_email='" . $this->db->sql_escape($this->install_config->get('board_email')) . "', + user_dateformat='" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "', + user_email_hash = " . $this->db->sql_escape(phpbb_email_hash($this->install_config->get('board_email'))) . ", + username_clean = '" . $this->db->sql_escape(utf8_clean_string($this->install_config->get('admin_name'))) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $this->moderator_cache_table . " + SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $this->forums_table . " + SET forum_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE forum_last_poster_name = 'Admin'", + + 'UPDATE ' . $this->topics_table . " + SET topic_first_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "', + topic_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE topic_first_poster_name = 'Admin' + OR topic_last_poster_name = 'Admin'", + + 'UPDATE ' . $this->user_table . " + SET user_regdate = $current_time", + + 'UPDATE ' . $this->posts_table . " + SET post_time = $current_time, poster_ip = '" . $this->db->sql_escape($user_ip) . "'", + + 'UPDATE ' . $this->topics_table . " + SET topic_time = $current_time, topic_last_post_time = $current_time", + + 'UPDATE ' . $this->forums_table . " + SET forum_last_post_time = $current_time", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->db->sql_server_info(true)) . "' + WHERE config_name = 'dbms_version'", + ); + + if (@extension_loaded('gd')) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = 'core.captcha.plugins.gd' + WHERE config_name = 'captcha_plugin'"; + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '1' + WHERE config_name = 'captcha_gd'"; + } + + $ref = substr($referer, strpos($referer, '://') + 3); + if (!(stripos($ref, $server_name) === 0)) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'referer_validation'"; + } + + // We set a (semi-)unique cookie name to bypass login issues related to the cookie name. + $cookie_name = 'phpbb3_'; + $rand_str = md5(mt_rand()); + $rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35)); + $rand_str = substr($rand_str, 0, 5); + $cookie_name .= strtolower($rand_str); + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($cookie_name) . "' + WHERE config_name = 'cookie_name'"; + + // Disable avatars if upload directory is not writable + if (!$this->filesystem->is_writable($this->phpbb_root_path . 'images/avatars/upload/')) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'allow_avatar'"; + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'allow_avatar_upload'"; + } + + foreach ($sql_ary as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_CONFIG_SETTINGS'; + } +} diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php new file mode 100644 index 0000000000..3d73a74618 --- /dev/null +++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php @@ -0,0 +1,163 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +/** + * Create database schema + */ +class add_default_data extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param \phpbb\install\helper\database $db_helper Installer's database helper + * @param \phpbb\install\helper\config $config Installer config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language $language Language service + * @param string $root_path Root path of phpBB + */ + public function __construct(\phpbb\install\helper\database $db_helper, + \phpbb\install\helper\config $config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container, + \phpbb\language\language $language, + $root_path) + { + $this->db = $container->get('dbal.conn.driver'); + $this->database_helper = $db_helper; + $this->config = $config; + $this->iohandler = $iohandler; + $this->language = $language; + $this->phpbb_root_path = $root_path; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $table_prefix = $this->config->get('table_prefix'); + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + + // Get schema data from file + $sql_query = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema_data.sql'); + + // Clean up SQL + $sql_query = $this->replace_dbms_specific_sql($sql_query); + $sql_query = preg_replace('# phpbb_([^\s]*) #i', ' ' . $table_prefix . '\1 ', $sql_query); + $sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', array($this, 'lang_replace_callback'), $sql_query); + $sql_query = $this->database_helper->remove_comments($sql_query); + $sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']); + + foreach ($sql_query as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + } + + /** + * Process DB specific SQL + * + * @return string + */ + protected function replace_dbms_specific_sql($query) + { + if ($this->db instanceof \phpbb\db\driver\mssql_base || $this->db instanceof \phpbb\db\driver\mssql) + { + $query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $query); + } + else if ($this->db instanceof \phpbb\db\driver\postgres) + { + $query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $query); + } + else if ($this->db instanceof \phpbb\db\driver\mysql_base) + { + $query = str_replace('\\', '\\\\', $query); + } + + return $query; + } + + /** + * Callback function for language replacing + * + * @param array $matches + * @return string + */ + public function lang_replace_callback($matches) + { + if (!empty($matches[1])) + { + return $this->db->sql_escape($this->language->lang($matches[1])); + } + + return ''; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_DEFAULT_DATA'; + } +} diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php new file mode 100644 index 0000000000..cabb78787f --- /dev/null +++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php @@ -0,0 +1,221 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +/** + * Create database schema + */ +class create_schema extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\db\tools\tools_interface + */ + protected $db_tools; + + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config provider + * @param \phpbb\install\helper\database $db_helper Installer's database helper + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param string $phpbb_root_path Path phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\database $db_helper, + \phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path, + $php_ext) + { + $dbms = $db_helper->get_available_dbms($config->get('dbms')); + $dbms = $dbms[$config->get('dbms')]['DRIVER']; + $factory = new \phpbb\db\tools\factory(); + + $this->db = new $dbms(); + $this->db->sql_connect( + $config->get('dbhost'), + $config->get('dbuser'), + $config->get('dbpasswd'), + $config->get('dbname'), + $config->get('dbport'), + false, + false + ); + + $this->config = $config; + $this->db_tools = $factory->get($this->db); + $this->database_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + $schema_name = $dbms_info[$dbms]['SCHEMA']; + $delimiter = $dbms_info[$dbms]['DELIM']; + $table_prefix = $this->config->get('table_prefix'); + + if ($dbms === 'mysql') + { + if (version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $schema_name .= '_41'; + } + else + { + $schema_name .= '_40'; + } + } + + $db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql'; + + // Load database vendor specific code if there is any + if ($this->filesystem->exists($db_schema_path)) + { + $sql_query = @file_get_contents($db_schema_path); + $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query); + $sql_query = $this->database_helper->remove_comments($sql_query); + $sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter); + + foreach ($sql_query as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + + unset($sql_query); + } + + $change_prefix = false; + + // Generate database schema + if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json')) + { + $db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + $change_prefix = true; + } + else + { + global $table_prefix; + + $table_prefix = $this->config->get('table_prefix'); + + if (!defined('CONFIG_TABLE')) + { + // We need to include the constants file for the table constants + // when we generate the schema from the migration files. + include ($this->phpbb_root_path . 'includes/constants.' . $this->php_ext); + } + + $finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, null, $this->php_ext); + $migrator_classes = $finder->core_path('phpbb/db/migration/data/')->get_classes(); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db, true); + $schema_generator = new \phpbb\db\migration\schema_generator( + $migrator_classes, + new \phpbb\config\config(array()), + $this->db, + $db_tools, + $this->phpbb_root_path, + $this->php_ext, + $table_prefix + ); + $db_table_schema = $schema_generator->get_schema(); + } + + if (!defined('CONFIG_TABLE')) + { + // CONFIG_TABLE is required by sql_create_index() to check the + // length of index names. However table_prefix is not defined + // here yet, so we need to create the constant ourselves. + define('CONFIG_TABLE', $table_prefix . 'config'); + } + + foreach ($db_table_schema as $table_name => $table_data) + { + $this->db_tools->sql_create_table( + ( ($change_prefix) ? ($table_prefix . substr($table_name, 6)) : $table_name ), + $table_data + ); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_DATABASE_SCHEMA'; + } +} diff --git a/phpBB/phpbb/install/module/install_filesystem/module.php b/phpBB/phpbb/install/module/install_filesystem/module.php new file mode 100644 index 0000000000..7215449664 --- /dev/null +++ b/phpBB/phpbb/install/module/install_filesystem/module.php @@ -0,0 +1,28 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_filesystem; + +/** + * Installer module for filesystem installation + */ +class module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } +} diff --git a/phpBB/phpbb/install/module/install_filesystem/task/create_config_file.php b/phpBB/phpbb/install/module/install_filesystem/task/create_config_file.php new file mode 100644 index 0000000000..e0890a929c --- /dev/null +++ b/phpBB/phpbb/install/module/install_filesystem/task/create_config_file.php @@ -0,0 +1,246 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_filesystem\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * Dumps config file + */ +class create_config_file extends \phpbb\install\task_base +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\database + */ + protected $db_helper; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var array + */ + protected $options; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param \phpbb\install\helper\config $install_config + * @param \phpbb\install\helper\database $db_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + * @param string $php_ext + * @param array $options + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\database $db_helper, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path, + $php_ext, + $options = array()) + { + $this->install_config = $install_config; + $this->db_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->options = array_merge(array( + 'debug' => false, + 'debug_container' => false, + 'environment' => null, + ), $options); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $config_written = true; + + // Create config.php + $path_to_config = $this->phpbb_root_path . 'config.' . $this->php_ext; + + $fp = @fopen($path_to_config, 'w'); + if (!$fp) + { + $config_written = false; + } + + $config_content = $this->get_config_data($this->options['debug'], $this->options['debug_container'], $this->options['environment']); + + if (!@fwrite($fp, $config_content)) + { + $config_written = false; + } + + @fclose($fp); + + // chmod config.php to be only readable + if ($config_written) + { + try + { + $this->filesystem->phpbb_chmod($path_to_config, \phpbb\filesystem\filesystem_interface::CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + else + { + $this->iohandler->add_error_message('UNABLE_TO_WRITE_CONFIG_FILE'); + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + + // Create a lock file to indicate that there is an install in progress + $fp = @fopen($this->phpbb_root_path . 'cache/install_lock', 'wb'); + if ($fp === false) + { + // We were unable to create the lock file - abort + $this->iohandler->add_error_message('UNABLE_TO_WRITE_LOCK'); + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + @fclose($fp); + + try + { + $this->filesystem->phpbb_chmod($this->phpbb_root_path . 'cache/install_lock', 0777); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + + /** + * Returns the content which should be dumped to config.php + * + * @param bool $debug If the debug constants should be enabled by default or not + * @param bool $debug_container If the container should be compiled on + * every page load or not + * @param string $environment The environment to use + * + * @return string content to be written to the config file + */ + protected function get_config_data($debug = false, $debug_container = false, $environment = null) + { + $config_content = "<?php\n"; + $config_content .= "// phpBB 3.2.x auto-generated configuration file\n// Do not change anything in this file!\n"; + + $dbms = $this->install_config->get('dbms'); + $db_driver = $this->db_helper->get_available_dbms($dbms); + $db_driver = $db_driver[$dbms]['DRIVER']; + + $config_data_array = array( + 'dbms' => $db_driver, + 'dbhost' => $this->install_config->get('dbhost'), + 'dbport' => $this->install_config->get('dbport'), + 'dbname' => $this->install_config->get('dbname'), + 'dbuser' => $this->install_config->get('dbuser'), + 'dbpasswd' => $this->install_config->get('dbpasswd'), + 'table_prefix' => $this->install_config->get('table_prefix'), + + 'phpbb_adm_relative_path' => 'adm/', + + 'acm_type' => 'phpbb\cache\driver\file', + ); + + foreach ($config_data_array as $key => $value) + { + $config_content .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n"; + } + + $config_content .= "\n@define('PHPBB_INSTALLED', true);\n"; + $config_content .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n"; + + if ($environment) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'test');\n"; + } + else if ($debug) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'development');\n"; + } + else + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'production');\n"; + } + + if ($debug_container) + { + $config_content .= "@define('DEBUG_CONTAINER', true);\n"; + } + else + { + $config_content .= "// @define('DEBUG_CONTAINER', true);\n"; + } + + if ($environment === 'test') + { + $config_content .= "@define('DEBUG_TEST', true);\n"; + + // Mandatory for the functional tests, will be removed by PHPBB3-12623 + $config_content .= "@define('DEBUG', true);\n"; + } + + return $config_content; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_CONFIG_FILE'; + } +} diff --git a/phpBB/phpbb/install/module/install_finish/module.php b/phpBB/phpbb/install/module/install_finish/module.php new file mode 100644 index 0000000000..3a7544b84f --- /dev/null +++ b/phpBB/phpbb/install/module/install_finish/module.php @@ -0,0 +1,28 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_finish; + +/** + * Installer module for filesystem installation + */ +class module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } +} diff --git a/phpBB/phpbb/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php new file mode 100644 index 0000000000..5268b85a42 --- /dev/null +++ b/phpBB/phpbb/install/module/install_finish/task/notify_user.php @@ -0,0 +1,170 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_finish\task; + +use phpbb\config\db; + +/** + * Logs installation and sends an email to the admin + */ +class notify_user extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * @var \phpbb\config\db + */ + protected $config; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\log\log_interface + */ + protected $log; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\install\helper\container_factory $container + * @param \phpbb\install\helper\config $install_config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, $phpbb_root_path, $php_ext) + { + $this->install_config = $install_config; + $this->iohandler = $iohandler; + + $this->auth = $container->get('auth'); + $this->language = $container->get('language'); + $this->log = $container->get('log'); + $this->user = $container->get('user'); + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + // We need to reload config for cases when it doesn't have all values + $this->config = new db( + $container->get('dbal.conn'), + $container->get('cache.driver'), + $container->get_parameter('tables.config') + ); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->user->session_begin(); + $this->user->setup('common'); + + if ($this->config['email_enable']) + { + include ($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); + + // functions_messenger.php uses config to determine language paths + // Remove when able + global $config; + $config = $this->config; + + $messenger = new \messenger(false); + $messenger->template('installed', $this->install_config->get('user_language', 'en')); + $messenger->to($this->config['board_email'], $this->install_config->get('admin_name')); + $messenger->anti_abuse_headers($this->config, $this->user); + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')), + 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd'))) + ); + $messenger->send(NOTIFY_EMAIL); + } + + // Login admin + // Ugly but works + $this->auth->login( + $this->install_config->get('admin_name'), + $this->install_config->get('admin_passwd'), + false, + true, + true + ); + + $this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id); + $this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']); + $this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']); + + // Create log + $this->log->add( + 'admin', + $this->user->data['user_id'], + $this->user->ip, + 'LOG_INSTALL_INSTALLED', + false, + array($this->config['version']) + ); + + // Remove install_lock + @unlink($this->phpbb_root_path . 'cache/install_lock'); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_NOTIFY_USER'; + } +} diff --git a/phpBB/phpbb/install/module/install_finish/task/populate_migrations.php b/phpBB/phpbb/install/module/install_finish/task/populate_migrations.php new file mode 100644 index 0000000000..8629d9aea3 --- /dev/null +++ b/phpBB/phpbb/install/module/install_finish/task/populate_migrations.php @@ -0,0 +1,72 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_finish\task; + +/** + * Populates migrations + */ +class populate_migrations extends \phpbb\install\task_base +{ + /** + * @var \phpbb\extension\manager + */ + protected $extension_manager; + + /** + * @var \phpbb\db\migrator + */ + protected $migrator; + + /** + * Constructor + * + * @param \phpbb\install\helper\container_factory $container phpBB's DI contianer + */ + public function __construct(\phpbb\install\helper\container_factory $container) + { + $this->extension_manager = $container->get('ext.manager'); + $this->migrator = $container->get('migrator'); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $finder = $this->extension_manager->get_finder(); + + $migrations = $finder + ->core_path('phpbb/db/migration/data/') + ->get_classes(); + $this->migrator->populate_migrations($migrations); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_POPULATE_MIGRATIONS'; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/install_module.php b/phpBB/phpbb/install/module/obtain_data/install_module.php new file mode 100644 index 0000000000..deb4be90d8 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/install_module.php @@ -0,0 +1,33 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data; + +class install_module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'obtain_data'); + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + return 0; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php new file mode 100644 index 0000000000..ac305e8ab5 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php @@ -0,0 +1,219 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class requests and validates admin account data from the user + */ +class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $install_config Installer's config helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->install_config = $install_config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->io_handler->get_input('submit_admin', false)) + { + $this->process_form(); + } + else + { + $this->request_form_data(); + } + } + + /** + * Process form data + */ + protected function process_form() + { + // Admin data + $admin_name = $this->io_handler->get_input('admin_name', '', true); + $admin_pass1 = $this->io_handler->get_input('admin_pass1', '', true); + $admin_pass2 = $this->io_handler->get_input('admin_pass2', '', true); + $board_email = $this->io_handler->get_input('board_email', '', true); + + $admin_data_valid = $this->check_admin_data($admin_name, $admin_pass1, $admin_pass2, $board_email); + + if ($admin_data_valid) + { + $this->install_config->set('admin_name', $admin_name); + $this->install_config->set('admin_passwd', $admin_pass1); + $this->install_config->set('board_email', $board_email); + } + else + { + $this->request_form_data(true); + } + } + + /** + * Request data from the user + * + * @param bool $use_request_data Whether to use submited data + * + * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + */ + protected function request_form_data($use_request_data = false) + { + if ($use_request_data) + { + $admin_username = $this->io_handler->get_input('admin_name', '', true); + $admin_email = $this->io_handler->get_input('board_email', '', true); + } + else + { + $admin_username = ''; + $admin_email = ''; + } + + $admin_form = array( + 'admin_name' => array( + 'label' => 'ADMIN_USERNAME', + 'description' => 'ADMIN_USERNAME_EXPLAIN', + 'type' => 'text', + 'default' => $admin_username, + ), + 'board_email' => array( + 'label' => 'CONTACT_EMAIL', + 'type' => 'email', + 'default' => $admin_email, + ), + 'admin_pass1' => array( + 'label' => 'ADMIN_PASSWORD', + 'description' => 'ADMIN_PASSWORD_EXPLAIN', + 'type' => 'password', + ), + 'admin_pass2' => array( + 'label' => 'ADMIN_PASSWORD_CONFIRM', + 'type' => 'password', + ), + 'submit_admin' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('ADMIN_CONFIG', $admin_form); + + // Require user interaction + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + + /** + * Check admin data + * + * @param string $username Admin username + * @param string $pass1 Admin password + * @param string $pass2 Admin password confirmation + * @param string $email Admin e-mail address + * + * @return bool True if data is valid, false otherwise + */ + protected function check_admin_data($username, $pass1, $pass2, $email) + { + $data_valid = true; + + // Check if none of admin data is empty + if (in_array('', array($username, $pass1, $pass2, $email), true)) + { + $this->io_handler->add_error_message('INST_ERR_MISSING_DATA'); + $data_valid = false; + } + + if (utf8_strlen($username) < 3) + { + $this->io_handler->add_error_message('INST_ERR_USER_TOO_SHORT'); + $data_valid = false; + } + + if (utf8_strlen($username) > 20) + { + $this->io_handler->add_error_message('INST_ERR_USER_TOO_LONG'); + $data_valid = false; + } + + if ($pass1 !== $pass2 && $pass1 !== '') + { + $this->io_handler->add_error_message('INST_ERR_PASSWORD_MISMATCH'); + $data_valid = false; + } + + // Test against the default password rules + if (utf8_strlen($pass1) < 6) + { + $this->io_handler->add_error_message('INST_ERR_PASSWORD_TOO_SHORT'); + $data_valid = false; + } + + if (utf8_strlen($pass1) > 30) + { + $this->io_handler->add_error_message('INST_ERR_PASSWORD_TOO_LONG'); + $data_valid = false; + } + + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) + { + $this->io_handler->add_error_message('INST_ERR_EMAIL_INVALID'); + $data_valid = false; + } + + return $data_valid; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php new file mode 100644 index 0000000000..6c54561d14 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php @@ -0,0 +1,186 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class obtains default data from the user related to board (Board name, Board descritpion, etc...) + */ +class obtain_board_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $language_helper; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\language\language_file_helper $lang_helper Language file helper + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\language\language_file_helper $lang_helper) + { + $this->install_config = $config; + $this->io_handler = $iohandler; + $this->language_helper = $lang_helper; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->io_handler->get_input('submit_board', false)) + { + $this->process_form(); + } + else + { + $this->request_form_data(); + } + } + + /** + * Process form data + */ + protected function process_form() + { + // Board data + $default_lang = $this->io_handler->get_input('default_lang', ''); + $board_name = $this->io_handler->get_input('board_name', '', true); + $board_desc = $this->io_handler->get_input('board_description', '', true); + + // Check default lang + $langs = $this->language_helper->get_available_languages(); + $lang_valid = false; + + foreach ($langs as $lang) + { + if ($lang['iso'] === $default_lang) + { + $lang_valid = true; + break; + } + } + + $this->install_config->set('board_name', $board_name); + $this->install_config->set('board_description', $board_desc); + + if ($lang_valid) + { + $this->install_config->set('default_lang', $default_lang); + } + else + { + $this->request_form_data(true); + } + } + + /** + * Request data from the user + * + * @param bool $use_request_data Whether to use submited data + * + * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + */ + protected function request_form_data($use_request_data = false) + { + if ($use_request_data) + { + $board_name = $this->io_handler->get_input('board_name', '', true); + $board_desc = $this->io_handler->get_input('board_description', '', true); + } + else + { + $board_name = '{L_CONFIG_SITENAME}'; + $board_desc = '{L_CONFIG_SITE_DESC}'; + } + + // Use language because we only check this to be valid + $default_lang = $this->install_config->get('user_language', 'en'); + + $langs = $this->language_helper->get_available_languages(); + $lang_options = array(); + + foreach ($langs as $lang) + { + $lang_options[] = array( + 'value' => $lang['iso'], + 'label' => $lang['local_name'], + 'selected' => ($default_lang === $lang['iso']), + ); + } + + $board_form = array( + 'default_lang' => array( + 'label' => 'DEFAULT_LANGUAGE', + 'type' => 'select', + 'options' => $lang_options, + ), + 'board_name' => array( + 'label' => 'BOARD_NAME', + 'type' => 'text', + 'default' => $board_name, + ), + 'board_description' => array( + 'label' => 'BOARD_DESCRIPTION', + 'type' => 'text', + 'default' => $board_desc, + ), + 'submit_board' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('BOARD_CONFIG', $board_form); + + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php new file mode 100644 index 0000000000..f0e7f1f686 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php @@ -0,0 +1,271 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class requests and validates database information from the user + */ +class obtain_database_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\database $database_helper Installer's database helper + * @param \phpbb\install\helper\config $install_config Installer's config helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\database $database_helper, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->database_helper = $database_helper; + $this->install_config = $install_config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->io_handler->get_input('submit_database', false)) + { + $this->process_form(); + } + else + { + $this->request_form_data(); + } + } + + /** + * Process form data + */ + protected function process_form() + { + // Collect database data + $dbms = $this->io_handler->get_input('dbms', ''); + $dbhost = $this->io_handler->get_input('dbhost', ''); + $dbport = $this->io_handler->get_input('dbport', ''); + $dbuser = $this->io_handler->get_input('dbuser', ''); + $dbpasswd = $this->io_handler->get_input('dbpasswd', '', true); + $dbname = $this->io_handler->get_input('dbname', ''); + $table_prefix = $this->io_handler->get_input('table_prefix', ''); + + // Check database data + $user_data_vaild = $this->check_database_data($dbms, $dbhost, $dbport, $dbuser, $dbpasswd, $dbname, $table_prefix); + + // Save database data if it is correct + if ($user_data_vaild) + { + $this->install_config->set('dbms', $dbms); + $this->install_config->set('dbhost', $dbhost); + $this->install_config->set('dbport', $dbport); + $this->install_config->set('dbuser', $dbuser); + $this->install_config->set('dbpasswd', $dbpasswd); + $this->install_config->set('dbname', $dbname); + $this->install_config->set('table_prefix', $table_prefix); + } + else + { + $this->request_form_data(true); + } + } + + /** + * Request data from the user + * + * @param bool $use_request_data Whether to use submited data + * + * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + */ + protected function request_form_data($use_request_data = false) + { + if ($use_request_data) + { + $dbms = $this->io_handler->get_input('dbms', ''); + $dbhost = $this->io_handler->get_input('dbhost', ''); + $dbport = $this->io_handler->get_input('dbport', ''); + $dbuser = $this->io_handler->get_input('dbuser', ''); + $dbname = $this->io_handler->get_input('dbname', ''); + $table_prefix = $this->io_handler->get_input('table_prefix', 'phpbb_'); + } + else + { + $dbms = ''; + $dbhost = ''; + $dbport = ''; + $dbuser = ''; + $dbname = ''; + $table_prefix = 'phpbb_'; + } + + $dbms_select = array(); + foreach ($this->database_helper->get_available_dbms() as $dbms_key => $dbms_array) + { + $dbms_select[] = array( + 'value' => $dbms_key, + 'label' => 'DB_OPTION_' . strtoupper($dbms_key), + 'selected' => ($dbms_key === $dbms), + ); + } + + $database_form = array( + 'dbms' => array( + 'label' => 'DBMS', + 'type' => 'select', + 'options' => $dbms_select, + ), + 'dbhost' => array( + 'label' => 'DB_HOST', + 'description' => 'DB_HOST_EXPLAIN', + 'type' => 'text', + 'default' => $dbhost, + ), + 'dbport' => array( + 'label' => 'DB_PORT', + 'description' => 'DB_PORT_EXPLAIN', + 'type' => 'text', + 'default' => $dbport, + ), + 'dbuser' => array( + 'label' => 'DB_USERNAME', + 'type' => 'text', + 'default' => $dbuser, + ), + 'dbpasswd' => array( + 'label' => 'DB_PASSWORD', + 'type' => 'password', + ), + 'dbname' => array( + 'label' => 'DB_NAME', + 'type' => 'text', + 'default' => $dbname, + ), + 'table_prefix' => array( + 'label' => 'TABLE_PREFIX', + 'description' => 'TABLE_PREFIX_EXPLAIN', + 'type' => 'text', + 'default' => $table_prefix, + ), + 'submit_database' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('DB_CONFIG', $database_form); + + // Require user interaction + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + + /** + * Check database data + * + * @param string $dbms Selected database type + * @param string $dbhost Database host address + * @param int $dbport Database port number + * @param string $dbuser Database username + * @param string $dbpass Database password + * @param string $dbname Database name + * @param string $table_prefix Database table prefix + * + * @return bool True if database data is correct, false otherwise + */ + protected function check_database_data($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix) + { + $available_dbms = $this->database_helper->get_available_dbms(); + $data_valid = true; + + // Check if PHP has the database extensions for the specified DBMS + if (!isset($available_dbms[$dbms])) + { + $this->io_handler->add_error_message('INST_ERR_NO_DB'); + $data_valid = false; + } + + // Validate table prefix + $prefix_valid = $this->database_helper->validate_table_prefix($dbms, $table_prefix); + if (is_array($prefix_valid)) + { + foreach ($prefix_valid as $error) + { + $this->io_handler->add_error_message( + $error['title'], + (isset($error['description'])) ? $error['description'] : false + ); + } + + $data_valid = false; + } + + // Try to connect to database if all provided data is valid + if ($data_valid) + { + $connect_test = $this->database_helper->check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix); + if (is_array($connect_test)) + { + foreach ($connect_test as $error) + { + $this->io_handler->add_error_message( + $error['title'], + (isset($error['description'])) ? $error['description'] : false + ); + } + + $data_valid = false; + } + } + + return $data_valid; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php new file mode 100644 index 0000000000..b04b8e353f --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php @@ -0,0 +1,167 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +class obtain_email_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->install_config = $config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // E-mail data + $email_enable = $this->io_handler->get_input('email_enable', true); + $smtp_delivery = $this->io_handler->get_input('smtp_delivery', ''); + $smtp_host = $this->io_handler->get_input('smtp_host', ''); + $smtp_auth = $this->io_handler->get_input('smtp_auth', ''); + $smtp_user = $this->io_handler->get_input('smtp_user', ''); + $smtp_passwd = $this->io_handler->get_input('smtp_pass', ''); + + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); + + // Check if data is sent + if ($this->io_handler->get_input('submit_email', false)) + { + $this->install_config->set('email_enable', $email_enable); + $this->install_config->set('smtp_delivery', $smtp_delivery); + $this->install_config->set('smtp_host', $smtp_host); + $this->install_config->set('smtp_auth', $smtp_auth); + $this->install_config->set('smtp_user', $smtp_user); + $this->install_config->set('smtp_pass', $smtp_passwd); + } + else + { + $auth_options = array(); + foreach ($auth_methods as $method) + { + $auth_options[] = array( + 'value' => $method, + 'label' => 'SMTP_' . str_replace('-', '_', $method), + 'selected' => false, + ); + } + + $email_form = array( + 'email_enable' => array( + 'label' => 'ENABLE_EMAIL', + 'description' => 'COOKIE_SECURE_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 1, + 'label' => 'ENABLE', + 'selected' => true, + ), + array( + 'value' => 0, + 'label' => 'DISABLE', + 'selected' => false, + ), + ), + ), + 'smtp_delivery' => array( + 'label' => 'USE_SMTP', + 'description' => 'USE_SMTP_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 0, + 'label' => 'NO', + 'selected' => true, + ), + array( + 'value' => 1, + 'label' => 'YES', + 'selected' => false, + ), + ), + ), + 'smtp_host' => array( + 'label' => 'SMTP_SERVER', + 'type' => 'text', + 'default' => $smtp_host, + ), + 'smtp_auth' => array( + 'label' => 'SMTP_AUTH_METHOD', + 'description' => 'SMTP_AUTH_METHOD_EXPLAIN', + 'type' => 'select', + 'options' => $auth_options, + ), + 'smtp_user' => array( + 'label' => 'SMTP_USERNAME', + 'description' => 'SMTP_USERNAME_EXPLAIN', + 'type' => 'text', + 'default' => $smtp_user, + ), + 'smtp_pass' => array( + 'label' => 'SMTP_PASSWORD', + 'description' => 'SMTP_PASSWORD_EXPLAIN', + 'type' => 'password', + ), + 'submit_email' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('EMAIL_CONFIG', $email_form); + + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php new file mode 100644 index 0000000000..9bcb73a6a9 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php @@ -0,0 +1,168 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\task_base; + +class obtain_file_updater_method extends task_base +{ + /** + * @var array Supported compression methods + * + * Note: .tar is assumed to be supported, but not in the list + */ + protected $available_methods; + + /** + * @var \phpbb\install\helper\config + */ + protected $installer_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * Constructor + * + * @param config $installer_config + * @param iohandler_interface $iohandler + */ + public function __construct(config $installer_config, iohandler_interface $iohandler) + { + $this->installer_config = $installer_config; + $this->iohandler = $iohandler; + + $this->available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib'); + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + return $this->installer_config->get('do_update_files', false); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->iohandler->get_input('submit_update_file', false)) + { + $supported_methods = array('compression', 'ftp', 'direct_file'); + $method = $this->iohandler->get_input('method', 'compression'); + $update_method = (in_array($method, $supported_methods, true)) ? $method : 'compression'; + $this->installer_config->set('file_update_method', $update_method); + + $compression = $this->iohandler->get_input('compression_method', '.zip'); + $supported_methods = array_keys($this->available_methods); + $supported_methods[] = '.tar'; + $compression = (in_array($compression, $supported_methods, true)) ? $compression : '.zip'; + $this->installer_config->set('file_update_compression', $compression); + } + else + { + $this->iohandler->add_user_form_group('UPDATE_FILE_METHOD_TITLE', array( + 'method' => array( + 'label' => 'UPDATE_FILE_METHOD', + 'type' => 'select', + 'options' => array( + array( + 'value' => 'compression', + 'label' => 'UPDATE_FILE_METHOD_DOWNLOAD', + 'selected' => true, + ), + array( + 'value' => 'ftp', + 'label' => 'UPDATE_FILE_METHOD_FTP', + 'selected' => false, + ), + array( + 'value' => 'direct_file', + 'label' => 'UPDATE_FILE_METHOD_FILESYSTEM', + 'selected' => false, + ), + ), + ), + 'compression_method' => array( + 'label' => 'SELECT_DOWNLOAD_FORMAT', + 'type' => 'select', + 'options' => $this->get_available_compression_methods(), + ), + 'submit_update_file' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + )); + + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + } + + /** + * Returns form elements in an array of available compression methods + * + * @return array + */ + protected function get_available_compression_methods() + { + $methods[] = array( + 'value' => '.tar', + 'label' => '.tar', + 'selected' => true, + ); + + foreach ($this->available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + + $methods[] = array( + 'value' => $type, + 'label' => $type, + 'selected' => false, + ); + } + + return $methods; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php new file mode 100644 index 0000000000..9f74b61770 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php @@ -0,0 +1,89 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + */ + public function __construct(\phpbb\install\helper\config $config) + { + $this->config = $config; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Can we find Imagemagick anywhere on the system? + $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : ''; + + $magic_home = getenv('MAGICK_HOME'); + $img_imagick = ''; + if (empty($magic_home)) + { + $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/'); + $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH')))); + + $locations = array_merge($path_locations, $locations); + foreach ($locations as $location) + { + // The path might not end properly, fudge it + if (substr($location, -1, 1) !== '/') + { + $location .= '/'; + } + + if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000) + { + $img_imagick = str_replace('\\', '/', $location); + continue; + } + } + } + else + { + $img_imagick = str_replace('\\', '/', $magic_home); + } + + $this->config->set('img_imagick', $img_imagick); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php new file mode 100644 index 0000000000..654b5534a9 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php @@ -0,0 +1,203 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class requests and saves some information about the server + */ +class obtain_server_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->install_config = $config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + /** + * {@inheritdoc} + */ + public function run() + { + $cookie_secure = $this->io_handler->is_secure(); + $server_protocol = ($this->io_handler->is_secure()) ? 'https://' : 'http://'; + $server_port = $this->io_handler->get_server_variable('SERVER_PORT', 0); + + // HTTP_HOST is having the correct browser url in most cases... + $server_name = strtolower(htmlspecialchars_decode($this->io_handler->get_header_variable( + 'Host', + $this->io_handler->get_server_variable('SERVER_NAME') + ))); + + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') !== false) + { + $server_name = substr($server_name, 0, strpos($server_name, ':')); + } + + $script_path = htmlspecialchars_decode($this->io_handler->get_server_variable('PHP_SELF')); + + if (!$script_path) + { + $script_path = htmlspecialchars_decode($this->io_handler->get_server_variable('REQUEST_URI')); + } + + $script_path = str_replace(array('\\', '//'), '/', $script_path); + $script_path = trim(dirname(dirname(dirname($script_path)))); // Because we are in install/app.php/route_name + + // Server data + $cookie_secure = $this->io_handler->get_input('cookie_secure', $cookie_secure); + $server_protocol = $this->io_handler->get_input('server_protocol', $server_protocol); + $force_server_vars = $this->io_handler->get_input('force_server_vars', 0); + $server_name = $this->io_handler->get_input('server_name', $server_name); + $server_port = $this->io_handler->get_input('server_port', $server_port); + $script_path = $this->io_handler->get_input('script_path', $script_path); + + // Clean up script path + if ($script_path !== '/') + { + // Adjust destination path (no trailing slash) + if (substr($script_path, -1) === '/') + { + $script_path = substr($script_path, 0, -1); + } + + $script_path = str_replace(array('../', './'), '', $script_path); + + if ($script_path[0] !== '/') + { + $script_path = '/' . $script_path; + } + } + + // Check if data is sent + if ($this->io_handler->get_input('submit_server', false)) + { + $this->install_config->set('cookie_secure', $cookie_secure); + $this->install_config->set('server_protocol', $server_protocol); + $this->install_config->set('force_server_vars', $force_server_vars); + $this->install_config->set('server_name', $server_name); + $this->install_config->set('server_port', $server_port); + $this->install_config->set('script_path', $script_path); + } + else + { + // Render form + $server_form = array( + 'cookie_secure' => array( + 'label' => 'COOKIE_SECURE', + 'description' => 'COOKIE_SECURE_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 0, + 'label' => 'NO', + 'selected' => (!$cookie_secure), + ), + array( + 'value' => 1, + 'label' => 'YES', + 'selected' => ($cookie_secure), + ), + ), + ), + 'force_server_vars' => array( + 'label' => 'FORCE_SERVER_VARS', + 'description' => 'FORCE_SERVER_VARS_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 0, + 'label' => 'NO', + 'selected' => true, + ), + array( + 'value' => 1, + 'label' => 'YES', + 'selected' => false, + ), + ), + ), + 'server_protocol' => array( + 'label' => 'SERVER_PROTOCOL', + 'description' => 'SERVER_PROTOCOL_EXPLAIN', + 'type' => 'text', + 'default' => $server_protocol, + ), + 'server_name' => array( + 'label' => 'SERVER_NAME', + 'description' => 'SERVER_NAME_EXPLAIN', + 'type' => 'text', + 'default' => $server_name, + ), + 'server_port' => array( + 'label' => 'SERVER_PORT', + 'description' => 'SERVER_PORT_EXPLAIN', + 'type' => 'text', + 'default' => $server_port, + ), + 'script_path' => array( + 'label' => 'SCRIPT_PATH', + 'description' => 'SCRIPT_PATH_EXPLAIN', + 'type' => 'text', + 'default' => $script_path, + ), + 'submit_server' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ) + ); + + $this->io_handler->add_user_form_group('SERVER_CONFIG', $server_form); + + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_files.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_files.php new file mode 100644 index 0000000000..0cb809154e --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_files.php @@ -0,0 +1,113 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\task_base; + +class obtain_update_files extends task_base +{ + /** + * @var config + */ + protected $installer_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param config $config + * @param iohandler_interface $iohandler + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(config $config, iohandler_interface $iohandler, $phpbb_root_path, $php_ext) + { + $this->installer_config = $config; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + return $this->installer_config->get('do_update_files', false); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Load update info file + // The file should be checked in the requirements, so we assume that it exists + $update_info_file = $this->phpbb_root_path . 'install/update/index.' . $this->php_ext; + include($update_info_file); + $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; + + // If the file is invalid, abort mission + if (!$info) + { + $this->iohandler->add_error_message('WRONG_INFO_FILE_FORMAT'); + throw new user_interaction_required_exception(); + } + + // Replace .php with $this->php_ext if needed + if ($this->php_ext !== 'php') + { + $custom_extension = '.' . $this->php_ext; + $info['files'] = preg_replace('#\.php$#i', $custom_extension, $info['files']); + } + + // Save update info + $this->installer_config->set('update_info_unprocessed', $info); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_ftp_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_ftp_data.php new file mode 100644 index 0000000000..a4d362a0f1 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_ftp_data.php @@ -0,0 +1,164 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\helper\update_helper; +use phpbb\install\task_base; + +class obtain_update_ftp_data extends task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $installer_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param config $installer_config + * @param iohandler_interface $iohandler + * @param update_helper $update_helper + * @param string $php_ext + */ + public function __construct(config $installer_config, iohandler_interface $iohandler, update_helper $update_helper, $php_ext) + { + $this->installer_config = $installer_config; + $this->iohandler = $iohandler; + $this->update_helper = $update_helper; + $this->php_ext = $php_ext; + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + return ($this->installer_config->get('do_update_files', false) && + ($this->installer_config->get('file_update_method', '') === 'ftp') + ); + } + + /** + * {@inheritdoc} + */ + public function run() + { + if ($this->iohandler->get_input('submit_ftp', false)) + { + $this->update_helper->include_file('includes/functions_transfer.' . $this->php_ext); + + $method = 'ftp'; + $methods = \transfer::methods(); + if (!in_array($method, $methods, true)) + { + $method = $methods[0]; + } + + $ftp_host = $this->iohandler->get_input('ftp_host', ''); + $ftp_user = $this->iohandler->get_input('ftp_user', ''); + $ftp_pass = htmlspecialchars_decode($this->iohandler->get_input('ftp_pass', '')); + $ftp_path = $this->iohandler->get_input('ftp_path', ''); + $ftp_port = $this->iohandler->get_input('ftp_port', 21); + $ftp_time = $this->iohandler->get_input('ftp_timeout', 10); + + $this->installer_config->set('ftp_host', $ftp_host); + $this->installer_config->set('ftp_user', $ftp_user); + $this->installer_config->set('ftp_pass', $ftp_pass); + $this->installer_config->set('ftp_path', $ftp_path); + $this->installer_config->set('ftp_port', (int) $ftp_port); + $this->installer_config->set('ftp_timeout', (int) $ftp_time); + $this->installer_config->set('ftp_method', $method); + } + else + { + $this->iohandler->add_user_form_group('FTP_SETTINGS', array( + 'ftp_host' => array( + 'label' => 'FTP_HOST', + 'description' => 'FTP_HOST_EXPLAIN', + 'type' => 'text', + ), + 'ftp_user' => array( + 'label' => 'FTP_USERNAME', + 'description' => 'FTP_USERNAME_EXPLAIN', + 'type' => 'text', + ), + 'ftp_pass' => array( + 'label' => 'FTP_PASSWORD', + 'description' => 'FTP_PASSWORD_EXPLAIN', + 'type' => 'password', + ), + 'ftp_path' => array( + 'label' => 'FTP_ROOT_PATH', + 'description' => 'FTP_ROOT_PATH_EXPLAIN', + 'type' => 'text', + ), + 'ftp_port' => array( + 'label' => 'FTP_PORT', + 'description' => 'FTP_PORT_EXPLAIN', + 'type' => 'text', + 'default' => 21, + ), + 'ftp_timeout' => array( + 'label' => 'FTP_TIMEOUT', + 'description' => 'FTP_TIMEOUT_EXPLAIN', + 'type' => 'text', + 'default' => 10, + ), + 'submit_ftp' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + )); + + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php new file mode 100644 index 0000000000..6a98721e77 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php @@ -0,0 +1,103 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\task_base; + +class obtain_update_settings extends task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $installer_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * Constructor + * + * @param config $installer_config + * @param iohandler_interface $iohandler + */ + public function __construct(config $installer_config, iohandler_interface $iohandler) + { + $this->installer_config = $installer_config; + $this->iohandler = $iohandler; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->iohandler->get_input('submit_update', false)) + { + $update_files = $this->iohandler->get_input('update_type', 'all') === 'all'; + $this->installer_config->set('do_update_files', $update_files); + } + else + { + $this->iohandler->add_user_form_group('UPDATE_TYPE', array( + 'update_type' => array( + 'label' => 'UPDATE_TYPE', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 'all', + 'label' => 'UPDATE_TYPE_ALL', + 'selected' => true, + ), + array( + 'value' => 'db_only', + 'label' => 'UPDATE_TYPE_DB_ONLY', + 'selected' => false, + ), + ), + ), + 'submit_update' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + )); + + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/update_module.php b/phpBB/phpbb/install/module/obtain_data/update_module.php new file mode 100644 index 0000000000..c2f9019d34 --- /dev/null +++ b/phpBB/phpbb/install/module/obtain_data/update_module.php @@ -0,0 +1,33 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\obtain_data; + +class update_module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('update', 0, 'obtain_data'); + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + return 0; + } +} diff --git a/phpBB/phpbb/install/module/requirements/abstract_requirements_module.php b/phpBB/phpbb/install/module/requirements/abstract_requirements_module.php new file mode 100644 index 0000000000..26593e6777 --- /dev/null +++ b/phpBB/phpbb/install/module/requirements/abstract_requirements_module.php @@ -0,0 +1,106 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements; + +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\module_base; + +/** + * Base class for requirements installer module + */ +abstract class abstract_requirements_module extends module_base +{ + public function run() + { + $tests_passed = true; + + // Recover install progress + $task_name = $this->recover_progress(); + $task_found = false; + + /** + * @var string $name ID of the service + * @var \phpbb\install\task_interface $task Task object + */ + foreach ($this->task_collection as $name => $task) + { + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + { + throw new resource_limit_reached_exception(); + } + + // Skip forward until the next task is reached + if (!$task_found) + { + if ($name === $task_name || empty($task_name)) + { + $task_found = true; + + if ($name === $task_name) + { + continue; + } + } + else + { + continue; + } + } + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + continue; + } + + if ($this->allow_progress_bar) + { + $this->install_config->increment_current_task_progress(); + } + + $test_result = $task->run(); + $tests_passed = ($tests_passed) ? $test_result : false; + } + + // Module finished, so clear task progress + $this->install_config->set_finished_task(''); + + // Check if tests have failed + if (!$tests_passed) + { + // If requirements are not met, exit form installer + // Set up UI for retesting + $this->iohandler->add_user_form_group('', array( + 'install' => array( + 'label' => 'RETEST_REQUIREMENTS', + 'type' => 'submit', + ), + )); + + // Send the response and quit + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + return 0; + } +} diff --git a/phpBB/phpbb/install/module/requirements/install_module.php b/phpBB/phpbb/install/module/requirements/install_module.php new file mode 100644 index 0000000000..ed0c5fbd94 --- /dev/null +++ b/phpBB/phpbb/install/module/requirements/install_module.php @@ -0,0 +1,25 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements; + +class install_module extends abstract_requirements_module +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'requirements'); + } +} diff --git a/phpBB/phpbb/install/module/requirements/task/check_filesystem.php b/phpBB/phpbb/install/module/requirements/task/check_filesystem.php new file mode 100644 index 0000000000..2aec3915e0 --- /dev/null +++ b/phpBB/phpbb/install/module/requirements/task/check_filesystem.php @@ -0,0 +1,275 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements\task; + +/** + * Checks filesystem requirements + */ +class check_filesystem extends \phpbb\install\task_base +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var array + */ + protected $files_to_check; + + /** + * @var bool + */ + protected $tests_passed; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $response; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem filesystem handler + * @param \phpbb\install\helper\iohandler\iohandler_interface $response response helper + * @param string $phpbb_root_path relative path to phpBB's root + * @param string $php_ext extension of php files + * @param bool $check_config_php Whether or not to check if config.php is writable + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\install\helper\iohandler\iohandler_interface $response, $phpbb_root_path, $php_ext, $check_config_php = true) + { + parent::__construct(true); + + $this->filesystem = $filesystem; + $this->response = $response; + $this->phpbb_root_path = $phpbb_root_path; + + $this->tests_passed = false; + + // Files/Directories to check + // All file/directory names must be relative to phpBB's root path + $this->files_to_check = array( + array( + 'path' => 'cache/', + 'failable' => false, + 'is_file' => false, + ), + array( + 'path' => 'store/', + 'failable' => false, + 'is_file' => false, + ), + array( + 'path' => 'files/', + 'failable' => false, + 'is_file' => false, + ), + array( + 'path' => 'images/avatars/upload/', + 'failable' => true, + 'is_file' => false, + ), + ); + + if ($check_config_php) + { + $this->files_to_check[] = array( + 'path' => "config.$php_ext", + 'failable' => false, + 'is_file' => true, + ); + } + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->tests_passed = true; + + // Check files/directories to be writable + foreach ($this->files_to_check as $file) + { + if ($file['is_file']) + { + $this->check_file($file['path'], $file['failable']); + } + else + { + $this->check_dir($file['path'], $file['failable']); + } + } + + return $this->tests_passed; + } + + /** + * Sets $this->tests_passed + * + * @param bool $is_passed + */ + protected function set_test_passed($is_passed) + { + // If one test failed, tests_passed should be false + $this->tests_passed = (!$this->tests_passed) ? false : $is_passed; + } + + /** + * Check if a file is readable and writable + * + * @param string $file Filename + * @param bool $failable Whether failing test should interrupt installation process + */ + protected function check_file($file, $failable = false) + { + $path = $this->phpbb_root_path . $file; + $exists = $writable = true; + + // Try to create file if it does not exists + if (!file_exists($path)) + { + $fp = @fopen($path, 'w'); + @fclose($fp); + try + { + $this->filesystem->phpbb_chmod($path, + \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE + ); + $exists = true; + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + if (file_exists($path)) + { + if (!$this->filesystem->is_writable($path)) + { + $writable = false; + } + } + else + { + $exists = $writable = false; + } + + $this->set_test_passed(($exists && $writable) || $failable); + + if (!($exists && $writable)) + { + $title = ($exists) ? 'FILE_NOT_WRITABLE' : 'FILE_NOT_EXISTS'; + $description = array($title . '_EXPLAIN', $file); + + if ($failable) + { + $this->response->add_warning_message($title, $description); + } + else + { + $this->response->add_error_message($title, $description); + } + } + } + + /** + * Check if a directory is readable and writable + * + * @param string $dir Filename + * @param bool $failable Whether failing test should abort the installation process + */ + protected function check_dir($dir, $failable = false) + { + $path = $this->phpbb_root_path . $dir; + $exists = $writable = false; + + // Try to create the directory if it does not exist + if (!file_exists($path)) + { + try + { + $this->filesystem->mkdir($path, 0777); + $this->filesystem->phpbb_chmod($path, + \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE + ); + $exists = true; + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + // Now really check + if (file_exists($path) && is_dir($path)) + { + try + { + $exists = true; + $this->filesystem->phpbb_chmod($path, + \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE + ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + if ($this->filesystem->is_writable($path)) + { + $writable = true; + } + + $this->set_test_passed(($exists && $writable) || $failable); + + if (!($exists && $writable)) + { + $title = ($exists) ? 'DIRECTORY_NOT_WRITABLE' : 'DIRECTORY_NOT_EXISTS'; + $description = array($title . '_EXPLAIN', $dir); + + if ($failable) + { + $this->response->add_warning_message($title, $description); + } + else + { + $this->response->add_error_message($title, $description); + } + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/requirements/task/check_server_environment.php b/phpBB/phpbb/install/module/requirements/task/check_server_environment.php new file mode 100644 index 0000000000..62485a2097 --- /dev/null +++ b/phpBB/phpbb/install/module/requirements/task/check_server_environment.php @@ -0,0 +1,190 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements\task; + +/** + * Installer task that checks if the server meats phpBB requirements + */ +class check_server_environment extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $response_helper; + + /** + * @var bool + */ + protected $tests_passed; + + /** + * Constructor + * + * @param \phpbb\install\helper\database $database_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $response + */ + public function __construct(\phpbb\install\helper\database $database_helper, + \phpbb\install\helper\iohandler\iohandler_interface $response) + { + $this->database_helper = $database_helper; + $this->response_helper = $response; + $this->tests_passed = true; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // + // Check requirements + // The error messages should be set in the check_ functions + // + + // Check PHP version + $this->check_php_version(); + + // Check for getimagesize() + $this->check_image_size(); + + // Check for PCRE support + $this->check_pcre(); + + // Check for JSON support + $this->check_json(); + + // Check for dbms support + $this->check_available_dbms(); + + return $this->tests_passed; + } + + /** + * Sets $this->tests_passed + * + * @param bool $is_passed + */ + protected function set_test_passed($is_passed) + { + // If one test failed, tests_passed should be false + $this->tests_passed = (!$this->tests_passed) ? false : $is_passed; + } + + /** + * Check if the requirements for PHP version is met + */ + protected function check_php_version() + { + $php_version = PHP_VERSION; + + if (version_compare($php_version, '5.4') < 0) + { + $this->response_helper->add_error_message('PHP_VERSION_REQD', 'PHP_VERSION_REQD_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP has getimagesize() available + */ + protected function check_image_size() + { + if (!@function_exists('getimagesize')) + { + $this->response_helper->add_error_message('PHP_GETIMAGESIZE_SUPPORT', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP supports PCRE + */ + protected function check_pcre() + { + if (@preg_match('//u', '')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PCRE_UTF_SUPPORT', 'PCRE_UTF_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Checks whether PHP's JSON extension is available or not + */ + protected function check_json() + { + if (@extension_loaded('json')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_JSON_SUPPORT', 'PHP_JSON_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Check if any supported DBMS is available + */ + protected function check_available_dbms() + { + $available_dbms = $this->database_helper->get_available_dbms(false, true); + + if ($available_dbms['ANY_DB_SUPPORT']) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_SUPPORTED_DB', 'PHP_SUPPORTED_DB_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/requirements/task/check_update.php b/phpBB/phpbb/install/module/requirements/task/check_update.php new file mode 100644 index 0000000000..c986c76810 --- /dev/null +++ b/phpBB/phpbb/install/module/requirements/task/check_update.php @@ -0,0 +1,185 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements\task; + +use phpbb\filesystem\filesystem; +use phpbb\install\helper\container_factory; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\helper\update_helper; +use phpbb\install\task_base; + +/** + * Check the availability of updater files and update version + */ +class check_update extends task_base +{ + /** + * @var \phpbb\config\db + */ + protected $config; + + /** + * @var filesystem + */ + protected $filesystem; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * @var \phpbb\version_helper + */ + protected $version_helper; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var bool + */ + protected $tests_passed; + + /** + * Constructor + * + * @param container_factory $container + * @param filesystem $filesystem + * @param iohandler_interface $iohandler + * @param update_helper $update_helper + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(container_factory $container, filesystem $filesystem, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext) + { + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->tests_passed = true; + + $this->config = $container->get('config'); + $this->version_helper = $container->get('version_helper'); + + parent::__construct(true); + } + + /** + * Sets $this->tests_passed + * + * @param bool $is_passed + */ + protected function set_test_passed($is_passed) + { + // If one test failed, tests_passed should be false + $this->tests_passed = $this->tests_passed && $is_passed; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Array of update files + $update_files = array( + $this->phpbb_root_path . 'install/update', + $this->phpbb_root_path . 'install/update/index.' . $this->php_ext, + ); + + // Check for a valid update directory + if (!$this->filesystem->exists($update_files) || !$this->filesystem->is_readable($update_files)) + { + $this->iohandler->add_error_message('UPDATE_FILES_NOT_FOUND'); + $this->set_test_passed(false); + + // If there are no update files, we can't check the version + return false; + } + + // Recover version numbers + $update_info = array(); + @include($this->phpbb_root_path . 'install/update/index.' . $this->php_ext); + $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; + $update_version = false; + + if ($info !== false) + { + $update_version = (!empty($info['version']['to'])) ? trim($info['version']['to']) : false; + } + + // Get current and latest version + try + { + $latest_version = $this->version_helper->get_latest_on_current_branch(true); + } + catch (\RuntimeException $e) + { + $latest_version = $update_version; + } + + $current_version = (!empty($this->config['version_update_from'])) ? $this->config['version_update_from'] : $this->config['version']; + + // Check if the update package + if (!$this->update_helper->phpbb_version_compare($current_version, $update_version, '<')) + { + $this->iohandler->add_error_message('NO_UPDATE_FILES_UP_TO_DATE'); + $this->tests_passed = false; + } + + // Check if the update package works with the installed version + if (empty($info['version']['from']) || $info['version']['from'] !== $current_version) + { + $this->iohandler->add_error_message(array('INCOMPATIBLE_UPDATE_FILES', $current_version, $info['version']['from'], $update_version)); + $this->tests_passed = false; + } + + // check if this is the latest update package + if ($this->update_helper->phpbb_version_compare($update_version, $latest_version, '<')) + { + $this->iohandler->add_warning_message(array('OLD_UPDATE_FILES', $info['version']['from'], $update_version, $latest_version)); + } + + return $this->tests_passed; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/requirements/update_module.php b/phpBB/phpbb/install/module/requirements/update_module.php new file mode 100644 index 0000000000..223d12faf3 --- /dev/null +++ b/phpBB/phpbb/install/module/requirements/update_module.php @@ -0,0 +1,25 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements; + +class update_module extends abstract_requirements_module +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('update', 0, 'requirements'); + } +} diff --git a/phpBB/phpbb/install/module/update_database/module.php b/phpBB/phpbb/install/module/update_database/module.php new file mode 100644 index 0000000000..ee38afe17d --- /dev/null +++ b/phpBB/phpbb/install/module/update_database/module.php @@ -0,0 +1,33 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_database; + +class module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('update', 0, 'update_database'); + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + return 0; + } +} diff --git a/phpBB/phpbb/install/module/update_database/task/update.php b/phpBB/phpbb/install/module/update_database/task/update.php new file mode 100644 index 0000000000..84ec6f73f5 --- /dev/null +++ b/phpBB/phpbb/install/module/update_database/task/update.php @@ -0,0 +1,212 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_database\task; + +use phpbb\db\migration\exception; +use phpbb\db\output_handler\installer_migrator_output_handler; +use phpbb\db\output_handler\log_wrapper_migrator_output_handler; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\task_base; + +/** + * Database updater task + */ +class update extends task_base +{ + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var \phpbb\extension\manager + */ + protected $extension_manager; + + /** + * @var \phpbb\filesystem\filesystem + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\config + */ + protected $installer_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\log\log + */ + protected $log; + + /** + * @var \phpbb\db\migrator + */ + protected $migrator; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param \phpbb\install\helper\container_factory $container + * @param \phpbb\filesystem\filesystem $filesystem + * @param \phpbb\install\helper\config $installer_config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param \phpbb\language\language $language + * @param string $phpbb_root_path + */ + public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\filesystem\filesystem $filesystem, \phpbb\install\helper\config $installer_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, \phpbb\language\language $language, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->installer_config = $installer_config; + $this->iohandler = $iohandler; + $this->language = $language; + $this->phpbb_root_path = $phpbb_root_path; + + $this->cache = $container->get('cache.driver'); + $this->config = $container->get('config'); + $this->extension_manager = $container->get('ext.manager'); + $this->log = $container->get('log'); + $this->migrator = $container->get('migrator'); + $this->user = $container->get('user'); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->language->add_lang('migrator'); + + if (!isset($this->config['version_update_from'])) + { + $this->config->set('version_update_from', $this->config['version']); + } + + $original_version = $this->config['version_update_from']; + + $this->migrator->set_output_handler( + new log_wrapper_migrator_output_handler( + $this->language, + new installer_migrator_output_handler($this->iohandler), + $this->phpbb_root_path . 'store/migrations_' . time() . '.log', + $this->filesystem + ) + ); + + $this->migrator->create_migrations_table(); + + $migrations = $this->extension_manager + ->get_finder() + ->core_path('phpbb/db/migration/data/') + ->extension_directory('/migrations') + ->get_classes(); + + $this->migrator->set_migrations($migrations); + $migration_count = count($migrations); + $this->iohandler->set_task_count($migration_count, true); + $progress_count = $this->installer_config->get('database_update_count', 0); + + while (!$this->migrator->finished()) + { + try + { + $this->migrator->update(); + $progress_count++; + $this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count); + } + catch (exception $e) + { + $msg = $e->getParameters(); + array_unshift($msg, $e->getMessage()); + + $this->iohandler->add_error_message($msg); + throw new user_interaction_required_exception(); + } + + if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) + { + $this->installer_config->set('database_update_count', $progress_count); + throw new resource_limit_reached_exception(); + } + } + + if ($original_version !== $this->config['version']) + { + $this->log->add( + 'admin', + (isset($this->user->data['user_id'])) ? $this->user->data['user_id'] : ANONYMOUS, + $this->user->ip, + 'LOG_UPDATE_DATABASE', + false, + array( + $original_version, + $this->config['version'] + ) + ); + } + + $this->iohandler->finish_progress('INLINE_UPDATE_SUCCESSFUL'); + + $this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL'); + + $this->config->delete('version_update_from'); + + $this->cache->purge(); + + $this->config->increment('assets_version', 1); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/update_filesystem/module.php b/phpBB/phpbb/install/module/update_filesystem/module.php new file mode 100644 index 0000000000..157c78a1ac --- /dev/null +++ b/phpBB/phpbb/install/module/update_filesystem/module.php @@ -0,0 +1,33 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_filesystem; + +class module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('update', 0, 'update_files'); + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + return 0; + } +} diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php new file mode 100644 index 0000000000..e3e6db6263 --- /dev/null +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -0,0 +1,205 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_filesystem\task; + +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\container_factory; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\helper\update_helper; +use phpbb\install\task_base; + +/** + * Merges user made changes into the files + */ +class diff_files extends task_base +{ + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var config + */ + protected $installer_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * Constructor + * + * @param container_factory $container + * @param config $config + * @param iohandler_interface $iohandler + * @param update_helper $update_helper + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext) + { + $this->installer_config = $config; + $this->iohandler = $iohandler; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->cache = $container->get('cache.driver'); + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + $files_to_diff = $this->installer_config->get('update_files', array()); + $files_to_diff = (isset($files_to_diff['update_with_diff'])) ? $files_to_diff['update_with_diff'] : array(); + + return $this->installer_config->get('do_update_files', false) && count($files_to_diff) > 0; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Include diff engine + $this->update_helper->include_file('includes/diff/diff.' . $this->php_ext); + $this->update_helper->include_file('includes/diff/engine.' . $this->php_ext); + + // Set up basic vars + $old_path = $this->update_helper->get_path_to_old_update_files(); + $new_path = $this->update_helper->get_path_to_new_update_files(); + + $files_to_diff = $this->installer_config->get('update_files', array()); + $files_to_diff = $files_to_diff['update_with_diff']; + + // Set progress bar + $this->iohandler->set_task_count(count($files_to_diff), true); + $this->iohandler->set_progress('UPDATE_FILE_DIFF', 0); + $progress_count = $this->installer_config->get('file_diff_update_count', 0); + + // Recover progress + $progress_key = $this->installer_config->get('differ_progress_key', -1); + $progress_recovered = ($progress_key === -1); + $merge_conflicts = $this->installer_config->get('merge_conflict_list', array()); + + foreach ($files_to_diff as $key => $filename) + { + if ($progress_recovered === false) + { + if ($progress_key === $key) + { + $progress_recovered = true; + } + + continue; + } + + // Read in files' content + $file_contents = array(); + + // Handle the special case when user created a file with the filename that is now new in the core + $file_contents[0] = (file_exists($old_path . $filename)) ? file_get_contents($old_path . $filename) : ''; + + $filenames = array( + $this->phpbb_root_path . $filename, + $new_path . $filename + ); + + foreach ($filenames as $file_to_diff) + { + $file_contents[] = file_get_contents($file_to_diff); + + if ($file_contents[sizeof($file_contents) - 1] === false) + { + $this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff)); + unset($file_contents); + throw new user_interaction_required_exception(); + } + } + + $diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]); + unset($file_contents); + + // Handle conflicts + if ($diff->get_num_conflicts() !== 0) + { + $merge_conflicts[] = $filename; + } + + // Save merged output + $this->cache->put( + '_file_' . md5($filename), + base64_encode(implode("\n", $diff->merged_output())) + ); + + unset($diff); + + $progress_count++; + $this->iohandler->set_progress('UPDATE_FILE_DIFF', $progress_count); + + if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) + { + // Save differ progress + $this->installer_config->set('differ_progress_key', $key); + $this->installer_config->set('merge_conflict_list', $merge_conflicts); + $this->installer_config->set('file_diff_update_count', $progress_count); + + // Request refresh + throw new resource_limit_reached_exception(); + } + } + + $this->iohandler->finish_progress('ALL_FILES_DIFFED'); + $this->installer_config->set('merge_conflict_list', $merge_conflicts); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php new file mode 100644 index 0000000000..9271e8fd50 --- /dev/null +++ b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php @@ -0,0 +1,124 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_filesystem\task; + +use phpbb\filesystem\filesystem; +use phpbb\install\exception\jump_to_restart_point_exception; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\task_base; + +class download_updated_files extends task_base +{ + /** + * @var config + */ + protected $installer_config; + + /** + * @var filesystem + */ + protected $filesystem; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * Constructor + * + * @param config $config + * @param iohandler_interface $iohandler + * @param filesystem $filesystem + */ + public function __construct(config $config, iohandler_interface $iohandler, filesystem $filesystem) + { + $this->installer_config = $config; + $this->iohandler = $iohandler; + $this->filesystem = $filesystem; + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + return $this->installer_config->get('do_update_files', false) + && $this->installer_config->get('file_update_method', '') === 'compression'; + } + + /** + * {@inheritdoc} + */ + public function run() + { + if ($this->iohandler->get_input('database_update_submit', false)) + { + // Remove archive + $this->filesystem->remove( + $this->installer_config->get('update_file_archive', null) + ); + + $this->installer_config->set('update_file_archive', null); + } + else if ($this->iohandler->get_input('update_recheck_files_submit', false)) + { + throw new jump_to_restart_point_exception('check_update_files'); + } + else + { + // Render download box + $this->iohandler->add_download_link( + 'phpbb_installer_update_file_download', + 'DOWNLOAD_UPDATE_METHOD', + 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' + ); + + // Add form to continue update + $this->iohandler->add_user_form_group('UPDATE_CONTINUE_UPDATE_PROCESS', array( + 'update_recheck_files_submit' => array( + 'label' => 'UPDATE_RECHECK_UPDATE_FILES', + 'type' => 'submit', + ), + 'database_update_submit' => array( + 'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS', + 'type' => 'submit', + ), + )); + + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/update_filesystem/task/file_check.php b/phpBB/phpbb/install/module/update_filesystem/task/file_check.php new file mode 100644 index 0000000000..5dbee6c259 --- /dev/null +++ b/phpBB/phpbb/install/module/update_filesystem/task/file_check.php @@ -0,0 +1,186 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_filesystem\task; + +use phpbb\filesystem\filesystem; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\helper\update_helper; +use phpbb\install\task_base; + +/** + * Updater task performing file checking + */ +class file_check extends task_base +{ + /** + * @var filesystem + */ + protected $filesystem; + + /** + * @var config + */ + protected $installer_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Construct + * + * @param filesystem $filesystem + * @param config $config + * @param iohandler_interface $iohandler + * @param update_helper $update_helper + * @param string $phpbb_root_path + */ + public function __construct(filesystem $filesystem, config $config, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->installer_config = $config; + $this->iohandler = $iohandler; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + return $this->installer_config->get('do_update_files', false); + } + + /** + * {@inheritdoc} + */ + public function run() + { + if (!$this->installer_config->has_restart_point('check_update_files')) + { + $this->installer_config->create_progress_restart_point('check_update_files'); + } + + $old_path = $this->update_helper->get_path_to_old_update_files(); + $new_path = $this->update_helper->get_path_to_new_update_files(); + + $update_info = $this->installer_config->get('update_info', array()); + $file_update_info = $this->installer_config->get('update_files', array()); + + if (empty($update_info)) + { + $root_path = $this->phpbb_root_path; + + $update_info = $this->installer_config->get('update_info_unprocessed', array()); + + $file_update_info = array(); + $file_update_info['update_without_diff'] = array_diff($update_info['binary'], $update_info['deleted']); + + // Filter out files that are already deleted + $file_update_info['delete'] = array_filter( + $update_info['deleted'], + function ($filename) use ($root_path) + { + return file_exists($root_path . $filename); + } + ); + } + + $progress_count = $this->installer_config->get('file_check_progress_count', 0); + $task_count = count($update_info['files']); + $this->iohandler->set_task_count($task_count); + $this->iohandler->set_progress('UPDATE_CHECK_FILES', 0); + + foreach ($update_info['files'] as $key => $filename) + { + $old_file = $old_path . $filename; + $new_file = $new_path . $filename; + $file = $this->phpbb_root_path . $filename; + + if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) + { + // Save progress + $this->installer_config->set('update_info', $update_info); + $this->installer_config->set('file_check_progress_count', $progress_count); + $this->installer_config->set('update_files', $file_update_info); + + // Request refresh + throw new resource_limit_reached_exception(); + } + + $progress_count++; + $this->iohandler->set_progress('UPDATE_CHECK_FILES', $progress_count); + + if (!$this->filesystem->exists($file)) + { + $file_update_info['new'][] = $filename; + } + else + { + $file_checksum = md5_file($file); + + if ($file_checksum === md5_file($new_file)) + { + // File already up to date + continue; + } + else if ($this->filesystem->exists($old_file) && $file_checksum === md5_file($old_file)) + { + // No need to diff the file + $file_update_info['update_without_diff'][] = $filename; + } + else + { + $file_update_info['update_with_diff'][] = $filename; + } + } + + unset($update_info['files'][$key]); + } + + $this->installer_config->set('update_files', $file_update_info); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php b/phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php new file mode 100644 index 0000000000..e712b8ad6a --- /dev/null +++ b/phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php @@ -0,0 +1,168 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_filesystem\task; + +use phpbb\filesystem\filesystem; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\container_factory; +use phpbb\install\helper\file_updater\factory; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\task_base; + +class show_file_status extends task_base +{ + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var filesystem + */ + protected $filesystem; + + /** + * @var config + */ + protected $installer_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\install\helper\file_updater\compression_file_updater + */ + protected $file_updater; + + /** + * Constructor + * + * @param container_factory $container + * @param config $config + * @param iohandler_interface $iohandler + * @param filesystem $filesystem + * @param factory $file_updater_factory + */ + public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, filesystem $filesystem, factory $file_updater_factory) + { + $this->installer_config = $config; + $this->iohandler = $iohandler; + $this->filesystem = $filesystem; + + $this->cache = $container->get('cache.driver'); + + // Initialize compression file updater + $compression_method = $this->installer_config->get('compression_method', ''); + $this->file_updater = $file_updater_factory->get('compression'); + $conflict_archive = $this->file_updater->init($compression_method); + + $this->installer_config->set('update_file_conflict_archive', $conflict_archive); + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + return $this->installer_config->get('do_update_files', false); + } + + /** + * {@inheritdoc} + */ + public function run() + { + if (!$this->iohandler->get_input('submit_continue_file_update', false)) + { + // Handle merge conflicts + $merge_conflicts = $this->installer_config->get('merge_conflict_list', array()); + + // Create archive for merge conflicts + if (!empty($merge_conflicts)) + { + foreach ($merge_conflicts as $filename) + { + $this->file_updater->create_new_file( + $filename, + base64_decode($this->cache->get('_file_' . md5($filename))), + true + ); + } + + // Render download box + $this->iohandler->add_download_link( + 'phpbb_installer_update_conflict_download', + 'DOWNLOAD_CONFLICTS', + 'DOWNLOAD_CONFLICTS_EXPLAIN' + ); + } + + $this->file_updater->close(); + + // Render update file statuses + $file_update_info = $this->installer_config->get('update_files', array()); + $file_status = array( + 'deleted' => (!isset($file_update_info['delete'])) ? array() : $file_update_info['delete'], + 'new' => (!isset($file_update_info['new'])) ? array() : $file_update_info['new'], + 'conflict' => $this->installer_config->get('merge_conflict_list', array()), + 'modified' => (!isset($file_update_info['update_with_diff'])) ? array() : $file_update_info['update_with_diff'], + 'not_modified' => (!isset($file_update_info['update_without_diff'])) ? array() : $file_update_info['update_without_diff'], + ); + + $this->iohandler->render_update_file_status($file_status); + + // Add form to continue update + $this->iohandler->add_user_form_group('UPDATE_CONTINUE_FILE_UPDATE', array( + 'submit_continue_file_update' => array( + 'label' => 'UPDATE_CONTINUE_FILE_UPDATE', + 'type' => 'submit', + ), + )); + + // Show results to the user + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + else + { + // Remove archive + $this->filesystem->remove( + $this->installer_config->get('update_file_conflict_archive', null) + ); + + $this->installer_config->set('update_file_conflict_archive', null); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module/update_filesystem/task/update_files.php b/phpBB/phpbb/install/module/update_filesystem/task/update_files.php new file mode 100644 index 0000000000..fbb465cc66 --- /dev/null +++ b/phpBB/phpbb/install/module/update_filesystem/task/update_files.php @@ -0,0 +1,294 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\update_filesystem\task; + +use phpbb\exception\runtime_exception; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\container_factory; +use phpbb\install\helper\file_updater\factory; +use phpbb\install\helper\file_updater\file_updater_interface; +use phpbb\install\helper\iohandler\iohandler_interface; +use phpbb\install\helper\update_helper; +use phpbb\install\task_base; + +/** + * File updater task + */ +class update_files extends task_base +{ + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var config + */ + protected $installer_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var factory + */ + protected $factory; + + /** + * @var file_updater_interface + */ + protected $file_updater; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param container_factory $container + * @param config $config + * @param iohandler_interface $iohandler + * @param factory $file_updater_factory + * @param update_helper $update_helper + * @param string $phpbb_root_path + */ + public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, factory $file_updater_factory, update_helper $update_helper, $phpbb_root_path) + { + $this->factory = $file_updater_factory; + $this->installer_config = $config; + $this->iohandler = $iohandler; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + + $this->cache = $container->get('cache.driver'); + $this->file_updater = null; + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + return $this->installer_config->get('do_update_files', false); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $new_path = $this->update_helper->get_path_to_new_update_files(); + + $file_update_info = $this->installer_config->get('update_files', array()); + + $update_type_progress = $this->installer_config->get('file_updater_type_progress', ''); + $update_elem_progress = $this->installer_config->get('file_updater_elem_progress', ''); + $type_progress_found = false; + $elem_progress_found = false; + + // Progress bar + $task_count = 0; + foreach ($file_update_info as $sub_array) + { + $task_count += count($sub_array); + } + + // Everything is up to date, so just continue + if ($task_count === 0) + { + return; + } + + $progress_count = $this->installer_config->get('file_update_progress_count', 0); + $this->iohandler->set_task_count($task_count, true); + $this->iohandler->set_progress('UPDATE_UPDATING_FILES', 0); + + $this->file_updater = $this->get_file_updater(); + + // File updater fallback logic + try + { + // Update files + foreach ($file_update_info as $type => $file_update_vector) + { + if (!$type_progress_found) + { + if ($type === $update_type_progress || empty($update_elem_progress)) + { + $type_progress_found = true; + } + else + { + continue; + } + } + + foreach ($file_update_vector as $path) + { + if (!$elem_progress_found) + { + if ($path === $update_elem_progress || empty($update_elem_progress)) + { + $elem_progress_found = true; + } + else + { + continue; + } + } + + switch ($type) + { + case 'delete': + $this->file_updater->delete_file($path); + break; + case 'new': + $this->file_updater->create_new_file($path, $new_path . $path); + break; + case 'update_without_diff': + $this->file_updater->update_file($path, $new_path . $path); + break; + case 'update_with_diff': + $this->file_updater->update_file( + $path, + base64_decode($this->cache->get('_file_' . md5($path))), + true + ); + break; + } + + // Save progress + $this->installer_config->set('file_updater_type_progress', $type); + $this->installer_config->set('file_updater_elem_progress', $path); + $progress_count++; + $this->iohandler->set_progress('UPDATE_UPDATING_FILES', $progress_count); + + if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) + { + // Request refresh + throw new resource_limit_reached_exception(); + } + } + } + + $this->iohandler->finish_progress('UPDATE_UPDATING_FILES'); + } + catch (runtime_exception $e) + { + if ($e instanceof resource_limit_reached_exception) + { + throw new resource_limit_reached_exception(); + } + + $current_method = $this->installer_config->get('file_update_method', ''); + + // File updater failed, try to fallback to download file update mode + if ($current_method !== 'compression') + { + $this->iohandler->add_warning_message(array( + 'UPDATE_FILE_UPDATER_HAS_FAILED', + $current_method, + 'compression' + )); + $this->installer_config->set('file_update_method', 'compression'); + + // We only want a simple refresh here + throw new resource_limit_reached_exception(); + } + else + { + // Nowhere to fallback to :( + // Due to the way the installer handles fatal errors, we need to throw a low level exception + throw new runtime_exception('UPDATE_FILE_UPDATERS_HAVE_FAILED'); + } + } + + $file_updater_method = $this->installer_config->get('file_update_method', ''); + if ($file_updater_method === 'compression' || $file_updater_method === 'ftp') + { + $this->file_updater->close(); + } + } + + /** + * Get file updater + * + * @param null|string $file_updater_method Name of the file updater to use + * + * @return file_updater_interface File updater + */ + protected function get_file_updater($file_updater_method = null) + { + $file_updater_method = ($file_updater_method === null) ? $this->installer_config->get('file_update_method', '') : $file_updater_method; + + if ($file_updater_method === 'compression') + { + $compression_method = $this->installer_config->get('file_update_compression', ''); + + /** @var \phpbb\install\helper\file_updater\compression_file_updater $file_updater */ + $file_updater = $this->factory->get('compression'); + $archive_path = $file_updater->init($compression_method); + $this->installer_config->set('update_file_archive', $archive_path); + } + else if ($file_updater_method === 'ftp') + { + /** @var \phpbb\install\helper\file_updater\ftp_file_updater $file_updater */ + $file_updater = $this->factory->get('ftp'); + $file_updater->init( + $this->installer_config->get('ftp_method', ''), + $this->installer_config->get('ftp_host', ''), + $this->installer_config->get('ftp_user', ''), + $this->installer_config->get('ftp_pass', ''), + $this->installer_config->get('ftp_path', ''), + $this->installer_config->get('ftp_port', 0), + $this->installer_config->get('ftp_timeout', 10) + ); + } + else + { + /** @var file_updater_interface $file_updater */ + $file_updater = $this->factory->get('direct_file'); + } + + return $file_updater; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php new file mode 100644 index 0000000000..fb68c3aca2 --- /dev/null +++ b/phpBB/phpbb/install/module_base.php @@ -0,0 +1,218 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +use phpbb\di\ordered_service_collection; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; + +/** + * Base class for installer module + */ +abstract class module_base implements module_interface +{ + /** + * @var config + */ + protected $install_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var bool + */ + protected $is_essential; + + /** + * Array of tasks for installer module + * + * @var ordered_service_collection + */ + protected $task_collection; + + /** + * @var array + */ + protected $task_step_count; + + /** + * @var bool + */ + protected $allow_progress_bar; + + /** + * Installer module constructor + * + * @param ordered_service_collection $tasks array of installer tasks for installer module + * @param bool $essential flag indicating whether the module is essential or not + * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module + */ + public function __construct(ordered_service_collection $tasks, $essential = true, $allow_progress_bar = true) + { + $this->task_collection = $tasks; + $this->is_essential = $essential; + $this->allow_progress_bar = $allow_progress_bar; + } + + /** + * Dependency getter + * + * @param config $config + * @param iohandler_interface $iohandler + */ + public function setup(config $config, iohandler_interface $iohandler) + { + $this->install_config = $config; + $this->iohandler = $iohandler; + } + + /** + * {@inheritdoc} + */ + public function is_essential() + { + return $this->is_essential; + } + + /** + * {@inheritdoc} + * + * Overwrite this method if your task is non-essential! + */ + public function check_requirements() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Recover install progress + $task_name = $this->recover_progress(); + $task_found = false; + + /** + * @var string $name ID of the service + * @var \phpbb\install\task_interface $task Task object + */ + foreach ($this->task_collection as $name => $task) + { + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + { + throw new resource_limit_reached_exception(); + } + + // Skip forward until the next task is reached + if (!$task_found) + { + if ($name === $task_name || empty($task_name)) + { + $task_found = true; + + if ($name === $task_name) + { + continue; + } + } + else + { + continue; + } + } + + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + $this->iohandler->add_log_message(array( + 'SKIP_TASK', + $name, + )); + + $this->install_config->increment_current_task_progress($this->task_step_count[$name]); + continue; + } + + if ($this->allow_progress_bar) + { + // Only increment progress by one, as if a task has more than one steps + // then that should be incremented in the task itself + $this->install_config->increment_current_task_progress(); + } + + $task->run(); + + // Log install progress + $this->install_config->set_finished_task($name); + + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } + + $this->iohandler->send_response(); + } + + // Module finished, so clear task progress + $this->install_config->set_finished_task(''); + } + + /** + * Returns the next task's name + * + * @return string Index of the array element of the next task + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + return $progress_array['last_task_name']; + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + $task_step_count = 0; + $task_class_names = $this->task_collection->get_service_classes(); + + foreach ($task_class_names as $name => $task_class) + { + $step_count = $task_class::get_step_count(); + $task_step_count += $step_count; + $this->task_step_count[$name] = $step_count; + } + + return $task_step_count; + } +} diff --git a/phpBB/phpbb/install/module_interface.php b/phpBB/phpbb/install/module_interface.php new file mode 100644 index 0000000000..a2d61e3958 --- /dev/null +++ b/phpBB/phpbb/install/module_interface.php @@ -0,0 +1,63 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +/** + * Interface for installer modules + * + * An installer module is a task collection which executes installer tasks. + */ +interface module_interface +{ + /** + * Checks if the execution of the module is essential to install phpBB or it can be skipped + * + * Note: Please note that all the non-essential modules have to implement check_requirements() + * method. + * + * @return bool true if the module is essential, false otherwise + */ + public function is_essential(); + + /** + * Checks requirements for the tasks + * + * Note: Only need to be implemented for non-essential tasks, as essential tasks + * requirements should be checked in the requirements install module. + * + * @return bool true if the task's requirements are met + */ + public function check_requirements(); + + /** + * Executes the task + * + * @return null + */ + public function run(); + + /** + * Returns the number of tasks in the module + * + * @return int + */ + public function get_step_count(); + + /** + * Returns an array to the correct navigation stage + * + * @return array + */ + public function get_navigation_stage_path(); +} diff --git a/phpBB/phpbb/install/task_base.php b/phpBB/phpbb/install/task_base.php new file mode 100644 index 0000000000..b5199be4af --- /dev/null +++ b/phpBB/phpbb/install/task_base.php @@ -0,0 +1,53 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +/** + * Base class for installer task + */ +abstract class task_base implements task_interface +{ + /** + * @var bool + */ + protected $is_essential; + + /** + * Constructor + * + * @param bool $essential + */ + public function __construct($essential = true) + { + $this->is_essential = $essential; + } + + /** + * {@inheritdoc} + */ + public function is_essential() + { + return $this->is_essential; + } + + /** + * {@inheritdoc} + * + * Note: Overwrite this method if your task is non-essential! + */ + public function check_requirements() + { + return true; + } +} diff --git a/phpBB/phpbb/install/task_interface.php b/phpBB/phpbb/install/task_interface.php new file mode 100644 index 0000000000..794cb16482 --- /dev/null +++ b/phpBB/phpbb/install/task_interface.php @@ -0,0 +1,61 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +/** + * Interface for installer tasks + */ +interface task_interface +{ + /** + * Returns the number of steps the task contains + * + * This is a helper method to provide a better progress bar for the front-end. + * + * @return int The number of steps that the task contains + */ + static public function get_step_count(); + + /** + * Checks if the task is essential to install phpBB or it can be skipped + * + * Note: Please note that all the non-essential modules have to implement check_requirements() + * method. + * + * @return bool true if the task is essential, false otherwise + */ + public function is_essential(); + + /** + * Checks requirements for the tasks + * + * Note: Only need to be implemented for non-essential tasks, as essential tasks + * requirements should be checked in the requirements install module. + * + * @return bool true if the task's requirements are met + */ + public function check_requirements(); + + /** + * Executes the task + */ + public function run(); + + /** + * Returns the language key of the name of the task + * + * @return string + */ + public function get_task_lang_name(); +} diff --git a/phpBB/phpbb/json_response.php b/phpBB/phpbb/json_response.php index 45c2f6cac4..5219cd0c32 100644 --- a/phpBB/phpbb/json_response.php +++ b/phpBB/phpbb/json_response.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb; /** * JSON class -* @package phpBB3 */ class json_response { diff --git a/phpBB/phpbb/language/exception/invalid_plural_rule_exception.php b/phpBB/phpbb/language/exception/invalid_plural_rule_exception.php new file mode 100644 index 0000000000..94e3466208 --- /dev/null +++ b/phpBB/phpbb/language/exception/invalid_plural_rule_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language\exception; + +/** + * Thrown when nonexistent plural rule is specified + */ +class invalid_plural_rule_exception extends language_exception +{ + +} diff --git a/phpBB/phpbb/language/exception/language_exception.php b/phpBB/phpbb/language/exception/language_exception.php new file mode 100644 index 0000000000..b1258414aa --- /dev/null +++ b/phpBB/phpbb/language/exception/language_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language\exception; + +/** + * Base exception class for language exceptions + */ +class language_exception extends \phpbb\exception\runtime_exception +{ + +} diff --git a/phpBB/phpbb/language/exception/language_file_not_found.php b/phpBB/phpbb/language/exception/language_file_not_found.php new file mode 100644 index 0000000000..89364267eb --- /dev/null +++ b/phpBB/phpbb/language/exception/language_file_not_found.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language\exception; + +/** + * This exception is thrown when the language file is not found + */ +class language_file_not_found extends language_exception +{ + +} diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php new file mode 100644 index 0000000000..382d4db89e --- /dev/null +++ b/phpBB/phpbb/language/language.php @@ -0,0 +1,653 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language; + +use phpbb\language\exception\invalid_plural_rule_exception; + +/** + * Wrapper class for loading translations + */ +class language +{ + /** + * Global fallback language + * + * ISO code of the language to fallback to when the specified language entries + * cannot be found. + * + * @var string + */ + const FALLBACK_LANGUAGE = 'en'; + + /** + * @var array List of common language files + */ + protected $common_language_files; + + /** + * @var bool + */ + protected $common_language_files_loaded; + + /** + * @var string ISO code of the default board language + */ + protected $default_language; + + /** + * @var string ISO code of the User's language + */ + protected $user_language; + + /** + * @var array Language fallback array (the order is important) + */ + protected $language_fallback; + + /** + * @var array Array of language variables + */ + protected $lang; + + /** + * @var array Loaded language sets + */ + protected $loaded_language_sets; + + /** + * @var \phpbb\language\language_file_loader Language file loader + */ + protected $loader; + + /** + * Constructor + * + * @param \phpbb\language\language_file_loader $loader Language file loader + * @param array|null $common_modules Array of common language modules to load (optional) + */ + public function __construct(language_file_loader $loader, $common_modules = null) + { + $this->loader = $loader; + + // Set up default information + $this->user_language = false; + $this->default_language = false; + $this->lang = array(); + $this->loaded_language_sets = array( + 'core' => array(), + 'ext' => array(), + ); + + // Common language files + if (is_array($common_modules)) + { + $this->common_language_files = $common_modules; + } + else + { + $this->common_language_files = array( + 'common', + ); + } + + $this->common_language_files_loaded = false; + + $this->language_fallback = array(self::FALLBACK_LANGUAGE); + } + + /** + * Function to set user's language to display. + * + * @param string $user_lang_iso ISO code of the User's language + * @param bool $reload Whether or not to reload language files + */ + public function set_user_language($user_lang_iso, $reload = false) + { + $this->user_language = $user_lang_iso; + + $this->set_fallback_array($reload); + } + + /** + * Function to set the board's default language to display. + * + * @param string $default_lang_iso ISO code of the board's default language + * @param bool $reload Whether or not to reload language files + */ + public function set_default_language($default_lang_iso, $reload = false) + { + $this->default_language = $default_lang_iso; + + $this->set_fallback_array($reload); + } + + /** + * Returns language array + * + * Note: This function is needed for the BC purposes, until \phpbb\user::lang[] is + * not removed. + * + * @return array Array of loaded language strings + */ + public function get_lang_array() + { + // Load common language files if they not loaded yet + if (!$this->common_language_files_loaded) + { + $this->load_common_language_files(); + } + + return $this->lang; + } + + /** + * Add Language Items + * + * Examples: + * <code> + * $component = array('posting'); + * $component = array('posting', 'viewtopic') + * $component = 'posting' + * </code> + * + * @param string|array $component The name of the language component to load + * @param string|null $extension_name Name of the extension to load component from, or null for core file + */ + public function add_lang($component, $extension_name = null) + { + // Load common language files if they not loaded yet + // This needs to be here to correctly merge language arrays + if (!$this->common_language_files_loaded) + { + $this->load_common_language_files(); + } + + if (!is_array($component)) + { + if (!is_null($extension_name)) + { + $this->load_extension($extension_name, $component); + } + else + { + $this->load_core_file($component); + } + } + else + { + foreach ($component as $lang_file) + { + $this->add_lang($lang_file, $extension_name); + } + } + } + + /** + * @param $key array|string The language key we want to know more about. Can be string or array. + * + * @return bool Returns whether the language key is set. + */ + public function is_set($key) + { + // Load common language files if they not loaded yet + if (!$this->common_language_files_loaded) + { + $this->load_common_language_files(); + } + + if (is_array($key)) + { + $lang = &$this->lang[array_shift($key)]; + + foreach ($key as $_key) + { + $lang = &$lang[$_key]; + } + } + else + { + $lang = &$this->lang[$key]; + } + + return isset($lang); + } + + /** + * 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. + * + * @return string Return localized string or the language key if the translation is not available + */ + public function lang() + { + $args = func_get_args(); + $key = array_shift($args); + + return $this->lang_array($key, $args); + } + + /** + * Act like lang() but takes a key and an array of parameters instead of using variadic + * + * @param string|array $key Language key + * @param array $args Parameters + * + * @return array|string + */ + public function lang_array($key, $args = array()) + { + // Load common language files if they not loaded yet + if (!$this->common_language_files_loaded) + { + $this->load_common_language_files(); + } + + 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 (count($args) === 0) + { + return $lang; + } + + // Replace key with language entry and simply pass along... + return vsprintf($lang, $args); + } + else if (sizeof($lang) == 0) + { + // If the language entry is an empty array, we just return the language key + return $key; + } + + // 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 = 0, $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() + return vsprintf($lang[$key_found], $args); + } + + /** + * Loads common language files + */ + protected function load_common_language_files() + { + if (!$this->common_language_files_loaded) + { + foreach ($this->common_language_files as $lang_file) + { + $this->load_core_file($lang_file); + } + + $this->common_language_files_loaded = true; + } + } + + /** + * Determine which plural form we should use. + * + * For some languages this is not as simple as for English. + * + * @param int|float $number The number we want to get the plural case for. Float numbers are floored. + * @param int|bool $force_rule 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 + * + * @throws \phpbb\language\exception\invalid_plural_rule_exception When $force_rule has an invalid value + */ + public function get_plural_form($number, $force_rule = false) + { + $number = (int) $number; + $plural_rule = ($force_rule !== false) ? $force_rule : ((isset($this->lang['PLURAL_RULE'])) ? $this->lang['PLURAL_RULE'] : 1); + + if ($plural_rule > 15 || $plural_rule < 0) + { + throw new invalid_plural_rule_exception('INVALID_PLURAL_RULE', array( + 'plural_rule' => $plural_rule, + )); + } + + /** + * The following plural rules are based on a list published by the Mozilla Developer Network + * https://developer.mozilla.org/en/Localization_and_Plurals + */ + switch ($plural_rule) + { + case 0: + /** + * Families: Asian (Chinese, Japanese, Korean, Vietnamese), Persian, Turkic/Altaic (Turkish), Thai, Lao + * 1 - everything: 0, 1, 2, ... + */ + return 1; + + case 1: + /** + * Families: Germanic (Danish, Dutch, English, Faroese, Frisian, German, Norwegian, Swedish), Finno-Ugric (Estonian, Finnish, Hungarian), Language isolate (Basque), Latin/Greek (Greek), Semitic (Hebrew), Romanic (Italian, Portuguese, Spanish, Catalan) + * 1 - 1 + * 2 - everything else: 0, 2, 3, ... + */ + return ($number === 1) ? 1 : 2; + + case 2: + /** + * Families: Romanic (French, Brazilian Portuguese) + * 1 - 0, 1 + * 2 - everything else: 2, 3, ... + */ + return (($number === 0) || ($number === 1)) ? 1 : 2; + + case 3: + /** + * Families: Baltic (Latvian) + * 1 - 0 + * 2 - ends in 1, not 11: 1, 21, ... 101, 121, ... + * 3 - everything else: 2, 3, ... 10, 11, 12, ... 20, 22, ... + */ + return ($number === 0) ? 1 : ((($number % 10 === 1) && ($number % 100 != 11)) ? 2 : 3); + + case 4: + /** + * Families: Celtic (Scottish Gaelic) + * 1 - is 1 or 11: 1, 11 + * 2 - is 2 or 12: 2, 12 + * 3 - others between 3 and 19: 3, 4, ... 10, 13, ... 18, 19 + * 4 - everything else: 0, 20, 21, ... + */ + return ($number === 1 || $number === 11) ? 1 : (($number === 2 || $number === 12) ? 2 : (($number >= 3 && $number <= 19) ? 3 : 4)); + + case 5: + /** + * Families: Romanic (Romanian) + * 1 - 1 + * 2 - is 0 or ends in 01-19: 0, 2, 3, ... 19, 101, 102, ... 119, 201, ... + * 3 - everything else: 20, 21, ... + */ + return ($number === 1) ? 1 : ((($number === 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 2 : 3); + + case 6: + /** + * Families: Baltic (Lithuanian) + * 1 - ends in 1, not 11: 1, 21, 31, ... 101, 121, ... + * 2 - ends in 0 or ends in 10-20: 0, 10, 11, 12, ... 19, 20, 30, 40, ... + * 3 - everything else: 2, 3, ... 8, 9, 22, 23, ... 29, 32, 33, ... + */ + return (($number % 10 === 1) && ($number % 100 != 11)) ? 1 : ((($number % 10 < 2) || (($number % 100 >= 10) && ($number % 100 < 20))) ? 2 : 3); + + case 7: + /** + * Families: Slavic (Croatian, Serbian, Russian, Ukrainian) + * 1 - ends in 1, not 11: 1, 21, 31, ... 101, 121, ... + * 2 - ends in 2-4, not 12-14: 2, 3, 4, 22, 23, 24, 32, ... + * 3 - everything else: 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, ... + */ + return (($number % 10 === 1) && ($number % 100 != 11)) ? 1 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 2 : 3); + + case 8: + /** + * Families: Slavic (Slovak, Czech) + * 1 - 1 + * 2 - 2, 3, 4 + * 3 - everything else: 0, 5, 6, 7, ... + */ + return ($number === 1) ? 1 : ((($number >= 2) && ($number <= 4)) ? 2 : 3); + + case 9: + /** + * Families: Slavic (Polish) + * 1 - 1 + * 2 - ends in 2-4, not 12-14: 2, 3, 4, 22, 23, 24, 32, ... 104, 122, ... + * 3 - everything else: 0, 5, 6, ... 11, 12, 13, 14, 15, ... 20, 21, 25, ... + */ + return ($number === 1) ? 1 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 2 : 3); + + case 10: + /** + * Families: Slavic (Slovenian, Sorbian) + * 1 - ends in 01: 1, 101, 201, ... + * 2 - ends in 02: 2, 102, 202, ... + * 3 - ends in 03-04: 3, 4, 103, 104, 203, 204, ... + * 4 - everything else: 0, 5, 6, 7, 8, 9, 10, 11, ... + */ + return ($number % 100 === 1) ? 1 : (($number % 100 === 2) ? 2 : ((($number % 100 === 3) || ($number % 100 === 4)) ? 3 : 4)); + + case 11: + /** + * Families: Celtic (Irish Gaeilge) + * 1 - 1 + * 2 - 2 + * 3 - is 3-6: 3, 4, 5, 6 + * 4 - is 7-10: 7, 8, 9, 10 + * 5 - everything else: 0, 11, 12, ... + */ + return ($number === 1) ? 1 : (($number === 2) ? 2 : (($number >= 3 && $number <= 6) ? 3 : (($number >= 7 && $number <= 10) ? 4 : 5))); + + case 12: + /** + * Families: Semitic (Arabic) + * 1 - 1 + * 2 - 2 + * 3 - ends in 03-10: 3, 4, ... 10, 103, 104, ... 110, 203, 204, ... + * 4 - ends in 11-99: 11, ... 99, 111, 112, ... + * 5 - everything else: 100, 101, 102, 200, 201, 202, ... + * 6 - 0 + */ + return ($number === 1) ? 1 : (($number === 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : (($number != 0) ? 5 : 6)))); + + case 13: + /** + * Families: Semitic (Maltese) + * 1 - 1 + * 2 - is 0 or ends in 01-10: 0, 2, 3, ... 9, 10, 101, 102, ... + * 3 - ends in 11-19: 11, 12, ... 18, 19, 111, 112, ... + * 4 - everything else: 20, 21, ... + */ + return ($number === 1) ? 1 : ((($number === 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 2 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 3 : 4)); + + case 14: + /** + * Families: Slavic (Macedonian) + * 1 - ends in 1: 1, 11, 21, ... + * 2 - ends in 2: 2, 12, 22, ... + * 3 - everything else: 0, 3, 4, ... 10, 13, 14, ... 20, 23, ... + */ + return ($number % 10 === 1) ? 1 : (($number % 10 === 2) ? 2 : 3); + + case 15: + /** + * Families: Icelandic + * 1 - ends in 1, not 11: 1, 21, 31, ... 101, 121, 131, ... + * 2 - everything else: 0, 2, 3, ... 10, 11, 12, ... 20, 22, ... + */ + return (($number % 10 === 1) && ($number % 100 != 11)) ? 1 : 2; + } + } + + /** + * Returns the ISO code of the used language + * + * @return string The ISO code of the currently used language + */ + public function get_used_language() + { + return $this->language_fallback[0]; + } + + /** + * Returns language fallback data + * + * @param bool $reload Whether or not to reload language files + * + * @return array + */ + protected function set_fallback_array($reload = false) + { + $fallback_array = array(); + + if ($this->user_language) + { + $fallback_array[] = $this->user_language; + } + + if ($this->default_language) + { + $fallback_array[] = $this->default_language; + } + + $fallback_array[] = self::FALLBACK_LANGUAGE; + + $this->language_fallback = $fallback_array; + + if ($reload) + { + $this->reload_language_files(); + } + } + + /** + * Load core language file + * + * @param string $component Name of the component to load + */ + protected function load_core_file($component) + { + // Check if the component is already loaded + if (isset($this->loaded_language_sets['core'][$component])) + { + return; + } + + $this->loader->load($component, $this->language_fallback, $this->lang); + $this->loaded_language_sets['core'][$component] = true; + } + + /** + * Load extension language file + * + * @param string $extension_name Name of the extension to load language from + * @param string $component Name of the component to load + */ + protected function load_extension($extension_name, $component) + { + // Check if the component is already loaded + if (isset($this->loaded_language_sets['ext'][$extension_name][$component])) + { + return; + } + + $this->loader->load_extension($extension_name, $component, $this->language_fallback, $this->lang); + $this->loaded_language_sets['ext'][$extension_name][$component] = true; + } + + /** + * Reload language files + */ + protected function reload_language_files() + { + $loaded_files = $this->loaded_language_sets; + $this->loaded_language_sets = array( + 'core' => array(), + 'ext' => array(), + ); + + // Reload core files + foreach ($loaded_files['core'] as $component => $value) + { + $this->load_core_file($component); + } + + // Reload extension files + foreach ($loaded_files['ext'] as $ext_name => $ext_info) + { + foreach ($ext_info as $ext_component => $value) + { + $this->load_extension($ext_name, $ext_component); + } + } + } +} diff --git a/phpBB/phpbb/language/language_file_helper.php b/phpBB/phpbb/language/language_file_helper.php new file mode 100644 index 0000000000..18d7b62e21 --- /dev/null +++ b/phpBB/phpbb/language/language_file_helper.php @@ -0,0 +1,71 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language; + +use Symfony\Component\Finder\Finder; + +/** + * Helper class for language file related functions + */ +class language_file_helper +{ + /** + * @var string Path to phpBB's root + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct($phpbb_root_path) + { + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Returns available languages + * + * @return array + */ + public function get_available_languages() + { + // Find available language packages + $finder = new Finder(); + $finder->files() + ->name('iso.txt') + ->depth('== 1') + ->in($this->phpbb_root_path . 'language'); + + $available_languages = array(); + foreach ($finder as $file) + { + $path = $file->getRelativePath(); + $info = explode("\n", $file->getContents()); + + $available_languages[] = array( + // Get the name of the directory containing iso.txt + 'iso' => $path, + + // Recover data from file + 'name' => trim($info[0]), + 'local_name' => trim($info[1]), + 'author' => trim($info[2]) + ); + } + + return $available_languages; + } +} diff --git a/phpBB/phpbb/language/language_file_loader.php b/phpBB/phpbb/language/language_file_loader.php new file mode 100644 index 0000000000..359202fd63 --- /dev/null +++ b/phpBB/phpbb/language/language_file_loader.php @@ -0,0 +1,206 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language; + +use \phpbb\language\exception\language_file_not_found; + +/** + * Language file loader + */ +class language_file_loader +{ + /** + * @var string Path to phpBB's root + */ + protected $phpbb_root_path; + + /** + * @var string Extension of PHP files + */ + protected $php_ext; + + /** + * @var \phpbb\extension\manager Extension manager + */ + protected $extension_manager; + + /** + * Constructor + * + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->extension_manager = null; + } + + /** + * Extension manager setter + * + * @param \phpbb\extension\manager $extension_manager Extension manager + */ + public function set_extension_manager(\phpbb\extension\manager $extension_manager) + { + $this->extension_manager = $extension_manager; + } + + /** + * Loads language array for the given component + * + * @param string $component Name of the language component + * @param string|array $locale ISO code of the language to load, or array of ISO codes if you want to + * specify additional language fallback steps + * @param array $lang Array reference containing language strings + */ + public function load($component, $locale, &$lang) + { + $locale = (array) $locale; + + // Determine path to language directory + $path = $this->phpbb_root_path . 'language/'; + + $this->load_file($path, $component, $locale, $lang); + } + + /** + * Loads language array for the given extension component + * + * @param string $extension Name of the extension + * @param string $component Name of the language component + * @param string|array $locale ISO code of the language to load, or array of ISO codes if you want to + * specify additional language fallback steps + * @param array $lang Array reference containing language strings + */ + public function load_extension($extension, $component, $locale, &$lang) + { + // Check if extension manager was loaded + if ($this->extension_manager === null) + { + // If not, let's return + return; + } + + $locale = (array) $locale; + + // Determine path to language directory + $path = $this->extension_manager->get_extension_path($extension, true) . 'language/'; + + $this->load_file($path, $component, $locale, $lang); + } + + /** + * Prepares language file loading + * + * @param string $path Path to search for file in + * @param string $component Name of the language component + * @param array $locale Array containing language fallback options + * @param array $lang Array reference of language strings + */ + protected function load_file($path, $component, $locale, &$lang) + { + // This is BC stuff and not the best idea as it makes language fallback + // implementation quite hard like below. + if (strpos($this->phpbb_root_path . $component, $path) === 0) + { + // Filter out the path + $path_diff = str_replace($path, '', dirname($this->phpbb_root_path . $component)); + $language_file = basename($component, '.' . $this->php_ext); + $component = ''; + + // This step is needed to resolve language/en/subdir style $component + // $path already points to the language base directory so we need to eliminate + // the first directory from the path (that should be the language directory) + $path_diff_parts = explode('/', $path_diff); + + if (sizeof($path_diff_parts) > 1) + { + array_shift($path_diff_parts); + $component = implode('/', $path_diff_parts) . '/'; + } + + $component .= $language_file; + } + + // Determine filename + $filename = $component . '.' . $this->php_ext; + + // Determine path to file + $file_path = $this->get_language_file_path($path, $filename, $locale); + + // Load language array + $this->load_language_file($file_path, $lang); + } + + /** + * This function implements language fallback logic + * + * @param string $path Path to language directory + * @param string $filename Filename to load language strings from + * + * @return string Relative path to language file + * + * @throws language_file_not_found When the path to the file cannot be resolved + */ + protected function get_language_file_path($path, $filename, $locales) + { + $language_file_path = $filename; + + // Language fallback logic + foreach ($locales as $locale) + { + $language_file_path = $path . $locale . '/' . $filename; + + // If we are in install, try to use the updated version, when available + if (defined('IN_INSTALL')) + { + $install_language_path = str_replace('language/', 'install/update/new/language/', $language_file_path); + if (file_exists($install_language_path)) + { + return $install_language_path; + } + } + + if (file_exists($language_file_path)) + { + return $language_file_path; + } + } + + // The language file is not exist + throw new language_file_not_found('Language file ' . $language_file_path . ' couldn\'t be opened.'); + } + + /** + * Loads language file + * + * @param string $path Path to language file to load + * @param array $lang Reference of the array of language strings + */ + protected function load_language_file($path, &$lang) + { + // Do not suppress error if in DEBUG mode + if (defined('DEBUG')) + { + include $path; + } + else + { + @include $path; + } + } +} diff --git a/phpBB/phpbb/lock/db.php b/phpBB/phpbb/lock/db.php index 461adda045..85ba9a7aa3 100644 --- a/phpBB/phpbb/lock/db.php +++ b/phpBB/phpbb/lock/db.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\lock; /** * Database locking class -* @package phpBB3 */ class db { @@ -42,7 +45,7 @@ class db /** * A database connection - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ private $db; @@ -51,11 +54,11 @@ class db * * You have to call acquire() to actually create the lock. * - * @param string $config_name A config variable to be used for locking - * @param array $config The phpBB configuration - * @param \phpbb\db\driver\driver $db A database connection + * @param string $config_name A config variable to be used for locking + * @param \phpbb\config\config $config The phpBB configuration + * @param \phpbb\db\driver\driver_interface $db A database connection */ - public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver $db) + public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) { $this->config_name = $config_name; $this->config = $config; diff --git a/phpBB/phpbb/lock/flock.php b/phpBB/phpbb/lock/flock.php index 94a5895440..df88e1490a 100644 --- a/phpBB/phpbb/lock/flock.php +++ b/phpBB/phpbb/lock/flock.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\lock; /** * File locking class -* @package phpBB3 */ class flock { diff --git a/phpBB/phpbb/log/dummy.php b/phpBB/phpbb/log/dummy.php new file mode 100644 index 0000000000..5c2d145e15 --- /dev/null +++ b/phpBB/phpbb/log/dummy.php @@ -0,0 +1,81 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\log; + +/** +* Dummy logger +*/ +class dummy implements log_interface +{ + /** + * {@inheritdoc} + */ + public function is_enabled($type = '') + { + return false; + } + + /** + * {@inheritdoc} + */ + public function disable($type = '') + { + } + + /** + * {@inheritdoc} + */ + public function enable($type = '') + { + } + + /** + * {@inheritdoc} + */ + public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array()) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function delete($mode, $conditions = array()) + { + } + + /** + * {@inheritdoc} + */ + public function get_logs($mode, $count_logs = true, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $log_time = 0, $sort_by = 'l.log_time DESC', $keywords = '') + { + return array(); + } + + /** + * {@inheritdoc} + */ + public function get_log_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_valid_offset() + { + return 0; + } +} diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 62edc6a77f..436c21bdad 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -1,9 +1,13 @@ <?php /** * -* @package \phpbb\log\log -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\log; /** * This class is used to add entries into the log table. -* -* @package \phpbb\log\log */ class log implements \phpbb\log\log_interface { @@ -25,7 +27,7 @@ class log implements \phpbb\log\log_interface /** * An array with the disabled log types. Logs of such types will not be - * added when add_log() is called. + * added when add() is called. * @var array */ protected $disabled_types; @@ -68,7 +70,7 @@ class log implements \phpbb\log\log_interface /** * Event dispatcher object - * @var phpbb_dispatcher + * @var \phpbb\event\dispatcher_interface */ protected $dispatcher; @@ -93,15 +95,14 @@ class log implements \phpbb\log\log_interface /** * Constructor * - * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\db\driver\driver_interface $db Database object * @param \phpbb\user $user User object * @param \phpbb\auth\auth $auth Auth object - * @param phpbb_dispatcher $phpbb_dispatcher Event dispatcher + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher * @param string $phpbb_root_path Root path * @param string $relative_admin_path Relative admin root path * @param string $php_ext PHP Extension * @param string $log_table Name of the table we use to store our logs - * @return null */ public function __construct($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, $relative_admin_path, $php_ext, $log_table) { @@ -157,8 +158,6 @@ class log implements \phpbb\log\log_interface } /** - * This function returns the state of the log system. - * * {@inheritDoc} */ public function is_enabled($type = '') @@ -171,12 +170,6 @@ class log implements \phpbb\log\log_interface } /** - * Disable log - * - * This function allows disabling the log system or parts of it, for this - * page call. When add_log is called and the type is disabled, - * the log will not be added to the database. - * * {@inheritDoc} */ public function disable($type = '') @@ -199,10 +192,6 @@ class log implements \phpbb\log\log_interface } /** - * Enable log - * - * This function allows re-enabling the log system. - * * {@inheritDoc} */ public function enable($type = '') @@ -225,8 +214,6 @@ class log implements \phpbb\log\log_interface } /** - * Adds a log to the database - * * {@inheritDoc} */ public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array()) @@ -236,14 +223,14 @@ class log implements \phpbb\log\log_interface return false; } - if ($log_time == false) + if ($log_time === false) { $log_time = time(); } $sql_ary = array( - 'user_id' => $user_id, - 'log_ip' => $log_ip, + 'user_id' => $user_id ? (int) $user_id : ANONYMOUS, + 'log_ip' => empty($log_ip) ? '' : $log_ip, 'log_time' => $log_time, 'log_operation' => $log_operation, ); @@ -258,14 +245,17 @@ class log implements \phpbb\log\log_interface break; case 'mod': - $forum_id = (int) $additional_data['forum_id']; + $forum_id = isset($additional_data['forum_id']) ? (int) $additional_data['forum_id'] : 0; unset($additional_data['forum_id']); - $topic_id = (int) $additional_data['topic_id']; + $topic_id = isset($additional_data['topic_id']) ? (int) $additional_data['topic_id'] : 0; unset($additional_data['topic_id']); + $post_id = isset($additional_data['post_id']) ? (int) $additional_data['post_id'] : 0; + unset($additional_data['post_id']); $sql_ary += array( 'log_type' => LOG_MOD, 'forum_id' => $forum_id, 'topic_id' => $topic_id, + 'post_id' => $post_id, 'log_data' => (!empty($additional_data)) ? serialize($additional_data) : '', ); break; @@ -305,10 +295,18 @@ class log implements \phpbb\log\log_interface * @var array sql_ary Array with log data we insert into the * database. If sql_ary[log_type] is not set, * we won't add the entry to the database. - * @since 3.1-A1 + * @since 3.1.0-a1 */ - $vars = array('mode', 'user_id', 'log_ip', 'log_operation', 'log_time', 'additional_data', 'sql_ary'); - extract($this->dispatcher->trigger_event('core.add_log', $vars)); + $vars = array( + 'mode', + 'user_id', + 'log_ip', + 'log_operation', + 'log_time', + 'additional_data', + 'sql_ary', + ); + extract($this->dispatcher->trigger_event('core.add_log', compact($vars))); // We didn't find a log_type, so we don't save it in the database. if (!isset($sql_ary['log_type'])) @@ -322,8 +320,99 @@ class log implements \phpbb\log\log_interface } /** - * Grab the logs from the database - * + * {@inheritDoc} + */ + public function delete($mode, $conditions = array()) + { + switch ($mode) + { + case 'admin': + $log_type = LOG_ADMIN; + break; + + case 'mod': + $log_type = LOG_MOD; + break; + + case 'user': + $log_type = LOG_USERS; + break; + + case 'users': + $log_type = LOG_USERS; + break; + + case 'critical': + $log_type = LOG_CRITICAL; + break; + + default: + $log_type = false; + } + + /** + * Allows to modify log data before we delete it from the database + * + * NOTE: if sql_ary does not contain a log_type value, the entry will + * not be deleted in the database. So ensure to set it, if needed. + * + * @event core.delete_log + * @var string mode Mode of the entry we log + * @var string log_type Type ID of the log (should be different than false) + * @var array conditions An array of conditions, 3 different forms are accepted + * 1) <key> => <value> transformed into 'AND <key> = <value>' (value should be an integer) + * 2) <key> => array(<operator>, <value>) transformed into 'AND <key> <operator> <value>' (values can't be an array) + * 3) <key> => array('IN' => array(<values>)) transformed into 'AND <key> IN <values>' + * A special field, keywords, can also be defined. In this case only the log entries that have the keywords in log_operation or log_data will be deleted. + * @since 3.1.0-b4 + */ + $vars = array( + 'mode', + 'log_type', + 'conditions', + ); + extract($this->dispatcher->trigger_event('core.delete_log', compact($vars))); + + if ($log_type === false) + { + return; + } + + $sql_where = 'WHERE log_type = ' . $log_type; + + if (isset($conditions['keywords'])) + { + $sql_where .= $this->generate_sql_keyword($conditions['keywords'], ''); + + unset($conditions['keywords']); + } + + foreach ($conditions as $field => $field_value) + { + $sql_where .= ' AND '; + + if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) + { + $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; + } + else if (is_array($field_value) && isset($field_value['IN']) && is_array($field_value['IN'])) + { + $sql_where .= $this->db->sql_in_set($field, $field_value['IN']); + } + else + { + $sql_where .= $field . ' = ' . $field_value; + } + } + + $sql = 'DELETE FROM ' . LOG_TABLE . " + $sql_where"; + $this->db->sql_query($sql); + + $this->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_CLEAR_' . strtoupper($mode)); + } + + /** * {@inheritDoc} */ public function get_logs($mode, $count_logs = true, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $log_time = 0, $sort_by = 'l.log_time DESC', $keywords = '') @@ -403,10 +492,24 @@ class log implements \phpbb\log\log_interface * is false, no entries will be returned. * @var string sql_additional Additional conditions for the entries, * e.g.: 'AND l.forum_id = 1' - * @since 3.1-A1 + * @since 3.1.0-a1 */ - $vars = array('mode', 'count_logs', 'limit', 'offset', 'forum_id', 'topic_id', 'user_id', 'log_time', 'sort_by', 'keywords', 'profile_url', 'log_type', 'sql_additional'); - extract($this->dispatcher->trigger_event('core.get_logs_modify_type', $vars)); + $vars = array( + 'mode', + 'count_logs', + 'limit', + 'offset', + 'forum_id', + 'topic_id', + 'user_id', + 'log_time', + 'sort_by', + 'keywords', + 'profile_url', + 'log_type', + 'sql_additional', + ); + extract($this->dispatcher->trigger_event('core.get_logs_modify_type', compact($vars))); if ($log_type === false) { @@ -421,15 +524,77 @@ class log implements \phpbb\log\log_interface $sql_keywords = $this->generate_sql_keyword($keywords); } - if ($count_logs) - { - $sql = 'SELECT COUNT(l.log_id) AS total_entries - FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u - WHERE l.log_type = ' . (int) $log_type . ' + $get_logs_sql_ary = array( + 'SELECT' => 'l.*, u.username, u.username_clean, u.user_colour', + 'FROM' => array( + $this->log_table => 'l', + USERS_TABLE => 'u', + ), + 'WHERE' => 'l.log_type = ' . (int) $log_type . " AND l.user_id = u.user_id - AND l.log_time >= ' . (int) $log_time . " $sql_keywords - $sql_additional"; + $sql_additional", + + 'ORDER_BY' => $sort_by, + ); + + if ($log_time) + { + $get_logs_sql_ary['WHERE'] = 'l.log_time >= ' . (int) $log_time . ' + AND ' . $get_logs_sql_ary['WHERE']; + } + + /** + * Modify the query to obtain the logs data + * + * @event core.get_logs_main_query_before + * @var array get_logs_sql_ary The array in the format of the query builder with the query + * to get the log count and the log list + * @var string mode Mode of the entries we display + * @var bool count_logs Do we count all matching entries? + * @var int limit Limit the number of entries + * @var int offset Offset when fetching the entries + * @var mixed forum_id Limit entries to the forum_id, + * can also be an array of forum_ids + * @var int topic_id Limit entries to the topic_id + * @var int user_id Limit entries to the user_id + * @var int log_time Limit maximum age of log entries + * @var string sort_by SQL order option + * @var string keywords Will only return entries that have the + * keywords in log_operation or log_data + * @var string profile_url URL to the users profile + * @var int log_type Limit logs to a certain type. If log_type + * is false, no entries will be returned. + * @var string sql_additional Additional conditions for the entries, + * e.g.: 'AND l.forum_id = 1' + * @since 3.1.5-RC1 + */ + $vars = array( + 'get_logs_sql_ary', + 'mode', + 'count_logs', + 'limit', + 'offset', + 'forum_id', + 'topic_id', + 'user_id', + 'log_time', + 'sort_by', + 'keywords', + 'profile_url', + 'log_type', + 'sql_additional', + ); + extract($this->dispatcher->trigger_event('core.get_logs_main_query_before', compact($vars))); + + if ($count_logs) + { + $count_logs_sql_ary = $get_logs_sql_ary; + + $count_logs_sql_ary['SELECT'] = 'COUNT(l.log_id) AS total_entries'; + unset($count_logs_sql_ary['ORDER_BY']); + + $sql = $this->db->sql_build_query('SELECT', $count_logs_sql_ary); $result = $this->db->sql_query($sql); $this->entry_count = (int) $this->db->sql_fetchfield('total_entries'); $this->db->sql_freeresult($result); @@ -448,14 +613,7 @@ class log implements \phpbb\log\log_interface } } - $sql = 'SELECT l.*, u.username, u.username_clean, u.user_colour - FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u - WHERE l.log_type = ' . (int) $log_type . ' - AND u.user_id = l.user_id - ' . (($log_time) ? 'AND l.log_time >= ' . (int) $log_time : '') . " - $sql_keywords - $sql_additional - ORDER BY $sort_by"; + $sql = $this->db->sql_build_query('SELECT', $get_logs_sql_ary); $result = $this->db->sql_query_limit($sql, $limit, $this->last_page_offset); $i = 0; @@ -488,9 +646,10 @@ class log implements \phpbb\log\log_interface 'time' => (int) $row['log_time'], 'forum_id' => (int) $row['forum_id'], 'topic_id' => (int) $row['topic_id'], + 'post_id' => (int) $row['post_id'], 'viewforum' => ($row['forum_id'] && $this->auth->acl_get('f_read', $row['forum_id'])) ? append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $row['forum_id']) : false, - 'action' => (isset($this->user->lang[$row['log_operation']])) ? $this->user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}', + 'action' => (isset($this->user->lang[$row['log_operation']])) ? $row['log_operation'] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}', ); /** @@ -499,10 +658,10 @@ class log implements \phpbb\log\log_interface * @event core.get_logs_modify_entry_data * @var array row Entry data from the database * @var array log_entry_data Entry's data which is returned - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('row', 'log_entry_data'); - extract($this->dispatcher->trigger_event('core.get_logs_modify_entry_data', $vars)); + extract($this->dispatcher->trigger_event('core.get_logs_modify_entry_data', compact($vars))); $log[$i] = $log_entry_data; @@ -517,12 +676,26 @@ class log implements \phpbb\log\log_interface // arguments, if there are we fill out the arguments // array. It doesn't matter if we add more arguments than // placeholders. - if ((substr_count($log[$i]['action'], '%') - sizeof($log_data_ary)) > 0) + $num_args = 0; + if (!is_array($this->user->lang[$row['log_operation']])) { - $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($log[$i]['action'], '%') - sizeof($log_data_ary), '')); + $num_args = substr_count($this->user->lang[$row['log_operation']], '%'); + } + else + { + foreach ($this->user->lang[$row['log_operation']] as $case => $plural_string) + { + $num_args = max($num_args, substr_count($plural_string, '%')); + } } - $log[$i]['action'] = vsprintf($log[$i]['action'], $log_data_ary); + if (($num_args - sizeof($log_data_ary)) > 0) + { + $log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - sizeof($log_data_ary), '')); + } + + $lang_arguments = array_merge(array($log[$i]['action']), $log_data_ary); + $log[$i]['action'] = call_user_func_array(array($this->user, 'lang'), $lang_arguments); // If within the admin panel we do not censor text out if ($this->get_is_admin()) @@ -544,6 +717,10 @@ class log implements \phpbb\log\log_interface $log[$i]['action'] = make_clickable($log[$i]['action']); */ } + else + { + $log[$i]['action'] = $this->user->lang($log[$i]['action']); + } $i++; } @@ -558,10 +735,10 @@ class log implements \phpbb\log\log_interface * get the permission data * @var array reportee_id_list Array of additional user IDs we * get the username strings for - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('log', 'topic_id_list', 'reportee_id_list'); - extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', $vars)); + extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', compact($vars))); if (sizeof($topic_id_list)) { @@ -570,6 +747,7 @@ class log implements \phpbb\log\log_interface foreach ($log as $key => $row) { $log[$key]['viewtopic'] = (isset($topic_auth['f_read'][$row['topic_id']])) ? append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $topic_auth['f_read'][$row['topic_id']] . '&t=' . $row['topic_id']) : false; + $log[$key]['viewpost'] = (isset($topic_auth['f_read'][$row['topic_id']]) && $row['post_id']) ? append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $topic_auth['f_read'][$row['topic_id']] . '&t=' . $row['topic_id'] . '&p=' . $row['post_id']) : false; $log[$key]['viewlogs'] = (isset($topic_auth['m_'][$row['topic_id']])) ? append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=logs&mode=topic_logs&t=' . $row['topic_id'], true, $this->user->session_id) : false; } } @@ -590,17 +768,63 @@ class log implements \phpbb\log\log_interface } } + /** + * Allow modifying or execute extra final filter on log entries + * + * @event core.get_logs_after + * @var array log Array with all our log entries + * @var array topic_id_list Array of topic ids, for which we + * get the permission data + * @var array reportee_id_list Array of additional user IDs we + * get the username strings for + * @var string mode Mode of the entries we display + * @var bool count_logs Do we count all matching entries? + * @var int limit Limit the number of entries + * @var int offset Offset when fetching the entries + * @var mixed forum_id Limit entries to the forum_id, + * can also be an array of forum_ids + * @var int topic_id Limit entries to the topic_id + * @var int user_id Limit entries to the user_id + * @var int log_time Limit maximum age of log entries + * @var string sort_by SQL order option + * @var string keywords Will only return entries that have the + * keywords in log_operation or log_data + * @var string profile_url URL to the users profile + * @var int log_type The type of logs it was filtered + * @since 3.1.3-RC1 + */ + $vars = array( + 'log', + 'topic_id_list', + 'reportee_id_list', + 'mode', + 'count_logs', + 'limit', + 'offset', + 'forum_id', + 'topic_id', + 'user_id', + 'log_time', + 'sort_by', + 'keywords', + 'profile_url', + 'log_type', + ); + extract($this->dispatcher->trigger_event('core.get_logs_after', compact($vars))); + return $log; } /** * Generates a sql condition for the specified keywords * - * @param string $keywords The keywords the user specified to search for + * @param string $keywords The keywords the user specified to search for + * @param string $table_alias The alias of the logs' table ('l.' by default) + * @param string $statement_operator The operator used to prefix the statement ('AND' by default) * * @return string Returns the SQL condition searching for the keywords */ - protected function generate_sql_keyword($keywords) + protected function generate_sql_keyword($keywords, $table_alias = 'l.', $statement_operator = 'AND') { // Use no preg_quote for $keywords because this would lead to sole // backslashes being added. We also use an OR connection here for @@ -617,7 +841,7 @@ class log implements \phpbb\log\log_interface for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++) { $keywords_pattern[] = preg_quote($keywords[$i], '#'); - $keywords[$i] = $this->db->sql_like_expression($this->db->any_char . $keywords[$i] . $this->db->any_char); + $keywords[$i] = $this->db->sql_like_expression($this->db->get_any_char() . $keywords[$i] . $this->db->get_any_char()); } $keywords_pattern = '#' . implode('|', $keywords_pattern) . '#ui'; @@ -625,18 +849,32 @@ class log implements \phpbb\log\log_interface $operations = array(); foreach ($this->user->lang as $key => $value) { - if (substr($key, 0, 4) == 'LOG_' && preg_match($keywords_pattern, $value)) + if (substr($key, 0, 4) == 'LOG_') { - $operations[] = $key; + if (is_array($value)) + { + foreach ($value as $plural_value) + { + if (preg_match($keywords_pattern, $plural_value)) + { + $operations[] = $key; + break; + } + } + } + else if (preg_match($keywords_pattern, $value)) + { + $operations[] = $key; + } } } - $sql_keywords = 'AND ('; + $sql_keywords = ' ' . $statement_operator . ' ('; if (!empty($operations)) { - $sql_keywords .= $this->db->sql_in_set('l.log_operation', $operations) . ' OR '; + $sql_keywords .= $this->db->sql_in_set($table_alias . 'log_operation', $operations) . ' OR '; } - $sql_lower = $this->db->sql_lower_text('l.log_data'); + $sql_lower = $this->db->sql_lower_text($table_alias . 'log_data'); $sql_keywords .= " $sql_lower " . implode(" OR $sql_lower ", $keywords) . ')'; } @@ -712,8 +950,6 @@ class log implements \phpbb\log\log_interface } /** - * Get total log count - * * {@inheritDoc} */ public function get_log_count() @@ -722,8 +958,6 @@ class log implements \phpbb\log\log_interface } /** - * Get offset of the last valid log page - * * {@inheritDoc} */ public function get_valid_offset() diff --git a/phpBB/phpbb/log/log_interface.php b/phpBB/phpbb/log/log_interface.php index 420ba79691..86286e6f88 100644 --- a/phpBB/phpbb/log/log_interface.php +++ b/phpBB/phpbb/log/log_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package \phpbb\log\log -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\log; /** * The interface for the log-system. -* -* @package \phpbb\log\log */ interface log_interface { @@ -30,8 +32,8 @@ interface log_interface * Disable log * * This function allows disabling the log system or parts of it, for this - * page call. When add_log is called and the type is disabled, - * the log will not be added to the database. + * page call. When add() is called and the type is disabled, the log will + * not be added to the database. * * @param mixed $type The log type we want to disable. Empty to * disable all logs. Can also be an array of types. @@ -55,18 +57,30 @@ interface log_interface /** * Adds a log entry to the database * - * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved - * @param int $user_id User ID of the user - * @param string $log_ip IP address of the user - * @param string $log_operation Name of the operation - * @param int $log_time Timestamp when the log entry was added, if empty time() will be used - * @param array $additional_data More arguments can be added, depending on the log_type + * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved + * @param int $user_id User ID of the user + * @param string $log_ip IP address of the user + * @param string $log_operation Name of the operation + * @param int|bool $log_time Timestamp when the log entry was added. If false, time() will be used + * @param array $additional_data More arguments can be added, depending on the log_type * * @return int|bool Returns the log_id, if the entry was added to the database, false otherwise. */ public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array()); /** + * Delete entries in the logs + * + * @param string $mode The mode defines which log_type is used and from which log the entries are deleted + * @param array $conditions An array of conditions, 3 different forms are accepted + * 1) <key> => <value> transformed into 'AND <key> = <value>' (value should be an integer) + * 2) <key> => array(<operator>, <value>) transformed into 'AND <key> <operator> <value>' (values can't be an array) + * 3) <key> => array('IN' => array(<values>)) transformed into 'AND <key> IN <values>' + * A special field, keywords, can also be defined. In this case only the log entries that have the keywords in log_operation or log_data will be deleted. + */ + public function delete($mode, $conditions = array()); + + /** * Grab the logs from the database * * @param string $mode The mode defines which log_type is used and ifrom which log the entry is retrieved diff --git a/phpBB/phpbb/log/null.php b/phpBB/phpbb/log/null.php deleted file mode 100644 index 77d0fbe2d7..0000000000 --- a/phpBB/phpbb/log/null.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** -* -* @package phpbb_log -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -namespace phpbb\log; - -/** -* Null logger -* -* @package phpbb_log -*/ -class null implements log_interface -{ - /** - * {@inheritdoc} - */ - public function is_enabled($type = '') - { - return false; - } - - /** - * {@inheritdoc} - */ - public function disable($type = '') - { - } - - /** - * {@inheritdoc} - */ - public function enable($type = '') - { - } - - /** - * {@inheritdoc} - */ - public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array()) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function get_logs($mode, $count_logs = true, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $log_time = 0, $sort_by = 'l.log_time DESC', $keywords = '') - { - return array(); - } - - /** - * {@inheritdoc} - */ - public function get_log_count() - { - return 0; - } - - /** - * {@inheritdoc} - */ - public function get_valid_offset() - { - return 0; - } -} diff --git a/phpBB/phpbb/message/admin_form.php b/phpBB/phpbb/message/admin_form.php new file mode 100644 index 0000000000..96b8d3499e --- /dev/null +++ b/phpBB/phpbb/message/admin_form.php @@ -0,0 +1,192 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\message; + +/** +* Class admin_form +* Displays a message to the user and allows him to send an email +*/ +class admin_form extends form +{ + /** @var \phpbb\config\db_text */ + protected $config_text; + + /** @var string */ + protected $subject; + /** @var string */ + protected $sender_name; + /** @var string */ + protected $sender_address; + + /** + * Construct + * + * @param \phpbb\auth\auth $auth + * @param \phpbb\config\config $config + * @param \phpbb\config\db_text $config_text + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\user $user + * @param string $phpbb_root_path + * @param string $phpEx + */ + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $phpEx) + { + parent::__construct($auth, $config, $db, $user, $phpbb_root_path, $phpEx); + $this->config_text = $config_text; + } + + /** + * {inheritDoc} + */ + public function check_allow() + { + $error = parent::check_allow(); + if ($error) + { + return $error; + } + + if (!$this->config['contact_admin_form_enable']) + { + return 'NO_CONTACT_PAGE'; + } + + return false; + } + + /** + * {inheritDoc} + */ + public function bind(\phpbb\request\request_interface $request) + { + parent::bind($request); + + $this->subject = $request->variable('subject', '', true); + $this->sender_address = $request->variable('email', ''); + $this->sender_name = $request->variable('name', '', true); + } + + /** + * {inheritDoc} + */ + public function submit(\messenger $messenger) + { + if (!$this->subject) + { + $this->errors[] = $this->user->lang['EMPTY_SUBJECT_EMAIL']; + } + if (!$this->body) + { + $this->errors[] = $this->user->lang['EMPTY_MESSAGE_EMAIL']; + } + + if ($this->user->data['is_registered']) + { + $this->message->set_sender_from_user($this->user); + $this->sender_name = $this->user->data['username']; + $this->sender_address = $this->user->data['user_email']; + } + else + { + if (!$this->sender_name) + { + $this->errors[] = $this->user->lang['EMPTY_SENDER_NAME']; + } + + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx); + } + + $validate_array = validate_data( + array( + 'email' => $this->sender_address, + ), + array( + 'email' => array( + array('string', false, 6, 60), + array('email'), + ), + ) + ); + + foreach ($validate_array as $error) + { + $this->errors[] = $this->user->lang[$error]; + } + + $this->message->set_sender($this->user->ip, $this->sender_name, $this->sender_address, $this->user->lang_name); + $this->message->set_sender_notify_type(NOTIFY_EMAIL); + } + + $this->message->set_template('contact_admin'); + $this->message->set_subject($this->subject); + $this->message->set_body($this->body); + $this->message->add_recipient( + $this->user->lang['ADMINISTRATOR'], + $this->config['board_contact'], + $this->config['default_lang'], + NOTIFY_EMAIL + ); + + $this->message->set_template_vars(array( + 'FROM_EMAIL_ADDRESS' => $this->sender_address, + 'FROM_IP_ADDRESS' => $this->user->ip, + 'S_IS_REGISTERED' => $this->user->data['is_registered'], + + 'U_FROM_PROFILE' => generate_board_url() . '/memberlist.' . $this->phpEx . '?mode=viewprofile&u=' . $this->user->data['user_id'], + )); + + parent::submit($messenger); + } + + /** + * {inheritDoc} + */ + public function render(\phpbb\template\template $template) + { + $l_admin_info = $this->config_text->get('contact_admin_info'); + if ($l_admin_info) + { + $contact_admin_data = $this->config_text->get_array(array( + 'contact_admin_info', + 'contact_admin_info_uid', + 'contact_admin_info_bitfield', + 'contact_admin_info_flags', + )); + + $l_admin_info = generate_text_for_display( + $contact_admin_data['contact_admin_info'], + $contact_admin_data['contact_admin_info_uid'], + $contact_admin_data['contact_admin_info_bitfield'], + $contact_admin_data['contact_admin_info_flags'] + ); + } + + $template->assign_vars(array( + 'S_CONTACT_ADMIN' => true, + 'S_CONTACT_FORM' => $this->config['contact_admin_form_enable'], + 'S_IS_REGISTERED' => $this->user->data['is_registered'], + 'S_POST_ACTION' => append_sid($this->phpbb_root_path . 'memberlist.' . $this->phpEx, 'mode=contactadmin'), + + 'CONTACT_INFO' => $l_admin_info, + 'MESSAGE' => $this->body, + 'SUBJECT' => $this->subject, + 'NAME' => $this->sender_name, + 'EMAIL' => $this->sender_address, + )); + + parent::render($template); + } +} diff --git a/phpBB/phpbb/message/form.php b/phpBB/phpbb/message/form.php new file mode 100644 index 0000000000..21d4de0b4d --- /dev/null +++ b/phpBB/phpbb/message/form.php @@ -0,0 +1,175 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\message; + +/** +* Abstract class form +*/ +abstract class form +{ + /** @var \phpbb\auth\auth */ + protected $auth; + /** @var \phpbb\config\config */ + protected $config; + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + /** @var \phpbb\message\message */ + protected $message; + /** @var \phpbb\user */ + protected $user; + + /** @var string */ + protected $phpbb_root_path; + /** @var string */ + protected $phpEx; + + /** @var array */ + protected $errors = array(); + /** @var bool */ + protected $cc_sender; + /** @var string */ + protected $body; + + /** + * Construct + * + * @param \phpbb\auth\auth $auth + * @param \phpbb\config\config $config + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\user $user + * @param string $phpbb_root_path + * @param string $phpEx + */ + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $phpEx) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + $this->db = $db; + + $this->message = new message($config['server_name']); + $this->message->set_sender_from_user($this->user); + } + + /** + * Returns the title for the email form page + * + * @return string + */ + public function get_page_title() + { + return $this->user->lang['SEND_EMAIL']; + } + + /** + * Returns the file name of the form template + * + * @return string + */ + public function get_template_file() + { + return 'memberlist_email.html'; + } + + /** + * Checks whether the user is allowed to use the form + * + * @return false|string Error string if not allowed, false otherwise + */ + public function check_allow() + { + if (!$this->config['email_enable']) + { + return 'EMAIL_DISABLED'; + } + + if (time() - $this->user->data['user_emailtime'] < $this->config['flood_interval']) + { + return 'FLOOD_EMAIL_LIMIT'; + } + + return false; + } + + /** + * Get the return link after the message has been sent + * + * @return string + */ + public function get_return_message() + { + return sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . append_sid($this->phpbb_root_path . 'index.' . $this->phpEx) . '">', '</a>'); + } + + /** + * Bind the values of the request to the form + * + * @param \phpbb\request\request_interface $request + * @return null + */ + public function bind(\phpbb\request\request_interface $request) + { + $this->cc_sender = $request->is_set_post('cc_sender'); + $this->body = $request->variable('message', '', true); + } + + /** + * Submit form, generate the email and send it + * + * @param \messenger $messenger + * @return null + */ + public function submit(\messenger $messenger) + { + if (!check_form_key('memberlist_email')) + { + $this->errors[] = 'FORM_INVALID'; + } + + if (!sizeof($this->errors)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_emailtime = ' . time() . ' + WHERE user_id = ' . $this->user->data['user_id']; + $this->db->sql_query($sql); + + if ($this->cc_sender && $this->user->data['is_registered']) + { + $this->message->cc_sender(); + } + + $this->message->send($messenger, phpbb_get_board_contact($this->config, $this->phpEx)); + + meta_refresh(3, append_sid($this->phpbb_root_path . 'index.' . $this->phpEx)); + trigger_error($this->user->lang['EMAIL_SENT'] . '<br /><br />' . $this->get_return_message()); + } + } + + /** + * Render the template of the form + * + * @param \phpbb\template\template $template + * @return null + */ + public function render(\phpbb\template\template $template) + { + add_form_key('memberlist_email'); + + $template->assign_vars(array( + 'ERROR_MESSAGE' => (sizeof($this->errors)) ? implode('<br />', $this->errors) : '', + )); + } +} diff --git a/phpBB/phpbb/message/message.php b/phpBB/phpbb/message/message.php new file mode 100644 index 0000000000..5fd24b542e --- /dev/null +++ b/phpBB/phpbb/message/message.php @@ -0,0 +1,282 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\message; + +/** +* Class message +* Holds all information for an email and sends it in the end +*/ +class message +{ + /** @var string */ + protected $server_name; + + /** @var string */ + protected $subject = ''; + /** @var string */ + protected $body = ''; + /** @var string */ + protected $template = ''; + /** @var array */ + protected $template_vars = array(); + + /** @var string */ + protected $sender_ip = ''; + /** @var string */ + protected $sender_name = ''; + /** @var string */ + protected $sender_address = ''; + /** @var string */ + protected $sender_lang = ''; + /** @var string */ + protected $sender_id = ''; + /** @var string */ + protected $sender_username = ''; + /** @var string */ + protected $sender_jabber = ''; + /** @var int */ + protected $sender_notify_type = NOTIFY_EMAIL; + + /** @var array */ + protected $recipients; + + /** + * Construct + * + * @param string $server_name Used for AntiAbuse header + */ + public function __construct($server_name) + { + $this->server_name = $server_name; + } + + /** + * Set the subject of the email + * + * @param string $subject + * @return null + */ + public function set_subject($subject) + { + $this->subject = $subject; + } + + /** + * Set the body of the email text + * + * @param string $body + * @return null + */ + public function set_body($body) + { + $this->body = $body; + } + + /** + * Set the name of the email template to use + * + * @param string $template + * @return null + */ + public function set_template($template) + { + $this->template = $template; + } + + /** + * Set the array with the "template" data for the email + * + * @param array $template_vars + * @return null + */ + public function set_template_vars($template_vars) + { + $this->template_vars = $template_vars; + } + + /** + * Add a recipient from \phpbb\user + * + * @param array $user + * @return null + */ + public function add_recipient_from_user_row(array $user) + { + $this->add_recipient( + $user['username'], + $user['user_email'], + $user['user_lang'], + $user['user_notify_type'], + $user['username'], + $user['user_jabber'] + ); + } + + /** + * Add a recipient + * + * @param string $recipient_name Displayed sender name + * @param string $recipient_address Email address + * @param string $recipient_lang + * @param int $recipient_notify_type Used notification methods (Jabber, Email, ...) + * @param string $recipient_username User Name (used for AntiAbuse header) + * @param string $recipient_jabber + * @return null + */ + public function add_recipient($recipient_name, $recipient_address, $recipient_lang, $recipient_notify_type = NOTIFY_EMAIL, $recipient_username = '', $recipient_jabber = '') + { + $this->recipients[] = array( + 'name' => $recipient_name, + 'address' => $recipient_address, + 'lang' => $recipient_lang, + 'username' => $recipient_username, + 'jabber' => $recipient_jabber, + 'notify_type' => $recipient_notify_type, + 'to_name' => $recipient_name, + ); + } + + /** + * Set the senders data from \phpbb\user object + * + * @param \phpbb\user $user + * @return null + */ + public function set_sender_from_user($user) + { + $this->set_sender( + $user->ip, + $user->data['username'], + $user->data['user_email'], + $user->lang_name, + $user->data['user_id'], + $user->data['username'], + $user->data['user_jabber'] + ); + + $this->set_sender_notify_type($user->data['user_notify_type']); + } + + /** + * Set the senders data + * + * @param string $sender_ip + * @param string $sender_name Displayed sender name + * @param string $sender_address Email address + * @param string $sender_lang + * @param int $sender_id User ID + * @param string $sender_username User Name (used for AntiAbuse header) + * @param string $sender_jabber + * @return null + */ + public function set_sender($sender_ip, $sender_name, $sender_address, $sender_lang = '', $sender_id = 0, $sender_username = '', $sender_jabber = '') + { + $this->sender_ip = $sender_ip; + $this->sender_name = $sender_name; + $this->sender_address = $sender_address; + $this->sender_lang = $sender_lang; + $this->sender_id = $sender_id; + $this->sender_username = $sender_username; + $this->sender_jabber = $sender_jabber; + } + + /** + * Which notification type should be used? Jabber, Email, ...? + * + * @param int $sender_notify_type + * @return null + */ + public function set_sender_notify_type($sender_notify_type) + { + $this->sender_notify_type = $sender_notify_type; + } + + /** + * Ok, now the same email if CC specified, but without exposing the user's email address + * + * @return null + */ + public function cc_sender() + { + if (!sizeof($this->recipients)) + { + trigger_error('No email recipients specified'); + } + if (!$this->sender_address) + { + trigger_error('No email sender specified'); + } + + $this->recipients[] = array( + 'lang' => $this->sender_lang, + 'address' => $this->sender_address, + 'name' => $this->sender_name, + 'username' => $this->sender_username, + 'jabber' => $this->sender_jabber, + 'notify_type' => $this->sender_notify_type, + 'to_name' => $this->recipients[0]['to_name'], + ); + } + + /** + * Send the email + * + * @param \messenger $messenger + * @param string $contact + * @return null + */ + public function send(\messenger $messenger, $contact) + { + if (!sizeof($this->recipients)) + { + return; + } + + foreach ($this->recipients as $recipient) + { + $messenger->template($this->template, $recipient['lang']); + $messenger->replyto($this->sender_address); + $messenger->to($recipient['address'], $recipient['name']); + $messenger->im($recipient['jabber'], $recipient['username']); + + $messenger->headers('X-AntiAbuse: Board servername - ' . $this->server_name); + $messenger->headers('X-AntiAbuse: User IP - ' . $this->sender_ip); + + if ($this->sender_id) + { + $messenger->headers('X-AntiAbuse: User_id - ' . $this->sender_id); + } + if ($this->sender_username) + { + $messenger->headers('X-AntiAbuse: Username - ' . $this->sender_username); + } + + $messenger->subject(htmlspecialchars_decode($this->subject)); + + $messenger->assign_vars(array( + 'BOARD_CONTACT' => $contact, + 'TO_USERNAME' => htmlspecialchars_decode($recipient['to_name']), + 'FROM_USERNAME' => htmlspecialchars_decode($this->sender_name), + 'MESSAGE' => htmlspecialchars_decode($this->body)) + ); + + if (sizeof($this->template_vars)) + { + $messenger->assign_vars($this->template_vars); + } + + $messenger->send($recipient['notify_type']); + } + } +} diff --git a/phpBB/phpbb/message/topic_form.php b/phpBB/phpbb/message/topic_form.php new file mode 100644 index 0000000000..174643bb81 --- /dev/null +++ b/phpBB/phpbb/message/topic_form.php @@ -0,0 +1,158 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\message; + +/** +* Class topic_form +* Form used to send topics as notification emails +*/ +class topic_form extends form +{ + /** @var int */ + protected $topic_id; + /** @var array */ + protected $topic_row; + /** @var string */ + protected $recipient_address; + /** @var string */ + protected $recipient_name; + /** @var string */ + protected $recipient_lang; + + /** + * Get the data of the topic + * + * @param int $topic_id + * @return false|array false if the topic does not exist, array otherwise + */ + protected function get_topic_row($topic_id) + { + $sql = 'SELECT forum_id, topic_title + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . (int) $topic_id; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + /** + * {inheritDoc} + */ + public function check_allow() + { + $error = parent::check_allow(); + if ($error) + { + return $error; + } + + if (!$this->auth->acl_get('u_sendemail')) + { + return 'NO_EMAIL'; + } + + if (!$this->topic_row) + { + return 'NO_TOPIC'; + } + + if (!$this->auth->acl_get('f_read', $this->topic_row['forum_id'])) + { + return 'SORRY_AUTH_READ'; + } + + if (!$this->auth->acl_get('f_email', $this->topic_row['forum_id'])) + { + return 'NO_EMAIL'; + } + + return false; + } + + /** + * {inheritDoc} + */ + public function bind(\phpbb\request\request_interface $request) + { + parent::bind($request); + + $this->topic_id = $request->variable('t', 0); + $this->recipient_address = $request->variable('email', ''); + $this->recipient_name = $request->variable('name', '', true); + $this->recipient_lang = $request->variable('lang', $this->config['default_lang']); + + $this->topic_row = $this->get_topic_row($this->topic_id); + } + + /** + * {inheritDoc} + */ + public function submit(\messenger $messenger) + { + if (!$this->recipient_address || !preg_match('/^' . get_preg_expression('email') . '$/i', $this->recipient_address)) + { + $this->errors[] = $this->user->lang['EMPTY_ADDRESS_EMAIL']; + } + + if (!$this->recipient_name) + { + $this->errors[] = $this->user->lang['EMPTY_NAME_EMAIL']; + } + + $this->message->set_template('email_notify'); + $this->message->set_template_vars(array( + 'TOPIC_NAME' => htmlspecialchars_decode($this->topic_row['topic_title']), + 'U_TOPIC' => generate_board_url() . '/viewtopic.' . $this->phpEx . '?f=' . $this->topic_row['forum_id'] . '&t=' . $this->topic_id, + )); + $this->message->set_body($this->body); + $this->message->add_recipient( + $this->recipient_name, + $this->recipient_address, + $this->recipient_lang, + NOTIFY_EMAIL + ); + $this->message->set_sender_notify_type(NOTIFY_EMAIL); + + parent::submit($messenger); + } + + /** + * {inheritDoc} + */ + public function get_return_message() + { + return sprintf($this->user->lang['RETURN_TOPIC'], '<a href="' . append_sid($this->phpbb_root_path . 'viewtopic.' . $this->phpEx, 'f=' . $this->topic_row['forum_id'] . '&t=' . $this->topic_id) . '">', '</a>'); + } + + /** + * {inheritDoc} + */ + public function render(\phpbb\template\template $template) + { + parent::render($template); + + $this->user->add_lang('viewtopic'); + $template->assign_vars(array( + 'EMAIL' => $this->recipient_address, + 'NAME' => $this->recipient_name, + 'S_LANG_OPTIONS' => language_select($this->recipient_lang), + 'MESSAGE' => $this->body, + + 'L_EMAIL_BODY_EXPLAIN' => $this->user->lang['EMAIL_TOPIC_EXPLAIN'], + 'S_POST_ACTION' => append_sid($this->phpbb_root_path . 'memberlist.' . $this->phpEx, 'mode=email&t=' . $this->topic_id)) + ); + } +} diff --git a/phpBB/phpbb/message/user_form.php b/phpBB/phpbb/message/user_form.php new file mode 100644 index 0000000000..007e575407 --- /dev/null +++ b/phpBB/phpbb/message/user_form.php @@ -0,0 +1,136 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\message; + +/** +* Class user_form +* Allows users to send emails to other users +*/ +class user_form extends form +{ + /** @var int */ + protected $recipient_id; + /** @var array */ + protected $recipient_row; + /** @var string */ + protected $subject; + + /** + * Get the data of the recipient + * + * @param int $user_id + * @return false|array false if the user does not exist, array otherwise + */ + protected function get_user_row($user_id) + { + $sql = 'SELECT user_id, username, user_colour, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $user_id . ' + AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + /** + * {inheritDoc} + */ + public function check_allow() + { + $error = parent::check_allow(); + if ($error) + { + return $error; + } + + if (!$this->auth->acl_get('u_sendemail')) + { + return 'NO_EMAIL'; + } + + if ($this->recipient_id == ANONYMOUS || !$this->config['board_email_form']) + { + return 'NO_EMAIL'; + } + + if (!$this->recipient_row) + { + return 'NO_USER'; + } + + // Can we send email to this user? + if (!$this->recipient_row['user_allow_viewemail'] && !$this->auth->acl_get('a_user')) + { + return 'NO_EMAIL'; + } + + return false; + } + + /** + * {inheritDoc} + */ + public function bind(\phpbb\request\request_interface $request) + { + parent::bind($request); + + $this->recipient_id = $request->variable('u', 0); + $this->subject = $request->variable('subject', '', true); + + $this->recipient_row = $this->get_user_row($this->recipient_id); + } + + /** + * {inheritDoc} + */ + public function submit(\messenger $messenger) + { + if (!$this->subject) + { + $this->errors[] = $this->user->lang['EMPTY_SUBJECT_EMAIL']; + } + + if (!$this->body) + { + $this->errors[] = $this->user->lang['EMPTY_MESSAGE_EMAIL']; + } + + $this->message->set_template('profile_send_email'); + $this->message->set_subject($this->subject); + $this->message->set_body($this->body); + $this->message->add_recipient_from_user_row($this->recipient_row); + + parent::submit($messenger); + } + + /** + * {inheritDoc} + */ + public function render(\phpbb\template\template $template) + { + parent::render($template); + + $template->assign_vars(array( + 'S_SEND_USER' => true, + 'S_POST_ACTION' => append_sid($this->phpbb_root_path . 'memberlist.' . $this->phpEx, 'mode=email&u=' . $this->recipient_id), + + 'L_SEND_EMAIL_USER' => $this->user->lang('SEND_EMAIL_USER', $this->recipient_row['username']), + 'USERNAME_FULL' => get_username_string('full', $this->recipient_row['user_id'], $this->recipient_row['username'], $this->recipient_row['user_colour']), + 'SUBJECT' => $this->subject, + 'MESSAGE' => $this->body, + )); + } +} diff --git a/phpBB/phpbb/mimetype/content_guesser.php b/phpBB/phpbb/mimetype/content_guesser.php index 2d74582a21..f3ad7f5f41 100644 --- a/phpBB/phpbb/mimetype/content_guesser.php +++ b/phpBB/phpbb/mimetype/content_guesser.php @@ -1,30 +1,30 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\mimetype; -/** -* @package mimetype -*/ - class content_guesser extends guesser_base { /** - * @inheritdoc + * {@inheritdoc} */ public function is_supported() { - return function_exists('mime_content_type'); + return function_exists('mime_content_type') && is_callable('mime_content_type'); } /** - * @inheritdoc + * {@inheritdoc} */ public function guess($file, $file_name = '') { diff --git a/phpBB/phpbb/mimetype/extension_guesser.php b/phpBB/phpbb/mimetype/extension_guesser.php index f6f4ae0138..9e36c07f91 100644 --- a/phpBB/phpbb/mimetype/extension_guesser.php +++ b/phpBB/phpbb/mimetype/extension_guesser.php @@ -1,18 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\mimetype; -/** -* @package mimetype -*/ - class extension_guesser extends guesser_base { /** @@ -470,7 +470,7 @@ class extension_guesser extends guesser_base ); /** - * @inheritdoc + * {@inheritdoc} */ public function is_supported() { @@ -478,7 +478,7 @@ class extension_guesser extends guesser_base } /** - * @inheritdoc + * {@inheritdoc} */ public function guess($file, $file_name = '') { diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php index 3499b3b0f7..8baa77089b 100644 --- a/phpBB/phpbb/mimetype/guesser.php +++ b/phpBB/phpbb/mimetype/guesser.php @@ -1,18 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\mimetype; -/** -* @package mimetype -*/ - class guesser { /** @@ -21,7 +21,7 @@ class guesser const PRIORITY_DEFAULT = 0; /** - * @var mimetype guessers + * @var array guessers */ protected $guessers; @@ -99,6 +99,7 @@ class guesser * Guess mimetype of supplied file * * @param string $file Path to file + * @param string $file_name The real file name * * @return string Guess for mimetype of file */ @@ -114,17 +115,42 @@ class guesser return false; } + $mimetype = 'application/octet-stream'; + foreach ($this->guessers as $guesser) { - $mimetype = $guesser->guess($file, $file_name); + $mimetype_guess = $guesser->guess($file, $file_name); - // Try to guess something that is not the fallback application/octet-stream - if ($mimetype !== null && $mimetype !== 'application/octet-stream') - { - return $mimetype; - } + $mimetype = $this->choose_mime_type($mimetype, $mimetype_guess); } // Return any mimetype if we got a result or the fallback value - return (!empty($mimetype)) ? $mimetype : 'application/octet-stream'; + return $mimetype; + } + + /** + * Choose the best mime type based on the current mime type and the guess + * If a guesser returns nulls or application/octet-stream, we will keep + * the current guess. Guesses with a slash inside them will be favored over + * already existing ones. However, any guess that will pass the first check + * will always overwrite the default application/octet-stream. + * + * @param string $mime_type The current mime type + * @param string $guess The current mime type guess + * + * @return string The best mime type based on current mime type and guess + */ + public function choose_mime_type($mime_type, $guess) + { + if ($guess === null || $guess == 'application/octet-stream') + { + return $mime_type; + } + + if ($mime_type == 'application/octet-stream' || strpos($guess, '/') !== false) + { + $mime_type = $guess; + } + + return $mime_type; } } diff --git a/phpBB/phpbb/mimetype/guesser_base.php b/phpBB/phpbb/mimetype/guesser_base.php index 082b098028..225dfd57dc 100644 --- a/phpBB/phpbb/mimetype/guesser_base.php +++ b/phpBB/phpbb/mimetype/guesser_base.php @@ -1,18 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\mimetype; -/** -* @package mimetype -*/ - abstract class guesser_base implements guesser_interface { /** @@ -21,7 +21,7 @@ abstract class guesser_base implements guesser_interface protected $priority; /** - * @inheritdoc + * {@inheritdoc} */ public function get_priority() { @@ -29,7 +29,7 @@ abstract class guesser_base implements guesser_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function set_priority($priority) { diff --git a/phpBB/phpbb/mimetype/guesser_interface.php b/phpBB/phpbb/mimetype/guesser_interface.php index 103689765e..a4005287e4 100644 --- a/phpBB/phpbb/mimetype/guesser_interface.php +++ b/phpBB/phpbb/mimetype/guesser_interface.php @@ -1,18 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\mimetype; -/** -* @package mimetype -*/ - interface guesser_interface { /** @@ -26,6 +26,7 @@ interface guesser_interface * Guess mimetype of supplied file * * @param string $file Path to file + * @param string $file_name The real file name * * @return string Guess for mimetype of file */ diff --git a/phpBB/phpbb/module/exception/module_exception.php b/phpBB/phpbb/module/exception/module_exception.php new file mode 100644 index 0000000000..8ad75112bc --- /dev/null +++ b/phpBB/phpbb/module/exception/module_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\module\exception; + +class module_exception extends \phpbb\exception\runtime_exception +{ + +} diff --git a/phpBB/phpbb/module/exception/module_not_found_exception.php b/phpBB/phpbb/module/exception/module_not_found_exception.php new file mode 100644 index 0000000000..2d485e7b35 --- /dev/null +++ b/phpBB/phpbb/module/exception/module_not_found_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\module\exception; + +class module_not_found_exception extends module_exception +{ + +} diff --git a/phpBB/phpbb/module/module_manager.php b/phpBB/phpbb/module/module_manager.php new file mode 100644 index 0000000000..a812d06736 --- /dev/null +++ b/phpBB/phpbb/module/module_manager.php @@ -0,0 +1,564 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\module; + +use phpbb\module\exception\module_exception; +use phpbb\module\exception\module_not_found_exception; + +class module_manager +{ + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\extension\manager + */ + protected $extension_manager; + + /** + * @var string + */ + protected $modules_table; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\cache\driver\driver_interface $cache Cache driver + * @param \phpbb\db\driver\driver_interface $db Database driver + * @param \phpbb\extension\manager $ext_manager Extension manager + * @param string $modules_table Module database table's name + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\extension\manager $ext_manager, $modules_table, $phpbb_root_path, $php_ext) + { + $this->cache = $cache; + $this->db = $db; + $this->extension_manager = $ext_manager; + $this->modules_table = $modules_table; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Get row for specified module + * + * @param int $module_id ID of the module + * @param string $module_class Class of the module (acp, ucp, mcp etc...) + * + * @return array Array of data fetched from the database + * + * @throws \phpbb\module\exception\module_not_found_exception When there is no module with $module_id + */ + public function get_module_row($module_id, $module_class) + { + $module_id = (int) $module_id; + + $sql = 'SELECT * + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND module_id = $module_id"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + throw new module_not_found_exception('NO_MODULE'); + } + + return $row; + } + + /** + * Get available module information from module files + * + * @param string $module_class Class of the module (acp, ucp, mcp etc...) + * @param string $module ID of module + * @param bool $use_all_available Use all available instead of just all + * enabled extensions + * + * @return array Array with module information gathered from module info files. + */ + public function get_module_infos($module_class, $module = '', $use_all_available = false) + { + $directory = $this->phpbb_root_path . 'includes/' . $module_class . '/info/'; + $fileinfo = array(); + + $finder = $this->extension_manager->get_finder($use_all_available); + + $modules = $finder + ->extension_suffix('_module') + ->extension_directory("/$module_class") + ->core_path("includes/$module_class/info/") + ->core_prefix($module_class . '_') + ->get_classes(true); + + foreach ($modules as $cur_module) + { + // Skip entries we do not need if we know the module we are + // looking for + if ($module && strpos(str_replace('\\', '_', $cur_module), $module) === false && $module !== $cur_module) + { + continue; + } + + $info_class = preg_replace('/_module$/', '_info', $cur_module); + + // If the class does not exist it might be following the old + // format. phpbb_acp_info_acp_foo needs to be turned into + // acp_foo_info and the respective file has to be included + // manually because it does not support auto loading + $old_info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module); + $old_info_class = $old_info_class_file . '_info'; + + if (class_exists($old_info_class)) + { + $info_class = $old_info_class; + } + else if (!class_exists($info_class)) + { + $info_class = $old_info_class; + + // need to check class exists again because previous checks triggered autoloading + if (!class_exists($info_class) && file_exists($directory . $old_info_class_file . '.' . $this->php_ext)) + { + include($directory . $old_info_class_file . '.' . $this->php_ext); + } + } + + if (class_exists($info_class)) + { + $info = new $info_class(); + $module_info = $info->module(); + + $main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $cur_module; + + $fileinfo[$main_class] = $module_info; + } + } + + ksort($fileinfo); + + return $fileinfo; + } + + /** + * Get module branch + * + * @param int $module_id ID of the module + * @param string $module_class Class of the module (acp, ucp, mcp etc...) + * @param string $type Type of branch (Expected values: all, parents or children) + * @param bool $include_module Whether or not to include the specified module with $module_id + * + * @return array Returns an array containing the modules in the specified branch type. + */ + public function get_module_branch($module_id, $module_class, $type = 'all', $include_module = true) + { + $module_id = (int) $module_id; + + switch ($type) + { + case 'parents': + $condition = 'm1.left_id BETWEEN m2.left_id AND m2.right_id'; + break; + + case 'children': + $condition = 'm2.left_id BETWEEN m1.left_id AND m1.right_id'; + break; + + default: + $condition = 'm2.left_id BETWEEN m1.left_id AND m1.right_id OR m1.left_id BETWEEN m2.left_id AND m2.right_id'; + break; + } + + $rows = array(); + + $sql = 'SELECT m2.* + FROM ' . $this->modules_table . ' m1 + LEFT JOIN ' . $this->modules_table . " m2 ON ($condition) + WHERE m1.module_class = '" . $this->db->sql_escape($module_class) . "' + AND m2.module_class = '" . $this->db->sql_escape($module_class) . "' + AND m1.module_id = $module_id + ORDER BY m2.left_id DESC"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if (!$include_module && $row['module_id'] == $module_id) + { + continue; + } + + $rows[] = $row; + } + $this->db->sql_freeresult($result); + + return $rows; + } + + /** + * Remove modules cache file + * + * @param string $module_class Class of the module (acp, ucp, mcp etc...) + */ + public function remove_cache_file($module_class) + { + // Sanitise for future path use, it's escaped as appropriate for queries + $cache_class = str_replace(array('.', '/', '\\'), '', basename($module_class)); + $this->cache->destroy('_modules_' . $cache_class); + $this->cache->destroy('sql', $this->modules_table); + } + + /** + * Update/Add module + * + * @param array &$module_data The module data + * + * @throws \phpbb\module\exception\module_not_found_exception When parent module or the category is not exist + */ + public function update_module_data(&$module_data) + { + if (!isset($module_data['module_id'])) + { + // no module_id means we're creating a new category/module + if ($module_data['parent_id']) + { + $sql = 'SELECT left_id, right_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "' + AND module_id = " . (int) $module_data['parent_id']; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + throw new module_not_found_exception('PARENT_NOT_EXIST'); + } + + // Workaround + $row['left_id'] = (int) $row['left_id']; + $row['right_id'] = (int) $row['right_id']; + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "' + AND left_id > {$row['right_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->modules_table . " + SET right_id = right_id + 2 + WHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "' + AND {$row['left_id']} BETWEEN left_id AND right_id"; + $this->db->sql_query($sql); + + $module_data['left_id'] = (int) $row['right_id']; + $module_data['right_id'] = (int) $row['right_id'] + 1; + } + else + { + $sql = 'SELECT MAX(right_id) AS right_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $module_data['left_id'] = (int) $row['right_id'] + 1; + $module_data['right_id'] = (int) $row['right_id'] + 2; + } + + $sql = 'INSERT INTO ' . $this->modules_table . ' ' . $this->db->sql_build_array('INSERT', $module_data); + $this->db->sql_query($sql); + + $module_data['module_id'] = $this->db->sql_nextid(); + } + else + { + $row = $this->get_module_row($module_data['module_id'], $module_data['module_class']); + + if ($module_data['module_basename'] && !$row['module_basename']) + { + // we're turning a category into a module + $branch = $this->get_module_branch($module_data['module_id'], $module_data['module_class'], 'children', false); + + if (sizeof($branch)) + { + throw new module_not_found_exception('NO_CATEGORY_TO_MODULE'); + } + } + + if ($row['parent_id'] != $module_data['parent_id']) + { + $this->move_module($module_data['module_id'], $module_data['parent_id'], $module_data['module_class']); + } + + $update_ary = $module_data; + unset($update_ary['module_id']); + + $sql = 'UPDATE ' . $this->modules_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $update_ary) . " + WHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "' + AND module_id = " . (int) $module_data['module_id']; + $this->db->sql_query($sql); + } + } + + /** + * Move module around the tree + * + * @param int $from_module_id ID of the current parent module + * @param int $to_parent_id ID of the target parent module + * @param string $module_class Class of the module (acp, ucp, mcp etc...) + * + * @throws \phpbb\module\exception\module_not_found_exception If the module specified to move modules from does not + * have any children. + */ + public function move_module($from_module_id, $to_parent_id, $module_class) + { + $moved_modules = $this->get_module_branch($from_module_id, $module_class, 'children'); + + if (empty($moved_modules)) + { + throw new module_not_found_exception(); + } + + $from_data = $moved_modules[0]; + $diff = sizeof($moved_modules) * 2; + + $moved_ids = array(); + for ($i = 0; $i < sizeof($moved_modules); ++$i) + { + $moved_ids[] = $moved_modules[$i]['module_id']; + } + + // Resync parents + $sql = 'UPDATE ' . $this->modules_table . " + SET right_id = right_id - $diff + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND left_id < " . (int) $from_data['right_id'] . ' + AND right_id > ' . (int) $from_data['right_id']; + $this->db->sql_query($sql); + + // Resync righthand side of tree + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id - $diff, right_id = right_id - $diff + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND left_id > " . (int) $from_data['right_id']; + $this->db->sql_query($sql); + + if ($to_parent_id > 0) + { + $to_data = $this->get_module_row($to_parent_id, $module_class); + + // Resync new parents + $sql = 'UPDATE ' . $this->modules_table . " + SET right_id = right_id + $diff + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND " . (int) $to_data['right_id'] . ' BETWEEN left_id AND right_id + AND ' . $this->db->sql_in_set('module_id', $moved_ids, true); + $this->db->sql_query($sql); + + // Resync the righthand side of the tree + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id + $diff, right_id = right_id + $diff + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND left_id > " . (int) $to_data['right_id'] . ' + AND ' . $this->db->sql_in_set('module_id', $moved_ids, true); + $this->db->sql_query($sql); + + // Resync moved branch + $to_data['right_id'] += $diff; + if ($to_data['right_id'] > $from_data['right_id']) + { + $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); + } + else + { + $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); + } + } + else + { + $sql = 'SELECT MAX(right_id) AS right_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND " . $this->db->sql_in_set('module_id', $moved_ids, true); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $diff = '+ ' . (int) ($row['right_id'] - $from_data['left_id'] + 1); + } + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id $diff, right_id = right_id $diff + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND " . $this->db->sql_in_set('module_id', $moved_ids); + $this->db->sql_query($sql); + } + + /** + * Remove module from tree + * + * @param int $module_id ID of the module to delete + * @param string $module_class Class of the module (acp, ucp, mcp etc...) + * + * @throws \phpbb\module\exception\module_exception When the specified module cannot be removed + */ + public function delete_module($module_id, $module_class) + { + $module_id = (int) $module_id; + + $row = $this->get_module_row($module_id, $module_class); + + $branch = $this->get_module_branch($module_id, $module_class, 'children', false); + + if (sizeof($branch)) + { + throw new module_exception('CANNOT_REMOVE_MODULE'); + } + + // If not move + $diff = 2; + $sql = 'DELETE FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND module_id = $module_id"; + $this->db->sql_query($sql); + + $row['right_id'] = (int) $row['right_id']; + $row['left_id'] = (int) $row['left_id']; + + // Resync tree + $sql = 'UPDATE ' . $this->modules_table . " + SET right_id = right_id - $diff + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND left_id < {$row['right_id']} AND right_id > {$row['right_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id - $diff, right_id = right_id - $diff + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND left_id > {$row['right_id']}"; + $this->db->sql_query($sql); + } + + /** + * Move module position by $steps up/down + * + * @param array $module_row Array of module data + * @param string $module_class Class of the module (acp, ucp, mcp etc...) + * @param string $action Direction of moving (valid values: move_up or move_down) + * @param int $steps Number of steps to move module + * + * @return string Returns the language name of the module + * + * @throws \phpbb\module\exception\module_not_found_exception When the specified module does not exists + */ + public function move_module_by($module_row, $module_class, $action = 'move_up', $steps = 1) + { + /** + * Fetch all the siblings between the module's current spot + * and where we want to move it to. If there are less than $steps + * siblings between the current spot and the target then the + * module will move as far as possible + */ + $sql = 'SELECT module_id, left_id, right_id, module_langname + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND parent_id = " . (int) $module_row['parent_id'] . ' + AND ' . (($action == 'move_up') ? 'right_id < ' . (int) $module_row['right_id'] . ' ORDER BY right_id DESC' : 'left_id > ' . (int) $module_row['left_id'] . ' ORDER BY left_id ASC'); + $result = $this->db->sql_query_limit($sql, $steps); + + $target = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $target = $row; + } + $this->db->sql_freeresult($result); + + if (!sizeof($target)) + { + // The module is already on top or bottom + throw new module_not_found_exception(); + } + + /** + * $left_id and $right_id define the scope of the nodes that are affected by the move. + * $diff_up and $diff_down are the values to substract or add to each node's left_id + * and right_id in order to move them up or down. + * $move_up_left and $move_up_right define the scope of the nodes that are moving + * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. + */ + if ($action == 'move_up') + { + $left_id = (int) $target['left_id']; + $right_id = (int) $module_row['right_id']; + + $diff_up = (int) ($module_row['left_id'] - $target['left_id']); + $diff_down = (int) ($module_row['right_id'] + 1 - $module_row['left_id']); + + $move_up_left = (int) $module_row['left_id']; + $move_up_right = (int) $module_row['right_id']; + } + else + { + $left_id = (int) $module_row['left_id']; + $right_id = (int) $target['right_id']; + + $diff_up = (int) ($module_row['right_id'] + 1 - $module_row['left_id']); + $diff_down = (int) ($target['right_id'] - $module_row['right_id']); + + $move_up_left = (int) ($module_row['right_id'] + 1); + $move_up_right = (int) $target['right_id']; + } + + // Now do the dirty job + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id + CASE + WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} + ELSE {$diff_down} + END, + right_id = right_id + CASE + WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} + ELSE {$diff_down} + END + WHERE module_class = '" . $this->db->sql_escape($module_class) . "' + AND left_id BETWEEN {$left_id} AND {$right_id} + AND right_id BETWEEN {$left_id} AND {$right_id}"; + $this->db->sql_query($sql); + + $this->remove_cache_file($module_class); + + return $target['module_langname']; + } +} diff --git a/phpBB/phpbb/notification/exception.php b/phpBB/phpbb/notification/exception.php index 6bdded3fd8..e416438061 100644 --- a/phpBB/phpbb/notification/exception.php +++ b/phpBB/phpbb/notification/exception.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,13 +15,8 @@ namespace phpbb\notification; /** * Notifications exception -* -* @package notifications */ -class exception extends \Exception + +class exception extends \phpbb\exception\runtime_exception { - public function __toString() - { - return $this->getMessage(); - } } diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 2e8652771b..ea1b800dc5 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -1,17 +1,22 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\notification; +use Symfony\Component\DependencyInjection\ContainerInterface; + /** * Notifications service class -* @package notifications */ class manager { @@ -19,39 +24,36 @@ class manager protected $notification_types; /** @var array */ + protected $subscription_types; + + /** @var method\method_interface[] */ protected $notification_methods; - /** @var ContainerBuilder */ + /** @var ContainerInterface */ protected $phpbb_container; /** @var \phpbb\user_loader */ protected $user_loader; - /** @var \phpbb\config\config */ - protected $config; + /** @var \phpbb\event\dispatcher_interface */ + protected $phpbb_dispatcher; - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var \phpbb\cache\service */ protected $cache; + /** @var \phpbb\language\language */ + protected $language; + /** @var \phpbb\user */ protected $user; /** @var string */ - protected $phpbb_root_path; - - /** @var string */ - protected $php_ext; - - /** @var string */ protected $notification_types_table; /** @var string */ - protected $notifications_table; - - /** @var string */ protected $user_notifications_table; /** @@ -59,41 +61,39 @@ class manager * * @param array $notification_types * @param array $notification_methods - * @param ContainerBuilder $phpbb_container + * @param ContainerInterface $phpbb_container * @param \phpbb\user_loader $user_loader - * @param \phpbb\config\config $config - * @param \phpbb\db\driver\driver $db + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\service $cache + * @param \phpbb\language\language $language * @param \phpbb\user $user - * @param string $phpbb_root_path - * @param string $php_ext * @param string $notification_types_table - * @param string $notifications_table * @param string $user_notifications_table + * * @return \phpbb\notification\manager */ - public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) + public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\language\language $language, \phpbb\user $user, $notification_types_table, $user_notifications_table) { $this->notification_types = $notification_types; $this->notification_methods = $notification_methods; $this->phpbb_container = $phpbb_container; $this->user_loader = $user_loader; - $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->db = $db; $this->cache = $cache; + $this->language = $language; $this->user = $user; - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; - $this->notification_types_table = $notification_types_table; - $this->notifications_table = $notifications_table; $this->user_notifications_table = $user_notifications_table; } /** - * Load the user's notifications + * Load the user's notifications for a given method * + * @param string $method_name * @param array $options Optional options to control what notifications are loaded * notification_id Notification id to load (or array of notification ids) * user_id User id to load notifications for (Default: $user->data['user_id']) @@ -108,27 +108,21 @@ class manager * 'notifications' array of notification type objects * 'unread_count' number of unread notifications the user has if count_unread is true in the options * 'total_count' number of notifications the user has if count_total is true in the options + * @throws \phpbb\notification\exception when the method doesn't refer to a class extending \phpbb\notification\method\method_interface */ - public function load_notifications(array $options = array()) + public function load_notifications($method_name, array $options = array()) { - // Merge default options - $options = array_merge(array( - 'notification_id' => false, - 'user_id' => $this->user->data['user_id'], - 'order_by' => 'notification_time', - 'order_dir' => 'DESC', - 'limit' => 0, - 'start' => 0, - 'all_unread' => false, - 'count_unread' => false, - 'count_total' => false, - ), $options); + $method = $this->get_method_class($method_name); - // If all_unread, count_unread must be true - $options['count_unread'] = ($options['all_unread']) ? true : $options['count_unread']; - - // Anonymous users and bots never receive notifications - if ($options['user_id'] == $this->user->data['user_id'] && ($this->user->data['user_id'] == ANONYMOUS || $this->user->data['user_type'] == USER_IGNORE)) + if (! $method instanceof \phpbb\notification\method\method_interface) + { + throw new \phpbb\notification\exception($this->language->lang('NOTIFICATION_METHOD_INVALID', $method_name)); + } + else if ($method->is_available()) + { + return $method->load_notifications($options); + } + else { return array( 'notifications' => array(), @@ -136,172 +130,112 @@ class manager 'total_count' => 0, ); } + } - $notifications = $user_ids = array(); - $load_special = array(); - $total_count = $unread_count = 0; + /** + * Mark notifications read or unread for all available methods + * + * @param bool|string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types). False to mark read for all item types + * @param bool|int|array $item_id Item id or array of item ids. False to mark read for all item ids + * @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids + * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * + * @deprecated since 3.2 + */ + public function mark_notifications_read($notification_type_name, $item_id, $user_id, $time = false) + { + $this->mark_notifications($notification_type_name, $item_id, $user_id, $time); + } - if ($options['count_unread']) + /** + * Mark notifications read or unread for all available methods + * + * @param bool|string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types). False to mark read for all item types + * @param bool|int|array $item_id Item id or array of item ids. False to mark read for all item ids + * @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids + * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * @param bool $mark_read Define if the notification as to be set to True or False. (Default: True) + */ + public function mark_notifications($notification_type_name, $item_id, $user_id, $time = false, $mark_read = true) + { + if (is_array($notification_type_name)) { - // Get the total number of unread notifications - $sql = 'SELECT COUNT(n.notification_id) AS unread_count - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.user_id = ' . (int) $options['user_id'] . ' - AND n.notification_read = 0 - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1'; - $result = $this->db->sql_query($sql); - $unread_count = (int) $this->db->sql_fetchfield('unread_count'); - $this->db->sql_freeresult($result); + $notification_type_id = $this->get_notification_type_ids($notification_type_name); } - - if ($options['count_total']) + else if ($notification_type_name !== false) { - // Get the total number of notifications - $sql = 'SELECT COUNT(n.notification_id) AS total_count - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.user_id = ' . (int) $options['user_id'] . ' - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1'; - $result = $this->db->sql_query($sql); - $total_count = (int) $this->db->sql_fetchfield('total_count'); - $this->db->sql_freeresult($result); + $notification_type_id = $this->get_notification_type_id($notification_type_name); } - - if (!$options['count_total'] || $total_count) + else { - $rowset = array(); - - // Get the main notifications - $sql = 'SELECT n.*, nt.notification_type_name - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.user_id = ' . (int) $options['user_id'] . - (($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : ' AND n.notification_id = ' . (int) $options['notification_id']) : '') . ' - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1 - ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); - $result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']); - - while ($row = $this->db->sql_fetchrow($result)) - { - $rowset[$row['notification_id']] = $row; - } - $this->db->sql_freeresult($result); - - // Get all unread notifications - if ($unread_count && $options['all_unread'] && !empty($rowset)) - { - $sql = 'SELECT n.*, nt.notification_type_name - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.user_id = ' . (int) $options['user_id'] . ' - AND n.notification_read = 0 - AND ' . $this->db->sql_in_set('n.notification_id', array_keys($rowset), true) . ' - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1 - ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); - $result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']); - - while ($row = $this->db->sql_fetchrow($result)) - { - $rowset[$row['notification_id']] = $row; - } - $this->db->sql_freeresult($result); - } - - foreach ($rowset as $row) - { - $notification = $this->get_item_type_class($row['notification_type_name'], $row); - - // Array of user_ids to query all at once - $user_ids = array_merge($user_ids, $notification->users_to_query()); - - // Some notification types also require querying additional tables themselves - if (!isset($load_special[$row['notification_type_name']])) - { - $load_special[$row['notification_type_name']] = array(); - } - $load_special[$row['notification_type_name']] = array_merge($load_special[$row['notification_type_name']], $notification->get_load_special()); - - $notifications[$row['notification_id']] = $notification; - } - - $this->user_loader->load_users($user_ids); - - // Allow each type to load its own special items - foreach ($load_special as $item_type => $data) - { - $item_class = $this->get_item_type_class($item_type); - - $item_class->load_special($data, $notifications); - } + $notification_type_id = false; } - return array( - 'notifications' => $notifications, - 'unread_count' => $unread_count, - 'total_count' => $total_count, - ); + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method) + { + $method->mark_notifications($notification_type_id, $item_id, $user_id, $time, $mark_read); + } } /** - * Mark notifications read - * - * @param bool|string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types). False to mark read for all item types - * @param bool|int|array $item_id Item id or array of item ids. False to mark read for all item ids - * @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids - * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) - */ - public function mark_notifications_read($notification_type_name, $item_id, $user_id, $time = false) + * Mark notifications read or unread from a parent identifier for all available methods + * + * @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types) + * @param bool|int|array $item_parent_id Item parent id or array of item parent ids. False to mark read for all item parent ids + * @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids + * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * + * @deprecated since 3.2 + */ + public function mark_notifications_read_by_parent($notification_type_name, $item_parent_id, $user_id, $time = false) { - $time = ($time !== false) ? $time : time(); - - $sql = 'UPDATE ' . $this->notifications_table . " - SET notification_read = 1 - WHERE notification_time <= " . (int) $time . - (($notification_type_name !== false) ? ' AND ' . - (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') . - (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') . - (($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : ''); - $this->db->sql_query($sql); + $this->mark_notifications_by_parent($notification_type_name, $item_parent_id, $user_id, $time); } /** - * Mark notifications read from a parent identifier + * Mark notifications read or unread from a parent identifier for all available methods * * @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types) * @param bool|int|array $item_parent_id Item parent id or array of item parent ids. False to mark read for all item parent ids * @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * @param bool $mark_read Define if the notification as to be set to True or False. (Default: True) */ - public function mark_notifications_read_by_parent($notification_type_name, $item_parent_id, $user_id, $time = false) + public function mark_notifications_by_parent($notification_type_name, $item_parent_id, $user_id, $time = false, $mark_read = true) { - $time = ($time !== false) ? $time : time(); - - $sql = 'UPDATE ' . $this->notifications_table . " - SET notification_read = 1 - WHERE notification_time <= " . (int) $time . - (($notification_type_name !== false) ? ' AND ' . - (is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name)) : '') . - (($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id) : 'item_parent_id = ' . (int) $item_parent_id) : '') . - (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : ''); - $this->db->sql_query($sql); + if (is_array($notification_type_name)) + { + $notification_type_id = $this->get_notification_type_ids($notification_type_name); + } + else + { + $notification_type_id = $this->get_notification_type_id($notification_type_name); + } + + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method) + { + $method->mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time, $mark_read); + } } /** - * Mark notifications read + * Mark notifications read or unread for a given method * + * @param string $method_name * @param int|array $notification_id Notification id or array of notification ids. * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * @param bool $mark_read Define if the notification as to be set to True or False. (Default: True) */ - public function mark_notifications_read_by_id($notification_id, $time = false) + public function mark_notifications_by_id($method_name, $notification_id, $time = false, $mark_read = true) { - $time = ($time !== false) ? $time : time(); + $method = $this->get_method_class($method_name); - $sql = 'UPDATE ' . $this->notifications_table . " - SET notification_read = 1 - WHERE notification_time <= " . (int) $time . ' - AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id); - $this->db->sql_query($sql); + if ($method instanceof \phpbb\notification\method\method_interface && $method->is_available()) + { + $method->mark_notifications_by_id($notification_id, $time, $mark_read); + } } /** @@ -335,11 +269,29 @@ class manager return $notified_users; } - $item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data); - // find out which users want to receive this type of notification $notify_users = $this->get_item_type_class($notification_type_name)->find_users_for_notification($data, $options); + /** + * Allow filtering the notify_users array for a notification that is about to be sent. + * Here, $notify_users is already filtered by f_read and the ignored list included in the options variable + * + * @event core.notification_manager_add_notifications + * @var string notification_type_name The forum id from where the topic belongs + * @var array data Data specific for the notification_type_name used will be inserted + * @var array notify_users The array of userid that are going to be notified for this notification. Set to array() to cancel. + * @var array options The options that were used when this method was called (read only) + * + * @since 3.1.3-RC1 + */ + $vars = array( + 'notification_type_name', + 'data', + 'notify_users', + 'options', + ); + extract($this->phpbb_dispatcher->trigger_event('core.notification_manager_add_notifications', compact($vars))); + $this->add_notifications_for_users($notification_type_name, $data, $notify_users); return $notify_users; @@ -369,25 +321,23 @@ class manager $item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data); $user_ids = array(); - $notification_objects = $notification_methods = array(); + $notification_methods = array(); // Never send notifications to the anonymous user! unset($notify_users[ANONYMOUS]); // Make sure not to send new notifications to users who've already been notified about this item // This may happen when an item was added, but now new users are able to see the item - $sql = 'SELECT n.user_id - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.notification_type_id = ' . (int) $notification_type_id . ' - AND n.item_id = ' . (int) $item_id . ' - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1'; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) + // We remove each user which was already notified by at least one method. + /** @var method\method_interface $method */ + foreach ($this->get_subscription_methods_instances() as $method) { - unset($notify_users[$row['user_id']]); + $notified_users = $method->get_notified_users($notification_type_id, array('item_id' => $item_id)); + foreach ($notified_users as $user => $notifications) + { + unset($notify_users[$user]); + } } - $this->db->sql_freeresult($result); if (!sizeof($notify_users)) { @@ -399,8 +349,6 @@ class manager $pre_create_data = $notification->pre_create_insert_array($data, $notify_users); unset($notification); - $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->notifications_table); - // Go through each user so we can insert a row in the DB and then notify them by their desired means foreach ($notify_users as $user => $methods) { @@ -408,8 +356,8 @@ class manager $notification->user_id = (int) $user; - // Insert notification row using buffer. - $insert_buffer->insert($notification->create_insert_array($data, $pre_create_data)); + // Generate the insert_array + $notification->create_insert_array($data, $pre_create_data); // Users are needed to send notifications $user_ids = array_merge($user_ids, $notification->users_to_query()); @@ -417,20 +365,15 @@ class manager foreach ($methods as $method) { // setup the notification methods and add the notification to the queue - if ($method) // blank means we just insert it as a notification, but do not notify them by any other means + if (!isset($notification_methods[$method])) { - if (!isset($notification_methods[$method])) - { - $notification_methods[$method] = $this->get_method_class($method); - } - - $notification_methods[$method]->add_to_queue($notification); + $notification_methods[$method] = $this->get_method_class($method); } + + $notification_methods[$method]->add_to_queue($notification); } } - $insert_buffer->flush(); - // We need to load all of the users to send notifications $this->user_loader->load_users($user_ids); @@ -442,12 +385,13 @@ class manager } /** - * Update a notification + * Update notification * * @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types) * @param array $data Data specific for this type that will be updated + * @param array $options */ - public function update_notifications($notification_type_name, $data) + public function update_notifications($notification_type_name, array $data, array $options = array()) { if (is_array($notification_type_name)) { @@ -459,27 +403,28 @@ class manager return; } - $notification = $this->get_item_type_class($notification_type_name); + $this->update_notification($this->get_item_type_class($notification_type_name), $data, $options); + } - // Allow the notifications class to over-ride the update_notifications functionality - if (method_exists($notification, 'update_notifications')) + /** + * Update a notification + * + * @param \phpbb\notification\type\type_interface $notification The notification + * @param array $data Data specific for this type that will be updated + * @param array $options + */ + public function update_notification(\phpbb\notification\type\type_interface $notification, array $data, array $options = array()) + { + if (empty($options)) { - // Return False to over-ride the rest of the update - if ($notification->update_notifications($data) === false) - { - return; - } + $options['item_id'] = $notification->get_item_id($data); } - $notification_type_id = $this->get_notification_type_id($notification_type_name); - $item_id = $notification->get_item_id($data); - $update_array = $notification->create_update_array($data); - - $sql = 'UPDATE ' . $this->notifications_table . ' - SET ' . $this->db->sql_build_array('UPDATE', $update_array) . ' - WHERE notification_type_id = ' . (int) $notification_type_id . ' - AND item_id = ' . (int) $item_id; - $this->db->sql_query($sql); + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method) + { + $method->update_notification($notification, $data, $options); + } } /** @@ -488,14 +433,15 @@ class manager * @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $item_id is identical for the specified types) * @param int|array $item_id Identifier within the type (or array of ids) * @param mixed $parent_id Parent identifier within the type (or array of ids), used in combination with item_id if specified (Default: false; not checked) + * @param mixed $user_id User id (Default: false; not checked) */ - public function delete_notifications($notification_type_name, $item_id, $parent_id = false) + public function delete_notifications($notification_type_name, $item_id, $parent_id = false, $user_id = false) { if (is_array($notification_type_name)) { foreach ($notification_type_name as $type) { - $this->delete_notifications($type, $item_id, $parent_id); + $this->delete_notifications($type, $item_id, $parent_id, $user_id); } return; @@ -503,11 +449,11 @@ class manager $notification_type_id = $this->get_notification_type_id($notification_type_name); - $sql = 'DELETE FROM ' . $this->notifications_table . ' - WHERE notification_type_id = ' . (int) $notification_type_id . ' - AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) . - (($parent_id !== false) ? ' AND ' . ((is_array($parent_id) ? $this->db->sql_in_set('item_parent_id', $parent_id) : 'item_parent_id = ' . (int) $parent_id)) : ''); - $this->db->sql_query($sql); + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method) + { + $method->delete_notifications($notification_type_id, $item_id, $parent_id, $user_id); + } } /** @@ -517,33 +463,37 @@ class manager */ public function get_subscription_types() { - $subscription_types = array(); - - foreach ($this->notification_types as $type_name => $data) + if ($this->subscription_types === null) { - $type = $this->get_item_type_class($type_name); + $this->subscription_types = array(); - if ($type instanceof \phpbb\notification\type\type_interface && $type->is_available()) + foreach ($this->notification_types as $type_name => $data) { - $options = array_merge(array( - 'id' => $type->get_type(), - 'lang' => 'NOTIFICATION_TYPE_' . strtoupper($type->get_type()), - 'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS', - ), (($type::$notification_option !== false) ? $type::$notification_option : array())); + /** @var type\base $type */ + $type = $this->get_item_type_class($type_name); + + if ($type instanceof \phpbb\notification\type\type_interface && $type->is_available()) + { + $options = array_merge(array( + 'id' => $type->get_type(), + 'lang' => 'NOTIFICATION_TYPE_' . strtoupper($type->get_type()), + 'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS', + ), (($type::$notification_option !== false) ? $type::$notification_option : array())); - $subscription_types[$options['group']][$options['id']] = $options; + $this->subscription_types[$options['group']][$options['id']] = $options; + } } - } - // Move Miscellaneous to the very last section - if (isset($subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS'])) - { - $miscellaneous = $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']; - unset($subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']); - $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS'] = $miscellaneous; + // Move Miscellaneous to the very last section + if (isset($this->subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS'])) + { + $miscellaneous = $this->subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']; + unset($this->subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']); + $this->subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS'] = $miscellaneous; + } } - return $subscription_types; + return $this->subscription_types; } /** @@ -555,22 +505,89 @@ class manager { $subscription_methods = array(); + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method_name => $method) + { + $subscription_methods[$method_name] = array( + 'id' => $method->get_type(), + 'lang' => str_replace('.', '_', strtoupper($method->get_type())), + ); + } + + return $subscription_methods; + } + + /** + * Get all of the subscription methods + * + * @return array Array of method's instances + */ + private function get_subscription_methods_instances() + { + $subscription_methods = array(); + foreach ($this->notification_methods as $method_name => $data) { $method = $this->get_method_class($method_name); - if ($method instanceof \phpbb\notification\method\method_interface && $method->is_available()) + if ($method instanceof \phpbb\notification\method\method_interface) + { + $subscription_methods[$method_name] = $method; + } + } + + return $subscription_methods; + } + + /** + * Get all of the available subscription methods + * + * @return array Array of method's instances + */ + private function get_available_subscription_methods() + { + $subscription_methods = array(); + + /** @var method\method_interface $method */ + foreach ($this->get_subscription_methods_instances() as $method_name => $method) + { + if ($method->is_available()) { - $subscription_methods[$method_name] = array( - 'id' => $method->get_type(), - 'lang' => 'NOTIFICATION_METHOD_' . strtoupper($method->get_type()), - ); + $subscription_methods[$method_name] = $method; } } return $subscription_methods; } + + /** + * Get user's notification data + * + * @param int $user_id The user_id of the user to get the notifications for + * + * @return array User's notification + */ + protected function get_user_notifications($user_id) + { + $sql = 'SELECT method, notify, item_type + FROM ' . $this->user_notifications_table . ' + WHERE user_id = ' . (int) $user_id . ' + AND item_id = 0'; + + $result = $this->db->sql_query($sql); + $user_notifications = array(); + + while ($row = $this->db->sql_fetchrow($result)) + { + $user_notifications[$row['item_type']][] = $row; + } + + $this->db->sql_freeresult($result); + + return $user_notifications; + } + /** * Get global subscriptions (item_id = 0) * @@ -580,47 +597,43 @@ class manager */ public function get_global_subscriptions($user_id = false) { - $user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id; + $user_id = $user_id ?: $this->user->data['user_id']; $subscriptions = array(); + $default_methods = $this->get_default_methods(); + + $user_notifications = $this->get_user_notifications($user_id); - foreach ($this->get_subscription_types() as $group_name => $types) + foreach ($this->get_subscription_types() as $types) { foreach ($types as $id => $type) { - $sql = 'SELECT method, notify - FROM ' . $this->user_notifications_table . ' - WHERE user_id = ' . (int) $user_id . " - AND item_type = '" . $this->db->sql_escape($id) . "' - AND item_id = 0"; - $result = $this->db->sql_query($sql); - - $row = $this->db->sql_fetchrow($result); - if (!$row) + $type_subscriptions = $default_methods; + if (!empty($user_notifications[$id])) { - // No rows at all, default to '' - $subscriptions[$id] = array(''); - } - else - { - do + foreach ($user_notifications[$id] as $user_notification) { - if (!$row['notify']) + $key = array_search($user_notification['method'], $type_subscriptions, true); + if (!$user_notification['notify']) { + if ($key !== false) + { + unset($type_subscriptions[$key]); + } + continue; } - - if (!isset($subscriptions[$id])) + else if ($key === false) { - $subscriptions[$id] = array(); + $type_subscriptions[] = $user_notification['method']; } - - $subscriptions[$id][] = $row['method']; } - while ($row = $this->db->sql_fetchrow($result)); } - $this->db->sql_freeresult($result); + if (!empty($type_subscriptions)) + { + $subscriptions[$id] = $type_subscriptions; + } } } @@ -632,15 +645,20 @@ class manager * * @param string $item_type Type identifier of the subscription * @param int $item_id The id of the item - * @param string $method The method of the notification e.g. '', 'email', or 'jabber' + * @param string $method The method of the notification e.g. 'board', 'email', or 'jabber' + * (if null a subscription will be added for all the defaults methods) * @param bool|int $user_id The user_id to add the subscription for (bool false for current user) */ - public function add_subscription($item_type, $item_id = 0, $method = '', $user_id = false) + public function add_subscription($item_type, $item_id = 0, $method = null, $user_id = false) { - if ($method !== '') + if ($method === null) { - // Make sure to subscribe them to the base subscription - $this->add_subscription($item_type, $item_id, '', $user_id); + foreach ($this->get_default_methods() as $method_name) + { + $this->add_subscription($item_type, $item_id, $method_name, $user_id); + } + + return; } $user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id; @@ -684,33 +702,23 @@ class manager * * @param string $item_type Type identifier of the subscription * @param int $item_id The id of the item - * @param string $method The method of the notification e.g. '', 'email', or 'jabber' + * @param string $method The method of the notification e.g. 'board', 'email', or 'jabber' * @param bool|int $user_id The user_id to add the subscription for (bool false for current user) */ - public function delete_subscription($item_type, $item_id = 0, $method = '', $user_id = false) + public function delete_subscription($item_type, $item_id = 0, $method = null, $user_id = false) { - $user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id; - - // If no method, make sure that no other notification methods for this item are selected before deleting - if ($method === '') + if ($method === null) { - $sql = 'SELECT COUNT(*) as num_notifications - FROM ' . $this->user_notifications_table . " - WHERE item_type = '" . $this->db->sql_escape($item_type) . "' - AND item_id = " . (int) $item_id . ' - AND user_id = ' .(int) $user_id . " - AND method <> '' - AND notify = 1"; - $this->db->sql_query($sql); - $num_notifications = $this->db->sql_fetchfield('num_notifications'); - $this->db->sql_freeresult(); - - if ($num_notifications) + foreach ($this->get_default_methods() as $method_name) { - return; + $this->delete_subscription($item_type, $item_id, $method_name, $user_id); } + + return; } + $user_id = $user_id ?: $this->user->data['user_id']; + $sql = 'UPDATE ' . $this->user_notifications_table . " SET notify = 0 WHERE item_type = '" . $this->db->sql_escape($item_type) . "' @@ -760,17 +768,27 @@ class manager */ public function purge_notifications($notification_type_name) { - $notification_type_id = $this->get_notification_type_id($notification_type_name); - - $sql = 'DELETE FROM ' . $this->notifications_table . ' - WHERE notification_type_id = ' . (int) $notification_type_id; - $this->db->sql_query($sql); + // If a notification is never used, its type will not be added to the database + // nor its id cached. If this method is called by an extension during the + // purge step, and that extension never used its notifications, + // get_notification_type_id() will throw an exception. However, + // because no notification type was added to the database, + // there is nothing to delete, so we can silently drop the exception. + try + { + $notification_type_id = $this->get_notification_type_id($notification_type_name); - $sql = 'DELETE FROM ' . $this->notification_types_table . ' - WHERE notification_type_id = ' . (int) $notification_type_id; - $this->db->sql_query($sql); + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method) + { + $method->purge_notifications($notification_type_id); + } - $this->cache->destroy('notification_type_ids'); + } + catch (\phpbb\notification\exception $e) + { + // Continue + } } /** @@ -794,25 +812,46 @@ class manager * Delete all notifications older than a certain time * * @param int $timestamp Unix timestamp to delete all notifications that were created before - * @param bool $only_unread True (default) to only prune read notifications + * @param bool $only_read True (default) to only prune read notifications */ public function prune_notifications($timestamp, $only_read = true) { - $sql = 'DELETE FROM ' . $this->notifications_table . ' - WHERE notification_time < ' . (int) $timestamp . - (($only_read) ? ' AND notification_read = 1' : ''); - $this->db->sql_query($sql); + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method) + { + $method->prune_notifications($timestamp, $only_read); + } + } - $this->config->set('read_notification_last_gc', time(), false); + /** + * Helper to get the list of methods enabled by default + * + * @return method\method_interface[] + */ + public function get_default_methods() + { + $default_methods = array(); + + foreach ($this->notification_methods as $method) + { + if ($method->is_enabled_by_default() && $method->is_available()) + { + $default_methods[] = $method->get_type(); + } + } + + return $default_methods; } /** - * Helper to get the notifications item type class and set it up - */ + * Helper to get the notifications item type class and set it up + * + * @param string $notification_type_name + * @param array $data + * @return type\type_interface + */ public function get_item_type_class($notification_type_name, $data = array()) { - $notification_type_name = (strpos($notification_type_name, 'notification.type.') === 0) ? $notification_type_name : 'notification.type.' . $notification_type_name; - $item = $this->load_object($notification_type_name); $item->set_initial_data($data); @@ -821,18 +860,22 @@ class manager } /** - * Helper to get the notifications method class and set it up - */ + * Helper to get the notifications method class and set it up + * + * @param string $method_name + * @return method\method_interface + */ public function get_method_class($method_name) { - $method_name = (strpos($method_name, 'notification.method.') === 0) ? $method_name : 'notification.method.' . $method_name; - return $this->load_object($method_name); } /** - * Helper to load objects (notification types/methods) - */ + * Helper to load objects (notification types/methods) + * + * @param string $object_name + * @return method\method_interface|type\type_interface + */ protected function load_object($object_name) { $object = $this->phpbb_container->get($object_name); @@ -850,6 +893,7 @@ class manager * * @param string $notification_type_name The name * @return int the notification_type_id + * @throws \phpbb\notification\exception */ public function get_notification_type_id($notification_type_name) { @@ -875,7 +919,7 @@ class manager { if (!isset($this->notification_types[$notification_type_name]) && !isset($this->notification_types['notification.type.' . $notification_type_name])) { - throw new \phpbb\notification\exception($this->user->lang('NOTIFICATION_TYPE_NOT_EXIST', $notification_type_name)); + throw new \phpbb\notification\exception('NOTIFICATION_TYPE_NOT_EXIST', array($notification_type_name)); } $sql = 'INSERT INTO ' . $this->notification_types_table . ' ' . $this->db->sql_build_array('INSERT', array( @@ -909,4 +953,26 @@ class manager return $notification_type_ids; } + + /** + * Find the users which are already notified + * + * @param bool|string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types). False to retrieve all item types + * @param array $options + * @return array The list of the notified users + */ + public function get_notified_users($notification_type_name, array $options) + { + $notification_type_id = $this->get_notification_type_id($notification_type_name); + + $notified_users = array(); + + /** @var method\method_interface $method */ + foreach ($this->get_available_subscription_methods() as $method) + { + $notified_users = $notified_users + $method->get_notified_users($notification_type_id, $options); + } + + return $notified_users; + } } diff --git a/phpBB/phpbb/notification/method/base.php b/phpBB/phpbb/notification/method/base.php index 4ce42de830..4a183ca508 100644 --- a/phpBB/phpbb/notification/method/base.php +++ b/phpBB/phpbb/notification/method/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,43 +15,12 @@ namespace phpbb\notification\method; /** * Base notifications method class -* @package notifications */ abstract class base implements \phpbb\notification\method\method_interface { /** @var \phpbb\notification\manager */ protected $notification_manager; - /** @var \phpbb\user_loader */ - protected $user_loader; - - /** @var \phpbb\db\driver\driver */ - protected $db; - - /** @var \phpbb\cache\driver\driver_interface */ - protected $cache; - - /** @var \phpbb\template\template */ - protected $template; - - /** @var \phpbb\extension\manager */ - protected $extension_manager; - - /** @var \phpbb\user */ - protected $user; - - /** @var \phpbb\auth\auth */ - protected $auth; - - /** @var \phpbb\config\config */ - protected $config; - - /** @var string */ - protected $phpbb_root_path; - - /** @var string */ - protected $php_ext; - /** * Queue of messages to be sent * @@ -56,38 +29,43 @@ abstract class base implements \phpbb\notification\method\method_interface protected $queue = array(); /** - * Notification Method Base Constructor - * - * @param \phpbb\user_loader $user_loader - * @param \phpbb\db\driver\driver $db - * @param \phpbb\cache\driver\driver_interface $cache - * @param \phpbb\user $user - * @param \phpbb\auth\auth $auth - * @param \phpbb\config\config $config - * @param string $phpbb_root_path - * @param string $php_ext - * @return \phpbb\notification\method\base + * Set notification manager (required) + * + * @param \phpbb\notification\manager $notification_manager + */ + public function set_notification_manager(\phpbb\notification\manager $notification_manager) + { + $this->notification_manager = $notification_manager; + } + + /** + * Is the method enable by default? + * + * @return bool */ - public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext) + public function is_enabled_by_default() { - $this->user_loader = $user_loader; - $this->db = $db; - $this->cache = $cache; - $this->user = $user; - $this->auth = $auth; - $this->config = $config; - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; + return false; } /** - * Set notification manager (required) - * - * @param \phpbb\notification\manager $notification_manager + * {@inheritdoc} */ - public function set_notification_manager(\phpbb\notification\manager $notification_manager) + public function get_notified_users($notification_type_id, array $options) { - $this->notification_manager = $notification_manager; + return array(); + } + + /** + * {@inheritdoc} + */ + public function load_notifications(array $options = array()) + { + return array( + 'notifications' => array(), + 'unread_count' => 0, + 'total_count' => 0, + ); } /** @@ -101,6 +79,55 @@ abstract class base implements \phpbb\notification\method\method_interface } /** + * {@inheritdoc} + */ + public function update_notification($notification, array $data, array $options) + { + } + + /** + * {@inheritdoc + */ + public function mark_notifications($notification_type_id, $item_id, $user_id, $time = false, $mark_read = true) + { + } + + /** + * {@inheritdoc} + */ + public function mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time = false, $mark_read = true) + { + } + + /** + * {@inheritdoc} + */ + public function mark_notifications_by_id($notification_id, $time = false, $mark_read = true) + { + } + + /** + * {@inheritdoc} + */ + public function delete_notifications($notification_type_id, $item_id, $parent_id = false, $user_id = false) + { + } + + /** + * {@inheritdoc} + */ + public function prune_notifications($timestamp, $only_read = true) + { + } + + /** + * {@inheritdoc} + */ + public function purge_notifications($notification_type_id) + { + } + + /** * Empty the queue */ protected function empty_queue() diff --git a/phpBB/phpbb/notification/method/board.php b/phpBB/phpbb/notification/method/board.php new file mode 100644 index 0000000000..931b252daa --- /dev/null +++ b/phpBB/phpbb/notification/method/board.php @@ -0,0 +1,399 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\method; + +/** +* In Board notification method class +* This class handles in board notifications. This method is enabled by default. +* +* @package notifications +*/ +class board extends \phpbb\notification\method\base +{ + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\cache\driver\driver_interface */ + protected $cache; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var string */ + protected $notification_types_table; + + /** @var string */ + protected $notifications_table; + + /** + * Notification Method Board Constructor + * + * @param \phpbb\user_loader $user_loader + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\driver\driver_interface $cache + * @param \phpbb\user $user + * @param \phpbb\config\config $config + * @param string $notification_types_table + * @param string $notifications_table + */ + public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\config\config $config, $notification_types_table, $notifications_table) + { + $this->user_loader = $user_loader; + $this->db = $db; + $this->cache = $cache; + $this->user = $user; + $this->config = $config; + $this->notification_types_table = $notification_types_table; + $this->notifications_table = $notifications_table; + + } + + /** + * {@inheritdoc} + */ + public function add_to_queue(\phpbb\notification\type\type_interface $notification) + { + $this->queue[] = $notification; + } + + /** + * {@inheritdoc} + */ + public function get_type() + { + return 'notification.method.board'; + } + + /** + * {@inheritdoc} + */ + public function is_available() + { + return $this->config['allow_board_notifications']; + } + + /** + * {@inheritdoc} + */ + public function is_enabled_by_default() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function get_notified_users($notification_type_id, array $options) + { + $notified_users = array(); + $sql = 'SELECT n.* + FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt + WHERE n.notification_type_id = ' . (int) $notification_type_id . + (isset($options['item_id']) ? ' AND n.item_id = ' . (int) $options['item_id'] : '') . + (isset($options['item_parent_id']) ? ' AND n.item_parent_id = ' . (int) $options['item_parent_id'] : '') . + (isset($options['user_id']) ? ' AND n.user_id = ' . (int) $options['user_id'] : '') . + (isset($options['read']) ? ' AND n.notification_read = ' . (int) $options['read'] : '') .' + AND nt.notification_type_id = n.notification_type_id + AND nt.notification_type_enabled = 1'; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $notified_users[$row['user_id']] = $row; + } + $this->db->sql_freeresult($result); + + return $notified_users; + } + + /** + * {@inheritdoc} + */ + public function load_notifications(array $options = array()) + { + // Merge default options + $options = array_merge(array( + 'notification_id' => false, + 'user_id' => $this->user->data['user_id'], + 'order_by' => 'notification_time', + 'order_dir' => 'DESC', + 'limit' => 0, + 'start' => 0, + 'all_unread' => false, + 'count_unread' => false, + 'count_total' => false, + ), $options); + + // If all_unread, count_unread must be true + $options['count_unread'] = ($options['all_unread']) ? true : $options['count_unread']; + + // Anonymous users and bots never receive notifications + if ($options['user_id'] == $this->user->data['user_id'] && ($this->user->data['user_id'] == ANONYMOUS || $this->user->data['user_type'] == USER_IGNORE)) + { + return array( + 'notifications' => array(), + 'unread_count' => 0, + 'total_count' => 0, + ); + } + + $notifications = $user_ids = array(); + $load_special = array(); + $total_count = $unread_count = 0; + + if ($options['count_unread']) + { + // Get the total number of unread notifications + $sql = 'SELECT COUNT(n.notification_id) AS unread_count + FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt + WHERE n.user_id = ' . (int) $options['user_id'] . ' + AND n.notification_read = 0 + AND nt.notification_type_id = n.notification_type_id + AND nt.notification_type_enabled = 1'; + $result = $this->db->sql_query($sql); + $unread_count = (int) $this->db->sql_fetchfield('unread_count'); + $this->db->sql_freeresult($result); + } + + if ($options['count_total']) + { + // Get the total number of notifications + $sql = 'SELECT COUNT(n.notification_id) AS total_count + FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt + WHERE n.user_id = ' . (int) $options['user_id'] . ' + AND nt.notification_type_id = n.notification_type_id + AND nt.notification_type_enabled = 1'; + $result = $this->db->sql_query($sql); + $total_count = (int) $this->db->sql_fetchfield('total_count'); + $this->db->sql_freeresult($result); + } + + if (!$options['count_total'] || $total_count) + { + $rowset = array(); + + // Get the main notifications + $sql = 'SELECT n.*, nt.notification_type_name + FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt + WHERE n.user_id = ' . (int) $options['user_id'] . + (($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : ' AND n.notification_id = ' . (int) $options['notification_id']) : '') . ' + AND nt.notification_type_id = n.notification_type_id + AND nt.notification_type_enabled = 1 + ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); + $result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']); + + while ($row = $this->db->sql_fetchrow($result)) + { + $rowset[$row['notification_id']] = $row; + } + $this->db->sql_freeresult($result); + + // Get all unread notifications + if ($unread_count && $options['all_unread'] && !empty($rowset)) + { + $sql = 'SELECT n.*, nt.notification_type_name + FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt + WHERE n.user_id = ' . (int) $options['user_id'] . ' + AND n.notification_read = 0 + AND ' . $this->db->sql_in_set('n.notification_id', array_keys($rowset), true) . ' + AND nt.notification_type_id = n.notification_type_id + AND nt.notification_type_enabled = 1 + ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']); + $result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']); + + while ($row = $this->db->sql_fetchrow($result)) + { + $rowset[$row['notification_id']] = $row; + } + $this->db->sql_freeresult($result); + } + + foreach ($rowset as $row) + { + $notification = $this->notification_manager->get_item_type_class($row['notification_type_name'], $row); + + // Array of user_ids to query all at once + $user_ids = array_merge($user_ids, $notification->users_to_query()); + + // Some notification types also require querying additional tables themselves + if (!isset($load_special[$row['notification_type_name']])) + { + $load_special[$row['notification_type_name']] = array(); + } + $load_special[$row['notification_type_name']] = array_merge($load_special[$row['notification_type_name']], $notification->get_load_special()); + + $notifications[$row['notification_id']] = $notification; + } + + $this->user_loader->load_users($user_ids); + + // Allow each type to load its own special items + foreach ($load_special as $item_type => $data) + { + $item_class = $this->notification_manager->get_item_type_class($item_type); + + $item_class->load_special($data, $notifications); + } + } + + return array( + 'notifications' => $notifications, + 'unread_count' => $unread_count, + 'total_count' => $total_count, + ); + } + + /** + * {@inheritdoc} + */ + public function notify() + { + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->notifications_table); + + /** @var \phpbb\notification\type\type_interface $notification */ + foreach ($this->queue as $notification) + { + $data = $notification->get_insert_array(); + $insert_buffer->insert($data); + } + + $insert_buffer->flush(); + + // We're done, empty the queue + $this->empty_queue(); + } + + /** + * {@inheritdoc} + */ + public function update_notification($notification, array $data, array $options) + { + // Allow the notifications class to over-ride the update_notifications functionality + if (method_exists($notification, 'update_notifications')) + { + // Return False to over-ride the rest of the update + if ($notification->update_notifications($data) === false) + { + return; + } + } + + $notification_type_id = $this->notification_manager->get_notification_type_id($notification->get_type()); + $update_array = $notification->create_update_array($data); + + $sql = 'UPDATE ' . $this->notifications_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $update_array) . ' + WHERE notification_type_id = ' . (int) $notification_type_id . + (isset($options['item_id']) ? ' AND item_id = ' . (int) $options['item_id'] : '') . + (isset($options['item_parent_id']) ? ' AND item_parent_id = ' . (int) $options['item_parent_id'] : '') . + (isset($options['user_id']) ? ' AND user_id = ' . (int) $options['user_id'] : '') . + (isset($options['read']) ? ' AND notification_read = ' . (int) $options['read'] : ''); + $this->db->sql_query($sql); + } + + /** + * {@inheritdoc} + */ + public function mark_notifications($notification_type_id, $item_id, $user_id, $time = false, $mark_read = true) + { + $time = ($time !== false) ? $time : time(); + + $sql = 'UPDATE ' . $this->notifications_table . ' + SET notification_read = ' . ($mark_read ? 1 : 0) . ' + WHERE notification_time <= ' . (int) $time . + (($notification_type_id !== false) ? ' AND ' . + (is_array($notification_type_id) ? $this->db->sql_in_set('notification_type_id', $notification_type_id) : 'notification_type_id = ' . $notification_type_id) : '') . + (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') . + (($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : ''); + $this->db->sql_query($sql); + } + + /** + * {@inheritdoc} + */ + public function mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time = false, $mark_read = true) + { + $time = ($time !== false) ? $time : time(); + + $sql = 'UPDATE ' . $this->notifications_table . ' + SET notification_read = ' . ($mark_read ? 1 : 0) . ' + WHERE notification_time <= ' . (int) $time . + (($notification_type_id !== false) ? ' AND ' . + (is_array($notification_type_id) ? $this->db->sql_in_set('notification_type_id', $notification_type_id) : 'notification_type_id = ' . $notification_type_id) : '') . + (($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id, false, true) : 'item_parent_id = ' . (int) $item_parent_id) : '') . + (($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : ''); + $this->db->sql_query($sql); + } + + /** + * {@inheritdoc} + */ + public function mark_notifications_by_id($notification_id, $time = false, $mark_read = true) + { + $time = ($time !== false) ? $time : time(); + + $sql = 'UPDATE ' . $this->notifications_table . ' + SET notification_read = ' . ($mark_read ? 1 : 0) . ' + WHERE notification_time <= ' . (int) $time . ' + AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id); + $this->db->sql_query($sql); + } + + /** + * {@inheritdoc} + */ + public function delete_notifications($notification_type_id, $item_id, $parent_id = false, $user_id = false) + { + $sql = 'DELETE FROM ' . $this->notifications_table . ' + WHERE notification_type_id = ' . (int) $notification_type_id . ' + AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) . + (($parent_id !== false) ? ' AND ' . ((is_array($parent_id) ? $this->db->sql_in_set('item_parent_id', $parent_id) : 'item_parent_id = ' . (int) $parent_id)) : '') . + (($user_id !== false) ? ' AND ' . ((is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id)) : ''); + $this->db->sql_query($sql); + } + + /** + * {@inheritdoc} + */ + public function prune_notifications($timestamp, $only_read = true) + { + $sql = 'DELETE FROM ' . $this->notifications_table . ' + WHERE notification_time < ' . (int) $timestamp . + (($only_read) ? ' AND notification_read = 1' : ''); + $this->db->sql_query($sql); + + $this->config->set('read_notification_last_gc', time(), false); + } + + /** + * {@inheritdoc} + */ + public function purge_notifications($notification_type_id) + { + $sql = 'DELETE FROM ' . $this->notifications_table . ' + WHERE notification_type_id = ' . (int) $notification_type_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . $this->notification_types_table . ' + WHERE notification_type_id = ' . (int) $notification_type_id; + $this->db->sql_query($sql); + + $this->cache->destroy('notification_type_ids'); + } +} diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index e039fae8de..21a6559012 100644 --- a/phpBB/phpbb/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,11 +16,33 @@ namespace phpbb\notification\method; /** * Email notification method class * This class handles sending emails for notifications -* -* @package notifications */ + class email extends \phpbb\notification\method\messenger_base { + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\config\config */ + protected $config; + + /** + * Notification Method email Constructor + * + * @param \phpbb\user_loader $user_loader + * @param \phpbb\user $user + * @param \phpbb\config\config $config + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user_loader $user_loader, \phpbb\user $user, \phpbb\config\config $config, $phpbb_root_path, $php_ext) + { + parent::__construct($user_loader, $phpbb_root_path, $php_ext); + + $this->user = $user; + $this->config = $config; + } + /** * Get notification method name * @@ -24,7 +50,7 @@ class email extends \phpbb\notification\method\messenger_base */ public function get_type() { - return 'email'; + return 'notification.method.email'; } /** diff --git a/phpBB/phpbb/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php index bdfaf5a6fc..509c6b432c 100644 --- a/phpBB/phpbb/notification/method/jabber.php +++ b/phpBB/phpbb/notification/method/jabber.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,11 +16,33 @@ namespace phpbb\notification\method; /** * Jabber notification method class * This class handles sending Jabber messages for notifications -* -* @package notifications */ + class jabber extends \phpbb\notification\method\messenger_base { + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\config\config */ + protected $config; + + /** + * Notification Method jabber Constructor + * + * @param \phpbb\user_loader $user_loader + * @param \phpbb\user $user + * @param \phpbb\config\config $config + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user_loader $user_loader, \phpbb\user $user, \phpbb\config\config $config, $phpbb_root_path, $php_ext) + { + parent::__construct($user_loader, $phpbb_root_path, $php_ext); + + $this->user = $user; + $this->config = $config; + } + /** * Get notification method name * @@ -24,7 +50,7 @@ class jabber extends \phpbb\notification\method\messenger_base */ public function get_type() { - return 'jabber'; + return 'notification.method.jabber'; } /** @@ -58,6 +84,6 @@ class jabber extends \phpbb\notification\method\messenger_base return; } - return $this->notify_using_messenger(NOTIFY_IM, 'short/'); + $this->notify_using_messenger(NOTIFY_IM, 'short/'); } } diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 7cb38eb59d..8a8e284e13 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,11 +16,32 @@ namespace phpbb\notification\method; /** * Abstract notification method handling email and jabber notifications * using the phpBB messenger. -* -* @package notifications */ abstract class messenger_base extends \phpbb\notification\method\base { + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** + * Notification Method Board Constructor + * + * @param \phpbb\user_loader $user_loader + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user_loader $user_loader, $phpbb_root_path, $php_ext) + { + $this->user_loader = $user_loader; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + /** * Notify using phpBB messenger * @@ -55,9 +80,9 @@ abstract class messenger_base extends \phpbb\notification\method\base include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); } $messenger = new \messenger(); - $board_url = generate_board_url(); // Time to go through the queue and send emails + /** @var \phpbb\notification\type\type_interface $notification */ foreach ($this->queue as $notification) { if ($notification->get_email_template() === false) @@ -67,7 +92,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $user = $this->user_loader->get_user($notification->user_id); - if ($user['user_type'] == USER_IGNORE || in_array($notification->user_id, $banned_users)) + if ($user['user_type'] == USER_IGNORE || ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL) || in_array($notification->user_id, $banned_users)) { continue; } diff --git a/phpBB/phpbb/notification/method/method_interface.php b/phpBB/phpbb/notification/method/method_interface.php index 4830d06b86..c2e4940485 100644 --- a/phpBB/phpbb/notification/method/method_interface.php +++ b/phpBB/phpbb/notification/method/method_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\notification\method; /** * Base notifications method interface -* @package notifications */ interface method_interface { @@ -23,12 +26,48 @@ interface method_interface public function get_type(); /** + * Is the method enable by default? + * + * @return bool + */ + public function is_enabled_by_default(); + + /** * Is this method available for the user? * This is checked on the notifications options */ public function is_available(); /** + * Return the list of the users already notified + * + * @param int $notification_type_id Type of the notification + * @param array $options + * @return array User + */ + public function get_notified_users($notification_type_id, array $options); + + /** + * Load the user's notifications + * + * @param array $options Optional options to control what notifications are loaded + * notification_id Notification id to load (or array of notification ids) + * user_id User id to load notifications for (Default: $user->data['user_id']) + * order_by Order by (Default: notification_time) + * order_dir Order direction (Default: DESC) + * limit Number of notifications to load (Default: 5) + * start Notifications offset (Default: 0) + * all_unread Load all unread notifications? If set to true, count_unread is set to true (Default: false) + * count_unread Count all unread notifications? (Default: false) + * count_total Count all notifications? (Default: false) + * @return array Array of information based on the request with keys: + * 'notifications' array of notification type objects + * 'unread_count' number of unread notifications the user has if count_unread is true in the options + * 'total_count' number of notifications the user has if count_total is true in the options + */ + public function load_notifications(array $options = array()); + + /** * Add a notification to the queue * * @param \phpbb\notification\type\type_interface $notification @@ -39,4 +78,72 @@ interface method_interface * Parse the queue and notify the users */ public function notify(); + + /** + * Update a notification + * + * @param \phpbb\notification\type\type_interface $notification Notification to update + * @param array $data Data specific for this type that will be updated + * @param array $options + */ + public function update_notification($notification, array $data, array $options); + + /** + * Mark notifications read or unread + * + * @param bool|string $notification_type_id Type identifier of item types. False to mark read for all item types + * @param bool|int|array $item_id Item id or array of item ids. False to mark read for all item ids + * @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids + * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * @param bool $mark_read Define if the notification as to be set to True or False. (Default: True) + */ + public function mark_notifications($notification_type_id, $item_id, $user_id, $time = false, $mark_read = true); + + /** + * Mark notifications read or unread from a parent identifier + * + * @param string $notification_type_id Type identifier of item types + * @param bool|int|array $item_parent_id Item parent id or array of item parent ids. False to mark read for all item parent ids + * @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids + * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * @param bool $mark_read Define if the notification as to be set to True or False. (Default: True) + */ + public function mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time = false, $mark_read = true); + + /** + * Mark notifications read or unread + * + * @param int $notification_id Notification id of notification ids. + * @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False) + * @param bool $mark_read Define if the notification as to be set to True or False. (Default: True) + */ + public function mark_notifications_by_id($notification_id, $time = false, $mark_read = true); + + /** + * Delete a notification + * + * @param string $notification_type_id Type identifier of item types + * @param int|array $item_id Identifier within the type (or array of ids) + * @param mixed $parent_id Parent identifier within the type (or array of ids), used in combination with item_id if specified (Default: false; not checked) + * @param mixed $user_id User id (Default: false; not checked) + */ + public function delete_notifications($notification_type_id, $item_id, $parent_id = false, $user_id = false); + + /** + * Delete all notifications older than a certain time + * + * @param int $timestamp Unix timestamp to delete all notifications that were created before + * @param bool $only_read True (default) to only prune read notifications + */ + public function prune_notifications($timestamp, $only_read = true); + + /** + * Purge all notifications of a certain type + * + * This should be called when an extension which has notification types + * is purged so that all those notifications are removed + * + * @param string $notification_type_id Type identifier of the subscription + */ + public function purge_notifications($notification_type_id); } diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index 5f146e18ff..9f2ae857ef 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Admin activation notifications class * This class handles notifications for users requiring admin activation -* -* @package notifications */ + class admin_activate_user extends \phpbb\notification\type\base { /** @@ -22,7 +25,7 @@ class admin_activate_user extends \phpbb\notification\type\base */ public function get_type() { - return 'admin_activate_user'; + return 'notification.type.admin_activate_user'; } /** @@ -33,11 +36,27 @@ class admin_activate_user extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER', 'group' => 'NOTIFICATION_GROUP_ADMINISTRATION', ); + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + /** * {@inheritdoc} */ @@ -49,7 +68,7 @@ class admin_activate_user extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public static function get_item_id($user) + static public function get_item_id($user) { return (int) $user['user_id']; } @@ -57,7 +76,7 @@ class admin_activate_user extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public static function get_item_parent_id($post) + static public function get_item_parent_id($post) { return 0; } @@ -81,7 +100,7 @@ class admin_activate_user extends \phpbb\notification\type\base WHERE user_type = ' . USER_FOUNDER; $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($sql)) + while ($row = $this->db->sql_fetchrow($result)) { $users[] = (int) $row['user_id']; } @@ -101,7 +120,7 @@ class admin_activate_user extends \phpbb\notification\type\base */ public function get_avatar() { - return $this->user_loader->get_avatar($this->item_id); + return $this->user_loader->get_avatar($this->item_id, false, true); } /** @@ -111,7 +130,7 @@ class admin_activate_user extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->item_id, 'no_profile'); - return $this->user->lang($this->language_key, $username); + return $this->language->lang($this->language_key, $username); } /** @@ -128,7 +147,7 @@ class admin_activate_user extends \phpbb\notification\type\base public function get_email_template_variables() { $board_url = generate_board_url(); - $username = $this->user_loader->get_username($this->item_id, 'no_profile'); + $username = $this->user_loader->get_username($this->item_id, 'username'); return array( 'USERNAME' => htmlspecialchars_decode($username), @@ -142,7 +161,7 @@ class admin_activate_user extends \phpbb\notification\type\base */ public function get_url() { - return append_sid($this->phpbb_root_path . 'memberlist.' . $this->php_ext, "mode=viewprofile&u={$this->item_id}"); + return $this->user_loader->get_username($this->item_id, 'profile'); } /** @@ -161,6 +180,6 @@ class admin_activate_user extends \phpbb\notification\type\base $this->set_data('user_actkey', $user['user_actkey']); $this->notification_time = $user['user_regdate']; - return parent::create_insert_array($user, $pre_create_data); + parent::create_insert_array($user, $pre_create_data); } } diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index e51ff12b3e..e4b111e4da 100644 --- a/phpBB/phpbb/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Post approved notifications class * This class handles notifications for posts when they are approved (to their authors) -* -* @package notifications */ + class approve_post extends \phpbb\notification\type\post { /** @@ -24,7 +27,7 @@ class approve_post extends \phpbb\notification\type\post */ public function get_type() { - return 'approve_post'; + return 'notification.type.approve_post'; } /** @@ -47,7 +50,7 @@ class approve_post extends \phpbb\notification\type\post * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', 'group' => 'NOTIFICATION_GROUP_POSTING', @@ -64,7 +67,8 @@ class approve_post extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ @@ -75,17 +79,10 @@ class approve_post extends \phpbb\notification\type\post ), $options); $users = array(); - $users[$post['poster_id']] = array(''); + $users[$post['poster_id']] = $this->notification_manager->get_default_methods(); - $auth_read = $this->auth->acl_get_list(array_keys($users), 'f_read', $post['forum_id']); - - if (empty($auth_read)) - { - return array(); - } - - return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array( - 'item_type' => self::$notification_option['id'], + return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array( + 'item_type' => static::$notification_option['id'], ))); } @@ -110,21 +107,24 @@ class approve_post extends \phpbb\notification\type\post } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { $this->set_data('post_subject', $post['post_subject']); - $data = parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); - $this->notification_time = $data['notification_time'] = time(); + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } @@ -138,4 +138,12 @@ class approve_post extends \phpbb\notification\type\post { return 'post_approved'; } + + /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return $this->get_url(); + } } diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index 11a240e03d..f8a3fdec6f 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Topic approved notifications class * This class handles notifications for topics when they are approved (for authors) -* -* @package notifications */ + class approve_topic extends \phpbb\notification\type\topic { /** @@ -24,7 +27,7 @@ class approve_topic extends \phpbb\notification\type\topic */ public function get_type() { - return 'approve_topic'; + return 'notification.type.approve_topic'; } /** @@ -47,7 +50,7 @@ class approve_topic extends \phpbb\notification\type\topic * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', 'group' => 'NOTIFICATION_GROUP_POSTING', @@ -64,7 +67,8 @@ class approve_topic extends \phpbb\notification\type\topic /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ @@ -75,17 +79,10 @@ class approve_topic extends \phpbb\notification\type\topic ), $options); $users = array(); - $users[$post['poster_id']] = array(''); - - $auth_read = $this->auth->acl_get_list(array_keys($users), 'f_read', $post['forum_id']); + $users[$post['poster_id']] = $this->notification_manager->get_default_methods(); - if (empty($auth_read)) - { - return array(); - } - - return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array( - 'item_type' => self::$notification_option['id'], + return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array( + 'item_type' => static::$notification_option['id'], ))); } @@ -110,19 +107,23 @@ class approve_topic extends \phpbb\notification\type\topic } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { - $data = parent::create_insert_array($post, $pre_create_data); - $this->notification_time = $data['notification_time'] = time(); + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 10c876b286..4aacb1c99e 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,24 +15,17 @@ namespace phpbb\notification\type; /** * Base notifications class -* @package notifications */ abstract class base implements \phpbb\notification\type\type_interface { /** @var \phpbb\notification\manager */ protected $notification_manager; - /** @var \phpbb\user_loader */ - protected $user_loader; - - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\cache\driver\driver_interface */ - protected $cache; - - /** @var \phpbb\template\template */ - protected $template; + /** @var \phpbb\language\language */ + protected $language; /** @var \phpbb\user */ protected $user; @@ -36,9 +33,6 @@ abstract class base implements \phpbb\notification\type\type_interface /** @var \phpbb\auth\auth */ protected $auth; - /** @var \phpbb\config\config */ - protected $config; - /** @var string */ protected $phpbb_root_path; @@ -46,12 +40,6 @@ abstract class base implements \phpbb\notification\type\type_interface protected $php_ext; /** @var string */ - protected $notification_types_table; - - /** @var string */ - protected $notifications_table; - - /** @var string */ protected $user_notifications_table; /** @@ -60,7 +48,7 @@ abstract class base implements \phpbb\notification\type\type_interface * @var bool|array False if the service should use its default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = false; + static public $notification_option = false; /** * The notification_type_id, set upon creation of the class @@ -71,7 +59,7 @@ abstract class base implements \phpbb\notification\type\type_interface protected $notification_type_id; /** - * Indentification data + * Identification data * notification_type_id - ID of the item type (auto generated, from notification types table) * item_id - ID of the item (e.g. post_id, msg_id) * item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc) @@ -86,35 +74,26 @@ abstract class base implements \phpbb\notification\type\type_interface private $data = array(); /** - * Notification Type Base Constructor - * - * @param \phpbb\user_loader $user_loader - * @param \phpbb\db\driver\driver $db - * @param \phpbb\cache\driver\driver_interface $cache - * @param \phpbb\user $user - * @param \phpbb\auth\auth $auth - * @param \phpbb\config\config $config - * @param string $phpbb_root_path - * @param string $php_ext - * @param string $notification_types_table - * @param string $notifications_table - * @param string $user_notifications_table - * @return \phpbb\notification\type\base - */ - public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) + * Notification Type Base Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\language\language $language + * @param \phpbb\user $user + * @param \phpbb\auth\auth $auth + * @param string $phpbb_root_path + * @param string $php_ext + * @param string $user_notifications_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table) { - $this->user_loader = $user_loader; $this->db = $db; - $this->cache = $cache; + $this->language = $language; $this->user = $user; $this->auth = $auth; - $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->notification_types_table = $notification_types_table; - $this->notifications_table = $notifications_table; $this->user_notifications_table = $user_notifications_table; } @@ -158,6 +137,8 @@ abstract class base implements \phpbb\notification\type\type_interface * Magic method to set data on this notification * * @param mixed $name + * @param mixed $value + * * @return null */ public function __set($name, $value) @@ -171,7 +152,6 @@ abstract class base implements \phpbb\notification\type\type_interface * * Primarily for testing * - * @param string $name * @return mixed */ public function __toString() @@ -203,12 +183,7 @@ abstract class base implements \phpbb\notification\type\type_interface } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $type_data Data unique to this notification type - * @param array $pre_create_data Data from pre_create_insert_array() - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($type_data, $pre_create_data = array()) { @@ -221,9 +196,15 @@ abstract class base implements \phpbb\notification\type\type_interface 'notification_time' => time(), 'notification_read' => false, - 'notification_data' => array(), + 'notification_data' => array(), ), $this->data); + } + /** + * {@inheritdoc} + */ + public function get_insert_array() + { $data = $this->data; $data['notification_data'] = serialize($data['notification_data']); @@ -240,7 +221,8 @@ abstract class base implements \phpbb\notification\type\type_interface */ public function create_update_array($type_data) { - $data = $this->create_insert_array($type_data); + $this->create_insert_array($type_data); + $data = $this->get_insert_array(); // Unset data unique to each row unset( @@ -276,6 +258,14 @@ abstract class base implements \phpbb\notification\type\type_interface } /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return $this->get_url(); + } + + /** * Prepare to output the notification to the template * * @return array Template variables @@ -297,16 +287,15 @@ abstract class base implements \phpbb\notification\type\type_interface return array( 'NOTIFICATION_ID' => $this->notification_id, - + 'STYLING' => $this->get_style_class(), 'AVATAR' => $this->get_avatar(), - 'FORMATTED_TITLE' => $this->get_title(), - + 'REFERENCE' => $this->get_reference(), + 'FORUM' => $this->get_forum(), + 'REASON' => $this->get_reason(), 'URL' => $this->get_url(), 'TIME' => $this->user->format_date($this->notification_time), - 'UNREAD' => !$this->notification_read, - 'U_MARK_READ' => (!$this->notification_read) ? $u_mark_read : '', ); } @@ -319,6 +308,7 @@ abstract class base implements \phpbb\notification\type\type_interface * URL to unsubscribe to this notification (fall back) * * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + * @return false */ public function get_unsubscribe_url($method = false) { @@ -326,6 +316,16 @@ abstract class base implements \phpbb\notification\type\type_interface } /** + * Get the CSS style class of the notification (fall back) + * + * @return string + */ + public function get_style_class() + { + return ''; + } + + /** * Get the user's avatar (fall back) * * @return string @@ -336,6 +336,36 @@ abstract class base implements \phpbb\notification\type\type_interface } /** + * Get the reference of the notifcation (fall back) + * + * @return string + */ + public function get_reference() + { + return ''; + } + + /** + * Get the forum of the notification reference (fall back) + * + * @return string + */ + public function get_forum() + { + return ''; + } + + /** + * Get the reason for the notifcation (fall back) + * + * @return string + */ + public function get_reason() + { + return ''; + } + + /** * Get the special items to load (fall back) * * @return array @@ -346,8 +376,11 @@ abstract class base implements \phpbb\notification\type\type_interface } /** - * Load the special items (fall back) - */ + * Load the special items (fall back) + * + * @param array $data + * @param array $notifications + */ public function load_special($data, $notifications) { return; @@ -364,10 +397,12 @@ abstract class base implements \phpbb\notification\type\type_interface } /** - * Pre create insert array function (fall back) - * - * @return array - */ + * Pre create insert array function (fall back) + * + * @param array $type_data + * @param array $notify_users + * @return array + */ public function pre_create_insert_array($type_data, $notify_users) { return array(); @@ -378,13 +413,13 @@ abstract class base implements \phpbb\notification\type\type_interface */ /** - * Find the users who want to receive notifications (helper) - * - * @param array $user_ids User IDs to check if they want to receive notifications - * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) - * - * @return array - */ + * Find the users who want to receive notifications (helper) + * + * @param array|bool $user_ids User IDs to check if they want to receive notifications + * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) + * @param array $options + * @return array + */ protected function check_user_notification_options($user_ids = false, $options = array()) { $options = array_merge(array( @@ -446,8 +481,8 @@ abstract class base implements \phpbb\notification\type\type_interface { if (!in_array($user_id, $resulting_user_ids) && !isset($options['ignore_users'][$user_id])) { - // No rows at all for this user, default to '' - $rowset[$user_id] = array(''); + // No rows at all for this user, use the default methods + $rowset[$user_id] = $this->notification_manager->get_default_methods(); } } @@ -465,21 +500,55 @@ abstract class base implements \phpbb\notification\type\type_interface { $this->notification_read = (bool) !$unread; - $where = array( - 'notification_type_id = ' . (int) $this->notification_type_id, - 'item_id = ' . (int) $this->item_id, - 'user_id = ' . (int) $this->user_id, - ); - $where = implode(' AND ', $where); - if ($return) { + $where = array( + 'notification_type_id = ' . (int) $this->notification_type_id, + 'item_id = ' . (int) $this->item_id, + 'user_id = ' . (int) $this->user_id, + ); + + $where = implode(' AND ', $where); return $where; } + else + { + $this->notification_manager->mark_notifications($this->get_type(), (int) $this->item_id, (int) $this->user_id, false, $this->notification_read); + } + + return null; + } + + /** + * Get a list of users that are authorised to receive notifications + * + * @param array $users Array of users that have subscribed to a notification + * @param int $forum_id Forum ID of the forum + * @param array $options Array of notification options + * @param bool $sort Whether the users array should be sorted. Default: false + * @return array Array of users that are authorised recipients + */ + protected function get_authorised_recipients($users, $forum_id, $options, $sort = false) + { + if (empty($users)) + { + return array(); + } + + $users = array_unique($users); + + if ($sort) + { + sort($users); + } + + $auth_read = $this->auth->acl_get_list($users, 'f_read', $forum_id); + + if (empty($auth_read)) + { + return array(); + } - $sql = 'UPDATE ' . $this->notifications_table . ' - SET notification_read = ' . (int) $this->notification_read . ' - WHERE ' . $where; - $this->db->sql_query($sql); + return $this->check_user_notification_options($auth_read[$forum_id]['f_read'], $options); } } diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index 5e6fdd2523..ebbb961c57 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Bookmark updating notifications class * This class handles notifications for replies to a bookmarked topic -* -* @package notifications */ + class bookmark extends \phpbb\notification\type\post { /** @@ -24,7 +27,7 @@ class bookmark extends \phpbb\notification\type\post */ public function get_type() { - return 'bookmark'; + return 'notification.type.bookmark'; } /** @@ -40,7 +43,7 @@ class bookmark extends \phpbb\notification\type\post * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_BOOKMARK', 'group' => 'NOTIFICATION_GROUP_POSTING', ); @@ -56,7 +59,8 @@ class bookmark extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ @@ -75,47 +79,39 @@ class bookmark extends \phpbb\notification\type\post $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); - if (empty($users)) - { - return array(); - } - sort($users); - - $auth_read = $this->auth->acl_get_list($users, 'f_read', $post['forum_id']); + $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true); - if (empty($auth_read)) + if (empty($notify_users)) { return array(); } - $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options); - // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications - $update_notifications = array(); - $sql = 'SELECT n.* - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.notification_type_id = ' . (int) $this->notification_type_id . ' - AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . ' - AND n.notification_read = 0 - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1'; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) + $notified_users = $this->notification_manager->get_notified_users($this->get_type(), array( + 'item_parent_id' => static::get_item_parent_id($post), + 'read' => 0, + )); + + foreach ($notified_users as $user => $notification_data) { - // Do not create a new notification - unset($notify_users[$row['user_id']]); - - $notification = $this->notification_manager->get_item_type_class($this->get_type(), $row); - $sql = 'UPDATE ' . $this->notifications_table . ' - SET ' . $this->db->sql_build_array('UPDATE', $notification->add_responders($post)) . ' - WHERE notification_id = ' . $row['notification_id']; - $this->db->sql_query($sql); + unset($notify_users[$user]); + + /** @var bookmark $notification */ + $notification = $this->notification_manager->get_item_type_class($this->get_type(), $notification_data); + $update_responders = $notification->add_responders($post); + if (!empty($update_responders)) + { + $this->notification_manager->update_notification($notification, $update_responders, array( + 'item_parent_id' => self::get_item_parent_id($post), + 'read' => 0, + 'user_id' => $user, + )); + } } - $this->db->sql_freeresult($result); return $notify_users; } diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index 70de2a3e10..2d908eb254 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Post disapproved notifications class * This class handles notifications for posts when they are disapproved (for authors) -* -* @package notifications */ + class disapprove_post extends \phpbb\notification\type\approve_post { /** @@ -24,7 +27,17 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_type() { - return 'disapprove_post'; + return 'notification.type.disapprove_post'; + } + + /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-disapproved'; } /** @@ -47,7 +60,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', 'group' => 'NOTIFICATION_GROUP_POSTING', @@ -60,9 +73,31 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_title() { - return $this->user->lang( - $this->language_key, - censor_text($this->get_data('topic_title')), + return $this->language->lang($this->language_key); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** + * Get the reason for the disapproval notification + * + * @return string + */ + public function get_reason() + { + return $this->language->lang( + 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); } @@ -90,21 +125,24 @@ class disapprove_post extends \phpbb\notification\type\approve_post } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { $this->set_data('disapprove_reason', $post['disapprove_reason']); - $data = parent::create_insert_array($post); + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } - $this->notification_time = $data['notification_time'] = time(); + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index d39201d928..c2522fb562 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Topic disapproved notifications class * This class handles notifications for topics when they are disapproved (for authors) -* -* @package notifications */ + class disapprove_topic extends \phpbb\notification\type\approve_topic { /** @@ -24,7 +27,17 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_type() { - return 'disapprove_topic'; + return 'notification.type.disapprove_topic'; + } + + /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-disapproved'; } /** @@ -47,7 +60,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', 'group' => 'NOTIFICATION_GROUP_POSTING', @@ -60,9 +73,31 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_title() { - return $this->user->lang( - $this->language_key, - censor_text($this->get_data('topic_title')), + return $this->language->lang($this->language_key); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** + * Get the reason for the disapproval notification + * + * @return string + */ + public function get_reason() + { + return $this->language->lang( + 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); } @@ -90,21 +125,24 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { $this->set_data('disapprove_reason', $post['disapprove_reason']); - $data = parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } - $this->notification_time = $data['notification_time'] = time(); + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php index e0527fe220..28a9e73bf9 100644 --- a/phpBB/phpbb/notification/type/group_request.php +++ b/phpBB/phpbb/notification/type/group_request.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,16 +20,24 @@ class group_request extends \phpbb\notification\type\base */ public function get_type() { - return 'group_request'; + return 'notification.type.group_request'; } /** * {@inheritdoc} */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_GROUP_REQUEST', ); + /** @var \phpbb\user_loader */ + protected $user_loader; + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + /** * {@inheritdoc} */ @@ -46,7 +58,7 @@ class group_request extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public static function get_item_id($group) + static public function get_item_id($group) { return (int) $group['user_id']; } @@ -54,7 +66,7 @@ class group_request extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public static function get_item_parent_id($group) + static public function get_item_parent_id($group) { // Group id is the parent return (int) $group['group_id']; @@ -92,7 +104,7 @@ class group_request extends \phpbb\notification\type\base */ public function get_avatar() { - return $this->user_loader->get_avatar($this->item_id); + return $this->user_loader->get_avatar($this->item_id, false, true); } /** @@ -102,7 +114,7 @@ class group_request extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->item_id, 'no_profile'); - return $this->user->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name')); + return $this->language->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name')); } /** @@ -152,6 +164,6 @@ class group_request extends \phpbb\notification\type\base { $this->set_data('group_name', $group['group_name']); - return parent::create_insert_array($group, $pre_create_data); + parent::create_insert_array($group, $pre_create_data); } } diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php index 448f049412..f55d28bafd 100644 --- a/phpBB/phpbb/notification/type/group_request_approved.php +++ b/phpBB/phpbb/notification/type/group_request_approved.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,7 +20,7 @@ class group_request_approved extends \phpbb\notification\type\base */ public function get_type() { - return 'group_request_approved'; + return 'notification.type.group_request_approved'; } /** @@ -30,7 +34,7 @@ class group_request_approved extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public static function get_item_id($group) + static public function get_item_id($group) { return (int) $group['group_id']; } @@ -38,7 +42,7 @@ class group_request_approved extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public static function get_item_parent_id($group) + static public function get_item_parent_id($group) { return 0; } @@ -54,7 +58,7 @@ class group_request_approved extends \phpbb\notification\type\base foreach ($group['user_ids'] as $user_id) { - $users[$user_id] = array(''); + $users[$user_id] = $this->notification_manager->get_default_methods(); } return $users; @@ -65,7 +69,7 @@ class group_request_approved extends \phpbb\notification\type\base */ public function get_title() { - return $this->user->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name')); + return $this->language->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name')); } /** @@ -83,7 +87,7 @@ class group_request_approved extends \phpbb\notification\type\base { $this->set_data('group_name', $group['group_name']); - return parent::create_insert_array($group, $pre_create_data); + parent::create_insert_array($group, $pre_create_data); } /** diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 584a30efa6..8fb9172911 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Private message notifications class * This class handles notifications for private messages -* -* @package notifications */ + class pm extends \phpbb\notification\type\base { /** @@ -24,7 +27,7 @@ class pm extends \phpbb\notification\type\base */ public function get_type() { - return 'pm'; + return 'notification.type.pm'; } /** @@ -33,10 +36,26 @@ class pm extends \phpbb\notification\type\base * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_PM', ); + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + /** * Is available */ @@ -50,7 +69,7 @@ class pm extends \phpbb\notification\type\base * * @param array $pm The data from the private message */ - public static function get_item_id($pm) + static public function get_item_id($pm) { return (int) $pm['msg_id']; } @@ -60,7 +79,7 @@ class pm extends \phpbb\notification\type\base * * @param array $pm The data from the pm */ - public static function get_item_parent_id($pm) + static public function get_item_parent_id($pm) { // No parent return 0; @@ -69,7 +88,8 @@ class pm extends \phpbb\notification\type\base /** * Find the users who want to receive notifications * - * @param array $pm Data from + * @param array $pm Data from submit_pm + * @param array $options Options for finding users for notification * * @return array */ @@ -96,7 +116,7 @@ class pm extends \phpbb\notification\type\base */ public function get_avatar() { - return $this->user_loader->get_avatar($this->get_data('from_user_id')); + return $this->user_loader->get_avatar($this->get_data('from_user_id'), false, true); } /** @@ -108,7 +128,20 @@ class pm extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->get_data('from_user_id'), 'no_profile'); - return $this->user->lang('NOTIFICATION_PM', $username, $this->get_data('message_subject')); + return $this->language->lang('NOTIFICATION_PM', $username); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + $this->get_data('message_subject') + ); } /** @@ -159,13 +192,7 @@ class pm extends \phpbb\notification\type\base } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($pm, $pre_create_data = array()) { @@ -173,6 +200,6 @@ class pm extends \phpbb\notification\type\base $this->set_data('message_subject', $pm['message_subject']); - return parent::create_insert_array($pm, $pre_create_data); + parent::create_insert_array($pm, $pre_create_data); } } diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index bc42c4422b..b9afc6d70a 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Post notifications class * This class handles notifications for replies to a topic -* -* @package notifications */ + class post extends \phpbb\notification\type\base { /** @@ -24,7 +27,7 @@ class post extends \phpbb\notification\type\base */ public function get_type() { - return 'post'; + return 'notification.type.post'; } /** @@ -47,11 +50,27 @@ class post extends \phpbb\notification\type\base * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_POST', 'group' => 'NOTIFICATION_GROUP_POSTING', ); + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + /** * Is available */ @@ -64,8 +83,9 @@ class post extends \phpbb\notification\type\base * Get the id of the item * * @param array $post The data from the post + * @return int The post id */ - public static function get_item_id($post) + static public function get_item_id($post) { return (int) $post['post_id']; } @@ -74,8 +94,9 @@ class post extends \phpbb\notification\type\base * Get the id of the parent * * @param array $post The data from the post + * @return int The topic id */ - public static function get_item_parent_id($post) + static public function get_item_parent_id($post) { return (int) $post['topic_id']; } @@ -83,7 +104,8 @@ class post extends \phpbb\notification\type\base /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ @@ -103,7 +125,7 @@ class post extends \phpbb\notification\type\base $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); @@ -115,49 +137,39 @@ class post extends \phpbb\notification\type\base $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); - if (empty($users)) - { - return array(); - } - - $users = array_unique($users); - sort($users); - - $auth_read = $this->auth->acl_get_list($users, 'f_read', $post['forum_id']); + $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true); - if (empty($auth_read)) + if (empty($notify_users)) { return array(); } - $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options); - // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications - $update_notifications = array(); - $sql = 'SELECT n.* - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.notification_type_id = ' . (int) $this->notification_type_id . ' - AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . ' - AND n.notification_read = 0 - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1'; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) + $notified_users = $this->notification_manager->get_notified_users($this->get_type(), array( + 'item_parent_id' => static::get_item_parent_id($post), + 'read' => 0, + )); + + foreach ($notified_users as $user => $notification_data) { - // Do not create a new notification - unset($notify_users[$row['user_id']]); - - $notification = $this->notification_manager->get_item_type_class($this->get_type(), $row); - $sql = 'UPDATE ' . $this->notifications_table . ' - SET ' . $this->db->sql_build_array('UPDATE', $notification->add_responders($post)) . ' - WHERE notification_id = ' . $row['notification_id']; - $this->db->sql_query($sql); + unset($notify_users[$user]); + + /** @var post $notification */ + $notification = $this->notification_manager->get_item_type_class($this->get_type(), $notification_data); + $update_responders = $notification->add_responders($post); + if (!empty($update_responders)) + { + $this->notification_manager->update_notification($notification, $update_responders, array( + 'item_parent_id' => self::get_item_parent_id($post), + 'read' => 0, + 'user_id' => $user, + )); + } } - $this->db->sql_freeresult($result); return $notify_users; } @@ -167,7 +179,7 @@ class post extends \phpbb\notification\type\base */ public function get_avatar() { - return $this->user_loader->get_avatar($this->get_data('poster_id')); + return $this->user_loader->get_avatar($this->get_data('poster_id'), false, true); } /** @@ -205,18 +217,33 @@ class post extends \phpbb\notification\type\base $usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile'); } } - $lang_key = $this->language_key; - if ($trimmed_responders_cnt) + if ($trimmed_responders_cnt > 20) + { + $usernames[] = $this->language->lang('NOTIFICATION_MANY_OTHERS'); + } + else if ($trimmed_responders_cnt) { - $lang_key .= '_TRIMMED'; + $usernames[] = $this->language->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); } - return $this->user->lang( - $lang_key, - implode($this->user->lang['COMMA_SEPARATOR'], $usernames), - censor_text($this->get_data('topic_title')), - $trimmed_responders_cnt + return $this->language->lang( + $this->language_key, + phpbb_generate_string_list($usernames, $this->user), + $responders_cnt + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) ); } @@ -271,6 +298,14 @@ class post extends \phpbb\notification\type\base } /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t={$this->item_parent_id}&view=unread#unread"); + } + + /** * Users needed to query before this notification can be displayed * * @return array Array of user_ids @@ -336,18 +371,13 @@ class post extends \phpbb\notification\type\base { $tracking_data[$row['user_id']] = $row['mark_time']; } + $this->db->sql_freeresult($result); return $tracking_data; } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { @@ -372,32 +402,41 @@ class post extends \phpbb\notification\type\base $this->notification_read = true; } - return parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); } /** * Add responders to the notification * * @param mixed $post + * @return array Array of responder data */ public function add_responders($post) { // Do not add them as a responder if they were the original poster that created the notification if ($this->get_data('poster_id') == $post['poster_id']) { - return array('notification_data' => serialize($this->get_data(false))); + return array(); } $responders = $this->get_data('responders'); $responders = ($responders === null) ? array() : $responders; + // Do not add more than 25 responders, + // we trim the username list to "a, b, c and x others" anyway + // so there is no use to add all of them anyway. + if (sizeof($responders) > 25) + { + return array(); + } + foreach ($responders as $responder) { // Do not add them as a responder multiple times if ($responder['poster_id'] == $post['poster_id']) { - return array('notification_data' => serialize($this->get_data(false))); + return array(); } } @@ -408,6 +447,15 @@ class post extends \phpbb\notification\type\base $this->set_data('responders', $responders); - return array('notification_data' => serialize($this->get_data(false))); + $serialized_data = serialize($this->get_data(false)); + + // If the data is longer then 4000 characters, it would cause a SQL error. + // We don't add the username to the list if this is the case. + if (utf8_strlen($serialized_data) >= 4000) + { + return array(); + } + + return array('notification_data' => $serialized_data); } } diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php index db16763583..2d556fc9c8 100644 --- a/phpBB/phpbb/notification/type/post_in_queue.php +++ b/phpBB/phpbb/notification/type/post_in_queue.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Post in queue notifications class * This class handles notifications for posts that are put in the moderation queue (for moderators) -* -* @package notifications */ + class post_in_queue extends \phpbb\notification\type\post { /** @@ -24,7 +27,7 @@ class post_in_queue extends \phpbb\notification\type\post */ public function get_type() { - return 'post_in_queue'; + return 'notification.type.post_in_queue'; } /** @@ -40,8 +43,8 @@ class post_in_queue extends \phpbb\notification\type\post * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( - 'id' => 'needs_approval', + static public $notification_option = array( + 'id' => 'notification.type.needs_approval', 'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE', 'group' => 'NOTIFICATION_GROUP_MODERATION', ); @@ -67,6 +70,7 @@ class post_in_queue extends \phpbb\notification\type\post * Find the users who want to receive notifications * * @param array $post Data from the post + * @param array $options Options for finding users for notification * * @return array */ @@ -104,7 +108,7 @@ class post_in_queue extends \phpbb\notification\type\post } return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array( - 'item_type' => self::$notification_option['id'], + 'item_type' => static::$notification_option['id'], ))); } @@ -119,19 +123,30 @@ class post_in_queue extends \phpbb\notification\type\post } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {inheritDoc} + */ + public function get_redirect_url() + { + return parent::get_url(); + } + + /** + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { - $data = parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } - $this->notification_time = $data['notification_time'] = time(); + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index e8527261d8..684463c8c3 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,29 +16,26 @@ namespace phpbb\notification\type; /** * Post quoting notifications class * This class handles notifying users when they have been quoted in a post -* -* @package notifications */ + class quote extends \phpbb\notification\type\post { /** + * @var \phpbb\textformatter\utils_interface + */ + protected $utils; + + /** * Get notification type name * * @return string */ public function get_type() { - return 'quote'; + return 'notification.type.quote'; } /** - * regular expression to match to find usernames - * - * @var string - */ - protected static $regular_expression_match = '#\[quote="(.+?)"#'; - - /** * Language key used to output the text * * @var string @@ -47,7 +48,7 @@ class quote extends \phpbb\notification\type\post * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_QUOTE', 'group' => 'NOTIFICATION_GROUP_POSTING', ); @@ -63,7 +64,8 @@ class quote extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ @@ -73,17 +75,16 @@ class quote extends \phpbb\notification\type\post 'ignore_users' => array(), ), $options); - $usernames = false; - preg_match_all(self::$regular_expression_match, $post['post_text'], $usernames); + $usernames = $this->utils->get_outermost_quote_authors($post['post_text']); - if (empty($usernames[1])) + if (empty($usernames)) { return array(); } - $usernames[1] = array_unique($usernames[1]); + $usernames = array_unique($usernames); - $usernames = array_map('utf8_clean_string', $usernames[1]); + $usernames = array_map('utf8_clean_string', $usernames); $users = array(); @@ -94,77 +95,30 @@ class quote extends \phpbb\notification\type\post $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); - if (empty($users)) - { - return array(); - } - sort($users); - - $auth_read = $this->auth->acl_get_list($users, 'f_read', $post['forum_id']); - - if (empty($auth_read)) - { - return array(); - } - - $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options); - - // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications - $update_notifications = array(); - $sql = 'SELECT n.* - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.notification_type_id = ' . (int) $this->notification_type_id . ' - AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . ' - AND n.notification_read = 0 - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1'; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - // Do not create a new notification - unset($notify_users[$row['user_id']]); - - $notification = $this->notification_manager->get_item_type_class($this->get_type(), $row); - $sql = 'UPDATE ' . $this->notifications_table . ' - SET ' . $this->db->sql_build_array('UPDATE', $notification->add_responders($post)) . ' - WHERE notification_id = ' . $row['notification_id']; - $this->db->sql_query($sql); - } - $this->db->sql_freeresult($result); - - return $notify_users; + return $this->get_authorised_recipients($users, $post['forum_id'], $options, true); } /** * Update a notification * - * @param array $data Data specific for this type that will be updated + * @param array $post Data specific for this type that will be updated + * @return true */ public function update_notifications($post) { - $old_notifications = array(); - $sql = 'SELECT n.user_id - FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt - WHERE n.notification_type_id = ' . (int) $this->notification_type_id . ' - AND n.item_id = ' . self::get_item_id($post) . ' - AND nt.notification_type_id = n.notification_type_id - AND nt.notification_type_enabled = 1'; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - $old_notifications[] = $row['user_id']; - } - $this->db->sql_freeresult($result); + $old_notifications = $this->notification_manager->get_notified_users($this->get_type(), array( + 'item_id' => static::get_item_id($post), + )); // Find the new users to notify - $notifications = $this->find_users_for_notification($post); + $notifications = array_keys($this->find_users_for_notification($post)); // Find the notifications we must delete - $remove_notifications = array_diff($old_notifications, array_keys($notifications)); + $remove_notifications = array_diff(array_keys($old_notifications), array_keys($notifications)); // Find the notifications we must add $add_notifications = array(); @@ -179,11 +133,7 @@ class quote extends \phpbb\notification\type\post // Remove the necessary notifications if (!empty($remove_notifications)) { - $sql = 'DELETE FROM ' . $this->notifications_table . ' - WHERE notification_type_id = ' . (int) $this->notification_type_id . ' - AND item_id = ' . self::get_item_id($post) . ' - AND ' . $this->db->sql_in_set('user_id', $remove_notifications); - $this->db->sql_query($sql); + $this->notification_manager->delete_notifications($this->get_type(), static::get_item_id($post), false, $remove_notifications); } // return true to continue with the update code in the notifications service (this will update the rest of the notifications) @@ -191,6 +141,14 @@ class quote extends \phpbb\notification\type\post } /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return $this->get_url(); + } + + /** * Get email template * * @return string|bool @@ -213,4 +171,14 @@ class quote extends \phpbb\notification\type\post 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), )); } + + /** + * Set the utils service used to retrieve quote authors + * + * @param \phpbb\textformatter\utils_interface $utils + */ + public function set_utils(\phpbb\textformatter\utils_interface $utils) + { + $this->utils = $utils; + } } diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 55f6bf946d..6091919769 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Private message reported notifications class * This class handles notifications for private messages when they are reported -* -* @package notifications */ + class report_pm extends \phpbb\notification\type\pm { /** @@ -24,7 +27,17 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_type() { - return 'report_pm'; + return 'notification.type.report_pm'; + } + + /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-reported'; } /** @@ -47,8 +60,8 @@ class report_pm extends \phpbb\notification\type\pm * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( - 'id' => 'report', + static public $notification_option = array( + 'id' => 'notification.type.report', 'lang' => 'NOTIFICATION_TYPE_REPORT', 'group' => 'NOTIFICATION_GROUP_MODERATION', ); @@ -57,8 +70,9 @@ class report_pm extends \phpbb\notification\type\pm * Get the id of the parent * * @param array $pm The data from the pm + * @return int The report id */ - public static function get_item_parent_id($pm) + static public function get_item_parent_id($pm) { return (int) $pm['report_id']; } @@ -81,6 +95,7 @@ class report_pm extends \phpbb\notification\type\pm * (copied from post_in_queue) * * @param array $post Data from the post + * @param array $options Options for finding users for notification * * @return array */ @@ -106,7 +121,7 @@ class report_pm extends \phpbb\notification\type\pm } return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, array( - 'item_type' => self::$notification_option['id'], + 'item_type' => static::$notification_option['id'], ))); } @@ -127,11 +142,13 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_email_template_variables() { + $user_data = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); + return array( - 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), - 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), + 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), + 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), - 'U_VIEW_REPORT' => generate_board_url() . "mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details", + 'U_VIEW_REPORT' => generate_board_url() . "mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details", ); } @@ -152,34 +169,54 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_title() { - $this->user->add_lang('mcp'); + $this->language->add_lang('mcp'); $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); + return $this->language->lang( + $this->language_key, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('message_subject')) + ); + } + + /** + * Get the reason for the notification + * + * @return string + */ + public function get_reason() + { if ($this->get_data('report_text')) { - return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('message_subject')), + return $this->language->lang( + 'NOTIFICATION_REASON', $this->get_data('report_text') ); } - if (isset($this->user->lang[$this->get_data('reason_title')])) + if ($this->language->is_set($this->get_data('reason_title'))) { - return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('message_subject')), - $this->user->lang[$this->get_data('reason_title')] + return $this->language->lang( + 'NOTIFICATION_REASON', + $this->language->lang($this->get_data('reason_title')) ); } - return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('message_subject')), + return $this->language->lang( + 'NOTIFICATION_REASON', $this->get_data('reason_description') ); } @@ -189,7 +226,7 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_avatar() { - return $this->user_loader->get_avatar($this->get_data('reporter_id')); + return $this->user_loader->get_avatar($this->get_data('reporter_id'), false, true); } /** @@ -203,13 +240,7 @@ class report_pm extends \phpbb\notification\type\pm } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { @@ -218,6 +249,6 @@ class report_pm extends \phpbb\notification\type\pm $this->set_data('reason_description', $post['reason_description']); $this->set_data('report_text', $post['report_text']); - return parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); } } diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index 56485f5d37..5e98eb5feb 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * PM report closed notifications class * This class handles notifications for when reports are closed on PMs (for the one who reported the PM) -* -* @package notifications */ + class report_pm_closed extends \phpbb\notification\type\pm { /** @@ -24,7 +27,7 @@ class report_pm_closed extends \phpbb\notification\type\pm */ public function get_type() { - return 'report_pm_closed'; + return 'notification.type.report_pm_closed'; } /** @@ -49,7 +52,8 @@ class report_pm_closed extends \phpbb\notification\type\pm /** * Find the users who want to receive notifications * - * @param array $pm Data from + * @param array $pm Data from submit_pm + * @param array $options Options for finding users for notification * * @return array */ @@ -60,7 +64,7 @@ class report_pm_closed extends \phpbb\notification\type\pm return array(); } - return array($pm['reporter'] => array('')); + return array($pm['reporter'] => $this->notification_manager->get_default_methods()); } /** @@ -102,9 +106,21 @@ class report_pm_closed extends \phpbb\notification\type\pm { $username = $this->user_loader->get_username($this->get_data('closer_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, - $username, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', censor_text($this->get_data('message_subject')) ); } @@ -114,7 +130,7 @@ class report_pm_closed extends \phpbb\notification\type\pm */ public function get_avatar() { - return $this->user_loader->get_avatar($this->get_data('closer_id')); + return $this->user_loader->get_avatar($this->get_data('closer_id'), false, true); } /** @@ -128,21 +144,24 @@ class report_pm_closed extends \phpbb\notification\type\pm } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $pm PM Data - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($pm, $pre_create_data = array()) { $this->set_data('closer_id', $pm['closer_id']); - $data = parent::create_insert_array($pm, $pre_create_data); + parent::create_insert_array($pm, $pre_create_data); - $this->notification_time = $data['notification_time'] = time(); + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index 9bf035b91e..84a5241417 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,8 +16,6 @@ namespace phpbb\notification\type; /** * Reported post notifications class * This class handles notifications for reported posts -* -* @package notifications */ class report_post extends \phpbb\notification\type\post_in_queue { @@ -24,7 +26,17 @@ class report_post extends \phpbb\notification\type\post_in_queue */ public function get_type() { - return 'report_post'; + return 'notification.type.report_post'; + } + + /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-reported'; } /** @@ -54,8 +66,8 @@ class report_post extends \phpbb\notification\type\post_in_queue * @var bool|array False if the service should use it's default data * Array of data (including keys 'id' and 'lang') */ - public static $notification_option = array( - 'id' => 'report', + static public $notification_option = array( + 'id' => 'notification.type.report', 'lang' => 'NOTIFICATION_TYPE_REPORT', 'group' => 'NOTIFICATION_GROUP_MODERATION', ); @@ -64,6 +76,7 @@ class report_post extends \phpbb\notification\type\post_in_queue * Find the users who want to receive notifications * * @param array $post Data from the post + * @param array $options Options for finding users for notification * * @return array */ @@ -126,34 +139,54 @@ class report_post extends \phpbb\notification\type\post_in_queue */ public function get_title() { - $this->user->add_lang('mcp'); + $this->language->add_lang('mcp'); $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); + return $this->language->lang( + $this->language_key, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('post_subject')) + ); + } + + /** + * Get the reason for the notification + * + * @return string + */ + public function get_reason() + { if ($this->get_data('report_text')) { - return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('post_subject')), + return $this->language->lang( + 'NOTIFICATION_REASON', $this->get_data('report_text') ); } - if (isset($this->user->lang[$this->get_data('reason_title')])) + if ($this->language->is_set($this->get_data('reason_title'))) { - return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('post_subject')), - $this->user->lang[$this->get_data('reason_title')] + return $this->language->lang( + 'NOTIFICATION_REASON', + $this->language->lang($this->get_data('reason_title')) ); } - return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('post_subject')), + return $this->language->lang( + 'NOTIFICATION_REASON', $this->get_data('reason_description') ); } @@ -163,7 +196,7 @@ class report_post extends \phpbb\notification\type\post_in_queue */ public function get_avatar() { - return $this->user_loader->get_avatar($this->get_data('reporter_id')); + return $this->user_loader->get_avatar($this->get_data('reporter_id'), false, true); } /** @@ -177,13 +210,7 @@ class report_post extends \phpbb\notification\type\post_in_queue } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { @@ -192,6 +219,6 @@ class report_post extends \phpbb\notification\type\post_in_queue $this->set_data('reason_description', $post['reason_description']); $this->set_data('report_text', $post['report_text']); - return parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); } } diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index fff45612b3..165034d57e 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Post report closed notifications class * This class handles notifications for when reports are closed on posts (for the one who reported the post) -* -* @package notifications */ + class report_post_closed extends \phpbb\notification\type\post { /** @@ -24,7 +27,7 @@ class report_post_closed extends \phpbb\notification\type\post */ public function get_type() { - return 'report_post_closed'; + return 'notification.type.report_post_closed'; } /** @@ -56,7 +59,8 @@ class report_post_closed extends \phpbb\notification\type\post /** * Find the users who want to receive notifications * - * @param array $post Data from + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification * * @return array */ @@ -67,7 +71,7 @@ class report_post_closed extends \phpbb\notification\type\post return array(); } - return array($post['reporter'] => array('')); + return array($post['reporter'] => $this->notification_manager->get_default_methods()); } /** @@ -109,9 +113,21 @@ class report_post_closed extends \phpbb\notification\type\post { $username = $this->user_loader->get_username($this->get_data('closer_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, - $username, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', censor_text($this->get_data('post_subject')) ); } @@ -121,7 +137,7 @@ class report_post_closed extends \phpbb\notification\type\post */ public function get_avatar() { - return $this->user_loader->get_avatar($this->get_data('closer_id')); + return $this->user_loader->get_avatar($this->get_data('closer_id'), false, true); } /** @@ -135,21 +151,24 @@ class report_post_closed extends \phpbb\notification\type\post } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { $this->set_data('closer_id', $post['closer_id']); - $data = parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); - $this->notification_time = $data['notification_time'] = time(); + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 98f086a50b..671c34fe96 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Topic notifications class * This class handles notifications for new topics -* -* @package notifications */ + class topic extends \phpbb\notification\type\base { /** @@ -24,7 +27,7 @@ class topic extends \phpbb\notification\type\base */ public function get_type() { - return 'topic'; + return 'notification.type.topic'; } /** @@ -47,11 +50,27 @@ class topic extends \phpbb\notification\type\base * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_TOPIC', 'group' => 'NOTIFICATION_GROUP_POSTING', ); + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + /** * Is available */ @@ -64,8 +83,9 @@ class topic extends \phpbb\notification\type\base * Get the id of the item * * @param array $post The data from the post + * @return int The topic id */ - public static function get_item_id($post) + static public function get_item_id($post) { return (int) $post['topic_id']; } @@ -74,8 +94,9 @@ class topic extends \phpbb\notification\type\base * Get the id of the parent * * @param array $post The data from the post + * @return int The forum id */ - public static function get_item_parent_id($post) + static public function get_item_parent_id($post) { return (int) $post['forum_id']; } @@ -84,6 +105,7 @@ class topic extends \phpbb\notification\type\base * Find the users who want to receive notifications * * @param array $topic Data from the topic + * @param array $options Options for finding users for notification * * @return array */ @@ -103,23 +125,11 @@ class topic extends \phpbb\notification\type\base $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); - if (empty($users)) - { - return array(); - } - - $auth_read = $this->auth->acl_get_list($users, 'f_read', $topic['forum_id']); - - if (empty($auth_read)) - { - return array(); - } - - return $this->check_user_notification_options($auth_read[$topic['forum_id']]['f_read'], $options); + return $this->get_authorised_recipients($users, $topic['forum_id'], $options); } /** @@ -127,7 +137,7 @@ class topic extends \phpbb\notification\type\base */ public function get_avatar() { - return $this->user_loader->get_avatar($this->get_data('poster_id')); + return $this->user_loader->get_avatar($this->get_data('poster_id'), false, true); } /** @@ -146,10 +156,34 @@ class topic extends \phpbb\notification\type\base $username = $this->user_loader->get_username($this->get_data('poster_id'), 'no_profile'); } - return $this->user->lang( + return $this->language->lang( $this->language_key, - $username, - censor_text($this->get_data('topic_title')), + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** + * Get the forum of the notification reference + * + * @return string + */ + public function get_forum() + { + return $this->language->lang( + 'NOTIFICATION_FORUM', $this->get_data('forum_name') ); } @@ -241,18 +275,13 @@ class topic extends \phpbb\notification\type\base { $tracking_data[$row['user_id']] = $row['mark_time']; } + $this->db->sql_freeresult($result); return $tracking_data; } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { @@ -273,6 +302,6 @@ class topic extends \phpbb\notification\type\base $this->notification_read = true; } - return parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); } } diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php index c8c1b5b7e2..2d732b9cd7 100644 --- a/phpBB/phpbb/notification/type/topic_in_queue.php +++ b/phpBB/phpbb/notification/type/topic_in_queue.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,9 +16,8 @@ namespace phpbb\notification\type; /** * Topic in queue notifications class * This class handles notifications for topics when they are put in the moderation queue (for moderators) -* -* @package notifications */ + class topic_in_queue extends \phpbb\notification\type\topic { /** @@ -24,7 +27,7 @@ class topic_in_queue extends \phpbb\notification\type\topic */ public function get_type() { - return 'topic_in_queue'; + return 'notification.type.topic_in_queue'; } /** @@ -40,8 +43,8 @@ class topic_in_queue extends \phpbb\notification\type\topic * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( - 'id' => 'needs_approval', + static public $notification_option = array( + 'id' => 'notification.type.needs_approval', 'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE', 'group' => 'NOTIFICATION_GROUP_MODERATION', ); @@ -67,6 +70,7 @@ class topic_in_queue extends \phpbb\notification\type\topic * Find the users who want to receive notifications * * @param array $topic Data from the topic + * @param array $options Options for finding users for notification * * @return array */ @@ -104,7 +108,7 @@ class topic_in_queue extends \phpbb\notification\type\topic } return $this->check_user_notification_options($auth_read[$topic['forum_id']]['f_read'], array_merge($options, array( - 'item_type' => self::$notification_option['id'], + 'item_type' => static::$notification_option['id'], ))); } @@ -119,19 +123,22 @@ class topic_in_queue extends \phpbb\notification\type\topic } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $topic Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($topic, $pre_create_data = array()) { - $data = parent::create_insert_array($topic, $pre_create_data); + parent::create_insert_array($topic, $pre_create_data); + + $this->notification_time = time(); + } - $this->notification_time = $data['notification_time'] = time(); + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; return $data; } diff --git a/phpBB/phpbb/notification/type/type_interface.php b/phpBB/phpbb/notification/type/type_interface.php index e3e6898172..f9f832bdda 100644 --- a/phpBB/phpbb/notification/type/type_interface.php +++ b/phpBB/phpbb/notification/type/type_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\notification\type; /** * Base notifications interface -* @package notifications */ interface type_interface { @@ -34,14 +37,14 @@ interface type_interface * * @param array $type_data The type specific data */ - public static function get_item_id($type_data); + static public function get_item_id($type_data); /** * Get the id of the parent * * @param array $type_data The type specific data */ - public static function get_item_parent_id($type_data); + static public function get_item_parent_id($type_data); /** * Is this type available to the current user (defines whether or not it will be shown in the UCP Edit notification options) @@ -85,6 +88,13 @@ interface type_interface public function load_special($data, $notifications); /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class(); + + /** * Get the HTML formatted title of this notification * * @return string @@ -92,6 +102,20 @@ interface type_interface public function get_title(); /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference(); + + /** + * Get the forum of the notification reference + * + * @return string + */ + public function get_forum(); + + /** * Get the url to this item * * @return string URL @@ -99,6 +123,13 @@ interface type_interface public function get_url(); /** + * Get the url to redirect after the item has been marked as read + * + * @return string URL + */ + public function get_redirect_url(); + + /** * URL to unsubscribe to this notification * * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item @@ -146,14 +177,18 @@ interface type_interface /** * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) * * @param array $type_data The type specific data * @param array $pre_create_data Data from pre_create_insert_array() + */ + public function create_insert_array($type_data, $pre_create_data); + + /** + * Function for getting the data for insertion in an SQL query * * @return array Array of data ready to be inserted into the database */ - public function create_insert_array($type_data, $pre_create_data); + public function get_insert_array(); /** * Function for preparing the data for update in an SQL query @@ -171,7 +206,7 @@ interface type_interface * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) * @return string */ - public function mark_read($return); + public function mark_read($return = false); /** * Mark this item unread @@ -179,5 +214,5 @@ interface type_interface * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) * @return string */ - public function mark_unread($return); + public function mark_unread($return = false); } diff --git a/phpBB/phpbb/pagination.php b/phpBB/phpbb/pagination.php index 57e7932341..7a81c25ad2 100644 --- a/phpBB/phpbb/pagination.php +++ b/phpBB/phpbb/pagination.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpbb -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,16 +21,26 @@ class pagination /** @var \phpbb\user */ protected $user; + /** @var \phpbb\controller\helper */ + protected $helper; + + /** @var \phpbb\event\dispatcher_interface */ + protected $phpbb_dispatcher; + /** * Constructor * - * @param \phpbb\template\template $template - * @param \phpbb\user $user + * @param \phpbb\template\template $template + * @param \phpbb\user $user + * @param \phpbb\controller\helper $helper + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\event\dispatcher_interface $phpbb_dispatcher) { $this->template = $template; $this->user = $user; + $this->helper = $helper; + $this->phpbb_dispatcher = $phpbb_dispatcher; } /** @@ -40,13 +54,60 @@ class pagination * If you use page numbers inside your controller route, start name should be the string * that should be removed for the first page (example: /page/%d) * @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce - * @return URL for the requested page + * @return string URL for the requested page */ protected function generate_page_link($base_url, $on_page, $start_name, $per_page) { - if (strpos($start_name, '%d') !== false) + // A listener can set this variable to the new pagination URL + // to override the generate_page_link() function generated value + $generate_page_link_override = false; + + /** + * Execute code and/or override generate_page_link() + * + * To override the generate_page_link() function generated value + * set $generate_page_link_override to the new URL value + * + * @event core.pagination_generate_page_link + * @var string base_url is url prepended to all links generated within the function + * If you use page numbers inside your controller route, base_url should contains a placeholder (%d) + * for the page. Also be sure to specify the pagination path information into the start_name argument + * @var string on_page is the page for which we want to generate the link + * @var string start_name is the name of the parameter containing the first item of the given page (example: start=20) + * If you use page numbers inside your controller route, start name should be the string + * that should be removed for the first page (example: /page/%d) + * @var int per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce + * @var bool|string generate_page_link_override Shall we return custom pagination link (string URL) or not (false) + * @since 3.1.0-RC5 + */ + $vars = array('base_url', 'on_page', 'start_name', 'per_page', 'generate_page_link_override'); + extract($this->phpbb_dispatcher->trigger_event('core.pagination_generate_page_link', compact($vars))); + + if ($generate_page_link_override) + { + return $generate_page_link_override; + } + + if (!is_string($base_url)) { - return ($on_page > 1) ? sprintf($base_url, (int) $on_page) : str_replace($start_name, '', $base_url); + if (is_array($base_url['routes'])) + { + $route = ($on_page > 1) ? $base_url['routes'][1] : $base_url['routes'][0]; + } + else + { + $route = $base_url['routes']; + } + $params = (isset($base_url['params'])) ? $base_url['params'] : array(); + $is_amp = (isset($base_url['is_amp'])) ? $base_url['is_amp'] : true; + $session_id = (isset($base_url['session_id'])) ? $base_url['session_id'] : false; + + if ($on_page > 1 || !is_array($base_url['routes'])) + { + $params[$start_name] = (int) $on_page; + } + + return $this->helper->route($route, $params, $is_amp, $session_id); } else { @@ -103,8 +164,8 @@ class pagination // determine this number. Again at most five pages? Then just display them all. More than // five and we first (min) determine whether we'd end up listing more pages than exist. // We then (max) ensure we're displaying the minimum number of pages. - $start_page = ($total_pages > 5) ? min(max(1, $on_page - 3), $total_pages - 4) : 1; - $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages; + $start_page = ($total_pages > 5) ? min(max(1, $on_page - 2), $total_pages - 4) : 1; + $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 2), 5) : $total_pages; } if ($on_page != 1) @@ -194,7 +255,8 @@ class pagination $tpl_prefix = ($tpl_prefix == 'PAGINATION') ? '' : $tpl_prefix . '_'; $template_array = array( - $tpl_prefix . 'BASE_URL' => $base_url, + $tpl_prefix . 'BASE_URL' => is_string($base_url) ? $base_url : '',//@todo: Fix this for routes + $tpl_prefix . 'START_NAME' => $start_name, $tpl_prefix . 'PER_PAGE' => $per_page, 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page != 1) ? $u_previous_page : '', 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '', diff --git a/phpBB/phpbb/passwords/driver/base.php b/phpBB/phpbb/passwords/driver/base.php index 8256fd721c..fd07a61bf4 100644 --- a/phpBB/phpbb/passwords/driver/base.php +++ b/phpBB/phpbb/passwords/driver/base.php @@ -1,23 +1,24 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords\driver; -/** -* @package passwords -*/ abstract class base implements driver_interface { - /** @var phpbb\config\config */ + /** @var \phpbb\config\config */ protected $config; - /** @var phpbb\passwords\driver\helper */ + /** @var \phpbb\passwords\driver\helper */ protected $helper; /** @var driver name */ @@ -36,10 +37,26 @@ abstract class base implements driver_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function is_supported() { return true; } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function get_settings_only($hash, $full = false) + { + return false; + } } diff --git a/phpBB/phpbb/passwords/driver/bcrypt.php b/phpBB/phpbb/passwords/driver/bcrypt.php index 1d1b1e267d..eab1c3d569 100644 --- a/phpBB/phpbb/passwords/driver/bcrypt.php +++ b/phpBB/phpbb/passwords/driver/bcrypt.php @@ -1,23 +1,24 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords\driver; -/** -* @package passwords -*/ class bcrypt extends base { const PREFIX = '$2a$'; /** - * @inheritdoc + * {@inheritdoc} */ public function get_prefix() { @@ -25,7 +26,7 @@ class bcrypt extends base } /** - * @inheritdoc + * {@inheritdoc} */ public function hash($password, $salt = '') { @@ -57,9 +58,9 @@ class bcrypt extends base } /** - * @inheritdoc + * {@inheritdoc} */ - public function check($password, $hash) + public function check($password, $hash, $user_row = array()) { $salt = substr($hash, 0, 29); if (strlen($salt) != 29) @@ -67,7 +68,7 @@ class bcrypt extends base return false; } - if ($hash == $this->hash($password, $salt)) + if ($this->helper->string_compare($hash, $this->hash($password, $salt))) { return true; } @@ -85,7 +86,7 @@ class bcrypt extends base } /** - * @inheritdoc + * {@inheritdoc} */ public function get_settings_only($hash, $full = false) { diff --git a/phpBB/phpbb/passwords/driver/bcrypt_2y.php b/phpBB/phpbb/passwords/driver/bcrypt_2y.php index 11c3617e49..c710e0d04a 100644 --- a/phpBB/phpbb/passwords/driver/bcrypt_2y.php +++ b/phpBB/phpbb/passwords/driver/bcrypt_2y.php @@ -1,23 +1,24 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords\driver; -/** -* @package passwords -*/ class bcrypt_2y extends bcrypt { const PREFIX = '$2y$'; /** - * @inheritdoc + * {@inheritdoc} */ public function get_prefix() { @@ -25,7 +26,7 @@ class bcrypt_2y extends bcrypt } /** - * @inheritdoc + * {@inheritdoc} */ public function is_supported() { diff --git a/phpBB/phpbb/passwords/driver/bcrypt_wcf2.php b/phpBB/phpbb/passwords/driver/bcrypt_wcf2.php new file mode 100644 index 0000000000..0eee98d7b7 --- /dev/null +++ b/phpBB/phpbb/passwords/driver/bcrypt_wcf2.php @@ -0,0 +1,84 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class bcrypt_wcf2 extends base +{ + const PREFIX = '$wcf2$'; + + /** @var \phpbb\passwords\driver\bcrypt */ + protected $bcrypt; + + /** @var \phpbb\passwords\driver\helper */ + protected $helper; + + /** + * Constructor of passwords driver object + * + * @param \phpbb\passwords\driver\bcrypt $bcrypt Salted md5 driver + * @param \phpbb\passwords\driver\helper $helper Password driver helper + */ + public function __construct(\phpbb\passwords\driver\bcrypt $bcrypt, helper $helper) + { + $this->bcrypt = $bcrypt; + $this->helper = $helper; + } + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + if (empty($hash) || strlen($hash) != 60) + { + return false; + } + else + { + $salt = substr($hash, 0, 29); + + if (strlen($salt) != 29) + { + return false; + } + // Works for standard WCF 2.x, i.e. WBB4 and similar + return $this->helper->string_compare($hash, $this->bcrypt->hash($this->bcrypt->hash($password, $salt), $salt)); + } + } +} diff --git a/phpBB/phpbb/passwords/driver/convert_password.php b/phpBB/phpbb/passwords/driver/convert_password.php new file mode 100644 index 0000000000..eb70434df2 --- /dev/null +++ b/phpBB/phpbb/passwords/driver/convert_password.php @@ -0,0 +1,43 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class convert_password extends base +{ + const PREFIX = '$CP$'; + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + return false; + } +} diff --git a/phpBB/phpbb/passwords/driver/driver_interface.php b/phpBB/phpbb/passwords/driver/driver_interface.php index ebaf0626af..3974484f13 100644 --- a/phpBB/phpbb/passwords/driver/driver_interface.php +++ b/phpBB/phpbb/passwords/driver/driver_interface.php @@ -1,17 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords\driver; -/** -* @package passwords -*/ interface driver_interface { /** @@ -22,6 +23,13 @@ interface driver_interface public function is_supported(); /** + * Check if hash type is a legacy hash type + * + * @return bool True if it's a legacy hash type, false if not + */ + public function is_legacy(); + + /** * Returns the hash prefix * * @return string Hash prefix @@ -43,10 +51,11 @@ interface driver_interface * * @param string $password The password to check * @param string $hash The password hash to check against + * @param array $user_row User's row in users table * * @return bool True if password is correct, else false */ - public function check($password, $hash); + public function check($password, $hash, $user_row = array()); /** * Get only the settings of the specified hash diff --git a/phpBB/phpbb/passwords/driver/helper.php b/phpBB/phpbb/passwords/driver/helper.php index 4b8dc9a123..f80c3e3df6 100644 --- a/phpBB/phpbb/passwords/driver/helper.php +++ b/phpBB/phpbb/passwords/driver/helper.php @@ -1,21 +1,22 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords\driver; -/** -* @package passwords -*/ class helper { /** - * @var phpbb\config\config + * @var \phpbb\config\config */ protected $config; @@ -28,7 +29,7 @@ class helper /** * Construct a driver helper object * - * @param phpbb\config\config $config phpBB configuration + * @param \phpbb\config\config $config phpBB configuration */ public function __construct(\phpbb\config\config $config) { @@ -141,4 +142,36 @@ class helper } return $random; } + + /** + * Compare two strings byte by byte + * + * @param string $string_a The first string + * @param string $string_b The second string + * + * @return bool True if strings are the same, false if not + */ + public function string_compare($string_a, $string_b) + { + // Return if input variables are not strings or if length does not match + if (!is_string($string_a) || !is_string($string_b) || strlen($string_a) != strlen($string_b)) + { + return false; + } + + // Use hash_equals() if it's available + if (function_exists('hash_equals')) + { + return hash_equals($string_a, $string_b); + } + + $difference = 0; + + for ($i = 0; $i < strlen($string_a) && $i < strlen($string_b); $i++) + { + $difference |= ord($string_a[$i]) ^ ord($string_b[$i]); + } + + return $difference === 0; + } } diff --git a/phpBB/phpbb/passwords/driver/md5_mybb.php b/phpBB/phpbb/passwords/driver/md5_mybb.php new file mode 100644 index 0000000000..f631ceae78 --- /dev/null +++ b/phpBB/phpbb/passwords/driver/md5_mybb.php @@ -0,0 +1,60 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class md5_mybb extends base +{ + const PREFIX = '$md5_mybb$'; + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + if (empty($hash) || strlen($hash) != 32 || !isset($user_row['user_passwd_salt'])) + { + return false; + } + else + { + // Works for myBB 1.1.x, 1.2.x, 1.4.x, 1.6.x + return $this->helper->string_compare($hash, md5(md5($user_row['user_passwd_salt']) . md5($password))); + } + } +} diff --git a/phpBB/phpbb/passwords/driver/md5_phpbb2.php b/phpBB/phpbb/passwords/driver/md5_phpbb2.php new file mode 100644 index 0000000000..bd8cc51e5a --- /dev/null +++ b/phpBB/phpbb/passwords/driver/md5_phpbb2.php @@ -0,0 +1,123 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class md5_phpbb2 extends base +{ + const PREFIX = '$md5_phpbb2$'; + + /** @var \phpbb\request\request phpBB request object */ + protected $request; + + /** @var \phpbb\passwords\driver\salted_md5 */ + protected $salted_md5; + + /** @var \phpbb\passwords\driver\helper */ + protected $helper; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var string php file extension */ + protected $php_ext; + + /** + * Constructor of passwords driver object + * + * @param \phpbb\request\request $request phpBB request object + * @param \phpbb\passwords\driver\salted_md5 $salted_md5 Salted md5 driver + * @param \phpbb\passwords\driver\helper $helper Driver helper + * @param string $phpbb_root_path phpBB root path + * @param string $php_ext PHP file extension + */ + public function __construct($request, salted_md5 $salted_md5, helper $helper, $phpbb_root_path, $php_ext) + { + $this->request = $request; + $this->salted_md5 = $salted_md5; + $this->helper = $helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + if (strlen($hash) != 32 && strlen($hash) != 34) + { + return false; + } + + // enable super globals to get literal value + // this is needed to prevent unicode normalization + $super_globals_disabled = $this->request->super_globals_disabled(); + if ($super_globals_disabled) + { + $this->request->enable_super_globals(); + } + + // in phpBB2 passwords were used exactly as they were sent, with addslashes applied + $password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : ''; + $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format; + $password_new_format = $this->request->variable('password', '', true); + + if ($super_globals_disabled) + { + $this->request->disable_super_globals(); + } + + if ($password == $password_new_format) + { + if (!function_exists('utf8_to_cp1252')) + { + include($this->phpbb_root_path . 'includes/utf/data/recode_basic.' . $this->php_ext); + } + + if ($this->helper->string_compare(md5($password_old_format), $hash) || $this->helper->string_compare(md5(\utf8_to_cp1252($password_old_format)), $hash) + || $this->salted_md5->check(md5($password_old_format), $hash) === true + || $this->salted_md5->check(md5(\utf8_to_cp1252($password_old_format)), $hash) === true) + { + return true; + } + } + + return false; + } +} diff --git a/phpBB/phpbb/passwords/driver/md5_vb.php b/phpBB/phpbb/passwords/driver/md5_vb.php new file mode 100644 index 0000000000..280b7114c7 --- /dev/null +++ b/phpBB/phpbb/passwords/driver/md5_vb.php @@ -0,0 +1,60 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class md5_vb extends base +{ + const PREFIX = '$md5_vb$'; + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + if (empty($hash) || strlen($hash) != 32 || !isset($user_row['user_passwd_salt'])) + { + return false; + } + else + { + // Works for vB 3.8.x, 4.x.x, 5.0.x + return $this->helper->string_compare($hash, md5(md5($password) . $user_row['user_passwd_salt'])); + } + } +} diff --git a/phpBB/phpbb/passwords/driver/phpass.php b/phpBB/phpbb/passwords/driver/phpass.php index 80c4d7a7f0..bef8355276 100644 --- a/phpBB/phpbb/passwords/driver/phpass.php +++ b/phpBB/phpbb/passwords/driver/phpass.php @@ -1,23 +1,24 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords\driver; -/** -* @package passwords -*/ class phpass extends salted_md5 { const PREFIX = '$P$'; /** - * @inheritdoc + * {@inheritdoc} */ public function get_prefix() { diff --git a/phpBB/phpbb/passwords/driver/salted_md5.php b/phpBB/phpbb/passwords/driver/salted_md5.php index 5c72726422..38d6d9cd2c 100644 --- a/phpBB/phpbb/passwords/driver/salted_md5.php +++ b/phpBB/phpbb/passwords/driver/salted_md5.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -37,15 +41,12 @@ namespace phpbb\passwords\driver; * */ -/** -* @package passwords -*/ class salted_md5 extends base { const PREFIX = '$H$'; /** - * @inheritdoc + * {@inheritdoc} */ public function get_prefix() { @@ -53,7 +54,15 @@ class salted_md5 extends base } /** - * @inheritdoc + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} */ public function hash($password, $setting = '') { @@ -66,7 +75,7 @@ class salted_md5 extends base // happen if pre-determined settings are // directly passed to the driver. The manager // will not do this. Same as the old hashing - // implementatio in phpBB 3.0 + // implementation in phpBB 3.0 return md5($password); } } @@ -89,16 +98,16 @@ class salted_md5 extends base } /** - * @inheritdoc + * {@inheritdoc} */ - public function check($password, $hash) + public function check($password, $hash, $user_row = array()) { if (strlen($hash) !== 34) { return md5($password) === $hash; } - return $hash === $this->hash($password, $hash); + return $this->helper->string_compare($hash, $this->hash($password, $hash)); } /** @@ -151,7 +160,7 @@ class salted_md5 extends base } /** - * @inheritdoc + * {@inheritdoc} */ public function get_settings_only($hash, $full = false) { diff --git a/phpBB/phpbb/passwords/driver/sha1.php b/phpBB/phpbb/passwords/driver/sha1.php new file mode 100644 index 0000000000..1abead42cd --- /dev/null +++ b/phpBB/phpbb/passwords/driver/sha1.php @@ -0,0 +1,52 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class sha1 extends base +{ + const PREFIX = '$sha1$'; + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + return (strlen($hash) == 40) ? $this->helper->string_compare($hash, sha1($password)) : false; + } +} diff --git a/phpBB/phpbb/passwords/driver/sha1_smf.php b/phpBB/phpbb/passwords/driver/sha1_smf.php new file mode 100644 index 0000000000..b30d87265e --- /dev/null +++ b/phpBB/phpbb/passwords/driver/sha1_smf.php @@ -0,0 +1,51 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class sha1_smf extends base +{ + const PREFIX = '$smf$'; + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + return (isset($user_row['login_name'])) ? sha1(strtolower($user_row['login_name']) . $password) : false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + return (strlen($hash) == 40) ? $this->helper->string_compare($hash, $this->hash($password, $user_row)) : false; + } +} diff --git a/phpBB/phpbb/passwords/driver/sha1_wcf1.php b/phpBB/phpbb/passwords/driver/sha1_wcf1.php new file mode 100644 index 0000000000..68006486c4 --- /dev/null +++ b/phpBB/phpbb/passwords/driver/sha1_wcf1.php @@ -0,0 +1,60 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class sha1_wcf1 extends base +{ + const PREFIX = '$wcf1$'; + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + if (empty($hash) || strlen($hash) != 40 || !isset($user_row['user_passwd_salt'])) + { + return false; + } + else + { + // Works for standard WCF 1.x, i.e. WBB3 and similar + return $this->helper->string_compare($hash, sha1($user_row['user_passwd_salt'] . sha1($user_row['user_passwd_salt'] . sha1($password)))); + } + } +} diff --git a/phpBB/phpbb/passwords/driver/sha_xf1.php b/phpBB/phpbb/passwords/driver/sha_xf1.php new file mode 100644 index 0000000000..9d8f01796e --- /dev/null +++ b/phpBB/phpbb/passwords/driver/sha_xf1.php @@ -0,0 +1,68 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class sha_xf1 extends base +{ + const PREFIX = '$xf1$'; + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * {@inheritdoc} + */ + public function is_legacy() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = array()) + { + if (empty($hash) || (strlen($hash) != 40 && strlen($hash) != 64) || !isset($user_row['user_passwd_salt'])) + { + return false; + } + else + { + // Works for xenforo 1.0, 1.1 + if ($this->helper->string_compare($hash, sha1(sha1($password) . $user_row['user_passwd_salt'])) + || $this->helper->string_compare($hash, hash('sha256', hash('sha256', $password) . $user_row['user_passwd_salt']))) + { + return true; + } + else + { + return false; + } + } + } +} diff --git a/phpBB/phpbb/passwords/helper.php b/phpBB/phpbb/passwords/helper.php index 95bad5805f..c2a49202cd 100644 --- a/phpBB/phpbb/passwords/helper.php +++ b/phpBB/phpbb/passwords/helper.php @@ -1,17 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords; -/** -* @package passwords -*/ class helper { /** @@ -59,7 +60,7 @@ class helper $data[$type] .= ($data[$type] !== '$') ? '\\' : ''; $data[$type] .= str_replace('$', '', $value); } - elseif ($type == 'settings') + else if ($type == 'settings') { $data[$type] .= ($data[$type] !== '$') ? '$' : ''; $data[$type] .= $value; diff --git a/phpBB/phpbb/passwords/manager.php b/phpBB/phpbb/passwords/manager.php index 0ac6b05ec4..b2caba81f2 100644 --- a/phpBB/phpbb/passwords/manager.php +++ b/phpBB/phpbb/passwords/manager.php @@ -1,17 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\passwords; -/** -* @package passwords -*/ class manager { /** @@ -38,32 +39,58 @@ class manager /** * Passwords helper - * @var phpbb\passwords\helper + * @var \phpbb\passwords\helper */ protected $helper; /** * phpBB configuration - * @var phpbb\config\config + * @var \phpbb\config\config */ protected $config; /** + * @var bool Whether or not initialized() has been called + */ + private $initialized = false; + + /** + * @var array Hashing driver service collection + */ + private $hashing_algorithms; + + /** + * @var array List of default driver types + */ + private $defaults; + + /** * Construct a passwords object * - * @param phpbb\config\config $config phpBB configuration - * @param array $hashing_algorithms Hashing driver - * service collection - * @param phpbb\passwords\helper $helper Passwords helper object - * @param string $defaults List of default driver types + * @param \phpbb\config\config $config phpBB configuration + * @param array $hashing_algorithms Hashing driver service collection + * @param \phpbb\passwords\helper $helper Passwords helper object + * @param array $defaults List of default driver types */ public function __construct(\phpbb\config\config $config, $hashing_algorithms, helper $helper, $defaults) { $this->config = $config; $this->helper = $helper; + $this->hashing_algorithms = $hashing_algorithms; + $this->defaults = $defaults; + } - $this->fill_type_map($hashing_algorithms); - $this->register_default_type($defaults); + /** + * Initialize the internal state + */ + protected function initialize() + { + if (!$this->initialized) + { + $this->initialized = true; + $this->fill_type_map($this->hashing_algorithms); + $this->register_default_type($this->defaults); + } } /** @@ -88,7 +115,7 @@ class manager /** * Fill algorithm type map * - * @param phpbb\di\service_collection $hashing_algorithms + * @param \phpbb\di\service_collection $hashing_algorithms */ protected function fill_type_map($hashing_algorithms) { @@ -140,9 +167,11 @@ class manager */ if (!preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $hash, $match)) { - return $this->get_algorithm('$H$'); + return false; } + $this->initialize(); + // Be on the lookout for multiple hashing algorithms // 2 is correct: H\2a > 2, H\P > 2 if (strlen($match[1]) > 2) @@ -191,6 +220,8 @@ class manager return false; } + $this->initialize(); + // Try to retrieve algorithm by service name if type doesn't // start with dollar sign if (!is_array($type) && strpos($type, '$') !== 0 && isset($this->algorithms[$type])) @@ -223,9 +254,10 @@ class manager * * @param string $password Password that should be checked * @param string $hash Stored hash + * @param array $user_row User's row in users table * @return string|bool True if password is correct, false if not */ - public function check($password, $hash) + public function check($password, $hash, $user_row = array()) { if (strlen($password) > 4096) { @@ -234,11 +266,21 @@ class manager return false; } + // Empty hashes can't be checked + if (empty($hash)) + { + return false; + } + + $this->initialize(); + // First find out what kind of hash we're dealing with $stored_hash_type = $this->detect_algorithm($hash); if ($stored_hash_type == false) { - return false; + // Still check MD5 hashes as that is what the installer + // will default to for the admin user + return $this->get_algorithm('$H$')->check($password, $hash); } // Multiple hash passes needed @@ -258,6 +300,21 @@ class manager $this->convert_flag = false; } + // Check all legacy hash types if prefix is $CP$ + if ($stored_hash_type->get_prefix() === '$CP$') + { + // Remove $CP$ prefix for proper checking + $hash = substr($hash, 4); + + foreach ($this->type_map as $algorithm) + { + if ($algorithm->is_legacy() && $algorithm->check($password, $hash, $user_row) === true) + { + return true; + } + } + } + return $stored_hash_type->check($password, $hash); } @@ -272,6 +329,8 @@ class manager */ public function combined_hash_password($password_hash, $type) { + $this->initialize(); + $data = array( 'prefix' => '$', 'settings' => '$', diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index a8e12c4063..7b0d6f0fba 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,16 +15,18 @@ namespace phpbb; /** * A class with various functions that are related to paths, files and the filesystem -* @package phpBB3 */ class path_helper { /** @var \phpbb\symfony_request */ protected $symfony_request; - /** @var \phpbb\filesystem */ + /** @var \phpbb\filesystem\filesystem_interface */ protected $filesystem; + /** @var \phpbb\request\request_interface */ + protected $request; + /** @var string */ protected $phpbb_root_path; @@ -37,14 +43,17 @@ class path_helper * Constructor * * @param \phpbb\symfony_request $symfony_request - * @param \phpbb\filesystem $filesystem + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param \phpbb\request\request_interface $request * @param string $phpbb_root_path Relative path to phpBB root - * @param string $php_ext PHP extension (php) + * @param string $php_ext PHP file extension + * @param mixed $adm_relative_path Relative path admin path to adm/ root */ - public function __construct(\phpbb\symfony_request $symfony_request, \phpbb\filesystem $filesystem, $phpbb_root_path, $php_ext, $adm_relative_path = null) + public function __construct(\phpbb\symfony_request $symfony_request, \phpbb\filesystem\filesystem_interface $filesystem, \phpbb\request\request_interface $request, $phpbb_root_path, $php_ext, $adm_relative_path = null) { $this->symfony_request = $symfony_request; $this->filesystem = $filesystem; + $this->request = $request; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->adm_relative_path = $adm_relative_path; @@ -95,7 +104,13 @@ class path_helper { $path = substr($path, strlen($this->phpbb_root_path)); - return $this->get_web_root_path() . $path; + $web_root_path = $this->get_web_root_path(); + if (substr($web_root_path, -8) === 'app.php/' && substr($path, 0, 7) === 'app.php') + { + $path = substr($path, 8); + } + + return $this->filesystem->clean_path($web_root_path . $path); } return $path; @@ -139,6 +154,7 @@ class path_helper return $this->web_root_path; } + // We do not need to escape $path_info, $request_uri and $script_name because we can not find their content in the result. // Path info (e.g. /foo/bar) $path_info = $this->filesystem->clean_path($this->symfony_request->getPathInfo()); @@ -149,6 +165,16 @@ class path_helper $script_name = $this->symfony_request->getScriptName(); /* + * If the path info is empty but we're using app.php, then we + * might be using an empty route like app.php/ which is + * supported by symfony's routing + */ + if ($path_info === '/' && preg_match('/app\.' . $this->php_ext . '\/$/', $request_uri)) + { + return $this->web_root_path = $this->filesystem->clean_path('./../' . $this->phpbb_root_path); + } + + /* * If the path info is empty (single /), then we're not using * a route like app.php/foo/bar */ @@ -157,31 +183,120 @@ class path_helper return $this->web_root_path = $this->phpbb_root_path; } + /* + * Check AJAX request: + * If the current request is a AJAX we need to fix the paths. + * We need to get the root path based on the Referer, so we can use + * the generated URLs in the template of the Referer. If we do not + * generate the relative path based on the Referer, but based on the + * currently requested URL, the generated URLs will not point to the + * intended locations: + * Referer desired URL desired relative root path + * memberlist.php faq.php ./ + * memberlist.php app.php/foo/bar ./ + * app.php/foo memberlist.php ../ + * app.php/foo app.php/fox ../ + * app.php/foo/bar memberlist.php ../../ + * ../page.php memberlist.php ./phpBB/ + * ../sub/page.php memberlist.php ./../phpBB/ + * + * The referer must be specified as a parameter in the query. + */ + if ($this->request->is_ajax() && $this->symfony_request->get('_referer')) + { + // We need to escape $absolute_board_url because it can be partially concatenated to the result. + $absolute_board_url = $this->request->escape($this->symfony_request->getSchemeAndHttpHost() . $this->symfony_request->getBasePath(), true); + + $referer_web_root_path = $this->get_web_root_path_from_ajax_referer( + $this->symfony_request->get('_referer'), + $absolute_board_url + ); + return $this->web_root_path = $this->phpbb_root_path . $referer_web_root_path; + } + // How many corrections might we need? $corrections = substr_count($path_info, '/'); /* - * If the script name (e.g. phpBB/app.php) exists in the - * requestUri (e.g. phpBB/app.php/foo/template), then we - * are have a non-rewritten URL. + * If the script name (e.g. phpBB/app.php) does not exists in the + * requestUri (e.g. phpBB/app.php/foo/template), then we are rewriting + * the URL. So we must reduce the slash count by 1. */ - if (strpos($request_uri, $script_name) === 0) + if (strpos($request_uri, $script_name) !== 0) { - /* - * Append ../ to the end of the phpbb_root_path as many times - * as / exists in path_info - */ - return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections); + $corrections--; } - /* - * If we're here it means we're at a re-written path, so we must - * correct the relative path for web URLs. We must append ../ - * to the end of the root path as many times as / exists in path_info - * less one time (because the script, e.g. /app.php, doesn't exist in - * the URL) - */ - return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections - 1); + // Prepend ../ to the phpbb_root_path as many times as / exists in path_info + $this->web_root_path = $this->filesystem->clean_path( + './' . str_repeat('../', $corrections) . $this->phpbb_root_path + ); + return $this->web_root_path; + } + + /** + * Get the web root path of the referer form an ajax request + * + * @param string $absolute_referer_url + * @param string $absolute_board_url + * @return string + */ + public function get_web_root_path_from_ajax_referer($absolute_referer_url, $absolute_board_url) + { + // If the board URL is in the beginning of the referer, this means + // we the referer is in the board URL or a subdirectory of it. + // So we just need to count the / (slashes) in the left over part of + // the referer and prepend ../ the the current root_path, to get the + // web root path of the referer. + if (strpos($absolute_referer_url, $absolute_board_url) === 0) + { + $relative_referer_path = substr($absolute_referer_url, strlen($absolute_board_url)); + $has_params = strpos($relative_referer_path, '?'); + if ($has_params !== false) + { + $relative_referer_path = substr($relative_referer_path, 0, $has_params); + } + $corrections = substr_count($relative_referer_path, '/'); + return $this->phpbb_root_path . str_repeat('../', $corrections - 1); + } + + // If not, it's a bit more complicated. We go to the parent directory + // of the referer until we find the remaining referer in the board URL. + // Foreach directory we need to add a ../ to the fixed root_path. + // When we finally found it, we need to remove the remaining referer + // from the board URL, to get the boards root path. + // If the then append these two strings, we get our fixed web root path. + $fixed_root_path = ''; + $referer_dir = $absolute_referer_url; + $has_params = strpos($referer_dir, '?'); + if ($has_params !== false) + { + $referer_dir = substr($referer_dir, 0, $has_params); + } + + // If we do not find a slash at the end of the referer, we come + // from a file. So the first dirname() does not need a traversal + // path correction. + if (substr($referer_dir, -1) !== '/') + { + $referer_dir = dirname($referer_dir); + } + + while (($dir_position = strpos($absolute_board_url, $referer_dir)) !== 0) + { + $fixed_root_path .= '../'; + $referer_dir = dirname($referer_dir); + + // Just return phpbb_root_path if we reach the top directory + if ($referer_dir === '.') + { + return $this->phpbb_root_path; + } + } + + $fixed_root_path .= substr($absolute_board_url, strlen($referer_dir) + 1); + // Add trailing slash + return $this->phpbb_root_path . $fixed_root_path . '/'; } /** @@ -206,4 +321,172 @@ class path_helper return $scheme . $this->filesystem->clean_path($path); } + + /** + * Glue URL parameters together + * + * @param array $params URL parameters in the form of array(name => value) + * @return string Returns the glued string, e.g. name1=value1&name2&name3=value3 + */ + public function glue_url_params($params) + { + $_params = array(); + + foreach ($params as $key => $value) + { + // some parameters do not have value + if ($value !== null) + { + $_params[] = $key . '=' . $value; + } + else + { + $_params[] = $key; + } + } + return implode('&', $_params); + } + + /** + * Get the base and parameters of a URL + * + * @param string $url URL to break apart + * @param bool $is_amp Is the parameter separator &. Defaults to true. + * @return array Returns the base and parameters in the form of array('base' => string, 'params' => array(name => value)) + */ + public function get_url_parts($url, $is_amp = true) + { + $separator = ($is_amp) ? '&' : '&'; + $params = array(); + + if (strpos($url, '?') !== false) + { + $base = substr($url, 0, strpos($url, '?')); + $args = substr($url, strlen($base) + 1); + $args = ($args) ? explode($separator, $args) : array(); + + foreach ($args as $argument) + { + if (empty($argument)) + { + continue; + } + + // some parameters don't have value + if (strpos($argument, '=') !== false) + { + list($key, $value) = explode('=', $argument, 2); + } + else + { + $key = $argument; + $value = null; + } + + if ($key === '') + { + continue; + } + + $params[$key] = $value; + } + } + else + { + $base = $url; + } + + return array( + 'base' => $base, + 'params' => $params, + ); + } + + /** + * Strip parameters from an already built URL. + * + * @param string $url URL to strip parameters from + * @param array|string $strip Parameters to strip. + * @param bool $is_amp Is the parameter separator &. Defaults to true. + * @return string Returns the new URL. + */ + public function strip_url_params($url, $strip, $is_amp = true) + { + $url_parts = $this->get_url_parts($url, $is_amp); + $params = $url_parts['params']; + + if (!is_array($strip)) + { + $strip = array($strip); + } + + if (!empty($params)) + { + // Strip the parameters off + foreach ($strip as $param) + { + unset($params[$param]); + } + } + + return $url_parts['base'] . (($params) ? '?' . $this->glue_url_params($params) : ''); + } + + /** + * Append parameters to an already built URL. + * + * @param string $url URL to append parameters to + * @param array $new_params Parameters to add in the form of array(name => value) + * @param bool $is_amp Is the parameter separator &. Defaults to true. + * @return string Returns the new URL. + */ + public function append_url_params($url, $new_params, $is_amp = true) + { + $url_parts = $this->get_url_parts($url, $is_amp); + $params = array_merge($url_parts['params'], $new_params); + + // Move the sid to the end if it's set + if (isset($params['sid'])) + { + $sid = $params['sid']; + unset($params['sid']); + $params['sid'] = $sid; + } + + return $url_parts['base'] . (($params) ? '?' . $this->glue_url_params($params) : ''); + } + + /** + * Get a valid page + * + * @param string $page The page to verify + * @param bool $mod_rewrite Whether mod_rewrite is enabled, default: false + * + * @return string A valid page based on given page and mod_rewrite + */ + public function get_valid_page($page, $mod_rewrite = false) + { + // We need to be cautious here. + // On some situations, the redirect path is an absolute URL, sometimes a relative path + // For a relative path, let's prefix it with $phpbb_root_path to point to the correct location, + // else we use the URL directly. + $url_parts = parse_url($page); + + // URL + if ($url_parts === false || empty($url_parts['scheme']) || empty($url_parts['host'])) + { + // Remove 'app.php/' from the page, when rewrite is enabled. + // Treat app.php as a reserved file name and remove on mod rewrite + // even if it might not be in the phpBB root. + if ($mod_rewrite && ($app_position = strpos($page, 'app.' . $this->php_ext . '/')) !== false) + { + $page = substr($page, 0, $app_position) . substr($page, $app_position + strlen('app.' . $this->php_ext . '/')); + } + + // Remove preceding slashes from page name and prepend root path + $page = $this->get_phpbb_root_path() . ltrim($page, '/\\'); + } + + return $page; + } } diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index a3fddb0b9e..c9181e6202 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,7 +17,7 @@ class permissions { /** * Event dispatcher object - * @var \phpbb\event\dispatcher + * @var \phpbb\event\dispatcher_interface */ protected $dispatcher; @@ -26,11 +30,10 @@ class permissions /** * Constructor * - * @param \phpbb\event\dispatcher $phpbb_dispatcher Event dispatcher + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher * @param \phpbb\user $user User Object - * @return null */ - public function __construct(\phpbb\event\dispatcher $phpbb_dispatcher, \phpbb\user $user) + public function __construct(\phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\user $user) { $this->dispatcher = $phpbb_dispatcher; $this->user = $user; @@ -57,7 +60,7 @@ class permissions * 'lang' => 'ACL_U_VIEWPROFILE', * 'cat' => 'profile', * ), - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('types', 'categories', 'permissions'); extract($phpbb_dispatcher->trigger_event('core.permissions', compact($vars))); @@ -157,6 +160,28 @@ class permissions } /** + * Checks if a category has been defined + * + * @param string $category Identifier of the category + * @return bool True if the category is defined, false otherwise + */ + public function category_defined($category) + { + return isset($this->categories[$category]); + } + + /** + * Checks if a permission has been defined + * + * @param string $permission Identifier of the permission + * @return bool True if the permission is defined, false otherwise + */ + public function permission_defined($permission) + { + return isset($this->permissions[$permission]); + } + + /** * Returns the language string of a permission * * @param string $permission Identifier of the permission @@ -248,6 +273,7 @@ class permissions 'f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'), 'f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'), 'f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'), + 'f_announce_global' => array('lang' => 'ACL_F_ANNOUNCE_GLOBAL', 'cat' => 'post'), 'f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'), 'f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'), 'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'), @@ -274,15 +300,17 @@ class permissions 'm_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'), 'm_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'), 'm_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'), + 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'post_actions'), + 'm_softdelete' => array('lang' => 'ACL_M_SOFTDELETE', 'cat' => 'post_actions'), 'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'), 'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'), 'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'), 'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'), - 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'), - 'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), - 'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'), + 'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), + 'm_pm_report' => array('lang' => 'ACL_M_PM_REPORT', 'cat' => 'misc'), + 'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'), // Admin Permissions 'a_board' => array('lang' => 'ACL_A_BOARD', 'cat' => 'settings'), diff --git a/phpBB/phpbb/php/ini.php b/phpBB/phpbb/php/ini.php index f0f53807fe..73a30659a6 100644 --- a/phpBB/phpbb/php/ini.php +++ b/phpBB/phpbb/php/ini.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,8 +17,6 @@ namespace phpbb\php; * Wrapper class for ini_get function. * * Provides easier handling of the different interpretations of ini values. -* -* @package phpBB */ class ini { diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index 6bff2b8a7e..a47fc87adf 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\plupload; /** * This class handles all server-side plupload functions -* -* @package \phpbb\plupload\plupload */ class plupload { @@ -37,7 +39,7 @@ class plupload protected $user; /** - * @var \phpbb\php\ini + * @var \bantu\IniGetWrapper\IniGetWrapper */ protected $php_ini; @@ -65,12 +67,10 @@ class plupload * @param \phpbb\config\config $config * @param \phpbb\request\request_interface $request * @param \phpbb\user $user - * @param \phpbb\php\ini $php_ini + * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini * @param \phpbb\mimetype\guesser $mimetype_guesser - * - * @return null */ - public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini, \phpbb\mimetype\guesser $mimetype_guesser) + public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \phpbb\mimetype\guesser $mimetype_guesser) { $this->phpbb_root_path = $phpbb_root_path; $this->config = $config; @@ -79,8 +79,7 @@ class plupload $this->php_ini = $php_ini; $this->mimetype_guesser = $mimetype_guesser; - $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path']; - $this->temporary_directory = $this->upload_directory . '/plupload'; + $this->set_default_directories(); } /** @@ -120,10 +119,13 @@ class plupload { rename("{$file_path}.part", $file_path); + // Reset upload directories to defaults once completed + $this->set_default_directories(); + // Need to modify some of the $_FILES values to reflect the new file return array( 'tmp_name' => $file_path, - 'name' => $this->request->variable('real_filename', ''), + 'name' => $this->request->variable('real_filename', '', true), 'size' => filesize($file_path), 'type' => $this->mimetype_guesser->guess($file_path, $file_name), ); @@ -146,10 +148,11 @@ class plupload * @param \phpbb\template\template $template * @param string $s_action The URL to submit the POST data to * @param int $forum_id The ID of the forum + * @param int $max_files Maximum number of files allowed. 0 for unlimited. * * @return null */ - public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id) + public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id, $max_files) { $filters = $this->generate_filter_string($cache, $forum_id); $chunk_size = $this->get_chunk_size(); @@ -161,6 +164,9 @@ class plupload 'FILTERS' => $filters, 'CHUNK_SIZE' => $chunk_size, 'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action), + 'MAX_ATTACHMENTS' => $max_files, + 'ATTACH_ORDER' => ($this->config['display_order']) ? 'asc' : 'desc', + 'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files), )); $this->user->add_lang('plupload'); @@ -261,8 +267,8 @@ class plupload { $resize = sprintf( 'resize: {width: %d, height: %d, quality: 100},', - (int) $this->config['img_max_height'], - (int) $this->config['img_max_width'] + (int) $this->config['img_max_width'], + (int) $this->config['img_max_height'] ); } @@ -278,9 +284,9 @@ class plupload public function get_chunk_size() { $max = min( - $this->php_ini->get_bytes('upload_max_filesize'), - $this->php_ini->get_bytes('post_max_size'), - max(1, $this->php_ini->get_bytes('memory_limit')), + $this->php_ini->getBytes('upload_max_filesize'), + $this->php_ini->getBytes('post_max_size'), + max(1, $this->php_ini->getBytes('memory_limit')), $this->config['max_filesize'] ); @@ -297,7 +303,7 @@ class plupload $this->temporary_directory, $this->config['plupload_salt'], md5($file_name), - \filespec::get_extension($file_name) + \phpbb\files\filespec::get_extension($file_name) ); } @@ -320,7 +326,7 @@ class plupload $tmp_file = $this->temporary_filepath($upload['tmp_name']); - if (!move_uploaded_file($upload['tmp_name'], $tmp_file)) + if (!phpbb_is_writable($this->temporary_directory) || !move_uploaded_file($upload['tmp_name'], $tmp_file)) { $this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED'); } @@ -368,4 +374,29 @@ class plupload ); } } + + /** + * Sets the default directories for uploads + * + * @return null + */ + protected function set_default_directories() + { + $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path']; + $this->temporary_directory = $this->upload_directory . '/plupload'; + } + + /** + * Sets the upload directories to the specified paths + * + * @param string $upload_directory Upload directory + * @param string $temporary_directory Temporary directory + * + * @return null + */ + public function set_upload_directories($upload_directory, $temporary_directory) + { + $this->upload_directory = $upload_directory; + $this->temporary_directory = $temporary_directory; + } } diff --git a/phpBB/phpbb/profilefields/lang_helper.php b/phpBB/phpbb/profilefields/lang_helper.php index 7bae1bdc18..2e353722b2 100644 --- a/phpBB/phpbb/profilefields/lang_helper.php +++ b/phpBB/phpbb/profilefields/lang_helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\profilefields; /** * Custom Profile Fields -* @package phpBB3 */ class lang_helper { @@ -23,7 +26,7 @@ class lang_helper /** * Database object - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; @@ -36,7 +39,7 @@ class lang_helper /** * Construct * - * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\db\driver\driver_interface $db Database object * @param string $language_table Table where the language strings are stored */ public function __construct($db, $language_table) @@ -46,43 +49,50 @@ class lang_helper } /** - * Get language entries for options and store them here for later use + * Loads preview options into language entries for options + * + * @param int $field_id + * @param int $lang_id + * @param mixed $preview_options */ - public function get_option_lang($field_id, $lang_id, $field_type, $preview_options) + public function load_preview_options($field_id, $lang_id, $preview_options) { - if ($preview_options !== false) - { - $lang_options = (!is_array($preview_options)) ? explode("\n", $preview_options) : $preview_options; + $lang_options = (!is_array($preview_options)) ? explode("\n", $preview_options) : $preview_options; - foreach ($lang_options as $num => $var) + foreach ($lang_options as $num => $var) + { + if (!isset($this->options_lang[$field_id])) { - if (!isset($this->options_lang[$field_id])) - { - $this->options_lang[$field_id] = array(); - } - if (!isset($this->options_lang[$field_id][$lang_id])) - { - $this->options_lang[$field_id][$lang_id] = array(); - } - $this->options_lang[$field_id][$lang_id][($num + 1)] = $var; + $this->options_lang[$field_id] = array(); } + if (!isset($this->options_lang[$field_id][$lang_id])) + { + $this->options_lang[$field_id][$lang_id] = array(); + } + $this->options_lang[$field_id][$lang_id][($num + 1)] = $var; } - else - { - $sql = 'SELECT option_id, lang_value + } + + /** + * Fetches language entries for options from DB + * + * @param int $lang_id + */ + public function load_option_lang($lang_id) + { + $sql = 'SELECT field_id, option_id, lang_value FROM ' . $this->language_table . ' - WHERE field_id = ' . (int) $field_id . ' - AND lang_id = ' . (int) $lang_id . " - AND field_type = '" . $this->db->sql_escape($field_type) . "' + WHERE lang_id = ' . (int) $lang_id . " ORDER BY option_id"; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - $this->options_lang[$field_id][$lang_id][($row['option_id'] + 1)] = $row['lang_value']; - } - $this->db->sql_freeresult($result); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $this->options_lang[$row['field_id']][$lang_id][($row['option_id'] + 1)] = $row['lang_value']; } + + $this->db->sql_freeresult($result); } /** diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index ac2542a6d4..ea4b24af56 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb\profilefields; /** * Custom Profile Fields -* @package phpBB3 */ class manager { @@ -23,11 +26,17 @@ class manager /** * Database object - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** * Request object * @var \phpbb\request\request */ @@ -63,7 +72,8 @@ class manager * Construct * * @param \phpbb\auth\auth $auth Auth object - * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\event\dispatcher_interface $dispatcher Event dispatcher object * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\di\service_collection $type_collection @@ -72,10 +82,11 @@ class manager * @param string $fields_language_table * @param string $fields_data_table */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\di\service_collection $type_collection, \phpbb\user $user, $fields_table, $fields_language_table, $fields_data_table) + public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\di\service_collection $type_collection, \phpbb\user $user, $fields_table, $fields_language_table, $fields_data_table) { $this->auth = $auth; $this->db = $db; + $this->dispatcher = $dispatcher; $this->request = $request; $this->template = $template; $this->type_collection = $type_collection; @@ -231,14 +242,11 @@ class manager if (!$this->db->sql_affectedrows()) { + $cp_data = $this->build_insert_sql_array($cp_data); $cp_data['user_id'] = (int) $user_id; - $this->db->sql_return_on_error(true); - $sql = 'INSERT INTO ' . $this->fields_data_table . ' ' . $this->db->sql_build_array('INSERT', $cp_data); $this->db->sql_query($sql); - - $this->db->sql_return_on_error(false); } } @@ -268,116 +276,200 @@ class manager $profile_field = $this->type_collection[$field_data['field_type']]; $tpl_fields[] = array( + 'PROFILE_FIELD_IDENT' => $field_ident, 'PROFILE_FIELD_TYPE' => $field_data['field_type'], 'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']), 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($field_data['lang_explain']), ); } + $profile_cache = $this->profile_cache; + + /** + * Event to modify template headlines of the generated profile fields + * + * @event core.generate_profile_fields_template_headlines + * @var string restrict_option Restrict the published fields to a certain profile field option + * @var array tpl_fields Array with template data fields + * @var array profile_cache A copy of the profile cache to make additional checks + * @since 3.1.6-RC1 + */ + $vars = array( + 'restrict_option', + 'tpl_fields', + 'profile_cache', + ); + extract($this->dispatcher->trigger_event('core.generate_profile_fields_template_headlines', compact($vars))); + unset($profile_cache); + return $tpl_fields; } /** - * Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled) - * This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template + * Grab the user specific profile fields data + * + * @param int|array $user_ids Single user id or an array of ids + * @return array Users profile fields data */ - public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false) + public function grab_profile_fields_data($user_ids = 0) { - if ($mode == 'grab') + if (!is_array($user_ids)) { - if (!is_array($user_id)) - { - $user_id = array($user_id); - } + $user_ids = array($user_ids); + } - if (!sizeof($this->profile_cache)) - { - $this->build_cache(); - } + if (!sizeof($this->profile_cache)) + { + $this->build_cache(); + } - if (!sizeof($user_id)) - { - return array(); - } + if (!sizeof($user_ids)) + { + return array(); + } - $sql = 'SELECT * - FROM ' . $this->fields_data_table . ' - WHERE ' . $this->db->sql_in_set('user_id', array_map('intval', $user_id)); - $result = $this->db->sql_query($sql); + $sql = 'SELECT * + FROM ' . $this->fields_data_table . ' + WHERE ' . $this->db->sql_in_set('user_id', array_map('intval', $user_ids)); + $result = $this->db->sql_query($sql); - $field_data = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $field_data[$row['user_id']] = $row; - } - $this->db->sql_freeresult($result); + $field_data = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $field_data[$row['user_id']] = $row; + } + $this->db->sql_freeresult($result); - $user_fields = array(); + /** + * Event to modify profile fields data retrieved from the database + * + * @event core.grab_profile_fields_data + * @var array user_ids Single user id or an array of ids + * @var array field_data Array with profile fields data + * @since 3.1.0-b3 + */ + $vars = array('user_ids', 'field_data'); + extract($this->dispatcher->trigger_event('core.grab_profile_fields_data', compact($vars))); - $user_ids = $user_id; + $user_fields = array(); - // Go through the fields in correct order - foreach (array_keys($this->profile_cache) as $used_ident) + // Go through the fields in correct order + foreach (array_keys($this->profile_cache) as $used_ident) + { + foreach ($field_data as $user_id => $row) { - foreach ($field_data as $user_id => $row) - { - $user_fields[$user_id][$used_ident]['value'] = $row['pf_' . $used_ident]; - $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; - } + $user_fields[$user_id][$used_ident]['value'] = $row['pf_' . $used_ident]; + $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; + } - foreach ($user_ids as $user_id) + foreach ($user_ids as $user_id) + { + if (!isset($user_fields[$user_id][$used_ident]) && $this->profile_cache[$used_ident]['field_show_novalue']) { - if (!isset($user_fields[$user_id][$used_ident]) && $this->profile_cache[$used_ident]['field_show_novalue']) - { - $user_fields[$user_id][$used_ident]['value'] = ''; - $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; - } + $user_fields[$user_id][$used_ident]['value'] = ''; + $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; } } - - return $user_fields; } - else if ($mode == 'show') + + return $user_fields; + } + + /** + * Assign the user's profile fields data to the template + * + * @param array $profile_row Array with users profile field data + * @param bool $use_contact_fields Should we display contact fields as such? + * This requires special treatments (links should not be parsed in the values, and more) + * @return array + */ + public function generate_profile_fields_template_data($profile_row, $use_contact_fields = true) + { + // $profile_row == $user_fields[$row['user_id']]; + $tpl_fields = array(); + $tpl_fields['row'] = $tpl_fields['blockrow'] = array(); + + /** + * Event to modify data of the generated profile fields, before the template assignment loop + * + * @event core.generate_profile_fields_template_data_before + * @var array profile_row Array with users profile field data + * @var array tpl_fields Array with template data fields + * @var bool use_contact_fields Should we display contact fields as such? + * @since 3.1.0-b3 + */ + $vars = array('profile_row', 'tpl_fields', 'use_contact_fields'); + extract($this->dispatcher->trigger_event('core.generate_profile_fields_template_data_before', compact($vars))); + + foreach ($profile_row as $ident => $ident_ary) { - // $profile_row == $user_fields[$row['user_id']]; - $tpl_fields = array(); - $tpl_fields['row'] = $tpl_fields['blockrow'] = array(); + $profile_field = $this->type_collection[$ident_ary['data']['field_type']]; + $value = $profile_field->get_profile_value($ident_ary['value'], $ident_ary['data']); + $value_raw = $profile_field->get_profile_value_raw($ident_ary['value'], $ident_ary['data']); - foreach ($profile_row as $ident => $ident_ary) + if ($value === null) { - $profile_field = $this->type_collection[$ident_ary['data']['field_type']]; - $value = $profile_field->get_profile_value($ident_ary['value'], $ident_ary['data']); + continue; + } - if ($value === null) + $field_desc = $contact_url = ''; + if ($use_contact_fields && $ident_ary['data']['field_is_contact']) + { + $value = $profile_field->get_profile_contact_value($ident_ary['value'], $ident_ary['data']); + $field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']); + if (strpos($field_desc, '%s') !== false) { - continue; + $field_desc = sprintf($field_desc, $value); } + $contact_url = ''; + if (strpos($ident_ary['data']['field_contact_url'], '%s') !== false) + { + $contact_url = sprintf($ident_ary['data']['field_contact_url'], $value); + } + } - $tpl_fields['row'] += array( - 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, - 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], - 'PROFILE_' . strtoupper($ident) . '_NAME' => $this->user->lang($ident_ary['data']['lang_name']), - 'PROFILE_' . strtoupper($ident) . '_EXPLAIN'=> $this->user->lang($ident_ary['data']['lang_explain']), - - 'S_PROFILE_' . strtoupper($ident) => true, - ); + $tpl_fields['row'] += array( + 'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident, + 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, + 'PROFILE_' . strtoupper($ident) . '_VALUE_RAW' => $value_raw, + 'PROFILE_' . strtoupper($ident) . '_CONTACT' => $contact_url, + 'PROFILE_' . strtoupper($ident) . '_DESC' => $field_desc, + 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], + 'PROFILE_' . strtoupper($ident) . '_NAME' => $this->user->lang($ident_ary['data']['lang_name']), + 'PROFILE_' . strtoupper($ident) . '_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), + + 'S_PROFILE_' . strtoupper($ident) . '_CONTACT' => $ident_ary['data']['field_is_contact'], + 'S_PROFILE_' . strtoupper($ident) => true, + ); - $tpl_fields['blockrow'][] = array( - 'PROFILE_FIELD_VALUE' => $value, - 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], - 'PROFILE_FIELD_NAME' => $this->user->lang($ident_ary['data']['lang_name']), - 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), + $tpl_fields['blockrow'][] = array( + 'PROFILE_FIELD_IDENT' => $ident, + 'PROFILE_FIELD_VALUE' => $value, + 'PROFILE_FIELD_VALUE_RAW' => $value_raw, + 'PROFILE_FIELD_CONTACT' => $contact_url, + 'PROFILE_FIELD_DESC' => $field_desc, + 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], + 'PROFILE_FIELD_NAME' => $this->user->lang($ident_ary['data']['lang_name']), + 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), + + 'S_PROFILE_CONTACT' => $ident_ary['data']['field_is_contact'], + 'S_PROFILE_' . strtoupper($ident) => true, + ); + } - 'S_PROFILE_' . strtoupper($ident) => true, - ); - } + /** + * Event to modify template data of the generated profile fields + * + * @event core.generate_profile_fields_template_data + * @var array profile_row Array with users profile field data + * @var array tpl_fields Array with template data fields + * @var bool use_contact_fields Should we display contact fields as such? + * @since 3.1.0-b3 + */ + $vars = array('profile_row', 'tpl_fields', 'use_contact_fields'); + extract($this->dispatcher->trigger_event('core.generate_profile_fields_template_data', compact($vars))); - return $tpl_fields; - } - else - { - trigger_error('Wrong mode for custom profile', E_USER_ERROR); - } + return $tpl_fields; } /** diff --git a/phpBB/phpbb/profilefields/type/type_base.php b/phpBB/phpbb/profilefields/type/type_base.php index 9c363a7b4e..9b4bada26d 100644 --- a/phpBB/phpbb/profilefields/type/type_base.php +++ b/phpBB/phpbb/profilefields/type/type_base.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -35,7 +39,6 @@ abstract class type_base implements type_interface * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object - * @param string $language_table Table where the language strings are stored */ public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { @@ -87,6 +90,14 @@ abstract class type_base implements type_interface /** * {@inheritDoc} */ + public function get_profile_contact_value($field_value, $field_data) + { + return $this->get_profile_value($field_value, $field_data); + } + + /** + * {@inheritDoc} + */ public function get_language_options_input($field_data) { $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true); @@ -122,7 +133,7 @@ abstract class type_base implements type_interface { foreach ($field_data[$key] as $lang_id => $options) { - $field_data[$key][$lang_id] = explode("\n", $options); + $field_data[$key][$lang_id] = is_array($options) ? $options : explode("\n", $options); } return $current_value; @@ -147,7 +158,19 @@ abstract class type_base implements type_interface } else { - return $this->request->variable($key, '', true); + $default_value = ''; + $lang_fields = array( + 'l_lang_name', + 'l_lang_explain', + 'l_lang_default_value', + 'l_lang_options', + ); + + if (in_array($key, $lang_fields)) + { + $default_value = array(0 => ''); + } + return $this->request->variable($key, $default_value, true); } } diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index fa9c0a8714..f6f3f17a6c 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -42,7 +46,6 @@ class type_bool extends type_base * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object - * @param string $language_table Table where the language strings are stored */ public function __construct(\phpbb\profilefields\lang_helper $lang_helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { @@ -152,7 +155,7 @@ class type_bool extends type_base if (!$this->lang_helper->is_set($field_id, $lang_id)) { - $this->lang_helper->get_option_lang($field_id, $lang_id, FIELD_BOOL, false); + $this->lang_helper->load_option_lang($lang_id); } if (!$field_value && $field_data['field_show_novalue']) @@ -170,8 +173,26 @@ class type_bool extends type_base } else { - return $this->lang_helper->is_set($field_id, $lang_id, $field_value + 1); + return $this->lang_helper->is_set($field_id, $lang_id, $field_value + 1) ? $this->lang_helper->get($field_id, $lang_id, $field_value + 1) : null; + } + } + + /** + * {@inheritDoc} + */ + public function get_profile_value_raw($field_value, $field_data) + { + if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) + { + return null; + } + + if (!$field_value && $field_data['field_show_novalue']) + { + $field_value = $field_data['field_novalue']; } + + return $field_value; } /** @@ -200,7 +221,14 @@ class type_bool extends type_base { if (!$this->lang_helper->is_set($profile_row['field_id'], $profile_row['lang_id'], 1)) { - $this->lang_helper->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], $this->get_service_name(), $preview_options); + if ($preview_options) + { + $this->lang_helper->load_preview_options($profile_row['field_id'], $profile_row['lang_id'], $preview_options); + } + else + { + $this->lang_helper->load_option_lang($profile_row['lang_id']); + } } $options = $this->lang_helper->get($profile_row['field_id'], $profile_row['lang_id']); @@ -324,7 +352,7 @@ class type_bool extends type_base } } - if ($step == 3 && ($field_data[$key] || $action != 'edit') && $key == 'l_lang_options') + if ($key == 'l_lang_options' && $this->request->is_set($key)) { $field_data[$key] = $this->request->variable($key, array(0 => array('')), true); @@ -339,29 +367,29 @@ class type_bool extends type_base */ public function prepare_hidden_fields($step, $key, $action, &$field_data) { - if ($key == 'l_lang_options' && $this->request->is_set('l_lang_options')) + if ($key == 'field_default_value') { - return $this->request->variable($key, array(array('')), true); - } - else if ($key == 'field_default_value') - { - return $this->request->variable($key, $field_data[$key]); - } - else - { - if (!$this->request->is_set($key)) - { - return false; - } - else if ($key == 'field_ident' && isset($field_data[$key])) - { - return $field_data[$key]; - } - else + $field_length = $this->request->variable('field_length', 0); + + // Do a simple is set check if using checkbox. + if ($field_length == 2) { - return ($key == 'lang_options') ? $this->request->variable($key, array(''), true) : $this->request->variable($key, '', true); + return $this->request->is_set($key); } + return $this->request->variable($key, $field_data[$key], true); + } + + $default_lang_options = array( + 'l_lang_options' => array(0 => array('')), + 'lang_options' => array(0 => ''), + ); + + if (isset($default_lang_options[$key]) && $this->request->is_set($key)) + { + return $this->request->variable($key, $default_lang_options[$key], true); } + + return parent::prepare_hidden_fields($step, $key, $action, $field_data); } /** diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index fc012dd97a..414484920b 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -35,7 +39,6 @@ class type_date extends type_base * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object - * @param string $language_table Table where the language strings are stored */ public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { @@ -66,9 +69,10 @@ class type_date extends type_base 'field_ident' => 'field_default_value', 'field_type' => $this->get_service_name(), 'field_length' => $field_data['field_length'], + 'lang_options' => $field_data['lang_options'], ); - $always_now = request_var('always_now', -1); + $always_now = $request->variable('always_now', -1); if ($always_now == -1) { $s_checked = ($field_data['field_default_value'] == 'now') ? true : false; @@ -204,6 +208,19 @@ class type_date extends type_base /** * {@inheritDoc} */ + public function get_profile_value_raw($field_value, $field_data) + { + if (($field_value === '' || $field_value === null) && !$field_data['field_show_novalue']) + { + return null; + } + + return $field_value; + } + + /** + * {@inheritDoc} + */ public function generate_field($profile_row, $preview_options = false) { $profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index bcf0ba05f9..17ae89e1b2 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -42,7 +46,6 @@ class type_dropdown extends type_base * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object - * @param string $language_table Table where the language strings are stored */ public function __construct(\phpbb\profilefields\lang_helper $lang_helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { @@ -132,7 +135,7 @@ class type_dropdown extends type_base // retrieve option lang data if necessary if (!$this->lang_helper->is_set($field_data['field_id'], $field_data['lang_id'], 1)) { - $this->lang_helper->get_option_lang($field_data['field_id'], $field_data['lang_id'], $this->get_service_name(), false); + $this->lang_helper->load_option_lang($field_data['lang_id']); } if (!$this->lang_helper->is_set($field_data['field_id'], $field_data['lang_id'], $field_value)) @@ -157,7 +160,7 @@ class type_dropdown extends type_base $lang_id = $field_data['lang_id']; if (!$this->lang_helper->is_set($field_id, $lang_id)) { - $this->lang_helper->get_option_lang($field_id, $lang_id, $this->get_service_name(), false); + $this->lang_helper->load_option_lang($lang_id); } if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) @@ -186,6 +189,24 @@ class type_dropdown extends type_base /** * {@inheritDoc} */ + public function get_profile_value_raw($field_value, $field_data) + { + if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) + { + return null; + } + + if (!$field_value && $field_data['field_show_novalue']) + { + $field_value = $field_data['field_novalue']; + } + + return $field_value; + } + + /** + * {@inheritDoc} + */ public function generate_field($profile_row, $preview_options = false) { $profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; @@ -196,7 +217,14 @@ class type_dropdown extends type_base if (!$this->lang_helper->is_set($profile_row['field_id'], $profile_row['lang_id'], 1)) { - $this->lang_helper->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], $this->get_service_name(), $preview_options); + if ($preview_options) + { + $this->lang_helper->load_preview_options($profile_row['field_id'], $profile_row['lang_id'], $preview_options); + } + else + { + $this->lang_helper->load_option_lang($profile_row['lang_id']); + } } $profile_row['field_value'] = (int) $value; diff --git a/phpBB/phpbb/profilefields/type/type_googleplus.php b/phpBB/phpbb/profilefields/type/type_googleplus.php new file mode 100644 index 0000000000..e6729b1935 --- /dev/null +++ b/phpBB/phpbb/profilefields/type/type_googleplus.php @@ -0,0 +1,66 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\profilefields\type; + +class type_googleplus extends type_string +{ + /** + * {@inheritDoc} + */ + public function get_name() + { + return $this->user->lang('FIELD_GOOGLEPLUS'); + } + + /** + * {@inheritDoc} + */ + public function get_service_name() + { + return 'profilefields.type.googleplus'; + } + + /** + * {@inheritDoc} + */ + public function get_default_option_values() + { + return array( + 'field_length' => 20, + 'field_minlen' => 3, + 'field_maxlen' => 255, + 'field_validation' => '(?:(?!\.{2,})([^<>=+]))+', + 'field_novalue' => '', + 'field_default_value' => '', + ); + } + + /** + * {@inheritDoc} + */ + public function get_profile_contact_value($field_value, $field_data) + { + if (!$field_value && !$field_data['field_show_novalue']) + { + return null; + } + + if (!is_numeric($field_value)) + { + $field_value = '+' . $field_value; + } + + return $field_value; + } +} diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index 267f522d5d..dd08df94c1 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -35,7 +39,6 @@ class type_int extends type_base * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object - * @param string $language_table Table where the language strings are stored */ public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { @@ -61,7 +64,7 @@ class type_int extends type_base 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" size="5" value="' . $field_data['field_length'] . '" />'), 1 => array('TITLE' => $this->user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" size="5" value="' . $field_data['field_minlen'] . '" />'), 2 => array('TITLE' => $this->user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" size="5" value="' . $field_data['field_maxlen'] . '" />'), - 3 => array('TITLE' => $this->user->lang['DEFAULT_VALUE'], 'FIELD' => '<input type="post" name="field_default_value" value="' . $field_data['field_default_value'] . '" />'), + 3 => array('TITLE' => $this->user->lang['DEFAULT_VALUE'], 'FIELD' => '<input type="number" name="field_default_value" value="' . $field_data['field_default_value'] . '" />'), ); return $options; @@ -151,6 +154,18 @@ class type_int extends type_base /** * {@inheritDoc} */ + public function get_profile_value_raw($field_value, $field_data) + { + if (($field_value === '' || $field_value === null) && !$field_data['field_show_novalue']) + { + return null; + } + return (int) $field_value; + } + + /** + * {@inheritDoc} + */ public function generate_field($profile_row, $preview_options = false) { $profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index 94f6882524..ec770f9467 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -90,6 +94,26 @@ interface type_interface public function get_profile_value($field_value, $field_data); /** + * Get Profile Value ID for display (the raw, unprocessed user data) + * + * @param mixed $field_value Field value as stored in the database + * @param array $field_data Array with requirements of the field + * @return mixed Field value ID to display + */ + public function get_profile_value_raw($field_value, $field_data); + + /** + * Get Profile Value for display + * + * When displaying a contact field, we don't want to have links already parsed and more + * + * @param mixed $field_value Field value as stored in the database + * @param array $field_data Array with requirements of the field + * @return mixed Field value to display + */ + public function get_profile_contact_value($field_value, $field_data); + + /** * Generate the input field for display * * @param array $profile_row Array with data for this field @@ -165,8 +189,8 @@ interface type_interface /** * Allows manipulating the intended variables if needed * - * @param string $key Name of the option * @param int $step Step on which the option is hidden + * @param string $key Name of the option * @param string $action Currently performed action (create|edit) * @param array $field_data Array with data for this field * @return mixed Final value of the option diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index 9d241c49ef..67befc457d 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -35,7 +39,6 @@ class type_string extends type_string_common * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object - * @param string $language_table Table where the language strings are stored */ public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { @@ -109,7 +112,7 @@ class type_string extends type_string_common $default_value = $profile_row['lang_default_value']; $profile_row['field_value'] = ($this->request->is_set($field_ident)) ? $this->request->variable($field_ident, $default_value, true) : ((!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false) ? $default_value : $this->user->profile_fields[$field_ident]); - $this->template->assign_block_vars('string', array_change_key_case($profile_row, CASE_UPPER)); + $this->template->assign_block_vars($this->get_name_short(), array_change_key_case($profile_row, CASE_UPPER)); } /** diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index f00a7e6a08..f5e1992044 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,15 +15,28 @@ namespace phpbb\profilefields\type; abstract class type_string_common extends type_base { + protected $validation_options = array( + 'CHARS_ANY' => '.*', + 'NUMBERS_ONLY' => '[0-9]+', + 'ALPHA_ONLY' => '[a-zA-Z0-9]+', + 'ALPHA_UNDERSCORE' => '[\w]+', + 'ALPHA_DOTS' => '[a-zA-Z0-9.]+', + 'ALPHA_SPACERS' => '[\w\x20+\-\[\]]+', + 'ALPHA_PUNCTUATION' => '[a-zA-Z][\w\.,\-]+', + 'LETTER_NUM_ONLY' => '[\p{Lu}\p{Ll}0-9]+', + 'LETTER_NUM_UNDERSCORE' => '[\p{Lu}\p{Ll}0-9_]+', + 'LETTER_NUM_DOTS' => '[\p{Lu}\p{Ll}0-9.]+', + 'LETTER_NUM_SPACERS' => '[\p{Lu}\p{Ll}0-9\x20_+\-\[\]]+', + 'LETTER_NUM_PUNCTUATION' => '[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_]+', + ); + /** * Return possible validation options */ - function validate_options($field_data) + public function validate_options($field_data) { - $validate_ary = array('CHARS_ANY' => '.*', 'NUMBERS_ONLY' => '[0-9]+', 'ALPHA_ONLY' => '[\w]+', 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+'); - $validate_options = ''; - foreach ($validate_ary as $lang => $value) + foreach ($this->validation_options as $lang => $value) { $selected = ($field_data['field_validation'] == $value) ? ' selected="selected"' : ''; $validate_options .= '<option value="' . $value . '"' . $selected . '>' . $this->user->lang[$lang] . '</option>'; @@ -59,7 +76,7 @@ abstract class type_string_common extends type_base { return $this->user->lang('FIELD_TOO_SHORT', (int) $field_data['field_minlen'], $this->get_field_name($field_data['lang_name'])); } - else if ($field_data['field_maxlen'] && utf8_strlen($field_value) > $field_data['field_maxlen']) + else if ($field_data['field_maxlen'] && utf8_strlen(html_entity_decode($field_value)) > $field_data['field_maxlen']) { return $this->user->lang('FIELD_TOO_LONG', (int) $field_data['field_maxlen'], $this->get_field_name($field_data['lang_name'])); } @@ -67,19 +84,14 @@ abstract class type_string_common extends type_base if (!empty($field_data['field_validation']) && $field_data['field_validation'] != '.*') { $field_validate = ($field_type != 'text') ? $field_value : bbcode_nl2br($field_value); - if (!preg_match('#^' . str_replace('\\\\', '\\', $field_data['field_validation']) . '$#i', $field_validate)) + if (!preg_match('#^' . str_replace('\\\\', '\\', $field_data['field_validation']) . '$#iu', $field_validate)) { - switch ($row['field_validation']) + $validation = array_search($field_data['field_validation'], $this->validation_options); + if ($validation) { - case '[0-9]+': - return $this->user->lang('FIELD_INVALID_CHARS_NUMBERS_ONLY', $this->get_field_name($field_data['lang_name'])); - - case '[\w]+': - return $this->user->lang('FIELD_INVALID_CHARS_ALPHA_ONLY', $this->get_field_name($field_data['lang_name'])); - - case '[\w_\+\. \-\[\]]+': - return $this->user->lang('FIELD_INVALID_CHARS_SPACERS_ONLY', $this->get_field_name($field_data['lang_name'])); + return $this->user->lang('FIELD_INVALID_CHARS_' . $validation, $this->get_field_name($field_data['lang_name'])); } + return $this->user->lang('FIELD_INVALID_CHARS_INVALID', $this->get_field_name($field_data['lang_name'])); } } @@ -91,7 +103,7 @@ abstract class type_string_common extends type_base */ public function get_profile_value($field_value, $field_data) { - if (!$field_value && !$field_data['field_show_novalue']) + if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue']) { return null; } @@ -105,6 +117,27 @@ abstract class type_string_common extends type_base /** * {@inheritDoc} */ + public function get_profile_value_raw($field_value, $field_data) + { + if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue']) + { + return null; + } + + return $field_value; + } + + /** + * {@inheritDoc} + */ + public function get_profile_contact_value($field_value, $field_data) + { + return $this->get_profile_value_raw($field_value, $field_data); + } + + /** + * {@inheritDoc} + */ public function prepare_options_form(&$exclude_options, &$visibility_options) { $exclude_options[1][] = 'lang_default_value'; diff --git a/phpBB/phpbb/profilefields/type/type_text.php b/phpBB/phpbb/profilefields/type/type_text.php index 660bb20ef8..bacf60a213 100644 --- a/phpBB/phpbb/profilefields/type/type_text.php +++ b/phpBB/phpbb/profilefields/type/type_text.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -35,7 +39,6 @@ class type_text extends type_string_common * @param \phpbb\request\request $request Request object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object - * @param string $language_table Table where the language strings are stored */ public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { diff --git a/phpBB/phpbb/profilefields/type/type_url.php b/phpBB/phpbb/profilefields/type/type_url.php new file mode 100644 index 0000000000..fe0bffd582 --- /dev/null +++ b/phpBB/phpbb/profilefields/type/type_url.php @@ -0,0 +1,74 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\profilefields\type; + +class type_url extends type_string +{ + /** + * {@inheritDoc} + */ + public function get_name_short() + { + return 'url'; + } + + /** + * {@inheritDoc} + */ + public function get_options($default_lang_id, $field_data) + { + $options = array( + 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" name="field_length" size="5" value="' . $field_data['field_length'] . '" />'), + 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_minlen" size="5" value="' . $field_data['field_minlen'] . '" />'), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_maxlen" size="5" value="' . $field_data['field_maxlen'] . '" />'), + ); + + return $options; + } + + /** + * {@inheritDoc} + */ + public function get_default_option_values() + { + return array( + 'field_length' => 40, + 'field_minlen' => 0, + 'field_maxlen' => 200, + 'field_validation' => '', + 'field_novalue' => '', + 'field_default_value' => '', + ); + } + + /** + * {@inheritDoc} + */ + public function validate_profile_field(&$field_value, $field_data) + { + $field_value = trim($field_value); + + if ($field_value === '' && !$field_data['field_required']) + { + return false; + } + + if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $field_value)) + { + return $this->user->lang('FIELD_INVALID_URL', $this->get_field_name($field_data['lang_name'])); + } + + return false; + } +} diff --git a/phpBB/phpbb/recursive_dot_prefix_filter_iterator.php b/phpBB/phpbb/recursive_dot_prefix_filter_iterator.php new file mode 100644 index 0000000000..2500ba0cf8 --- /dev/null +++ b/phpBB/phpbb/recursive_dot_prefix_filter_iterator.php @@ -0,0 +1,30 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* Class recursive_dot_prefix_filter_iterator +* +* This filter ignores directories starting with a dot. +* When searching for php classes and template files of extensions +* we don't need to look inside these directories. +*/ +class recursive_dot_prefix_filter_iterator extends \RecursiveFilterIterator +{ + public function accept() + { + $filename = $this->current()->getFilename(); + return !$this->current()->isDir() || $filename[0] !== '.'; + } +} diff --git a/phpBB/phpbb/report/controller/report.php b/phpBB/phpbb/report/controller/report.php new file mode 100644 index 0000000000..f703d1cc60 --- /dev/null +++ b/phpBB/phpbb/report/controller/report.php @@ -0,0 +1,319 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\controller; + +use phpbb\exception\http_exception; +use Symfony\Component\HttpFoundation\RedirectResponse; + +class report +{ + /** + * @var \phpbb\config\db + */ + protected $config; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var \phpbb\controller\helper + */ + protected $helper; + + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\captcha\factory + */ + protected $captcha_factory; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var \phpbb\report\report_handler_interface + */ + protected $report_handler; + + /** + * @var \phpbb\report\report_reason_list_provider + */ + protected $report_reason_provider; + + public function __construct(\phpbb\config\db $config, \phpbb\user $user, \phpbb\template\template $template, \phpbb\controller\helper $helper, \phpbb\request\request_interface $request, \phpbb\captcha\factory $captcha_factory, \phpbb\report\handler_factory $report_factory, \phpbb\report\report_reason_list_provider $ui_provider, $phpbb_root_path, $php_ext) + { + $this->config = $config; + $this->user = $user; + $this->template = $template; + $this->helper = $helper; + $this->request = $request; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->captcha_factory = $captcha_factory; + $this->report_handler = $report_factory; + + // User interface factory + $this->report_reason_provider = $ui_provider; + } + + /** + * Controller for /path_to_entities/{id}/report routes + * + * Because of how phpBB organizes routes $mode must be set in the route config. + * + * @param int $id ID of the entity to report + * @param string $mode + * @return \Symfony\Component\HttpFoundation\Response a Symfony response object + * @throws \phpbb\exception\http_exception when $mode or $id is invalid for some reason + */ + public function handle($id, $mode) + { + // Get report handler + $this->report_handler = $this->report_handler->get_instance($mode); + + $this->user->add_lang('mcp'); + + $user_notify = ($this->user->data['is_registered']) ? $this->request->variable('notify', 0) : false; + $reason_id = $this->request->variable('reason_id', 0); + $report_text = $this->request->variable('report_text', '', true); + + $submit = $this->request->variable('submit', ''); + $cancel = $this->request->variable('cancel', ''); + + $error = array(); + $s_hidden_fields = ''; + + $redirect_url = append_sid( + $this->phpbb_root_path . ( ($mode === 'pm') ? 'ucp' : 'viewtopic' ) . ".{$this->php_ext}", + ($mode == 'pm') ? "i=pm&mode=view&p=$id" : "p=$id" + ); + $redirect_url .= ($mode === 'post') ? "#p$id" : ''; + + // Set up CAPTCHA if necessary + if ($this->config['enable_post_confirm'] && !$this->user->data['is_registered']) + { + $captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']); + $captcha->init(CONFIRM_REPORT); + } + + //Has the report been cancelled? + if (!empty($cancel)) + { + return new RedirectResponse($redirect_url, 302); + } + + // Check CAPTCHA, if the form was submited + if (!empty($submit) && isset($captcha)) + { + $captcha_template_array = $this->check_captcha($captcha); + $error = $captcha_template_array['error']; + $s_hidden_fields = $captcha_template_array['hidden_fields']; + } + + // Handle request + try + { + if (!empty($submit) && sizeof($error) === 0) + { + $this->report_handler->add_report( + (int) $id, + (int) $reason_id, + (string) $report_text, + (int) $user_notify + ); + + // Send success message + switch ($mode) + { + case 'pm': + $lang_return = $this->user->lang['RETURN_PM']; + $lang_success = $this->user->lang['PM_REPORTED_SUCCESS']; + break; + case 'post': + $lang_return = $this->user->lang['RETURN_TOPIC']; + $lang_success = $this->user->lang['POST_REPORTED_SUCCESS']; + break; + } + + $this->helper->assign_meta_refresh_var(3, $redirect_url); + $message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>'); + return $this->helper->message($message); + } + else + { + $this->report_handler->validate_report_request($id); + } + } + catch (\phpbb\report\exception\pm_reporting_disabled_exception $exception) + { + throw new http_exception(404, 'PAGE_NOT_FOUND'); + } + catch (\phpbb\report\exception\already_reported_exception $exception) + { + switch ($mode) + { + case 'pm': + $message = $this->user->lang['ALREADY_REPORTED_PM']; + $message .= '<br /><br />' . sprintf($this->user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>'); + break; + case 'post': + $message = $this->user->lang['ALREADY_REPORTED']; + $message .= '<br /><br />' . sprintf($this->user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); + break; + } + + return $this->helper->message($message); + } + catch (\phpbb\report\exception\report_permission_denied_exception $exception) + { + $message = $exception->getMessage(); + if (isset($this->user->lang[$message])) + { + $message = $this->user->lang[$message]; + } + + throw new http_exception(403, $message); + } + catch (\phpbb\report\exception\entity_not_found_exception $exception) + { + $message = $exception->getMessage(); + if (isset($this->user->lang[$message])) + { + $message = $this->user->lang[$message]; + } + + throw new http_exception(404, $message); + } + catch (\phpbb\report\exception\empty_report_exception $exception) + { + $error[] = $this->user->lang['EMPTY_REPORT']; + } + catch (\phpbb\report\exception\invalid_report_exception $exception) + { + return $this->helper->message($exception->getMessage()); + } + + // Setting up an rendering template + $page_title = ($mode === 'pm') ? $this->user->lang['REPORT_MESSAGE'] : $this->user->lang['REPORT_POST']; + $this->assign_template_data( + $mode, + $id, + $reason_id, + $report_text, + $user_notify, + $error, + $s_hidden_fields, + ( isset($captcha) ? $captcha : false ) + ); + + return $this->helper->render('report_body.html', $page_title); + } + + /** + * Assigns template variables + * + * @param int $mode + * @param int $id + * @param int $reason_id + * @param string $report_text + * @param mixed $user_notify + * @param array $error + * @param string $s_hidden_fields + * @param mixed $captcha + * @return null + */ + protected function assign_template_data($mode, $id, $reason_id, $report_text, $user_notify, $error = array(), $s_hidden_fields = '', $captcha = false) + { + if ($captcha !== false && $captcha->is_solved() === false) + { + $this->template->assign_vars(array( + 'S_CONFIRM_CODE' => true, + 'CAPTCHA_TEMPLATE' => $captcha->get_template(), + )); + } + + $this->report_reason_provider->display_reasons($reason_id); + + switch ($mode) + { + case 'pm': + $report_route = $this->helper->route('phpbb_report_pm_controller', array('id' => $id)); + break; + case 'post': + $report_route = $this->helper->route('phpbb_report_post_controller', array('id' => $id)); + break; + } + + $this->template->assign_vars(array( + 'ERROR' => (sizeof($error) > 0) ? implode('<br />', $error) : '', + 'S_REPORT_POST' => ($mode === 'pm') ? false : true, + 'REPORT_TEXT' => $report_text, + 'S_HIDDEN_FIELDS' => (!empty($s_hidden_fields)) ? $s_hidden_fields : null, + 'S_REPORT_ACTION' => $report_route, + + 'S_NOTIFY' => $user_notify, + 'S_CAN_NOTIFY' => ($this->user->data['is_registered']) ? true : false, + 'S_IN_REPORT' => true, + )); + } + + /** + * Check CAPTCHA + * + * @param object $captcha A phpBB CAPTCHA object + * @return array template variables which ensures that CAPTCHA's work correctly + */ + protected function check_captcha($captcha) + { + $error = array(); + $captcha_hidden_fields = ''; + + $visual_confirmation_response = $captcha->validate(); + if ($visual_confirmation_response) + { + $error[] = $visual_confirmation_response; + } + + if (sizeof($error) === 0) + { + $captcha->reset(); + } + else if ($captcha->is_solved() !== false) + { + $captcha_hidden_fields = build_hidden_fields($captcha->get_hidden_fields()); + } + + return array( + 'error' => $error, + 'hidden_fields' => $captcha_hidden_fields, + ); + } +} diff --git a/phpBB/phpbb/report/exception/already_reported_exception.php b/phpBB/phpbb/report/exception/already_reported_exception.php new file mode 100644 index 0000000000..54174044fe --- /dev/null +++ b/phpBB/phpbb/report/exception/already_reported_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\exception; + +class already_reported_exception extends invalid_report_exception +{ + +} diff --git a/phpBB/phpbb/report/exception/empty_report_exception.php b/phpBB/phpbb/report/exception/empty_report_exception.php new file mode 100644 index 0000000000..8c968dca80 --- /dev/null +++ b/phpBB/phpbb/report/exception/empty_report_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\exception; + +class empty_report_exception extends invalid_report_exception +{ + public function __construct() + { + parent::__construct('EMPTY_REPORT'); + } +} diff --git a/phpBB/phpbb/report/exception/entity_not_found_exception.php b/phpBB/phpbb/report/exception/entity_not_found_exception.php new file mode 100644 index 0000000000..732aa58a13 --- /dev/null +++ b/phpBB/phpbb/report/exception/entity_not_found_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\exception; + +class entity_not_found_exception extends invalid_report_exception +{ + +} diff --git a/phpBB/phpbb/report/exception/factory_invalid_argument_exception.php b/phpBB/phpbb/report/exception/factory_invalid_argument_exception.php new file mode 100644 index 0000000000..19de91eea3 --- /dev/null +++ b/phpBB/phpbb/report/exception/factory_invalid_argument_exception.php @@ -0,0 +1,21 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\exception; + +use \phpbb\exception\runtime_exception; + +class factory_invalid_argument_exception extends runtime_exception +{ + +} diff --git a/phpBB/phpbb/report/exception/invalid_report_exception.php b/phpBB/phpbb/report/exception/invalid_report_exception.php new file mode 100644 index 0000000000..03ff0a872d --- /dev/null +++ b/phpBB/phpbb/report/exception/invalid_report_exception.php @@ -0,0 +1,21 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\exception; + +use \phpbb\exception\runtime_exception; + +class invalid_report_exception extends runtime_exception +{ + +} diff --git a/phpBB/phpbb/report/exception/pm_reporting_disabled_exception.php b/phpBB/phpbb/report/exception/pm_reporting_disabled_exception.php new file mode 100644 index 0000000000..2c8ab8cf84 --- /dev/null +++ b/phpBB/phpbb/report/exception/pm_reporting_disabled_exception.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\exception; + +class pm_reporting_disabled_exception extends invalid_report_exception +{ + public function __construct() + { + + } +} diff --git a/phpBB/phpbb/report/exception/report_permission_denied_exception.php b/phpBB/phpbb/report/exception/report_permission_denied_exception.php new file mode 100644 index 0000000000..c7069288b8 --- /dev/null +++ b/phpBB/phpbb/report/exception/report_permission_denied_exception.php @@ -0,0 +1,19 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report\exception; + +class report_permission_denied_exception extends invalid_report_exception +{ + +} diff --git a/phpBB/phpbb/report/handler_factory.php b/phpBB/phpbb/report/handler_factory.php new file mode 100644 index 0000000000..ec229aac54 --- /dev/null +++ b/phpBB/phpbb/report/handler_factory.php @@ -0,0 +1,56 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +use phpbb\report\exception\factory_invalid_argument_exception; + +class handler_factory +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * Constructor + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + */ + public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Return a new instance of an appropriate report handler + * + * @param string $type + * @return \phpbb\report\report_handler_interface + * @throws \phpbb\report\exception\factory_invalid_argument_exception if $type is not valid + */ + public function get_instance($type) + { + switch ($type) + { + case 'pm': + return $this->container->get('phpbb.report.handlers.report_handler_pm'); + break; + case 'post': + return $this->container->get('phpbb.report.handlers.report_handler_post'); + break; + } + + throw new factory_invalid_argument_exception(); + } +} diff --git a/phpBB/phpbb/report/report_handler.php b/phpBB/phpbb/report/report_handler.php new file mode 100644 index 0000000000..126a206dbf --- /dev/null +++ b/phpBB/phpbb/report/report_handler.php @@ -0,0 +1,104 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +abstract class report_handler implements report_handler_interface +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\config\db + */ + protected $config; + + /** + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var \phpbb\notification\manager + */ + protected $notifications; + + /** + * @var array + */ + protected $report_data; + + /** + * Construtor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\config\db $config + * @param \phpbb\auth\auth $auth + * @param \phpbb\user $user + * @param \phpbb\notification\manager $notification + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\db $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\notification\manager $notification) + { + $this->db = $db; + $this->dispatcher = $dispatcher; + $this->config = $config; + $this->auth = $auth; + $this->user = $user; + $this->notifications = $notification; + $this->report_data = array(); + } + + /** + * Creates a report entity in the database + * + * @param array $report_data + * @return int the ID of the created entity + */ + protected function create_report(array $report_data) + { + $sql_ary = array( + 'reason_id' => (int) $report_data['reason_id'], + 'post_id' => $report_data['post_id'], + 'pm_id' => $report_data['pm_id'], + 'user_id' => (int) $this->user->data['user_id'], + 'user_notify' => (int) $report_data['user_notify'], + 'report_closed' => 0, + 'report_time' => (int) time(), + 'report_text' => (string) $report_data['report_text'], + 'reported_post_text' => $report_data['reported_post_text'], + 'reported_post_uid' => $report_data['reported_post_uid'], + 'reported_post_bitfield' => $report_data['reported_post_bitfield'], + 'reported_post_enable_bbcode' => $report_data['reported_post_enable_bbcode'], + 'reported_post_enable_smilies' => $report_data['reported_post_enable_smilies'], + 'reported_post_enable_magic_url' => $report_data['reported_post_enable_magic_url'], + ); + + $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + + return $this->db->sql_nextid(); + } +} diff --git a/phpBB/phpbb/report/report_handler_interface.php b/phpBB/phpbb/report/report_handler_interface.php new file mode 100644 index 0000000000..8dafc392d0 --- /dev/null +++ b/phpBB/phpbb/report/report_handler_interface.php @@ -0,0 +1,43 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +interface report_handler_interface +{ + /** + * Reports a message + * + * @param int $id + * @param int $reason_id + * @param string $report_text + * @param int $user_notify + * @return null + * @throws \phpbb\report\exception\empty_report_exception when the given report is empty + * @throws \phpbb\report\exception\already_reported_exception when the entity is already reported + * @throws \phpbb\report\exception\entity_not_found_exception when the entity does not exist or the user does not have viewing permissions for it + * @throws \phpbb\report\exception\invalid_report_exception when the entity cannot be reported for some other reason + */ + public function add_report($id, $reason_id, $report_text, $user_notify); + + /** + * Checks if the message is reportable + * + * @param int $id + * @return null + * @throws \phpbb\report\exception\already_reported_exception when the entity is already reported + * @throws \phpbb\report\exception\entity_not_found_exception when the entity does not exist or the user does not have viewing permissions for it + * @throws \phpbb\report\exception\invalid_report_exception when the entity cannot be reported for some other reason + */ + public function validate_report_request($id); +} diff --git a/phpBB/phpbb/report/report_handler_pm.php b/phpBB/phpbb/report/report_handler_pm.php new file mode 100644 index 0000000000..2f2a697efc --- /dev/null +++ b/phpBB/phpbb/report/report_handler_pm.php @@ -0,0 +1,137 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +use phpbb\report\exception\empty_report_exception; +use phpbb\report\exception\already_reported_exception; +use phpbb\report\exception\pm_reporting_disabled_exception; +use phpbb\report\exception\entity_not_found_exception; + +class report_handler_pm extends report_handler +{ + /** + * {@inheritdoc} + * @throws \phpbb\report\exception\pm_reporting_disabled_exception when PM reporting is disabled on the board + */ + public function add_report($id, $reason_id, $report_text, $user_notify) + { + // Cast the input variables + $id = (int) $id; + $reason_id = (int) $reason_id; + $report_text = (string) $report_text; + $user_notify = (int) $user_notify; + + $this->validate_report_request($id); + + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row || (empty($report_text) && strtolower($row['reason_title']) === 'other')) + { + throw new empty_report_exception(); + } + + $report_data = array( + 'reason_id' => $reason_id, + 'post_id' => 0, + 'pm_id' => $id, + 'user_notify' => $user_notify, + 'report_text' => $report_text, + 'reported_post_text' => $this->report_data['message_text'], + 'reported_post_uid' => $this->report_data['bbcode_bitfield'], + 'reported_post_bitfield' => $this->report_data['bbcode_uid'], + 'reported_post_enable_bbcode' => $this->report_data['enable_bbcode'], + 'reported_post_enable_smilies' => $this->report_data['enable_smilies'], + 'reported_post_enable_magic_url' => $this->report_data['enable_magic_url'], + ); + + $report_id = $this->create_report($report_data); + + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_reported = 1 + WHERE msg_id = ' . $id; + $this->db->sql_query($sql); + + $sql_ary = array( + 'msg_id' => $id, + 'user_id' => ANONYMOUS, + 'author_id' => (int) $this->report_data['author_id'], + 'pm_deleted' => 0, + 'pm_new' => 0, + 'pm_unread' => 0, + 'pm_replied' => 0, + 'pm_marked' => 0, + 'pm_forwarded' => 0, + 'folder_id' => PRIVMSGS_INBOX, + ); + + $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + + $this->notifications->add_notifications('notification.type.report_pm', array_merge($this->report_data, $row, array( + 'report_text' => $report_text, + 'from_user_id' => $this->report_data['author_id'], + 'report_id' => $report_id, + ))); + } + + /** + * {@inheritdoc} + * @throws \phpbb\report\exception\pm_reporting_disabled_exception when PM reporting is disabled on the board + */ + public function validate_report_request($id) + { + $id = (int) $id; + + // Check if reporting PMs is enabled + if (!$this->config['allow_pm_report']) + { + throw new pm_reporting_disabled_exception(); + } + else if ($id <= 0) + { + throw new entity_not_found_exception('NO_POST_SELECTED'); + } + + // Grab all relevant data + $sql = 'SELECT p.*, pt.* + FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . " pt + WHERE p.msg_id = $id + AND p.msg_id = pt.msg_id + AND (p.author_id = " . $this->user->data['user_id'] . " + OR pt.user_id = " . $this->user->data['user_id'] . ")"; + $result = $this->db->sql_query($sql); + $report_data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Check if message exists + if (!$report_data) + { + $this->user->add_lang('ucp'); + throw new entity_not_found_exception('NO_MESSAGE'); + } + + // Check if message is already reported + if ($report_data['message_reported']) + { + throw new already_reported_exception(); + } + + $this->report_data = $report_data; + } +} diff --git a/phpBB/phpbb/report/report_handler_post.php b/phpBB/phpbb/report/report_handler_post.php new file mode 100644 index 0000000000..5574a16dc0 --- /dev/null +++ b/phpBB/phpbb/report/report_handler_post.php @@ -0,0 +1,175 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +use phpbb\report\exception\invalid_report_exception; +use phpbb\report\exception\empty_report_exception; +use phpbb\report\exception\already_reported_exception; +use phpbb\report\exception\entity_not_found_exception; +use phpbb\report\exception\report_permission_denied_exception; + +class report_handler_post extends report_handler +{ + /** + * @var array + */ + protected $forum_data; + + /** + * {@inheritdoc} + * @throws \phpbb\report\exception\report_permission_denied_exception when the user does not have permission to report the post + */ + public function add_report($id, $reason_id, $report_text, $user_notify) + { + // Cast the input variables + $id = (int) $id; + $reason_id = (int) $reason_id; + $report_text = (string) $report_text; + $user_notify = (int) $user_notify; + + $this->validate_report_request($id); + + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row || (empty($report_text) && strtolower($row['reason_title']) === 'other')) + { + throw new empty_report_exception(); + } + + $report_data = array( + 'reason_id' => $reason_id, + 'post_id' => $id, + 'pm_id' => 0, + 'user_notify' => $user_notify, + 'report_text' => $report_text, + 'reported_post_text' => $this->report_data['post_text'], + 'reported_post_uid' => $this->report_data['bbcode_bitfield'], + 'reported_post_bitfield' => $this->report_data['bbcode_uid'], + 'reported_post_enable_bbcode' => $this->report_data['enable_bbcode'], + 'reported_post_enable_smilies' => $this->report_data['enable_smilies'], + 'reported_post_enable_magic_url' => $this->report_data['enable_magic_url'], + ); + + $this->create_report($report_data); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_reported = 1 + WHERE post_id = ' . $id; + $this->db->sql_query($sql); + + if (!$this->report_data['topic_reported']) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 1 + WHERE topic_id = ' . $this->report_data['topic_id'] . ' + OR topic_moved_id = ' . $this->report_data['topic_id']; + $this->db->sql_query($sql); + } + + $this->notifications->add_notifications('notification.type.report_post', array_merge($this->report_data, $row, $this->forum_data, array( + 'report_text' => $report_text, + ))); + } + + /** + * {@inheritdoc} + * @throws \phpbb\report\exception\report_permission_denied_exception when the user does not have permission to report the post + */ + public function validate_report_request($id) + { + $id = (int) $id; + + // Check if id is valid + if ($id <= 0) + { + throw new entity_not_found_exception('NO_POST_SELECTED'); + } + + // Grab all relevant data + $sql = 'SELECT t.*, p.* + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + WHERE p.post_id = $id + AND p.topic_id = t.topic_id"; + $result = $this->db->sql_query($sql); + $report_data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$report_data) + { + throw new entity_not_found_exception('POST_NOT_EXIST'); + } + + $forum_id = (int) $report_data['forum_id']; + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $this->db->sql_query($sql); + $forum_data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$forum_data) + { + throw new invalid_report_exception('FORUM_NOT_EXIST'); + } + + $acl_check_ary = array( + 'f_list' => 'POST_NOT_EXIST', + 'f_read' => 'USER_CANNOT_READ', + 'f_report' => 'USER_CANNOT_REPORT' + ); + + /** + * This event allows you to do extra auth checks and verify if the user + * has the required permissions + * + * @event core.report_post_auth + * @var array forum_data All data available from the forums table on this post's forum + * @var array report_data All data available from the topics and the posts tables on this post (and its topic) + * @var array acl_check_ary An array with the ACL to be tested. The evaluation is made in the same order as the array is sorted + * The key is the ACL name and the value is the language key for the error message. + * @since 3.1.3-RC1 + */ + $vars = array( + 'forum_data', + 'report_data', + 'acl_check_ary', + ); + extract($this->dispatcher->trigger_event('core.report_post_auth', compact($vars))); + + $this->auth->acl($this->user->data); + + foreach ($acl_check_ary as $acl => $error) + { + if (!$this->auth->acl_get($acl, $forum_id)) + { + throw new report_permission_denied_exception($error); + } + } + unset($acl_check_ary); + + if ($report_data['post_reported']) + { + throw new already_reported_exception(); + } + + $this->report_data = $report_data; + $this->forum_data = $forum_data; + } +} diff --git a/phpBB/phpbb/report/report_reason_list_provider.php b/phpBB/phpbb/report/report_reason_list_provider.php new file mode 100644 index 0000000000..388a61d577 --- /dev/null +++ b/phpBB/phpbb/report/report_reason_list_provider.php @@ -0,0 +1,78 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +class report_reason_list_provider +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\template\template $template + * @param \phpbb\user $user + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user) + { + $this->db = $db; + $this->template = $template; + $this->user = $user; + } + + /** + * Sets template variables to render report reasons select HTML input + * + * @param int $reason_id + * @return null + */ + public function display_reasons($reason_id = 0) + { + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . ' + ORDER BY reason_order ASC'; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // If the reason is defined within the language file, we will use the localized version, else just use the database entry... + if (isset($this->user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($this->user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) + { + $row['reason_description'] = $this->user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; + $row['reason_title'] = $this->user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; + } + + $this->template->assign_block_vars('reason', array( + 'ID' => $row['reason_id'], + 'TITLE' => $row['reason_title'], + 'DESCRIPTION' => $row['reason_description'], + 'S_SELECTED' => ($row['reason_id'] == $reason_id) ? true : false, + )); + } + $this->db->sql_freeresult($result); + } +} diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php index b6940cf51f..ab56240b14 100644 --- a/phpBB/phpbb/request/deactivated_super_global.php +++ b/phpBB/phpbb/request/deactivated_super_global.php @@ -1,9 +1,13 @@ <?php /** * -* @package \phpbb\request\request -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,8 +16,6 @@ namespace phpbb\request; /** * Replacement for a superglobal (like $_GET or $_POST) which calls * trigger_error on all operations but isset, overloads the [] operator with SPL. -* -* @package \phpbb\request\request */ class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAggregate { @@ -54,7 +56,7 @@ class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAgg $file = ''; $line = 0; - $message = 'Illegal use of $' . $this->name . '. You must use the request class or request_var() to access input data. Found in %s on line %d. This error message was generated by deactivated_super_global.'; + $message = 'Illegal use of $' . $this->name . '. You must use the request class to access input data. Found in %s on line %d. This error message was generated by deactivated_super_global.'; $backtrace = debug_backtrace(); if (isset($backtrace[1])) diff --git a/phpBB/phpbb/request/request.php b/phpBB/phpbb/request/request.php index 3171a6edb7..56ce3999ed 100644 --- a/phpBB/phpbb/request/request.php +++ b/phpBB/phpbb/request/request.php @@ -1,9 +1,13 @@ <?php /** * -* @package \phpbb\request\request -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,8 +18,6 @@ namespace phpbb\request; * * It provides a method to disable access to input data through super globals. * This should force MOD authors to read about data validation. -* -* @package \phpbb\request\request */ class request implements \phpbb\request\request_interface { @@ -273,7 +275,7 @@ class request implements \phpbb\request\request_interface */ public function file($form_name) { - return $this->variable($form_name, array('name' => 'none'), false, \phpbb\request\request_interface::FILES); + return $this->variable($form_name, array('name' => 'none'), true, \phpbb\request\request_interface::FILES); } /** @@ -414,4 +416,27 @@ class request implements \phpbb\request\request_interface { return $this->input[$super_global]; } + + /** + * {@inheritdoc} + */ + public function escape($var, $multibyte) + { + if (is_array($var)) + { + $result = array(); + foreach ($var as $key => $value) + { + $this->type_cast_helper->set_var($key, $key, gettype($key), $multibyte); + $result[$key] = $this->escape($value, $multibyte); + } + $var = $result; + } + else + { + $this->type_cast_helper->set_var($var, $var, 'string', $multibyte); + } + + return $var; + } } diff --git a/phpBB/phpbb/request/request_interface.php b/phpBB/phpbb/request/request_interface.php index 1f9978b276..47b3b3a4ed 100644 --- a/phpBB/phpbb/request/request_interface.php +++ b/phpBB/phpbb/request/request_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package \phpbb\request\request -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\request; /** * An interface through which all application input can be accessed. -* -* @package \phpbb\request\request */ interface request_interface { @@ -140,4 +142,14 @@ interface request_interface * @return array The original array of the requested super global. */ public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Escape a string variable. + * + * @param mixed $value The contents to fill with + * @param bool $multibyte Indicates whether string values may contain UTF-8 characters. + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks. + * @return string|array + */ + public function escape($value, $multibyte); } diff --git a/phpBB/phpbb/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php index e9b55663af..96e66950ca 100644 --- a/phpBB/phpbb/request/type_cast_helper.php +++ b/phpBB/phpbb/request/type_cast_helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package \phpbb\request\request -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\request; /** * A helper class that provides convenience methods for type casting. -* -* @package \phpbb\request\request */ class type_cast_helper implements \phpbb\request\type_cast_helper_interface { @@ -170,7 +172,6 @@ class type_cast_helper implements \phpbb\request\type_cast_helper_interface } list($default_key, $default_value) = each($default); - $value_type = gettype($default_value); $key_type = gettype($default_key); $_var = $var; diff --git a/phpBB/phpbb/request/type_cast_helper_interface.php b/phpBB/phpbb/request/type_cast_helper_interface.php index f12795eef9..2cb28d021f 100644 --- a/phpBB/phpbb/request/type_cast_helper_interface.php +++ b/phpBB/phpbb/request/type_cast_helper_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package \phpbb\request\request -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\request; /** * An interface for type cast operations. -* -* @package \phpbb\request\request */ interface type_cast_helper_interface { diff --git a/phpBB/phpbb/routing/file_locator.php b/phpBB/phpbb/routing/file_locator.php new file mode 100644 index 0000000000..64efcc6c76 --- /dev/null +++ b/phpBB/phpbb/routing/file_locator.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\routing; + +use phpbb\filesystem\filesystem_interface; +use Symfony\Component\Config\FileLocator; + +class file_locator extends FileLocator +{ + public function __construct(filesystem_interface $filesystem, $paths = []) + { + $paths = (array) $paths; + $absolute_paths = []; + + foreach ($paths as $path) + { + $absolute_paths[] = $filesystem->realpath($path); + } + + parent::__construct($absolute_paths); + } +} diff --git a/phpBB/phpbb/routing/helper.php b/phpBB/phpbb/routing/helper.php new file mode 100644 index 0000000000..f56974a354 --- /dev/null +++ b/phpBB/phpbb/routing/helper.php @@ -0,0 +1,153 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\routing; + +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Routing\RequestContext; + +/** +* Controller helper class, contains methods that do things for controllers +*/ +class helper +{ + /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * phpBB router + * @var \phpbb\routing\router + */ + protected $router; + + /** + * @var \phpbb\symfony_request + */ + protected $symfony_request; + + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\filesystem The filesystem object + */ + protected $filesystem; + + /** + * phpBB root path + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP file extension + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\routing\router $router phpBB router + * @param \phpbb\symfony_request $symfony_request Symfony Request object + * @param \phpbb\request\request_interface $request phpBB request object + * @param \phpbb\filesystem\filesystem $filesystem The filesystem object + * @param string $phpbb_root_path phpBB root path + * @param string $php_ext PHP file extension + */ + public function __construct(\phpbb\config\config $config, \phpbb\routing\router $router, \phpbb\symfony_request $symfony_request, \phpbb\request\request_interface $request, \phpbb\filesystem\filesystem $filesystem, $phpbb_root_path, $php_ext) + { + $this->config = $config; + $this->router = $router; + $this->symfony_request = $symfony_request; + $this->request = $request; + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Generate a URL to a route + * + * @param string $route Name of the route to travel + * @param array $params String or array of additional url parameters + * @param bool $is_amp Is url using & (true) or & (false) + * @param string|bool $session_id Possibility to use a custom session id instead of the global one + * @param bool|string $reference_type The type of reference to be generated (one of the constants) + * @return string The URL already passed through append_sid() + */ + public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH) + { + $anchor = ''; + if (isset($params['#'])) + { + $anchor = '#' . $params['#']; + unset($params['#']); + } + + $context = new RequestContext(); + $context->fromRequest($this->symfony_request); + + $script_name = $this->symfony_request->getScriptName(); + $page_name = substr($script_name, -1, 1) == '/' ? '' : utf8_basename($script_name); + + $base_url = $context->getBaseUrl(); + + // Append page name if base URL does not contain it + if (!empty($page_name) && strpos($base_url, '/' . $page_name) === false) + { + $base_url .= '/' . $page_name; + } + + // If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it. + $base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url); + + // We need to update the base url to move to the directory of the app.php file if the current script is not app.php + if ($page_name !== 'app.php') + { + if (empty($this->config['enable_mod_rewrite'])) + { + $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url); + } + else + { + $base_url .= preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), '$2', $this->phpbb_root_path); + } + } + + $base_url = $this->request->escape($this->filesystem->clean_path($base_url), true); + + $context->setBaseUrl($base_url); + + $this->router->setContext($context); + $route_url = $this->router->generate($route, $params, $reference_type); + + if ($is_amp) + { + $route_url = str_replace(array('&', '&'), array('&', '&'), $route_url); + } + + if ($reference_type === UrlGeneratorInterface::RELATIVE_PATH && empty($this->config['enable_mod_rewrite'])) + { + $route_url = 'app.' . $this->php_ext . '/' . $route_url; + } + + return append_sid($route_url . $anchor, false, $is_amp, $session_id, true); + } +} diff --git a/phpBB/phpbb/routing/loader_resolver.php b/phpBB/phpbb/routing/loader_resolver.php new file mode 100644 index 0000000000..13fbc6405c --- /dev/null +++ b/phpBB/phpbb/routing/loader_resolver.php @@ -0,0 +1,50 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\routing; + +use Symfony\Component\Config\Loader\LoaderResolverInterface; + +/** + * @see Symfony\Component\Config\Loader\LoaderResolver + */ +class loader_resolver implements LoaderResolverInterface +{ + /** + * @var \Symfony\Component\Config\Loader\LoaderInterface[] An array of LoaderInterface objects + */ + protected $loaders = []; + + public function __construct($loaders = []) + { + $this->loaders = $loaders; + } + + /** + * {@inheritdoc} + */ + public function resolve($resource, $type = null) + { + /** @var \Symfony\Component\Config\Loader\LoaderInterface $loader */ + foreach ($this->loaders as $loader) + { + if ($loader->supports($resource, $type)) + { + $loader->setResolver($this); + return $loader; + } + } + + return false; + } +} diff --git a/phpBB/phpbb/routing/resources_locator/chained_resources_locator.php b/phpBB/phpbb/routing/resources_locator/chained_resources_locator.php new file mode 100644 index 0000000000..db9abf2095 --- /dev/null +++ b/phpBB/phpbb/routing/resources_locator/chained_resources_locator.php @@ -0,0 +1,47 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\routing\resources_locator; + +class chained_resources_locator implements resources_locator_interface +{ + /** + * @var resources_locator_interface[] + */ + protected $locators; + + /** + * Construct method + * + * @param resources_locator_interface[] $locators Locators + */ + public function __construct($locators) + { + $this->locators = $locators; + } + + /** + * {@inheritdoc} + */ + public function locate_resources() + { + $resources = []; + + foreach ($this->locators as $locator) + { + $resources = array_merge($resources, $locator->locate_resources()); + } + + return $resources; + } +} diff --git a/phpBB/phpbb/routing/resources_locator/default_resources_locator.php b/phpBB/phpbb/routing/resources_locator/default_resources_locator.php new file mode 100644 index 0000000000..90c3877007 --- /dev/null +++ b/phpBB/phpbb/routing/resources_locator/default_resources_locator.php @@ -0,0 +1,105 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\routing\resources_locator; + +use phpbb\extension\manager; + +/** + * Locates the yaml routing resources located in the default locations + */ +class default_resources_locator implements resources_locator_interface +{ + /** + * phpBB root path + * + * @var string + */ + protected $phpbb_root_path; + + /** + * Name of the current environment + * + * @var string + */ + protected $environment; + + /** + * Extension manager + * + * @var manager + */ + protected $extension_manager; + + /** + * Construct method + * + * @param string $phpbb_root_path phpBB root path + * @param string $environment Name of the current environment + * @param manager $extension_manager Extension manager + */ + public function __construct($phpbb_root_path, $environment, manager $extension_manager = null) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->environment = $environment; + $this->extension_manager = $extension_manager; + } + + /** + * {@inheritdoc} + */ + public function locate_resources() + { + $resources = [['config/' . $this->environment . '/routing/environment.yml', 'yaml']]; + + $resources = $this->append_ext_resources($resources); + + return $resources; + } + + /** + * Append extension resources to an array of resouces + * + * @see resources_locator_interface::locate_resources() + * + * @param mixed[] $resources List of resources + * + * @return mixed[] List of resources + */ + protected function append_ext_resources(array $resources) + { + if ($this->extension_manager !== null) + { + foreach ($this->extension_manager->all_enabled(false) as $path) + { + if (file_exists($this->phpbb_root_path . $path . 'config/' . $this->environment . '/routing/environment.yml')) + { + $resources[] = [$path . 'config/' . $this->environment . '/routing/environment.yml', 'yaml']; + } + else if (!is_dir($this->phpbb_root_path . $path . 'config/' . $this->environment)) + { + if (file_exists($this->phpbb_root_path . $path . 'config/default/routing/environment.yml')) + { + $resources[] = [$path . 'config/default/routing/environment.yml', 'yaml']; + } + else if (!is_dir($this->phpbb_root_path . $path . 'config/default/routing') && file_exists($this->phpbb_root_path . $path . 'config/routing.yml')) + { + $resources[] = [$path . 'config/routing.yml', 'yaml']; + } + } + } + } + + return $resources; + } +} diff --git a/phpBB/phpbb/routing/resources_locator/installer_resources_locator.php b/phpBB/phpbb/routing/resources_locator/installer_resources_locator.php new file mode 100644 index 0000000000..42cd0f11af --- /dev/null +++ b/phpBB/phpbb/routing/resources_locator/installer_resources_locator.php @@ -0,0 +1,78 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\routing\resources_locator; + +use phpbb\filesystem\filesystem_interface; + +/** + * Locates the yaml routing resources taking update directories into consideration + */ +class installer_resources_locator implements resources_locator_interface +{ + /** + * phpBB's filesystem handler + * + * @var filesystem_interface + */ + protected $filesystem; + + /** + * phpBB root path + * + * @var string + */ + protected $phpbb_root_path; + + /** + * Name of the current environment + * + * @var string + */ + protected $environment; + + /** + * Construct method + * + * @param filesystem_interface $filesystem phpBB's filesystem handler + * @param string $phpbb_root_path phpBB root path + * @param string $environment Name of the current environment + */ + public function __construct(filesystem_interface $filesystem, $phpbb_root_path, $environment) + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->environment = $environment; + } + + /** + * {@inheritdoc} + */ + public function locate_resources() + { + if ($this->filesystem->exists($this->phpbb_root_path . 'install/update/new/config')) + { + $resources = array( + array('install/update/new/config/' . $this->environment . '/routing/environment.yml', 'yaml') + ); + } + else + { + $resources = array( + array('config/' . $this->environment . '/routing/environment.yml', 'yaml') + ); + } + + return $resources; + } +} diff --git a/phpBB/phpbb/routing/resources_locator/resources_locator_interface.php b/phpBB/phpbb/routing/resources_locator/resources_locator_interface.php new file mode 100644 index 0000000000..46335cb288 --- /dev/null +++ b/phpBB/phpbb/routing/resources_locator/resources_locator_interface.php @@ -0,0 +1,27 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\routing\resources_locator; + +interface resources_locator_interface +{ + /** + * Locates a list of resources used to load the routes + * + * Each entry of the list can be either the resource or an array composed of 2 elements: + * the resource and its type. + * + * @return mixed[] List of resources + */ + public function locate_resources(); +} diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php new file mode 100644 index 0000000000..5d237b6433 --- /dev/null +++ b/phpBB/phpbb/routing/router.php @@ -0,0 +1,406 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\routing; + +use phpbb\routing\resources_locator\resources_locator_interface; +use Symfony\Component\Config\ConfigCache; +use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\Filesystem\Exception\IOException; +use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper; +use Symfony\Component\Routing\Generator\UrlGenerator; +use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; +use Symfony\Component\Routing\Matcher\UrlMatcher; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RouteCollection; +use Symfony\Component\Routing\RouterInterface; + +/** + * Integration of all pieces of the routing system for easier use. + */ +class router implements RouterInterface +{ + /** + * @var ContainerInterface + */ + protected $container; + + /** + * @var resources_locator_interface + */ + protected $resources_locator; + + /** + * @var LoaderInterface + */ + protected $loader; + + /** + * phpBB root path + * + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP file extensions + * + * @var string + */ + protected $php_ext; + + /** + * Name of the current environment + * + * @var string + */ + protected $environment; + + /** + * @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface|null + */ + protected $matcher; + + /** + * @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface|null + */ + protected $generator; + + /** + * @var RequestContext + */ + protected $context; + + /** + * @var RouteCollection + */ + protected $route_collection; + + /** + * Construct method + * + * @param ContainerInterface $container DI container + * @param resources_locator_interface $resources_locator Resources locator + * @param LoaderInterface $loader Resources loader + * @param string $phpbb_root_path phpBB root path + * @param string $php_ext PHP file extension + * @param string $environment Name of the current environment + */ + public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $phpbb_root_path, $php_ext, $environment) + { + $this->container = $container; + $this->resources_locator = $resources_locator; + $this->loader = $loader; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->environment = $environment; + $this->context = new RequestContext(); + } + + /** + * Get the list of routes + * + * @return RouteCollection Get the route collection + */ + public function get_routes() + { + if ($this->route_collection === null /*|| $this->route_collection->count() === 0*/) + { + $this->route_collection = new RouteCollection; + foreach ($this->resources_locator->locate_resources() as $resource) + { + if (is_array($resource)) + { + $this->route_collection->addCollection($this->loader->load($resource[0], $resource[1])); + } + else + { + $this->route_collection->addCollection($this->loader->load($resource)); + } + } + + $this->resolveParameters($this->route_collection); + } + + return $this->route_collection; + } + + /** + * {@inheritdoc} + */ + public function getRouteCollection() + { + return $this->get_routes(); + } + + /** + * {@inheritdoc} + */ + public function setContext(RequestContext $context) + { + $this->context = $context; + + if ($this->matcher !== null) + { + $this->get_matcher()->setContext($context); + } + if ($this->generator !== null) + { + $this->get_generator()->setContext($context); + } + } + + /** + * {@inheritdoc} + */ + public function getContext() + { + return $this->context; + } + + /** + * {@inheritdoc} + */ + public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) + { + return $this->get_generator()->generate($name, $parameters, $referenceType); + } + + /** + * {@inheritdoc} + */ + public function match($pathinfo) + { + return $this->get_matcher()->match($pathinfo); + } + + /** + * Gets the UrlMatcher instance associated with this Router. + * + * @return \Symfony\Component\Routing\Matcher\UrlMatcherInterface A UrlMatcherInterface instance + */ + public function get_matcher() + { + if ($this->matcher !== null) + { + return $this->matcher; + } + + $this->create_dumped_url_matcher(); + + return $this->matcher; + } + + /** + * Creates a new dumped URL Matcher (dump it if necessary) + */ + protected function create_dumped_url_matcher() + { + try + { + $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_matcher.{$this->php_ext}", defined('DEBUG')); + if (!$cache->isFresh()) + { + $dumper = new PhpMatcherDumper($this->get_routes()); + + $options = array( + 'class' => 'phpbb_url_matcher', + 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', + ); + + $cache->write($dumper->dump($options), $this->get_routes()->getResources()); + } + + require_once($cache->getPath()); + + $this->matcher = new \phpbb_url_matcher($this->context); + } + catch (IOException $e) + { + $this->create_new_url_matcher(); + } + } + + /** + * Creates a new URL Matcher + */ + protected function create_new_url_matcher() + { + $this->matcher = new UrlMatcher($this->get_routes(), $this->context); + } + + /** + * Gets the UrlGenerator instance associated with this Router. + * + * @return \Symfony\Component\Routing\Generator\UrlGeneratorInterface A UrlGeneratorInterface instance + */ + public function get_generator() + { + if ($this->generator !== null) + { + return $this->generator; + } + + $this->create_dumped_url_generator(); + + return $this->generator; + } + + /** + * Creates a new dumped URL Generator (dump it if necessary) + */ + protected function create_dumped_url_generator() + { + try + { + $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_generator.{$this->php_ext}", defined('DEBUG')); + if (!$cache->isFresh()) + { + $dumper = new PhpGeneratorDumper($this->get_routes()); + + $options = array( + 'class' => 'phpbb_url_generator', + 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', + ); + + $cache->write($dumper->dump($options), $this->get_routes()->getResources()); + } + + require_once($cache->getPath()); + + $this->generator = new \phpbb_url_generator($this->context); + } + catch (IOException $e) + { + $this->create_new_url_generator(); + } + } + + /** + * Creates a new URL Generator + */ + protected function create_new_url_generator() + { + $this->generator = new UrlGenerator($this->get_routes(), $this->context); + } + + /** + * Replaces placeholders with service container parameter values in: + * - the route defaults, + * - the route requirements, + * - the route path, + * - the route host, + * - the route schemes, + * - the route methods. + * + * @param RouteCollection $collection + */ + protected function resolveParameters(RouteCollection $collection) + { + /** @var \Symfony\Component\Routing\Route $route */ + foreach ($collection as $route) + { + foreach ($route->getDefaults() as $name => $value) + { + $route->setDefault($name, $this->resolve($value)); + } + + $requirements = $route->getRequirements(); + unset($requirements['_scheme']); + unset($requirements['_method']); + + foreach ($requirements as $name => $value) + { + $route->setRequirement($name, $this->resolve($value)); + } + + $route->setPath($this->resolve($route->getPath())); + $route->setHost($this->resolve($route->getHost())); + + $schemes = array(); + foreach ($route->getSchemes() as $scheme) + { + $schemes = array_merge($schemes, explode('|', $this->resolve($scheme))); + } + + $route->setSchemes($schemes); + $methods = array(); + foreach ($route->getMethods() as $method) + { + $methods = array_merge($methods, explode('|', $this->resolve($method))); + } + + $route->setMethods($methods); + $route->setCondition($this->resolve($route->getCondition())); + } + } + + /** + * Recursively replaces placeholders with the service container parameters. + * + * @param mixed $value The source which might contain "%placeholders%" + * + * @return mixed The source with the placeholders replaced by the container + * parameters. Arrays are resolved recursively. + * + * @throws ParameterNotFoundException When a placeholder does not exist as a container parameter + * @throws RuntimeException When a container value is not a string or a numeric value + */ + private function resolve($value) + { + if (is_array($value)) + { + foreach ($value as $key => $val) + { + $value[$key] = $this->resolve($val); + } + + return $value; + } + + if (!is_string($value)) + { + return $value; + } + + $container = $this->container; + $escapedValue = preg_replace_callback('/%%|%([^%\s]++)%/', function ($match) use ($container, $value) + { + // skip %% + if (!isset($match[1])) + { + return '%%'; + } + + $resolved = $container->getParameter($match[1]); + if (is_string($resolved) || is_numeric($resolved)) + { + return (string) $resolved; + } + + throw new RuntimeException(sprintf( + 'The container parameter "%s", used in the route configuration value "%s", '. + 'must be a string or numeric, but it is of type %s.', + $match[1], + $value, + gettype($resolved) + ) + ); + }, $value); + + return str_replace('%%', '%', $escapedValue); + } +} diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php index 9ecf3751d0..30781975d8 100644 --- a/phpBB/phpbb/search/base.php +++ b/phpBB/phpbb/search/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,10 +21,8 @@ define('SEARCH_RESULT_IN_CACHE', 1); define('SEARCH_RESULT_INCOMPLETE', 2); /** -* \phpbb\search\base * optional base class for search plugins providing simple caching based on ACM * and functions to retrieve ignore_words and synonyms -* @package search */ class base { @@ -83,8 +85,12 @@ class base /** * Retrieves cached search results * - * @param int &$result_count will contain the number of all results for the search (not only for the current page) - * @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache + * @param string $search_key an md5 string generated from all the passed search options to identify the results + * @param int &$result_count will contain the number of all results for the search (not only for the current page) + * @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache + * @param int &$start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @param string $sort_dir is either a or d representing ASC and DESC * * @return int SEARCH_RESULT_NOT_IN_CACHE or SEARCH_RESULT_IN_CACHE or SEARCH_RESULT_INCOMPLETE */ @@ -158,8 +164,16 @@ class base /** * Caches post/topic ids * - * @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element + * @param string $search_key an md5 string generated from all the passed search options to identify the results + * @param string $keywords contains the keywords as entered by the user + * @param array $author_ary an array of author ids, if the author should be ignored during the search the array is empty + * @param int $result_count contains the number of all results for the search (not only for the current page) + * @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element * must have the absolute index $start in the result set. + * @param int $start indicates the first index of the page + * @param string $sort_dir is either a or d representing ASC and DESC + * + * @return null */ function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir) { @@ -280,7 +294,7 @@ class base $sql_where = ''; foreach ($words as $word) { - $sql_where .= " OR search_keywords " . $db->sql_like_expression($db->any_char . $word . $db->any_char); + $sql_where .= " OR search_keywords " . $db->sql_like_expression($db->get_any_char() . $word . $db->get_any_char()); } $sql = 'SELECT search_key @@ -301,7 +315,7 @@ class base $sql_where = ''; foreach ($authors as $author) { - $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors ' . $db->sql_like_expression($db->any_char . ' ' . (int) $author . ' ' . $db->any_char); + $sql_where .= (($sql_where) ? ' OR ' : '') . 'search_authors ' . $db->sql_like_expression($db->get_any_char() . ' ' . (int) $author . ' ' . $db->get_any_char()); } $sql = 'SELECT search_key diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 509b73e26e..d1962bc8cc 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -1,18 +1,20 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\search; /** -* fulltext_mysql * Fulltext search for MySQL -* @package search */ class fulltext_mysql extends \phpbb\search\base { @@ -36,11 +38,17 @@ class fulltext_mysql extends \phpbb\search\base /** * Database connection - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * User object * @var \phpbb\user */ @@ -71,11 +79,19 @@ class fulltext_mysql extends \phpbb\search\base * Creates a new \phpbb\search\fulltext_mysql, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object */ - public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) { $this->config = $config; $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->user = $user; $this->word_length = array('min' => $this->config['fulltext_mysql_min_word_len'], 'max' => $this->config['fulltext_mysql_max_word_len']); @@ -138,7 +154,7 @@ class fulltext_mysql extends \phpbb\search\base */ public function init() { - if ($this->db->sql_layer != 'mysql4' && $this->db->sql_layer != 'mysqli') + if ($this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli') { return $this->user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_DATABASE']; } @@ -180,8 +196,8 @@ class fulltext_mysql extends \phpbb\search\base } $this->db->sql_freeresult($result); - set_config('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']); - set_config('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']); + $this->config->set('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']); + $this->config->set('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']); return false; } @@ -363,7 +379,7 @@ class fulltext_mysql extends \phpbb\search\base } // generate a search_key from all the options to identify the results - $search_key = md5(implode('#', array( + $search_key_array = array( implode(', ', $this->split_words), $type, $fields, @@ -374,7 +390,39 @@ class fulltext_mysql extends \phpbb\search\base implode(',', $ex_fid_ary), $post_visibility, implode(',', $author_ary) - ))); + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_mysql_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); if ($start < 0) { @@ -439,6 +487,55 @@ class fulltext_mysql extends \phpbb\search\base break; } + $search_query = $this->search_query; + + /** + * Allow changing the query used to search for posts using fulltext_mysql + * + * @event core.search_mysql_keywords_main_query_before + * @var string search_query The parsed keywords used for this search + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_match Which columns to do the search on. + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'search_query', + 'result_count', + 'join_topic', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_match', + 'sql_match_where', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_keywords_main_query_before', compact($vars))); + $sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : ''; $sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id'; $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; @@ -545,7 +642,7 @@ class fulltext_mysql extends \phpbb\search\base } // generate a search_key from all the options to identify the results - $search_key = md5(implode('#', array( + $search_key_array = array( '', $type, ($firstpost_only) ? 'firstpost' : '', @@ -558,7 +655,39 @@ class fulltext_mysql extends \phpbb\search\base $post_visibility, implode(',', $author_ary), $author_name, - ))); + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_mysql_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); if ($start < 0) { @@ -612,6 +741,59 @@ class fulltext_mysql extends \phpbb\search\base $m_approve_fid_sql = ' AND ' . $post_visibility; + /** + * Allow changing the query used to search for posts by author in fulltext_mysql + * + * @event core.search_mysql_author_query_before + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var string type Either "posts" or "topics" specifying the type of search being made + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on + * @var string sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sql_topic_id SQL of topic_id + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var string sql_firstpost The SQL with the conditions to join the tables when using firstpost_only + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var string m_approve_fid_sql WHERE clause condition on post_visibility restrictions + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'result_count', + 'sql_sort_table', + 'sql_sort_join', + 'type', + 'author_ary', + 'author_name', + 'sql_author', + 'topic_id', + 'sql_topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'sql_firstpost', + 'ex_fid_ary', + 'sql_fora', + 'm_approve_fid_sql', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_author_query_before', compact($vars))); + // If the cache was completely empty count the results $calc_results = ($result_count) ? '' : 'SQL_CALC_FOUND_ROWS '; @@ -737,7 +919,7 @@ class fulltext_mysql extends \phpbb\search\base // destroy too old cached search results $this->destroy_cache(array()); - set_config('search_last_gc', time(), true); + $this->config->set('search_last_gc', time(), false); } /** @@ -762,7 +944,7 @@ class fulltext_mysql extends \phpbb\search\base if (!isset($this->stats['post_subject'])) { - if ($this->db->sql_layer == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { $alter[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; } @@ -775,7 +957,7 @@ class fulltext_mysql extends \phpbb\search\base if (!isset($this->stats['post_content'])) { - if ($this->db->sql_layer == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { $alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; } @@ -870,7 +1052,7 @@ class fulltext_mysql extends \phpbb\search\base */ protected function get_stats() { - if (strpos($this->db->sql_layer, 'mysql') === false) + if (strpos($this->db->get_sql_layer(), 'mysql') === false) { $this->stats = array(); return; diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 1a89182978..521eebb7ee 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -1,21 +1,30 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\search; /** -* fulltext_native * phpBB's own db driven fulltext search, version 2 -* @package search */ class fulltext_native extends \phpbb\search\base { + const UTF8_HANGUL_FIRST = "\xEA\xB0\x80"; + const UTF8_HANGUL_LAST = "\xED\x9E\xA3"; + const UTF8_CJK_FIRST = "\xE4\xB8\x80"; + const UTF8_CJK_LAST = "\xE9\xBE\xBB"; + const UTF8_CJK_B_FIRST = "\xF0\xA0\x80\x80"; + const UTF8_CJK_B_LAST = "\xF0\xAA\x9B\x96"; + /** * Associative array holding index stats * @var array @@ -55,7 +64,7 @@ class fulltext_native extends \phpbb\search\base protected $must_not_contain_ids = array(); /** - * Post ids of posts containing atleast one word that needs to be excluded + * Post ids of posts containing at least one word that needs to be excluded * @var array */ protected $must_exclude_one_ids = array(); @@ -80,27 +89,35 @@ class fulltext_native extends \phpbb\search\base /** * Database connection - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * User object * @var \phpbb\user */ protected $user; /** - * Initialises the fulltext_native search backend with min/max word length and makes sure the UTF-8 normalizer is loaded + * Initialises the fulltext_native search backend with min/max word length * * @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object */ - public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $phpEx; $this->config = $config; $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->user = $user; $this->word_length = array('min' => $this->config['fulltext_native_min_chars'], 'max' => $this->config['fulltext_native_max_chars']); @@ -108,10 +125,6 @@ class fulltext_native extends \phpbb\search\base /** * Load the UTF tools */ - if (!class_exists('utf_normalizer')) - { - include($this->phpbb_root_path . 'includes/utf/utf_normalizer.' . $this->php_ext); - } if (!function_exists('utf8_decode_ncr')) { include($this->phpbb_root_path . 'includes/utf/utf_tools.' . $this->php_ext); @@ -298,7 +311,7 @@ class fulltext_native extends \phpbb\search\base $this->search_query = $keywords; $exact_words = array(); - preg_match_all('#([^\\s+\\-|*()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words); + preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words); $exact_words = $exact_words[1]; $common_ids = $words = array(); @@ -325,7 +338,12 @@ class fulltext_native extends \phpbb\search\base } $this->db->sql_freeresult($result); } - unset($exact_words); + + // Handle +, - without preceeding whitespace character + $match = array('#(\S)\+#', '#(\S)-#'); + $replace = array('$1 +', '$1 +'); + + $keywords = preg_replace($match, $replace, $keywords); // now analyse the search query, first split it using the spaces $query = explode(' ', $keywords); @@ -334,9 +352,6 @@ class fulltext_native extends \phpbb\search\base $this->must_not_contain_ids = array(); $this->must_exclude_one_ids = array(); - $mode = ''; - $ignore_no_id = true; - foreach ($query as $word) { if (empty($word)) @@ -427,7 +442,7 @@ class fulltext_native extends \phpbb\search\base // throw an error if we shall not ignore unexistant words else if (!$ignore_no_id && sizeof($non_common_words)) { - trigger_error(sprintf($user->lang['WORDS_IN_NO_POST'], implode($user->lang['COMMA_SEPARATOR'], $non_common_words))); + trigger_error(sprintf($this->user->lang['WORDS_IN_NO_POST'], implode($this->user->lang['COMMA_SEPARATOR'], $non_common_words))); } unset($non_common_words); } @@ -451,39 +466,21 @@ class fulltext_native extends \phpbb\search\base $this->{$mode . '_ids'}[] = $words[$word]; } } - // throw an error if we shall not ignore unexistant words - else if (!$ignore_no_id) + else { if (!isset($common_ids[$word])) { $len = utf8_strlen($word); - if ($len >= $this->word_length['min'] && $len <= $this->word_length['max']) - { - trigger_error(sprintf($this->user->lang['WORD_IN_NO_POST'], $word)); - } - else + if ($len < $this->word_length['min'] || $len > $this->word_length['max']) { $this->common_words[] = $word; } } } - else - { - $len = utf8_strlen($word); - if ($len < $this->word_length['min'] || $len > $this->word_length['max']) - { - $this->common_words[] = $word; - } - } - } - - // we can't search for negatives only - if (!sizeof($this->must_contain_ids)) - { - return false; } - if (!empty($this->search_query)) + // Return true if all words are not common words + if (sizeof($exact_words) - sizeof($this->common_words) > 0) { return true; } @@ -518,6 +515,12 @@ class fulltext_native extends \phpbb\search\base return false; } + // we can't search for negatives only + if (empty($this->must_contain_ids)) + { + return false; + } + $must_contain_ids = $this->must_contain_ids; $must_not_contain_ids = $this->must_not_contain_ids; $must_exclude_one_ids = $this->must_exclude_one_ids; @@ -527,7 +530,7 @@ class fulltext_native extends \phpbb\search\base sort($must_exclude_one_ids); // generate a search_key from all the options to identify the results - $search_key = md5(implode('#', array( + $search_key_array = array( serialize($must_contain_ids), serialize($must_not_contain_ids), serialize($must_exclude_one_ids), @@ -541,7 +544,45 @@ class fulltext_native extends \phpbb\search\base $post_visibility, implode(',', $author_ary), $author_name, - ))); + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_native_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var array must_contain_ids Array with post ids of posts containing words that are to be included + * @var array must_not_contain_ids Array with post ids of posts containing words that should not be included + * @var array must_exclude_one_ids Array with post ids of posts containing at least one word that needs to be excluded + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'must_contain_ids', + 'must_not_contain_ids', + 'must_exclude_one_ids', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); // try reading the results from cache $total_results = 0; @@ -553,7 +594,6 @@ class fulltext_native extends \phpbb\search\base $id_ary = array(); $sql_where = array(); - $group_by = false; $m_num = 0; $w_num = 0; @@ -717,6 +757,70 @@ class fulltext_native extends \phpbb\search\base $sql_where[] = $post_visibility; + $search_query = $this->search_query; + $must_exclude_one_ids = $this->must_exclude_one_ids; + $must_not_contain_ids = $this->must_not_contain_ids; + $must_contain_ids = $this->must_contain_ids; + + /** + * Allow changing the query used for counting for posts using fulltext_native + * + * @event core.search_native_keywords_count_query_before + * @var string search_query The parsed keywords used for this search + * @var array must_not_contain_ids Ids that cannot be taken into account for the results + * @var array must_exclude_one_ids Ids that cannot be on the results + * @var array must_contain_ids Ids that must be on the results + * @var int total_results The previous result count for the format of the query + * Set to 0 to force a re-count + * @var array sql_array The data on how to search in the DB at this point + * @var bool left_join_topics Whether or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_where An array of the current WHERE clause conditions + * @var string sql_match Which columns to do the search on + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var bool group_by Whether or not the SQL query requires a GROUP BY for the elements in the SELECT clause + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'search_query', + 'must_not_contain_ids', + 'must_exclude_one_ids', + 'must_contain_ids', + 'total_results', + 'sql_array', + 'left_join_topics', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_where', + 'sql_match', + 'sql_match_where', + 'group_by', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_keywords_count_query_before', compact($vars))); + if ($topic_id) { $sql_where[] = 'p.topic_id = ' . $topic_id; @@ -763,7 +867,7 @@ class fulltext_native extends \phpbb\search\base ); } - switch ($this->db->sql_layer) + switch ($this->db->get_sql_layer()) { case 'mysql4': case 'mysqli': @@ -775,6 +879,7 @@ class fulltext_native extends \phpbb\search\base break; case 'sqlite': + case 'sqlite3': $sql_array_count['SELECT'] = ($type == 'posts') ? 'DISTINCT p.post_id' : 'DISTINCT p.topic_id'; $sql = 'SELECT COUNT(' . (($type == 'posts') ? 'post_id' : 'topic_id') . ') as total_results FROM (' . $this->db->sql_build_query('SELECT', $sql_array_count) . ')'; @@ -827,6 +932,13 @@ class fulltext_native extends \phpbb\search\base ); } + // if using mysql and the total result count is not calculated yet, get it from the db + if (!$total_results && $is_mysql) + { + // Also count rows for the query as if there was not LIMIT. Add SQL_CALC_FOUND_ROWS to SQL + $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT']; + } + $sql_array['WHERE'] = implode(' AND ', $sql_where); $sql_array['GROUP_BY'] = ($group_by) ? (($type == 'posts') ? 'p.post_id' : 'p.topic_id') . ', ' . $sort_by_sql[$sort_key] : ''; $sql_array['ORDER_BY'] = $sql_sort; @@ -842,19 +954,9 @@ class fulltext_native extends \phpbb\search\base } $this->db->sql_freeresult($result); - // if we use mysql and the total result count is not cached yet, retrieve it from the db if (!$total_results && $is_mysql) { - // Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it - $sql_array_copy = $sql_array; - $sql_array_copy['SELECT'] = 'SQL_CALC_FOUND_ROWS p.post_id '; - - $sql_calc = $this->db->sql_build_query('SELECT', $sql_array_copy); - unset($sql_array_copy); - - $this->db->sql_query($sql_calc); - $this->db->sql_freeresult($result); - + // Get the number of results as calculated by MySQL $sql_count = 'SELECT FOUND_ROWS() as total_results'; $result = $this->db->sql_query($sql_count); $total_results = (int) $this->db->sql_fetchfield('total_results'); @@ -915,7 +1017,7 @@ class fulltext_native extends \phpbb\search\base } // generate a search_key from all the options to identify the results - $search_key = md5(implode('#', array( + $search_key_array = array( '', $type, ($firstpost_only) ? 'firstpost' : '', @@ -928,7 +1030,39 @@ class fulltext_native extends \phpbb\search\base $post_visibility, implode(',', $author_ary), $author_name, - ))); + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_native_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); // try reading the results from cache $total_results = 0; @@ -979,10 +1113,57 @@ class fulltext_native extends \phpbb\search\base $select = ($type == 'posts') ? 'p.post_id' : 't.topic_id'; $is_mysql = false; + /** + * Allow changing the query used to search for posts by author in fulltext_native + * + * @event core.search_native_author_count_query_before + * @var int total_results The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string type The type of search being made + * @var string select SQL SELECT clause for what to get + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var array sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var string sql_firstpost The SQL used in the WHERE claused to filter by firstpost. + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'total_results', + 'type', + 'select', + 'sql_sort_table', + 'sql_sort_join', + 'sql_author', + 'topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'sql_firstpost', + 'ex_fid_ary', + 'sql_fora', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_author_count_query_before', compact($vars))); + // If the cache was completely empty count the results if (!$total_results) { - switch ($this->db->sql_layer) + switch ($this->db->get_sql_layer()) { case 'mysql4': case 'mysqli': @@ -1004,7 +1185,7 @@ class fulltext_native extends \phpbb\search\base } else { - if ($this->db->sql_layer == 'sqlite') + if ($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3') { $sql = 'SELECT COUNT(topic_id) as total_results FROM (SELECT DISTINCT t.topic_id'; @@ -1021,7 +1202,7 @@ class fulltext_native extends \phpbb\search\base $post_visibility $sql_fora AND t.topic_id = p.topic_id - $sql_time" . (($this->db->sql_layer == 'sqlite') ? ')' : ''); + $sql_time" . (($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3') ? ')' : ''); } $result = $this->db->sql_query($sql); @@ -1082,7 +1263,7 @@ class fulltext_native extends \phpbb\search\base // Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it. $sql_calc = str_replace('SELECT ' . $select, 'SELECT DISTINCT SQL_CALC_FOUND_ROWS p.post_id', $sql); - $this->db->sql_query($sql_calc); + $result = $this->db->sql_query($sql_calc); $this->db->sql_freeresult($result); $sql_count = 'SELECT FOUND_ROWS() as total_results'; @@ -1143,7 +1324,6 @@ class fulltext_native extends \phpbb\search\base $match[] = '#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?[0-9a-z]{5,})\]#'; $min = $this->word_length['min']; - $max = $this->word_length['max']; $isset_min = $min - 1; @@ -1179,9 +1359,9 @@ class fulltext_native extends \phpbb\search\base * Note: this could be optimized. If the codepoint is lower than Hangul's range * we know that it will also be lower than CJK ranges */ - if ((strncmp($word, UTF8_HANGUL_FIRST, 3) < 0 || strncmp($word, UTF8_HANGUL_LAST, 3) > 0) - && (strncmp($word, UTF8_CJK_FIRST, 3) < 0 || strncmp($word, UTF8_CJK_LAST, 3) > 0) - && (strncmp($word, UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, UTF8_CJK_B_LAST, 4) > 0)) + if ((strncmp($word, self::UTF8_HANGUL_FIRST, 3) < 0 || strncmp($word, self::UTF8_HANGUL_LAST, 3) > 0) + && (strncmp($word, self::UTF8_CJK_FIRST, 3) < 0 || strncmp($word, self::UTF8_CJK_LAST, 3) > 0) + && (strncmp($word, self::UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, self::UTF8_CJK_B_LAST, 4) > 0)) { $word = strtok(' '); continue; @@ -1426,7 +1606,7 @@ class fulltext_native extends \phpbb\search\base // carry on ... it's okay ... I know when I'm not wanted boo hoo if (!$this->config['fulltext_native_load_upd']) { - set_config('search_last_gc', time(), true); + $this->config->set('search_last_gc', time(), false); return; } @@ -1461,7 +1641,7 @@ class fulltext_native extends \phpbb\search\base // by setting search_last_gc to the new time here we make sure that if a user reloads because the // following query takes too long, he won't run into it again - set_config('search_last_gc', time(), true); + $this->config->set('search_last_gc', time(), false); // Delete the matches $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . ' @@ -1477,7 +1657,7 @@ class fulltext_native extends \phpbb\search\base $this->destroy_cache(array_unique($destroy_cache_words)); } - set_config('search_last_gc', time(), true); + $this->config->set('search_last_gc', time(), false); } /** @@ -1485,10 +1665,10 @@ class fulltext_native extends \phpbb\search\base */ public function delete_index($acp_module, $u_action) { - switch ($this->db->sql_layer) + switch ($this->db->get_sql_layer()) { case 'sqlite': - case 'firebird': + case 'sqlite3': $this->db->sql_query('DELETE FROM ' . SEARCH_WORDLIST_TABLE); $this->db->sql_query('DELETE FROM ' . SEARCH_WORDMATCH_TABLE); $this->db->sql_query('DELETE FROM ' . SEARCH_RESULTS_TABLE); @@ -1548,13 +1728,11 @@ class fulltext_native extends \phpbb\search\base * @param string $allowed_chars String of special chars to allow * @param string $encoding Text encoding * @return string Cleaned up text, only alphanumeric chars are left - * - * @todo \normalizer::cleanup being able to be used? */ protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') { static $conv = array(), $conv_loaded = array(); - $words = $allow = array(); + $allow = array(); // Convert the text to UTF-8 $encoding = strtolower($encoding); @@ -1576,12 +1754,9 @@ class fulltext_native extends \phpbb\search\base $text = htmlspecialchars_decode(utf8_decode_ncr($text), ENT_QUOTES); /** - * Load the UTF-8 normalizer - * - * If we use it more widely, an instance of that class should be held in a - * a global variable instead + * Normalize to NFC */ - \utf_normalizer::nfc($text); + $text = \Normalizer::normalize($text); /** * The first thing we do is: @@ -1674,9 +1849,9 @@ class fulltext_native extends \phpbb\search\base $utf_char = substr($text, $pos, $utf_len); $pos += $utf_len; - if (($utf_char >= UTF8_HANGUL_FIRST && $utf_char <= UTF8_HANGUL_LAST) - || ($utf_char >= UTF8_CJK_FIRST && $utf_char <= UTF8_CJK_LAST) - || ($utf_char >= UTF8_CJK_B_FIRST && $utf_char <= UTF8_CJK_B_LAST)) + if (($utf_char >= self::UTF8_HANGUL_FIRST && $utf_char <= self::UTF8_HANGUL_LAST) + || ($utf_char >= self::UTF8_CJK_FIRST && $utf_char <= self::UTF8_CJK_LAST) + || ($utf_char >= self::UTF8_CJK_B_FIRST && $utf_char <= self::UTF8_CJK_B_LAST)) { /** * All characters within these ranges are valid diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 063bf52a19..42425cbc6b 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -1,18 +1,20 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\search; /** -* fulltext_postgres * Fulltext search for PostgreSQL -* @package search */ class fulltext_postgres extends \phpbb\search\base { @@ -29,18 +31,6 @@ class fulltext_postgres extends \phpbb\search\base protected $split_words = array(); /** - * True if PostgreSQL version supports tsearch - * @var boolean - */ - protected $tsearch_usable = false; - - /** - * Stores the PostgreSQL version - * @var string - */ - protected $version; - - /** * Stores the tsearch query * @var string */ @@ -61,11 +51,17 @@ class fulltext_postgres extends \phpbb\search\base /** * Database connection - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * User object * @var \phpbb\user */ @@ -96,25 +92,23 @@ class fulltext_postgres extends \phpbb\search\base * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object */ - public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) { $this->config = $config; $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->user = $user; $this->word_length = array('min' => $this->config['fulltext_postgres_min_word_len'], 'max' => $this->config['fulltext_postgres_max_word_len']); - if ($this->db->sql_layer == 'postgres') - { - $pgsql_version = explode(',', substr($this->db->sql_server_info(), 10)); - $this->version = trim($pgsql_version[0]); - if (version_compare($this->version, '8.3', '>=')) - { - $this->tsearch_usable = true; - } - } - /** * Load the UTF tools */ @@ -183,16 +177,11 @@ class fulltext_postgres extends \phpbb\search\base */ public function init() { - if ($this->db->sql_layer != 'postgres') + if ($this->db->get_sql_layer() != 'postgres') { return $this->user->lang['FULLTEXT_POSTGRES_INCOMPATIBLE_DATABASE']; } - if (!$this->tsearch_usable) - { - return $this->user->lang['FULLTEXT_POSTGRES_TS_NOT_USABLE']; - } - return false; } @@ -261,12 +250,12 @@ class fulltext_postgres extends \phpbb\search\base $this->search_query .= $word . ' '; $this->tsearch_query .= '&' . substr($word, 1) . ' '; } - elseif (strpos($word, '-') === 0) + else if (strpos($word, '-') === 0) { $this->search_query .= $word . ' '; $this->tsearch_query .= '&!' . substr($word, 1) . ' '; } - elseif (strpos($word, '|') === 0) + else if (strpos($word, '|') === 0) { $this->search_query .= $word . ' '; $this->tsearch_query .= '|' . substr($word, 1) . ' '; @@ -352,7 +341,7 @@ class fulltext_postgres extends \phpbb\search\base } // generate a search_key from all the options to identify the results - $search_key = md5(implode('#', array( + $search_key_array = array( implode(', ', $this->split_words), $type, $fields, @@ -363,7 +352,39 @@ class fulltext_postgres extends \phpbb\search\base implode(',', $ex_fid_ary), $post_visibility, implode(',', $author_ary) - ))); + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_postgres_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); if ($start < 0) { @@ -428,10 +449,58 @@ class fulltext_postgres extends \phpbb\search\base break; } + $tsearch_query = $this->tsearch_query; + + /** + * Allow changing the query used to search for posts using fulltext_postgres + * + * @event core.search_postgres_keywords_main_query_before + * @var string tsearch_query The parsed keywords used for this search + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_match Which columns to do the search on. + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'tsearch_query', + 'result_count', + 'join_topic', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_match', + 'sql_match_where', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_keywords_main_query_before', compact($vars))); + $sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id'; $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; $field = ($type == 'posts') ? 'post_id' : 'topic_id'; - $sql_author = (sizeof($author_ary) == 1) ? ' = ' . $author_ary[0] : 'IN (' . implode(', ', $author_ary) . ')'; if (sizeof($author_ary) && $author_name) { @@ -456,16 +525,13 @@ class fulltext_postgres extends \phpbb\search\base $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $sql_where_options .= $sql_match_where; - $tmp_sql_match = array(); - foreach (explode(',', $sql_match) as $sql_match_column) - { - $tmp_sql_match[] = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match_column . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')"; - } + $sql_match = str_replace(',', " || ' ' ||", $sql_match); + $tmp_sql_match = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')"; $this->db->sql_transaction('begin'); $sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p"; - $sql_where = "WHERE (" . implode(' OR ', $tmp_sql_match) . ") + $sql_where = "WHERE (" . $tmp_sql_match . ") $sql_where_options"; $sql = "SELECT $sql_select $sql_from @@ -549,7 +615,7 @@ class fulltext_postgres extends \phpbb\search\base } // generate a search_key from all the options to identify the results - $search_key = md5(implode('#', array( + $search_key_array = array( '', $type, ($firstpost_only) ? 'firstpost' : '', @@ -562,7 +628,39 @@ class fulltext_postgres extends \phpbb\search\base $post_visibility, implode(',', $author_ary), $author_name, - ))); + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_postgres_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); if ($start < 0) { @@ -616,6 +714,55 @@ class fulltext_postgres extends \phpbb\search\base $m_approve_fid_sql = ' AND ' . $post_visibility; + /** + * Allow changing the query used to search for posts by author in fulltext_postgres + * + * @event core.search_postgres_author_count_query_before + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on + * @var string sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sql_topic_id SQL of topic_id + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var string m_approve_fid_sql WHERE clause condition on post_visibility restrictions + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'result_count', + 'sql_sort_table', + 'sql_sort_join', + 'author_ary', + 'author_name', + 'sql_author', + 'topic_id', + 'sql_topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'ex_fid_ary', + 'sql_fora', + 'm_approve_fid_sql', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_author_count_query_before', compact($vars))); + // Build the query for really selecting the post_ids if ($type == 'posts') { @@ -689,7 +836,7 @@ class fulltext_postgres extends \phpbb\search\base GROUP BY t.topic_id, $sort_by_sql[$sort_key]"; } - $result = $this->db->sql_query($sql_count); + $this->db->sql_query($sql_count); $result_count = (int) $this->db->sql_fetchfield('result_count'); if (!$result_count) @@ -767,7 +914,7 @@ class fulltext_postgres extends \phpbb\search\base // destroy too old cached search results $this->destroy_cache(array()); - set_config('search_last_gc', time(), true); + $this->config->set('search_last_gc', time(), false); } /** @@ -793,9 +940,9 @@ class fulltext_postgres extends \phpbb\search\base $this->db->sql_query("CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_subject ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_subject))"); } - if (!isset($this->stats['post_text'])) + if (!isset($this->stats['post_content'])) { - $this->db->sql_query("CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_text ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_text))"); + $this->db->sql_query("CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_content ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_text || ' ' || post_subject))"); } $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); @@ -826,9 +973,9 @@ class fulltext_postgres extends \phpbb\search\base $this->db->sql_query('DROP INDEX ' . $this->stats['post_subject']['relname']); } - if (isset($this->stats['post_text'])) + if (isset($this->stats['post_content'])) { - $this->db->sql_query('DROP INDEX ' . $this->stats['post_text']['relname']); + $this->db->sql_query('DROP INDEX ' . $this->stats['post_content']['relname']); } $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); @@ -846,7 +993,7 @@ class fulltext_postgres extends \phpbb\search\base $this->get_stats(); } - return (isset($this->stats['post_text']) && isset($this->stats['post_subject'])) ? true : false; + return (isset($this->stats['post_subject']) && isset($this->stats['post_content'])) ? true : false; } /** @@ -869,7 +1016,7 @@ class fulltext_postgres extends \phpbb\search\base */ protected function get_stats() { - if ($this->db->sql_layer != 'postgres') + if ($this->db->get_sql_layer() != 'postgres') { $this->stats = array(); return; @@ -888,13 +1035,13 @@ class fulltext_postgres extends \phpbb\search\base // deal with older PostgreSQL versions which didn't use Index_type if (strpos($row['indexdef'], 'to_tsvector') !== false) { - if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_text' || $row['relname'] == POSTS_TABLE . '_post_text') + if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_subject' || $row['relname'] == POSTS_TABLE . '_post_subject') { - $this->stats['post_text'] = $row; + $this->stats['post_subject'] = $row; } - else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_subject' || $row['relname'] == POSTS_TABLE . '_post_subject') + else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_content' || $row['relname'] == POSTS_TABLE . '_post_content') { - $this->stats['post_subject'] = $row; + $this->stats['post_content'] = $row; } } } @@ -913,13 +1060,13 @@ class fulltext_postgres extends \phpbb\search\base $tpl = ' <dl> <dt><label>' . $this->user->lang['FULLTEXT_POSTGRES_VERSION_CHECK'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN'] . '</span></dt> - <dd>' . (($this->tsearch_usable) ? $this->user->lang['YES'] : $this->user->lang['NO']) . ' (PostgreSQL ' . $this->version . ')</dd> + <dd>' . (($this->db->get_sql_layer() == 'postgres') ? $this->user->lang['YES'] : $this->user->lang['NO']) . '</dd> </dl> <dl> <dt><label>' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME_EXPLAIN'] . '</span></dt> <dd><select name="config[fulltext_postgres_ts_name]">'; - if ($this->db->sql_layer == 'postgres' && $this->tsearch_usable) + if ($this->db->get_sql_layer() == 'postgres') { $sql = 'SELECT cfgname AS ts_name FROM pg_ts_config'; diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index acbfad9474..504065e8cd 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -1,9 +1,13 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,9 +18,7 @@ define('SPHINX_CONNECT_RETRIES', 3); define('SPHINX_CONNECT_WAIT_TIME', 300); /** -* fulltext_sphinx * Fulltext search based on the sphinx search deamon -* @package search */ class fulltext_sphinx { @@ -77,13 +79,13 @@ class fulltext_sphinx /** * Database connection - * @var \phpbb\db\driver\driver + * @var \phpbb\db\driver\driver_interface */ protected $db; /** * Database Tools object - * @var \phpbb\db\tools + * @var \phpbb\db\tools\tools_interface */ protected $db_tools; @@ -94,6 +96,12 @@ class fulltext_sphinx protected $dbtype; /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * User object * @var \phpbb\user */ @@ -117,22 +125,31 @@ class fulltext_sphinx * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object */ - public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $phpEx; $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->user = $user; $this->db = $db; $this->auth = $auth; - // Initialize \phpbb\db\tools object - $this->db_tools = new \phpbb\db\tools($this->db); + // Initialize \phpbb\db\tools\tools object + global $phpbb_container; // TODO inject into object + $this->db_tools = $phpbb_container->get('dbal.tools'); - if(!$this->config['fulltext_sphinx_id']) + if (!$this->config['fulltext_sphinx_id']) { - set_config('fulltext_sphinx_id', unique_id()); + $this->config->set('fulltext_sphinx_id', unique_id()); } $this->id = $this->config['fulltext_sphinx_id']; $this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main'; @@ -197,13 +214,13 @@ class fulltext_sphinx */ public function init() { - if ($this->db->sql_layer != 'mysql' && $this->db->sql_layer != 'mysql4' && $this->db->sql_layer != 'mysqli' && $this->db->sql_layer != 'postgres') + if ($this->db->get_sql_layer() != 'mysql' && $this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres') { return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE']; } // Move delta to main index each hour - set_config('search_gc', 3600); + $this->config->set('search_gc', 3600); return false; } @@ -216,11 +233,11 @@ class fulltext_sphinx protected function config_generate() { // Check if Database is supported by Sphinx - if ($this->db->sql_layer =='mysql' || $this->db->sql_layer == 'mysql4' || $this->db->sql_layer == 'mysqli') + if ($this->db->get_sql_layer() =='mysql' || $this->db->get_sql_layer() == 'mysql4' || $this->db->get_sql_layer() == 'mysqli') { $this->dbtype = 'mysql'; } - else if ($this->db->sql_layer == 'postgres') + else if ($this->db->get_sql_layer() == 'postgres') { $this->dbtype = 'pgsql'; } @@ -248,8 +265,8 @@ class fulltext_sphinx array('type', $this->dbtype . ' # mysql or pgsql'), // This config value sql_host needs to be changed incase sphinx and sql are on different servers array('sql_host', $dbhost . ' # SQL server host sphinx connects to'), - array('sql_user', $dbuser), - array('sql_pass', $dbpasswd), + array('sql_user', '[dbuser]'), + array('sql_pass', '[dbpassword]'), array('sql_db', $dbname), array('sql_port', $dbport . ' # optional, default is 3306 for mysql and 5432 for pgsql'), array('sql_query_pre', 'SET NAMES \'utf8\''), @@ -282,9 +299,9 @@ class fulltext_sphinx array('sql_attr_uint', 'post_visibility'), array('sql_attr_bool', 'topic_first_post'), array('sql_attr_bool', 'deleted'), - array('sql_attr_timestamp' , 'post_time'), - array('sql_attr_timestamp' , 'topic_last_post_time'), - array('sql_attr_str2ordinal', 'post_subject'), + array('sql_attr_timestamp', 'post_time'), + array('sql_attr_timestamp', 'topic_last_post_time'), + array('sql_attr_string', 'post_subject'), ), 'source source_phpbb_' . $this->id . '_delta : source_phpbb_' . $this->id . '_main' => array( array('sql_query_pre', ''), @@ -342,6 +359,23 @@ class fulltext_sphinx $non_unique = array('sql_query_pre' => true, 'sql_attr_uint' => true, 'sql_attr_timestamp' => true, 'sql_attr_str2ordinal' => true, 'sql_attr_bool' => true); $delete = array('sql_group_column' => true, 'sql_date_column' => true, 'sql_str2ordinal_column' => true); + + /** + * Allow adding/changing the Sphinx configuration data + * + * @event core.search_sphinx_modify_config_data + * @var array config_data Array with the Sphinx configuration data + * @var array non_unique Array with the Sphinx non-unique variables to delete + * @var array delete Array with the Sphinx variables to delete + * @since 3.1.7-RC1 + */ + $vars = array( + 'config_data', + 'non_unique', + 'delete', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_modify_config_data', compact($vars))); + foreach ($config_data as $section_name => $section_data) { $section = $config_object->get_section_by_name($section_name); @@ -370,7 +404,7 @@ class fulltext_sphinx $variable = $section->get_variable_by_name($key); if (!$variable) { - $variable = $section->create_variable($key, $value); + $section->create_variable($key, $value); } else { @@ -379,7 +413,7 @@ class fulltext_sphinx } else { - $variable = $section->create_variable($key, $value); + $section->create_variable($key, $value); } } } @@ -403,7 +437,6 @@ class fulltext_sphinx $match = array('#\sand\s#i', '#\sor\s#i', '#\snot\s#i', '#\+#', '#-#', '#\|#', '#@#'); $replace = array(' & ', ' | ', ' - ', ' +', ' -', ' |', ''); - $replacements = 0; $keywords = preg_replace($match, $replace, $keywords); $this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED); } @@ -446,6 +479,8 @@ class fulltext_sphinx */ public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { + global $user, $phpbb_log; + // No keywords? No posts. if (!strlen($this->search_query) && !sizeof($author_ary)) { @@ -454,8 +489,6 @@ class fulltext_sphinx $id_ary = array(); - $join_topic = ($type != 'posts'); - // Sorting if ($type == 'topics') @@ -515,6 +548,41 @@ class fulltext_sphinx $this->sphinx->SetFilter('topic_id', array($topic_id)); } + /** + * Allow modifying the Sphinx search options + * + * @event core.search_sphinx_keywords_modify_options + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @var object sphinx The Sphinx searchd client object + * @since 3.1.7-RC1 + */ + $sphinx = $this->sphinx; + $vars = array( + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + 'sphinx', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_keywords_modify_options', compact($vars))); + $this->sphinx = $sphinx; + unset($sphinx); + $search_query_prefix = ''; switch ($fields) @@ -593,7 +661,7 @@ class fulltext_sphinx if ($this->sphinx->GetLastError()) { - add_log('critical', 'LOG_SPHINX_ERROR', $this->sphinx->GetLastError()); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_SPHINX_ERROR', false, array($this->sphinx->GetLastError())); if ($this->auth->acl_get('a_')) { trigger_error($this->user->lang('SPHINX_SEARCH_FAILED', $this->sphinx->GetLastError())); @@ -691,7 +759,7 @@ class fulltext_sphinx { if ($mode == 'edit') { - $this->sphinx->UpdateAttributes($this->indexes, array('forum_id', 'poster_id'), array((int)$post_id => array((int)$forum_id, (int)$poster_id))); + $this->sphinx->UpdateAttributes($this->indexes, array('forum_id', 'poster_id'), array((int) $post_id => array((int) $forum_id, (int) $poster_id))); } else if ($mode != 'post' && $post_id) { @@ -707,6 +775,7 @@ class fulltext_sphinx ), 'ON' => 'p1.topic_id = p2.topic_id', )), + 'WHERE' => 'p2.post_id = ' . ((int) $post_id), ); $sql = $this->db->sql_build_query('SELECT', $sql_array); @@ -716,7 +785,7 @@ class fulltext_sphinx $post_time = time(); while ($row = $this->db->sql_fetchrow($result)) { - $post_updates[(int)$row['post_id']] = array($post_time); + $post_updates[(int) $row['post_id']] = array($post_time); } $this->db->sql_freeresult($result); @@ -746,7 +815,7 @@ class fulltext_sphinx */ public function tidy($create = false) { - set_config('search_last_gc', time(), true); + $this->config->set('search_last_gc', time(), false); } /** diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index cb8e4524df..675649b460 100644 --- a/phpBB/phpbb/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php @@ -1,19 +1,21 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\search\sphinx; /** -* \phpbb\search\sphinx\config * An object representing the sphinx configuration * Can read it from file and write it back out after modification -* @package search */ class config { diff --git a/phpBB/phpbb/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php index 20b1c19af1..b5cd0a3db5 100644 --- a/phpBB/phpbb/search/sphinx/config_comment.php +++ b/phpBB/phpbb/search/sphinx/config_comment.php @@ -1,9 +1,13 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 8f9253ec56..14ab3a752c 100644 --- a/phpBB/phpbb/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php @@ -1,9 +1,13 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php index c0f6d28dcc..85cee20b62 100644 --- a/phpBB/phpbb/search/sphinx/config_variable.php +++ b/phpBB/phpbb/search/sphinx/config_variable.php @@ -1,9 +1,13 @@ <?php /** * -* @package search -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index f530d30f1f..3f7146c59b 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,6 @@ namespace phpbb; /** * Session class -* @package phpBB3 */ class session { @@ -28,10 +31,11 @@ class session var $update_session_page = true; /** - * Extract current session page - * - * @param string $root_path current root path (phpbb_root_path) - */ + * Extract current session page + * + * @param string $root_path current root path (phpbb_root_path) + * @return array + */ static function extract_current_page($root_path) { global $request, $symfony_request, $phpbb_filesystem; @@ -39,8 +43,8 @@ class session $page_array = array(); // First of all, get the request uri... - $script_name = $symfony_request->getScriptName(); - $args = explode('&', $symfony_request->getQueryString()); + $script_name = $request->escape($symfony_request->getScriptName(), true); + $args = $request->escape(explode('&', $symfony_request->getQueryString()), true); // If we are unable to get the script name we use REQUEST_URI as a failover and note it within the page array for easier support... if (!$script_name) @@ -58,8 +62,8 @@ class session // Since some browser do not encode correctly we need to do this with some "special" characters... // " -> %22, ' => %27, < -> %3C, > -> %3E - $find = array('"', "'", '<', '>'); - $replace = array('%22', '%27', '%3C', '%3E'); + $find = array('"', "'", '<', '>', '"', '<', '>'); + $replace = array('%22', '%27', '%3C', '%3E', '%22', '%3C', '%3E'); foreach ($args as $key => $argument) { @@ -84,12 +88,12 @@ class session $symfony_request_path = $phpbb_filesystem->clean_path($symfony_request->getPathInfo()); if ($symfony_request_path !== '/') { - $page_name .= $symfony_request_path; + $page_name .= str_replace('%2F', '/', urlencode($symfony_request_path)); } // current directory within the phpBB root (for example: adm) - $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($root_path))); - $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath('./'))); + $root_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath($root_path))); + $page_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath('./'))); $intersection = array_intersect_assoc($root_dirs, $page_dirs); $root_dirs = array_diff_assoc($root_dirs, $intersection); @@ -126,6 +130,10 @@ class session $script_path .= (substr($script_path, -1, 1) == '/') ? '' : '/'; $root_script_path .= (substr($root_script_path, -1, 1) == '/') ? '' : '/'; + $forum_id = $request->variable('f', 0); + // maximum forum id value is maximum value of mediumint unsigned column + $forum_id = ($forum_id > 0 && $forum_id < 16777215) ? $forum_id : 0; + $page_array += array( 'page_name' => $page_name, 'page_dir' => $page_dir, @@ -135,7 +143,7 @@ class session 'root_script_path' => str_replace(' ', '%20', htmlspecialchars($root_script_path)), 'page' => $page, - 'forum' => request_var('f', 0), + 'forum' => $forum_id, ); return $page_array; @@ -211,7 +219,7 @@ class session function session_begin($update_session_page = true) { global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $config, $phpbb_root_path; - global $request, $phpbb_container; + global $request, $phpbb_container, $user, $phpbb_log; // Give us some basic information $this->time_now = time(); @@ -249,23 +257,23 @@ class session if ($request->is_set($config['cookie_name'] . '_sid', \phpbb\request\request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', \phpbb\request\request_interface::COOKIE)) { - $this->cookie_data['u'] = request_var($config['cookie_name'] . '_u', 0, false, true); - $this->cookie_data['k'] = request_var($config['cookie_name'] . '_k', '', false, true); - $this->session_id = request_var($config['cookie_name'] . '_sid', '', false, true); + $this->cookie_data['u'] = $request->variable($config['cookie_name'] . '_u', 0, false, \phpbb\request\request_interface::COOKIE); + $this->cookie_data['k'] = $request->variable($config['cookie_name'] . '_k', '', false, \phpbb\request\request_interface::COOKIE); + $this->session_id = $request->variable($config['cookie_name'] . '_sid', '', false, \phpbb\request\request_interface::COOKIE); $SID = (defined('NEED_SID')) ? '?sid=' . $this->session_id : '?sid='; $_SID = (defined('NEED_SID')) ? $this->session_id : ''; if (empty($this->session_id)) { - $this->session_id = $_SID = request_var('sid', ''); + $this->session_id = $_SID = $request->variable('sid', ''); $SID = '?sid=' . $this->session_id; $this->cookie_data = array('u' => 0, 'k' => ''); } } else { - $this->session_id = $_SID = request_var('sid', ''); + $this->session_id = $_SID = $request->variable('sid', ''); $SID = '?sid=' . $this->session_id; } @@ -341,8 +349,8 @@ class session } else { - set_config('limit_load', '0'); - set_config('limit_search_load', '0'); + $config->set('limit_load', '0'); + $config->set('limit_search_load', '0'); } } @@ -405,9 +413,9 @@ class session $session_expired = false; // Check whether the session is still valid if we have one - $method = basename(trim($config['auth_method'])); - - $provider = $phpbb_container->get('auth.provider.' . $method); + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); if (!($provider instanceof \phpbb\auth\provider\provider_interface)) { @@ -439,38 +447,6 @@ class session if (!$session_expired) { - // Only update session DB a minute or so after last update or if page changes - if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) - { - $sql_ary = array('session_time' => $this->time_now); - - if ($this->update_session_page) - { - $sql_ary['session_page'] = substr($this->page['page'], 0, 199); - $sql_ary['session_forum_id'] = $this->page['forum']; - } - - $db->sql_return_on_error(true); - - $this->update_session($sql_ary); - - $db->sql_return_on_error(false); - - // If the database is not yet updated, there will be an error due to the session_forum_id - // @todo REMOVE for 3.0.2 - if ($result === false) - { - unset($sql_ary['session_forum_id']); - - $this->update_session($sql_ary); - } - - if ($this->data['user_id'] != ANONYMOUS && !empty($config['new_member_post_limit']) && $this->data['user_new'] && $config['new_member_post_limit'] <= $this->data['user_posts']) - { - $this->leave_newly_registered(); - } - } - $this->data['is_registered'] = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false; $this->data['is_bot'] = (!$this->data['is_registered'] && $this->data['user_id'] != ANONYMOUS) ? true : false; $this->data['user_lang'] = basename($this->data['user_lang']); @@ -485,11 +461,18 @@ class session { if ($referer_valid) { - add_log('critical', 'LOG_IP_BROWSER_FORWARDED_CHECK', $u_ip, $s_ip, $u_browser, $s_browser, htmlspecialchars($u_forwarded_for), htmlspecialchars($s_forwarded_for)); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_IP_BROWSER_FORWARDED_CHECK', false, array( + $u_ip, + $s_ip, + $u_browser, + $s_browser, + htmlspecialchars($u_forwarded_for), + htmlspecialchars($s_forwarded_for) + )); } else { - add_log('critical', 'LOG_REFERER_INVALID', $this->referer); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_REFERER_INVALID', false, array($this->referer)); } } } @@ -511,7 +494,7 @@ class session */ function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) { - global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx, $phpbb_container; + global $SID, $_SID, $db, $config, $cache, $phpbb_container, $phpbb_dispatcher; $this->data = array(); @@ -574,11 +557,16 @@ class session } } - $method = basename(trim($config['auth_method'])); - - $provider = $phpbb_container->get('auth.provider.' . $method); + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); $this->data = $provider->autologin(); + if ($user_id !== false && sizeof($this->data) && $this->data['user_id'] != $user_id) + { + $this->data = array(); + } + if (sizeof($this->data)) { $this->cookie_data['k'] = ''; @@ -596,11 +584,18 @@ class session AND k.user_id = u.user_id AND k.key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'"; $result = $db->sql_query($sql); - $this->data = $db->sql_fetchrow($result); + $user_data = $db->sql_fetchrow($result); + + if ($user_id === false || (isset($user_data['user_id']) && $user_id == $user_data['user_id'])) + { + $this->data = $user_data; + $bot = false; + } + $db->sql_freeresult($result); - $bot = false; } - else if ($user_id !== false && !sizeof($this->data)) + + if ($user_id !== false && !sizeof($this->data)) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = $user_id; @@ -715,18 +710,6 @@ class session // Only update session DB a minute or so after last update or if page changes if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) { - $this->data['session_time'] = $this->data['session_last_visit'] = $this->time_now; - - $sql_ary = array('session_time' => $this->time_now, 'session_last_visit' => $this->time_now, 'session_admin' => 0); - - if ($this->update_session_page) - { - $sql_ary['session_page'] = substr($this->page['page'], 0, 199); - $sql_ary['session_forum_id'] = $this->page['forum']; - } - - $this->update_session($sql_ary); - // Update the last visit time $sql = 'UPDATE ' . USERS_TABLE . ' SET user_lastvisit = ' . (int) $this->data['session_time'] . ' @@ -874,6 +857,19 @@ class session $_SID = ''; } + $session_data = $sql_ary; + /** + * Event to send new session data to extension + * Read-only event + * + * @event core.session_create_after + * @var array session_data Associative array of session keys to be updated + * @since 3.1.6-RC1 + */ + $vars = array('session_data'); + extract($phpbb_dispatcher->trigger_event('core.session_create_after', compact($vars))); + unset($session_data); + return true; } @@ -887,17 +883,34 @@ class session */ function session_kill($new_session = true) { - global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx, $phpbb_container; + global $SID, $_SID, $db, $phpbb_container, $phpbb_dispatcher; $sql = 'DELETE FROM ' . SESSIONS_TABLE . " WHERE session_id = '" . $db->sql_escape($this->session_id) . "' AND session_user_id = " . (int) $this->data['user_id']; $db->sql_query($sql); - // Allow connecting logout with external auth method logout - $method = basename(trim($config['auth_method'])); + $user_id = (int) $this->data['user_id']; + $session_id = $this->session_id; + /** + * Event to send session kill information to extension + * Read-only event + * + * @event core.session_kill_after + * @var int user_id user_id of the session user. + * @var string session_id current user's session_id + * @var bool new_session should we create new session for user + * @since 3.1.6-RC1 + */ + $vars = array('user_id', 'session_id', 'new_session'); + extract($phpbb_dispatcher->trigger_event('core.session_kill_after', compact($vars))); + unset($user_id); + unset($session_id); - $provider = $phpbb_container->get('auth.provider.' . $method); + // Allow connecting logout with external auth method logout + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); $provider->logout($this->data, $new_session); if ($this->data['user_id'] != ANONYMOUS) @@ -962,7 +975,7 @@ class session */ function session_gc() { - global $db, $config, $phpbb_root_path, $phpEx; + global $db, $config, $phpbb_container, $phpbb_dispatcher; $batch_size = 10; @@ -1012,7 +1025,7 @@ class session { // Less than 10 users, update gc timer ... else we want gc // called again to delete other sessions - set_config('session_last_gc', $this->time_now, true); + $config->set('session_last_gc', $this->time_now, false); if ($config['max_autologin_time']) { @@ -1022,11 +1035,8 @@ class session } // only called from CRON; should be a safe workaround until the infrastructure gets going - if (!class_exists('phpbb_captcha_factory', false)) - { - include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); - } - $captcha_factory = new \phpbb_captcha_factory(); + /* @var $captcha_factory \phpbb\captcha\factory */ + $captcha_factory = $phpbb_container->get('captcha.factory'); $captcha_factory->garbage_collect($config['captcha_plugin']); $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' @@ -1034,6 +1044,14 @@ class session $db->sql_query($sql); } + /** + * Event to trigger extension on session_gc + * + * @event core.session_gc_after + * @since 3.1.6-RC1 + */ + $phpbb_dispatcher->dispatch('core.session_gc_after'); + return; } @@ -1045,33 +1063,42 @@ class session * @param string $name Name of the cookie, will be automatically prefixed with the phpBB cookie name. track becomes [cookie_name]_track then. * @param string $cookiedata The data to hold within the cookie * @param int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set. + * @param bool $httponly Use HttpOnly. Defaults to true. Use false to make cookie accessible by client-side scripts. */ - function set_cookie($name, $cookiedata, $cookietime) + function set_cookie($name, $cookiedata, $cookietime, $httponly = true) { global $config; + // If headers are already set, we just return + if (headers_sent()) + { + return; + } + $name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata); $expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime); - $domain = (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']; + $domain = (!$config['cookie_domain'] || $config['cookie_domain'] == '127.0.0.1' || strpos($config['cookie_domain'], '.') === false) ? '' : '; domain=' . $config['cookie_domain']; - header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . '; HttpOnly', false); + header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . ';' . (($httponly) ? ' HttpOnly' : ''), false); } /** * Check for banned user * * Checks whether the supplied user is banned by id, ip or email. If no parameters - * are passed to the method pre-existing session data is used. If $return is false - * this routine does not return on finding a banned user, it outputs a relevant - * message and stops execution. + * are passed to the method pre-existing session data is used. * - * @param string|array $user_ips Can contain a string with one IP or an array of multiple IPs + * @param int|false $user_id The user id + * @param mixed $user_ips Can contain a string with one IP or an array of multiple IPs + * @param string|false $user_email The user email + * @param bool $return If $return is false this routine does not return on finding a banned user, + * it outputs a relevant message and stops execution. */ function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) { - global $config, $db; + global $config, $db, $phpbb_dispatcher; - if (defined('IN_CHECK_BAN')) + if (defined('IN_CHECK_BAN') || defined('SKIP_CHECK_BAN')) { return; } @@ -1183,9 +1210,23 @@ class session } $db->sql_freeresult($result); + /** + * Event to set custom ban type + * + * @event core.session_set_custom_ban + * @var bool return If $return is false this routine does not return on finding a banned user, it outputs a relevant message and stops execution + * @var bool banned Check if user already banned + * @var array|false ban_row Ban data + * @var string ban_triggered_by Method that caused ban, can be your custom method + * @since 3.1.3-RC1 + */ + $ban_row = isset($ban_row) ? $ban_row : false; + $vars = array('return', 'banned', 'ban_row', 'ban_triggered_by'); + extract($phpbb_dispatcher->trigger_event('core.session_set_custom_ban', compact($vars))); + if ($banned && !$return) { - global $template; + global $phpbb_root_path, $phpEx; // If the session is empty we need to create a valid one... if (empty($this->session_id)) @@ -1206,8 +1247,6 @@ class session // We show a login box here to allow founders accessing the board if banned by IP if (defined('IN_LOGIN') && $this->data['user_id'] == ANONYMOUS) { - global $phpEx; - $this->setup('ucp'); $this->data['is_registered'] = $this->data['is_bot'] = false; @@ -1231,7 +1270,8 @@ class session $till_date = ($ban_row['ban_end']) ? $this->format_date($ban_row['ban_end']) : ''; $message = ($ban_row['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; - $message = sprintf($this->lang[$message], $till_date, '<a href="mailto:' . $config['board_contact'] . '">', '</a>'); + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); + $message = sprintf($this->lang[$message], $till_date, '<a href="' . $contact_link . '">', '</a>'); $message .= ($ban_row['ban_give_reason']) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : ''; $message .= '<br /><br /><em>' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . '</em>'; @@ -1254,12 +1294,14 @@ class session /** * Check if ip is blacklisted - * This should be called only where absolutly necessary + * This should be called only where absolutely necessary * * Only IPv4 (rbldns does not support AAAA records/IPv6 lookups) * * @author satmd (from the php manual) - * @param string $mode register/post - spamcop for example is ommitted for posting + * @param string $mode register/post - spamcop for example is ommitted for posting + * @param string|false $ip the IPv4 address to check + * * @return false if ip is not blacklisted, else an array([checked server], [lookup]) */ function check_dnsbl($mode, $ip = false) @@ -1361,7 +1403,7 @@ class session */ function set_login_key($user_id = false, $key = false, $user_ip = false) { - global $config, $db; + global $db; $user_id = ($user_id === false) ? $this->data['user_id'] : $user_id; $user_ip = ($user_ip === false) ? $this->ip : $user_ip; @@ -1371,7 +1413,7 @@ class session $sql_ary = array( 'key_id' => (string) md5($key_id), - 'last_ip' => (string) $this->ip, + 'last_ip' => (string) $user_ip, 'last_login' => (int) time() ); @@ -1408,7 +1450,7 @@ class session */ function reset_login_keys($user_id = false) { - global $config, $db; + global $db; $user_id = ($user_id === false) ? (int) $this->data['user_id'] : (int) $user_id; @@ -1509,12 +1551,59 @@ class session */ public function update_session($session_data, $session_id = null) { - global $db; + global $db, $phpbb_dispatcher; $session_id = ($session_id) ? $session_id : $this->session_id; $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $session_data) . " WHERE session_id = '" . $db->sql_escape($session_id) . "'"; $db->sql_query($sql); + + /** + * Event to send update session information to extension + * Read-only event + * + * @event core.update_session_after + * @var array session_data Associative array of session keys to be updated + * @var string session_id current user's session_id + * @since 3.1.6-RC1 + */ + $vars = array('session_data', 'session_id'); + extract($phpbb_dispatcher->trigger_event('core.update_session_after', compact($vars))); + } + + public function update_session_infos() + { + global $config, $db, $request; + + // No need to update if it's a new session. Informations are already inserted by session_create() + if (isset($this->data['session_created']) && $this->data['session_created']) + { + return; + } + + // Only update session DB a minute or so after last update or if page changes + if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) + { + $sql_ary = array('session_time' => $this->time_now); + + // Do not update the session page for ajax requests, so the view online still works as intended + if ($this->update_session_page && !$request->is_ajax()) + { + $sql_ary['session_page'] = substr($this->page['page'], 0, 199); + $sql_ary['session_forum_id'] = $this->page['forum']; + } + + $db->sql_return_on_error(true); + + $this->update_session($sql_ary); + + $db->sql_return_on_error(false); + + if ($this->data['user_id'] != ANONYMOUS && !empty($config['new_member_post_limit']) && $this->data['user_new'] && $config['new_member_post_limit'] <= $this->data['user_posts']) + { + $this->leave_newly_registered(); + } + } } } diff --git a/phpBB/phpbb/symfony_request.php b/phpBB/phpbb/symfony_request.php index ebe862a565..2931cae3cc 100644 --- a/phpBB/phpbb/symfony_request.php +++ b/phpBB/phpbb/symfony_request.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,30 +15,25 @@ namespace phpbb; use Symfony\Component\HttpFoundation\Request; +/** + * WARNING: The Symfony request does not escape the input and should be used very carefully + * prefer the phpbb request as possible + */ class symfony_request extends Request { /** * Constructor * - * @param phpbb\request\request_interface $phpbb_request + * @param \phpbb\request\request_interface $phpbb_request */ public function __construct(\phpbb\request\request_interface $phpbb_request) { - // This function is meant to sanitize the global input arrays - $sanitizer = function(&$value, $key) { - $type_cast_helper = new \phpbb\request\type_cast_helper(); - $type_cast_helper->set_var($value, $value, gettype($value), true); - }; - $get_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::GET); $post_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::POST); $server_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::SERVER); $files_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::FILES); $cookie_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::COOKIE); - array_walk_recursive($get_parameters, $sanitizer); - array_walk_recursive($post_parameters, $sanitizer); - parent::__construct($get_parameters, $post_parameters, array(), $cookie_parameters, $files_parameters, $server_parameters); } } diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index 24e0d6698d..cb00f16549 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,14 +20,20 @@ class asset /** @var \phpbb\path_helper **/ protected $path_helper; + /** @var \phpbb\filesystem\filesystem */ + protected $filesystem; + /** * Constructor * * @param string $url URL + * @param \phpbb\path_helper $path_helper Path helper object + * @param \phpbb\filesystem\filesystem $filesystem */ - public function __construct($url, \phpbb\path_helper $path_helper) + public function __construct($url, \phpbb\path_helper $path_helper, \phpbb\filesystem\filesystem $filesystem) { $this->path_helper = $path_helper; + $this->filesystem = $filesystem; $this->set_url($url); } @@ -147,6 +157,24 @@ class asset */ public function set_path($path, $urlencode = false) { + // Since 1.7.0 Twig returns the real path of the file. We need it to be relative. + $real_root_path = $this->filesystem->realpath($this->path_helper->get_phpbb_root_path()) . DIRECTORY_SEPARATOR; + + // If the asset is under the phpBB root path we need to remove its path and then prepend $phpbb_root_path + if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) + { + $path = $this->path_helper->get_phpbb_root_path() . str_replace('\\', '/', substr($path, strlen($real_root_path))); + } + else + { + // Else we make the path relative to the current working directory + $real_root_path = $this->filesystem->realpath('.') . DIRECTORY_SEPARATOR; + if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) + { + $path = str_replace('\\', '/', substr($path, strlen($real_root_path))); + } + } + if ($urlencode) { $paths = explode('/', $path); @@ -156,6 +184,7 @@ class asset } $path = implode('/', $paths); } + $this->components['path'] = $path; } diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index 6044effa1f..9a40702ba8 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -113,6 +117,16 @@ abstract class base implements template /** * {@inheritdoc} */ + public function assign_block_vars_array($blockname, array $block_vars_array) + { + $this->context->assign_block_vars_array($blockname, $block_vars_array); + + return $this; + } + + /** + * {@inheritdoc} + */ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert') { return $this->context->alter_block_array($blockname, $vararray, $key, $mode); @@ -128,11 +142,11 @@ abstract class base implements template { global $phpbb_hook; - if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this)) + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array('template', $method), $handle, $this)) { - if ($phpbb_hook->hook_return(array(__CLASS__, $method))) + if ($phpbb_hook->hook_return(array('template', $method))) { - $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method)); + $result = $phpbb_hook->hook_return_result(array('template', $method)); return array($result); } } diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 65c7d094a0..4ee48205c8 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,8 +15,6 @@ namespace phpbb\template; /** * Stores variables assigned to template. -* -* @package phpBB3 */ class context { @@ -32,6 +34,11 @@ class context */ private $rootref; + /** + * @var bool + */ + private $num_rows_is_set; + public function __construct() { $this->clear(); @@ -44,6 +51,7 @@ class context { $this->tpldata = array('.' => array(0 => array())); $this->rootref = &$this->tpldata['.'][0]; + $this->num_rows_is_set = false; } /** @@ -53,6 +61,7 @@ class context * * @param string $varname Variable name * @param string $varval Value to assign to variable + * @return true */ public function assign_var($varname, $varval) { @@ -68,6 +77,7 @@ class context * * @param string $varname Variable name * @param string $varval Value to append to variable + * @return true */ public function append_var($varname, $varval) { @@ -91,10 +101,59 @@ class context // returning a reference directly is not // something php is capable of doing $ref = &$this->tpldata; + + if (!$this->num_rows_is_set) + { + /* + * We do not set S_NUM_ROWS while adding a row, to reduce the complexity + * If we would set it on adding, each subsequent adding would cause + * n modifications, resulting in a O(n!) complexity, rather then O(n) + */ + foreach ($ref as $loop_name => &$loop_data) + { + if ($loop_name === '.') + { + continue; + } + + $this->set_num_rows($loop_data); + } + $this->num_rows_is_set = true; + } + return $ref; } /** + * Set S_NUM_ROWS for each row in this template block + * + * @param array $loop_data + */ + protected function set_num_rows(&$loop_data) + { + $s_num_rows = sizeof($loop_data); + foreach ($loop_data as &$mod_block) + { + foreach ($mod_block as $sub_block_name => &$sub_block) + { + // If the key name is lowercase and the data is an array, + // it could be a template loop. So we set the S_NUM_ROWS there + // aswell. + if ($sub_block_name === strtolower($sub_block_name) && is_array($sub_block)) + { + $this->set_num_rows($sub_block); + } + } + + // Check whether we are inside a block before setting the variable + if (isset($mod_block['S_BLOCK_NAME'])) + { + $mod_block['S_NUM_ROWS'] = $s_num_rows; + } + } + } + + /** * Returns a reference to template root scope. * * This function is public so that template renderer may invoke it. @@ -115,9 +174,11 @@ class context * * @param string $blockname Name of block to assign $vararray to * @param array $vararray A hash of variable name => value pairs + * @return true */ public function assign_block_vars($blockname, array $vararray) { + $this->num_rows_is_set = false; if (strpos($blockname, '.') !== false) { // Nested block. @@ -155,12 +216,6 @@ class context // We're adding a new iteration to this block with the given // variable assignments. $str[$blocks[$blockcount]][] = $vararray; - - // Set S_NUM_ROWS - foreach ($str[$blocks[$blockcount]] as &$mod_block) - { - $mod_block['S_NUM_ROWS'] = sizeof($str[$blocks[$blockcount]]); - } } else { @@ -186,12 +241,23 @@ class context // Add a new iteration to this block with the variable assignments we were given. $this->tpldata[$blockname][] = $vararray; + } - // Set S_NUM_ROWS - foreach ($this->tpldata[$blockname] as &$mod_block) - { - $mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]); - } + return true; + } + + /** + * Assign key variable pairs from an array to a whole specified block loop + * + * @param string $blockname Name of block to assign $block_vars_array to + * @param array $block_vars_array An array of hashes of variable name => value pairs + * @return true + */ + public function assign_block_vars_array($blockname, array $block_vars_array) + { + foreach ($block_vars_array as $vararray) + { + $this->assign_block_vars($blockname, $vararray); } return true; @@ -226,6 +292,7 @@ class context */ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert') { + $this->num_rows_is_set = false; if (strpos($blockname, '.') !== false) { // Nested block. @@ -325,12 +392,6 @@ class context $block[$key] = $vararray; $block[$key]['S_ROW_COUNT'] = $block[$key]['S_ROW_NUM'] = $key; - // Set S_NUM_ROWS - foreach ($this->tpldata[$blockname] as &$mod_block) - { - $mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]); - } - return true; } @@ -354,9 +415,11 @@ class context * Reset/empty complete block * * @param string $blockname Name of block to destroy + * @return true */ public function destroy_block_vars($blockname) { + $this->num_rows_is_set = false; if (strpos($blockname, '.') !== false) { // Nested block. diff --git a/phpBB/phpbb/template/exception/user_object_not_available.php b/phpBB/phpbb/template/exception/user_object_not_available.php new file mode 100644 index 0000000000..62fd2743c1 --- /dev/null +++ b/phpBB/phpbb/template/exception/user_object_not_available.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\template\exception; + +/** + * This exception is thrown when the user object was not set but it is required by the called method + */ +class user_object_not_available extends \phpbb\exception\runtime_exception +{ + +} diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index d95b0a822c..041ecb12e4 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -132,6 +136,14 @@ interface template public function assign_block_vars($blockname, array $vararray); /** + * Assign key variable pairs from an array to a whole specified block loop + * @param string $blockname Name of block to assign $block_vars_array to + * @param array $block_vars_array An array of hashes of variable name => value pairs + * @return \phpbb\template\template $this + */ + public function assign_block_vars_array($blockname, array $block_vars_array); + + /** * Change already assigned key variable pair (one-dimensional - single loop entry) * * An example of how to use this function: @@ -163,6 +175,7 @@ interface template /** * Get path to template for handle (required for BBCode parser) * + * @param string $handle Handle to retrieve the source file * @return string */ public function get_source_file_for_handle($handle); diff --git a/phpBB/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php index 945c46675e..cb3c953692 100644 --- a/phpBB/phpbb/template/twig/definition.php +++ b/phpBB/phpbb/template/twig/definition.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,6 +25,8 @@ class definition * Get a DEFINE'd variable * * @param string $name + * @param array $arguments + * * @return mixed Null if not found */ public function __call($name, $arguments) diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index aa55f1e011..6e75403159 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,9 +18,15 @@ class environment extends \Twig_Environment /** @var \phpbb\config\config */ protected $phpbb_config; + /** @var \phpbb\filesystem\filesystem */ + protected $filesystem; + /** @var \phpbb\path_helper */ protected $phpbb_path_helper; + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + /** @var \phpbb\extension\manager */ protected $extension_manager; @@ -32,27 +42,53 @@ class environment extends \Twig_Environment /** * Constructor * - * @param \phpbb\config\config $phpbb_config - * @param \phpbb\path_helper - * @param \phpbb\extension\manager - * @param string $phpbb_root_path - * @param Twig_LoaderInterface $loader + * @param \phpbb\config\config $phpbb_config The phpBB configuration + * @param \phpbb\filesystem\filesystem $filesystem + * @param \phpbb\path_helper $path_helper phpBB path helper + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container The dependency injection container + * @param string $cache_path The path to the cache directory + * @param \phpbb\extension\manager $extension_manager phpBB extension manager + * @param \Twig_LoaderInterface $loader Twig loader interface * @param array $options Array of options to pass to Twig */ - public function __construct($phpbb_config, \phpbb\path_helper $path_helper, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array()) + public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, \Symfony\Component\DependencyInjection\ContainerInterface $container, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array()) { $this->phpbb_config = $phpbb_config; + $this->filesystem = $filesystem; $this->phpbb_path_helper = $path_helper; $this->extension_manager = $extension_manager; + $this->container = $container; $this->phpbb_root_path = $this->phpbb_path_helper->get_phpbb_root_path(); $this->web_root_path = $this->phpbb_path_helper->get_web_root_path(); + $options = array_merge(array( + 'cache' => (defined('IN_INSTALL')) ? false : $cache_path, + 'debug' => false, + 'auto_reload' => (bool) $this->phpbb_config['load_tplcompile'], + 'autoescape' => false, + ), $options); + return parent::__construct($loader, $options); } /** + * {@inheritdoc} + */ + public function getLexer() + { + if (null === $this->lexer) + { + $this->lexer = $this->container->get('template.twig.lexer'); + $this->lexer->set_environment($this); + } + + return $this->lexer; + } + + + /** * Get the list of enabled phpBB extensions * * Used in EVENT node @@ -75,16 +111,26 @@ class environment extends \Twig_Environment } /** - * Get the phpBB root path - * - * @return string - */ + * Get the phpBB root path + * + * @return string + */ public function get_phpbb_root_path() { return $this->phpbb_root_path; } /** + * Get the filesystem object + * + * @return \phpbb\filesystem\filesystem + */ + public function get_filesystem() + { + return $this->filesystem; + } + + /** * Get the web root path * * @return string @@ -118,7 +164,7 @@ class environment extends \Twig_Environment * Set the namespace look up order to load templates from * * @param array $namespace - * @return Twig_Environment + * @return \Twig_Environment */ public function setNamespaceLookUpOrder($namespace) { @@ -128,12 +174,13 @@ class environment extends \Twig_Environment } /** - * Loads a template by name. - * - * @param string $name The template name - * @param integer $index The index if it is an embedded template - * @return Twig_TemplateInterface A template instance representing the given template name - */ + * Loads a template by name. + * + * @param string $name The template name + * @param integer $index The index if it is an embedded template + * @return \Twig_TemplateInterface A template instance representing the given template name + * @throws \Twig_Error_Loader + */ public function loadTemplate($name, $index = null) { if (strpos($name, '@') === false) @@ -164,11 +211,12 @@ class environment extends \Twig_Environment } /** - * Finds a template by name. - * - * @param string $name The template name - * @return string - */ + * Finds a template by name. + * + * @param string $name The template name + * @return string + * @throws \Twig_Error_Loader + */ public function findTemplate($name) { if (strpos($name, '@') === false) @@ -184,7 +232,7 @@ class environment extends \Twig_Environment return parent::getLoader()->getCacheKey('@' . $namespace . '/' . $name); } - catch (Twig_Error_Loader $e) + catch (\Twig_Error_Loader $e) { } } diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 6847dbd9f8..92f87a0331 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,20 +18,20 @@ class extension extends \Twig_Extension /** @var \phpbb\template\context */ protected $context; - /** @var \phpbb\user */ - protected $user; + /** @var \phpbb\language\language */ + protected $language; /** * Constructor * * @param \phpbb\template\context $context - * @param \phpbb\user $user + * @param \phpbb\language\language $language * @return \phpbb\template\twig\extension */ - public function __construct(\phpbb\template\context $context, $user) + public function __construct(\phpbb\template\context $context, $language) { $this->context = $context; - $this->user = $user; + $this->language = $language; } /** @@ -67,6 +71,7 @@ class extension extends \Twig_Extension { return array( new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + // @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes new \Twig_SimpleFilter('addslashes', 'addslashes'), ); } @@ -123,7 +128,7 @@ class extension extends \Twig_Extension /** * Grabs a subset of a loop * - * @param Twig_Environment $env A Twig_Environment instance + * @param \Twig_Environment $env A Twig_Environment instance * @param mixed $item A variable * @param integer $start Start of the subset * @param integer $end End of the subset @@ -158,7 +163,6 @@ class extension extends \Twig_Extension * (e.g. in the ACP, L_TITLE) * If not, we return the result of $user->lang() * - * @param string $lang name * @return string */ function lang() @@ -174,9 +178,9 @@ class extension extends \Twig_Extension return $context_vars['L_' . $key]; } - // LA_ is transformed into lang(\'$1\')|addslashes, so we should not + // LA_ is transformed into lang(\'$1\')|escape('js'), so we should not // need to check for it - return call_user_func_array(array($this->user, 'lang'), $args); + return call_user_func_array(array($this->language, 'lang'), $args); } } diff --git a/phpBB/phpbb/template/twig/extension/routing.php b/phpBB/phpbb/template/twig/extension/routing.php new file mode 100644 index 0000000000..829ce738eb --- /dev/null +++ b/phpBB/phpbb/template/twig/extension/routing.php @@ -0,0 +1,43 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\extension; + +use Symfony\Bridge\Twig\Extension\RoutingExtension; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +class routing extends RoutingExtension +{ + /** @var \phpbb\controller\helper */ + protected $helper; + + /** + * Constructor + * + * @param \phpbb\routing\helper $helper + */ + public function __construct(\phpbb\routing\helper $helper) + { + $this->helper = $helper; + } + + public function getPath($name, $parameters = array(), $relative = false) + { + return $this->helper->route($name, $parameters, true, false, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); + } + + public function getUrl($name, $parameters = array(), $schemeRelative = false) + { + return $this->helper->route($name, $parameters, true, false, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL); + } +} diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index f4efc58540..f1542109a4 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,6 +15,11 @@ namespace phpbb\template\twig; class lexer extends \Twig_Lexer { + public function set_environment(\Twig_Environment $env) + { + $this->env = $env; + } + public function tokenize($code, $filename = null) { // Our phpBB tags @@ -108,9 +117,9 @@ class lexer extends \Twig_Lexer // Appends any filters after lang() $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code); - // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }} - // Appends any filters after lang(), but before addslashes - $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code); + // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|escape('js') }} + // Appends any filters after lang(), but before escape('js') + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|escape(\'js\') }}', $code); // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} // Appends any filters @@ -191,9 +200,16 @@ class lexer extends \Twig_Lexer $parent_class = $this; $callback = function ($matches) use ($parent_class, $parent_nodes) { - $name = $matches[1]; - $subset = trim(substr($matches[2], 1, -1)); // Remove parenthesis - $body = $matches[3]; + $hard_parents = explode('.', $matches[1]); + array_pop($hard_parents); // ends with . + if ($hard_parents) + { + $parent_nodes = array_merge($hard_parents, $parent_nodes); + } + + $name = $matches[2]; + $subset = trim(substr($matches[3], 1, -1)); // Remove parenthesis + $body = $matches[4]; // Replace <!-- BEGINELSE --> $body = str_replace('<!-- BEGINELSE -->', '{% else %}', $body); @@ -242,7 +258,7 @@ class lexer extends \Twig_Lexer return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; - return preg_replace_callback('#<!-- BEGIN ([!a-zA-Z0-9_]+)(\([0-9,\-]+\))? -->(.+?)<!-- END \1 -->#s', $callback, $code); + return preg_replace_callback('#<!-- BEGIN ((?:[a-zA-Z0-9_]+\.)*)([!a-zA-Z0-9_]+)(\([0-9,\-]+\))? -->(.+?)<!-- END \1\2 -->#s', $callback, $code); } /** @@ -274,7 +290,7 @@ class lexer extends \Twig_Lexer return "<!-- {$matches[1]}IF{$inner}-->"; }; - return preg_replace_callback('#<!-- (ELSE)?IF((.*?) \(*!?[\$|\.]([^\s]+)(.*?))-->#', $callback, $code); + return preg_replace_callback('#<!-- (ELSE)?IF((.*?) (?:\(*!?[\$|\.]([^\s]+)(.*?))?)-->#', $callback, $code); } /** diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index e01e9de467..8b12188a77 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,17 +15,34 @@ namespace phpbb\template\twig; /** * Twig Template loader -* @package phpBB3 */ class loader extends \Twig_Loader_Filesystem { protected $safe_directories = array(); /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param string|array $paths + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $paths = array()) + { + $this->filesystem = $filesystem; + + parent::__construct($paths); + } + + /** * Set safe directories * * @param array $directories Array of directories that are safe (empty to clear) - * @return Twig_Loader_Filesystem + * @return \Twig_Loader_Filesystem */ public function setSafeDirectories($directories = array()) { @@ -42,11 +63,11 @@ class loader extends \Twig_Loader_Filesystem * Add safe directory * * @param string $directory Directory that should be added - * @return Twig_Loader_Filesystem + * @return \Twig_Loader_Filesystem */ public function addSafeDirectory($directory) { - $directory = phpbb_realpath($directory); + $directory = $this->filesystem->realpath($directory); if ($directory !== false) { @@ -94,7 +115,8 @@ class loader extends \Twig_Loader_Filesystem // If this is in the cache we can skip the entire process below // as it should have already been validated - if (isset($this->cache[$name])) { + if (isset($this->cache[$name])) + { return $this->cache[$name]; } @@ -107,7 +129,7 @@ class loader extends \Twig_Loader_Filesystem // Try validating the name (which may throw an exception) parent::validateName($name); } - catch (Twig_Error_Loader $e) + catch (\Twig_Error_Loader $e) { if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0) { @@ -115,7 +137,7 @@ class loader extends \Twig_Loader_Filesystem // can now check if we're within a "safe" directory // Find the real path of the directory the file is in - $directory = phpbb_realpath(dirname($file)); + $directory = $this->filesystem->realpath(dirname($file)); if ($directory === false) { diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php index 6a9969f8c6..ddbd151d20 100644 --- a/phpBB/phpbb/template/twig/node/definenode.php +++ b/phpBB/phpbb/template/twig/node/definenode.php @@ -1,15 +1,19 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier, Armin Ronacher -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\node; - class definenode extends \Twig_Node { public function __construct($capture, \Twig_NodeInterface $name, \Twig_NodeInterface $value, $lineno, $tag = null) @@ -18,15 +22,16 @@ class definenode extends \Twig_Node } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); - if ($this->getAttribute('capture')) { + if ($this->getAttribute('capture')) + { $compiler ->write("ob_start();\n") ->subcompile($this->getNode('value')) diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 7a1181a866..11fdb75247 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -1,24 +1,27 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\node; - class event extends \Twig_Node { /** - * The subdirectory in which all template listener files must be placed - * @var string - */ + * The subdirectory in which all template listener files must be placed + * @var string + */ protected $listener_directory = 'event/'; - /** @var Twig_Environment */ + /** @var \Twig_Environment */ protected $environment; public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) @@ -29,10 +32,10 @@ class event extends \Twig_Node } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); @@ -43,7 +46,7 @@ class event extends \Twig_Node { $ext_namespace = str_replace('/', '_', $ext_namespace); - if (defined('DEBUG')) + if ($this->environment->isDebug()) { // If debug mode is enabled, lets check for new/removed EVENT // templates on page load rather than at compile. This is @@ -55,7 +58,7 @@ class event extends \Twig_Node ; } - if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) + if ($this->environment->isDebug() || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html')) { $compiler ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") @@ -67,7 +70,7 @@ class event extends \Twig_Node ; } - if (defined('DEBUG')) + if ($this->environment->isDebug()) { $compiler ->outdent() diff --git a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php index f3bbfa6691..2cd15d59da 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php @@ -1,15 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\node\expression\binary; - class equalequal extends \Twig_Node_Expression_Binary { public function operator(\Twig_Compiler $compiler) diff --git a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php index c9c2687e08..5f2908fb9b 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php @@ -1,15 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\node\expression\binary; - class notequalequal extends \Twig_Node_Expression_Binary { public function operator(\Twig_Compiler $compiler) diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index f6c9dc9c58..324823b8d7 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,7 @@ namespace phpbb\template\twig\node; abstract class includeasset extends \Twig_Node { - /** @var Twig_Environment */ + /** @var \Twig_Environment */ protected $environment; public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) @@ -21,10 +25,10 @@ abstract class includeasset extends \Twig_Node parent::__construct(array('expr' => $expr), array(), $lineno, $tag); } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); @@ -35,7 +39,7 @@ abstract class includeasset extends \Twig_Node ->write("\$asset_file = ") ->subcompile($this->getNode('expr')) ->raw(";\n") - ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_path_helper());\n") + ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_path_helper(), \$this->getEnvironment()->get_filesystem());\n") ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") @@ -70,7 +74,7 @@ abstract class includeasset extends \Twig_Node /** * Append the output code for the asset * - * @param Twig_Compiler A Twig_Compiler instance + * @param \Twig_Compiler A Twig_Compiler instance * @return null */ abstract protected function append_asset(\Twig_Compiler $compiler); diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php index deb279fa4a..2dac154036 100644 --- a/phpBB/phpbb/template/twig/node/includecss.php +++ b/phpBB/phpbb/template/twig/node/includecss.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -27,7 +31,7 @@ class includecss extends \phpbb\template\twig\node\includeasset $compiler ->raw("<link href=\"' . ") ->raw("\$asset_file . '\"") - ->raw(' rel="stylesheet" type="text/css" media="screen, projection" />') + ->raw(' rel="stylesheet" type="text/css" media="screen" />') ; } } diff --git a/phpBB/phpbb/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php index 696b640eac..e77f2afeed 100644 --- a/phpBB/phpbb/template/twig/node/includejs.php +++ b/phpBB/phpbb/template/twig/node/includejs.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -24,8 +28,6 @@ class includejs extends \phpbb\template\twig\node\includeasset */ protected function append_asset(\Twig_Compiler $compiler) { - $config = $this->environment->get_phpbb_config(); - $compiler ->raw("<script type=\"text/javascript\" src=\"' . ") ->raw("\$asset_file") diff --git a/phpBB/phpbb/template/twig/node/includenode.php b/phpBB/phpbb/template/twig/node/includenode.php index d9b45d6407..c36ac3c324 100644 --- a/phpBB/phpbb/template/twig/node/includenode.php +++ b/phpBB/phpbb/template/twig/node/includenode.php @@ -1,22 +1,25 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\node; - class includenode extends \Twig_Node_Include { /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index 3f4621c0a9..76182c2f84 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -1,18 +1,22 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier, Armin Ronacher -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* Sections (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\node; - class includephp extends \Twig_Node { - /** @var Twig_Environment */ + /** @var \Twig_Environment */ protected $environment; public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) @@ -23,10 +27,10 @@ class includephp extends \Twig_Node } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); @@ -42,7 +46,8 @@ class includephp extends \Twig_Node return; } - if ($this->getAttribute('ignore_missing')) { + if ($this->getAttribute('ignore_missing')) + { $compiler ->write("try {\n") ->indent() @@ -71,7 +76,8 @@ class includephp extends \Twig_Node ->write("}\n") ; - if ($this->getAttribute('ignore_missing')) { + if ($this->getAttribute('ignore_missing')) + { $compiler ->outdent() ->write("} catch (\Twig_Error_Loader \$e) {\n") diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php index 2b18551266..4ee415e446 100644 --- a/phpBB/phpbb/template/twig/node/php.php +++ b/phpBB/phpbb/template/twig/node/php.php @@ -1,18 +1,21 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\node; - class php extends \Twig_Node { - /** @var Twig_Environment */ + /** @var \Twig_Environment */ protected $environment; public function __construct(\Twig_Node_Text $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null) @@ -23,10 +26,10 @@ class php extends \Twig_Node } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index 8484f2e81a..b755836ccd 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -1,24 +1,30 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\tokenparser; - class defineparser extends \Twig_TokenParser { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + * @throws \Twig_Error_Syntax + * @throws \phpbb\template\twig\node\definenode + */ public function parse(\Twig_Token $token) { $lineno = $token->getLine(); @@ -26,7 +32,8 @@ class defineparser extends \Twig_TokenParser $name = $this->parser->getExpressionParser()->parseExpression(); $capture = false; - if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) { + if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) + { $stream->next(); $value = $this->parser->getExpressionParser()->parseExpression(); @@ -38,7 +45,9 @@ class defineparser extends \Twig_TokenParser } $stream->expect(\Twig_Token::BLOCK_END_TYPE); - } else { + } + else + { $capture = true; $stream->expect(\Twig_Token::BLOCK_END_TYPE); @@ -56,10 +65,10 @@ class defineparser extends \Twig_TokenParser } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ public function getTag() { return 'DEFINE'; diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php index 8864e879f8..f73ef4ae25 100644 --- a/phpBB/phpbb/template/twig/tokenparser/event.php +++ b/phpBB/phpbb/template/twig/tokenparser/event.php @@ -1,24 +1,27 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\tokenparser; - class event extends \Twig_TokenParser { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -30,10 +33,10 @@ class event extends \Twig_TokenParser } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ public function getTag() { return 'EVENT'; diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php index 7bf4c610b1..1f30811754 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,12 +16,12 @@ namespace phpbb\template\twig\tokenparser; class includecss extends \Twig_TokenParser { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -29,10 +33,10 @@ class includecss extends \Twig_TokenParser } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ public function getTag() { return 'INCLUDECSS'; diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php index 0e46915b86..4b67d2c468 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php @@ -1,24 +1,27 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\tokenparser; - class includejs extends \Twig_TokenParser { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -30,10 +33,10 @@ class includejs extends \Twig_TokenParser } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ public function getTag() { return 'INCLUDEJS'; diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php index d351f1b4cd..aa7236aaa6 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -1,24 +1,28 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\tokenparser; - class includeparser extends \Twig_TokenParser_Include { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -29,10 +33,10 @@ class includeparser extends \Twig_TokenParser_Include } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ public function getTag() { return 'INCLUDE'; diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index 1b3d1742e3..3992636f8c 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php @@ -1,24 +1,28 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier, Armin Ronacher -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\tokenparser; - class includephp extends \Twig_TokenParser { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -26,7 +30,8 @@ class includephp extends \Twig_TokenParser $stream = $this->parser->getStream(); $ignoreMissing = false; - if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) { + if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) + { $stream->next(); $stream->expect(\Twig_Token::NAME_TYPE, 'missing'); @@ -39,10 +44,10 @@ class includephp extends \Twig_TokenParser } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ public function getTag() { return 'INCLUDEPHP'; diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php index b427969e2d..f11ce35896 100644 --- a/phpBB/phpbb/template/twig/tokenparser/php.php +++ b/phpBB/phpbb/template/twig/tokenparser/php.php @@ -1,24 +1,27 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig\tokenparser; - class php extends \Twig_TokenParser { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(\Twig_Token $token) { $stream = $this->parser->getStream(); @@ -38,10 +41,10 @@ class php extends \Twig_TokenParser } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ public function getTag() { return 'PHP'; diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 83630f5992..6b3cf32bc8 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -1,17 +1,22 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\template\twig; +use phpbb\template\exception\user_object_not_available; + /** * Twig Template class. -* @package phpBB3 */ class twig extends \phpbb\template\base { @@ -64,7 +69,7 @@ class twig extends \phpbb\template\base /** * Twig Environment * - * @var Twig_Environment + * @var \Twig_Environment */ protected $twig; @@ -73,11 +78,14 @@ class twig extends \phpbb\template\base * * @param \phpbb\path_helper $path_helper * @param \phpbb\config\config $config - * @param \phpbb\user $user * @param \phpbb\template\context $context template context + * @param \phpbb\template\twig\environment $twig_environment + * @param string $cache_path + * @param \phpbb\user|null $user + * @param array|\ArrayAccess $extensions * @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked */ - public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) + public function __construct(\phpbb\path_helper $path_helper, $config, \phpbb\template\context $context, \phpbb\template\twig\environment $twig_environment, $cache_path, \phpbb\user $user = null, $extensions = array(), \phpbb\extension\manager $extension_manager = null) { $this->path_helper = $path_helper; $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); @@ -86,35 +94,13 @@ class twig extends \phpbb\template\base $this->user = $user; $this->context = $context; $this->extension_manager = $extension_manager; + $this->cachepath = $cache_path; + $this->twig = $twig_environment; - $this->cachepath = $this->phpbb_root_path . 'cache/twig/'; - - // Initiate the loader, __main__ namespace paths will be setup later in set_style_names() - $loader = new \phpbb\template\twig\loader(''); - - $this->twig = new \phpbb\template\twig\environment( - $this->config, - $this->path_helper, - $this->extension_manager, - $loader, - array( - 'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath, - 'debug' => defined('DEBUG'), - 'auto_reload' => (bool) $this->config['load_tplcompile'], - 'autoescape' => false, - ) - ); - - $this->twig->addExtension( - new \phpbb\template\twig\extension( - $this->context, - $this->user - ) - ); - - $lexer = new \phpbb\template\twig\lexer($this->twig); - - $this->twig->setLexer($lexer); + foreach ($extensions as $extension) + { + $this->twig->addExtension($extension); + } // Add admin namespace if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')) @@ -142,9 +128,16 @@ class twig extends \phpbb\template\base * Get the style tree of the style preferred by the current user * * @return array Style tree, most specific first + * + * @throws \phpbb\template\exception\user_object_not_available When user service was not set */ public function get_user_style() { + if ($this->user === null) + { + throw new user_object_not_available(); + } + $style_list = array( $this->user->style['style_path'], ); @@ -174,6 +167,10 @@ class twig extends \phpbb\template\base } $names = $this->get_user_style(); + // Add 'all' folder to $names array + // It allows extensions to load a template file from 'all' folder, + // if a style doesn't include it. + $names[] = 'all'; $paths = array(); foreach ($style_directories as $directory) @@ -182,13 +179,24 @@ class twig extends \phpbb\template\base { $path = $this->phpbb_root_path . trim($directory, '/') . "/{$name}/"; $template_path = $path . 'template/'; + $theme_path = $path . 'theme/'; + $is_valid_dir = false; if (is_dir($template_path)) { + $is_valid_dir = true; + $paths[] = $template_path; + } + if (is_dir($theme_path)) + { + $is_valid_dir = true; + $paths[] = $theme_path; + } + + if ($is_valid_dir) + { // Add the base style directory as a safe directory $this->twig->getLoader()->addSafeDirectory($path); - - $paths[] = $template_path; } } } @@ -211,9 +219,13 @@ class twig extends \phpbb\template\base * * Note: Templates are still compiled to phpBB's cache directory. * - * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. - * @param string|array or string $paths Array of style paths, relative to current root directory - * @return phpbb_template $this + * @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions. + * E.g. array( + * 'name' => 'adm', + * 'ext_path' => 'adm/style/', + * ) + * @param string|array of string $paths Array of style paths, relative to current root directory + * @return \phpbb\template\template $this */ public function set_custom_style($names, $paths) { @@ -234,17 +246,46 @@ class twig extends \phpbb\template\base $namespace = str_replace('/', '_', $ext_namespace); $paths = array(); - foreach ($names as $style_name) + foreach ($names as $template_dir) { - $ext_style_path = $ext_path . 'styles/' . $style_name . '/'; - $ext_style_template_path = $ext_style_path . 'template/'; + if (is_array($template_dir)) + { + if (isset($template_dir['ext_path'])) + { + $ext_style_template_path = $ext_path . $template_dir['ext_path']; + $ext_style_path = dirname($ext_style_template_path); + $ext_style_theme_path = $ext_style_path . 'theme/'; + } + else + { + $ext_style_path = $ext_path . 'styles/' . $template_dir['name'] . '/'; + $ext_style_template_path = $ext_style_path . 'template/'; + $ext_style_theme_path = $ext_style_path . 'theme/'; + } + } + else + { + $ext_style_path = $ext_path . 'styles/' . $template_dir . '/'; + $ext_style_template_path = $ext_style_path . 'template/'; + $ext_style_theme_path = $ext_style_path . 'theme/'; + } + $is_valid_dir = false; if (is_dir($ext_style_template_path)) { + $is_valid_dir = true; + $paths[] = $ext_style_template_path; + } + if (is_dir($ext_style_theme_path)) + { + $is_valid_dir = true; + $paths[] = $ext_style_theme_path; + } + + if ($is_valid_dir) + { // Add the base style directory as a safe directory $this->twig->getLoader()->addSafeDirectory($ext_style_path); - - $paths[] = $ext_style_template_path; } } @@ -312,21 +353,29 @@ class twig extends \phpbb\template\base $context_vars['.'][0], // To get normal vars array( 'definition' => new \phpbb\template\twig\definition(), - 'user' => $this->user, 'loops' => $context_vars, // To get loops ) ); + if ($this->user instanceof \phpbb\user) + { + $vars['user'] = $this->user; + } + // cleanup unset($vars['loops']['.']); + // Inject in the main context the value added by assign_block_vars() to be able to use directly the Twig loops. + foreach ($vars['loops'] as $key => &$value) + { + $vars[$key] = $value; + } + return $vars; } /** - * Get path to template for handle (required for BBCode parser) - * - * @return string + * {@inheritdoc} */ public function get_source_file_for_handle($handle) { diff --git a/phpBB/phpbb/textformatter/cache_interface.php b/phpBB/phpbb/textformatter/cache_interface.php new file mode 100644 index 0000000000..f6b5f195c7 --- /dev/null +++ b/phpBB/phpbb/textformatter/cache_interface.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter; + +/** +* Currently only used to signal that something that could effect the rendering has changed. +* BBCodes, smilies, censored words, templates, etc... +*/ +interface cache_interface +{ + /** + * Invalidate and/or regenerate this text formatter's cache(s) + */ + public function invalidate(); + + /** + * Tidy/prune this text formatter's cache(s) + */ + public function tidy(); +} diff --git a/phpBB/phpbb/textformatter/data_access.php b/phpBB/phpbb/textformatter/data_access.php new file mode 100644 index 0000000000..2103bf8e60 --- /dev/null +++ b/phpBB/phpbb/textformatter/data_access.php @@ -0,0 +1,228 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter; + +/** +* Data access layer that fetchs BBCodes, smilies and censored words from the database. +* To be extended to include insert/update/delete operations. +* +* Also used to get templates. +*/ +class data_access +{ + /** + * @var string Name of the BBCodes table + */ + protected $bbcodes_table; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var string Name of the smilies table + */ + protected $smilies_table; + + /** + * @var string Name of the styles table + */ + protected $styles_table; + + /** + * @var string Path to the styles dir + */ + protected $styles_path; + + /** + * @var string Name of the words table + */ + protected $words_table; + + /** + * Constructor + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param string $bbcodes_table Name of the BBCodes table + * @param string $smilies_table Name of the smilies table + * @param string $styles_table Name of the styles table + * @param string $words_table Name of the words table + * @param string $styles_path Path to the styles dir + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $bbcodes_table, $smilies_table, $styles_table, $words_table, $styles_path) + { + $this->db = $db; + + $this->bbcodes_table = $bbcodes_table; + $this->smilies_table = $smilies_table; + $this->styles_table = $styles_table; + $this->words_table = $words_table; + + $this->styles_path = $styles_path; + } + + /** + * Return the list of custom BBCodes + * + * @return array + */ + public function get_bbcodes() + { + $sql = 'SELECT bbcode_match, bbcode_tpl FROM ' . $this->bbcodes_table; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + /** + * Return the list of smilies + * + * @return array + */ + public function get_smilies() + { + // NOTE: smilies that are displayed on the posting page are processed first because they're + // typically the most used smilies and it ends up producing a slightly more efficient + // renderer + $sql = 'SELECT code, emotion, smiley_url, smiley_width, smiley_height + FROM ' . $this->smilies_table . ' + ORDER BY display_on_posting DESC'; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + /** + * Return the list of installed styles + * + * @return array + */ + protected function get_styles() + { + $sql = 'SELECT style_id, style_path, style_parent_id, bbcode_bitfield FROM ' . $this->styles_table; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + /** + * Return the bbcode.html template for every installed style + * + * @return array 2D array. style_id as keys, each element is an array with a "template" element that contains the style's bbcode.html and a "bbcodes" element that contains the name of each BBCode that is to be stylised + */ + public function get_styles_templates() + { + $templates = array(); + + $bbcode_ids = array( + 'quote' => 0, + 'b' => 1, + 'i' => 2, + 'url' => 3, + 'img' => 4, + 'size' => 5, + 'color' => 6, + 'u' => 7, + 'code' => 8, + 'list' => 9, + '*' => 9, + 'email' => 10, + 'flash' => 11, + 'attachment' => 12, + ); + + $styles = array(); + foreach ($this->get_styles() as $row) + { + $styles[$row['style_id']] = $row; + } + + foreach ($styles as $style_id => $style) + { + $bbcodes = array(); + + // Collect the name of the BBCodes whose bit is set in the style's bbcode_bitfield + $template_bitfield = new \bitfield($style['bbcode_bitfield']); + foreach ($bbcode_ids as $bbcode_name => $bit) + { + if ($template_bitfield->get($bit)) + { + $bbcodes[] = $bbcode_name; + } + } + + $filename = $this->resolve_style_filename($styles, $style); + if ($filename === false) + { + // Ignore this style, it will use the default templates + continue; + } + + $templates[$style_id] = array( + 'bbcodes' => $bbcodes, + 'template' => file_get_contents($filename), + ); + } + + return $templates; + } + + /** + * Resolve inheritance for given style and return the path to their bbcode.html file + * + * @param array $styles Associative array of [style_id => style] containing all styles + * @param array $style Style for which we resolve + * @return string|bool Path to this style's bbcode.html, or FALSE + */ + protected function resolve_style_filename(array $styles, array $style) + { + // Look for a bbcode.html in this style's dir + $filename = $this->styles_path . $style['style_path'] . '/template/bbcode.html'; + if (file_exists($filename)) + { + return $filename; + } + + // Resolve using this style's parent + $parent_id = $style['style_parent_id']; + if ($parent_id && !empty($styles[$parent_id])) + { + return $this->resolve_style_filename($styles, $styles[$parent_id]); + } + + return false; + } + + /** + * Return the list of censored words + * + * @return array + */ + public function get_censored_words() + { + $sql = 'SELECT word, replacement FROM ' . $this->words_table; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } +} diff --git a/phpBB/phpbb/textformatter/parser_interface.php b/phpBB/phpbb/textformatter/parser_interface.php new file mode 100644 index 0000000000..ad611fb5b4 --- /dev/null +++ b/phpBB/phpbb/textformatter/parser_interface.php @@ -0,0 +1,112 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter; + +interface parser_interface +{ + /** + * Parse given text + * + * @param string $text + * @return string + */ + public function parse($text); + + /** + * Disable a specific BBCode + * + * @param string $name BBCode name + * @return null + */ + public function disable_bbcode($name); + + /** + * Disable BBCodes in general + */ + public function disable_bbcodes(); + + /** + * Disable the censor + */ + public function disable_censor(); + + /** + * Disable magic URLs + */ + public function disable_magic_url(); + + /** + * Disable smilies + */ + public function disable_smilies(); + + /** + * Enable a specific BBCode + * + * @param string $name BBCode name + * @return null + */ + public function enable_bbcode($name); + + /** + * Enable BBCodes in general + */ + public function enable_bbcodes(); + + /** + * Enable the censor + */ + public function enable_censor(); + + /** + * Enable magic URLs + */ + public function enable_magic_url(); + + /** + * Enable smilies + */ + public function enable_smilies(); + + /** + * Get the list of errors that were generated during last parsing + * + * @return array[] Array of arrays. Each array contains a lang string at index 0 plus any number + * of optional parameters + */ + public function get_errors(); + + /** + * Set a variable to be used by the parser + * + * - max_font_size + * - max_img_height + * - max_img_width + * - max_smilies + * - max_urls + * + * @param string $name + * @param mixed $value + * @return null + */ + public function set_var($name, $value); + + /** + * Set multiple variables to be used by the parser + * + * @param array $vars Associative array of [name => value] + * @return null + */ + public function set_vars(array $vars); +} diff --git a/phpBB/phpbb/textformatter/renderer_interface.php b/phpBB/phpbb/textformatter/renderer_interface.php new file mode 100644 index 0000000000..609b0bb642 --- /dev/null +++ b/phpBB/phpbb/textformatter/renderer_interface.php @@ -0,0 +1,92 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter; + +interface renderer_interface +{ + /** + * Render given text + * + * @param string $text Text, as parsed by something that implements \phpbb\textformatter\parser + * @return string + */ + public function render($text); + + /** + * Set the smilies' path + * + * @return null + */ + public function set_smilies_path($path); + + /** + * Return the value of the "viewcensors" option + * + * @return bool Option's value + */ + public function get_viewcensors(); + + /** + * Return the value of the "viewflash" option + * + * @return bool Option's value + */ + public function get_viewflash(); + + /** + * Return the value of the "viewimg" option + * + * @return bool Option's value + */ + public function get_viewimg(); + + /** + * Return the value of the "viewsmilies" option + * + * @return bool Option's value + */ + public function get_viewsmilies(); + + /** + * Set the "viewcensors" option + * + * @param bool $value Option's value + * @return null + */ + public function set_viewcensors($value); + + /** + * Set the "viewflash" option + * + * @param bool $value Option's value + * @return null + */ + public function set_viewflash($value); + + /** + * Set the "viewimg" option + * + * @param bool $value Option's value + * @return null + */ + public function set_viewimg($value); + + /** + * Set the "viewsmilies" option + * + * @param bool $value Option's value + * @return null + */ + public function set_viewsmilies($value); +} diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php new file mode 100644 index 0000000000..8c273c342e --- /dev/null +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -0,0 +1,617 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use s9e\TextFormatter\Configurator; +use s9e\TextFormatter\Configurator\Items\AttributeFilters\RegexpFilter; +use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; + +/** +* Creates s9e\TextFormatter objects +*/ +class factory implements \phpbb\textformatter\cache_interface +{ + /** + * @var \phpbb\textformatter\s9e\link_helper + */ + protected $link_helper; + + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var string Path to the cache dir + */ + protected $cache_dir; + + /** + * @var string Cache key used for the parser + */ + protected $cache_key_parser; + + /** + * @var string Cache key used for the renderer + */ + protected $cache_key_renderer; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var array Custom tokens used in bbcode.html and their corresponding token from the definition + */ + protected $custom_tokens = array( + 'email' => array('{DESCRIPTION}' => '{TEXT}'), + 'flash' => array('{WIDTH}' => '{NUMBER1}', '{HEIGHT}' => '{NUMBER2}'), + 'img' => array('{URL}' => '{IMAGEURL}'), + 'list' => array('{LIST_TYPE}' => '{HASHMAP}'), + 'quote' => array('{USERNAME}' => '{TEXT1}'), + 'size' => array('{SIZE}' => '{FONTSIZE}'), + 'url' => array('{DESCRIPTION}' => '{TEXT}'), + ); + + /** + * @var \phpbb\textformatter\data_access + */ + protected $data_access; + + /** + * @var array Default BBCode definitions + */ + protected $default_definitions = array( + 'attachment' => '[ATTACHMENT index={NUMBER} filename={TEXT;useContent}]', + 'b' => '[B]{TEXT}[/B]', + 'code' => '[CODE lang={IDENTIFIER;optional}]{TEXT}[/CODE]', + 'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]', + 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT;optional;postFilter=rawurlencode} body={TEXT;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', + 'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]', + 'i' => '[I]{TEXT}[/I]', + 'img' => '[IMG src={IMAGEURL;useContent}]', + 'list' => '[LIST type={HASHMAP=1:decimal,a:lower-alpha,A:upper-alpha,i:lower-roman,I:upper-roman;optional;postFilter=#simpletext}]{TEXT}[/LIST]', + 'li' => '[* $tagName=LI]{TEXT}[/*]', + 'quote' => + "[QUOTE + author={TEXT1;optional} + post_id={UINT;optional} + post_url={URL;optional;postFilter=#false} + profile_url={URL;optional;postFilter=#false} + time={UINT;optional} + url={URL;optional} + user_id={UINT;optional} + author={PARSE=/^\\[url=(?'url'.*?)](?'author'.*)\\[\\/url]$/i} + author={PARSE=/^\\[url](?'author'(?'url'.*?))\\[\\/url]$/i} + author={PARSE=/(?'url'https?:\\/\\/[^[\\]]+)/i} + ]{TEXT2}[/QUOTE]", + 'size' => '[SIZE={FONTSIZE}]{TEXT}[/SIZE]', + 'u' => '[U]{TEXT}[/U]', + 'url' => '[URL={URL;useContent} $forceLookahead=true]{TEXT}[/URL]', + ); + + /** + * @var array Default templates, taken from bbcode::bbcode_tpl() + */ + protected $default_templates = array( + 'b' => '<span style="font-weight: bold"><xsl:apply-templates/></span>', + 'i' => '<span style="font-style: italic"><xsl:apply-templates/></span>', + 'u' => '<span style="text-decoration: underline"><xsl:apply-templates/></span>', + 'img' => '<img src="{IMAGEURL}" class="postimage" alt="{L_IMAGE}"/>', + 'size' => '<span style="font-size: {FONTSIZE}%; line-height: normal"><xsl:apply-templates/></span>', + 'color' => '<span style="color: {COLOR}"><xsl:apply-templates/></span>', + 'email' => '<a> + <xsl:attribute name="href"> + <xsl:text>mailto:</xsl:text> + <xsl:value-of select="@email"/> + <xsl:if test="@subject or @body"> + <xsl:text>?</xsl:text> + <xsl:if test="@subject">subject=<xsl:value-of select="@subject"/></xsl:if> + <xsl:if test="@body"><xsl:if test="@subject">&</xsl:if>body=<xsl:value-of select="@body"/></xsl:if> + </xsl:if> + </xsl:attribute> + <xsl:apply-templates/> + </a>', + ); + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * Constructor + * + * @param \phpbb\textformatter\data_access $data_access + * @param \phpbb\cache\driver\driver_interface $cache + * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\config\config $config + * @param \phpbb\textformatter\s9e\link_helper $link_helper + * @param string $cache_dir Path to the cache dir + * @param string $cache_key_parser Cache key used for the parser + * @param string $cache_key_renderer Cache key used for the renderer + */ + public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer) + { + $this->link_helper = $link_helper; + $this->cache = $cache; + $this->cache_dir = $cache_dir; + $this->cache_key_parser = $cache_key_parser; + $this->cache_key_renderer = $cache_key_renderer; + $this->config = $config; + $this->data_access = $data_access; + $this->dispatcher = $dispatcher; + } + + /** + * {@inheritdoc} + */ + public function invalidate() + { + $this->regenerate(); + } + + /** + * {@inheritdoc} + * + * Will remove old renderers from the cache dir but won't touch the current renderer + */ + public function tidy() + { + // Get the name of current renderer + $renderer_data = $this->cache->get($this->cache_key_renderer); + $renderer_file = ($renderer_data) ? $renderer_data['class'] . '.php' : null; + + foreach (glob($this->cache_dir . 's9e_*') as $filename) + { + // Only remove the file if it's not the current renderer + if (!$renderer_file || substr($filename, -strlen($renderer_file)) !== $renderer_file) + { + unlink($filename); + } + } + } + + /** + * Generate and return a new configured instance of s9e\TextFormatter\Configurator + * + * @return Configurator + */ + public function get_configurator() + { + // Create a new Configurator + $configurator = new Configurator; + + /** + * Modify the s9e\TextFormatter configurator before the default settings are set + * + * @event core.text_formatter_s9e_configure_before + * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @since 3.2.0-a1 + */ + $vars = array('configurator'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_before', compact($vars))); + + // Reset the list of allowed schemes + foreach ($configurator->urlConfig->getAllowedSchemes() as $scheme) + { + $configurator->urlConfig->disallowScheme($scheme); + } + foreach (explode(',', $this->config['allowed_schemes_links']) as $scheme) + { + $configurator->urlConfig->allowScheme(trim($scheme)); + } + + // Convert newlines to br elements by default + $configurator->rootRules->enableAutoLineBreaks(); + + // Don't automatically ignore text in places where text is not allowed + $configurator->rulesGenerator->remove('IgnoreTextIfDisallowed'); + + // Don't remove comments and instead convert them to xsl:comment elements + $configurator->templateNormalizer->remove('RemoveComments'); + $configurator->templateNormalizer->add('TransposeComments'); + + // Set the rendering engine and configure it to save to the cache dir + $configurator->rendering->engine = 'PHP'; + $configurator->rendering->engine->cacheDir = $this->cache_dir; + $configurator->rendering->engine->defaultClassPrefix = 's9e_renderer_'; + $configurator->rendering->engine->enableQuickRenderer = true; + + // Create custom filters for BBCode tokens that are supported in phpBB but not in + // s9e\TextFormatter + $filter = new RegexpFilter('#^' . get_preg_expression('relative_url') . '$#Du'); + $configurator->attributeFilters->add('#local_url', $filter); + $configurator->attributeFilters->add('#relative_url', $filter); + + // INTTEXT regexp from acp_bbcodes + $filter = new RegexpFilter('!^([\p{L}\p{N}\-+,_. ]+)$!Du'); + $configurator->attributeFilters->add('#inttext', $filter); + + // Create custom filters for Flash restrictions, which use the same values as the image + // restrictions but have their own error message + $configurator->attributeFilters + ->add('#flashheight', __NAMESPACE__ . '\\parser::filter_flash_height') + ->addParameterByName('max_img_height') + ->addParameterByName('logger'); + + $configurator->attributeFilters + ->add('#flashwidth', __NAMESPACE__ . '\\parser::filter_flash_width') + ->addParameterByName('max_img_width') + ->addParameterByName('logger'); + + // Create a custom filter for phpBB's per-mode font size limits + $configurator->attributeFilters + ->add('#fontsize', __NAMESPACE__ . '\\parser::filter_font_size') + ->addParameterByName('max_font_size') + ->addParameterByName('logger') + ->markAsSafeInCSS(); + + // Create a custom filter for image URLs + $configurator->attributeFilters + ->add('#imageurl', __NAMESPACE__ . '\\parser::filter_img_url') + ->addParameterByName('urlConfig') + ->addParameterByName('logger') + ->addParameterByName('max_img_height') + ->addParameterByName('max_img_width') + ->markAsSafeAsURL(); + + // Add default BBCodes + foreach ($this->get_default_bbcodes($configurator) as $bbcode) + { + $configurator->BBCodes->addCustom($bbcode['usage'], $bbcode['template']); + } + + // Modify the template to disable images/flash depending on user's settings + foreach (array('FLASH', 'IMG') as $name) + { + $tag = $configurator->tags[$name]; + $tag->template = '<xsl:choose><xsl:when test="$S_VIEW' . $name . '">' . $tag->template . '</xsl:when><xsl:otherwise><xsl:apply-templates/></xsl:otherwise></xsl:choose>'; + } + + // Load custom BBCodes + foreach ($this->data_access->get_bbcodes() as $row) + { + // Insert the board's URL before {LOCAL_URL} tokens + $tpl = preg_replace_callback( + '#\\{LOCAL_URL\\d*\\}#', + function ($m) + { + return generate_board_url() . '/' . $m[0]; + }, + $row['bbcode_tpl'] + ); + + try + { + $configurator->BBCodes->addCustom($row['bbcode_match'], new UnsafeTemplate($tpl)); + } + catch (\Exception $e) + { + /** + * @todo log an error? + */ + } + } + + // Load smilies + foreach ($this->data_access->get_smilies() as $row) + { + $configurator->Emoticons->add( + $row['code'], + '<img class="smilies" src="{$T_SMILIES_PATH}/' . htmlspecialchars($row['smiley_url']) . '" alt="{.}" title="' . htmlspecialchars($row['emotion']) . '"/>' + ); + } + + if (isset($configurator->Emoticons)) + { + // Force emoticons to be rendered as text if $S_VIEWSMILIES is not set + $configurator->Emoticons->notIfCondition = 'not($S_VIEWSMILIES)'; + + // Only parse emoticons at the beginning of the text or if they're preceded by any + // one of: a new line, a space, a dot, or a right square bracket + $configurator->Emoticons->notAfter = '[^\\n .\\]]'; + } + + // Load the censored words + $censor = $this->data_access->get_censored_words(); + if (!empty($censor)) + { + // Use a namespaced tag to avoid collisions + $configurator->plugins->load('Censor', array('tagName' => 'censor:tag')); + foreach ($censor as $row) + { + // NOTE: words are stored as HTML, we need to decode them to plain text + $configurator->Censor->add(htmlspecialchars_decode($row['word']), htmlspecialchars_decode($row['replacement'])); + } + } + + // Load the magic links plugins. We do that after BBCodes so that they use the same tags + $this->configure_autolink($configurator); + + // Register some vars with a default value. Those should be set at runtime by whatever calls + // the parser + $configurator->registeredVars['max_font_size'] = 0; + $configurator->registeredVars['max_img_height'] = 0; + $configurator->registeredVars['max_img_width'] = 0; + + // Load the Emoji plugin and modify its tag's template to obey viewsmilies + $configurator->Emoji->setImageSize(18); + $tag = $configurator->Emoji->getTag(); + $tag->template = '<xsl:choose><xsl:when test="$S_VIEWSMILIES">' . str_replace('class="emoji"', 'class="smilies"', $tag->template) . '</xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose>'; + + /** + * Modify the s9e\TextFormatter configurator after the default settings are set + * + * @event core.text_formatter_s9e_configure_after + * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @since 3.2.0-a1 + */ + $vars = array('configurator'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_after', compact($vars))); + + return $configurator; + } + + /** + * Regenerate and cache a new parser and renderer + * + * @return array Associative array with at least two elements: "parser" and "renderer" + */ + public function regenerate() + { + $configurator = $this->get_configurator(); + + // Get the censor helper and remove the Censor plugin if applicable + if (isset($configurator->Censor)) + { + $censor = $configurator->Censor->getHelper(); + unset($configurator->Censor); + unset($configurator->tags['censor:tag']); + } + + $objects = $configurator->finalize(); + $parser = $objects['parser']; + $renderer = $objects['renderer']; + + // Cache the parser as-is + $this->cache->put($this->cache_key_parser, $parser); + + // We need to cache the name of the renderer's generated class + $renderer_data = array('class' => get_class($renderer)); + if (isset($censor)) + { + $renderer_data['censor'] = $censor; + } + $this->cache->put($this->cache_key_renderer, $renderer_data); + + return array('parser' => $parser, 'renderer' => $renderer); + } + + /** + * Configure the Autolink / Autoemail plugins used to linkify text + * + * @param \s9e\TextFormatter\Configurator $configurator + * @return void + */ + protected function configure_autolink(Configurator $configurator) + { + $configurator->plugins->load('Autoemail'); + $configurator->plugins->load('Autolink', array('matchWww' => true)); + + // Add a tag filter that creates a tag that stores and replace the + // content of a link created by the Autolink plugin + $configurator->Autolink->getTag()->filterChain + ->add(array($this->link_helper, 'generate_link_text_tag')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByName('parser'); + + // Create a tag that will be used to display the truncated text by + // replacing the original content with the content of the @text attribute + $tag = $configurator->tags->add('LINK_TEXT'); + $tag->attributes->add('text'); + $tag->template = '<xsl:value-of select="@text"/>'; + + $tag->filterChain + ->add(array($this->link_helper, 'truncate_local_url')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByValue(generate_board_url() . '/'); + $tag->filterChain + ->add(array($this->link_helper, 'truncate_text')) + ->resetParameters() + ->addParameterByName('tag'); + $tag->filterChain + ->add(array($this->link_helper, 'cleanup_tag')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByName('parser'); + } + + /** + * Return the default BBCodes configuration + * + * @return array 2D array. Each element has a 'usage' key, a 'template' key, and an optional 'options' key + */ + protected function get_default_bbcodes($configurator) + { + // For each BBCode, build an associative array matching style_ids to their template + $templates = array(); + foreach ($this->data_access->get_styles_templates() as $style_id => $data) + { + foreach ($this->extract_templates($data['template']) as $bbcode_name => $template) + { + $templates[$bbcode_name][$style_id] = $template; + } + + // Add default templates wherever missing, or for BBCodes that were not specified in + // this template's bitfield. For instance, prosilver has a custom template for b but its + // bitfield does not enable it so the default template is used instead + foreach ($this->default_templates as $bbcode_name => $template) + { + if (!isset($templates[$bbcode_name][$style_id]) || !in_array($bbcode_name, $data['bbcodes'], true)) + { + $templates[$bbcode_name][$style_id] = $template; + } + } + } + + // Replace custom tokens and normalize templates + foreach ($templates as $bbcode_name => $style_templates) + { + foreach ($style_templates as $i => $template) + { + if (isset($this->custom_tokens[$bbcode_name])) + { + $template = strtr($template, $this->custom_tokens[$bbcode_name]); + } + + $templates[$bbcode_name][$i] = $configurator->templateNormalizer->normalizeTemplate($template); + } + } + + $bbcodes = array(); + foreach ($this->default_definitions as $bbcode_name => $usage) + { + $bbcodes[$bbcode_name] = array( + 'usage' => $usage, + 'template' => $this->merge_templates($templates[$bbcode_name]), + ); + } + + return $bbcodes; + } + + /** + * Extract and recompose individual BBCode templates from a style's template file + * + * @param string $template Style template (bbcode.html) + * @return array Associative array matching BBCode names to their template + */ + protected function extract_templates($template) + { + // Capture the template fragments + preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END .*? -->#s', $template, $matches, PREG_SET_ORDER); + + $fragments = array(); + foreach ($matches as $match) + { + // Normalize the whitespace + $fragment = preg_replace('#>\\n\\t*<#', '><', trim($match[2])); + + $fragments[$match[1]] = $fragment; + } + + // Automatically recompose templates split between *_open and *_close + foreach ($fragments as $fragment_name => $fragment) + { + if (preg_match('#^(\\w+)_close$#', $fragment_name, $match)) + { + $bbcode_name = $match[1]; + + if (isset($fragments[$bbcode_name . '_open'])) + { + $templates[$bbcode_name] = $fragments[$bbcode_name . '_open'] . '<xsl:apply-templates/>' . $fragment; + } + } + } + + // Manually recompose and overwrite irregular templates + $templates['list'] = + '<xsl:choose> + <xsl:when test="not(@type)"> + ' . $fragments['ulist_open_default'] . '<xsl:apply-templates/>' . $fragments['ulist_close'] . ' + </xsl:when> + <xsl:when test="contains(\'upperlowerdecim\',substring(@type,1,5))"> + ' . $fragments['olist_open'] . '<xsl:apply-templates/>' . $fragments['olist_close'] . ' + </xsl:when> + <xsl:otherwise> + ' . $fragments['ulist_open'] . '<xsl:apply-templates/>' . $fragments['ulist_close'] . ' + </xsl:otherwise> + </xsl:choose>'; + + $templates['li'] = $fragments['listitem'] . '<xsl:apply-templates/>' . $fragments['listitem_close']; + + // Replace the regular quote template with the extended quote template if available + if (isset($fragments['quote_extended'])) + { + $templates['quote'] = $fragments['quote_extended']; + } + + // The [attachment] BBCode uses the inline_attachment template to output a comment that + // is post-processed by parse_attachments() + $templates['attachment'] = $fragments['inline_attachment_open'] . '<xsl:comment> ia<xsl:value-of select="@index"/> </xsl:comment><xsl:value-of select="@filename"/><xsl:comment> ia<xsl:value-of select="@index"/> </xsl:comment>' . $fragments['inline_attachment_close']; + + // Add fragments as templates + foreach ($fragments as $fragment_name => $fragment) + { + if (preg_match('#^\\w+$#', $fragment_name)) + { + $templates[$fragment_name] = $fragment; + } + } + + // Keep only templates that are named after an existing BBCode + $templates = array_intersect_key($templates, $this->default_definitions); + + return $templates; + } + + /** + * Merge the templates from any number of styles into one BBCode template + * + * When multiple templates are available for the same BBCode (because of multiple styles) we + * merge them into a single template that uses an xsl:choose construct that determines which + * style to use at rendering time. + * + * @param array $style_templates Associative array matching style_ids to their template + * @return string + */ + protected function merge_templates(array $style_templates) + { + // Return the template as-is if there's only one style or all styles share the same template + if (count(array_unique($style_templates)) === 1) + { + return end($style_templates); + } + + // Group identical templates together + $grouped_templates = array(); + foreach ($style_templates as $style_id => $style_template) + { + $grouped_templates[$style_template][] = '$STYLE_ID=' . $style_id; + } + + // Sort templates by frequency descending + $templates_cnt = array_map('sizeof', $grouped_templates); + array_multisort($grouped_templates, $templates_cnt); + + // Remove the most frequent template from the list; It becomes the default + reset($grouped_templates); + $default_template = key($grouped_templates); + unset($grouped_templates[$default_template]); + + // Build an xsl:choose switch + $template = '<xsl:choose>'; + foreach ($grouped_templates as $style_template => $exprs) + { + $template .= '<xsl:when test="' . implode(' or ', $exprs) . '">' . $style_template . '</xsl:when>'; + } + $template .= '<xsl:otherwise>' . $default_template . '</xsl:otherwise></xsl:choose>'; + + return $template; + } +} diff --git a/phpBB/phpbb/textformatter/s9e/link_helper.php b/phpBB/phpbb/textformatter/s9e/link_helper.php new file mode 100644 index 0000000000..0f44603dec --- /dev/null +++ b/phpBB/phpbb/textformatter/s9e/link_helper.php @@ -0,0 +1,118 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +class link_helper +{ + /** + * Clean up and invalidate a LINK_TEXT tag if applicable + * + * Will invalidate the tag if its replacement text is the same as the original + * text and would have no visible effect + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @param \s9e\TextFormatter\Parser $parser Parser + * @return bool Whether the tag is valid + */ + public function cleanup_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser) + { + // Invalidate if the content of the tag matches the text attribute + $text = substr($parser->getText(), $tag->getPos(), $tag->getLen()); + + return ($text !== $tag->getAttribute('text')); + } + + /** + * Create a LINK_TEXT tag inside of a link + * + * Meant to only apply to linkified URLs and [url] BBCodes without a parameter + * + * @param \s9e\TextFormatter\Parser\Tag $tag URL tag (start tag) + * @param \s9e\TextFormatter\Parser $parser Parser + * @return bool Always true to indicate that the tag is valid + */ + public function generate_link_text_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser) + { + // Only create a LINK_TEXT tag if the start tag is paired with an end + // tag, which is the case with tags from the Autolink plugins and with + // the [url] BBCode when its content is used for the URL + if (!$tag->getEndTag() || !$this->should_shorten($tag, $parser->getText())) + { + return true; + } + + // Capture the text between the start tag and its end tag + $start = $tag->getPos() + $tag->getLen(); + $end = $tag->getEndTag()->getPos(); + $length = $end - $start; + $text = substr($parser->getText(), $start, $length); + + // Create a tag that consumes the link's text + $parser->addSelfClosingTag('LINK_TEXT', $start, $length)->setAttribute('text', $text); + + return true; + } + + /** + * Test whether we should shorten this tag's text + * + * Will test whether the tag either does not use any markup or uses a single + * [url] BBCode + * + * @param \s9e\TextFormatter\Parser\Tag $tag URL tag + * @param string $text Original text + * @return bool + */ + protected function should_shorten(\s9e\TextFormatter\Parser\Tag $tag, $text) + { + return ($tag->getLen() === 0 || strtolower(substr($text, $tag->getPos(), $tag->getLen())) === '[url]'); + } + + /** + * Remove the board's root URL from a the start of a string + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @param string $board_url Forum's root URL (with trailing slash) + * @return bool Always true to indicate that the tag is valid + */ + public function truncate_local_url(\s9e\TextFormatter\Parser\Tag $tag, $board_url) + { + $text = $tag->getAttribute('text'); + if (stripos($text, $board_url) === 0 && strlen($text) > strlen($board_url)) + { + $tag->setAttribute('text', substr($text, strlen($board_url))); + } + + return true; + } + + /** + * Truncate the replacement text set in a LINK_TEXT tag + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @return bool Always true to indicate that the tag is valid + */ + public function truncate_text(\s9e\TextFormatter\Parser\Tag $tag) + { + $text = $tag->getAttribute('text'); + if (utf8_strlen($text) > 55) + { + $text = utf8_substr($text, 0, 39) . ' ... ' . utf8_substr($text, -10); + } + + $tag->setAttribute('text', $text); + + return true; + } +} diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php new file mode 100644 index 0000000000..e2653d60f0 --- /dev/null +++ b/phpBB/phpbb/textformatter/s9e/parser.php @@ -0,0 +1,397 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use s9e\TextFormatter\Parser\BuiltInFilters; +use s9e\TextFormatter\Parser\Logger; + +/** +* s9e\TextFormatter\Parser adapter +*/ +class parser implements \phpbb\textformatter\parser_interface +{ + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \s9e\TextFormatter\Parser + */ + protected $parser; + + /** + * Constructor + * + * @param \phpbb\cache\driver_interface $cache + * @param string $key Cache key + * @param factory $factory + * @param \phpbb\event\dispatcher_interface $dispatcher + */ + public function __construct(\phpbb\cache\driver\driver_interface $cache, $key, factory $factory, \phpbb\event\dispatcher_interface $dispatcher) + { + $parser = $cache->get($key); + if (!$parser) + { + $objects = $factory->regenerate(); + $parser = $objects['parser']; + } + + $this->dispatcher = $dispatcher; + $this->parser = $parser; + + $parser = $this; + + /** + * Configure the parser service + * + * Can be used to: + * - toggle features or BBCodes + * - register variables or custom parsers in the s9e\TextFormatter parser + * - configure the s9e\TextFormatter parser's runtime settings + * + * @event core.text_formatter_s9e_parser_setup + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @since 3.2.0-a1 + */ + $vars = array('parser'); + extract($dispatcher->trigger_event('core.text_formatter_s9e_parser_setup', compact($vars))); + } + + /** + * {@inheritdoc} + */ + public function parse($text) + { + $parser = $this; + + /** + * Modify a text before it is parsed + * + * @event core.text_formatter_s9e_parse_before + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @var string text The original text + * @since 3.2.0-a1 + */ + $vars = array('parser', 'text'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_before', compact($vars))); + + $xml = $this->parser->parse($text); + + /** + * Modify a parsed text in its XML form + * + * @event core.text_formatter_s9e_parse_after + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @var string xml The parsed text, in XML + * @since 3.2.0-a1 + */ + $vars = array('parser', 'xml'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_after', compact($vars))); + + return $xml; + } + + /** + * {@inheritdoc} + */ + public function disable_bbcode($name) + { + $this->parser->disableTag(strtoupper($name)); + } + + /** + * {@inheritdoc} + */ + public function disable_bbcodes() + { + $this->parser->disablePlugin('BBCodes'); + } + + /** + * {@inheritdoc} + */ + public function disable_censor() + { + $this->parser->disablePlugin('Censor'); + } + + /** + * {@inheritdoc} + */ + public function disable_magic_url() + { + $this->parser->disablePlugin('Autoemail'); + $this->parser->disablePlugin('Autolink'); + } + + /** + * {@inheritdoc} + */ + public function disable_smilies() + { + $this->parser->disablePlugin('Emoticons'); + } + + /** + * {@inheritdoc} + */ + public function enable_bbcode($name) + { + $this->parser->enableTag(strtoupper($name)); + } + + /** + * {@inheritdoc} + */ + public function enable_bbcodes() + { + $this->parser->enablePlugin('BBCodes'); + } + + /** + * {@inheritdoc} + */ + public function enable_censor() + { + $this->parser->enablePlugin('Censor'); + } + + /** + * {@inheritdoc} + */ + public function enable_magic_url() + { + $this->parser->enablePlugin('Autoemail'); + $this->parser->enablePlugin('Autolink'); + } + + /** + * {@inheritdoc} + */ + public function enable_smilies() + { + $this->parser->enablePlugin('Emoticons'); + } + + /** + * {@inheritdoc} + * + * This will convert the log entries found in s9e\TextFormatter's logger into phpBB error + * messages + */ + public function get_errors() + { + $errors = array(); + foreach ($this->parser->getLogger()->get() as $entry) + { + list(, $msg, $context) = $entry; + + if ($msg === 'Tag limit exceeded') + { + if ($context['tagName'] === 'E') + { + $errors[] = array('TOO_MANY_SMILIES', $context['tagLimit']); + } + else if ($context['tagName'] === 'URL') + { + $errors[] = array('TOO_MANY_URLS', $context['tagLimit']); + } + } + else if ($msg === 'MAX_FONT_SIZE_EXCEEDED') + { + $errors[] = array($msg, $context['max_size']); + } + else if (preg_match('/^MAX_(?:FLASH|IMG)_(HEIGHT|WIDTH)_EXCEEDED$/D', $msg, $m)) + { + $errors[] = array($msg, $context['max_' . strtolower($m[1])]); + } + else if ($msg === 'Tag is disabled') + { + $name = strtolower($context['tag']->getName()); + $errors[] = array('UNAUTHORISED_BBCODE', '[' . $name . ']'); + } + else if ($msg === 'UNABLE_GET_IMAGE_SIZE') + { + $errors[] = array($msg); + } + } + + // Deduplicate error messages. array_unique() only works on strings so we have to serialize + if (!empty($errors)) + { + $errors = array_map('unserialize', array_unique(array_map('serialize', $errors))); + } + + return $errors; + } + + /** + * Return the instance of s9e\TextFormatter\Parser used by this object + * + * @return \s9e\TextFormatter\Parser + */ + public function get_parser() + { + return $this->parser; + } + + /** + * {@inheritdoc} + */ + public function set_var($name, $value) + { + if ($name === 'max_smilies') + { + $this->parser->setTagLimit('E', $value ?: PHP_INT_MAX); + } + else if ($name === 'max_urls') + { + $this->parser->setTagLimit('URL', $value ?: PHP_INT_MAX); + } + else + { + $this->parser->registeredVars[$name] = $value; + } + } + + /** + * {@inheritdoc} + */ + public function set_vars(array $vars) + { + foreach ($vars as $name => $value) + { + $this->set_var($name, $value); + } + } + + /** + * Filter a flash object's height + * + * @see bbcode_firstpass::bbcode_flash() + * + * @param string $height + * @param integer $max_height + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_flash_height($height, $max_height, Logger $logger) + { + if ($max_height && $height > $max_height) + { + $logger->err('MAX_FLASH_HEIGHT_EXCEEDED', array('max_height' => $max_height)); + + return false; + } + + return $height; + } + + /** + * Filter a flash object's width + * + * @see bbcode_firstpass::bbcode_flash() + * + * @param string $width + * @param integer $max_width + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_flash_width($width, $max_width, Logger $logger) + { + if ($max_width && $width > $max_width) + { + $logger->err('MAX_FLASH_WIDTH_EXCEEDED', array('max_width' => $max_width)); + + return false; + } + + return $width; + } + + /** + * Filter the value used in a [size] BBCode + * + * @see bbcode_firstpass::bbcode_size() + * + * @param string $size Original size + * @param integer $max_size Maximum allowed size + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_font_size($size, $max_size, Logger $logger) + { + if ($max_size && $size > $max_size) + { + $logger->err('MAX_FONT_SIZE_EXCEEDED', array('max_size' => $max_size)); + + return false; + } + + if ($size < 1) + { + return false; + } + + return $size; + } + + /** + * Filter an image's URL to enforce restrictions on its dimensions + * + * @see bbcode_firstpass::bbcode_img() + * + * @param string $url Original URL + * @param array $url_config Config used by the URL filter + * @param Logger $logger + * @param integer $max_height Maximum height allowed + * @param integer $max_width Maximum width allowed + * @return string|bool Original value if valid, FALSE otherwise + */ + static public function filter_img_url($url, array $url_config, Logger $logger, $max_height, $max_width) + { + // Validate the URL + $url = BuiltInFilters::filterUrl($url, $url_config, $logger); + if ($url === false) + { + return false; + } + + if ($max_height || $max_width) + { + $imagesize = new \FastImageSize\FastImageSize(); + $size_info = $imagesize->getImageSize($url); + if ($size_info === false) + { + $logger->err('UNABLE_GET_IMAGE_SIZE'); + return false; + } + + if ($max_height && $max_height < $size_info['height']) + { + $logger->err('MAX_IMG_HEIGHT_EXCEEDED', array('max_height' => $max_height)); + return false; + } + + if ($max_width && $max_width < $size_info['width']) + { + $logger->err('MAX_IMG_WIDTH_EXCEEDED', array('max_width' => $max_width)); + return false; + } + } + + return $url; + } +} diff --git a/phpBB/phpbb/textformatter/s9e/quote_helper.php b/phpBB/phpbb/textformatter/s9e/quote_helper.php new file mode 100644 index 0000000000..24109ac8cc --- /dev/null +++ b/phpBB/phpbb/textformatter/s9e/quote_helper.php @@ -0,0 +1,81 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +class quote_helper +{ + /** + * @var string Base URL for a post link, uses {POST_ID} as placeholder + */ + protected $post_url; + + /** + * @var string Base URL for a profile link, uses {USER_ID} as placeholder + */ + protected $profile_url; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\user $user + * @param string $root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user $user, $root_path, $php_ext) + { + $this->post_url = append_sid($root_path . 'viewtopic.' . $php_ext, 'p={POST_ID}#p{POST_ID}'); + $this->profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=viewprofile&u={USER_ID}'); + $this->user = $user; + } + + /** + * Inject dynamic metadata into QUOTE tags in given XML + * + * @param string $xml Original XML + * @return string Modified XML + */ + public function inject_metadata($xml) + { + $post_url = $this->post_url; + $profile_url = $this->profile_url; + $user = $this->user; + + return \s9e\TextFormatter\Utils::replaceAttributes( + $xml, + 'QUOTE', + function ($attributes) use ($post_url, $profile_url, $user) + { + if (isset($attributes['post_id'])) + { + $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $post_url); + } + if (isset($attributes['time'])) + { + $attributes['date'] = $user->format_date($attributes['time']); + } + if (isset($attributes['user_id'])) + { + $attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $profile_url); + } + + return $attributes; + } + ); + } +} diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php new file mode 100644 index 0000000000..9be20b7f53 --- /dev/null +++ b/phpBB/phpbb/textformatter/s9e/renderer.php @@ -0,0 +1,315 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +/** +* s9e\TextFormatter\Renderer adapter +*/ +class renderer implements \phpbb\textformatter\renderer_interface +{ + /** + * @var \s9e\TextFormatter\Plugins\Censor\Helper + */ + protected $censor; + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var quote_helper + */ + protected $quote_helper; + + /** + * @var \s9e\TextFormatter\Renderer + */ + protected $renderer; + + /** + * @var bool Status of the viewcensors option + */ + protected $viewcensors = false; + + /** + * @var bool Status of the viewflash option + */ + protected $viewflash = false; + + /** + * @var bool Status of the viewimg option + */ + protected $viewimg = false; + + /** + * @var bool Status of the viewsmilies option + */ + protected $viewsmilies = false; + + /** + * Constructor + * + * @param \phpbb\cache\driver\driver_interface $cache + * @param string $cache_dir Path to the cache dir + * @param string $key Cache key + * @param factory $factory + * @param \phpbb\event\dispatcher_interface $dispatcher + */ + public function __construct(\phpbb\cache\driver\driver_interface $cache, $cache_dir, $key, factory $factory, \phpbb\event\dispatcher_interface $dispatcher) + { + $renderer_data = $cache->get($key); + if ($renderer_data) + { + $class = $renderer_data['class']; + if (!class_exists($class, false)) + { + // Try to load the renderer class from its cache file + $cache_file = $cache_dir . $class . '.php'; + + if (file_exists($cache_file)) + { + include($cache_file); + } + } + if (class_exists($class, false)) + { + $renderer = new $class; + } + if (isset($renderer_data['censor'])) + { + $censor = $renderer_data['censor']; + } + } + if (!isset($renderer)) + { + $objects = $factory->regenerate(); + $renderer = $objects['renderer']; + } + + if (isset($censor)) + { + $this->censor = $censor; + } + $this->dispatcher = $dispatcher; + $this->renderer = $renderer; + $renderer = $this; + + /** + * Configure the renderer service + * + * @event core.text_formatter_s9e_renderer_setup + * @var \phpbb\textformatter\s9e\renderer renderer This renderer service + * @since 3.2.0-a1 + */ + $vars = array('renderer'); + extract($dispatcher->trigger_event('core.text_formatter_s9e_renderer_setup', compact($vars))); + } + + /** + * Configure the quote_helper object used to display extended information in quotes + * + * @param quote_helper $quote_helper + */ + public function configure_quote_helper(quote_helper $quote_helper) + { + $this->quote_helper = $quote_helper; + } + + /** + * Automatically set the smilies path based on config + * + * @param \phpbb\config\config $config + * @param \phpbb\path_helper $path_helper + * @return null + */ + public function configure_smilies_path(\phpbb\config\config $config, \phpbb\path_helper $path_helper) + { + /** + * @see smiley_text() + */ + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $path_helper->get_web_root_path(); + + $this->set_smilies_path($root_path . $config['smilies_path']); + } + + /** + * Configure this renderer as per the user's settings + * + * Should set the locale as well as the viewcensor/viewflash/viewimg/viewsmilies options. + * + * @param \phpbb\user $user + * @param \phpbb\config\config $config + * @param \phpbb\auth\auth $auth + * @return null + */ + public function configure_user(\phpbb\user $user, \phpbb\config\config $config, \phpbb\auth\auth $auth) + { + $censor = $user->optionget('viewcensors') || !$config['allow_nocensors'] || !$auth->acl_get('u_chgcensors'); + + $this->set_viewcensors($censor); + $this->set_viewflash($user->optionget('viewflash')); + $this->set_viewimg($user->optionget('viewimg')); + $this->set_viewsmilies($user->optionget('viewsmilies')); + + // Set the stylesheet parameters + foreach (array_keys($this->renderer->getParameters()) as $param_name) + { + if (strpos($param_name, 'L_') === 0) + { + // L_FOO is set to $user->lang('FOO') + $this->renderer->setParameter($param_name, $user->lang(substr($param_name, 2))); + } + } + + // Set this user's style id and other parameters + $this->renderer->setParameters(array( + 'S_IS_BOT' => $user->data['is_bot'], + 'S_REGISTERED_USER' => $user->data['is_registered'], + 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS), + 'STYLE_ID' => $user->style['style_id'], + )); + } + + /** + * Return the instance of s9e\TextFormatter\Renderer used by this object + * + * @return \s9e\TextFormatter\Renderer + */ + public function get_renderer() + { + return $this->renderer; + } + + /** + * {@inheritdoc} + */ + public function get_viewcensors() + { + return $this->viewcensors; + } + + /** + * {@inheritdoc} + */ + public function get_viewflash() + { + return $this->viewflash; + } + + /** + * {@inheritdoc} + */ + public function get_viewimg() + { + return $this->viewimg; + } + + /** + * {@inheritdoc} + */ + public function get_viewsmilies() + { + return $this->viewsmilies; + } + + /** + * {@inheritdoc} + */ + public function render($xml) + { + if (isset($this->quote_helper)) + { + $xml = $this->quote_helper->inject_metadata($xml); + } + + $renderer = $this; + + /** + * Modify a parsed text before it is rendered + * + * @event core.text_formatter_s9e_render_before + * @var \phpbb\textformatter\s9e\renderer renderer This renderer service + * @var string xml The parsed text, in its XML form + * @since 3.2.0-a1 + */ + $vars = array('renderer', 'xml'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_render_before', compact($vars))); + + if (isset($this->censor) && $this->viewcensors) + { + // NOTE: censorHtml() is XML-safe + $xml = $this->censor->censorHtml($xml, true); + } + + $html = $this->renderer->render($xml); + + /** + * Modify a rendered text + * + * @event core.text_formatter_s9e_render_after + * @var string html The rendered text's HTML + * @var \phpbb\textformatter\s9e\renderer renderer This renderer service + * @since 3.2.0-a1 + */ + $vars = array('html', 'renderer'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_render_after', compact($vars))); + + return $html; + } + + /** + * {@inheritdoc} + */ + public function set_smilies_path($path) + { + $this->renderer->setParameter('T_SMILIES_PATH', $path); + } + + /** + * {@inheritdoc} + */ + public function set_viewcensors($value) + { + $this->viewcensors = $value; + $this->renderer->setParameter('S_VIEWCENSORS', $value); + } + + /** + * {@inheritdoc} + */ + public function set_viewflash($value) + { + $this->viewflash = $value; + $this->renderer->setParameter('S_VIEWFLASH', $value); + } + + /** + * {@inheritdoc} + */ + public function set_viewimg($value) + { + $this->viewimg = $value; + $this->renderer->setParameter('S_VIEWIMG', $value); + } + + /** + * {@inheritdoc} + */ + public function set_viewsmilies($value) + { + $this->viewsmilies = $value; + $this->renderer->setParameter('S_VIEWSMILIES', $value); + } +} diff --git a/phpBB/phpbb/textformatter/s9e/utils.php b/phpBB/phpbb/textformatter/s9e/utils.php new file mode 100644 index 0000000000..b317fe4a8d --- /dev/null +++ b/phpBB/phpbb/textformatter/s9e/utils.php @@ -0,0 +1,139 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +/** +* Text manipulation utilities +*/ +class utils implements \phpbb\textformatter\utils_interface +{ + /** + * Replace BBCodes and other formatting elements with whitespace + * + * NOTE: preserves smilies as text + * + * @param string $xml Parsed text + * @return string Plain text + */ + public function clean_formatting($xml) + { + // Insert a space before <s> and <e> then remove formatting + $xml = preg_replace('#<[es]>#', ' $0', $xml); + + return \s9e\TextFormatter\Utils::removeFormatting($xml); + } + + /** + * Format given string to be used as an attribute value + * + * Will return the string as-is if it can be used in a BBCode without quotes. Otherwise, + * it will use either single- or double- quotes depending on whichever requires less escaping. + * Quotes and backslashes are escaped with backslashes where necessary + * + * @param string $str Original string + * @return string Same string if possible, escaped string within quotes otherwise + */ + protected function format_attribute_value($str) + { + if (!preg_match('/[ "\'\\\\\\]]/', $str)) + { + // Return as-is if it contains none of: space, ' " \ or ] + return $str; + } + $singleQuoted = "'" . addcslashes($str, "\\'") . "'"; + $doubleQuoted = '"' . addcslashes($str, '\\"') . '"'; + + return (strlen($singleQuoted) < strlen($doubleQuoted)) ? $singleQuoted : $doubleQuoted; + } + + /** + * {@inheritdoc} + */ + public function generate_quote($text, array $attributes = array()) + { + $text = trim($text); + $quote = '[quote'; + if (isset($attributes['author'])) + { + // Add the author as the BBCode's default attribute + $quote .= '=' . $this->format_attribute_value($attributes['author']); + unset($attributes['author']); + } + + if (isset($attributes['user_id']) && $attributes['user_id'] == ANONYMOUS) + { + unset($attributes['user_id']); + } + + ksort($attributes); + foreach ($attributes as $name => $value) + { + $quote .= ' ' . $name . '=' . $this->format_attribute_value($value); + } + $quote .= ']'; + $newline = (strlen($quote . $text . '[/quote]') > 80 || strpos($text, "\n") !== false) ? "\n" : ''; + $quote .= $newline . $text . $newline . '[/quote]'; + + return $quote; + } + + /** + * Get a list of quote authors, limited to the outermost quotes + * + * @param string $xml Parsed text + * @return string[] List of authors + */ + public function get_outermost_quote_authors($xml) + { + $authors = array(); + if (strpos($xml, '<QUOTE ') === false) + { + return $authors; + } + + $dom = new \DOMDocument; + $dom->loadXML($xml); + $xpath = new \DOMXPath($dom); + foreach ($xpath->query('//QUOTE[not(ancestor::QUOTE)]/@author') as $author) + { + $authors[] = $author->textContent; + } + + return $authors; + } + + /** + * Remove given BBCode and its content, at given nesting depth + * + * @param string $xml Parsed text + * @param string $bbcode_name BBCode's name + * @param integer $depth Minimum nesting depth (number of parents of the same name) + * @return string Parsed text + */ + public function remove_bbcode($xml, $bbcode_name, $depth = 0) + { + return \s9e\TextFormatter\Utils::removeTag($xml, strtoupper($bbcode_name), $depth); + } + + /** + * Return a parsed text to its original form + * + * @param string $xml Parsed text + * @return string Original plain text + */ + public function unparse($xml) + { + return \s9e\TextFormatter\Unparser::unparse($xml); + } +} diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php new file mode 100644 index 0000000000..4810453cd1 --- /dev/null +++ b/phpBB/phpbb/textformatter/utils_interface.php @@ -0,0 +1,71 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter; + +/** +* Used to manipulate a parsed text +*/ +interface utils_interface +{ + /** + * Replace BBCodes and other formatting elements with whitespace + * + * NOTE: preserves smilies as text + * + * @param string $text Parsed text + * @return string Plain text + */ + public function clean_formatting($text); + + /** + * Create a quote block for given text + * + * Possible attributes: + * - author: author's name (usually a username) + * - post_id: post_id of the post being quoted + * - user_id: user_id of the user being quoted + * - time: timestamp of the original message + * + * @param string $text Quote's text + * @param array $attributes Quote's attributes + * @return string Quote block to be used in a new post/text + */ + public function generate_quote($text, array $attributes = array()); + + /** + * Get a list of quote authors, limited to the outermost quotes + * + * @param string $text Parsed text + * @return string[] List of authors + */ + public function get_outermost_quote_authors($text); + + /** + * Remove given BBCode and its content, at given nesting depth + * + * @param string $text Parsed text + * @param string $bbcode_name BBCode's name + * @param integer $depth Minimum nesting depth (number of parents of the same name) + * @return string Parsed text + */ + public function remove_bbcode($text, $bbcode_name, $depth = 0); + + /** + * Return a parsed text to its original form + * + * @param string $text Parsed text + * @return string Original plain text + */ + public function unparse($text); +} diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php new file mode 100644 index 0000000000..3e5ee248a1 --- /dev/null +++ b/phpBB/phpbb/textreparser/base.php @@ -0,0 +1,243 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser; + +abstract class base implements reparser_interface +{ + /** + * @var bool Whether to save changes to the database + */ + protected $save_changes = true; + + /** + * {@inheritdoc} + */ + abstract public function get_max_id(); + + /** + * Return all records in given range + * + * @param integer $min_id Lower bound + * @param integer $max_id Upper bound + * @return array Array of records + */ + abstract protected function get_records_by_range($min_id, $max_id); + + /** + * {@inheritdoc} + */ + abstract protected function save_record(array $record); + + /** + * Add fields to given record, if applicable + * + * The enable_* fields are not always saved to the database. Sometimes we need to guess their + * original value based on the text content or possibly other fields + * + * @param array $record Original record + * @return array Complete record + */ + protected function add_missing_fields(array $record) + { + if (!isset($record['enable_bbcode'], $record['enable_smilies'], $record['enable_magic_url'])) + { + if (isset($record['options'])) + { + $record += array( + 'enable_bbcode' => (bool) ($record['options'] & OPTION_FLAG_BBCODE), + 'enable_smilies' => (bool) ($record['options'] & OPTION_FLAG_SMILIES), + 'enable_magic_url' => (bool) ($record['options'] & OPTION_FLAG_LINKS), + ); + } + else + { + $record += array( + 'enable_bbcode' => $this->guess_bbcodes($record), + 'enable_smilies' => $this->guess_smilies($record), + 'enable_magic_url' => $this->guess_magic_url($record), + ); + } + } + + // Those BBCodes are disabled based on context and user permissions and that value is never + // stored in the database. Here we test whether they were used in the original text. + $bbcodes = array('flash', 'img', 'quote', 'url'); + foreach ($bbcodes as $bbcode) + { + $field_name = 'enable_' . $bbcode . '_bbcode'; + $record[$field_name] = $this->guess_bbcode($record, $bbcode); + } + + // Magic URLs are tied to the URL BBCode, that's why if magic URLs are enabled we make sure + // that the URL BBCode is also enabled + if ($record['enable_magic_url']) + { + $record['enable_url_bbcode'] = true; + } + + return $record; + } + + /** + * Disable saving changes to the database + */ + public function disable_save() + { + $this->save_changes = false; + } + + /** + * Enable saving changes to the database + */ + public function enable_save() + { + $this->save_changes = true; + } + + /** + * Guess whether given BBCode is in use in given record + * + * @param array $record + * @param string $bbcode + * @return bool + */ + protected function guess_bbcode(array $record, $bbcode) + { + if (!empty($record['bbcode_uid'])) + { + // Look for the closing tag, e.g. [/url] + $match = '[/' . $bbcode . ':' . $record['bbcode_uid']; + if (strpos($record['text'], $match) !== false) + { + return true; + } + } + + if (substr($record['text'], 0, 2) === '<r') + { + // Look for the closing tag inside of a e element, in an element of the same name, e.g. + // <e>[/url]</e></URL> + $match = '<e>[/' . $bbcode . ']</e></' . strtoupper($bbcode) . '>'; + if (strpos($record['text'], $match) !== false) + { + return true; + } + } + + return false; + } + + /** + * Guess whether any BBCode is in use in given record + * + * @param array $record + * @return bool + */ + protected function guess_bbcodes(array $record) + { + if (!empty($record['bbcode_uid'])) + { + // Test whether the bbcode_uid is in use + $match = ':' . $record['bbcode_uid']; + if (strpos($record['text'], $match) !== false) + { + return true; + } + } + + if (substr($record['text'], 0, 2) === '<r') + { + // Look for a closing tag inside of an e element + return (bool) preg_match('(<e>\\[/\\w+\\]</e>)', $match); + } + + return false; + } + + /** + * Guess whether magic URLs are in use in given record + * + * @param array $record + * @return bool + */ + protected function guess_magic_url(array $record) + { + // Look for <!-- m --> or for a URL tag that's not immediately followed by <s> + return (strpos($record['text'], '<!-- m -->') !== false || preg_match('(<URL [^>]++>(?!<s>))', $record['text'])); + } + + /** + * Guess whether smilies are in use in given record + * + * @param array $record + * @return bool + */ + protected function guess_smilies(array $record) + { + return (strpos($record['text'], '<!-- s') !== false || strpos($record['text'], '<E>') !== false); + } + + /** + * {@inheritdoc} + */ + public function reparse_range($min_id, $max_id) + { + foreach ($this->get_records_by_range($min_id, $max_id) as $record) + { + $this->reparse_record($record); + } + } + + /** + * Reparse given record + * + * @param array $record Associative array containing the record's data + */ + protected function reparse_record(array $record) + { + $record = $this->add_missing_fields($record); + $flags = ($record['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0; + $flags |= ($record['enable_smilies']) ? OPTION_FLAG_SMILIES : 0; + $flags |= ($record['enable_magic_url']) ? OPTION_FLAG_LINKS : 0; + $unparsed = array_merge( + $record, + generate_text_for_edit($record['text'], $record['bbcode_uid'], $flags) + ); + + // generate_text_for_edit() and decode_message() actually return the text as HTML. It has to + // be decoded to plain text before it can be reparsed + $text = html_entity_decode($unparsed['text'], ENT_QUOTES, 'UTF-8'); + $bitfield = $flags = null; + generate_text_for_storage( + $text, + $unparsed['bbcode_uid'], + $bitfield, + $flags, + $unparsed['enable_bbcode'], + $unparsed['enable_magic_url'], + $unparsed['enable_smilies'], + $unparsed['enable_img_bbcode'], + $unparsed['enable_flash_bbcode'], + $unparsed['enable_quote_bbcode'], + $unparsed['enable_url_bbcode'] + ); + + // Save the new text if it has changed and it's not a dry run + if ($text !== $record['text'] && $this->save_changes) + { + $record['text'] = $text; + $this->save_record($record); + } + } +} diff --git a/phpBB/phpbb/textreparser/manager.php b/phpBB/phpbb/textreparser/manager.php new file mode 100644 index 0000000000..fddd867923 --- /dev/null +++ b/phpBB/phpbb/textreparser/manager.php @@ -0,0 +1,128 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\textreparser; + +class manager +{ + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var \phpbb\config\db_text + */ + protected $config_text; + + /** + * @var \phpbb\di\service_collection + */ + protected $reparsers; + + /** + * @var array + */ + protected $resume_data; + + /** + * Constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\config\db_text $config_text + * @param \phpbb\di\service_collection $reparsers + */ + public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\di\service_collection $reparsers) + { + $this->config = $config; + $this->config_text = $config_text; + $this->reparsers = $reparsers; + } + + /** + * Loads resume data from the database + * + * @param string $name Name of the reparser to which the resume data belongs + * + * @return array + */ + public function get_resume_data($name) + { + if ($this->resume_data === null) + { + $resume_data = $this->config_text->get('reparser_resume'); + $this->resume_data = !empty($resume_data) ? unserialize($resume_data) : array(); + } + + return isset($this->resume_data[$name]) ? $this->resume_data[$name] : array(); + } + + /** + * Updates the resume data in the database + * + * @param string $name Name of the reparser to which the resume data belongs + * @param int $min Lowest record ID + * @param int $current Current record ID + * @param int $size Number of records to process at a time + * @param bool $update_db True if the resume data should be written to the database, false if not. (default: true) + */ + public function update_resume_data($name, $min, $current, $size, $update_db = true) + { + // Prevent overwriting the old, stored array + if ($this->resume_data === null) + { + $this->get_resume_data(''); + } + + $this->resume_data[$name] = array( + 'range-min' => $min, + 'range-max' => $current, + 'range-size' => $size, + ); + + if ($update_db) + { + $this->config_text->set('reparser_resume', serialize($this->resume_data)); + } + } + + /** + * Sets the interval for a text_reparser cron task + * + * @param string $name Name of the reparser to schedule + * @param int $interval Interval in seconds, 0 to disable the cron task + */ + public function schedule($name, $interval) + { + if (isset($this->reparsers[$name]) && isset($this->config[$name . '_cron_interval'])) + { + $this->config->set($name . '_cron_interval', $interval); + } + } + + /** + * Sets the interval for all text_reparser cron tasks + * + * @param int $interval Interval in seconds, 0 to disable the cron task + */ + public function schedule_all($interval) + { + // This way we don't construct every registered reparser + $reparser_array = array_keys($this->reparsers->getArrayCopy()); + + foreach ($reparser_array as $reparser) + { + $this->schedule($reparser, $interval); + } + } +} diff --git a/phpBB/phpbb/textreparser/plugins/contact_admin_info.php b/phpBB/phpbb/textreparser/plugins/contact_admin_info.php new file mode 100644 index 0000000000..8910f2256b --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/contact_admin_info.php @@ -0,0 +1,69 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class contact_admin_info extends \phpbb\textreparser\base +{ + /** + * @var \phpbb\config\db_text + */ + protected $config_text; + + /** + * Constructor + * + * @param \phpbb\config\db_text $config_text + */ + public function __construct(\phpbb\config\db_text $config_text) + { + $this->config_text = $config_text; + } + + /** + * {@inheritdoc} + */ + public function get_max_id() + { + return 1; + } + + /** + * {@inheritdoc} + */ + protected function get_records_by_range($min_id, $max_id) + { + $values = $this->config_text->get_array(array( + 'contact_admin_info', + 'contact_admin_info_uid', + 'contact_admin_info_flags', + )); + + return array(array( + 'id' => 1, + 'text' => $values['contact_admin_info'], + 'bbcode_uid' => $values['contact_admin_info_uid'], + 'enable_bbcode' => $values['contact_admin_info_flags'] & OPTION_FLAG_BBCODE, + 'enable_magic_url' => $values['contact_admin_info_flags'] & OPTION_FLAG_LINKS, + 'enable_smilies' => $values['contact_admin_info_flags'] & OPTION_FLAG_SMILIES, + )); + } + + /** + * {@inheritdoc} + */ + protected function save_record(array $record) + { + $this->config_text->set('contact_admin_info', $record['text']); + } +} diff --git a/phpBB/phpbb/textreparser/plugins/forum_description.php b/phpBB/phpbb/textreparser/plugins/forum_description.php new file mode 100644 index 0000000000..b0f5a42452 --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/forum_description.php @@ -0,0 +1,30 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class forum_description extends \phpbb\textreparser\row_based_plugin +{ + /** + * {@inheritdoc} + */ + public function get_columns() + { + return array( + 'id' => 'forum_id', + 'text' => 'forum_desc', + 'bbcode_uid' => 'forum_desc_uid', + 'options' => 'forum_desc_options', + ); + } +} diff --git a/phpBB/phpbb/textreparser/plugins/forum_rules.php b/phpBB/phpbb/textreparser/plugins/forum_rules.php new file mode 100644 index 0000000000..d131d00707 --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/forum_rules.php @@ -0,0 +1,30 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class forum_rules extends \phpbb\textreparser\row_based_plugin +{ + /** + * {@inheritdoc} + */ + public function get_columns() + { + return array( + 'id' => 'forum_id', + 'text' => 'forum_rules', + 'bbcode_uid' => 'forum_rules_uid', + 'options' => 'forum_rules_options', + ); + } +} diff --git a/phpBB/phpbb/textreparser/plugins/group_description.php b/phpBB/phpbb/textreparser/plugins/group_description.php new file mode 100644 index 0000000000..2c45c00474 --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/group_description.php @@ -0,0 +1,30 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class group_description extends \phpbb\textreparser\row_based_plugin +{ + /** + * {@inheritdoc} + */ + public function get_columns() + { + return array( + 'id' => 'group_id', + 'text' => 'group_desc', + 'bbcode_uid' => 'group_desc_uid', + 'options' => 'group_desc_options', + ); + } +} diff --git a/phpBB/phpbb/textreparser/plugins/pm_text.php b/phpBB/phpbb/textreparser/plugins/pm_text.php new file mode 100644 index 0000000000..867da624ee --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/pm_text.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class pm_text extends \phpbb\textreparser\row_based_plugin +{ + /** + * {@inheritdoc} + */ + public function get_columns() + { + return array( + 'id' => 'msg_id', + 'enable_bbcode' => 'enable_bbcode', + 'enable_smilies' => 'enable_smilies', + 'enable_magic_url' => 'enable_magic_url', + 'text' => 'message_text', + 'bbcode_uid' => 'bbcode_uid', + ); + } +} diff --git a/phpBB/phpbb/textreparser/plugins/poll_option.php b/phpBB/phpbb/textreparser/plugins/poll_option.php new file mode 100644 index 0000000000..44cacfae62 --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/poll_option.php @@ -0,0 +1,74 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class poll_option extends \phpbb\textreparser\base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * Constructor + * + * @param \phpbb\db\driver\driver_interface $db Database connection + */ + public function __construct(\phpbb\db\driver\driver_interface $db) + { + $this->db = $db; + } + + /** + * {@inheritdoc} + */ + public function get_max_id() + { + $sql = 'SELECT MAX(topic_id) AS max_id FROM ' . POLL_OPTIONS_TABLE; + $result = $this->db->sql_query($sql); + $max_id = (int) $this->db->sql_fetchfield('max_id'); + $this->db->sql_freeresult($result); + + return $max_id; + } + + /** + * {@inheritdoc} + */ + protected function get_records_by_range($min_id, $max_id) + { + $sql = 'SELECT o.topic_id, o.poll_option_id, o.poll_option_text AS text, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.bbcode_uid + FROM ' . POLL_OPTIONS_TABLE . ' o, ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p + WHERE o.topic_id BETWEEN ' . $min_id . ' AND ' . $max_id .' + AND t.topic_id = o.topic_id + AND p.post_id = t.topic_first_post_id'; + $result = $this->db->sql_query($sql); + $records = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $records; + } + + /** + * {@inheritdoc} + */ + protected function save_record(array $record) + { + $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . " + SET poll_option_text = '" . $this->db->sql_escape($record['text']) . "' + WHERE topic_id = " . $record['topic_id'] . ' + AND poll_option_id = ' . $record['poll_option_id']; + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/textreparser/plugins/poll_title.php b/phpBB/phpbb/textreparser/plugins/poll_title.php new file mode 100644 index 0000000000..76d30655c9 --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/poll_title.php @@ -0,0 +1,42 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class poll_title extends \phpbb\textreparser\row_based_plugin +{ + /** + * {@inheritdoc} + */ + public function get_columns() + { + return array( + 'id' => 'topic_id', + 'text' => 'poll_title', + ); + } + + /** + * {@inheritdoc} + */ + protected function get_records_by_range_query($min_id, $max_id) + { + $sql = 'SELECT t.topic_id AS id, t.poll_title AS text, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.bbcode_uid + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p + WHERE t.topic_id BETWEEN ' . $min_id . ' AND ' . $max_id .' + AND t.poll_max_options > 0 + AND p.post_id = t.topic_first_post_id'; + + return $sql; + } +} diff --git a/phpBB/phpbb/textreparser/plugins/post_text.php b/phpBB/phpbb/textreparser/plugins/post_text.php new file mode 100644 index 0000000000..1c98e86067 --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/post_text.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class post_text extends \phpbb\textreparser\row_based_plugin +{ + /** + * {@inheritdoc} + */ + public function get_columns() + { + return array( + 'id' => 'post_id', + 'enable_bbcode' => 'enable_bbcode', + 'enable_smilies' => 'enable_smilies', + 'enable_magic_url' => 'enable_magic_url', + 'text' => 'post_text', + 'bbcode_uid' => 'bbcode_uid', + ); + } +} diff --git a/phpBB/phpbb/textreparser/plugins/user_signature.php b/phpBB/phpbb/textreparser/plugins/user_signature.php new file mode 100644 index 0000000000..647d3a7b14 --- /dev/null +++ b/phpBB/phpbb/textreparser/plugins/user_signature.php @@ -0,0 +1,65 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser\plugins; + +class user_signature extends \phpbb\textreparser\row_based_plugin +{ + /** + * @var array Bit numbers used for user options + * @see \phpbb\user + */ + protected $keyoptions; + + /** + * {@inheritdoc} + */ + protected function add_missing_fields(array $row) + { + if (!isset($this->keyoptions)) + { + $this->save_keyoptions(); + } + + $options = $row['user_options']; + $row += array( + 'enable_bbcode' => phpbb_optionget($this->keyoptions['sig_bbcode'], $options), + 'enable_smilies' => phpbb_optionget($this->keyoptions['sig_smilies'], $options), + 'enable_magic_url' => phpbb_optionget($this->keyoptions['sig_links'], $options), + ); + + return parent::add_missing_fields($row); + } + + /** + * {@inheritdoc} + */ + public function get_columns() + { + return array( + 'id' => 'user_id', + 'text' => 'user_sig', + 'bbcode_uid' => 'user_sig_bbcode_uid', + 'user_options' => 'user_options', + ); + } + + /** + * Save the keyoptions var from \phpbb\user + */ + protected function save_keyoptions() + { + $class_vars = get_class_vars('phpbb\\user'); + $this->keyoptions = $class_vars['keyoptions']; + } +} diff --git a/phpBB/phpbb/textreparser/reparser_interface.php b/phpBB/phpbb/textreparser/reparser_interface.php new file mode 100644 index 0000000000..9ea1732870 --- /dev/null +++ b/phpBB/phpbb/textreparser/reparser_interface.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser; + +interface reparser_interface +{ + /** + * Return the highest ID for all existing records + * + * @return integer + */ + public function get_max_id(); + + /** + * Reparse all records in given range + * + * @param integer $min_id Lower bound + * @param integer $max_id Upper bound + */ + public function reparse_range($min_id, $max_id); +} diff --git a/phpBB/phpbb/textreparser/row_based_plugin.php b/phpBB/phpbb/textreparser/row_based_plugin.php new file mode 100644 index 0000000000..2d32104493 --- /dev/null +++ b/phpBB/phpbb/textreparser/row_based_plugin.php @@ -0,0 +1,117 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textreparser; + +abstract class row_based_plugin extends base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var string + */ + protected $table; + + /** + * Constructor + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param string $table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $table) + { + $this->db = $db; + $this->table = $table; + } + + /** + * Return the name of the column that correspond to each field + * + * @return array + */ + abstract public function get_columns(); + + /** + * {@inheritdoc} + */ + public function get_max_id() + { + $columns = $this->get_columns(); + + $sql = 'SELECT MAX(' . $columns['id'] . ') AS max_id FROM ' . $this->table; + $result = $this->db->sql_query($sql); + $max_id = (int) $this->db->sql_fetchfield('max_id'); + $this->db->sql_freeresult($result); + + return $max_id; + } + + /** + * {@inheritdoc} + */ + protected function get_records_by_range($min_id, $max_id) + { + $sql = $this->get_records_by_range_query($min_id, $max_id); + $result = $this->db->sql_query($sql); + $records = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $records; + } + + /** + * Generate the query that retrieves all records for given range + * + * @param integer $min_id Lower bound + * @param integer $max_id Upper bound + * @return string SQL query + */ + protected function get_records_by_range_query($min_id, $max_id) + { + $columns = $this->get_columns(); + $fields = array(); + foreach ($columns as $field_name => $column_name) + { + if ($column_name === $field_name) + { + $fields[] = $column_name; + } + else + { + $fields[] = $column_name . ' AS ' . $field_name; + } + } + + $sql = 'SELECT ' . implode(', ', $fields) . ' + FROM ' . $this->table . ' + WHERE ' . $columns['id'] . ' BETWEEN ' . $min_id . ' AND ' . $max_id; + + return $sql; + } + + /** + * {@inheritdoc} + */ + protected function save_record(array $record) + { + $columns = $this->get_columns(); + + $sql = 'UPDATE ' . $this->table . ' + SET ' . $columns['text'] . " = '" . $this->db->sql_escape($record['text']) . "' + WHERE " . $columns['id'] . ' = ' . $record['id']; + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php index 13184cf41c..7149513fd9 100644 --- a/phpBB/phpbb/tree/nestedset.php +++ b/phpBB/phpbb/tree/nestedset.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,7 @@ namespace phpbb\tree; abstract class nestedset implements \phpbb\tree\tree_interface { - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var \phpbb\lock\db */ @@ -52,7 +56,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface /** * Construct * - * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around * @param string $table_name Table name * @param string $message_prefix Prefix for the messages thrown by exceptions @@ -60,7 +64,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface * @param array $item_basic_data Array with basic item data that is stored in item_parents * @param array $columns Array with column names to overwrite */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array()) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\lock\db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array()) { $this->db = $db; $this->lock = $lock; @@ -99,7 +103,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface * * @return bool True if the lock was acquired, false if it has been acquired previously * - * @throws RuntimeException If the lock could not be acquired + * @throws \RuntimeException If the lock could not be acquired */ protected function acquire_lock() { @@ -117,7 +121,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function insert(array $additional_data) { @@ -172,6 +176,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface * * @param int $item_id The item to be deleted * @return array Item ids that have been removed + * @throws \OutOfBoundsException */ protected function remove_item_from_nestedset($item_id) { @@ -195,7 +200,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function delete($item_id) { @@ -210,7 +215,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function move($item_id, $delta) { @@ -328,7 +333,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function move_down($item_id) { @@ -336,7 +341,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function move_up($item_id) { @@ -344,7 +349,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function move_children($current_parent_id, $new_parent_id) { @@ -386,7 +391,6 @@ abstract class nestedset implements \phpbb\tree\tree_interface throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } - $diff = sizeof($move_items) * 2; $sql_exclude_moved_items = $this->db->sql_in_set($this->column_item_id, $move_items, true); $this->db->sql_transaction('begin'); @@ -450,7 +454,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function change_parent($item_id, $new_parent_id) { @@ -485,7 +489,6 @@ abstract class nestedset implements \phpbb\tree\tree_interface throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } - $diff = sizeof($move_items) * 2; $sql_exclude_moved_items = $this->db->sql_in_set($this->column_item_id, $move_items, true); $this->db->sql_transaction('begin'); @@ -549,7 +552,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function get_path_and_subtree_data($item_id, $order_asc = true, $include_item = true) { @@ -560,7 +563,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function get_path_data($item_id, $order_asc = true, $include_item = true) { @@ -570,7 +573,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** - * @inheritdoc + * {@inheritdoc} */ public function get_subtree_data($item_id, $order_asc = true, $include_item = true) { @@ -664,6 +667,32 @@ abstract class nestedset implements \phpbb\tree\tree_interface } /** + * Get all items from the tree + * + * @param bool $order_asc Order the items ascending by their left_id + * @return array Array of items (containing all columns from the item table) + * ID => Item data + */ + public function get_all_tree_data($order_asc = true) + { + $rows = array(); + + $sql = 'SELECT * + FROM ' . $this->table_name . ' ' . + $this->get_sql_where('WHERE') . ' + ORDER BY ' . $this->column_left_id . ' ' . ($order_asc ? 'ASC' : 'DESC'); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $rows[(int) $row[$this->column_item_id]] = $row; + } + $this->db->sql_freeresult($result); + + return $rows; + } + + /** * Remove a subset from the nested set * * @param array $subset_items Subset of items to remove @@ -806,7 +835,10 @@ abstract class nestedset implements \phpbb\tree\tree_interface ' . $this->get_sql_where('AND') . ' ORDER BY ' . $this->column_left_id . ', ' . $this->column_item_id . ' ASC'; $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + foreach ($rows as $row) { // First we update the left_id for this module if ($row[$this->column_left_id] != $new_id) @@ -831,7 +863,6 @@ abstract class nestedset implements \phpbb\tree\tree_interface } $new_id++; } - $this->db->sql_freeresult($result); if ($acquired_new_lock) { diff --git a/phpBB/phpbb/tree/nestedset_forum.php b/phpBB/phpbb/tree/nestedset_forum.php index ef6023546b..890fc804c0 100644 --- a/phpBB/phpbb/tree/nestedset_forum.php +++ b/phpBB/phpbb/tree/nestedset_forum.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,11 +18,11 @@ class nestedset_forum extends \phpbb\tree\nestedset /** * Construct * - * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around * @param string $table_name Table name */ - public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\lock\db $lock, $table_name) { parent::__construct( $db, diff --git a/phpBB/phpbb/tree/tree_interface.php b/phpBB/phpbb/tree/tree_interface.php index 90ec27e024..5df01a89cf 100644 --- a/phpBB/phpbb/tree/tree_interface.php +++ b/phpBB/phpbb/tree/tree_interface.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,7 +18,7 @@ interface tree_interface /** * Inserts an item into the database table and into the tree. * - * @param array $item The item to be added + * @param array $additional_data The item to be added * @return array Array with item data as set in the database */ public function insert(array $additional_data); diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 2a7cc602da..5262e10e87 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,13 +18,14 @@ namespace phpbb; * * This is the overarching class which contains (through session extend) * all methods utilised for user functionality during a session. -* -* @package phpBB3 */ class user extends \phpbb\session { - var $lang = array(); - var $help = array(); + /** + * @var \phpbb\language\language + */ + protected $language; + var $style = array(); var $date_format; @@ -29,39 +34,74 @@ class user extends \phpbb\session */ public $timezone; + /** + * @var string Class name of datetime object + */ + protected $datetime; + var $lang_name = false; var $lang_id = false; var $lang_path; var $img_lang; var $img_array = array(); + /** @var bool */ + protected $is_setup_flag; + // 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, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17); /** * Constructor to set the lang path + * + * @param \phpbb\language\language $lang phpBB's Language loader + * @param string $datetime_class Class name of datetime class */ - function __construct() + function __construct(\phpbb\language\language $lang, $datetime_class) { global $phpbb_root_path; $this->lang_path = $phpbb_root_path . 'language/'; + $this->language = $lang; + $this->datetime = $datetime_class; + + $this->is_setup_flag = false; } /** - * 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) + * Returns whether user::setup was called + * + * @return bool + */ + public function is_setup() { - $this->lang_path = $lang_path; + return $this->is_setup_flag; + } - if (substr($this->lang_path, -1) != '/') + /** + * Magic getter for BC compatibility + * + * Implement array access for user::lang. + * + * @param string $param_name Name of the BC component the user want to access + * + * @return array The appropriate array + * + * @deprecated 3.2.0-dev (To be removed: 4.0.0) + */ + public function __get($param_name) + { + if ($param_name === 'lang') { - $this->lang_path .= '/'; + return $this->language->get_lang_array(); } + else if ($param_name === 'help') + { + $help_array = $this->language->get_lang_array(); + return $help_array['__help']; + } + + return array(); } /** @@ -69,9 +109,11 @@ class user extends \phpbb\session */ function setup($lang_set = false, $style_id = false) { - global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; + global $db, $request, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; global $phpbb_dispatcher; + $this->language->set_default_language($config['default_lang']); + if ($this->data['user_id'] != ANONYMOUS) { $user_lang_name = (file_exists($this->lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']); @@ -80,7 +122,27 @@ class user extends \phpbb\session } else { - $user_lang_name = basename($config['default_lang']); + $lang_override = $request->variable('language', ''); + if ($lang_override) + { + $this->set_cookie('lang', $lang_override, 0, false); + } + else + { + $lang_override = $request->variable($config['cookie_name'] . '_lang', '', true, \phpbb\request\request_interface::COOKIE); + } + + if ($lang_override) + { + $use_lang = basename($lang_override); + $user_lang_name = (file_exists($this->lang_path . $use_lang . "/common.$phpEx")) ? $use_lang : basename($config['default_lang']); + $this->data['user_lang'] = $user_lang_name; + } + else + { + $user_lang_name = basename($config['default_lang']); + } + $user_date_format = $config['default_dateformat']; $user_timezone = $config['board_timezone']; @@ -143,15 +205,25 @@ class user extends \phpbb\session * that are absolutely needed globally using this * event. Use local events otherwise. * @var mixed style_id Style we are going to display - * @since 3.1-A1 + * @since 3.1.0-a1 */ - $vars = array('user_data', 'user_lang_name', 'user_date_format', 'user_timezone', 'lang_set', 'lang_set_ext', 'style_id'); + $vars = array( + 'user_data', + 'user_lang_name', + 'user_date_format', + 'user_timezone', + 'lang_set', + 'lang_set_ext', + 'style_id', + ); extract($phpbb_dispatcher->trigger_event('core.user_setup', compact($vars))); $this->data = $user_data; $this->lang_name = $user_lang_name; $this->date_format = $user_date_format; + $this->language->set_user_language($user_lang_name); + try { $this->timezone = new \DateTimeZone($user_timezone); @@ -162,17 +234,6 @@ class user extends \phpbb\session $this->timezone = new \DateTimeZone('UTC'); } - // 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 mode - $include_result = (defined('DEBUG')) ? (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); @@ -182,7 +243,7 @@ class user extends \phpbb\session } unset($lang_set_ext); - $style_request = request_var('style', 0); + $style_request = $request->variable('style', 0); if ($style_request && (!$config['override_user_style'] || $auth->acl_get('a_styles')) && !defined('ADMIN_START')) { global $SID, $_EXTRA_URL; @@ -204,6 +265,19 @@ class user extends \phpbb\session $this->style = $db->sql_fetchrow($result); $db->sql_freeresult($result); + // Fallback to user's standard style + if (!$this->style && $style_id != $this->data['user_style']) + { + $style_id = $this->data['user_style']; + + $sql = 'SELECT * + FROM ' . STYLES_TABLE . " s + WHERE s.style_id = $style_id"; + $result = $db->sql_query($sql, 3600); + $this->style = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + // User has wrong style if (!$this->style && $style_id == $this->data['user_style']) { @@ -253,6 +327,14 @@ class user extends \phpbb\session // After calling it we continue script execution... phpbb_user_session_handler(); + /** + * Execute code at the end of user setup + * + * @event core.user_setup_after + * @since 3.1.6-RC1 + */ + $phpbb_dispatcher->dispatch('core.user_setup_after'); + // If this function got called from the error handler we are finished here. if (defined('IN_ERROR_HANDLER')) { @@ -276,7 +358,7 @@ class user extends \phpbb\session } // 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 ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) { if ($this->data['is_bot']) { @@ -345,6 +427,8 @@ class user extends \phpbb\session } } + $this->is_setup_flag = true; + return; } @@ -358,103 +442,13 @@ class user extends \phpbb\session * * 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. + * + * @deprecated 3.2.0-dev (To be removed 4.0.0) */ 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); + return call_user_func_array(array($this->language, 'lang'), $args); } /** @@ -464,24 +458,22 @@ class user extends \phpbb\session * @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 + * @return int|bool The plural-case we need to use for the number plural-rule combination, false if $force_rule + * was invalid. + * + * @deprecated: 3.2.0-dev (To be removed: 3.3.0) */ 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); + return $this->language->get_plural_form($number, $force_rule); } /** * 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 bool $use_db internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 3.3.0) + * @param bool $use_help internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 3.3.0) * @param string $ext_name The extension to load language from, or empty for core files * * Examples: @@ -492,11 +484,14 @@ class user extends \phpbb\session * $lang_set = 'posting' * $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting')) * </code> + * + * Note: $use_db and $use_help should be removed. The old function was kept for BC purposes, + * so the BC logic is handled here. + * + * @deprecated: 3.2.0-dev (To be removed: 3.3.0) */ 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) @@ -507,6 +502,7 @@ class user extends \phpbb\session if ($key == 'db') { + // This is never used $this->add_lang($lang_file, true, $use_help, $ext_name); } else if ($key == 'help') @@ -515,7 +511,7 @@ class user extends \phpbb\session } else if (!is_array($lang_file)) { - $this->set_lang($this->lang, $this->help, $lang_file, $use_db, $use_help, $ext_name); + $this->set_lang($lang_file, $use_help, $ext_name); } else { @@ -526,17 +522,50 @@ class user extends \phpbb\session } else if ($lang_set) { - $this->set_lang($this->lang, $this->help, $lang_set, $use_db, $use_help, $ext_name); + $this->set_lang($lang_set, $use_help, $ext_name); } } /** + * BC function for loading language files + * + * @deprecated 3.2.0-dev (To be removed: 3.3.0) + */ + private function set_lang($lang_set, $use_help, $ext_name) + { + if (empty($ext_name)) + { + $ext_name = null; + } + + if ($use_help && strpos($lang_set, '/') !== false) + { + $component = dirname($lang_set) . '/help_' . basename($lang_set); + + if ($component[0] === '/') + { + $component = substr($component, 1); + } + } + else + { + $component = (($use_help) ? 'help_' : '') . $lang_set; + } + + $this->language->add_lang($component, $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 + * + * Note: $use_db and $use_help should be removed. Kept for BC purposes. + * + * @deprecated: 3.2.0-dev (To be removed: 3.3.0) */ function add_lang_ext($ext_name, $lang_set, $use_db = false, $use_help = false) { @@ -549,107 +578,6 @@ class user extends \phpbb\session } /** - * 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 we are in install, try to use the updated version, when available - $install_language_filename = str_replace('language/', 'install/update/new/language/', $language_filename); - if (defined('IN_INSTALL') && file_exists($install_language_filename)) - { - $language_filename = $install_language_filename; - } - - 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 mode - $include_result = (defined('DEBUG')) ? (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 @@ -667,7 +595,7 @@ class user extends \phpbb\session $utc = new \DateTimeZone('UTC'); } - $time = new \phpbb\datetime($this, "@$gmepoch", $utc); + $time = new $this->datetime($this, "@$gmepoch", $utc); $time->setTimezone($this->timezone); return $time->format($format, $forcedate); @@ -684,7 +612,7 @@ class user extends \phpbb\session public function create_datetime($time = 'now', \DateTimeZone $timezone = null) { $timezone = $timezone ?: $this->timezone; - return new \phpbb\datetime($this, $time, $timezone); + return new $this->datetime($this, $time, $timezone); } /** @@ -754,8 +682,14 @@ class user extends \phpbb\session */ function img($img, $alt = '') { - $alt = (!empty($this->lang[$alt])) ? $this->lang[$alt] : $alt; - return '<span class="imageset ' . $img . '">' . $alt . '</span>'; + $title = ''; + + if ($alt) + { + $alt = $this->language->lang($alt); + $title = ' title="' . $alt . '"'; + } + return '<span class="imageset ' . $img . '"' . $title . '>' . $alt . '</span>'; } /** @@ -813,8 +747,6 @@ class user extends \phpbb\session */ function leave_newly_registered() { - global $db; - if (empty($this->data['user_new'])) { return false; diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php index c1d69802f8..cdd28329db 100644 --- a/phpBB/phpbb/user_loader.php +++ b/phpBB/phpbb/user_loader.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,7 +23,7 @@ namespace phpbb; */ class user_loader { - /** @var \phpbb\db\driver\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db = null; /** @var string */ @@ -41,12 +45,12 @@ class user_loader /** * User loader constructor * - * @param \phpbb\db\driver\driver $db A database connection + * @param \phpbb\db\driver\driver_interface $db A database connection * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $php_ext php file extension * @param string $users_table The name of the database table (phpbb_users) */ - public function __construct(\phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext, $users_table) + public function __construct(\phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext, $users_table) { $this->db = $db; @@ -171,25 +175,28 @@ class user_loader /** * Get avatar * - * @param int $user_id User ID of the user you want to retreive the avatar for + * @param int $user_id User ID of the user you want to retrieve the avatar for * @param bool $query Should we query the database if this user has not yet been loaded? * Typically this should be left as false and you should make sure * you load users ahead of time with load_users() + * @param bool @lazy If true, will be lazy loaded (requires JS) * @return string */ - public function get_avatar($user_id, $query = false) + public function get_avatar($user_id, $query = false, $lazy = false) { if (!($user = $this->get_user($user_id, $query))) { return ''; } - if (!function_exists('get_user_avatar')) - { - include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); - } + $row = array( + 'avatar' => $user['user_avatar'], + 'avatar_type' => $user['user_avatar_type'], + 'avatar_width' => $user['user_avatar_width'], + 'avatar_height' => $user['user_avatar_height'], + ); - return get_user_avatar($user['user_avatar'], $user['user_avatar_type'], $user['user_avatar_width'], $user['user_avatar_height']); + return phpbb_get_avatar($row, 'USER_AVATAR', false, $lazy); } /** @@ -208,7 +215,7 @@ class user_loader return ''; } - if (!function_exists('get_user_rank')) + if (!function_exists('phpbb_get_user_rank')) { include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); } @@ -219,7 +226,10 @@ class user_loader 'rank_img_src', ); - get_user_rank($user['user_rank'], (($user['user_id'] == ANONYMOUS) ? false : $user['user_posts']), $rank['rank_title'], $rank['rank_img'], $rank['rank_img_src']); + $user_rank_data = phpbb_get_user_rank($user, (($user['user_id'] == ANONYMOUS) ? false : $user['user_posts'])); + $rank['rank_title'] = $user_rank_data['title']; + $rank['rank_img'] = $user_rank_data['img']; + $rank['rank_img_src'] = $user_rank_data['img_src']; return $rank; } diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php new file mode 100644 index 0000000000..a1e66ba8fe --- /dev/null +++ b/phpBB/phpbb/version_helper.php @@ -0,0 +1,306 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** + * Class to handle version checking and comparison + */ +class version_helper +{ + /** + * @var string Host + */ + protected $host = 'version.phpbb.com'; + + /** + * @var string Path to file + */ + protected $path = '/phpbb'; + + /** + * @var string File name + */ + protected $file = 'versions.json'; + + /** + * @var bool Use SSL or not + */ + protected $use_ssl = false; + + /** + * @var string Current version installed + */ + protected $current_version; + + /** + * @var null|string Null to not force stability, 'unstable' or 'stable' to + * force the corresponding stability + */ + protected $force_stability; + + /** @var \phpbb\cache\service */ + protected $cache; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\file_downloader */ + protected $file_downloader; + + /** @var \phpbb\user */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\cache\service $cache + * @param \phpbb\config\config $config + * @param \phpbb\file_downloader $file_downloader + * @param \phpbb\user $user + */ + public function __construct(\phpbb\cache\service $cache, \phpbb\config\config $config, \phpbb\file_downloader $file_downloader, \phpbb\user $user) + { + $this->cache = $cache; + $this->config = $config; + $this->file_downloader = $file_downloader; + $this->user = $user; + + if (defined('PHPBB_QA')) + { + $this->force_stability = 'unstable'; + } + + $this->current_version = $this->config['version']; + } + + /** + * Set location to the file + * + * @param string $host Host (e.g. version.phpbb.com) + * @param string $path Path to file (e.g. /phpbb) + * @param string $file File name (Default: versions.json) + * @param bool $use_ssl Use SSL or not (Default: false) + * @return version_helper + */ + public function set_file_location($host, $path, $file = 'versions.json', $use_ssl = false) + { + $this->host = $host; + $this->path = $path; + $this->file = $file; + $this->use_ssl = $use_ssl; + + return $this; + } + + /** + * Set current version + * + * @param string $version The current version + * @return version_helper + */ + public function set_current_version($version) + { + $this->current_version = $version; + + return $this; + } + + /** + * Over-ride the stability to force check to include unstable versions + * + * @param null|string Null to not force stability, 'unstable' or 'stable' to + * force the corresponding stability + * @return version_helper + */ + public function force_stability($stability) + { + $this->force_stability = $stability; + + return $this; + } + + /** + * Wrapper for version_compare() that allows using uppercase A and B + * for alpha and beta releases. + * + * See http://www.php.net/manual/en/function.version-compare.php + * + * @param string $version1 First version number + * @param string $version2 Second version number + * @param string $operator Comparison operator (optional) + * + * @return mixed Boolean (true, false) if comparison operator is specified. + * Integer (-1, 0, 1) otherwise. + */ + public function compare($version1, $version2, $operator = null) + { + return phpbb_version_compare($version1, $version2, $operator); + } + + /** + * Check whether or not a version is "stable" + * + * Stable means only numbers OR a pl release + * + * @param string $version + * @return bool Bool true or false + */ + public function is_stable($version) + { + $matches = false; + preg_match('/^[\d\.]+/', $version, $matches); + + if (empty($matches[0])) + { + return false; + } + + return $this->compare($version, $matches[0], '>='); + } + + /** + * Gets the latest version for the current branch the user is on + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string + * @throws \RuntimeException + */ + public function get_latest_on_current_branch($force_update = false, $force_cache = false) + { + $versions = $this->get_versions_matching_stability($force_update, $force_cache); + + $self = $this; + $current_version = $this->current_version; + + // Filter out any versions less than to the current version + $versions = array_filter($versions, function($data) use ($self, $current_version) { + return $self->compare($data['current'], $current_version, '>='); + }); + + // Get the lowest version from the previous list. + return array_reduce($versions, function($value, $data) use ($self) { + if ($value === null || $self->compare($data['current'], $value, '<')) + { + return $data['current']; + } + + return $value; + }); + } + + /** + * Obtains the latest version information + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string + * @throws \RuntimeException + */ + public function get_suggested_updates($force_update = false, $force_cache = false) + { + $versions = $this->get_versions_matching_stability($force_update, $force_cache); + + $self = $this; + $current_version = $this->current_version; + + // Filter out any versions less than or equal to the current version + return array_filter($versions, function($data) use ($self, $current_version) { + return $self->compare($data['current'], $current_version, '>'); + }); + } + + /** + * Obtains the latest version information matching the stability of the current install + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string Version info + * @throws \RuntimeException + */ + public function get_versions_matching_stability($force_update = false, $force_cache = false) + { + $info = $this->get_versions($force_update, $force_cache); + + if ($this->force_stability !== null) + { + return ($this->force_stability === 'unstable') ? $info['unstable'] : $info['stable']; + } + + return ($this->is_stable($this->current_version)) ? $info['stable'] : $info['unstable']; + } + + /** + * Obtains the latest version information + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string Version info, includes stable and unstable data + * @throws \RuntimeException + */ + public function get_versions($force_update = false, $force_cache = false) + { + $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file . $this->use_ssl; + + $info = $this->cache->get($cache_file); + + if ($info === false && $force_cache) + { + throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); + } + else if ($info === false || $force_update) + { + try { + $info = $this->file_downloader->get($this->host, $this->path, $this->file, $this->use_ssl ? 443 : 80); + } + catch (\phpbb\exception\runtime_exception $exception) + { + $prepare_parameters = array_merge(array($exception->getMessage()), $exception->get_parameters()); + throw new \RuntimeException(call_user_func_array(array($this->user, 'lang'), $prepare_parameters)); + } + $error_string = $this->file_downloader->get_error_string(); + + if (!empty($error_string)) + { + throw new \RuntimeException($error_string); + } + + $info = json_decode($info, true); + + // Sanitize any data we retrieve from a server + if (!empty($info)) + { + $json_sanitizer = function (&$value, $key) { + $type_cast_helper = new \phpbb\request\type_cast_helper(); + $type_cast_helper->set_var($value, $value, gettype($value), true); + }; + array_walk_recursive($info, $json_sanitizer); + } + + if (empty($info['stable']) && empty($info['unstable'])) + { + $this->user->add_lang('acp/common'); + + throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); + } + + $info['stable'] = (empty($info['stable'])) ? array() : $info['stable']; + $info['unstable'] = (empty($info['unstable'])) ? $info['stable'] : $info['unstable']; + + $this->cache->put($cache_file, $info, 86400); // 24 hours + } + + return $info; + } +} diff --git a/phpBB/phpbb/viewonline_helper.php b/phpBB/phpbb/viewonline_helper.php new file mode 100644 index 0000000000..89915f2228 --- /dev/null +++ b/phpBB/phpbb/viewonline_helper.php @@ -0,0 +1,54 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* Class to handle viewonline related tasks +*/ +class viewonline_helper +{ + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB's filesystem service + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem) + { + $this->filesystem = $filesystem; + } + + /** + * Get user page + * + * @param string $session_page User's session page + * @return array Match array filled by preg_match() + */ + public function get_user_page($session_page) + { + $session_page = $this->filesystem->clean_path($session_page); + if (strpos($session_page, './') === 0) + { + $session_page = substr($session_page, 2); + } + + preg_match('#^((\.\./)*([a-z0-9/_-]+))#i', $session_page, $on_page); + if (empty($on_page)) + { + $on_page[1] = ''; + } + + return $on_page; + } +} diff --git a/phpBB/posting.php b/phpBB/posting.php index 442e1d9782..3174626f6b 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -25,13 +29,12 @@ $auth->acl($user->data); // Grab only parameters needed here -$post_id = request_var('p', 0); -$topic_id = request_var('t', 0); -$forum_id = request_var('f', 0); -$draft_id = request_var('d', 0); -$lastclick = request_var('lastclick', 0); +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$forum_id = $request->variable('f', 0); +$draft_id = $request->variable('d', 0); +$lastclick = $request->variable('lastclick', 0); -$submit = (isset($_POST['post'])) ? true : false; $preview = (isset($_POST['preview'])) ? true : false; $save = (isset($_POST['save'])) ? true : false; $load = (isset($_POST['load'])) ? true : false; @@ -39,7 +42,8 @@ $confirm = $request->is_set_post('confirm'); $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; $refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview); -$mode = request_var('mode', ''); +$submit = $request->is_set_post('post') && !$refresh && !$preview; +$mode = $request->variable('mode', ''); // If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here. if ($mode == 'delete' && (($confirm && !$request->is_set_post('delete_permanent')) || !$auth->acl_gets('f_delete', 'm_delete', $forum_id))) @@ -52,7 +56,7 @@ $current_time = time(); /** * This event allows you to alter the above parameters, such as submit and mode -* +* * Note: $refresh must be true to retain previously submitted form data. * * Note: The template class will not work properly until $user->setup() is @@ -69,20 +73,34 @@ $current_time = time(); * @var bool preview Whether or not the post is being previewed * @var bool save Whether or not a draft is being saved * @var bool load Whether or not a draft is being loaded -* @var bool delete Whether or not the post is being deleted * @var bool cancel Whether or not to cancel the form (returns to * viewtopic or viewforum depending on if the user * is posting a new topic or editing a post) * @var bool refresh Whether or not to retain previously submitted data -* @var string mode What action to take if the form has been sumitted +* @var string mode What action to take if the form has been submitted * post|reply|quote|edit|delete|bump|smilies|popup * @var array error Any error strings; a non-empty array aborts * form submission. * NOTE: Should be actual language strings, NOT * language keys. -* @since 3.1-A1 +* @since 3.1.0-a1 +* @change 3.1.2-RC1 Removed 'delete' var as it does not exist */ -$vars = array('post_id', 'topic_id', 'forum_id', 'draft_id', 'lastclick', 'submit', 'preview', 'save', 'load', 'delete', 'cancel', 'refresh', 'mode', 'error'); +$vars = array( + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'lastclick', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'mode', + 'error', +); extract($phpbb_dispatcher->trigger_event('core.modify_posting_parameters', compact($vars))); // Was cancel pressed? If so then redirect to the appropriate page @@ -98,6 +116,7 @@ if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$foru trigger_error('NO_FORUM'); } +/* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // We need to know some basic information in all cases before we do anything. @@ -176,7 +195,7 @@ switch ($mode) } else { - upload_popup(); + phpbb_upload_popup(); return; } break; @@ -214,7 +233,7 @@ if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'b if ($mode == 'popup') { - upload_popup($post_data['forum_style']); + phpbb_upload_popup($post_data['forum_style']); return; } @@ -222,8 +241,7 @@ $user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); if ($config['enable_post_confirm'] && !$user->data['is_registered']) { - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_POST); } @@ -313,20 +331,65 @@ switch ($mode) { $is_authed = true; } - break; + + // no break; case 'soft_delete': - if ($user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked'])) + if (!$is_authed && $user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked'])) { + // Fall back to soft_delete if we have no permissions to delete posts but to soft delete them $is_authed = true; + $mode = 'soft_delete'; } - else + else if (!$is_authed) { // Display the same error message for softdelete we use for delete $mode = 'delete'; } break; } +/** +* This event allows you to do extra auth checks and verify if the user +* has the required permissions +* +* Extensions should only change the error and is_authed variables. +* +* @event core.modify_posting_auth +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var int lastclick Timestamp of when the form was last loaded +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool refresh Whether or not to retain previously submitted data +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @var bool is_authed Does the user have the required permissions? +* @since 3.1.3-RC1 +*/ +$vars = array( + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'lastclick', + 'submit', + 'preview', + 'save', + 'load', + 'refresh', + 'mode', + 'error', + 'is_authed', +); +extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars))); if (!$is_authed) { @@ -366,19 +429,46 @@ if (($post_data['forum_status'] == ITEM_LOCKED || (isset($post_data['topic_statu // else it depends on editing times, lock status and if we're the correct user if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) { - if ($user->data['user_id'] != $post_data['poster_id']) - { - trigger_error('USER_CANNOT_EDIT'); - } - - if (!($post_data['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) - { - trigger_error('CANNOT_EDIT_TIME'); - } + $force_edit_allowed = false; + + $s_cannot_edit = $user->data['user_id'] != $post_data['poster_id']; + $s_cannot_edit_time = $config['edit_time'] && $post_data['post_time'] <= time() - ($config['edit_time'] * 60); + $s_cannot_edit_locked = $post_data['post_edit_locked']; + + /** + * This event allows you to modify the conditions for the "cannot edit post" checks + * + * @event core.posting_modify_cannot_edit_conditions + * @var array post_data Array with post data + * @var bool force_edit_allowed Allow the user to edit the post (all permissions and conditions are ignored) + * @var bool s_cannot_edit User can not edit the post because it's not his + * @var bool s_cannot_edit_locked User can not edit the post because it's locked + * @var bool s_cannot_edit_time User can not edit the post because edit_time has passed + * @since 3.1.0-b4 + */ + $vars = array( + 'post_data', + 'force_edit_allowed', + 's_cannot_edit', + 's_cannot_edit_locked', + 's_cannot_edit_time', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_cannot_edit_conditions', compact($vars))); - if ($post_data['post_edit_locked']) + if (!$force_edit_allowed) { - trigger_error('CANNOT_EDIT_POST_LOCKED'); + if ($s_cannot_edit) + { + trigger_error('USER_CANNOT_EDIT'); + } + else if ($s_cannot_edit_time) + { + trigger_error('CANNOT_EDIT_TIME'); + } + else if ($s_cannot_edit_locked) + { + trigger_error('CANNOT_EDIT_POST_LOCKED'); + } } } @@ -391,9 +481,8 @@ if ($mode == 'delete' || $mode == 'soft_delete') trigger_error('NO_POST'); } - $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id)); - $soft_delete_reason = ($mode == 'soft_delete' && $allow_reason) ? $request->variable('delete_reason', '', true) : ''; - handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $soft_delete_reason); + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $delete_reason); return; } @@ -401,7 +490,7 @@ if ($mode == 'delete' || $mode == 'soft_delete') if ($mode == 'bump') { if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id']) - && check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}")) + && check_link_hash($request->variable('hash', ''), "topic_{$post_data['topic_id']}")) { $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); meta_refresh(3, $meta_url); @@ -476,7 +565,11 @@ if ($mode == 'edit') $orig_poll_options_size = sizeof($post_data['poll_options']); $message_parser = new parse_message(); +/* @var $plupload \phpbb\plupload\plupload */ $plupload = $phpbb_container->get('plupload'); + +/* @var $mimetype_guesser \phpbb\mimetype\guesser */ +$mimetype_guesser = $phpbb_container->get('mimetype.guesser'); $message_parser->set_plupload($plupload); if (isset($post_data['post_text'])) @@ -534,6 +627,11 @@ if ($mode != 'edit') $post_data['enable_urls'] = true; } +if ($mode == 'post') +{ + $post_data['topic_status'] = ($request->is_set_post('lock_topic') && $auth->acl_gets('m_lock', 'f_user_lock', $forum_id)) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + $post_data['enable_magic_url'] = $post_data['drafts'] = false; // User own some drafts? @@ -585,9 +683,9 @@ $quote_status = true; // Save Draft if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) { - $subject = utf8_normalize_nfc(request_var('subject', '', true)); + $subject = $request->variable('subject', '', true); $subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject; - $message = utf8_normalize_nfc(request_var('message', '', true)); + $message = $request->variable('message', '', true); if ($subject && $message) { @@ -657,11 +755,11 @@ if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ( if (is_bool($default)) { // Use the string representation - $hidden_fields[$name] = request_var($name, ''); + $hidden_fields[$name] = $request->variable($name, ''); } else { - $hidden_fields[$name] = request_var($name, $default); + $hidden_fields[$name] = $request->variable($name, $default); } } @@ -718,20 +816,20 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_ if ($submit || $preview || $refresh) { - $post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0); - $post_data['post_subject'] = utf8_normalize_nfc(request_var('subject', '', true)); - $message_parser->message = utf8_normalize_nfc(request_var('message', '', true)); + $post_data['topic_cur_post_id'] = $request->variable('topic_cur_post_id', 0); + $post_data['post_subject'] = $request->variable('subject', '', true); + $message_parser->message = $request->variable('message', '', true); - $post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true)); - $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : ''; + $post_data['username'] = $request->variable('username', $post_data['username'], true); + $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? $request->variable('edit_reason', '', true) : ''; $post_data['orig_topic_type'] = $post_data['topic_type']; - $post_data['topic_type'] = request_var('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL)); - $post_data['topic_time_limit'] = request_var('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0)); + $post_data['topic_type'] = $request->variable('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL)); + $post_data['topic_time_limit'] = $request->variable('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0)); if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id)) { - $post_data['icon_id'] = request_var('icon', (int) $post_data['icon_id']); + $post_data['icon_id'] = $request->variable('icon', (int) $post_data['icon_id']); } $post_data['enable_bbcode'] = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true; @@ -796,10 +894,10 @@ if ($submit || $preview || $refresh) } else { - $post_data['poll_title'] = utf8_normalize_nfc(request_var('poll_title', '', true)); - $post_data['poll_length'] = request_var('poll_length', 0); - $post_data['poll_option_text'] = utf8_normalize_nfc(request_var('poll_option_text', '', true)); - $post_data['poll_max_options'] = request_var('poll_max_options', 1); + $post_data['poll_title'] = $request->variable('poll_title', '', true); + $post_data['poll_length'] = $request->variable('poll_length', 0); + $post_data['poll_option_text'] = $request->variable('poll_option_text', '', true); + $post_data['poll_max_options'] = $request->variable('poll_max_options', 1); $post_data['poll_vote_change'] = ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0; } @@ -824,6 +922,43 @@ if ($submit || $preview || $refresh) // Parse Attachments - before checksum is calculated $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh); + /** + * This event allows you to modify message text before parsing + * + * @event core.posting_modify_message_text + * @var array post_data Array with post data + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var bool preview Whether or not the post is being previewed + * @var bool save Whether or not a draft is being saved + * @var bool load Whether or not a draft is being loaded + * @var bool cancel Whether or not to cancel the form (returns to + * viewtopic or viewforum depending on if the user + * is posting a new topic or editing a post) + * @var bool refresh Whether or not to retain previously submitted data + * @var object message_parser The message parser object + * @since 3.1.2-RC1 + */ + $vars = array( + 'post_data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'message_parser', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars))); + // Grab md5 'checksum' of new message $message_md5 = md5($message_parser->message); @@ -831,8 +966,8 @@ if ($submit || $preview || $refresh) // Notify and show user the changed post if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) { - $edit_post_message_checksum = request_var('edit_post_message_checksum', ''); - $edit_post_subject_checksum = request_var('edit_post_subject_checksum', ''); + $edit_post_message_checksum = $request->variable('edit_post_message_checksum', ''); + $edit_post_subject_checksum = $request->variable('edit_post_subject_checksum', ''); // $post_data['post_checksum'] is the checksum of the post submitted in the meantime // $message_md5 is the checksum of the post we're about to submit @@ -879,10 +1014,13 @@ if ($submit || $preview || $refresh) $message_parser->warn_msg = array(); } - $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); + if (!$preview || !empty($message_parser->message)) + { + $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); + } // On a refresh we do not care about message parsing errors - if (sizeof($message_parser->warn_msg) && $refresh) + if (sizeof($message_parser->warn_msg) && $refresh && !$preview) { $message_parser->warn_msg = array(); } @@ -892,7 +1030,8 @@ if ($submit || $preview || $refresh) $message_parser->bbcode_bitfield = $post_data['bbcode_bitfield']; } - if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('f_ignoreflood', $forum_id)) + $ignore_flood = $auth->acl_get('u_ignoreflood') ? true : $auth->acl_get('f_ignoreflood', $forum_id); + if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$ignore_flood) { // Flood check $last_post_time = 0; @@ -943,9 +1082,9 @@ if ($submit || $preview || $refresh) if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) { $captcha_data = array( - 'message' => utf8_normalize_nfc(request_var('message', '', true)), - 'subject' => utf8_normalize_nfc(request_var('subject', '', true)), - 'username' => utf8_normalize_nfc(request_var('username', '', true)), + 'message' => $request->variable('message', '', true), + 'subject' => $request->variable('subject', '', true), + 'username' => $request->variable('username', '', true), ); $vc_response = $captcha->validate($captcha_data); if ($vc_response) @@ -979,6 +1118,14 @@ if ($submit || $preview || $refresh) $error[] = $user->lang['EMPTY_SUBJECT']; } + // Check for out-of-bounds characters that are currently + // not supported by utf8_bin in MySQL + if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches)) + { + $character_list = implode('<br />', $matches[0]); + $error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list); + } + $post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0; if ($post_data['poll_option_text'] && @@ -1055,6 +1202,9 @@ if ($submit || $preview || $refresh) switch ($post_data['topic_type']) { case POST_GLOBAL: + $auth_option = 'f_announce_global'; + break; + case POST_ANNOUNCE: $auth_option = 'f_announce'; break; @@ -1068,7 +1218,7 @@ if ($submit || $preview || $refresh) break; } - if (!$auth->acl_get($auth_option, $forum_id)) + if ($auth_option != '' && !$auth->acl_get($auth_option, $forum_id)) { // There is a special case where a user edits his post whereby the topic type got changed by an admin/mod. // Another case would be a mod not having sticky permissions for example but edit permissions. @@ -1098,6 +1248,36 @@ if ($submit || $preview || $refresh) } } + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submission_errors + * @var array post_data Array with post data + * @var array poll Array with poll data from post (must be used instead of the post_data equivalent) + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var array error Any error strings; a non-empty array aborts form submission. + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @change 3.1.5-RC1 Added poll array to the event + * @change 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars))); + // Store message, sync counters if (!sizeof($error) && $submit) { @@ -1126,7 +1306,11 @@ if ($submit || $preview || $refresh) $user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : ''; - add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), $post_data['topic_title']); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'] + )); } // Lock/Unlock Post Edit @@ -1156,7 +1340,6 @@ if ($submit || $preview || $refresh) 'enable_urls' => (bool) $post_data['enable_urls'], 'enable_indexing' => (bool) $post_data['enable_indexing'], 'message_md5' => (string) $message_md5, - 'post_time' => (isset($post_data['post_time'])) ? (int) $post_data['post_time'] : $current_time, 'post_checksum' => (isset($post_data['post_checksum'])) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], 'post_edit_user' => ($mode == 'edit') ? $user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0), @@ -1171,6 +1354,7 @@ if ($submit || $preview || $refresh) 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, + 'topic_status' => $post_data['topic_status'], 'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false, 'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false, @@ -1189,9 +1373,79 @@ if ($submit || $preview || $refresh) // post's poster, not the poster of the current post). See: PHPBB3-11769 for more information. $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username'] !== '') ? $post_data['username'] : ''; + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submit_post_before + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_before', compact($vars))); + // The last parameter tells submit_post if search indexer has to be run $redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); + /** + * This event allows you to define errors after the post action is performed + * + * @event core.posting_modify_submit_post_after + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * @var string redirect_url URL the user is going to be redirected to + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + 'redirect_url', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_after', compact($vars))); + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === true) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { $captcha->reset(); @@ -1200,9 +1454,8 @@ if ($submit || $preview || $refresh) // Handle delete mode... if ($request->is_set_post('delete') || $request->is_set_post('delete_permanent')) { - $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id)); - $soft_delete_reason = (!$request->is_set_post('delete_permanent') && $allow_reason) ? $request->variable('delete_reason', '', true) : ''; - handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $soft_delete_reason); + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $delete_reason); return; } @@ -1213,17 +1466,11 @@ if ($submit || $preview || $refresh) meta_refresh(10, $redirect_url); $message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD']; $message .= (($user->data['user_id'] == ANONYMOUS) ? '' : ' '. $user->lang['POST_APPROVAL_NOTIFY']); - } - else - { - meta_refresh(3, $redirect_url); - - $message = ($mode == 'edit') ? 'POST_EDITED' : 'POST_STORED'; - $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $redirect_url . '">', '</a>'); + $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $data['forum_id']) . '">', '</a>'); + trigger_error($message); } - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $data['forum_id']) . '">', '</a>'); - trigger_error($message); + redirect($redirect_url); } } } @@ -1242,14 +1489,11 @@ if (!sizeof($error) && $preview) // Signature if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) { - $parse_sig = new parse_message($preview_signature); - $parse_sig->bbcode_uid = $preview_signature_uid; - $parse_sig->bbcode_bitfield = $preview_signature_bitfield; - - // Not sure about parameters for bbcode/smilies/urls... in signatures - $parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']); - $preview_signature = $parse_sig->message; - unset($parse_sig); + $flags = ($config['allow_sig_bbcode']) ? OPTION_FLAG_BBCODE : 0; + $flags |= ($config['allow_sig_links']) ? OPTION_FLAG_LINKS : 0; + $flags |= ($config['allow_sig_smilies']) ? OPTION_FLAG_SMILIES : 0; + + $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $flags, false); } else { @@ -1283,9 +1527,13 @@ if (!sizeof($error) && $preview) 'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', (int) $post_data['poll_max_options']), )); - $parse_poll->message = implode("\n", $post_data['poll_options']); - $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']); - $preview_poll_options = explode('<br />', $parse_poll->message); + $preview_poll_options = array(); + foreach ($post_data['poll_options'] as $poll_option) + { + $parse_poll->message = $poll_option; + $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']); + $preview_poll_options[] = $parse_poll->message; + } unset($parse_poll); foreach ($preview_poll_options as $key => $option) @@ -1329,15 +1577,34 @@ if (!sizeof($error) && $preview) } } +// Remove quotes that would become nested too deep before decoding the text +$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh); +if ($generate_quote && $config['max_quote_depth'] > 0) +{ + $tmp_bbcode_uid = $message_parser->bbcode_uid; + $message_parser->bbcode_uid = $post_data['bbcode_uid']; + $message_parser->remove_nested_quotes($config['max_quote_depth'] - 1); + $message_parser->bbcode_uid = $tmp_bbcode_uid; +} + // Decode text for message display $post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; $message_parser->decode_message($post_data['bbcode_uid']); -if ($mode == 'quote' && !$submit && !$preview && !$refresh) +if ($generate_quote) { if ($config['allow_bbcode']) { - $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; + $message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote( + censor_text($message_parser->message), + array( + 'author' => $post_data['quote_username'], + 'post_id' => $post_data['post_id'], + 'time' => $post_data['post_time'], + 'user_id' => $post_data['poster_id'], + ) + ); + $message_parser->message .= "\n\n"; } else { @@ -1459,7 +1726,7 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($c $s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : ''; $s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_time . '" />'; -$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', $draft_id) . '" />' : ''; +$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . $request->variable('draft_loaded', $draft_id) . '" />' : ''; if ($mode == 'edit') { @@ -1478,13 +1745,14 @@ if (isset($captcha) && $captcha->is_solved() !== false) $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; add_form_key('posting'); +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); -// Start assigning vars for main posting page ... -$template->assign_vars(array( +// Build array of variables for main posting page +$page_data = array( 'L_POST_A' => $page_title, 'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'], 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), - 'L_TOO_MANY_ATTACHMENTS' => $user->lang('TOO_MANY_ATTACHMENTS', (int) $config['max_attachments']), 'FORUM_NAME' => $post_data['forum_name'], 'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', @@ -1493,7 +1761,7 @@ $template->assign_vars(array( 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], - 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], @@ -1503,13 +1771,12 @@ $template->assign_vars(array( 'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '', 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], - 'EDIT_REASON' => $request->variable('edit_reason', ''), + 'EDIT_REASON' => $request->variable('edit_reason', '', true), + 'SHOW_PANEL' => $request->variable('show_panel', ''), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), 'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '', 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"), 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup")), - 'ATTACH_ORDER' => ($config['display_order']) ? 'asc' : 'desc', - 'MAX_ATTACHMENTS' => ($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) ? 0 : (int) $config['max_attachments'], 'S_PRIVMSGS' => false, 'S_CLOSE_PROGRESS_WINDOW' => (isset($_POST['add_file'])) ? true : false, @@ -1526,12 +1793,11 @@ $template->assign_vars(array( 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', 'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true, 'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '', - 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, + 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote' || $mode == 'post') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', 'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '', - 'S_DELETE_REASON' => ($mode == 'edit' && $auth->acl_get('m_softdelete', $forum_id)) ? true : false, 'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false, 'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id), 'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false, @@ -1550,15 +1816,8 @@ $template->assign_vars(array( 'S_POST_ACTION' => $s_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), -)); - -/** -* This event allows you to modify template variables for the posting screen -* -* @event core.posting_modify_template_vars -* @since 3.1-A1 -*/ -$phpbb_dispatcher->dispatch('core.posting_modify_template_vars'); + 'S_IN_POSTING' => true, +); // Build custom bbcodes array display_custom_bbcodes(); @@ -1567,7 +1826,7 @@ display_custom_bbcodes(); if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/)) && $auth->acl_get('f_poll', $forum_id)) { - $template->assign_vars(array( + $page_data = array_merge($page_data, array( 'S_SHOW_POLL_BOX' => true, 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)), 'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), @@ -1579,23 +1838,95 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ 'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '', 'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '', 'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1, - 'POLL_LENGTH' => $post_data['poll_length']) + 'POLL_LENGTH' => $post_data['poll_length'], + ) ); } +/** +* This event allows you to modify template variables for the posting screen +* +* @event core.posting_modify_template_vars +* @var array post_data Array with post data +* @var array moderators Array with forum moderators +* @var string mode What action to take if the form is submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var string page_title Title of the mode page +* @var bool s_topic_icons Whether or not to show the topic icons +* @var string form_enctype If attachments are allowed for this form +* "multipart/form-data" or empty string +* @var string s_action The URL to submit the POST data to +* @var string s_hidden_fields Concatenated hidden input tags of posting form +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool cancel Whether or not to cancel the form (returns to +* viewtopic or viewforum depending on if the user +* is posting a new topic or editing a post) +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @var bool refresh Whether or not to retain previously submitted data +* @var array page_data Posting page data that should be passed to the +* posting page via $template->assign_vars() +* @var object message_parser The message parser object +* @since 3.1.0-a1 +* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, +* s_topic_icons, form_enctype, s_action, s_hidden_fields, +* post_id, topic_id, forum_id, submit, preview, save, load, +* delete, cancel, refresh, error, page_data, message_parser +* @change 3.1.2-RC1 Removed 'delete' var as it does not exist +* @change 3.1.5-RC1 Added poll variables to the page_data array +* @change 3.1.6-RC1 Added 'draft_id' var +*/ +$vars = array( + 'post_data', + 'moderators', + 'mode', + 'page_title', + 's_topic_icons', + 'form_enctype', + 's_action', + 's_hidden_fields', + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'error', + 'page_data', + 'message_parser', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', compact($vars))); + +// Start assigning vars for main posting page ... +$template->assign_vars($page_data); + // Show attachment box for adding attachments if true $allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype); if ($allowed) { - $plupload->configure($cache, $template, $s_action, $forum_id); + $max_files = ($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) ? 0 : (int) $config['max_attachments']; + $plupload->configure($cache, $template, $s_action, $forum_id, $max_files); } // Attachment entry posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); // Output page ... -page_header($page_title, false); +page_header($page_title); $template->set_filenames(array( 'body' => 'posting_body.html') @@ -1613,139 +1944,3 @@ if ($mode == 'reply' || $mode == 'quote') } page_footer(); - -/** -* Show upload popup (progress bar) -*/ -function upload_popup($forum_style = 0) -{ - global $template, $user; - - ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting'); - - page_header($user->lang['PROGRESS_BAR'], false); - - $template->set_filenames(array( - 'popup' => 'posting_progress_bar.html') - ); - - $template->assign_vars(array( - 'PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS'])) - ); - - $template->display('popup'); - - garbage_collection(); - exit_handler(); -} - -/** -* Do the various checks required for removing posts as well as removing it -*/ -function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '') -{ - global $user, $db, $auth, $config, $request; - global $phpbb_root_path, $phpEx; - - $perm_check = ($is_soft) ? 'softdelete' : 'delete'; - - // If moderator removing post or user itself removing post, present a confirmation screen - if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) - { - $s_hidden_fields = array( - 'p' => $post_id, - 'f' => $forum_id, - 'mode' => ($is_soft) ? 'soft_delete' : 'delete', - ); - - if (confirm_box(true)) - { - $data = array( - 'topic_first_post_id' => $post_data['topic_first_post_id'], - 'topic_last_post_id' => $post_data['topic_last_post_id'], - 'topic_posts_approved' => $post_data['topic_posts_approved'], - 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'], - 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'], - 'topic_visibility' => $post_data['topic_visibility'], - 'topic_type' => $post_data['topic_type'], - 'post_visibility' => $post_data['post_visibility'], - 'post_reported' => $post_data['post_reported'], - 'post_time' => $post_data['post_time'], - 'poster_id' => $post_data['poster_id'], - 'post_postcount' => $post_data['post_postcount'], - ); - - $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $soft_delete_reason); - $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username']; - - if ($next_post_id === false) - { - add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username); - - $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); - $message = $user->lang['POST_DELETED']; - } - else - { - add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username); - - $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; - $message = $user->lang['POST_DELETED']; - - if (!$request->is_ajax()) - { - $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $meta_info . '">', '</a>'); - } - } - - meta_refresh(3, $meta_info); - if (!$request->is_ajax()) - { - $message .= '<br /><br />' . $user->lang('RETURN_FORUM', '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>'); - } - trigger_error($message); - } - else - { - global $user, $template, $request; - - $can_delete = $auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id)); - $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id)); - $display_reason = $auth->acl_get('m_softdelete', $forum_id) || ($can_delete && $can_softdelete); - - $template->assign_vars(array( - 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED, - 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '', - 'S_ALLOWED_DELETE' => $can_delete, - 'S_ALLOWED_SOFTDELETE' => $can_softdelete, - 'S_DELETE_REASON' => $display_reason, - )); - - $l_confirm = 'DELETE_POST'; - if ($post_data['post_visibility'] == ITEM_DELETED) - { - $l_confirm .= '_PERMANENTLY'; - $s_hidden_fields['delete_permanent'] = '1'; - } - else if (!$can_softdelete) - { - $s_hidden_fields['delete_permanent'] = '1'; - } - - confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); - } - } - - // If we are here the user is not able to delete - present the correct error message - if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) - { - trigger_error('DELETE_OWN_POSTS'); - } - - if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) - { - trigger_error('CANNOT_DELETE_REPLIED'); - } - - trigger_error('USER_CANNOT_DELETE'); -} diff --git a/phpBB/report.php b/phpBB/report.php index 5081f90ad1..bb26b972aa 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -1,12 +1,18 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +use Symfony\Component\HttpFoundation\RedirectResponse; + /** * @ignore */ @@ -14,303 +20,22 @@ define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); -include($phpbb_root_path . 'includes/functions_display.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); -$user->setup('mcp'); - -$forum_id = request_var('f', 0); -$post_id = request_var('p', 0); -$pm_id = request_var('pm', 0); -$reason_id = request_var('reason_id', 0); -$report_text = utf8_normalize_nfc(request_var('report_text', '', true)); -$user_notify = ($user->data['is_registered']) ? request_var('notify', 0) : false; - -$submit = (isset($_POST['submit'])) ? true : false; - -if (!$post_id && (!$pm_id || !$config['allow_pm_report'])) -{ - trigger_error('NO_POST_SELECTED'); -} - -if ($post_id) -{ - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id"; - $return_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); - $pm_id = 0; -} -else -{ - $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&p=$pm_id"); - $return_forum_url = ''; - $post_id = 0; - $forum_id = 0; -} - -// Has the report been cancelled? -if (isset($_POST['cancel'])) -{ - redirect($redirect_url); -} - -if ($post_id) -{ - // Grab all relevant data - $sql = 'SELECT t.*, p.* - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE p.post_id = $post_id - AND p.topic_id = t.topic_id"; - $result = $db->sql_query($sql); - $report_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$report_data) - { - trigger_error('POST_NOT_EXIST'); - } - - $forum_id = (int) $report_data['forum_id']; - $topic_id = (int) $report_data['topic_id']; - $reported_post_text = $report_data['post_text']; - $reported_post_bitfield = $report_data['bbcode_bitfield']; - $reported_post_uid = $report_data['bbcode_uid']; - $reported_post_enable_bbcode = $report_data['enable_bbcode']; - $reported_post_enable_smilies = $report_data['enable_smilies']; - $reported_post_enable_magic_url = $report_data['enable_magic_url']; - - $sql = 'SELECT * - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $forum_id; - $result = $db->sql_query($sql); - $forum_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$forum_data) - { - trigger_error('FORUM_NOT_EXIST'); - } - - // Check required permissions - $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); - - foreach ($acl_check_ary as $acl => $error) - { - if (!$auth->acl_get($acl, $forum_id)) - { - trigger_error($error); - } - } - unset($acl_check_ary); - - if ($report_data['post_reported']) - { - $message = $user->lang['ALREADY_REPORTED']; - $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>'); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>'); - trigger_error($message); - } -} -else -{ - // Grab all relevant data - $sql = 'SELECT p.*, pt.* - FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . " pt - WHERE p.msg_id = $pm_id - AND p.msg_id = pt.msg_id - AND (p.author_id = " . $user->data['user_id'] . " OR pt.user_id = " . $user->data['user_id'] . ")"; - $result = $db->sql_query($sql); - $report_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$report_data) - { - $user->add_lang('ucp'); - trigger_error('NO_MESSAGE'); - } - - if ($report_data['message_reported']) - { - $message = $user->lang['ALREADY_REPORTED_PM']; - $message .= '<br /><br />' . sprintf($user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>'); - trigger_error($message); - } - - $reported_post_text = $report_data['message_text']; - $reported_post_bitfield = $report_data['bbcode_bitfield']; - $reported_post_uid = $report_data['bbcode_uid']; - $reported_post_enable_bbcode = $report_data['enable_bbcode']; - $reported_post_enable_smilies = $report_data['enable_smilies']; - $reported_post_enable_magic_url = $report_data['enable_magic_url']; -} - -if ($config['enable_post_confirm'] && !$user->data['is_registered']) -{ - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']); - $captcha->init(CONFIRM_REPORT); -} - -$error = array(); -$s_hidden_fields = ''; - -// Submit report? -if ($submit && $reason_id) -{ - if (isset($captcha)) - { - $visual_confirmation_response = $captcha->validate(); - if ($visual_confirmation_response) - { - $error[] = $visual_confirmation_response; - } - } - - $sql = 'SELECT * - FROM ' . REPORTS_REASONS_TABLE . " - WHERE reason_id = $reason_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other')) - { - $error[] = $user->lang('EMPTY_REPORT'); - } +$post_id = $request->variable('p', 0); +$pm_id = $request->variable('pm', 0); - if (!sizeof($error)) - { - if (isset($captcha)) - { - $captcha->reset(); - } +$redirect_route_name = ($pm_id === 0) ? 'phpbb_report_post_controller' : 'phpbb_report_pm_controller'; - $sql_ary = array( - 'reason_id' => (int) $reason_id, - 'post_id' => $post_id, - 'pm_id' => $pm_id, - 'user_id' => (int) $user->data['user_id'], - 'user_notify' => (int) $user_notify, - 'report_closed' => 0, - 'report_time' => (int) time(), - 'report_text' => (string) $report_text, - 'reported_post_text' => $reported_post_text, - 'reported_post_uid' => $reported_post_uid, - 'reported_post_bitfield' => $reported_post_bitfield, - 'reported_post_enable_bbcode' => $reported_post_enable_bbcode, - 'reported_post_enable_smilies' => $reported_post_enable_smilies, - 'reported_post_enable_magic_url' => $reported_post_enable_magic_url, - ); - - $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); - $report_id = $db->sql_nextid(); - - $phpbb_notifications = $phpbb_container->get('notification_manager'); - - if ($post_id) - { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_reported = 1 - WHERE post_id = ' . $post_id; - $db->sql_query($sql); - - if (!$report_data['topic_reported']) - { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_reported = 1 - WHERE topic_id = ' . $report_data['topic_id'] . ' - OR topic_moved_id = ' . $report_data['topic_id']; - $db->sql_query($sql); - } - - $lang_return = $user->lang['RETURN_TOPIC']; - $lang_success = $user->lang['POST_REPORTED_SUCCESS']; - - $phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data, array( - 'report_text' => $report_text, - ))); - } - else - { - $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' - SET message_reported = 1 - WHERE msg_id = ' . $pm_id; - $db->sql_query($sql); - - $sql_ary = array( - 'msg_id' => $pm_id, - 'user_id' => ANONYMOUS, - 'author_id' => (int) $report_data['author_id'], - 'pm_deleted' => 0, - 'pm_new' => 0, - 'pm_unread' => 0, - 'pm_replied' => 0, - 'pm_marked' => 0, - 'pm_forwarded' => 0, - 'folder_id' => PRIVMSGS_INBOX, - ); - - $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); - - $lang_return = $user->lang['RETURN_PM']; - $lang_success = $user->lang['PM_REPORTED_SUCCESS']; - - $phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array( - 'report_text' => $report_text, - 'from_user_id' => $report_data['author_id'], - 'report_id' => $report_id, - ))); - } - - meta_refresh(3, $redirect_url); - - $message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>'); - if ($return_forum_url) - { - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>'); - } - trigger_error($message); - } - else if (isset($captcha) && $captcha->is_solved() !== false) - { - $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); - } -} - -// Generate the reasons -display_reasons($reason_id); - -$page_title = ($pm_id) ? $user->lang['REPORT_MESSAGE'] : $user->lang['REPORT_POST']; - -if (isset($captcha) && $captcha->is_solved() === false) -{ - $template->assign_vars(array( - 'S_CONFIRM_CODE' => true, - 'CAPTCHA_TEMPLATE' => $captcha->get_template(), - )); -} - -$template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', - 'S_REPORT_POST' => ($pm_id) ? false : true, - 'REPORT_TEXT' => $report_text, - 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id . '&pm=' . $pm_id), - 'S_HIDDEN_FIELDS' => (sizeof($s_hidden_fields)) ? $s_hidden_fields : null, - - 'S_NOTIFY' => $user_notify, - 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false) +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); +$response = new RedirectResponse( + $controller_helper->route($redirect_route_name, array( + 'id' => ($pm_id === 0) ? $post_id : $pm_id, + )), + 301 ); - -generate_forum_nav($forum_data); - -// Start output of page -page_header($page_title); - -$template->set_filenames(array( - 'body' => 'report_body.html') -); - -page_footer(); +$response->send(); diff --git a/phpBB/search.php b/phpBB/search.php index 2d516502ed..d9e5d0557a 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,30 +25,30 @@ $auth->acl($user->data); $user->setup('search'); // Define initial vars -$mode = request_var('mode', ''); -$search_id = request_var('search_id', ''); -$start = max(request_var('start', 0), 0); -$post_id = request_var('p', 0); -$topic_id = request_var('t', 0); -$view = request_var('view', ''); - -$submit = request_var('submit', false); -$keywords = utf8_normalize_nfc(request_var('keywords', '', true)); -$add_keywords = utf8_normalize_nfc(request_var('add_keywords', '', true)); -$author = request_var('author', '', true); -$author_id = request_var('author_id', 0); -$show_results = ($topic_id) ? 'posts' : request_var('sr', 'posts'); +$mode = $request->variable('mode', ''); +$search_id = $request->variable('search_id', ''); +$start = max($request->variable('start', 0), 0); +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$view = $request->variable('view', ''); + +$submit = $request->variable('submit', false); +$keywords = $request->variable('keywords', '', true); +$add_keywords = $request->variable('add_keywords', '', true); +$author = $request->variable('author', '', true); +$author_id = $request->variable('author_id', 0); +$show_results = ($topic_id) ? 'posts' : $request->variable('sr', 'posts'); $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; -$search_terms = request_var('terms', 'all'); -$search_fields = request_var('sf', 'all'); -$search_child = request_var('sc', true); +$search_terms = $request->variable('terms', 'all'); +$search_fields = $request->variable('sf', 'all'); +$search_child = $request->variable('sc', true); -$sort_days = request_var('st', 0); -$sort_key = request_var('sk', 't'); -$sort_dir = request_var('sd', 'd'); +$sort_days = $request->variable('st', 0); +$sort_key = $request->variable('sk', 't'); +$sort_dir = $request->variable('sd', 'd'); -$return_chars = request_var('ch', ($topic_id) ? -1 : 300); -$search_forum = request_var('fid', array(0)); +$return_chars = $request->variable('ch', ($topic_id) ? -1 : 300); +$search_forum = $request->variable('fid', array(0)); // We put login boxes for the case if search_id is newposts, egosearch or unreadposts // because a guest should be able to log in even if guests search is not permitted @@ -97,7 +101,7 @@ if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$conf if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($config['limit_search_load']))) { $template->assign_var('S_NO_SEARCH', true); - trigger_error('NO_SEARCH_TIME'); + trigger_error('NO_SEARCH_LOAD'); } // It is applicable if the configuration setting is non-zero, and the user cannot @@ -108,7 +112,7 @@ if ($interval && !in_array($search_id, array('unreadposts', 'unanswered', 'activ if ($user->data['user_last_search'] > time() - $interval) { $template->assign_var('S_NO_SEARCH', true); - trigger_error('NO_SEARCH_TIME'); + trigger_error($user->lang('NO_SEARCH_TIME', (int) ($user->data['user_last_search'] + $interval - time()))); } } @@ -119,7 +123,10 @@ $sort_by_text = array('a' => $user->lang['SORT_AUTHOR'], 't' => $user->lang['SOR $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); +/* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +/* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); if ($keywords || $author || $author_id || $search_id || $submit) @@ -141,7 +148,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) trigger_error($user->lang('TOO_FEW_AUTHOR_CHARS', (int) $config['min_search_author_chars'])); } - $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; $sql = 'SELECT user_id FROM ' . USERS_TABLE . " @@ -155,7 +162,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } $db->sql_freeresult($result); - $sql_where = (strpos($author, '*') !== false) ? ' post_username ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " post_username = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + $sql_where = (strpos($author, '*') !== false) ? ' post_username ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " post_username = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; $sql = 'SELECT 1 as guest_post FROM ' . POSTS_TABLE . " @@ -168,7 +175,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($found_guest_post) { $author_id_ary[] = ANONYMOUS; - $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; } if (!sizeof($author_id_ary)) @@ -270,19 +277,18 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // We do some additional checks in the module to ensure it can actually be utilised $error = false; - $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); if ($error) { trigger_error($error); } - $common_words = $search->get_common_words(); - // let the search module split up the keywords if ($keywords) { $correct_query = $search->split_keywords($keywords, $search_terms); + $common_words = $search->get_common_words(); if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) { $ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '<br />' : ''; @@ -301,13 +307,33 @@ if ($keywords || $author || $author_id || $search_id || $submit) if (!$keywords && sizeof($author_id_ary)) { // if it is an author search we want to show topics by default - $show_results = ($topic_id) ? 'posts' : request_var('sr', ($search_id == 'egosearch') ? 'topics' : 'posts'); + $show_results = ($topic_id) ? 'posts' : $request->variable('sr', ($search_id == 'egosearch') ? 'topics' : 'posts'); $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; } // define some variables needed for retrieving post_id/topic_id information $sort_by_sql = array('a' => 'u.username_clean', 't' => (($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'), 'f' => 'f.forum_id', 'i' => 't.topic_title', 's' => (($show_results == 'posts') ? 'p.post_subject' : 't.topic_title')); + /** + * Event to modify the SQL parameters before pre-made searches + * + * @event core.search_modify_param_before + * @var string keywords String of the specified keywords + * @var array sort_by_sql Array of SQL sorting instructions + * @var array ex_fid_ary Array of excluded forum ids + * @var array author_id_ary Array of exclusive author ids + * @var string search_id The id of the search request + * @since 3.1.3-RC1 + */ + $vars = array( + 'keywords', + 'sort_by_sql', + 'ex_fid_ary', + 'author_id_ary', + 'search_id', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_param_before', compact($vars))); + // pre-made searches $sql = $field = $l_search_title = ''; if ($search_id) @@ -320,7 +346,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $show_results = 'topics'; $sort_key = 't'; $sort_dir = 'd'; - $sort_days = request_var('st', 7); + $sort_days = $request->variable('st', 7); $sort_by_sql['t'] = 't.topic_last_post_time'; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); @@ -340,7 +366,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) case 'unanswered': $l_search_title = $user->lang['SEARCH_UNANSWERED']; - $show_results = request_var('sr', 'topics'); + $show_results = $request->variable('sr', 'topics'); $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; $sort_by_sql['s'] = ($show_results == 'posts') ? 'p.post_subject' : 't.topic_title'; @@ -404,12 +430,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + $template->assign_var('U_MARK_ALL_READ', ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : ''); break; case 'newposts': $l_search_title = $user->lang['SEARCH_NEW']; // force sorting - $show_results = (request_var('sr', 'topics') == 'posts') ? 'posts' : 'topics'; + $show_results = ($request->variable('sr', 'topics') == 'posts') ? 'posts' : 'topics'; $sort_key = 't'; $sort_dir = 'd'; $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; @@ -460,6 +488,24 @@ if ($keywords || $author || $author_id || $search_id || $submit) } } + /** + * Event to modify data after pre-made searches + * + * @event core.search_modify_param_after + * @var string l_search_title The title of the search page + * @var string search_id Predefined search type name + * @var string show_results Display topics or posts + * @var string sql SQL query corresponding to the pre-made search id + * @since 3.1.7-RC1 + */ + $vars = array( + 'l_search_title', + 'search_id', + 'show_results', + 'sql', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_param_after', compact($vars))); + // show_results should not change after this $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page']; $total_match_count = 0; @@ -527,12 +573,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); } - // For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options. - if (!sizeof($id_ary) && !$search_id) - { - trigger_error('NO_SEARCH_RESULTS'); - } - $sql_where = ''; if (sizeof($id_ary)) @@ -556,20 +596,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) // Grab icons $icons = $cache->obtain_icons(); - // Output header - if ($found_more_search_matches) - { - $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); - } - else - { - $l_search_matches = $user->lang('FOUND_SEARCH_MATCHES', (int) $total_match_count); - } - // define some vars for urls - $hilit = implode('|', explode(' ', preg_replace('#\s+#u', ' ', str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)))); - // Do not allow *only* wildcard being used for hilight - $hilit = (strspn($hilit, '*') === strlen($hilit)) ? '' : $hilit; + // A single wildcard will make the search results look ugly + $hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)); + $hilit = str_replace(' ', '|', $hilit); $u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit))); $u_show_results = '&sr=' . $show_results; @@ -587,42 +617,19 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : ''; $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; - // Check if search backend supports phrase search or not - $phrase_search_disabled = ''; - if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) - { - $phrase_search_disabled = $search->supports_phrase_search() ? false : true; - } - - $pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); - - $template->assign_vars(array( - 'SEARCH_TITLE' => $l_search_title, - 'SEARCH_MATCHES' => $l_search_matches, - 'SEARCH_WORDS' => $keywords, - 'SEARCHED_QUERY' => $search->get_search_query(), - 'IGNORED_WORDS' => (sizeof($common_words)) ? implode(' ', $common_words) : '', - - 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, - - 'TOTAL_MATCHES' => $total_match_count, - 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, - - 'S_SELECT_SORT_DIR' => $s_sort_dir, - 'S_SELECT_SORT_KEY' => $s_sort_key, - 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_SEARCH_ACTION' => $u_search, - 'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true, - - 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), - 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - - 'U_SEARCH_WORDS' => $u_search, - )); + /** + * Event to add or modify search URL parameters + * + * @event core.search_modify_url_parameters + * @var string u_search Search URL parameters string + * @var string search_id Predefined search type name + * @since 3.1.7-RC1 + */ + $vars = array( + 'u_search', + 'search_id', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_url_parameters', compact($vars))); if ($sql_where) { @@ -641,12 +648,66 @@ if ($keywords || $author || $author_id || $search_id || $submit) } $db->sql_freeresult($result); - $sql = 'SELECT p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour - FROM ' . POSTS_TABLE . ' p - LEFT JOIN ' . TOPICS_TABLE . ' t ON (p.topic_id = t.topic_id) - LEFT JOIN ' . FORUMS_TABLE . ' f ON (p.forum_id = f.forum_id) - LEFT JOIN ' . USERS_TABLE . " u ON (p.poster_id = u.user_id) - WHERE $sql_where"; + $sql_array = array( + 'SELECT' => 'p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id', + ), + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ), + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'p.poster_id = u.user_id', + ), + ), + 'WHERE' => $sql_where, + 'ORDER_BY' => $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'), + ); + + /** + * Event to modify the SQL query before the posts data is retrieved + * + * @event core.search_get_posts_data + * @var array sql_array The SQL array + * @var array zebra Array of zebra data for the current user + * @var int total_match_count The total number of search matches + * @var string keywords String of the specified keywords + * @var array sort_by_sql Array of SQL sorting instructions + * @var string s_sort_dir The sort direction + * @var string s_sort_key The sort key + * @var string s_limit_days Limit the age of results + * @var array ex_fid_ary Array of excluded forum ids + * @var array author_id_ary Array of exclusive author ids + * @var string search_fields The data fields to search in + * @var int search_id The id of the search request + * @var int start The starting id of the results + * @since 3.1.0-b3 + */ + $vars = array( + 'sql_array', + 'zebra', + 'total_match_count', + 'keywords', + 'sort_by_sql', + 's_sort_dir', + 's_sort_key', + 's_limit_days', + 'ex_fid_ary', + 'author_id_ary', + 'search_fields', + 'search_id', + 'start', + ); + extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); } else { @@ -680,6 +741,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } + $sql_order_by = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + /** * Event to modify the SQL query before the topic data is retrieved * @@ -687,20 +750,36 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string sql_select The SQL SELECT string used by search to get topic data * @var string sql_from The SQL FROM string used by search to get topic data * @var string sql_where The SQL WHERE string used by search to get topic data - * @since 3.1-A1 + * @var int total_match_count The total number of search matches + * @var array sort_by_sql Array of SQL sorting instructions + * @var string sort_dir The sorting direction + * @var string sort_key The sorting key + * @var string sql_order_by The SQL ORDER BY string used by search to get topic data + * @since 3.1.0-a1 + * @changed 3.1.0-RC5 Added total_match_count + * @changed 3.1.7-RC1 Added sort_by_sql, sort_dir, sort_key, sql_order_by */ - $vars = array('sql_select', 'sql_from', 'sql_where'); + $vars = array( + 'sql_select', + 'sql_from', + 'sql_where', + 'total_match_count', + 'sort_by_sql', + 'sort_dir', + 'sort_key', + 'sql_order_by', + ); extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars))); $sql = "SELECT $sql_select FROM $sql_from - WHERE $sql_where"; + WHERE $sql_where + ORDER BY $sql_order_by"; } - $sql .= ' ORDER BY ' . $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); $result = $db->sql_query($sql); $result_topic_id = 0; - $rowset = array(); + $rowset = $attachments = $topic_tracking_info = array(); if ($show_results == 'topics') { @@ -771,7 +850,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } else { - $bbcode_bitfield = $text_only_message = ''; + $text_only_message = ''; $attach_list = array(); while ($row = $db->sql_fetchrow($result)) @@ -791,7 +870,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($return_chars == -1 || utf8_strlen($text_only_message) < ($return_chars + 3)) { $row['display_text_only'] = false; - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); // Does this post have an attachment? If so, add it to the list if ($row['post_attachment'] && $config['allow_attachments']) @@ -811,13 +889,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) unset($text_only_message); - // Instantiate BBCode if needed - if ($bbcode_bitfield !== '') - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode(base64_encode($bbcode_bitfield)); - } - // Pull attachment data if (sizeof($attach_list)) { @@ -856,12 +927,40 @@ if ($keywords || $author || $author_id || $search_id || $submit) $hilit_array = array_filter(explode('|', $hilit), 'strlen'); foreach ($hilit_array as $key => $value) { - $hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($value, '#')); + $hilit_array[$key] = phpbb_clean_search_string($value); + $hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($hilit_array[$key], '#')); $hilit_array[$key] = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $hilit_array[$key]); } $hilit = implode('|', $hilit_array); } + /** + * Modify the rowset data + * + * @event core.search_modify_rowset + * @var array attachments Array with posts attachments data + * @var string hilit String to highlight + * @var array rowset Array with the search results data + * @var string show_results String indicating the show results mode + * @var array topic_tracking_info Array with the topics tracking data + * @var string u_hilit Highlight string to be injected into URL + * @var string view Search results view mode + * @var array zebra Array with zebra data for the current user + * @since 3.1.0-b4 + * @changed 3.1.0-b5 Added var show_results + */ + $vars = array( + 'attachments', + 'hilit', + 'rowset', + 'show_results', + 'topic_tracking_info', + 'u_hilit', + 'view', + 'zebra', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_rowset', compact($vars))); + foreach ($rowset as $row) { $forum_id = $row['forum_id']; @@ -884,11 +983,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; - $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $forum_id)) ? true : false; $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; - $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&mode=deleted_topics&t=$result_topic_id", true, $user->session_id) : ''; + $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&mode=deleted_topics&t=$result_topic_id", true, $user->session_id) : $u_mcp_queue; $row['topic_title'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">$1</span>', $row['topic_title']); @@ -924,6 +1023,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_TOPIC_DELETED' => $topic_deleted, + 'S_HAS_POLL' => ($row['poll_start']) ? true : false, 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), @@ -1007,11 +1107,46 @@ if ($keywords || $author || $author_id || $search_id || $submit) * Modify the topic data before it is assigned to the template * * @event core.search_modify_tpl_ary - * @var array row Array with topic data - * @var array tpl_ary Template block array with topic data - * @since 3.1-A1 + * @var array row Array with topic data + * @var array tpl_ary Template block array with topic data + * @var string show_results Display topics or posts + * @var string topic_title Cleaned topic title + * @var int replies The number of topic replies + * @var string view_topic_url The URL to the topic + * @var string folder_img The folder image of the topic + * @var string folder_alt The alt attribute of the topic folder img + * @var int topic_type The topic type + * @var bool unread_topic Whether the topic has unread posts + * @var bool topic_unapproved Whether the topic is unapproved + * @var int posts_unapproved The number of unapproved posts + * @var bool topic_deleted Whether the topic has been deleted + * @var string u_mcp_queue The URL to the corresponding MCP queue page + * @var array zebra The zebra data of the current user + * @var array attachments All the attachments of the search results + * @since 3.1.0-a1 + * @changed 3.1.0-b3 Added vars show_results, topic_title, replies, + * view_topic_url, folder_img, folder_alt, topic_type, unread_topic, + * topic_unapproved, posts_unapproved, topic_deleted, u_mcp_queue, + * zebra, attachments */ - $vars = array('row', 'tpl_ary'); + $vars = array( + 'row', + 'tpl_ary', + 'show_results', + 'topic_title', + 'replies', + 'view_topic_url', + 'folder_img', + 'folder_alt', + 'topic_type', + 'unread_topic', + 'topic_unapproved', + 'posts_unapproved', + 'topic_deleted', + 'u_mcp_queue', + 'zebra', + 'attachments', + ); extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); $template->assign_block_vars('searchresults', $tpl_ary); @@ -1026,12 +1161,86 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $template->assign_vars(array( 'SEARCH_TOPIC' => $topic_title, + 'L_RETURN_TO_TOPIC' => $user->lang('RETURN_TO', $topic_title), 'U_SEARCH_TOPIC' => $view_topic_url )); } } unset($rowset); + // Output header + if ($found_more_search_matches) + { + $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); + } + else + { + $l_search_matches = $user->lang('FOUND_SEARCH_MATCHES', (int) $total_match_count); + } + + // Check if search backend supports phrase search or not + $phrase_search_disabled = ''; + if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) + { + $phrase_search_disabled = $search->supports_phrase_search() ? false : true; + } + + $pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); + + $template->assign_vars(array( + 'SEARCH_TITLE' => $l_search_title, + 'SEARCH_MATCHES' => $l_search_matches, + 'SEARCH_WORDS' => $keywords, + 'SEARCHED_QUERY' => $search->get_search_query(), + 'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '', + + 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, + + 'TOTAL_MATCHES' => $total_match_count, + 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, + + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_SEARCH_ACTION' => $u_search, + 'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true, + + 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), + 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + + 'U_SEARCH_WORDS' => $u_search, + )); + + /** + * Modify the title and/or load data for the search results page + * + * @event core.search_results_modify_search_title + * @var int author_id ID of the author to search by + * @var string l_search_title The title of the search page + * @var string search_id Predefined search type name + * @var string show_results Search results output mode - topics or posts + * @var int start The starting id of the results + * @var int total_match_count The count of search results + * @var string keywords The search keywords + * @since 3.1.0-RC4 + * @changed 3.1.6-RC1 Added total_match_count and keywords + */ + $vars = array( + 'author_id', + 'l_search_title', + 'search_id', + 'show_results', + 'start', + 'total_match_count', + 'keywords', + ); + extract($phpbb_dispatcher->trigger_event('core.search_results_modify_search_title', compact($vars))); + page_header(($l_search_title) ? $l_search_title : $user->lang['SEARCH']); $template->set_filenames(array( @@ -1141,7 +1350,7 @@ $s_characters .= '<option value="0">0</option>'; $s_characters .= '<option value="25">25</option>'; $s_characters .= '<option value="50">50</option>'; -for ($i = 100; $i <= 1000 ; $i += 100) +for ($i = 100; $i <= 1000; $i += 100) { $selected = ($i == 300) ? ' selected="selected"' : ''; $s_characters .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>'; @@ -1178,7 +1387,7 @@ $template->assign_vars(array( if ($auth->acl_get('a_search')) { // Handle large objects differently for Oracle and MSSQL - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'oracle': $sql = 'SELECT search_time, search_keywords diff --git a/phpBB/styles/all/template/feed.xml.twig b/phpBB/styles/all/template/feed.xml.twig new file mode 100644 index 0000000000..91467c62cd --- /dev/null +++ b/phpBB/styles/all/template/feed.xml.twig @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ FEED_LANG }}"> + <link rel="self" type="application/atom+xml" href="{{ SELF_LINK }}" /> + + {% if not FEED_TITLE is empty %}<title>{{ FEED_TITLE }}</title>{% endif %} + + {% if not FEED_SUBTITLE is empty %}<subtitle>{{ FEED_SUBTITLE }}</subtitle>{% endif %} + + {% if not FEED_LINK is empty %}<link href="{{ FEED_LINK }}" />{% endif %} + + <updated>{{ FEED_UPDATED }}</updated> + + <author><name><![CDATA[{{ FEED_AUTHOR }}]]></name></author> + <id>{{ SELF_LINK }}</id> + + {% for row in FEED_ROWS %} + <entry> + {% if not row.author is empty %}<author><name><![CDATA[{{ row.author }}]]></name></author>{% endif %} + + <updated>{% if not row.updated is empty %}{{ row.updated }} {% else %}{{ row.published }}{% endif %}</updated> + + {% if not row.published is empty %}<published>{{ row.published }}</published>{% endif %} + + <id>{{ row.link }}</id> + <link href="{{ row.link }}"/> + <title type="html"><![CDATA[{{ row.title }}]]></title> + + {% if not row.category is empty and row.category_name is defined and row.category_name != '' %} + <category term="{{ row.category_name }}" scheme="{{ row.category }}" label="{{ row.category_name }}"/> + {% endif %} + + <content type="html" xml:base="{{ row.link }}"><![CDATA[ +{{ row.description }}{% if not row.statistics is empty %}<p>{{ lang('STATISTICS') }}: {{ row.statistics }}</p>{% endif %}<hr /> +]]></content> + </entry> + {% endfor %} +</feed> diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 50755cdbe5..21951b7b0d 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -1,10 +1,13 @@ # # phpBB Style Configuration File # -# @package phpBB3 -# @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# This file is part of the phpBB Forum Software package. # +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. # # At the left is the name, please do not change this # At the right the value is entered @@ -17,9 +20,9 @@ # General Information about this style name = prosilver -copyright = © phpBB Group, 2007 -style_version = 3.1.0-a3 -phpbb_version = 3.1.0-a3 +copyright = © phpBB Limited, 2007 +style_version = 3.2.0-a2 +phpbb_version = 3.2.0-a2 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 1d70adc48d..aec6b0bbe6 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -1,26 +1,17 @@ +/* global phpbb */ + (function($) { // Avoid conflicts with other libraries -"use strict"; - -/** -* Close popup alert after a specified delay -* -* @param int Delay in ms until darkenwrapper's click event is triggered -*/ -phpbb.closeDarkenWrapper = function(delay) { - setTimeout(function() { - $('#darkenwrapper').trigger('click'); - }, delay); -}; +'use strict'; // This callback will mark all forum icons read phpbb.addAjaxCallback('mark_forums_read', function(res) { var readTitle = res.NO_UNREAD_POSTS; var unreadTitle = res.UNREAD_POSTS; var iconsArray = { - 'forum_unread': 'forum_read', - 'forum_unread_subforum': 'forum_read_subforum', - 'forum_unread_locked': 'forum_read_locked' + forum_unread: 'forum_read', + forum_unread_subforum: 'forum_read_subforum', + forum_unread_locked: 'forum_read_locked' }; $('li.row').find('dl[class*="forum_unread"]').each(function() { @@ -48,28 +39,28 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) { phpbb.closeDarkenWrapper(3000); }); -/** +/** * This callback will mark all topic icons read * -* @param update_topic_links bool Wether "Mark topics read" links should be -* updated. Defaults to true. +* @param {bool} [update_topic_links=true] Whether "Mark topics read" links +* should be updated. Defaults to true. */ -phpbb.addAjaxCallback('mark_topics_read', function(res, update_topic_links) { +phpbb.addAjaxCallback('mark_topics_read', function(res, updateTopicLinks) { var readTitle = res.NO_UNREAD_POSTS; var unreadTitle = res.UNREAD_POSTS; var iconsArray = { - 'global_unread': 'global_read', - 'announce_unread': 'announce_read', - 'sticky_unread': 'sticky_read', - 'topic_unread': 'topic_read' + global_unread: 'global_read', + announce_unread: 'announce_read', + sticky_unread: 'sticky_read', + topic_unread: 'topic_read' }; var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine']; - var unreadClassSelectors = ''; + var unreadClassSelectors; var classMap = {}; var classNames = []; - if (typeof update_topic_links === 'undefined') { - update_topic_links = true; + if (typeof updateTopicLinks === 'undefined') { + updateTopicLinks = true; } $.each(iconsArray, function(unreadClass, readClass) { @@ -96,10 +87,10 @@ phpbb.addAjaxCallback('mark_topics_read', function(res, update_topic_links) { }); // Remove link to first unread post - $('a').has('span.icon_topic_newest').remove(); + $('a.unread').has('.icon-red').remove(); // Update mark topics read links - if (update_topic_links) { + if (updateTopicLinks) { $('[data-ajax="mark_topics_read"]').attr('href', res.U_MARK_TOPICS); } @@ -125,36 +116,41 @@ phpbb.addAjaxCallback('notification.mark_read', function(res) { /** * Mark notification popup rows as read. * - * @param {jQuery} el jQuery object(s) to mark read. + * @param {jQuery} $popup jQuery object(s) to mark read. * @param {int} unreadCount The new unread notifications count. */ -phpbb.markNotifications = function(el, unreadCount) { +phpbb.markNotifications = function($popup, unreadCount) { // Remove the unread status. - el.removeClass('bg2'); - el.find('a.mark_read').remove(); + $popup.removeClass('bg2'); + $popup.find('a.mark_read').remove(); // Update the notification link to the real URL. - el.each(function() { + $popup.each(function() { var link = $(this).find('a'); link.attr('href', link.attr('data-real-url')); }); // Update the unread count. - $('#notification_list_button strong').html(unreadCount); + $('strong', '#notification_list_button').html(unreadCount); // Remove the Mark all read link if there are no unread notifications. if (!unreadCount) { $('#mark_all_notifications').remove(); } + + // Update page title + var $title = $('title'); + var originalTitle = $title.text().replace(/(\((\d+)\))/, ''); + $title.text((unreadCount ? '(' + unreadCount + ')' : '') + originalTitle); }; // This callback finds the post from the delete link, and removes it. phpbb.addAjaxCallback('post_delete', function() { - var el = $(this), + var $this = $(this), postId; - if (el.attr('data-refresh') === undefined) { - postId = el[0].href.split('&p=')[1]; - var post = el.parents('#p' + postId).css('pointer-events', 'none'); + if ($this.attr('data-refresh') === undefined) { + postId = $this[0].href.split('&p=')[1]; + var post = $this.parents('#p' + postId).css('pointer-events', 'none'); if (post.hasClass('bg1') || post.hasClass('bg2')) { var posts1 = post.nextAll('.bg1'); post.nextAll('.bg2').removeClass('bg2').addClass('bg1'); @@ -173,8 +169,7 @@ phpbb.addAjaxCallback('post_visibility', function(res) { $(this).remove(); }); - if (res.visible) - { + if (res.visible) { // Remove the "Deleted by" message from the post on restoring. remove.parents('.post').find('.post_deleted_msg').css('pointer-events', 'none').fadeOut(function() { $(this).remove(); @@ -205,17 +200,18 @@ phpbb.addAjaxCallback('vote_poll', function(res) { if (typeof res.success !== 'undefined') { var poll = $('.topic_poll'); var panel = poll.find('.panel'); - var results_visible = poll.find('dl:first-child .resultbar').is(':visible'); + var resultsVisible = poll.find('dl:first-child .resultbar').is(':visible'); + var mostVotes = 0; // Set min-height to prevent the page from jumping when the content changes - var update_panel_height = function (height) { - var height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height; + var updatePanelHeight = function (height) { + height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height; panel.css('min-height', height); }; - update_panel_height(); + updatePanelHeight(); // Remove the View results link - if (!results_visible) { + if (!resultsVisible) { poll.find('.poll_view_results').hide(500); } @@ -228,30 +224,49 @@ phpbb.addAjaxCallback('vote_poll', function(res) { poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500); } + // Get the votes count of the highest poll option + poll.find('[data-poll-option-id]').each(function() { + var option = $(this); + var optionId = option.attr('data-poll-option-id'); + mostVotes = (res.vote_counts[optionId] >= mostVotes) ? res.vote_counts[optionId] : mostVotes; + }); + // Update the total votes count poll.find('.poll_total_vote_cnt').html(res.total_votes); // Update each option poll.find('[data-poll-option-id]').each(function() { - var option = $(this); - var option_id = option.attr('data-poll-option-id'); - var voted = (typeof res.user_votes[option_id] !== 'undefined') ? true : false; - var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[option_id] / res.total_votes) * 100); - - option.toggleClass('voted', voted); + var $this = $(this); + var optionId = $this.attr('data-poll-option-id'); + var voted = (typeof res.user_votes[optionId] !== 'undefined'); + var mostVoted = (res.vote_counts[optionId] === mostVotes); + var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[optionId] / res.total_votes) * 100); + var percentRel = (mostVotes === 0) ? 0 : Math.round((res.vote_counts[optionId] / mostVotes) * 100); + var altText; + + altText = $this.attr('data-alt-text'); + if (voted) { + $this.attr('title', $.trim(altText)); + } else { + $this.attr('title', ''); + }; + $this.toggleClass('voted', voted); + $this.toggleClass('most-votes', mostVoted); // Update the bars - var bar = option.find('.resultbar div'); - var bar_time_lapse = (res.can_vote) ? 500 : 1500; - var new_bar_class = (percent == 100) ? 'pollbar5' : 'pollbar' + (Math.floor(percent / 20) + 1); + var bar = $this.find('.resultbar div'); + var barTimeLapse = (res.can_vote) ? 500 : 1500; + var newBarClass = (percent === 100) ? 'pollbar5' : 'pollbar' + (Math.floor(percent / 20) + 1); setTimeout(function () { - bar.animate({width: percent + '%'}, 500).removeClass('pollbar1 pollbar2 pollbar3 pollbar4 pollbar5').addClass(new_bar_class); - bar.html(res.vote_counts[option_id]); - - var percent_txt = (!percent) ? res.NO_VOTES : percent + '%'; - option.find('.poll_option_percent').html(percent_txt); - }, bar_time_lapse); + bar.animate({ width: percentRel + '%' }, 500) + .removeClass('pollbar1 pollbar2 pollbar3 pollbar4 pollbar5') + .addClass(newBarClass) + .html(res.vote_counts[optionId]); + + var percentText = percent ? percent + '%' : res.NO_VOTES; + $this.find('.poll_option_percent').html(percentText); + }, barTimeLapse); }); if (!res.can_vote) { @@ -259,30 +274,31 @@ phpbb.addAjaxCallback('vote_poll', function(res) { } // Display "Your vote has been cast." message. Disappears after 5 seconds. - var confirmation_delay = (res.can_vote) ? 300 : 900; - poll.find('.vote-submitted').delay(confirmation_delay).slideDown(200, function() { - if (results_visible) { - update_panel_height(); + var confirmationDelay = (res.can_vote) ? 300 : 900; + poll.find('.vote-submitted').delay(confirmationDelay).slideDown(200, function() { + if (resultsVisible) { + updatePanelHeight(); } $(this).delay(5000).fadeOut(500, function() { - resize_panel(300); + resizePanel(300); }); }); // Remove the gap resulting from removing options setTimeout(function() { - resize_panel(500); + resizePanel(500); }, 1500); - var resize_panel = function (time) { - var panel_height = panel.height(); - var inner_height = panel.find('.inner').outerHeight(); + var resizePanel = function (time) { + var panelHeight = panel.height(); + var innerHeight = panel.find('.inner').outerHeight(); - if (panel_height != inner_height) { - panel.css({'min-height': '', 'height': panel_height}).animate({height: inner_height}, time, function () { - panel.css({'min-height': inner_height, 'height': ''}); - }); + if (panelHeight !== innerHeight) { + panel.css({ minHeight: '', height: panelHeight }) + .animate({ height: innerHeight }, time, function () { + panel.css({ minHeight: innerHeight, height: '' }); + }); } }; } @@ -295,22 +311,25 @@ $('.poll_view_results a').click(function(e) { // Do not follow the link e.preventDefault(); - var poll = $(this).parents('.topic_poll'); + var $poll = $(this).parents('.topic_poll'); - poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500); - poll.find('.poll_view_results').hide(500); + $poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500); + $poll.find('.poll_view_results').hide(500); }); $('[data-ajax]').each(function() { - var $this = $(this), - ajax = $this.attr('data-ajax'), - fn; + var $this = $(this); + var ajax = $this.attr('data-ajax'); + var filter = $this.attr('data-filter'); if (ajax !== 'false') { - fn = (ajax !== 'true') ? ajax : null; + var fn = (ajax !== 'true') ? ajax : null; + filter = (filter !== undefined) ? phpbb.getFunctionByName(filter) : null; + phpbb.ajaxify({ selector: this, refresh: $this.attr('data-refresh') !== undefined, + filter: filter, callback: fn }); } @@ -335,49 +354,10 @@ $('.display_post').click(function(e) { // Do not follow the link e.preventDefault(); - var post_id = $(this).attr('data-post-id'); - $('#post_content' + post_id).show(); - $('#profile' + post_id).show(); - $('#post_hidden' + post_id).hide(); -}); - - - -/** - * This AJAXifies the quick-mod tools. The reason it cannot be a standard - * callback / data attribute is that it requires filtering - some of the options - * can be ajaxified, while others cannot. - */ -phpbb.ajaxify({ - selector: '#quickmodform', - refresh: true, - filter: function (data) { - var action = $('#quick-mod-select').val(); - - if (action === 'make_normal') { - return $(this).find('select option[value="make_global"]').length > 0; - } else if (action === 'lock' || action === 'unlock') { - return true; - } - - if (action === 'delete_topic' || action === 'make_sticky' || action === 'make_announce' || action === 'make_global') { - return true; - } - - return false; - } -}); - -$('#quick-mod-select').change(function () { - $('#quickmodform').submit(); -}); - -$('#delete_permanent').click(function () { - if ($(this).attr('checked')) { - $('#delete_reason').hide(); - } else { - $('#delete_reason').show(); - } + var postId = $(this).attr('data-post-id'); + $('#post_content' + postId).show(); + $('#profile' + postId).show(); + $('#post_hidden' + postId).hide(); }); /** @@ -388,10 +368,13 @@ $('#delete_permanent').click(function () { * appropriately changed based on the status of the search panel. */ $('#member_search').click(function () { - $('#memberlist_search').slideToggle('fast'); - phpbb.ajax_callbacks.alt_text.call(this); + var $memberlistSearch = $('#memberlist_search'); + + $memberlistSearch.slideToggle('fast'); + phpbb.ajaxCallbacks.alt_text.call(this); + // Focus on the username textbox if it's available and displayed - if ($('#memberlist_search').is(':visible')) { + if ($memberlistSearch.is(':visible')) { $('#username').focus(); } return false; @@ -400,9 +383,10 @@ $('#member_search').click(function () { /** * Automatically resize textarea */ -$(document).ready(function() { - phpbb.resizeTextArea($('textarea:not(#message-box textarea, .no-auto-resize)'), {minHeight: 75, maxHeight: 250}); - phpbb.resizeTextArea($('#message-box textarea')); +$(function() { + var $textarea = $('textarea:not(#message-box textarea, .no-auto-resize)'); + phpbb.resizeTextArea($textarea, { minHeight: 75, maxHeight: 250 }); + phpbb.resizeTextArea($('textarea', '#message-box')); }); diff --git a/phpBB/styles/prosilver/template/attachment.html b/phpBB/styles/prosilver/template/attachment.html index 4c0a326f1e..0978d9189e 100644 --- a/phpBB/styles/prosilver/template/attachment.html +++ b/phpBB/styles/prosilver/template/attachment.html @@ -1,20 +1,21 @@ +<!-- EVENT attachment_file_before --> <!-- BEGIN _file --> <!-- IF _file.S_DENIED --> <p>[{_file.DENIED_MESSAGE}]</p> <!-- ELSE --> + <!-- EVENT attachment_file_prepend --> <!-- IF _file.S_THUMBNAIL --> <dl class="thumbnail"> - <dt><a href="{_file.U_DOWNLOAD_LINK}"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" title="{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}" /></a></dt> + <dt><a href="{_file.U_DOWNLOAD_LINK}"><img src="{_file.THUMB_IMAGE}" class="postimage" alt="{_file.DOWNLOAD_NAME}" title="{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}" /></a></dt> <!-- IF _file.COMMENT --><dd> {_file.COMMENT}</dd><!-- ENDIF --> </dl> <!-- ENDIF --> - <!-- IF _file.S_IMAGE --> <dl class="file"> - <dt class="attach-image"><img src="{_file.U_INLINE_LINK}" alt="{_file.DOWNLOAD_NAME}" onclick="viewableArea(this);" /></dt> + <dt class="attach-image"><img src="{_file.U_INLINE_LINK}" class="postimage" alt="{_file.DOWNLOAD_NAME}" onclick="viewableArea(this);" /></dt> <!-- IF _file.COMMENT --><dd><em>{_file.COMMENT}</em></dd><!-- ENDIF --> <dd>{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}</dd> </dl> @@ -28,38 +29,7 @@ </dl> <!-- ENDIF --> - - - <!-- IF _file.S_WM_FILE --> - <!-- method used here from http://alistapart.com/articles/byebyeembed / autosizing seems to not work always, this will not fix --> - <object width="320" height="285" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="wmstream_{_file.ATTACH_ID}"> - <param name="url" value="{_file.U_DOWNLOAD_LINK}" /> - <param name="showcontrols" value="1" /> - <param name="showdisplay" value="0" /> - <param name="showstatusbar" value="0" /> - <param name="autosize" value="1" /> - <param name="autostart" value="0" /> - <param name="visible" value="1" /> - <param name="animationstart" value="0" /> - <param name="loop" value="0" /> - <param name="src" value="{_file.U_DOWNLOAD_LINK}" /> - <!--[if !IE]>--> - <object width="320" height="285" type="video/x-ms-wmv" data="{_file.U_DOWNLOAD_LINK}"> - <param name="src" value="{_file.U_DOWNLOAD_LINK}" /> - <param name="controller" value="1" /> - <param name="showcontrols" value="1" /> - <param name="showdisplay" value="0" /> - <param name="showstatusbar" value="0" /> - <param name="autosize" value="1" /> - <param name="autostart" value="0" /> - <param name="visible" value="1" /> - <param name="animationstart" value="0" /> - <param name="loop" value="0" /> - </object> - <!--<![endif]--> - </object> - - <!-- ELSEIF _file.S_FLASH_FILE --> + <!-- IF _file.S_FLASH_FILE --> <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{_file.WIDTH}" height="{_file.HEIGHT}"> <param name="movie" value="{_file.U_VIEW_LINK}" /> <param name="play" value="true" /> @@ -69,54 +39,10 @@ <param name="allowNetworking" value="internal" /> <embed src="{_file.U_VIEW_LINK}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{_file.WIDTH}" height="{_file.HEIGHT}" play="true" loop="true" quality="high" allowscriptaccess="never" allownetworking="internal"></embed> </object> - <!-- ELSEIF _file.S_QUICKTIME_FILE --> - <object id="qtstream_{_file.ATTACH_ID}" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="320" height="285"> - <param name="src" value="{_file.U_DOWNLOAD_LINK}" /> - <param name="controller" value="true" /> - <param name="autoplay" value="false" /> - <param name="type" value="video/quicktime" /> - <embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="320" height="285" type="video/quicktime" autoplay="false"></embed> - </object> - <!-- ELSEIF _file.S_RM_FILE --> - <object id="rmstream_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="200" height="50"> - <param name="src" value="{_file.U_DOWNLOAD_LINK}" /> - <param name="autostart" value="false" /> - <param name="controls" value="ImageWindow" /> - <param name="console" value="ctrls_{_file.ATTACH_ID}" /> - <param name="prefetch" value="false" /> - <embed name="rmstream_{_file.ATTACH_ID}" type="audio/x-pn-realaudio-plugin" src="{_file.U_DOWNLOAD_LINK}" width="0" height="0" autostart="false" controls="ImageWindow" console="ctrls_{_file.ATTACH_ID}" prefetch="false"></embed> - </object> - <br /> - <object id="ctrls_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="0" height="36"> - <param name="controls" value="ControlPanel" /> - <param name="console" value="ctrls_{_file.ATTACH_ID}" /> - <embed name="ctrls_{_file.ATTACH_ID}" type="audio/x-pn-realaudio-plugin" width="200" height="36" controls="ControlPanel" console="ctrls_{_file.ATTACH_ID}"></embed> - </object> - - <script type="text/javascript"> - // <![CDATA[ - if (document.rmstream_{_file.ATTACH_ID}.GetClipWidth) - { - while (!document.rmstream_{_file.ATTACH_ID}.GetClipWidth()) - { - } - - var width = document.rmstream_{_file.ATTACH_ID}.GetClipWidth(); - var height = document.rmstream_{_file.ATTACH_ID}.GetClipHeight(); - - document.rmstream_{_file.ATTACH_ID}.width = width; - document.rmstream_{_file.ATTACH_ID}.height = height; - document.ctrls_{_file.ATTACH_ID}.width = width; - } - // ]]> - </script> - <!-- ENDIF --> - - <!-- IF _file.S_WM_FILE or _file.S_RM_FILE or _file.S_FLASH_FILE or _file.S_QUICKTIME_FILE --> - <p> - <!-- IF _file.S_QUICKTIME_FILE --><a href="#" onclick="play_qt_file(document.qtstream_{_file.ATTACH_ID}); return false;">[ {L_PLAY_QUICKTIME_FILE} ]</a> <!-- ENDIF --> - <a href="{_file.U_DOWNLOAD_LINK}">{_file.DOWNLOAD_NAME}</a> [ {_file.FILESIZE} {_file.SIZE_LANG} | {_file.L_DOWNLOAD_COUNT} ]</p> + <p><a href="{_file.U_DOWNLOAD_LINK}">{_file.DOWNLOAD_NAME}</a> [ {_file.FILESIZE} {_file.SIZE_LANG} | {_file.L_DOWNLOAD_COUNT} ]</p> <!-- ENDIF --> + <!-- EVENT attachment_file_append --> <!-- ENDIF --> <!-- END _file --> +<!-- EVENT attachment_file_after --> diff --git a/phpBB/styles/prosilver/template/avatars.js b/phpBB/styles/prosilver/template/avatars.js deleted file mode 100644 index 26ea24c0db..0000000000 --- a/phpBB/styles/prosilver/template/avatars.js +++ /dev/null @@ -1,15 +0,0 @@ -(function($) { // Avoid conflicts with other libraries - -"use strict"; - -function avatarHide() { - $('#avatar_options > div').hide(); - - var selected = $('#avatar_driver').val(); - $('#avatar_option_' + selected).show(); -} - -avatarHide(); -$('#avatar_driver').bind('change', avatarHide); - -})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index 909c09df5a..8c4e941092 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -11,9 +11,44 @@ <!-- BEGIN quote_username_open --><blockquote><div><cite>{USERNAME} {L_WROTE}{L_COLON}</cite><!-- END quote_username_open --> <!-- BEGIN quote_open --><blockquote class="uncited"><div><!-- END quote_open --> <!-- BEGIN quote_close --></div></blockquote><!-- END quote_close --> +<!-- BEGIN quote_extended --> +<blockquote> + <xsl:if test="not(@author)"> + <xsl:attribute name="class">uncited</xsl:attribute> + </xsl:if> + <div> + <xsl:if test="@author"> + <cite> + <xsl:choose> + <xsl:when test="@url"> + <a href="{@url}" class="postlink"><xsl:value-of select="@author"/></a> + </xsl:when> + <xsl:when test="@profile_url"> + <a href="{@profile_url}"><xsl:value-of select="@author"/></a> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@author"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> + <xsl:value-of select="$L_WROTE"/> + <xsl:value-of select="$L_COLON"/> + <xsl:if test="@post_url"> + <xsl:text> </xsl:text> + <a href="{@post_url}" data-post-id="{@post_id}" onclick="if(document.getElementById(hash.substr(1)))href=hash">↑</a> + </xsl:if> + <xsl:if test="@date"> + <div class="responsive-hide"><xsl:value-of select="@date"/></div> + </xsl:if> + </cite> + </xsl:if> + <xsl:apply-templates/> + </div> +</blockquote> +<!-- END quote_extended --> -<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><code><!-- END code_open --> -<!-- BEGIN code_close --></code></div><!-- END code_close --> +<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><pre><code><!-- END code_open --> +<!-- BEGIN code_close --></code></pre></div><!-- END code_close --> <!-- BEGIN inline_attachment_open --><div class="inline-attachment"><!-- END inline_attachment_open --> <!-- BEGIN inline_attachment_close --></div><!-- END inline_attachment_close --> @@ -31,7 +66,7 @@ <!-- BEGIN size --><span style="font-size: {SIZE}%; line-height: 116%;">{TEXT}</span><!-- END size --> -<!-- BEGIN img --><img src="{URL}" alt="{L_IMAGE}" /><!-- END img --> +<!-- BEGIN img --><img src="{URL}" class="postimage" alt="{L_IMAGE}" /><!-- END img --> <!-- BEGIN url --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END url --> diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html index c9c5295d13..02899bcafd 100644 --- a/phpBB/styles/prosilver/template/captcha_default.html +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -1,8 +1,8 @@ <!-- IF S_TYPE == 1 --> -<div class="panel"> +<div class="panel captcha-panel"> <div class="inner"> - <h3>{L_CONFIRMATION}</h3> + <h3 class="captcha-title">{L_CONFIRMATION}</h3> <p>{L_CONFIRM_EXPLAIN}</p> <fieldset class="fields2"> @@ -10,7 +10,7 @@ <dl> <dt><label for="confirm_code">{L_CONFIRM_CODE}{L_COLON}</label></dt> - <dd><img src="{CONFIRM_IMAGE_LINK}" alt="{L_CONFIRM_CODE}" /></dd> + <dd class="captcha captcha-image"><img src="{CONFIRM_IMAGE_LINK}" alt="{L_CONFIRM_CODE}" /></dd> <dd><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" tabindex="{$CAPTCHA_TAB_INDEX}" class="inputbox narrow" title="{L_CONFIRM_CODE}" /> <!-- IF S_CONFIRM_REFRESH --><input type="submit" name="refresh_vc" id="refresh_vc" class="button2" value="{L_VC_REFRESH}" /><!-- ENDIF --> <input type="hidden" name="confirm_id" id="confirm_id" value="{CONFIRM_ID}" /></dd> diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index c179f6dc20..b8c6678066 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -1,14 +1,14 @@ <!-- IF S_TYPE == 1 --> -<div class="panel"> +<div class="panel captcha-panel"> <div class="inner"> - <h3>{L_CONFIRMATION}</h3> + <h3 class="captcha-title">{L_CONFIRMATION}</h3> <fieldset class="fields2"> <!-- ENDIF --> <dl> <dt><label>{QA_CONFIRM_QUESTION}{L_COLON}</label><br /><span>{L_CONFIRM_QUESTION_EXPLAIN}</span></dt> - <dd> + <dd class="captcha"> <input type="text" tabindex="{$CAPTCHA_TAB_INDEX}" name="qa_answer" id="answer" size="45" class="inputbox autowidth" title="{L_ANSWER}" /> <input type="hidden" name="qa_confirm_id" id="qa_confirm_id" value="{QA_CONFIRM_ID}" /> </dd> diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index aad1008241..a123f543a8 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -1,8 +1,8 @@ <!-- IF S_TYPE == 1 --> -<div class="panel"> +<div class="panel captcha-panel"> <div class="inner"> - <h3>{L_CONFIRMATION}</h3> + <h3 class="captcha-title">{L_CONFIRMATION}</h3> <p>{L_CONFIRM_EXPLAIN}</p> <fieldset class="fields2"> @@ -11,32 +11,12 @@ <!-- IF S_RECAPTCHA_AVAILABLE --> <dl> <dt><label>{L_CONFIRM_CODE}{L_COLON}</label><br /><span>{L_RECAPTCHA_EXPLAIN}</span></dt> - <dd> - <script type="text/javascript"> - // <![CDATA[ - var RecaptchaOptions = { - lang : '{LA_RECAPTCHA_LANG}', - theme : 'clean', - tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF --> - }; - // ]]> - </script> - <script type="text/javascript" src="{RECAPTCHA_SERVER}/challenge?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}"></script> - <script type="text/javascript"> - // <![CDATA[ - <!-- IF S_CONTENT_DIRECTION eq 'rtl' --> - document.getElementById('recaptcha_table').style.direction = 'ltr'; - <!-- ENDIF --> - // ]]> - </script> + <dd class="captcha"> <noscript> - <div> - <object data="{RECAPTCHA_SERVER}/noscript?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" type="text/html" height="300" width="500"></object><br /> - <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> - <input type="hidden" name="recaptcha_response_field" value="manual_challenge" /> - </div> + <div>{L_RECAPTCHA_NOSCRIPT}</div> </noscript> - + <script src="{RECAPTCHA_SERVER}.js?hl={LA_RECAPTCHA_LANG}" async defer></script> + <div class="g-recaptcha" data-sitekey="{RECAPTCHA_PUBKEY}" data-tabindex="<!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF -->"></div> </dd> </dl> <!-- ELSE --> diff --git a/phpBB/styles/prosilver/template/confirm_body.html b/phpBB/styles/prosilver/template/confirm_body.html index a0428025cf..aaea5cfd05 100644 --- a/phpBB/styles/prosilver/template/confirm_body.html +++ b/phpBB/styles/prosilver/template/confirm_body.html @@ -17,7 +17,7 @@ <div class="panel"> <div class="inner"> - <h2>{MESSAGE_TITLE}</h2> + <h2 class="message-title">{MESSAGE_TITLE}</h2> <p>{MESSAGE_TEXT}</p> <fieldset class="submit-buttons"> diff --git a/phpBB/styles/prosilver/template/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html index dc09974d1c..f0a7ab2bdb 100644 --- a/phpBB/styles/prosilver/template/confirm_delete_body.html +++ b/phpBB/styles/prosilver/template/confirm_delete_body.html @@ -2,21 +2,19 @@ <form action="{S_CONFIRM_ACTION}" method="post"> <p>{MESSAGE_TEXT}</p> - <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) --> - <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> - <label> - <strong>{L_DELETE_PERMANENTLY}{L_COLON}</strong> - <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} /> - <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF --> - </label> - <!-- ENDIF --> + <!-- IF not S_SHADOW_TOPICS --> + <!-- IF not S_SOFTDELETED and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> + <label> + <strong>{L_DELETE_PERMANENTLY}{L_COLON}</strong> + <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} /> + <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF --> + </label> + <!-- ENDIF --> - <!-- IF S_DELETE_REASON --> - <label for="delete_reason"> - <strong>{L_DELETE_REASON}{L_COLON}</strong><br /><span>{L_DELETE_REASON_EXPLAIN}</span><br /> - <input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /> - </label> - <!-- ENDIF --> + <label for="delete_reason"> + <strong>{L_DELETE_REASON}{L_COLON}</strong><br /><span>{L_DELETE_REASON_EXPLAIN}</span><br /> + <input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /> + </label> <!-- ENDIF --> <fieldset class="submit-buttons"> @@ -33,13 +31,13 @@ <div class="panel"> <div class="inner"> - <h2>{MESSAGE_TITLE}</h2> + <h2 class="message-title">{MESSAGE_TITLE}</h2> <p>{MESSAGE_TEXT}</p> - <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) --> + <!-- IF not S_SHADOW_TOPICS --> <fieldset class="fields1"> - <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> + <!-- IF not S_SOFTDELETED and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> <dl> <dt><label for="delete_permanent">{L_DELETE_PERMANENTLY}{L_COLON}</label></dt> <dd> @@ -51,12 +49,10 @@ </dl> <!-- ENDIF --> - <!-- IF S_DELETE_REASON --> - <dl> - <dt><label for="delete_reason">{L_DELETE_REASON}{L_COLON}</label><br /><span>{L_DELETE_REASON_EXPLAIN}</span></dt> - <dd><input type="text" name="delete_reason" id="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></dd> - </dl> - <!-- ENDIF --> + <dl> + <dt><label for="delete_reason">{L_DELETE_REASON}{L_COLON}</label><br /><span>{L_DELETE_REASON_EXPLAIN}</span></dt> + <dd><input type="text" name="delete_reason" id="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></dd> + </dl> </fieldset> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/display_options.html b/phpBB/styles/prosilver/template/display_options.html new file mode 100644 index 0000000000..d1ec3dcef1 --- /dev/null +++ b/phpBB/styles/prosilver/template/display_options.html @@ -0,0 +1,27 @@ +<div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_BEGIN} dropdown-button-control sort-tools"> + <span title="{L_SORT_OPTIONS}" class="button button-secondary dropdown-trigger dropdown-select"> + <i class="icon fa-sort-amount-asc fa-fw" aria-hidden="true"></i> + <span class="caret"><i class="icon fa-sort-down fa-fw" aria-hidden="true"></i></span> + </span> + <div class="dropdown hidden"> + <div class="pointer"><div class="pointer-inner"></div></div> + <div class="dropdown-contents"> + <fieldset class="display-options"> + <!-- IF S_SORT_OPTIONS --> + <label>{L_SORT_BY}{L_COLON} <select name="sk" id="sk">{S_SORT_OPTIONS}</select></label> + <label>{L_SORT_DIRECTION}{L_COLON} <select name="sd" id="sd">{S_ORDER_SELECT}</select></label> + <hr class="dashed" /> + <input type="submit" class="button2" name="sort" value="{L_SORT}" /> + <!-- ELSE --> + <label>{L_DISPLAY}{L_COLON} {S_SELECT_SORT_DAYS}</label> + <!-- IF S_SELECT_SORT_KEY --> + <label>{L_SORT_BY}{L_COLON} {S_SELECT_SORT_KEY}</label> + <label>{L_SORT_DIRECTION}{L_COLON} {S_SELECT_SORT_DIR}</label> + <!-- ENDIF --> + <hr class="dashed" /> + <input type="submit" class="button2" name="sort" value="{L_GO}" /> + <!-- ENDIF --> + </fieldset> + </div> + </div> +</div> diff --git a/phpBB/styles/prosilver/template/drafts.html b/phpBB/styles/prosilver/template/drafts.html index 4b2e1bf0c6..ea2849a485 100644 --- a/phpBB/styles/prosilver/template/drafts.html +++ b/phpBB/styles/prosilver/template/drafts.html @@ -4,7 +4,7 @@ <div class="panel"> <div class="inner"> - <h3>{L_LOAD_DRAFT}</h3> + <h3 class="draft-title">{L_LOAD_DRAFT}</h3> <p>{L_LOAD_DRAFT_EXPLAIN}</p> </div> diff --git a/phpBB/styles/prosilver/template/faq_body.html b/phpBB/styles/prosilver/template/faq_body.html index 46f738aa3a..e55c12ac48 100644 --- a/phpBB/styles/prosilver/template/faq_body.html +++ b/phpBB/styles/prosilver/template/faq_body.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> -<h2>{L_FAQ_TITLE}</h2> +<h2 class="faq-title">{L_FAQ_TITLE}</h2> <div class="panel bg1" id="faqlinks"> @@ -24,22 +24,20 @@ </div> </div> - - -<div class="clear"></div> - <!-- BEGIN faq_block --> <div class="panel <!-- IF faq_block.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> <div class="inner"> <div class="content"> - <h2>{faq_block.BLOCK_TITLE}</h2> + <h2 class="faq-title">{faq_block.BLOCK_TITLE}</h2> <!-- BEGIN faq_row --> <dl class="faq"> <dt id="f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}"><strong>{faq_block.faq_row.FAQ_QUESTION}</strong></dt> <dd>{faq_block.faq_row.FAQ_ANSWER}</dd> - <dd><a href="#faqlinks" class="top2">{L_BACK_TO_TOP}</a></dd> </dl> + <a href="#faqlinks" class="top"> + <i class="icon fa-chevron-circle-up fa-fw icon-gray" aria-hidden="true"></i><span>{L_BACK_TO_TOP}</span> + </a> <!-- IF not faq_block.faq_row.S_LAST_ROW --><hr class="dashed" /><!-- ENDIF --> <!-- END faq_row --> </div> diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 495df2871d..b803a6f5c8 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -1,3 +1,5 @@ +/* global phpbb */ + /** * phpBB3 forum functions */ @@ -6,6 +8,8 @@ * Find a member */ function find_username(url) { + 'use strict'; + popup(url, 760, 570, '_usersearch'); return false; } @@ -14,6 +18,8 @@ function find_username(url) { * Window popup */ function popup(url, width, height, name) { + 'use strict'; + if (!name) { name = '_popup'; } @@ -25,29 +31,19 @@ function popup(url, width, height, name) { /** * Jump to page */ -function jumpto(item) { - if (!item || !item.length) { - item = $('a.pagination-trigger[data-lang-jump-page]'); - if (!item.length) { - return; - } - } +function pageJump(item) { + 'use strict'; - var jump_page = item.attr('data-lang-jump-page'), - on_page = item.attr('data-on-page'), - per_page = item.attr('data-per-page'), - base_url = item.attr('data-base-url'), - page = prompt(jump_page, on_page); + var page = parseInt(item.val(), 10), + perPage = item.attr('data-per-page'), + baseUrl = item.attr('data-base-url'), + startName = item.attr('data-start-name'); - if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) { - if (base_url.indexOf('%d') === -1) { - if (base_url.indexOf('?') === -1) { - document.location.href = base_url + '?start=' + ((page - 1) * per_page); - } else { - document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); - } + if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) { + if (baseUrl.indexOf('?') === -1) { + document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage); } else { - document.location.href = base_url.replace('%d', page); + document.location.href = baseUrl.replace(/&/g, '&') + '&' + startName + '=' + ((page - 1) * perPage); } } } @@ -57,9 +53,11 @@ function jumpto(item) { * id = ID of parent container, name = name prefix, state = state [true/false] */ function marklist(id, name, state) { + 'use strict'; + jQuery('#' + id + ' input[type=checkbox][name]').each(function() { var $this = jQuery(this); - if ($this.attr('name').substr(0, name.length) == name) { + if ($this.attr('name').substr(0, name.length) === name) { $this.prop('checked', state); } }); @@ -70,6 +68,8 @@ function marklist(id, name, state) { * e = element */ function viewableArea(e, itself) { + 'use strict'; + if (!e) { return; } @@ -95,91 +95,57 @@ function viewableArea(e, itself) { } /** -* Set display of page element -* s[-1,0,1] = hide,toggle display,show -* type = string: inline, block, inline-block or other CSS "display" type -*/ -function dE(n, s, type) { - if (!type) { - type = 'block'; - } - - var e = document.getElementById(n); - if (!s) { - s = (e.style.display === '' || e.style.display === type) ? -1 : 1; - } - e.style.display = (s === 1) ? type : 'none'; -} - -/** * Alternate display of subPanels */ -jQuery(document).ready(function() { - jQuery('.sub-panels').each(function() { +jQuery(function($) { + 'use strict'; - var panels = [], - childNodes = jQuery('a[data-subpanel]', this).each(function() { - panels.push(this.getAttribute('data-subpanel')); + $('.sub-panels').each(function() { + + var $childNodes = $('a[data-subpanel]', this), + panels = $childNodes.map(function () { + return this.getAttribute('data-subpanel'); }), - show_panel = this.getAttribute('data-show-panel'); + showPanel = this.getAttribute('data-show-panel'); if (panels.length) { - subPanels(show_panel); - childNodes.click(function () { - subPanels(this.getAttribute('data-subpanel')); + activateSubPanel(showPanel, panels); + $childNodes.click(function () { + activateSubPanel(this.getAttribute('data-subpanel'), panels); return false; }); } - - function subPanels(p) { - var i; - - if (typeof(p) === 'string') { - show_panel = p; - } - - for (i = 0; i < panels.length; i++) { - jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none'); - jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel); - } - } }); }); /** -* Call print preview +* Activate specific subPanel */ -function printPage() { - if (is_ie) { - printPreview(); - } else { - window.print(); - } -} +function activateSubPanel(p, panels) { + 'use strict'; -/** -* Show/hide groups of blocks -* c = CSS style name -* e = checkbox element -* t = toggle dispay state (used to show 'grip-show' image in the profile block when hiding the profiles) -*/ -function displayBlocks(c, e, t) { - var s = (e.checked === true) ? 1 : -1; + var i, showPanel; - if (t) { - s *= -1; + if (typeof p === 'string') { + showPanel = p; } + $('input[name="show_panel"]').val(showPanel); - var divs = document.getElementsByTagName("DIV"); + if (typeof panels === 'undefined') { + panels = jQuery('.sub-panels a[data-subpanel]').map(function() { + return this.getAttribute('data-subpanel'); + }); + } - for (var d = 0; d < divs.length; d++) { - if (divs[d].className.indexOf(c) === 0) { - divs[d].style.display = (s === 1) ? 'none' : 'block'; - } + for (i = 0; i < panels.length; i++) { + jQuery('#' + panels[i]).css('display', panels[i] === showPanel ? 'block' : 'none'); + jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === showPanel); } } function selectCode(a) { + 'use strict'; + // Get ID of code block var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; var s, r; @@ -187,9 +153,17 @@ function selectCode(a) { // Not IE and IE9+ if (window.getSelection) { s = window.getSelection(); - // Safari + // Safari and Chrome if (s.setBaseAndExtent) { - s.setBaseAndExtent(e, 0, e, e.innerText.length - 1); + var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1; + try { + s.setBaseAndExtent(e, 0, e, l); + } catch (error) { + r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } } // Firefox and Opera else { @@ -225,6 +199,8 @@ function selectCode(a) { * from the displayed rectangle area */ function play_qt_file(obj) { + 'use strict'; + var rectangle = obj.GetRectangle(); var width, height; @@ -249,30 +225,32 @@ function play_qt_file(obj) { obj.Play(); } -var in_autocomplete = false; -var last_key_entered = ''; +var inAutocomplete = false; +var lastKeyEntered = ''; /** * Check event key */ -function phpbb_check_key(event) { +function phpbbCheckKey(event) { + 'use strict'; + // Keycode is array down or up? if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) { - in_autocomplete = true; + inAutocomplete = true; } // Make sure we are not within an "autocompletion" field - if (in_autocomplete) { + if (inAutocomplete) { // If return pressed and key changed we reset the autocompletion - if (!last_key_entered || last_key_entered === event.which) { - in_autocompletion = false; + if (!lastKeyEntered || lastKeyEntered === event.which) { + inAutocomplete = false; return true; } } // Keycode is not return, then return. ;) if (event.which !== 13) { - last_key_entered = event.which; + lastKeyEntered = event.which; return true; } @@ -282,219 +260,146 @@ function phpbb_check_key(event) { /** * Apply onkeypress event for forcing default submit button on ENTER key press */ -function apply_onkeypress_event() { - jQuery('form input[type=text], form input[type=password]').on('keypress', function (e) { - var default_button = jQuery(this).parents('form').find('input[type=submit].default-submit-action'); +jQuery(function($) { + 'use strict'; - if (!default_button || default_button.length <= 0) { + $('form input[type=text], form input[type=password]').on('keypress', function (e) { + var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action'); + + if (!defaultButton || defaultButton.length <= 0) { return true; } - if (phpbb_check_key(e)) { + if (phpbbCheckKey(e)) { return true; } if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) { - default_button.click(); + defaultButton.click(); return false; } return true; }); -} - -jQuery(document).ready(apply_onkeypress_event); - -/** -* Run MSN action -*/ -function msn_action(action, address) -{ - // Does the browser support the MSNM object? - var app = document.getElementById('objMessengerApp'); - - if (!app || !app.MyStatus) { - var lang = $('form[data-lang-im-msnm-browser]'); - if (lang.length) { - alert(lang.attr('data-lang-im-msnm-browser')); - } - return false; - } - - // Is MSNM connected? - if (app.MyStatus == 1) { - var lang = $('form[data-lang-im-msnm-connect]'); - if (lang.length) { - alert(lang.attr('data-lang-im-msnm-connect')); - } - return false; - } - - // Do stuff - try { - switch (action) { - case 'add': - app.AddContact(0, address); - break; - - case 'im': - app.InstantMessage(address); - break; - } - } - catch (e) { - return; - } -} - -/** -* Add to your contact list -*/ -function add_contact(address) -{ - msn_action('add', address); -} - -/** -* Write IM to contact -*/ -function im_contact(address) -{ - msn_action('im', address); -} +}); /** * Functions for user search popup */ -function insert_user(formId, value) -{ - var form = jQuery(formId), - formName = form.attr('data-form-name'), - fieldName = form.attr('data-field-name'), +function insertUser(formId, value) { + 'use strict'; + + var $form = jQuery(formId), + formName = $form.attr('data-form-name'), + fieldName = $form.attr('data-field-name'), item = opener.document.forms[formName][fieldName]; - if (item.value.length && item.type == 'textarea') { - value = item.value + "\n" + value; + if (item.value.length && item.type === 'textarea') { + value = item.value + '\n' + value; } item.value = value; } -function insert_marked_users(formId, users) -{ - if (typeof(users.length) == "undefined") - { - if (users.checked) - { - insert_user(formId, users.value); - } - } - else if (users.length > 0) - { - for (i = 0; i < users.length; i++) - { - if (users[i].checked) - { - insert_user(formId, users[i].value); - } +function insert_marked_users(formId, users) { + 'use strict'; + + for (var i = 0; i < users.length; i++) { + if (users[i].checked) { + insertUser(formId, users[i].value); } } - self.close(); + window.close(); } -function insert_single_user(formId, user) -{ - insert_user(formId, user); - self.close(); +function insert_single_user(formId, user) { + 'use strict'; + + insertUser(formId, user); + window.close(); } /** * Parse document block */ -function parse_document(container) -{ - var test = document.createElement('div'), - oldBrowser = (typeof test.style.borderRadius == 'undefined'); +function parseDocument($container) { + 'use strict'; - delete test; + var test = document.createElement('div'), + oldBrowser = (typeof test.style.borderRadius === 'undefined'), + $body = $('body'); /** * Reset avatar dimensions when changing URL or EMAIL */ - container.find('input[data-reset-on-edit]').bind('keyup', function() { + $container.find('input[data-reset-on-edit]').on('keyup', function() { $(this.getAttribute('data-reset-on-edit')).val(''); }); /** * Pagination */ - container.find('a.pagination-trigger').click(function() { - jumpto($(this)); + $container.find('.pagination .page-jump-form :button').click(function() { + var $input = $(this).siblings('input.inputbox'); + pageJump($input); }); - /** - * Dropdowns - */ - container.find('.dropdown-container').each(function() { - var $this = $(this), - trigger = $this.find('.dropdown-trigger:first'), - contents = $this.find('.dropdown'), - options = { - direction: 'auto', - verticalDirection: 'auto' - }, - data; - - if (!trigger.length) { - data = $this.attr('data-dropdown-trigger'); - trigger = data ? $this.children(data) : $this.children('a:first'); + $container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) { + if (event.which === 13 || event.keyCode === 13) { + event.preventDefault(); + pageJump($(this)); } + }); - if (!contents.length) { - data = $this.attr('data-dropdown-contents'); - contents = data ? $this.children(data) : $this.children('div:first'); - } - - if (!trigger.length || !contents.length) return; - - if ($this.hasClass('dropdown-up')) options.verticalDirection = 'up'; - if ($this.hasClass('dropdown-down')) options.verticalDirection = 'down'; - if ($this.hasClass('dropdown-left')) options.direction = 'left'; - if ($this.hasClass('dropdown-right')) options.direction = 'right'; - - phpbb.registerDropdown(trigger, contents, options); + $container.find('.pagination .dropdown-trigger').click(function() { + var $dropdownContainer = $(this).parent(); + // Wait a little bit to make sure the dropdown has activated + setTimeout(function() { + if ($dropdownContainer.hasClass('dropdown-visible')) { + $dropdownContainer.find('input.inputbox').focus(); + } + }, 100); }); /** - * Adjust HTML code for IE8 and older versions + * Adjust HTML code for IE8 and older versions */ - if (oldBrowser) { - // Fix .linklist.bulletin lists - container.find('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin'); - - // Do not run functions below for old browsers - return; - } + // if (oldBrowser) { + // // Fix .linklist.bulletin lists + // $container + // .find('ul.linklist.bulletin > li') + // .filter(':first-child, .rightside:last-child') + // .addClass('no-bulletin'); + // } /** - * Resize navigation block to keep all links on same line + * Resize navigation (breadcrumbs) block to keep all links on same line */ - container.find('.navlinks').each(function() { + $container.find('.navlinks').each(function() { var $this = $(this), - left = $this.children().not('.rightside'), - right = $this.children('.rightside'); + $left = $this.children().not('.rightside'), + $right = $this.children('.rightside'); - if (left.length !== 1 || !right.length) return; + if ($left.length !== 1 || !$right.length) { + return; + } function resize() { var width = 0, - diff = left.outerWidth(true) - left.width(); - - right.each(function() { - width += $(this).outerWidth(true); + diff = $left.outerWidth(true) - $left.width(), + minWidth = Math.max($this.width() / 3, 240), + maxWidth; + + $right.each(function() { + var $this = $(this); + if ($this.is(':visible')) { + width += $this.outerWidth(true); + } }); - left.css('max-width', Math.floor($this.width() - width - diff) + 'px'); + + maxWidth = $this.width() - width - diff; + $left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px'); } resize(); @@ -504,11 +409,10 @@ function parse_document(container) /** * Makes breadcrumbs responsive */ - container.find('.breadcrumbs:not([data-skip-responsive])').each(function() { + $container.find('.breadcrumbs:not([data-skip-responsive])').each(function() { var $this = $(this), - $body = $('body'), - links = $this.find('.crumb'), - length = links.length, + $links = $this.find('.crumb'), + length = $links.length, classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'], classesLength = classes.length, maxHeight = 0, @@ -521,14 +425,19 @@ function parse_document(container) $link.attr('title', $link.text()); }); - // Funciton that checks breadcrumbs + // Function that checks breadcrumbs function check() { var height = $this.height(), - width = $body.width(), - link, i, j; + width; + + // Test max-width set in code for .navlinks above + width = parseInt($this.css('max-width'), 10); + if (!width) { + width = $body.width(); + } - maxHeight = parseInt($this.css('line-height')) | 0; - links.each(function() { + maxHeight = parseInt($this.css('line-height'), 10); + $links.each(function() { if ($(this).height() > 0) { maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); } @@ -536,7 +445,6 @@ function parse_document(container) if (height <= maxHeight) { if (!wrapped || lastWidth === false || lastWidth >= width) { - lastWidth = width; return; } } @@ -544,7 +452,6 @@ function parse_document(container) if (wrapped) { $this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' ')); - wrapped = false; if ($this.height() <= maxHeight) { return; } @@ -556,9 +463,9 @@ function parse_document(container) return; } - for (i = 0; i < classesLength; i ++) { - for (j = length - 1; j >= 0; j --) { - links.eq(j).addClass('wrapped ' + classes[i]); + for (var i = 0; i < classesLength; i++) { + for (var j = length - 1; j >= 0; j--) { + $links.eq(j).addClass('wrapped ' + classes[i]); if ($this.height() <= maxHeight) { return; } @@ -572,9 +479,190 @@ function parse_document(container) }); /** + * Responsive link lists + */ + var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' + + '.postbody .post-buttons:not([data-skip-responsive])'; + $container.find(selector).each(function() { + var $this = $(this), + filterSkip = '.breadcrumbs, [data-skip-responsive]', + filterLast = '.edit-icon, .quote-icon, [data-last-responsive]', + $linksAll = $this.children(), + $linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden + $linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first + $linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last + persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)? + html = '<li class="responsive-menu hidden"><a href="javascript:void(0);" class="js-responsive-menu-link responsive-menu-link"><i class="icon fa-bars fa-fw" aria-hidden="true"></i></a><div class="dropdown"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>', + slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured. + + // Add a hidden drop-down menu to each links list (except those that already have one) + if (!persistent) { + if ($linksNotSkip.is('.rightside')) { + $linksNotSkip.filter('.rightside:first').before(html); + $this.children('.responsive-menu').addClass('rightside'); + } else { + $this.append(html); + } + } + + // Set some object references and initial states + var $menu = $this.children('.responsive-menu'), + $menuContents = $menu.find('.dropdown-contents'), + persistentContent = $menuContents.find('li:not(.separator)').length, + lastWidth = false, + compact = false, + responsive1 = false, + responsive2 = false, + copied1 = false, + copied2 = false, + maxHeight = 0; + + // Find the tallest element in the list (we assume that all elements are roughly the same height) + $linksAll.each(function() { + if (!$(this).height()) { + return; + } + maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); + }); + if (maxHeight < 1) { + return; // Shouldn't be possible, but just in case, abort + } else { + maxHeight = maxHeight + slack; + } + + function check() { + var width = $body.width(); + // We can't make it any smaller than this, so just skip + if (responsive2 && compact && (width <= lastWidth)) { + return; + } + lastWidth = width; + + // Reset responsive and compact layout + if (responsive1 || responsive2) { + $linksNotSkip.removeClass('hidden'); + $menuContents.children('.clone').addClass('hidden'); + responsive1 = responsive2 = false; + } + if (compact) { + $this.removeClass('compact'); + compact = false; + } + + // Unhide the quick-links menu if it has "persistent" content + if (persistent && persistentContent) { + $menu.removeClass('hidden'); + } else { + $menu.addClass('hidden'); + } + + // Nothing to resize if block's height is not bigger than tallest element's height + if ($this.height() <= maxHeight) { + return; + } + + // STEP 1: Compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 2: First responsive set - compact + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied1) { + var $clones1 = $linksFirst.clone(); + $menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside')); + + if ($this.hasClass('post-buttons')) { + $('.button', $menuContents).removeClass('button'); + $('.sr-only', $menuContents).removeClass('sr-only'); + $('.js-responsive-menu-link').addClass('button').addClass('button-icon-only'); + $('.js-responsive-menu-link .icon').removeClass('fa-bars').addClass('fa-ellipsis-h'); + } + copied1 = true; + } + if (!responsive1) { + $linksFirst.addClass('hidden'); + responsive1 = true; + $menuContents.children('.clone-first').removeClass('hidden'); + $menu.removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 3: First responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 4: Last responsive set - compact + if (!$linksLast.length) { + return; // No other links to hide, can't do more + } + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied2) { + var $clones2 = $linksLast.clone(); + $menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside')); + copied2 = true; + } + if (!responsive2) { + $linksLast.addClass('hidden'); + responsive2 = true; + $menuContents.children('.clone-last').removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 5: Last responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + } + + if (!persistent) { + phpbb.registerDropdown($menu.find('a.js-responsive-menu-link'), $menu.find('.dropdown'), false); + } + + // If there are any images in the links list, run the check again after they have loaded + $linksAll.find('img').each(function() { + $(this).load(function() { + check(); + }); + }); + + check(); + $(window).resize(check); + }); + + /** + * Do not run functions below for old browsers + */ + if (oldBrowser) { + return; + } + + /** * Adjust topiclist lists with check boxes */ - container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark'); + $container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark'); /** * Appends contents of all extra columns to first column in @@ -583,31 +671,30 @@ function parse_document(container) * To add that functionality to .topiclist list simply add * responsive-show-all to list of classes */ - container.find('.topiclist.responsive-show-all > li > dl').each(function() { + $container.find('.topiclist.responsive-show-all > li > dl').each(function() { var $this = $(this), - block = $this.find('dt .responsive-show:last-child'), + $block = $this.find('dt .responsive-show:last-child'), first = true; // Create block that is visible only on mobile devices - if (!block.length) { + if (!$block.length) { $this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />'); - block = $this.find('dt .responsive-show:last-child'); - } - else { - first = (block.text().trim().length == 0); + $block = $this.find('dt .responsive-show:last-child'); + } else { + first = ($.trim($block.text()).length === 0); } // Copy contents of each column $this.find('dd').not('.mark').each(function() { var column = $(this), - children = column.children(), + $children = column.children(), html = column.html(); - if (children.length == 1 && children.text() == column.text()) { - html = children.html(); + if ($children.length === 1 && $children.text() === column.text()) { + html = $children.html(); } - block.append((first ? '' : '<br />') + html); + $block.append((first ? '' : '<br />') + html); first = false; }); @@ -620,15 +707,15 @@ function parse_document(container) * To add that functionality to .topiclist list simply add * responsive-show-columns to list of classes */ - container.find('.topiclist.responsive-show-columns').each(function() { - var list = $(this), + $container.find('.topiclist.responsive-show-columns').each(function() { + var $list = $(this), headers = [], headersLength = 0; // Find all headers, get contents - list.prev('.topiclist').find('li.header dd').not('.mark').each(function() { + $list.prev('.topiclist').find('li.header dd').not('.mark').each(function() { headers.push($(this).text()); - headersLength ++; + headersLength++; }); if (!headersLength) { @@ -636,18 +723,17 @@ function parse_document(container) } // Parse each row - list.find('dl').each(function() { + $list.find('dl').each(function() { var $this = $(this), - block = $this.find('dt .responsive-show:last-child'), + $block = $this.find('dt .responsive-show:last-child'), first = true; // Create block that is visible only on mobile devices - if (!block.length) { + if (!$block.length) { $this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />'); - block = $this.find('dt .responsive-show:last-child'); - } - else { - first = (block.text().trim().length == 0); + $block = $this.find('dt .responsive-show:last-child'); + } else { + first = ($.trim($block.text()).length === 0); } // Copy contents of each column @@ -656,7 +742,7 @@ function parse_document(container) children = column.children(), html = column.html(); - if (children.length == 1 && children.text() == column.text()) { + if (children.length === 1 && children.text() === column.text()) { html = children.html(); } @@ -665,7 +751,7 @@ function parse_document(container) html = headers[i] + ': <strong>' + html + '</strong>'; } - block.append((first ? '' : '<br />') + html); + $block.append((first ? '' : '<br />') + html); first = false; }); @@ -675,33 +761,32 @@ function parse_document(container) /** * Responsive tables */ - container.find('table.table1').not('.not-responsive').each(function() { + $container.find('table.table1').not('.not-responsive').each(function() { var $this = $(this), - th = $this.find('thead > tr > th'), - columns = th.length, + $th = $this.find('thead > tr > th'), headers = [], totalHeaders = 0, i, headersLength; // Find each header - th.each(function(column) { + $th.each(function(column) { var cell = $(this), - colspan = parseInt(cell.attr('colspan')), + colspan = parseInt(cell.attr('colspan'), 10), dfn = cell.attr('data-dfn'), text = dfn ? dfn : cell.text(); colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; - for (i=0; i<colspan; i++) { + for (i = 0; i < colspan; i++) { headers.push(text); } - totalHeaders ++; + totalHeaders++; if (dfn && !column) { $this.addClass('show-header'); } }); - + headersLength = headers.length; // Add header text to each cell as <dfn> @@ -717,15 +802,15 @@ function parse_document(container) cells = row.children('td'), column = 0; - if (cells.length == 1) { + if (cells.length === 1) { row.addClass('big-column'); return; } cells.each(function() { var cell = $(this), - colspan = parseInt(cell.attr('colspan')), - text = cell.text().trim(); + colspan = parseInt(cell.attr('colspan'), 10), + text = $.trim(cell.text()); if (headersLength <= column) { return; @@ -733,8 +818,7 @@ function parse_document(container) if ((text.length && text !== '-') || cell.children().length) { cell.prepend('<dfn style="display: none;">' + headers[column] + '</dfn>'); - } - else { + } else { cell.addClass('empty'); } @@ -747,201 +831,80 @@ function parse_document(container) /** * Hide empty responsive tables */ - container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() { - var items = $(this).children('tr'); - if (items.length == 0) - { + $container.find('table.responsive > tbody').not('.responsive-skip-empty').each(function() { + var $items = $(this).children('tr'); + if (!$items.length) { $(this).parent('table:first').addClass('responsive-hide'); } }); /** - * Responsive link lists - */ - container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody ul.profile-icons:not([data-skip-responsive])').each(function() { - var $this = $(this), - $body = $('body'), - filterSkip = '.breadcrumbs, [data-skip-responsive]', - filterLast = '.pagination, .icon-notifications, .icon-pm, .icon-logout, .icon-login, .mark-read, .edit-icon, .quote-icon', - allLinks = $this.children(), - links = allLinks.not(filterSkip), - html = '<li class="responsive-menu" style="display:none;"><a href="javascript:void(0);" class="responsive-menu-link"> </a><div class="dropdown" style="display:none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>', - filterLastList = links.filter(filterLast); - - if (links.is('.rightside')) - { - links.filter('.rightside:first').before(html); - } - else - { - $this.append(html); - } - - var item = $this.children('.responsive-menu'), - menu = item.find('.dropdown-contents'), - lastWidth = false, - compact = false, - responsive = false, - copied = false; - - function check() { - var width = $body.width(); - if (responsive && width <= lastWidth) { - return; - } - - // Reset responsive and compact layout - if (responsive) { - responsive = false; - $this.removeClass('responsive'); - links.css('display', ''); - item.css('display', 'none'); - } - - if (compact) { - compact = false; - $this.removeClass('compact'); - } - - // Find tallest element - var maxHeight = 0; - allLinks.each(function() { - if (!$(this).height()) return; - maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); - }); - - if (maxHeight < 1) { - return; - } - - // Nothing to resize if block's height is not bigger than tallest element's height - if ($this.height() <= maxHeight) { - return; - } - - // Enable compact layout, find tallest element, compare to height of whole block - compact = true; - $this.addClass('compact'); - - var compactMaxHeight = 0; - allLinks.each(function() { - if (!$(this).height()) return; - compactMaxHeight = Math.max(compactMaxHeight, $(this).outerHeight(true)); - }); - - if ($this.height() <= maxHeight) { - return; - } - - // Compact layout did not resize block enough, switch to responsive layout - compact = false; - $this.removeClass('compact'); - responsive = true; - - if (!copied) { - var clone = links.clone(true); - clone.filter('.rightside').each(function() { - menu.prepend(this); - }); - menu.prepend(clone.not('.rightside')); - menu.find('li.leftside, li.rightside').removeClass('leftside rightside'); - menu.find('.inputbox').parents('li:first').css('white-space', 'normal'); - copied = true; - } - else { - menu.children().css('display', ''); - } - - item.css('display', ''); - $this.addClass('responsive'); - - // Try to not hide filtered items - if (filterLastList.length) { - links.not(filterLast).css('display', 'none'); - - maxHeight = 0; - filterLastList.each(function() { - if (!$(this).height()) return; - maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); - }); - - if ($this.height() <= maxHeight) { - menu.children().filter(filterLast).css('display', 'none'); - return; - } - } - - links.css('display', 'none'); - } - - phpbb.registerDropdown(item.find('a.responsive-menu-link'), item.find('.dropdown')); - - check(); - $(window).resize(check); - }); - - /** * Responsive tabs */ - container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() { + $container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() { var $this = $(this), - $body = $('body'), - ul = $this.children(), - tabs = ul.children().not('[data-skip-responsive]'), - links = tabs.children('a'), - item = ul.append('<li class="responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link"><span> </span></a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'), - menu = item.find('.dropdown-contents'), + $ul = $this.children(), + $tabs = $ul.children().not('[data-skip-responsive]'), + $links = $tabs.children('a'), + $item = $ul.append('<li class="tab responsive-tab" style="display:none;"><a href="javascript:void(0);" class="responsive-tab-link"> </a><div class="dropdown tab-dropdown" style="display: none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>').find('li.responsive-tab'), + $menu = $item.find('.dropdown-contents'), maxHeight = 0, lastWidth = false, responsive = false; - links.each(function() { - var link = $(this); - maxHeight = Math.max(maxHeight, Math.max(link.outerHeight(true), link.parent().outerHeight(true))); - }) + $links.each(function() { + var $this = $(this); + maxHeight = Math.max(maxHeight, Math.max($this.outerHeight(true), $this.parent().outerHeight(true))); + }); function check() { var width = $body.width(), height = $this.height(); - if (arguments.length == 0 && (!responsive || width <= lastWidth) && height <= maxHeight) { + if (!arguments.length && (!responsive || width <= lastWidth) && height <= maxHeight) { return; } - tabs.show(); - item.hide(); + $tabs.show(); + $item.hide(); lastWidth = width; height = $this.height(); if (height <= maxHeight) { - responsive = false; - if (item.hasClass('dropdown-visible')) { - phpbb.toggleDropdown.call(item.find('a.responsive-tab-link').get(0)); + if ($item.hasClass('dropdown-visible')) { + phpbb.toggleDropdown.call($item.find('a.responsive-tab-link').get(0)); } return; } responsive = true; - item.show(); - menu.html(''); + $item.show(); + $menu.html(''); - var availableTabs = tabs.filter(':not(.activetab, .responsive-tab)'), - total = availableTabs.length, - i, tab; + var $availableTabs = $tabs.filter(':not(.activetab, .responsive-tab)'), + total = $availableTabs.length, + i, $tab; - for (i = total - 1; i >= 0; i --) { - tab = availableTabs.eq(i); - menu.prepend(tab.clone(true)); - tab.hide(); + for (i = total - 1; i >= 0; i--) { + $tab = $availableTabs.eq(i); + $menu.prepend($tab.clone(true).removeClass('tab')); + $tab.hide(); if ($this.height() <= maxHeight) { - menu.find('a').click(function() { check(true); }); + $menu.find('a').click(function() { + check(true); + }); return; } } - menu.find('a').click(function() { check(true); }); + $menu.find('a').click(function() { + check(true); + }); } - phpbb.registerDropdown(item.find('a.responsive-tab-link'), item.find('.dropdown'), {visibleClass: 'activetab'}); + var $tabLink = $item.find('a.responsive-tab-link'); + phpbb.registerDropdown($tabLink, $item.find('.dropdown'), { + visibleClass: 'activetab' + }); check(true); $(window).resize(check); @@ -950,10 +913,9 @@ function parse_document(container) /** * Hide UCP/MCP navigation if there is only 1 item */ - container.find('#navigation').each(function() { - var items = $(this).children('ol, ul').children('li'); - if (items.length == 1) - { + $container.find('#navigation').each(function() { + var $items = $(this).children('ol, ul').children('li'); + if ($items.length === 1) { $(this).addClass('responsive-hide'); } }); @@ -961,7 +923,7 @@ function parse_document(container) /** * Replace responsive text */ - container.find('[data-responsive-text]').each(function() { + $container.find('[data-responsive-text]').each(function() { var $this = $(this), fullText = $this.text(), responsiveText = $this.attr('data-responsive-text'), @@ -969,12 +931,16 @@ function parse_document(container) function check() { if ($(window).width() > 700) { - if (!responsive) return; + if (!responsive) { + return; + } $this.text(fullText); responsive = false; return; } - if (responsive) return; + if (responsive) { + return; + } $this.text(responsiveText); responsive = true; } @@ -987,16 +953,18 @@ function parse_document(container) /** * Run onload functions */ -(function($) { - $(document).ready(function() { - // Swap .nojs and .hasjs - $('#phpbb.nojs').toggleClass('nojs hasjs'); - - // Focus forms - $('form[data-focus]:first').each(function() { - $('#' + this.getAttribute('data-focus')).focus(); - }); +jQuery(function($) { + 'use strict'; + + // Swap .nojs and .hasjs + $('#phpbb.nojs').toggleClass('nojs hasjs'); + $('#phpbb').toggleClass('hastouch', phpbb.isTouch); + $('#phpbb.hastouch').removeClass('notouch'); - parse_document($('body')); + // Focus forms + $('form[data-focus]:first').each(function() { + $('#' + this.getAttribute('data-focus')).focus(); }); -})(jQuery); + + parseDocument($('body')); +}); diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index f9019b4fe3..0bbaa9beb3 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -7,40 +7,57 @@ </div> <!-- ENDIF --> + <!-- EVENT forumlist_body_category_header_before --> <!-- IF forumrow.S_IS_CAT or forumrow.S_FIRST_ROW or forumrow.S_NO_CAT --> <div class="forabg"> <div class="inner"> <ul class="topiclist"> <li class="header"> - <dl class="icon"> + <!-- EVENT forumlist_body_category_header_row_prepend --> + <dl class="row-item"> <dt><div class="list-inner"><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></div></dt> <dd class="topics">{L_TOPICS}</dd> <dd class="posts">{L_POSTS}</dd> <dd class="lastpost"><span>{L_LAST_POST}</span></dd> </dl> + <!-- EVENT forumlist_body_category_header_row_append --> </li> </ul> <ul class="topiclist forums"> <!-- ENDIF --> + <!-- EVENT forumlist_body_category_header_after --> <!-- IF not forumrow.S_IS_CAT --> + <!-- EVENT forumlist_body_forum_row_before --> <li class="row"> - <dl class="icon {forumrow.FORUM_IMG_STYLE}"> + <!-- EVENT forumlist_body_forum_row_prepend --> + <dl class="row-item {forumrow.FORUM_IMG_STYLE}"> <dt title="{forumrow.FORUM_FOLDER_IMG_ALT}"> + <!-- IF forumrow.S_UNREAD_FORUM --><a href="{forumrow.U_VIEWFORUM}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> - <!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --><!-- <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"><img src="{T_THEME_PATH}/images/feed.gif" alt="{L_FEED} - {forumrow.FORUM_NAME}" /></a> --><!-- ENDIF --> - + <!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --> + <!-- + <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"> + <i class="icon fa-rss-square fa-fw icon-orange" aria-hidden="true"></i><span class="sr-only">{L_FEED} - {forumrow.FORUM_NAME}</span> + </a> + --> + <!-- ENDIF --> <!-- IF forumrow.FORUM_IMAGE --><span class="forum-image">{forumrow.FORUM_IMAGE}</span><!-- ENDIF --> - <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a><br /> - {forumrow.FORUM_DESC} + <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a> + <!-- IF forumrow.FORUM_DESC --><br />{forumrow.FORUM_DESC}<!-- ENDIF --> <!-- IF forumrow.MODERATORS --> <br /><strong>{forumrow.L_MODERATOR_STR}{L_COLON}</strong> {forumrow.MODERATORS} <!-- ENDIF --> <!-- IF .forumrow.subforum and forumrow.S_LIST_SUBFORUMS --> - <br /><strong>{forumrow.L_SUBFORUM_STR}</strong> + <!-- EVENT forumlist_body_subforums_before --> + <br /><strong>{forumrow.L_SUBFORUM_STR}{L_COLON}</strong> <!-- BEGIN subforum --> - <a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->,<!-- ENDIF --> + <a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.S_UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->"> + <i class="icon fa-file-o fa-fw <!-- IF forumrow.subforum.S_UNREAD --> icon-red<!-- ELSE --> icon-blue<!-- ENDIF --> icon-md" aria-hidden="true"></i>{forumrow.subforum.SUBFORUM_NAME} + </a> + <!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF --> <!-- END subforum --> + <!-- EVENT forumlist_body_subforums_after --> <!-- ENDIF --> <!-- IF not S_IS_BOT --> @@ -59,23 +76,42 @@ <!-- ELSEIF not forumrow.S_IS_LINK --> <dd class="topics">{forumrow.TOPICS} <dfn>{L_TOPICS}</dfn></dd> <dd class="posts">{forumrow.POSTS} <dfn>{L_POSTS}</dfn></dd> - <dd class="lastpost"><span> - <!-- IF forumrow.U_UNAPPROVED_TOPICS --> - <a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a> - <!-- ELSEIF forumrow.U_UNAPPROVED_POSTS --> - <a href="{forumrow.U_UNAPPROVED_POSTS}">{UNAPPROVED_POST_IMG}</a> - <!-- ENDIF --> - <!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn> - <!-- IF forumrow.S_DISPLAY_SUBJECT --> - <!-- EVENT forumlist_body_last_post_title_prepend --> - <a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a> <br /> - <!-- ENDIF --> - {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} - <!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{forumrow.LAST_POST_TIME}<!-- ELSE -->{L_NO_POSTS}<br /> <!-- ENDIF --></span> + <dd class="lastpost"> + <span> + <!-- IF forumrow.U_UNAPPROVED_TOPICS --> + <a href="{forumrow.U_UNAPPROVED_TOPICS}" title="{TOPICS_UNAPPROVED}"> + <i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{TOPICS_UNAPPROVED}</span> + </a> + <!-- ELSEIF forumrow.U_UNAPPROVED_POSTS --> + <a href="{forumrow.U_UNAPPROVED_POSTS}" title="{POSTS_UNAPPROVED_FORUM}"> + <i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{POSTS_UNAPPROVED_FORUM}</span> + </a> + <!-- ENDIF --> + <!-- IF forumrow.LAST_POST_TIME --> + <dfn>{L_LAST_POST}</dfn> + <!-- IF forumrow.S_DISPLAY_SUBJECT --> + <!-- EVENT forumlist_body_last_post_title_prepend --> + <a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a> <br /> + <!-- ENDIF --> + {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} + <!-- IF not S_IS_BOT --> + <a href="{forumrow.U_LAST_POST}" title="{VIEW_LATEST_POST}"> + <i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span> + </a> + <!-- ENDIF --> + <br />{forumrow.LAST_POST_TIME} + <!-- ELSE --> + {L_NO_POSTS}<br /> + <!-- ENDIF --> + </span> </dd> + <!-- ELSE --> + <dd> </dd> <!-- ENDIF --> </dl> + <!-- EVENT forumlist_body_forum_row_append --> </li> + <!-- EVENT forumlist_body_forum_row_after --> <!-- ENDIF --> <!-- IF forumrow.S_LAST_ROW --> @@ -83,6 +119,7 @@ </div> </div> + <!-- EVENT forumlist_body_last_row_after --> <!-- ENDIF --> <!-- BEGINELSE --> diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 50c7640e62..ec5bf35476 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -1,43 +1,33 @@ <!-- INCLUDE overall_header.html --> -<p class="{S_CONTENT_FLOW_END} responsive-center<!-- IF S_USER_LOGGED_IN --> rightside<!-- ENDIF -->"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --></p> -<!-- IF S_USER_LOGGED_IN --><p class="responsive-center">{CURRENT_TIME}<!-- IF U_MCP or U_ACP --> <br />[ <!-- IF U_ACP --><a href="{U_ACP}" title="{L_ACP}" data-responsive-text="{L_ACP_SHORT}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}" title="{L_MCP}" data-responsive-text="{L_MCP_SHORT}">{L_MCP}</a><!-- ENDIF --> ]<!-- ENDIF --></p><!-- ENDIF --> +<p class="{S_CONTENT_FLOW_END} responsive-center time<!-- IF S_USER_LOGGED_IN --> rightside<!-- ENDIF -->"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --></p> +<!-- IF S_USER_LOGGED_IN --><p class="responsive-center time">{CURRENT_TIME}</p><!-- ENDIF --> -<!-- EVENT index_body_linklist_before --> - -<!-- IF S_DISPLAY_SEARCH or (S_USER_LOGGED_IN and not S_IS_BOT) --> -<ul class="linklist bulletin"> - <!-- IF S_DISPLAY_SEARCH --> - <li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a></li> - <!-- IF S_LOAD_UNREADS --> - <li><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a></li> - <!-- ENDIF --> - <!-- IF S_USER_LOGGED_IN --> - <li><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a></li> - <!-- ENDIF --> - <li><a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li> - <!-- ENDIF --> - <!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside mark-read"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF --> -</ul> +<!-- EVENT index_body_markforums_before --> +<!-- IF U_MARK_FORUMS --> + <div class="action-bar compact"> + <a href="{U_MARK_FORUMS}" class="mark-read rightside" accesskey="m" data-ajax="mark_forums_read">{L_MARK_FORUMS_READ}</a> + </div> <!-- ENDIF --> - -<!-- EVENT index_body_linklist_after --> +<!-- EVENT index_body_markforums_after --> <!-- INCLUDE forumlist_body.html --> +<!-- EVENT index_body_forumlist_body_after --> + <!-- IF not S_USER_LOGGED_IN and not S_IS_BOT --> <form method="post" action="{S_LOGIN_ACTION}" class="headerspace"> <h3><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a><!-- IF S_REGISTER_ENABLED --> • <a href="{U_REGISTER}">{L_REGISTER}</a><!-- ENDIF --></h3> <fieldset class="quick-login"> - <label for="username"><span>{L_USERNAME}{L_COLON}</span> <input type="text" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" /></label> - <label for="password"><span>{L_PASSWORD}{L_COLON}</span> <input type="password" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" /></label> + <label for="username"><span>{L_USERNAME}{L_COLON}</span> <input type="text" tabindex="1" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" /></label> + <label for="password"><span>{L_PASSWORD}{L_COLON}</span> <input type="password" tabindex="2" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" autocomplete="off" /></label> <!-- IF U_SEND_PASSWORD --> <a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a> <!-- ENDIF --> <!-- IF S_AUTOLOGIN_ENABLED --> - <span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" name="autologin" id="autologin" /></label> + <span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" tabindex="4" name="autologin" id="autologin" /></label> <!-- ENDIF --> - <input type="submit" name="login" value="{L_LOGIN}" class="button2" /> + <input type="submit" tabindex="5" name="login" value="{L_LOGIN}" class="button2" /> {S_LOGIN_REDIRECT} </fieldset> </form> @@ -46,19 +36,39 @@ <!-- EVENT index_body_stat_blocks_before --> <!-- IF S_DISPLAY_ONLINE_LIST --> - <!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF --> - <p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST} - <!-- IF LEGEND --><br /><em>{L_LEGEND}{L_COLON} {LEGEND}</em><!-- ENDIF --></p> + <div class="stat-block online-list"> + <!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF --> + <p> + <!-- EVENT index_body_block_online_prepend --> + {TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST} + <!-- IF LEGEND --><br /><em>{L_LEGEND}{L_COLON} {LEGEND}</em><!-- ENDIF --> + <!-- EVENT index_body_block_online_append --> + </p> + </div> <!-- ENDIF --> <!-- IF S_DISPLAY_BIRTHDAY_LIST --> - <h3>{L_BIRTHDAYS}</h3> - <p><!-- IF .birthdays -->{L_CONGRATULATIONS}{L_COLON} <strong><!-- BEGIN birthdays -->{birthdays.USERNAME}<!-- IF birthdays.AGE !== '' --> ({birthdays.AGE})<!-- ENDIF --><!-- IF not birthdays.S_LAST_ROW -->, <!-- ENDIF --><!-- END birthdays --></strong><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p> + <div class="stat-block birthday-list"> + <h3>{L_BIRTHDAYS}</h3> + <p> + <!-- EVENT index_body_block_birthday_prepend --> + <!-- IF .birthdays -->{L_CONGRATULATIONS}{L_COLON} <strong><!-- BEGIN birthdays -->{birthdays.USERNAME}<!-- IF birthdays.AGE !== '' --> ({birthdays.AGE})<!-- ENDIF --><!-- IF not birthdays.S_LAST_ROW -->, <!-- ENDIF --><!-- END birthdays --></strong><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --> + <!-- EVENT index_body_block_birthday_append --> + </p> + </div> <!-- ENDIF --> <!-- IF NEWEST_USER --> - <h3>{L_STATISTICS}</h3> - <p>{TOTAL_POSTS} • {TOTAL_TOPICS} • {TOTAL_USERS} • {NEWEST_USER}</p> + <div class="stat-block statistics"> + <h3>{L_STATISTICS}</h3> + <p> + <!-- EVENT index_body_block_stats_prepend --> + {TOTAL_POSTS} • {TOTAL_TOPICS} • {TOTAL_USERS} • {NEWEST_USER} + <!-- EVENT index_body_block_stats_append --> + </p> + </div> <!-- ENDIF --> +<!-- EVENT index_body_stat_blocks_after --> + <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html index 201b2dece2..0c40e85783 100644 --- a/phpBB/styles/prosilver/template/jumpbox.html +++ b/phpBB/styles/prosilver/template/jumpbox.html @@ -1,33 +1,48 @@ <!-- IF S_VIEWTOPIC --> - <p class="jumpbox-return"><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {FORUM_NAME}</a></p> + <p class="jumpbox-return"> + <a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_RETURN_TO_FORUM}</span> + </a> + </p> <!-- ELSEIF S_VIEWFORUM --> - <p class="jumpbox-return"><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {L_INDEX}</a></p> + <p class="jumpbox-return"> + <a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_RETURN_TO_INDEX}</span> + </a> + </p> <!-- ELSEIF SEARCH_TOPIC --> - <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p> + <p class="jumpbox-return"> + <a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_RETURN_TO_TOPIC}</span> + </a> + </p> <!-- ELSEIF S_SEARCH_ACTION --> - <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_RETURN_TO_SEARCH_ADV}</a></p> + <p class="jumpbox-return"> + <a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_GO_TO_SEARCH_ADV}</span> + </a> + </p> <!-- ENDIF --> <!-- IF S_DISPLAY_JUMPBOX --> - <form method="get" id="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(this.f.value == -1){return false;}"> - <!-- IF $CUSTOM_FIELDSET_CLASS --> - <fieldset class="{$CUSTOM_FIELDSET_CLASS}"> - <!-- ELSE --> - <fieldset class="jumpbox"> - <!-- ENDIF --> - {HIDDEN_FIELDS_FOR_JUMPBOX} - <label for="f" accesskey="j"><!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->{L_COLON}</label> - <select name="f" id="f" onchange="if(this.options[this.selectedIndex].value != -1){ document.forms['jumpbox'].submit() }"> + <div class="jumpbox dropdown-container dropdown-container-right<!-- IF not S_IN_MCP --> dropdown-up<!-- ENDIF --> dropdown-{S_CONTENT_FLOW_BEGIN} dropdown-button-control" id="jumpbox"> + <span title="<!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->" class="button button-secondary dropdown-trigger dropdown-select"> + <span><!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF --></span> + <span class="caret"><i class="icon fa-sort-down fa-fw" aria-hidden="true"></i></span> + </span> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents"> <!-- BEGIN jumpbox_forums --> - <!-- IF jumpbox_forums.S_FORUM_COUNT == 1 --><option value="-1">------------------</option><!-- ENDIF --> - <option value="{jumpbox_forums.FORUM_ID}"{jumpbox_forums.SELECTED}><!-- BEGIN level --> <!-- END level -->{jumpbox_forums.FORUM_NAME}</option> + <!-- IF jumpbox_forums.FORUM_ID neq -1 --> + <li><a href="{jumpbox_forums.LINK}" class="<!-- IF jumpbox_forums.level -->jumpbox-sub-link<!-- ELSEIF jumpbox_forums.S_IS_CAT -->jumpbox-cat-link<!-- ELSE -->jumpbox-forum-link<!-- ENDIF -->"><!-- BEGIN level --><span class="spacer"></span><!-- END level --> <span><!-- IF jumpbox_forums.level --> ↳ <!-- ENDIF --> {jumpbox_forums.FORUM_NAME}</span></a></li> + <!-- ENDIF --> <!-- END jumpbox_forums --> - </select> - <input type="submit" value="{L_GO}" class="button2" /> - </fieldset> - </form> + </ul> + </div> + </div> <!-- ELSE --> <br /><br /> diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html index 38d9f8c68b..ef08035717 100644 --- a/phpBB/styles/prosilver/template/login_body.html +++ b/phpBB/styles/prosilver/template/login_body.html @@ -5,7 +5,7 @@ <div class="inner"> <div class="content"> - <h2><!-- IF LOGIN_EXPLAIN -->{LOGIN_EXPLAIN}<!-- ELSE -->{L_LOGIN}<!-- ENDIF --></h2> + <h2 class="login-title"><!-- IF LOGIN_EXPLAIN -->{LOGIN_EXPLAIN}<!-- ELSE -->{L_LOGIN}<!-- ENDIF --></h2> <fieldset <!-- IF not S_CONFIRM_CODE -->class="fields1"<!-- ELSE -->class="fields2"<!-- ENDIF -->> <!-- IF LOGIN_ERROR --><div class="error">{LOGIN_ERROR}</div><!-- ENDIF --> @@ -15,7 +15,7 @@ </dl> <dl> <dt><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></dt> - <dd><input type="password" tabindex="2" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></dd> + <dd><input type="password" tabindex="2" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" autocomplete="off" /></dd> <!-- IF S_DISPLAY_FULL_LOGIN and (U_SEND_PASSWORD or U_RESEND_ACTIVATION) --> <!-- IF U_SEND_PASSWORD --><dd><a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a></dd><!-- ENDIF --> <!-- IF U_RESEND_ACTIVATION --><dd><a href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a></dd><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/login_forum.html b/phpBB/styles/prosilver/template/login_forum.html index c83a625b3f..7fa9736a96 100644 --- a/phpBB/styles/prosilver/template/login_forum.html +++ b/phpBB/styles/prosilver/template/login_forum.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> -<!-- IF FORUM_NAME --><h2><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2><!-- ENDIF --> +<!-- IF FORUM_NAME --><h2 class="forum-title"><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2><!-- ENDIF --> <form id="login_forum" method="post" action="{S_LOGIN_ACTION}"> {S_FORM_TOKEN} @@ -8,7 +8,7 @@ <div class="inner"> <div class="content"> - <h2>{L_LOGIN}</h2> + <h2 class="login-title">{L_LOGIN}</h2> <p>{L_LOGIN_FORUM}</p> @@ -22,7 +22,7 @@ <dl> <dt><label for="password">{L_PASSWORD}{L_COLON}</label></dt> - <dd><input type="password" tabindex="1" id="password" name="password" size="25" class="inputbox narrow" /></dd> + <dd><input type="password" tabindex="1" id="password" name="password" size="25" class="inputbox narrow" autocomplete="off" /></dd> </dl> {S_LOGIN_REDIRECT} <dl> diff --git a/phpBB/styles/prosilver/template/mcp_approve.html b/phpBB/styles/prosilver/template/mcp_approve.html index ab7f92e262..14472bcf4f 100644 --- a/phpBB/styles/prosilver/template/mcp_approve.html +++ b/phpBB/styles/prosilver/template/mcp_approve.html @@ -34,7 +34,7 @@ <div class="content"> - <h2>{MESSAGE_TITLE}</h2> + <h2 class="message-title">{MESSAGE_TITLE}</h2> <!-- IF ADDITIONAL_MSG --><p class="error">{ADDITIONAL_MSG}</p><!-- ENDIF --> <fieldset> diff --git a/phpBB/styles/prosilver/template/mcp_ban.html b/phpBB/styles/prosilver/template/mcp_ban.html index 591dbf8076..5a7eaa7840 100644 --- a/phpBB/styles/prosilver/template/mcp_ban.html +++ b/phpBB/styles/prosilver/template/mcp_ban.html @@ -5,27 +5,34 @@ var ban_length = new Array(); ban_length[-1] = ''; - <!-- BEGIN ban_length --> - ban_length['{ban_length.BAN_ID}'] = '{ban_length.A_LENGTH}'; - <!-- END ban_length --> - var ban_reason = new Array(); ban_reason[-1] = ''; - <!-- BEGIN ban_reason --> - ban_reason['{ban_reason.BAN_ID}'] = '{ban_reason.A_REASON}'; - <!-- END ban_reason --> - var ban_give_reason = new Array(); ban_give_reason[-1] = ''; - <!-- BEGIN ban_give_reason --> - ban_give_reason['{ban_give_reason.BAN_ID}'] = '{ban_give_reason.A_REASON}'; - <!-- END ban_give_reason --> + + <!-- BEGIN bans --> + ban_length['{bans.BAN_ID}'] = '{bans.A_LENGTH}'; + <!-- IF bans.A_REASON --> + ban_reason['{bans.BAN_ID}'] = '{bans.A_REASON}'; + <!-- ENDIF --> + <!-- IF bans.A_GIVE_REASON --> + ban_give_reason['{bans.BAN_ID}'] = '{bans.A_GIVE_REASON}'; + <!-- ENDIF --> + <!-- END bans --> function display_details(option) { - document.getElementById('unbangivereason').innerHTML = ban_give_reason[option]; - document.getElementById('unbanreason').innerHTML = ban_reason[option]; document.getElementById('unbanlength').innerHTML = ban_length[option]; + if (option in ban_reason) { + document.getElementById('unbanreason').innerHTML = ban_reason[option]; + } else { + document.getElementById('unbanreason').innerHTML = ''; + } + if (option in ban_give_reason) { + document.getElementById('unbangivereason').innerHTML = ban_give_reason[option]; + } else { + document.getElementById('unbangivereason').innerHTML = ''; + } } // ]]> @@ -42,6 +49,7 @@ <p>{L_EXPLAIN}</p> <fieldset> + <!-- EVENT mcp_ban_fields_before --> <dl> <dt><label for="ban">{L_BAN_CELL}{L_COLON}</label></dt> <dd><label for="ban"><textarea name="ban" id="ban" class="inputbox" cols="40" rows="3">{BAN_QUANTIFIER}</textarea></label></dd> @@ -70,6 +78,7 @@ <label for="banexclude0"><input type="radio" name="banexclude" id="banexclude0" value="0" checked="checked" /> {L_NO}</label> </dd> </dl> + <!-- EVENT mcp_ban_fields_after --> </fieldset> </div> @@ -89,6 +98,7 @@ <!-- IF S_BANNED_OPTIONS --> <fieldset> + <!-- EVENT mcp_ban_unban_before --> <dl> <dt><label for="unban">{L_BAN_CELL}{L_COLON}</label></dt> <dd><select name="unban[]" id="unban" multiple="multiple" size="5" onchange="if (this.selectedIndex != -1) {display_details(this.options[this.selectedIndex].value);}">{BANNED_OPTIONS}</select></dd> @@ -105,6 +115,7 @@ <dt>{L_BAN_GIVE_REASON}{L_COLON}</dt> <dd><strong id="unbangivereason"></strong></dd> </dl> + <!-- EVENT mcp_ban_unban_after --> </fieldset> </div> diff --git a/phpBB/styles/prosilver/template/mcp_footer.html b/phpBB/styles/prosilver/template/mcp_footer.html index e5768bdc6b..89ce7c34ab 100644 --- a/phpBB/styles/prosilver/template/mcp_footer.html +++ b/phpBB/styles/prosilver/template/mcp_footer.html @@ -1,9 +1,8 @@ </div> - <div class="clear"></div> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 6ca176a4aa..147afff0f5 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -10,23 +10,21 @@ <div class="panel"> <div class="inner"> - <!-- IF .pagination or TOTAL_TOPICS --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> - <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </li> - </ul> - <!-- ENDIF --> + <div class="action-bar bar-top"> + <div class="pagination"> + {TOTAL_TOPICS} + <!-- IF .pagination --> + <!-- INCLUDE pagination.html --> + <!-- ELSE --> + • {PAGE_NUMBER} + <!-- ENDIF --> + </div> + </div> <!-- IF .topicrow --> <ul class="topiclist<!-- IF S_MERGE_SELECT --> missing-column<!-- ENDIF -->"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt><div class="list-inner">{L_TOPICS}</div></dt> <dd class="posts">{L_REPLIES}</dd> <dd class="lastpost"><span>{L_LAST_POST}</span></dd> @@ -38,17 +36,39 @@ <!-- BEGIN topicrow --> <li class="row<!-- IF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->"> - <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> + <dl class="row-item {topicrow.TOPIC_IMG_STYLE}"> <dt <!-- IF topicrow.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF -->> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> - + <!-- EVENT topiclist_row_prepend --> <!-- IF topicrow.S_SELECT_TOPIC --><a href="{topicrow.U_SELECT_TOPIC}" class="topictitle">[ {L_SELECT_MERGE} ]</a> <!-- ENDIF --> + <!-- EVENT mcp_forum_topic_title_before --> <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_DELETED or topicrow.S_POSTS_DELETED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.DELETED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> + <!-- EVENT mcp_forum_topic_title_after --> + <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> + <a href="{topicrow.U_MCP_QUEUE}" title="{TOPIC_UNAPPROVED}"> + <i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{TOPIC_UNAPPROVED}</span> + </a> + <!-- ENDIF --> + <!-- IF topicrow.S_TOPIC_DELETED or topicrow.S_POSTS_DELETED --> + <a href="{topicrow.U_MCP_QUEUE}" title="{TOPIC_DELETED"> + <i class="icon fa-recycle fa-fw icon-green" aria-hidden="true"></i><span class="sr-only">{TOPIC_DELETED}</span> + </a> + <!-- ENDIF --> + <!-- IF topicrow.S_TOPIC_REPORTED --> + <a href="{topicrow.U_MCP_REPORT}" title="{TOPIC_REPORTED}"> + <i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{TOPIC_REPORTED}</span> + </a> + <!-- ENDIF --> <!-- IF topicrow.S_MOVED_TOPIC and S_CAN_DELETE --> <a href="{topicrow.U_DELETE_TOPIC}" class="topictitle">[ {L_DELETE_SHADOW_TOPIC} ]</a><!-- ENDIF --> <br /> + + <div class="responsive-show" style="display: none;"> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> + {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « {topicrow.LAST_POST_TIME}<br /> + </div> + <span class="responsive-show left-box" style="display: none;">{L_REPLIES}{L_COLON} <strong>{topicrow.REPLIES}</strong></span> + <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -63,21 +83,16 @@ </ul> </div> <!-- ENDIF --> + <div class="responsive-hide"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} </div> - <div class="responsive-show" style="display: none;"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « {topicrow.LAST_POST_TIME}<br /> - {L_REPLIES}{L_COLON} <strong>{topicrow.REPLIES}</strong> - </div> - + <!-- EVENT topiclist_row_append --> </div> </dt> <dd class="posts">{topicrow.REPLIES} <dfn>{L_REPLIES}</dfn></dd> - <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}<br />{topicrow.LAST_POST_TIME}</span> - </dd> + <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}<br />{topicrow.LAST_POST_TIME}</span></dd> <!-- IF not S_MERGE_SELECT --> <dd class="mark"> <!-- IF not topicrow.S_MOVED_TOPIC --><input type="checkbox" name="topic_id_list[]" value="{topicrow.TOPIC_ID}"<!-- IF topicrow.S_TOPIC_CHECKED --> checked="checked"<!-- ENDIF --> /><!-- ELSE --> <!-- ENDIF --> @@ -93,29 +108,18 @@ </ul> <!-- ENDIF --> - <fieldset class="display-options"> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <label>{L_DISPLAY_TOPICS}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> - <label>{S_SELECT_SORT_DIR}</label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - </fieldset> + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> - <hr /> - - <!-- IF .pagination or TOTAL_TOPICS --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> - <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </li> - </ul> - <!-- ENDIF --> + <div class="pagination"> + {TOTAL_TOPICS} + <!-- IF .pagination --> + <!-- INCLUDE pagination.html --> + <!-- ELSE --> + • {PAGE_NUMBER} + <!-- ENDIF --> + </div> + </div> </div> </div> @@ -133,10 +137,8 @@ <!-- IF S_CAN_SYNC --><option value="resync">{L_RESYNC}</option><!-- ENDIF --> <!-- IF S_CAN_MAKE_NORMAL --><option value="make_normal">{L_MAKE_NORMAL}</option><!-- ENDIF --> <!-- IF S_CAN_MAKE_STICKY --><option value="make_sticky">{L_MAKE_STICKY}</option><!-- ENDIF --> - <!-- IF S_CAN_MAKE_ANNOUNCE --> - <option value="make_announce">{L_MAKE_ANNOUNCE}</option> - <option value="make_global">{L_MAKE_GLOBAL}</option> - <!-- ENDIF --> + <!-- IF S_CAN_MAKE_ANNOUNCE --><option value="make_announce">{L_MAKE_ANNOUNCE}</option><!-- ENDIF --> + <!-- IF S_CAN_MAKE_ANNOUNCE_GLOBAL --><option value="make_global">{L_MAKE_GLOBAL}</option><!-- ENDIF --> </select> <input class="button2" type="submit" value="{L_SUBMIT}" /> <div><a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a></div> diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index 44295611cf..97775814db 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -2,6 +2,8 @@ <h2>{PAGE_TITLE}</h2> +<!-- EVENT mcp_front_latest_unapproved_before --> + <!-- IF S_SHOW_UNAPPROVED --> <form id="mcp_queue" method="post" action="{S_MCP_QUEUE_ACTION}"> @@ -28,7 +30,7 @@ <dl> <dt> <div class="list-inner"> - <a href="{unapproved.U_POST_DETAILS}" class="topictitle">{unapproved.SUBJECT}</a> {unapproved.ATTACH_ICON_IMG}<br /> + <a href="{unapproved.U_POST_DETAILS}" class="topictitle">{unapproved.SUBJECT}</a> <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br /> {L_POSTED} {L_POST_BY_AUTHOR} {unapproved.AUTHOR_FULL} » {unapproved.POST_TIME} </div> </dt> @@ -59,6 +61,8 @@ </form> <!-- ENDIF --> +<!-- EVENT mcp_front_latest_reported_before --> + <!-- IF S_SHOW_REPORTS --> <div class="panel"> <div class="inner"> @@ -82,12 +86,12 @@ <dl> <dt> <div class="list-inner"> - <a href="{report.U_POST_DETAILS}#reports" class="topictitle">{report.SUBJECT}</a> {report.ATTACH_ICON_IMG}<br /> + <a href="{report.U_POST_DETAILS}#reports" class="topictitle">{report.SUBJECT}</a> <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br /> <span>{L_POSTED} {L_POST_BY_AUTHOR} {report.AUTHOR_FULL} » {report.POST_TIME}</span> </div> </dt> <dd class="moderation"> - <span>{L_REPORTED} {L_POST_BY_AUTHOR} {report.REPORTER_FULL} {L_REPORTED_ON_DATE} {report.REPORT_TIME}<br /> + <span>{L_REPORTED} {L_POST_BY_AUTHOR} {report.REPORTER_FULL} {L_REPORTED_ON_DATE} <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br /> {L_FORUM}{L_COLON} <a href="{report.U_FORUM}">{report.FORUM_NAME}</a></span> </dd> </dl> @@ -100,6 +104,8 @@ </div> <!-- ENDIF --> +<!-- EVENT mcp_front_latest_reported_pms_before --> + <!-- IF S_SHOW_PM_REPORTS --> <div class="panel"> <div class="inner"> @@ -123,7 +129,7 @@ <dl> <dt> <div class="list-inner"> - <a href="{pm_report.U_PM_DETAILS}" class="topictitle">{pm_report.PM_SUBJECT}</a> {pm_report.ATTACH_ICON_IMG}<br /> + <a href="{pm_report.U_PM_DETAILS}" class="topictitle">{pm_report.PM_SUBJECT}</a> <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br /> <span>{L_MESSAGE_BY_AUTHOR} {pm_report.PM_AUTHOR_FULL} » {pm_report.PM_TIME}</span><br /> <span>{L_MESSAGE_TO} {pm_report.RECIPIENTS}</span> </div> @@ -141,6 +147,8 @@ </div> <!-- ENDIF --> +<!-- EVENT mcp_front_latest_logs_before --> + <!-- IF S_SHOW_LOGS --> <div class="panel"> <div class="inner"> @@ -180,4 +188,6 @@ </div> <!-- ENDIF --> +<!-- EVENT mcp_front_latest_logs_after --> + <!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/prosilver/template/mcp_header.html b/phpBB/styles/prosilver/template/mcp_header.html index 51f496605e..5841c1bbd2 100644 --- a/phpBB/styles/prosilver/template/mcp_header.html +++ b/phpBB/styles/prosilver/template/mcp_header.html @@ -8,10 +8,10 @@ </p> <!-- ENDIF --> -<div id="tabs"> +<div id="tabs" class="tabs"> <ul> <!-- BEGIN l_block1 --> - <li<!-- IF l_block1.S_SELECTED --> class="activetab"<!-- ENDIF -->><a href="{l_block1.U_TITLE}"><span>{l_block1.L_TITLE}</span></a></li> + <li class="tab<!-- IF l_block1.S_SELECTED --> activetab<!-- ENDIF -->"><a href="{l_block1.U_TITLE}">{l_block1.L_TITLE}</a></li> <!-- END l_block1 --> </ul> </div> @@ -21,14 +21,14 @@ <div style="width: 100%;"> - <div id="cp-menu"> - <div id="navigation"> + <div id="cp-menu" class="cp-menu"> + <div id="navigation" class="navigation" role="navigation"> <ul> <!-- BEGIN l_block1 --> <!-- IF l_block1.S_SELECTED --> <!-- BEGIN l_block2 --> <!-- IF l_block1.l_block2.S_SELECTED --> - <li id="active-subsection"><a href="{l_block1.l_block2.U_TITLE}"><span>{l_block1.l_block2.L_TITLE}<!-- IF l_block1.l_block2.ADD_ITEM --> ({l_block1.l_block2.ADD_ITEM})<!-- ENDIF --></span></a></li> + <li id="active-subsection" class="active-subsection"><a href="{l_block1.l_block2.U_TITLE}"><span>{l_block1.l_block2.L_TITLE}<!-- IF l_block1.l_block2.ADD_ITEM --> ({l_block1.l_block2.ADD_ITEM})<!-- ENDIF --></span></a></li> <!-- ELSE --> <li><a href="{l_block1.l_block2.U_TITLE}"><span>{l_block1.l_block2.L_TITLE}<!-- IF l_block1.l_block2.ADD_ITEM --> ({l_block1.l_block2.ADD_ITEM})<!-- ENDIF --></span></a></li> <!-- ENDIF --> @@ -39,27 +39,11 @@ </div> </div> - <div id="cp-main" class="mcp-main panel-container"> + <div id="cp-main" class="cp-main mcp-main panel-container"> <!-- IF MESSAGE --> <div class="content"> - <h2>{L_MESSAGE}</h2> + <h2 class="message-title">{L_MESSAGE}</h2> <p class="error">{MESSAGE}</p> <p><!-- BEGIN return_links -->{return_links.MESSAGE_LINK}<br /><br /><!-- END return_links --></p> </div> <!-- ENDIF --> - - <!-- IF CONFIRM_MESSAGE --> - <form id="confirm" method="post" action="{S_CONFIRM_ACTION}"{S_FORM_ENCTYPE}> - - <div class="content"> - <h2>{L_PLEASE_CONFIRM}</h2> - <p>{CONFIRM_MESSAGE}</p> - - <fieldset class="submit-buttons"> - {S_HIDDEN_FIELDS}<input class="button1" type="submit" name="submit" value="{L_YES}" /> - <input class="button2" type="cancel" value="{L_NO}" /> - </fieldset> - </div> - - </form> - <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_logs.html b/phpBB/styles/prosilver/template/mcp_logs.html index b930bbbcc6..a50bd95ccd 100644 --- a/phpBB/styles/prosilver/template/mcp_logs.html +++ b/phpBB/styles/prosilver/template/mcp_logs.html @@ -7,27 +7,25 @@ <div class="panel"> <div class="inner"> - <ul class="linklist"> - <li class="leftside"> - {L_SEARCH_KEYWORDS}{L_COLON} <input type="search" class="inputbox autowidth" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="button2" name="filter" value="{L_SEARCH}" /> - </li> - <li class="rightside pagination"> - <!-- IF TOTAL -->{TOTAL} • <!-- ENDIF --> + <div class="action-bar bar-top"> + {L_SEARCH_KEYWORDS}{L_COLON} <input type="search" class="inputbox autowidth" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="button2" name="filter" value="{L_SEARCH}" /> + <div class="pagination"> + {TOTAL} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> <table class="table1"> <thead> <tr> - <th>{L_USERNAME}</th> - <th style="text-align: center">{L_IP}</th> - <th style="text-align: center">{L_TIME}</th> - <th>{L_ACTION}</th> + <th class="name">{L_USERNAME}</th> + <th class="center">{L_IP}</th> + <th class="center">{L_TIME}</th> + <th class="name">{L_ACTION}</th> <!-- IF S_CLEAR_ALLOWED --><th>{L_MARK}</th><!-- ENDIF --> </tr> </thead> @@ -36,8 +34,8 @@ <!-- BEGIN log --> <!-- IF log.S_ROW_COUNT is even --><tr class="bg1"><!-- ELSE --><tr class="bg2"><!-- ENDIF --> <td>{log.USERNAME}</td> - <td style="text-align: center">{log.IP}</td> - <td style="text-align: center">{log.DATE}</td> + <td class="center">{log.IP}</td> + <td class="center">{log.DATE}</td> <td>{log.ACTION}<br /> {log.DATA} </td> @@ -53,27 +51,19 @@ </table> <!-- IF .log --> - <fieldset class="display-options"> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> - <label>{S_SELECT_SORT_DIR}</label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - </fieldset> - - <hr /> + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL -->{TOTAL} • <!-- ENDIF --> + <div class="pagination"> + {TOTAL} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + {S_FORM_TOKEN} </div> </div> diff --git a/phpBB/styles/prosilver/template/mcp_message.html b/phpBB/styles/prosilver/template/mcp_message.html index 7102c658c4..062103b91c 100644 --- a/phpBB/styles/prosilver/template/mcp_message.html +++ b/phpBB/styles/prosilver/template/mcp_message.html @@ -1,7 +1,7 @@ <!-- INCLUDE mcp_header.html --> <div class="content"> - <h2>{MESSAGE_TITLE}</h2> + <h2 class="message-title">{MESSAGE_TITLE}</h2> <p>{MESSAGE_TEXT}</p> </div> diff --git a/phpBB/styles/prosilver/template/mcp_move.html b/phpBB/styles/prosilver/template/mcp_move.html index c2ee25f0d9..d028fffeb4 100644 --- a/phpBB/styles/prosilver/template/mcp_move.html +++ b/phpBB/styles/prosilver/template/mcp_move.html @@ -37,7 +37,7 @@ <div class="inner"> <div class="content"> - <h2>{MESSAGE_TITLE}</h2> + <h2 class="message-title">{MESSAGE_TITLE}</h2> <!-- IF ADDITIONAL_MSG --><p>{ADDITIONAL_MSG}</p><!-- ENDIF --> <fieldset> diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html index 9b6c9b2667..6a9d88389c 100644 --- a/phpBB/styles/prosilver/template/mcp_notes_user.html +++ b/phpBB/styles/prosilver/template/mcp_notes_user.html @@ -50,26 +50,24 @@ <div class="panel"> <div class="inner"> - <ul class="linklist"> - <li class="leftside"> - {L_SEARCH_KEYWORDS}{L_COLON} <input type="search" class="inputbox autowidth" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="button2" name="filter" value="{L_SEARCH}" /> - </li> - <li class="rightside pagination"> - <!-- IF TOTAL_REPORTS -->{TOTAL_REPORTS} • <!-- ENDIF --> + <div class="action-bar bar-top"> + {L_SEARCH_KEYWORDS}{L_COLON} <input type="search" class="inputbox autowidth" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="button2" name="filter" value="{L_SEARCH}" /> + <div class="pagination"> + {TOTAL_REPORTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> <table class="table1"> <thead> <tr> - <th>{L_REPORT_BY}</th> - <th style="text-align: center">{L_IP}</th> - <th style="text-align: center">{L_TIME}</th> + <th class="name reportby">{L_REPORT_BY}</th> + <th class="center">{L_IP}</th> + <th class="center">{L_TIME}</th> <th>{L_ACTION_NOTE}</th> <!-- IF S_CLEAR_ALLOWED --><th>{L_MARK}</th><!-- ENDIF --> </tr> @@ -78,11 +76,11 @@ <!-- BEGIN usernotes --> <!-- IF usernotes.S_ROW_COUNT is even --><tr class="bg1"><!-- ELSE --><tr class="bg2"><!-- ENDIF --> <td>{usernotes.REPORT_BY}</td> - <td style="text-align: center">{usernotes.IP}</td> - <td style="text-align: center">{usernotes.REPORT_AT}</td> + <td class="center">{usernotes.IP}</td> + <td class="center">{usernotes.REPORT_AT}</td> <td>{usernotes.ACTION}</td> - <!-- IF S_CLEAR_ALLOWED --><td style="width: 5%; text-align: center;"><input type="checkbox" name="marknote[]" id="note-{usernotes.ID}" value="{usernotes.ID}" /></td><!-- ENDIF --> + <!-- IF S_CLEAR_ALLOWED --><td class="center" style="width: 5%;"><input type="checkbox" name="marknote[]" id="note-{usernotes.ID}" value="{usernotes.ID}" /></td><!-- ENDIF --> </tr> <!-- BEGINELSE --> <tr> @@ -92,28 +90,18 @@ </tbody> </table> - <hr /> - - <fieldset class="display-options"> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <label>{L_DISPLAY_LOG}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - </fieldset> + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> - <hr /> - - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_REPORTS -->{TOTAL_REPORTS} • <!-- ENDIF --> + <div class="pagination"> + {TOTAL_REPORTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> </div> </div> diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index 2b4ebec5c8..c7b52bb3a5 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -14,7 +14,7 @@ <h3>{L_REPORT_REASON}{L_COLON} {REPORT_REASON_TITLE}</h3> <p class="author">{L_REPORTED} {L_POST_BY_AUTHOR} {REPORTER_FULL} « {REPORT_DATE}</p> <!-- IF S_REPORT_CLOSED --> - <p class="post-notice reported">{L_REPORT_CLOSED}</p> + <p class="post-notice reported"><i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i>{L_REPORT_CLOSED}</p> <!-- ENDIF --> <div class="content"> <!-- IF REPORT_TEXT --> @@ -50,13 +50,20 @@ <div class="postbody"> <h3><a href="{U_VIEW_POST}">{POST_SUBJECT}</a></h3> - <!-- IF U_EDIT --> - <ul class="profile-icons"> - <li class="edit-icon"><a href="{U_EDIT}" title="{L_EDIT_POST}"><span>{L_EDIT_POST}</span></a></li> + <ul class="post-buttons"> + <li id="expand"> + <a href="#post_details" onclick="viewableArea(getElementById('post_details'), true); var rev_text = getElementById('expand').getElementsByTagName('a').item(0).firstChild; if (rev_text.data.trim() == '{LA_EXPAND_VIEW}'){rev_text.data = '{LA_COLLAPSE_VIEW}'; } else if (rev_text.data.trim() == '{LA_COLLAPSE_VIEW}'){rev_text.data = '{LA_EXPAND_VIEW}';} return false;"> + {L_EXPAND_VIEW} + </a> + </li> + <!-- IF U_EDIT --> + <li> + <a href="{U_EDIT}" title="{L_EDIT_POST}" class="button"> + <i class="icon fa-pencil fa-fw" aria-hidden="true"></i><span class="sr-only">{L_EDIT_POST}</span> + </a> + </li> + <!-- ENDIF --> </ul> - <!-- ENDIF --> - - <span class="right-box" id="expand"><a href="#post_details" onclick="viewableArea(getElementById('post_details'), true); var rev_text = getElementById('expand').getElementsByTagName('a').item(0).firstChild; if (rev_text.data == '{LA_EXPAND_VIEW}'){rev_text.data = '{LA_COLLAPSE_VIEW}'; } else if (rev_text.data == '{LA_COLLAPSE_VIEW}'){rev_text.data = '{LA_EXPAND_VIEW}'}; return false;">{L_EXPAND_VIEW}</a></span> <!-- IF S_PM --> <p class="author"> @@ -66,7 +73,7 @@ <!-- IF S_BCC_RECIPIENT --><br /><strong>{L_BCC}{L_COLON}</strong> <!-- BEGIN bcc_recipient --><!-- IF bcc_recipient.NAME_FULL -->{bcc_recipient.NAME_FULL}<!-- ELSE --><a href="{bcc_recipient.U_VIEW}" style="color:<!-- IF bcc_recipient.COLOUR -->{bcc_recipient.COLOUR}<!-- ELSEIF bcc_recipient.IS_GROUP -->#0000FF<!-- ENDIF -->;">{bcc_recipient.NAME}</a><!-- ENDIF --> <!-- END bcc_recipient --><!-- ENDIF --> </p> <!-- ELSE --> - <p class="author">{MINI_POST_IMG} {L_POSTED} {L_POST_BY_AUTHOR} {POST_AUTHOR_FULL} » {POST_DATE}</p> + <p class="author"><span><i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{MINI_POST_IMG}</span></span> {L_POSTED} {L_POST_BY_AUTHOR} {POST_AUTHOR_FULL} » {POST_DATE}</p> <!-- ENDIF --> <!-- IF S_POST_UNAPPROVED --> @@ -84,9 +91,9 @@ <form method="post" id="mcp_approve" action="{U_APPROVE_ACTION}"> <p class="post-notice deleted"> - <input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" /> + <!-- IF S_CAN_DELETE_POST --><input class="button2" type="submit" value="{L_DELETE}" name="action[delete]" /> <!-- ENDIF --> <input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" /> - <!-- IF not S_FIRST_POST --><input type="hidden" name="mode" value="unapproved_posts" /><!-- ENDIF --> + <!-- IF not S_FIRST_POST --><input type="hidden" name="mode" value="deleted_posts" /><!-- ENDIF --> <input type="hidden" name="post_id_list[]" value="{POST_ID}" /> {S_FORM_TOKEN} </p> @@ -95,11 +102,11 @@ <!-- IF S_MESSAGE_REPORTED --> <p class="post-notice reported"> - {REPORTED_IMG} <a href="{U_MCP_REPORT}"><strong>{L_MESSAGE_REPORTED}</strong></a> + <i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{TOPIC_REPORTED}</span> <a href="{U_MCP_REPORT}"><strong>{L_MESSAGE_REPORTED}</strong></a> </p> <!-- ENDIF --> - <div class="content" id="post_details"> + <div id="post_details" class="content post_details"> {POST_PREVIEW} </div> @@ -137,7 +144,7 @@ </div> </div> -<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER --> +<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER or S_MCP_POST_ADDITIONAL_OPTS --> <div class="panel"> <div class="inner"> @@ -161,6 +168,8 @@ </form> <!-- ENDIF --> + <!-- EVENT mcp_post_additional_options --> + <!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST --> <form method="post" id="mcp" action="{U_MCP_ACTION}"> diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html index 461d5982db..ce58d110e1 100644 --- a/phpBB/styles/prosilver/template/mcp_queue.html +++ b/phpBB/styles/prosilver/template/mcp_queue.html @@ -16,16 +16,17 @@ <p>{L_EXPLAIN}</p> <!-- IF .postrow --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL --> {TOTAL} • <!-- ENDIF --> + <div class="action-bar bar-top"> + <div class="pagination"> + {TOTAL} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + <ul class="topiclist missing-column"> <li class="header"> <dl> @@ -47,7 +48,7 @@ <dl> <dt> <div class="list-inner"> - <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.POST_SUBJECT}</a> {postrow.ATTACH_ICON_IMG}<br /> + <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.POST_SUBJECT}</a> <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br /> <span>{L_POSTED} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} » {postrow.POST_TIME}</span> </div> </dt> @@ -72,27 +73,20 @@ <!-- END postrow --> </ul> - <fieldset class="display-options"> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label> - <!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" /> <strong>{L_ONLY_TOPIC}</strong></label><!-- ENDIF --> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - </fieldset> - - <hr /> + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> + <!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" onClick="document.getElementById('mcp').submit()" /> <strong>{L_ONLY_TOPIC}</strong></label><!-- ENDIF --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL -->{TOTAL} • <!-- ENDIF --> + <div class="pagination"> + {TOTAL} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + <!-- ELSE --> <p class="notopics"><strong> <!-- IF S_RESTORE --> diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index ffa82d5e0e..4131d9f2f3 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -18,16 +18,17 @@ <p>{L_EXPLAIN}</p> <!-- IF .postrow --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL -->{TOTAL_REPORTS} • <!-- ENDIF --> + <div class="action-bar bar-top"> + <div class="pagination"> + {TOTAL_REPORTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + <ul class="topiclist missing-column"> <li class="header"> <dl> @@ -45,7 +46,7 @@ <!-- IF S_PM --> <dt> <div class="list-inner"> - <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.PM_SUBJECT}</a> {postrow.ATTACH_ICON_IMG}<br /> + <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.PM_SUBJECT}</a> <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br /> <span>{L_MESSAGE_BY_AUTHOR} {postrow.PM_AUTHOR_FULL} » {postrow.PM_TIME}</span><br /> <span>{L_MESSAGE_TO} {postrow.RECIPIENTS}</span> <div class="responsive-show" style="display: none;"> @@ -59,7 +60,7 @@ <!-- ELSE --> <dt> <div class="list-inner"> - <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.POST_SUBJECT}</a> {postrow.ATTACH_ICON_IMG}<br /> + <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.POST_SUBJECT}</a><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br /> <span>{L_POSTED} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} » {postrow.POST_TIME}</span> <div class="responsive-show" style="display: none;"> {L_REPORTER}{L_COLON} {postrow.REPORTER_FULL} « {postrow.REPORT_TIME}<br /> @@ -78,25 +79,19 @@ <!-- END postrow --> </ul> - <fieldset class="display-options"> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label> - <!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" /> <strong>{L_ONLY_TOPIC}</strong></label><!-- ENDIF --> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - </fieldset> - <hr /> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL -->{TOTAL_REPORTS} • <!-- ENDIF --> + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> + <!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" onClick="document.getElementById('mcp').submit()" /> <strong>{L_ONLY_TOPIC}</strong></label><!-- ENDIF --> + + <div class="pagination"> + {TOTAL_REPORTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> <!-- ELSE --> <p><strong>{L_NO_REPORTS}</strong></p> diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index bfe18579a6..5f11e763e1 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -11,16 +11,16 @@ <!-- DEFINE $SHOW_PANEL = 'display-panel' --> <!-- ENDIF --> -<div id="minitabs" class="sub-panels" data-show-panel="{$SHOW_PANEL}"> +<div id="minitabs" class="minitabs sub-panels" data-show-panel="{$SHOW_PANEL}" role="tablist"> <ul> - <li id="display-panel-tab"<!-- IF not S_MERGE_VIEW --> class="activetab"<!-- ENDIF -->> - <a href="#minitabs" data-subpanel="display-panel"><span>{L_DISPLAY_OPTIONS}</span></a> + <li id="display-panel-tab" class="tab<!-- IF not S_MERGE_VIEW --> activetab<!-- ENDIF -->"> + <a href="#minitabs" data-subpanel="display-panel" role="tab" aria-controls="display-panel">{L_DISPLAY_OPTIONS}</a> </li> - <li id="split-panel-tab"> - <a href="#minitabs" data-subpanel="split-panel"><span>{L_SPLIT_TOPIC}</span></a> + <li id="split-panel-tab" class="tab"> + <a href="#minitabs" data-subpanel="split-panel" role="tab" aria-controls="split-panel">{L_SPLIT_TOPIC}</a> </li> - <li id="merge-panel-tab"<!-- IF S_MERGE_VIEW --> class="activetab"<!-- ENDIF -->> - <a href="#minitabs" data-subpanel="merge-panel"><span>{L_MERGE_POSTS}</span></a> + <li id="merge-panel-tab" class="tab<!-- IF S_MERGE_VIEW --> activetab<!-- ENDIF -->"> + <a href="#minitabs" data-subpanel="merge-panel" role="tab" aria-controls="merge-panel">{L_MERGE_POSTS}</a> </li> </ul> </div> @@ -31,10 +31,10 @@ <div class="panel"> <div class="inner"> - <fieldset id="display-panel" class="fields2"> + <fieldset id="display-panel" class="fields2" role="tabpanel"> <dl> <dt><label for="posts_per_page">{L_POSTS_PER_PAGE}{L_COLON}</label><br /><span>{L_POSTS_PER_PAGE_EXPLAIN}</span></dt> - <dd><input class="inputbox autowidth" type="number" min="1" name="posts_per_page" id="posts_per_page" size="6" value="{POSTS_PER_PAGE}" /></dd> + <dd><input class="inputbox autowidth" type="number" min="0" name="posts_per_page" id="posts_per_page" size="6" value="{POSTS_PER_PAGE}" /></dd> </dl> <dl> <dt><label>{L_DISPLAY_POSTS}{L_COLON}</label></dt> @@ -43,7 +43,7 @@ </fieldset> <!-- IF S_CAN_SPLIT --> - <fieldset id="split-panel" class="fields2"> + <fieldset id="split-panel" class="fields2" role="tabpanel"> <p>{L_SPLIT_TOPIC_EXPLAIN}</p> <!-- IF S_SHOW_TOPIC_ICONS --> @@ -54,10 +54,12 @@ </dl> <!-- ENDIF --> + <!-- EVENT mcp_topic_options_before --> <dl> <dt><label for="subject">{L_SPLIT_SUBJECT}{L_COLON}</label></dt> <dd><input type="text" name="subject" id="subject" size="45" maxlength="124" tabindex="2" value="{SPLIT_SUBJECT}" title="{L_SPLIT_SUBJECT}" class="inputbox" /></dd> </dl> + <!-- EVENT mcp_topic_options_after --> <dl> <dt><label>{L_SPLIT_FORUM}{L_COLON}</label></dt> <dd><select name="to_forum_id">{S_FORUM_SELECT}</select></dd> @@ -66,7 +68,7 @@ <!-- ENDIF --> <!-- IF S_CAN_MERGE --> - <fieldset id="merge-panel" class="fields2"> + <fieldset id="merge-panel" class="fields2" role="tabpanel"> <p>{L_MERGE_TOPIC_EXPLAIN}</p> <dl> <dt><label for="to_topic_id">{L_MERGE_TOPIC_ID}{L_COLON}</label></dt> @@ -85,25 +87,39 @@ <div class="panel"> <div class="inner"> - <h3 id="review"> + <h3 id="review" class="review"> <span class="right-box"><a href="#review" onclick="viewableArea(getElementById('topicreview'), true); var rev_text = getElementById('review').getElementsByTagName('a').item(0).firstChild; if (rev_text.data == '{LA_EXPAND_VIEW}'){rev_text.data = '{LA_COLLAPSE_VIEW}'; } else if (rev_text.data == '{LA_COLLAPSE_VIEW}'){rev_text.data = '{LA_EXPAND_VIEW}'};">{L_EXPAND_VIEW}</a></span> - {L_TOPIC_REVIEW}{L_COLON} {TOPIC_TITLE} + {L_TOPIC_REVIEW}{L_COLON} <!-- EVENT mcp_topic_topic_title_before -->{TOPIC_TITLE}<!-- EVENT mcp_topic_topic_title_after --> </h3> - <div id="topicreview"> + <div id="topicreview" class="topicreview"> <!-- BEGIN postrow --> <div class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> <div class="inner"> <div class="postbody" id="pr{postrow.POST_ID}"> - <ul class="profile-icons"><li class="info-icon"><a href="{postrow.U_POST_DETAILS}" title="{L_POST_DETAILS}"><span>{L_POST_DETAILS}</span></a></li><li><label for="post_id_list_select_{postrow.POST_ID}">{L_SELECT}{L_COLON} <input type="checkbox" id="post_id_list_select_{postrow.POST_ID}" name="post_id_list[]" value="{postrow.POST_ID}"<!-- IF postrow.S_CHECKED --> checked="checked"<!-- ENDIF --> /></label></li></ul> + <ul class="post-buttons"> + <li> + <a href="{postrow.U_POST_DETAILS}" title="{L_POST_DETAILS}" class="button button-icon-only"> + <i class="icon fa-info fa-fw" aria-hidden="true"></i><span class="sr-only">{L_POST_DETAILS}</span> + </a> + </li> + <li> + <label for="post_id_list_select_{postrow.POST_ID}">{L_SELECT}{L_COLON} + <input type="checkbox" id="post_id_list_select_{postrow.POST_ID}" name="post_id_list[]" value="{postrow.POST_ID}"<!-- IF postrow.S_CHECKED --> checked="checked"<!-- ENDIF --> /> + </label> + </li> + </ul> <h3><a href="{postrow.U_POST_DETAILS}">{postrow.POST_SUBJECT}</a></h3> - <p class="author"><a href="#pr{postrow.POST_ID}">{postrow.MINI_POST_IMG}</a> {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong><!-- IF postrow.U_MCP_DETAILS --> [ <a href="{postrow.U_MCP_DETAILS}">{L_POST_DETAILS}</a> ]<!-- ENDIF --></p> - + <p class="author"> + <a href="#pr{postrow.POST_ID}" title="{postrow.MINI_POST}"> + <i class="icon fa-file fa-fw icon-lightgray icon-tiny" aria-hidden="true"></i><span class="sr-only">{postrow.MINI_POST}</span> + </a> {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong><!-- IF postrow.U_MCP_DETAILS --> [ <a href="{postrow.U_MCP_DETAILS}">{L_POST_DETAILS}</a> ]<!-- ENDIF --> + </p> <!-- IF postrow.S_POST_UNAPPROVED --> <p class="post-notice unapproved"> - <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_UNAPPROVED}</strong></a> + <a href="{postrow.U_MCP_APPROVE}"><i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><strong>{L_POST_UNAPPROVED}</strong></a> </p> <!-- ENDIF --> @@ -115,7 +131,7 @@ <!-- IF postrow.S_POST_REPORTED --> <p class="post-notice reported"> - <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a> + <a href="{postrow.U_MCP_REPORT}"><i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><strong>{L_POST_REPORTED}</strong></a> </p> <!-- ENDIF --> @@ -139,18 +155,16 @@ <hr /> - <!-- IF .pagination or TOTAL_POSTS --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_POSTS --> {TOTAL_POSTS} • <!-- ENDIF --> + <div class="action-bar bar-bottom"> + <div class="pagination"> + {TOTAL_POSTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> - <!-- ENDIF --> + </div> + </div> </div> </div> diff --git a/phpBB/styles/prosilver/template/mcp_warn_list.html b/phpBB/styles/prosilver/template/mcp_warn_list.html index 731c945fe6..215e155d5c 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_list.html +++ b/phpBB/styles/prosilver/template/mcp_warn_list.html @@ -10,17 +10,17 @@ <p>{L_WARNED_USERS_EXPLAIN}</p> <!-- IF .user --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_USERS -->{TOTAL_USERS} • <!-- ENDIF --> + <div class="action-bar bar-top"> + <div class="pagination"> + {TOTAL_USERS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> - + </div> + </div> + <table class="table1"> <thead> <tr> @@ -43,23 +43,19 @@ </tbody> </table> - <fieldset class="display-options"> - <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - </fieldset> - <hr /> + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_USERS -->{TOTAL_USERS} • <!-- ENDIF --> + <div class="pagination"> + {TOTAL_USERS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + <!-- ELSE --> <p><strong>{L_NO_WARNINGS}</strong></p> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_warn_post.html b/phpBB/styles/prosilver/template/mcp_warn_post.html index 0dd2e14d92..59c7d0d495 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_post.html +++ b/phpBB/styles/prosilver/template/mcp_warn_post.html @@ -44,6 +44,8 @@ </div> </div> +<!-- EVENT mcp_warn_post_add_warning_field_before --> + <div class="panel"> <div class="inner"> @@ -64,6 +66,8 @@ </div> </div> +<!-- EVENT mcp_warn_post_add_warning_field_after --> + <fieldset class="submit-buttons"> <input type="reset" value="{L_RESET}" name="reset" class="button2" /> <input type="submit" name="action[add_warning]" value="{L_SUBMIT}" class="button1" /> diff --git a/phpBB/styles/prosilver/template/mcp_warn_user.html b/phpBB/styles/prosilver/template/mcp_warn_user.html index 1541f2e5f6..1ad6df7ade 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_user.html +++ b/phpBB/styles/prosilver/template/mcp_warn_user.html @@ -28,6 +28,8 @@ </div> </div> +<!-- EVENT mcp_warn_user_add_warning_field_before --> + <div class="panel"> <div class="inner"> @@ -48,6 +50,8 @@ </div> </div> +<!-- EVENT mcp_warn_user_add_warning_field_after --> + <fieldset class="submit-buttons"> <input type="reset" value="{L_RESET}" name="reset" class="button2" /> <input type="submit" name="action[add_warning]" value="{L_SUBMIT}" class="button1" /> diff --git a/phpBB/styles/prosilver/template/mcp_whois.html b/phpBB/styles/prosilver/template/mcp_whois.html index 41a825458d..1d08a4627e 100644 --- a/phpBB/styles/prosilver/template/mcp_whois.html +++ b/phpBB/styles/prosilver/template/mcp_whois.html @@ -3,13 +3,19 @@ <div class="panel"> <div class="inner"> - - <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_RETURN_POST}">{L_RETURN_POST}</a></p> + <p> + <a href="{U_RETURN_POST}" class="arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_RETURN_POST}</span> + </a> + </p> <div class="postbody"><div class="content"> <pre>{WHOIS}</pre> </div></div> - <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_RETURN_POST}">{L_RETURN_POST}</a></p> - + <p> + <a href="{U_RETURN_POST}" class="arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_RETURN_POST}</span> + </a> + </p> </div> </div> diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index c155d431fa..997147f492 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -13,57 +13,51 @@ <!-- ENDIF --> <!-- IF S_SHOW_GROUP --> - - <h2<!-- IF GROUP_COLOR --> style="color:#{GROUP_COLOR};"<!-- ENDIF -->>{GROUP_NAME}</h2> + <h2 class="group-title"<!-- IF GROUP_COLOR --> style="color:#{GROUP_COLOR};"<!-- ENDIF -->>{GROUP_NAME}</h2> + <!-- IF U_MANAGE --> + <p class="right responsive-center manage rightside"><a href="{U_MANAGE}">{L_MANAGE_GROUP}</a></p> + <!-- ENDIF --> <p>{GROUP_DESC} {GROUP_TYPE}</p> + <p> <!-- IF AVATAR_IMG -->{AVATAR_IMG}<!-- ENDIF --> <!-- IF RANK_IMG -->{RANK_IMG}<!-- ENDIF --> <!-- IF GROUP_RANK -->{GROUP_RANK}<!-- ENDIF --> </p> - <!-- ELSE --> <h2 class="solo">{PAGE_TITLE}<!-- IF SEARCH_WORDS -->{L_COLON} <a href="{U_SEARCH_WORDS}">{SEARCH_WORDS}</a><!-- ENDIF --></h2> - <div class="panel"> - <div class="inner"> - - <ul class="linklist wrap"> - <li> - <!-- IF U_FIND_MEMBER and not S_SEARCH_USER --><a href="{U_FIND_MEMBER}" id="member_search" data-alt-text="{LA_HIDE_MEMBER_SEARCH}">{L_FIND_USERNAME}</a> • <!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP --><a href="{U_HIDE_FIND_MEMBER}" id="member_search" data-alt-text="{LA_FIND_USERNAME}">{L_HIDE_MEMBER_SEARCH}</a> • <!-- ENDIF --> - <strong style="font-size: 0.95em;"> + <div class="action-bar bar-top"> + <div class="member-search panel"> + <!-- IF U_FIND_MEMBER and not S_SEARCH_USER --><a href="{U_FIND_MEMBER}" id="member_search" data-alt-text="{L_HIDE_MEMBER_SEARCH}">{L_FIND_USERNAME}</a> • <!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP --><a href="{U_HIDE_FIND_MEMBER}" id="member_search" data-alt-text="{L_FIND_USERNAME}">{L_HIDE_MEMBER_SEARCH}</a> • <!-- ENDIF --> + <strong> <!-- BEGIN first_char --> <a href="{first_char.U_SORT}">{first_char.DESC}</a> <!-- END first_char --> </strong> - </li> - <li class="rightside pagination"> - {TOTAL_USERS} - <!-- IF .pagination --> - • - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </li> - </ul> - + </div> + + <div class="pagination"> + {TOTAL_USERS} + <!-- IF .pagination --> + <!-- INCLUDE pagination.html --> + <!-- ELSE --> + • {PAGE_NUMBER} + <!-- ENDIF --> </div> </div> <!-- ENDIF --> + <!-- IF S_LEADERS_SET or not S_SHOW_GROUP or not .memberrow --> <div class="forumbg forumbg-table"> <div class="inner"> - <table class="table1" id="memberlist"> + <table class="table1 memberlist" id="memberlist"> <thead> <tr> <th class="name" data-dfn="{L_RANK}{L_COMMA_SEPARATOR}<!-- IF S_SHOW_GROUP and .memberrow -->{L_GROUP_LEADER}<!-- ELSE -->{L_USERNAME}<!-- ENDIF -->"><span class="rank-img"><a href="{U_SORT_RANK}">{L_RANK}</a></span><a href="{U_SORT_USERNAME}"><!-- IF S_SHOW_GROUP and .memberrow -->{L_GROUP_LEADER}<!-- ELSE -->{L_USERNAME}<!-- ENDIF --></a></th> <th class="posts"><a href="{U_SORT_POSTS}#memberlist">{L_POSTS}</a></th> - <th class="info"> - <a href="{U_SORT_WEBSITE}#memberlist">{L_WEBSITE}</a> - <!-- BEGIN custom_fields -->{L_COMMA_SEPARATOR} {custom_fields.PROFILE_FIELD_NAME}<!-- END custom_fields --> - </th> + <th class="info"><!-- BEGIN custom_fields --><!-- IF not custom_fields.S_FIRST_ROW -->{L_COMMA_SEPARATOR} <!-- ENDIF -->{custom_fields.PROFILE_FIELD_NAME}<!-- END custom_fields --></th> <th class="joined"><a href="{U_SORT_JOINED}#memberlist">{L_JOINED}</a></th> <!-- IF U_SORT_ACTIVE --><th class="active"><a href="{U_SORT_ACTIVE}#memberlist">{L_LAST_ACTIVE}</a></th><!-- ENDIF --> </tr> @@ -94,18 +88,15 @@ <!-- IF not S_LEADERS_SET --> <th class="name" data-dfn="{L_RANK}{L_COMMA_SEPARATOR}{L_USERNAME}"><span class="rank-img"><a href="{U_SORT_RANK}">{L_RANK}</a></span><a href="{U_SORT_USERNAME}"><!-- IF S_SHOW_GROUP -->{L_GROUP_MEMBERS}<!-- ELSE -->{L_USERNAME}<!-- ENDIF --></a></th> <th class="posts"><a href="{U_SORT_POSTS}#memberlist">{L_POSTS}</a></th> - <th class="info"> - <a href="{U_SORT_WEBSITE}#memberlist">{L_WEBSITE}</a> - <!-- BEGIN custom_fields -->{L_COMMA_SEPARATOR} {custom_fields.PROFILE_FIELD_NAME}<!-- END custom_fields --> - </th> + <th class="info"><!-- BEGIN custom_fields --><!-- IF not custom_fields.S_FIRST_ROW -->{L_COMMA_SEPARATOR} <!-- ENDIF -->{custom_fields.PROFILE_FIELD_NAME}<!-- END custom_fields --></th> <th class="joined"><a href="{U_SORT_JOINED}#memberlist">{L_JOINED}</a></th> <!-- IF U_SORT_ACTIVE --><th class="active"><a href="{U_SORT_ACTIVE}#memberlist">{L_LAST_ACTIVE}</a></th><!-- ENDIF --> <!-- ELSEIF S_SHOW_GROUP --> <th class="name">{L_GROUP_MEMBERS}</th> - <th class="posts"> </th> - <th class="info"> </th> - <th class="joined"> </th> - <!-- IF U_SORT_ACTIVE --><th class="active"> </th><!-- ENDIF --> + <th class="posts">{L_POSTS}</th> + <th class="info"><!-- BEGIN custom_fields --><!-- IF not custom_fields.S_FIRST_ROW -->{L_COMMA_SEPARATOR} <!-- ENDIF -->{custom_fields.PROFILE_FIELD_NAME}<!-- END custom_fields --></th> + <th class="joined">{L_JOINED}</th> + <!-- IF U_SORT_ACTIVE --><th class="active">{L_LAST_ACTIVE}</th><!-- ENDIF --> <!-- ENDIF --> </tr> </thead> @@ -114,19 +105,12 @@ <!-- ENDIF --> <!-- ENDIF --> - <tr class="<!-- IF memberrow.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> - <td><!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF --><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF --><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- EVENT memberlist_body_username_append --><!-- IF S_IN_SEARCH_POPUP --><br />[ <a href="#" onclick="insert_single_user('#results', '{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a> ]<!-- ENDIF --></td> + <tr class="<!-- IF memberrow.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF memberrow.S_INACTIVE --> inactive<!-- ENDIF -->"> + <td><span class="rank-img"><!-- EVENT memberlist_body_rank_prepend --><!-- IF memberrow.RANK_IMG -->{memberrow.RANK_IMG}<!-- ELSE -->{memberrow.RANK_TITLE}<!-- ENDIF --><!-- EVENT memberlist_body_rank_append --></span><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF --><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- IF memberrow.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_body_username_append --><!-- IF S_IN_SEARCH_POPUP --><br />[ <a href="#" onclick="insert_single_user('#results', '{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a> ]<!-- ENDIF --></td> <td class="posts"><!-- IF memberrow.POSTS and S_DISPLAY_SEARCH --><a href="{memberrow.U_SEARCH_USER}" title="{L_SEARCH_USER_POSTS}">{memberrow.POSTS}</a><!-- ELSE -->{memberrow.POSTS}<!-- ENDIF --></td> - <td class="info"> - <!-- IF memberrow.U_WWW or .memberrow.custom_fields --> - <!-- IF memberrow.U_WWW --><div><a href="{memberrow.U_WWW}" title="{L_VISIT_WEBSITE}{L_COLON} {memberrow.U_WWW}">{memberrow.U_SHORT_WWW}</a></div><!-- ENDIF --> - <!-- BEGIN custom_fields --><div>{memberrow.custom_fields.PROFILE_FIELD_VALUE}</div><!-- END custom_fields --> - <!-- ELSE --> - - <!-- ENDIF --> - </td> + <td class="info"><!-- BEGIN custom_fields --><div>{memberrow.custom_fields.PROFILE_FIELD_VALUE}</div><!-- BEGINELSE --> <!-- END custom_fields --></td> <td>{memberrow.JOINED}</td> - <!-- IF S_VIEWONLINE --><td>{memberrow.VISITED} </td><!-- ENDIF --> + <!-- IF S_VIEWONLINE --><td>{memberrow.LAST_ACTIVE} </td><!-- ENDIF --> </tr> <!-- BEGINELSE --> <tr class="bg1"> @@ -153,8 +137,6 @@ <!-- IF S_IN_SEARCH_POPUP and not S_SEARCH_USER --> <fieldset class="display-options"> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> <label for="sk">{L_SELECT_SORT_METHOD}{L_COLON} <select name="sk" id="sk">{S_MODE_SELECT}</select></label> <label for="sd">{L_ORDER} <select name="sd" id="sd">{S_ORDER_SELECT}</select></label> <input type="submit" name="sort" value="{L_SUBMIT}" class="button2" /> @@ -163,18 +145,16 @@ </form> -<hr /> - -<ul class="linklist"> - <li class="rightside pagination">{TOTAL_USERS} - <!-- IF .pagination --> - • +<div class="action-bar bar-bottom"> + <div class="pagination"> + {TOTAL_USERS} + <!-- IF .pagination --> <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} + <!-- ELSE --> + • {PAGE_NUMBER} <!-- ENDIF --> - </li> -</ul> + </div> +</div> <!-- IF S_IN_SEARCH_POPUP --> <!-- INCLUDE simple_footer.html --> diff --git a/phpBB/styles/prosilver/template/memberlist_email.html b/phpBB/styles/prosilver/template/memberlist_email.html index 218402a9e9..4a9f764d07 100644 --- a/phpBB/styles/prosilver/template/memberlist_email.html +++ b/phpBB/styles/prosilver/template/memberlist_email.html @@ -1,24 +1,62 @@ <!-- INCLUDE overall_header.html --> -<h2 class="titlespace">{L_SEND_EMAIL_USER} {USERNAME}</h2> +<!-- IF S_CONTACT_ADMIN--> +<h2 class="titlespace">{L_CONTACT_ADMIN}</h2> +<!-- ELSEIF S_SEND_USER --> +<h2 class="titlespace">{L_SEND_EMAIL_USER}</h2> +<!-- ELSE --> +<h2 class="titlespace">{L_EMAIL_TOPIC}</h2> +<!-- ENDIF --> <form method="post" action="{S_POST_ACTION}" id="post"> -<div class="panel"> - <div class="inner"> + <!-- IF CONTACT_INFO --> + <div class="panel"> + <div class="inner"> + <div class="postbody"> + <div class="content"> + {CONTACT_INFO} + </div> + </div> + </div> + </div> + <br class="clear" /> + <!-- ENDIF --> + <div class="panel"> + <div class="inner"> <div class="content"> + <!-- IF ERROR_MESSAGE --><p class="error">{ERROR_MESSAGE}</p><!-- ENDIF --> <fieldset class="fields2"> <!-- IF S_SEND_USER --> <dl> <dt><label>{L_RECIPIENT}{L_COLON}</label></dt> - <dd><strong>{USERNAME}</strong></dd> + <dd><strong>{USERNAME_FULL}</strong></dd> </dl> <dl> <dt><label for="subject">{L_SUBJECT}{L_COLON}</label></dt> <dd><input class="inputbox autowidth" type="text" name="subject" id="subject" size="50" tabindex="1" value="{SUBJECT}" /></dd> </dl> + <!-- ELSEIF S_CONTACT_ADMIN--> + <dl> + <dt><label>{L_RECIPIENT}{L_COLON}</label></dt> + <dd><strong>{L_ADMINISTRATOR}</strong></dd> + </dl> + <!-- IF not S_IS_REGISTERED --> + <dl> + <dt><label for="email">{L_SENDER_EMAIL_ADDRESS}{L_COLON}</label></dt> + <dd><input class="inputbox autowidth" type="text" name="email" id="email" size="50" maxlength="100" tabindex="1" value="{EMAIL}" /></dd> + </dl> + <dl> + <dt><label for="name">{L_SENDER_NAME}{L_COLON}</label></dt> + <dd><input class="inputbox autowidth" type="text" name="name" id="name" size="50" tabindex="2" value="{NAME}" /></dd> + </dl> + <!-- ENDIF --> + <dl> + <dt><label for="subject">{L_SUBJECT}{L_COLON}</label></dt> + <dd><input class="inputbox autowidth" type="text" name="subject" id="subject" size="50" tabindex="3" value="{SUBJECT}" /></dd> + </dl> <!-- ELSE --> <dl> <dt><label for="email">{L_EMAIL_ADDRESS}{L_COLON}</label></dt> @@ -39,10 +77,12 @@ <span>{L_EMAIL_BODY_EXPLAIN}</span></dt> <dd><textarea class="inputbox" name="message" id="message" rows="15" cols="76" tabindex="4">{MESSAGE}</textarea></dd> </dl> + <!-- IF S_REGISTERED_USER --> <dl> <dt> </dt> - <dd><label for="cc_email"><input type="checkbox" name="cc_email" id="cc_email" value="1" checked="checked" tabindex="5" /> {L_CC_EMAIL}</label></dd> + <dd><label for="cc_sender"><input type="checkbox" name="cc_sender" id="cc_sender" value="1" checked="checked" tabindex="5" /> {L_CC_SENDER}</label></dd> </dl> + <!-- ENDIF --> </fieldset> </div> diff --git a/phpBB/styles/prosilver/template/memberlist_im.html b/phpBB/styles/prosilver/template/memberlist_im.html index 8e7842e631..874607d913 100644 --- a/phpBB/styles/prosilver/template/memberlist_im.html +++ b/phpBB/styles/prosilver/template/memberlist_im.html @@ -1,57 +1,24 @@ <!-- INCLUDE simple_header.html --> -<!-- MSNM info from http://www.cdolive.net/ - doesn't seem to work with MSN Messenger --> -<h2 class="solo">{L_SEND_IM}</h2> +<h2>{L_SEND_IM}</h2> -<form method="post" action="{S_IM_ACTION}" data-lang-im-msnm-connect="{L_IM_MSNM_CONNECT|e('html_attr')}" data-lang-im-msnm-browser="{L_IM_MSNM_BROWSER|e('html_attr')}"> +<form method="post" action="{S_IM_ACTION}"> <div class="panel bg2"> <div class="inner"> <p>{L_SEND_IM_EXPLAIN}</p> + <!-- IF S_SENT_JABBER --> + <p>{L_IM_SENT_JABBER}</p> + <!-- ENDIF --> + <fieldset> <dl class="fields2"> <dt><label>{L_IM_RECIPIENT}{L_COLON}</label></dt> - <dd><strong>{USERNAME}</strong><!-- IF S_SEND_ICQ or S_SEND_AIM or S_SEND_MSNM or S_NO_SEND_JABBER --> [ {IM_CONTACT} ]<!-- ENDIF --><!-- IF PRESENCE_IMG --> {PRESENCE_IMG}<!-- ENDIF --></dd> + <dd><strong>{USERNAME}</strong><!-- IF S_NO_SEND_JABBER --> [ {IM_CONTACT} ]<!-- ENDIF --><!-- IF PRESENCE_IMG --> {PRESENCE_IMG}<!-- ENDIF --></dd> </dl> - <!-- IF S_SEND_ICQ --> - <dl class="fields2"> - <dt><label for="from">{L_IM_NAME}{L_COLON}</label></dt> - <dd><input class="inputbox autowidth" type="text" name="from" id="from" size="20" /></dd> - </dl> - <dl class="fields2"> - <dt><label for="body">{L_IM_MESSAGE}{L_COLON}</label></dt> - <dd><textarea class="inputbox autowidth" name="body" id="body" rows="5" cols="45"></textarea></dd> - </dl> - <dl class="fields2"> - <dt> </dt> - <dd><input class="button1" name="submit" type="submit" value="{L_IM_SEND}" /></dd> - </dl> - <input type="hidden" name="fromemail" value="{EMAIL}" /> - <input type="hidden" name="subject" value="{SITENAME}" /> - <input type="hidden" name="to" value="{IM_CONTACT}" /> - <!-- ENDIF --> - - <!-- IF S_SEND_AIM --> - <dl class="fields2"> - <dt> </dt> - <dd><a href="{U_AIM_CONTACT}">{L_IM_ADD_CONTACT}</a></dd> - <dd><a href="{U_AIM_MESSAGE}">{L_IM_SEND_MESSAGE}</a></dd> - <dd><a href="http://www.aim.com">{L_IM_DOWNLOAD_APP}</a> | <a href="http://www.aim.com/products/express">{L_IM_AIM_EXPRESS}</a></dd> - </dl> - <!-- ENDIF --> - - <!-- IF S_SEND_MSNM --> - <dl class="fields2"> - <dt> </dt> - <dd><object classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28" codetype="application/x-oleobject" id="objMessengerApp" width="0" height="0"></object></dd> - <dd><a href="#" onclick="add_contact('{A_IM_CONTACT}'); return false;">{L_IM_ADD_CONTACT}</a></dd> - <dd><a href="#" onclick="im_contact('{A_IM_CONTACT}'); return false;">{L_IM_SEND_MESSAGE}</a></dd> - </dl> - <!-- ENDIF --> - <!-- IF S_SEND_JABBER --> <dl class="fields2"> <dt><label for="message">{L_IM_MESSAGE}{L_COLON}</label></dt> @@ -61,21 +28,12 @@ <dt> </dt> <dd><input class="button1" name="submit" type="submit" value="{L_IM_SEND}" /></dd> </dl> - <!-- ENDIF --> - - <!-- IF S_NO_SEND_JABBER --> + <!-- ELSE IF S_NO_SEND_JABBER --> <dl class="fields2"> <dt> </dt> <dd>{L_IM_NO_JABBER}</dd> </dl> <!-- ENDIF --> - - <!-- IF S_SENT_JABBER --> - <dl class="fields2"> - <dt> </dt> - <dd>{L_IM_SENT_JABBER}</dd> - </dl> - <!-- ENDIF --> {S_FORM_TOKEN} </fieldset> diff --git a/phpBB/styles/prosilver/template/memberlist_leaders.html b/phpBB/styles/prosilver/template/memberlist_leaders.html deleted file mode 100644 index fd2ba564d3..0000000000 --- a/phpBB/styles/prosilver/template/memberlist_leaders.html +++ /dev/null @@ -1,47 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<h2 class="solo">{PAGE_TITLE}</h2> - -<form method="post" action="{S_MODE_ACTION}"> - -<!-- BEGIN group --> -<div class="forumbg forumbg-table"> - <div class="inner"> - - <table class="table1"> - <thead> - <tr> - <th class="name" data-dfn="{L_RANK}{L_COMMA_SEPARATOR}{L_USERNAME}"><span class="rank-img">{L_RANK} </span><!-- IF group.U_GROUP --><a href="{group.U_GROUP}">{group.GROUP_NAME}</a><!-- ELSE -->{group.GROUP_NAME}<!-- ENDIF --></th> - <th class="info">{L_PRIMARY_GROUP}</th> - <!-- IF S_DISPLAY_MODERATOR_FORUMS --><th class="info">{L_MODERATOR}</th><!-- ENDIF --> - </tr> - </thead> - <tbody> -<!-- BEGIN user --> - <tr class="<!-- IF group.user.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> - <td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF -->{group.user.USERNAME_FULL}</td> - <td class="info"><!-- IF group.user.U_GROUP --> - <a<!-- IF group.user.GROUP_COLOR --> style="font-weight: bold; color: #{group.user.GROUP_COLOR}"<!-- ENDIF --> href="{group.user.U_GROUP}">{group.user.GROUP_NAME}</a> - <!-- ELSE --> - {group.user.GROUP_NAME} - <!-- ENDIF --></td> - <!-- IF S_DISPLAY_MODERATOR_FORUMS --> - <td class="info"><!-- IF group.user.FORUM_OPTIONS --><select style="width: 100%;">{group.user.FORUMS}</select><!-- ELSEIF group.user.FORUMS -->{group.user.FORUMS}<!-- ELSE -->-<!-- ENDIF --></td> - <!-- ENDIF --> - </tr> -<!-- BEGINELSE --> - <tr class="bg1"> - <td colspan="3"><strong>{L_NO_MEMBERS}</strong></td> - </tr> -<!-- END user --> - </tbody> - </table> - - </div> -</div> -<!-- END group --> - -</form> - -<!-- INCLUDE jumpbox.html --> -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html index 0b04d0087c..b1c7a81709 100644 --- a/phpBB/styles/prosilver/template/memberlist_search.html +++ b/phpBB/styles/prosilver/template/memberlist_search.html @@ -6,10 +6,23 @@ <p>{L_FIND_USERNAME_EXPLAIN}</p> + <!-- EVENT memberlist_search_fields_before --> <fieldset class="fields1 column1"> - <dl> + <dl style="overflow: visible;"> <dt><label for="username">{L_USERNAME}{L_COLON}</label></dt> - <dd><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox" /></dd> + <dd> + <!-- IF U_LIVE_SEARCH --><div class="dropdown-container dropdown-{S_CONTENT_FLOW_END}"><!-- ENDIF --> + <input type="text" name="username" id="username" value="{USERNAME}" class="inputbox"<!-- IF U_LIVE_SEARCH --> autocomplete="off" data-filter="phpbb.search.filter" data-ajax="member_search" data-min-length="3" data-url="{U_LIVE_SEARCH}" data-results="#user-search" data-overlay="false"<!-- ENDIF --> /> + <!-- IF U_LIVE_SEARCH --> + <div class="dropdown live-search hidden" id="user-search"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents search-results"> + <li class="search-result-tpl"><span class="search-result"></span></li> + </ul> + </div> + </div> + <!-- ENDIF --> + </dd> </dl> <!-- IF S_EMAIL_SEARCH_ALLOWED --> <dl> @@ -17,25 +30,20 @@ <dd><input type="text" name="email" id="email" value="{EMAIL}" class="inputbox" /></dd> </dl> <!-- ENDIF --> +<!-- IF S_JABBER_ENABLED --> <dl> - <dt><label for="icq">{L_ICQ}{L_COLON}</label></dt> - <dd><input type="text" name="icq" id="icq" value="{ICQ}" class="inputbox" /></dd> - </dl> - <dl> - <dt><label for="aim">{L_AIM}{L_COLON}</label></dt> - <dd><input type="text" name="aim" id="aim" value="{AIM}" class="inputbox" /></dd> - </dl> - <dl> - <dt><label for="yahoo">{L_YIM}{L_COLON}</label></dt> - <dd><input type="text" name="yahoo" id="yahoo" value="{YAHOO}" class="inputbox" /></dd> + <dt><label for="jabber">{L_JABBER}{L_COLON}</label></dt> + <dd><input type="text" name="jabber" id="jabber" value="{JABBER}" class="inputbox" /></dd> </dl> +<!-- ENDIF --> <dl> - <dt><label for="msn">{L_MSNM}{L_COLON}</label></dt> - <dd><input type="text" name="msn" id="msn" value="{MSNM}" class="inputbox" /></dd> + <dt><label for="search_group_id">{L_GROUP}{L_COLON}</label></dt> + <dd><select name="search_group_id" id="search_group_id">{S_GROUP_SELECT}</select></dd> </dl> + <!-- EVENT memberlist_search_sorting_options_before --> <dl> - <dt><label for="jabber">{L_JABBER}:</label></dt> - <dd><input type="text" name="jabber" id="jabber" value="{JABBER}" class="inputbox" /></dd> + <dt><label for="sk" class="label3">{L_SORT_BY}{L_COLON}</label></dt> + <dd><select name="sk" id="sk">{S_SORT_OPTIONS}</select> <select name="sd">{S_ORDER_SELECT}</select></dd> </dl> </fieldset> @@ -60,14 +68,7 @@ <dd><input class="inputbox medium" type="text" name="ip" id="ip" value="{IP}" /></dd> </dl> <!-- ENDIF --> - <dl> - <dt><label for="search_group_id">{L_GROUP}{L_COLON}</label></dt> - <dd><select name="search_group_id" id="search_group_id">{S_GROUP_SELECT}</select></dd> - </dl> - <dl> - <dt><label for="sk" class="label3">{L_SORT_BY}{L_COLON}</label></dt> - <dd><select name="sk" id="sk">{S_SORT_OPTIONS}</select> <select name="sd">{S_ORDER_SELECT}</select></dd> - </dl> + <!-- EVENT memberlist_search_fields_after --> </fieldset> <div class="clear"></div> diff --git a/phpBB/styles/prosilver/template/memberlist_team.html b/phpBB/styles/prosilver/template/memberlist_team.html new file mode 100644 index 0000000000..b7f2d66d94 --- /dev/null +++ b/phpBB/styles/prosilver/template/memberlist_team.html @@ -0,0 +1,47 @@ +<!-- INCLUDE overall_header.html --> + +<h2 class="solo">{PAGE_TITLE}</h2> + +<form method="post" action="{S_MODE_ACTION}"> + +<!-- BEGIN group --> +<div class="forumbg forumbg-table"> + <div class="inner"> + + <table class="table1" id="team"> + <thead> + <tr> + <th class="name" data-dfn="{L_RANK}{L_COMMA_SEPARATOR}{L_USERNAME}"><span class="rank-img">{L_RANK} </span><!-- IF group.U_GROUP --><a href="{group.U_GROUP}">{group.GROUP_NAME}</a><!-- ELSE -->{group.GROUP_NAME}<!-- ENDIF --></th> + <th class="info">{L_PRIMARY_GROUP}</th> + <!-- IF S_DISPLAY_MODERATOR_FORUMS --><th class="info">{L_MODERATOR}</th><!-- ENDIF --> + </tr> + </thead> + <tbody> +<!-- BEGIN user --> + <tr class="<!-- IF group.user.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF group.user.S_INACTIVE --> inactive<!-- ENDIF -->"> + <td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF -->{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --></td> + <td class="info"><!-- IF group.user.U_GROUP --> + <a<!-- IF group.user.GROUP_COLOR --> style="font-weight: bold; color: #{group.user.GROUP_COLOR}"<!-- ENDIF --> href="{group.user.U_GROUP}">{group.user.GROUP_NAME}</a> + <!-- ELSE --> + {group.user.GROUP_NAME} + <!-- ENDIF --></td> + <!-- IF S_DISPLAY_MODERATOR_FORUMS --> + <td class="info"><!-- IF group.user.FORUM_OPTIONS --><select style="width: 100%;">{group.user.FORUMS}</select><!-- ELSEIF group.user.FORUMS -->{group.user.FORUMS}<!-- ELSE -->-<!-- ENDIF --></td> + <!-- ENDIF --> + </tr> +<!-- BEGINELSE --> + <tr class="bg1"> + <td colspan="3"><strong>{L_NO_MEMBERS}</strong></td> + </tr> +<!-- END user --> + </tbody> + </table> + + </div> +</div> +<!-- END group --> + +</form> + +<!-- INCLUDE jumpbox.html --> +<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 1c4b6be2d1..8ecca49a60 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -1,6 +1,8 @@ <!-- INCLUDE overall_header.html --> -<h2>{PAGE_TITLE}</h2> +<h2 class="memberlist-title">{PAGE_TITLE}</h2> + +<!-- EVENT memberlist_view_content_prepend --> <form method="post" action="{S_PROFILE_ACTION}" id="viewprofile"> <div class="panel bg1<!-- IF S_ONLINE --> online<!-- ENDIF -->"> @@ -8,9 +10,11 @@ <!-- IF AVATAR_IMG --> <dl class="left-box"> - <dt>{AVATAR_IMG}</dt> + <dt class="profile-avatar">{AVATAR_IMG}</dt> + <!-- EVENT memberlist_view_rank_avatar_before --> <!-- IF RANK_TITLE --><dd style="text-align: center;">{RANK_TITLE}</dd><!-- ENDIF --> <!-- IF RANK_IMG --><dd style="text-align: center;">{RANK_IMG}</dd><!-- ENDIF --> + <!-- EVENT memberlist_view_rank_avatar_after --> </dl> <!-- ENDIF --> @@ -18,18 +22,25 @@ <dt>{L_USERNAME}{L_COLON}</dt> <dd> <!-- IF USER_COLOR --><span style="color: {USER_COLOR}; font-weight: bold;"><!-- ELSE --><span><!-- ENDIF -->{USERNAME}</span> + <!-- IF U_EDIT_SELF --> [ <a href="{U_EDIT_SELF}">{L_EDIT_PROFILE}</a> ]<!-- ENDIF --> <!-- IF U_USER_ADMIN --> [ <a href="{U_USER_ADMIN}">{L_USER_ADMIN}</a> ]<!-- ENDIF --> <!-- IF U_USER_BAN --> [ <a href="{U_USER_BAN}">{L_USER_BAN}</a> ]<!-- ENDIF --> <!-- IF U_SWITCH_PERMISSIONS --> [ <a href="{U_SWITCH_PERMISSIONS}">{L_USE_PERMISSIONS}</a> ]<!-- ENDIF --> </dd> <!-- IF not AVATAR_IMG --> + <!-- EVENT memberlist_view_rank_no_avatar_before --> <!-- IF RANK_TITLE --><dt>{L_RANK}{L_COLON}</dt> <dd>{RANK_TITLE}</dd><!-- ENDIF --> <!-- IF RANK_IMG --><dt><!-- IF RANK_TITLE --> <!-- ELSE -->{L_RANK}{L_COLON}<!-- ENDIF --></dt> <dd>{RANK_IMG}</dd><!-- ENDIF --> + <!-- EVENT memberlist_view_rank_no_avatar_after --> <!-- ENDIF --> <!-- IF S_USER_INACTIVE --><dt>{L_USER_IS_INACTIVE}{L_COLON}</dt> <dd>{USER_INACTIVE_REASON}</dd><!-- ENDIF --> <!-- IF AGE !== '' --><dt>{L_AGE}{L_COLON}</dt> <dd>{AGE}</dd><!-- ENDIF --> <!-- IF S_GROUP_OPTIONS --><dt>{L_USERGROUPS}{L_COLON}</dt> <dd><select name="g">{S_GROUP_OPTIONS}</select> <input type="submit" name="submit" value="{L_GO}" class="button2" /></dd><!-- ENDIF --> - <!-- BEGIN custom_fields --><dt>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</dt> <dd>{custom_fields.PROFILE_FIELD_VALUE}</dd><!-- END custom_fields --> + <!-- BEGIN custom_fields --> + <!-- IF not custom_fields.S_PROFILE_CONTACT --> + <dt>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</dt> <dd>{custom_fields.PROFILE_FIELD_VALUE}</dd> + <!-- ENDIF --> + <!-- END custom_fields --> <!-- IF S_USER_LOGGED_IN and S_ZEBRA --> <!-- IF U_REMOVE_FRIEND --> <dt> </dt> <dd class="zebra"><a href="{U_REMOVE_FRIEND}" data-ajax="zebra"><strong>{L_REMOVE_FRIEND}</strong></a></dd> @@ -46,24 +57,30 @@ <!-- ENDIF --> </dl> - <span class="clear"></span></div> + </div> </div> +<!-- EVENT memberlist_view_contact_before --> <div class="panel bg2"> <div class="inner"> - <div class="column1"> - <h3>{L_CONTACT_USER} {USERNAME}</h3> + <div class="column1"> + <h3>{L_CONTACT_USER}</h3> <dl class="details"> - <!-- IF U_EMAIL --><dt>{L_EMAIL_ADDRESS}{L_COLON}</dt> <dd><a href="{U_EMAIL}">{L_SEND_EMAIL_USER} {USERNAME}</a></dd><!-- ENDIF --> - <!-- IF U_WWW --><dt>{L_WEBSITE}{L_COLON}</dt> <dd><a href="{U_WWW}" title="{L_VISIT_WEBSITE}{L_COLON} {U_WWW}">{U_WWW}</a></dd><!-- ENDIF --> + <!-- IF U_EMAIL --><dt>{L_EMAIL_ADDRESS}{L_COLON}</dt> <dd><a href="{U_EMAIL}">{L_SEND_EMAIL_USER}</a></dd><!-- ENDIF --> <!-- IF U_PM --><dt>{L_PM}{L_COLON}</dt> <dd><a href="{U_PM}">{L_SEND_PRIVATE_MESSAGE}</a></dd><!-- ENDIF --> - <!-- IF U_MSN or USER_MSN --><dt>{L_MSNM}{L_COLON}</dt> <dd><!-- IF U_MSN --><a href="{U_MSN}" onclick="popup(this.href, 550, 320); return false;">{L_SEND_MSNM_MESSAGE}</a><!-- ELSE -->{USER_MSN}<!-- ENDIF --></dd><!-- ENDIF --> - <!-- IF U_YIM or USER_YIM --><dt>{L_YIM}{L_COLON}</dt> <dd><!-- IF U_YIM --><a href="{U_YIM}" onclick="popup(this.href, 780, 550); return false;">{L_SEND_YIM_MESSAGE}</a><!-- ELSE -->{USER_YIM}<!-- ENDIF --></dd><!-- ENDIF --> - <!-- IF U_AIM or USER_AIM --><dt>{L_AIM}{L_COLON}</dt> <dd><!-- IF U_AIM --><a href="{U_AIM}" onclick="popup(this.href, 550, 320); return false;">{L_SEND_AIM_MESSAGE}</a><!-- ELSE -->{USER_AIM}<!-- ENDIF --></dd><!-- ENDIF --> - <!-- IF U_ICQ or USER_ICQ --><dt>{L_ICQ}{L_COLON}</dt> <dd><!-- IF U_ICQ --><a href="{U_ICQ}" onclick="popup(this.href, 550, 320); return false;">{L_SEND_ICQ_MESSAGE}</a><!-- ELSE -->{USER_ICQ}<!-- ENDIF --></dd><!-- ENDIF --> - <!-- IF U_JABBER and S_JABBER_ENABLED --><dt>{L_JABBER}{L_COLON}</dt> <dd><a href="{U_JABBER}" onclick="popup(this.href, 550, 320); return false;">{L_SEND_JABBER_MESSAGE}</a></dd><!-- ELSEIF USER_JABBER --><dt>{L_JABBER}{L_COLON}</dt> <dd>{USER_JABBER}</dd><!-- ENDIF --> + <!-- IF U_JABBER and S_JABBER_ENABLED --><dt>{L_JABBER}{L_COLON}</dt> <dd><a href="{U_JABBER}" onclick="popup(this.href, 750, 320); return false;">{L_SEND_JABBER_MESSAGE}</a></dd><!-- ELSEIF USER_JABBER --><dt>{L_JABBER}{L_COLON}</dt> <dd>{USER_JABBER}</dd><!-- ENDIF --> + <!-- BEGIN custom_fields --> + <!-- IF custom_fields.S_PROFILE_CONTACT --> + <dt>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</dt> + <!-- IF custom_fields.PROFILE_FIELD_CONTACT --> + <dd><a href="{custom_fields.PROFILE_FIELD_CONTACT}">{custom_fields.PROFILE_FIELD_DESC}</a></dd> + <!-- ELSE --> + <dd>{custom_fields.PROFILE_FIELD_VALUE}</dd> + <!-- ENDIF --> + <!-- ENDIF --> + <!-- END custom_fields --> <!-- IF S_PROFILE_FIELD1 --> <!-- NOTE: Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. --> <dt>{PROFILE_FIELD1_NAME}{L_COLON}</dt> <dd>{PROFILE_FIELD1_VALUE}</dd> @@ -76,7 +93,7 @@ <dl class="details"> <!-- EVENT memberlist_view_user_statistics_before --> <dt>{L_JOINED}{L_COLON}</dt> <dd>{JOINED}</dd> - <dt>{L_VISITED}{L_COLON}</dt> <dd>{VISITED}</dd> + <dt>{L_LAST_ACTIVE}{L_COLON}</dt> <dd>{LAST_ACTIVE}</dd> <!-- IF S_WARNINGS --> <dt>{L_WARNINGS}{L_COLON} </dt> <dd><strong>{WARNINGS}</strong><!-- IF U_NOTES or U_WARN --> [ <!-- IF U_NOTES --><a href="{U_NOTES}">{L_VIEW_NOTES}</a><!-- ENDIF --> <!-- IF U_WARN --><!-- IF U_NOTES --> | <!-- ENDIF --><a href="{U_WARN}">{L_WARN_USER}</a><!-- ENDIF --> ]<!-- ENDIF --></dd> @@ -93,8 +110,10 @@ <!-- EVENT memberlist_view_user_statistics_after --> </dl> </div> - <span class="clear"></span></div> + + </div> </div> +<!-- EVENT memberlist_view_contact_after --> <!-- IF SIGNATURE --> <div class="panel bg1"> @@ -104,12 +123,14 @@ <div class="postbody"><div class="signature standalone">{SIGNATURE}</div></div> - <span class="clear"></span></div> + </div> </div> <!-- ENDIF --> </form> +<!-- EVENT memberlist_view_content_append --> + <!-- INCLUDE jumpbox.html --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/message_body.html b/phpBB/styles/prosilver/template/message_body.html index a844246055..330203e19e 100644 --- a/phpBB/styles/prosilver/template/message_body.html +++ b/phpBB/styles/prosilver/template/message_body.html @@ -6,9 +6,15 @@ <div class="panel" id="message"> <div class="inner"> - <h2>{MESSAGE_TITLE}</h2> + <h2 class="message-title">{MESSAGE_TITLE}</h2> <p>{MESSAGE_TEXT}</p> - <!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --><p><a href="{U_SEARCH}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF --> + <!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --> + <p> + <a href="{U_SEARCH}" class="arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_GO_TO_SEARCH_ADV}</span> + </a> + </p> + <!-- ENDIF --> </div> </div> diff --git a/phpBB/styles/prosilver/template/navbar_footer.html b/phpBB/styles/prosilver/template/navbar_footer.html new file mode 100644 index 0000000000..a7864e3a3d --- /dev/null +++ b/phpBB/styles/prosilver/template/navbar_footer.html @@ -0,0 +1,65 @@ +<div class="navbar" role="navigation"> + <div class="inner"> + + <ul id="nav-footer" class="nav-footer linklist" role="menubar"> + <li class="breadcrumbs"> + <!-- IF U_SITE_HOME --> + <span class="crumb"> + <a href="{U_SITE_HOME}" data-navbar-reference="home"> + <i class="icon fa-home fa-fw" aria-hidden="true"></i><span>{L_SITE_HOME}</span> + </a> + </span> + <!-- ENDIF --> + <!-- EVENT overall_footer_breadcrumb_prepend --> + <span class="crumb"> + <a href="{U_INDEX}" data-navbar-reference="index"> + <!-- IF not U_SITE_HOME --><i class="icon fa-home fa-fw" aria-hidden="true"></i><!-- ENDIF --><span>{L_INDEX}</span> + </a> + </span> + <!-- EVENT overall_footer_breadcrumb_append --> + </li> + <!-- IF U_WATCH_FORUM_LINK and not S_IS_BOT --> + <li data-last-responsive="true"> + <a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-class="icon <!-- IF S_WATCHING_FORUM -->fa-check-square-o<!-- ELSE -->fa-square-o<!-- ENDIF --> fa-fw" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}"> + <i class="icon <!-- IF S_WATCHING_FORUM -->fa-square-o<!-- ELSE -->fa-check-square-o<!-- ENDIF --> fa-fw" aria-hidden="true"></i><span>{S_WATCH_FORUM_TITLE}</span> + </a> + </li> + <!-- ENDIF --> + + <!-- EVENT overall_footer_timezone_before --> + <li class="rightside">{S_TIMEZONE}</li> + <!-- EVENT overall_footer_timezone_after --> + <!-- IF not S_IS_BOT --> + <li class="rightside"> + <a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true" role="menuitem"> + <i class="icon fa-trash fa-fw" aria-hidden="true"></i><span>{L_DELETE_COOKIES}</span> + </a> + </li> + <!-- IF S_DISPLAY_MEMBERLIST --> + <li class="rightside" data-last-responsive="true"> + <a href="{U_MEMBERLIST}" title="{L_MEMBERLIST_EXPLAIN}" role="menuitem"> + <i class="icon fa-group fa-fw" aria-hidden="true"></i><span>{L_MEMBERLIST}</span> + </a> + </li> + <!-- ENDIF --> + <!-- ENDIF --> + <!-- EVENT overall_footer_teamlink_before --> + <!-- IF U_TEAM --> + <li class="rightside" data-last-responsive="true"> + <a href="{U_TEAM}" role="menuitem"> + <i class="icon fa-shield fa-fw" aria-hidden="true"></i><span>{L_THE_TEAM}</span> + </a> + </li> + <!-- ENDIF --> + <!-- EVENT overall_footer_teamlink_after --> + <!-- IF U_CONTACT_US --> + <li class="rightside" data-last-responsive="true"> + <a href="{U_CONTACT_US}" role="menuitem"> + <i class="icon fa-envelope fa-fw" aria-hidden="true"></i><span>{L_CONTACT_US}</span> + </a> + </li> + <!-- ENDIF --> + </ul> + + </div> +</div> diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html new file mode 100644 index 0000000000..a02ec45830 --- /dev/null +++ b/phpBB/styles/prosilver/template/navbar_header.html @@ -0,0 +1,205 @@ +<div class="navbar" role="navigation"> + <div class="inner"> + + <ul id="nav-main" class="nav-main linklist" role="menubar"> + + <li id="quick-links" class="quick-links dropdown-container responsive-menu<!-- IF not S_DISPLAY_QUICK_LINKS and not S_DISPLAY_SEARCH --> hidden<!-- ENDIF -->" data-skip-responsive="true"> + <a href="#" class="dropdown-trigger"> + <i class="icon fa-bars fa-fw" aria-hidden="true"></i><span>{L_QUICK_LINKS}</span> + </a> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents" role="menu"> + <!-- EVENT navbar_header_quick_links_before --> + + <!-- IF S_DISPLAY_SEARCH --> + <li class="separator"></li> + <!-- IF S_REGISTERED_USER --> + <li> + <a href="{U_SEARCH_SELF}" role="menuitem"> + <i class="icon fa-file-o fa-fw icon-gray" aria-hidden="true"></i><span>{L_SEARCH_SELF}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF S_USER_LOGGED_IN --> + <li> + <a href="{U_SEARCH_NEW}" role="menuitem"> + <i class="icon fa-file-o fa-fw icon-red" aria-hidden="true"></i><span>{L_SEARCH_NEW}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF S_LOAD_UNREADS --> + <li> + <a href="{U_SEARCH_UNREAD}" role="menuitem"> + <i class="icon fa-file-o fa-fw icon-red" aria-hidden="true"></i><span>{L_SEARCH_UNREAD}</span> + </a> + </li> + <!-- ENDIF --> + <li> + <a href="{U_SEARCH_UNANSWERED}" role="menuitem"> + <i class="icon fa-file-o fa-fw icon-gray" aria-hidden="true"></i><span>{L_SEARCH_UNANSWERED}</span> + </a> + </li> + <li> + <a href="{U_SEARCH_ACTIVE_TOPICS}" role="menuitem"> + <i class="icon fa-file-o fa-fw icon-blue" aria-hidden="true"></i><span>{L_SEARCH_ACTIVE_TOPICS}</span> + </a> + </li> + <li class="separator"></li> + <li> + <a href="{U_SEARCH}" role="menuitem"> + <i class="icon fa-search fa-fw" aria-hidden="true"></i><span>{L_SEARCH}</span> + </a> + </li> + <!-- ENDIF --> + + <!-- IF not S_IS_BOT and (S_DISPLAY_MEMBERLIST or U_TEAM) --> + <li class="separator"></li> + <!-- IF S_DISPLAY_MEMBERLIST --> + <li> + <a href="{U_MEMBERLIST}" role="menuitem"> + <i class="icon fa-group fa-fw" aria-hidden="true"></i><span>{L_MEMBERLIST}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF U_TEAM --> + <li> + <a href="{U_TEAM}" role="menuitem"> + <i class="icon fa-shield fa-fw" aria-hidden="true"></i><span>{L_THE_TEAM}</span> + </a> + </li> + <!-- ENDIF --> + <!-- ENDIF --> + <li class="separator"></li> + + <!-- EVENT navbar_header_quick_links_after --> + </ul> + </div> + </li> + + <!-- EVENT overall_header_navigation_prepend --> + <li <!-- IF not S_USER_LOGGED_IN -->data-skip-responsive="true"<!-- ELSE -->data-last-responsive="true"<!-- ENDIF -->> + <a href="{U_FAQ}" rel="help" title="{L_FAQ_EXPLAIN}" role="menuitem"> + <i class="icon fa-question-circle fa-fw" aria-hidden="true"></i><span>{L_FAQ}</span> + </a> + </li> + <!-- EVENT overall_header_navigation_append --> + <!-- IF U_ACP --> + <li data-last-responsive="true"> + <a href="{U_ACP}" title="{L_ACP}" role="menuitem"> + <i class="icon fa-cogs fa-fw" aria-hidden="true"></i><span>{L_ACP_SHORT}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF U_MCP --> + <li data-last-responsive="true"> + <a href="{U_MCP}" title="{L_MCP}" role="menuitem"> + <i class="icon fa-gavel fa-fw" aria-hidden="true"></i><span>{L_MCP_SHORT}</span> + </a> + </li> + <!-- ENDIF --> + + <!-- IF S_REGISTERED_USER --> + <li id="username_logged_in" class="rightside <!-- IF CURRENT_USER_AVATAR --> no-bulletin<!-- ENDIF -->" data-skip-responsive="true"> + <!-- EVENT navbar_header_username_prepend --> + <div class="header-profile dropdown-container"> + <a href="{U_PROFILE}" class="header-avatar dropdown-trigger"><!-- IF CURRENT_USER_AVATAR -->{CURRENT_USER_AVATAR} <!-- ENDIF --> {CURRENT_USERNAME_SIMPLE}</a> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents" role="menu"> + <!-- IF U_RESTORE_PERMISSIONS --> + <li> + <a href="{U_RESTORE_PERMISSIONS}"> + <i class="icon fa-refresh fa-fw" aria-hidden="true"></i><span>{L_RESTORE_PERMISSIONS}</span> + </a> + </li> + <!-- ENDIF --> + + <!-- EVENT navbar_header_profile_list_before --> + + <li> + <a href="{U_PROFILE}" title="{L_PROFILE}" role="menuitem"> + <i class="icon fa-sliders fa-fw" aria-hidden="true"></i><span>{L_PROFILE}</span> + </a> + </li> + <li> + <a href="{U_USER_PROFILE}" title="{L_READ_PROFILE}" role="menuitem"> + <i class="icon fa-user fa-fw" aria-hidden="true"></i><span>{L_READ_PROFILE}</span> + </a> + </li> + + <!-- EVENT navbar_header_profile_list_after --> + + <li class="separator"></li> + <li> + <a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x" role="menuitem"> + <i class="icon fa-power-off fa-fw" aria-hidden="true"></i><span>{L_LOGIN_LOGOUT}</span> + </a> + </li> + </ul> + </div> + </div> + <!-- EVENT navbar_header_username_append --> + </li> + <!-- IF S_DISPLAY_PM --> + <li class="rightside" data-skip-responsive="true"> + <a href="{U_PRIVATEMSGS}" role="menuitem"> + <i class="icon fa-inbox fa-fw" aria-hidden="true"></i><span><span>{L_PRIVATE_MESSAGES} [</span><strong>{PRIVATE_MESSAGE_COUNT}</strong><span>]</span></span> + </a> + </li> + <!-- ENDIF --> + <!-- IF S_NOTIFICATIONS_DISPLAY --> + <li class="dropdown-container dropdown-{S_CONTENT_FLOW_END} rightside" data-skip-responsive="true"> + <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"> + <i class="icon fa-bell fa-fw" aria-hidden="true"></i><span><span>{L_NOTIFICATIONS} [</span><strong>{NOTIFICATIONS_COUNT}</strong><span>]</span></span> + </a> + <!-- INCLUDE notification_dropdown.html --> + </li> + <!-- ENDIF --> + <!-- ELSE --> + <li class="rightside" data-skip-responsive="true"> + <a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x" role="menuitem"> + <i class="icon fa-power-off fa-fw" aria-hidden="true"></i><span>{L_LOGIN_LOGOUT}</span> + </a> + </li> + <!-- IF S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --> + <li class="rightside" data-skip-responsive="true"> + <a href="{U_REGISTER}" role="menuitem"> + <i class="icon fa-pencil-square-o fa-fw" aria-hidden="true"></i><span>{L_REGISTER}</span> + </a> + </li> + <!-- ENDIF --> + <!-- EVENT navbar_header_logged_out_content --> + <!-- ENDIF --> + </ul> + + <ul id="nav-breadcrumbs" class="nav-breadcrumbs linklist navlinks" role="menubar"> + <!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' --> + <!-- EVENT overall_header_breadcrumbs_before --> + <li class="breadcrumbs"> + <!-- IF U_SITE_HOME --> + <span class="crumb" {$MICRODATA}><a href="{U_SITE_HOME}" data-navbar-reference="home"><i class="icon fa-home fa-fw" aria-hidden="true"></i><span>{L_SITE_HOME}</span></a></span> + <!-- ENDIF --> + <!-- EVENT overall_header_breadcrumb_prepend --> + <span class="crumb" {$MICRODATA}><a href="{U_INDEX}" accesskey="h" data-navbar-reference="index"><!-- IF not U_SITE_HOME --><i class="icon fa-home fa-fw"></i><!-- ENDIF --><span>{L_INDEX}</span></a></span> + + <!-- BEGIN navlinks --> + <!-- EVENT overall_header_navlink_prepend --> + <span class="crumb" {$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->><a href="{navlinks.U_VIEW_FORUM}" itemprop="url"><span itemprop="title">{navlinks.FORUM_NAME}</span></a></span> + <!-- EVENT overall_header_navlink_append --> + <!-- END navlinks --> + <!-- EVENT overall_header_breadcrumb_append --> + </li> + <!-- EVENT overall_header_breadcrumbs_after --> + + <!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH --> + <li class="rightside responsive-search"> + <a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}" role="menuitem"> + <i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH}</span> + </a> + </li> + <!-- ENDIF --> + </ul> + + </div> +</div> diff --git a/phpBB/styles/prosilver/template/notification_dropdown.html b/phpBB/styles/prosilver/template/notification_dropdown.html new file mode 100644 index 0000000000..e444d8fb90 --- /dev/null +++ b/phpBB/styles/prosilver/template/notification_dropdown.html @@ -0,0 +1,47 @@ +<div id="notification_list" class="dropdown dropdown-extended notification_list"> + <div class="pointer"><div class="pointer-inner"></div></div> + <div class="dropdown-contents"> + <div class="header"> + {L_NOTIFICATIONS} + <span class="header_settings"> + <a href="{U_NOTIFICATION_SETTINGS}">{L_SETTINGS}</a> + <!-- IF NOTIFICATIONS_COUNT --> + <span id="mark_all_notifications"> • <a href="{U_MARK_ALL_NOTIFICATIONS}" data-ajax="notification.mark_all_read">{L_MARK_ALL_READ}</a></span> + <!-- ENDIF --> + </span> + </div> + + <ul> + <!-- IF not .notifications --> + <li class="no_notifications"> + {L_NO_NOTIFICATIONS} + </li> + <!-- ENDIF --> + <!-- BEGIN notifications --> + <li class="<!-- IF notifications.UNREAD --> bg2<!-- ENDIF --><!-- IF notifications.STYLING --> {notifications.STYLING}<!-- ENDIF --><!-- IF not notifications.URL --> no-url<!-- ENDIF -->"> + <!-- IF notifications.URL --> + <a class="notification-block" href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}" data-real-url="{notifications.URL}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"> + <!-- ENDIF --> + <!-- IF notifications.AVATAR -->{notifications.AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --> + <div class="notification_text"> + <p class="notification-title">{notifications.FORMATTED_TITLE}</p> + <!-- IF notifications.REFERENCE --><p class="notification-reference">{notifications.REFERENCE}</p><!-- ENDIF --> + <!-- IF notifications.FORUM --><p class="notification-forum">{notifications.FORUM}</p><!-- ENDIF --> + <!-- IF notifications.REASON --><p class="notification-reason">{notifications.REASON}</p><!-- ENDIF --> + <p class="notification-time">{notifications.TIME}</p> + </div> + <!-- IF notifications.URL --></a><!-- ENDIF --> + <!-- IF notifications.UNREAD --> + <a href="{notifications.U_MARK_READ}" class="mark_read icon-mark" data-ajax="notification.mark_read" title="{L_MARK_READ}"> + <i class="icon fa-check-circle icon-xl fa-fw" aria-hidden="true"></i><span class="sr-only">{L_MARK_READ}</span> + </a> + <!-- ENDIF --> + </li> + <!-- END notifications --> + </ul> + + <div class="footer"> + <a href="{U_VIEW_ALL_NOTIFICATIONS}"><span>{L_SEE_ALL}</span></a> + </div> + </div> +</div> diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 662008b7fa..0573abec64 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -1,25 +1,10 @@ <!-- EVENT overall_footer_content_after --> </div> -<div id="page-footer"> +<!-- EVENT overall_footer_page_body_after --> - <div class="navbar"> - <div class="inner"> - - <ul class="linklist bulletin"> - <li class="small-icon icon-home breadcrumbs"><!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}">{L_SITE_HOME}</a> <strong>‹</strong></span> <!-- ENDIF --><span class="crumb"><a href="{U_INDEX}">{L_INDEX}</a></span> - <!-- EVENT overall_footer_breadcrumb_append --> - </li> - <!-- IF not S_IS_BOT --> - <!-- IF U_WATCH_FORUM_LINK --><li class="small-icon icon-<!-- IF S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->"><a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-class="small-icon icon-<!-- IF not S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF --> - <!-- ENDIF --> - <li class="rightside">{S_TIMEZONE}</li> - <!-- IF not S_IS_BOT --><li class="rightside"><a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true">{L_DELETE_COOKIES}</a></li><!-- ENDIF --> - <!-- IF U_TEAM --><li class="rightside"><a href="{U_TEAM}">{L_THE_TEAM}</a><!-- ENDIF --> - </ul> - - </div> - </div> +<div id="page-footer" class="page-footer" role="contentinfo"> + <!-- INCLUDE navbar_footer.html --> <div class="copyright"> <!-- EVENT overall_footer_copyright_prepend --> @@ -30,17 +15,20 @@ <!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF --> </div> - <div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}"> - <div id="darken"> </div> + <div id="darkenwrapper" class="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}"> + <div id="darken" class="darken"> </div> </div> - <div id="loading_indicator"></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> + <a href="#" class="alert_close"> + <i class="icon fa-times-circle fa-fw" aria-hidden="true"></i> + </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> + <a href="#" class="alert_close"> + <i class="icon fa-times-circle fa-fw" aria-hidden="true"></i> + </a> <div class="alert_text"></div> </div> </div> @@ -48,20 +36,35 @@ </div> <div> - <a id="bottom" accesskey="z"></a> + <a id="bottom" class="anchor" accesskey="z"></a> <!-- IF not S_IS_BOT -->{RUN_CRON_TASK}<!-- ENDIF --> </div> <script type="text/javascript" src="{T_JQUERY_LINK}"></script> -<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> +<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write('\x3Cscript src="{T_ASSETS_PATH}/javascript/jquery.min.js?assets_version={T_ASSETS_VERSION}">\x3C/script>');</script><!-- ENDIF --> <script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> <!-- INCLUDEJS forum_fn.js --> <!-- INCLUDEJS ajax.js --> +<!-- IF S_ALLOW_CDN --> + <script type="text/javascript"> + (function($){ + var $fa_cdn = $('head').find('link[rel="stylesheet"]').first(), + $span = $('<span class="fa" style="display:none"></span>').appendTo('body'); + if ($span.css('fontFamily') !== 'FontAwesome' ) { + $fa_cdn.after('<link href="{T_ASSETS_PATH}/css/font-awesome.min.css" rel="stylesheet">'); + $fa_cdn.remove(); + } + $span.remove(); + })(jQuery); + </script> +<!-- ENDIF --> <!-- EVENT overall_footer_after --> <!-- IF S_PLUPLOAD --><!-- INCLUDE plupload.html --><!-- ENDIF --> {$SCRIPTS} +<!-- EVENT overall_footer_body_after --> + </body> </html> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index a89585d899..823d5e1c12 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -1,21 +1,24 @@ <!DOCTYPE html> <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> -<meta charset="utf-8"> -<meta name="viewport" content="width=device-width" /> -<meta name="keywords" content="" /> -<meta name="description" content="" /> +<meta charset="utf-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> {META} <title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title> <!-- IF S_ENABLE_FEEDS --> - <!-- IF S_ENABLE_FEEDS_OVERALL --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {SITENAME}" href="{U_FEED}" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_NEWS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_NEWS}" href="{U_FEED}?mode=news" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_FORUMS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_FORUMS}" href="{U_FEED}?mode=forums" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_TOPICS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_NEW}" href="{U_FEED}?mode=topics" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_TOPICS_ACTIVE --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_ACTIVE}" href="{U_FEED}?mode=topics_active" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} - {FORUM_NAME}" href="{U_FEED}?f={S_FORUM_ID}" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} - {TOPIC_TITLE}" href="{U_FEED}?f={S_FORUM_ID}&t={S_TOPIC_ID}" /><!-- ENDIF --> + <!-- IF S_ENABLE_FEEDS_OVERALL --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {SITENAME}" href="{{ path('phpbb_feed_index') }}"><!-- ENDIF --> + <!-- IF S_ENABLE_FEEDS_NEWS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_NEWS}" href="{{ path('phpbb_feed_news') }}"><!-- ENDIF --> + <!-- IF S_ENABLE_FEEDS_FORUMS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_FORUMS}" href="{{ path('phpbb_feed_forums') }}"><!-- ENDIF --> + <!-- IF S_ENABLE_FEEDS_TOPICS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_NEW}" href="{{ path('phpbb_feed_topics') }}"><!-- ENDIF --> + <!-- IF S_ENABLE_FEEDS_TOPICS_ACTIVE --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_ACTIVE}" href="{{ path('phpbb_feed_topics_active') }}"><!-- ENDIF --> + <!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} - {FORUM_NAME}" href="{{ path('phpbb_feed_forum', { forum_id : S_FORUM_ID } ) }}"><!-- ENDIF --> + <!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} - {TOPIC_TITLE}" href="{{ path('phpbb_feed_topic', { topic_id : S_TOPIC_ID } ) }}"><!-- ENDIF --> + <!-- EVENT overall_header_feeds --> +<!-- ENDIF --> + +<!-- IF U_CANONICAL --> + <link rel="canonical" href="{U_CANONICAL}"> <!-- ENDIF --> <!-- @@ -25,159 +28,90 @@ Modified by: --> -<link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" /> -<!-- IF S_ALLOW_CDN --><link href="//fonts.googleapis.com/css?family=Open+Sans:600&subset=latin,cyrillic-ext,latin-ext,cyrillic,greek-ext,greek,vietnamese" rel="stylesheet" type="text/css" media="screen, projection" /><!-- ENDIF --> -<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" /> -<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" /> -<link href="{T_THEME_PATH}/responsive.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="only screen and (max-width: 700px), only screen and (max-device-width: 700px)" /> +<!-- IF S_ALLOW_CDN --> +<script> + WebFontConfig = { + google: { + families: ['Open+Sans:600:cyrillic-ext,latin,greek-ext,greek,vietnamese,latin-ext,cyrillic'] + } + }; + + (function(d) { + var wf = d.createElement('script'), s = d.scripts[0]; + wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js'; + wf.async = true; + s.parentNode.insertBefore(wf, s); + })(document); +</script> +<!-- ENDIF --> +<link href="{T_FONT_AWESOME_LINK}" rel="stylesheet"> +<link href="{T_STYLESHEET_LINK}" rel="stylesheet"> +<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet"> <!-- IF S_CONTENT_DIRECTION eq 'rtl' --> - <link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" /> + <link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet"> <!-- ENDIF --> <!-- IF S_PLUPLOAD --> - <link href="{T_THEME_PATH}/plupload.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" /> + <link href="{T_THEME_PATH}/plupload.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet"> <!-- ENDIF --> -<!--[if lte IE 8]> - <link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" /> +<!--[if lte IE 9]> + <link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet"> <![endif]--> <!-- EVENT overall_header_head_append --> {$STYLESHEETS} +<!-- EVENT overall_header_stylesheets_after --> + </head> -<body id="phpbb" class="nojs section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}"> +<body id="phpbb" class="nojs notouch section-{SCRIPT_NAME} {S_CONTENT_DIRECTION} {BODY_CLASS}"> -<div id="wrap"> - <a id="top" accesskey="t"></a> +<!-- EVENT overall_header_body_before --> + +<div id="wrap" class="wrap"> + <a id="top" class="top-anchor" accesskey="t"></a> <div id="page-header"> - <div class="headerbar"> + <div class="headerbar" role="banner"> <div class="inner"> - <div id="site-description"> - <a href="<!-- IF U_SITE_HOME -->{U_SITE_HOME}<!-- ELSE -->{U_INDEX}<!-- ENDIF -->" title="<!-- IF U_SITE_HOME -->{L_SITE_HOME}<!-- ELSE -->{L_INDEX}<!-- ENDIF -->" id="logo">{SITE_LOGO_IMG}</a> + <div id="site-description" class="site-description"> + <a id="logo" class="logo" href="<!-- IF U_SITE_HOME -->{U_SITE_HOME}<!-- ELSE -->{U_INDEX}<!-- ENDIF -->" title="<!-- IF U_SITE_HOME -->{L_SITE_HOME}<!-- ELSE -->{L_INDEX}<!-- ENDIF -->"><span class="site_logo"></span></a> <h1>{SITENAME}</h1> <p>{SITE_DESCRIPTION}</p> <p class="skiplink"><a href="#start_here">{L_SKIP}</a></p> </div> - <!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH --> - <div id="search-box"> + <!-- EVENT overall_header_searchbox_before --> + <!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH --> + <div id="search-box" class="search-box search-header" role="search"> <form action="{U_SEARCH}" method="get" id="search"> <fieldset> - <input name="keywords" id="keywords" type="search" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="{SEARCH_WORDS}" placeholder="{L_SEARCH_MINI}" /> - <input class="button2" value="{L_SEARCH}" type="submit" /><br /> - <a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> {S_SEARCH_HIDDEN_FIELDS} + <input name="keywords" id="keywords" type="search" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search tiny" size="20" value="{SEARCH_WORDS}" placeholder="{L_SEARCH_MINI}" /> + <button class="button button-search" type="submit" title="{L_SEARCH}"> + <i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH}</span> + </button> + <a href="{U_SEARCH}" class="button button-search-end" title="{L_SEARCH_ADV}"> + <i class="icon fa-cog fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH_ADV}</span> + </a> + {S_SEARCH_HIDDEN_FIELDS} </fieldset> </form> </div> - <!-- ENDIF --> - - </div> - </div> - - <div class="navbar"> - <div class="inner"> - - <ul class="linklist navlinks"> - <!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' --> - <li class="small-icon icon-home breadcrumbs"><!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}"{$MICRODATA}>{L_SITE_HOME}</a> <strong>‹</strong></span> <!-- ENDIF --> - <span class="crumb"><a href="{U_INDEX}" accesskey="h"{$MICRODATA}>{L_INDEX}</a></span> - <!-- BEGIN navlinks --> <span class="crumb"><strong>‹</strong> <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a></span><!-- END navlinks --> - <!-- EVENT overall_header_breadcrumb_append --> - </li> - - <!-- IF U_EMAIL_TOPIC --><li class="rightside"><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}" class="sendemail">{L_EMAIL_TOPIC}</a></li><!-- ENDIF --> - <!-- IF U_EMAIL_PM --><li class="rightside"><a href="{U_EMAIL_PM}" title="{L_EMAIL_PM}" class="sendemail">{L_EMAIL_PM}</a></li><!-- ENDIF --> - <!-- IF U_PRINT_TOPIC --><li class="rightside"><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p" class="print">{L_PRINT_TOPIC}</a></li><!-- ENDIF --> - <!-- IF U_PRINT_PM --><li class="rightside"><a href="{U_PRINT_PM}" title="{L_PRINT_PM}" accesskey="p" class="print">{L_PRINT_PM}</a></li><!-- ENDIF --> - <!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH --><li class="responsive-search rightside" style="display: none;"><a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH}</a></li><!-- ENDIF --> - </ul> - - <ul class="linklist bulletin"> - <!-- IF not S_IS_BOT and S_USER_LOGGED_IN --> - <!-- IF S_NOTIFICATIONS_DISPLAY --> - <li class="small-icon icon-notification" data-skip-responsive="true"> - <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button"><span>{L_NOTIFICATIONS} [</span><strong>{NOTIFICATIONS_COUNT}</strong><span>]</span></a> - <div id="notification_list" class="dropdown notification_list"> - <div class="pointer"><div class="pointer-inner"></div></div> - <div class="dropdown-contents"> - <div class="header"> - {L_NOTIFICATIONS} - <span class="header_settings"> - <a href="{U_NOTIFICATION_SETTINGS}">{L_SETTINGS}</a> - <!-- IF NOTIFICATIONS_COUNT --> - <span id="mark_all_notifications"> • <a href="{U_MARK_ALL_NOTIFICATIONS}" data-ajax="notification.mark_all_read">{L_MARK_ALL_READ}</a></span> - <!-- ENDIF --> - </span> - </div> - - <ul> - <!-- IF not .notifications --> - <li> - {L_NO_NOTIFICATIONS} - </li> - <!-- ENDIF --> - <!-- BEGIN notifications --> - <li class="<!-- IF notifications.UNREAD --> bg2<!-- ENDIF -->"> - <!-- IF notifications.URL --> - <a href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}" data-real-url="{notifications.URL}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"> - <!-- ENDIF --> - <!-- IF notifications.AVATAR -->{notifications.AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --> - <div class="notification_text"> - <p>{notifications.FORMATTED_TITLE}</p> - <p>» {notifications.TIME}</p> - </div> - <!-- IF notifications.URL --></a><!-- ENDIF --> - <!-- IF notifications.UNREAD --> - <a href="{notifications.U_MARK_READ}" class="mark_read icon-mark" data-ajax="notification.mark_read" title="{L_MARK_READ}"></a> - <!-- ENDIF --> - </li> - <!-- END notifications --> - </ul> - - <div class="footer"> - <a href="{U_VIEW_ALL_NOTIFICATIONS}"><span>{L_SEE_ALL}</span></a> - </div> - </div> - </div> - </li> - <!-- ENDIF --> - <!-- IF S_DISPLAY_PM --> - <li class="small-icon icon-pm"> - <a href="{U_PRIVATEMSGS}"><span>{L_PRIVATE_MESSAGES} [</span><strong>{PRIVATE_MESSAGE_COUNT}</strong><span>]</span></a> - </li> - <!-- ENDIF --> - <li class="small-icon icon-ucp"> - <a href="{U_PROFILE}" title="{L_PROFILE}" accesskey="e">{L_PROFILE}</a> - </li> - <!-- IF S_DISPLAY_SEARCH --> - <li class="icon-search-self"><a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></li> - <!-- ENDIF --> - <!-- IF U_RESTORE_PERMISSIONS --> - <li class="icon-restore-permissions"><a href="{U_RESTORE_PERMISSIONS}">{L_RESTORE_PERMISSIONS}</a></li> - <!-- ENDIF --> <!-- ENDIF --> - <!-- EVENT overall_header_navigation_append --> - <!-- IF not S_IS_BOT --> - <li class="small-icon icon-logout rightside no-bulletin"><a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x">{L_LOGIN_LOGOUT}</a></li> - <!-- IF not S_USER_LOGGED_IN and S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --><li class="small-icon icon-register rightside no-bulletin"><a href="{U_REGISTER}">{L_REGISTER}</a></li><!-- ENDIF --> - <!-- IF S_DISPLAY_MEMBERLIST --><li class="small-icon icon-members rightside no-bulletin"><a href="{U_MEMBERLIST}" title="{L_MEMBERLIST_EXPLAIN}">{L_MEMBERLIST}</a></li><!-- ENDIF --> - <!-- ENDIF --> - <li class="small-icon icon-faq rightside no-bulletin"><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></li> - <!-- EVENT overall_header_navigation_prepend --> - </ul> - </div> </div> - + <!-- EVENT overall_header_navbar_before --> + <!-- INCLUDE navbar_header.html --> </div> - <a id="start_here"></a> - <div id="page-body"> + <!-- EVENT overall_header_page_body_before --> + + <a id="start_here" class="anchor"></a> + <div id="page-body" class="page-body" role="main"> <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) --> <div id="information" class="rules"> <div class="inner"> diff --git a/phpBB/styles/prosilver/template/pagination.html b/phpBB/styles/prosilver/template/pagination.html index cb54193c3f..e8483331f4 100644 --- a/phpBB/styles/prosilver/template/pagination.html +++ b/phpBB/styles/prosilver/template/pagination.html @@ -1,14 +1,30 @@ - <a href="#" class="pagination-trigger" title="{L_JUMP_TO_PAGE}" data-lang-jump-page="{L_JUMP_PAGE|e('html_attr')}{L_COLON}" data-on-page="{CURRENT_PAGE}" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> +<ul> +<!-- IF BASE_URL and TOTAL_PAGES > 6 --> + <li class="dropdown-container dropdown-button-control dropdown-page-jump page-jump"> + <a class="button button-icon-only dropdown-trigger" href="#" title="{L_JUMP_TO_PAGE_CLICK}" role="button"><i class="icon fa-level-down fa-rotate-270" aria-hidden="true"></i><span class="sr-only">{PAGE_NUMBER}</span></a> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents"> + <li>{L_JUMP_TO_PAGE}{L_COLON}</li> + <li class="page-jump-form"> + <input type="number" name="page-number" min="1" maxlength="6" title="{L_JUMP_PAGE}" class="inputbox tiny" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}" data-start-name="{START_NAME}" /> + <input class="button2" value="{L_GO}" type="button" /> + </li> + </ul> + </div> + </li> +<!-- ENDIF --> +<!-- BEGIN pagination --> + <!-- IF pagination.S_IS_PREV --> + <li class="arrow previous"><a class="button button-icon-only" href="{pagination.PAGE_URL}" rel="prev" role="button"><i class="icon fa-chevron-left fa-fw" aria-hidden="true"></i><span class="sr-only">{L_PREVIOUS}</span></a></li> + <!-- ELSEIF pagination.S_IS_CURRENT --> + <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> + <!-- ELSEIF pagination.S_IS_ELLIPSIS --> + <li class="ellipsis" role="separator"><span>{L_ELLIPSIS}</span></li> + <!-- ELSEIF pagination.S_IS_NEXT --> + <li class="arrow next"><a class="button button-icon-only" href="{pagination.PAGE_URL}" rel="next" role="button"><i class="icon fa-chevron-right fa-fw" aria-hidden="true"></i><span class="sr-only">{L_NEXT}</span></a></li> + <!-- ELSE --> + <li><a class="button" href="{pagination.PAGE_URL}" role="button">{pagination.PAGE_NUMBER}</a></li> + <!-- ENDIF --> +<!-- END pagination --> +</ul> diff --git a/phpBB/styles/prosilver/template/posting_attach_body.html b/phpBB/styles/prosilver/template/posting_attach_body.html index 8a2004c29b..81e3186de1 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -17,13 +17,13 @@ </dl> </fieldset> - <div id="attach-panel-multi"> + <div id="attach-panel-multi" class="attach-panel-multi"> <input type="button" class="button2" value="{L_PLUPLOAD_ADD_FILES}" id="add_files" /> </div> - <div class="panel<!-- IF not .attach_row --> hidden<!-- ENDIF -->" id="file-list-container"> + <div class="panel<!-- IF not .attach_row --> hidden<!-- ENDIF --> file-list-container" id="file-list-container"> <div class="inner"> - <table class="table1 zebra-list"> + <table class="table1 zebra-list fixed-width-table"> <thead> <tr> <th class="attach-name">{L_PLUPLOAD_FILENAME}</th> @@ -32,11 +32,10 @@ <th class="attach-status">{L_PLUPLOAD_STATUS}</th> </tr> </thead> - <tbody class="responsive-skip-empty" id="file-list"> + <tbody class="responsive-skip-empty file-list" id="file-list"> <tr class="attach-row" id="attach-row-tpl"> <td class="attach-name"> - <dfn style="display: none;">{L_PLUPLOAD_FILENAME}</dfn> - <span class="file-name"></span> + <span class="file-name ellipsis-text"></span> <span class="attach-controls"> <input type="button" value="{L_PLACE_INLINE}" class="button2 hidden file-inline-bbcode" /> <input type="button" value="{L_DELETE_FILE}" class="button2 file-delete" /> @@ -44,15 +43,12 @@ <span class="clear"></span> </td> <td class="attach-comment"> - <dfn style="display: none;">{L_FILE_COMMENT}</dfn> <textarea rows="1" cols="30" class="inputbox"></textarea> </td> <td class="attach-filesize"> - <dfn style="display: none;">{L_PLUPLOAD_SIZE}</dfn> <span class="file-size"></span> </td> <td class="attach-status"> - <dfn style="display: none;">{L_PLUPLOAD_STATUS}</dfn> <span class="file-progress"> <span class="file-progress-bar"></span> </span> @@ -62,7 +58,7 @@ <!-- BEGIN attach_row --> <tr class="attach-row" data-attach-id="{attach_row.ATTACH_ID}"> <td class="attach-name"> - <span class="file-name"><a href="{attach_row.U_VIEW_ATTACHMENT}">{attach_row.FILENAME}</a></span> + <span class="file-name ellipsis-text"><a href="{attach_row.U_VIEW_ATTACHMENT}">{attach_row.FILENAME}</a></span> <span class="attach-controls"> <!-- IF S_INLINE_ATTACHMENT_OPTIONS --><input type="button" value="{L_PLACE_INLINE}" class="button2 file-inline-bbcode" /> <!-- ENDIF --> <input type="submit" name="delete_file[{attach_row.ASSOC_INDEX}]" value="{L_DELETE_FILE}" class="button2 file-delete" /> diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index 137970bbdf..45290251a6 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -34,7 +34,7 @@ function change_palette() { - dE('colour_palette'); + phpbb.toggleDisplay('colour_palette'); e = document.getElementById('colour_palette'); if (e.style.display == 'block') @@ -55,32 +55,57 @@ <div id="colour_palette" style="display: none;"> <dl style="clear: left;"> <dt><label>{L_FONT_COLOR}{L_COLON}</label></dt> - <dd id="color_palette_placeholder" data-orientation="h" data-height="12" data-width="15" data-bbcode="true"></dd> + <dd id="color_palette_placeholder" class="color_palette_placeholder" data-orientation="h" data-height="12" data-width="15" data-bbcode="true"></dd> </dl> </div> <!-- EVENT posting_editor_buttons_before --> -<div id="format-buttons"> - <input type="button" class="button2" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}" /> - <input type="button" class="button2" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}" /> - <input type="button" class="button2" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" title="{L_BBCODE_U_HELP}" /> +<div id="format-buttons" class="format-buttons"> + <button type="button" class="button button-icon-only bbcode-b" accesskey="b" name="addbbcode0" value=" B " onclick="bbstyle(0)" title="{L_BBCODE_B_HELP}"> + <i class="icon fa-bold fa-fw" aria-hidden="true"></i> + </button> + <button type="button" class="button button-icon-only bbcode-i" accesskey="i" name="addbbcode2" value=" i " onclick="bbstyle(2)" title="{L_BBCODE_I_HELP}"> + <i class="icon fa-italic fa-fw" aria-hidden="true"></i> + </button> + <button type="button" class="button button-icon-only bbcode-u" accesskey="u" name="addbbcode4" value=" u " onclick="bbstyle(4)" title="{L_BBCODE_U_HELP}"> + <i class="icon fa-underline fa-fw" aria-hidden="true"></i> + </button> <!-- IF S_BBCODE_QUOTE --> - <input type="button" class="button2" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" title="{L_BBCODE_Q_HELP}" /> + <button type="button" class="button button-icon-only bbcode-quote" accesskey="q" name="addbbcode6" value="Quote" onclick="bbstyle(6)" title="{L_BBCODE_Q_HELP}"> + <i class="icon fa-quote-left fa-fw" aria-hidden="true"></i> + </button> <!-- ENDIF --> - <input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" title="{L_BBCODE_C_HELP}" /> - <input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" title="{L_BBCODE_L_HELP}" /> - <input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" title="{L_BBCODE_O_HELP}" /> - <input type="button" class="button2" accesskey="y" name="addlistitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" title="{L_BBCODE_LISTITEM_HELP}" /> + <button type="button" class="button button-icon-only bbcode-code" accesskey="c" name="addbbcode8" value="Code" onclick="bbstyle(8)" title="{L_BBCODE_C_HELP}"> + <i class="icon fa-code fa-fw" aria-hidden="true"></i> + </button> + <button type="button" class="button button-icon-only bbcode-list" accesskey="l" name="addbbcode10" value="List" onclick="bbstyle(10)" title="{L_BBCODE_L_HELP}"> + <i class="icon fa-list fa-fw" aria-hidden="true"></i> + </button> + <button type="button" class="button button-icon-only bbcode-list-" accesskey="o" name="addbbcode12" value="List=" onclick="bbstyle(12)" title="{L_BBCODE_O_HELP}"> + <i class="icon fa-list-ol fa-fw" aria-hidden="true"></i> + </button> + <button type="button" class="button button-icon-only bbcode-asterisk" accesskey="y" name="addlistitem" value="[*]" onclick="bbstyle(-1)" title="{L_BBCODE_LISTITEM_HELP}"> + <i class="icon fa-asterisk fa-fw" aria-hidden="true"></i> + </button> <!-- IF S_BBCODE_IMG --> - <input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}" /> + <button type="button" class="button button-icon-only bbcode-img" accesskey="p" name="addbbcode14" value="Img" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}"> + <i class="icon fa-image fa-fw" aria-hidden="true"></i> + </button> <!-- ENDIF --> <!-- IF S_LINKS_ALLOWED --> - <input type="button" class="button2" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" title="{L_BBCODE_W_HELP}" /> + <button type="button" class="button button-icon-only bbcode-url" accesskey="w" name="addbbcode16" value="URL" onclick="bbstyle(16)" title="{L_BBCODE_W_HELP}"> + <i class="icon fa-link fa-fw" aria-hidden="true"></i> + </button> <!-- ENDIF --> <!-- IF S_BBCODE_FLASH --> - <input type="button" class="button2" accesskey="d" name="addbbcode18" value="Flash" onclick="bbstyle(18)" title="{L_BBCODE_D_HELP}" /> + <button type="button" class="button button-icon-only bbcode-flash" accesskey="d" name="addbbcode18" value="Flash" onclick="bbstyle(18)" title="{L_BBCODE_D_HELP}"> + <i class="icon fa-flash fa-fw" aria-hidden="true"></i> + </button> <!-- ENDIF --> - <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" title="{L_BBCODE_F_HELP}"> + <button type="button" class="button button-icon-only bbcode-color" name="bbpalette" id="bbpalette" value="{L_FONT_COLOR}" onclick="change_palette();" title="{L_BBCODE_S_HELP}"> + <i class="icon fa-tint fa-fw" aria-hidden="true"></i> + </button> + <select name="addbbcode20" class="bbcode-size" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" title="{L_BBCODE_F_HELP}"> <option value="50">{L_FONT_TINY}</option> <option value="85">{L_FONT_SMALL}</option> <option value="100" selected="selected">{L_FONT_NORMAL}</option> @@ -91,9 +116,13 @@ <!-- ENDIF --> <!-- ENDIF --> </select> - <input type="button" class="button2" name="bbpalette" id="bbpalette" value="{L_FONT_COLOR}" onclick="change_palette();" title="{L_BBCODE_S_HELP}" /> + + <!-- EVENT posting_editor_buttons_custom_tags_before --> + <!-- BEGIN custom_tags --> - <input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" /> + <button type="button" class="button button-secondary bbcode-{custom_tags.BBCODE_TAG_CLEAN}" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}"> + {custom_tags.BBCODE_TAG} + </button> <!-- END custom_tags --> </div> <!-- EVENT posting_editor_buttons_after --> diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 2ae224bc3a..9376ae8be7 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -1,80 +1,12 @@ <fieldset class="fields1"> <!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF --> - <!-- IF S_PRIVMSGS and not S_SHOW_DRAFTS --> - - <div class="column1"> - <!-- IF S_ALLOW_MASS_PM --> - <!-- IF .to_recipient --> - <dl> - <dt><label>{L_TO}{L_COLON}</label></dt> - <dd> - <!-- BEGIN to_recipient --> - <!-- IF not to_recipient.S_FIRST_ROW and to_recipient.S_ROW_COUNT mod 2 eq 0 --></dd><dd><!-- ENDIF --> - <!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><strong>{to_recipient.NAME}</strong></a><!-- ELSE -->{to_recipient.NAME_FULL}<!-- ENDIF --> - <!-- IF not S_EDIT_POST --><input type="submit" name="remove_{to_recipient.TYPE}[{to_recipient.UG_ID}]" value="x" class="button2" /> <!-- ENDIF --> - <!-- END to_recipient --> - </dd> - </dl> - <!-- ENDIF --> - <!-- IF .bcc_recipient --> - <dl> - <dt><label>{L_BCC}{L_COLON}</label></dt> - <dd> - <!-- BEGIN bcc_recipient --> - <!-- IF not bcc_recipient.S_FIRST_ROW and bcc_recipient.S_ROW_COUNT mod 2 eq 0 --></dd><dd><!-- ENDIF --> - <!-- IF bcc_recipient.IS_GROUP --><a href="{bcc_recipient.U_VIEW}"><strong>{bcc_recipient.NAME}</strong></a><!-- ELSE -->{bcc_recipient.NAME_FULL}<!-- ENDIF --> - <!-- IF not S_EDIT_POST --><input type="submit" name="remove_{bcc_recipient.TYPE}[{bcc_recipient.UG_ID}]" value="x" class="button2" /> <!-- ENDIF --> - <!-- END bcc_recipient --> - </dd> - </dl> - <!-- ENDIF --> - <!-- IF not S_EDIT_POST --> - <dl class="pmlist"> - <dt><label>{L_TO}{L_COLON}<textarea id="username_list" name="username_list" class="inputbox" cols="50" rows="2" tabindex="1"></textarea></label></dt> - <dd><span><a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a></span></dd> - <dd><input type="submit" name="add_to" value="{L_ADD}" class="button2" tabindex="1" /></dd> - <dd><input type="submit" name="add_bcc" value="{L_ADD_BCC}" class="button2" tabindex="1" /></dd> - </dl> - <!-- ENDIF --> - <!-- ELSE --> - <dl> - <dt><label for="username_list">{L_TO}{L_COLON}</label><!-- IF not S_EDIT_POST --><br /><span><a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false">{L_FIND_USERNAME}</a></span><!-- ENDIF --></dt> - <!-- IF .to_recipient --> - <dd> - <!-- BEGIN to_recipient --> - <!-- IF not to_recipient.S_FIRST_ROW and to_recipient.S_ROW_COUNT mod 2 eq 0 --></dd><dd><!-- ENDIF --> - <!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><strong>{to_recipient.NAME}</strong></a><!-- ELSE -->{to_recipient.NAME_FULL}<!-- ENDIF --> - <!-- IF not S_EDIT_POST --><input type="submit" name="remove_{to_recipient.TYPE}[{to_recipient.UG_ID}]" value="x" class="button2" /> <!-- ENDIF --> - <!-- END to_recipient --> - </dd> - <!-- ENDIF --> - - <!-- IF not S_EDIT_POST --> - <dd><input class="inputbox" type="text" name="username_list" id="username_list" size="20" value="" /> <input type="submit" name="add_to" value="{L_ADD}" class="button2" /></dd> - <!-- ENDIF --> - </dl> - <!-- ENDIF --> - - </div> - - <!-- IF S_GROUP_OPTIONS --> - <div class="column2"> - <dl> - <dd><label for="group_list">{L_USERGROUPS}{L_COLON}</label> <select name="group_list[]" id="group_list" multiple="multiple" size="4" class="inputbox">{S_GROUP_OPTIONS}</select></dd> - </dl> - </div> - <!-- ENDIF --> - - <div class="clear"></div> - <!-- ENDIF --> - <!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS --> <dl> <dt><label for="icon">{L_ICON}{L_COLON}</label></dt> <dd> <label for="icon"><input type="radio" name="icon" id="icon" value="0" checked="checked" tabindex="1" /> <!-- IF S_SHOW_TOPIC_ICONS -->{L_NO_TOPIC_ICON}<!-- ELSE -->{L_NO_PM_ICON}<!-- ENDIF --></label> - <!-- BEGIN topic_icon --><label for="icon-{topic_icon.ICON_ID}"><input type="radio" name="icon" id="icon-{topic_icon.ICON_ID}" value="{topic_icon.ICON_ID}" {topic_icon.S_ICON_CHECKED} tabindex="1" /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" /></label> <!-- END topic_icon --> + <!-- BEGIN topic_icon --><label for="icon-{topic_icon.ICON_ID}"><input type="radio" name="icon" id="icon-{topic_icon.ICON_ID}" value="{topic_icon.ICON_ID}" {topic_icon.S_ICON_CHECKED} tabindex="1" /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="{topic_icon.ICON_ALT}" title="{topic_icon.ICON_ALT}" /></label> <!-- END topic_icon --> </dd> </dl> <!-- ENDIF --> @@ -103,17 +35,18 @@ <!-- INCLUDE posting_buttons.html --> - <div id="smiley-box"> + <div id="smiley-box" class="smiley-box"> + <!-- EVENT posting_editor_smilies_before --> <!-- IF S_SMILIES_ALLOWED and .smiley --> <strong>{L_SMILIES}</strong><br /> <!-- BEGIN smiley --> <a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" /></a> <!-- END smiley --> <!-- ENDIF --> - <!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED--> - <br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a> + <!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED --> + <br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 750, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a> <!-- ENDIF --> - + <!-- EVENT posting_editor_smilies_after --> <!-- IF BBCODE_STATUS --> <div class="bbcode-status"> <!-- IF .smiley --><hr /><!-- ENDIF --> @@ -126,6 +59,7 @@ {SMILIES_STATUS} </div> <!-- ENDIF --> + <!-- EVENT posting_editor_bbcode_status_after --> <!-- IF S_EDIT_DRAFT || S_DISPLAY_REVIEW --> <!-- IF S_DISPLAY_REVIEW --><hr /><!-- ENDIF --> <!-- IF S_EDIT_DRAFT --><strong><a href="{S_UCP_ACTION}">{L_BACK_TO_DRAFTS}</a></strong><!-- ENDIF --> @@ -135,12 +69,12 @@ <!-- EVENT posting_editor_message_before --> - <div id="message-box"> + <div id="message-box" class="message-box"> <textarea <!-- IF S_UCP_ACTION and not S_PRIVMSGS and not S_EDIT_DRAFT -->name="signature" id="signature" style="height: 9em;"<!-- ELSE -->name="message" id="message"<!-- ENDIF --> rows="15" cols="76" tabindex="4" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();" class="inputbox">{MESSAGE}{DRAFT_MESSAGE}{SIGNATURE}</textarea> </div> <!-- EVENT posting_editor_message_after --> -</fieldset> + </fieldset> <!-- IF $EXTRA_POSTING_OPTIONS eq 1 --> @@ -155,6 +89,7 @@ <fieldset class="submit-buttons"> {S_HIDDEN_ADDRESS_FIELD} {S_HIDDEN_FIELDS} + <!-- EVENT posting_editor_submit_buttons --> <!-- IF S_HAS_DRAFTS --><input type="submit" accesskey="d" tabindex="8" name="load" value="{L_LOAD_DRAFT}" class="button2" onclick="load_draft = true;" /> <!-- ENDIF --> <!-- IF S_SAVE_ALLOWED --><input type="submit" accesskey="k" tabindex="7" name="save" value="{L_SAVE_DRAFT}" class="button2" /> <!-- ENDIF --> <input type="submit" tabindex="5" name="preview" value="{L_PREVIEW}" class="button1"<!-- IF not S_PRIVMSGS --> onclick="document.getElementById('postform').action += '#preview';"<!-- ENDIF --> /> @@ -167,19 +102,22 @@ <!-- ENDIF --> <!-- IF not S_PRIVMSGS and not S_SHOW_DRAFTS and not $SIG_EDIT eq 1 --> - <div id="tabs" class="sub-panels" data-show-panel="options-panel"> + <div id="tabs" class="tabs sub-panels" data-show-panel="<!-- IF SHOW_PANEL -->{SHOW_PANEL}<!-- ELSE -->options-panel<!-- ENDIF -->" role="tablist"> <ul> - <li id="options-panel-tab" class="activetab"><a href="#tabs" data-subpanel="options-panel"><span>{L_OPTIONS}</span></a></li> + <li id="options-panel-tab" class="tab activetab"><a href="#tabs" data-subpanel="options-panel" role="tab" aria-controls="options-panel"><span>{L_OPTIONS}</span></a></li> <!-- IF S_SHOW_ATTACH_BOX --> - <li id="attach-panel-tab"> - <a href="#tabs" data-subpanel="attach-panel"> - <span> - {L_ATTACHMENTS} <strong id="file-total-progress"><strong id="file-total-progress-bar"></strong></strong> - </span> + <li id="attach-panel-tab" class="tab"> + <a href="#tabs" data-subpanel="attach-panel" role="tab" aria-controls="attach-panel"> + {L_ATTACHMENTS} <strong id="file-total-progress" class="file-total-progress"><strong id="file-total-progress-bar" class="file-total-progress-bar"></strong></strong> </a> - </li> + </li> + <!-- ENDIF --> + <!-- IF S_SHOW_POLL_BOX || S_POLL_DELETE --> + <li id="poll-panel-tab" class="tab"> + <a href="#tabs" data-subpanel="poll-panel" role="tab" aria-controls="poll-panel">{L_ADD_POLL}</a> + </li> <!-- ENDIF --> - <!-- IF S_SHOW_POLL_BOX || S_POLL_DELETE --><li id="poll-panel-tab"><a href="#tabs" data-subpanel="poll-panel"><span>{L_ADD_POLL}</span></a></li><!-- ENDIF --> + <!-- EVENT posting_editor_add_panel_tab --> </ul> </div> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/posting_layout.html b/phpBB/styles/prosilver/template/posting_layout.html index c0bd0225de..22da32076c 100644 --- a/phpBB/styles/prosilver/template/posting_layout.html +++ b/phpBB/styles/prosilver/template/posting_layout.html @@ -1,13 +1,13 @@ <!-- INCLUDE overall_header.html --> <!-- IF TOPIC_TITLE --> - <h2><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2> + <h2 class="posting-title"><!-- EVENT posting_topic_title_before --><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><!-- EVENT posting_topic_title_after --></h2> <!-- ELSE --> - <h2><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2> + <h2 class="posting-title"><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2> <!-- ENDIF --> <!-- IF S_FORUM_RULES --> - <div class="rules"> + <div class="rules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <div class="inner"> <!-- IF U_FORUM_RULES --> @@ -68,6 +68,7 @@ <!-- DEFINE $EXTRA_POSTING_OPTIONS = 1 --> <!-- INCLUDE posting_editor.html --> + <input type="hidden" name="show_panel" value="options-panel" /> {S_FORM_TOKEN} </div> </div> @@ -76,6 +77,8 @@ <!-- IF S_SHOW_POLL_BOX or S_POLL_DELETE --><!-- INCLUDE posting_poll_body.html --><!-- ENDIF --> +<!-- EVENT posting_layout_include_panel_body --> + <!-- IF S_DISPLAY_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF --> </form> diff --git a/phpBB/styles/prosilver/template/posting_pm_header.html b/phpBB/styles/prosilver/template/posting_pm_header.html new file mode 100644 index 0000000000..032d8c6a6f --- /dev/null +++ b/phpBB/styles/prosilver/template/posting_pm_header.html @@ -0,0 +1,83 @@ +<fieldset class="fields1"> + <!-- IF not S_SHOW_DRAFTS --> + + <!-- IF S_GROUP_OPTIONS --> + <div class="column2"> + <label for="group_list"><strong>{L_TO_ADD_GROUPS}{L_COLON}</strong></label><br /> + <select name="group_list[]" id="group_list" multiple="multiple" size="3" class="inputbox">{S_GROUP_OPTIONS}</select><br /> + </div> + <!-- ENDIF --> + <!-- IF S_ALLOW_MASS_PM --> + <div class="column1"> + <!-- IF not S_EDIT_POST --> + <dl class="pmlist"> + <dt><label><strong>{L_TO_ADD_MASS}{L_COLON}</strong><textarea id="username_list" name="username_list" class="inputbox" cols="50" rows="2" tabindex="1"></textarea></label></dt> + <dd class="recipients"> + <input type="submit" name="add_to" value="{L_ADD}" class="button2" tabindex="1" /> + <input type="submit" name="add_bcc" value="{L_ADD_BCC}" class="button2" tabindex="1" /> + <!-- EVENT posting_pm_header_find_username_before --> + <span><a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a></span> + <!-- EVENT posting_pm_header_find_username_after --> + </dd> + </dl> + <!-- ENDIF --> + </div> + <!-- IF .to_recipient or .bcc_recipient --><hr /><!-- ENDIF --> + <div class="column1"> + <!-- IF .to_recipient --> + <dl> + <dt><label>{L_TO_MASS}{L_COLON}</label></dt> + <dd class="recipients"> + <ul class="recipients"> + <!-- BEGIN to_recipient --> + <li> + <!-- IF not S_EDIT_POST --><input type="submit" name="remove_{to_recipient.TYPE}[{to_recipient.UG_ID}]" value="x" class="button2" /><!-- ENDIF --> + <!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><strong>{to_recipient.NAME}</strong></a><!-- ELSE -->{to_recipient.NAME_FULL}<!-- ENDIF --> + </li> + <!-- END to_recipient --> + </ul> + </dd> + </dl> + <!-- ENDIF --> + </div> + <!-- IF .bcc_recipient --> + <div class="column2"> + <dl> + <dt><label>{L_BCC}{L_COLON}</label></dt> + <dd class="recipients"> + <ul class="recipients"> + <!-- BEGIN bcc_recipient --> + <li> + <!-- IF not S_EDIT_POST --><input type="submit" name="remove_{bcc_recipient.TYPE}[{bcc_recipient.UG_ID}]" value="x" class="button2" /><!-- ENDIF --> + <!-- IF bcc_recipient.IS_GROUP --><a href="{bcc_recipient.U_VIEW}"><strong>{bcc_recipient.NAME}</strong></a><!-- ELSE -->{bcc_recipient.NAME_FULL}<!-- ENDIF --> + </li> + <!-- END bcc_recipient --> + </ul> + </dd> + </dl> + </div> + <!-- ENDIF --> + <!-- ELSE --> + <div class="column1"> + <dl> + <dt><label for="username_list">{L_TO_ADD}{L_COLON}</label><!-- IF not S_EDIT_POST --><br /><span><a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false">{L_FIND_USERNAME}</a></span><!-- ENDIF --></dt> + <!-- IF not S_EDIT_POST --> + <dd><input class="inputbox" type="text" name="username_list" id="username_list" size="20" value="" /> <input type="submit" name="add_to" value="{L_ADD}" class="button2" /></dd> + <!-- ENDIF --> + <!-- IF .to_recipient --> + <dd class="recipients"> + <ul class="recipients"> + <!-- BEGIN to_recipient --> + <li> + <!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><strong>{to_recipient.NAME}</strong></a><!-- ELSE -->{to_recipient.NAME_FULL}<!-- ENDIF --> + <!-- IF not S_EDIT_POST --><input type="submit" name="remove_{to_recipient.TYPE}[{to_recipient.UG_ID}]" value="x" class="button2" /><!-- ENDIF --> + </li> + <!-- END to_recipient --> + </dd> + <!-- ENDIF --> + </dl> + </div> + <!-- ENDIF --> + + <!-- ENDIF --> + </fieldset> diff --git a/phpBB/styles/prosilver/template/posting_pm_layout.html b/phpBB/styles/prosilver/template/posting_pm_layout.html index 5421cc2cbd..7f4a0ea8d7 100644 --- a/phpBB/styles/prosilver/template/posting_pm_layout.html +++ b/phpBB/styles/prosilver/template/posting_pm_layout.html @@ -15,7 +15,15 @@ <!-- IF S_DISPLAY_PREVIEW --><!-- INCLUDE posting_preview.html --><!-- ENDIF --> -<h2>{L_TITLE}</h2> +<h2 class="posting-title">{L_TITLE}</h2> + +<div class="panel" id="pmheader-postingbox"> + <div class="inner"> + <!-- EVENT posting_pm_layout_include_pm_header_before --> + <!-- INCLUDE posting_pm_header.html --> + <!-- EVENT posting_pm_layout_include_pm_header_after --> + </div> +</div> <div class="panel" id="postingbox"> <div class="inner"> diff --git a/phpBB/styles/prosilver/template/posting_poll_body.html b/phpBB/styles/prosilver/template/posting_poll_body.html index a131c10533..dcaec14a93 100644 --- a/phpBB/styles/prosilver/template/posting_poll_body.html +++ b/phpBB/styles/prosilver/template/posting_poll_body.html @@ -6,13 +6,14 @@ <!-- ENDIF --> <fieldset class="fields2"> + <!-- IF S_POLL_DELETE --> + <dl> + <dt><label for="poll_delete">{L_POLL_DELETE}{L_COLON}</label></dt> + <dd><label for="poll_delete"><input type="checkbox" name="poll_delete" id="poll_delete"<!-- IF S_POLL_DELETE_CHECKED --> checked="checked"<!-- ENDIF --> /> </label></dd> + </dl> + <!-- ENDIF --> + <!-- IF S_SHOW_POLL_BOX --> - <!-- IF S_POLL_DELETE --> - <dl> - <dt><label for="poll_delete">{L_POLL_DELETE}{L_COLON}</label></dt> - <dd><label for="poll_delete"><input type="checkbox" name="poll_delete" id="poll_delete"<!-- IF S_POLL_DELETE_CHECKED --> checked="checked"<!-- ENDIF --> /> </label></dd> - </dl> - <!-- ENDIF --> <dl> <dt><label for="poll_title">{L_POLL_QUESTION}{L_COLON}</label></dt> <dd><input type="text" name="poll_title" id="poll_title" maxlength="255" value="{POLL_TITLE}" class="inputbox" /></dd> @@ -43,13 +44,9 @@ <dd><label for="poll_vote_change"><input type="checkbox" id="poll_vote_change" name="poll_vote_change"{VOTE_CHANGE_CHECKED} /> {L_POLL_VOTE_CHANGE_EXPLAIN}</label></dd> </dl> <!-- ENDIF --> - - <!-- ELSEIF S_POLL_DELETE --> - <dl class="fields1"> - <dt><label for="poll_delete">{L_POLL_DELETE}{L_COLON}</label></dt> - <dd><label for="poll_delete"><input type="checkbox" name="poll_delete" id="poll_delete"<!-- IF S_POLL_DELETE_CHECKED --> checked="checked"<!-- ENDIF --> /> </label></dd> - </dl> <!-- ENDIF --> + + <!-- EVENT posting_poll_body_options_after --> </fieldset> </div> diff --git a/phpBB/styles/prosilver/template/posting_preview.html b/phpBB/styles/prosilver/template/posting_preview.html index a5aae8c436..aac117c090 100644 --- a/phpBB/styles/prosilver/template/posting_preview.html +++ b/phpBB/styles/prosilver/template/posting_preview.html @@ -24,6 +24,8 @@ <!-- ENDIF --> +<!-- EVENT posting_preview_poll_after --> + <div class="postbody"> <h3>{L_PREVIEW}{L_COLON} {PREVIEW_SUBJECT}</h3> diff --git a/phpBB/styles/prosilver/template/posting_review.html b/phpBB/styles/prosilver/template/posting_review.html index 2771c9829a..1304046b23 100644 --- a/phpBB/styles/prosilver/template/posting_review.html +++ b/phpBB/styles/prosilver/template/posting_review.html @@ -8,13 +8,22 @@ <div class="inner"> {post_review_row.L_IGNORE_POST} <!-- ELSE --> -<div class="post <!-- IF post_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF post_review_row.ONLINE_STATUS --> online<!-- ENDIF -->"> +<div class="post <!-- IF post_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> <div class="inner"> <!-- ENDIF --> <div class="postbody" id="ppr{post_review_row.POST_ID}"> <h3><a href="#ppr{post_review_row.POST_ID}">{post_review_row.POST_SUBJECT}</a></h3> - <p class="author"><!-- IF S_IS_BOT -->{post_review_row.MINI_POST_IMG}<!-- ELSE --><a href="{post_review_row.U_MINI_POST}">{post_review_row.MINI_POST_IMG}</a><!-- ENDIF --> {L_POST_BY_AUTHOR}<strong> {post_review_row.POST_AUTHOR_FULL}</strong> » {post_review_row.POST_DATE}</p> + <p class="author"> + <!-- IF S_IS_BOT --> + <span><i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{post_review_row.MINI_POST}</span></span> + <!-- ELSE --> + <a href="{post_review_row.U_MINI_POST}" title="{post_review_row.MINI_POST}"> + <i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{post_review_row.MINI_POST}</span> + </a> + <!-- ENDIF --> + {L_POST_BY_AUTHOR}<strong> {post_review_row.POST_AUTHOR_FULL}</strong> » {post_review_row.POST_DATE} + </p> <div class="content">{post_review_row.MESSAGE}</div> <!-- IF post_review_row.S_HAS_ATTACHMENTS --> diff --git a/phpBB/styles/prosilver/template/posting_smilies.html b/phpBB/styles/prosilver/template/posting_smilies.html index c5371b9b6a..3bd51275ec 100644 --- a/phpBB/styles/prosilver/template/posting_smilies.html +++ b/phpBB/styles/prosilver/template/posting_smilies.html @@ -17,11 +17,11 @@ </div> </div> -<div class="pagination"> - <!-- IF .pagination --> +<!-- IF .pagination --> + <div class="pagination"> <!-- INCLUDE pagination.html --> - <!-- ENDIF --> -</div> + </div> +<!-- ENDIF --> <a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a> <!-- INCLUDE simple_footer.html --> diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index d2faed5f8f..dae0095105 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -1,10 +1,10 @@ -<h3 id="review"> +<h3 id="review" class="review"> <span class="right-box"><a href="#review" onclick="viewableArea(getElementById('topicreview'), true); var rev_text = getElementById('review').getElementsByTagName('a').item(0).firstChild; if (rev_text.data == '{LA_EXPAND_VIEW}'){rev_text.data = '{LA_COLLAPSE_VIEW}'; } else if (rev_text.data == '{LA_COLLAPSE_VIEW}'){rev_text.data = '{LA_EXPAND_VIEW}'};">{L_EXPAND_VIEW}</a></span> {L_TOPIC_REVIEW}{L_COLON} {TOPIC_TITLE} </h3> -<div id="topicreview"> +<div id="topicreview" class="topicreview"> <script type="text/javascript"> // <![CDATA[ bbcodeEnabled = {S_BBCODE_ALLOWED}; @@ -24,15 +24,35 @@ <div class="postbody" id="pr{topic_review_row.POST_ID}"> <h3><a href="#pr{topic_review_row.POST_ID}">{topic_review_row.POST_SUBJECT}</a></h3> + <!-- IF (topic_review_row.POSTER_QUOTE and topic_review_row.DECODED_MESSAGE) or topic_review_row.U_MCP_DETAILS --> + <ul class="post-buttons"> + <!-- IF topic_review_row.U_MCP_DETAILS --> + <li> + <a href="{topic_review_row.U_MCP_DETAILS}" title="{L_POST_DETAILS}" class="button button-icon-only"> + <i class="icon fa-info fa-fw" aria-hidden="true"></i><span class="sr-only">{L_POST_DETAILS}</span> + </a> + <li> + <!-- ENDIF --> <!-- IF topic_review_row.POSTER_QUOTE and topic_review_row.DECODED_MESSAGE --> - <ul class="profile-icons"> - <li class="quote-icon"><a href="#postingbox" onclick="addquote({topic_review_row.POST_ID}, '{topic_review_row.POSTER_QUOTE}', '{LA_WROTE}');" title="{L_QUOTE} {topic_review_row.POST_AUTHOR}"><span>{L_QUOTE} {topic_review_row.POST_AUTHOR}</span></a></li> + <li> + <a href="#postingbox" onclick="addquote({topic_review_row.POST_ID}, '{topic_review_row.POSTER_QUOTE}', '{LA_WROTE}', {post_id:{topic_review_row.POST_ID},time:{topic_review_row.POST_TIME},user_id:{topic_review_row.USER_ID}});" title="{L_QUOTE} {topic_review_row.POST_AUTHOR}" class="button button-icon-only"> + <i class="icon fa-quote-left fa-fw" aria-hidden="true"></i><span class="sr-only">{L_QUOTE} {topic_review_row.POST_AUTHOR}</span> + </a> + </li> + <!-- ENDIF --> </ul> <!-- ENDIF --> - <!-- IF topic_review_row.U_MCP_DETAILS --><div class="right-box"><a href="{topic_review_row.U_MCP_DETAILS}">{L_POST_DETAILS}</a></div><!-- ENDIF --> - - <p class="author"><!-- IF S_IS_BOT -->{topic_review_row.MINI_POST_IMG}<!-- ELSE --><a href="{topic_review_row.U_MINI_POST}">{topic_review_row.MINI_POST_IMG}</a><!-- ENDIF --> {L_POST_BY_AUTHOR} <strong>{topic_review_row.POST_AUTHOR_FULL}</strong> » {topic_review_row.POST_DATE} </p> + <p class="author"> + <!-- IF S_IS_BOT --> + <span><i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{topic_review_row.MINI_POST}</span></span> + <!-- ELSE --> + <a href="{topic_review_row.U_MINI_POST}" title="{topic_review_row.MINI_POST}"> + <i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{topic_review_row.MINI_POST}</span> + </a> + <!-- ENDIF --> + {L_POST_BY_AUTHOR} <strong>{topic_review_row.POST_AUTHOR_FULL}</strong> » {topic_review_row.POST_DATE} + </p> <div class="content">{topic_review_row.MESSAGE}</div> <!-- IF topic_review_row.S_HAS_ATTACHMENTS --> @@ -55,8 +75,8 @@ <hr /> -<!-- IF S_MCP_REPORT --> - <p><a href="#report" class="top2">{L_BACK_TO_TOP}</a></p> -<!-- ELSE --> - <p><a href="#postingbox" class="top2">{L_BACK_TO_TOP}</a></p> -<!-- ENDIF --> +<p> + <a href="<!-- IF S_MCP_REPORT -->#report<!-- ELSE -->#postingbox<!-- ENDIF -->" class="top"> + <i class="icon fa-chevron-circle-up fa-fw icon-gray" aria-hidden="true"></i><span>{L_BACK_TO_TOP}</span> + </a> +</p> diff --git a/phpBB/styles/prosilver/template/profilefields/url.html b/phpBB/styles/prosilver/template/profilefields/url.html new file mode 100644 index 0000000000..8dd3a90de1 --- /dev/null +++ b/phpBB/styles/prosilver/template/profilefields/url.html @@ -0,0 +1,3 @@ +<!-- BEGIN url --> +<input type="url" class="inputbox autowidth" name="{url.FIELD_IDENT}" id="{url.FIELD_IDENT}" size="{url.FIELD_LENGTH}" maxlength="{url.FIELD_MAXLEN}" value="{url.FIELD_VALUE}" /> +<!-- END url --> diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index 774d013cd3..9839494491 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -1,14 +1,16 @@ <form method="post" action="{U_QR_ACTION}" id="qr_postform"> +<!-- EVENT quickreply_editor_panel_before --> <div class="panel"> <div class="inner"> - <h2>{L_QUICKREPLY}</h2> + <h2 class="quickreply-title">{L_QUICKREPLY}</h2> <fieldset class="fields1"> + <!-- EVENT quickreply_editor_subject_before --> <dl style="clear: left;"> <dt><label for="subject">{L_SUBJECT}{L_COLON}</label></dt> <dd><input type="text" name="subject" id="subject" size="45" maxlength="124" tabindex="2" value="{SUBJECT}" class="inputbox autowidth" /></dd> </dl> <!-- EVENT quickreply_editor_message_before --> - <div id="message-box"> + <div id="message-box" class="message-box"> <textarea style="height: 9em;" name="message" rows="7" cols="76" tabindex="3" class="inputbox"></textarea> </div> <!-- EVENT quickreply_editor_message_after --> @@ -21,4 +23,5 @@ </fieldset> </div> </div> +<!-- EVENT quickreply_editor_panel_after --> </form> diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html index 2f15830eb1..618e2680ba 100644 --- a/phpBB/styles/prosilver/template/search_body.html +++ b/phpBB/styles/prosilver/template/search_body.html @@ -2,13 +2,16 @@ <h2 class="solo">{L_SEARCH}</h2> +<!-- EVENT search_body_form_before --> <form method="get" action="{S_SEARCH_ACTION}" data-focus="keywords"> <div class="panel"> <div class="inner"> <h3>{L_SEARCH_QUERY}</h3> + <!-- EVENT search_body_search_query_before --> <fieldset> + <!-- EVENT search_body_search_query_prepend --> <dl> <dt><label for="keywords">{L_SEARCH_KEYWORDS}{L_COLON}</label><br /><span>{L_SEARCH_KEYWORDS_EXPLAIN}</span></dt> <dd><input type="search" class="inputbox" name="keywords" id="keywords" size="40" title="{L_SEARCH_KEYWORDS}" /></dd> @@ -19,7 +22,9 @@ <dt><label for="author">{L_SEARCH_AUTHOR}{L_COLON}</label><br /><span>{L_SEARCH_AUTHOR_EXPLAIN}</span></dt> <dd><input type="search" class="inputbox" name="author" id="author" size="40" title="{L_SEARCH_AUTHOR}" /></dd> </dl> + <!-- EVENT search_body_search_query_append --> </fieldset> + <!-- EVENT search_body_search_query_after --> </div> </div> @@ -29,7 +34,9 @@ <h3>{L_SEARCH_OPTIONS}</h3> + <!-- EVENT search_body_search_options_before --> <fieldset> + <!-- EVENT search_body_search_options_prepend --> <dl> <dt><label for="search_forum">{L_SEARCH_FORUMS}{L_COLON}</label><br /><span>{L_SEARCH_FORUMS_EXPLAIN}</span></dt> <dd><select name="fid[]" id="search_forum" multiple="multiple" size="8" title="{L_SEARCH_FORUMS}">{S_FORUM_OPTIONS}</select></dd> @@ -48,9 +55,11 @@ <dd><label for="sf3"><input type="radio" name="sf" id="sf3" value="titleonly" /> {L_SEARCH_TITLE_ONLY}</label></dd> <dd><label for="sf4"><input type="radio" name="sf" id="sf4" value="firstpost" /> {L_SEARCH_FIRST_POST}</label></dd> </dl> + <!-- EVENT search_body_search_options_append --> <hr class="dashed" /> + <!-- EVENT search_body_search_display_options_prepend --> <dl> <dt><label for="show_results1">{L_DISPLAY_RESULTS}{L_COLON}</label></dt> <dd> @@ -73,7 +82,9 @@ <dt><label>{L_RETURN_FIRST}{L_COLON}</label></dt> <dd><select name="ch" title="{L_RETURN_FIRST}">{S_CHARACTER_OPTIONS}</select> {L_POST_CHARACTERS}</dd> </dl> + <!-- EVENT search_body_search_display_options_append --> </fieldset> + <!-- EVENT search_body_search_options_after --> </div> </div> @@ -90,7 +101,9 @@ </div> </form> +<!-- EVENT search_body_form_after --> +<!-- EVENT search_body_recent_search_before --> <!-- IF .recentsearch --> <div class="forumbg forumbg-table"> <div class="inner"> @@ -118,5 +131,6 @@ </div> </div> <!-- ENDIF --> +<!-- EVENT search_body_recent_search_after --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index 1a83484235..cd8ce66a74 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -1,42 +1,59 @@ <!-- INCLUDE overall_header.html --> -<h2><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --><!-- IF SEARCH_WORDS -->{L_COLON} <a href="{U_SEARCH_WORDS}">{SEARCH_WORDS}</a><!-- ENDIF --></h2> +<!-- EVENT search_results_header_before --> + +<h2 class="searchresults-title"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --><!-- IF SEARCH_WORDS -->{L_COLON} <a href="{U_SEARCH_WORDS}">{SEARCH_WORDS}</a><!-- ENDIF --></h2> <!-- IF SEARCHED_QUERY --> <p>{L_SEARCHED_QUERY}{L_COLON} <strong>{SEARCHED_QUERY}</strong></p><!-- ENDIF --> <!-- IF IGNORED_WORDS --> <p>{L_IGNORED_TERMS}{L_COLON} <strong>{IGNORED_WORDS}</strong></p><!-- ENDIF --> <!-- IF PHRASE_SEARCH_DISABLED --> <p><strong>{L_PHRASE_SEARCH_DISABLED}</strong></p><!-- ENDIF --> <!-- IF SEARCH_TOPIC --> - <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p> + <p class="return-link"> + <a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_RETURN_TO_TOPIC}</span> + </a> + </p> <!-- ELSE --> - <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_RETURN_TO_SEARCH_ADV}</a></p> + <p class="advanced-search-link"> + <a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_GO_TO_SEARCH_ADV}</span> + </a> + </p> <!-- ENDIF --> -<!-- IF .pagination or SEARCH_MATCHES or PAGE_NUMBER --> - <form method="post" action="{S_SEARCH_ACTION}"> - - <div class="topic-actions"> - - <!-- IF SEARCH_MATCHES --> - <div class="search-box"> - <!-- IF SEARCH_IN_RESULTS --> - <label for="add_keywords">{L_SEARCH_IN_RESULTS}{L_COLON} <input type="search" name="add_keywords" id="add_keywords" value="" class="inputbox narrow" /></label> - <input class="button2" type="submit" name="submit" value="{L_SEARCH}" /> - <!-- ENDIF --> +<!-- EVENT search_results_header_after --> + +<!-- IF .pagination or SEARCH_MATCHES or TOTAL_MATCHES or PAGE_NUMBER --> + <div class="action-bar bar-top"> + + <!-- IF TOTAL_MATCHES > 0 --> + <div class="search-box" role="search"> + <form method="post" action="{S_SEARCH_ACTION}"> + <fieldset> + <input class="inputbox search tiny" type="search" name="add_keywords" id="add_keywords" value="" placeholder="{L_SEARCH_IN_RESULTS}" /> + <button class="button button-search" type="submit" title="{L_SEARCH}"> + <i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH}</span> + </button> + <a href="{U_SEARCH}" class="button button-search-end" title="{L_SEARCH_ADV}"> + <i class="icon fa-cog fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH_ADV}</span> + </a> + </fieldset> + </form> </div> <!-- ENDIF --> - <div class="rightside pagination"> + <!-- EVENT search_results_searchbox_after --> + + <div class="pagination"> + <!-- IF U_MARK_ALL_READ --><a href="{U_MARK_ALL_READ}" class="mark-read" accesskey="m">{L_MARK_ALL_READ}</a> •<!-- ENDIF --> {SEARCH_MATCHES} <!-- IF .pagination --> - • <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> </div> </div> - - </form> <!-- ENDIF --> <!-- IF S_SHOW_TOPICS --> @@ -47,7 +64,7 @@ <div class="inner"> <ul class="topiclist"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt><div class="list-inner">{L_TOPICS}</div></dt> <dd class="posts">{L_REPLIES}</dd> <dd class="views">{L_VIEWS}</dd> @@ -58,22 +75,37 @@ <ul class="topiclist topics"> <!-- BEGIN searchresults --> + <!-- EVENT search_results_topic_before --> <li class="row<!-- IF searchresults.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> - <dl class="icon {searchresults.TOPIC_IMG_STYLE}"> + <dl class="row-item {searchresults.TOPIC_IMG_STYLE}"> <dt <!-- IF searchresults.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{searchresults.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{searchresults.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- EVENT topiclist_row_prepend --> <!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT --> - <a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{searchresults.U_NEWEST_POST}" class="topictitle">{searchresults.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> + <a class="unread" href="{searchresults.U_NEWEST_POST}"> + <i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span> + </a> + <!-- ENDIF --> + <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> + + <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --> + <a href="{searchresults.U_MCP_QUEUE}" title="{TOPIC_UNAPPROVED}"> + <i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{TOPIC_UNAPPROVED}</span> + </a> + <!-- ENDIF --> + <!-- IF searchresults.S_TOPIC_DELETED --> + <a href="{searchresults.U_MCP_QUEUE}" title="{TOPIC_DELETED}"> + <i class="icon fa-recycle fa-fw icon-green" aria-hidden="true"></i><span class="sr-only">{TOPIC_DELETED}</span> + </a> <!-- ENDIF --> - {searchresults.ATTACH_ICON_IMG} - <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF searchresults.S_TOPIC_DELETED --><a href="{searchresults.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF --> - <!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> + <!-- IF searchresults.S_TOPIC_REPORTED --> + <a href="{searchresults.U_MCP_REPORT}" title="{TOPIC_REPORTED}"> + <i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{TOPIC_REPORTED}</span> + </a> + <!-- ENDIF --> + <br /> <!-- IF .searchresults.pagination --> <div class="pagination"> <ul> @@ -82,25 +114,37 @@ <!-- ELSEIF searchresults.pagination.S_IS_CURRENT --><li class="active"><span>{searchresults.pagination.PAGE_NUMBER}</span></li> <!-- ELSEIF searchresults.pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> <!-- ELSEIF searchresults.pagination.S_IS_NEXT --> - <!-- ELSE --><li><a href="{searchresults.pagination.PAGE_URL}">{searchresults.pagination.PAGE_NUMBER}</a></li> + <!-- ELSE --><li><a class="button" href="{searchresults.pagination.PAGE_URL}">{searchresults.pagination.PAGE_NUMBER}</a></li> <!-- ENDIF --> <!-- END pagination --> </ul> </div> <!-- ENDIF --> - {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » <!-- IF not S_IS_BOT --><a href="{searchresults.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{searchresults.FIRST_POST_TIME}</a><!-- ELSE -->{searchresults.FIRST_POST_TIME}<!-- ENDIF --> » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> + <!-- IF searchresults.S_HAS_POLL --><i class="icon fa-bar-chart fa-fw" aria-hidden="true"></i> <!-- ENDIF --> + <!-- IF searchresults.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i><!-- ENDIF --> + {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> <!-- EVENT topiclist_row_append --> </div> </dt> <dd class="posts">{searchresults.TOPIC_REPLIES}</dd> <dd class="views">{searchresults.TOPIC_VIEWS}</dd> - <dd class="lastpost"><span> - {L_POST_BY_AUTHOR} {searchresults.LAST_POST_AUTHOR_FULL} - <!-- IF not S_IS_BOT --><a href="{searchresults.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{searchresults.LAST_POST_TIME}<br /> </span> + <dd class="lastpost"> + <span> + {L_POST_BY_AUTHOR} {searchresults.LAST_POST_AUTHOR_FULL} + <!-- IF not S_IS_BOT --> + <a href="{searchresults.U_LAST_POST}" title="{L_GOTO_LAST_POST}"> + <i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span> + </a> + <!-- ENDIF --> + <br /> + {searchresults.LAST_POST_TIME} + <br /> + </span> </dd> </dl> </li> + <!-- EVENT search_results_topic_after --> <!-- END searchresults --> </ul> @@ -117,6 +161,7 @@ <!-- ELSE --> <!-- BEGIN searchresults --> + <!-- EVENT search_results_post_before --> <div class="search post <!-- IF searchresults.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF searchresults.S_POST_REPORTED --> reported<!-- ENDIF -->"> <div class="inner"> @@ -126,12 +171,14 @@ </div> <!-- ELSE --> <dl class="postprofile"> + <!-- EVENT search_results_postprofile_before --> <dt class="author">{L_POST_BY_AUTHOR} {searchresults.POST_AUTHOR_FULL}</dt> <dd class="search-result-date">{searchresults.POST_DATE}</dd> <dd>{L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></dd> <dd>{L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a></dd> <dd>{L_REPLIES}{L_COLON} <strong>{searchresults.TOPIC_REPLIES}</strong></dd> <dd>{L_VIEWS}{L_COLON} <strong>{searchresults.TOPIC_VIEWS}</strong></dd> + <!-- EVENT search_results_postprofile_after --> </dl> <div class="postbody"> @@ -142,12 +189,17 @@ <!-- IF not searchresults.S_IGNORE_POST --> <ul class="searchresults"> - <li ><a href="{searchresults.U_VIEW_POST}" class="arrow-{S_CONTENT_FLOW_END}">{L_JUMP_TO_POST}</a></li> + <li> + <a href="{searchresults.U_VIEW_POST}" class="arrow-{S_CONTENT_FLOW_END}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_END} fa-fw icon-black" aria-hidden="true"></i><span>{L_JUMP_TO_POST}</span> + </a> + </li> </ul> <!-- ENDIF --> </div> </div> + <!-- EVENT search_results_post_after --> <!-- BEGINELSE --> <div class="panel"> <div class="inner"> @@ -157,37 +209,22 @@ <!-- END searchresults --> <!-- ENDIF --> -<!-- IF .pagination or .searchresults or S_SELECT_SORT_KEY or S_SELECT_SORT_DAYS --> +<div class="action-bar bottom"> + <!-- IF .searchresults and (S_SELECT_SORT_DAYS or S_SELECT_SORT_KEY) --> <form method="post" action="{S_SEARCH_ACTION}"> - - <fieldset class="display-options"> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF S_SELECT_SORT_DAYS or S_SELECT_SORT_KEY --> - <label><!-- IF S_SHOW_TOPICS -->{L_DISPLAY_POSTS}<!-- ELSE -->{L_SORT_BY}</label><label><!-- ENDIF --> {S_SELECT_SORT_DAYS}<!-- IF S_SELECT_SORT_KEY --></label> <label>{S_SELECT_SORT_KEY}</label> - <label>{S_SELECT_SORT_DIR}<!-- ENDIF --></label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - <!-- ENDIF --> - </fieldset> - + <!-- INCLUDE display_options.html --> </form> + <!-- ENDIF --> - <hr /> -<!-- ENDIF --> - -<!-- IF .pagination or .searchresults or PAGE_NUMBER --> - <ul class="linklist"> - <li class="rightside pagination"> - {SEARCH_MATCHES} - <!-- IF .pagination --> - • - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </li> - </ul> -<!-- ENDIF --> + <div class="pagination"> + {SEARCH_MATCHES} + <!-- IF .pagination --> + <!-- INCLUDE pagination.html --> + <!-- ELSE --> + • {PAGE_NUMBER} + <!-- ENDIF --> + </div> +</div> <!-- INCLUDE jumpbox.html --> diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html index 10edece3cd..614c137835 100644 --- a/phpBB/styles/prosilver/template/simple_footer.html +++ b/phpBB/styles/prosilver/template/simple_footer.html @@ -1,14 +1,34 @@ </div> - <div class="copyright">{CREDIT_LINE} + <div class="copyright" role="contentinfo">{CREDIT_LINE} <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF --> </div> + + <div id="darkenwrapper" class="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}"> + <div id="darken" class="darken"> </div> + </div> + <div id="loading_indicator" class="loading_indicator"></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"> + <i class="icon fa-times-circle fa-fw" aria-hidden="true"></i> + </a> + <h3 class="alert_title"></h3><p class="alert_text"></p> + </div> + <div id="phpbb_confirm" class="phpbb_confirm phpbb_alert"> + <a href="#" class="alert_close"> + <i class="icon fa-times-circle fa-fw" aria-hidden="true"></i> + </a> + <div class="alert_text"></div> + </div> </div> <script type="text/javascript" src="{T_JQUERY_LINK}"></script> -<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> +<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write('\x3Cscript src="{T_ASSETS_PATH}/javascript/jquery.min.js?assets_version={T_ASSETS_VERSION}">\x3C/script>');</script><!-- ENDIF --> +<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> <!-- INCLUDEJS forum_fn.js --> +<!-- INCLUDEJS ajax.js --> <!-- EVENT simple_footer_after --> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 53c86689e0..954eebd011 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -1,33 +1,53 @@ <!DOCTYPE html> <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> -<meta charset="utf-8"> -<meta name="viewport" content="width=device-width" /> -<meta name="keywords" content="" /> -<meta name="description" content="" /> +<meta charset="utf-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> {META} <title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title> -<link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" /> -<!-- IF S_ALLOW_CDN --><link href="//fonts.googleapis.com/css?family=Open+Sans:600&subset=latin,cyrillic-ext,latin-ext,cyrillic,greek-ext,greek,vietnamese" rel="stylesheet" type="text/css" media="screen, projection" /><!-- ENDIF --> -<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" /> -<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" /> -<link href="{T_THEME_PATH}/responsive.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="only screen and (max-width: 700px), only screen and (max-device-width: 700px)" /> +<!-- IF S_ALLOW_CDN --> +<script> + WebFontConfig = { + google: { + families: ['Open+Sans:600:cyrillic-ext,latin,greek-ext,greek,vietnamese,latin-ext,cyrillic'] + } + }; + + (function(d) { + var wf = d.createElement('script'), s = d.scripts[0]; + wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js'; + wf.async = true; + s.parentNode.insertBefore(wf, s); + })(document); +</script> +<!-- ENDIF --> +<link href="{T_FONT_AWESOME_LINK}" rel="stylesheet"> +<link href="{T_STYLESHEET_LINK}" rel="stylesheet"> +<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet"> <!-- IF S_CONTENT_DIRECTION eq 'rtl' --> - <link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" /> + <link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet"> <!-- ENDIF --> <!--[if lte IE 8]> - <link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" /> + <link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet"> <![endif]--> <!-- DEFINE $POPUP = 1 --> +<!-- EVENT simple_header_head_append --> + +{$STYLESHEETS} + +<!-- EVENT simple_header_stylesheets_after --> + </head> -<body id="phpbb" class="nojs {S_CONTENT_DIRECTION}"> +<body id="phpbb" class="nojs {S_CONTENT_DIRECTION} {BODY_CLASS}"> + +<!-- EVENT simple_header_body_before --> -<div id="simple-wrap"> - <a id="top" accesskey="t"></a> - <div id="page-body"> +<div id="wrap" class="wrap"> + <a id="top" class="top-anchor" accesskey="t"></a> + <div id="page-body" class="page-body" role="main"> diff --git a/phpBB/styles/prosilver/template/timezone.js b/phpBB/styles/prosilver/template/timezone.js index e0d3da9ff7..44ec1b0979 100644 --- a/phpBB/styles/prosilver/template/timezone.js +++ b/phpBB/styles/prosilver/template/timezone.js @@ -1,6 +1,8 @@ +/* global phpbb */ + (function($) { // Avoid conflicts with other libraries -"use strict"; +'use strict'; $('#tz_date').change(function() { phpbb.timezoneSwitchDate(false); @@ -10,12 +12,9 @@ $('#tz_select_date_suggest').click(function(){ phpbb.timezonePreselectSelect(true); }); -$(document).ready( - phpbb.timezoneEnableDateSelection -); - -$(document).ready( - phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('timezone-preselect') === 'true') -); +$(function () { + phpbb.timezoneEnableDateSelection(); + phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('timezone-preselect') === 'true'); +}); })(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/prosilver/template/timezone_option.html b/phpBB/styles/prosilver/template/timezone_option.html index fc0579bffd..728dc9487a 100644 --- a/phpBB/styles/prosilver/template/timezone_option.html +++ b/phpBB/styles/prosilver/template/timezone_option.html @@ -1,18 +1,26 @@ <dl> <dt><label for="timezone">{L_BOARD_TIMEZONE}{L_COLON}</label></dt> - <!-- IF S_TZ_DATE_OPTIONS --> + <!-- IF .timezone_date --> <dd id="tz_select_date" style="display: none;"> <select name="tz_date" id="tz_date" class="autowidth tz_select"> <option value="">{L_SELECT_CURRENT_TIME}</option> - {S_TZ_DATE_OPTIONS} + <!-- BEGIN timezone_date --> + <option value="{timezone_date.VALUE}"<!-- IF timezone_date.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_date.TITLE}</option> + <!-- END timezone_date --> </select> <input type="button" id="tz_select_date_suggest" class="button2" style="display: none;" timezone-preselect="<!-- IF S_TZ_PRESELECT -->true<!-- ELSE -->false<!-- ENDIF -->" data-l-suggestion="{L_TIMEZONE_DATE_SUGGESTION}" value="{L_TIMEZONE_DATE_SUGGESTION}" /> </dd> <!-- ENDIF --> <dd> - <select name="tz" id="timezone" class="autowidth tz_select"> + <select name="tz" id="timezone" class="autowidth tz_select timezone"> <option value="">{L_SELECT_TIMEZONE}</option> - {S_TZ_OPTIONS} + <!-- BEGIN timezone_select --> + <optgroup label="{timezone_select.LABEL}" data-tz-value="{timezone_select.VALUE}"> + <!-- BEGIN timezone_options --> + <option title="{timezone_select.timezone_options.TITLE}" value="{timezone_select.timezone_options.VALUE}"<!-- IF timezone_select.timezone_options.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_select.timezone_options.LABEL}</option> + <!-- END timezone_options --> + </optgroup> + <!-- END timezone_select --> </select> <!-- INCLUDEJS timezone.js --> diff --git a/phpBB/styles/prosilver/template/ucp_agreement.html b/phpBB/styles/prosilver/template/ucp_agreement.html index 6c96be864a..943774c6ec 100644 --- a/phpBB/styles/prosilver/template/ucp_agreement.html +++ b/phpBB/styles/prosilver/template/ucp_agreement.html @@ -10,6 +10,7 @@ */ function change_language(lang_iso) { + document.cookie = '{COOKIE_NAME}_lang=' + lang_iso + '; path={COOKIE_PATH}'; document.forms['register'].change_lang.value = lang_iso; document.forms['register'].submit(); } @@ -33,8 +34,10 @@ <div class="panel"> <div class="inner"> <div class="content"> - <h2>{SITENAME} - {L_REGISTRATION}</h2> + <h2 class="sitename-title">{SITENAME} - {L_REGISTRATION}</h2> + <!-- EVENT ucp_agreement_terms_before --> <p><!-- IF S_SHOW_COPPA -->{L_COPPA_BIRTHDAY}<!-- ELSE -->{L_TERMS_OF_USE}<!-- ENDIF --></p> + <!-- EVENT ucp_agreement_terms_after --> </div> </div> </div> @@ -60,7 +63,7 @@ <div class="panel"> <div class="inner"> <div class="content"> - <h2>{SITENAME} - {AGREEMENT_TITLE}</h2> + <h2 class="sitename-title">{SITENAME} - {AGREEMENT_TITLE}</h2> <p>{AGREEMENT_TEXT}</p> <hr class="dashed" /> <p><a href="{U_BACK}" class="button2">{L_BACK}</a></p> diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html index ed39e80c12..9de08f17b9 100644 --- a/phpBB/styles/prosilver/template/ucp_attachments.html +++ b/phpBB/styles/prosilver/template/ucp_attachments.html @@ -10,16 +10,16 @@ <p>{L_ATTACHMENTS_EXPLAIN}</p> <!-- IF .attachrow --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_ATTACHMENTS -->{TOTAL_ATTACHMENTS} {L_TITLE} • <!-- ENDIF --> + <div class="action-bar top"> + <div class="pagination"> + {NUM_ATTACHMENTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> <ul class="topiclist"> <li class="header"> @@ -38,7 +38,7 @@ <dl> <dt> <div class="list-inner"> - <a href="{attachrow.U_VIEW_ATTACHMENT}" class="topictitle">{attachrow.FILENAME}</a> ({attachrow.SIZE})<br /> + <a href="{attachrow.U_VIEW_ATTACHMENT}" class="topictitle attachment-filename ellipsis-text" title="{attachrow.FILENAME}">{attachrow.FILENAME}</a> ({attachrow.SIZE})<br /> <!-- IF attachrow.S_IN_MESSAGE -->{L_PM}{L_COLON} <!-- ELSE -->{L_TOPIC}{L_COLON} <!-- ENDIF --><a href="{attachrow.U_VIEW_TOPIC}">{attachrow.TOPIC_TITLE}</a> </div> </dt> @@ -50,27 +50,20 @@ <!-- END attachrow --> </ul> - <fieldset class="display-options"> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <label for="sk">{L_SORT_BY}{L_COLON} <select name="sk" id="sk">{S_SORT_OPTIONS}</select></label> - <label><select name="sd" id="sd">{S_ORDER_SELECT}</select></label> - <input class="button2" type="submit" name="sort" value="{L_SORT}" /> + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> {S_FORM_TOKEN} - </fieldset> - <hr /> - - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_ATTACHMENTS -->{TOTAL_ATTACHMENTS} {L_TITLE} • <!-- ENDIF --> + <div class="pagination"> + {TOTAL_ATTACHMENTS} {L_TITLE} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + <!-- ELSE --> <p><strong>{L_UCP_NO_ATTACHMENTS}</strong></p> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html index 072f235eb1..2cf9488ed0 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html @@ -16,10 +16,9 @@ <fieldset> <dl> <dt><label>{L_AVATAR_TYPE}{L_COLON}</label></dt> - <dd><select name="avatar_driver" id="avatar_driver"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> + <dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true"> <!-- BEGIN avatar_drivers --> - <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_drivers.L_TITLE}</option> + <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF --> data-toggle-setting="#avatar_option_{avatar_drivers.DRIVER}">{avatar_drivers.L_TITLE}</option> <!-- END avatar_drivers --> </select></dd> </dl> @@ -46,5 +45,3 @@ <!-- ENDIF --> </div> </div> - -<!-- INCLUDEJS avatars.js --> diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options_local.html b/phpBB/styles/prosilver/template/ucp_avatar_options_local.html index 3946b9d269..e431b7425e 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options_local.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options_local.html @@ -1,17 +1,17 @@ <!-- IF .avatar_local_cats --> <label for="category">{L_AVATAR_CATEGORY}{L_COLON} <select name="avatar_local_cat" id="category"> -<option value="">{L_NO_AVATAR_CATEGORY}</option> <!-- BEGIN avatar_local_cats --> <option value="{avatar_local_cats.NAME}"<!-- IF avatar_local_cats.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_local_cats.NAME}</option> <!-- END avatar_local_cats --> </select></label> <input type="submit" value="{L_GO}" name="avatar_local_go" class="button2" /> -<div id="gallery"> +<div id="gallery" class="gallery"> <!-- BEGIN avatar_local_row --> <!-- BEGIN avatar_local_col --> <label for="av-{avatar_local_row.S_ROW_COUNT}-{avatar_local_row.avatar_local_col.S_ROW_COUNT}"><img src="{avatar_local_row.avatar_local_col.AVATAR_IMAGE}" alt="" /><br /> - <input type="radio" name="avatar_local_file" id="av-{avatar_local_row.S_ROW_COUNT}-{avatar_local_row.avatar_local_col.S_ROW_COUNT}" value="{avatar_local_row.avatar_local_col.AVATAR_FILE}" /></label> + <input type="radio" name="avatar_local_file" id="av-{avatar_local_row.S_ROW_COUNT}-{avatar_local_row.avatar_local_col.S_ROW_COUNT}" + value="{avatar_local_row.avatar_local_col.AVATAR_FILE}"<!-- IF avatar_local_row.avatar_local_col.CHECKED --> checked="checked"<!-- ENDIF --> /></label> <!-- END avatar_local_col --> <!-- END avatar_local_row --> </div> diff --git a/phpBB/styles/prosilver/template/ucp_footer.html b/phpBB/styles/prosilver/template/ucp_footer.html index ea546f7a82..f2f1a68db3 100644 --- a/phpBB/styles/prosilver/template/ucp_footer.html +++ b/phpBB/styles/prosilver/template/ucp_footer.html @@ -1,9 +1,8 @@ </div> - <div class="clear"></div> </div> - <span class="corners-bottom"><span></span></span></div> + </div> </div> <!-- IF S_COMPOSE_PM --> <div>{S_FORM_TOKEN}</div> diff --git a/phpBB/styles/prosilver/template/ucp_groups_manage.html b/phpBB/styles/prosilver/template/ucp_groups_manage.html index df80135acb..223493ff38 100644 --- a/phpBB/styles/prosilver/template/ucp_groups_manage.html +++ b/phpBB/styles/prosilver/template/ucp_groups_manage.html @@ -58,7 +58,7 @@ <input name="group_colour" type="text" id="group_colour" value="{GROUP_COLOUR}" size="6" maxlength="6" class="inputbox narrow" /> <span style="background-color: #{GROUP_COLOUR};"> </span> [ <a href="#" id="color_palette_toggle">{L_COLOUR_SWATCH}</a> ] - <div id="color_palette_placeholder" class="hidden" data-orientation="h" data-height="12" data-width="15" data-target="#group_colour"></div> + <div id="color_palette_placeholder" class="color_palette_placeholder hidden" data-orientation="h" data-height="12" data-width="15" data-target="#group_colour"></div> </dd> </dl> <dl> @@ -159,15 +159,13 @@ </tbody> </table> - <ul class="linklist"> - <li class="leftside pagination"> - <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </li> - </ul> + <!-- IF .pagination --> + <div class="action-bar bar-bottom"> + <div class="pagination"> + <!-- INCLUDE pagination.html --> + </div> + </div> + <!-- ENDIF --> </div> </div> diff --git a/phpBB/styles/prosilver/template/ucp_header.html b/phpBB/styles/prosilver/template/ucp_header.html index 8ce2c54294..98d2eee1a0 100644 --- a/phpBB/styles/prosilver/template/ucp_header.html +++ b/phpBB/styles/prosilver/template/ucp_header.html @@ -1,11 +1,11 @@ <!-- INCLUDE overall_header.html --> -<h2>{L_UCP}</h2> +<h2 class="ucp-title">{L_UCP}</h2> -<div id="tabs"> +<div id="tabs" class="tabs"> <ul> <!-- BEGIN t_block1 --> - <li <!-- IF t_block1.S_SELECTED -->class="activetab"<!-- ENDIF -->><a href="{t_block1.U_TITLE}"><span>{t_block1.L_TITLE}</span></a></li> + <li class="tab<!-- IF t_block1.S_SELECTED --> activetab<!-- ENDIF -->"><a href="{t_block1.U_TITLE}">{t_block1.L_TITLE}</a></li> <!-- END t_block1 --> </ul> </div> @@ -19,15 +19,15 @@ <div style="width: 100%;"> - <div id="cp-menu"> - <div id="navigation"> + <div id="cp-menu" class="cp-menu"> + <div id="navigation" class="navigation" role="navigation"> <!-- IF S_PRIVMSGS --> <!-- BEGIN t_block2 --> <!-- IF S_PRIVMSGS and not t_block2.S_LAST_ROW --> <ul> <!-- IF t_block2.S_SELECTED --> - <li id="active-subsection"><a href="{t_block2.U_TITLE}"><span>{t_block2.L_TITLE}</span></a></li> + <li id="active-subsection" class="active-subsection"><a href="{t_block2.U_TITLE}"><span>{t_block2.L_TITLE}</span></a></li> <!-- ELSE --> <li><a href="{t_block2.U_TITLE}"><span>{t_block2.L_TITLE}</span></a></li> <!-- ENDIF --> @@ -39,7 +39,7 @@ <!-- BEGIN folder --> <!-- IF folder.S_FIRST_ROW --><ul><!-- ENDIF --> <!-- IF folder.S_CUR_FOLDER --> - <li id="active-subsection"><a href="{folder.U_FOLDER}"><!-- IF folder.UNREAD_MESSAGES > 0 --><strong>{folder.FOLDER_NAME} ({folder.UNREAD_MESSAGES})</strong><!-- ELSE -->{folder.FOLDER_NAME}<!-- ENDIF --></a></li> + <li id="active-subsection" class="active-subsection"><a href="{folder.U_FOLDER}"><!-- IF folder.UNREAD_MESSAGES > 0 --><strong>{folder.FOLDER_NAME} ({folder.UNREAD_MESSAGES})</strong><!-- ELSE -->{folder.FOLDER_NAME}<!-- ENDIF --></a></li> <!-- ELSE --> <li><a href="{folder.U_FOLDER}"><span><!-- IF folder.UNREAD_MESSAGES > 0 --><strong>{folder.FOLDER_NAME} ({folder.UNREAD_MESSAGES})</strong><!-- ELSE -->{folder.FOLDER_NAME}<!-- ENDIF --></span></a></li> <!-- ENDIF --> @@ -52,7 +52,7 @@ <!-- BEGIN t_block2 --> <!-- IF (S_PRIVMSGS and t_block2.S_LAST_ROW) or not S_PRIVMSGS --> <!-- IF t_block2.S_SELECTED --> - <li id="active-subsection"><a href="{t_block2.U_TITLE}"><span>{t_block2.L_TITLE}</span></a></li> + <li id="active-subsection" class="active-subsection"><a href="{t_block2.U_TITLE}"><span>{t_block2.L_TITLE}</span></a></li> <!-- ELSE --> <li><a href="{t_block2.U_TITLE}"><span>{t_block2.L_TITLE}</span></a></li> <!-- ENDIF --> @@ -98,4 +98,4 @@ </div> - <div id="cp-main" class="ucp-main panel-container"> + <div id="cp-main" class="cp-main ucp-main panel-container"> diff --git a/phpBB/styles/prosilver/template/ucp_login_link.html b/phpBB/styles/prosilver/template/ucp_login_link.html index d3c6931ce3..be173318cb 100644 --- a/phpBB/styles/prosilver/template/ucp_login_link.html +++ b/phpBB/styles/prosilver/template/ucp_login_link.html @@ -36,7 +36,7 @@ </dl> <dl> <dt><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></dt> - <dd><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></dd> + <dd><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" autocomplete="off" /></dd> </dl> <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE --> <!-- DEFINE $CAPTCHA_TAB_INDEX = 4 --> diff --git a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html index 96becc42e7..71e54c12eb 100644 --- a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html +++ b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html @@ -16,7 +16,7 @@ <!-- IF .topicrow --> <ul class="topiclist missing-column"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt><div class="list-inner">{L_BOOKMARKS}</div></dt> <dd class="lastpost"><span>{L_LAST_POST}</span></dd> <dd class="mark">{L_MARK}</dd> @@ -34,17 +34,25 @@ <dd class="mark"><input type="checkbox" name="t[{topicrow.TOPIC_ID}]" id="t{topicrow.TOPIC_ID}" /></dd> </dl> <!-- ELSE --> - <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> + <dl class="row-item {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- IF topicrow.S_UNREAD_TOPIC --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <a class="unread" href="{topicrow.U_NEWEST_POST}"> + <i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span> + </a> + <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> + <a href="{topicrow.U_MCP_QUEUE}" title="{TOPIC_UNAPPROVED}"> + <i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{TOPIC_UNAPPROVED}</span> + </a> + <!-- ENDIF --> + <!-- IF topicrow.S_TOPIC_REPORTED --> + <a href="{topicrow.U_MCP_REPORT}" title="{TOPIC_REPORTED}"> + <i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{TOPIC_REPORTED}</span> + </a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> <br /> <!-- IF .topicrow.pagination --> <div class="pagination"> @@ -61,18 +69,21 @@ </div> <!-- ENDIF --> <div class="responsive-hide"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} </div> <div class="responsive-show" style="display: none;"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> </div> </div> </dt> <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}"> + <i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span> + </a> + <br />{topicrow.LAST_POST_TIME}</span> </dd> <dd class="mark"><input type="checkbox" name="t[{topicrow.TOPIC_ID}]" id="t{topicrow.TOPIC_ID}" /></dd> </dl> @@ -80,16 +91,18 @@ </li> <!-- END topicrow --> </ul> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> + + <div class="action-bar bar-bottom"> + <div class="pagination"> + {TOTAL_TOPICS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + <!-- ELSE --> <p><strong>{L_NO_BOOKMARKS}</strong></p> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index eca224f2d9..aaeb55729f 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -13,16 +13,16 @@ <ul class="topiclist cplist two-long-columns"> <!-- BEGIN topicrow --> <li class="row<!-- IF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> - <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> + <dl class="row-item {topicrow.TOPIC_IMG_STYLE}"> <dt <!-- IF topicrow.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF -->> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- IF topicrow.S_UNREAD --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <a class="unread" href="{topicrow.U_NEWEST_POST}"> + <i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span> + </a> <!-- ENDIF --> - <br /> + <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a><br /> <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -38,17 +38,22 @@ </div> <!-- ENDIF --> <div class="responsive-hide"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} </div> <div class="responsive-show" style="display: none;"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> </div> </div> </dt> - <dd class="lastpost"><span>{L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> + <dd class="lastpost"> + <span>{L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}"> + <i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span> + </a> + <br />{topicrow.LAST_POST_TIME} + </span> </dd> </dl> </li> @@ -58,14 +63,16 @@ <h3>{L_YOUR_DETAILS}</h3> +<!-- EVENT ucp_main_front_user_activity_before --> <dl class="details"> <dt>{L_JOINED}{L_COLON}</dt> <dd>{JOINED}</dd> - <dt>{L_VISITED}{L_COLON}</dt> <dd>{LAST_VISIT_YOU}</dd> + <dt>{L_LAST_ACTIVE}{L_COLON}</dt> <dd>{LAST_VISIT_YOU}</dd> <dt>{L_TOTAL_POSTS}{L_COLON}</dt> <dd><!-- IF POSTS_PCT -->{POSTS}<!-- IF S_DISPLAY_SEARCH --> | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_YOUR_POSTS}</a></strong><!-- ENDIF --><br />({POSTS_DAY} / {POSTS_PCT})<!-- ELSE -->{POSTS}<!-- ENDIF --></dd> <!-- IF ACTIVE_FORUM != '' --><dt>{L_ACTIVE_IN_FORUM}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></strong><br />({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})</dd><!-- ENDIF --> <!-- IF ACTIVE_TOPIC != '' --><dt>{L_ACTIVE_IN_TOPIC}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></strong><br />({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})</dd><!-- ENDIF --> - <!-- IF WARNINGS --><dt>{L_YOUR_WARNINGS}{L_COLON}</dt> <dd class="error">{WARNING_IMG} [{WARNINGS}]</dd><!-- ENDIF --> + <!-- IF WARNINGS --><dt>{L_YOUR_WARNINGS}{L_COLON}</dt> <dd class="error"><i class="icon fa-exclamation-triangle fa-fw icon-red" aria-hidden="true"></i> [{WARNINGS}]</dd><!-- ENDIF --> </dl> +<!-- EVENT ucp_main_front_user_activity_after --> </div> </div> diff --git a/phpBB/styles/prosilver/template/ucp_main_subscribed.html b/phpBB/styles/prosilver/template/ucp_main_subscribed.html index 0187f3cc3f..6cf23bdf31 100755..100644 --- a/phpBB/styles/prosilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/prosilver/template/ucp_main_subscribed.html @@ -11,7 +11,7 @@ <!-- IF .forumrow --> <ul class="topiclist missing-column"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt><div class="list-inner">{L_WATCHED_FORUMS}</div></dt> <dd class="lastpost"><span>{L_LAST_POST}</span></dd> <dd class="mark">{L_MARK}</dd> @@ -22,8 +22,9 @@ <!-- BEGIN forumrow --> <li class="row<!-- IF forumrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> - <dl class="icon {forumrow.FORUM_IMG_STYLE}"> + <dl class="row-item {forumrow.FORUM_IMG_STYLE}"> <dt> + <!-- IF forumrow.S_UNREAD_FORUM --><a href="{forumrow.U_VIEWFORUM}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a><br /> {forumrow.FORUM_DESC} @@ -34,9 +35,16 @@ <!-- ENDIF --> </div> </dt> - <dd class="lastpost"><!-- IF forumrow.LAST_POST_TIME --><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {forumrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{forumrow.LAST_POST_TIME}</span> - <!-- ELSE -->{L_NO_POSTS}<br /> <!-- ENDIF --> + <dd class="lastpost"> + <!-- IF forumrow.LAST_POST_TIME --> + <span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {forumrow.LAST_POST_AUTHOR_FULL} + <a href="{forumrow.U_LAST_POST}"> + <i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span> + </a> + <br />{forumrow.LAST_POST_TIME}</span> + <!-- ELSE --> + {L_NO_POSTS}<br /> + <!-- ENDIF --> </dd> <dd class="mark"><input type="checkbox" name="f[{forumrow.FORUM_ID}]" id="f{forumrow.FORUM_ID}" /></dd> </dl> @@ -46,7 +54,7 @@ <!-- ELSEIF S_FORUM_NOTIFY --> <ul class="topiclist"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt>{L_WATCHED_FORUMS}</dt> </dl> </li> @@ -58,7 +66,7 @@ <!-- IF .topicrow --> <ul class="topiclist missing-column"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt><div class="list-inner">{L_WATCHED_TOPICS}</div></dt> <dd class="lastpost"><span>{L_LAST_POST}</span></dd> <dd class="mark">{L_MARK}</dd> @@ -69,17 +77,25 @@ <!-- BEGIN topicrow --> <li class="row<!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ELSEIF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> - <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> + <dl class="row-item {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- IF topicrow.S_UNREAD_TOPIC --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <a class="unread" href="{topicrow.U_NEWEST_POST}"> + <i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span> + </a> + <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> + <a href="{topicrow.U_MCP_QUEUE}" title="{TOPIC_UNAPPROVED}"> + <i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{TOPIC_UNAPPROVED}</span> + </a> + <!-- ENDIF --> + <!-- IF topicrow.S_TOPIC_REPORTED --> + <a href="{topicrow.U_MCP_REPORT}" title="{TOPIC_REPORTED}"> + <i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{TOPIC_REPORTED}</span> + </a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> <br /> <!-- IF .topicrow.pagination --> <div class="pagination"> @@ -96,37 +112,42 @@ </div> <!-- ENDIF --> <div class="responsive-hide"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} </div> <div class="responsive-show" style="display: none;"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --> {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> </div> </div> </dt> <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <br />{topicrow.LAST_POST_TIME}</span> + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}"> + <i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span> + </a> + <br />{topicrow.LAST_POST_TIME}</span> </dd> <dd class="mark"><input type="checkbox" name="t[{topicrow.TOPIC_ID}]" id="t{topicrow.TOPIC_ID}" /></dd> </dl> </li> <!-- END topicrow --> </ul> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> - <!-- IF .pagination --> + + <div class="action-bar bar-bottom"> + <div class="pagination"> + {TOTAL_TOPICS} + <!-- IF .pagination --> <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} + <!-- ELSE --> + • {PAGE_NUMBER} <!-- ENDIF --> - </li> - </ul> + </div> + </div> + <!-- ELSEIF S_TOPIC_NOTIFY --> <ul class="topiclist"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt>{L_WATCHED_TOPICS}</dt> </dl> </li> diff --git a/phpBB/styles/prosilver/template/ucp_notifications.html b/phpBB/styles/prosilver/template/ucp_notifications.html index 6a711cfd30..a7eb7fc8fb 100644 --- a/phpBB/styles/prosilver/template/ucp_notifications.html +++ b/phpBB/styles/prosilver/template/ucp_notifications.html @@ -11,11 +11,12 @@ <!-- IF MODE == 'notification_options' --> <table class="table1"> <thead> - <th>{L_NOTIFICATION_TYPE}</th> - <!-- BEGIN notification_methods --> - <th class="mark">{notification_methods.NAME}</th> - <!-- END notification_methods --> - <th class="mark">{L_NOTIFICATIONS}</th> + <tr> + <th>{L_NOTIFICATION_TYPE}</th> + <!-- BEGIN notification_methods --> + <th class="mark">{notification_methods.NAME}</th> + <!-- END notification_methods --> + </tr> </thead> <tbody> <!-- BEGIN notification_types --> @@ -32,7 +33,6 @@ <!-- BEGIN notification_methods --> <td class="mark"><input type="checkbox" name="{notification_types.TYPE}_{notification_methods.METHOD}"<!-- IF notification_methods.SUBSCRIBED --> checked="checked"<!-- ENDIF --> /></td> <!-- END notification_methods --> - <td class="mark"><input type="checkbox" name="{notification_types.TYPE}_notification"<!-- IF notification_types.SUBSCRIBED --> checked="checked"<!-- ENDIF --> /></td> </tr> <!-- ENDIF --> <!-- END notification_types --> @@ -40,19 +40,17 @@ </table> <!-- ELSE --> <!-- IF .notification_list --> - <!-- IF .pagination or TOTAL_COUNT --> - <div class="topic-actions"> + <div class="action-bar bar-top"> <div class="pagination"> - <!-- IF U_MARK_ALL --><a href="{U_MARK_ALL}">{L_NOTIFICATIONS_MARK_ALL_READ}</a> • <!-- ENDIF --> - <!-- IF TOTAL_COUNT -->{L_NOTIFICATIONS} [<strong>{TOTAL_COUNT}</strong>] • <!-- ENDIF --> + <!-- IF U_MARK_ALL --><a href="{U_MARK_ALL}" class="mark">{L_NOTIFICATIONS_MARK_ALL_READ}</a> • <!-- ENDIF --> + {L_NOTIFICATIONS} [<strong>{TOTAL_COUNT}</strong>] <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> </div> </div> - <!-- ENDIF --> <div class="notification_list"> <ul class="topiclist two-columns"> @@ -65,19 +63,18 @@ </ul> <ul class="topiclist cplist two-columns"> <!-- BEGIN notification_list --> - <li class="row<!-- IF notification_list.UNREAD --> bg3<!-- ELSE --><!-- IF notification_list.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- ENDIF -->"> + <li class="row<!-- IF notification_list.UNREAD --> bg3<!-- ELSE --><!-- IF notification_list.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- ENDIF --><!-- IF notification_list.STYLING --> {notification_list.STYLING}<!-- ENDIF -->"> <dl> <dt> <div class="list-inner"> <!-- IF notification_list.AVATAR -->{notification_list.AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --> <div class="notifications"> <!-- IF notification_list.URL --><a href="<!-- IF notification_list.UNREAD -->{notification_list.U_MARK_READ}<!-- ELSE -->{notification_list.URL}<!-- ENDIF -->"><!-- ENDIF --> - <p class="notifications_title">{notification_list.FORMATTED_TITLE}</p> - <!-- IF notification_list.URL --></a><!-- ENDIF --> + <p class="notifications_title">{notification_list.FORMATTED_TITLE}<!-- IF notification_list.REFERENCE --> {notification_list.REFERENCE}<!-- ENDIF --></p> + <!-- IF notification_list.URL --></a><!-- ENDIF --> + <!-- IF notification_list.FORUM --><p class="notifications_forum">{notification_list.FORUM}</p><!-- ENDIF --> + <!-- IF notification_list.REASON --><p class="notifications_reason">{notification_list.REASON}</p><!-- ENDIF --> <p class="notifications_time">{notification_list.TIME}</p> - <!-- IF not notification_list.URL and notification_list.U_MARK_READ --> - <p><a href="{notification_list.U_MARK_READ}">{L_MARK_READ}</a></p> - <!-- ENDIF --> </div> </div> </dt> @@ -89,18 +86,16 @@ </ul> </div> - <!-- IF .pagination or TOTAL_COUNT --> - <div class="topic-actions"> - <div class="pagination"> - <!-- IF TOTAL_COUNT -->{L_NOTIFICATIONS} [<strong>{TOTAL_COUNT}</strong>] • <!-- ENDIF --> - <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </div> + <div class="action-bar bar-bottom"> + <div class="pagination"> + {L_NOTIFICATIONS} [<strong>{TOTAL_COUNT}</strong>] + <!-- IF .pagination --> + <!-- INCLUDE pagination.html --> + <!-- ELSE --> + • {PAGE_NUMBER} + <!-- ENDIF --> </div> - <!-- ENDIF --> + </div> <!-- ELSE --> <p><strong>{L_NO_NOTIFICATIONS}</strong></p> @@ -115,7 +110,7 @@ <input type="hidden" name="form_time" value="{FORM_TIME}" /> {S_HIDDEN_FIELDS} <input type="submit" name="submit" value="<!-- IF MODE == 'notification_options' -->{L_SUBMIT}<!-- ELSE -->{L_MARK_READ}<!-- ENDIF -->" class="button1" /> - <div><a href="#" onclick="$('#ucp input:checkbox').attr('checked', true); return false;">{L_MARK_ALL}</a> • <a href="#" onclick="$('#ucp input:checkbox').attr('checked', false); return false;">{L_UNMARK_ALL}</a></div> + <div><a href="#" onclick="$('#ucp input:checkbox').prop('checked', true); return false;">{L_MARK_ALL}</a> • <a href="#" onclick="$('#ucp input:checkbox').prop('checked', false); return false;">{L_UNMARK_ALL}</a></div> {S_FORM_TOKEN} </fieldset> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index d08f622d1f..e97befc552 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -1,10 +1,11 @@ -<h3 id="review"> +<h3 id="review" class="review"> <span class="right-box"><a href="#review" onclick="viewableArea(getElementById('topicreview'), true); var rev_text = getElementById('review').getElementsByTagName('a').item(0).firstChild; if (rev_text.data == '{LA_EXPAND_VIEW}'){rev_text.data = '{LA_COLLAPSE_VIEW}'; } else if (rev_text.data == '{LA_COLLAPSE_VIEW}'){rev_text.data = '{LA_EXPAND_VIEW}'};">{L_EXPAND_VIEW}</a></span> {L_MESSAGE_HISTORY}{L_COLON} </h3> -<div id="topicreview"> +<!-- EVENT ucp_pm_history_review_before --> +<div id="topicreview" class="topicreview"> <script type="text/javascript"> // <![CDATA[ bbcodeEnabled = {S_BBCODE_ALLOWED}; @@ -17,14 +18,28 @@ <div class="postbody" id="pr{history_row.MSG_ID}"> <h3><a href="{history_row.U_VIEW_MESSAGE}" <!-- IF history_row.S_CURRENT_MSG -->class="current"<!-- ENDIF -->>{history_row.SUBJECT}</a></h3> - <!-- IF history_row.U_QUOTE or history_row.MESSAGE_AUTHOR_QUOTE --> - <ul class="profile-icons"> - <li class="quote-icon"><a <!-- IF history_row.U_QUOTE -->href="{history_row.U_QUOTE}"<!-- ELSE -->href="#postingbox" onclick="addquote({history_row.MSG_ID}, '{history_row.MESSAGE_AUTHOR_QUOTE}', '{LA_WROTE}');"<!-- ENDIF --> title="{L_QUOTE} {history_row.MESSAGE_AUTHOR}"><span>{L_QUOTE} {history_row.MESSAGE_AUTHOR}</span></a></li> + <!-- DEFINE $SHOW_PM_HISTORY_POST_BUTTONS = (history_row.U_QUOTE or history_row.MESSAGE_AUTHOR_QUOTE) --> + <!-- EVENT ucp_pm_history_post_buttons_list_before --> + <!-- IF $SHOW_PM_HISTORY_POST_BUTTONS --> + <ul class="post-buttons"> + <!-- EVENT ucp_pm_history_post_buttons_before --> + <!-- IF history_row.U_QUOTE or history_row.MESSAGE_AUTHOR_QUOTE --> + <li> + <a <!-- IF history_row.U_QUOTE -->href="{history_row.U_QUOTE}"<!-- ELSE -->href="#postingbox" onclick="addquote({history_row.MSG_ID}, '{history_row.MESSAGE_AUTHOR_QUOTE}', '{LA_WROTE}', {time:{history_row.MESSAGE_TIME},user_id:{history_row.USER_ID}});"<!-- ENDIF --> title="{L_QUOTE} {history_row.MESSAGE_AUTHOR}" class="button button-icon-only"> + <i class="icon fa-quote-left fa-fw" aria-hidden="true"></i><span class="sr-only">{L_QUOTE} {history_row.MESSAGE_AUTHOR}</span> + </a> + </li> + <!-- ENDIF --> + <!-- EVENT ucp_pm_history_post_buttons_after --> </ul> <!-- ENDIF --> + <!-- EVENT ucp_pm_history_post_buttons_list_after --> - <p class="author">{history_row.MINI_POST_IMG} {L_SENT_AT}{L_COLON} <strong>{history_row.SENT_DATE}</strong><br /> - {L_MESSAGE_BY_AUTHOR} {history_row.MESSAGE_AUTHOR_FULL}</p> + <p class="author"> + <span><i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{history_row.MINI_POST}</span></span> {L_SENT_AT}{L_COLON} <strong>{history_row.SENT_DATE}</strong> + <br /> + {L_MESSAGE_BY_AUTHOR} {history_row.MESSAGE_AUTHOR_FULL} + </p> <div class="content"><!-- IF history_row.MESSAGE -->{history_row.MESSAGE}<!-- ELSE --><span class="error">{L_MESSAGE_REMOVED_FROM_OUTBOX}</span><!-- ENDIF --></div> <div id="message_{history_row.MSG_ID}" style="display: none;">{history_row.DECODED_MESSAGE}</div> </div> @@ -33,6 +48,12 @@ </div> <!-- END history_row --> </div> +<!-- EVENT ucp_pm_history_review_after --> <hr /> -<p><a href="#cp-main" class="top2">{L_BACK_TO_TOP}</a></p> +<p> + <a href="#cp-main" class="top"> + <i class="icon fa-chevron-circle-up fa-fw icon-gray" aria-hidden="true"></i><span>{L_BACK_TO_TOP}</span> + </a> +</p> + diff --git a/phpBB/styles/prosilver/template/ucp_pm_message_header.html b/phpBB/styles/prosilver/template/ucp_pm_message_header.html index 7a80f72348..6ad9e9cab6 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_message_header.html +++ b/phpBB/styles/prosilver/template/ucp_pm_message_header.html @@ -4,29 +4,67 @@ <div class="panel"> <div class="inner"> - <!-- IF FOLDER_STATUS and FOLDER_MAX_MESSAGES neq 0 --><p>{FOLDER_STATUS}</p><!-- ENDIF --> + + <div class="action-bar bar-top"> <!-- IF U_POST_REPLY_PM or U_POST_NEW_TOPIC or U_FORWARD_PM --> - <div class="buttons"> - <!-- IF U_POST_REPLY_PM --><div class="pmreply-icon"><a title="{L_POST_REPLY_PM}" href="{U_POST_REPLY_PM}"><span></span>{L_BUTTON_PM_REPLY}</a></div> - <!-- ELSEIF U_POST_NEW_TOPIC --><div class="newpm-icon"><a href="{U_POST_NEW_TOPIC}" accesskey="n" title="{L_UCP_PM_COMPOSE}"><span></span>{L_BUTTON_PM_NEW}</a></div><!-- ENDIF --> - <!-- IF U_FORWARD_PM --><div class="forwardpm-icon"><a title="{L_POST_FORWARD_PM}" href="{U_FORWARD_PM}"><span></span>{L_BUTTON_PM_FORWARD}</a></div><!-- ENDIF --> - <!-- IF U_POST_REPLY_PM and S_PM_RECIPIENTS gt 1 --><div class="reply-all"><a title="{L_REPLY_TO_ALL}" href="{U_POST_REPLY_ALL}">{L_BUTTON_PM_REPLY_ALL}</a></div><!-- ENDIF --> + <!-- IF U_POST_REPLY_PM --> + <a title="{L_POST_REPLY_PM}" href="{U_POST_REPLY_PM}" class="button"> + <span>{L_BUTTON_PM_REPLY}</span> <i class="icon fa-reply fa-fw" aria-hidden="true"></i> + </a> + <!-- ELSEIF U_POST_NEW_TOPIC --> + <a href="{U_POST_NEW_TOPIC}" accesskey="n" title="{L_UCP_PM_COMPOSE}" class="button"> + <span>{L_BUTTON_PM_NEW}</span> <i class="icon fa-pencil fa-fw" aria-hidden="true"></i> + </a> + <!-- ENDIF --> + <!-- IF U_FORWARD_PM --> + <a title="{L_POST_FORWARD_PM}" href="{U_FORWARD_PM}" class="button"> + <span>{L_BUTTON_PM_FORWARD}</span> <i class="icon fa-mail-forward fa-fw" aria-hidden="true"></i> + </a> + <!-- ENDIF --> + <!-- IF U_POST_REPLY_PM and S_PM_RECIPIENTS gt 1 --> + <a title="{L_REPLY_TO_ALL}" href="{U_POST_REPLY_ALL}" class="button"> + <span>{L_BUTTON_PM_REPLY_ALL}</span> <i class="icon fa-pencil fa-fw" aria-hidden="true"></i> + </a> + <!-- ENDIF --> + <!-- ENDIF --> + + <!-- IF not S_IS_BOT and U_PRINT_PM --> + <div class="dropdown-container dropdown-button-control topic-tools"> + <span title="{L_PM_TOOLS}" class="button button-secondary dropdown-trigger dropdown-select"> + <i class="icon fa-wrench fa-fw" aria-hidden="true"></i> + <span class="caret"><i class="icon fa-sort-down fa-fw" aria-hidden="true"></i></span> + </span> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents"> + <!-- IF U_PRINT_PM --> + <li> + <a href="{U_PRINT_PM}" title="{L_PRINT_PM}" accesskey="p"> + <i class="icon fa-print fa-fw" aria-hidden="true"></i><span>{L_PRINT_PM}</span> + </a> + </li> + <!-- ENDIF --> + </ul> + </div> </div> <!-- ENDIF --> <!-- IF TOTAL_MESSAGES or S_VIEW_MESSAGE --> - <ul class="linklist"> - <li class="rightside pagination"> - <!-- IF S_VIEW_MESSAGE --><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_CURRENT_FOLDER}">{L_RETURN_TO} {CUR_FOLDER_NAME}</a><!-- ENDIF --> - <!-- IF FOLDER_CUR_MESSAGES neq 0 --> - <!-- IF TOTAL_MESSAGES -->{TOTAL_MESSAGES} • <!-- ENDIF --> + <div class="pagination"> + <!-- IF S_VIEW_MESSAGE --> + <a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_CURRENT_FOLDER}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_RETURN_TO_FOLDER}</span> + </a> + <!-- ELSEIF FOLDER_CUR_MESSAGES neq 0 --> + <!-- IF U_MARK_ALL --><a href="{U_MARK_ALL}" class="mark">{L_PM_MARK_ALL_READ}</a> • <!-- ENDIF --> + {TOTAL_MESSAGES} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> <!-- ENDIF --> - </li> - </ul> + </div> <!-- ENDIF --> + </div> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index efe6663db0..a3d58c8749 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -25,7 +25,7 @@ <fieldset class="submit-buttons"> <input type="hidden" name="export_option" value="CSV" /> <input class="button1" type="submit" name="submit_export" value="{L_EXPORT_FOLDER}" /> - <input class="button2" type="reset" value="Reset" name="reset" /> + <input class="button2" type="reset" value="{L_RESET}" name="reset" /> {S_FORM_TOKEN} </fieldset> </form> @@ -57,8 +57,9 @@ <!-- BEGIN messagerow --> <li class="row<!-- IF messagerow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF messagerow.PM_CLASS --> {messagerow.PM_CLASS}<!-- ENDIF -->"> - <dl class="icon {messagerow.FOLDER_IMG_STYLE}"> + <dl class="row-item {messagerow.FOLDER_IMG_STYLE}"> <dt<!-- IF messagerow.PM_ICON_URL and S_PM_ICONS --> style="background-image: url({messagerow.PM_ICON_URL}); background-repeat: no-repeat;"<!-- ENDIF -->> + <!-- IF messagerow.S_PM_UNREAD and not messagerow.S_PM_DELETED --><a href="{messagerow.U_VIEW_PM}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- IF messagerow.S_PM_DELETED --> @@ -70,8 +71,11 @@ <!-- IF messagerow.S_AUTHOR_DELETED --> <br /><em class="small">{L_PM_FROM_REMOVED_AUTHOR}</em> <!-- ENDIF --> - - <!-- IF messagerow.S_PM_REPORTED --><a href="{messagerow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> {messagerow.ATTACH_ICON_IMG}<br /> + <!-- IF messagerow.S_PM_REPORTED --> + <a href="{messagerow.U_MCP_REPORT}"> + <i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{PM_REPORTED}</span> + </a> + <!-- ENDIF --> <!-- IF messagerow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --><br /> <!-- IF S_SHOW_RECIPIENTS -->{L_MESSAGE_TO} {messagerow.RECIPIENTS}<!-- ELSE -->{L_MESSAGE_BY_AUTHOR} {messagerow.MESSAGE_AUTHOR_FULL} » {messagerow.SENT_TIME}<!-- ENDIF --> </div> @@ -95,43 +99,32 @@ <!-- ENDIF --> <!-- IF FOLDER_CUR_MESSAGES neq 0 --> - <fieldset class="display-actions"> - <div class="left-box"><label for="export_option">{L_EXPORT_FOLDER}{L_COLON} <select name="export_option" id="export_option"><option value="CSV">{L_EXPORT_AS_CSV}</option><option value="CSV_EXCEL">{L_EXPORT_AS_CSV_EXCEL}</option><option value="XML">{L_EXPORT_AS_XML}</option></select></label> <input class="button2" type="submit" name="submit_export" value="{L_GO}" /><br /></div> - <select name="mark_option">{S_MARK_OPTIONS}{S_MOVE_MARKED_OPTIONS}</select> <input class="button2" type="submit" name="submit_mark" value="{L_GO}" /> - <div><a href="#" onclick="marklist('viewfolder', 'marked_msg', true); return false;">{L_MARK_ALL}</a> • <a href="#" onclick="marklist('viewfolder', 'marked_msg', false); return false;">{L_UNMARK_ALL}</a></div> - </fieldset> - - <hr /> - - <ul class="linklist"> - <!-- IF TOTAL_MESSAGES or S_VIEW_MESSAGE --> - <li class="rightside pagination"> - <!-- IF TOTAL_MESSAGES -->{TOTAL_MESSAGES} • <!-- ENDIF --> - <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </li> - <!-- ENDIF --> - </ul> + <fieldset class="display-actions"> + <div class="left-box"><label for="export_option">{L_EXPORT_FOLDER}{L_COLON} <select name="export_option" id="export_option"><option value="CSV">{L_EXPORT_AS_CSV}</option><option value="CSV_EXCEL">{L_EXPORT_AS_CSV_EXCEL}</option><option value="XML">{L_EXPORT_AS_XML}</option></select></label> <input class="button2" type="submit" name="submit_export" value="{L_GO}" /><br /></div> + <select name="mark_option">{S_MARK_OPTIONS}{S_MOVE_MARKED_OPTIONS}</select> <input class="button2" type="submit" name="submit_mark" value="{L_GO}" /> + <div><a href="#" onclick="marklist('viewfolder', 'marked_msg', true); return false;">{L_MARK_ALL}</a> • <a href="#" onclick="marklist('viewfolder', 'marked_msg', false); return false;">{L_UNMARK_ALL}</a></div> + </fieldset> + + <hr /> + + <div class="action-bar bottom"> + <!-- INCLUDE display_options.html --> + <input type="hidden" name="cur_folder_id" value="{CUR_FOLDER_ID}" /> + + <div class="pagination"> + {TOTAL_MESSAGES} + <!-- IF .pagination --> + <!-- INCLUDE pagination.html --> + <!-- ELSE --> + • {PAGE_NUMBER} + <!-- ENDIF --> + </div> + </div> <!-- ENDIF --> </div> </div> - <!-- IF FOLDER_CUR_MESSAGES neq 0 --> - <fieldset class="display-options"> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <label>{L_DISPLAY}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> - <label>{S_SELECT_SORT_DIR}</label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - <input type="hidden" name="cur_folder_id" value="{CUR_FOLDER_ID}" /> - </fieldset> - <!-- ENDIF --> - <!-- INCLUDE ucp_pm_message_footer.html --> <!-- ENDIF --> <!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 3623489ccf..59317da8f7 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -8,57 +8,118 @@ <!-- IF S_DISPLAY_HISTORY and (U_VIEW_PREVIOUS_HISTORY or U_VIEW_NEXT_HISTORY) --> <fieldset class="display-options clearfix"> - <!-- IF U_VIEW_PREVIOUS_HISTORY --><a href="{U_VIEW_PREVIOUS_HISTORY}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_HISTORY}</a><!-- ENDIF --> - <!-- IF U_VIEW_NEXT_HISTORY --><a href="{U_VIEW_NEXT_HISTORY}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_VIEW_NEXT_HISTORY}</a><!-- ENDIF --> + <!-- IF U_VIEW_PREVIOUS_HISTORY --> + <a href="{U_VIEW_PREVIOUS_HISTORY}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_VIEW_PREVIOUS_HISTORY}</span> + </a> + <!-- ENDIF --> + <!-- IF U_VIEW_NEXT_HISTORY --> + <a href="{U_VIEW_NEXT_HISTORY}" class="right-box arrow-{S_CONTENT_FLOW_END}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_VIEW_NEXT_HISTORY}</span> + </a> + <!-- ENDIF --> </fieldset> <!-- ENDIF --> -<div id="post-{MESSAGE_ID}" class="post pm<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->"> +<div id="post-{MESSAGE_ID}" class="post pm has-profile<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->"> <div class="inner"> <dl class="postprofile" id="profile{MESSAGE_ID}"> - <dt class="<!-- IF RANK_TITLE or RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF -->"><!-- IF AUTHOR_AVATAR --><a href="{U_MESSAGE_AUTHOR}" class="avatar">{AUTHOR_AVATAR}</a><!-- ENDIF -->{MESSAGE_AUTHOR_FULL}</dt> - + <dt class="<!-- IF RANK_TITLE or RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF --> <!-- IF AUTHOR_AVATAR -->has-avatar<!-- ELSE -->no-avatar<!-- ENDIF -->"> + <div class="avatar-container"> + <!-- EVENT ucp_pm_viewmessage_avatar_before --> + <!-- IF AUTHOR_AVATAR --><a href="{U_MESSAGE_AUTHOR}" class="avatar">{AUTHOR_AVATAR}</a><!-- ENDIF --> + <!-- EVENT ucp_pm_viewmessage_avatar_after --> + </div> + {MESSAGE_AUTHOR_FULL} + </dt> + + <!-- EVENT ucp_pm_viewmessage_rank_before --> <!-- IF RANK_TITLE or RANK_IMG --><dd class="profile-rank">{RANK_TITLE}<!-- IF RANK_TITLE and RANK_IMG --><br /><!-- ENDIF -->{RANK_IMG}</dd><!-- ENDIF --> + <!-- EVENT ucp_pm_viewmessage_rank_after --> - <dd><strong>{L_POSTS}{L_COLON}</strong> {AUTHOR_POSTS}</dd> - <!-- IF AUTHOR_JOINED --><dd><strong>{L_JOINED}{L_COLON}</strong> {AUTHOR_JOINED}</dd><!-- ENDIF --> + <dd class="profile-posts"><strong>{L_POSTS}{L_COLON}</strong> <!-- IF U_AUTHOR_POSTS != '' --><a href="{U_AUTHOR_POSTS}">{AUTHOR_POSTS}</a><!-- ELSE -->{AUTHOR_POSTS}<!-- ENDIF --></dd> + <!-- IF AUTHOR_JOINED --><dd class="profile-joined"><strong>{L_JOINED}{L_COLON}</strong> {AUTHOR_JOINED}</dd><!-- ENDIF --> <!-- EVENT ucp_pm_viewmessage_custom_fields_before --> <!-- BEGIN custom_fields --> - <dd><strong>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</strong> {custom_fields.PROFILE_FIELD_VALUE}</dd> + <!-- IF not custom_fields.S_PROFILE_CONTACT --> + <dd class="profile-custom-field profile-{custom_fields.PROFILE_FIELD_IDENT}"><strong>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</strong> {custom_fields.PROFILE_FIELD_VALUE}</dd> + <!-- ENDIF --> <!-- END custom_fields --> <!-- EVENT ucp_pm_viewmessage_custom_fields_after --> - - <!-- IF U_PM or U_EMAIL or U_WWW or U_MSN or U_ICQ or U_YIM or U_AIM or U_JABBER --> - <dd> - <ul class="profile-icons"> - <!-- IF U_PM --><li class="pm-icon"><a href="{U_PM}" title="{L_PRIVATE_MESSAGE}"><span>{L_PRIVATE_MESSAGE}</span></a></li><!-- ENDIF --> - <!-- IF U_EMAIL --><li class="email-icon"><a href="{U_EMAIL}" title="{L_SEND_EMAIL_USER} {MESSAGE_AUTHOR}"><span>{L_SEND_EMAIL_USER} {MESSAGE_AUTHOR}</span></a></li><!-- ENDIF --> - <!-- IF U_WWW --><li class="web-icon"><a href="{U_WWW}" title="{L_VISIT_WEBSITE}{L_COLON} {U_WWW}"><span>{L_WEBSITE}</span></a></li><!-- ENDIF --> - <!-- IF U_MSN --><li class="msnm-icon"><a href="{U_MSN}" onclick="popup(this.href, 550, 320); return false;" title="{L_MSNM}"><span>{L_MSNM}</span></a></li><!-- ENDIF --> - <!-- IF U_ICQ --><li class="icq-icon"><a href="{U_ICQ}" onclick="popup(this.href, 550, 320); return false;" title="{L_ICQ}"><span>{L_ICQ}</span></a></li><!-- ENDIF --> - <!-- IF U_YIM --><li class="yahoo-icon"><a href="{U_YIM}" onclick="popup(this.href, 780, 550); return false;" title="{L_YIM}"><span>{L_YIM}</span></a></li><!-- ENDIF --> - <!-- IF U_AIM --><li class="aim-icon"><a href="{U_AIM}" onclick="popup(this.href, 550, 320); return false;" title="{L_AIM}"><span>{L_AIM}</span></a></li><!-- ENDIF --> - <!-- IF U_JABBER --><li class="jabber-icon"><a href="{U_JABBER}" onclick="popup(this.href, 550, 320); return false;" title="{L_JABBER}"><span>{L_JABBER}</span></a></li><!-- ENDIF --> - </ul> - </dd> + <!-- EVENT ucp_pm_viewmessage_contact_fields_before --> + <!-- IF .contact --> + <dd class="profile-contact"> + <strong>{L_CONTACT}{L_COLON}</strong> + <div class="dropdown-container dropdown-left"> + <a href="#" class="dropdown-trigger" title="{CONTACT_USER}"><i class="icon fa-commenting-o fa-fw icon-lg" aria-hidden="true"></i><span class="sr-only">{CONTACT_USER}</span></a> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <div class="dropdown-contents contact-icons"> + <!-- BEGIN contact --> + {% set REMAINDER = contact.S_ROW_COUNT % 4 %} + <!-- DEFINE $S_LAST_CELL = ((REMAINDER eq 3) or (contact.S_LAST_ROW and contact.S_NUM_ROWS < 4)) --> + <!-- IF REMAINDER eq 0 --> + <div> + <!-- ENDIF --> + <a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF contact.ID eq 'jabber' --> onclick="popup(this.href, 750, 320); return false;"<!-- ENDIF -->> + <span class="contact-icon {contact.ID}-icon">{contact.NAME}</span> + </a> + <!-- IF REMAINDER eq 3 or contact.S_LAST_ROW --> + </div> + <!-- ENDIF --> + <!-- END contact --> + </div> + </div> + </div> + </dd> <!-- ENDIF --> + <!-- EVENT ucp_pm_viewmessage_contact_fields_after --> </dl> <div class="postbody"> <h3 class="first">{SUBJECT}</h3> - <!-- IF U_DELETE or U_EDIT or U_QUOTE or U_REPORT --> - <ul class="profile-icons"> - <!-- IF U_EDIT --><li class="edit-icon"><a href="{U_EDIT}" title="{L_POST_EDIT_PM}"><span>{L_POST_EDIT_PM}</span></a></li><!-- ENDIF --> - <!-- IF U_DELETE --><li class="delete-icon"><a href="{U_DELETE}" title="{L_DELETE_MESSAGE}"><span>{L_DELETE_MESSAGE}</span></a></li><!-- ENDIF --> - <!-- IF U_REPORT --><li class="report-icon"><a href="{U_REPORT}" title="{L_REPORT_PM}"><span>{L_REPORT_PM}</span></a></li><!-- ENDIF --> - <!-- IF U_QUOTE --><li class="quote-icon"><a href="{U_QUOTE}" title="{L_POST_QUOTE_PM}"><span>{L_POST_QUOTE_PM}</span></a></li><!-- ENDIF --> + <!-- DEFINE $SHOW_PM_POST_BUTTONS = (U_EDIT or U_DELETE or U_REPORT or U_QUOTE) --> + <!-- EVENT ucp_pm_viewmessage_post_buttons_list_before --> + <!-- IF $SHOW_PM_POST_BUTTONS --> + <ul class="post-buttons"> + <!-- EVENT ucp_pm_viewmessage_post_buttons_before --> + <!-- IF U_EDIT --> + <li> + <a href="{U_EDIT}" title="{L_POST_EDIT_PM}" class="button button-icon-only"> + <i class="icon fa-pencil fa-fw" aria-hidden="true"></i><span class="sr-only">{L_POST_EDIT_PM}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF U_DELETE --> + <li> + <a href="{U_DELETE}" title="{L_DELETE_MESSAGE}" class="button button-icon-only"> + <i class="icon fa-times fa-fw" aria-hidden="true"></i><span class="sr-only">{L_DELETE_MESSAGE}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF U_REPORT --> + <li> + <a href="{U_REPORT}" title="{L_REPORT_PM}" class="button button-icon-only"> + <i class="icon fa-exclamation fa-fw" aria-hidden="true"></i><span class="sr-only">{L_REPORT_PM}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF U_QUOTE --> + <li> + <a href="{U_QUOTE}" title="{L_POST_QUOTE_PM}" class="button button-icon-only"> + <i class="icon fa-quote-left fa-fw" aria-hidden="true"></i><span class="sr-only">{L_POST_QUOTE_PM}</span> + </a> + </li> + <!-- ENDIF --> + <!-- EVENT ucp_pm_viewmessage_post_buttons_after --> </ul> <!-- ENDIF --> + <!-- EVENT ucp_pm_viewmessage_post_buttons_list_after --> <p class="author"> <strong>{L_SENT_AT}{L_COLON}</strong> {SENT_DATE} @@ -74,16 +135,6 @@ <dl class="attachbox"> <dt> {L_ATTACHMENTS} - <!-- IF S_HAS_MULTIPLE_ATTACHMENTS --> - <div class="dl_links"> - <strong>{L_DOWNLOAD_ALL}{L_COLON}</strong> - <ul> - <!-- BEGIN dl_method --> - <li>[ <a href="{dl_method.LINK}">{dl_method.TYPE}</a> ]</li> - <!-- END dl_method --> - </ul> - </div> - <!-- ENDIF --> </dt> <!-- BEGIN attachment --> <dd>{attachment.DISPLAY_ATTACHMENT}</dd> @@ -106,17 +157,30 @@ <!-- ENDIF --> </div> - <div class="back2top"><a href="#top" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div> + <div class="back2top"> + <a href="#top" class="top" title="{L_BACK_TO_TOP}"> + <i class="icon fa-chevron-circle-up fa-fw icon-gray" aria-hidden="true"></i> + <span class="sr-only">{L_BACK_TO_TOP}</span> + </a> + </div> </div> </div> <!-- IF S_VIEW_MESSAGE --> <fieldset class="display-options"> - <!-- IF U_PREVIOUS_PM --><a href="{U_PREVIOUS_PM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_PM}</a><!-- ENDIF --> - <!-- IF U_NEXT_PM --><a href="{U_NEXT_PM}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_VIEW_NEXT_PM}</a><!-- ENDIF --> <!-- IF S_MARK_OPTIONS --><label for="mark_option"><select name="mark_option" id="mark_option">{S_MARK_OPTIONS}</select></label> <input class="button2" type="submit" name="submit_mark" value="{L_GO}" /><!-- ENDIF --> + <!-- IF U_PREVIOUS_PM --> + <a href="{U_PREVIOUS_PM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_VIEW_PREVIOUS_PM}</span> + </a> + <!-- ENDIF --> + <!-- IF U_NEXT_PM --> + <a href="{U_NEXT_PM}" class="right-box arrow-{S_CONTENT_FLOW_END}"> + <i class="icon fa-angle-{S_CONTENT_FLOW_BEGIN} fa-fw icon-black" aria-hidden="true"></i><span>{L_VIEW_NEXT_PM}</span> + </a> + <!-- ENDIF --> <!-- IF not S_UNREAD and not S_SPECIAL_FOLDER --><label for="dest_folder"><!-- IF S_VIEW_MESSAGE -->{L_MOVE_TO_FOLDER}{L_COLON} <!-- ELSE -->{L_MOVE_MARKED_TO_FOLDER}<!-- ENDIF --> <select name="dest_folder" id="dest_folder">{S_TO_FOLDER_OPTIONS}</select></label> <input class="button2" type="submit" name="move_pm" value="{L_GO}" /><!-- ENDIF --> <input type="hidden" name="marked_msg_id[]" value="{MSG_ID}" /> <input type="hidden" name="cur_folder_id" value="{CUR_FOLDER_ID}" /> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index 4d7346fda8..70beec8256 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -1,17 +1,17 @@ <!DOCTYPE html> <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> -<meta charset="utf-8"> +<meta charset="utf-8" /> <meta name="robots" content="noindex" /> {META} <title>{SITENAME} • {PAGE_TITLE}</title> -<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" /> +<link href="{T_THEME_PATH}/print.css" rel="stylesheet"> <!-- EVENT ucp_pm_viewmessage_print_head_append --> </head> <body id="phpbb"> -<div id="wrap"> - <a id="top" accesskey="t"></a> +<div id="wrap" class="wrap"> + <a id="top" class="top-anchor" accesskey="t"></a> <div id="page-header"> <h1>{SITENAME}</h1> @@ -20,7 +20,7 @@ <h2>{L_PRIVATE_MESSAGING}</h2> </div> - <div id="page-body"> + <div id="page-body" class="page-body"> <div class="page-number">{PAGE_NUMBER}</div> <div class="post"> <h3>{SUBJECT}</h3> @@ -38,9 +38,9 @@ <hr /> </div> - <div id="page-footer"> + <div id="page-footer" class="page-footer"> <div class="page-number">{S_TIMEZONE}<br />{PAGE_NUMBER}</div> - <div class="copyright">Powered by phpBB® Forum Software © phpBB Group<br />https://www.phpbb.com/</div> + <div class="copyright">Powered by phpBB® Forum Software © phpBB Limited<br />https://www.phpbb.com/</div> </div> </div> diff --git a/phpBB/styles/prosilver/template/ucp_prefs_personal.html b/phpBB/styles/prosilver/template/ucp_prefs_personal.html index 8111496dcb..4cd9f6655b 100644 --- a/phpBB/styles/prosilver/template/ucp_prefs_personal.html +++ b/phpBB/styles/prosilver/template/ucp_prefs_personal.html @@ -58,19 +58,19 @@ <!-- ENDIF --> <!-- IF S_STYLE_OPTIONS and S_MORE_STYLES --> <dl> - <dt><label for="style">{L_BOARD_STYLE}{L_COLON}</label></dt> - <dd><select name="style" id="style">{S_STYLE_OPTIONS}</select></dd> + <dt><label for="user_style">{L_BOARD_STYLE}{L_COLON}</label></dt> + <dd><select name="user_style" id="user_style">{S_STYLE_OPTIONS}</select></dd> </dl> <!-- ENDIF --> <!-- INCLUDE timezone_option.html --> <dl> <dt><label for="dateformat">{L_BOARD_DATE_FORMAT}{L_COLON}</label><br /><span>{L_BOARD_DATE_FORMAT_EXPLAIN}</span></dt> <dd> - <select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){dE('custom_date',1);}else{dE('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }"> + <select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){phpbb.toggleDisplay('custom_date',1);}else{phpbb.toggleDisplay('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }"> {S_DATEFORMAT_OPTIONS} </select> </dd> - <dd id="custom_date" style="display:none;"><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="inputbox narrow" style="margin-top: 3px;" /></dd> + <dd id="custom_date" style="display:none;"><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="64" class="inputbox narrow" style="margin-top: 3px;" /></dd> </dl> <!-- EVENT ucp_prefs_personal_append --> </fieldset> @@ -109,15 +109,15 @@ // Show/hide custom field if (e.selectedIndex == e.length - 1) { - dE('custom_date',1); + phpbb.toggleDisplay('custom_date',1); } else { - dE('custom_date',-1); + phpbb.toggleDisplay('custom_date',-1); } } - customDates(); + window.onload = customDates; // ]]> </script> diff --git a/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html b/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html index bf97434bac..65909b7068 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html +++ b/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html @@ -5,47 +5,41 @@ <h2>{L_TITLE}</h2> <div class="panel"> <div class="inner"> - - <!-- IF .errors --> - <p class="error"> - <!-- BEGIN errors --> - {errors} <br /> - <!-- END errors --> - </p> - <!-- ENDIF --> - - <p>{L_PROFILE_AUTOLOGIN_KEYS}</p><br /> - <table class="table1"> - <thead> - <tr> - <th>{L_MARK}</th> - <th>{L_LOGIN_KEY}</th> - <th>{L_IP}</th> - <th>{L_LOGIN_TIME}</th> - </tr> - </thead> - <tbody> - <!-- BEGIN sessions --> - <!-- IF sessions.S_ROW_COUNT is even --><tr class="bg1"><!-- ELSE --><tr class="bg2"><!-- ENDIF --> - <td style="text-align: center"><input type="checkbox" name="keys[]" value="{sessions.KEY}" id="{sessions.KEY}"/></td> - <td><label for="{sessions.KEY}">{sessions.KEY}</label></td> - <td style="text-align: center">{sessions.IP}</td> - <td style="text-align: center">{sessions.LOGIN_TIME}</td> - </tr> - <!-- BEGINELSE --> - <tr><td colspan="4" class="bg1" style="text-align: center">{L_PROFILE_NO_AUTOLOGIN_KEYS}</td></tr> - <!-- END sessions --> - </tbody> - </table> + <p>{L_PROFILE_AUTOLOGIN_KEYS}</p> + <!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF --> + <table class="table1"> + <thead> + <tr> + <th class="name">{L_LOGIN_KEY}</th> + <th class="center">{L_IP}</th> + <th class="center">{L_LOGIN_TIME}</th> + <th class="center mark">{L_MARK}</th> + </tr> + </thead> + <tbody> + <!-- BEGIN sessions --> + <!-- IF sessions.S_ROW_COUNT is even --><tr class="bg1"><!-- ELSE --><tr class="bg2"><!-- ENDIF --> + <td><label for="{sessions.KEY}">{sessions.KEY}</label></td> + <td class="center">{sessions.IP}</td> + <td class="center">{sessions.LOGIN_TIME}</td> + <td class="center mark"><input type="checkbox" name="keys[]" value="{sessions.KEY}" id="{sessions.KEY}" /></td> + </tr> + <!-- BEGINELSE --> + <tr><td colspan="4" class="bg1" style="text-align: center">{L_PROFILE_NO_AUTOLOGIN_KEYS}</td></tr> + <!-- END sessions --> + </tbody> + </table> </div> </div> <!-- IF .sessions --> - <fieldset class="submit-buttons"> - {S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_DELETE}" class="button1" /> + <fieldset class="display-actions"> + {S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_DELETE_MARKED}" class="button2" /> + <div><a href="#" onclick="$('#ucp input:checkbox').prop('checked', true); return false;">{L_MARK_ALL}</a> • <a href="#" onclick="$('#ucp input:checkbox').prop('checked', false); return false;">{L_UNMARK_ALL}</a></div> {S_FORM_TOKEN} </fieldset> <!-- ENDIF --> + </form> <!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html index 03b8aa0a14..69eda8c42c 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html +++ b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html @@ -2,7 +2,7 @@ <form id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}> -<h2>{L_TITLE}</h2> +<h2>{L_TITLE} <span class="small">[ <a href="{U_USER_PROFILE}" title="{L_VIEW_PROFILE}">{L_VIEW_PROFILE}</a> ]</span></h2> <div class="panel"> <div class="inner"> @@ -10,40 +10,23 @@ <fieldset> <!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF --> - <dl> - <dt><label for="icq">{L_UCP_ICQ}{L_COLON}</label></dt> - <dd><input type="text" name="icq" id="icq" maxlength="15" value="{ICQ}" class="inputbox" /></dd> - </dl> - <dl> - <dt><label for="aim">{L_UCP_AIM}{L_COLON}</label></dt> - <dd><input type="text" name="aim" id="aim" maxlength="255" value="{AIM}" class="inputbox" /></dd> - </dl> - <dl> - <dt><label for="msn">{L_UCP_MSNM}{L_COLON}</label></dt> - <dd><input type="email" name="msn" id="msn" maxlength="255" value="{MSN}" class="inputbox" /></dd> - </dl> - <dl> - <dt><label for="yim">{L_UCP_YIM}{L_COLON}</label></dt> - <dd><input type="text" name="yim" id="yim" maxlength="255" value="{YIM}" class="inputbox" /></dd> - </dl> - <dl> - <dt><label for="jabber">{L_UCP_JABBER}{L_COLON}</label></dt> - <dd><input type="email" name="jabber" id="jabber" maxlength="255" value="{JABBER}" class="inputbox" /></dd> - </dl> - <dl> - <dt><label for="website">{L_WEBSITE}{L_COLON}</label></dt> - <dd><input type="url" name="website" id="website" maxlength="255" value="{WEBSITE}" class="inputbox" /></dd> - </dl> + <!-- EVENT ucp_profile_profile_info_before --> <!-- IF S_BIRTHDAYS_ENABLED --> <dl> <dt><label for="bday_day">{L_BIRTHDAY}{L_COLON}</label><br /><span>{L_BIRTHDAY_EXPLAIN}</span></dt> <dd> - <label for="bday_day">{L_DAY}{L_COLON} <select name="bday_day" id="bday_day" style="width: 4em;">{S_BIRTHDAY_DAY_OPTIONS}</select></label> - <label for="bday_month">{L_MONTH}{L_COLON} <select name="bday_month" id="bday_month" style="width: 4em;">{S_BIRTHDAY_MONTH_OPTIONS}</select></label> - <label for="bday_year">{L_YEAR}{L_COLON} <select name="bday_year" id="bday_year" style="width: 6em;">{S_BIRTHDAY_YEAR_OPTIONS}</select></label> + <label for="bday_day">{L_DAY}{L_COLON} <select name="bday_day" id="bday_day">{S_BIRTHDAY_DAY_OPTIONS}</select></label> + <label for="bday_month">{L_MONTH}{L_COLON} <select name="bday_month" id="bday_month">{S_BIRTHDAY_MONTH_OPTIONS}</select></label> + <label for="bday_year">{L_YEAR}{L_COLON} <select name="bday_year" id="bday_year">{S_BIRTHDAY_YEAR_OPTIONS}</select></label> </dd> </dl> <!-- ENDIF --> + <!-- IF S_JABBER_ENABLED --> + <dl> + <dt><label for="jabber">{L_UCP_JABBER}{L_COLON}</label></dt> + <dd><input type="email" name="jabber" id="jabber" maxlength="255" value="{JABBER}" class="inputbox" /></dd> + </dl> + <!-- ENDIF --> <!-- BEGIN profile_fields --> <dl> <dt><label<!-- IF profile_fields.FIELD_ID --> for="{profile_fields.FIELD_ID}"<!-- ENDIF -->>{profile_fields.LANG_NAME}{L_COLON}<!-- IF profile_fields.S_REQUIRED --> *<!-- ENDIF --></label> @@ -52,6 +35,7 @@ <dd>{profile_fields.FIELD}</dd> </dl> <!-- END profile_fields --> + <!-- EVENT ucp_profile_profile_info_after --> </fieldset> </div> diff --git a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html index 4b26bc2e99..462a7f8f20 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html +++ b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html @@ -12,24 +12,26 @@ <fieldset> <!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF --> + <!-- EVENT ucp_profile_register_details_before --> <dl> <dt><label <!-- IF S_CHANGE_USERNAME -->for="username"<!-- ENDIF -->>{L_USERNAME}{L_COLON}</label><br /><span>{L_USERNAME_EXPLAIN}</span></dt> <dd><!-- IF S_CHANGE_USERNAME --><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox" title="{L_USERNAME}" /><!-- ELSE --><strong>{USERNAME}</strong><!-- ENDIF --></dd> </dl> <dl> <dt><label for="email">{L_EMAIL_ADDRESS}{L_COLON}</label></dt> - <dd><!-- IF S_CHANGE_EMAIL --><input type="email" name="email" id="email" maxlength="100" value="{EMAIL}" class="inputbox" title="{L_EMAIL_ADDRESS}" /><!-- ELSE --><strong>{EMAIL}</strong><!-- ENDIF --></dd> + <dd><!-- IF S_CHANGE_EMAIL --><input type="email" name="email" id="email" maxlength="100" value="{EMAIL}" class="inputbox" title="{L_EMAIL_ADDRESS}" autocomplete="off" /><!-- ELSE --><strong>{EMAIL}</strong><!-- ENDIF --></dd> </dl> <!-- IF S_CHANGE_PASSWORD --> <dl> <dt><label for="new_password">{L_NEW_PASSWORD}{L_COLON}</label><br /><span>{L_CHANGE_PASSWORD_EXPLAIN}</span></dt> - <dd><input type="password" name="new_password" id="new_password" maxlength="255" value="{NEW_PASSWORD}" class="inputbox" title="{L_CHANGE_PASSWORD}" /></dd> + <dd><input type="password" name="new_password" id="new_password" maxlength="255" value="{NEW_PASSWORD}" class="inputbox" title="{L_CHANGE_PASSWORD}" autocomplete="off" /></dd> </dl> <dl> <dt><label for="password_confirm">{L_CONFIRM_PASSWORD}{L_COLON}</label><br /><span>{L_CONFIRM_PASSWORD_EXPLAIN}</span></dt> - <dd><input type="password" name="password_confirm" id="password_confirm" maxlength="255" value="{PASSWORD_CONFIRM}" class="inputbox" title="{L_CONFIRM_PASSWORD}" /></dd> + <dd><input type="password" name="password_confirm" id="password_confirm" maxlength="255" value="{PASSWORD_CONFIRM}" class="inputbox" title="{L_CONFIRM_PASSWORD}" autocomplete="off" /></dd> </dl> <!-- ENDIF --> + <!-- EVENT ucp_profile_register_details_after --> </fieldset> </div> </div> @@ -40,7 +42,7 @@ <fieldset> <dl> <dt><label for="cur_password">{L_CURRENT_PASSWORD}{L_COLON}</label><br /><span><!-- IF S_CHANGE_PASSWORD -->{L_CURRENT_CHANGE_PASSWORD_EXPLAIN}<!-- ELSE -->{L_CURRENT_PASSWORD_EXPLAIN}<!-- ENDIF --></span></dt> - <dd><input type="password" name="cur_password" id="cur_password" maxlength="255" value="{CUR_PASSWORD}" class="inputbox" title="{L_CURRENT_PASSWORD}" /></dd> + <dd><input type="password" name="cur_password" id="cur_password" maxlength="255" value="{CUR_PASSWORD}" class="inputbox" title="{L_CURRENT_PASSWORD}" autocomplete="off" /></dd> </dl> </fieldset> diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index fc469eff36..655c0fc48c 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -7,13 +7,14 @@ */ function change_language(lang_iso) { + document.cookie = '{COOKIE_NAME}_lang=' + lang_iso + '; path={COOKIE_PATH}'; document.forms['register'].change_lang.value = lang_iso; document.forms['register'].submit.click(); } // ]]> </script> -<form method="post" action="{S_UCP_ACTION}" id="register"> +<form id="register" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}> <div class="panel"> <div class="inner"> @@ -25,25 +26,28 @@ <!-- IF L_REG_COND --> <dl><dd><strong>{L_REG_COND}</strong></dd></dl> <!-- ENDIF --> + <!-- EVENT ucp_register_credentials_before --> <dl> <dt><label for="username">{L_USERNAME}{L_COLON}</label><br /><span>{L_USERNAME_EXPLAIN}</span></dt> <dd><input type="text" tabindex="1" name="username" id="username" size="25" value="{USERNAME}" class="inputbox autowidth" title="{L_USERNAME}" /></dd> </dl> <dl> <dt><label for="email">{L_EMAIL_ADDRESS}{L_COLON}</label></dt> - <dd><input type="email" tabindex="2" name="email" id="email" size="25" maxlength="100" value="{EMAIL}" class="inputbox autowidth" title="{L_EMAIL_ADDRESS}" /></dd> + <dd><input type="email" tabindex="2" name="email" id="email" size="25" maxlength="100" value="{EMAIL}" class="inputbox autowidth" title="{L_EMAIL_ADDRESS}" autocomplete="off" /></dd> </dl> <dl> <dt><label for="new_password">{L_PASSWORD}{L_COLON}</label><br /><span>{L_PASSWORD_EXPLAIN}</span></dt> - <dd><input type="password" tabindex="4" name="new_password" id="new_password" size="25" value="{PASSWORD}" class="inputbox autowidth" title="{L_NEW_PASSWORD}" /></dd> + <dd><input type="password" tabindex="4" name="new_password" id="new_password" size="25" value="{PASSWORD}" class="inputbox autowidth" title="{L_NEW_PASSWORD}" autocomplete="off" /></dd> </dl> <dl> <dt><label for="password_confirm">{L_CONFIRM_PASSWORD}{L_COLON}</label></dt> - <dd><input type="password" tabindex="5" name="password_confirm" id="password_confirm" size="25" value="{PASSWORD_CONFIRM}" class="inputbox autowidth" title="{L_CONFIRM_PASSWORD}" /></dd> + <dd><input type="password" tabindex="5" name="password_confirm" id="password_confirm" size="25" value="{PASSWORD_CONFIRM}" class="inputbox autowidth" title="{L_CONFIRM_PASSWORD}" autocomplete="off" /></dd> </dl> + <!-- EVENT ucp_register_credentials_after --> <hr /> + <!-- EVENT ucp_register_options_before --> <dl> <dt><label for="lang">{L_LANGUAGE}{L_COLON}</label></dt> <dd><select name="lang" id="lang" onchange="change_language(this.value); return false;" tabindex="6" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select></dd> @@ -51,6 +55,7 @@ <!-- INCLUDE timezone_option.html --> + <!-- EVENT ucp_register_profile_fields_before --> <!-- IF .profile_fields --> <dl><dd><strong>{L_ITEMS_REQUIRED}</strong></dd></dl> @@ -64,6 +69,7 @@ <!-- END profile_fields --> <!-- ENDIF --> + <!-- EVENT ucp_register_profile_fields_after --> </fieldset> </div> </div> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index e4c0a40d3a..c17d99be74 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -1,7 +1,7 @@ <!-- INCLUDE overall_header.html --> -<!-- IF U_MCP or U_ACP --><p class="responsive-center">[ <!-- IF U_ACP --><a href="{U_ACP}" title="{L_ACP}" data-responsive-text="{L_ACP_SHORT}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}" title="{L_MCP}" data-responsive-text="{L_MCP_SHORT}">{L_MCP}</a><!-- ENDIF --> ]</p><!-- ENDIF --> -<h2><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2> - +<!-- EVENT viewforum_forum_title_before --> +<h2 class="forum-title"><!-- EVENT viewforum_forum_name_prepend --><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- EVENT viewforum_forum_name_append --></h2> +<!-- EVENT viewforum_forum_title_after --> <!-- IF FORUM_DESC or MODERATORS or U_MCP --> <div> <!-- NOTE: remove the style="display: none" when you want to have the forum description on the forum body --> @@ -11,7 +11,7 @@ <!-- ENDIF --> <!-- IF S_FORUM_RULES --> - <div class="rules"> + <div class="rules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <div class="inner"> <!-- IF U_FORUM_RULES --> @@ -27,28 +27,40 @@ <!-- IF S_HAS_SUBFORUM --> <!-- IF not S_IS_BOT and U_MARK_FORUMS --> -<ul class="linklist"> - <li class="rightside mark-read"><a href="{U_MARK_FORUMS}" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_SUBFORUMS_READ}</a></li> -</ul> + <div class="action-bar compact"> + <a href="{U_MARK_FORUMS}" class="mark-read rightside" data-ajax="mark_forums_read">{L_MARK_SUBFORUMS_READ}</a> + </div> <!-- ENDIF --> <!-- INCLUDE forumlist_body.html --> <!-- ENDIF --> <!-- IF S_DISPLAY_POST_INFO or .pagination or TOTAL_POSTS or TOTAL_TOPICS --> - <div class="topic-actions" <!-- IF S_HAS_SUBFORUM -->style="margin-top: 2em;"<!-- ENDIF -->> + <div class="action-bar bar-top"> <!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO --> - <div class="buttons"> - <div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF --></a></div> - </div> + <!-- EVENT viewforum_buttons_top_before --> + + <a href="{U_POST_NEW_TOPIC}" class="button" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"> + <!-- IF S_IS_LOCKED --> + <span>{L_BUTTON_FORUM_LOCKED}</span> <i class="icon fa-lock fa-fw" aria-hidden="true"></i> + <!-- ELSE --> + <span>{L_BUTTON_NEW_TOPIC}</span> <i class="icon fa-pencil fa-fw" aria-hidden="true"></i> + <!-- ENDIF --> + </a> + <!-- EVENT viewforum_buttons_top_after --> <!-- ENDIF --> <!-- IF S_DISPLAY_SEARCHBOX --> - <div class="search-box"> + <div class="search-box" role="search"> <form method="get" id="forum-search" action="{S_SEARCHBOX_ACTION}"> <fieldset> <input class="inputbox search tiny" type="search" name="keywords" id="search_keywords" size="20" placeholder="{L_SEARCH_FORUM}" /> - <input class="button2" type="submit" value="{L_SEARCH}" /> + <button class="button button-search" type="submit" title="{L_SEARCH}"> + <i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH}</span> + </button> + <a href="{U_SEARCH}" class="button button-search-end" title="{L_SEARCH_ADV}"> + <i class="icon fa-cog fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH_ADV}</span> + </a> {S_SEARCH_LOCAL_HIDDEN_FIELDS} </fieldset> </form> @@ -56,12 +68,12 @@ <!-- ENDIF --> <div class="pagination"> - <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> - {TOTAL_TOPICS} • + <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" class="mark" accesskey="m" data-ajax="mark_topics_read">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> + {TOTAL_TOPICS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> </div> @@ -93,7 +105,7 @@ </dl> <dl> <dt><label for="password">{L_PASSWORD}{L_COLON}</label></dt> - <dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" /></dd> + <dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" autocomplete="off" /></dd> <!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="3" /> {L_LOG_ME_IN}</label></dd><!-- ENDIF --> <dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="4" /> {L_HIDE_ME}</label></dd> </dl> @@ -127,7 +139,7 @@ <div class="inner"> <ul class="topiclist"> <li class="header"> - <dl class="icon"> + <dl class="row-item"> <dt<!-- IF S_DISPLAY_ACTIVE --> id="active_topics"<!-- ENDIF -->><div class="list-inner"><!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS}<!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS}<!-- ELSE -->{L_TOPICS}<!-- ENDIF --></div></dt> <dd class="posts">{L_REPLIES}</dd> <dd class="views">{L_VIEWS}</dd> @@ -138,57 +150,87 @@ <ul class="topiclist topics"> <!-- ENDIF --> + <!-- EVENT viewforum_body_topic_row_before --> <li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->"> - <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> + <!-- EVENT viewforum_body_topic_row_prepend --> + <dl class="row-item {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- EVENT topiclist_row_prepend --> <!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <a class="unread" href="{topicrow.U_NEWEST_POST}"> + <i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span> + </a> + <!-- ENDIF --> + <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> + <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> + <a href="{topicrow.U_MCP_QUEUE}" title="{TOPIC_UNAPPROVED}"> + <i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{TOPIC_UNAPPROVED}</span> + </a> + <!-- ENDIF --> + <!-- IF topicrow.S_TOPIC_DELETED --> + <a href="{topicrow.U_MCP_QUEUE}" title="{TOPIC_DELETED"> + <i class="icon fa-recycle fa-fw icon-green" aria-hidden="true"></i><span class="sr-only">{TOPIC_DELETED}</span> + </a> + <!-- ENDIF --> + <!-- IF topicrow.S_TOPIC_REPORTED --> + <a href="{topicrow.U_MCP_REPORT}" title="{TOPIC_REPORTED}"> + <i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{TOPIC_REPORTED}</span> + </a> + <!-- ENDIF --> + <br /> + + <!-- IF not S_IS_BOT --> + <div class="responsive-show" style="display: none;"> + {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> + <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --><br />{L_POSTED} {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> + </div> + <!-- IF topicrow.REPLIES --><span class="responsive-show left-box" style="display: none;">{L_REPLIES}{L_COLON} <strong>{topicrow.REPLIES}</strong></span><!-- ENDIF --> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_DELETED --><a href="{topicrow.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> + + <div class="responsive-hide"> + <!-- IF topicrow.S_HAS_POLL --><i class="icon fa-bar-chart fa-fw" aria-hidden="true"></i><!-- ENDIF --> + <!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i><!-- ENDIF --> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} + <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> + </div> + <!-- IF .topicrow.pagination --> <div class="pagination"> + <span><i class="icon fa-clone fa-fw" aria-hidden="true"></i></span> <ul> <!-- BEGIN pagination --> <!-- IF topicrow.pagination.S_IS_PREV --> <!-- ELSEIF topicrow.pagination.S_IS_CURRENT --><li class="active"><span>{topicrow.pagination.PAGE_NUMBER}</span></li> <!-- ELSEIF topicrow.pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> <!-- ELSEIF topicrow.pagination.S_IS_NEXT --> - <!-- ELSE --><li><a href="{topicrow.pagination.PAGE_URL}">{topicrow.pagination.PAGE_NUMBER}</a></li> + <!-- ELSE --><li><a class="button" href="{topicrow.pagination.PAGE_URL}">{topicrow.pagination.PAGE_NUMBER}</a></li> <!-- ENDIF --> <!-- END pagination --> </ul> </div> <!-- ENDIF --> - <div class="responsive-hide"> - <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <!-- IF not S_IS_BOT --><a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a><!-- ELSE -->{topicrow.FIRST_POST_TIME}<!-- ENDIF --> - <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> - </div> - <!-- IF not S_IS_BOT --> - <div class="responsive-show" style="display: none;"> - {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} « <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a> - <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --><br />{L_POSTED} {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> - <!-- IF topicrow.REPLIES --><br />{L_REPLIES}{L_COLON} <strong>{topicrow.REPLIES}</strong><!-- ENDIF --> - </div> - <!-- ENDIF --> <!-- EVENT topiclist_row_append --> </div> </dt> <dd class="posts">{topicrow.REPLIES} <dfn>{L_REPLIES}</dfn></dd> <dd class="views">{topicrow.VIEWS} <dfn>{L_VIEWS}</dfn></dd> - <dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} - <!-- IF not S_IS_BOT --><a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{topicrow.LAST_POST_TIME}</span> + <dd class="lastpost"> + <span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} + <!-- IF not S_IS_BOT --> + <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}"> + <i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span> + </a> + <!-- ENDIF --> + <br />{topicrow.LAST_POST_TIME} + </span> </dd> </dl> + <!-- EVENT viewforum_body_topic_row_append --> </li> + <!-- EVENT viewforum_body_topic_row_after --> <!-- IF topicrow.S_LAST_ROW --> </ul> @@ -206,37 +248,35 @@ <!-- ENDIF --> <!-- END topicrow --> -<!-- IF S_SELECT_SORT_DAYS and not S_DISPLAY_ACTIVE --> - <form method="post" action="{S_FORUM_ACTION}"> - <fieldset class="display-options"> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF not S_IS_BOT --> - <label>{L_DISPLAY_TOPICS}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> - <label>{S_SELECT_SORT_DIR}</label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - <!-- ENDIF --> - </fieldset> - </form> - <hr /> -<!-- ENDIF --> - <!-- IF .topicrow and not S_DISPLAY_ACTIVE --> - <div class="topic-actions"> + <div class="action-bar bar-bottom"> <!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO --> - <div class="buttons"> - <div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"><a href="{U_POST_NEW_TOPIC}"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF --></a></div> - </div> + <!-- EVENT viewforum_buttons_bottom_before --> + + <a href="{U_POST_NEW_TOPIC}" class="button" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"> + <!-- IF S_IS_LOCKED --> + <span>{L_BUTTON_FORUM_LOCKED}</span> <i class="icon fa-lock fa-fw" aria-hidden="true"></i> + <!-- ELSE --> + <span>{L_BUTTON_NEW_TOPIC}</span> <i class="icon fa-pencil fa-fw" aria-hidden="true"></i> + <!-- ENDIF --> + </a> + + <!-- EVENT viewforum_buttons_bottom_after --> + <!-- ENDIF --> + + <!-- IF S_SELECT_SORT_DAYS and not S_IS_BOT --> + <form method="post" action="{S_FORUM_ACTION}"> + <!-- INCLUDE display_options.html --> + </form> <!-- ENDIF --> <div class="pagination"> - <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> - {TOTAL_TOPICS} • + <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> + {TOTAL_TOPICS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> </div> </div> @@ -245,13 +285,17 @@ <!-- INCLUDE jumpbox.html --> <!-- IF S_DISPLAY_ONLINE_LIST --> - <h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3> - <p>{LOGGED_IN_USER_LIST}</p> + <div class="stat-block online-list"> + <h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3> + <p>{LOGGED_IN_USER_LIST}</p> + </div> <!-- ENDIF --> <!-- IF S_DISPLAY_POST_INFO --> - <h3>{L_FORUM_PERMISSIONS}</h3> - <p><!-- BEGIN rules -->{rules.RULE}<br /><!-- END rules --></p> + <div class="stat-block permissions"> + <h3>{L_FORUM_PERMISSIONS}</h3> + <p><!-- BEGIN rules -->{rules.RULE}<br /><!-- END rules --></p> + </div> <!-- ENDIF --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/viewonline_body.html b/phpBB/styles/prosilver/template/viewonline_body.html index 13f459b57f..52733afbcf 100644 --- a/phpBB/styles/prosilver/template/viewonline_body.html +++ b/phpBB/styles/prosilver/template/viewonline_body.html @@ -1,17 +1,17 @@ <!-- INCLUDE overall_header.html --> -<h2>{TOTAL_REGISTERED_USERS_ONLINE}</h2> +<h2 class="viewonline-title">{TOTAL_REGISTERED_USERS_ONLINE}</h2> <p>{TOTAL_GUEST_USERS_ONLINE}<!-- IF S_SWITCH_GUEST_DISPLAY --> • <a href="{U_SWITCH_GUEST_DISPLAY}">{L_SWITCH_GUEST_DISPLAY}</a><!-- ENDIF --></p> -<ul class="linklist"> - <li class="rightside pagination"> +<div class="action-bar bar-top"> + <div class="pagination"> <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> - </li> -</ul> + </div> +</div> <div class="forumbg forumbg-table"> <div class="inner"> @@ -47,23 +47,17 @@ </div> </div> -<!-- IF U_PREVIOUS_PAGE or U_NEXT_PAGE --> -<fieldset class="display-options right-box"> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ELSE -->{L_PREVIOUS}<!-- ENDIF --> • <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ELSE -->{L_NEXT}<!-- ENDIF --> -</fieldset> -<!-- ENDIF --> - <!-- IF LEGEND --><p><em>{L_LEGEND}{L_COLON} {LEGEND}</em></p><!-- ENDIF --> -<ul class="linklist"> - <li class="rightside pagination"> +<div class="action-bar bar-bottom"> + <div class="pagination"> <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> - </li> -</ul> + </div> +</div> <!-- INCLUDE jumpbox.html --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/viewonline_whois.html b/phpBB/styles/prosilver/template/viewonline_whois.html index 8abd933efa..5d780490da 100644 --- a/phpBB/styles/prosilver/template/viewonline_whois.html +++ b/phpBB/styles/prosilver/template/viewonline_whois.html @@ -4,11 +4,7 @@ <div class="panel"> <div class="inner"> - - <div class="postbody"><div class="content"> - <pre>{WHOIS}</pre> - </div></div> - + <pre>{WHOIS}</pre> </div> </div> <a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index d5c45e1dfe..0df6956181 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -1,6 +1,7 @@ <!-- INCLUDE overall_header.html --> -<!-- IF U_MCP or U_ACP --><p class="responsive-center">[ <!-- IF U_ACP --><a href="{U_ACP}" title="{L_ACP}" data-responsive-text="{L_ACP_SHORT}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}" title="{L_MCP}" data-responsive-text="{L_MCP_SHORT}">{L_MCP}</a><!-- ENDIF --> ]</p><!-- ENDIF --> -<h2><!-- EVENT viewtopic_topic_title_prepend --><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2> + +<h2 class="topic-title"><!-- EVENT viewtopic_topic_title_prepend --><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><!-- EVENT viewtopic_topic_title_append --></h2> +<!-- EVENT viewtopic_topic_title_after --> <!-- NOTE: remove the style="display: none" when you want to have the forum description on the topic body --> <!-- IF FORUM_DESC --><div style="display: none !important;">{FORUM_DESC}<br /></div><!-- ENDIF --> @@ -11,7 +12,7 @@ <!-- ENDIF --> <!-- IF S_FORUM_RULES --> - <div class="rules"> + <div class="rules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <div class="inner"> <!-- IF U_FORUM_RULES --> @@ -25,22 +26,34 @@ </div> <!-- ENDIF --> -<div class="topic-actions"> +<div class="action-bar bar-top"> + <!-- EVENT viewtopic_buttons_top_before --> - <div class="buttons"> <!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO --> - <div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->"><a href="{U_POST_REPLY_TOPIC}" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF --></a></div> + <a href="{U_POST_REPLY_TOPIC}" class="button" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"> + <!-- IF S_IS_LOCKED --> + <span>{L_BUTTON_TOPIC_LOCKED}</span> <i class="icon fa-lock fa-fw" aria-hidden="true"></i> + <!-- ELSE --> + <span>{L_BUTTON_POST_REPLY}</span> <i class="icon fa-reply fa-fw" aria-hidden="true"></i> + <!-- ENDIF --> + </a> <!-- ENDIF --> - </div> + <!-- EVENT viewtopic_buttons_top_after --> <!-- INCLUDE viewtopic_topic_tools.html --> + <!-- EVENT viewtopic_dropdown_top_custom --> <!-- IF S_DISPLAY_SEARCHBOX --> - <div class="search-box"> + <div class="search-box" role="search"> <form method="get" id="topic-search" action="{S_SEARCHBOX_ACTION}"> <fieldset> <input class="inputbox search tiny" type="search" name="keywords" id="search_keywords" size="20" placeholder="{L_SEARCH_TOPIC}" /> - <input class="button2" type="submit" value="{L_SEARCH}" /> + <button class="button button-search" type="submit" title="{L_SEARCH}"> + <i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH}</span> + </button> + <a href="{U_SEARCH}" class="button button-search-end" title="{L_SEARCH_ADV}"> + <i class="icon fa-cog fa-fw" aria-hidden="true"></i><span class="sr-only">{L_SEARCH_ADV}</span> + </a> {S_SEARCH_LOCAL_HIDDEN_FIELDS} </fieldset> </form> @@ -49,17 +62,19 @@ <!-- IF .pagination or TOTAL_POSTS --> <div class="pagination"> - <!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->{TOTAL_POSTS} • + <!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}" class="mark">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->{TOTAL_POSTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> </div> <!-- ENDIF --> - <div class="clear"></div> + <!-- EVENT viewtopic_body_pagination_top_after --> </div> +<!-- EVENT viewtopic_body_poll_before --> + <!-- IF S_HAS_POLL --> <form method="post" action="{S_POLL_ACTION}" data-ajax="vote_poll" class="topic_poll"> @@ -67,17 +82,19 @@ <div class="inner"> <div class="content"> - <h2>{POLL_QUESTION}</h2> + <h2 class="poll-title"><!-- EVENT viewtopic_body_poll_question_prepend -->{POLL_QUESTION}<!-- EVENT viewtopic_body_poll_question_append --></h2> <p class="author">{L_POLL_LENGTH}<!-- IF S_CAN_VOTE and L_POLL_LENGTH --><br /><!-- ENDIF --><!-- IF S_CAN_VOTE --><span class="poll_max_votes">{L_MAX_VOTES}</span><!-- ENDIF --></p> <fieldset class="polls"> <!-- BEGIN poll_option --> - <dl class="<!-- IF poll_option.POLL_OPTION_VOTED -->voted<!-- ENDIF -->"<!-- IF poll_option.POLL_OPTION_VOTED --> title="{L_POLL_VOTED_OPTION}"<!-- ENDIF --> data-poll-option-id="{poll_option.POLL_OPTION_ID}"> + <!-- EVENT viewtopic_body_poll_option_before --> + <dl class="<!-- IF poll_option.POLL_OPTION_VOTED -->voted<!-- ENDIF --><!-- IF poll_option.POLL_OPTION_MOST_VOTES --> most-votes<!-- ENDIF -->"<!-- IF poll_option.POLL_OPTION_VOTED --> title="{L_POLL_VOTED_OPTION}"<!-- ENDIF --> data-alt-text="{L_POLL_VOTED_OPTION}" data-poll-option-id="{poll_option.POLL_OPTION_ID}"> <dt><!-- IF S_CAN_VOTE --><label for="vote_{poll_option.POLL_OPTION_ID}">{poll_option.POLL_OPTION_CAPTION}</label><!-- ELSE -->{poll_option.POLL_OPTION_CAPTION}<!-- ENDIF --></dt> <!-- IF S_CAN_VOTE --><dd style="width: auto;" class="poll_option_select"><!-- IF S_IS_MULTI_CHOICE --><input type="checkbox" name="vote_id[]" id="vote_{poll_option.POLL_OPTION_ID}" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /><!-- ELSE --><input type="radio" name="vote_id[]" id="vote_{poll_option.POLL_OPTION_ID}" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /><!-- ENDIF --></dd><!-- ENDIF --> - <dd class="resultbar<!-- IF not S_DISPLAY_RESULTS --> hidden<!-- ENDIF -->"><div class="<!-- IF poll_option.POLL_OPTION_PCT < 20 -->pollbar1<!-- ELSEIF poll_option.POLL_OPTION_PCT < 40 -->pollbar2<!-- ELSEIF poll_option.POLL_OPTION_PCT < 60 -->pollbar3<!-- ELSEIF poll_option.POLL_OPTION_PCT < 80 -->pollbar4<!-- ELSE -->pollbar5<!-- ENDIF -->" style="width:{poll_option.POLL_OPTION_PERCENT};">{poll_option.POLL_OPTION_RESULT}</div></dd> + <dd class="resultbar<!-- IF not S_DISPLAY_RESULTS --> hidden<!-- ENDIF -->"><div class="<!-- IF poll_option.POLL_OPTION_PCT < 20 -->pollbar1<!-- ELSEIF poll_option.POLL_OPTION_PCT < 40 -->pollbar2<!-- ELSEIF poll_option.POLL_OPTION_PCT < 60 -->pollbar3<!-- ELSEIF poll_option.POLL_OPTION_PCT < 80 -->pollbar4<!-- ELSE -->pollbar5<!-- ENDIF -->" style="width:{poll_option.POLL_OPTION_PERCENT_REL};">{poll_option.POLL_OPTION_RESULT}</div></dd> <dd class="poll_option_percent<!-- IF not S_DISPLAY_RESULTS --> hidden<!-- ENDIF -->"><!-- IF poll_option.POLL_OPTION_RESULT == 0 -->{L_NO_VOTES}<!-- ELSE -->{poll_option.POLL_OPTION_PERCENT}<!-- ENDIF --></dd> </dl> + <!-- EVENT viewtopic_body_poll_option_after --> <!-- END poll_option --> <dl class="poll_total_votes<!-- IF not S_DISPLAY_RESULTS --> hidden<!-- ENDIF -->"> @@ -111,24 +128,37 @@ <hr /> <!-- ENDIF --> +<!-- EVENT viewtopic_body_poll_after --> + <!-- BEGIN postrow --> <!-- EVENT viewtopic_body_postrow_post_before --> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread"></a><!-- ENDIF --> - <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF -->"> + <!-- IF postrow.S_FIRST_UNREAD --> + <a id="unread" class="anchor"<!-- IF S_UNREAD_VIEW --> data-url="{postrow.U_MINI_POST}"<!-- ENDIF -->></a> + <!-- ENDIF --> + <div id="p{postrow.POST_ID}" class="post has-profile <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->"> <div class="inner"> <dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->> - <dt class="<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF -->"> - <!-- IF postrow.POSTER_AVATAR --> - <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="avatar">{postrow.POSTER_AVATAR}</a><!-- ELSE --><span class="avatar">{postrow.POSTER_AVATAR}</span><!-- ENDIF --> - <!-- ENDIF --> + <dt class="<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF --> <!-- IF postrow.POSTER_AVATAR -->has-avatar<!-- ELSE -->no-avatar<!-- ENDIF -->"> + <div class="avatar-container"> + <!-- EVENT viewtopic_body_avatar_before --> + <!-- IF postrow.POSTER_AVATAR --> + <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="avatar">{postrow.POSTER_AVATAR}</a><!-- ELSE --><span class="avatar">{postrow.POSTER_AVATAR}</span><!-- ENDIF --> + <!-- ENDIF --> + <!-- EVENT viewtopic_body_avatar_after --> + </div> + <!-- EVENT viewtopic_body_post_author_before --> <!-- IF not postrow.U_POST_AUTHOR --><strong>{postrow.POST_AUTHOR_FULL}</strong><!-- ELSE -->{postrow.POST_AUTHOR_FULL}<!-- ENDIF --> + <!-- EVENT viewtopic_body_post_author_after --> </dt> + <!-- EVENT viewtopic_body_postrow_rank_before --> <!-- IF postrow.RANK_TITLE or postrow.RANK_IMG --><dd class="profile-rank">{postrow.RANK_TITLE}<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br /><!-- ENDIF -->{postrow.RANK_IMG}</dd><!-- ENDIF --> + <!-- EVENT viewtopic_body_postrow_rank_after --> - <!-- IF postrow.POSTER_POSTS != '' --><dd><strong>{L_POSTS}{L_COLON}</strong> {postrow.POSTER_POSTS}</dd><!-- ENDIF --> - <!-- IF postrow.POSTER_JOINED --><dd><strong>{L_JOINED}{L_COLON}</strong> {postrow.POSTER_JOINED}</dd><!-- ENDIF --> + <!-- IF postrow.POSTER_POSTS != '' --><dd class="profile-posts"><strong>{L_POSTS}{L_COLON}</strong> <!-- IF postrow.U_SEARCH !== '' --><a href="{postrow.U_SEARCH}"><!-- ENDIF -->{postrow.POSTER_POSTS}<!-- IF postrow.U_SEARCH !== '' --></a><!-- ENDIF --></dd><!-- ENDIF --> + <!-- IF postrow.POSTER_JOINED --><dd class="profile-joined"><strong>{L_JOINED}{L_COLON}</strong> {postrow.POSTER_JOINED}</dd><!-- ENDIF --> + <!-- IF postrow.POSTER_WARNINGS --><dd class="profile-warnings"><strong>{L_WARNINGS}{L_COLON}</strong> {postrow.POSTER_WARNINGS}</dd><!-- ENDIF --> <!-- IF postrow.S_PROFILE_FIELD1 --> <!-- Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. --> @@ -137,26 +167,42 @@ <!-- EVENT viewtopic_body_postrow_custom_fields_before --> <!-- BEGIN custom_fields --> - <dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON}</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd> + <!-- IF not postrow.custom_fields.S_PROFILE_CONTACT --> + <dd class="profile-custom-field profile-{postrow.custom_fields.PROFILE_FIELD_IDENT}"><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON}</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd> + <!-- ENDIF --> <!-- END custom_fields --> <!-- EVENT viewtopic_body_postrow_custom_fields_after --> - <!-- IF not S_IS_BOT --> - <!-- IF postrow.U_PM or postrow.U_EMAIL or postrow.U_WWW or postrow.U_MSN or postrow.U_ICQ or postrow.U_YIM or postrow.U_AIM or postrow.U_JABBER --> - <dd> - <ul class="profile-icons"> - <!-- IF postrow.U_PM --><li class="pm-icon"><a href="{postrow.U_PM}" title="{L_PRIVATE_MESSAGE}"><span>{L_PRIVATE_MESSAGE}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_EMAIL --><li class="email-icon"><a href="{postrow.U_EMAIL}" title="{L_SEND_EMAIL_USER} {postrow.POST_AUTHOR}"><span>{L_SEND_EMAIL_USER} {postrow.POST_AUTHOR}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_WWW --><li class="web-icon"><a href="{postrow.U_WWW}" title="{L_VISIT_WEBSITE}{L_COLON} {postrow.U_WWW}"><span>{L_WEBSITE}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_MSN --><li class="msnm-icon"><a href="{postrow.U_MSN}" onclick="popup(this.href, 550, 320); return false;" title="{L_MSNM}"><span>{L_MSNM}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_ICQ --><li class="icq-icon"><a href="{postrow.U_ICQ}" onclick="popup(this.href, 550, 320); return false;" title="{L_ICQ}"><span>{L_ICQ}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_YIM --><li class="yahoo-icon"><a href="{postrow.U_YIM}" onclick="popup(this.href, 780, 550); return false;" title="{L_YIM}"><span>{L_YIM}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_AIM --><li class="aim-icon"><a href="{postrow.U_AIM}" onclick="popup(this.href, 550, 320); return false;" title="{L_AIM}"><span>{L_AIM}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_JABBER --><li class="jabber-icon"><a href="{postrow.U_JABBER}" onclick="popup(this.href, 550, 320); return false;" title="{L_JABBER}"><span>{L_JABBER}</span></a></li><!-- ENDIF --> - </ul> + <!-- EVENT viewtopic_body_contact_fields_before --> + <!-- IF not S_IS_BOT and .postrow.contact --> + <dd class="profile-contact"> + <strong>{L_CONTACT}{L_COLON}</strong> + <div class="dropdown-container dropdown-left"> + <a href="#" class="dropdown-trigger" title="{postrow.CONTACT_USER}"> + <i class="icon fa-commenting-o fa-fw icon-lg" aria-hidden="true"></i><span class="sr-only">{postrow.CONTACT_USER}</span> + </a> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <div class="dropdown-contents contact-icons"> + <!-- BEGIN contact --> + {% set REMAINDER = postrow.contact.S_ROW_COUNT % 4 %} + <!-- DEFINE $S_LAST_CELL = ((REMAINDER eq 3) or (postrow.contact.S_LAST_ROW and postrow.contact.S_NUM_ROWS < 4)) --> + <!-- IF REMAINDER eq 0 --> + <div> + <!-- ENDIF --> + <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.U_POST_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF postrow.contact.ID eq 'jabber' --> onclick="popup(this.href, 750, 320); return false;"<!-- ENDIF -->> + <span class="contact-icon {postrow.contact.ID}-icon">{postrow.contact.NAME}</span> + </a> + <!-- IF REMAINDER eq 3 or postrow.contact.S_LAST_ROW --> + </div> + <!-- ENDIF --> + <!-- END contact --> + </div> + </div> + </div> </dd> <!-- ENDIF --> - <!-- ENDIF --> + <!-- EVENT viewtopic_body_contact_fields_after --> </dl> @@ -176,29 +222,81 @@ <!-- ENDIF --> <div id="post_content{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->> - <h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3> + <!-- EVENT viewtopic_body_post_subject_before --> + <h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="{postrow.POST_ICON_IMG_ALT}" title="{postrow.POST_ICON_IMG_ALT}" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3> + <!-- DEFINE $SHOW_POST_BUTTONS = (postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE) --> + <!-- EVENT viewtopic_body_post_buttons_list_before --> <!-- IF not S_IS_BOT --> - <!-- IF postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE --> - <ul class="profile-icons"> + <!-- IF $SHOW_POST_BUTTONS --> + <ul class="post-buttons"> <!-- EVENT viewtopic_body_post_buttons_before --> - <!-- IF postrow.U_EDIT --><li class="edit-icon"><a href="{postrow.U_EDIT}" title="{L_EDIT_POST}"><span>{L_EDIT_POST}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_DELETE --><li class="delete-icon"><a href="{postrow.U_DELETE}" title="{L_DELETE_POST}"><span>{L_DELETE_POST}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_REPORT --><li class="report-icon"><a href="{postrow.U_REPORT}" title="{L_REPORT_POST}"><span>{L_REPORT_POST}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_WARN --><li class="warn-icon"><a href="{postrow.U_WARN}" title="{L_WARN_USER}"><span>{L_WARN_USER}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_INFO --><li class="info-icon"><a href="{postrow.U_INFO}" title="{L_INFORMATION}"><span>{L_INFORMATION}</span></a></li><!-- ENDIF --> - <!-- IF postrow.U_QUOTE --><li class="quote-icon"><a href="{postrow.U_QUOTE}" title="{L_REPLY_WITH_QUOTE}"><span>{L_REPLY_WITH_QUOTE}</span></a></li><!-- ENDIF --> + <!-- IF postrow.U_EDIT --> + <li> + <a href="{postrow.U_EDIT}" title="{L_EDIT_POST}" class="button button-icon-only"> + <i class="icon fa-pencil fa-fw" aria-hidden="true"></i><span class="sr-only">{L_BUTTON_EDIT}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF postrow.U_DELETE --> + <li> + <a href="{postrow.U_DELETE}" title="{L_DELETE_POST}" class="button button-icon-only"> + <i class="icon fa-times fa-fw" aria-hidden="true"></i><span class="sr-only">{L_DELETE_POST}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF postrow.U_REPORT --> + <li> + <a href="{postrow.U_REPORT}" title="{L_REPORT_POST}" class="button button-icon-only"> + <i class="icon fa-exclamation fa-fw" aria-hidden="true"></i><span class="sr-only">{L_REPORT_POST}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF postrow.U_WARN --> + <li> + <a href="{postrow.U_WARN}" title="{L_WARN_USER}" class="button button-icon-only"> + <i class="icon fa-exclamation-triangle fa-fw" aria-hidden="true"></i><span class="sr-only">{L_WARN_USER}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF postrow.U_INFO --> + <li> + <a href="{postrow.U_INFO}" title="{L_INFORMATION}" class="button button-icon-only"> + <i class="icon fa-info fa-fw" aria-hidden="true"></i><span class="sr-only">{L_INFORMATION}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF postrow.U_QUOTE --> + <li> + <a href="{postrow.U_QUOTE}" title="{L_REPLY_WITH_QUOTE}" class="button button-icon-only"> + <i class="icon fa-quote-left fa-fw" aria-hidden="true"></i><span class="sr-only">{L_QUOTE}</span> + </a> + </li> + <!-- ENDIF --> <!-- EVENT viewtopic_body_post_buttons_after --> </ul> <!-- ENDIF --> <!-- ENDIF --> - - <p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF --><span class="responsive-hide">{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> » </span>{postrow.POST_DATE} </p> + <!-- EVENT viewtopic_body_post_buttons_list_after --> + + <!-- EVENT viewtopic_body_postrow_post_details_before --> + <p class="author"> + <!-- IF S_IS_BOT --> + <span><i class="icon fa-file fa-fw <!-- IF postrow.S_UNREAD_POST -->icon-red<!-- ELSE -->icon-lightgray<!-- ENDIF --> icon-md" aria-hidden="true"></i><span class="sr-only">{postrow.MINI_POST}</span></span> + <!-- ELSE --> + <a class="unread" href="{postrow.U_MINI_POST}" title="{postrow.MINI_POST}"> + <i class="icon fa-file fa-fw <!-- IF postrow.S_UNREAD_POST -->icon-red<!-- ELSE -->icon-lightgray<!-- ENDIF --> icon-md" aria-hidden="true"></i><span class="sr-only">{postrow.MINI_POST}</span> + </a> + <!-- ENDIF --> + <span class="responsive-hide">{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> » </span>{postrow.POST_DATE} + </p> + <!-- EVENT viewtopic_body_postrow_post_details_after --> <!-- IF postrow.S_POST_UNAPPROVED --> <form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}"> <p class="post-notice unapproved"> - <strong>{L_POST_UNAPPROVED}</strong> + <span><i class="icon fa-question icon-red fa-fw" aria-hidden="true"></i></span> + <strong>{L_POST_UNAPPROVED_ACTION}</strong> <input class="button2" type="submit" value="{L_DISAPPROVE}" name="action[disapprove]" /> <input class="button1" type="submit" value="{L_APPROVE}" name="action[approve]" /> <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" /> @@ -208,8 +306,10 @@ <!-- ELSEIF postrow.S_POST_DELETED --> <form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}"> <p class="post-notice deleted"> - <strong>{L_POST_DELETED}</strong> - <input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" /> + <strong>{L_POST_DELETED_ACTION}</strong> + <!-- IF postrow.S_DELETE_PERMANENT --> + <input class="button2" type="submit" value="{L_DELETE}" name="action[delete]" /> + <!-- ENDIF --> <input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" /> <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" /> {S_FORM_TOKEN} @@ -219,7 +319,7 @@ <!-- IF postrow.S_POST_REPORTED --> <p class="post-notice reported"> - <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a> + <a href="{postrow.U_MCP_REPORT}"><i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><strong>{L_POST_REPORTED}</strong></a> </p> <!-- ENDIF --> @@ -229,16 +329,6 @@ <dl class="attachbox"> <dt> {L_ATTACHMENTS} - <!-- IF postrow.S_MULTIPLE_ATTACHMENTS --> - <div class="dl_links"> - <strong>{L_DOWNLOAD_ALL}{L_COLON}</strong> - <ul> - <!-- BEGIN dl_method --> - <li>[ <a href="{postrow.dl_method.LINK}">{postrow.dl_method.TYPE}</a> ]</li> - <!-- END dl_method --> - </ul> - </div> - <!-- ENDIF --> </dt> <!-- BEGIN attachment --> <dd>{postrow.attachment.DISPLAY_ATTACHMENT}</dd> @@ -246,6 +336,7 @@ </dl> <!-- ENDIF --> + <!-- EVENT viewtopic_body_postrow_post_notices_before --> <!-- IF postrow.S_DISPLAY_NOTICE --><div class="rules">{L_DOWNLOAD_NOTICE}</div><!-- ENDIF --> <!-- IF postrow.DELETED_MESSAGE or postrow.DELETE_REASON --> <div class="notice post_deleted_msg"> @@ -260,12 +351,24 @@ <!-- ENDIF --> <!-- IF postrow.BUMPED_MESSAGE --><div class="notice"><br /><br />{postrow.BUMPED_MESSAGE}</div><!-- ENDIF --> + <!-- EVENT viewtopic_body_postrow_post_notices_after --> <!-- IF postrow.SIGNATURE --><div id="sig{postrow.POST_ID}" class="signature">{postrow.SIGNATURE}</div><!-- ENDIF --> + + <!-- EVENT viewtopic_body_postrow_post_content_footer --> </div> </div> - <div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div> + <!-- EVENT viewtopic_body_postrow_back2top_before --> + <div class="back2top"> + <!-- EVENT viewtopic_body_postrow_back2top_prepend --> + <a href="#top" class="top" title="{L_BACK_TO_TOP}"> + <i class="icon fa-chevron-circle-up fa-fw icon-gray" aria-hidden="true"></i> + <span class="sr-only">{L_BACK_TO_TOP}</span> + </a> + <!-- EVENT viewtopic_body_postrow_back2top_append --> + </div> + <!-- EVENT viewtopic_body_postrow_back2top_after --> </div> </div> @@ -273,70 +376,74 @@ <hr class="divider" /> <!-- EVENT viewtopic_body_postrow_post_after --> <!-- END postrow --> + <!-- IF S_QUICK_REPLY --> <!-- INCLUDE quickreply_editor.html --> <!-- ENDIF --> -<!-- IF S_NUM_POSTS > 1 or U_PREVIOUS_PAGE or U_NEXT_PAGE --> - <form id="viewtopic" method="post" action="{S_TOPIC_ACTION}"> - - <fieldset class="display-options" style="margin-top: 0; "> - <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF not S_IS_BOT --> - <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> - <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> <label>{S_SELECT_SORT_DIR}</label> - <input type="submit" name="sort" value="{L_GO}" class="button2" /> - <!-- ENDIF --> - </fieldset> - - </form> - <hr /> -<!-- ENDIF --> <!-- EVENT viewtopic_body_topic_actions_before --> -<div class="topic-actions"> - <div class="buttons"> + <div class="action-bar bar-bottom"> + <!-- EVENT viewtopic_buttons_bottom_before --> + <!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO --> - <div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->"><a href="{U_POST_REPLY_TOPIC}" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF --></a></div> + <a href="{U_POST_REPLY_TOPIC}" class="button" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"> + <!-- IF S_IS_LOCKED --> + <span>{L_BUTTON_TOPIC_LOCKED}</span> <i class="icon fa-lock fa-fw" aria-hidden="true"></i> + <!-- ELSE --> + <span>{L_BUTTON_POST_REPLY}</span> <i class="icon fa-reply fa-fw" aria-hidden="true"></i> + <!-- ENDIF --> + </a> <!-- ENDIF --> - </div> + <!-- EVENT viewtopic_buttons_bottom_after --> <!-- INCLUDE viewtopic_topic_tools.html --> + <!-- IF (S_NUM_POSTS > 1 or .pagination) and not S_IS_BOT --> + <form method="post" action="{S_TOPIC_ACTION}"> + <!-- INCLUDE display_options.html --> + </form> + <!-- ENDIF --> + + <!-- IF .quickmod --> + <div class="quickmod dropdown-container dropdown-container-left dropdown-up dropdown-{S_CONTENT_FLOW_END} dropdown-button-control" id="quickmod"> + <span title="{L_QUICK_MOD}" class="button button-secondary dropdown-trigger dropdown-select"> + <i class="icon fa-gavel fa-fw" aria-hidden="true"></i><span class="sr-only">{L_QUICK_MOD}</span> + <span class="caret"><i class="icon fa-sort-down fa-fw" aria-hidden="true"></i></span> + </span> + <div class="dropdown"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents"> + <!-- BEGIN quickmod --> + <!-- DEFINE $QUICKMOD_AJAX = (quickmod.VALUE in ['lock', 'unlock', 'delete_topic', 'restore_topic', 'make_normal', 'make_sticky', 'make_announce', 'make_global']) --> + <li><a href="{quickmod.LINK}"<!-- IF $QUICKMOD_AJAX --> data-ajax="true" data-refresh="true"<!-- ENDIF -->>{quickmod.TITLE}</a></li> + <!-- END quickmod --> + </ul> + </div> + </div> + <!-- ENDIF --> + + <!-- EVENT viewtopic_dropdown_bottom_custom --> + <!-- IF .pagination or TOTAL_POSTS --> <div class="pagination"> - {TOTAL_POSTS} • + {TOTAL_POSTS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> - {PAGE_NUMBER} + • {PAGE_NUMBER} <!-- ENDIF --> </div> <!-- ENDIF --> - <div class="clear"></div> </div> <!-- EVENT viewtopic_body_footer_before --> <!-- INCLUDE jumpbox.html --> -<!-- IF .quickmod --> - <form method="post" action="{S_MOD_ACTION}" id="quickmodform"> - <fieldset class="quickmod"> - <label for="quick-mod-select">{L_QUICK_MOD}{L_COLON}</label> - <select name="action" id="quick-mod-select"> - <!-- BEGIN quickmod --> - <option value="{quickmod.VALUE}">{quickmod.TITLE}</option> - <!-- END quickmod --> - </select> - <input type="submit" value="{L_GO}" class="button2" /> - {S_FORM_TOKEN} - </fieldset> - </form> -<!-- ENDIF --> - <!-- IF S_DISPLAY_ONLINE_LIST --> - <h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3> - <p>{LOGGED_IN_USER_LIST}</p> + <div class="stat-block online-list"> + <h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3> + <p>{LOGGED_IN_USER_LIST}</p> + </div> <!-- ENDIF --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 6c4dcfadf1..796111dd3c 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -1,17 +1,17 @@ <!DOCTYPE html> <html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> <head> -<meta charset="utf-8"> +<meta charset="utf-8" /> <meta name="robots" content="noindex" /> {META} <title>{SITENAME} • {PAGE_TITLE}</title> -<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" /> +<link href="{T_THEME_PATH}/print.css" rel="stylesheet"> <!-- EVENT viewtopic_print_head_append --> </head> <body id="phpbb"> -<div id="wrap"> - <a id="top" accesskey="t"></a> +<div id="wrap" class="wrap"> + <a id="top" class="top-anchor" accesskey="t"></a> <div id="page-header"> <h1>{SITENAME}</h1> @@ -21,7 +21,7 @@ <p><a href="{U_TOPIC}">{U_TOPIC}</a></p> </div> - <div id="page-body"> + <div id="page-body" class="page-body"> <div class="page-number">{PAGE_NUMBER}</div> <!-- BEGIN postrow --> <div class="post"> @@ -34,9 +34,9 @@ <!-- END postrow --> </div> - <div id="page-footer"> + <div id="page-footer" class="page-footer"> <div class="page-number">{S_TIMEZONE}<br />{PAGE_NUMBER}</div> - <div class="copyright">Powered by phpBB® Forum Software © phpBB Group<br />https://www.phpbb.com/</div> + <div class="copyright">Powered by phpBB® Forum Software © phpBB Limited<br />https://www.phpbb.com/</div> </div> </div> diff --git a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html index ec17185bae..96c514f1d9 100644 --- a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html +++ b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html @@ -1,36 +1,47 @@ -<!-- IF not S_IS_BOT and (U_WATCH_TOPIC or U_BOOKMARK_TOPIC or U_BUMP_TOPIC or S_HAS_ATTACHMENTS or S_DISPLAY_TOPIC_TOOLS) --> +<!-- IF not S_IS_BOT and (U_WATCH_TOPIC or U_BOOKMARK_TOPIC or U_BUMP_TOPIC or U_EMAIL_TOPIC or U_PRINT_TOPIC or S_DISPLAY_TOPIC_TOOLS) --> <div class="dropdown-container dropdown-button-control topic-tools"> - <span title="{L_TOPIC_TOOLS}" class="dropdown-trigger dropdown-select dropdown-select-icon tools-icon"><span></span></span> - <div class="dropdown hidden"> + <span title="{L_PM_TOOLS}" class="button button-secondary dropdown-trigger dropdown-select"> + <i class="icon fa-wrench fa-fw" aria-hidden="true"></i> + <span class="caret"><i class="icon fa-sort-down fa-fw" aria-hidden="true"></i></span> + </span> + <div class="dropdown"> <div class="pointer"><div class="pointer-inner"></div></div> <ul class="dropdown-contents"> <!-- EVENT viewtopic_topic_tools_before --> <!-- IF U_WATCH_TOPIC --> - <li class="small-icon icon-<!-- IF S_WATCHING_TOPIC -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->"> - <a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="small-icon icon-<!-- IF not S_WATCHING_TOPIC -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}"> - {S_WATCH_TOPIC_TITLE} + <li> + <a href="{U_WATCH_TOPIC}" class="watch-topic-link" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="icon <!-- IF S_WATCHING_TOPIC -->fa-check-square-o<!-- ELSE -->fa-square-o<!-- ENDIF --> fa-fw" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}" data-update-all=".watch-topic-link"> + <i class="icon <!-- IF S_WATCHING_FORUM -->fa-square-o<!-- ELSE -->fa-check-square-o<!-- ENDIF --> fa-fw" aria-hidden="true"></i><span>{S_WATCH_TOPIC_TITLE}</span> </a> </li> <!-- ENDIF --> <!-- IF U_BOOKMARK_TOPIC --> - <li class="small-icon icon-bookmark"> - <a href="{U_BOOKMARK_TOPIC}" title="{L_BOOKMARK_TOPIC}" data-ajax="alt_text" data-alt-text="{S_BOOKMARK_TOGGLE}"> - {S_BOOKMARK_TOPIC} + <li> + <a href="{U_BOOKMARK_TOPIC}" class="bookmark-link" title="{L_BOOKMARK_TOPIC}" data-ajax="alt_text" data-alt-text="{S_BOOKMARK_TOGGLE}" data-update-all=".bookmark-link"> + <i class="icon fa-bookmark-o fa-fw" aria-hidden="true"></i><span>{S_BOOKMARK_TOPIC}</span> </a> </li> <!-- ENDIF --> - <!-- IF U_BUMP_TOPIC --><li class="small-icon icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF --> - <!-- IF S_HAS_ATTACHMENTS --> - <li class="small-icon icon-download"> - <a class="dropdown-toggle-submenu" href="{U_DOWNLOAD_ALL_ATTACHMENTS}" title="{L_DOWNLOAD_ALL_ATTACHMENTS}">{L_DOWNLOAD_ALL_ATTACHMENTS}</a> - <ul class="dropdown-submenu hidden"> - <li> - <!-- BEGIN dl_method --> - <a href="{dl_method.LINK}">{dl_method.TYPE}</a><!-- IF not dl_method.S_LAST_ROW --> • <!-- ENDIF --> - <!-- END dl_method --> - </li> - </ul> - </li> + <!-- IF U_BUMP_TOPIC --> + <li> + <a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true"> + <i class="icon fa-level-up fa-fw" aria-hidden="true"></i><span>{L_BUMP_TOPIC}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF U_EMAIL_TOPIC --> + <li> + <a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}"> + <i class="icon fa-envelope-o fa-fw" aria-hidden="true"></i><span>{L_EMAIL_TOPIC}</span> + </a> + </li> + <!-- ENDIF --> + <!-- IF U_PRINT_TOPIC --> + <li> + <a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p"> + <i class="icon fa-print fa-fw" aria-hidden="true"></i><span>{L_PRINT_TOPIC}</span> + </a> + </li> <!-- ENDIF --> <!-- EVENT viewtopic_topic_tools_after --> </ul> diff --git a/phpBB/styles/prosilver/theme/base.css b/phpBB/styles/prosilver/theme/base.css new file mode 100644 index 0000000000..98c57d9264 --- /dev/null +++ b/phpBB/styles/prosilver/theme/base.css @@ -0,0 +1,115 @@ +/* -------------------------------------------------------------- + $Base +-------------------------------------------------------------- */ + +/** { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +*:before, +*:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +}*/ + +/* Define your base font-size here; most elements will inherit this. _NO__DOTCOMMA__AFTER__*/ +html { + font-size: 1em; /* Assuming 16px... */ + line-height: 1.5; /* 24px (This is now our magic number; all subsequent margin-bottoms and line-heights want to be a multiple of this number in order to maintain vertical rhythm.) _NO__DOTCOMMA__AFTER__*/ + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #333333; + background-color: #ffffff; +} + +input, +button, +select, +textarea { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} + +figure { margin: 0 } +img { vertical-align: middle } + +hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #e5e5e5; +} + +a { + color: #428bca; + text-decoration: none; +} + +a:hover, +a:focus, +a:active { + color: #2a6496; + text-decoration: underline; +} + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +figure, +p, +pre { margin: 0 } +button { + background: transparent; + border: 0; + padding: 0; +} + +/** + * Work around a Firefox/IE bug where the transparent `button` background + * results in a loss of the default `button` focus styles. + */ +button:focus { + outline: 1px dotted; + outline: 5px auto -webkit-focus-ring-color; +} + +fieldset { + border: 0; + margin: 0; + padding: 0; +} + +iframe { border: 0 } +ol, +ul { + list-style: none; + margin: 0; + padding: 0; +} + +/** + * Suppress the focus outline on links that cannot be accessed via keyboard. + * This prevents an unwanted focus outline from appearing around elements that + * might still respond to pointer events. + */ +[tabindex="-1"]:focus { outline: none !important } + +/** + * Remove double underline from recent version of firefox + */ +abbr[title] { + text-decoration: none; +} + diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 57d9a33c12..a6d4bef6f4 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -2,7 +2,7 @@ ---------------------------------------- */ /** -* common.css +* common.css */ .rtl h1 { margin-right: 0; @@ -20,34 +20,23 @@ /* Main blocks ---------------------------------------- */ -.rtl #logo { +.rtl .icon { + padding-right: 0; + padding-left: 2px; +} + +.rtl .logo { float: right; padding: 10px 10px 0 13px; } -/* Search box +/* Site Description --------------------------------------------- */ -.rtl #search-box { - float: left; - text-align: left; - margin-right: 0; - margin-left: 5px; -} - -.rtl #search-box li { - text-align: left; -} - -.rtl #search-box img { - margin-right: 0; - margin-left: 3px; -} - -.rtl #site-description { +.rtl .site-description { float: right; } -.rtl #site-description h1 { +.rtl .site-description h1 { margin-left: 0; } @@ -59,20 +48,20 @@ /* Horizontal lists ----------------------------------------*/ -.rtl ul.linklist li { +.rtl ul.linklist > li { float: right; margin-right: 0; - margin-left: 5px; + margin-left: 7px; } -.rtl ul.linklist li.rightside, .rtl p.rightside { +.rtl ul.linklist > li.rightside, .rtl p.rightside, .rtl a.rightside { float: left; - margin-right: 5px; + margin-right: 7px; margin-left: 0; text-align: left; } -.rtl ul.leftside li, .rtl ul.rightside li { +.rtl ul.leftside > li, .rtl ul.rightside > li { float: left; } @@ -92,14 +81,14 @@ /* Bulletin icons for list items ----------------------------------------*/ -.rtl ul.linklist.bulletin li:before { +.rtl ul.linklist.bulletin > li:before { padding-left: 4px; padding-right: 0; } /* Dropdown menu ---------------------------------------- */ -.rtl .dropdown-container.topic-tools { +.rtl .dropdown-container.topic-tools, .rtl .dropdown-container-left { float: right; } @@ -107,9 +96,54 @@ text-align: right; } +.rtl .dropdown-contents > li { + padding-left: 15px; + padding-right: 0; +} + +.rtl .dropdown-nonscroll > li { + padding-left: 0; +} + .rtl .dropdown li li { padding-left: 0; - padding-right: 10px; + padding-right: 18px; +} + +.rtl .dropdown-extended .header { + text-align: right; +} + +.rtl .dropdown-extended .header .header_settings, .rtl .dropdown-container-right { + float: left; +} + +/* Notifications +-----------------------------------------*/ +.rtl .notification_list ul li img { + float: right; + margin-left: 5px; + margin-right: 0; +} + +.rtl .notification_list div.notifications { + margin-left: 0; + margin-right: 50px; +} + +.rtl .notification_text { + margin-left: 0; + margin-right: 58px; +} + +.rtl .notification_list p.notification-time { + text-align: left; +} + +/* Responsive breadcrumbs +----------------------------------------*/ +.rtl .breadcrumbs .crumb { + float: right; } /* Table styles @@ -148,8 +182,7 @@ /* Misc layout styles ---------------------------------------- */ -/* column[1-2] styles are containers for two column layouts - Also see tweaks.css */ +/* column[1-2] styles are containers for two column layouts */ .rtl .column1 { float: right; clear: right; @@ -200,83 +233,99 @@ .rtl .pagination { text-align: left; float: left; - padding-left: 5px; +} + +.rtl .pagination > ul { + margin-left: 0; + margin-right: 5px; } /* Pagination in viewforum for multipage topics */ .rtl .row .pagination { background-position: 100% 50%; float: left; - padding: 1px 15px 1px 0; + padding-left: 0; + padding-right: 15px; +} + +.rtl .row .pagination > ul { + margin: 0; } .rtl .pagination span { direction: ltr; } -.rtl .pagination span.page-sep { - display: inline; - visibility: hidden; - position: absolute; +.pagination li.page-jump { + margin-left: 5px; + margin-right: 0; } + +/* Action Bar styles +---------------------------------------- */ +.rtl .action-bar .button { + margin-right: 0; + float: right; +} + +.rtl .action-bar > .button { + margin-left: 5px; + float: right; +} + +.rtl .action-bar .dropdown-button-control .button { + margin-left: 5px; +} + + /* Miscellaneous styles ---------------------------------------- */ -.rtl #forum-permissions { - float: left; - padding-right: 5px; - padding-left: 0; - margin-right: 5px; - margin-left: 0; - text-align: left; +.rtl .quick-links { + margin-left: 7px; + margin-right: 0; } -.rtl .forabg { - width: 99%; /* fix for IE6 */ +.rtl .header-avatar span:after { + float: left; + padding-left: 0; + padding-right: 2px; } -.rtl .forumbg { - width: 99%; /* fix for IE6 */ +.rtl .member-search { + float: right; } /** * links.css */ -/* Back to top of page */ -.rtl .back2top { - text-align: left; -} - /* Links adjustment to correctly display an order of rtl/ltr mixed content */ .rtl a { direction: rtl; unicode-bidi: embed; } -ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { +li.breadcrumbs span:first-child > a { padding-left: 0; - padding-right: 19px; } -.rtl a.top { - float: left; +/* Notification mark read link */ +.rtl .dropdown-extended a.mark_read { + border-radius: 0 3px 3px 0; + left: 0; + right: auto; } -.rtl a.top2 { - background-position: 100% 50%; - padding-left: 0; - padding-right: 15px; +.rtl .back2top .top { + float: left; + margin-left: -10px; } .rtl .skiplink { /* invisible skip link, used for accessibility */ - position: relative; - width: 1px; - height: 1px; - overflow: hidden; - display: block; left: 0; + right: -999px; } .rtl a.feed-icon-forum { @@ -289,12 +338,12 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { .rtl ul.topiclist dt, .rtl li.header dt { float: right; margin-right: 0; - margin-left: -410px; + margin-left: -440px; } .rtl ul.topiclist.missing-column dt { margin-right: 0; - margin-left: -330px; + margin-left: -345px; } .rtl ul.topiclist.two-long-columns dt { @@ -309,7 +358,7 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { .rtl ul.topiclist dt .list-inner { margin-right: 0; - margin-left: 410px; + margin-left: 440px; } .rtl ul.topiclist.missing-column dt .list-inner { @@ -327,10 +376,6 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { margin-left: 80px; } -.rtl ul.topiclist dl { - position: static; /* fix for IE6 */ -} - .rtl ul.topiclist dd { float: right; border-right-width: 1px; @@ -338,6 +383,11 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { border-left: none; } +.rtl ul.topiclist dfn { + left: auto; + right: -999px; +} + .rtl ul.topiclist li.row dt a.subforum { padding-right: 12px; background-position: right; @@ -359,26 +409,34 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { padding-right: 1px; } -.rtl dl.icon { +.rtl dl.row-item{ background-position: 99.5% 50%; } -.rtl li.header dl.icon dt .list-inner { +.rtl li.header dl.row-item dt .list-inner { /* Tweak for headers alignment when folder icon used */ padding-right: 0; padding-left: 50px; } -.rtl dl.icon dt { +.rtl dl.row-item dt { background-position: 99.5% 95%; /* Position of topic icon */ } -.rtl dl.icon dt .list-inner { - padding-left: 0; +.rtl dl.row-item dt .list-inner { + padding-left: 5px; padding-right: 45px; /* Space for folder icon */ } -.rtl dd.lastpost span, .rtl ul.topiclist dd.info span, .rtl ul.topiclist dd.time span, .rtl dd.redirect span, .rtl dd.moderation span { +.rtl dl a.row-item-link { /* topic row icon links */ + display: inline-block; + left: auto; + right: 0; + margin-left: 0; + margin-right: 2px; +} + +.rtl dd.lastpost > span, .rtl ul.topiclist dd.info > span, .rtl ul.topiclist dd.time > span, .rtl dd.redirect > span, .rtl dd.moderation > span { padding-left: 0; padding-right: 5px; } @@ -389,9 +447,13 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { float: right; } +.rtl .has-profile .postbody h3 { + margin-right: 0; + margin-left: 180px; +} + .rtl p.post-notice { padding-left: 5px; - padding-right: 26px; } .rtl p.post-notice:before { @@ -401,7 +463,7 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { /* Topic review panel ----------------------------------------*/ -.rtl #topicreview { +.rtl .topicreview { padding-right: 0; padding-left: 5px; } @@ -516,6 +578,10 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { margin-right: 8px; } +.rtl .postprofile .avatar { + float: right; +} + .rtl .online { background-position: 0 0; } @@ -528,46 +594,39 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { /** * buttons.css */ -/* Rollover buttons - Based on: http://wellstyled.com/css-nopreload-rollovers.html -----------------------------------------*/ -.rtl .buttons { + +.rtl .caret { float: right; } -/* Rollover state */ -.rtl .buttons div { - margin: 0 1px 0 5px; -} -/* Sub-header (navigation bar) + +/* Post control buttons --------------------------------------------- */ -.rtl a.print, .rtl a.sendemail { - text-align: right; +.rtl .post-buttons { + float: left; } -/* Icon images ----------------------------------------- */ -.rtl .small-icon { - background-position: 100% 50%; - padding: 1px 19px 0 0; +.rtl .has-profile .post-buttons { + left: 0; + right: auto; } -.rtl ul.linklist li.small-icon { - padding-right: 0; +.rtl .post-buttons li { + float: right; } -/* Poster profile icons -----------------------------------------*/ -/* Rollover state */ -.rtl .postprofile ul.profile-icons li { +/* Poster contact icons + ----------------------------------------*/ +.rtl .contact-icons a { + border-left-width: 1px; + border-left-style: dotted; + border-right: none; float: right; - margin: 0 0 3px 6px; } -/* Positioning of moderator icons */ -.rtl .postbody ul.profile-icons { - float: left; +.rtl .contact-icons .last-cell { + border-left: none; } /** @@ -579,24 +638,20 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { /* Main CP box ----------------------------------------*/ -.rtl #cp-menu { +.rtl .cp-menu { float: right; } -.rtl #cp-main { +.rtl .cp-main { float: right; } -.rtl #cp-main .panel ol { +.rtl .cp-main .panel ol { margin-right: 2em; margin-left: 0; } -.rtl #cp-main .pagination { - float: left; -} - -.rtl #cp-main .buttons { +.rtl .cp-main .buttons { margin-right: 0; margin-left: 0; } @@ -607,41 +662,70 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { /* CP tabbed menu ----------------------------------------*/ -.rtl #tabs { - margin: 20px 7px -1px 0; +.rtl .tabs { + margin-left: 0; + margin-right: 7px; } -.rtl #tabs a { +.rtl .tabs .tab { float: right; } -/*.rtl #tabs a span { - float: right; -}*/ +.rtl .tabs .tab > a { + margin-left: 1px; + margin-right: 0; +} /* Mini tabbed menu used in MCP ----------------------------------------*/ -.rtl #minitabs { +.rtl .minitabs { + float: left; margin-right: 0; margin-left: 7px; } -.rtl .tabs-container #minitabs { +.rtl .minitabs .tab { float: left; } -.rtl #minitabs li { - float: left; +.rtl .minitabs .tab > a { margin-right: 2px; margin-left: 0; } +/* Responsive tabs +----------------------------------------*/ +.rtl .tabs .dropdown { + margin-left: -2px; +} + +.rtl .tabs .dropdown li { + text-align: left; +} + +.rtl .minitabs .dropdown { + margin-left: -4px; +} + +.rtl .minitabs .dropdown li { + text-align: right; +} + +/* Responsive *CP navigation +----------------------------------------*/ +@media only screen and (max-width: 900px), only screen and (max-device-width: 900px) +{ + .rtl .cp-menu, .rtl .navigation, .rtl .cp-main { + float: none; + } +} + /* UCP navigation menu ----------------------------------------*/ /* Preferences pane layout ----------------------------------------*/ -.rtl #cp-main h2 { +.rtl .cp-main h2 { margin-left: 0; margin-right: 10px; } @@ -682,10 +766,19 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { } /* Avatar gallery */ -.rtl #gallery label { +.rtl .gallery label { float: right; } +/* Responsive *CP navigation +----------------------------------------*/ +@media only screen and (max-width: 900px), only screen and (max-device-width: 900px) +{ + .rtl .cp-menu, .rtl .navigation, .rtl .cp-main { + float: none; + } +} + /** * forms.css */ @@ -768,6 +861,10 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { padding-right: 0; } +.rtl .dropdown fieldset.display-options label { + text-align: left; +} + /* Display actions for ucp and mcp pages */ .rtl fieldset.display-actions { text-align: left; @@ -789,75 +886,178 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { float: left; } -/* Jumpbox */ -.rtl fieldset.jumpbox { - text-align: left; -} - -.rtl fieldset.quickmod { - float: left; - text-align: left; -} - /* Posting page styles ----------------------------------------*/ /* Emoticons panel */ -.rtl #smiley-box { +.rtl .smiley-box { float: left; } -/* Form button styles +/* Search box ---------------------------------------- */ /* Topic and forum Search */ .rtl .search-box { - margin-right: 5px; - margin-left: 0; float: right; } -.rtl input.search { - background-position: right 1px; - padding-right: 17px; - padding-left: 0; +.rtl .search-box .inputbox { + border-left-width: 0; + border-right-width: 1px; + border-radius: 0 4px 4px 0; + float: right; + padding: 3px; } -/** -* tweaks.css -*/ - -/** Reference: Bug #27155 */ -.rtl #wrap, .rtl .headerbar, .rtl #site-description, .rtl .navbar { - position: relative; +.rtl .button-search, +.button-search-end { + float: right; } -/* Former imageset */ -.rtl .imageset.site_logo { - padding-right: 139px; - padding-left: 0; -} -.rtl .imageset.forum_link, .rtl .imageset.forum_read, .rtl .imageset.forum_read_locked, .rtl .imageset.forum_read_subforum, .rtl .imageset.forum_unread, .rtl .imageset.forum_unread_locked, .rtl .imageset.forum_unread_subforum, .rtl .imageset.topic_moved, .rtl .imageset.topic_read, .rtl .imageset.topic_read_mine, .rtl .imageset.topic_read_hot, .rtl .imageset.topic_read_hot_mine, .rtl .imageset.topic_read_locked, .rtl .imageset.topic_read_locked_mine, .rtl .imageset.topic_unread, .rtl .imageset.topic_unread_mine, .rtl .imageset.topic_unread_hot, .rtl .imageset.topic_unread_hot_mine, .rtl .imageset.topic_unread_locked, .rtl .imageset.topic_unread_locked_mine, .rtl .imageset.sticky_read, .rtl .imageset.sticky_read_mine, .rtl .imageset.sticky_read_locked, .rtl .imageset.sticky_read_locked_mine, .rtl .imageset.sticky_unread, .rtl .imageset.sticky_unread_mine, .rtl .imageset.sticky_unread_locked, .rtl .imageset.sticky_unread_locked_mine, .rtl .imageset.announce_read, .rtl .imageset.announce_read_mine, .rtl .imageset.announce_read_locked, .rtl .imageset.announce_read_locked_mine, .rtl .imageset.announce_unread, .rtl .imageset.announce_unread_mine, .rtl .imageset.announce_unread_locked, .rtl .imageset.announce_unread_locked_mine, .rtl .imageset.global_read, .rtl .imageset.global_read_mine, .rtl .imageset.global_read_locked, .rtl .imageset.global_read_locked_mine, .rtl .imageset.global_unread, .rtl .imageset.global_unread_mine, .rtl .imageset.global_unread_locked, .rtl .imageset.global_unread_locked_mine, .rtl .imageset.pm_read, .rtl .imageset.pm_unread { - padding-right: 27px; - padding-left: 0; +.button-search-end { + border-left-width: 1px; + border-right-width: 0; } -.rtl .imageset.subforum_read, .rtl .imageset.subforum_unread, .rtl .imageset.icon_post_target, .rtl .imageset.icon_post_target_unread, .rtl .imageset.icon_topic_latest, .rtl .imageset.icon_topic_newest { - padding-right: 11px; - padding-left: 0; + +.rtl .search-header .button-search-end { + border: 0; } -.rtl .imageset.icon_back_top { - padding-right: 11px; - padding-left: 0; + +.rtl .search-header { + float: left; + margin-right: 0; + margin-left: 5px; } -.rtl .imageset.icon_contact_aim, .rtl .imageset.icon_contact_email, .rtl .imageset.icon_contact_icq, .rtl .imageset.icon_contact_jabber, .rtl .imageset.icon_contact_msnm, .rtl .imageset.icon_contact_www, .rtl .imageset.icon_contact_yahoo, .rtl .imageset.icon_post_delete, .rtl .imageset.icon_post_info, .rtl .imageset.icon_post_report, .rtl .imageset.icon_user_warn { - padding-right: 20px; - padding-left: 0; + +/* Form button styles +---------------------------------------- */ + +/** Reference: Bug #27155 */ +.rtl .wrap, .rtl .headerbar, .rtl .site-description, .rtl .navbar { + position: relative; } -.rtl .imageset.icon_topic_attach { - padding-right: 7px; - padding-left: 0; + +/** +* plupload.css +*/ + +.rtl .attach-controls { + float: left; } -.rtl .imageset.icon_topic_reported, .rtl .imageset.icon_topic_unapproved { - padding-right: 16px; - padding-left: 0; + +/** +* responsive.css +*/ +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + /* .topiclist lists + ----------------------------------------*/ + .rtl ul.topiclist li.header dt, .rtl ul.topiclist li.header dt .list-inner { + margin-left: 0 !important; + padding-left: 0; + } + + .rtl ul.topiclist dt, .rtl ul.topiclist dt .list-inner, + .rtl ul.topiclist.missing-column dt, .rtl ul.topiclist.missing-column dt .list-inner, + .rtl ul.topiclist.two-long-columns dt, .rtl ul.topiclist.two-long-columns dt .list-inner, + .rtl ul.topiclist.two-columns dt, .rtl ul.topiclist.two-columns dt .list-inner { + margin-left: 0; + } + + .rtl ul.topiclist dt .list-inner.with-mark { + padding-left: 34px; + } + + /* Forums and topics lists + ----------------------------------------*/ + .rtl ul.topiclist.forums dt { + margin-left: -250px; + } + .rtl ul.topiclist.forums dt .list-inner { + margin-left: 250px; + } + + .rtl ul.topiclist dd.mark { + left: 5px; + right: auto; + text-align: right; + } + + .rtl table.responsive.show-header thead, .rtl table.responsive.show-header th:first-child { + text-align: right !important; + } + + .rtl table.responsive td { + text-align: right !important; + } + + /* User profile + ----------------------------------------*/ + .rtl .column1, .rtl .column2, .rtl .left-box.profile-details { + float: none; + } + + /* Post + ----------------------------------------*/ + .rtl .postprofile, .rtl .postbody, .rtl .search .postbody { + float: none; + } + + .rtl .post .postprofile { + border-width: 0 0 1px 0; + } + + .rtl .postprofile dt, .rtl .postprofile dd.profile-rank, .rtl .search .postprofile dd { + margin: 0; + } + + .rtl .postprofile .avatar { + margin-left: 5px; + margin-right: 0; + } + + .rtl .has-profile .post-buttons { + left: 20px; + } + + /* Forms + ----------------------------------------*/ + .rtl fieldset dt, .rtl fieldset.fields1 dt, .rtl fieldset.fields2 dt { + float: none; + } + + .rtl fieldset dd, .rtl fieldset.fields1 dd, .rtl fieldset.fields2 dd { + margin-right: 20px; + } +} + +@media only screen and (max-width: 550px), only screen and (max-device-width: 550px) +{ + /* .topiclist lists + ----------------------------------------*/ + .rtl ul.topiclist.forums dt { + margin-left: 0; + } + + .rtl ul.topiclist.forums dt .list-inner { + margin-left: 0; + } +} + +@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) +{ + .rtl dl.details dt, .rtl dl.details dd { + float: none; + text-align: right; + } + + .rtl dl.details dd { + margin-left: 0; + margin-right: 20px; + } + + .captcha-panel dd.captcha { + margin-right: 0; + } } diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css index 89fdcd85a8..7f93dbdf89 100644 --- a/phpBB/styles/prosilver/theme/buttons.css +++ b/phpBB/styles/prosilver/theme/buttons.css @@ -1,277 +1,193 @@ /* Button Styles ---------------------------------------- */ -/* Rollover buttons - Based on: http://wellstyled.com/css-nopreload-rollovers.html -----------------------------------------*/ -.buttons { - float: left; - width: auto; - height: auto; -} - -/* Rollover state */ -.buttons div, .dropdown-select { - float: left; - margin: 0 5px 0 0; -} - -/* Rolloff state */ -.buttons div a, .dropdown-select { +.button { display: inline-block; - line-height: 17.5px; - height: 18px; + padding: 2px 8px; font-size: 13px; + font-weight: normal; + font-family: "Open Sans", "Droid Sans", Verdana, Arial, Helvetica; + line-height: 1.4; + text-align: center; white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; border: 1px solid transparent; border-radius: 4px; - background: transparent none 0 0 repeat-x; - padding: 2px 22px 2px 8px; - font-family: "Open Sans", "Droid Sans", Verdana, Arial, Helvetica; - font-weight: 600; - position: relative; - text-decoration: none !important; - outline-style: none !important; - vertical-align: bottom; - *padding-right: 8px; } -.buttons div span { display: none; } - -.buttons div a:after, .dropdown-select:after { - content: ''; - display: block; - position: absolute; - top: 50%; - right: 6px; - width: 12px; - height: 12px; - margin-top: -6px; - background: transparent 0 0 no-repeat; -} - -.buttons div a:hover:after { - background-position: 0 -20px; -} - -.dropdown-select { - cursor: pointer; - font-family: inherit; - font-size: 1em; - font-weight: normal; +.button:focus, +.button:hover { + text-decoration: none; + outline: none; } -.dropdown-select:after { - background-position: -103px 10px; +.caret { border-left: 1px solid; - margin-top: 0; - top: 0; - right: 0; - height: 21px; - width: 15px; + position: relative; + right: -6px; } -.dropdown-visible .dropdown-select:after, .nojs .dropdown-container:hover .dropdown-select:after { - background-position: -103px -10px; +.caret i { + vertical-align: top; } -.dropdown-select-icon:before { - content: ''; - display: block; +/* Posting page styles +----------------------------------------*/ +.button-search, +.button-search-end { float: left; - margin-right: 4px; - margin-top: 2px; + border-radius: 0; + margin: 0; + padding: 2px 5px; } -/* Big button images */ -.buttons div.reply-icon a:after, .buttons div.pmreply-icon a:after { background-position: -20px 0; } -.buttons div.reply-icon a:hover:after, .buttons div.pmreply-icon a:hover:after { background-position: -20px -20px; } - -.buttons div.post-icon a:after, .buttons div.newpm-icon a:after { background-position: 0 0; } -.buttons div.post-icon a:hover:after, .buttons div.newpm-icon a:hover:after { background-position: 0 -20px; } +.button-search-end { + border-left-width: 0; + border-radius: 0 4px 4px 0; +} -.buttons div.locked-icon a:after { background-position: -60px 0; } -.buttons div.locked-icon a:hover:after { background-position: -60px -20px; } +.search-header .button-search, +.search-header .button-search-end { + border-top-width: 0; + border-bottom-width: 0; + padding: 3px 5px; +} -.buttons div.forwardpm-icon a:after { background-position: -40px 0; } -.buttons div.forwardpm-icon a:hover:after { background-position: -40px -20px; } +.search-header .button-search-end { + border-right-width: 0; +} -.dropdown-select.tools-icon:before { background-position: -80px 0; height: 16px; width: 16px; } +.button-icon-only { + padding-left: 3px; + padding-right: 3px; +} -.dropdown-visible .dropdown-select.tools-icon:before, -.nojs .dropdown-container:hover .dropdown-select.tools-icon:before { background-position: -80px -20px; } +/* Poster contact icons +----------------------------------------*/ +.contact-icons.dropdown-contents { + min-width: 0; + padding: 0; + font-size: 0; +} -/* Sub-header (navigation bar) ---------------------------------------------- */ -a.print, a.sendemail { - display: block; - overflow: hidden; - height: 18px; - text-indent: -5000px; - text-align: left; +.contact-icon { background-repeat: no-repeat; + display: block; + height: 16px; + width: 16px; } - -a.print { - background-image: none; - width: 22px; +.contact-icons a { + border-bottom: 1px dotted; + border-right: 1px dotted; + display: block; + float: left; + padding: 8px; } -a.sendemail { - background-image: none; - width: 22px; +.contact-icons .last-cell { + border-right: none; } -/* Icon images ----------------------------------------- */ -.small-icon { - background-position: 0 50%; - background-repeat: no-repeat; - background-image: none; - padding: 1px 0 0 17px; +.contact-icons div:last-child a { + border-bottom: none; } -ul.linklist li.small-icon { - padding-left: 0; +.contact-icons div { + clear: left; } -ul.linklist.bulletin li.small-icon:before { - display: none; +/* Post control buttons +--------------------------------------------- */ +.post-buttons { + float: right; + list-style: none; + margin-top: 2px; } -/* Poster profile icons -----------------------------------------*/ -ul.profile-icons { - padding-top: 10px; - list-style: none; +.has-profile .post-buttons { + float: none; + position: absolute; + margin: 0; + right: 0; + top: 5px; } -/* Rollover state */ -ul.profile-icons li { +.post-buttons > li { float: left; - margin: 0 6px 3px 0; - background-position: 0 100%; + margin-right: 3px; } -/* Rolloff state */ -ul.profile-icons li a { - display: block; - width: 100%; - height: 100%; - background-position: 0 0; +.post-buttons .button, .format-buttons .button { + padding-left: 3px; + padding-right: 3px; } -/* Hide <a> text and hide off-state image when rolling over (prevents flicker in IE) */ -ul.profile-icons li span { display:none; } -ul.profile-icons li a:hover { background: none; } +.hastouch .post-buttons { + margin-right: 10px; +} -/* Positioning of moderator icons */ -.postbody ul.profile-icons { - float: right; - width: auto; - padding: 0; +.post-buttons .button span { + font-size: 0; } -.postbody ul.profile-icons li { - margin: 0 3px; +/* Responsive buttons in post body */ +.post-buttons .dropdown { + top: 18px; } -/* Responsive icons in postbody */ -.postbody ul.profile-icons.responsive .responsive-menu { - position: relative; +.post-buttons .dropdown a { + display: block; + font-size: 1.2em; + text-align: right; } -ul.profile-icons.responsive a.responsive-menu-link { - display: inline-block; - position: relative; - margin: 0 5px; - width: 20px; - height: 20px; - text-decoration: none; - background: none top left no-repeat; +.hasjs .postbody .post-buttons { + max-width: 40%; } -ul.profile-icons.responsive a.responsive-menu-link:hover { - background-position: 0 -20px; +/* Browser-specific tweaks */ +button::-moz-focus-inner { + padding: 0; + border: 0 } -ul.profile-icons.responsive a.responsive-menu-link:before { - content: ''; - position: absolute; - left: 0; - top: 7px; - height: .125em; - width: 14px; - border-bottom: 0.125em solid transparent; - border-top: 0.375em double transparent; +/* Deprecated as of version 3.2 +-------------------------------------------------*/ +.small-icon { + background-position: 0 50%; + background-repeat: no-repeat; + background-image: none; } -.postbody ul.profile-icons.responsive .popup-pointer { - left: auto; - right: 7px; - top: 20px; +.dropdown .small-icon { + background-position: 5px 50%; + padding: 5px; } -.postbody ul.profile-icons .dropdown li, .postbody ul.profile-icons .dropdown li a { - display: block; - background: transparent none; - width: auto; - height: auto; - margin: 0; - padding: 0; - float: none; - list-style-type: none; +.small-icon > a { + padding: 0 0 0 18px; } -.postbody ul.profile-icons .dropdown li span { +ul.linklist.bulletin > li.small-icon:before { + display: none; +} + +.dropdown .small-icon > a { display: block; - text-align: right; - font-size: 1.2em; - line-height: 1.8em; - white-space: nowrap; } -.hasjs .postbody ul.profile-icons { - max-width: 40%; +.rtl .small-icon { + background-position: 100% 50%; } -/* Profile & navigation icons */ -.email-icon, .email-icon a { background: none top left no-repeat; } -.aim-icon, .aim-icon a { background: none top left no-repeat; } -.yahoo-icon, .yahoo-icon a { background: none top left no-repeat; } -.web-icon, .web-icon a { background: none top left no-repeat; } -.msnm-icon, .msnm-icon a { background: none top left no-repeat; } -.icq-icon, .icq-icon a { background: none top left no-repeat; } -.jabber-icon, .jabber-icon a { background: none top left no-repeat; } -.pm-icon, .pm-icon a { background: none top left no-repeat; } -.quote-icon, .quote-icon a { background: none top left no-repeat; } - -/* Moderator icons */ -.report-icon, .report-icon a { background: none top left no-repeat; } -.warn-icon, .warn-icon a { background: none top left no-repeat; } -.edit-icon, .edit-icon a { background: none top left no-repeat; } -.delete-icon, .delete-icon a { background: none top left no-repeat; } -.info-icon, .info-icon a { background: none top left no-repeat; } - -/* Set profile icon dimensions */ -ul.profile-icons li.email-icon { width: 20px; height: 20px; } -ul.profile-icons li.aim-icon { width: 20px; height: 20px; } -ul.profile-icons li.yahoo-icon { width: 20px; height: 20px; } -ul.profile-icons li.web-icon { width: 20px; height: 20px; } -ul.profile-icons li.msnm-icon { width: 20px; height: 20px; } -ul.profile-icons li.icq-icon { width: 20px; height: 20px; } -ul.profile-icons li.jabber-icon { width: 20px; height: 20px; } -ul.profile-icons li.pm-icon { width: 28px; height: 20px; } -ul.profile-icons li.quote-icon { width: 54px; height: 20px; } -ul.profile-icons li.report-icon { width: 20px; height: 20px; } -ul.profile-icons li.edit-icon { width: 42px; height: 20px; } -ul.profile-icons li.delete-icon { width: 20px; height: 20px; } -ul.profile-icons li.info-icon { width: 20px; height: 20px; } -ul.profile-icons li.warn-icon { width: 20px; height: 20px; } -ul.profile-icons a.responsive-menu-link { width: 20px; height: 20px; } - -/* Fix profile icon default margins */ -ul.profile-icons li.edit-icon { margin: 0 0 0 3px; } -ul.profile-icons li.quote-icon { margin: 0 0 0 10px; } -ul.profile-icons li.info-icon, ul.profile-icons li.report-icon { margin: 0 3px 0 0; } - +.rtl .small-icon > a { + padding-left: 0; + padding-right: 19px; +} diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 1d4c657a14..4458a59502 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -5,7 +5,7 @@ Colours and backgrounds for common.css html, body { color: #536482; - background-color: #FFFFFF; + background-color: #F5F7FA; } h1 { @@ -26,41 +26,85 @@ hr { border-top-color: #CCCCCC; } -/* Search box ---------------------------------------------- */ +/* +-------------------------------------------------------------- +Colours and backgrounds for links.css +-------------------------------------------------------------- */ -#search-box { +a { color: #105289; } +a:hover { color: #D31141; } + +/* Links on gradient backgrounds */ +.forumbg .header a, .forabg .header a, th a { color: #FFFFFF; } -#search-box #keywords { - background-color: #FFF; +.forumbg .header a:hover, .forabg .header a:hover, th a:hover { + color: #A8D8FF; +} + +/* Notification mark read link */ +.dropdown-extended a.mark_read { + background-color: #FFFFFF; +} + +/* Post body links */ +.postlink { + border-bottom-color: #368AD2; + color: #368AD2; } -#search-box input { - border-color: #0075B0; +.postlink:visited { + border-bottom-color: #5D8FBD; + color: #5D8FBD; +} + +.postlink:hover { + background-color: #D0E4F6; + color: #0D4473; +} + +.signature a, .signature a:hover { + background-color: transparent; +} + +/* Back to top of page */ +.top i { + color: #999999; +} + +/* Arrow links */ +.arrow-left:hover, .arrow-right:hover { + color: #368AD2; } /* Round cornered boxes and backgrounds ---------------------------------------- */ +.wrap { + background-color: #FFF; + border-color: #E6E9ED; +} + .headerbar { - background-color: #12A3EB; - background-image: url("./images/bg_header.gif"); color: #FFFFFF; } -.navbar { - background-color: #cadceb; +.headerbar, .forumbg { + background-color: #12A3EB; + background-image: -webkit-linear-gradient(top, #6ACEFF 0%, #0076B1 2px, #12A3EB 92px, #12A3EB 100%); + background-image: linear-gradient(to bottom, #6ACEFF 0%,#0076B1 2px,#12A3EB 92px,#12A3EB 100%); + background-repeat: repeat-x; } .forabg { - background-color: #0076b1; - background-image: url("./images/bg_list.gif"); + background-color: #0076B1; + background-image: -webkit-linear-gradient(top, #6ACEFF 0%, #12A3EB 2px, #0076B1 92px, #0076B1 100%); + background-image: linear-gradient(to bottom, #6ACEFF 0%,#12A3EB 2px,#0076B1 92px,#0076B1 100%); + background-repeat: repeat-x; } -.forumbg { - background-color: #12A3EB; - background-image: url("./images/bg_header.gif"); +.navbar { + background-color: #CADCEB; } .panel { @@ -85,14 +129,16 @@ table.zebra-list tr:nth-child(odd) td, ul.zebra-list li:nth-child(odd) { } .bg2 { - background-color: #e1ebf2; + background-color: #E1EBF2; } table.zebra-list tr:nth-child(even) td, ul.zebra-list li:nth-child(even) { - background-color: #e1ebf2; + background-color: #E1EBF2; } -.bg3 { background-color: #cadceb; } +.bg3 { + background-color: #CADCEB; +} .ucprowbg { background-color: #DCDEE2; @@ -102,11 +148,15 @@ table.zebra-list tr:nth-child(even) td, ul.zebra-list li:nth-child(even) { background-color: #E7E8EA; } +.site_logo { + background-image: url("./images/site_logo.gif"); +} + /* Horizontal lists ----------------------------------------*/ ul.navlinks { - border-bottom-color: #FFFFFF; + border-top-color: #FFFFFF; } /* Table styles @@ -156,238 +206,123 @@ dl.details dd { color: #1198D9; } -/* Pagination +/* Icon styles ---------------------------------------- */ - -.pagination li a, .pagination li a:link, .pagination li a:visited { - color: #5C758C; - background-color: #ECEDEE; - border-color: #B4BAC0; -} - -.pagination li.ellipsis span { - background-color: transparent; - color: #000000; -} - -.pagination li.active span { - color: #FFFFFF; - background-color: #4692BF; - border-color: #4692BF; +.icon.icon-blue, a:hover .icon.icon-blue { + color: #196db5; } -.pagination li a:hover, .pagination .active a:hover { - border-color: #368AD2; - background-color: #368AD2; - color: #FFFFFF; -} - -.pagination li a:active, .pagination li.active a:active { - color: #5C758C; - background-color: #ECEDEE; - border-color: #B4BAC0; -} - -/* Pagination in viewforum for multipage topics */ -.row .pagination { - background-image: url("./images/icon_pages.gif"); -} - -.row .pagination span a, li.pagination span a { - background-color: #FFFFFF; -} - -.row .pagination span a:hover, li.pagination span a:hover { - background-color: #368AD2; -} - -/* Miscellaneous styles ----------------------------------------- */ - -.copyright { - color: #555555; +.icon.icon-green, a:hover .icon.icon-green{ + color: #1b9A1B; } -.error { +.icon.icon-red, a:hover .icon.icon-red{ color: #BC2A4D; } -.reported { - background-color: #F7ECEF; +.icon.icon-orange, a:hover .icon.icon-orange{ + color: #FF6600; } -li.reported:hover { - background-color: #ECD5D8 !important; -} -.sticky, .announce { - /* you can add a background for stickies and announcements*/ +.icon.icon-bluegray, a:hover .icon.icon-bluegray{ + color: #536482; } -div.rules { - background-color: #ECD5D8; - color: #BC2A4D; +.icon.icon-gray, a:hover .icon.icon-gray{ + color: #777777; } -p.post-notice { - background-color: #ECD5D8; - background-image: none; +.icon.icon-lightgray, a:hover .icon.icon-lightgray{ + color: #999999; } -p.post-notice.deleted:before { - background-image: url("./images/icon_topic_deleted.png"); +.icon.icon-black, a:hover .icon.icon-black{ + color: #333333; } -p.post-notice.unapproved:before { - background-image: url("./images/icon_topic_unapproved.gif"); +.alert_close .icon:before { + background-color: #FFFFFF; } -p.post-notice.reported:before, p.post-notice.error:before { - background-image: url("./images/icon_topic_reported.gif"); +/* Jumpbox */ +.jumpbox .dropdown li { + border-top-color: #CCCCCC; } -/* --------------------------------------------------------------- -Colours and backgrounds for links.css --------------------------------------------------------------- */ - -a:link { color: #105289; } -a:visited { color: #105289; } -a:hover { color: #D31141; } -a:active { color: #368AD2; } - -/* Links on gradient backgrounds */ -#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link { +.jumpbox-cat-link { + background-color: #0076b1; + border-top-color: #0076B1; color: #FFFFFF; } -#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited { +.jumpbox-cat-link:hover { + background-color: #12A3EB; + border-top-color: #12A3EB; color: #FFFFFF; } -#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover { - color: #A8D8FF; +.jumpbox-forum-link { + background-color: #E1EBF2; } -#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active { - color: #C8E6FF; +.jumpbox-forum-link:hover { + background-color: #F6F4D0; } -/* Notification mark read link */ -#notification_list a.mark_read { - background-color: #FFFFFF; +.jumpbox .dropdown .pointer-inner { + border-color: #E1EBF2 transparent; } -/* Links for forum/topic lists */ -a.forumtitle { - color: #105289; +.jumpbox-sub-link { + background-color: #E1EBF2; } -/* a.forumtitle:visited { color: #105289; } */ - -a.forumtitle:hover { - color: #BC2A4D; +.jumpbox-sub-link:hover { + background-color: #F1F8FF; } -a.forumtitle:active { - color: #105289; -} +/* Miscellaneous styles +---------------------------------------- */ -a.topictitle { - color: #105289; +.copyright { + color: #555555; } -/* a.topictitle:visited { color: #368AD2; } */ - -a.topictitle:hover { +.error { color: #BC2A4D; } -a.topictitle:active { - color: #105289; -} - -/* Post body links */ -.postlink { - color: #368AD2; - border-bottom-color: #368AD2; -} - -.postlink:visited { - color: #5D8FBD; - border-bottom-color: #5D8FBD; -} - -.postlink:active { - color: #368AD2; -} - -.postlink:hover { - background-color: #D0E4F6; - color: #0D4473; -} - -.signature a, .signature a:visited, .signature a:hover, .signature a:active { - background-color: transparent; -} - -/* Profile links */ -.postprofile a:link, .postprofile a:visited, .postprofile dt.author a { - color: #105289; -} - -.postprofile a:hover, .postprofile dt.author a:hover { - color: #D31141; -} - -.postprofile a:active { - color: #105289; -} - -/* Profile searchresults */ -.search .postprofile a { - color: #105289; -} - -.search .postprofile a:hover { - color: #D31141; -} - -/* Back to top of page */ -a.top { - background-image: url("./images/icon_back_top.gif"); +.reported { + background-color: #F7ECEF; } -a.top2 { - background-image: url("./images/icon_back_top.gif"); +li.reported:hover { + background-color: #ECD5D8 !important; } - -/* Arrow links */ -a.arrow-up { background-image: url("./images/arrow_up.gif"); } -a.arrow-down { background-image: url("./images/arrow_down.gif"); } -a.arrow-left { background-image: url("./images/arrow_left.gif"); } -a.arrow-right { background-image: url("./images/arrow_right.gif"); } - -a.arrow-up:hover { - background-color: transparent; +.sticky, .announce { + /* you can add a background for stickies and announcements*/ } -a.arrow-left:hover { - color: #368AD2; +div.rules { + background-color: #ECD5D8; + color: #BC2A4D; } -a.arrow-right:hover { - color: #368AD2; +p.post-notice { + background-color: #ECD5D8; + background-image: none; } - /* -------------------------------------------------------------- Colours and backgrounds for content.css -------------------------------------------------------------- */ ul.forums { - background-color: #eef5f9; - background-image: url("./images/gradient.gif"); + background-color: #EEF5F9; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #D2E0EB 0%, #EEF5F9 100%); + background-image: linear-gradient(to bottom, #D2E0EB 0%,#EEF5F9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D2E0EB', endColorstr='#EEF5F9',GradientType=0 ); /* IE6-9 */ } ul.topiclist li { @@ -399,18 +334,10 @@ ul.topiclist dd { } .rtl ul.topiclist dd { - border-right-color: #fff; + border-right-color: #FFFFFF; border-left-color: transparent; } -ul.topiclist li.row dt a.subforum.read { - background-image: url("./images/subforum_read.gif"); -} - -ul.topiclist li.row dt a.subforum.unread { - background-image: url("./images/subforum_unread.gif"); -} - li.row { border-top-color: #FFFFFF; border-bottom-color: #00608F; @@ -660,154 +587,175 @@ fieldset.polls dd div { background-image: url("./en/icon_user_online.gif"); } +dd.profile-warnings { + color: #BC2A4D; +} + /* -------------------------------------------------------------- Colours and backgrounds for buttons.css -------------------------------------------------------------- */ +.button { + border-color: #C7C3BF; + background-color: #E9E9E9; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #FFFFFF 0%, #E9E9E9 100%); + background-image: linear-gradient(to bottom, #FFFFFF 0%,#E9E9E9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFFFF', endColorstr='#E9E9E9',GradientType=0 ); /* IE6-9 */ + box-shadow: 0 0 0 1px #FFFFFF inset; + -webkit-box-shadow: 0 0 0 1px #FFFFFF inset; + color: #D31141; +} + +.button:hover, +.button:focus { + border-color: #0A8ED0; + background-color: #FFFFFF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #E9E9E9 0%, #FFFFFF 100%); + background-image: linear-gradient(to bottom, #E9E9E9 0%,#FFFFFF 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E9E9E9', endColorstr='#FFFFFF',GradientType=0 ); /* IE6-9 */ + text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, -1px -1px 0 rgba(188, 42, 77, 0.2); +} -a.print { - background-image: url("./images/icon_print.gif"); + +.button .icon, +.button-secondary { + color: #8f8f8f; } -a.sendemail { - background-image: url("./images/icon_sendemail.gif"); +.button-secondary:focus, +.button-secondary:hover, +.button:focus .icon, +.button:hover .icon { + color: #0A8ED0; } -.buttons div a, .dropdown-select { +.button-search:hover, +.button-search-end:hover { border-color: #C7C3BF; - background-color: #FFFFFF; - background-image: -moz-linear-gradient(top, #FFFFFF, #E9E9E9); - background-image: -webkit-linear-gradient(top, #FFFFFF, #E9E9E9); - background-image: -o-linear-gradient(top, #FFFFFF, #E9E9E9); - background-image: linear-gradient(to bottom, #FFFFFF, #E9E9E9); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#FFFFFF', EndColorStr='#E9E9E9')"; - box-shadow: 0 0 0 1px #FFFFFF inset; - -webkit-box-shadow: 0 0 0 1px #FFFFFF inset; - color: #BC2A4D !important; } -.dropdown-select { - color: #5C6482 !important; +.caret { border-color: #DADADA; } +.caret { border-color: #C7C3BF; } + +.contact-icons a { border-color: #DCDCDC; } +.contact-icons a:hover { background-color: #F2F6F9; } + +/* Pagination +---------------------------------------- */ + +.pagination li a { + background: #ECEDEE; + filter: none; + border-color: #B4BAC0; + box-shadow: none; + -webkit-box-shadow: none; + color: #5C758C; } -.dropdown-select:after { - border-color: #DADADA; +.pagination li.ellipsis span { + background: transparent; + color: #000000; } -.buttons div a:hover, .dropdown-select:hover, .dropdown-visible .dropdown-select, -.dropdown-visible .dropdown-select:hover, .nojs .dropdown-container:hover .dropdown-select { - border-color: #0a8ed0; - background-image: -moz-linear-gradient(top, #E9E9E9, #FFFFFF); - background-image: -webkit-linear-gradient(top, #E9E9E9, #FFFFFF); - background-image: -o-linear-gradient(top, #E9E9E9, #FFFFFF); - background-image: linear-gradient(to bottom, #E9E9E9, #FFFFFF); - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#E9E9E9', EndColorStr='#FFFFFF')"; - text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, -1px -1px 0 rgba(188, 42, 77, 0.2); +.pagination li.active span { + background: #4692BF; + border-color: #4692BF; + color: #FFFFFF; } -.dropdown-select:hover { - border-color: #C7C3BF; +.pagination li a:hover, .pagination li a:hover .icon, .pagination .dropdown-visible a.dropdown-trigger, .nojs .pagination .dropdown-container:hover a.dropdown-trigger { + background: #368AD2; + border-color: #368AD2; + filter: none; + color: #FFFFFF; + text-shadow: none; } -.dropdown-visible .dropdown-select, .dropdown-visible .dropdown-select:hover, .nojs .dropdown-container:hover .dropdown-select { - border-color: #A6B2BA; - color: #105289 !important; +/* Search box +--------------------------------------------- */ + +.search-box .inputbox, +.search-box .inputbox:hover, +.search-box .inputbox:focus { + border-color: #C7C3BF; } -.buttons div a:after, .dropdown-select-icon:before, .dropdown-select:after { - background-image: url("images/buttons.png"); +.search-header { + box-shadow: 0 0 10px #0075B0; } /* Icon images ---------------------------------------- */ -.icon-faq { background-image: url("./images/icon_faq.gif"); } -.icon-members { background-image: url("./images/icon_members.gif"); } -.icon-home { background-image: url("./images/icon_home.gif"); } -.icon-ucp { background-image: url("./images/icon_ucp.gif"); } -.icon-register { background-image: url("./images/icon_register.gif"); } -.icon-logout { background-image: url("./images/icon_logout.gif"); } -.icon-bookmark { background-image: url("./images/icon_bookmark.gif"); } -.icon-bump { background-image: url("./images/icon_bump.gif"); } -.icon-subscribe { background-image: url("./images/icon_subscribe.gif"); } -.icon-unsubscribe { background-image: url("./images/icon_unsubscribe.gif"); } -.icon-pages { background-image: url("./images/icon_pages.gif"); } -.icon-search, .responsive-search a { background-image: url("./images/icon_search.gif"); } -.icon-notification { background-image: url("./images/icon_notification.gif"); } -.icon-pm { background-image: url("./images/icon_pm.gif"); } -.icon-download { background-image: url("./images/icon_download.gif"); } -.icon-mark { background-image: url("./images/icon_mark.gif"); } + +.contact-icon { background-image: url("./images/icons_contact.png"); } /* Profile & navigation icons */ -.email-icon, .email-icon a { background-image: url("./images/icon_contact_email.gif"); } -.aim-icon, .aim-icon a { background-image: url("./images/icon_contact_aim.gif"); } -.yahoo-icon, .yahoo-icon a { background-image: url("./images/icon_contact_yahoo.gif"); } -.web-icon, .web-icon a { background-image: url("./images/icon_contact_www.gif"); } -.msnm-icon, .msnm-icon a { background-image: url("./images/icon_contact_msnm.gif"); } -.icq-icon, .icq-icon a { background-image: url("./images/icon_contact_icq.gif"); } -.jabber-icon, .jabber-icon a { background-image: url("./images/icon_contact_jabber.gif"); } -.pm-icon, .pm-icon a { background-image: url("./en/icon_contact_pm.gif"); } -.quote-icon, .quote-icon a { background-image: url("./en/icon_post_quote.gif"); } -ul.profile-icons.responsive a.responsive-menu-link { background-image: url("./images/icon_post_menu.png"); } - -/* Moderator icons */ -.report-icon, .report-icon a { background-image: url("./images/icon_post_report.gif"); } -.edit-icon, .edit-icon a { background-image: url("./en/icon_post_edit.gif"); } -.delete-icon, .delete-icon a { background-image: url("./images/icon_post_delete.gif"); } -.info-icon, .info-icon a { background-image: url("./images/icon_post_info.gif"); } -.warn-icon, .warn-icon a { background-image: url("./images/icon_user_warn.gif"); } /* Need updated warn icon */ +.pm-icon { background-position: 0 0; } +.email-icon { background-position: -21px 0; } +.jabber-icon { background-position: -80px 0; } +.phpbb_icq-icon { background-position: -61px 0 ; } +.phpbb_wlm-icon { background-position: -182px 0; } +.phpbb_aol-icon { background-position: -244px 0; } +.phpbb_website-icon { background-position: -40px 0; } +.phpbb_youtube-icon { background-position: -98px 0; } +.phpbb_facebook-icon { background-position: -119px 0; } +.phpbb_googleplus-icon { background-position: -140px 0; } +.phpbb_skype-icon { background-position: -161px 0; } +.phpbb_twitter-icon { background-position: -203px 0; } +.phpbb_yahoo-icon { background-position: -224px 0; } /* Forum icons & Topic icons */ -.global_read { background-image: url("./images/announce_read.gif"); } -.global_read_mine { background-image: url("./images/announce_read_mine.gif"); } -.global_read_locked { background-image: url("./images/announce_read_locked.gif"); } -.global_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } -.global_unread { background-image: url("./images/announce_unread.gif"); } -.global_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } -.global_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } -.global_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } - -.announce_read { background-image: url("./images/announce_read.gif"); } -.announce_read_mine { background-image: url("./images/announce_read_mine.gif"); } -.announce_read_locked { background-image: url("./images/announce_read_locked.gif"); } -.announce_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } -.announce_unread { background-image: url("./images/announce_unread.gif"); } -.announce_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } -.announce_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } -.announce_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } - -.forum_link { background-image: url("./images/forum_link.gif"); } -.forum_read { background-image: url("./images/forum_read.gif"); } -.forum_read_locked { background-image: url("./images/forum_read_locked.gif"); } -.forum_read_subforum { background-image: url("./images/forum_read_subforum.gif"); } -.forum_unread { background-image: url("./images/forum_unread.gif"); } -.forum_unread_locked { background-image: url("./images/forum_unread_locked.gif"); } -.forum_unread_subforum { background-image: url("./images/forum_unread_subforum.gif"); } - -.sticky_read { background-image: url("./images/sticky_read.gif"); } -.sticky_read_mine { background-image: url("./images/sticky_read_mine.gif"); } -.sticky_read_locked { background-image: url("./images/sticky_read_locked.gif"); } -.sticky_read_locked_mine { background-image: url("./images/sticky_read_locked_mine.gif"); } -.sticky_unread { background-image: url("./images/sticky_unread.gif"); } -.sticky_unread_mine { background-image: url("./images/sticky_unread_mine.gif"); } -.sticky_unread_locked { background-image: url("./images/sticky_unread_locked.gif"); } -.sticky_unread_locked_mine { background-image: url("./images/sticky_unread_locked_mine.gif"); } - -.topic_moved { background-image: url("./images/topic_moved.gif"); } -.topic_read { background-image: url("./images/topic_read.gif"); } -.topic_read_mine { background-image: url("./images/topic_read_mine.gif"); } -.topic_read_hot { background-image: url("./images/topic_read_hot.gif"); } -.topic_read_hot_mine { background-image: url("./images/topic_read_hot_mine.gif"); } -.topic_read_locked { background-image: url("./images/topic_read_locked.gif"); } -.topic_read_locked_mine { background-image: url("./images/topic_read_locked_mine.gif"); } -.topic_unread { background-image: url("./images/topic_unread.gif"); } -.topic_unread_mine { background-image: url("./images/topic_unread_mine.gif"); } -.topic_unread_hot { background-image: url("./images/topic_unread_hot.gif"); } -.topic_unread_hot_mine { background-image: url("./images/topic_unread_hot_mine.gif"); } -.topic_unread_locked { background-image: url("./images/topic_unread_locked.gif"); } -.topic_unread_locked_mine { background-image: url("./images/topic_unread_locked_mine.gif"); } - -.pm_read { background-image: url("./images/topic_read.gif"); } -.pm_unread { background-image: url("./images/topic_unread.gif"); } +.global_read { background-image: url("./images/announce_read.gif"); } +.global_read_mine { background-image: url("./images/announce_read_mine.gif"); } +.global_read_locked { background-image: url("./images/announce_read_locked.gif"); } +.global_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } +.global_unread { background-image: url("./images/announce_unread.gif"); } +.global_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } +.global_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } +.global_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } + +.announce_read { background-image: url("./images/announce_read.gif"); } +.announce_read_mine { background-image: url("./images/announce_read_mine.gif"); } +.announce_read_locked { background-image: url("./images/announce_read_locked.gif"); } +.announce_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } +.announce_unread { background-image: url("./images/announce_unread.gif"); } +.announce_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } +.announce_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } +.announce_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } + +.forum_link { background-image: url("./images/forum_link.gif"); } +.forum_read { background-image: url("./images/forum_read.gif"); } +.forum_read_locked { background-image: url("./images/forum_read_locked.gif"); } +.forum_read_subforum { background-image: url("./images/forum_read_subforum.gif"); } +.forum_unread { background-image: url("./images/forum_unread.gif"); } +.forum_unread_locked { background-image: url("./images/forum_unread_locked.gif"); } +.forum_unread_subforum { background-image: url("./images/forum_unread_subforum.gif"); } + +.sticky_read { background-image: url("./images/sticky_read.gif"); } +.sticky_read_mine { background-image: url("./images/sticky_read_mine.gif"); } +.sticky_read_locked { background-image: url("./images/sticky_read_locked.gif"); } +.sticky_read_locked_mine { background-image: url("./images/sticky_read_locked_mine.gif"); } +.sticky_unread { background-image: url("./images/sticky_unread.gif"); } +.sticky_unread_mine { background-image: url("./images/sticky_unread_mine.gif"); } +.sticky_unread_locked { background-image: url("./images/sticky_unread_locked.gif"); } +.sticky_unread_locked_mine { background-image: url("./images/sticky_unread_locked_mine.gif"); } + +.topic_moved { background-image: url("./images/topic_moved.gif"); } +.pm_read, +.topic_read { background-image: url("./images/topic_read.gif"); } +.topic_read_mine { background-image: url("./images/topic_read_mine.gif"); } +.topic_read_hot { background-image: url("./images/topic_read_hot.gif"); } +.topic_read_hot_mine { background-image: url("./images/topic_read_hot_mine.gif"); } +.topic_read_locked { background-image: url("./images/topic_read_locked.gif"); } +.topic_read_locked_mine { background-image: url("./images/topic_read_locked_mine.gif"); } +.pm_unread, +.topic_unread { background-image: url("./images/topic_unread.gif"); } +.topic_unread_mine { background-image: url("./images/topic_unread_mine.gif"); } +.topic_unread_hot { background-image: url("./images/topic_unread_hot.gif"); } +.topic_unread_hot_mine { background-image: url("./images/topic_unread_hot_mine.gif"); } +.topic_unread_locked { background-image: url("./images/topic_unread_locked.gif"); } +.topic_unread_locked_mine { background-image: url("./images/topic_unread_locked_mine.gif"); } + /* -------------------------------------------------------------- @@ -817,7 +765,7 @@ Colours and backgrounds for cp.css /* Main CP box ----------------------------------------*/ -.panel-container h3, .panel-container hr, #cp-menu hr { +.panel-container h3, .panel-container hr, .cp-menu hr { border-color: #A4B3BF; } @@ -839,97 +787,99 @@ ul.cplist { border-bottom-color: #333333; } -#cp-main .pm-message { +.cp-main .pm-message { border-color: #DBDEE2; background-color: #FFFFFF; } /* CP tabbed menu ----------------------------------------*/ -#tabs a { - background-image: url("./images/bg_tabs1.gif"); -} - -#tabs a span { - background-image: url("./images/bg_tabs2.gif"); +.tabs .tab > a { + background: #BACCD9; color: #536482; } -#tabs a:hover span { - color: #BC2A4D; -} - -#tabs .activetab a { - border-bottom-color: #CADCEB; +.tabs .tab > a:hover { + background: #DDEDFB; + color: #D31141; } -#tabs .activetab a span { +.tabs .activetab > a, +.tabs .activetab > a:hover { + background-color: #CADCEB; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #E2F2FF 0%, #CADCEB 100%); + background-image: linear-gradient(to bottom, #E2F2FF 0%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E2F2FF', endColorstr='#CADCEB',GradientType=0 ); /* IE6-9 */ + border-color: #CADCEB; + box-shadow: 0 1px 1px #F2F9FF inset; color: #333333; } -#tabs .activetab a:hover span { +.tabs .activetab > a:hover { color: #000000; } /* Mini tabbed menu used in MCP ----------------------------------------*/ -#minitabs li { +.minitabs .tab > a { background-color: #E1EBF2; } -#minitabs li.activetab { +.minitabs .activetab > a, +.minitabs .activetab > a:hover { background-color: #F9F9F9; -} - -#minitabs li.activetab a span, #minitabs li.activetab a:hover span { color: #333333; } /* Responsive tabs ----------------------------------------*/ -.responsive-tab .responsive-tab-link span:before { +.responsive-tab .responsive-tab-link:before { border-color: #536482; } -.responsive-tab .responsive-tab-link:hover span:before { - border-color: #BC2A4D; +.responsive-tab .responsive-tab-link:hover:before { + border-color: #D31141; } /* UCP navigation menu ----------------------------------------*/ /* Link styles for the sub-section links */ -#navigation a { +.navigation a { color: #333; - background-color: #B2C2CF; - background-image: url("./images/bg_menu.gif"); + background: #CADCEB; /* Old browsers */ /* FF3.6+ */ + background: -webkit-linear-gradient(left, #B4C4D1 50%, #CADCEB 100%); + background: linear-gradient(to right, #B4C4D1 50%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#B4C4D1', endColorstr='#CADCEB',GradientType=1 ); /* IE6-9 */ } -.rtl #navigation a { - background-image: url("./images/bg_menu_rtl.gif"); - background-position: 0 100%; +.rtl .navigation a { + background: #B4C4D1; /* Old browsers */ /* FF3.6+ */ + background: -webkit-linear-gradient(left, #CADCEB 50%, #B4C4D1 100%); + background: linear-gradient(to right, #CADCEB 50%,#B4C4D1 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#CADCEB', endColorstr='#B4C4D1',GradientType=1 ); /* IE6-9 */ } -#navigation a:hover { - background-image: none; - background-color: #aabac6; +.navigation a:hover { + background: #AABAC6; color: #BC2A4D; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } -#navigation #active-subsection a { +.navigation .active-subsection a { + background: #F9F9F9; color: #D31141; - background-color: #F9F9F9; - background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } -#navigation #active-subsection a:hover { +.navigation .active-subsection a:hover { color: #D31141; } -@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +@media only screen and (max-width: 900px), only screen and (max-device-width: 900px) { #navigation a, .rtl #navigation a { - background-image: none; + background: #B2C2CF; } } @@ -943,13 +893,13 @@ ul.cplist { background-color: #F9F9F9; } -#cp-main .pm { +.cp-main .pm { background-color: #FFFFFF; } /* Friends list */ .cp-mini { - background-color: #eef5f9; + background-color: #EEF5F9; } dl.mini dt { @@ -986,12 +936,12 @@ dl.mini dt { } /* Avatar gallery */ -#gallery label { +.gallery label { background: #FFFFFF; border-color: #CCC; } -#gallery label:hover { +.gallery label:hover { background-color: #EEE; } @@ -1043,10 +993,18 @@ fieldset.quick-login input.inputbox { /* Posting page styles ----------------------------------------*/ -#message-box textarea { +.message-box textarea { color: #333333; } +.message-box textarea.drag-n-drop { + outline-color: rgba(102, 102, 102, 0.5); +} + +.message-box textarea.drag-n-drop-highlight { + outline-color: rgba(17, 163, 234, 0.5); +} + /* Input field styles ---------------------------------------- */ .inputbox { @@ -1069,7 +1027,6 @@ fieldset.quick-login input.inputbox { .inputbox:focus { border-color: #11A3EA; - color: #0F4987; } .inputbox:focus:-moz-placeholder { @@ -1086,8 +1043,10 @@ fieldset.quick-login input.inputbox { a.button1, input.button1, input.button3, a.button2, input.button2 { color: #000; - background-color: #FAFAFA; - background-image: url("./images/bg_button.gif"); + background-color: #EFEFEF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #D2D2D2 0%, #EFEFEF 100%); + background-image: linear-gradient(to bottom, #D2D2D2 0%,#EFEFEF 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D2D2D2', endColorstr='#EFEFEF',GradientType=0 ); /* IE6-9 */ } a.button1, input.button1 { @@ -1104,14 +1063,18 @@ a.button2, input.button2, input.button3 { } /* <a> button in the style of the form buttons */ -a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active { +a.button1, a.button2 { color: #000000; } /* Hover states */ a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover { - border-color: #BC2A4D; - color: #BC2A4D; + border-color: #D31141; + color: #D31141; + background-color: #D2D2D2; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #EFEFEF 0%, #D2D2D2 100%); + background-image: linear-gradient(to bottom, #EFEFEF 0%,#D2D2D2 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#EFEFEF', endColorstr='#D2D2D2',GradientType=0 ); /* IE6-9 */ } /* Focus states */ @@ -1120,10 +1083,6 @@ input.button1:focus, input.button2:focus, input.button3:focus { color: #0F4987; } -input.search { - background-image: url("./images/icon_textbox_search.gif"); -} - input.disabled { color: #666666; } @@ -1134,40 +1093,39 @@ input.disabled { background-color: #FFFFFF; border-color: #999999; } -.phpbb_alert .alert_close { - background-image: url("./images/alert_close.png"); -} -#darken { +.darken { background-color: #000000; } -#loading_indicator { +.loading_indicator { background-color: #000000; background-image: url("./images/loading.gif"); } -#notification_list ul li { - border-bottom-color: #B9B9B9; +.dropdown-extended ul li { + border-top-color: #B9B9B9; } -#notification_list ul li:hover { +.dropdown-extended ul li:hover { background-color: #CFE1F6; color: #000000; } -#notification_list .header, .notification_list .footer { +.dropdown-extended .header, .dropdown-extended .footer { border-color: #B9B9B9; color: #000000; } -#notification_list .header { - background: #F1F8FF; - background: -moz-linear-gradient(top, #F1F8FF 0%, #CADCEB 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #F1F8FF), color-stop(100%, #CADCEB)); - background: -webkit-linear-gradient(top, #F1F8FF 0%, #CADCEB 100%); - background: -o-linear-gradient(top, #F1F8FF 0%, #CADCEB 100%); - background: -ms-linear-gradient(top, #F1F8FF 0%, #CADCEB 100%); - background: linear-gradient(to bottom, #F1F8FF 0%, #CADCEB 100%); +.dropdown-extended .footer { + border-top-style: solid; + border-top-width: 1px; +} + +.dropdown-extended .header { + background-color: #F1F8FF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #F1F8FF 0%, #CADCEB 100%); + background-image: linear-gradient(to bottom, #F1F8FF 0%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F1F8FF', endColorstr='#CADCEB',GradientType=0 ); /* IE6-9 */ } .dropdown .pointer { @@ -1178,21 +1136,13 @@ input.disabled { border-color: #FFF transparent; } -#notification_list .pointer-inner, #minitabs .pointer-inner { +.dropdown-extended .pointer-inner { border-color: #F1F8FF transparent; } -ul.linklist li.responsive-menu a.responsive-menu-link:before { - border-color: #105289; -} - -ul.linklist li.responsive-menu a.responsive-menu-link:hover:before, ul.linklist li.responsive-menu.visible a.responsive-menu-link:before { - border-color: #D31141; -} - .dropdown .dropdown-contents { background: #fff; - border-color: #b9b9b9; + border-color: #B9B9B9; box-shadow: 1px 3px 5px rgba(0, 0, 0, 0.2); } @@ -1204,6 +1154,17 @@ ul.linklist li.responsive-menu a.responsive-menu-link:hover:before, ul.linklist border-color: #DCDCDC; } -#minitabs .dropdown-contents { - background-color: #F1F8FF; +.dropdown li.separator { + border-color: #DCDCDC; +} + +/* Notifications +---------------------------------------- */ + +.notification_list p.notification-time { + color: #4C5D77; +} + +li.notification-reported strong, li.notification-disapproved strong { + color: #D31141; } diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 84f6859936..e800c63294 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -1,49 +1,3 @@ -/* CSS Reset http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 ----------------------------------------- */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} -body { - line-height: 1; -} -ol, ul { - list-style: none; -} -blockquote, q { - quotes: none; -} -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -} - /* General Markup Styles ---------------------------------------- */ html { @@ -53,14 +7,13 @@ html { } body { - /* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */ font-family: Verdana, Helvetica, Arial, sans-serif; - /*font-size: 62.5%; This sets the default font size to be equivalent to 10px */ font-size: 10px; line-height: normal; margin: 0; padding: 12px 0; word-wrap: break-word; + -webkit-print-color-adjust: exact; } h1 { @@ -113,7 +66,6 @@ img { } hr { - /* Also see tweaks.css */ border: 0 solid transparent; border-top-width: 1px; height: 1px; @@ -171,103 +123,78 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul { list-style-type: square; } +a:hover { text-decoration: underline; } /* Main blocks ---------------------------------------- */ -#wrap { - padding: 0 20px; - min-width: 650px; +.wrap { + border: 1px solid transparent; + border-radius: 8px; + margin: 0 auto; + max-width: 1152px; + min-width: 625px; + padding: 15px; } -#simple-wrap { - padding: 6px 0; +@media only screen and (max-width: 1220px), only screen and (max-device-width: 1220px) { + .wrap { + margin: 0 12px; + } } -#page-body { +.page-body { margin: 4px 0; clear: both; } -#page-footer { +.page-footer { clear: both; } -#page-footer h3 { +.page-footer h3 { margin-top: 20px; } -#logo { +.logo { float: left; width: auto; padding: 10px 13px 0 10px; } -a#logo:hover { +.logo:hover { text-decoration: none; } -/* Search box ---------------------------------------------- */ -#search-box { - position: relative; - margin-top: 30px; - margin-right: 5px; - display: block; - float: right; - text-align: right; - white-space: nowrap; /* For Opera */ -} - -#search-box #keywords { - width: 95px; -} - -#search-box input { - border: 1px solid transparent; -} - -/* .button1 style defined later, just a few tweaks for the search button version */ -#search-box input.button1 { - padding: 1px 5px; -} - -#search-box li { - text-align: right; - margin-top: 4px; -} - -#search-box img { - vertical-align: middle; - margin-right: 3px; +.site_logo { + display: inline-block; + width: 149px; + height: 52px; } /* Site description and logo */ -#site-description { +.site-description { float: left; - width: 70%; + width: 65%; } -#site-description h1 { +.site-description h1 { margin-right: 0; } /* Round cornered boxes and backgrounds ---------------------------------------- */ .headerbar { - background: transparent none repeat-x 0 0; margin-bottom: 4px; padding: 5px; border-radius: 7px; } .navbar { - padding: 0 10px; - padding: 5px 10px 5px 10px; + padding: 3px 10px; border-radius: 7px; } .forabg { - background: transparent none repeat-x 0 0; margin-bottom: 4px; padding: 5px; clear: both; @@ -275,7 +202,6 @@ a#logo:hover { } .forumbg { - background: transparent none repeat-x 0 0; margin-bottom: 4px; padding: 5px; clear: both; @@ -294,12 +220,7 @@ a#logo:hover { background-repeat: no-repeat; background-position: 100% 0; border-radius: 7px; -} - -.inner:after { - content: ''; - clear: both; - display: block; + position: relative; } .rowbg { @@ -308,43 +229,39 @@ a#logo:hover { /* Horizontal lists ----------------------------------------*/ -ul.linklist { - display: block; - margin: 0; +.navbar ul.linklist { + padding: 2px 0; + list-style-type: none; } -ul.linklist:after { - content: ''; +ul.linklist { display: block; - clear: both; + margin: 0; } -#cp-main .panel { +.cp-main .panel { padding: 5px 10px; } -ul.linklist li { - display: block; - list-style-type: none; +ul.linklist > li { float: left; - width: auto; - margin-right: 5px; font-size: 1.1em; line-height: 2.2em; + list-style-type: none; + margin-right: 7px; + padding-top: 1px; + width: auto; } -ul.linklist li.rightside, p.rightside { +ul.linklist > li.rightside, p.rightside, a.rightside { float: right; margin-right: 0; - margin-left: 5px; + margin-left: 7px; text-align: right; } ul.navlinks { - padding-bottom: 1px; - margin-bottom: 1px; - border-bottom: 1px solid transparent; - font-weight: bold; + border-top: 1px solid transparent; } ul.leftside { @@ -363,28 +280,7 @@ ul.rightside { ul.linklist li.responsive-menu { position: relative; - margin: 0 5px; -} - -ul.linklist li.responsive-menu a.responsive-menu-link { - display: inline-block; - margin: 0 5px; - font-size: 16px; - position: relative; - width: 16px; - line-height: 16.5px; - text-decoration: none; -} - -ul.linklist li.responsive-menu a.responsive-menu-link:before { - content: ''; - position: absolute; - left: 0; - top: 7px; - height: .125em; - width: 14px; - border-bottom: 0.125em solid transparent; - border-top: 0.375em double transparent; + margin: 0 5px 0 0; } .hasjs ul.linklist.leftside, .hasjs ul.linklist.rightside { @@ -403,27 +299,18 @@ li.responsive-menu.dropdown-left .dropdown { right: -6px; } -li.responsive-menu .dropdown .dropdown-contents { - padding: 0 5px; -} - -ul.linklist .dropdown-down .dropdown { +ul.linklist .dropdown { top: 22px; } ul.linklist .dropdown-up .dropdown { bottom: 18px; + top: auto; } -ul.linklist .dropdown li { - clear: both; -} - - - /* Bulletin icons for list items ----------------------------------------*/ -ul.linklist.bulletin li:before { +ul.linklist.bulletin > li:before { display: inline-block; content: "\2022"; font-size: inherit; @@ -431,29 +318,65 @@ ul.linklist.bulletin li:before { padding-right: 4px; } -ul.linklist.bulletin li:first-child:before, ul.linklist.bulletin li.rightside:last-child:before { - display: none; +ul.linklist.bulletin > li:first-child:before, +ul.linklist.bulletin > li.rightside:last-child:before { + content: none; } -ul.linklist.bulletin li.no-bulletin:before { - display: none; +ul.linklist.bulletin > li.no-bulletin:before { + content: none; } .responsive-menu:before { display: none !important; } +/* Profile in overall_header.html */ +.header-profile { + display: inline-block; + vertical-align: top; +} + +.header-avatar:hover { + text-decoration: none; +} + +.header-avatar img { + margin-bottom: 2px; + max-height: 20px; + vertical-align: middle; + width: auto; +} + +.header-avatar span:after { + content: '\f0dd'; + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + padding-left: 6px; + padding-top: 2px; + vertical-align: top; +} + /* Dropdown menu ----------------------------------------*/ .dropdown-container { position: relative; } +.dropdown-container-right { + float: right; +} + +.dropdown-container-left { + float: left; +} + .nojs .dropdown-container:hover .dropdown { display: block !important; } .dropdown { + display: none; position: absolute; left: 0; top: 1.2em; @@ -461,6 +384,11 @@ ul.linklist.bulletin li.no-bulletin:before { border: 1px solid transparent; border-radius: 5px; padding: 9px 0 0; + margin-right: -500px; +} + +.dropdown.live-search { + top: auto; } .dropdown-container.topic-tools { @@ -476,6 +404,8 @@ ul.linklist.bulletin li.no-bulletin:before { .dropdown-left .dropdown, .nojs .rightside .dropdown { left: auto; right: 0; + margin-left: -500px; + margin-right: 0; } .dropdown-button-control .dropdown { @@ -507,12 +437,12 @@ ul.linklist.bulletin li.no-bulletin:before { .dropdown .pointer { right: auto; left: 10px; - top: 0; + top: -1px; z-index: 3; } .dropdown-up .pointer { - bottom: 0; + bottom: -1px; top: auto; } @@ -540,28 +470,86 @@ ul.linklist.bulletin li.no-bulletin:before { border-radius: 5px; padding: 5px; position: relative; - min-width: 40px; - max-height: 200px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; + max-height: 300px; +} + +.dropdown-contents a { + display: block; + padding: 5px; +} + +.jumpbox { + margin: 5px 0; +} + +.jumpbox .dropdown li { + border-top: 1px solid transparent; +} + +.jumpbox .dropdown-select { + margin: 0; +} + +.jumpbox .dropdown-contents { + padding: 0; + text-decoration: none; +} + +.jumpbox .dropdown-contents li { + padding: 0; +} + +.jumpbox .dropdown-contents a { + margin-right: 20px; + padding: 5px 10px; + text-decoration: none; + width: 100%; +} + +.jumpbox .spacer { + display: inline-block; + width: 0px; +} + +.jumpbox .spacer + .spacer { + width: 20px; +} + +.dropdown-contents a { + display: block; + padding: 5px; +} + +.jumpbox .dropdown-select { + margin: 0; +} + +.jumpbox .dropdown-contents a { + text-decoration: none; } .dropdown li { - border-bottom: 1px dotted transparent; + display: list-item; + border-top: 1px dotted transparent; float: none !important; line-height: normal !important; font-size: 1em !important; list-style: none; margin: 0; - padding-top: 4px; - padding-bottom: 4px; white-space: nowrap; text-align: left; } -.dropdown li:last-child, .dropdown li li { - border-bottom: 0; +.dropdown-contents > li { + padding-right: 15px; +} + +.dropdown-nonscroll > li { + padding-right: 0; +} + +.dropdown li:first-child, .dropdown li.separator + li, .dropdown li li { + border-top: 0; } .dropdown li li:first-child { @@ -574,25 +562,41 @@ ul.linklist.bulletin li.no-bulletin:before { .dropdown li li { border-top: 1px dotted transparent; - padding-left: 10px; + padding-left: 18px; } -.wrap .dropdown li, .dropdown.wrap li, #notification_list li { +.wrap .dropdown li, .dropdown.wrap li, .dropdown-extended li { white-space: normal; } -.dropdown li:before, .dropdown li:after { +.dropdown li.separator { + border-top: 1px solid transparent; + padding: 0; +} + +.dropdown li.separator:first-child, .dropdown li.separator:last-child { display: none !important; } /* Responsive breadcrumbs ----------------------------------------*/ .breadcrumbs .crumb { + float: left; + font-weight: bold; word-wrap: normal; } +.breadcrumbs .crumb:before { + content: '\2039'; + font-weight: bold; + padding: 0 0.5em; +} + +.breadcrumbs .crumb:first-child:before { + content: none; +} + .breadcrumbs .crumb a { - display: inline-block; white-space: nowrap; text-overflow: ellipsis; vertical-align: bottom; @@ -615,7 +619,7 @@ table.table1 { width: 100%; } -#ucp-main table.table1 { +.ucp-main table.table1 { padding: 2px; } @@ -652,6 +656,8 @@ table.table1 tbody th { /* Specific column styles */ table.table1 .name { text-align: left; } +table.table1 .center { text-align: center; } +table.table1 .reportby { width: 15%; } table.table1 .posts { text-align: center; width: 7%; } table.table1 .joined { text-align: left; width: 15%; } table.table1 .active { text-align: left; width: 15%; } @@ -685,15 +691,14 @@ table.info tbody th { margin: 0 -1px; } -#color_palette_placeholder table { +.color_palette_placeholder table { border-collapse: separate; border-spacing: 1px; } /* Misc layout styles ---------------------------------------- */ -/* column[1-2] styles are containers for two column layouts - Also see tweaks.css */ +/* column[1-2] styles are containers for two column layouts */ .column1 { float: left; clear: left; @@ -711,6 +716,7 @@ table.info tbody th { float: left; width: auto; text-align: left; + max-width: 100%; } .left-box.profile-details { @@ -721,6 +727,7 @@ table.info tbody th { float: right; width: auto; text-align: right; + max-width: 100%; } dl.details { @@ -750,78 +757,150 @@ dl.details dd { overflow: hidden; } +fieldset.fields1 ul.recipients { + list-style-type: none; + line-height: 1.8; + max-height: 150px; + overflow-y: auto; +} + +fieldset.fields1 dd.recipients { + clear: left; + margin-left: 1em; +} + +fieldset.fields1 ul.recipients input.button2{ + font-size: 0.8em; + margin-right: 0; + padding: 0; +} + +fieldset.fields1 dl.pmlist > dt { + width: auto !important; +} + +fieldset.fields1 dl.pmlist dd.recipients { + margin-left: 0 !important; +} + +/* Action-bars (container for post/reply buttons, pagination, etc.) +---------------------------------------- */ +.action-bar { + font-size: 11px; + margin: 4px 0; +} + +.forabg + .action-bar { + margin-top: 2em; +} + +.action-bar .button { + margin-right: 5px; + float: left; +} + +.action-bar .button-search { + margin-right: 0; +} /* Pagination ---------------------------------------- */ .pagination { - width: auto; - text-align: right; - margin-top: 5px; float: right; + text-align: right; + width: auto; } -li.pagination { +.action-bar.bar-bottom .pagination { margin-top: 0; } -.pagination img { - vertical-align: middle; +.action-bar .pagination .button { + margin-right: 0; + float: none; } -.pagination ul { +.pagination > ul { display: inline-block; - *display: inline; /* IE7 inline-block hack */ - *zoom: 1; - margin-left: 0; - margin-bottom: 0; -} - -li.pagination ul { - margin-top: -2px; - vertical-align: middle; + list-style: none !important; + margin-left: 5px; } -.pagination ul li, dl .pagination ul li, dl.icon .pagination ul li { - display: inline; +.pagination > ul > li { + display: inline-block !important; padding: 0; font-size: 100%; line-height: normal; + vertical-align: middle; +} + +.pagination li a, .pagination li span { + border-radius: 2px; + padding: 2px 5px; } -.pagination li a, .pagnation li span, li .pagination li a, li .pagination li span, .pagination li.active span, .pagination li.ellipsis span { +.pagination li.active span { + display: inline-block; + font-size: 13px; font-weight: normal; - text-decoration: none; - padding: 0 2px; + font-family: "Open Sans", "Droid Sans", Verdana, Arial, Helvetica; + line-height: 1.4; + text-align: center; + white-space: nowrap; + vertical-align: middle; border: 1px solid transparent; - font-size: 0.9em; - line-height: 1.5em; +} + +.pagination li.ellipsis span { + border: none; + padding: 0; +} + +.pagination li.page-jump { + margin-right: 5px; +} + +.pagination li.page-jump a { + padding: 0 8px; +} + +.pagination li.page-jump a i { + font-size: 21px; +} + +.pagination .arrow a { + padding: 2px 0; } /* Pagination in viewforum for multipage topics */ .row .pagination { display: block; - float: right; - width: auto; - margin-top: 0; - padding: 1px 0 1px 8px; - font-size: 0.9em; - background: none 0 50% no-repeat; + margin-top: -12px; +} + +.row .pagination > ul { + margin: 0; +} + +.row .pagination li a, .row .pagination li span { + border-radius: 2px; + padding: 1px 3px; + font-size: 9px; } /* jQuery popups ---------------------------------------- */ .phpbb_alert { border: 1px solid transparent; - position: fixed; display: none; - top: 150px; left: 0; + padding: 0 25px 20px 25px; + position: fixed; right: 0; - max-width: 640px; - margin: 0 auto; + top: 150px; z-index: 50; - padding: 25px; - padding: 0 25px 20px 25px; + width: 620px; + margin: 0 auto; } @media only screen and (max-height: 500px), only screen and (max-device-width: 500px) @@ -832,18 +911,9 @@ li.pagination ul { } .phpbb_alert .alert_close { - display: block; float: right; - width: 16px; - height: 16px; - overflow: hidden; - text-decoration: none !important; - background: transparent none 0 0 no-repeat; - margin-top: -7px; - margin-right: -31px; -} -.phpbb_alert .alert_close:hover { - background-position: 0 -16px; + margin-right: -36px; + margin-top: -8px; } .phpbb_alert p { @@ -865,13 +935,13 @@ li.pagination ul { font-size: 1.1em; } -#darkenwrapper { +.darkenwrapper { display: none; position: relative; z-index: 44; } -#darken { +.darken { position: fixed; left: 0; top: 0; @@ -881,7 +951,7 @@ li.pagination ul { z-index: 45; } -#loading_indicator { +.loading_indicator { background: center center no-repeat; border-radius: 5px; display: none; @@ -898,15 +968,6 @@ li.pagination ul { /* Miscellaneous styles ---------------------------------------- */ -#forum-permissions { - float: right; - width: auto; - padding-left: 5px; - margin-left: 5px; - margin-top: 10px; - text-align: right; -} - .copyright { padding: 5px; text-align: center; @@ -943,28 +1004,20 @@ div.rules ul, div.rules ol { p.post-notice { position: relative; padding: 5px; - padding-left: 26px; min-height: 14px; margin-bottom: 1em; } -p.post-notice:before { - content: ''; - display: block; - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 28px; - background: transparent none 50% 50% no-repeat; - pointer-events: none; -} - form > p.post-notice strong { line-height: 20px; } -#top { +.stat-block { + clear: both; +} + +.top-anchor { + display: block; position: absolute; top: -20px; } @@ -977,8 +1030,18 @@ form > p.post-notice strong { background: transparent; } -.hidden { - display: none; +/* Inner box-model clearing */ +.inner:after, +ul.linklist:after, +.action-bar:after, +.notification_text:after, +.tabs-container:after, +.tabs > ul:after, +.minitabs > ul:after, +.postprofile .avatar-container:after { + clear: both; + content: ''; + display: block; } .smilies { @@ -989,66 +1052,101 @@ form > p.post-notice strong { position: relative; } -#notification_list { +.member-search { + float: left; + margin: 0; + padding: 6px 10px; +} + +.member-search strong { + font-size: 0.95em; +} + +.dropdown-extended { display: none; - position: absolute; - left: 0; - width: 330px; z-index: 1; - top: 22px; } -#notification_list ul { +.dropdown-extended ul { max-height: 350px; overflow-y: auto; overflow-x: hidden; clear: both; } -#notification_list ul li { - padding: 10px; - margin: 0; +.dropdown-extended ul li { + padding: 0; + margin: 0 !important; float: none; - border-bottom: 1px solid; + border-top: 1px solid; list-style-type: none; font-size: 0.95em; clear: both; position: relative; } -#notification_list ul li:before, #notification_list ul li:after { - display: none; +.dropdown-extended ul li:first-child { + border-top: none; } -#notification_list .dropdown-contents { +.dropdown-extended ul li.no_notifications { + padding: 10px; +} + +.dropdown-extended .dropdown-contents { max-height: none; padding: 0; + position: absolute; + width: 340px; } -#notification_list .header { +.nojs .dropdown-extended .dropdown-contents { + position: relative; +} + +.dropdown-extended .header { padding: 0 10px; font-family: Arial, "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 11px; font-weight: bold; + text-align: left; text-shadow: 1px 1px 1px white; - text-transform: uppercase; - line-height: 30px; + text-transform: uppercase; + line-height: 3em; border-bottom: 1px solid; border-radius: 5px 5px 0 0; } -#notification_list .header .header_settings { +.dropdown-extended .header .header_settings { float: right; font-weight: normal; text-transform: none; } -#notification_list .footer { +.dropdown-extended .header .header_settings a { + display: inline-block; + padding: 0 5px; +} + +.dropdown-extended .header:after { + content: ''; + display: table; + clear: both; +} + +.dropdown-extended .footer { text-align: center; - font-size: 1.2em; + font-size: 1.1em; +} + +.dropdown-extended ul li a, .dropdown-extended ul li.no-url { + padding: 8px; } -#notification_list ul li a, .notification_list dt > a, #notification_list .footer > a { +.dropdown-extended .footer > a { + padding: 5px 0; +} + +.dropdown-extended ul li a, .notification_list dt > a, .dropdown-extended .footer > a { display: block; text-decoration: none; } @@ -1056,39 +1154,88 @@ form > p.post-notice strong { .notification_list ul li img { float: left; max-height: 50px; + max-width: 50px; width: auto !important; height: auto !important; margin-right: 5px; } .notification_list ul li p { + margin-bottom: 4px; + font-size: 1em; +} + +.notification_list p.notification-reference, +.notification_list p.notification-location, +.notification_list li a p.notification-reason { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.notification_list p.notification-time { + font-size: 0.9em; margin: 0; + text-align: right; } .notification_list div.notifications { + margin-left: 50px; padding: 5px; } +.notification_list div.notifications a { + display: block; +} + .notification_list p.notifications_title { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - font-size: 13px !important; + font-size: 1.2em !important; +} + +.notification_list p.notifications_title strong { font-weight: bold; } .notification_list p.notifications_time { - font-size: 11px !important; + font-size: 0.9em !important; } -.notification_text:after { - content: ''; - clear: both; - display: block; +.notification_text { + margin-left: 58px; } -.compact .icon-notification > a > span, .compact .icon-pm > a > span { +/* Navbar specific list items +----------------------------------------*/ + +.linklist .quick-links { + margin: 0 7px 0 0; +} + +.linklist.compact .rightside > a > span span { display: none; } -.compact .icon-notification > a > strong, .compact .icon-pm > a > strong { +.linklist.compact .rightside > a strong { padding-left: 2px; } + +.dropdown-page-jump .dropdown { + top: 20px; +} + +.dropdown-page-jump.dropdown-up .dropdown { + bottom: 20px; +} + +.dropdown-page-jump input.tiny { + width: 50px; +} + +.dropdown .clone.hidden + li.separator { + display: none; +} + +.dropdown .clone.hidden + li { + border-top: none; +} diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 389f93fa4e..ef18e26ef1 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -7,10 +7,6 @@ ul.topiclist { margin: 0; } -ul.forums { - background: transparent none repeat-x 0 0; -} - ul.topiclist li { display: block; list-style-type: none; @@ -32,12 +28,12 @@ ul.topiclist dt, ul.topiclist dd { ul.topiclist dt { width: 100%; - margin-right: -410px; + margin-right: -440px; font-size: 1.1em; } ul.topiclist.missing-column dt { - margin-right: -330px; + margin-right: -345px; } ul.topiclist.two-long-columns dt { @@ -49,13 +45,13 @@ ul.topiclist.two-columns dt { } ul.topiclist dt .list-inner { - margin-right: 410px; + margin-right: 440px; padding-left: 5px; padding-right: 5px; } ul.topiclist.missing-column dt .list-inner { - margin-right: 330px; + margin-right: 345px; } ul.topiclist.two-long-columns dt .list-inner { @@ -81,15 +77,6 @@ ul.topiclist dfn { width: 990px; } -ul.topiclist li.row dt a.subforum { - background-image: none; - background-position: 0 50%; - background-repeat: no-repeat; - position: relative; - white-space: nowrap; - padding: 0 0 0 12px; -} - .forum-image { float: left; padding-top: 5px; @@ -119,11 +106,11 @@ li.header dt, li.header dd { li.header dt { font-weight: bold; width: 100%; - margin-right: -410px; + margin-right: -440px; } li.header dt .list-inner { - margin-right: 410px; + margin-right: 440px; } li.header dd { @@ -133,35 +120,51 @@ li.header dd { box-sizing: border-box; } -li.header dl.icon dt, li.header dl.icon dd { +li.header dl.row-item dt, li.header dl.row-item dd { min-height: 0; } -li.header dl.icon dt .list-inner { +li.header dl.row-item dt .list-inner { /* Tweak for headers alignment when folder icon used */ padding-left: 0; padding-right: 50px; } /* Forum list column styles */ -dl.icon { +dl.row-item { background-position: 10px 50%; /* Position of folder icon */ background-repeat: no-repeat; } -dl.icon dt { +dl.row-item dt { background-repeat: no-repeat; background-position: 5px 95%; /* Position of topic icon */ } -dl.icon dt .list-inner { +dl.row-item dt .list-inner { padding-left: 45px; /* Space for folder icon */ } -dl.icon dt, dl.icon dd { +dl.row-item dt, dl.row-item dd { min-height: 35px; } +dl.row-item dt a { + display: inline; +} + +dl a.row-item-link { /* topic row icon links */ + display: block; + width: 30px; + height: 30px; + padding: 0; + position: absolute; + top: 50%; + left: 0; + margin-top: -15px; + margin-left: 9px; +} + dd.posts, dd.topics, dd.views, dd.extra, dd.mark { width: 80px; text-align: center; @@ -169,14 +172,18 @@ dd.posts, dd.topics, dd.views, dd.extra, dd.mark { font-size: 1.2em; } +dd.posts, dd.topics, dd.views { + width: 95px; +} + /* List in forum description */ -dl.icon dt ol, -dl.icon dt ul { +dl.row-item dt ol, +dl.row-item dt ul { list-style-position: inside; margin-left: 1em; } -dl.icon dt li { +dl.row-item dt li { display: list-item; list-style-type: inherit; } @@ -194,7 +201,7 @@ dd.time { line-height: 200%; } -dd.lastpost span, ul.topiclist dd.info span, ul.topiclist dd.time span, dd.redirect span, dd.moderation span { +dd.lastpost > span, ul.topiclist dd.info > span, ul.topiclist dd.time > span, dd.redirect > span, dd.moderation > span { display: block; padding-left: 5px; } @@ -210,17 +217,6 @@ dd.option { font-size: 1.1em; } -/* Container for post/reply buttons and pagination */ -.topic-actions { - margin-bottom: 3px; - font-size: 1.1em; - height: 28px; - min-height: 28px; -} -div[class].topic-actions { - height: auto; -} - /* Post body styles ----------------------------------------*/ .postbody { @@ -228,6 +224,7 @@ div[class].topic-actions { line-height: 1.48em; width: 76%; float: left; + position: relative; } .postbody .ignore { @@ -244,7 +241,8 @@ div[class].topic-actions { float: left; font-size: 1.5em; padding: 2px 0 0 0; - margin: 0 0 0.3em 0 !important; + margin-top: 0 !important; + margin-bottom: 0.3em !important; text-transform: none; border: none; font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; @@ -252,43 +250,55 @@ div[class].topic-actions { } .postbody h3 img { - /* Also see tweaks.css */ vertical-align: bottom; } +.has-profile .postbody h3 { + /* If there is a post-profile, we position the post-buttons differently */ + float: none !important; + margin-right: 180px; +} + .postbody .content { font-size: 1.3em; overflow-x: auto; } +.postbody img.postimage { + max-width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + .search .postbody { width: 68% } /* Topic review panel ----------------------------------------*/ -#review { +.panel .review { margin-top: 2em; } -#topicreview { +.topicreview { padding-right: 5px; overflow: auto; height: 300px; } -#topicreview .postbody { +.topicreview .postbody { width: auto; float: none; margin: 0; height: auto; } -#topicreview .post { +.topicreview .post { height: auto; } -#topicreview h2 { +.topicreview h2 { border-bottom-width: 0; } @@ -298,7 +308,7 @@ div[class].topic-actions { /* MCP Post details ----------------------------------------*/ -#post_details { +.post_details { /* This will only work in IE7+, plus the others */ overflow: auto; max-height: 300px; @@ -342,10 +352,6 @@ div[class].topic-actions { line-height: 1.4em; } -span.corners-top, span.corners-bottom { - display: none; -} - dl.faq { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; font-size: 1.1em; @@ -368,8 +374,7 @@ dl.faq dt { } .content ul, .content ol { - margin-bottom: 1em; - margin-left: 3em; + margin: 0.8em 0 0.9em 3em; } .posthilit { @@ -415,8 +420,7 @@ dd .signature { } .signature ul, .signature ol { - margin-bottom: 1em; - margin-left: 3em; + margin: 0.8em 0 0.9em 3em; } /* Post noticies */ @@ -445,7 +449,7 @@ blockquote { background: transparent none 6px 8px no-repeat; border: 1px solid transparent; font-size: 0.95em; - margin: 0.5em 1px 0 25px; + margin: 1em 1px 1em 25px; overflow: hidden; padding: 5px; } @@ -453,7 +457,7 @@ blockquote { blockquote blockquote { /* Nested quotes */ font-size: 1em; - margin: 0.5em 1px 0 15px; + margin: 1em 1px 1em 15px; } blockquote cite { @@ -473,18 +477,29 @@ blockquote.uncited { padding-top: 25px; } +blockquote cite > div { + float: right; + font-weight: normal; +} + +.postbody .content li blockquote { + overflow: inherit; + margin-left: 0; +} + /* Code block */ .codebox { padding: 3px; border: 1px solid transparent; font-size: 1em; + margin: 1em 0 1.2em 0; } .codebox p { text-transform: uppercase; border-bottom: 1px solid transparent; margin-bottom: 3px; - font-size: 0.8em; + font-size: 0.8em !important; font-weight: bold; display: block; } @@ -494,12 +509,10 @@ blockquote .codebox { } .codebox code { - /* Also see tweaks.css */ overflow: auto; display: block; height: auto; max-height: 200px; - white-space: normal; padding-top: 5px; font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; line-height: 1.3em; @@ -510,7 +523,7 @@ blockquote .codebox { ----------------------------------------*/ .attachbox { float: left; - width: auto; + width: auto; max-width: 100%; margin: 5px 5px 5px 0; padding: 6px; @@ -554,8 +567,6 @@ blockquote .codebox { .attach-image { margin: 3px 0; max-width: 100%; - max-height: 350px; - overflow: auto; } .attach-image img { @@ -589,12 +600,13 @@ dl.file dt { dl.file dd { margin: 0; - padding: 0; + padding: 0; } dl.thumbnail img { padding: 3px; border: 1px solid transparent; + box-sizing: border-box; } dl.thumbnail dd { @@ -659,7 +671,7 @@ fieldset.polls dd div { text-align: right; font-family: Arial, Helvetica, sans-serif; font-weight: bold; - padding: 0 2px; + padding: 2px 2px 0 2px; overflow: visible; min-width: 8px; } @@ -678,7 +690,6 @@ fieldset.polls dd div { /* Poster profile block ----------------------------------------*/ .postprofile { - /* Also see tweaks.css */ margin: 5px 0 10px 0; min-height: 80px; border: 1px solid transparent; @@ -706,15 +717,46 @@ fieldset.polls dd div { margin-bottom: 10px; } +/* Post-profile avatars */ +.postprofile .has-avatar .avatar-container { + margin-bottom: 3px; + overflow: hidden; +} + .postprofile .avatar { display: block; - border: none; - margin-bottom: 3px; + float: left; + max-width: 100%; } .postprofile .avatar img { - max-width: 90%; + display: block; height: auto !important; + max-width: 100%; +} + +.postprofile .profile-posts a { + font-weight: normal; +} + +dd.profile-warnings { + font-weight: bold; +} + +dd.profile-contact { + overflow: visible; +} + +.profile-contact .dropdown-container { + display: inline-block; +} + +.profile-contact .icon_contact { + vertical-align: middle; +} + +.profile-contact .dropdown { + margin-right: -14px; } .online { @@ -728,6 +770,11 @@ fieldset.polls dd div { width: 30%; } +/* Profile used on view-profile */ +.profile-avatar img { + max-width: 100%; +} + /* pm list in compose message if mass pm is enabled */ dl.pmlist dt { width: 60% !important; @@ -742,7 +789,7 @@ dl.pmlist dd { margin-bottom: 2px; } -.topic-actions div.dl_links { +.action-bar div.dl_links { padding: 10px 0 0 10px; } @@ -765,9 +812,24 @@ div.dl_links { display: inline-block; } +.attachment-filename { + width: 100%; +} + +.ellipsis-text { + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +table.fixed-width-table { + table-layout: fixed; +} + /* Show scrollbars for items with overflow on iOS devices ----------------------------------------*/ -.postbody .content::-webkit-scrollbar, #topicreview::-webkit-scrollbar, #post_details::-webkit-scrollbar, .codebox code::-webkit-scrollbar, .attachbox dd::-webkit-scrollbar, .attach-image::-webkit-scrollbar, #notification_list ul::-webkit-scrollbar { +.postbody .content::-webkit-scrollbar, .topicreview::-webkit-scrollbar, .post_details::-webkit-scrollbar, .codebox code::-webkit-scrollbar, .attachbox dd::-webkit-scrollbar, .attach-image::-webkit-scrollbar, .dropdown-extended ul::-webkit-scrollbar { width: 8px; height: 8px; -webkit-appearance: none; @@ -775,7 +837,11 @@ div.dl_links { border-radius: 3px; } -.postbody .content::-webkit-scrollbar-thumb, #topicreview::-webkit-scrollbar-thumb, #post_details::-webkit-scrollbar-thumb, .codebox code::-webkit-scrollbar-thumb, .attachbox dd::-webkit-scrollbar-thumb, .attach-image::-webkit-scrollbar-thumb, #notification_list ul::-webkit-scrollbar-thumb { +.postbody .content::-webkit-scrollbar-thumb, .topicreview::-webkit-scrollbar-thumb, .post_details::-webkit-scrollbar-thumb, .codebox code::-webkit-scrollbar-thumb, .attachbox dd::-webkit-scrollbar-thumb, .attach-image::-webkit-scrollbar-thumb, .dropdown-extended ul::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .3); border-radius: 3px; } + +#memberlist tr.inactive, #team tr.inactive { + font-style: italic; +} diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css index bf235b3fb5..d54c948343 100644 --- a/phpBB/styles/prosilver/theme/cp.css +++ b/phpBB/styles/prosilver/theme/cp.css @@ -4,19 +4,19 @@ /* Main CP box ----------------------------------------*/ -#cp-menu { +.cp-menu { float:left; width: 19%; margin-top: 1em; margin-bottom: 5px; } -#cp-main { +.cp-main { float: left; width: 81%; } -#cp-main .content { +.cp-main .content { padding: 0; } @@ -59,17 +59,7 @@ ul.cplist { border-bottom: none; } -#cp-main .pagination { - float: right; - width: auto; - padding-top: 1px; -} - -#cp-main .postbody p { - font-size: 1.1em; -} - -#cp-main .pm-message { +.cp-main .pm-message { border: 1px solid transparent; margin: 10px 0; width: auto; @@ -80,15 +70,19 @@ ul.cplist { padding-bottom: 5px; } -#cp-main .postbody h3, #cp-main .box2 h3 { +.cp-main .postbody h3, .cp-main .box2 h3 { margin-top: 0; } -#cp-main .buttons { +.panel-container .postbody p.author { + font-size: 1.1em; +} + +.cp-main .buttons { margin-left: 0; } -#cp-main ul.linklist { +.cp-main ul.linklist { margin: 0; } @@ -102,118 +96,71 @@ ul.cplist { margin-bottom: 0px; } -.tabs-container:after { - display: block; - clear: both; - content: ''; -} - -/* CP tabbed menu +/* CP tabs shared ----------------------------------------*/ -#tabs { +.tabs, .minitabs { line-height: normal; - margin: 20px 0 -1px 7px; - *overflow: hidden; } -#tabs ul { - margin:0; - padding: 0; +.tabs > ul, .minitabs > ul { list-style: none; + margin: 0; + padding: 0; + position: relative; } -#tabs ul:after { - content: ''; +.tabs .tab, .minitabs .tab { display: block; - clear: both; -} - -#tabs li { - display: inline; - margin: 0; - padding: 0; + float: left; font-size: 1em; font-weight: bold; + line-height: 1.4em; } -#tabs a { - float: left; - background: none no-repeat 0% -35px; - margin: 0 1px 0 0; - padding: 0 0 0 5px; - text-decoration: none; +.tabs .tab > a, .minitabs .tab > a { + display: block; + padding: 5px 9px; position: relative; + text-decoration: none; + white-space: nowrap; cursor: pointer; } -#tabs a span { - float: left; - display: block; - background: none no-repeat 100% -35px; - padding: 6px 10px 6px 5px; - white-space: nowrap; +/* CP tabbed menu +----------------------------------------*/ +.tabs { + margin: 20px 0 0 7px; } -#tabs .activetab a { - background-position: 0 0; - border-bottom: 1px solid transparent; +.tabs .tab > a { + border: 1px solid transparent; + border-radius: 4px 4px 0 0; + margin: 1px 1px 0 0; } -#tabs .activetab a span { - background-position: 100% 0; +.tabs .activetab > a { + margin-top: 0; padding-bottom: 7px; } -#tabs a:hover { - background-position: 0 -70px; -} - -#tabs a:hover span { - background-position:100% -70px; -} - -#tabs .activetab a:hover { - background-position: 0 0; -} - -#tabs .activetab a:hover span { - background-position: 100% 0; -} - /* Mini tabbed menu used in MCP ----------------------------------------*/ -#minitabs { - line-height: normal; - margin: -20px 7px 0 0; -} - -.tabs-container #minitabs { +.minitabs { float: right; - margin-top: 19px; + margin: 15px 7px 0 0; max-width: 50%; } -#minitabs ul { - margin:0; - padding: 0; - list-style: none; -} - -#minitabs li { - display: block; +.minitabs .tab { float: right; - border-top-left-radius: 5px; - border-top-right-radius: 5px; - padding: 5px 10px 4px 10px; - font-size: 1em; - font-weight: bold; - margin-left: 2px; } -#minitabs a { +.minitabs .tab > a { + border-radius: 5px 5px 0 0; + margin-left: 2px; } -#minitabs a:hover { +.minitabs .tab > a:hover { text-decoration: none; } @@ -223,132 +170,85 @@ ul.cplist { position: relative; } -.responsive-tab .responsive-tab-link span { - display: inline-block; - font-size: 16px; +.responsive-tab > a.responsive-tab-link { + display: block; + font-size: 1.6em; position: relative; width: 16px; - line-height: 14px; + line-height: 0.9em; text-decoration: none; } -#minitabs .responsive-tab .responsive-tab-link span { - display: block; -} - -.responsive-tab .responsive-tab-link span:before { +.responsive-tab .responsive-tab-link:before { content: ''; position: absolute; - left: 5px; - top: 8px; + left: 10px; + top: 7px; height: .125em; width: 14px; border-bottom: 0.125em solid transparent; border-top: 0.375em double transparent; } -#minitabs .responsive-tab .responsive-tab-link span:before { - left: 0; - top: 2px; -} - -#tabs ul, #minitabs ul { - position: relative; -} - -#tabs .dropdown, #minitabs .dropdown { - top: 29px; - margin-right: -1px; +.tabs .dropdown, .minitabs .dropdown { + top: 20px; + margin-right: -2px; + font-size: 1.1em; + font-weight: normal; } -#minitabs .dropdown { - top: 18px; +.minitabs .dropdown { + margin-right: -4px; } -#tabs .dropdown-up .dropdown, #minitabs .dropdown-up .dropdown { - bottom: -5px; +.tabs .dropdown-up .dropdown, .minitabs .dropdown-up .dropdown { + bottom: 20px; top: auto; } -#minitabs .dropdown-up .dropdown { - bottom: 18px; -} - -#tabs .dropdown-right .dropdown, #minitabs .dropdown-right .dropdown { - margin-left: -41px; -} - -#tabs .dropdown li, #minitabs .dropdown li { - display: block !important; - background: transparent none; - padding: 0; -} - -.tabs-container #minitabs .dropdown a span { - display: block; -} - -#tabs .dropdown a, #tabs .dropdown a span, #minitabs .dropdown a, #minitabs .dropdown a span { - background: transparent; - float: none; - margin: 0; - padding: 0; +.tabs .dropdown li { text-align: right; } -.tabs-container #minitabs .dropdown a span { +.minitabs .dropdown li { text-align: left; } -#tabs .dropdown a span, #minitabs .dropdown a span { - padding: 5px 8px; - color: inherit !important; -} - - /* UCP navigation menu ----------------------------------------*/ /* Container for sub-navigation list */ -#navigation { +.navigation { width: 100%; padding-top: 36px; } -#navigation ul { - list-style:none; +.navigation ul { + list-style: none; } /* Default list state */ -#navigation li { +.navigation li { + display: inline; + font-weight: bold; margin: 1px 0; padding: 0; - font-weight: bold; - display: inline; } /* Link styles for the sub-section links */ -#navigation a { +.navigation a { display: block; padding: 5px; margin: 1px 0; text-decoration: none; - font-weight: bold; - background: transparent none repeat-y 100% 0; } -#navigation a:hover { +.navigation a:hover { text-decoration: none; - background-image: none; -} - -#navigation #active-subsection a { - display: block; - background-image: none; } /* Preferences pane layout ----------------------------------------*/ -#cp-main h2 { +.cp-main h2 { border-bottom: none; padding: 0; margin-left: 10px; @@ -357,6 +257,8 @@ ul.cplist { /* Friends list */ .cp-mini { margin: 10px 15px 10px 5px; + max-height: 200px; + overflow-y: auto; padding: 5px 10px; border-radius: 7px; } @@ -379,10 +281,6 @@ dl.mini dd { /* PM Styles ----------------------------------------*/ -#pm-menu { - line-height: 2.5em; -} - /* Defined rules list for PM options */ ol.def-rules { padding-left: 0; @@ -407,7 +305,7 @@ ol.def-rules li { border-right-color: transparent; } -.pmlist li.pm_marked_colour, .pm_marked_colour, +.pmlist li.pm_marked_colour, .pm_marked_colour, .pmlist li.pm_replied_colour, .pm_replied_colour, .pmlist li.pm_friend_colour, .pm_friend_colour, .pmlist li.pm_foe_colour, .pm_foe_colour { @@ -425,7 +323,7 @@ ol.def-rules li { } /* Avatar gallery */ -#gallery label { +.gallery label { position: relative; float: left; margin: 10px; @@ -439,35 +337,35 @@ ol.def-rules li { ----------------------------------------*/ @media only screen and (max-width: 900px), only screen and (max-device-width: 900px) { - .nojs #tabs a span, .nojs #minitabs a span { - max-width: 40px; + .nojs .tabs a span, .nojs .minitabs a span { + max-width: 40px; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.5px; } - #cp-menu, #navigation, #cp-main { + .cp-menu, .navigation, .cp-main { float: none; width: auto; margin: 0; } - #navigation { - padding: 0; + .navigation { + padding: 0; margin: 0 auto; max-width: 320px; } - #navigation a { + .navigation a { background-image: none; } - #navigation li:first-child a { + .navigation li:first-child a { border-top-left-radius: 5px; border-top-right-radius: 5px; } - #navigation li:last-child a { + .navigation li:last-child a { border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; } diff --git a/phpBB/styles/prosilver/theme/en/icon_contact_pm.gif b/phpBB/styles/prosilver/theme/en/icon_contact_pm.gif Binary files differdeleted file mode 100644 index ec190118fe..0000000000 --- a/phpBB/styles/prosilver/theme/en/icon_contact_pm.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/icon_post_edit.gif b/phpBB/styles/prosilver/theme/en/icon_post_edit.gif Binary files differdeleted file mode 100644 index 19006f95a7..0000000000 --- a/phpBB/styles/prosilver/theme/en/icon_post_edit.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/icon_post_quote.gif b/phpBB/styles/prosilver/theme/en/icon_post_quote.gif Binary files differdeleted file mode 100644 index c3708a1477..0000000000 --- a/phpBB/styles/prosilver/theme/en/icon_post_quote.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/stylesheet.css b/phpBB/styles/prosilver/theme/en/stylesheet.css index 82b7df0830..604b299488 100644 --- a/phpBB/styles/prosilver/theme/en/stylesheet.css +++ b/phpBB/styles/prosilver/theme/en/stylesheet.css @@ -1,34 +1,2 @@ -/* Set profile icon dimensions */ -ul.profile-icons li.pm-icon { width: 28px; height: 20px; } -ul.profile-icons li.quote-icon { width: 54px; height: 20px; } -ul.profile-icons li.edit-icon { width: 42px; height: 20px; } - /* Online image */ .online { background-image: url("./icon_user_online.gif"); } - -/* Icon images */ -.pm-icon, .pm-icon a { background-image: url("./icon_contact_pm.gif"); } -.quote-icon, .quote-icon a { background-image: url("./icon_post_quote.gif"); } -.edit-icon, .edit-icon a { background-image: url("./icon_post_edit.gif"); } - -/* EN Language Pack */ -.imageset.icon_contact_pm { - background-image: url("./icon_contact_pm.gif"); - padding-left: 28px; - padding-top: 20px; -} -.imageset.icon_post_edit { - background-image: url("./icon_post_edit.gif"); - padding-left: 42px; - padding-top: 20px; -} -.imageset.icon_post_quote { - background-image: url("./icon_post_quote.gif"); - padding-left: 54px; - padding-top: 20px; -} -.imageset.icon_user_online { - background-image: url("./icon_user_online.gif"); - padding-left: 58px; - padding-top: 58px; -} diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css index 755ce4a19d..e8efbc6045 100644 --- a/phpBB/styles/prosilver/theme/forms.css +++ b/phpBB/styles/prosilver/theme/forms.css @@ -68,7 +68,7 @@ fieldset dl { } fieldset dt { - float: left; + float: left; width: 40%; text-align: left; display: block; @@ -96,7 +96,7 @@ fieldset.fields1 div { } /* Set it back to 0px for the reCaptcha divs: PHPBB3-9587 */ -fieldset.fields1 #recaptcha_widget_div div { +fieldset.fields1 .live-search div { margin-bottom: 0; } @@ -129,15 +129,25 @@ dd select { width: auto; } +dd select[multiple] { + width: 100%; +} + dd textarea { width: 85%; } /* Hover effects */ -#timezone { +.timezone { width: 95%; } +/* Browser-specific tweaks */ +button::-moz-focus-inner { + padding: 0; + border: 0 +} + /* Quick-login on index page */ fieldset.quick-login { margin-top: 5px; @@ -173,6 +183,24 @@ fieldset.display-options a { margin-top: 3px; } +.dropdown fieldset.display-options { + font-size: 1em; + margin: 0; + padding: 0; +} + +.dropdown fieldset.display-options label { + display: block; + margin: 4px; + padding: 0; + text-align: right; + white-space: nowrap; +} + +.dropdown fieldset.display-options select { + min-width: 120px; +} + /* Display actions for ucp and mcp pages */ fieldset.display-actions { text-align: right; @@ -201,24 +229,6 @@ fieldset.forum-selection2 { float: right; } -/* Jumpbox */ -fieldset.jumpbox { - text-align: right; - margin-top: 15px; - min-height: 2.5em; -} - -fieldset.jumpbox select { - max-width: 50%; -} - -fieldset.quickmod { - width: 50%; - float: right; - text-align: right; - height: 2.5em; -} - /* Submit button fieldset */ fieldset.submit-buttons { text-align: center; @@ -228,43 +238,49 @@ fieldset.submit-buttons { fieldset.submit-buttons input { vertical-align: middle; - padding-top: 3px; - padding-bottom: 3px; } /* Posting page styles ----------------------------------------*/ /* Buttons used in the editor */ -#format-buttons { +.format-buttons { margin: 15px 0 2px 0; } -#format-buttons input, #format-buttons select { +.format-buttons input, .format-buttons select { vertical-align: middle; } /* Main message box */ -#message-box { +.message-box { width: 80%; } -#message-box textarea { +.message-box textarea { font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; width: 450px; height: 270px; min-width: 100%; max-width: 100%; font-size: 1.2em; + resize: vertical; + outline: 3px dashed transparent; + outline-offset: -4px; + -webkit-transition: all .5s ease; + -moz-transition: all .5s ease; + -ms-transition: all .5s ease; + -o-transition: all .5s ease; + transition: all .5s ease; } /* Emoticons panel */ -#smiley-box { +.smiley-box { width: 18%; float: right; } -#smiley-box img { +.smiley-box img { margin: 3px; } @@ -283,7 +299,7 @@ fieldset.submit-buttons input { input.inputbox { width: 85%; } input.medium { width: 50%; } input.narrow { width: 25%; } -input.tiny { width: 125px; } +input.tiny { width: 150px; } textarea.inputbox { width: 85%; @@ -293,6 +309,10 @@ textarea.inputbox { width: auto !important; } +input[type="number"] { + -moz-padding-end: inherit; +} + input[type="search"] { -webkit-appearance: textfield; -webkit-box-sizing: content-box; @@ -302,6 +322,10 @@ input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-s display: none; } +input[type="search"]::-webkit-search-cancel-button { + cursor: pointer; +} + /* Form button styles ---------------------------------------- */ input.button1, input.button2 { @@ -314,6 +338,7 @@ a.button1, input.button1, input.button3, a.button2, input.button2 { padding-bottom: 1px; font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; background: transparent none repeat-x top left; + line-height: 1.5; } a.button1, input.button1 { @@ -330,8 +355,8 @@ input.button3 { font-variant: small-caps; } -input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"] { - cursor: pointer; +input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"] { + cursor: pointer; } /* Alternative button */ @@ -340,18 +365,15 @@ a.button2, input.button2, input.button3 { } /* <a> button in the style of the form buttons */ -a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active { +a.button1, a.button2 { text-decoration: none; - padding: 2px 8px; - line-height: 250%; + padding: 0 3px; vertical-align: text-bottom; - background-position: 0 1px; } /* Hover states */ a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover { border: 1px solid transparent; - background-position: 0 100%; } input.disabled { @@ -365,14 +387,35 @@ input.button1:focus, input.button2:focus, input.button3:focus { /* Topic and forum Search */ .search-box { - margin-top: 3px; - margin-left: 5px; float: left; } -.search-box input { +.search-box .inputbox { + background-image: none; + border-right-width: 0; + border-radius: 4px 0 0 4px; + float: left; + height: 24px; + padding: 3px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } +/* Search box (header) +--------------------------------------------- */ +.search-header { + border-radius: 4px; + display: block; + float: right; + margin-right: 5px; + margin-top: 30px; +} + +.search-header .inputbox { border: 0; } + +.navbar .linklist > li.responsive-search { display: none; } + input.search { background-image: none; background-repeat: no-repeat; @@ -384,4 +427,3 @@ input.search { .medium { width: 50%;} .narrow { width: 25%;} .tiny { width: 10%;} - diff --git a/phpBB/styles/prosilver/theme/icons.css b/phpBB/styles/prosilver/theme/icons.css new file mode 100644 index 0000000000..f5d1b00795 --- /dev/null +++ b/phpBB/styles/prosilver/theme/icons.css @@ -0,0 +1,83 @@ +/* -------------------------------------------------------------- + $Icons +-------------------------------------------------------------- */ + +/* Global module setup +--------------------------------*/ + +/* Renamed version of .fa class for agnostic useage of icon fonts. + * Just change the name of the font after the 14/1 to the name of + * the font you wish to use. + */ +.icon, .button .icon { + display: inline-block; + font-weight: normal; + font-style: normal; + font-variant: normal; + font-family: FontAwesome; + font-size: 14px; + line-height: 1; + text-rendering: auto; /* optimizelegibility throws things off #1094 */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon:before { padding-right: 2px; } + +.button .icon:before { + padding-right: 0; +} + +/* Icon size classes - Default size is 14px, use these for small variations */ + +.icon.icon-xl { + font-size: 20px; +} + +.icon.icon-lg { + font-size: 16px; +} + +.icon.icon-md { + font-size: 10px; +} + +.icon.icon-sm { + font-size: 8px; +} + +/* icon modifiers */ +.icon-tiny { + width: 12px; + transform: scale(0.65, 0.75); + vertical-align: text-bottom; + font-size: 16px; +} + +.arrow-left:hover .icon { + margin-left: -5px; + margin-right: 5px; +} + +.arrow-right .icon { + float: right; +} + +.arrow-right:hover .icon { + margin-left: 5px; + margin-right: -5px; +} + +.post-buttons .dropdown-contents .icon { + float: right; + margin-left: 5px; +} + +.alert_close .icon:before { + padding: 0; + border-radius: 50%; + width: 11px; + display: block; + line-height: .9; + height: 12px; +} diff --git a/phpBB/styles/prosilver/theme/images/alert_close.png b/phpBB/styles/prosilver/theme/images/alert_close.png Binary files differdeleted file mode 100644 index 79750a013c..0000000000 --- a/phpBB/styles/prosilver/theme/images/alert_close.png +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/announce_read.gif b/phpBB/styles/prosilver/theme/images/announce_read.gif Binary files differindex 33e4a5e852..9457870e6f 100644 --- a/phpBB/styles/prosilver/theme/images/announce_read.gif +++ b/phpBB/styles/prosilver/theme/images/announce_read.gif diff --git a/phpBB/styles/prosilver/theme/images/announce_read_mine.gif b/phpBB/styles/prosilver/theme/images/announce_read_mine.gif Binary files differindex ad928330e6..2c88cacca0 100644 --- a/phpBB/styles/prosilver/theme/images/announce_read_mine.gif +++ b/phpBB/styles/prosilver/theme/images/announce_read_mine.gif diff --git a/phpBB/styles/prosilver/theme/images/announce_unread.gif b/phpBB/styles/prosilver/theme/images/announce_unread.gif Binary files differindex 4a789f70f0..33e10b2ccc 100644 --- a/phpBB/styles/prosilver/theme/images/announce_unread.gif +++ b/phpBB/styles/prosilver/theme/images/announce_unread.gif diff --git a/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif b/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif Binary files differindex e01e920b59..bc07df0ce9 100644 --- a/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif +++ b/phpBB/styles/prosilver/theme/images/announce_unread_mine.gif diff --git a/phpBB/styles/prosilver/theme/images/arrow_down.gif b/phpBB/styles/prosilver/theme/images/arrow_down.gif Binary files differdeleted file mode 100644 index e45c365ecc..0000000000 --- a/phpBB/styles/prosilver/theme/images/arrow_down.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/arrow_left.gif b/phpBB/styles/prosilver/theme/images/arrow_left.gif Binary files differdeleted file mode 100644 index 076a5596f1..0000000000 --- a/phpBB/styles/prosilver/theme/images/arrow_left.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/arrow_right.gif b/phpBB/styles/prosilver/theme/images/arrow_right.gif Binary files differdeleted file mode 100644 index c5827a401f..0000000000 --- a/phpBB/styles/prosilver/theme/images/arrow_right.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/arrow_up.gif b/phpBB/styles/prosilver/theme/images/arrow_up.gif Binary files differdeleted file mode 100644 index 38b5a62c17..0000000000 --- a/phpBB/styles/prosilver/theme/images/arrow_up.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/bg_button.gif b/phpBB/styles/prosilver/theme/images/bg_button.gif Binary files differdeleted file mode 100644 index 03172ff5c6..0000000000 --- a/phpBB/styles/prosilver/theme/images/bg_button.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/bg_menu.gif b/phpBB/styles/prosilver/theme/images/bg_menu.gif Binary files differdeleted file mode 100644 index 4a9f5a9174..0000000000 --- a/phpBB/styles/prosilver/theme/images/bg_menu.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/bg_menu_rtl.gif b/phpBB/styles/prosilver/theme/images/bg_menu_rtl.gif Binary files differdeleted file mode 100644 index 10add09a17..0000000000 --- a/phpBB/styles/prosilver/theme/images/bg_menu_rtl.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/bg_tabs1.gif b/phpBB/styles/prosilver/theme/images/bg_tabs1.gif Binary files differdeleted file mode 100644 index 335a72c711..0000000000 --- a/phpBB/styles/prosilver/theme/images/bg_tabs1.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/bg_tabs2.gif b/phpBB/styles/prosilver/theme/images/bg_tabs2.gif Binary files differdeleted file mode 100644 index a2142d5432..0000000000 --- a/phpBB/styles/prosilver/theme/images/bg_tabs2.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/buttons.png b/phpBB/styles/prosilver/theme/images/buttons.png Binary files differdeleted file mode 100755 index 3a8c2f2f65..0000000000 --- a/phpBB/styles/prosilver/theme/images/buttons.png +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/corners_left2.gif b/phpBB/styles/prosilver/theme/images/corners_left2.gif Binary files differdeleted file mode 100644 index fa27ce3ba2..0000000000 --- a/phpBB/styles/prosilver/theme/images/corners_left2.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/corners_right2.gif b/phpBB/styles/prosilver/theme/images/corners_right2.gif Binary files differdeleted file mode 100644 index 2d689446ee..0000000000 --- a/phpBB/styles/prosilver/theme/images/corners_right2.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/created_by.jpg b/phpBB/styles/prosilver/theme/images/created_by.jpg Binary files differdeleted file mode 100644 index 68d56e2013..0000000000 --- a/phpBB/styles/prosilver/theme/images/created_by.jpg +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/feed.gif b/phpBB/styles/prosilver/theme/images/feed.gif Binary files differdeleted file mode 100644 index ff19905874..0000000000 --- a/phpBB/styles/prosilver/theme/images/feed.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/forum_link.gif b/phpBB/styles/prosilver/theme/images/forum_link.gif Binary files differindex 01fb1c4e1e..efeaf0a11f 100644 --- a/phpBB/styles/prosilver/theme/images/forum_link.gif +++ b/phpBB/styles/prosilver/theme/images/forum_link.gif diff --git a/phpBB/styles/prosilver/theme/images/forum_read.gif b/phpBB/styles/prosilver/theme/images/forum_read.gif Binary files differindex 82ceee0784..845618c1a2 100644 --- a/phpBB/styles/prosilver/theme/images/forum_read.gif +++ b/phpBB/styles/prosilver/theme/images/forum_read.gif diff --git a/phpBB/styles/prosilver/theme/images/forum_read_locked.gif b/phpBB/styles/prosilver/theme/images/forum_read_locked.gif Binary files differindex 450bf28c3c..7afb092a8f 100644 --- a/phpBB/styles/prosilver/theme/images/forum_read_locked.gif +++ b/phpBB/styles/prosilver/theme/images/forum_read_locked.gif diff --git a/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif b/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif Binary files differindex 5e97bc94ce..7119486539 100644 --- a/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif +++ b/phpBB/styles/prosilver/theme/images/forum_read_subforum.gif diff --git a/phpBB/styles/prosilver/theme/images/forum_unread.gif b/phpBB/styles/prosilver/theme/images/forum_unread.gif Binary files differindex 5a305d2470..1a397cb216 100644 --- a/phpBB/styles/prosilver/theme/images/forum_unread.gif +++ b/phpBB/styles/prosilver/theme/images/forum_unread.gif diff --git a/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif b/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif Binary files differindex 5ddd1b2cba..e955887020 100644 --- a/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif +++ b/phpBB/styles/prosilver/theme/images/forum_unread_subforum.gif diff --git a/phpBB/styles/prosilver/theme/images/gradient.gif b/phpBB/styles/prosilver/theme/images/gradient.gif Binary files differdeleted file mode 100644 index 21dc11f13b..0000000000 --- a/phpBB/styles/prosilver/theme/images/gradient.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_bookmark.gif b/phpBB/styles/prosilver/theme/images/icon_bookmark.gif Binary files differdeleted file mode 100644 index 2644293f7d..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_bookmark.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_bump.gif b/phpBB/styles/prosilver/theme/images/icon_bump.gif Binary files differdeleted file mode 100644 index 014cd9bd15..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_bump.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_contact_aim.gif b/phpBB/styles/prosilver/theme/images/icon_contact_aim.gif Binary files differdeleted file mode 100644 index be039fcde2..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_contact_aim.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_contact_email.gif b/phpBB/styles/prosilver/theme/images/icon_contact_email.gif Binary files differdeleted file mode 100644 index caa3683005..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_contact_email.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_contact_icq.gif b/phpBB/styles/prosilver/theme/images/icon_contact_icq.gif Binary files differdeleted file mode 100644 index 48a09373eb..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_contact_icq.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_contact_jabber.gif b/phpBB/styles/prosilver/theme/images/icon_contact_jabber.gif Binary files differdeleted file mode 100644 index e335433e97..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_contact_jabber.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_contact_msnm.gif b/phpBB/styles/prosilver/theme/images/icon_contact_msnm.gif Binary files differdeleted file mode 100644 index e25469c3a5..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_contact_msnm.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_contact_www.gif b/phpBB/styles/prosilver/theme/images/icon_contact_www.gif Binary files differdeleted file mode 100644 index 83cee9728d..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_contact_www.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_contact_yahoo.gif b/phpBB/styles/prosilver/theme/images/icon_contact_yahoo.gif Binary files differdeleted file mode 100644 index 305f297fdb..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_contact_yahoo.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_faq.gif b/phpBB/styles/prosilver/theme/images/icon_faq.gif Binary files differdeleted file mode 100644 index 4e26460629..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_faq.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_home.gif b/phpBB/styles/prosilver/theme/images/icon_home.gif Binary files differdeleted file mode 100644 index 8ae9004534..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_home.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_logout.gif b/phpBB/styles/prosilver/theme/images/icon_logout.gif Binary files differdeleted file mode 100644 index b8ad5c4e5c..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_logout.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_mark.gif b/phpBB/styles/prosilver/theme/images/icon_mark.gif Binary files differdeleted file mode 100644 index 1a33fc3264..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_mark.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_members.gif b/phpBB/styles/prosilver/theme/images/icon_members.gif Binary files differdeleted file mode 100644 index 48e3e5f5f3..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_members.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_notification.gif b/phpBB/styles/prosilver/theme/images/icon_notification.gif Binary files differdeleted file mode 100644 index 11092f4dce..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_notification.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_offline.gif b/phpBB/styles/prosilver/theme/images/icon_offline.gif Binary files differindex c5e41a41db..5dc4212e9f 100644 --- a/phpBB/styles/prosilver/theme/images/icon_offline.gif +++ b/phpBB/styles/prosilver/theme/images/icon_offline.gif diff --git a/phpBB/styles/prosilver/theme/images/icon_online.gif b/phpBB/styles/prosilver/theme/images/icon_online.gif Binary files differindex 18e43cd0c6..d0d202dde5 100644 --- a/phpBB/styles/prosilver/theme/images/icon_online.gif +++ b/phpBB/styles/prosilver/theme/images/icon_online.gif diff --git a/phpBB/styles/prosilver/theme/images/icon_pages.gif b/phpBB/styles/prosilver/theme/images/icon_pages.gif Binary files differdeleted file mode 100644 index 44cc34500e..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_pages.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_pm.gif b/phpBB/styles/prosilver/theme/images/icon_pm.gif Binary files differdeleted file mode 100644 index 103421a26f..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_pm.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_post_delete.gif b/phpBB/styles/prosilver/theme/images/icon_post_delete.gif Binary files differdeleted file mode 100644 index f51ffc24a6..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_post_delete.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_post_info.gif b/phpBB/styles/prosilver/theme/images/icon_post_info.gif Binary files differdeleted file mode 100644 index af089d8656..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_post_info.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_post_menu.png b/phpBB/styles/prosilver/theme/images/icon_post_menu.png Binary files differdeleted file mode 100644 index 2b48289fdb..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_post_menu.png +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_post_report.gif b/phpBB/styles/prosilver/theme/images/icon_post_report.gif Binary files differdeleted file mode 100644 index 72c6ae89d0..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_post_report.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_post_target.gif b/phpBB/styles/prosilver/theme/images/icon_post_target.gif Binary files differdeleted file mode 100644 index a29dbffa35..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_post_target.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_post_target_unread.gif b/phpBB/styles/prosilver/theme/images/icon_post_target_unread.gif Binary files differdeleted file mode 100644 index e97eeb2b2e..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_post_target_unread.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_print.gif b/phpBB/styles/prosilver/theme/images/icon_print.gif Binary files differdeleted file mode 100644 index a71dfdde70..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_print.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_register.gif b/phpBB/styles/prosilver/theme/images/icon_register.gif Binary files differdeleted file mode 100644 index 9ecf126c4f..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_register.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_search.gif b/phpBB/styles/prosilver/theme/images/icon_search.gif Binary files differdeleted file mode 100644 index 8492cd308c..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_search.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_sendemail.gif b/phpBB/styles/prosilver/theme/images/icon_sendemail.gif Binary files differdeleted file mode 100644 index f6b8aa10e1..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_sendemail.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_subscribe.gif b/phpBB/styles/prosilver/theme/images/icon_subscribe.gif Binary files differdeleted file mode 100644 index 5ca18af80a..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_subscribe.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_textbox_search.gif b/phpBB/styles/prosilver/theme/images/icon_textbox_search.gif Binary files differdeleted file mode 100644 index b3b51d8425..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_textbox_search.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_topic_attach.gif b/phpBB/styles/prosilver/theme/images/icon_topic_attach.gif Binary files differdeleted file mode 100644 index 9a70638650..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_topic_attach.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_topic_deleted.png b/phpBB/styles/prosilver/theme/images/icon_topic_deleted.png Binary files differdeleted file mode 100644 index 494b4fb563..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_topic_deleted.png +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_topic_latest.gif b/phpBB/styles/prosilver/theme/images/icon_topic_latest.gif Binary files differdeleted file mode 100644 index d79d31ac43..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_topic_latest.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_topic_newest.gif b/phpBB/styles/prosilver/theme/images/icon_topic_newest.gif Binary files differdeleted file mode 100644 index 0aa19884b5..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_topic_newest.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_topic_reported.gif b/phpBB/styles/prosilver/theme/images/icon_topic_reported.gif Binary files differdeleted file mode 100644 index 006b1e2291..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_topic_reported.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_topic_unapproved.gif b/phpBB/styles/prosilver/theme/images/icon_topic_unapproved.gif Binary files differdeleted file mode 100644 index 09d8f387a7..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_topic_unapproved.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_ucp.gif b/phpBB/styles/prosilver/theme/images/icon_ucp.gif Binary files differdeleted file mode 100644 index 2a5fcc3f0c..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_ucp.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_unsubscribe.gif b/phpBB/styles/prosilver/theme/images/icon_unsubscribe.gif Binary files differdeleted file mode 100644 index 27013fc1cb..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_unsubscribe.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icon_user_warn.gif b/phpBB/styles/prosilver/theme/images/icon_user_warn.gif Binary files differdeleted file mode 100644 index 9c4ad98e5c..0000000000 --- a/phpBB/styles/prosilver/theme/images/icon_user_warn.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/icons_contact.png b/phpBB/styles/prosilver/theme/images/icons_contact.png Binary files differnew file mode 100644 index 0000000000..f84abd36a5 --- /dev/null +++ b/phpBB/styles/prosilver/theme/images/icons_contact.png diff --git a/phpBB/assets/plupload/img/done.gif b/phpBB/styles/prosilver/theme/images/plupload/done.gif Binary files differindex 29f3ed7c97..29f3ed7c97 100644 --- a/phpBB/assets/plupload/img/done.gif +++ b/phpBB/styles/prosilver/theme/images/plupload/done.gif diff --git a/phpBB/assets/plupload/img/error.gif b/phpBB/styles/prosilver/theme/images/plupload/error.gif Binary files differindex 4682b63007..4682b63007 100644 --- a/phpBB/assets/plupload/img/error.gif +++ b/phpBB/styles/prosilver/theme/images/plupload/error.gif diff --git a/phpBB/assets/plupload/img/throbber.gif b/phpBB/styles/prosilver/theme/images/plupload/throbber.gif Binary files differindex 4ae8b16a5a..4ae8b16a5a 100644 --- a/phpBB/assets/plupload/img/throbber.gif +++ b/phpBB/styles/prosilver/theme/images/plupload/throbber.gif diff --git a/phpBB/styles/prosilver/theme/images/sticky_read.gif b/phpBB/styles/prosilver/theme/images/sticky_read.gif Binary files differindex 59e42833db..e1af585da5 100644 --- a/phpBB/styles/prosilver/theme/images/sticky_read.gif +++ b/phpBB/styles/prosilver/theme/images/sticky_read.gif diff --git a/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif b/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif Binary files differindex 49e8b3f01c..8f5f28fe5e 100644 --- a/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif +++ b/phpBB/styles/prosilver/theme/images/sticky_read_mine.gif diff --git a/phpBB/styles/prosilver/theme/images/sticky_unread.gif b/phpBB/styles/prosilver/theme/images/sticky_unread.gif Binary files differindex ae6d5954b1..d62b3c0f3a 100644 --- a/phpBB/styles/prosilver/theme/images/sticky_unread.gif +++ b/phpBB/styles/prosilver/theme/images/sticky_unread.gif diff --git a/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif b/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif Binary files differindex 2580ca0518..e201a9f31f 100644 --- a/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif +++ b/phpBB/styles/prosilver/theme/images/sticky_unread_mine.gif diff --git a/phpBB/styles/prosilver/theme/images/subforum_read.gif b/phpBB/styles/prosilver/theme/images/subforum_read.gif Binary files differdeleted file mode 100644 index 595595c296..0000000000 --- a/phpBB/styles/prosilver/theme/images/subforum_read.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/subforum_unread.gif b/phpBB/styles/prosilver/theme/images/subforum_unread.gif Binary files differdeleted file mode 100644 index b2b661dc78..0000000000 --- a/phpBB/styles/prosilver/theme/images/subforum_unread.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/images/topic_moved.gif b/phpBB/styles/prosilver/theme/images/topic_moved.gif Binary files differindex 3275cd6ef9..3dafa46ed7 100644 --- a/phpBB/styles/prosilver/theme/images/topic_moved.gif +++ b/phpBB/styles/prosilver/theme/images/topic_moved.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_read.gif b/phpBB/styles/prosilver/theme/images/topic_read.gif Binary files differindex 0347ffc1e9..640d5396f8 100644 --- a/phpBB/styles/prosilver/theme/images/topic_read.gif +++ b/phpBB/styles/prosilver/theme/images/topic_read.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_read_locked.gif b/phpBB/styles/prosilver/theme/images/topic_read_locked.gif Binary files differindex 83bc8bd02f..a47affb2f2 100644 --- a/phpBB/styles/prosilver/theme/images/topic_read_locked.gif +++ b/phpBB/styles/prosilver/theme/images/topic_read_locked.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif b/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif Binary files differindex 360f9d989a..d6142f0ea7 100644 --- a/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif +++ b/phpBB/styles/prosilver/theme/images/topic_read_locked_mine.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_read_mine.gif b/phpBB/styles/prosilver/theme/images/topic_read_mine.gif Binary files differindex 4972a4e0a5..18a1245b93 100644 --- a/phpBB/styles/prosilver/theme/images/topic_read_mine.gif +++ b/phpBB/styles/prosilver/theme/images/topic_read_mine.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_unread.gif b/phpBB/styles/prosilver/theme/images/topic_unread.gif Binary files differindex 542a998258..3fa920b6fc 100644 --- a/phpBB/styles/prosilver/theme/images/topic_unread.gif +++ b/phpBB/styles/prosilver/theme/images/topic_unread.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif b/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif Binary files differindex 4fb8fa9517..0a9768ba7d 100644 --- a/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif +++ b/phpBB/styles/prosilver/theme/images/topic_unread_locked.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif b/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif Binary files differindex 4ee6cfe423..916b60517e 100644 --- a/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif +++ b/phpBB/styles/prosilver/theme/images/topic_unread_locked_mine.gif diff --git a/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif b/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif Binary files differindex e73da38df7..4ca8492e74 100644 --- a/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif +++ b/phpBB/styles/prosilver/theme/images/topic_unread_mine.gif diff --git a/phpBB/styles/prosilver/theme/imageset.css b/phpBB/styles/prosilver/theme/imageset.css deleted file mode 100644 index 7aa19df06e..0000000000 --- a/phpBB/styles/prosilver/theme/imageset.css +++ /dev/null @@ -1,380 +0,0 @@ -/* Former imageset */ -span.imageset { - display: inline-block !important; - background: transparent none 0 0 no-repeat; - margin: 0; - padding: 0; - width: 0; - height: 0; - overflow: hidden; -} - -/* Global imageset items */ -.imageset.site_logo { - background-image: url("./images/site_logo.gif"); - padding-left: 149px; - padding-top: 52px; -} -.imageset.forum_link { - background-image: url("./images/forum_link.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.forum_read { - background-image: url("./images/forum_read.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.forum_read_locked { - background-image: url("./images/forum_read_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.forum_read_subforum { - background-image: url("./images/forum_read_subforum.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.forum_unread { - background-image: url("./images/forum_unread.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.forum_unread_locked { - background-image: url("./images/forum_unread_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.forum_unread_subforum { - background-image: url("./images/forum_unread_subforum.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_moved { - background-image: url("./images/topic_moved.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_read { - background-image: url("./images/topic_read.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_read_mine { - background-image: url("./images/topic_read_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_read_hot { - background-image: url("./images/topic_read_hot.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_read_hot_mine { - background-image: url("./images/topic_read_hot_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_read_locked { - background-image: url("./images/topic_read_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_read_locked_mine { - background-image: url("./images/topic_read_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_unread { - background-image: url("./images/topic_unread.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_unread_mine { - background-image: url("./images/topic_unread_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_unread_hot { - background-image: url("./images/topic_unread_hot.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_unread_hot_mine { - background-image: url("./images/topic_unread_hot_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_unread_locked { - background-image: url("./images/topic_unread_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.topic_unread_locked_mine { - background-image: url("./images/topic_unread_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_read { - background-image: url("./images/sticky_read.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_read_mine { - background-image: url("./images/sticky_read_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_read_locked { - background-image: url("./images/sticky_read_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_read_locked_mine { - background-image: url("./images/sticky_read_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_unread { - background-image: url("./images/sticky_unread.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_unread_mine { - background-image: url("./images/sticky_unread_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_unread_locked { - background-image: url("./images/sticky_unread_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.sticky_unread_locked_mine { - background-image: url("./images/sticky_unread_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_read { - background-image: url("./images/announce_read.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_read_mine { - background-image: url("./images/announce_read_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_read_locked { - background-image: url("./images/announce_read_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_read_locked_mine { - background-image: url("./images/announce_read_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_unread { - background-image: url("./images/announce_unread.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_unread_mine { - background-image: url("./images/announce_unread_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_unread_locked { - background-image: url("./images/announce_unread_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.announce_unread_locked_mine { - background-image: url("./images/announce_unread_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_read { - background-image: url("./images/announce_read.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_read_mine { - background-image: url("./images/announce_read_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_read_locked { - background-image: url("./images/announce_read_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_read_locked_mine { - background-image: url("./images/announce_read_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_unread { - background-image: url("./images/announce_unread.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_unread_mine { - background-image: url("./images/announce_unread_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_unread_locked { - background-image: url("./images/announce_unread_locked.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.global_unread_locked_mine { - background-image: url("./images/announce_unread_locked_mine.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.subforum_read { - background-image: url("./images/subforum_read.gif"); - padding-left: 11px; - padding-top: 9px; -} -.imageset.subforum_unread { - background-image: url("./images/subforum_unread.gif"); - padding-left: 11px; - padding-top: 9px; -} -.imageset.pm_read { - background-image: url("./images/topic_read.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.pm_unread { - background-image: url("./images/topic_unread.gif"); - padding-left: 27px; - padding-top: 27px; -} -.imageset.icon_back_top { - background-image: url("./images/icon_back_top.gif"); - padding-left: 11px; - padding-top: 11px; -} -.imageset.icon_contact_aim { - background-image: url("./images/icon_contact_aim.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_contact_email { - background-image: url("./images/icon_contact_email.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_contact_icq { - background-image: url("./images/icon_contact_icq.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_contact_jabber { - background-image: url("./images/icon_contact_jabber.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_contact_msnm { - background-image: url("./images/icon_contact_msnm.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_contact_www { - background-image: url("./images/icon_contact_www.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_contact_yahoo { - background-image: url("./images/icon_contact_yahoo.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_delete { - background-image: url("./images/icon_post_delete.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_info { - background-image: url("./images/icon_post_info.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_report { - background-image: url("./images/icon_post_report.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_target { - background-image: url("./images/icon_post_target.gif"); - padding-left: 11px; - padding-top: 9px; -} -.imageset.icon_post_target_unread { - background-image: url("./images/icon_post_target_unread.gif"); - padding-left: 11px; - padding-top: 9px; -} -.imageset.icon_topic_attach { - background-image: url("./images/icon_topic_attach.gif"); - padding-left: 7px; - padding-top: 10px; -} -.imageset.icon_topic_latest { - background-image: url("./images/icon_topic_latest.gif"); - padding-left: 11px; - padding-top: 9px; -} -.imageset.icon_topic_newest { - background-image: url("./images/icon_topic_newest.gif"); - padding-left: 11px; - padding-top: 9px; -} -.imageset.icon_topic_reported { - background-image: url("./images/icon_topic_reported.gif"); - padding-left: 16px; - padding-top: 14px; -} -.imageset.icon_topic_deleted { - background-image: url("./images/icon_topic_deleted.png"); - padding-left: 16px; - padding-top: 14px; -} -.imageset.icon_topic_unapproved { - background-image: url("./images/icon_topic_unapproved.gif"); - padding-left: 16px; - padding-top: 14px; -} -.imageset.icon_user_warn { - background-image: url("./images/icon_user_warn.gif"); - padding-left: 20px; - padding-top: 20px; -} - - -/* English images for fallback */ -.imageset.icon_contact_pm { - background-image: url("./en/icon_contact_pm.gif"); - padding-left: 28px; - padding-top: 20px; -} -.imageset.icon_post_edit { - background-image: url("./en/icon_post_edit.gif"); - padding-left: 42px; - padding-top: 20px; -} -.imageset.icon_post_quote { - background-image: url("./en/icon_post_quote.gif"); - padding-left: 54px; - padding-top: 20px; -} -.imageset.icon_user_online { - background-image: url("./en/icon_user_online.gif"); - padding-left: 58px; - padding-top: 58px; -} diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css index d43886256d..a018bbc792 100644 --- a/phpBB/styles/prosilver/theme/links.css +++ b/phpBB/styles/prosilver/theme/links.css @@ -5,18 +5,11 @@ a { direction: ltr; unicode-bidi: embed; -} - -a:link, a:visited { text-decoration: none; -} - -a:hover { - text-decoration: underline; -} + /* we use links inline more often then not so to address several bugs with + IE and some other browsers we render all links as inlineblock by default */ + display: inline-block; -a:active { - text-decoration: none; } /* Coloured usernames */ @@ -27,30 +20,16 @@ a:active { } /* Links on gradient backgrounds */ -#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link { - text-decoration: none; -} - -#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited { +.forumbg .header a, .forabg .header a, th a { text-decoration: none; } -#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover { +.forumbg .header a:hover, .forabg .header a:hover, th a:hover { text-decoration: underline; } -#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active { - text-decoration: none; -} - -/* Navigation bar links */ -ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { - display: inline-block; - padding-left: 17px; -} - /* Notification mark read link */ -#notification_list a.mark_read { +.dropdown-extended a.mark_read { background-position: center center; background-repeat: no-repeat; border-radius: 3px 0 0 3px; @@ -60,18 +39,23 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { z-index: 2; right: 0; top: 50%; - width: 30px; - height: 40px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } -#notification_list li:hover a.mark_read { +.dropdown-extended li:hover a.mark_read { display: block; } -#notification_list a.mark_read:hover { - width: 40px; +.dropdown-extended a.mark_read:hover { + width: 50px; } +.jumpbox-cat-link, +.jumpbox-forum-link { font-weight: bold; } + + /* Links for forum/topic lists */ a.forumtitle { font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif; @@ -89,6 +73,7 @@ a.topictitle { font-size: 1.2em; font-weight: bold; text-decoration: none; + display: inline; } a.topictitle:hover { @@ -115,13 +100,13 @@ a.lastsubject:hover { text-decoration: none; } -.signature a, .signature a:visited, .signature a:hover, .signature a:active { +.signature a, .signature a:hover { border: none; text-decoration: underline; } /* Profile links */ -.postprofile a:link, .postprofile a:visited, .postprofile dt.author a { +.postprofile a, .postprofile dt.author a { font-weight: bold; text-decoration: none; } @@ -130,90 +115,59 @@ a.lastsubject:hover { text-decoration: underline; } -/* CSS spec requires a:link, a:visited, a:hover and a:active rules to be specified in this order. */ -/* See http://www.phpbb.com/bugs/phpbb3/59685 */ -.postprofile a:active { - font-weight: bold; - text-decoration: none; -} - - -/* Profile searchresults */ +/* Profile searchresults */ .search .postprofile a { - text-decoration: none; + text-decoration: none; font-weight: normal; } .search .postprofile a:hover { - text-decoration: underline; + text-decoration: underline; +} + +.top { + font-size: 12px; + text-decoration: none; + margin-top: 10px; } /* Back to top of page */ .back2top { clear: both; - height: 11px; - text-align: right; } -a.top { - background: none no-repeat top left; - text-decoration: none; - width: 11px; - height: 11px; - display: block; +.back2top .top { float: right; - overflow: hidden; - letter-spacing: 1000px; - text-indent: 11px; -} - -a.top2 { - background: none no-repeat 0 50%; - text-decoration: none; - padding-left: 15px; + margin-right: -10px; + margin-top: 0; } /* Arrow links */ -a.arrow-up { background: none no-repeat left center; } -a.arrow-down { background: none no-repeat right center; } -a.arrow-left { background: none no-repeat 3px 60%; } -a.arrow-right { background: none no-repeat 95% 60%; } -a.arrow-up, a.arrow-up:link, a.arrow-up:active, a.arrow-up:visited { +.arrow-up { padding-left: 10px; text-decoration: none; border-bottom-width: 0; } -a.arrow-up:hover { - background-position: left top; +.arrow-up:hover { + } -a.arrow-down, a.arrow-down:link, a.arrow-down:active, a.arrow-down:visited { +.arrow-down { padding-right: 10px; } -a.arrow-down:hover { - background-position: right bottom; - text-decoration: none; -} - -a.arrow-left, a.arrow-left:active, a.arrow-left:visited { - padding-left: 12px; +.arrow-down:hover { + } -a.arrow-left:hover { +.arrow-left:hover { text-decoration: none; - background-position: 0 60%; } -a.arrow-right, a.arrow-right:active, a.arrow-right:visited { - padding-right: 12px; -} - -a.arrow-right:hover { +.arrow-right:hover { text-decoration: none; - background-position: 100% 60%; } /* invisible skip link, used for accessibility */ @@ -228,3 +182,7 @@ a.feed-icon-forum { float: right; margin: 3px; } + +a.anchor { + display: block; +} diff --git a/phpBB/styles/prosilver/theme/normalize.css b/phpBB/styles/prosilver/theme/normalize.css new file mode 100644 index 0000000000..a7ebfad424 --- /dev/null +++ b/phpBB/styles/prosilver/theme/normalize.css @@ -0,0 +1,424 @@ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS and IE text size adjust after device orientation change, + * without disabling user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability of focused elements when they are also in an + * active/hover state. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + box-sizing: content-box; /* 2 */ +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +}
\ No newline at end of file diff --git a/phpBB/styles/prosilver/theme/plupload.css b/phpBB/styles/prosilver/theme/plupload.css index 8569eca662..f466803964 100644 --- a/phpBB/styles/prosilver/theme/plupload.css +++ b/phpBB/styles/prosilver/theme/plupload.css @@ -1,9 +1,9 @@ -#attach-panel-multi { +.attach-panel-multi { display: none; margin-bottom: 1em; } -#file-list td { +.file-list td { vertical-align: middle; } @@ -15,6 +15,11 @@ width: 30%; } +.attach-comment .inputbox { + resize: vertical; + width: 100%; +} + .attach-filesize { width: 15%; } @@ -32,11 +37,11 @@ float: right; } -#attach-row-tpl, .nojs .file-inline-bbcode { +.nojs .file-inline-bbcode { display: none; } -#file-total-progress { +.file-total-progress { height: 2px; display: block; position: relative; @@ -50,7 +55,7 @@ width: 50px; } -.file-progress-bar, #file-total-progress-bar { +.file-progress-bar, .file-total-progress-bar { background-color: green; display: block; height: 100%; @@ -58,15 +63,15 @@ } .file-status.file-working { - background: url('../../../assets/plupload/img/throbber.gif'); + background: url('./images/plupload/throbber.gif'); } .file-status.file-uploaded { - background: url('../../../assets/plupload/img/done.gif'); + background: url('./images/plupload/done.gif'); } .file-status.file-error { - background: url('../../../assets/plupload/img/error.gif'); + background: url('./images/plupload/error.gif'); } .file-status { @@ -74,3 +79,8 @@ height: 16px; width: 16px; } + +.file-name { + max-width: 65%; + vertical-align: bottom; +} diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index 88de620493..a3295ac367 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -19,14 +19,14 @@ a:link { color: #000000; text-decoration: none; } a:visited { color: #000000; text-decoration: none; } a:active { color: #000000; text-decoration: none; } -img, .noprint, #sub-header, #sub-footer, .navbar, .box1, .divider, .signature { display: none; } +img, .noprint, .navbar, .box1, .divider, .signature { display: none; } /* Display smilies (Bug #47265) */ .content img { display: inline; } /* Container for the main body */ -#wrap { +.wrap { margin: 0 2em; } @@ -91,11 +91,11 @@ hr { } /* Dont want to print url for names or titles in content area */ -.postbody .author a:link, .postbody .author a:visited, -html>body .postbody .author a:link:after, +.postbody .author a:link, .postbody .author a:visited, +html>body .postbody .author a:link:after, html>body .postbody .author a:visited:after, -.postquote .quote-by a:link, .postquote .quote-by a:visited, -html>body .postquote .quote-by a:link:after, +.postquote .quote-by a:link, .postquote .quote-by a:visited, +html>body .postquote .quote-by a:link:after, html>body .postquote .quote-by a:visited:after, html>body .postbody h1 a:link:after, html>body .postbody h2 a:link:after { text-decoration: none; @@ -119,7 +119,7 @@ html>body .postbody h1 a:link:after, html>body .postbody h2 a:link:after { .postquote img { display: none; } .postquote span { display: block; } .postquote span .postquote { font-size: 100%; } -.quote-by, blockquote cite { +.quote-by, blockquote cite { color: black; display : block; font-weight: bold; diff --git a/phpBB/styles/prosilver/theme/responsive.css b/phpBB/styles/prosilver/theme/responsive.css index a6bc52db52..d71fd142e6 100644 --- a/phpBB/styles/prosilver/theme/responsive.css +++ b/phpBB/styles/prosilver/theme/responsive.css @@ -1,538 +1,590 @@ /* Responsive Design ---------------------------------------- */ -.responsive-hide { display: none !important; } -.responsive-show { display: block !important; } -.responsive-show-inline { display: inline !important; } -.responsive-show-inline-block { display: inline-block !important; } - -/* Content wrappers -----------------------------------------*/ -html { - height: auto; -} - -body { - padding: 0 5px; -} - -#wrap { - min-width: 300px; - padding: 0; +@media (max-width: 320px) { + select, .inputbox { + max-width: 240px; + } } -/* Common block wrappers +/* Notifications list ----------------------------------------*/ -.headerbar, .navbar, .forabg, .forumbg, .post, .panel { - border-radius: 0; - margin-left: -5px; - margin-right: -5px; +@media (max-width: 350px) { + .dropdown-extended .dropdown-contents { + width: auto; + } } -#cp-main .forabg, #cp-main .forumdb, #cp-main .post, #cp-main .panel { - border-radius: 7px; -} +@media (max-width: 430px) { + .action-bar .search-box .inputbox { + width: 120px; + } -/* Logo block -----------------------------------------*/ -#site-description { - float: none; - width: auto; - text-align: center; -} + .section-viewtopic .search-box .inputbox { + width: 57px; + } -#logo { - /* change display value to inline-block to show logo */ - display: none; - float: none; - padding: 10px; -} + .action-bar .search-box .inputbox ::-moz-placeholder { + content: "Search..."; + } -#site-description h1, #site-description p { - text-align: inherit; - float: none; - margin: 5px; - line-height: 1.2em; - overflow: hidden; - text-overflow: ellipsis; -} + .action-bar .search-box .inputbox :-ms-input-placeholder { + content: "Search..."; + } -#site-description p, #search-box { - display: none; + .action-bar .search-box .inputbox ::-webkit-input-placeholder { + content: "Search..."; + } } -/* Navigation -----------------------------------------*/ -.headerbar + .navbar { - margin-top: -5px; -} +@media (max-width: 500px) { + dd label { + white-space: normal; + } -/* Search -----------------------------------------*/ -.responsive-search { display: block !important; } -.responsive-search a { - display: block; - width: 16px; - height: 18px; - text-indent: 99px; - overflow: hidden; - background-position: 50% 50%; - background-repeat: no-repeat; - text-decoration: none; -} + select, .inputbox { + max-width: 260px; + } -/* .topiclist lists -----------------------------------------*/ -li.header dt { - text-align: center; - text-transform: none; - line-height: 1em; - font-size: 1.2em; - padding-bottom: 4px; -} + .captcha-panel dd.captcha { + margin-left: 0; + } -ul.topiclist li.header dt, ul.topiclist li.header dt .list-inner { - margin-right: 0 !important; - padding-right: 0; -} + .captcha-panel dd.captcha-image img { + width: 100%; + } -ul.topiclist li.header dd { - display: none !important; -} + dl.details dt, dl.details dd { + width: auto; + float: none; + text-align: left; + } -ul.topiclist dt, ul.topiclist dt .list-inner, -ul.topiclist.missing-column dt, ul.topiclist.missing-column dt .list-inner, -ul.topiclist.two-long-columns dt, ul.topiclist.two-long-columns dt .list-inner, -ul.topiclist.two-columns dt, ul.topiclist.two-columns dt .list-inner { - margin-right: 0; -} + dl.details dd { + margin-left: 20px; + } -ul.topiclist dt .list-inner.with-mark { - padding-right: 34px; -} + p.responsive-center { + float: none; + text-align: center; + margin-bottom: 5px; + } -ul.topiclist dt .list-inner { - min-height: 28px; -} + .action-bar > div { + margin-bottom: 5px; + } -ul.topiclist li.header dt .list-inner { - min-height: 0; -} + .action-bar > .pagination { + float: none; + clear: both; + padding-bottom: 1px; + text-align: center; + } -ul.topiclist dd { - display: none; -} -ul.topiclist dd.mark { - display: block; -} + .action-bar > .pagination li.page-jump { + margin: 0 2px; + } -/* Forums and topics lists -----------------------------------------*/ -ul.topiclist.forums dt, ul.topiclist.topics dt { - margin-right: -250px; -} -ul.topiclist.forums dt .list-inner, ul.topiclist.topics dt .list-inner { - margin-right: 250px; -} + p.jumpbox-return { + display: none; + } -ul.topiclist.forums dd.lastpost, ul.topiclist.topics dd.lastpost { - display: block; -} + .display-options > label:nth-child(1) { + display: block; + margin-bottom: 5px; + } -ul.topiclist dd.mark { - display: block; - position: absolute; - right: 5px; - top: 0; - margin: 0; - width: auto; - min-width: 0; - text-align: left; -} + .attach-controls { + margin-top: 5px; + width: 100%; + } -ul.topiclist.forums dd.topics dfn, ul.topiclist.topics dd.posts dfn { - position: relative; - left: 0; - width: auto; - display: inline; - font-weight: normal; + .quick-links .dropdown-trigger span { + display: none; + } } -@media only screen and (max-width: 550px), only screen and (max-device-width: 550px) -{ - ul.topiclist.forums dt, ul.topiclist.topics dt { +@media (max-width: 550px) { + ul.topiclist.forums dt { margin-right: 0; } - ul.topiclist.forums dt .list-inner, ul.topiclist.topics dt .list-inner { + ul.topiclist.forums dt .list-inner { margin-right: 0; } - ul.topiclist.forums dd.lastpost, ul.topiclist.topics dd.lastpost { + ul.topiclist.forums dd.lastpost { display: none; } } -li.row .responsive-show strong { - font-weight: bold; - color: inherit; -} +@media (max-width: 700px) { + .responsive-hide { display: none !important; } + .responsive-show { display: block !important; } + .responsive-show-inline { display: inline !important; } + .responsive-show-inline-block { display: inline-block !important; } -ul.topiclist li.row dt a.subforum { - display: inline-block; - vertical-align: bottom; - overflow: hidden; - text-overflow: ellipsis; - max-width: 100px; -} + /* Content wrappers + ----------------------------------------*/ + html { + height: auto; + } -/* Notifications list -----------------------------------------*/ -@media only screen and (max-width: 350px), only screen and (max-device-width: 350px) -{ - #notification_list { - width: 250px; + body { + padding: 0; } -} -/* Pagination -----------------------------------------*/ -.pagination { - margin: 5px 0; -} + .wrap { + border: none; + border-radius: 0; + margin: 0; + min-width: 290px; + padding: 0 5px; + } -.pagination li a, .pagination li span { - min-width: 10px; - display: inline-block; - text-align: center; -} + /* Common block wrappers + ----------------------------------------*/ + .headerbar, .navbar, .forabg, .forumbg, .post, .panel { + border-radius: 0; + margin-left: -5px; + margin-right: -5px; + } -/* Responsive tables -----------------------------------------*/ -table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { - display: block; -} + .cp-main .forabg, .cp-main .forumdb, .cp-main .post, .cp-main .panel { + border-radius: 7px; + } -table.responsive thead, table.responsive th { - display: none; -} + /* Logo block + ----------------------------------------*/ + .site-description { + float: none; + width: auto; + text-align: center; + } -table.responsive.show-header thead, table.responsive.show-header th:first-child { - display: block; - width: auto !important; - text-align: left !important; -} + .logo { + /* change display value to inline-block to show logo */ + display: none; + float: none; + padding: 10px; + } -table.responsive.show-header th:first-child span.rank-img { - display: none; -} + .site-description h1, .site-description p { + text-align: inherit; + float: none; + margin: 5px; + line-height: 1.2em; + overflow: hidden; + text-overflow: ellipsis; + } -table.responsive tr { - margin: 2px 0; -} + .site-description p, .search-header { + display: none; + } -table.responsive td { - width: auto !important; - text-align: left !important; - padding: 4px; -} + /* Navigation + ----------------------------------------*/ + .headerbar + .navbar { + margin-top: -5px; + } -table.responsive td.empty { - display: none !important; -} + /* Search + ----------------------------------------*/ + .responsive-search { display: block !important; } -table.responsive td > dfn { - display: inline-block !important; -} + /* .topiclist lists + ----------------------------------------*/ + li.header dt { + text-align: center; + text-transform: none; + line-height: 1em; + font-size: 1.2em; + padding-bottom: 4px; + } -table.responsive td > dfn:after { - content: ':'; - padding-right: 5px; -} + ul.topiclist li.header dt, ul.topiclist li.header dt .list-inner { + margin-right: 0 !important; + padding-right: 0; + } -table.responsive span.rank-img { - float: none; - padding-right: 5px; -} + ul.topiclist li.header dd { + display: none !important; + } -table.responsive#memberlist td:first-child input[type="checkbox"] { - float: right; -} + ul.topiclist dt, ul.topiclist dt .list-inner, + ul.topiclist.missing-column dt, ul.topiclist.missing-column dt .list-inner, + ul.topiclist.two-long-columns dt, ul.topiclist.two-long-columns dt .list-inner, + ul.topiclist.two-columns dt, ul.topiclist.two-columns dt .list-inner { + margin-right: 0; + } -/* Forms -----------------------------------------*/ -fieldset dt, fieldset.fields1 dt, fieldset.fields2 dt { - width: auto; - float: none; -} + ul.topiclist dt .list-inner.with-mark { + padding-right: 34px; + } -fieldset dd, fieldset.fields1 dd, fieldset.fields2 dd { - margin-left: 20px; -} + ul.topiclist dt .list-inner { + min-height: 28px; + } -textarea, dd textarea, #message-box textarea { - width: 100%; - -moz-box-sizing: border-box; - box-sizing: border-box; -} + ul.topiclist li.header dt .list-inner { + min-height: 0; + } -dl.pmlist dt { - width: auto !important; - margin-bottom: 5px; -} + ul.topiclist dd { + display: none; + } + ul.topiclist dd.mark { + display: block; + } -dl.pmlist dd { - display: inline-block; - margin-left: 0 !important; -} + /* Forums and topics lists + ----------------------------------------*/ + ul.topiclist.forums dt { + margin-right: -250px; + } -dl.pmlist dd:first-of-type { - padding-left: 20px; -} + ul.topiclist dd.mark { + display: block; + position: absolute; + right: 5px; + top: 0; + margin: 0; + width: auto; + min-width: 0; + text-align: left; + } -#smiley-box, #message-box { - float: none; - width: auto; -} + ul.topiclist.forums dd.topics dfn, ul.topiclist.topics dd.posts dfn { + position: relative; + left: 0; + width: auto; + display: inline; + font-weight: normal; + } -#smiley-box { - margin-top: 5px; -} + li.row .responsive-show strong { + font-weight: bold; + color: inherit; + } -.bbcode-status { - display: none; -} + ul.topiclist li.row dt a.subforum { + vertical-align: bottom; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100px; + } -.colour-palette, .colour-palette tbody, .colour-palette tr { - display: block; -} + /* Pagination + ----------------------------------------*/ + .pagination > ul { + margin: 5px 0 0; + } -.colour-palette td { - display: inline-block; - margin-right: 2px; -} + .row .pagination { + margin-top: 2px; + margin-bottom: 2px; + } -.horizontal-palette td:nth-child(2n), .vertical-palette tr:nth-child(2n) { - display: none; -} + .row .pagination .ellipsis + li { + display: none !important; + } -.colour-palette a { - display: inline-block !important; -} + /* Responsive tables + ----------------------------------------*/ + table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { + display: block; + } -fieldset.quick-login label { - display: block; - margin-bottom: 5px; - white-space: normal; -} + table.responsive thead, table.responsive th { + display: none; + } -fieldset.quick-login label > span { - display: inline-block; - min-width: 100px; -} + table.responsive.show-header thead, table.responsive.show-header th:first-child { + display: block; + width: auto !important; + text-align: left !important; + } -fieldset.quick-login input.inputbox { - width: 85%; - max-width: 300px; - margin-left: 20px; -} + table.responsive.show-header th:first-child span.rank-img { + display: none; + } -fieldset.quick-login label[for="autologin"] { - display: inline-block; - text-align: right; - min-width: 50%; -} + table.responsive tr { + margin: 2px 0; + } -@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) -{ - select, .inputbox { - max-width: 260px; + table.responsive td { + width: auto !important; + text-align: left !important; + padding: 4px; } -} -@media only screen and (max-width: 320px), only screen and (max-device-width: 320px) -{ - select, .inputbox { - max-width: 240px; + table.responsive td.empty { + display: none !important; } -} -/* User profile -----------------------------------------*/ -.column1, .column2, .left-box.profile-details { - float: none; - width: auto; -} + table.responsive td > dfn { + display: inline-block !important; + } -@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) -{ - dl.details dt, dl.details dd { + table.responsive td > dfn:after { + content: ':'; + padding-right: 5px; + } + + table.responsive span.rank-img { + float: none; + padding-right: 5px; + } + + table.responsive.memberlist td:first-child input[type="checkbox"] { + float: right; + } + + /* Forms + ----------------------------------------*/ + fieldset dt, fieldset.fields1 dt, fieldset.fields2 dt { width: auto; float: none; - text-align: left; } - dl.details dd { + fieldset dd, fieldset.fields1 dd, fieldset.fields2 dd { margin-left: 20px; } -} -/* Polls -----------------------------------------*/ -fieldset.polls dt { - width: 90%; -} + textarea, dd textarea, .message-box textarea { + width: 100%; + -moz-box-sizing: border-box; + box-sizing: border-box; + } -fieldset.polls dd.resultbar { - padding-left: 20px; -} + dl.pmlist dt { + width: auto !important; + margin-bottom: 5px; + } -fieldset.polls dd.poll_option_percent { - width: 20%; -} + dl.pmlist dd { + display: inline-block; + margin-left: 0 !important; + } -fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent { - margin-top: 5px; -} + dl.pmlist dd:first-of-type { + padding-left: 20px; + } -/* Post -----------------------------------------*/ -.postprofile, .postbody, .search .postbody { - display: block; - width: auto; - float: none; - padding: 0; - min-height: 0; -} + .smiley-box, .message-box { + float: none; + width: auto; + } -.post .postprofile { - width: auto; - border-width: 0 0 1px 0; - padding-bottom: 5px; - margin: 0; - margin-bottom: 5px; - overflow: hidden; -} + .smiley-box { + margin-top: 5px; + } -.postprofile dd { - display: none; -} + .bbcode-status { + display: none; + } -.postprofile dt, .postprofile dd.profile-rank, .search .postprofile dd { - display: block; - margin: 0; -} + .colour-palette, .colour-palette tbody, .colour-palette tr { + display: block; + } -.postprofile ul.profile-icons { - display: none; -} + .colour-palette td { + display: inline-block; + margin-right: 2px; + } -.postprofile .avatar { - display: block; - float: left; - margin-right: 5px; -} + .horizontal-palette td:nth-child(2n), .vertical-palette tr:nth-child(2n) { + display: none; + } -.postprofile .avatar img { - width: auto !important; - height: auto !important; - display: block; - max-height: 32px; -} + fieldset.quick-login label { + display: block; + margin-bottom: 5px; + white-space: normal; + } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 1.5dppx) -{ - /* Scale online image for HD displays */ - .online { - background-size: 40px; + fieldset.quick-login label > span { + display: inline-block; + min-width: 100px; } -} -/* Misc stuff -----------------------------------------*/ -h2 { - margin-top: .5em; -} + fieldset.quick-login input.inputbox { + width: 85%; + max-width: 300px; + margin-left: 20px; + } -p { - margin-bottom: .5em; - overflow: hidden; -} + fieldset.quick-login label[for="autologin"] { + display: inline-block; + text-align: right; + min-width: 50%; + } -p.rightside { - margin-bottom: 0; -} + /* User profile + ----------------------------------------*/ + .column1, .column2, .left-box.profile-details { + float: none; + width: auto; + } -.column1, .column2 { - width: auto; - float: none; -} + /* Polls + ----------------------------------------*/ + fieldset.polls dt { + width: 90%; + } -fieldset.quickmod { - width: auto; - float: none; - text-align: center; -} + fieldset.polls dd.resultbar { + padding-left: 20px; + } -fieldset.display-options label { - display: block; - clear: both; - margin-bottom: 5px; -} + fieldset.polls dd.poll_option_percent { + width: 20%; + } -dl.mini dd.pm-legend { - float: left; - min-width: 200px; -} + fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent { + margin-top: 5px; + } -#topicreview { - margin: 0 -5px; - padding: 0 5px; -} + /* Post + ----------------------------------------*/ + .postbody { + position: inherit; + } -fieldset.display-actions { - white-space: normal; -} + .postprofile, .postbody, .search .postbody { + display: block; + width: auto; + float: none; + padding: 0; + min-height: 0; + } -.phpbb_alert { - max-width: none; - margin: 0 25px; -} + .post .postprofile { + width: auto; + border-width: 0 0 1px 0; + padding-bottom: 5px; + margin: 0; + margin-bottom: 5px; + min-height: 40px; + overflow: hidden; + } -.attach-comment dfn { - width: 100%; -} + .postprofile dd { + display: none; + } -@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) -{ - p.responsive-center { - float: none; - text-align: center; + .postprofile dt, .postprofile dd.profile-rank, .search .postprofile dd { + display: block; margin: 0; } - .topic-actions > .pagination, fieldset.jumpbox { - text-align: center; + .postprofile .has-avatar .avatar-container { + margin: 0; + overflow: inherit; } - .topic-actions > .pagination { - float: none; + .postprofile .avatar-container:after { + clear: none; + } + + .postprofile .avatar { + margin-right: 5px; + } + + .postprofile .avatar img { + width: auto !important; + height: auto !important; + max-height: 32px; + } + + .has-profile .postbody h3 { + margin-left: 0 !important; + margin-right: 0 !important; + } + + .has-profile .post-buttons { + right: 30px; + top: 15px; + } + + .online { + background-size: 40px; + } + + /* Misc stuff + ----------------------------------------*/ + h2 { + margin-top: .5em; + } + + p { + margin-bottom: .5em; overflow: hidden; - clear: both; - padding-bottom: 1px; } - .topic-actions > div.search-box, p.jumpbox-return { - display: none; + p.rightside { + margin-bottom: 0; } - .display-options > label:nth-child(1) { + fieldset.display-options label { display: block; + clear: both; margin-bottom: 5px; } - .attach-controls { - margin-top: 5px; + dl.mini dd.pm-legend { + float: left; + min-width: 200px; + } + + .topicreview { + margin: 0 -5px; + padding: 0 5px; + } + + fieldset.display-actions { + white-space: normal; + } + + .phpbb_alert { + width: auto; + margin: 0 5px; + } + + .attach-comment dfn { width: 100%; } } + +@media (min-width: 700px) { + .postbody { width: 70%; } +} + +@media (min-width: 850px) { + .postbody { width: 76%; } +} + +@media (max-width: 850px) { + .postprofile { width: 28%; } +} + +@media (min-width: 701px) and (max-width: 950px) { + .row .pagination { + margin-top: 2px; + margin-bottom: 2px; + } + + ul.topiclist dt { + margin-right: -410px; + } + + ul.topiclist dt .list-inner { + margin-right: 410px; + } + + dd.posts, dd.topics, dd.views { + width: 80px; + } +} + diff --git a/phpBB/styles/prosilver/theme/stylesheet.css b/phpBB/styles/prosilver/theme/stylesheet.css index 48a00c6803..4fe97d144b 100644 --- a/phpBB/styles/prosilver/theme/stylesheet.css +++ b/phpBB/styles/prosilver/theme/stylesheet.css @@ -3,15 +3,19 @@ Style name: prosilver (the default phpBB 3.1.x style) Based on style: Original author: Tom Beddard ( http://www.subblue.com/ ) - Modified by: phpBB Group ( https://www.phpbb.com/ ) + Modified by: phpBB Limited ( https://www.phpbb.com/ ) -------------------------------------------------------------- */ +@import url("normalize.css"); +@import url("base.css"); +@import url("utilities.css"); @import url("common.css"); @import url("links.css"); @import url("content.css"); @import url("buttons.css"); @import url("cp.css"); @import url("forms.css"); +@import url("icons.css"); @import url("colours.css"); -@import url("imageset.css"); +@import url("responsive.css"); diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css index ca4e9a23b6..ba82551f85 100644 --- a/phpBB/styles/prosilver/theme/tweaks.css +++ b/phpBB/styles/prosilver/theme/tweaks.css @@ -1,68 +1,41 @@ /* Style Sheet Tweaks -These style definitions are IE 7 and 8 specific -tweaks required due to its poor CSS support. --------------------------------------------------*/ +These style definitions are IE 8 & 9 only. +They are required due to the poor CSS support in IE browsers. +------------------------------------------------------------------------------*/ -/* Clear float fix for IE7 */ -.inner { - zoom: 1; -} +/* IE 8 Tweaks (value)\9 equates to IE <= 8 +------------------------------------------------------------------------------*/ -ul.linklist { - zoom: 1; -} +/* Clear float fix */ +.inner, ul.linklist { zoom: 1\9; } /* Align checkboxes/radio buttons nicely */ -dd label input { - vertical-align: text-bottom; - *vertical-align: middle; -} +dd label input { vertical-align: text-bottom\9; } -/* Simple fix so forum and topic lists always have a height set */ -dl.icon { - *height: 35px; -} +/* Fixes header-avatar aspect-ratio */ +.header-avatar img { height: 20px\9; } -/* Correctly clear floating for details on profile view */ -dl.details dd { - *margin-left: 30%; - *float: none; -} +/* IE8 often can't handle max-width in %, so we use px instead */ +.postprofile .avatar img { max-width: 150px\9; } -/* Headerbar height fix for IE7 */ -#site-description p { - *margin-bottom: 1.0em; -} -/* Forum list column styles for IE7 */ -dl.icon dt, dl.icon dd { - *min-height: 32px; -} - -dd.posts, dd.topics, dd.views, dd.extra, dd.mark { - *width: 79px; -} - -dd.lastpost, dd.redirect, dd.moderation, dd.time, dd.info { - *width: 249px; -} +/* IE 9 Tweaks +------------------------------------------------------------------------------*/ -dd.option { - *width: 124px; +/* Border-radius bleed fix in IE9 */ +.search-header, .search-header .inputbox, .search-header a.button { + border-radius: 0; } -/* Notifications list for IE7 */ -#notification_list { - *left: 0; +.headerbar, .forumbg { + background-image: url("./images/bg_header.gif"); } -#notification_list .header_settings { - *position: absolute; - *right: 10px; - *top: 0; +.forabg { + background-image: url("./images/bg_list.gif"); } -.icon-notification { - *z-index: 2; +.tabs .tab > a { + border-radius: 0; } diff --git a/phpBB/styles/prosilver/theme/utilities.css b/phpBB/styles/prosilver/theme/utilities.css new file mode 100644 index 0000000000..cbb8127d1c --- /dev/null +++ b/phpBB/styles/prosilver/theme/utilities.css @@ -0,0 +1,66 @@ +/* -------------------------------------------------------------- + $Utilities +-------------------------------------------------------------- */ + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} + +.sr-only-focusable:active, +.sr-only-focusable:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; +} + +.clearfix:before, +.clearfix:after, +.container:before, +.container:after, +.container-fluid:before, +.container-fluid:after, +.row:before, +.row:after { + content: " "; + display: table; +} +.clearfix:after, +.container:after, +.container-fluid:after, +.row:after { clear: both } + +.center-block { + display: block; + margin-left: auto; + margin-right: auto; +} + +.pull-right { float: right !important } +.pull-left { float: left !important } +.hide { display: none !important } +.show { display: block !important } +.invisible { visibility: hidden } + +.text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} + +.hidden { + display: none ; +} + +.affix { position: fixed } diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg deleted file mode 100644 index 19441b43ba..0000000000 --- a/phpBB/styles/subsilver2/style.cfg +++ /dev/null @@ -1,29 +0,0 @@ -# -# phpBB Style Configuration File -# -# @package phpBB3 -# @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -# -# -# At the left is the name, please do not change this -# At the right the value is entered -# -# Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. -# Single and double quotes do not need to be escaped. -# -# - -# General Information about this style -name = subsilver2 -copyright = © 2005 phpBB Group -style_version = 3.1.0-a3 -phpbb_version = 3.1.0-a3 - -# Defining a different template bitfield -# 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 = subsilver2 diff --git a/phpBB/styles/subsilver2/template/attachment.html b/phpBB/styles/subsilver2/template/attachment.html deleted file mode 100644 index eb5dd91634..0000000000 --- a/phpBB/styles/subsilver2/template/attachment.html +++ /dev/null @@ -1,121 +0,0 @@ - -<!-- BEGIN _file --> - - <!-- IF _file.S_DENIED --> - <span class="genmed">[{_file.DENIED_MESSAGE}]</span><br /> - <!-- ELSE --> - - <!-- IF _file.COMMENT --> - <span class="gensmall"><b>{L_FILE_COMMENT}{L_COLON}</b> {_file.COMMENT}</span><br /> - <!-- ENDIF --> - - <!-- IF _file.S_THUMBNAIL --> - <a href="{_file.U_DOWNLOAD_LINK}"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" /></a><br /> - <span class="gensmall">{_file.DOWNLOAD_NAME} [ {_file.FILESIZE} {_file.SIZE_LANG} | {_file.L_DOWNLOAD_COUNT} ]</span> - <!-- ENDIF --> - - <!-- IF _file.S_IMAGE --> - <img src="{_file.U_INLINE_LINK}" alt="{_file.DOWNLOAD_NAME}" /><br /> - <span class="gensmall">{_file.DOWNLOAD_NAME} [ {_file.FILESIZE} {_file.SIZE_LANG} | {_file.L_DOWNLOAD_COUNT} ]</span> - <!-- ENDIF --> - - <!-- IF _file.S_FILE --> - <span class="genmed"> - <!-- IF _file.UPLOAD_ICON -->{_file.UPLOAD_ICON} <!-- ENDIF --> - <a href="{_file.U_DOWNLOAD_LINK}">{_file.DOWNLOAD_NAME}</a> [{_file.FILESIZE} {_file.SIZE_LANG}] - </span><br /> - <span class="gensmall">{_file.L_DOWNLOAD_COUNT}</span> - <!-- ENDIF --> - - <!-- IF _file.S_WM_FILE --> - <!-- method used here from http://alistapart.com/articles/byebyeembed / autosizing seems to not work always, this will not fix --> - <object width="320" height="285" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="wmstream_{_file.ATTACH_ID}"> - <param name="url" value="{_file.U_DOWNLOAD_LINK}" /> - <param name="showcontrols" value="1" /> - <param name="showdisplay" value="0" /> - <param name="showstatusbar" value="0" /> - <param name="autosize" value="1" /> - <param name="autostart" value="0" /> - <param name="visible" value="1" /> - <param name="animationstart" value="0" /> - <param name="loop" value="0" /> - <param name="src" value="{_file.U_DOWNLOAD_LINK}" /> - <!--[if !IE]>--> - <object width="320" height="285" type="video/x-ms-wmv" data="{_file.U_DOWNLOAD_LINK}"> - <param name="src" value="{_file.U_DOWNLOAD_LINK}" /> - <param name="controller" value="1" /> - <param name="showcontrols" value="1" /> - <param name="showdisplay" value="0" /> - <param name="showstatusbar" value="0" /> - <param name="autosize" value="1" /> - <param name="autostart" value="0" /> - <param name="visible" value="1" /> - <param name="animationstart" value="0" /> - <param name="loop" value="0" /> - </object> - <!--<![endif]--> - </object> - - <!-- ELSEIF _file.S_FLASH_FILE --> - <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{_file.WIDTH}" height="{_file.HEIGHT}"> - <param name="movie" value="{_file.U_VIEW_LINK}" /> - <param name="play" value="true" /> - <param name="loop" value="true" /> - <param name="quality" value="high" /> - <param name="allowScriptAccess" value="never" /> - <param name="allowNetworking" value="internal" /> - <embed src="{_file.U_VIEW_LINK}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{_file.WIDTH}" height="{_file.HEIGHT}" play="true" loop="true" quality="high" allowscriptaccess="never" allownetworking="internal"></embed> - </object> - <!-- ELSEIF _file.S_QUICKTIME_FILE --> - <object id="qtstream_{_file.ATTACH_ID}" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="320" height="285"> - <param name="src" value="{_file.U_DOWNLOAD_LINK}"> - <param name="controller" value="true"> - <param name="autoplay" value="false" /> - <param name="type" value="video/quicktime"> - <embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="320" height="285" type="video/quicktime" autoplay="false"></embed> - </object> - <!-- ELSEIF _file.S_RM_FILE --> - <object id="rmstream_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="200" height="50"> - <param name="src" value="{_file.U_DOWNLOAD_LINK}"> - <param name="autostart" value="false"> - <param name="controls" value="ImageWindow"> - <param name="console" value="ctrls_{_file.ATTACH_ID}"> - <param name="prefetch" value="false"> - <embed name="rmstream_{_file.ATTACH_ID}" type="audio/x-pn-realaudio-plugin" src="{_file.U_DOWNLOAD_LINK}" width="0" height="0" autostart="false" controls="ImageWindow" console="ctrls_{_file.ATTACH_ID}" prefetch="false"></embed> - </object> - <br /> - <object id="ctrls_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="0" height="36"> - <param name="controls" value="ControlPanel"> - <param name="console" value="ctrls_{_file.ATTACH_ID}"> - <embed name="ctrls_{_file.ATTACH_ID}" type="audio/x-pn-realaudio-plugin" width="200" height="36" controls="ControlPanel" console="ctrls_{_file.ATTACH_ID}"></embed> - </object> - - <script type="text/javascript"> - // <![CDATA[ - if (document.rmstream_{_file.ATTACH_ID}.GetClipWidth) - { - while (!document.rmstream_{_file.ATTACH_ID}.GetClipWidth()) - { - } - - var width = document.rmstream_{_file.ATTACH_ID}.GetClipWidth(); - var height = document.rmstream_{_file.ATTACH_ID}.GetClipHeight(); - - document.rmstream_{_file.ATTACH_ID}.width = width; - document.rmstream_{_file.ATTACH_ID}.height = height; - document.ctrls_{_file.ATTACH_ID}.width = width; - } - // ]]> - </script> - <!-- ENDIF --> - - <!-- IF _file.S_WM_FILE or _file.S_RM_FILE or _file.S_FLASH_FILE or _file.S_QUICKTIME_FILE --> - <br /> - <!-- IF _file.S_QUICKTIME_FILE --><a href="#" onclick="play_qt_file(document.qtstream_{_file.ATTACH_ID}); return false;">[ {L_PLAY_QUICKTIME_FILE} ]</a> <!-- ENDIF --> - <span class="gensmall"><a href="{_file.U_DOWNLOAD_LINK}">{_file.DOWNLOAD_NAME}</a> [ {_file.FILESIZE} {_file.SIZE_LANG} | {_file.L_DOWNLOAD_COUNT} ]</span> - <!-- ENDIF --> - - <br /> - <!-- ENDIF --> - -<!-- END _file --> diff --git a/phpBB/styles/subsilver2/template/avatars.js b/phpBB/styles/subsilver2/template/avatars.js deleted file mode 100644 index 146aca94d3..0000000000 --- a/phpBB/styles/subsilver2/template/avatars.js +++ /dev/null @@ -1,15 +0,0 @@ -(function($) { // Avoid conflicts with other libraries - -"use strict"; - -function avatarHide() { - $('.[class^="avatar_option_"]').hide(); - - var selected = $('#avatar_driver').val(); - $('.avatar_option_' + selected).show(); -} - -avatarHide(); -$('#avatar_driver').bind('change', avatarHide); - -})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/subsilver2/template/bbcode.html b/phpBB/styles/subsilver2/template/bbcode.html deleted file mode 100644 index 5558716cad..0000000000 --- a/phpBB/styles/subsilver2/template/bbcode.html +++ /dev/null @@ -1,69 +0,0 @@ -<!-- BEGIN ulist_open --><ul style="list-style-type: {LIST_TYPE}"><!-- END ulist_open --> -<!-- BEGIN ulist_open_default --><ul><!-- END ulist_open_default --> -<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> - -<!-- BEGIN olist_open --><ol style="list-style-type: {LIST_TYPE}"><!-- END olist_open --> -<!-- BEGIN olist_close --></ol><!-- END olist_close --> - -<!-- BEGIN listitem --><li><!-- END listitem --> -<!-- BEGIN listitem_close --></li><!-- END listitem_close --> - -<!-- BEGIN quote_username_open --> -<div class="quotetitle">{USERNAME} {L_WROTE}{L_COLON}</div><div class="quotecontent"> -<!-- END quote_username_open --> - -<!-- BEGIN quote_open --> -<div class="quotetitle"><b>{L_QUOTE}{L_COLON}</b></div><div class="quotecontent"> -<!-- END quote_open --> - -<!-- BEGIN quote_close --> -</div> -<!-- END quote_close --> - -<!-- BEGIN code_open --> -<div class="codetitle"><b>{L_CODE}{L_COLON}</b></div><pre class="codecontent"> -<!-- END code_open --> - -<!-- BEGIN code_close --> -</pre> -<!-- END code_close --> - -<!-- BEGIN inline_attachment_open --> -<div class="attachtitle">{L_ATTACHMENT}{L_COLON}</div><div class="attachcontent"> -<!-- END inline_attachment_open --> - -<!-- BEGIN inline_attachment_close --> -</div> -<!-- END inline_attachment_close --> - - -<!-- BEGIN b_open --><strong><!-- END b_open --> -<!-- BEGIN b_close --></strong><!-- END b_close --> - -<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> -<!-- BEGIN u_close --></span><!-- END u_close --> - -<!-- BEGIN i_open --><em><!-- END i_open --> -<!-- BEGIN i_close --></em><!-- END i_close --> - -<!-- BEGIN color --><span style="color: {COLOR}">{TEXT}</span><!-- END color --> - -<!-- BEGIN size --><span style="font-size: {SIZE}%; line-height: normal">{TEXT}</span><!-- END size --> - -<!-- BEGIN img --><img src="{URL}" alt="{L_IMAGE}" /><!-- END img --> - -<!-- BEGIN url --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END url --> - -<!-- BEGIN email --><a href="mailto:{EMAIL}">{DESCRIPTION}</a><!-- END email --> - -<!-- BEGIN flash --> - <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{WIDTH}" height="{HEIGHT}"> - <param name="movie" value="{URL}" /> - <param name="play" value="false" /> - <param name="loop" value="false" /> - <param name="quality" value="high" /> - <param name="allowScriptAccess" value="never" /> - <param name="allowNetworking" value="internal" /> - <embed src="{URL}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{WIDTH}" height="{HEIGHT}" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></embed> - </object> -<!-- END flash --> diff --git a/phpBB/styles/subsilver2/template/breadcrumbs.html b/phpBB/styles/subsilver2/template/breadcrumbs.html deleted file mode 100644 index 09ee9a8606..0000000000 --- a/phpBB/styles/subsilver2/template/breadcrumbs.html +++ /dev/null @@ -1,10 +0,0 @@ - <!-- IF $S_MICRODATA --><!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' --><!-- ELSE --><!-- DEFINE $MICRODATA = '' --><!-- ENDIF --> - <table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;"> - <tr> - <td class="row1"> - <p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA}>{L_SITE_HOME}</a> <strong>»</strong> <!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA}>{L_INDEX}</a><!-- BEGIN navlinks --> » <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a><!-- END navlinks --> - <!-- EVENT overall_header_breadcrumb_append --></p> - <p class="datetime">{S_TIMEZONE}</p> - </td> - </tr> - </table> diff --git a/phpBB/styles/subsilver2/template/captcha_default.html b/phpBB/styles/subsilver2/template/captcha_default.html deleted file mode 100644 index 1be25403ce..0000000000 --- a/phpBB/styles/subsilver2/template/captcha_default.html +++ /dev/null @@ -1,17 +0,0 @@ - <tr> - <th colspan="2" valign="middle">{L_CONFIRM_CODE}</th> - </tr> - <!-- IF S_TYPE == 1 --> - <tr> - <td class="row3" colspan="2"><span class="gensmall">{L_CONFIRM_EXPLAIN}</span></td> - </tr> - <!-- ENDIF --> - <tr> - <td class="row1" colspan="2" align="center"><img src="{CONFIRM_IMAGE_LINK}" alt="{L_CONFIRM_CODE}" /> - <input type="hidden" name="confirm_id" id="confirm_id" value="{CONFIRM_ID}" /></td> - </tr> - <tr> - <td class="row1"><b class="genmed">{L_CONFIRM_CODE}{L_COLON}</b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8"<!-- IF $CAPTCHA_TAB_INDEX --> tabindex="{$CAPTCHA_TAB_INDEX}"<!-- ENDIF --> /> - <!-- IF S_CONFIRM_REFRESH --><input type="submit" name="refresh_vc" id="refresh_vc" class="btnlite" value="{L_VC_REFRESH}" /><!-- ENDIF --></td> - </tr> diff --git a/phpBB/styles/subsilver2/template/captcha_qa.html b/phpBB/styles/subsilver2/template/captcha_qa.html deleted file mode 100644 index 90a6492400..0000000000 --- a/phpBB/styles/subsilver2/template/captcha_qa.html +++ /dev/null @@ -1,8 +0,0 @@ - <tr> - <th colspan="2" valign="middle">{L_CONFIRM_QUESTION}</th> - </tr> - <tr> - <td class="row1"><b class="genmed">{QA_CONFIRM_QUESTION}{L_COLON}</b><br /><span class="gensmall">{L_CONFIRM_QUESTION_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="text" name="qa_answer" size="80"<!-- IF $CAPTCHA_TAB_INDEX --> tabindex="{$CAPTCHA_TAB_INDEX}"<!-- ENDIF --> /> - <input type="hidden" name="qa_confirm_id" id="confirm_id" value="{QA_CONFIRM_ID}" /></td> - </tr> diff --git a/phpBB/styles/subsilver2/template/captcha_recaptcha.html b/phpBB/styles/subsilver2/template/captcha_recaptcha.html deleted file mode 100644 index 0d116b361f..0000000000 --- a/phpBB/styles/subsilver2/template/captcha_recaptcha.html +++ /dev/null @@ -1,36 +0,0 @@ -<!-- IF S_RECAPTCHA_AVAILABLE --> - <tr> - <th colspan="2" valign="middle">{L_CONFIRM_CODE}</th> - </tr> - <tr> - <td class="row1"><b class="genmed">{L_CONFIRM_CODE}{L_COLON}</b><br /><span class="gensmall">{L_RECAPTCHA_EXPLAIN}</span></td> - <td class="row2"> - <script type="text/javascript"> - // <![CDATA[ - var RecaptchaOptions = { - lang : '{LA_RECAPTCHA_LANG}', - theme : 'clean', - tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF --> - }; - // ]]> - </script> - <script type="text/javascript" src="{RECAPTCHA_SERVER}/challenge?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" ></script> - <script type="text/javascript"> - // <![CDATA[ - <!-- IF S_CONTENT_DIRECTION eq 'rtl' --> - document.getElementById('recaptcha_table').style.direction = 'ltr'; - <!-- ENDIF --> - // ]]> - </script> - - <noscript> - <iframe src="{RECAPTCHA_SERVER}/noscript?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" height="300" width="500" frameborder="0"></iframe><br /> - <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> - <input type="hidden" name="recaptcha_response_field" value="manual_challenge" /> - </noscript> - </td> - </tr> - -<!-- ELSE --> -{L_RECAPTCHA_NOT_AVAILABLE} -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/confirm_body.html b/phpBB/styles/subsilver2/template/confirm_body.html deleted file mode 100644 index 1712017c38..0000000000 --- a/phpBB/styles/subsilver2/template/confirm_body.html +++ /dev/null @@ -1,28 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pagecontent"> - - <form name="confirm" action="{S_CONFIRM_ACTION}" method="post"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{MESSAGE_TITLE}</th> - </tr> - <tr> - <td class="row1" align="center"><br /><p class="gen">{MESSAGE_TEXT}</p><br />{S_HIDDEN_FIELDS}<input type="submit" name="confirm" value="{YES_VALUE}" class="btnlite" /> <input type="submit" name="cancel" value="{L_NO}" class="btnlite" /></td> - </tr> - </table> - - </form> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/confirm_delete_body.html b/phpBB/styles/subsilver2/template/confirm_delete_body.html deleted file mode 100644 index 9e416f5195..0000000000 --- a/phpBB/styles/subsilver2/template/confirm_delete_body.html +++ /dev/null @@ -1,56 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pagecontent"> - - <form name="confirm" action="{S_CONFIRM_ACTION}" method="post"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{MESSAGE_TITLE}</th> - </tr> - <tr> - <td class="row1" align="center"> - <br /> - <p class="gen">{MESSAGE_TEXT}</p> - <br /> - - <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) --> - <table border="0" width="90%" cellspacing="2" cellpadding="1"> - <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> - <tr> - <td class="row1" width="22%"><b class="gen">{L_DELETE_PERMANENTLY}{L_COLON}</b></td> - <td class="row1" width="78%"> - <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} /> - <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF --> - </td> - </tr> - <!-- ENDIF --> - <!-- IF S_DELETE_REASON --> - <tr> - <td class="row1" valign="top"><span class="gen"><b>{L_DELETE_REASON}{L_COLON}</b></span><br /><span class="gensmall">{L_DELETE_REASON_EXPLAIN}</span></td> - <td class="row1"><input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></td> - </tr> - <!-- ENDIF --> - </table> - <br /> - <!-- ENDIF --> - {S_HIDDEN_FIELDS} - <input type="submit" name="confirm" value="{L_YES}" class="btnmain" /> - <input type="submit" name="cancel" value="{L_NO}" class="btnlite" /> - </td> - </tr> - </table> - - </form> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/custom_profile_fields.html b/phpBB/styles/subsilver2/template/custom_profile_fields.html deleted file mode 100644 index 3dabedda06..0000000000 --- a/phpBB/styles/subsilver2/template/custom_profile_fields.html +++ /dev/null @@ -1,31 +0,0 @@ -<!-- BEGIN dropdown --> - <select name="{dropdown.FIELD_IDENT}"> - <!-- BEGIN options --><option value="{dropdown.options.OPTION_ID}"{dropdown.options.SELECTED}>{dropdown.options.VALUE}</option><!-- END options --> - </select> -<!-- END dropdown --> - -<!-- BEGIN text --> - <textarea name="{text.FIELD_IDENT}" rows="{text.FIELD_ROWS}" cols="{text.FIELD_COLS}">{text.FIELD_VALUE}</textarea> -<!-- END text --> - -<!-- BEGIN string --> - <input type="text" class="post" name="{string.FIELD_IDENT}" size="{string.FIELD_LENGTH}" maxlength="{string.FIELD_MAXLEN}" value="{string.FIELD_VALUE}" /> -<!-- END string --> - -<!-- BEGIN bool --> - <!-- IF bool.FIELD_LENGTH eq 1 --> - <!-- BEGIN options --><input type="radio" class="radio" name="{bool.FIELD_IDENT}" value="{bool.options.OPTION_ID}"{bool.options.CHECKED} /><span class="genmed">{bool.options.VALUE}</span> <!-- END options --> - <!-- ELSE --> - <input type="checkbox" class="radio" name="{bool.FIELD_IDENT}" value="1"<!-- IF bool.FIELD_VALUE eq 1 --> checked="checked"<!-- ENDIF --> /> - <!-- ENDIF --> -<!-- END bool --> - -<!-- BEGIN int --> - <input type="number" min="{int.FIELD_MINLEN}" max="{int.FIELD_MAXLEN}" class="post" name="{int.FIELD_IDENT}" size="{int.FIELD_LENGTH}" value="{int.FIELD_VALUE}" /> -<!-- END int --> - -<!-- BEGIN date --> - <span class="genmed">{L_DAY}{L_COLON}</span> <select name="{date.FIELD_IDENT}_day">{date.S_DAY_OPTIONS}</select> - <span class="genmed">{L_MONTH}{L_COLON}</span> <select name="{date.FIELD_IDENT}_month">{date.S_MONTH_OPTIONS}</select> - <span class="genmed">{L_YEAR}{L_COLON}</span> <select name="{date.FIELD_IDENT}_year">{date.S_YEAR_OPTIONS}</select> -<!-- END date --> diff --git a/phpBB/styles/subsilver2/template/faq_body.html b/phpBB/styles/subsilver2/template/faq_body.html deleted file mode 100644 index 22c4145a20..0000000000 --- a/phpBB/styles/subsilver2/template/faq_body.html +++ /dev/null @@ -1,63 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<a name="faqtop"></a> - -<div id="pagecontent"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_FAQ_TITLE}</th> - </tr> - <tr> - <td class="row1"> - <!-- BEGIN faq_block --> - <span class="gen"><b>{faq_block.BLOCK_TITLE}</b></span><br /> - <!-- BEGIN faq_row --> - <span class="gen"><a href="#f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}">{faq_block.faq_row.FAQ_QUESTION}</a></span><br /> - <!-- END faq_row --> - <br /> - <!-- END faq_block --> - </td> - </tr> - <tr> - <td class="cat"> </td> - </tr> - </table> - - <br clear="all" /> - - <!-- BEGIN faq_block --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat" align="center"><h4>{faq_block.BLOCK_TITLE}</h4></td> - </tr> - <!-- BEGIN faq_row --> - <tr> - <!-- IF faq_block.faq_row.S_ROW_COUNT is even --> - <td class="row1" valign="top"> - <!-- ELSE --> - <td class="row2" valign="top"> - <!-- ENDIF --> - <div class="postbody"><a name="f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}"></a><b>» {faq_block.faq_row.FAQ_QUESTION}</b></div> - <div class="postbody">{faq_block.faq_row.FAQ_ANSWER}</div> - <p class="gensmall"><a href="#faqtop">{L_BACK_TO_TOP}</a></p> - </td> - </tr> - <tr> - <td class="spacer" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> - <!-- END faq_row --> - </table> - - <br clear="all" /> - <!-- END faq_block --> - -</div> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/forumlist_body.html b/phpBB/styles/subsilver2/template/forumlist_body.html deleted file mode 100644 index a222607ae8..0000000000 --- a/phpBB/styles/subsilver2/template/forumlist_body.html +++ /dev/null @@ -1,89 +0,0 @@ -<table class="tablebg" cellspacing="1" width="100%"> -<tr> - <td class="cat" colspan="5" align="{S_CONTENT_FLOW_END}"><!-- IF not S_IS_BOT and U_MARK_FORUMS --><a class="nav" href="{U_MARK_FORUMS}">{L_MARK_FORUMS_READ}</a><!-- ENDIF --> </td> -</tr> -<tr> - <th colspan="2"> {L_FORUM} </th> - <th width="50"> {L_TOPICS} </th> - <th width="50"> {L_POSTS} </th> - <th> {L_LAST_POST} </th> -</tr> -<!-- BEGIN forumrow --> - <!-- IF forumrow.S_IS_CAT --> - <tr> - <td class="cat" colspan="2"><h4><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a></h4></td> - <td class="catdiv" colspan="3"> </td> - </tr> - <!-- ELSEIF forumrow.S_IS_LINK --> - <tr> - <td class="row1" width="50" align="center">{forumrow.FORUM_FOLDER_IMG}</td> - <td class="row1"> - <!-- IF forumrow.FORUM_IMAGE --> - <div style="float: {S_CONTENT_FLOW_BEGIN}; margin-{S_CONTENT_FLOW_END}{L_COLON} 5px;">{forumrow.FORUM_IMAGE}</div> - <!-- ENDIF --> - <a class="forumlink" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a> - <p class="forumdesc">{forumrow.FORUM_DESC}</p> - </td> - <!-- IF forumrow.CLICKS --> - <td class="row2" colspan="3" align="center"><span class="genmed">{L_REDIRECTS}{L_COLON} {forumrow.CLICKS}</span></td> - <!-- ELSE --> - <td class="row2" colspan="3" align="center"> </td> - <!-- ENDIF --> - </tr> - <!-- ELSE --> - <!-- IF forumrow.S_NO_CAT --> - <tr> - <td class="cat" colspan="2"><h4>{L_FORUM}</h4></td> - <td class="catdiv" colspan="3"> </td> - </tr> - <!-- ENDIF --> - <tr> - <td class="row1" width="50" align="center">{forumrow.FORUM_FOLDER_IMG}</td> - <td class="row1" width="100%"> - <!-- IF forumrow.FORUM_IMAGE --> - <div style="float: {S_CONTENT_FLOW_BEGIN}; margin-{S_CONTENT_FLOW_END}{L_COLON} 5px;">{forumrow.FORUM_IMAGE}</div> - <!-- ENDIF --> - <a class="forumlink" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a> - <p class="forumdesc">{forumrow.FORUM_DESC}</p> - <!-- IF forumrow.MODERATORS --> - <p class="forumdesc"><strong>{forumrow.L_MODERATOR_STR}{L_COLON}</strong> {forumrow.MODERATORS}</p> - <!-- ENDIF --> - <!-- IF .forumrow.subforum and forumrow.S_LIST_SUBFORUMS --> - <p class="forumdesc"><strong>{forumrow.L_SUBFORUM_STR}</strong> - <!-- BEGIN subforum --> - <a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->,<!-- ENDIF --> - <!-- END subforum --> - </p> - <!-- ENDIF --> - </td> - <td class="row2" align="center"><p class="topicdetails">{forumrow.TOPICS}</p></td> - <td class="row2" align="center"><p class="topicdetails">{forumrow.POSTS}</p></td> - <td class="row2" align="center" nowrap="nowrap"> - <!-- IF forumrow.LAST_POST_TIME --> - <!-- IF forumrow.S_DISPLAY_SUBJECT --> - <!-- EVENT forumlist_body_last_post_title_prepend --> - <p class="topicdetails"><a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a></p> - <!-- ENDIF --> - <p class="topicdetails"> - <!-- IF forumrow.U_UNAPPROVED_TOPICS --> - <a href="{forumrow.U_UNAPPROVED_TOPICS}" class="imageset">{UNAPPROVED_IMG}</a> - <!-- ELSEIF forumrow.U_UNAPPROVED_POSTS --> - <a href="{forumrow.U_UNAPPROVED_POSTS}" class="imageset">{UNAPPROVED_POST_IMG}</a> - <!-- ENDIF --> - {forumrow.LAST_POST_TIME} - </p> - <p class="topicdetails">{forumrow.LAST_POSTER_FULL} - <!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}" class="imageset">{LAST_POST_IMG}</a><!-- ENDIF --> - </p> - <!-- ELSE --> - <p class="topicdetails">{L_NO_POSTS}</p> - <!-- ENDIF --> - </td> - </tr> - <!-- ENDIF --> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="5" align="center"><p class="gensmall">{L_NO_FORUMS}</p></td> - </tr> -<!-- END forumrow --> -</table> diff --git a/phpBB/styles/subsilver2/template/index.htm b/phpBB/styles/subsilver2/template/index.htm deleted file mode 100644 index 4763c05f0e..0000000000 --- a/phpBB/styles/subsilver2/template/index.htm +++ /dev/null @@ -1,16 +0,0 @@ -<html> -<head> -<title>subSilver created by subBlue Design</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -</head> - -<body bgcolor="#FFFFFF" text="#000000"> - -<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td align="center" valign="middle"><a href="http://www.subblue.com/" target="_new"><img src="images/created_by.jpg" width="400" height="300" alt="Created by subBlue Design" /></a></td> - </tr> -</table> - -</body> -</html>
\ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html deleted file mode 100644 index 55a62fcf18..0000000000 --- a/phpBB/styles/subsilver2/template/index_body.html +++ /dev/null @@ -1,109 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<!-- EVENT index_body_linklist_before --> - -<!-- IF U_MCP or U_ACP --> - <div id="pageheader"> - <p class="linkmcp">[ <!-- IF U_ACP --><a href="{U_ACP}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}">{L_MCP}</a><!-- ENDIF --> ]</p> - </div> - - <br clear="all" /><br /> -<!-- ENDIF --> - -<!-- EVENT index_body_linklist_after --> - -<!-- INCLUDE forumlist_body.html --> - -<!-- IF not S_IS_BOT or U_TEAM --> -<span class="gensmall"><!-- IF not S_IS_BOT --><a href="{U_DELETE_COOKIES}">{L_DELETE_COOKIES}</a><!-- ENDIF --><!-- IF not S_IS_BOT and U_TEAM --> | <!-- ENDIF --><!-- IF U_TEAM --><a href="{U_TEAM}">{L_THE_TEAM}</a><!-- ENDIF --></span><br /> -<!-- ENDIF --> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<!-- EVENT index_body_stat_blocks_before --> - -<!-- IF S_DISPLAY_ONLINE_LIST --> - <br clear="all" /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat" colspan="2"><!-- IF U_VIEWONLINE --><h4><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h4><!-- ELSE --><h4>{L_WHO_IS_ONLINE}</h4><!-- ENDIF --></td> - </tr> - <tr> - <!-- IF LEGEND --> - <td class="row1" rowspan="2" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td> - <!-- ELSE --> - <td class="row1" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td> - <!-- ENDIF --> - <td class="row1" width="100%"><span class="genmed">{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /><br />{LOGGED_IN_USER_LIST}</span></td> - </tr> - <!-- IF LEGEND --> - <tr> - <td class="row1"><b class="gensmall">{L_LEGEND} :: {LEGEND}</b></td> - </tr> - <!-- ENDIF --> - </table> -<!-- ENDIF --> - -<!-- IF S_DISPLAY_BIRTHDAY_LIST --> - <br clear="all" /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat" colspan="2"><h4>{L_BIRTHDAYS}</h4></td> - </tr> - <tr> - <td class="row1" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_BIRTHDAYS}" /></td> - <td class="row1" width="100%"><p class="genmed"><!-- IF .birthdays -->{L_CONGRATULATIONS}{L_COLON} <b><!-- BEGIN birthdays -->{birthdays.USERNAME}<!-- IF birthdays.AGE !== '' --> ({birthdays.AGE})<!-- ENDIF --><!-- IF not birthdays.S_LAST_ROW -->, <!-- ENDIF --><!-- END birthdays --></b><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p></td> - </tr> - </table> -<!-- ENDIF --> - -<br clear="all" /> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <td class="cat" colspan="2"><h4>{L_STATISTICS}</h4></td> -</tr> -<tr> - <td class="row1"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_STATISTICS}" /></td> - <td class="row1" width="100%" valign="middle"><p class="genmed">{TOTAL_POSTS} | {TOTAL_TOPICS} | {TOTAL_USERS} | {NEWEST_USER}</p></td> -</tr> -</table> - -<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT --> - <br clear="all" /> - - <form method="post" action="{S_LOGIN_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat"><h4><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h4></td> - </tr> - <tr> - <td class="row1" align="center"><span class="genmed">{L_USERNAME}{L_COLON}</span> <input class="post" type="text" name="username" size="10" /> <span class="genmed">{L_PASSWORD}{L_COLON}</span> <input class="post" type="password" name="password" size="10" /> <!-- IF U_SEND_PASSWORD --><a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a> <!-- ENDIF --> <!-- IF S_AUTOLOGIN_ENABLED --> <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF --> <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td> - </tr> - </table> - {S_LOGIN_REDIRECT} - {S_FORM_TOKEN} - </form> -<!-- ENDIF --> - -<br clear="all" /> - -<table class="legend"> -<tr> - <td width="20" align="center">{FORUM_UNREAD_IMG}</td> - <td><span class="gensmall">{L_UNREAD_POSTS}</span></td> - <td> </td> - <td width="20" align="center">{FORUM_IMG}</td> - <td><span class="gensmall">{L_NO_UNREAD_POSTS}</span></td> - <td> </td> - <td width="20" align="center">{FORUM_LOCKED_IMG}</td> - <td><span class="gensmall">{L_FORUM_LOCKED}</span></td> -</tr> -</table> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/jumpbox.html b/phpBB/styles/subsilver2/template/jumpbox.html deleted file mode 100644 index e0603c6a6e..0000000000 --- a/phpBB/styles/subsilver2/template/jumpbox.html +++ /dev/null @@ -1,19 +0,0 @@ - -<!-- IF S_DISPLAY_JUMPBOX --> - <form method="get" name="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(document.jumpbox.f.value == -1){return false;}"> - - <table cellspacing="0" cellpadding="0" border="0"> - <tr> - <td nowrap="nowrap">{HIDDEN_FIELDS_FOR_JUMPBOX}<span class="gensmall"><!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->{L_COLON}</span> <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ document.forms['jumpbox'].submit() }"> - - <!-- BEGIN jumpbox_forums --> - <!-- IF jumpbox_forums.S_FORUM_COUNT eq 1 --><option value="-1">------------------</option><!-- ENDIF --> - <option value="{jumpbox_forums.FORUM_ID}"{jumpbox_forums.SELECTED}><!-- BEGIN level --> <!-- END level -->{jumpbox_forums.FORUM_NAME}</option> - <!-- END jumpbox_forums --> - - </select> <input class="btnlite" type="submit" value="{L_GO}" /></td> - </tr> - </table> - - </form> -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html deleted file mode 100644 index ed63e748cf..0000000000 --- a/phpBB/styles/subsilver2/template/login_body.html +++ /dev/null @@ -1,111 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<form action="{S_LOGIN_ACTION}" method="post"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <!-- IF not S_ADMIN_AUTH --> - <th colspan="2">{L_LOGIN}</th> - <!-- ELSE --> - <th>{LOGIN_EXPLAIN}</th> - <!-- ENDIF --> -</tr> -<!-- IF LOGIN_EXPLAIN && not S_ADMIN_AUTH --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall">{LOGIN_EXPLAIN}</span></td> - </tr> -<!-- ENDIF --> -<tr><!-- IF not S_ADMIN_AUTH and S_REGISTER_ENABLED --> - <td class="row1" width="50%"> - <p class="genmed">{L_LOGIN_INFO}</p> - - <p class="genmed" align="center"> - <a href="{U_TERMS_USE}">{L_TERMS_USE}</a> | <a href="{U_PRIVACY}">{L_PRIVACY}</a> - </p> - </td> - <!-- ENDIF --> - <td <!-- IF not S_ADMIN_AUTH -->class="row2"<!-- ELSE -->class="row1"<!-- ENDIF -->> - - <table align="center" cellspacing="1" cellpadding="4" style="width: 100%;"> - <!-- IF LOGIN_ERROR --> - <tr> - <td class="gensmall" colspan="2" align="center"><span class="error">{LOGIN_ERROR}</span></td> - </tr> - <!-- ENDIF --> - - <tr> - <td valign="top" <!-- IF S_ADMIN_AUTH -->style="width: 50%; text-align: {S_CONTENT_FLOW_END};"<!-- ENDIF -->><b class="gensmall">{L_USERNAME}{L_COLON}</b></td> - <td><input class="post" type="text" name="{USERNAME_CREDENTIAL}" size="25" value="{USERNAME}" tabindex="1" /> - <!-- IF not S_ADMIN_AUTH and S_REGISTER_ENABLED --> - <br /><a class="gensmall" href="{U_REGISTER}">{L_REGISTER}</a> - <!-- ENDIF --> - </td> - </tr> - <tr> - <td valign="top" <!-- IF S_ADMIN_AUTH -->style="width: 50%; text-align: {S_CONTENT_FLOW_END};"<!-- ENDIF -->><b class="gensmall">{L_PASSWORD}{L_COLON}</b></td> - <td> - <input class="post" type="password" name="{PASSWORD_CREDENTIAL}" size="25" tabindex="2" /> - <!-- IF U_SEND_PASSWORD --><br /><a class="gensmall" href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a><!-- ENDIF --> - <!-- IF U_RESEND_ACTIVATION and not S_ADMIN_AUTH --><br /><a class="gensmall" href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a><!-- ENDIF --> - </td> - </tr> - <!-- IF S_DISPLAY_FULL_LOGIN --> - <!-- IF S_AUTOLOGIN_ENABLED --> - <tr> - <td> </td> - <td><input type="checkbox" class="radio" name="autologin" tabindex="3" /> <span class="gensmall">{L_LOG_ME_IN}</span></td> - </tr> - <!-- ENDIF --> - <tr> - <td> </td> - <td><input type="checkbox" class="radio" name="viewonline" tabindex="4" /> <span class="gensmall">{L_HIDE_ME}</span></td> - </tr> - <!-- ENDIF --> - <!-- IF not S_ADMIN_AUTH and PROVIDER_TEMPLATE_FILE --> - <!-- INCLUDE {PROVIDER_TEMPLATE_FILE} --> - <!-- ENDIF --> - </table> - </td> -</tr> - -<!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE --> -</table> -<table class="tablebg" width="100%" cellspacing="1"> - <!-- DEFINE $CAPTCHA_TAB_INDEX = 4 --> - <!-- INCLUDE {CAPTCHA_TEMPLATE} --> -<!-- ENDIF --> - -{S_LOGIN_REDIRECT} -<tr> - <td class="cat" <!-- IF not S_ADMIN_AUTH or S_CONFIRM_CODE -->colspan="2"<!-- ENDIF --> align="center">{S_HIDDEN_FIELDS}<input type="submit" name="login" class="btnmain" value="{L_LOGIN}" tabindex="5" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<script type="text/javascript"> -// <![CDATA[ - (function() - { - var elements = document.getElementsByName("<!-- IF S_ADMIN_AUTH -->{PASSWORD_CREDENTIAL}<!-- ELSE -->{USERNAME_CREDENTIAL}<!-- ENDIF -->"); - for (var i = 0; i < elements.length; ++i) - { - if (elements[i].tagName.toLowerCase() == 'input') - { - elements[i].focus(); - break; - } - } - })(); -// ]]> -</script> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/login_body_oauth.html b/phpBB/styles/subsilver2/template/login_body_oauth.html deleted file mode 100644 index 6f374fa4f2..0000000000 --- a/phpBB/styles/subsilver2/template/login_body_oauth.html +++ /dev/null @@ -1,7 +0,0 @@ -<!-- BEGIN oauth --> - <tr> - <td> - <a href="{oauth.REDIRECT_URL}">{oauth.SERVICE_NAME}</a> - </td> - </tr> -<!-- END oauth --> diff --git a/phpBB/styles/subsilver2/template/login_forum.html b/phpBB/styles/subsilver2/template/login_forum.html deleted file mode 100644 index 9a141fc295..0000000000 --- a/phpBB/styles/subsilver2/template/login_forum.html +++ /dev/null @@ -1,56 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<!-- IF FORUM_NAME --> - <div id="pageheader"> - <h2><a class="titles" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2> - </div> - - <br clear="all" /><br /> -<!-- ENDIF --> - -<div id="pagecontent"> - - <form name="login_forum" method="post" action="{S_LOGIN_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1" align="center"> - <tr> - <th>{L_LOGIN}</th> - </tr> - <tr> - <td class="row3" align="center"><span class="gensmall">{L_LOGIN_FORUM}</span></td> - </tr> - <tr> - <td class="row1" align="center"> - - <table cellspacing="1" cellpadding="4" border="0"> - <!-- IF LOGIN_ERROR --> - <tr> - <td class="gensmall" colspan="2" align="center"><span class="error">{LOGIN_ERROR}</span></td> - </tr> - <!-- ENDIF --> - <tr> - <td class="gensmall"><b>{L_PASSWORD}{L_COLON}</b></td> - <td><input class="post" type="password" name="password" size="25" tabindex="2" /></td> - </tr> - </table> - </td> - </tr> - <tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="login" class="btnmain" value="{L_LOGIN}" tabindex="3" /></td> - </tr> - </table> - {S_FORM_TOKEN} - {S_LOGIN_REDIRECT} - </form> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_approve.html b/phpBB/styles/subsilver2/template/mcp_approve.html deleted file mode 100644 index 8c2ef0806b..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_approve.html +++ /dev/null @@ -1,49 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pagecontent"> - - <form name="confirm" action="{S_CONFIRM_ACTION}" method="post"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{MESSAGE_TITLE}</th> - </tr> - <tr> - <td class="row1" align="center"> - <!-- IF ADDITIONAL_MSG --> - <span class="gen error">{ADDITIONAL_MSG}</span><br /> - <!-- ENDIF --> - <!-- IF S_NOTIFY_POSTER --> - <input type="checkbox" class="radio" name="notify_poster" checked="checked" /><span class="gen"><!-- IF S_APPROVE -->{L_NOTIFY_POSTER_APPROVAL}<!-- ELSE -->{L_NOTIFY_POSTER_DISAPPROVAL}<!-- ENDIF --></span><br /> - <!-- ENDIF --> - <!-- IF not S_APPROVE and not S_RESTORE and .reason --> - <br /> - <table border="0" width="90%" cellspacing="2" cellpadding="1"> - <tr> - <td class="row1" width="22%"><b class="gen">{L_DISAPPROVE_REASON}{L_COLON}</b></td> - <td class="row1" width="78%"><select name="reason_id"><!-- BEGIN reason --><option value="{reason.ID}"<!-- IF reason.S_SELECTED --> selected="selected"<!-- ENDIF -->>{reason.DESCRIPTION}</option><!-- END reason --></select></td> - </tr> - <tr> - <td class="row1" valign="top"><span class="gen"><b>{L_MORE_INFO}{L_COLON}</b></span><br /><span class="gensmall">{L_CAN_LEAVE_BLANK}</span></td> - <td class="row1"><textarea class="post" style="width:500px" name="reason" rows="10" cols="40">{REASON}</textarea></td> - </tr> - </table> - <br /> - <!-- ENDIF --> - <br />{S_HIDDEN_FIELDS}<span class="gen">{MESSAGE_TEXT}</span><br /><br /> - <input type="submit" name="confirm" value="{YES_VALUE}" class="btnmain" /> <input type="submit" name="cancel" value="{L_NO}" class="btnlite" /></span> - </td> - </tr> - </table> - {S_FORM_TOKEN} - </form> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_ban.html b/phpBB/styles/subsilver2/template/mcp_ban.html deleted file mode 100644 index edf81c6d76..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_ban.html +++ /dev/null @@ -1,109 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<script type="text/javascript"> -// <![CDATA[ - - var ban_length = new Array(); - ban_length[-1] = ''; - <!-- BEGIN ban_length --> - ban_length['{ban_length.BAN_ID}'] = '{ban_length.A_LENGTH}'; - <!-- END ban_length --> - - var ban_reason = new Array(); - ban_reason[-1] = ''; - <!-- BEGIN ban_reason --> - ban_reason['{ban_reason.BAN_ID}'] = '{ban_reason.A_REASON}'; - <!-- END ban_reason --> - - var ban_give_reason = new Array(); - ban_give_reason[-1] = ''; - <!-- BEGIN ban_give_reason --> - ban_give_reason['{ban_give_reason.BAN_ID}'] = '{ban_give_reason.A_REASON}'; - <!-- END ban_give_reason --> - - function display_details(option) - { - document.getElementById('mcp_ban').unbangivereason.value = ban_give_reason[option]; - document.getElementById('mcp_ban').unbanreason.value = ban_reason[option]; - document.getElementById('mcp_ban').unbanlength.value = ban_length[option]; - } - -// ]]> -</script> - -<form id="mcp_ban" method="post" action="{U_ACTION}"> - -<table width="100%" class="tablebg" cellspacing="1" cellpadding="4" border="0"> -<tr> - <th colspan="2" nowrap="nowrap">{L_TITLE}</th> -</tr> -<tr> - <td class="row3" colspan="2">{L_EXPLAIN}</td> -</tr> -<tr> - <td class="row1" width="45%" valign="top"><b>{L_BAN_CELL}{L_COLON}</b></td> - <td class="row2"> - <textarea name="ban" id="ban" cols="40" rows="3" class="post">{USERNAMES}</textarea> - <!-- IF S_USERNAME_BAN --><br />[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]<!-- ENDIF --> - </td> -</tr> -<tr> - <td class="row1" valign="top"><b>{L_BAN_LENGTH}{L_COLON}</b></td> - <td class="row2"><select name="banlength">{S_BAN_END_OPTIONS}</select><br /><input type="text" name="banlengthother" class="post" /> {L_YEAR_MONTH_DAY}</td> -</tr> -<tr> - <td class="row1" valign="top"><b>{L_BAN_EXCLUDE}{L_COLON}</b><br /><span class="gensmall">{L_BAN_EXCLUDE_EXPLAIN}</span></td> - <td class="row2"><input type="radio" class="radio" name="banexclude" value="1" /> {L_YES} <input type="radio" class="radio" name="banexclude" value="0" checked="checked" /> {L_NO}</td> -</tr> -<tr> - <td class="row1" valign="top"><b>{L_BAN_REASON}{L_COLON}</b></td> - <td class="row2"><input name="banreason" type="text" class="post" maxlength="255" /></td> -</tr> -<tr> - <td class="row1" valign="top"><b>{L_BAN_GIVE_REASON}{L_COLON}</b></td> - <td class="row2"><input name="bangivereason" type="text" class="post" maxlength="255" /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="bansubmit" value="{L_SUBMIT}" class="btnmain" /> <input type="reset" value="{L_RESET}" class="btnlite" /> </td> -</tr> -</table> - -<br /><br /> - -<table width="100%" class="tablebg" cellspacing="1" cellpadding="4" border="0"> -<tr> - <th colspan="2" nowrap="nowrap">{L_UNBAN_TITLE}</th> -</tr> -<tr> - <td class="row3" colspan="2">{L_UNBAN_EXPLAIN}</td> -</tr> -<!-- IF S_BANNED_OPTIONS --> - <tr> - <td class="row1" valign="top" width="45%"><b>{L_BAN_CELL}{L_COLON}</b></td> - <td class="row2"><select name="unban[]" multiple="multiple" size="10" style="width: 50%" onchange="if (this.selectedIndex > -1) display_details(this.options[this.selectedIndex].value); else display_details(-1);">{BANNED_OPTIONS}</select></td> - </tr> - <tr> - <td class="row1" valign="top"><b>{L_BAN_LENGTH}{L_COLON}</b></td> - <td class="row2"><input style="border: 0; width: 100%" type="text" name="unbanlength" readonly="readonly" /></td> - </tr> - <tr> - <td class="row1" valign="top"><b>{L_BAN_REASON}{L_COLON}</b></td> - <td class="row2"><textarea style="border: 0; width: 100%" name="unbanreason" readonly="readonly" rows="5" cols="80"> </textarea></td> - </tr> - <tr> - <td class="row1" valign="top"><b>{L_BAN_GIVE_REASON}{L_COLON}</b></td> - <td class="row2"><textarea style="border: 0; width: 100%" name="unbangivereason" readonly="readonly" rows="5" cols="80"> </textarea></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="{L_SUBMIT}" class="btnmain" /> <input type="reset" value="{L_RESET}" class="btnlite" /> </td> - </tr> -<!-- ELSE --> - <tr> - <td class="row1" colspan="2"><b>{L_NO_BAN_CELL}</b></td> - </tr> -<!-- ENDIF --> -</table> -{S_FORM_TOKEN} -</form> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_footer.html b/phpBB/styles/subsilver2/template/mcp_footer.html deleted file mode 100644 index 280920b148..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_footer.html +++ /dev/null @@ -1,27 +0,0 @@ - - </td> - </tr> - </table> - - <!-- IF .pagination --> - <table width="80%" align="{S_CONTENT_FLOW_END}" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ <!-- IF TOTAL_TOPICS -->{TOTAL_TOPICS}<!-- ELSEIF TOTAL_POSTS -->{TOTAL_POSTS}<!-- ELSE -->{TOTAL}<!-- ENDIF --> ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - </tr> - </table> - <br /> - <!-- ENDIF --> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_forum.html b/phpBB/styles/subsilver2/template/mcp_forum.html deleted file mode 100644 index b168bf3ac8..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_forum.html +++ /dev/null @@ -1,93 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<!-- IF S_MERGE_SELECT --><div style="float: {S_CONTENT_FLOW_END};"><!-- INCLUDE jumpbox.html --></div><!-- ENDIF --> - -<!-- IF U_VIEW_FORUM_LOGS --><a href="{U_VIEW_FORUM_LOGS}">{L_VIEW_FORUM_LOGS}</a><!-- ENDIF --> - -<!-- IF S_MERGE_SELECT --><br clear="{S_CONTENT_FLOW_END}" /><!-- ENDIF --> - -<form method="post" id="mcp" action="{S_MCP_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <td class="cat" colspan="6" align="center"><span class="gensmall">{L_DISPLAY_TOPICS}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" name="sort" value="{L_GO}" /></td> -</tr> -<tr> - <th width="4%" nowrap="nowrap"> </th> - <th nowrap="nowrap"> {L_TOPICS} </th> - <th width="8%" nowrap="nowrap"> {L_REPLIES} </th> - <th width="17%" nowrap="nowrap"> {L_LAST_POST} </th> - <th width="5%" nowrap="nowrap"> {L_MARK} </th> -</tr> -<!-- BEGIN topicrow --> - <tr> - <td class="row1" width="25" align="center">{topicrow.TOPIC_FOLDER_IMG}</td> - <!-- IF S_TOPIC_ICONS --> - <!-- td class="row1" width="25" align="center">{topicrow.TOPIC_ICON_IMG}</td --> - <!-- ENDIF --> - <td class="row1"> - <!-- IF topicrow.S_SELECT_TOPIC --> - <span class="genmed">[ <a href="{topicrow.U_SELECT_TOPIC}">{L_SELECT_MERGE}</a> ] </span> - <!-- ENDIF --> - <p class="topictitle">{NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a> - <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> - <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.UNAPPROVED_IMG}</a> - <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_DELETED or topicrow.S_POSTS_DELETED --> - <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.DELETED_IMG}</a> - <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED and topicrow.U_MCP_REPORT --> - <a href="{topicrow.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a> - <!-- ENDIF --> - <!-- IF topicrow.S_MOVED_TOPIC and S_CAN_DELETE --> - [ <a href="{topicrow.U_DELETE_TOPIC}">{L_DELETE_SHADOW_TOPIC}</a> ] - <!-- ENDIF --> - </p> - </td> - <td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td> - <td class="row1" width="120" align="center"><p class="topicdetails">{topicrow.LAST_POST_TIME}</p></td> - <td class="row2" align="center"> - <!-- IF not topicrow.S_MOVED_TOPIC and not S_MERGE_SELECT --><input type="checkbox" class="radio" name="topic_id_list[]" value="{topicrow.TOPIC_ID}"<!-- IF topicrow.S_TOPIC_CHECKED --> checked="checked"<!-- ENDIF --> /><!-- ELSE --> <!-- ENDIF --> - </td> - </tr> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="8" align="center"><p class="gen">{L_NO_TOPICS}</p></td> - </tr> -<!-- END topicrow --> -<!-- IF not S_MERGE_SELECT --> -<tr> - <td class="cat" colspan="6" align="{S_CONTENT_FLOW_END}"> - <select name="action"> - <option value="" selected="selected">{L_SELECT_ACTION}</option> - <!-- IF S_CAN_DELETE --><option value="delete_topic">{L_DELETE}</option><!-- ENDIF --> - <!-- IF S_CAN_RESTORE --><option value="restore_topic">{L_RESTORE}</option><!-- ENDIF --> - <!-- IF S_CAN_MERGE --><option value="merge_topics">{L_MERGE}</option><!-- ENDIF --> - <!-- IF S_CAN_MOVE --><option value="move">{L_MOVE}</option><!-- ENDIF --> - <!-- IF S_CAN_FORK --><option value="fork">{L_FORK}</option><!-- ENDIF --> - <!-- IF S_CAN_LOCK --><option value="lock">{L_LOCK}</option><option value="unlock">{L_UNLOCK}</option><!-- ENDIF --> - <!-- IF S_CAN_SYNC --><option value="resync">{L_RESYNC}</option><!-- ENDIF --> - <!-- IF S_CAN_MAKE_NORMAL --><option value="make_normal">{L_MAKE_NORMAL}</option><!-- ENDIF --> - <!-- IF S_CAN_MAKE_STICKY --><option value="make_sticky">{L_MAKE_STICKY}</option><!-- ENDIF --> - <!-- IF S_CAN_MAKE_ANNOUNCE --> - <option value="make_announce">{L_MAKE_ANNOUNCE}</option> - <option value="make_global">{L_MAKE_GLOBAL}</option> - <!-- ENDIF --> - </select> - <input class="btnmain" type="submit" value="{L_SUBMIT}" /> - </td> -</tr> -<!-- ENDIF --> -</table> -{S_FORM_TOKEN} -</form> - -<!-- IF not S_MERGE_SELECT --> -<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> -<tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="gensmall"><a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a></b></td> -</tr> -</table> -<!-- ENDIF --> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_front.html b/phpBB/styles/subsilver2/template/mcp_front.html deleted file mode 100644 index 7c17e13c52..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_front.html +++ /dev/null @@ -1,137 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<!-- IF S_SHOW_UNAPPROVED --> - <form name="mcp_queue" method="post" action="{S_MCP_QUEUE_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3" colspan="6" align="center"><b class="gen">{L_LATEST_UNAPPROVED}</b></td> - </tr> - <tr> - <th> {L_FORUM} </th> - <th> {L_TOPIC} </th> - <th> {L_SUBJECT} </th> - <th> {L_AUTHOR} </th> - <th> {L_POST_TIME} </th> - <th width="5%"> {L_SELECT} </th> - </tr> - <!-- BEGIN unapproved --> - <tr> - <td class="row1" width="15%" valign="top"><span class="gen"><!-- IF unapproved.U_FORUM --><a href="{unapproved.U_FORUM}">{unapproved.FORUM_NAME}</a><!-- ELSE -->{unapproved.FORUM_NAME}<!-- ENDIF --></span><!-- IF unapproved.U_MCP_FORUM --><br /><span class="gensmall">[ <a href="{unapproved.U_MCP_FORUM}">{L_MODERATE}</a> ]</span><!-- ENDIF --></td> - <td class="row2" valign="top"><span class="gen"><a href="{unapproved.U_TOPIC}">{unapproved.TOPIC_TITLE}</a></span><br /><span class="gensmall">[ <a href="{unapproved.U_MCP_TOPIC}">{L_MODERATE}</a> ]</span></td> - <td class="row1" valign="top">{unapproved.ATTACH_ICON_IMG} <span class="gen">{unapproved.SUBJECT}</span><br /><span class="gensmall">[ <a href="{unapproved.U_POST_DETAILS}">{L_VIEW_DETAILS}</a> ]</span></td> - <td class="row2" align="center" width="15%" nowrap="nowrap" valign="top"><span class="gen">{unapproved.AUTHOR_FULL}</span></td> - <td class="row1" align="center" width="15%" nowrap="nowrap" valign="top"><span class="gensmall">{unapproved.POST_TIME}</span></td> - <td class="row2" align="center"><input type="checkbox" class="radio" name="post_id_list[]" value="{unapproved.POST_ID}" /></td> - </tr> - <!-- END unapproved --> - <tr> - <td class="row3" colspan="6"><span class="gensmall">{L_UNAPPROVED_TOTAL}</span></td> - </tr> - <tr> - <td class="cat" colspan="6" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="action[approve]" value="{L_APPROVE}" /> <input class="btnlite" type="submit" name="action[disapprove]" value="{L_DISAPPROVE}" /></td> - </tr> - </table> - {S_FORM_TOKEN} - </form> - - <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> - <tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="gensmall"><a href="#" onclick="marklist('mcp_queue', '', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp_queue', '', false); return false;">{L_UNMARK_ALL}</a></b></td> - </tr> - </table> - - <br clear="all" /><br /> -<!-- ENDIF --> - -<!-- IF S_SHOW_REPORTS --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3" colspan="5" align="center"><b class="gen">{L_LATEST_REPORTED}</b></td> - </tr> - <tr> - <th> {L_FORUM} </th> - <th> {L_TOPIC} </th> - <th> {L_SUBJECT} </th> - <th> {L_REPORTER} </th> - <th> {L_REPORT_TIME} </th> - </tr> - <!-- BEGIN report --> - <tr> - <td class="row1" width="15%" valign="top"><span class="gen"><!-- IF report.U_FORUM --><a href="{report.U_FORUM}">{report.FORUM_NAME}</a><!-- ELSE -->{report.FORUM_NAME}<!-- ENDIF --></span><!-- IF report.U_MCP_FORUM --><br /><span class="gensmall">[ <a href="{report.U_MCP_FORUM}">{L_MODERATE}</a> ]</span><!-- ENDIF --></td> - <td class="row2" valign="top"><span class="gen"><a href="{report.U_TOPIC}">{report.TOPIC_TITLE}</a></span><br /><span class="gensmall">[ <a href="{report.U_MCP_TOPIC}">{L_MODERATE}</a> ]</span></td> - <td class="row1" valign="top">{report.ATTACH_ICON_IMG} <span class="gen">{report.SUBJECT}</span><br /><span class="gensmall">[ <a href="{report.U_POST_DETAILS}">{L_VIEW_DETAILS}</a> ]</span></td> - <td class="row2" align="center" width="15%" nowrap="nowrap" valign="top"><span class="gen">{report.REPORTER_FULL}</span></td> - <td class="row1" align="center" width="15%" nowrap="nowrap" valign="top"><span class="gensmall">{report.REPORT_TIME}</span></td> - </tr> - <!-- END report --> - <tr> - <td class="row3" colspan="5"><span class="gensmall">{L_REPORTS_TOTAL}</span></td> - </tr> - </table> - - <br clear="all" /><br /> -<!-- ENDIF --> - -<!-- IF S_SHOW_PM_REPORTS --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3" colspan="6" align="center"><b class="gen">{L_LATEST_REPORTED_PMS}</b></td> - </tr> - <tr> - <th> {L_PM_SUBJECT} </th> - <th> {L_PM_FROM} </th> - <th> {L_TO} & {L_BCC} </th> - <th> {L_SENT_AT} </th> - <th> {L_REPORTER} </th> - <th> {L_REPORT_TIME} </th> - </tr> - <!-- BEGIN pm_report --> - <tr> - <td class="row1" valign="top">{pm_report.ATTACH_ICON_IMG} <span class="gen">{pm_report.PM_SUBJECT}</span><br /><span class="gensmall">[ <a href="{pm_report.U_PM_DETAILS}">{L_VIEW_DETAILS}</a> ]</span></td> - <td class="row2" align="center" width="15%" nowrap="nowrap" valign="top"><span class="gen">{pm_report.PM_AUTHOR_FULL}</span></td> - <td class="row1" align="center" width="15%" nowrap="nowrap" valign="top"><span class="gen">{pm_report.RECIPIENTS}</span></td> - <td class="row2" align="center" width="10%" nowrap="nowrap" valign="top"><span class="gensmall">{pm_report.PM_TIME}</span></td> - <td class="row1" align="center" width="15%" nowrap="nowrap" valign="top"><span class="gen">{pm_report.REPORTER_FULL}</span></td> - <td class="row2" align="center" width="10%" nowrap="nowrap" valign="top"><span class="gensmall">{pm_report.REPORT_TIME}</span></td> - </tr> - <!-- END pm_report --> - <tr> - <td class="row3" colspan="6"><span class="gensmall">{L_PM_REPORTS_TOTAL}</span></td> - </tr> - </table> - - <br clear="all" /><br /> -<!-- ENDIF --> - -<!-- IF S_SHOW_LOGS --> - <table class="tablebg" width="100%" cellspacing="1" cellpadding="4" border="0" align="{S_CONTENT_FLOW_END}"> - <tr> - <td class="row3" colspan="5" align="center"><b class="gen">{L_LATEST_LOGS}</b></td> - </tr> - <tr> - <th width="15%" nowrap="nowrap">{L_USERNAME}</th> - <th width="12%" nowrap="nowrap">{L_IP}</th> - <th width="45%" nowrap="nowrap">{L_ACTION}</th> - <th nowrap="nowrap"></th> - <th width="18%" nowrap="nowrap">{L_TIME}</th> - </tr> - <!-- BEGIN log --> - <tr> - <td class="row1" nowrap="nowrap"><span class="gen">{log.USERNAME}</span></td> - <td class="row1" align="center" nowrap="nowrap"><span class="gen">{log.IP}</span></td> - <td class="row1"><span class="genmed">{log.ACTION}</span></td> - <td class="row1" align="center" nowrap="nowrap"><span class="gensmall"><!-- IF log.U_VIEW_TOPIC --><a href="{log.U_VIEW_TOPIC}">{L_VIEW_TOPIC}</a><!-- IF log.U_VIEWLOGS --> | <!-- ENDIF --><!-- ENDIF --><!-- IF log.U_VIEWLOGS --><a href="{log.U_VIEWLOGS}">{L_VIEW_TOPIC_LOGS}</a><!-- ENDIF --></span></td> - <td class="row1" align="center" nowrap="nowrap"><span class="gensmall">{log.TIME}</span></td> - </tr> - <!-- BEGINELSE --> - <tr> - <td class="row1" colspan="5" align="center"><span class="gen">{L_NO_ENTRIES}</span></td> - </tr> - <!-- END log --> - </table> - - <br clear="all" /> -<!-- ENDIF --> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_header.html b/phpBB/styles/subsilver2/template/mcp_header.html deleted file mode 100644 index 9b9f7849f4..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_header.html +++ /dev/null @@ -1,77 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pageheader"> - <!-- IF U_MCP --> - <p class="linkmcp"> - [<!-- IF U_ACP --> <a href="{U_ACP}">{L_ACP}</a> |<!-- ENDIF --> <a href="{U_MCP}">{L_MCP}</a><!-- IF U_MCP_FORUM --> | <a href="{U_MCP_FORUM}">{L_MODERATE_FORUM}</a><!-- ENDIF --><!-- IF U_MCP_TOPIC --> | <a href="{U_MCP_TOPIC}">{L_MODERATE_TOPIC}</a><!-- ENDIF --><!-- IF U_MCP_POST --> | <a href="{U_MCP_POST}">{L_MODERATE_POST}</a><!-- ENDIF --> ] - </p> - <!-- ENDIF --> - - <!-- IF TOPIC_TITLE or FORUM_NAME --> - <h2><!-- IF TOPIC_TITLE --><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><!-- ELSE --><a class="titles" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- ENDIF --></h2> - <!-- ENDIF --> -</div> - -<br clear="all" /> - -<div id="pagecontent"> - - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td width="20%" valign="top"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_OPTIONS}</th> - </tr> - <!-- BEGIN l_block1 --> - <tr> - <!-- IF l_block1.S_SELECTED --> - <td class="row1"><b class="nav">{l_block1.L_TITLE}</b> - - <ul class="nav" style="margin: 0; padding: 0; list-style-type: none; line-height: 175%;"> - <!-- BEGIN l_block2 --> - <li>» <!-- IF l_block1.l_block2.S_SELECTED --><b>{l_block1.l_block2.L_TITLE}</b><!-- ELSE --><a href="{l_block1.l_block2.U_TITLE}">{l_block1.l_block2.L_TITLE}</a><!-- ENDIF --></li> - <!-- END l_block2 --> - </ul> - <!-- ELSE --> - <td class="row2" nowrap="nowrap" onmouseover="this.className='row1'" onmouseout="this.className='row2'" onclick="location.href=this.firstChild.href;"><a class="nav" href="{l_block1.U_TITLE}">{l_block1.L_TITLE}</a> - <!-- ENDIF --> - </td> - </tr> - <!-- END l_block1 --> - </table> - - </td> - <td><img src="images/spacer.gif" width="4" alt="" /></td> - <td width="80%" valign="top"> - - <!-- IF MESSAGE --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_MESSAGE}</th> - </tr> - <tr> - <td class="row1" align="center"><br /><span class="gen">{MESSAGE}<br /><br /><!-- BEGIN return_links -->{return_links.MESSAGE_LINK}<br /><br /><!-- END return_links --></span></td> - </tr> - </table> - - <br /> - <!-- ENDIF --> - - <!-- IF CONFIRM_MESSAGE --> - <form name="confirm" method="post" action="{S_CONFIRM_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_PLEASE_CONFIRM}</th> - </tr> - <tr> - <td class="row1" align="center"><span class="gen"><br />{CONFIRM_MESSAGE}<br /><br />{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="confirm" value="{L_YES}" /> <input class="btnlite" type="submit" name="cancel" value="{L_NO}" /><br /><br /></span></td> - </tr> - </table> - - </form> - - <br /> - <!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/mcp_logs.html b/phpBB/styles/subsilver2/template/mcp_logs.html deleted file mode 100644 index 64f2a6a64d..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_logs.html +++ /dev/null @@ -1,46 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form method="post" name="mcp" action="{U_POST_ACTION}"> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th>{L_USERNAME}</th> - <th>{L_IP}</th> - <th>{L_TIME}</th> - <th>{L_ACTION}</th> - <!-- IF S_CLEAR_ALLOWED --><th>{L_MARK}</th><!-- ENDIF --> -</tr> -<!-- IF S_LOGS --> - - <!-- BEGIN log --> - <!-- IF log.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td class="genmed">{log.USERNAME}</td> - <td class="genmed" style="text-align: center;">{log.IP}</td> - <td class="genmed" style="text-align: center;">{log.DATE}</td> - <td class="genmed">{log.ACTION}<br />{log.DATA}</td> - <!-- IF S_CLEAR_ALLOWED --><td width="5%" align="center"><input type="checkbox" class="radio" name="mark[]" value="{log.ID}" /></td><!-- ENDIF --> - </tr> - <!-- END log --> - <tr align="center"> - <td class="row3" colspan="<!-- IF S_CLEAR_ALLOWED -->5<!-- ELSE -->4<!-- ENDIF -->"><span class="gensmall">{L_SEARCH_KEYWORDS}{L_COLON}</span> <input type="text" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="btnlite" name="filter" value="{L_SEARCH}" /></td> - </tr> - <tr align="center"> - <td class="row3" colspan="<!-- IF S_CLEAR_ALLOWED -->5<!-- ELSE -->4<!-- ENDIF -->"><span class="gensmall">{L_DISPLAY_LOG}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" value="{L_GO}" name="sort" /></td> - </tr> - <!-- IF S_CLEAR_ALLOWED --> - <tr> - <td class="cat" colspan="5" align="center"><input class="btnlite" type="submit" name="action[del_all]" value="{L_DELETE_ALL}" /> <input class="btnlite" type="submit" name="action[del_marked]" value="{L_DELETE_MARKED}" /></td> - </tr> - <!-- ENDIF --> -<!-- ELSE --> - <tr> - <td class="row1" colspan="<!-- IF S_CLEAR_ALLOWED -->5<!-- ELSE -->4<!-- ENDIF -->" align="center"><span class="gen">{L_NO_ENTRIES}</span></td> - </tr> -<!-- ENDIF --> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /><br /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_message.html b/phpBB/styles/subsilver2/template/mcp_message.html deleted file mode 100644 index 5699dd54af..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_message.html +++ /dev/null @@ -1,14 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> -<tr> - <th><b>{MESSAGE_TITLE}</b></th> -</tr> -<tr> - <td class="row1" align="center"><br /><span class="gen">{MESSAGE_TEXT}</span><br /><br /></td> -</tr> -</table> - -<br clear="all" /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_move.html b/phpBB/styles/subsilver2/template/mcp_move.html deleted file mode 100644 index b8958187e6..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_move.html +++ /dev/null @@ -1,46 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pagecontent"> - - <form name="confirm" action="{S_CONFIRM_ACTION}" method="post"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{MESSAGE_TITLE}</th> - </tr> - <tr> - <td class="row1" align="center"> - <!-- IF ADDITIONAL_MSG --> - <span class="gen error">{ADDITIONAL_MSG}</span><br /> - <!-- ENDIF --> - <!-- IF S_FORUM_SELECT --> - <span class="gen"><br />{L_SELECT_DESTINATION_FORUM} </span> - <select name="to_forum_id">{S_FORUM_SELECT}</select><br /> - <!-- IF S_CAN_LEAVE_SHADOW --> - <input type="checkbox" class="radio" name="move_leave_shadow" /><span class="gen">{L_LEAVE_SHADOW}</span><br /> - <!-- ENDIF --> - <!-- IF S_CAN_LOCK_TOPIC --> - <input type="checkbox" class="radio" name="move_lock_topics" /><span class="gen">{L_LOCK_TOPIC}</span><br /> - <!-- ENDIF --> - <br />{S_HIDDEN_FIELDS}<span class="gen">{MESSAGE_TEXT}</span><br /><br /> - <input type="submit" name="confirm" value="{YES_VALUE}" class="btnmain" /> <input type="submit" name="cancel" value="{L_NO}" class="btnlite" /> - <!-- ELSE --> - <span class="gen">{L_NO_DESTINATION_FORUM}</span><br /><br /> - {S_HIDDEN_FIELDS} - <input type="submit" name="cancel" value="{L_CANCEL}" class="btnlite" /> - <!-- ENDIF --> - </td> - </tr> - </table> - {S_FORM_TOKEN} - </form> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_notes_front.html b/phpBB/styles/subsilver2/template/mcp_notes_front.html deleted file mode 100644 index e2e14e0150..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_notes_front.html +++ /dev/null @@ -1,22 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form method="post" name="mcp" action="{U_POST_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> -<tr> - <th colspan="2"align="center">{L_SELECT_USER}</th> -</tr> -<tr> - <td class="row1" width="40%"><b class="gen">{L_FIND_USERNAME}{L_COLON} </b><br /><span class="gensmall">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span></td> - <td class="row2"><input type="text" class="post" name="username" size="20" /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="submituser" value="{L_SUBMIT}" class="btnmain" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /><br /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_notes_user.html b/phpBB/styles/subsilver2/template/mcp_notes_user.html deleted file mode 100644 index 4bd8de6862..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_notes_user.html +++ /dev/null @@ -1,125 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form method="post" name="mcp" action="{U_POST_ACTION}"> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th colspan="2" align="center">{USERNAME}</th> -</tr> -<tr> - <td class="row1" align="center"> - <table cellspacing="1" cellpadding="2" border="0"> - <tr> - <td class="gen" align="center"><b>{USERNAME_FULL}</b></td> - </tr> - <!-- IF RANK_TITLE --> - <tr> - <td class="postdetails" align="center">{RANK_TITLE}</td> - </tr> - <!-- ENDIF --> - <!-- IF RANK_IMG --> - <tr> - <td align="center">{RANK_IMG}</td> - </tr> - <!-- ENDIF --> - <tr> - <td align="center"><!-- IF AVATAR_IMG -->{AVATAR_IMG}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --></td> - </tr> - </table> - </td> - <td class="row1"> - <table width="100%" cellspacing="1" cellpadding="2" border="0"> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_JOINED}{L_COLON} </td> - <td width="100%"><b class="gen">{JOINED}</b></td> - </tr> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_TOTAL_POSTS}{L_COLON} </td> - <td><b class="gen">{POSTS}</b></td> - </tr> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_WARNINGS}{L_COLON} </td> - <td><b class="gen">{WARNINGS}</b></td> - </tr> - </table> - </td> -</tr> -</table> - -<br /> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th colspan="5" align="center">{L_FEEDBACK}</th> -</tr> -<!-- IF S_USER_NOTES --> - - <tr align="center"> - <td colspan="5" class="row3"><span class="gensmall">{L_SEARCH_KEYWORDS}{L_COLON}</span> <input type="text" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="btnlite" name="filter" value="{L_SEARCH}" /></td> - </tr> - <tr align="center"> - <td colspan="5" class="row3"><span class="gensmall">{L_DISPLAY_LOG}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}{L_COLON}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" value="{L_GO}" name="sort" /></td> - </tr> - <tr> - <th>{L_REPORT_BY}</th> - <th>{L_IP}</th> - <th>{L_TIME}</th> - <th>{L_ACTION}</th> - <th><!-- IF S_CLEAR_ALLOWED -->{L_MARK}<!-- ENDIF --></th> - </tr> - - <!-- BEGIN usernotes --> - <!-- IF usernotes.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td class="gen">{usernotes.REPORT_BY}</td> - <td style="text-align: center;">{usernotes.IP}</td> - <td style="text-align: center;">{usernotes.REPORT_AT}</td> - <td class="gen"> - {usernotes.ACTION} - <!-- IF usernotes.DATA --><br />» <span class="gensmall">[ {usernotes.DATA} ]</span><!-- ENDIF --> - </td> - <td style="text-align: center;"><!-- IF S_CLEAR_ALLOWED --><input type="checkbox" class="radio" name="marknote[]" value="{usernotes.ID}" /><!-- ENDIF --></td> - </tr> - <!-- END usernotes --> - - <!-- IF S_CLEAR_ALLOWED --> - <tr> - <td class="cat" colspan="5" align="center"><input class="btnlite" type="submit" name="action[del_all]" value="{L_DELETE_ALL}" /> <input class="btnlite" type="submit" name="action[del_marked]" value="{L_DELETE_MARKED}" /></td> - </tr> - <!-- ENDIF --> - -<!-- ELSE --> - <tr> - <td class="row1" colspan="2" align="center"><span class="gen">{L_NO_FEEDBACK}</span></td> - </tr> -<!-- ENDIF --> -</table> - -<br clear="all" /> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th colspan="2" align="center">{L_ADD_FEEDBACK}</th> -</tr> -<tr> - <td class="row3" align="center" colspan="2"><span class="genmed">{L_ADD_FEEDBACK_EXPLAIN}</span></td> -</tr> -<tr> - <td colspan="2" class="row1" align="center"><textarea name="usernote" rows="10" cols="76"></textarea></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="action[add_feedback]" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" /></td> -</tr> -</table> - -<table width="100%" cellspacing="0" cellpadding="0"> -<tr> - <td class="pagination">{PAGE_NUMBER} [ {TOTAL_REPORTS} ]</td> - <td align="{S_CONTENT_FLOW_END}"><span class="pagination"><!-- INCLUDE pagination.html --></span></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /><br /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html deleted file mode 100644 index 0f000ca931..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ /dev/null @@ -1,211 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<!-- IF S_MCP_REPORT --> - <form method="post" name="mcp_report" action="{S_CLOSE_ACTION}"> - - <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> - <tr> - <th colspan="2" align="center"><!-- IF S_PM -->{L_PM_REPORT_DETAILS}<!-- ELSE -->{L_REPORT_DETAILS}<!-- ENDIF --></th> - </tr> - <tr> - <td class="row1"><b class="gen">{L_REPORT_REASON}{L_COLON} </b></td> - <td class="row2"><span class="gen">{REPORT_REASON_TITLE} » {REPORT_REASON_DESCRIPTION}</span></td> - </tr> - <tr> - <td class="row1" width="20%"><b class="gen">{L_REPORTER}{L_COLON} </b></td> - <td class="row2" width="80%"><span class="gen"<!-- IF REPORTER_COLOUR --> style="font-weight: bold; color: {REPORTER_COLOUR};"<!-- ENDIF -->>{REPORTER_NAME}</span> <span class="gen">[ <!-- IF U_VIEW_REPORTER_PROFILE --><a href="{U_VIEW_REPORTER_PROFILE}">{L_READ_PROFILE}</a><!-- ENDIF --><!-- IF S_USER_NOTES --><!-- IF U_VIEW_REPORTER_PROFILE --> | <!-- ENDIF --><a href="{U_MCP_REPORTER_NOTES}">{L_VIEW_NOTES}</a> | <a href="{U_MCP_WARN_REPORTER}">{L_WARN_USER}</a><!-- ENDIF --> ]</span></td> - </tr> - <tr> - <td class="row1"><b class="gen">{L_REPORTED}{L_COLON} </b></td> - <td class="row2"><span class="postdetails">{REPORT_DATE}</span></td> - </tr> - <!-- IF REPORT_TEXT --> - <tr> - <th colspan="2" align="center">{L_MORE_INFO}</th> - </tr> - <tr> - <td class="row1" colspan="2"><div class="gen" style="overflow: auto; width: 100%; height: 80pt; border: 1px;">{REPORT_TEXT}</div></td> - </tr> - <!-- ENDIF --> - <tr> - <td class="cat" align="center" colspan="2"><!-- IF not S_REPORT_CLOSED --><input class="btnmain" type="submit" value="{L_CLOSE_REPORT}" name="action[close]" /><!-- ELSE -->{L_REPORT_CLOSED}<!-- ENDIF --> <input class="btnlite" type="submit" value="{L_DELETE_REPORT}" name="action[delete]" /></td> - </tr> - </table> - - <input type="hidden" name="report_id_list[]" value="{REPORT_ID}" /> - {S_FORM_TOKEN} - </form> - - <br clear="all"/> -<!-- ENDIF --> - -<!-- IF S_MCP_QUEUE --><form method="post" name="mcp_approve" action="{U_APPROVE_ACTION}"><!-- ELSE --><form method="post" name="mcp_report_details" action="{S_CLOSE_ACTION}"><!-- ENDIF --> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th colspan="2" align="center"><!-- IF S_PM -->{L_PM}<!-- ELSE -->{L_POST_DETAILS}<!-- ENDIF --></th> -</tr> -<tr> - <td class="row3" colspan="2" align="center"><span class="gensmall"><!-- IF S_MCP_QUEUE -->{RETURN_QUEUE} | {RETURN_TOPIC_SIMPLE} | {RETURN_POST}<!-- ELSEIF S_MCP_REPORT -->{RETURN_REPORTS}<!-- IF not S_PM --> | <a href="{U_VIEW_POST}">{L_VIEW_POST}</a> | <a href="{U_VIEW_TOPIC}">{L_VIEW_TOPIC}</a> | <a href="{U_VIEW_FORUM}">{L_VIEW_FORUM}</a><!-- ENDIF --><!-- ELSE -->{RETURN_TOPIC}<!-- ENDIF --></span></td> -</tr> -<tr> - <td class="row1"><b class="gen"><!-- IF S_PM -->{L_PM_SUBJECT}<!-- ELSE -->{L_POST_SUBJECT}<!-- ENDIF -->{L_COLON} </b></td> - <td class="row2"> - <span class="gen">{POST_SUBJECT}</span> - <!-- IF S_POST_UNAPPROVED --><span class="postapprove">{UNAPPROVED_IMG} <a href="{U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span> <!-- ENDIF --> - <!-- IF S_POST_DELETED --><span class="postapprove">{DELETED_IMG} <a href="{U_MCP_APPROVE}">{L_POST_DELETED}</a></span> <!-- ENDIF --> - <!-- IF S_POST_REPORTED and not S_MCP_REPORT --><span class="postreported">{REPORTED_IMG} <a href="{U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF --> - </td> -</tr> -<tr> - <td class="row1" width="20%"><b class="gen"><!-- IF S_PM -->{L_PM_FROM}<!-- ELSE -->{L_POSTER}<!-- ENDIF -->{L_COLON} </b></td> - <td class="row2" width="80%"><span class="gen"<!-- IF POST_AUTHOR_COLOUR --> style="font-weight: bold; color: {POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{POST_AUTHOR}</span><span class="gen"> [ <!-- IF U_POST_AUTHOR --><a href="{U_POST_AUTHOR}">{L_READ_PROFILE}</a><!-- ENDIF --><!-- IF S_USER_NOTES --><!-- IF U_POST_AUTHOR --> | <!-- ENDIF --><a href="{U_MCP_USER_NOTES}">{L_VIEW_NOTES}</a> <!-- IF U_MCP_WARN_USER -->| <a href="{U_MCP_WARN_USER}">{L_WARN_USER}</a><!-- ENDIF --><!-- ENDIF --> ]</span></td> -</tr> -<!-- IF S_CAN_VIEWIP --> - <tr> - <td class="row1"><b class="gen"><!-- IF S_PM -->{L_THIS_PM_IP}<!-- ELSE -->{L_THIS_POST_IP}<!-- ENDIF -->{L_COLON} </b></td> - <td class="row2"><span class="gen"> - <!-- IF U_WHOIS --> - <a href="{U_WHOIS}"><!-- IF POST_IPADDR -->{POST_IPADDR}<!-- ELSE -->{POST_IP}<!-- ENDIF --></a> (<!-- IF POST_IPADDR -->{POST_IP}<!-- ELSE --><a href="{U_LOOKUP_IP}">{L_LOOKUP_IP}</a><!-- ENDIF -->) - <!-- ELSE --> - <!-- IF POST_IPADDR -->{POST_IPADDR} ({POST_IP})<!-- ELSE -->{POST_IP}<!-- IF U_LOOKUP_IP --> (<a href="{U_LOOKUP_IP}">{L_LOOKUP_IP}</a>)<!-- ENDIF --><!-- ENDIF --> - <!-- ENDIF --> - </span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1"><b class="gen"><!-- IF S_PM -->{L_SENT_AT}<!-- ELSE -->{L_POSTED}<!-- ENDIF -->{L_COLON} </b></td> - <td class="row2"><span class="postdetails">{POST_DATE}</span></td> -</tr> -<!-- IF S_TO_RECIPIENT --> - <tr> - <td class="row1" nowrap="nowrap" width="150"><b class="gen">{L_TO}{L_COLON}</b></td> - <td class="row2 gen"> - <!-- BEGIN to_recipient --> - <!-- IF to_recipient.IS_GROUP --><span class="sep"><a href="{to_recipient.U_VIEW}">{to_recipient.NAME}</a></span><!-- ELSE -->{to_recipient.NAME_FULL} <!-- ENDIF --> - <!-- END to_recipient --> - </td> - </tr> -<!-- ENDIF --> - -<!-- IF S_BCC_RECIPIENT --> - <tr> - <td class="row1" nowrap="nowrap" width="150"><b class="gen">{L_BCC}{L_COLON}</b></td> - <td class="row2 gen"> - <!-- BEGIN bcc_recipient --> - <!-- IF bcc_recipient.IS_GROUP --><span class="sep"><a href="{bcc_recipient.U_VIEW}">{bcc_recipient.NAME}</a></span><!-- ELSE -->{bcc_recipient.NAME_FULL} <!-- ENDIF --> - <!-- END bcc_recipient --> - </td> - </tr> -<!-- ENDIF --> -<tr> - <th colspan="2" align="center">{L_PREVIEW}</th> -</tr> -<tr> - <td class="row1" colspan="2"> - <!-- IF U_EDIT --><div class="gen" style="float: {S_CONTENT_FLOW_END};"><a href="{U_EDIT}" class="imageset">{EDIT_IMG}</a></div><!-- ENDIF --> - - <div class="postbody">{POST_PREVIEW}</div> - - <!-- IF S_HAS_ATTACHMENTS --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <!-- IF attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - - </td> -</tr> -<!-- IF S_POST_UNAPPROVED and S_MCP_QUEUE --> - <tr> - <td class="cat" align="center" colspan="2"><input class="btnmain" type="submit" value="{L_APPROVE}" name="action[approve]" /> <input class="btnlite" type="submit" value="{L_DISAPPROVE}" name="action[disapprove]" /></td> - </tr> - <input type="hidden" name="post_id_list[]" value="{POST_ID}" /> -<!-- ENDIF --> -</table> -{S_FORM_TOKEN} -</form> - -<!-- IF S_MCP_QUEUE --> - <br clear="all" /> - - <!-- IF S_TOPIC_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF --> -<!-- ELSEIF S_MCP_REPORT --> - <br clear="all" /> - - <!-- IF S_TOPIC_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF --> -<!-- ELSE --> - <!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER --> - <br /><a name="mod"></a> - - <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> - <tr> - <th colspan="2" align="center">{L_MOD_OPTIONS}</th> - </tr> - <!-- IF S_CAN_CHGPOSTER --> - <tr> - <td class="row1" valign="top"><b class="gen">{L_CHANGE_POSTER}</b></td> - <td class="row2"><form method="post" name="mcp_chgposter" action="{U_POST_ACTION}"><input class="post" type="text" name="username" value="" /> <input class="btnmain" type="submit" value="{L_CONFIRM}" name="action[chgposter]" /><br /><span class="gensmall">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span><!-- IF S_USER_SELECT --><br /><select name="u">{S_USER_SELECT}</select> <input type="submit" class="btnmain" name="action[chgposter_ip]" value="{L_CONFIRM}" /><!-- ENDIF -->{S_FORM_TOKEN}</form></td> - </tr> - <!-- ENDIF --> - <!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST --> - <tr> - <td class="row1" valign="top"><b class="gen">{L_MOD_OPTIONS}</b></td> - <td class="row2"><form method="post" name="mcp" action="{U_MCP_ACTION}"><select name="action"><!-- IF S_CAN_LOCK_POST --><!-- IF S_POST_LOCKED --><option value="unlock_post">{L_UNLOCK_POST} [{L_UNLOCK_POST_EXPLAIN}]</option><!-- ELSE --><option value="lock_post">{L_LOCK_POST} [{L_LOCK_POST_EXPLAIN}]</option><!-- ENDIF --><!-- ENDIF --><!-- IF S_CAN_DELETE_POST --><option value="delete_post">{L_DELETE_POST}</option><!-- ENDIF --></select> <input class="btnmain" type="submit" value="{L_SUBMIT}" /> {S_FORM_TOKEN}</form></td> - </tr> - <!-- ENDIF --> - </table> - <!-- ENDIF --> - - <!-- IF S_CAN_VIEWIP --> - <br /><a name="ip"></a> - - <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> - <tr> - <th colspan="2" align="center">{L_IP_INFO}</th> - </tr> - <tr> - <td colspan="2" class="cat"><b class="gen">{L_OTHER_USERS}</b></td> - </tr> - <!-- BEGIN userrow --> - <!-- IF userrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td><span class="gen"><!-- IF userrow.U_PROFILE --><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a><!-- ELSE -->{userrow.USERNAME}<!-- ENDIF --> [ {userrow.NUM_POSTS} {userrow.L_POST_S} ]</span></td> - <td align="center"><a href="{userrow.U_SEARCHPOSTS}" class="imageset">{SEARCH_IMG}</a></td> - </tr> - <!-- BEGINELSE --> - <tr class="row1"> - <td colspan="2" align="center"><span class="gen">{L_NO_MATCHES_FOUND}</span></td> - </tr> - <!-- END userrow --> - <tr> - <td class="cat"><b class="gen">{L_IPS_POSTED_FROM}</b></td> - <td class="cat" width="10%" nowrap="nowrap"><!-- IF U_LOOKUP_ALL --><span class="gen">[ <a href="{U_LOOKUP_ALL}">{L_LOOKUP_ALL}</a> ]</span><!-- ENDIF --></td> - </tr> - <!-- BEGIN iprow --> - <!-- IF iprow.S_ROW_COUNT is even --> - <tr class="row1"> - <!-- ELSE --> - <tr class="row2"> - <!-- ENDIF --> - <td><span class="gen"><!-- IF iprow.HOSTNAME --><a href="{iprow.U_WHOIS}">{iprow.HOSTNAME}</a> ({iprow.IP})<!-- ELSE --><a href="{iprow.U_WHOIS}">{iprow.IP}</a><!-- ENDIF --> [ {iprow.NUM_POSTS} {iprow.L_POST_S} ]</span></td> - <td align="center"><!-- IF iprow.U_LOOKUP_IP --><span class="gen">[ <a href="{iprow.U_LOOKUP_IP}">{L_LOOKUP_IP}</a> ]</span><!-- ENDIF --></td> - </tr> - <!-- BEGINELSE --> - <tr class="row1"> - <td colspan="2" align="center"><span class="gen">{L_NO_MATCHES_FOUND}</span></td> - </tr> - <!-- END iprow --> - </table> - <!-- ENDIF --> - -<!-- ENDIF --> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_queue.html b/phpBB/styles/subsilver2/template/mcp_queue.html deleted file mode 100644 index 7ca659b5da..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_queue.html +++ /dev/null @@ -1,76 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form name="mcp" id="mcp" method="post" action="{S_MCP_ACTION}"> - -<table width="100%" class="tablebg" cellspacing="1" cellpadding="4" border="0"> -<tr> - <th colspan="4" nowrap="nowrap">{L_DISPLAY_OPTIONS}</th> -</tr> -<tr> - <td colspan="4" class="cat" align="center"><span class="gensmall">{L_DISPLAY_ITEMS}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <span class="gensmall">{L_FORUM}</span> <select name="f">{S_FORUM_OPTIONS}</select> <!-- IF TOPIC_ID --><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" /> <b>{L_ONLY_TOPIC}</b> <!-- ENDIF --><input class="btnlite" type="submit" name="sort" value="{L_GO}" /></td> -</tr> -<tr> - <th> <!-- IF S_TOPICS -->{L_TOPIC}<!-- ELSE -->{L_POST}<!-- ENDIF --> </th> - <th> {L_AUTHOR} </th> - <th> {L_POST_TIME} </th> - <th width="5%"> {L_SELECT} </th> -</tr> -<!-- BEGIN postrow --> - - <!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td style="padding: 4px;"><p class="topictitle">{postrow.ATTACH_ICON_IMG} <a href="{postrow.U_VIEWPOST}">{postrow.POST_SUBJECT}</a></p> - <span class="gensmall"><!-- IF postrow.U_VIEWFORUM -->{L_FORUM}{L_COLON} <a href="{postrow.U_VIEWFORUM}">{postrow.FORUM_NAME}</a><!-- ELSE -->{postrow.FORUM_NAME}<!-- ENDIF --></span></td> - <td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap"><span class="gen">{postrow.POST_AUTHOR_FULL}</span><br /> - <span class="gensmall">[ <a href="{postrow.U_VIEW_DETAILS}">{L_VIEW_DETAILS}</a> ]</span></td> - <td class="postdetails" style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap">{postrow.POST_TIME}</td> - <td align="center"> - <!-- IF S_TOPICS --> - <input type="checkbox" class="radio" name="topic_id_list[]" value="{postrow.TOPIC_ID}" /> - <!-- ELSE --> - <input type="checkbox" class="radio" name="post_id_list[]" value="{postrow.POST_ID}" /> - <!-- ENDIF --> - </td> - </tr> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="4" height="30" align="center" valign="middle"> - <span class="gen"> - <!-- IF S_RESTORE --> - <!-- IF S_TOPICS -->{L_NO_TOPICS_DELETED}<!-- ELSE -->{L_NO_POSTS_DELETED}<!-- ENDIF --> - <!-- ELSE --> - <!-- IF S_TOPICS -->{L_NO_TOPICS_QUEUE}<!-- ELSE -->{L_NO_POSTS_QUEUE}<!-- ENDIF --> - <!-- ENDIF --> - </span> - </td> - </tr> -<!-- END postrow --> -<tr> - <td class="cat" colspan="4" align="center"> - <!-- IF S_RESTORE --> - <input class="btnlite" type="submit" name="action[delete]" value="{L_DELETE}" /> - <input class="btnmain" type="submit" name="action[restore]" value="{L_RESTORE}" /> - <!-- ELSE --> - <input class="btnmain" type="submit" name="action[approve]" value="{L_APPROVE}" /> - <input class="btnlite" type="submit" name="action[disapprove]" value="{L_DISAPPROVE}" /> - <!-- ENDIF --> - </td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> -<tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"> - <b class="gensmall"> - <!-- IF S_TOPICS --> - <a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a> - <!-- ELSE --> - <a href="#" onclick="marklist('mcp', 'post_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'post_id_list', false); return false;">{L_UNMARK_ALL}</a> - <!-- ENDIF --> - </b> - </td> -</tr> -</table> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_reports.html b/phpBB/styles/subsilver2/template/mcp_reports.html deleted file mode 100644 index 158f9c2603..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_reports.html +++ /dev/null @@ -1,67 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form name="mcp" id="mcp" method="post" action="{S_MCP_ACTION}"> - -<table width="100%" class="tablebg" cellspacing="1" cellpadding="4" border="0"> -<tr> - <th colspan="5" nowrap="nowrap">{L_DISPLAY_OPTIONS}</th> -</tr> -<tr> - <td colspan="5" class="cat" align="center"><span class="gensmall">{L_DISPLAY_POSTS}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}<!-- IF not S_PM --> <span class="gensmall">{L_FORUM}</span> <select name="f">{S_FORUM_OPTIONS}</select> <!-- IF TOPIC_ID --><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" /> <b>{L_ONLY_TOPIC}</b> <!-- ENDIF --><!-- ENDIF --><input class="btnlite" type="submit" name="sort" value="{L_GO}" /></td> -</tr> -<tr> - <!-- IF S_PM --> - <th> {L_PM} </th> - <th> {L_TO} & {L_BCC} </th> - <!-- ELSE --> - <th> {L_POST} </th> - <th> {L_AUTHOR} </th> - <!-- ENDIF --> - <th> {L_REPORTER} </th> - <th> {L_REPORT_TIME} </th> - <th width="5%"> {L_SELECT} </th> -</tr> -<!-- BEGIN postrow --> - - <!-- IF postrow.S_ROW_ is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <!-- IF S_PM --> - <td style="padding: 4px;"><p class="topictitle">{postrow.ATTACH_ICON_IMG} <a href="{postrow.U_VIEW_DETAILS}">{postrow.PM_SUBJECT}</a></p> - <span class="gensmall">{L_PM_FROM}{L_COLON} {postrow.PM_AUTHOR_FULL}</span></td> - <td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><span class="gen">{postrow.RECIPIENTS}</span><br /> - <span class="gensmall">{L_SENT_AT}{L_COLON} {postrow.PM_TIME}</span></td> - <!-- ELSE --> - <td style="padding: 4px;"><p class="topictitle">{postrow.ATTACH_ICON_IMG} <a href="{postrow.U_VIEWPOST}">{postrow.POST_SUBJECT}</a></p> - <span class="gensmall"><!-- IF postrow.U_VIEWFORUM -->{L_FORUM}{L_COLON} <a href="{postrow.U_VIEWFORUM}">{postrow.FORUM_NAME}</a><!-- ELSE -->{postrow.FORUM_NAME}<!-- ENDIF --></span></td> - <td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap"><span class="gen">{postrow.POST_AUTHOR_FULL}</span><br /> - <span class="gensmall">{postrow.POST_TIME}</span></td> - <!-- ENDIF --> - <td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap"><span class="gen">{postrow.REPORTER_FULL}</span></td> - <td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap"><span class="gen">{postrow.REPORT_TIME}</span><br /> - <span class="gensmall">[ <a href="{postrow.U_VIEW_DETAILS}">{L_VIEW_DETAILS}</a> ]</span></td> - <td align="center"><input type="checkbox" class="radio" name="report_id_list[]" value="{postrow.REPORT_ID}" /></td> - </tr> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="5" height="30" align="center" valign="middle"><span class="gen">{L_NO_POSTS}</span></td> - </tr> -<!-- END postrow --> -<tr> - <td class="cat" colspan="5" align="center"> - <!-- IF S_CLOSED --> - <input class="btnmain" type="submit" value="{L_DELETE_REPORTS}" name="action[delete]" /> - <!-- ELSE --> - <input class="btnmain" type="submit" name="action[close]" value="{L_CLOSE_REPORTS}" /> <input class="btnlite" type="submit" value="{L_DELETE_REPORTS}" name="action[delete]" /> - <!-- ENDIF --> - </td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> -<tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="gensmall"><a href="#" onclick="marklist('mcp', '', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', '', false); return false;">{L_UNMARK_ALL}</a></b></td> -</tr> -</table> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html deleted file mode 100644 index 5bd762ec0b..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_topic.html +++ /dev/null @@ -1,154 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form name="mcp" id="mcp" method="post" action="{S_MCP_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1"> -<!-- IF S_CAN_SPLIT --> - <tr> - <th colspan="3" nowrap="nowrap">{L_SPLIT_TOPIC}</th> - </tr> - <tr> - <td class="row2" colspan="3" align="center"><span class="gensmall">{L_SPLIT_TOPIC_EXPLAIN}</span></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><span class="gen">{L_SPLIT_SUBJECT}</span></td> - <td class="row2" colspan="2"><input class="post" style="width: 350px" type="text" size="35" maxlength="124" name="subject" value="{SPLIT_SUBJECT}" /></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><span class="gen">{L_SPLIT_FORUM}</span></td> - <td class="row2" colspan="2"><select name="to_forum_id">{S_FORUM_SELECT}</select></td> - </tr> - - <!-- IF S_SHOW_TOPIC_ICONS --> - <tr> - <td class="row1"><span class="gen">{L_TOPIC_ICON}</span></td> - <td class="row2" colspan="2"> - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td><span class="genmed nowrap"><input type="radio" class="radio" name="icon" value="0"<!-- IF not S_TOPIC_ICON --> checked="checked"<!-- ENDIF --> />{L_NO_TOPIC_ICON}</span> <!-- BEGIN topic_icon --><span class="nowrap"><input type="radio" class="radio" name="icon" value="{topic_icon.ICON_ID}"<!-- IF topic_icon.S_CHECKED --> checked="checked"<!-- ENDIF --> /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /></span> <!-- END topic_icon --></td> - </tr> - </table> - </td> - </tr> - <!-- ENDIF --> -<!-- ENDIF --> - -<!-- IF S_CAN_MERGE --> - <tr> - <th colspan="3" nowrap="nowrap">{L_MERGE_POSTS}</th> - </tr> - <tr> - <td class="row2" colspan="3" align="center"><span class="gensmall">{L_MERGE_TOPIC_EXPLAIN}</span></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap"><span class="gen">{L_MERGE_TOPIC_ID}</span></td> - <td class="row2" colspan="2"><input class="post" type="number" min="0" size="6" name="to_topic_id" value="{TO_TOPIC_ID}" /> <a href="{U_SELECT_TOPIC}">{L_SELECT_TOPIC}</a></td> - </tr> - <!-- IF TO_TOPIC_INFO --> - <tr> - <td class="row3" colspan="3" align="center"><b class="gen">{TO_TOPIC_INFO}</b></td> - </tr> - <!-- ENDIF --> -<!-- ENDIF --> -<tr> - <th colspan="3" nowrap="nowrap">{L_DISPLAY_OPTIONS}</th> -</tr> -<tr> - <td class="row1" nowrap="nowrap"><span class="gen">{L_POSTS_PER_PAGE}</span><br /><span class="gensmall">{L_POSTS_PER_PAGE_EXPLAIN}</span></td> - <td class="row2" colspan="2"><input class="post" type="number" min="1" name="posts_per_page" size="6" value="{POSTS_PER_PAGE}" /></td> -</tr> -<tr> - <td class="cat" colspan="3" align="center"><span class="gensmall">{L_DISPLAY_POSTS}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" name="sort" value="{L_GO}" /></td> -</tr> -<tr> - <th nowrap="nowrap" colspan="3">{L_TOPIC_REVIEW}{L_COLON} {TOPIC_TITLE}</th> -</tr> -<tr> - <td class="row3" colspan="3" align="center"><span class="gensmall">{RETURN_TOPIC}</span></td> -</tr> -<!-- BEGIN postrow --> - - <!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td align="center"><b class="postauthor">{postrow.POST_AUTHOR_FULL}</b></td> - <td width="100%"> - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr style="vertical-align: top;"> - <td class="gensmall" nowrap="nowrap"> <b>{L_POST_SUBJECT}{L_COLON}</b> </td> - <td class="gensmall" width="100%">{postrow.POST_SUBJECT}</td> - </tr> - </table> - </td> - <td width="5%" align="center"><a href="{postrow.U_POST_DETAILS}" class="imageset">{INFO_IMG}</a></td> - </tr> - - <!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td width="100%" valign="top" colspan="2"> - <table width="100%" cellspacing="0" cellpadding="2" border="0"> - <tr> - <td valign="top"> - <div class="postbody">{postrow.MESSAGE}</div> - <!-- IF postrow.S_HAS_ATTACHMENTS --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <!-- IF postrow.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{postrow.attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - - </td> - </tr> - <tr> - <td valign="bottom"> - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr valign="middle"> - <td width="100%"> - <!-- IF postrow.S_POST_UNAPPROVED and postrow.U_MCP_APPROVE --><span class="postapprove">{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span><br /><!-- ENDIF --> - <!-- IF postrow.S_POST_DELETED and postrow.U_MCP_APPROVE --><span class="postapprove">{DELETED_IMG} <a href="{postrow.U_MCP_APPROVE}">{L_POST_DELETED}</a></span><br /><!-- ENDIF --> - <!-- IF postrow.S_POST_REPORTED and postrow.U_MCP_REPORT --><span class="postreported">{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF --> - </td> - <td width="10" nowrap="nowrap">{postrow.MINI_POST_IMG}</td> - <td class="gensmall" nowrap="nowrap"><b>{L_POSTED}{L_COLON}</b> {postrow.POST_DATE}</td> - </tr> - </table> - </td> - </tr> - </table> - </td> - <td width="5%" align="center"><input type="checkbox" class="radio" name="post_id_list[]" value="{postrow.POST_ID}"<!-- IF postrow.S_CHECKED --> checked="checked"<!-- ENDIF --> /></td> - </tr> - <tr> - <td class="row3" colspan="3" height="1"><img src="images/spacer.gif" width="1" height="1" alt="" /></td> - </tr> -<!-- END postrow --> -<tr> - <td class="cat" colspan="3" align="center"><select name="action"><option value="" selected="selected">{L_SELECT_ACTION}</option> - <!-- IF S_CAN_APPROVE --><option value="approve">{L_APPROVE_POSTS}</option><!-- ENDIF --> - <!-- IF S_CAN_LOCK --><option value="lock_post">{L_LOCK_POST_POSTS} [ {L_LOCK_POST_EXPLAIN} ]</option><option value="unlock_post">{L_UNLOCK_POST_POSTS}</option><!-- ENDIF --> - <!-- IF S_CAN_DELETE --><option value="delete_post">{L_DELETE_POSTS}</option><!-- ENDIF --> - <!-- IF S_CAN_RESTORE --><option value="restore">{L_RESTORE_POSTS}</option><!-- ENDIF --> - <!-- IF S_CAN_MERGE --><option value="merge_posts"<!-- IF ACTION eq 'merge' --> selected="selected"<!-- ENDIF -->>{L_MERGE_POSTS}</option><!-- ENDIF --> - <!-- IF S_CAN_SPLIT --><option value="split_all"<!-- IF ACTION eq 'split' --> selected="selected"<!-- ENDIF -->>{L_SPLIT_POSTS}</option><option value="split_beyond">{L_SPLIT_AFTER}</option><!-- ENDIF --> - <!-- IF S_CAN_SYNC --><option value="resync">{L_RESYNC}</option><!-- ENDIF --> - </select> <input class="btnmain" type="submit" name="mcp_topic_submit" value="{L_SUBMIT}" /></td> -</tr> -</table> -{S_HIDDEN_FIELDS} -{S_FORM_TOKEN} -</form> - -<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> -<tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="gensmall"><a href="#" onclick="marklist('mcp', '', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', '', false); return false;">{L_UNMARK_ALL}</a></b></td> -</tr> -</table> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_warn_front.html b/phpBB/styles/subsilver2/template/mcp_warn_front.html deleted file mode 100644 index f6daec9cc5..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_warn_front.html +++ /dev/null @@ -1,74 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form method="post" name="mcp" action="{U_POST_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1" border="0" align="center"> -<tr> - <th colspan="2"align="center">{L_SELECT_USER}</th> -</tr> -<tr> - <td class="row1" width="40%"><b class="gen">{L_FIND_USERNAME}{L_COLON} </b><br /><span class="gensmall">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span></td> - <td class="row2"><input type="text" class="post" name="username" size="20" /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="submituser" value="{L_SUBMIT}" class="btnmain" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /><br /> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <td class="row3" colspan="4" align="center"><b class="gen">{L_MOST_WARNINGS}</b></td> -</tr> -<tr> - <th> {L_USERNAME} </th> - <th> {L_WARNINGS} </th> - <th> {L_LATEST_WARNING_TIME} </th> - <th> </th> -</tr> -<!-- BEGIN highest --> - <tr> - <td class="row1" width="15%" valign="top"><span class="gen">{highest.USERNAME_FULL}</span></td> - <td class="row2" width="15%" valign="top"><span class="gen">{highest.WARNINGS}</span></td> - <td class="row1" width="15%" valign="top"><span class="gen">{highest.WARNING_TIME}</span></td> - <td class="row2" width="15%" valign="top"><span class="gen"><a href="{highest.U_NOTES}">{L_VIEW_NOTES}</a></span></td> - </tr> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="4" align="center"><span class="gen">{L_NO_WARNINGS}</span></td> - </tr> -<!-- END highest --> -</table> - -<br clear="all" /><br /> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <td class="row3" colspan="4" align="center"><b class="gen">{L_LATEST_WARNINGS}</b></td> -</tr> -<tr> - <th> {L_USERNAME} </th> - <th> {L_TIME} </th> - <th> {L_TOTAL_WARNINGS} </th> - <th> </th> -</tr> -<!-- BEGIN latest --> - <tr> - <td class="row1" width="15%" valign="top"><span class="gen">{latest.USERNAME_FULL}</span></td> - <td class="row2" width="15%" valign="top"><span class="gen">{latest.WARNING_TIME}</span></td> - <td class="row1" width="15%" valign="top"><span class="gen">{latest.WARNINGS}</span></td> - <td class="row2" width="15%" valign="top"><span class="gen"><a href="{latest.U_NOTES}">{L_VIEW_NOTES}</a></span></td> - </tr> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="4" align="center"><span class="gen">{L_NO_WARNINGS}</span></td> - </tr> -<!-- END latest --> -</table> - -<br clear="all" /><br /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_warn_list.html b/phpBB/styles/subsilver2/template/mcp_warn_list.html deleted file mode 100644 index 6e263b6403..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_warn_list.html +++ /dev/null @@ -1,43 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<form method="post" name="mcp" action="{U_POST_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <td class="row3" colspan="4" align="center"><b class="gen">{L_WARNED_USERS}</b></td> -</tr> -<tr> - <th> {L_USERNAME} </th> - <th> {L_WARNINGS} </th> - <th> {L_LATEST_WARNING_TIME} </th> - <th> </th> -</tr> -<!-- BEGIN user --> - <tr> - <td class="row1" width="15%" valign="top"><span class="gen">{user.USERNAME_FULL}</span></td> - <td class="row2" width="15%" valign="top"><span class="gen">{user.WARNINGS}</span></td> - <td class="row1" width="15%" valign="top"><span class="gen">{user.WARNING_TIME}</span></td> - <td class="row2" width="15%" valign="top"><span class="gen"><a href="{user.U_NOTES}">{L_VIEW_NOTES}</a></span></td> - </tr> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="4" align="center"><span class="gen">{L_NO_WARNINGS}</span></td> - </tr> -<!-- END user --> -<tr align="center"> - <td class="row3" colspan="4"><span class="gensmall">{L_DISPLAY_POSTS}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" value="{L_GO}" name="sort" /></td> -</tr> -</table> - -<table width="100%" cellspacing="0" cellpadding="0"> -<tr> - <td class="pagination">{PAGE_NUMBER} [ {TOTAL_USERS} ]</td> - <td align="{S_CONTENT_FLOW_END}"><span class="pagination"><!-- INCLUDE pagination.html --></span></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /><br /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_warn_post.html b/phpBB/styles/subsilver2/template/mcp_warn_post.html deleted file mode 100644 index 223457d158..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_warn_post.html +++ /dev/null @@ -1,62 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th colspan="2" align="center">{L_POST}</th> -</tr> -<tr> - <td class="row1" align="center"> - <table cellspacing="1" cellpadding="2" border="0"> - <tr> - <td class="gen" align="center"><!-- IF USER_COLOR --><b style="color: #{USER_COLOR}"><!-- ELSE --><b><!-- ENDIF -->{USERNAME}</b></td> - </tr> - <!-- IF RANK_TITLE --> - <tr> - <td class="postdetails" align="center">{RANK_TITLE}</td> - </tr> - <!-- ENDIF --> - <!-- IF RANK_IMG --> - <tr> - <td align="center">{RANK_IMG}</td> - </tr> - <!-- ENDIF --> - <tr> - <td align="center"><!-- IF AVATAR_IMG -->{AVATAR_IMG}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --></td> - </tr> - </table> - </td> - <td class="row1"> - <span class="gen">{POST}</span> - </td> -</tr> -</table> - -<br clear="all" /><br /> - -<form method="post" name="mcp" action="{U_POST_ACTION}"> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th align="center">{L_ADD_WARNING}</th> -</tr> -<tr> - <td class="row3" align="center"><span class="genmed">{L_ADD_WARNING_EXPLAIN}</span></td> -</tr> -<tr> - <td class="row1" align="center"><textarea name="warning" rows="10" cols="76">{L_WARNING_POST_DEFAULT}</textarea></td> -</tr> -<!-- IF S_CAN_NOTIFY --> -<tr> - <td class="row1" align="center"><input type="checkbox" class="radio" name="notify_user" checked="checked" /><span class="genmed">{L_NOTIFY_USER_WARN}</span></td> -</tr> -<!-- ENDIF --> -<tr> - <td class="cat" align="center"><input class="btnmain" type="submit" name="action[add_warning]" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /><br /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_warn_user.html b/phpBB/styles/subsilver2/template/mcp_warn_user.html deleted file mode 100644 index 6b78c71557..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_warn_user.html +++ /dev/null @@ -1,75 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th colspan="2" align="center">{USERNAME}</th> -</tr> -<tr> - <td class="row1" align="center"> - <table cellspacing="1" cellpadding="2" border="0"> - <tr> - <td class="gen" align="center"><b>{USERNAME_FULL}</b></td> - </tr> - <!-- IF RANK_TITLE --> - <tr> - <td class="postdetails" align="center">{RANK_TITLE}</td> - </tr> - <!-- ENDIF --> - <!-- IF RANK_IMG --> - <tr> - <td align="center">{RANK_IMG}</td> - </tr> - <!-- ENDIF --> - <tr> - <td align="center"><!-- IF AVATAR_IMG -->{AVATAR_IMG}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --></td> - </tr> - </table> - </td> - <td class="row1"> - <table width="100%" cellspacing="1" cellpadding="2" border="0"> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_JOINED}{L_COLON} </td> - <td width="100%"><b class="gen">{JOINED}</b></td> - </tr> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_TOTAL_POSTS}{L_COLON} </td> - <td><b class="gen">{POSTS}</b></td> - </tr> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_WARNINGS}{L_COLON} </td> - <td><b class="gen">{WARNINGS}</b></td> - </tr> - </table> - </td> -</tr> -</table> - -<br clear="all" /><br /> - -<form method="post" name="mcp" action="{U_POST_ACTION}"> - -<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> -<tr> - <th align="center">{L_ADD_WARNING}</th> -</tr> -<tr> - <td class="row3" align="center"><span class="genmed">{L_ADD_WARNING_EXPLAIN}</span></td> -</tr> -<tr> - <td class="row1" align="center"><textarea name="warning" rows="10" cols="76"></textarea></td> -</tr> -<!-- IF S_CAN_NOTIFY --> -<tr> - <td class="row1" align="center"><input type="checkbox" class="radio" name="notify_user" checked="checked" /><span class="genmed">{L_NOTIFY_USER_WARN}</span></td> -</tr> -<!-- ENDIF --> -<tr> - <td class="cat" align="center"><input class="btnmain" type="submit" name="action[add_warning]" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /><br /> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_whois.html b/phpBB/styles/subsilver2/template/mcp_whois.html deleted file mode 100644 index 3e3b983059..0000000000 --- a/phpBB/styles/subsilver2/template/mcp_whois.html +++ /dev/null @@ -1,15 +0,0 @@ -<!-- INCLUDE mcp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th>{L_WHOIS}</th> -</tr> -<tr> - <td class="row3" align="center"><span class="gensmall">{RETURN_POST}</span></td> -</tr> -<tr> - <td class="row1"><pre>{WHOIS}</pre></td> -</tr> -</table> - -<!-- INCLUDE mcp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/memberlist_body.html b/phpBB/styles/subsilver2/template/memberlist_body.html deleted file mode 100644 index 7c4d301de7..0000000000 --- a/phpBB/styles/subsilver2/template/memberlist_body.html +++ /dev/null @@ -1,121 +0,0 @@ -<!-- IF S_IN_SEARCH_POPUP --> - <!-- INCLUDE simple_header.html --> -<!-- ELSE --> - <!-- INCLUDE overall_header.html --> -<!-- ENDIF --> - -<!-- IF S_SEARCH_USER --> - <!-- INCLUDE memberlist_search.html --> -<!-- ENDIF --> - -<!-- IF S_SHOW_GROUP --><!-- INCLUDE memberlist_group.html --><!-- ENDIF --> - -<!-- IF not S_SHOW_GROUP --> - <form method="post" name="charsearch" action="{S_MODE_ACTION}"> - <table width="100%" cellspacing="1"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}"><span class="genmed">{L_USERNAME_BEGINS_WITH}{L_COLON} </span> - <select name="first_char" onchange="this.form.submit();"> - <!-- BEGIN first_char --> - <option value="{first_char.VALUE}"<!-- IF first_char.S_SELECTED --> selected="selected"<!-- ENDIF -->>{first_char.DESC}</option> - <!-- END first_char --> - </select> <input type="submit" name="char" value="{L_DISPLAY}" class="btnlite" /></td> - <!-- IF U_FIND_MEMBER and not S_SEARCH_USER --> - <td class="genmed" align="{S_CONTENT_FLOW_END}"><a href="{U_FIND_MEMBER}">{L_FIND_USERNAME}</a></td> - <!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP --> - <td class="genmed" align="{S_CONTENT_FLOW_END}"><a href="{U_HIDE_FIND_MEMBER}">{L_HIDE_MEMBER_SEARCH}</a></td> - <!-- ENDIF --> - </tr> - </table> - {S_FORM_TOKEN} - </form> -<!-- ENDIF --> - -<!-- IF S_IN_SEARCH_POPUP --> - <form method="post" name="results" action="{S_MODE_ACTION}" onsubmit="insert_marked(this.user);return false"> -<!-- ELSE --> - <form method="post" action="{S_MODE_ACTION}"> -<!-- ENDIF --> -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th nowrap="nowrap">#</th> - <th nowrap="nowrap" width="25%" align="{S_CONTENT_FLOW_BEGIN}"><a href="{U_SORT_USERNAME}">{L_USERNAME}</a></th> - <th nowrap="nowrap" width="15%"><a href="{U_SORT_JOINED}">{L_JOINED}</a></th> - <th nowrap="nowrap" width="10%"><a href="{U_SORT_POSTS}">{L_POSTS}</a></th> - <th nowrap="nowrap" width="15%"><a href="{U_SORT_RANK}">{L_RANK}</a></th> - <th nowrap="nowrap" width="11%">{L_SEND_MESSAGE}</th> - <th nowrap="nowrap" width="11%"><a href="{U_SORT_EMAIL}">{L_EMAIL}</a></th> - <th nowrap="nowrap" width="11%"><a href="{U_SORT_WEBSITE}">{L_WEBSITE}</a></th> - <!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><th width="2%" nowrap="nowrap">{L_MARK}</th><!-- ENDIF --> -</tr> -<!-- BEGIN memberrow --> - - <!-- IF S_SHOW_GROUP --> - <!-- IF memberrow.S_FIRST_ROW and memberrow.S_GROUP_LEADER --> - <tr class="row3"> - <td colspan="8"><b class="gensmall">{L_GROUP_LEADER}</b></td> - </tr> - <!-- ELSEIF not memberrow.S_GROUP_LEADER and not $S_MEMBER_HEADER --> - <tr class="row3"> - <td colspan="8"><b class="gensmall">{L_GROUP_MEMBERS}</b></td> - </tr> - <!-- DEFINE $S_MEMBER_HEADER = 1 --> - <!-- ENDIF --> - <!-- ENDIF --> - - <!-- IF memberrow.S_ROW_COUNT is even --><tr class="row2"><!-- ELSE --> <tr class="row1"><!-- ENDIF --> - - <td class="gen" align="center"> {memberrow.ROW_NUMBER} </td> - <td class="genmed" align="{S_CONTENT_FLOW_BEGIN}"><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- EVENT memberlist_body_username_append --><!-- IF S_SELECT_SINGLE --> [ <a href="#" onclick="insert_single('{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a> ]<!-- ENDIF --></td> - <td class="genmed" align="center" nowrap="nowrap"> {memberrow.JOINED} </td> - <td class="gen" align="center">{memberrow.POSTS}</td> - <td class="gen" align="center"><!-- IF memberrow.RANK_IMG -->{memberrow.RANK_IMG}<!-- ELSE -->{memberrow.RANK_TITLE}<!-- ENDIF --></td> - <td class="gen" align="center"> <!-- IF memberrow.U_PM --><a href="{memberrow.U_PM}" class="imageset">{PM_IMG}</a><!-- ENDIF --> </td> - <td class="gen" align="center"> <!-- IF memberrow.U_EMAIL --><a href="{memberrow.U_EMAIL}" class="imageset">{EMAIL_IMG}</a><!-- ENDIF --> </td> - <td class="gen" align="center"> <!-- IF memberrow.U_WWW --><a href="{memberrow.U_WWW}" class="imageset">{WWW_IMG}</a><!-- ENDIF --> </td> - <!-- IF memberrow.S_PROFILE_FIELD1 --> - <!-- Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. --> - <td class="gen" align="center"> {memberrow.PROFILE_FIELD1_VALUE}</td> - <!-- ENDIF --> - <!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><td align="center"><input type="checkbox" class="radio" name="user" value="{memberrow.USERNAME}" /></td><!-- ENDIF --> - </tr> - -<!-- BEGINELSE --> - - <tr> - <td class="row1" colspan="<!-- IF S_IN_SEARCH_POPUP -->9<!-- ELSE -->8<!-- ENDIF -->" align="center"> - <span class="gen"><!-- IF S_SHOW_GROUP -->{L_NO_GROUP_MEMBERS}<!-- ELSE -->{L_NO_MEMBERS}<!-- ENDIF --></span> - </td> - </tr> - -<!-- END memberrow --> - -<tr> - <td class="cat" colspan="<!-- IF S_IN_SEARCH_POPUP -->9<!-- ELSE -->8<!-- ENDIF -->" align="center"><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input class="btnlite" type="submit" value="{L_SELECT_MARKED}" /><!-- ELSE --><span class="gensmall">{L_SELECT_SORT_METHOD}{L_COLON}</span> <select name="sk">{S_MODE_SELECT}</select> <span class="gensmall">{L_ORDER}</span> <select name="sd">{S_ORDER_SELECT}</select> <input type="submit" name="submit" value="{L_SUBMIT}" class="btnlite" /><!-- ENDIF --></td> -</tr> -</table> -{S_FORM_TOKEN} - -</form> - -<table width="100%" cellspacing="0" cellpadding="0"> -<tr> - <td class="pagination">{PAGE_NUMBER} [ {TOTAL_USERS} ]</td> - <td align="{S_CONTENT_FLOW_END}"><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><b class="nav"><a href="#" onclick="marklist('results', 'user', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('results', 'user', false); return false;">{L_UNMARK_ALL}</a></b><br /><!-- ENDIF --><span class="pagination"><!-- INCLUDE pagination.html --></span></td> -</tr> -</table> - - - -<!-- IF S_IN_SEARCH_POPUP --> - <!-- INCLUDE simple_footer.html --> -<!-- ELSE --> - <br clear="all" /> - - <!-- INCLUDE breadcrumbs.html --> - - <br clear="all" /> - - <div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - <!-- INCLUDE overall_footer.html --> -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/memberlist_email.html b/phpBB/styles/subsilver2/template/memberlist_email.html deleted file mode 100644 index 88289e53bf..0000000000 --- a/phpBB/styles/subsilver2/template/memberlist_email.html +++ /dev/null @@ -1,73 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pagecontent"> - - <form action="{S_POST_ACTION}" method="post" name="postform"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="2">{L_SEND_EMAIL_USER} {USERNAME}</th> - </tr> - <!-- IF ERROR_MESSAGE --> - <tr> - <td class="row3" colspan="2" align="center"><span class="error">{ERROR_MESSAGE}</span></td> - </tr> - <!-- ENDIF --> - <!-- IF S_SEND_USER --> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_RECIPIENT}</b></td> - <td class="row2" width="65%"><b class="genmed">{USERNAME}</b></td> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_SUBJECT}</b></td> - <td class="row2"><input class="post" type="text" name="subject" size="50" tabindex="2" value="{SUBJECT}" /></td> - </tr> - <!-- ELSE --> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_EMAIL_ADDRESS}</b></td> - <td class="row2"><input class="post" type="email" name="email" size="50" maxlength="100" value="{EMAIL}" /></td> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_REAL_NAME}</b></td> - <td class="row2"><input class="post" type="text" name="name" size="50" value="{NAME}" /></td> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_DEST_LANG}</b><br /><span class="gensmall">{L_DEST_LANG_EXPLAIN}</span></td> - <td class="row2"><select name="lang">{S_LANG_OPTIONS}</select></td> - </tr> - <!-- ENDIF --> - <tr> - <td class="row1" valign="top"><b class="genmed">{L_MESSAGE_BODY}</b><br /><span class="gensmall">{L_EMAIL_BODY_EXPLAIN}</span></td> - <td class="row2"><textarea class="post" name="message" rows="15" cols="76" tabindex="3">{MESSAGE}</textarea></td> - </tr> - <tr> - <td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span></td> - <td class="row2"> - <table cellspacing="0" cellpadding="1" border="0"> - <tr> - <td><input type="checkbox" class="radio" name="cc_email" value="1" checked="checked" /></td> - <td class="gen">{L_CC_EMAIL}</td> - </tr> - </table> - </td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" tabindex="6" name="submit" class="btnmain" value="{L_SEND_EMAIL}" /></td> - </tr> - </table> - - {S_FORM_TOKEN} - - </form> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div style="float: {S_CONTENT_FLOW_END};"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/memberlist_group.html b/phpBB/styles/subsilver2/template/memberlist_group.html deleted file mode 100644 index 4140c8cdbf..0000000000 --- a/phpBB/styles/subsilver2/template/memberlist_group.html +++ /dev/null @@ -1,17 +0,0 @@ - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="3">{L_GROUP_INFORMATION}</th> -</tr> -<tr> - <td class="row1" width="20%"><b class="genmed">{L_GROUP_NAME}{L_COLON}</b></td> - <td class="row2"><b class="gen"<!-- IF GROUP_COLOR --> style="color:#{GROUP_COLOR}"<!-- ENDIF -->>{GROUP_NAME}</b></td> -<!-- IF AVATAR_IMG or RANK_IMG or GROUP_RANK or U_PM --> - <td class="row1" width="33%" rowspan="2" align="center"><!-- IF AVATAR_IMG -->{AVATAR_IMG}<br /><!-- ENDIF --><!-- IF RANK_IMG -->{RANK_IMG}<!-- ENDIF --><!-- IF GROUP_RANK --><span class="gensmall">{GROUP_RANK}</span><br /><br /><!-- ENDIF --><!-- IF U_PM --><a href="{U_PM}" class="imageset">{PM_IMG}</a><!-- ENDIF --></td> -<!-- ENDIF --> -</tr> -<tr> - <td class="row1" width="20%"><b class="genmed">{L_GROUP_DESC}{L_COLON}</b></td> - <td class="row2"><span class="gen">{GROUP_DESC}</span><p class="forumdesc">{GROUP_TYPE}</p></td> -</tr> -</table> diff --git a/phpBB/styles/subsilver2/template/memberlist_im.html b/phpBB/styles/subsilver2/template/memberlist_im.html deleted file mode 100644 index da1ad661c3..0000000000 --- a/phpBB/styles/subsilver2/template/memberlist_im.html +++ /dev/null @@ -1,139 +0,0 @@ -<!-- INCLUDE simple_header.html --> - -<br clear="all" /> - -<!-- MSNM info from http://www.cdolive.net/ - doesn't seem to work with MSN Messenger --> - -<form method="post" action="{S_IM_ACTION}"> - <table class="tablebg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2">{L_SEND_IM}</th> - </tr> - <tr> - <td class="row3" colspan="2"><span class="gensmall">{L_SEND_IM_EXPLAIN}</span></td> - </tr> - <tr> - <td class="row1"><b class="genmed">{L_IM_RECIPIENT}{L_COLON} </b></td> - <td class="row2"><span class="gen"><b>{USERNAME}</b><!-- IF S_SEND_ICQ or S_SEND_AIM or S_SEND_MSNM or S_NO_SEND_JABBER --> [ {IM_CONTACT} ]<!-- ENDIF --></span> <!-- IF PRESENCE_IMG -->{PRESENCE_IMG}<!-- ENDIF --></td> - </tr> - - <!-- IF S_SEND_AIM --> - <tr> - <td class="row1" colspan="2" align="center"><br /><a class="gen" href="{U_AIM_CONTACT}">{L_IM_ADD_CONTACT}</a><br /><a class="gen" href="{U_AIM_MESSAGE}">{L_IM_SEND_MESSAGE}</a><br /><br /><a class="gensmall" href="http://www.aim.com">{L_IM_DOWNLOAD_APP}</a> | <a class="gensmall" href="http://www.aim.com/products/express">{L_IM_AIM_EXPRESS}</a> </td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"> </td> - </tr> - <!-- ENDIF --> - - <!-- IF S_SEND_MSNM --> - <tr> - <td class="row1" colspan="2" align="center"> - <object classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28" codetype="application/x-oleobject" id="objMessengerApp" width="0" height="0"></object> - <script type="text/javascript"> - // <![CDATA[ - var app = document.getElementById('objMessengerApp'); - - /** - * Check whether the browser supports this and whether MSNM is connected - */ - function msn_supported() - { - // Does the browser support the MSNM object? - if (app.MyStatus) - { - // Is MSNM connected? - if (app.MyStatus == 1) - { - alert('{LA_IM_MSNM_CONNECT}'); - return false; - } - } - else - { - alert('{LA_IM_MSNM_BROWSER}'); - return false; - } - return true; - } - - /** - * Add to your contact list - */ - function add_contact(address) - { - if (msn_supported()) - { - // Could return an error while MSNM is connecting, don't want that - try - { - app.AddContact(0, address); - } - catch (e) - { - return; - } - } - } - - /** - * Write IM to contact - */ - function im_contact(address) - { - if (msn_supported()) - { - // Could return an error while MSNM is connecting, don't want that - try - { - app.InstantMessage(address); - } - catch (e) - { - return; - } - } - } - // ]]> - </script> - - <a class="gen" href="#" onclick="add_contact('{A_IM_CONTACT}'); return false;">{L_IM_ADD_CONTACT}</a><br /><a class="gen" href="#" onclick="im_contact('{A_IM_CONTACT}'); return false;">{L_IM_SEND_MESSAGE}</a> - </td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"> </td> - </tr> - <!-- ENDIF --> - - <!-- IF S_SEND_JABBER --> - <tr> - <td class="row1"><b class="genmed">{L_IM_MESSAGE}{L_COLON} </b></td> - <td class="row2"><textarea class="post" name="message" rows="5" cols="45"></textarea></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" name="submit" type="submit" value="{L_IM_SEND}" /></td> - </tr> - <!-- ENDIF --> - - <!-- IF S_NO_SEND_JABBER --> - <tr> - <td class="row1" colspan="2"><span class="genmed">{L_IM_NO_JABBER}</span></td> - </tr> - <!-- ENDIF --> - - <!-- IF S_SENT_JABBER --> - <tr> - <td class="row1" colspan="2" align="center"><span class="gen">{L_IM_SENT_JABBER}</span></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"></td> - </tr> - <!-- ENDIF --> - - </table> -{S_FORM_TOKEN} -</form> - -<a class="nav" href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a> - -<!-- INCLUDE simple_footer.html --> diff --git a/phpBB/styles/subsilver2/template/memberlist_leaders.html b/phpBB/styles/subsilver2/template/memberlist_leaders.html deleted file mode 100644 index a4f38aafc4..0000000000 --- a/phpBB/styles/subsilver2/template/memberlist_leaders.html +++ /dev/null @@ -1,50 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<form method="post" action="{S_MODE_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th nowrap="nowrap" width="20%">{L_USERNAME}</th> - <!-- IF S_DISPLAY_MODERATOR_FORUMS --><th nowrap="nowrap" width="25%">{L_FORUMS}</th><!-- ENDIF --> - <th nowrap="nowrap" width="20%">{L_PRIMARY_GROUP}</th> - <th nowrap="nowrap" width="15%">{L_RANK}</th> - <th nowrap="nowrap" width="11%">{L_SEND_MESSAGE}</th> -</tr> -<!-- BEGIN group --> -<tr class="row3"> - <td colspan="5"><b class="gensmall"><!-- IF group.U_GROUP --><a href="{group.U_GROUP}">{group.GROUP_NAME}</a><!-- ELSE -->{group.GROUP_NAME}<!-- ENDIF --></b></td> -</tr> -<!-- BEGIN user --> - <!-- IF group.user.S_ROW_COUNT is even --><tr class="row2"><!-- ELSE --><tr class="row1"><!-- ENDIF --> - - <td class="gen" align="center"><strong>{group.user.USERNAME_FULL}</strong></td> - <!-- IF S_DISPLAY_MODERATOR_FORUMS --><td class="gensmall" align="center"><!-- IF group.user.FORUM_OPTIONS --><select style="width: 100%;">{group.user.FORUMS}</select><!-- ELSEIF group.user.FORUMS -->{group.user.FORUMS}<!-- ELSE -->-<!-- ENDIF --></td><!-- ENDIF --> - <td class="gensmall" align="center" nowrap="nowrap"> - <!-- IF group.user.U_GROUP --> - <a<!-- IF group.user.GROUP_COLOR --> style="font-weight: bold; color:#{group.user.GROUP_COLOR}"<!-- ENDIF --> href="{group.user.U_GROUP}">{group.user.GROUP_NAME}</a> - <!-- ELSE --> - {group.user.GROUP_NAME} - <!-- ENDIF --> - </td> - <td class="gen" align="center"><!-- IF group.user.RANK_IMG -->{group.user.RANK_IMG}<!-- ELSE -->{group.user.RANK_TITLE}<!-- ENDIF --></td> - <td class="gen" align="center"> <!-- IF group.user.U_PM --><a href="{group.user.U_PM}" class="imageset">{PM_IMG}</a><!-- ENDIF --> </td> -</tr> -<!-- BEGINELSE --> - <tr> - <td class="row1" colspan="5" align="center"><span class="gen">{L_NO_MEMBERS}</span></td> - </tr> -<!-- END user --> -<!-- END group --> -</table> - -</form> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div style="float: {S_CONTENT_FLOW_END};"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/memberlist_search.html b/phpBB/styles/subsilver2/template/memberlist_search.html deleted file mode 100644 index 484bbd85e8..0000000000 --- a/phpBB/styles/subsilver2/template/memberlist_search.html +++ /dev/null @@ -1,139 +0,0 @@ -<!-- You should retain this javascript in your own template! --> - -<!-- IF S_IN_SEARCH_POPUP --> - <script type="text/javascript"> - // <![CDATA[ - function insert_user(user) - { - opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value = ( opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value.length && opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.type == "textarea" ) ? opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value + "\n" + user : user; - } - - function insert_marked(users) - { - if (typeof(users.length) == "undefined") - { - if (users.checked) - { - insert_user(users.value); - } - } - else if (users.length > 0) - { - for (i = 0; i < users.length; i++) - { - if (users[i].checked) - { - insert_user(users[i].value); - } - } - } - - self.close(); - } - - function insert_single(user) - { - opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value = user; - self.close(); - } - - /** - * Mark/unmark checklist - * id = ID of parent container, name = name prefix, state = state [true/false] - */ - function marklist(id, name, state) - { - var parent = document.getElementById(id) || document[id]; - - if (!parent) - { - return; - } - - var rb = parent.getElementsByTagName('input'); - - for (var r = 0; r < rb.length; r++) - { - if (rb[r].name.substr(0, name.length) == name) - { - rb[r].checked = state; - } - } - } - // ]]> - </script> -<!-- ENDIF --> - -<form method="post" action="{S_MODE_ACTION}" name="search"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="4">{L_FIND_USERNAME}</th> -</tr> -<tr> - <td class="row3" colspan="4"><span class="gensmall">{L_FIND_USERNAME_EXPLAIN}</span></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_USERNAME}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="username" value="{USERNAME}" /></td> - <td class="row1"><b class="genmed">{L_ICQ}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="icq" value="{ICQ}" /></td> -</tr> -<tr> -<!-- IF S_EMAIL_SEARCH_ALLOWED --> - <td class="row1"><b class="genmed">{L_EMAIL}{L_COLON}</b></td> - <td class="row2"><input class="post" type="email" name="email" value="{EMAIL}" /></td> -<!-- ELSE --> - <td colspan="2" class="row1"> </td> -<!-- ENDIF --> - <td class="row1"><b class="genmed">{L_AIM}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="aim" value="{AIM}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_JOINED}{L_COLON}</b></td> - <td class="row2"><select name="joined_select">{S_JOINED_TIME_OPTIONS}</select> <input class="post" type="text" name="joined" value="{JOINED}" /></td> - <td class="row1"><b class="genmed">{L_YIM}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="yahoo" value="{YAHOO}" /></td> -</tr> -<tr> -<!-- IF S_VIEWONLINE --> - <td class="row1"><b class="genmed">{L_LAST_ACTIVE}{L_COLON}</b></td> - <td class="row2"><select name="active_select">{S_ACTIVE_TIME_OPTIONS}</select> <input class="post" type="text" name="active" value="{ACTIVE}" /></td> -<!-- ELSE --> - <td colspan="2" class="row1"> </td> -<!-- ENDIF --> - <td class="row1"><b class="genmed">{L_MSNM}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="msn" value="{MSNM}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_POSTS}{L_COLON}</b></td> - <td class="row2"><select name="count_select">{S_COUNT_OPTIONS}</select> <input class="post" type="number" min="0" name="count" value="{COUNT}" /></td> - <td class="row1"><b class="genmed">{L_JABBER}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="jabber" value="{JABBER}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_SORT_BY}{L_COLON}</b></td> - <td class="row2" nowrap="nowrap"><select name="sk">{S_SORT_OPTIONS}</select> <select name="sd">{S_ORDER_SELECT}</select> </td> -<!-- IF S_IP_SEARCH_ALLOWED --> - <td class="row1"><b class="genmed">{L_POST_IP}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="ip" value="{IP}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_GROUP}{L_COLON}</b></td> - <td class="row2" nowrap="nowrap"><select name="search_group_id">{S_GROUP_SELECT}</select></td> - <td class="row1"> </td> - <td class="row2"> </td> -</tr> -<!-- ELSE --> - <td class="row1"><b class="genmed">{L_GROUP}{L_COLON}</b></td> - <td class="row2" nowrap="nowrap"><select name="search_group_id">{S_GROUP_SELECT}</select></td> -</tr> -<!-- ENDIF --> -<tr> - <td class="cat" colspan="4" align="center"><input class="btnmain" type="submit" name="submit" value="{L_SEARCH}" /> <input class="btnlite" type="reset" value="{L_RESET}" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html deleted file mode 100644 index 40d61dddd9..0000000000 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ /dev/null @@ -1,197 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pagecontent"> - - <form method="post" action="{S_PROFILE_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="2" nowrap="nowrap">{L_VIEWING_PROFILE}</th> - </tr> - <tr> - <td class="cat" width="40%" align="center"><h4>{L_USER_PRESENCE}</h4></td> - <td class="cat" width="60%" align="center"><h4>{L_USER_FORUM}</h4></td> - </tr> - <tr> - <td class="row1" align="center"> - - <table cellspacing="1" cellpadding="2" border="0"> - <!-- IF S_USER_INACTIVE --> - <tr> - <td align="center"><b class="gen inactive">{L_USER_IS_INACTIVE}</b><br />{L_INACTIVE_REASON}{L_COLON} {USER_INACTIVE_REASON}<br /><br /></td> - </tr> - <!-- ENDIF --> - <tr> - <td align="center"><!-- IF USER_COLOR --><b class="gen" style="color: {USER_COLOR}"><!-- ELSE --><b class="gen"><!-- ENDIF -->{USERNAME}</b><!-- IF U_USER_BAN --><span class="genmed"> [ <a href="{U_USER_BAN}">{L_USER_BAN}</a> ]</span><!-- ENDIF --><!-- IF U_USER_ADMIN --><span class="genmed"> [ <a href="{U_USER_ADMIN}">{L_USER_ADMIN}</a> ]</span><!-- ENDIF --></td> - </tr> - <!-- IF RANK_TITLE --> - <tr> - <td class="postdetails" align="center">{RANK_TITLE}</td> - </tr> - <!-- ENDIF --> - <!-- IF RANK_IMG --> - <tr> - <td align="center">{RANK_IMG}</td> - </tr> - <!-- ENDIF --> - <!-- IF AVATAR_IMG --> - <tr> - <td align="center">{AVATAR_IMG}</td> - </tr> - <!-- ENDIF --> - <!-- IF ONLINE_IMG --> - <tr> - <td align="center">{ONLINE_IMG}</td> - </tr> - <!-- ENDIF --> - <!-- IF U_SWITCH_PERMISSIONS --> - <tr> - <td class="genmed" align="center">[ <a href="{U_SWITCH_PERMISSIONS}">{L_USE_PERMISSIONS}</a> ]</td> - </tr> - <!-- ENDIF --> - <!-- IF S_USER_LOGGED_IN and S_ZEBRA --> - <tr> - <td class="genmed" align="center">[ - <!-- IF U_REMOVE_FRIEND --> - <a href="{U_REMOVE_FRIEND}">{L_REMOVE_FRIEND}</a> - <!-- ELSEIF U_REMOVE_FOE --> - <a href="{U_REMOVE_FOE}">{L_REMOVE_FOE}</a> - <!-- ELSE --> - <!-- IF U_ADD_FRIEND --><a href="{U_ADD_FRIEND}">{L_ADD_FRIEND}</a><!-- ENDIF --><!-- IF U_ADD_FOE --><!-- IF U_ADD_FRIEND --> | <!-- ENDIF --><a href="{U_ADD_FOE}">{L_ADD_FOE}</a><!-- ENDIF --> - <!-- ENDIF --> - ]</td> - </tr> - <!-- ENDIF --> - </table> - </td> - <td class="row1"> - <table width="100%" cellspacing="1" cellpadding="2" border="0"> - <!-- EVENT memberlist_view_user_statistics_before --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_JOINED}{L_COLON} </td> - <td width="100%"><b class="gen">{JOINED}</b></td> - </tr> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_VISITED}{L_COLON} </td> - <td width="100%"><b class="gen">{VISITED}</b></td> - </tr> - <!-- IF S_WARNINGS --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_WARNINGS}{L_COLON} </td> - <td width="100%"><b class="gen">{WARNINGS}</b><!-- IF U_NOTES or U_WARN --><br /><span class="genmed"> [ <!-- IF U_NOTES --><a href="{U_NOTES}">{L_VIEW_NOTES}</a><!-- ENDIF --> <!-- IF U_WARN --><!-- IF U_NOTES --> | <!-- ENDIF --><a href="{U_WARN}">{L_WARN_USER}</a><!-- ENDIF --> ]</span><!-- ENDIF --></td> - </tr> - <!-- ENDIF --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_TOTAL_POSTS}{L_COLON} </td> - <td><b class="gen">{POSTS}</b><span class="genmed"><!-- IF POSTS_PCT --><br />[{POSTS_PCT} / {POSTS_DAY}]<!-- ENDIF --> - <!-- IF POSTS_IN_QUEUE and U_MCP_QUEUE --><br />[<a href="{U_MCP_QUEUE}">{L_POSTS_IN_QUEUE}</a>]<!-- ELSEIF POSTS_IN_QUEUE --><br />[{L_POSTS_IN_QUEUE}]<!-- ENDIF --> - <!-- IF S_DISPLAY_SEARCH --><br /><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a><!-- ENDIF --></span></td> - </tr> - <!-- IF S_SHOW_ACTIVITY --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_ACTIVE_IN_FORUM}{L_COLON} </td> - <td><!-- IF ACTIVE_FORUM != '' --><b><a class="gen" href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></b><br /><span class="genmed">[ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]</span><!-- ELSE --><span class="gen">-</span><!-- ENDIF --></td> - </tr> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_ACTIVE_IN_TOPIC}{L_COLON} </td> - <td><!-- IF ACTIVE_TOPIC != '' --><b><a class="gen" href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></b><br /><span class="genmed">[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]</span><!-- ELSE --><span class="gen">-</span><!-- ENDIF --></td> - </tr> - <!-- ENDIF --> - <!-- EVENT memberlist_view_user_statistics_after --> - </table> - </td> - </tr> - <tr> - <td class="cat" align="center"><h4>{L_CONTACT_USER}</h4></td> - <td class="cat" align="center"><h4>{L_ABOUT_USER}</h4></td> - </tr> - <tr> - <td class="row1"> - <table width="100%" cellspacing="1" cellpadding="2" border="0"> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_EMAIL_ADDRESS}{L_COLON} </td> - <td width="100%"><!-- IF U_EMAIL --><a href="{U_EMAIL}" class="imageset">{EMAIL_IMG}</a><!-- ENDIF --></td> - </tr> - <!-- IF U_PM --> - <tr> - <td class="gen" nowrap="nowrap" align="{S_CONTENT_FLOW_END}">{L_PM}{L_COLON} </td> - <td><a href="{U_PM}" class="imageset">{PM_IMG}</a></td> - </tr> - <!-- ENDIF --> - <tr> - <td class="gen" nowrap="nowrap" align="{S_CONTENT_FLOW_END}">{L_MSNM}{L_COLON} </td> - <td><!-- IF U_MSN --><a href="{U_MSN}" onclick="popup(this.href, 550, 320); return false" class="imageset">{MSN_IMG}</a><!-- ELSEIF USER_MSN -->{USER_MSN}<!-- ENDIF --></td> - </tr> - <tr> - <td class="gen" nowrap="nowrap" align="{S_CONTENT_FLOW_END}">{L_YIM}{L_COLON} </td> - <td><!-- IF U_YIM --><a href="{U_YIM}" onclick="popup(this.href, 780, 550); return false" class="imageset">{YIM_IMG}</a><!-- ELSEIF USER_YIM -->{USER_YIM}<!-- ENDIF --></td> - </tr> - <tr> - <td class="gen" nowrap="nowrap" align="{S_CONTENT_FLOW_END}">{L_AIM}{L_COLON} </td> - <td><!-- IF U_AIM --><a href="{U_AIM}" onclick="popup(this.href, 550, 320); return false" class="imageset">{AIM_IMG}</a><!-- ELSEIF USER_AIM -->{USER_AIM}<!-- ENDIF --></td> - </tr> - <tr> - <td class="gen" nowrap="nowrap" align="{S_CONTENT_FLOW_END}">{L_ICQ}{L_COLON} </td> - <td><!-- IF U_ICQ --><a href="{U_ICQ}" onclick="popup(this.href, 550, 320); return false" class="imageset">{ICQ_IMG}</a><!-- ELSEIF USER_ICQ -->{USER_ICQ}<!-- ENDIF --></td> - </tr> - <tr> - <td class="gen" nowrap="nowrap" align="{S_CONTENT_FLOW_END}">{L_JABBER}{L_COLON} </td> - <td><!-- IF U_JABBER --><a href="{U_JABBER}" onclick="popup(this.href, 550, 320); return false" class="imageset">{JABBER_IMG}</a><!-- ELSEIF USER_JABBER -->{USER_JABBER_IMG}<!-- ENDIF --></td> - </tr> - </table> - </td> - <td class="row1"> - <table cellspacing="1" cellpadding="2" border="0"> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_USERGROUPS}{L_COLON} </td> - <td><select name="g">{S_GROUP_OPTIONS}</select> <input class="btnlite" type="submit" name="submit" value="{L_GO}" /></td> - </tr> - <!-- IF AGE !== '' --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_AGE}{L_COLON} </td> - <td><b class="genmed">{AGE}</b></td> - </tr> - <!-- ENDIF --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_WEBSITE}{L_COLON} </td> - <td><!-- IF U_WWW --><b><a class="genmed" href="{U_WWW}">{U_WWW}</a></b><!-- ENDIF --></td> - </tr> - <!-- IF S_PROFILE_FIELD1 --> - <!-- Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{PROFILE_FIELD1_NAME}{L_COLON} </td> - <td><b class="genmed">{PROFILE_FIELD1_VALUE}</b></td> - </tr> - <!-- ENDIF --> - <!-- BEGIN custom_fields --> - <tr> - <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{custom_fields.PROFILE_FIELD_NAME}{L_COLON} </td> - <td><b class="genmed">{custom_fields.PROFILE_FIELD_VALUE}</b></td> - </tr> - <!-- END custom_fields --> - </table> - </td> - </tr> - <!-- IF SIGNATURE --> - <tr> - <td class="cat" colspan="2" align="center"><h4>{L_SIGNATURE}</h4></td> - </tr> - <tr> - <td class="row1" colspan="2"><div class="postbody" style="padding: 10px;">{SIGNATURE}</div></td> - </tr> - <!-- ENDIF --> - </table> - - </form> - -</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div style="float: {S_CONTENT_FLOW_END};"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/message_body.html b/phpBB/styles/subsilver2/template/message_body.html deleted file mode 100644 index b9b502a57f..0000000000 --- a/phpBB/styles/subsilver2/template/message_body.html +++ /dev/null @@ -1,16 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th>{MESSAGE_TITLE}</th> -</tr> -<tr> - <td class="row1" align="center"><br /><p class="gen">{MESSAGE_TEXT}</p><br /></td> -</tr> -</table> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html deleted file mode 100644 index d2b6f6a9d7..0000000000 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ /dev/null @@ -1,25 +0,0 @@ - <!-- EVENT overall_footer_content_after --> - - <!-- IF not S_IS_BOT -->{RUN_CRON_TASK}<!-- ENDIF --> -</div> - -<div id="wrapfooter"> - <!-- IF U_ACP --><span class="gensmall">[ <a href="{U_ACP}">{L_ACP}</a> ]</span><br /><br /><!-- ENDIF --> - <span class="copyright"> - <!-- EVENT overall_footer_copyright_prepend --> - {CREDIT_LINE} - <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> - <!-- EVENT overall_footer_copyright_append --> - <!-- IF DEBUG_OUTPUT --><br /><bdo dir="ltr">[ {DEBUG_OUTPUT} ]</bdo><!-- ENDIF --></span> -</div> - -<script type="text/javascript" src="{T_JQUERY_LINK}"></script> -<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> -<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script> - -<!-- EVENT overall_footer_after --> - -{$SCRIPTS} - -</body> -</html> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html deleted file mode 100644 index 5da73bd70d..0000000000 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ /dev/null @@ -1,243 +0,0 @@ -<!DOCTYPE html> -<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> -<head> -<meta charset="utf-8"> -<meta name="keywords" content="" /> -<meta name="description" content="" /> -{META} -<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title> - -<!-- IF S_ENABLE_FEEDS --> - <!-- IF S_ENABLE_FEEDS_OVERALL --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {SITENAME}" href="{U_FEED}" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_NEWS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_NEWS}" href="{U_FEED}?mode=news" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_FORUMS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_FORUMS}" href="{U_FEED}?mode=forums" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_TOPICS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_NEW}" href="{U_FEED}?mode=topics" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_TOPICS_ACTIVE --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_ACTIVE}" href="{U_FEED}?mode=topics_active" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} - {FORUM_NAME}" href="{U_FEED}?f={S_FORUM_ID}" /><!-- ENDIF --> - <!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} - {TOPIC_TITLE}" href="{U_FEED}?f={S_FORUM_ID}&t={S_TOPIC_ID}" /><!-- ENDIF --> -<!-- ENDIF --> - -<link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css" /> -<link rel="stylesheet" href="{T_STYLESHEET_LANG_LINK}" type="text/css" /> - -<script type="text/javascript"> -// <![CDATA[ - -function popup(url, width, height, name) -{ - if (!name) - { - name = '_popup'; - } - - window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes,width=' + width); - return false; -} - -function jumpto() -{ - var page = prompt('{LA_JUMP_PAGE}{L_COLON}', '{CURRENT_PAGE}'); - var per_page = '{PER_PAGE}'; - var base_url = '{BASE_URL|e('js')}'; - - if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) - { - if (base_url.indexOf('?') == -1) - { - document.location.href = base_url + '?start=' + ((page - 1) * per_page); - } - else - { - document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); - } - } -} - -/** -* Find a member -*/ -function find_username(url) -{ - popup(url, 760, 570, '_usersearch'); - return false; -} - -/** -* Mark/unmark checklist -* id = ID of parent container, name = name prefix, state = state [true/false] -*/ -function marklist(id, name, state) -{ - var parent = document.getElementById(id) || document[id]; - - if (!parent) - { - return; - } - - var rb = parent.getElementsByTagName('input'); - - for (var r = 0; r < rb.length; r++) - { - if (rb[r].name.substr(0, name.length) == name) - { - rb[r].checked = state; - } - } -} - -<!-- IF ._file --> - - /** - * Play quicktime file by determining it's width/height - * from the displayed rectangle area - * - * Only defined if there is a file block present. - */ - function play_qt_file(obj) - { - var rectangle = obj.GetRectangle(); - - if (rectangle) - { - rectangle = rectangle.split(',') - var x1 = parseInt(rectangle[0]); - var x2 = parseInt(rectangle[2]); - var y1 = parseInt(rectangle[1]); - var y2 = parseInt(rectangle[3]); - - var width = (x1 < 0) ? (x1 * -1) + x2 : x2 - x1; - var height = (y1 < 0) ? (y1 * -1) + y2 : y2 - y1; - } - else - { - var width = 200; - var height = 0; - } - - obj.width = width; - obj.height = height + 16; - - obj.SetControllerVisible(true); - - obj.Play(); - } -<!-- ENDIF --> - -// ]]> -</script> - -<!-- EVENT overall_header_head_append --> - -{$STYLESHEETS} - -</head> -<body class="{S_CONTENT_DIRECTION}"> - -<a name="top"></a> - -<div id="wrapheader"> - - <div id="logodesc"> - <table width="100%" cellspacing="0"> - <tr> - <td><a href="<!-- IF U_SITE_HOME -->{U_SITE_HOME}<!-- ELSE -->{U_INDEX}<!-- ENDIF -->" class="imageset">{SITE_LOGO_IMG}</a></td> - <td width="100%" align="center"><h1>{SITENAME}</h1><span class="gen">{SITE_DESCRIPTION}</span></td> - </tr> - </table> - </div> - - <div id="menubar"> - <table width="100%" cellspacing="0"> - <tr> - <td class="genmed"> - <!-- IF S_NOTIFICATIONS_DISPLAY and not S_IS_BOT and S_USER_LOGGED_IN --> - <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button"><img src="{T_THEME_PATH}/images/icon_mini_notification.gif" width="12" height="13" alt="*" /> {L_NOTIFICATIONS} [<strong>{NOTIFICATIONS_COUNT}</strong>]</a> - <div id="notification_list" class="notification_list"> - <div class="row1 header"> - {L_NOTIFICATIONS} - <span class="header_settings"><a href="{U_NOTIFICATION_SETTINGS}">{L_SETTINGS}</a></span> - </div> - - <div class="notification_scroll"> - <table class="tablebg" width="310" cellspacing="1"> - <!-- BEGIN notifications --> - <tr class="row<!-- IF notifications.UNREAD -->2<!-- ELSE -->1<!-- ENDIF -->"> - <td width="50"> - <!-- IF notifications.AVATAR -->{notifications.AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --> - </td> - <td valign="top"> - <div class="notification_title"> - <!-- IF notifications.URL --><a href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"><!-- ENDIF --> - {notifications.FORMATTED_TITLE} - <!-- IF notifications.URL --></a><!-- ENDIF --> - <br />» {notifications.TIME} - <!-- IF not notifications.URL and notifications.UNREAD --> - <br /><a href="{notifications.U_MARK_READ}">{L_MARK_READ}</a> - <!-- ENDIF --> - </div> - </td> - </tr> - <!-- END notifications --> - </table> - </div> - - <div class="row1 footer"> - <a href="{U_VIEW_ALL_NOTIFICATIONS}"><span>{L_SEE_ALL}</span></a> - </div> - </div> - <!-- ENDIF --> - <!-- IF not S_IS_BOT --> - <!-- IF S_USER_LOGGED_IN --> - <!-- IF S_DISPLAY_PM --> <a href="{U_PRIVATEMSGS}"><img src="{T_THEME_PATH}/images/icon_mini_message.gif" width="12" height="13" alt="*" /> {L_PRIVATE_MESSAGES} [<strong>{PRIVATE_MESSAGE_COUNT}</strong>]</a><!-- ENDIF --> - <!-- ELSEIF S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --> <a href="{U_REGISTER}"><img src="{T_THEME_PATH}/images/icon_mini_register.gif" width="12" height="13" alt="*" /> {L_REGISTER}</a> - <!-- ENDIF --> - <!-- ENDIF --> - <!-- IF not S_IS_BOT --> <a href="{U_LOGIN_LOGOUT}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_LOGIN_LOGOUT}</a> <!-- ENDIF --> - <!-- IF U_RESTORE_PERMISSIONS --> <a href="{U_RESTORE_PERMISSIONS}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_RESTORE_PERMISSIONS}</a><!-- ENDIF --> - <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --> <span class="error">{L_BOARD_DISABLED}</span><!-- ENDIF --> - </td> - <td class="genmed" align="{S_CONTENT_FLOW_END}"> - <!-- EVENT overall_header_navigation_prepend --> - <a href="{U_FAQ}"><img src="{T_THEME_PATH}/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> {L_FAQ}</a> - <!-- IF S_DISPLAY_SEARCH --> <a href="{U_SEARCH}"><img src="{T_THEME_PATH}/images/icon_mini_search.gif" width="12" height="13" alt="*" /> {L_SEARCH}</a><!-- ENDIF --> - <!-- IF not S_IS_BOT --> - <!-- IF S_DISPLAY_MEMBERLIST --> <a href="{U_MEMBERLIST}"><img src="{T_THEME_PATH}/images/icon_mini_members.gif" width="12" height="13" alt="*" /> {L_MEMBERLIST}</a><!-- ENDIF --> - <!-- IF S_USER_LOGGED_IN --> <a href="{U_PROFILE}"><img src="{T_THEME_PATH}/images/icon_mini_profile.gif" width="12" height="13" alt="*" /> {L_PROFILE}</a><!-- ENDIF --> - <!-- ENDIF --> - <!-- EVENT overall_header_navigation_append --> - </td> - </tr> - </table> - </div> - - <div id="datebar"> - <table width="100%" cellspacing="0"> - <tr> - <td class="gensmall"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ENDIF --></td> - <td class="gensmall" align="{S_CONTENT_FLOW_END}">{CURRENT_TIME}<br /></td> - </tr> - </table> - </div> - -</div> - -<div id="wrapcentre"> - - <!-- IF S_DISPLAY_SEARCH --> - <p class="searchbar"> - <span style="float: {S_CONTENT_FLOW_BEGIN};"><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a> | <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></span> - <!-- IF S_USER_LOGGED_IN or S_LOAD_UNREADS --> - <span style="float: {S_CONTENT_FLOW_END};"><!-- IF S_LOAD_UNREADS --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- IF S_USER_LOGGED_IN --> | <!-- ENDIF --><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a><!-- ENDIF --></span> - <!-- ENDIF --> - </p> - <!-- ENDIF --> - - <br style="clear: both;" /> - - <!-- DEFINE $S_MICRODATA = 1 --> - <!-- INCLUDE breadcrumbs.html --> - <!-- DEFINE $S_MICRODATA = 0 --> - - <br /> - <!-- EVENT overall_header_content_before --> diff --git a/phpBB/styles/subsilver2/template/pagination.html b/phpBB/styles/subsilver2/template/pagination.html deleted file mode 100644 index a2e023ac22..0000000000 --- a/phpBB/styles/subsilver2/template/pagination.html +++ /dev/null @@ -1,11 +0,0 @@ -<!-- IF .pagination --> - <b><a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{L_GOTO_PAGE}</a> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><a href="{pagination.PAGE_URL}">{L_PREVIOUS}</a> - <!-- ELSEIF pagination.S_IS_CURRENT --><strong>{pagination.PAGE_NUMBER}</strong> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> {L_ELLIPSIS} - <!-- ELSEIF pagination.S_IS_NEXT --><a href="{pagination.PAGE_URL}">{L_NEXT}</a> - <!-- ELSE --><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a> - <!-- ENDIF --> - <!-- END pagination --> -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/posting_attach_body.html b/phpBB/styles/subsilver2/template/posting_attach_body.html deleted file mode 100644 index 8c70e4c831..0000000000 --- a/phpBB/styles/subsilver2/template/posting_attach_body.html +++ /dev/null @@ -1,83 +0,0 @@ -<tr> - <th colspan="2"> - <script type="text/javascript"> - // <![CDATA[ - /** - * Show upload progress bar - */ - function popup_progress_bar() - { - close_waitscreen = 0; - // no scrollbars - popup('{UA_PROGRESS_BAR}', 400, 200, '_upload'); - } - // ]]> - </script> - - <!-- IF S_CLOSE_PROGRESS_WINDOW --> - <script type="text/javascript"> - // <![CDATA[ - close_waitscreen = 1; - // ]]> - </script> - <!-- ENDIF --> - - {L_ADD_ATTACHMENT} - </th> -</tr> -<tr> - <td class="row3" colspan="2"><span class="gensmall">{L_ADD_ATTACHMENT_EXPLAIN}</span></td> -</tr> - -<tr> - <td class="row1"><b class="genmed">{L_FILENAME}</b></td> - <td class="row2"><input type="file" name="fileupload" size="40" maxlength="{FILESIZE}" value="" class="btnfile" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_FILE_COMMENT}</b></td> - <td class="row2"> - <table border="0" cellspacing="0" cellpadding="2"> - <tr> - <td><textarea class="post" name="filecomment" rows="3" cols="35">{FILE_COMMENT}</textarea> </td> - <td valign="top"> - <table border="0" cellspacing="4" cellpadding="0"> - <tr> - <td><input class="btnlite" type="submit" style="width:150px" name="add_file" value="{L_ADD_FILE}" onclick="popup_progress_bar();" /></td> - </tr> - </table> - </td> - </tr> - </table> - </td> -</tr> - -<!-- IF S_HAS_ATTACHMENTS --> - <tr> - <th colspan="2">{L_POSTED_ATTACHMENTS}</th> - </tr> - - <!-- BEGIN attach_row --> - <tr> - <td class="row1"><b class="genmed">{L_FILENAME}</b></td> - <td class="row2"><a class="genmed" href="{attach_row.U_VIEW_ATTACHMENT}" target="_blank">{attach_row.FILENAME}</a></td> - </tr> - <tr> - <td class="row1"><b class="genmed">{L_FILE_COMMENT}</b></td> - <td class="row2">{attach_row.S_HIDDEN} - <table border="0" cellspacing="0" cellpadding="2"> - <tr> - <td><textarea class="post" name="comment_list[{attach_row.ASSOC_INDEX}]" rows="3" cols="35" wrap="virtual">{attach_row.FILE_COMMENT}</textarea> </td> - <td valign="top"> - <table border="0" cellspacing="4" cellpadding="0"> - <tr> - <td><input class="btnlite" type="submit" style="width:150px" name="delete_file[{attach_row.ASSOC_INDEX}]" value="{L_DELETE_FILE}" /></td> - </tr> - </table> - </td> - </tr> - </table> - </td> - </tr> - <!-- END attach_row --> - -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html deleted file mode 100644 index b501c4146a..0000000000 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ /dev/null @@ -1,426 +0,0 @@ -<!-- IF S_PRIVMSGS --> - <!-- INCLUDE ucp_header.html --> -<!-- ELSE --> - <!-- INCLUDE overall_header.html --> -<!-- ENDIF --> - -<!-- IF S_FORUM_RULES --> - <div class="forumrules"> - <!-- IF U_FORUM_RULES --> - <h3>{L_FORUM_RULES}</h3><br /> - <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a> - <!-- ELSE --> - <h3>{L_FORUM_RULES}</h3><br /> - {FORUM_RULES} - <!-- ENDIF --> - </div> - - <br clear="all" /> -<!-- ENDIF --> - -<!-- IF not S_PRIVMSGS --> - <div id="pageheader"> - <h2><!-- IF TOPIC_TITLE --><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><!-- ELSE --><a class="titles" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- ENDIF --></h2> - - <!-- IF MODERATORS --> - <p class="moderators">{L_MODERATORS}{L_COLON} {MODERATORS}</p> - <!-- ENDIF --> - <!-- IF U_MCP or U_ACP --> - <p class="linkmcp">[ <!-- IF U_ACP --><a href="{U_ACP}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}">{L_MCP}</a><!-- ENDIF --> ]</p> - <!-- ENDIF --> - </div> - - <br clear="all" /><br /> -<!-- ENDIF --> - -<!-- IF not S_SHOW_PM_BOX --> - <form action="{S_POST_ACTION}" method="post" name="postform"{S_FORM_ENCTYPE}> -<!-- ENDIF --> - -<!-- IF S_DRAFT_LOADED --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th align="center">{L_INFORMATION}</th> - </tr> - <tr> - <td class="row1" align="center"><span class="gen"><!-- IF S_PRIVMSGS -->{L_DRAFT_LOADED_PM}<!-- ELSE -->{L_DRAFT_LOADED}<!-- ENDIF --></span></td> - </tr> - </table> - - <br clear="all" /> -<!-- ENDIF --> - -<!-- IF S_SHOW_DRAFTS --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="3" align="center">{L_LOAD_DRAFT}</th> - </tr> - <tr> - <td class="row1" colspan="3" align="center"><span class="gen">{L_LOAD_DRAFT_EXPLAIN}</span></td> - </tr> - <tr> - <th>{L_SAVE_DATE}</th> - <th>{L_DRAFT_TITLE}</th> - <th>{L_OPTIONS}</th> - </tr> - <!-- BEGIN draftrow --> - - <!-- IF draftrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td class="postdetails" style="padding: 4px;">{draftrow.DATE}</td> - <td style="padding: 4px;"><b class="gen">{draftrow.DRAFT_SUBJECT}</b> - <!-- IF draftrow.S_LINK_TOPIC --><br /><span class="gensmall">{L_TOPIC}{L_COLON} <a href="{draftrow.U_VIEW}">{draftrow.TITLE}</a></span> - <!-- ELSEIF draftrow.S_LINK_FORUM --><br /><span class="gensmall">{L_FORUM}{L_COLON} <a href="{draftrow.U_VIEW}">{draftrow.TITLE}</a></span> - <!-- ELSEIF draftrow.S_LINK_PM --><br /><span class="gensmall">{L_PRIVATE_MESSAGE}</span> - <!-- ELSE --><br /><span class="gensmall">{L_NO_TOPIC_FORUM}</span><!-- ENDIF --> - </td> - <td style="padding: 4px;" align="center"><span class="gen"><a href="{draftrow.U_INSERT}">{L_LOAD_DRAFT}</a></span></td> - </tr> - <!-- END draftrow --> - </table> - - <br clear="all" /> -<!-- ENDIF --> - - -<!-- IF S_POST_REVIEW --><!-- INCLUDE posting_review.html --><!-- ENDIF --> -<!-- IF S_DISPLAY_PREVIEW --><!-- INCLUDE posting_preview.html --><!-- ENDIF --> - - -<!-- IF not S_PRIVMSGS and S_UNGLOBALISE --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_MOVE}</th> - </tr> - <tr> - <td class="spacer" colspan="2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> - <tr> - <td class="row2" align="center"><span class="gen">{L_UNGLOBALISE_EXPLAIN}<br /><br />{L_SELECT_DESTINATION_FORUM} </span><select name="to_forum_id">{S_FORUM_SELECT}</select><br /><br /><input class="btnmain" type="submit" name="post" value="{L_CONFIRM}" /> <input class="btnlite" type="submit" name="cancel_unglobalise" value="{L_CANCEL}" /></td> - </tr> - </table> - - <br clear="all" /> -<!-- ENDIF --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2"><b>{L_POST_A}</b></th> -</tr> - -<!-- IF ERROR --> - <tr> - <td class="row2" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> - -<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS --> - <tr> - <td class="row1"><b class="genmed">{L_ICON}{L_COLON}</b></td> - <td class="row2"> - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td><input type="radio" class="radio" name="icon" value="0"{S_NO_ICON_CHECKED} tabindex="1" /><span class="genmed"><!-- IF S_SHOW_TOPIC_ICONS -->{L_NO_TOPIC_ICON}<!-- ELSE -->{L_NO_PM_ICON}<!-- ENDIF --></span> <!-- BEGIN topic_icon --><span style="white-space: nowrap;"><input type="radio" class="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} tabindex="1" /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /></span> <!-- END topic_icon --></td> - </tr> - </table> - </td> - </tr> -<!-- ENDIF --> - -<!-- IF not S_PRIVMSGS and S_DISPLAY_USERNAME --> - <tr> - <td class="row1"><b class="genmed">{L_USERNAME}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" tabindex="1" name="username" size="25" value="{USERNAME}" /></td> - </tr> -<!-- ENDIF --> - -<!-- IF S_PRIVMSGS --> - <tr> - <td class="row1"><b class="genmed">{L_TO}{L_COLON}</b></td> - <td class="row2"> - {S_HIDDEN_ADDRESS_FIELD} - <!-- BEGIN to_recipient --> - <span style="display: block; float: {S_CONTENT_FLOW_BEGIN};" class="nowrap genmed"><strong> - <!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><span class="sep">{to_recipient.NAME}</span></a><!-- ELSE -->{to_recipient.NAME_FULL}<!-- ENDIF --></strong> <!-- IF not S_EDIT_POST --><input class="post" type="submit" name="remove_{to_recipient.TYPE}[{to_recipient.UG_ID}]" value="{L_REMOVE}" /> <!-- ENDIF --> - </span> - <!-- BEGINELSE --> - <span class="genmed">{L_NO_TO_RECIPIENT}</span> - <!-- END to_recipient --> - </td> - </tr> - <!-- IF S_ALLOW_MASS_PM --> - <tr> - <td class="row1"><b class="genmed">{L_BCC}{L_COLON}</b></td> - <td class="row2"> - <!-- BEGIN bcc_recipient --> - <span class="genmed nowrap"><strong> - <!-- IF bcc_recipient.IS_GROUP --><a href="{bcc_recipient.U_VIEW}"><span class="sep">{bcc_recipient.NAME}</span></a><!-- ELSE -->{bcc_recipient.NAME_FULL}<!-- ENDIF --></strong> <!-- IF not S_EDIT_POST --><input class="post" type="submit" name="remove_{bcc_recipient.TYPE}[{bcc_recipient.UG_ID}]" value="{L_REMOVE}" /> <!-- ENDIF --> - </span> - <!-- BEGINELSE --> - <span class="genmed">{L_NO_BCC_RECIPIENT}</span> - <!-- END bcc_recipient --> - </td> - </tr> - <!-- ENDIF --> -<!-- ENDIF --> -<!-- EVENT posting_editor_subject_before --> -<tr> - <td class="row1" width="22%"><b class="genmed">{L_SUBJECT}{L_COLON}</b></td> - <td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->120<!-- ELSE -->124<!-- ENDIF -->" tabindex="2" value="{SUBJECT}" /></td> -</tr> -<!-- EVENT posting_editor_subject_after --> -<tr> - <td class="row1" valign="top"><b class="genmed">{L_MESSAGE_BODY}{L_COLON}</b><br /><span class="gensmall">{L_MESSAGE_BODY_EXPLAIN} </span><br /><br /> - <!-- IF S_SMILIES_ALLOWED --> - <table width="100%" cellspacing="5" cellpadding="0" border="0" align="center"> - <tr> - <td class="gensmall" align="center"><b>{L_SMILIES}</b></td> - </tr> - <tr> - <td align="center"> - <!-- BEGIN smiley --> - <a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;" style="line-height: 20px;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" hspace="2" vspace="2" /></a> - <!-- END smiley --> - </td> - </tr> - - <!-- IF S_SHOW_SMILEY_LINK --> - <tr> - <td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a></td> - </tr> - <!-- ENDIF --> - - </table> - <!-- ENDIF --> - </td> - <td class="row2" valign="top"> - <script type="text/javascript"> - // <![CDATA[ - var form_name = 'postform'; - var text_name = 'message'; - // ]]> - </script> - - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <!-- INCLUDE posting_buttons.html --> - <!-- EVENT posting_editor_message_before --> - <tr> - <td valign="top" style="width: 100%;"><textarea name="message" rows="15" cols="76" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();" style="width: 700px; height: 270px; min-width: 98%; max-width: 98%;">{MESSAGE}</textarea></td> - <!-- IF S_BBCODE_ALLOWED --> - <td width="80" align="center" valign="top" id="color_palette_placeholder" data-orientation="v" data-width="11" data-height="10" data-bbcode="true"> - </td> - <!-- ENDIF --> - </tr> - <!-- EVENT posting_editor_message_after --> - </table> - </td> -</tr> - -<!-- IF S_INLINE_ATTACHMENT_OPTIONS --> - <tr> - <td class="row1"><b class="genmed">{L_ATTACHMENTS}{L_COLON}</b></td> - <td class="row2"><select name="attachments">{S_INLINE_ATTACHMENT_OPTIONS}</select> <input type="button" class="btnbbcode" accesskey="a" value="{L_PLACE_INLINE}" name="attachinline" onclick="attach_form = document.forms[form_name].elements['attachments']; attach_inline(attach_form.value, attach_form.options[attach_form.selectedIndex].text);" onmouseover="helpline('a')" onmouseout="helpline('tip')" /> - </td> - </tr> -<!-- ENDIF --> - -<tr> - <td class="row1" valign="top"><b class="genmed">{L_OPTIONS}{L_COLON}</b><br /> - <table cellspacing="2" cellpadding="0" border="0"> - <tr> - <td class="gensmall">{BBCODE_STATUS}</td> - </tr> - <!-- IF S_BBCODE_ALLOWED --> - <tr> - <td class="gensmall">{IMG_STATUS}</td> - </tr> - <tr> - <td class="gensmall">{FLASH_STATUS}</td> - </tr> - <tr> - <td class="gensmall">{URL_STATUS}</td> - </tr> - <!-- ENDIF --> - <tr> - <td class="gensmall">{SMILIES_STATUS}</td> - </tr> - </table> - </td> - <td class="row2"> - <table cellpadding="1"> - <!-- EVENT posting_editor_options_prepend --> - <!-- IF S_BBCODE_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="disable_bbcode"{S_BBCODE_CHECKED} /></td> - <td class="gen">{L_DISABLE_BBCODE}</td> - </tr> - <!-- ENDIF --> - - <!-- IF S_SMILIES_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="disable_smilies"{S_SMILIES_CHECKED} /></td> - <td class="gen">{L_DISABLE_SMILIES}</td> - </tr> - <!-- ENDIF --> - - <!-- IF S_LINKS_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="disable_magic_url"{S_MAGIC_URL_CHECKED} /></td> - <td class="gen">{L_DISABLE_MAGIC_URL}</td> - </tr> - <!-- ENDIF --> - - <!-- IF S_SIG_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="attach_sig"{S_SIGNATURE_CHECKED} /></td> - <td class="gen">{L_ATTACH_SIG}</td> - </tr> - <!-- ENDIF --> - - <!-- IF S_NOTIFY_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="notify"{S_NOTIFY_CHECKED} /></td> - <td class="gen">{L_NOTIFY_REPLY}</td> - </tr> - <!-- ENDIF --> - - <!-- IF not S_PRIVMSGS --> - <!-- IF S_LOCK_TOPIC_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="lock_topic"{S_LOCK_TOPIC_CHECKED} /></td> - <td class="gen">{L_LOCK_TOPIC}</td> - </tr> - <!-- ENDIF --> - - <!-- IF S_LOCK_POST_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="lock_post"{S_LOCK_POST_CHECKED} /></td> - <td class="gen">{L_LOCK_POST} [{L_LOCK_POST_EXPLAIN}]</td> - </tr> - <!-- ENDIF --> - - <!-- IF S_TYPE_TOGGLE --> - <tr> - <td></td> - <td class="gen"><!-- IF S_EDIT_POST -->{L_CHANGE_TOPIC_TO}<!-- ELSE -->{L_POST_TOPIC_AS}<!-- ENDIF -->{L_COLON} <!-- BEGIN topic_type --><input type="radio" class="radio" name="topic_type" value="{topic_type.VALUE}"{topic_type.S_CHECKED} />{topic_type.L_TOPIC_TYPE} <!-- END topic_type --></td> - </tr> - <!-- ENDIF --> - <!-- ENDIF --> - </table> - </td> -</tr> - -<!-- IF S_SOFTDELETE_ALLOWED or S_DELETE_ALLOWED --> - <tr> - <td class="row1" valign="top"><b class="genmed">{L_DELETE_POST}{L_COLON}</b></td> - <td class="row2"> - <table cellpadding="1"> - <tr> - <td><input type="checkbox" class="radio" name="delete" /></td> - <td class="gen">{L_DELETE_POST_WARN}</td> - </tr> - <!-- IF S_SOFTDELETE_ALLOWED and S_DELETE_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="delete_permanent" /></td> - <td class="gen">{L_DELETE_POST_PERMANENTLY}</td> - </tr> - <!-- ENDIF --> - </table> - </td> - </tr> -<!-- ENDIF --> - -<!-- IF S_TOPIC_TYPE_ANNOUNCE or S_TOPIC_TYPE_STICKY --> - <tr> - <td class="row1"><b class="genmed">{L_STICK_TOPIC_FOR}{L_COLON}</b><br /><span class="gensmall">{L_STICKY_ANNOUNCE_TIME_LIMIT}</span></td> - <td class="row2"><input class="post" type="number" min="0" max="999" name="topic_time_limit" size="3" maxlength="3" value="{TOPIC_TIME_LIMIT}" /> <b class="gen">{L_DAYS}</b> <span class="gensmall">{L_STICK_TOPIC_FOR_EXPLAIN}</span></td> - </tr> -<!-- ENDIF --> - -<!-- IF S_EDIT_REASON --> - <tr> - <td class="row1" valign="top"><b class="genmed">{L_EDIT_REASON}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="edit_reason" size="50" value="{EDIT_REASON}" /></td> - </tr> -<!-- ENDIF --> - - <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE --> - <!-- DEFINE $CAPTCHA_TAB_INDEX = 4 --> - <!-- INCLUDE {CAPTCHA_TEMPLATE} --> - <!-- ENDIF --> - - -<!-- IF S_SHOW_ATTACH_BOX or S_SHOW_POLL_BOX --> - <tr> - <td class="cat" colspan="2" align="center"> - <input class="btnlite" type="submit" tabindex="5" name="preview" value="{L_PREVIEW}" /> - <input class="btnmain" type="submit" accesskey="s" tabindex="6" name="post" value="{L_SUBMIT}" /> - <!-- IF S_SAVE_ALLOWED --> <input class="btnlite" type="submit" accesskey="k" tabindex="7" name="save" value="{L_SAVE_DRAFT}" /><!-- ENDIF --> - <!-- IF S_HAS_DRAFTS --> <input class="btnlite" type="submit" accesskey="d" tabindex="8" name="load" value="{L_LOAD_DRAFT}" /><!-- ENDIF --> - <input class="btnlite" type="submit" accesskey="c" tabindex="9" name="cancel" value="{L_CANCEL}" /> - </td> - </tr> - - <!-- IF S_SHOW_ATTACH_BOX --><!-- INCLUDE posting_attach_body.html --><!-- ENDIF --> - - <!-- IF S_SHOW_POLL_BOX --> - <!-- INCLUDE posting_poll_body.html --> - <!-- ELSEIF S_POLL_DELETE --> - <tr> - <td class="row1"><span class="genmed"><b>{L_POLL_DELETE}{L_COLON}</b></span></td> - <td class="row2"><input type="checkbox" class="radio" name="poll_delete" /></td> - </tr> - <!-- ENDIF --> -<!-- ENDIF --> - -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS} - <input class="btnlite" type="submit" tabindex="10" name="preview" value="{L_PREVIEW}" /> - <input class="btnmain" type="submit" accesskey="s" tabindex="11" name="post" value="{L_SUBMIT}" /> - <!-- IF not S_SHOW_ATTACH_BOX and not S_SHOW_POLL_BOX --> - <!-- IF S_SAVE_ALLOWED --> <input class="btnlite" type="submit" accesskey="k" tabindex="12" name="save" value="{L_SAVE_DRAFT}" /><!-- ENDIF --> - <!-- IF S_HAS_DRAFTS --> <input class="btnlite" type="submit" accesskey="d" tabindex="13" name="load" value="{L_LOAD_DRAFT}" /><!-- ENDIF --> - <!-- ENDIF --> - <input class="btnlite" type="submit" accesskey="c" tabindex="14" name="cancel" value="{L_CANCEL}" /> - </td> -</tr> -</table> -<!-- IF not S_PRIVMSGS --> - {S_FORM_TOKEN} - </form> -<!-- ENDIF --> -<br clear="all" /> - -<!-- IF S_DISPLAY_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF --> -<!-- IF S_DISPLAY_HISTORY --><!-- INCLUDE ucp_pm_history.html --><!-- ENDIF --> - -<!-- IF S_PRIVMSGS --> - <!-- INCLUDE ucp_footer.html --> -<!-- ELSE --> - - <!-- INCLUDE breadcrumbs.html --> - - - <!-- IF S_DISPLAY_ONLINE_LIST --> - <br clear="all" /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat"><h4>{L_WHO_IS_ONLINE}</h4></td> - </tr> - <tr> - <td class="row1"><span class="gensmall">{LOGGED_IN_USER_LIST}</span></td> - </tr> - </table> - <!-- ENDIF --> - - <br clear="all" /> - - <table width="100%" cellspacing="1"> - <tr> - <td align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></td> - </tr> - </table> - - <!-- INCLUDE overall_footer.html --> -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/posting_buttons.html b/phpBB/styles/subsilver2/template/posting_buttons.html deleted file mode 100644 index 2c60913fc0..0000000000 --- a/phpBB/styles/subsilver2/template/posting_buttons.html +++ /dev/null @@ -1,94 +0,0 @@ -<tr valign="middle" align="{S_CONTENT_FLOW_BEGIN}"> - <td colspan="2"> - <script type="text/javascript"> - // <![CDATA[ - - // Define the bbCode tags - var bbcode = new Array(); - var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[flash=]', '[/flash]','[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->); - var imageTag = false; - - // Helpline messages - var help_line = { - b: '{LA_BBCODE_B_HELP}', - i: '{LA_BBCODE_I_HELP}', - u: '{LA_BBCODE_U_HELP}', - q: '{LA_BBCODE_Q_HELP}', - c: '{LA_BBCODE_C_HELP}', - l: '{LA_BBCODE_L_HELP}', - e: '{LA_BBCODE_LISTITEM_HELP}', - o: '{LA_BBCODE_O_HELP}', - p: '{LA_BBCODE_P_HELP}', - w: '{LA_BBCODE_W_HELP}', - a: '{LA_BBCODE_A_HELP}', - s: '{LA_BBCODE_S_HELP}', - f: '{LA_BBCODE_F_HELP}', - y: '{LA_BBCODE_Y_HELP}', - d: '{LA_BBCODE_D_HELP}', - tip: '{L_STYLES_TIP}' - <!-- BEGIN custom_tags --> - ,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}' - <!-- END custom_tags --> - } - - // ]]> - </script> - <!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js --> - -<!-- IF S_BBCODE_ALLOWED --> - <!-- EVENT posting_editor_buttons_before --> - <div id="core-bbcode-buttons"> - <input type="button" class="btnbbcode" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px;" onclick="bbstyle(0)" onmouseover="helpline('b')" onmouseout="helpline('tip')" /> - <input type="button" class="btnbbcode" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px;" onclick="bbstyle(2)" onmouseover="helpline('i')" onmouseout="helpline('tip')" /> - <input type="button" class="btnbbcode" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px;" onclick="bbstyle(4)" onmouseover="helpline('u')" onmouseout="helpline('tip')" /> - <!-- IF S_BBCODE_QUOTE --> - <input type="button" class="btnbbcode" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" onmouseover="helpline('q')" onmouseout="helpline('tip')" /> - <!-- ENDIF --> - <input type="button" class="btnbbcode" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" onmouseout="helpline('tip')" /> - <input type="button" class="btnbbcode" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" onmouseout="helpline('tip')" /> - <input type="button" class="btnbbcode" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" onmouseout="helpline('tip')" /> - <input type="button" class="btnbbcode" accesskey="y" name="addlistitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" onmouseover="helpline('e')" onmouseout="helpline('tip')" /> - <!-- IF S_BBCODE_IMG --> - <input type="button" class="btnbbcode" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" onmouseout="helpline('tip')" /> - <!-- ENDIF --> - <!-- IF S_LINKS_ALLOWED --> - <input type="button" class="btnbbcode" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" onmouseover="helpline('w')" onmouseout="helpline('tip')" /> - <!-- ENDIF --> - <!-- IF S_BBCODE_FLASH --> - <input type="button" class="btnbbcode" accesskey="d" name="addbbcode18" value="Flash" onclick="bbstyle(18)" onmouseover="helpline('d')" onmouseout="helpline('tip')" /> - <!-- ENDIF --> - <span class="genmed nowrap">{L_FONT_SIZE}{L_COLON} <select class="gensmall" name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" onmouseover="helpline('f')" onmouseout="helpline('tip')"> - <option value="50">{L_FONT_TINY}</option> - <option value="85">{L_FONT_SMALL}</option> - <option value="100" selected="selected">{L_FONT_NORMAL}</option> - <!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 150 --> - <option value="150">{L_FONT_LARGE}</option> - <!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 200 --> - <option value="200">{L_FONT_HUGE}</option> - <!-- ENDIF --> - <!-- ENDIF --> - </select></span> - </div> - <!-- EVENT posting_editor_buttons_after --> -<!-- ENDIF --> - </td> -</tr> -<!-- IF S_BBCODE_ALLOWED and .custom_tags --> - <tr valign="middle" align="{S_CONTENT_FLOW_BEGIN}"> - <td colspan="2"> - <div id="custom-bbcode-buttons"> - <!-- BEGIN custom_tags --> - <input type="button" class="btnbbcode" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})"<!-- IF custom_tags.BBCODE_HELPLINE !== '' --> onmouseover="helpline('cb_{custom_tags.BBCODE_ID}')" onmouseout="helpline('tip')"<!-- ENDIF --> /> - <!-- END custom_tags --> - </div> - </td> - </tr> -<!-- ENDIF --> -<!-- IF S_BBCODE_ALLOWED --> -<tr> - <td<!-- IF $S_SIGNATURE or S_EDIT_DRAFT --> colspan="2"<!-- ENDIF -->><input type="text" readonly="readonly" name="helpbox" style="width:100%" class="helpline" value="{L_STYLES_TIP}" /></td> - <!-- IF not $S_SIGNATURE and not S_EDIT_DRAFT --> - <td class="genmed" align="center">{L_FONT_COLOR}</td> - <!-- ENDIF --> -</tr> -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/posting_poll_body.html b/phpBB/styles/subsilver2/template/posting_poll_body.html deleted file mode 100644 index 67996eaf33..0000000000 --- a/phpBB/styles/subsilver2/template/posting_poll_body.html +++ /dev/null @@ -1,36 +0,0 @@ - -<tr> - <th colspan="2">{L_ADD_POLL}</th> -</tr> -<tr> - <td class="row3" colspan="2"><span class="gensmall">{L_ADD_POLL_EXPLAIN}</span></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_POLL_QUESTION}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="poll_title" size="50" maxlength="255" value="{POLL_TITLE}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_POLL_OPTIONS}{L_COLON}</b><br /><span class="gensmall">{L_POLL_OPTIONS_EXPLAIN}</span></td> - <td class="row2"><textarea style="width:450px" name="poll_option_text" rows="5" cols="35">{POLL_OPTIONS}</textarea></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_POLL_MAX_OPTIONS}{L_COLON}</b><br /><span class="gensmall">{L_POLL_MAX_OPTIONS_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="number" min="1" max="999" name="poll_max_options" size="3" maxlength="3" value="{POLL_MAX_OPTIONS}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_POLL_FOR}{L_COLON}</b></td> - <td class="row2"><input class="post" type="number" min="0" max="999" name="poll_length" size="3" maxlength="3" value="{POLL_LENGTH}" /> <b class="gen">{L_DAYS}</b> <span class="gensmall">{L_POLL_FOR_EXPLAIN}</span></td> -</tr> -<!-- IF S_POLL_VOTE_CHANGE --> - <tr> - <td class="row1"><b class="genmed">{L_POLL_VOTE_CHANGE}{L_COLON}</b><br /><span class="gensmall">{L_POLL_VOTE_CHANGE_EXPLAIN}</span></td> - <td class="row2"><input type="checkbox" class="radio" name="poll_vote_change"{VOTE_CHANGE_CHECKED} /></td> - </tr> -<!-- ENDIF --> - -<!-- IF S_POLL_DELETE --> - <tr> - <td class="row1"><b class="genmed">{L_POLL_DELETE}{L_COLON}</b></td> - <td class="row2"><input type="checkbox" class="radio" name="poll_delete"<!-- IF S_POLL_DELETE_CHECKED --> checked="checked"<!-- ENDIF --> /></td> - </tr> -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/posting_preview.html b/phpBB/styles/subsilver2/template/posting_preview.html deleted file mode 100644 index b0dbef6a5a..0000000000 --- a/phpBB/styles/subsilver2/template/posting_preview.html +++ /dev/null @@ -1,70 +0,0 @@ - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th>{L_PREVIEW}</th> -</tr> -<tr> - <td class="row1">{MINI_POST_IMG}<span class="postdetails">{L_POSTED}{L_COLON} {POST_DATE} {L_POST_SUBJECT}{L_COLON} {PREVIEW_SUBJECT}</span></td> -</tr> -<!-- IF S_HAS_POLL_OPTIONS --> - <tr> - <td class="row2" colspan="2" align="center"><br clear="all" /> - <table cellspacing="0" cellpadding="4" border="0" align="center"> - <tr> - <td align="center"><span class="gen"><b>{POLL_QUESTION}</b></span><br /><span class="gensmall">{L_POLL_LENGTH}</span></td> - </tr> - <tr> - <td align="center"> - <table cellspacing="0" cellpadding="2" border="0"> - <!-- BEGIN poll_option --> - <tr> - <td> - <!-- IF S_IS_MULTI_CHOICE --> - <input type="checkbox" class="radio" name="vote_id" value="" /> - <!-- ELSE --> - <input type="radio" class="radio" name="vote_id" value="" /> - <!-- ENDIF --> - </td> - <td><span class="gen">{poll_option.POLL_OPTION_CAPTION}</span></td> - </tr> - <!-- END poll_option --> - </table> - </td> - </tr> - <tr> - <td align="center"><span class="gensmall">{L_MAX_VOTES}</span></td> - </tr> - </table> - </td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1"> - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td><div class="postbody">{PREVIEW_MESSAGE}</div> - <!-- IF .attachment --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <td class="row2">{attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - <!-- IF PREVIEW_SIGNATURE --><span class="postbody"><br />_________________<br />{PREVIEW_SIGNATURE}</span><!-- ENDIF --></td> - </tr> - </table> - </td> -</tr> -<tr> - <td class="spacer"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> -</tr> -</table> - -<br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/posting_progress_bar.html b/phpBB/styles/subsilver2/template/posting_progress_bar.html deleted file mode 100644 index f9decc506b..0000000000 --- a/phpBB/styles/subsilver2/template/posting_progress_bar.html +++ /dev/null @@ -1,44 +0,0 @@ -<!-- INCLUDE simple_header.html --> -<script type="text/javascript"> -// <![CDATA[ - /** - * Close upload popup - */ - function close_popup() - { - if (opener != null) - { - if (opener.close_waitscreen != null) - { - if (opener.close_waitscreen == 1) - { - opener.close_waitscreen = 0; - self.close(); - return 0; - } - } - } - setTimeout("close_popup()", 1000); - return 0; - } -// ]]> -</script> - -<table width="100%" border="0" cellspacing="0" cellpadding="10"> -<tr> - <td> - <table width="100%" border="0" cellspacing="1" cellpadding="4"> - <tr> - <td valign="top" class="row1" align="center"><br /><span class="genmed">{L_UPLOAD_IN_PROGRESS}</span><br /><br /><div style="align:center">{PROGRESS_BAR}</div><br /><br /><span class="genmed"><a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a></span><br /><br /></td> - </tr> - </table> - </td> -</tr> -</table> - -<script type="text/javascript"> -// <![CDATA[ - close_popup(); -// ]]> -</script> -<!-- INCLUDE simple_footer.html --> diff --git a/phpBB/styles/subsilver2/template/posting_review.html b/phpBB/styles/subsilver2/template/posting_review.html deleted file mode 100644 index baf159aecd..0000000000 --- a/phpBB/styles/subsilver2/template/posting_review.html +++ /dev/null @@ -1,99 +0,0 @@ - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th align="center">{L_POST_REVIEW}</th> -</tr> -<tr> - <td class="row1" align="center"><span class="gen">{L_POST_REVIEW_EXPLAIN}</span></td> -</tr> -<tr> - <td class="spacer"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> -</tr> -<tr> - <td class="row1"> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th width="22%">{L_AUTHOR}</th> - <th>{L_MESSAGE}</th> - </tr> - <!-- BEGIN post_review_row --> - - <!-- IF post_review_row.S_ROW_COUNT is even --> <tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <!-- IF post_review_row.S_IGNORE_POST --> - <td colspan="2">{post_review_row.L_IGNORE_POST}</td> - <!-- ELSE --> - - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{post_review_row.POST_ID}"></a> - <table width="150" cellspacing="0" cellpadding="4" border="0"> - <tr> - <td align="center"><b class="postauthor">{post_review_row.POST_AUTHOR_FULL}</b></td> - </tr> - </table> - </td> - <td width="100%"> - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td> </td> - <td class="gensmall" valign="middle" nowrap="nowrap"><b>{L_POST_SUBJECT}{L_COLON}</b> </td> - <td class="gensmall" width="100%" valign="middle">{post_review_row.POST_SUBJECT}</td> - <td> </td> - </tr> - </table> - </td> - </tr> - - <!-- IF post_review_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td valign="top"> - <table width="100%" cellspacing="0"> - <tr> - <td valign="top"> - <table width="100%" cellspacing="0" cellpadding="2"> - <tr> - <td><div class="postbody">{post_review_row.MESSAGE}</div> - - <!-- IF post_review_row.S_HAS_ATTACHMENTS --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <!-- IF post_review_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{post_review_row.attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td> - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr valign="middle"> - <td width="100%"> </td> - <td width="10" nowrap="nowrap"><!-- IF S_IS_BOT -->{post_review_row.MINI_POST_IMG}<!-- ELSE --><a href="{post_review_row.U_MINI_POST}" class="imageset">{post_review_row.MINI_POST_IMG}</a><!-- ENDIF --></td> - <td class="gensmall" nowrap="nowrap"><b>{L_POSTED}{L_COLON}</b> {post_review_row.POST_DATE}</td> - </tr> - </table> - </td> - </tr> - </table> - </td> - <!-- ENDIF --> - </tr> - <tr> - <td class="spacer" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> - <!-- END post_review_row --> - </table> - </td> -</tr> -</table> - -<br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/posting_smilies.html b/phpBB/styles/subsilver2/template/posting_smilies.html deleted file mode 100644 index 0be71098db..0000000000 --- a/phpBB/styles/subsilver2/template/posting_smilies.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- INCLUDE simple_header.html --> - -<script type="text/javascript"> -// <![CDATA[ - var form_name = opener.form_name; - var text_name = opener.text_name; -// ]]> -</script> -<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js --> - -<table width="100%" cellspacing="1" cellpadding="4" border="0"> -<tr> - <td> - <table class="tablebg" width="95%" cellspacing="1" cellpadding="4" border="0"> - <tr> - <th>{L_SMILIES}</th> - </tr> - <tr> - <td class="row1" align="center" valign="middle"><!-- BEGIN smiley --> <a href="#" onclick="initInsertions(); insert_text('{smiley.A_SMILEY_CODE}', true, true); return false;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" hspace="2" vspace="2" /></a> <!-- END smiley --><br /> - <!-- IF .pagination --> - <b><a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{L_GOTO_PAGE}</a> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a> - <!-- ELSEIF pagination.S_IS_CURRENT --><strong>{pagination.PAGE_NUMBER}</strong> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> {L_ELLIPSIS} - <!-- ELSEIF pagination.S_IS_NEXT --><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a> - <!-- ELSE --><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a> - <!-- ENDIF --> - <!-- END pagination --> - <br /> - <!-- ENDIF --> - <a class="nav" href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a></td> - </tr> - </table> - </td> -</tr> -</table> -<!-- INCLUDE simple_footer.html --> diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html deleted file mode 100644 index 23ea56a216..0000000000 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ /dev/null @@ -1,110 +0,0 @@ -<script type="text/javascript"> -// <![CDATA[ - bbcodeEnabled = {S_BBCODE_ALLOWED}; -// ]]> -</script> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th align="center">{L_TOPIC_REVIEW} - {TOPIC_TITLE}</th> -</tr> -<tr> - <td class="row1"><div style="overflow: auto; width: 100%; height: 300px;"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th width="22%">{L_AUTHOR}</th> - <th>{L_MESSAGE}</th> - </tr> - <!-- BEGIN topic_review_row --> - - <!-- IF topic_review_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <!-- IF topic_review_row.S_IGNORE_POST --> - <td colspan="2">{topic_review_row.L_IGNORE_POST}</td> - <!-- ELSE --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{topic_review_row.POST_ID}"></a> - <table width="150" cellspacing="0"> - <tr> - <td align="center"><b class="postauthor"<!-- IF topic_review_row.POST_AUTHOR_COLOUR --> style="color: {topic_review_row.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{topic_review_row.POST_AUTHOR}</b></td> - </tr> - </table> - </td> - <td width="100%"> - <table width="100%" cellspacing="0"> - <tr> - <td> </td> - <td class="gensmall" valign="middle" nowrap="nowrap"><b>{L_POST_SUBJECT}{L_COLON}</b> </td> - <td class="gensmall" width="100%" valign="middle">{topic_review_row.POST_SUBJECT}</td> - <td valign="top" nowrap="nowrap"> <!-- IF topic_review_row.POSTER_QUOTE and topic_review_row.DECODED_MESSAGE --><a href="#" onclick="addquote({topic_review_row.POST_ID},'{topic_review_row.POSTER_QUOTE}', '{LA_WROTE}'); return false;" class="imageset">{QUOTE_IMG}</a><!-- ENDIF --></td> - </tr> - </table> - </td> - </tr> - - <!-- IF topic_review_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td valign="top"> - <table width="100%" cellspacing="0"> - <tr> - <td valign="top"> - <table width="100%" cellspacing="0" cellpadding="2"> - <tr> - <td> - <!-- IF topic_review_row.POST_ID == REPORTED_POST_ID --> - <table width="100%" cellspacing="0"> - <tr> - <span class="postreported">{REPORTED_IMG}</span> - </tr> - </table> - <!-- ENDIF --> - <div class="postbody">{topic_review_row.MESSAGE}</div> - - <!-- IF topic_review_row.S_HAS_ATTACHMENTS --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <!-- IF topic_review_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{topic_review_row.attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - - <!-- IF topic_review_row.POSTER_QUOTE and topic_review_row.DECODED_MESSAGE --> - <div id="message_{topic_review_row.POST_ID}" style="display: none;">{topic_review_row.DECODED_MESSAGE}</div> - <!-- ENDIF --> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td> - <table width="100%" cellspacing="0"> - <tr valign="middle"> - <td width="100%" align="{S_CONTENT_FLOW_BEGIN}"><span class="gensmall"><!-- IF topic_review_row.U_MCP_DETAILS -->[ <a href="{topic_review_row.U_MCP_DETAILS}">{L_POST_DETAILS}</a> ]<!-- ENDIF --></span></td> - <td width="10" nowrap="nowrap"><!-- IF S_IS_BOT -->{topic_review_row.MINI_POST_IMG}<!-- ELSE --><a href="{topic_review_row.U_MINI_POST}" class="imageset">{topic_review_row.MINI_POST_IMG}</a><!-- ENDIF --></td> - <td class="gensmall" nowrap="nowrap"><b>{L_POSTED}{L_COLON}</b> {topic_review_row.POST_DATE}</td> - </tr> - </table> - </td> - </tr> - </table> - </td> - <!-- ENDIF --> - </tr> - <tr> - <td class="spacer" colspan="2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> - <!-- END topic_review_row --> - </table> - </div></td> -</tr> -</table> - -<br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html deleted file mode 100644 index b2b7b1624e..0000000000 --- a/phpBB/styles/subsilver2/template/quickreply_editor.html +++ /dev/null @@ -1,29 +0,0 @@ -<form method="post" action="{U_QR_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th align="center" colspan="2">{L_QUICKREPLY}</th> - </tr> - <tr> - <td class="row1" width="22%"><b class="genmed">{L_SUBJECT}{L_COLON}</b></td> - <td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="124" tabindex="2" value="{SUBJECT}" /></td> - </tr> - <!-- EVENT quickreply_editor_message_before --> - <tr> - <td class="row1" width="22%"><b class="genmed">{L_MESSAGE}{L_COLON}</b></td> - <td class="row2" valign="top" align="left" width="78%"><textarea name="message" rows="7" cols="76" tabindex="3" style="width: 700px; height: 130px; min-width: 98%; max-width: 98%;"></textarea> </td> - </tr> - <!-- EVENT quickreply_editor_message_after --> - <tr> - <td class="cat" colspan="2" align="center"> - <input class="btnlite" type="submit" accesskey="f" tabindex="6" name="preview" value="{L_FULL_EDITOR}" /> - <input class="btnmain" type="submit" accesskey="s" tabindex="7" name="post" value="{L_SUBMIT}" /> - - {S_FORM_TOKEN} - {QR_HIDDEN_FIELDS} - </td> - </tr> - </table> - -</form> -<br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/report_body.html b/phpBB/styles/subsilver2/template/report_body.html deleted file mode 100644 index 906a957ef4..0000000000 --- a/phpBB/styles/subsilver2/template/report_body.html +++ /dev/null @@ -1,49 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<form method="post" id="report" action="{S_REPORT_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2"><!-- IF S_REPORT_POST -->{L_REPORT_POST}<!-- ELSE -->{L_REPORT_MESSAGE}<!-- ENDIF --></th> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row3" colspan="2"><span class="gensmall"><!-- IF S_REPORT_POST -->{L_REPORT_POST_EXPLAIN}<!-- ELSE -->{L_REPORT_MESSAGE_EXPLAIN}<!-- ENDIF --></span></td> -</tr> -<tr> - <td class="row1" width="22%"><b class="gen">{L_REASON}{L_COLON}</b></td> - <td class="row2" width="78%"><select name="reason_id"> - <!-- BEGIN reason --><option value="{reason.ID}"<!-- IF reason.S_SELECTED --> selected="selected"<!-- ENDIF -->>{reason.TITLE} » {reason.DESCRIPTION}</option><!-- END reason --> - </select></td> -</tr> -<!-- IF S_CAN_NOTIFY --> - <tr> - <td class="row1"><span class="gen"><b>{L_REPORT_NOTIFY}{L_COLON}</b></span><br /><span class="gensmall">{L_REPORT_NOTIFY_EXPLAIN}</span></td> - <td class="row2"><span class="gen"><input type="radio" class="radio" name="notify" value="1"<!-- IF S_NOTIFY --> checked="checked"<!-- ENDIF --> /> {L_YES} <input type="radio" class="radio" name="notify" value="0"<!-- IF not S_NOTIFY --> checked="checked"<!-- ENDIF --> /> {L_NO}</span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1" valign="top"><span class="gen"><b>{L_MORE_INFO}{L_COLON}</b></span><br /><span class="gensmall">{L_CAN_LEAVE_BLANK}</span></td> - <td class="row2"><textarea class="post" name="report_text" rows="10" cols="50">{REPORT_TEXT}</textarea></td> -</tr> -<!-- IF CAPTCHA_TEMPLATE --> - <!-- INCLUDE {CAPTCHA_TEMPLATE} --> -<!-- ENDIF --> -<tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="submit" class="btnmain" value="{L_SUBMIT}" /> <input type="submit" name="cancel" class="btnlite" value="{L_CANCEL}" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<div style="float: {S_CONTENT_FLOW_END};"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/search_body.html b/phpBB/styles/subsilver2/template/search_body.html deleted file mode 100644 index c0199fbae8..0000000000 --- a/phpBB/styles/subsilver2/template/search_body.html +++ /dev/null @@ -1,95 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div id="pagecontent"> - - <form method="get" action="{S_SEARCH_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="4">{L_SEARCH_QUERY}</th> - </tr> - <tr> - <td class="row1" colspan="2" width="50%"><b class="genmed">{L_SEARCH_KEYWORDS}{L_COLON} </b><br /><span class="gensmall">{L_SEARCH_KEYWORDS_EXPLAIN}</span></td> - <td class="row2" colspan="2" valign="top"><input type="text" style="width: 300px" class="post" name="keywords" size="30" /><br /><input type="radio" class="radio" name="terms" value="all" checked="checked" /> <span class="genmed">{L_SEARCH_ALL_TERMS}</span><br /><input type="radio" class="radio" name="terms" value="any" /> <span class="genmed">{L_SEARCH_ANY_TERMS}</span></td> - </tr> - <tr> - <td class="row1" colspan="2"><b class="genmed">{L_SEARCH_AUTHOR}{L_COLON}</b><br /><span class="gensmall">{L_SEARCH_AUTHOR_EXPLAIN}</span></td> - <td class="row2" colspan="2" valign="middle"><input type="text" style="width: 300px" class="post" name="author" size="30" /></td> - </tr> - <tr> - <td class="row1" colspan="2"><b class="genmed">{L_SEARCH_FORUMS}{L_COLON} </b><br /><span class="gensmall">{L_SEARCH_FORUMS_EXPLAIN}</span></td> - <td class="row2" colspan="2"><select name="fid[]" multiple="multiple" size="5">{S_FORUM_OPTIONS}</select></td> - </tr> - <tr> - <th colspan="4">{L_SEARCH_OPTIONS}</th> - </tr> - <tr> - <td class="row1" width="25%" nowrap="nowrap"><b class="genmed">{L_SEARCH_SUBFORUMS}{L_COLON} </b></td> - <td class="row2" width="25%" nowrap="nowrap"><input type="radio" class="radio" name="sc" value="1" checked="checked" /> <span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="sc" value="0" /> <span class="genmed">{L_NO}</span></td> - <td class="row1" width="25%" nowrap="nowrap"><b class="genmed">{L_SEARCH_WITHIN}{L_COLON} </b></td> - <td class="row2" width="25%" nowrap="nowrap"><input type="radio" class="radio" name="sf" value="all" checked="checked" /> <span class="genmed">{L_SEARCH_TITLE_MSG}</span><br /><input type="radio" class="radio" name="sf" value="msgonly" /> <span class="genmed">{L_SEARCH_MSG_ONLY}</span> <br /><input type="radio" class="radio" name="sf" value="titleonly" /> <span class="genmed">{L_SEARCH_TITLE_ONLY}</span> <br /><input type="radio" class="radio" name="sf" value="firstpost" /> <span class="genmed">{L_SEARCH_FIRST_POST}</span></td> - </tr> - <tr> - <td class="row1"><b class="genmed">{L_RESULT_SORT}{L_COLON} </b></td> - <td class="row2" nowrap="nowrap">{S_SELECT_SORT_KEY}<br /><input type="radio" class="radio" name="sd" value="a" /> <span class="genmed">{L_SORT_ASCENDING}</span><br /><input type="radio" class="radio" name="sd" value="d" checked="checked" /> <span class="genmed">{L_SORT_DESCENDING}</span></td> - <td class="row1" nowrap="nowrap"><b class="genmed">{L_DISPLAY_RESULTS}{L_COLON} </b></td> - <td class="row2" nowrap="nowrap"><input type="radio" class="radio" name="sr" value="posts" checked="checked" /> <span class="genmed">{L_POSTS}</span> <input type="radio" class="radio" name="sr" value="topics" /> <span class="genmed">{L_TOPICS}</span></td> - </tr> - <tr> - <td class="row1" width="25%"><b class="genmed">{L_RESULT_DAYS}{L_COLON} </b></td> - <td class="row2" width="25%" nowrap="nowrap">{S_SELECT_SORT_DAYS}</td> - <td class="row1" nowrap="nowrap"><b class="genmed">{L_RETURN_FIRST}{L_COLON} </b></td> - <td class="row2" nowrap="nowrap"><select name="ch">{S_CHARACTER_OPTIONS}</select> <span class="genmed">{L_POST_CHARACTERS}</span></td> - </tr> - <tr> - <td class="cat" colspan="4" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" name="submit" type="submit" value="{L_SEARCH}" /> <input class="btnlite" type="reset" value="{L_RESET}" /></td> - </tr> - </table> - - </form> - - <br clear="all" /> - - <!-- IF .recentsearch --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="2">{L_RECENT_SEARCHES}</th> - </tr> - <!-- BEGIN recentsearch --> - <!-- IF recentsearch.S_ROW_COUNT is even --><tr class="row2"><!-- ELSE --><tr class="row1"><!-- ENDIF --> - - <td class="genmed" style="padding: 4px;" width="70%"><a href="{recentsearch.U_KEYWORDS}">{recentsearch.KEYWORDS}</a></td> - <td class="genmed" style="padding: 4px;" width="30%" align="center">{recentsearch.TIME}</td> - </tr> - <!-- END recentsearch --> - </table> - - <br clear="all" /> - <!-- ENDIF --> - - </div> - - <!-- INCLUDE breadcrumbs.html --> - - <br clear="all" /> - - <div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<script type="text/javascript"> -// <![CDATA[ - (function() - { - var elements = document.getElementsByName("keywords"); - for (var i = 0; i < elements.length; ++i) - { - if (elements[i].tagName.toLowerCase() == 'input') - { - elements[i].focus(); - break; - } - } - })(); -// ]]> -</script> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/search_results.html b/phpBB/styles/subsilver2/template/search_results.html deleted file mode 100644 index 092779055d..0000000000 --- a/phpBB/styles/subsilver2/template/search_results.html +++ /dev/null @@ -1,156 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<form method="post" action="{S_SEARCH_ACTION}"> - -<table width="100%" cellspacing="1"> -<tr> - <td colspan="2"><span class="titles"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --></span><br /></td> -</tr> -<tr> - <td class="genmed"><!-- IF SEARCH_TOPIC -->{L_SEARCHED_TOPIC}{L_COLON} <a href="{U_SEARCH_TOPIC}"><b>{SEARCH_TOPIC}</b></a><br /><!-- ENDIF --><!-- IF SEARCH_WORDS -->{L_SEARCHED_FOR}{L_COLON} <a href="{U_SEARCH_WORDS}"><b>{SEARCH_WORDS}</b></a><!-- ENDIF --><!-- IF IGNORED_WORDS --> {L_IGNORED_TERMS}{L_COLON} <b>{IGNORED_WORDS}</b><!-- ENDIF --></td> - <td align="{S_CONTENT_FLOW_END}"><!-- IF SEARCH_IN_RESULTS --><span class="genmed">{L_SEARCH_IN_RESULTS}{L_COLON} </span><input class="post" type="text" name="add_keywords" value="" /> <input class="btnlite" type="submit" name="submit" value="{L_GO}" /><!-- ENDIF --></td> -</tr> -</table> - -<br clear="all" /> - -<!-- IF S_SHOW_TOPICS --> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th width="4%" nowrap="nowrap"> </th> - <th colspan="2" nowrap="nowrap"> {L_TOPICS} </th> - <th nowrap="nowrap"> {L_AUTHOR} </th> - <th nowrap="nowrap"> {L_REPLIES} </th> - <th nowrap="nowrap"> {L_VIEWS} </th> - <th nowrap="nowrap"> {L_LAST_POST} </th> - </tr> - <!-- BEGIN searchresults --> - <tr valign="middle"> - <td class="row1" width="25" align="center">{searchresults.TOPIC_FOLDER_IMG}</td> - <td class="row1" width="25" align="center"> - <!-- IF searchresults.TOPIC_ICON_IMG --> - <img src="{T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}" width="{searchresults.TOPIC_ICON_IMG_WIDTH}" height="{searchresults.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /> - <!-- ENDIF --> - </td> - <td class="row1"> - <!-- EVENT topiclist_row_prepend --> - <!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF --> - {searchresults.ATTACH_ICON_IMG} <a href="<!-- IF not S_IS_BOT and searchresults.S_UNREAD_TOPIC -->{searchresults.U_NEWEST_POST}<!-- ELSE -->{searchresults.U_VIEW_TOPIC}<!-- ENDIF -->" class="topictitle">{searchresults.TOPIC_TITLE}</a> - <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --> - <a href="{searchresults.U_MCP_QUEUE}" class="imageset">{searchresults.UNAPPROVED_IMG}</a> - <!-- ENDIF --> - <!-- IF searchresults.S_TOPIC_DELETED --> - <a href="{searchresults.U_MCP_QUEUE}" class="imageset">{DELETED_IMG}</a> - <!-- ENDIF --> - <!-- IF searchresults.S_TOPIC_REPORTED --> - <a href="{searchresults.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a> - <!-- ENDIF --> - <!-- IF .searchresults.pagination --> - <p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} - <!-- BEGIN pagination --> - <!-- IF searchresults.pagination.S_IS_PREV --> - <!-- ELSEIF searchresults.pagination.S_IS_CURRENT --><strong>{searchresults.pagination.PAGE_NUMBER}</strong> - <!-- ELSEIF searchresults.pagination.S_IS_ELLIPSIS --> {L_ELLIPSIS} - <!-- ELSEIF searchresults.pagination.S_IS_NEXT --> - <!-- ELSE --><a href="{searchresults.pagination.PAGE_URL}">{searchresults.pagination.PAGE_NUMBER}</a> - <!-- ENDIF --> - <!-- END pagination --> - ] </p> - <!-- ENDIF --> - <p class="gensmall">{L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></p> - <!-- EVENT topiclist_row_append --> - </td> - <td class="row2" width="100" align="center"><p class="topicauthor">{searchresults.TOPIC_AUTHOR_FULL}</p></td> - <td class="row1" width="50" align="center"><p class="topicdetails">{searchresults.TOPIC_REPLIES}</p></td> - <td class="row2" width="50" align="center"><p class="topicdetails">{searchresults.TOPIC_VIEWS}</p></td> - <td class="row1" width="120" align="center"> - <p class="topicdetails">{searchresults.LAST_POST_TIME}</p> - <p class="topicdetails">{searchresults.LAST_POST_AUTHOR_FULL} - <a href="{searchresults.U_LAST_POST}" class="imageset">{LAST_POST_IMG}</a> - </p> - </td> - </tr> - <!-- BEGINELSE --> - <tr valign="middle"> - <td colspan="7" class="row3" align="center">{L_NO_SEARCH_RESULTS}</td> - </tr> - <!-- END searchresults --> - <tr> - <td class="cat" colspan="7" valign="middle" align="center"><!-- IF S_SELECT_SORT_DAYS or S_SELECT_SORT_KEY --><span class="gensmall">{L_DISPLAY_POSTS}{L_COLON}</span> {S_SELECT_SORT_DAYS}<!-- IF S_SELECT_SORT_KEY --> <span class="gensmall">{L_SORT_BY}{L_COLON}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}<!-- ENDIF --> <input class="btnlite" type="submit" value="{L_GO}" name="sort" /><!-- ENDIF --></td> - </tr> - </table> - -<!-- ELSE --> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th width="150" nowrap="nowrap">{L_AUTHOR}</th> - <th width="100%" nowrap="nowrap">{L_MESSAGE}</th> - </tr> - - <!-- BEGIN searchresults --> - <tr class="row2"> - <!-- IF searchresults.S_IGNORE_POST --> - <td class="gensmall" colspan="2" height="25" align="center">{searchresults.L_IGNORE_POST}</td> - <!-- ELSE --> - <td colspan="2" height="25"><p class="topictitle"><a name="p{searchresults.POST_ID}" id="p{searchresults.POST_ID}"></a> {L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> {L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a> </p></td> - </tr> - <tr class="row1"> - <td width="150" align="center" valign="middle"><b class="postauthor">{searchresults.POST_AUTHOR_FULL}</b></td> - <td height="25"> - <table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td class="gensmall"> - <div style="float: {S_CONTENT_FLOW_BEGIN};"> - <!-- IF searchresults.POST_SUBJECT neq "" --> - <b>{L_POST_SUBJECT}{L_COLON}</b> <a href="{searchresults.U_VIEW_POST}">{searchresults.POST_SUBJECT}</a> - <!-- ELSE --> - [ <a href="{searchresults.U_VIEW_POST}">{L_JUMP_TO_POST}</a> ] - <!-- ENDIF --> - </div> - <div style="float: {S_CONTENT_FLOW_END};"><b>{L_POSTED}{L_COLON}</b> {searchresults.POST_DATE} </div> - </td> - </tr> - </table> - </td> - </tr> - <tr class="row1"> - <td width="150" align="center" valign="top"><br /><span class="postdetails">{L_REPLIES}{L_COLON} <b>{searchresults.TOPIC_REPLIES}</b><br />{L_VIEWS}{L_COLON} <b>{searchresults.TOPIC_VIEWS}</b></span><br /><br /></td> - <td valign="top"> - <table width="100%" cellspacing="5"> - <tr> - <td class="postbody">{searchresults.MESSAGE}</td> - </tr> - </table> - </td> - </tr> - <!-- ENDIF --> - <tr> - <td class="spacer" colspan="2"><img src="images/spacer.gif" height="1" alt="" /></td> - </tr> - <!-- BEGINELSE --> - <tr valign="middle"> - <td colspan="2" class="row3" align="center">{L_NO_SEARCH_RESULTS}</td> - </tr> - <!-- END searchresults --> - <tr> - <td class="cat" colspan="2" align="center"><!-- IF S_SELECT_SORT_KEY --><span class="gensmall">{L_SORT_BY}{L_COLON}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" name="sort" value="{L_GO}" /><!-- ENDIF --></td> - </tr> - </table> -<!-- ENDIF --> - -</form> - -<div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"><span class="nav">{PAGE_NUMBER}</span> [ {SEARCH_MATCHES} ]</div> -<div class="nav" style="float: {S_CONTENT_FLOW_END};"><!-- INCLUDE pagination.html --></div> - -<br clear="all" /><br /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/searchbox.html b/phpBB/styles/subsilver2/template/searchbox.html deleted file mode 100644 index 49de299ea2..0000000000 --- a/phpBB/styles/subsilver2/template/searchbox.html +++ /dev/null @@ -1 +0,0 @@ -<form method="get" name="search" action="{S_SEARCHBOX_ACTION}"><span class="gensmall">{L_SEARCH_FOR}{L_COLON}</span> <input class="post" type="text" name="keywords" size="20" /> <input class="btnlite" type="submit" value="{L_GO}" />{S_SEARCH_LOCAL_HIDDEN_FIELDS}</form> diff --git a/phpBB/styles/subsilver2/template/simple_footer.html b/phpBB/styles/subsilver2/template/simple_footer.html deleted file mode 100644 index 6a9c3096bc..0000000000 --- a/phpBB/styles/subsilver2/template/simple_footer.html +++ /dev/null @@ -1,15 +0,0 @@ - -</div> - -<div id="wrapfooter"> - <span class="copyright">{CREDIT_LINE}</span> -</div> - -<script type="text/javascript" src="{T_JQUERY_LINK}"></script> -<!-- IF S_ALLOW_CDN --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF --> - -<!-- EVENT simple_footer_after --> - -{$SCRIPTS} -</body> -</html> diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html deleted file mode 100644 index 43ca16ed87..0000000000 --- a/phpBB/styles/subsilver2/template/simple_header.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> -<head> -<meta charset="utf-8"> -<meta name="keywords" content="" /> -<meta name="description" content="" /> -{META} -<title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title> - -<link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css" /> -<link rel="stylesheet" href="{T_STYLESHEET_LANG_LINK}" type="text/css" /> -</head> - -<body class="{S_CONTENT_DIRECTION}"> -<a name="top"></a> -<div id="wrapcentre"> diff --git a/phpBB/styles/subsilver2/template/timezone.js b/phpBB/styles/subsilver2/template/timezone.js deleted file mode 100644 index c5829c0bb1..0000000000 --- a/phpBB/styles/subsilver2/template/timezone.js +++ /dev/null @@ -1,21 +0,0 @@ -(function($) { // Avoid conflicts with other libraries - -"use strict"; - -$('#tz_date').change(function() { - phpbb.timezoneSwitchDate(false); -}); - -$('#tz_select_date_suggest').click(function(){ - phpbb.timezonePreselectSelect(true); -}); - -$(document).ready( - phpbb.timezoneEnableDateSelection -); - -$(document).ready( - phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('timezone-preselect') == 'true') -); - -})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/styles/subsilver2/template/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html deleted file mode 100644 index 0f27719f86..0000000000 --- a/phpBB/styles/subsilver2/template/timezone_option.html +++ /dev/null @@ -1,20 +0,0 @@ -<tr> - <td class="row1" width="50%"><b class="genmed">{L_BOARD_TIMEZONE}{L_COLON}</b></td> - <td class="row2"> - <!-- IF S_TZ_DATE_OPTIONS --> - <div id="tz_select_date" style="display: none;"> - <select name="tz_date" id="tz_date" class="autowidth tz_select"> - <option value="">{L_SELECT_CURRENT_TIME}</option> - {S_TZ_DATE_OPTIONS} - </select><br /> - <input type="button" id="tz_select_date_suggest" class="btnlite" style="display: none;" timezone-preselect="<!-- IF S_TZ_PRESELECT -->true<!-- ELSE -->false<!-- ENDIF -->" data-l-suggestion="{L_TIMEZONE_DATE_SUGGESTION}" value="{L_TIMEZONE_DATE_SUGGESTION}" /> - </div> - <!-- ENDIF --> - <select name="tz" id="timezone" class="autowidth tz_select"> - <option value="">{L_SELECT_TIMEZONE}</option> - {S_TZ_OPTIONS} - </select> - - <!-- INCLUDEJS timezone.js --> - </td> -</tr> diff --git a/phpBB/styles/subsilver2/template/ucp_agreement.html b/phpBB/styles/subsilver2/template/ucp_agreement.html deleted file mode 100644 index 054d25282f..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_agreement.html +++ /dev/null @@ -1,84 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<!-- IF S_SHOW_COPPA or S_REGISTRATION --> - -<!-- IF S_LANG_OPTIONS --> -<script type="text/javascript"> -// <![CDATA[ - /** - * Change language - */ - function change_language(lang_iso) - { - document.forms['register'].change_lang.value = lang_iso; - document.forms['register'].submit(); - } - -// ]]> -</script> - - <form method="post" action="{S_UCP_ACTION}" id="register"> - <table width="100%" cellspacing="0"> - <tr> - <td class="gensmall" align="{S_CONTENT_FLOW_END}">{L_LANGUAGE}{L_COLON} <select name="lang" id="lang" onchange="change_language(this.value); return false;" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select></td> - </tr> - </table> - {S_HIDDEN_FIELDS} - </form> -<!-- ENDIF --> - - <form method="post" action="{S_UCP_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th height="25">{SITENAME} - {L_REGISTRATION}</th> - </tr> - <tr> - <td class="row1" align="center"> - <table width="90%" cellspacing="2" cellpadding="2" border="0" align="center"> - <tr> - <!-- IF S_SHOW_COPPA --> - <td class="gen" align="center"><br />{L_COPPA_BIRTHDAY}<br /><br /><a href="{U_COPPA_NO}">{L_COPPA_NO}</a> :: <a href="{U_COPPA_YES}">{L_COPPA_YES}</a><br /><br /></td> - <!-- ELSE --> - <td> - <span class="genmed"><br />{L_TERMS_OF_USE}<br /><br /></span> - <div align="center"> - <input class="btnlite" type="submit" id="agreed" name="agreed" value="{L_AGREE}" /><br /><br /> - <input class="btnlite" type="submit" name="not_agreed" value="{L_NOT_AGREE}" /> - </div> - </td> - <!-- ENDIF --> - </tr> - </table> - </td> - </tr> - </table> - {S_HIDDEN_FIELDS} - {S_FORM_TOKEN} - </form> - -<!-- ELSEIF S_AGREEMENT --> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th height="25">{SITENAME} - {AGREEMENT_TITLE}</th> - </tr> - <tr> - <td class="row1" align="center"> - <table width="90%" cellspacing="2" cellpadding="2" border="0" align="center"> - <tr> - <td> - <span class="genmed"><br />{AGREEMENT_TEXT}<br /><br /></span> - <div align="center"> - <a href="{U_BACK}">{L_BACK}</a> - </div> - </td> - </tr> - </table> - </td> - </tr> - </table> - -<!-- ENDIF --> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_attachments.html b/phpBB/styles/subsilver2/template/ucp_attachments.html deleted file mode 100644 index 0f6101aac7..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_attachments.html +++ /dev/null @@ -1,58 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<!-- IF S_ATTACHMENT_ROWS --> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th nowrap="nowrap">#</th> - <th nowrap="nowrap" width="15%"><a href="{U_SORT_FILENAME}">{L_FILENAME}</a></th> - <th nowrap="nowrap" width="5%"><a href="{U_SORT_POST_TIME}">{L_POST_TIME}</a></th> - <th nowrap="nowrap" width="5%"><a href="{U_SORT_FILESIZE}">{L_FILESIZE}</a></th> - <th nowrap="nowrap" width="5%"><a href="{U_SORT_DOWNLOADS}">{L_DOWNLOADS}</a></th> - <th width="2%" nowrap="nowrap">{L_DELETE}</th> - </tr> - <!-- IF TOTAL_ATTACHMENTS --> - <tr> - <td class="row3" colspan="6"> - <table width="100%" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ {TOTAL_ATTACHMENTS} ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - </tr> - </table> - </td> - </tr> - <!-- ENDIF --> - <!-- BEGIN attachrow --> - <!-- IF attachrow.S_ROW_COUNT is even --><tr class="row2"><!-- ELSE --><tr class="row1"><!-- ENDIF --> - - <td class="genmed" style="padding: 4px;" align="center" width="2%"> {attachrow.ROW_NUMBER} </td> - <td style="padding: 4px;"><a class="gen" href="{attachrow.U_VIEW_ATTACHMENT}">{attachrow.FILENAME}</a><br /><span class="gensmall"><!-- IF attachrow.S_IN_MESSAGE --><b>{L_PM}{L_COLON} </b><!-- ELSE --><b>{L_TOPIC}{L_COLON} </b><!-- ENDIF --><a href="{attachrow.U_VIEW_TOPIC}">{attachrow.TOPIC_TITLE}</a></span></td> - <td class="gensmall" style="padding: 4px;" align="center" valign="middle" nowrap="nowrap"> {attachrow.POST_TIME} </td> - <td class="genmed" style="padding: 4px;" align="center" valign="middle" nowrap="nowrap">{attachrow.SIZE}</td> - <td class="genmed" style="padding: 4px;" align="center">{attachrow.DOWNLOAD_COUNT}</td> - <td style="padding: 4px;" align="center" valign="middle"><input type="checkbox" class="radio" name="attachment[{attachrow.ATTACH_ID}]" value="1" /></td> - </tr> - <!-- END attachrow --> - <tr> - <td class="cat" colspan="6"><div style="float: {S_CONTENT_FLOW_BEGIN};"><span class="gensmall">{L_SORT_BY}{L_COLON} </span><select name="sk">{S_SORT_OPTIONS}</select> <select name="sd">{S_ORDER_SELECT}</select> <input class="btnlite" type="submit" name="sort" value="{L_SORT}" /></div><div style="float: {S_CONTENT_FLOW_END};"><input class="btnlite" type="submit" name="delete" value="{L_DELETE_MARKED}" /> </div></td> - </tr> - </table> - - <div style="float: {S_CONTENT_FLOW_END};"><b class="gensmall"><a href="#" onclick="marklist('ucp', 'attachment', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('ucp', 'attachment', false); return false;">{L_UNMARK_ALL}</a></b></div> - -<!-- ELSE --> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_TITLE}</th> - </tr> - <tr class="row1"> - <td align="center"><b class="genmed">{L_UCP_NO_ATTACHMENTS}</b></td> - </tr> - </table> - -<!-- ENDIF --> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_auth_link.html b/phpBB/styles/subsilver2/template/ucp_auth_link.html deleted file mode 100644 index 75e3133fcf..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_auth_link.html +++ /dev/null @@ -1,19 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="4">{L_UCP_AUTH_LINK_TITLE}</th> - </tr> - - <!-- IF ERROR --> - <tr> - <td class="row1" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td> - </tr> - <!-- ENDIF --> - - <!-- IF PROVIDER_TEMPLATE_FILE --> - <!-- INCLUDE {PROVIDER_TEMPLATE_FILE} --> - <!-- ENDIF --> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_auth_link_oauth.html b/phpBB/styles/subsilver2/template/ucp_auth_link_oauth.html deleted file mode 100644 index 80564d207b..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_auth_link_oauth.html +++ /dev/null @@ -1,34 +0,0 @@ -<!-- BEGIN oauth --> - <tr> - <th>{oauth.SERVICE_NAME}</th> - </tr> - - <tr> - <td class="row1"> - <form id="ucp" method="post" action="{S_UCP_ACTION}"> - <table> - <!-- IF oauth.UNIQUE_ID --> - <tr> - <td class="row1">{L_UCP_AUTH_LINK_ID}{L_COLON}</td> - <td class="row1">{oauth.UNIQUE_ID}</td> - </tr> - <tr> - <td class="row1"> </td> - <td class="row1"><input type="submit" name="submit" tabindex="6" value="{L_UCP_AUTH_LINK_UNLINK}" class="button1" /></td> - </tr> - <!-- ELSE --> - <tr> - <td class="row1">{L_UCP_AUTH_LINK_ASK}</td> - </tr> - <tr> - <td class="row1"><input type="submit" name="submit" tabindex="6" value="{L_UCP_AUTH_LINK_LINK}" class="button1" /></td> - </tr> - <!-- ENDIF --> - </table> - {oauth.HIDDEN_FIELDS} - {S_HIDDEN_FIELDS} - {S_FORM_TOKEN} - </form> - </td> - </tr> -<!-- END oauth --> diff --git a/phpBB/styles/subsilver2/template/ucp_avatar_options_gravatar.html b/phpBB/styles/subsilver2/template/ucp_avatar_options_gravatar.html deleted file mode 100644 index b8840e0aab..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_avatar_options_gravatar.html +++ /dev/null @@ -1,13 +0,0 @@ -<table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_GRAVATAR_AVATAR_EMAIL}{L_COLON}</b><br /><span class="gensmall">{L_GRAVATAR_AVATAR_EMAIL_EXPLAIN}</span></td> - <td class="row2"><input type="text" name="avatar_gravatar_email" id="avatar_gravatar_email" value="{AVATAR_GRAVATAR_EMAIL}" class="inputbox" /></td> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_GRAVATAR_AVATAR_SIZE}{L_COLON}</b><br /><span class="gensmall">{L_GRAVATAR_AVATAR_SIZE_EXPLAIN}</span></td> - <td class="row2"> - <input type="text" name="avatar_gravatar_width" id="avatar_gravatar_width" size="3" value="{AVATAR_GRAVATAR_WIDTH}" class="inputbox autowidth" /> {L_PIXEL} × - <input type="text" name="avatar_gravatar_height" id="avatar_gravatar_height" size="3" value="{AVATAR_GRAVATAR_HEIGHT}" class="inputbox autowidth" /> {L_PIXEL} - </td> - </tr> -</table> diff --git a/phpBB/styles/subsilver2/template/ucp_avatar_options_local.html b/phpBB/styles/subsilver2/template/ucp_avatar_options_local.html deleted file mode 100644 index 87e5608fec..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_avatar_options_local.html +++ /dev/null @@ -1,39 +0,0 @@ -<table class="tablebg" width="100%" cellspacing="1"> - <!-- IF .avatar_local_cats --> - <tr> - <td class="cat" colspan="2" align="center" valign="middle"><span class="genmed">{L_AVATAR_CATEGORY}{L_COLON} </span><select name="avatar_local_cat" id="category"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> - <!-- BEGIN avatar_local_cats --> - <option value="{avatar_local_cats.NAME}"<!-- IF avatar_local_cats.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_local_cats.NAME}</option> - <!-- END avatar_local_cats --> - </select> <input class="btnlite" tabindex="0" type="submit" value="{L_GO}" name="avatar_local_go" /> - </td> - </tr> - <tr> - <td class="row1" colspan="2" align="center"> - <table cellspacing="1" cellpadding="4" border="0"> - <!-- BEGIN avatar_local_row --> - <tr> - <!-- BEGIN avatar_local_col --> - <td class="row1" align="center"><img src="{avatar_local_col.avatar_local_col.AVATAR_IMAGE}" alt="{avatar_local_col.avatar_local_col.AVATAR_NAME}" title="{avatar_local_col.avatar_local_col.AVATAR_NAME}" /></td> - <!-- END avatar_local_col --> - </tr> - <tr> - <!-- BEGIN avatar_local_option --> - <td class="row2" align="center"><input type="radio" class="radio" name="avatar_local_file" value="{avatar_local_col.avatar_local_option.S_OPTIONS_AVATAR}" /></td> - <!-- END avatar_local_option --> - </tr> - <!-- BEGINELSE --> - <tr> - <td class="row1" colspan="2">{L_NO_AVATAR_CATEGORY}</td> - </tr> - <!-- END avatar_local_col --> - </table> - </td> - </tr> - <!-- ELSE --> - <tr> - <td class="row1" colspan="2"><strong>{L_NO_AVATARS}</strong></td> - </tr> - <!-- ENDIF --> -</table> diff --git a/phpBB/styles/subsilver2/template/ucp_avatar_options_remote.html b/phpBB/styles/subsilver2/template/ucp_avatar_options_remote.html deleted file mode 100644 index 50ebb9b93d..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_avatar_options_remote.html +++ /dev/null @@ -1,10 +0,0 @@ -<table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_LINK_REMOTE_AVATAR}{L_COLON} </b><br /><span class="gensmall">{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="text" name="avatar_remote_url" size="40" value="{AVATAR_REMOTE_URL}" /></td> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_LINK_REMOTE_SIZE}{L_COLON} </b><br /><span class="gensmall">{L_LINK_REMOTE_SIZE_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="text" name="avatar_remote_width" size="3" value="{AVATAR_REMOTE_WIDTH}" /> <span class="gen">{L_PIXEL} × </span> <input class="post" type="text" name="avatar_remote_height" size="3" value="{AVATAR_REMOTE_HEIGHT}" /> <span class="gen">{L_PIXEL}</span></td> - </tr> -</table> diff --git a/phpBB/styles/subsilver2/template/ucp_avatar_options_upload.html b/phpBB/styles/subsilver2/template/ucp_avatar_options_upload.html deleted file mode 100644 index 6b813baeaa..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_avatar_options_upload.html +++ /dev/null @@ -1,12 +0,0 @@ -<table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_UPLOAD_AVATAR_FILE}{L_COLON} </b></td> - <td class="row2"><input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_SIZE}" /><input class="post" type="file" name="avatar_upload_file" /></td> - </tr> -<!-- IF S_UPLOAD_AVATAR_URL --> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_UPLOAD_AVATAR_URL}{L_COLON} </b><br /><span class="gensmall">{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="text" name="avatar_upload_url" size="40" value="" /></td> - </tr> -<!-- ENDIF --> -</table> diff --git a/phpBB/styles/subsilver2/template/ucp_footer.html b/phpBB/styles/subsilver2/template/ucp_footer.html deleted file mode 100644 index 57adb2da97..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_footer.html +++ /dev/null @@ -1,13 +0,0 @@ - - <!-- IF not S_PRIVMSGS or S_SHOW_DRAFTS --> {S_FORM_TOKEN}</form><!-- ENDIF --></td> -</tr> -</table> -<!-- IF (S_SHOW_PM_BOX or S_EDIT_POST) and S_POST_ACTION -->{S_FORM_TOKEN}</form><!-- ENDIF --> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html deleted file mode 100644 index 3099fcb1d8..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html +++ /dev/null @@ -1,230 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<!-- IF S_EDIT --> - - <!-- IF S_ERROR --> - <div class="errorbox"> - <h3>{L_WARNING}</h3> - <p>{ERROR_MSG}</p> - </div> - <!-- ENDIF --> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="2">{L_USERGROUPS}</th> - </tr> - <tr> - <td class="row1" colspan="2"><span class="genmed">{L_GROUPS_EXPLAIN}</span></td> - </tr> - - <tr> - <th colspan="2">{L_GROUP_DETAILS}</th> - </tr> - <tr> - <td class="row1" width="35%"><label<!-- IF not S_SPECIAL_GROUP --> for="group_name"<!-- ENDIF -->>{L_GROUP_NAME}{L_COLON}</label></td> - <td class="row2"><!-- IF S_SPECIAL_GROUP --><b<!-- IF GROUP_COLOUR --> style="color: #{GROUP_COLOUR};"<!-- ENDIF -->>{GROUP_NAME}</b><!-- ENDIF --><input name="group_name" type="<!-- IF S_SPECIAL_GROUP -->hidden<!-- ELSE -->text<!-- ENDIF -->" id="group_name" value="{GROUP_INTERNAL_NAME}" /></td> - </tr> - <tr> - <td class="row1" width="35%"><label for="group_desc">{L_GROUP_DESC}{L_COLON}</label></td> - <td class="row2"><textarea id="group_desc" name="group_desc" rows="5" cols="45">{GROUP_DESC}</textarea> - <br /><input type="checkbox" class="radio" name="desc_parse_bbcode"<!-- IF S_DESC_BBCODE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_BBCODE} <input type="checkbox" class="radio" name="desc_parse_smilies"<!-- IF S_DESC_SMILIES_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_SMILIES} <input type="checkbox" class="radio" name="desc_parse_urls"<!-- IF S_DESC_URLS_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_URLS} - </td> - </tr> - <!-- IF not S_SPECIAL_GROUP --> - <tr> - <td class="row1" width="35%"><label for="group_type">{L_GROUP_TYPE}{L_COLON}</label><br /><span>{L_GROUP_TYPE_EXPLAIN}</span></td> - <td class="row2"> - <input name="group_type" type="radio" class="radio" id="group_type" value="{GROUP_TYPE_FREE}"{GROUP_FREE} /> {L_GROUP_OPEN} - <input name="group_type" type="radio" class="radio" value="{GROUP_TYPE_OPEN}"{GROUP_OPEN} /> {L_GROUP_REQUEST} - <input name="group_type" type="radio" class="radio" value="{GROUP_TYPE_CLOSED}"{GROUP_CLOSED} /> {L_GROUP_CLOSED} - <input name="group_type" type="radio" class="radio" value="{GROUP_TYPE_HIDDEN}"{GROUP_HIDDEN} /> {L_GROUP_HIDDEN} - </td> - </tr> - <!-- ELSE --> - <tr style="display:none;"><td><input name="group_type" type="hidden" value="{GROUP_TYPE_SPECIAL}" /></td></tr> - <!-- ENDIF --> - - <tr> - <th colspan="2">{L_GROUP_SETTINGS_SAVE}</th> - </tr> - <tr> - <td class="row1" width="35%"><label for="group_colour">{L_GROUP_COLOR}{L_COLON}</label><br /><span>{L_GROUP_COLOR_EXPLAIN}</span></td> - <td class="row2"> - <input name="group_colour" type="text" id="group_colour" value="{GROUP_COLOUR}" size="6" maxlength="6" /> - <span>[ <a href="#" id="color_palette_toggle">{L_COLOUR_SWATCH}</a> ]</span> - <div id="color_palette_placeholder" style="display: none;" data-orientation="h" data-height="12" data-width="15" data-target="#group_colour"></div> - </td> - </tr> - <tr> - <td class="row1" width="35%"><label for="group_rank">{L_GROUP_RANK}{L_COLON}</label></td> - <td class="row2"><select name="group_rank" id="group_rank">{S_RANK_OPTIONS}</select></td> - </tr> - <tr> - <th colspan="2">{L_GROUP_AVATAR}</th> - </tr> - <tr> - <td class="row1" width="35%"><label>{L_CURRENT_IMAGE}{L_COLON}</label><br /><span>{L_AVATAR_EXPLAIN}</span></td> - <td class="row2">{AVATAR_IMAGE}<br /><br /><input type="checkbox" class="radio" name="avatar_delete" /> <span>{L_DELETE_AVATAR}</span></td> - </tr> -<!-- IF not S_AVATARS_ENABLED --> - <tr> - <td class="row3" colspan="2" align="center">{L_AVATAR_FEATURES_DISABLED}</td> - </tr> -<!-- ENDIF --> - <tr> - <th colspan="2">{L_AVATAR_SELECT}</th> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_AVATAR_TYPE}{L_COLON}</b></td> - <td class="row2"> - <select name="avatar_driver" id="avatar_driver"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> - <!-- BEGIN avatar_drivers --> - <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_drivers.L_TITLE}</option> - <!-- END avatar_drivers --> - </select></td> - </tr> -<!-- BEGIN avatar_drivers --> - <tr class="avatar_option_{avatar_drivers.DRIVER}"> - <td class="row1" width="35%" colspan="2"><noscript><b class="genmed">{avatar_drivers.L_TITLE} </b><br /></noscript>{avatar_drivers.L_EXPLAIN}</span></td> - </tr> - <tr class="avatar_option_{avatar_drivers.DRIVER}"> - <td colspan="2" style="padding: 0">{avatar_drivers.OUTPUT}</td> - </tr> -<!-- END avatar_drivers --> - - <tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnlite" type="submit" id="submit" name="update" value="{L_SUBMIT}" /> - <input class="btnmain" type="reset" id="reset" name="reset" value="{L_RESET}" /></td> - </tr> - </table> - -<!-- INCLUDEJS avatars.js --> - -<!-- ELSEIF S_LIST --> - - <h1>{L_GROUP_MEMBERS}</h1> - - <p>{L_GROUP_MEMBERS_EXPLAIN}</p> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_USERNAME}</th> - <th>{L_GROUP_DEFAULT}</th> - <th>{L_JOINED}</th> - <th>{L_POSTS}</th> - <th>{L_MARK}</th> - </tr> - - <tr> - <td class="row3" colspan="5"><b>{L_GROUP_LEAD}</b></td> - </tr> - <!-- BEGIN leader --> - <!-- IF leader.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td>{leader.USERNAME_FULL}</td> - <td style="text-align: center;"><!-- IF leader.S_GROUP_DEFAULT -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td> - <td style="text-align: center;">{leader.JOINED}</td> - <td style="text-align: center;">{leader.USER_POSTS}</td> - <td style="text-align: center;"></td> - </tr> - <!-- END leader --> - - <!-- BEGIN member --> - <!-- IF member.S_PENDING --> - <tr> - <td class="row3" colspan="5"><b>{L_GROUP_PENDING}</b></td> - </tr> - <!-- ELSEIF member.S_APPROVED --> - <tr> - <td class="row3" colspan="5"><b>{L_GROUP_APPROVED}</b></td> - </tr> - <!-- ELSE --> - <!-- IF member.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td>{member.USERNAME_FULL}</td> - <td style="text-align: center;"><!-- IF member.S_GROUP_DEFAULT -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td> - <td style="text-align: center;">{member.JOINED}</td> - <td style="text-align: center;">{member.USER_POSTS}</td> - <td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" value="{member.USER_ID}" /></td> - </tr> - <!-- ENDIF --> - <!-- BEGINELSE --> - <tr> - <td class="row1" colspan="5" style="text-align: center;">{L_GROUPS_NO_MEMBERS}</td> - </tr> - <!-- END member --> - <tr> - <td class="cat" colspan="5" align="center"><div style="float: {S_CONTENT_FLOW_END};"><span class="small"><a href="#" onclick="marklist('ucp', 'mark', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('ucp', 'mark', false); return false;">{L_UNMARK_ALL}</a></span></div><div style="float: {S_CONTENT_FLOW_BEGIN};"><select name="action"><option class="sep" value="">{L_SELECT_OPTION}</option>{S_ACTION_OPTIONS}</select> <input class="btnmain" type="submit" name="update" value="{L_SUBMIT}" /></div></td> - </tr> - </table> - - <div class="pagination" style="float: {S_CONTENT_FLOW_BEGIN};"> - <!-- IF .pagination --> - <!-- INCLUDE pagination.html --> - <!-- ELSE --> - {PAGE_NUMBER} - <!-- ENDIF --> - </div> - - <br /> - <br /> - - <h1>{L_ADD_USERS}</h1> - - <p>{L_ADD_USERS_UCP_EXPLAIN}</p> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="2">{L_ADD_USERS}</th> - </tr> - <tr> - <td class="row1"><label for="default">{L_USER_GROUP_DEFAULT}{L_COLON}</label><br /><span>{L_USER_GROUP_DEFAULT_EXPLAIN}</span></td> - <td class="row2"><input name="default" type="radio" class="radio" value="1" /> {L_YES} <input name="default" type="radio" class="radio" id="default" value="0" checked="checked" /> {L_NO}</td> - </tr> - <tr> - <td class="row1"><label for="usernames">{L_USERNAME}{L_COLON}</label><br /><span>{L_USERNAMES_EXPLAIN}</span></td> - <td class="row2"><textarea id="usernames" name="usernames" cols="40" rows="5"></textarea><br />[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="addusers" value="{L_SUBMIT}" /></td> - </tr> - </table> - -<!-- ELSE --> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="3">{L_USERGROUPS}</th> - </tr> - <tr> - <td class="row1" colspan="3"><span class="genmed">{L_GROUPS_EXPLAIN}</span></td> - </tr> - - <tr> - <th>{L_GROUP_DETAILS}</th> - <th colspan="2">{L_OPTIONS}</th> - </tr> - <tr> - <td class="row3" colspan="3"><b class="gensmall">{L_GROUP_LEADER}</b></td> - </tr> - <!-- BEGIN leader --> - <!-- IF leader.S_ROW_COUNT is odd --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td><b class="genmed"<!-- IF leader.GROUP_COLOUR --> style="color: #{leader.GROUP_COLOUR};"<!-- ENDIF -->>{leader.GROUP_NAME}</b><!-- IF leader.GROUP_DESC --><p class="forumdesc">{leader.GROUP_DESC}</p><!-- ENDIF --></td> - <td style="text-align: center;"><a href="{leader.U_EDIT}">{L_EDIT}</a></td> - <td style="text-align: center;"><a href="{leader.U_LIST}">{L_GROUP_LIST}</a></td> - - </tr> - <!-- BEGINELSE --> - <tr> - <td class="row2" align="center" colspan="3"><b class="genmed">{L_NO_LEADERS}</b></td> - </tr> - <!-- END leader --> - - <tr> - <td class="cat" align="{S_CONTENT_FLOW_END}" colspan="3"> </td> - </tr> - </table> - -<!-- ENDIF --> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_groups_membership.html b/phpBB/styles/subsilver2/template/ucp_groups_membership.html deleted file mode 100644 index 846d48007e..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_groups_membership.html +++ /dev/null @@ -1,93 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="3">{L_USERGROUPS}</th> -</tr> -<tr> - <td class="row1" colspan="3"><span class="genmed">{L_GROUPS_EXPLAIN}</span></td> -</tr> - -<tr> - <th colspan="2">{L_GROUP_DETAILS}</th> - <th>{L_SELECT}</th> -</tr> - -<!-- BEGIN leader --> - <!-- IF leader.S_FIRST_ROW --> - <tr> - <td class="row3" colspan="3"><b class="gensmall">{L_GROUP_LEADER}</b></td> - </tr> - <!-- ENDIF --> - - <!-- IF leader.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td width="6%" align="center" nowrap="nowrap"><!-- IF S_CHANGE_DEFAULT --><input type="radio" class="radio" name="default"<!-- IF leader.S_GROUP_DEFAULT --> checked="checked"<!-- ENDIF --> value="{leader.GROUP_ID}" /><!-- ENDIF --></td> - <td> - <b class="genmed"><a href="{leader.U_VIEW_GROUP}"<!-- IF leader.GROUP_COLOUR --> style="color: #{leader.GROUP_COLOUR};"<!-- ENDIF -->>{leader.GROUP_NAME}</a></b> - <!-- IF leader.GROUP_DESC --><br /><span class="genmed">{leader.GROUP_DESC}</span><!-- ENDIF --> - <!-- IF not leader.GROUP_SPECIAL --><br /><i class="gensmall">{leader.GROUP_STATUS}</i><!-- ENDIF --> - </td> - <td width="6%" align="center" nowrap="nowrap"><!-- IF not leader.GROUP_SPECIAL --><input type="radio" class="radio" name="selected" value="{leader.GROUP_ID}" /><!-- ENDIF --></td> - </tr> -<!-- END leader --> - -<!-- BEGIN member --> - <!-- IF member.S_FIRST_ROW --> - <tr> - <td class="row3" colspan="3"><b class="gensmall">{L_GROUP_MEMBER}</b></td> - </tr> - <!-- ENDIF --> - - <!-- IF member.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td width="6%" align="center" nowrap="nowrap"><!-- IF S_CHANGE_DEFAULT --><input type="radio" class="radio" name="default"<!-- IF member.S_GROUP_DEFAULT --> checked="checked"<!-- ENDIF --> value="{member.GROUP_ID}" /><!-- ENDIF --></td> - <td> - <b class="genmed"><a href="{member.U_VIEW_GROUP}"<!-- IF member.GROUP_COLOUR --> style="color: #{member.GROUP_COLOUR};"<!-- ENDIF -->>{member.GROUP_NAME}</a></b> - <!-- IF member.GROUP_DESC --><br /><span class="genmed">{member.GROUP_DESC}</span><!-- ENDIF --> - <!-- IF not member.GROUP_SPECIAL --><br /><i class="gensmall">{member.GROUP_STATUS}</i><!-- ENDIF --> - </td> - <td width="6%" align="center" nowrap="nowrap"><!-- IF not member.GROUP_SPECIAL --><input type="radio" class="radio" name="selected" value="{member.GROUP_ID}" /><!-- ENDIF --></td> - </tr> -<!-- END member --> - -<!-- BEGIN pending --> - <!-- IF pending.S_FIRST_ROW --> - <tr> - <td class="row3" colspan="3"><b class="gensmall">{L_GROUP_PENDING}</b></td> - </tr> - <!-- ENDIF --> - - <!-- IF pending.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td width="6%" align="center" nowrap="nowrap"> </td> - <td> - <b class="genmed"><a href="{pending.U_VIEW_GROUP}"<!-- IF pending.GROUP_COLOUR --> style="color: #{pending.GROUP_COLOUR};"<!-- ENDIF -->>{pending.GROUP_NAME}</a></b> - <!-- IF pending.GROUP_DESC --><br /><span class="genmed">{pending.GROUP_DESC}</span><!-- ENDIF --> - <!-- IF not pending.GROUP_SPECIAL --><br /><i class="gensmall">{pending.GROUP_STATUS}</i><!-- ENDIF --> - </td> - <td width="6%" align="center" nowrap="nowrap"><!-- IF not pending.GROUP_SPECIAL --><input type="radio" class="radio" name="selected" value="{pending.GROUP_ID}" /><!-- ENDIF --></td> - </tr> -<!-- END pending --> - -<!-- BEGIN nonmember --> - <!-- IF nonmember.S_FIRST_ROW --> - <tr> - <td class="row3" colspan="3"><b class="gensmall">{L_GROUP_NONMEMBER}</b></td> - </tr> - <!-- ENDIF --> - - <!-- IF nonmember.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td width="6%" align="center" nowrap="nowrap"> </td> - <td> - <b class="genmed"><a href="{nonmember.U_VIEW_GROUP}"<!-- IF nonmember.GROUP_COLOUR --> style="color: #{nonmember.GROUP_COLOUR};"<!-- ENDIF -->>{nonmember.GROUP_NAME}</a></b> - <!-- IF nonmember.GROUP_DESC --><br /><span class="genmed">{nonmember.GROUP_DESC}</span><!-- ENDIF --> - <!-- IF not nonmember.GROUP_SPECIAL --><br /><i class="gensmall">{nonmember.GROUP_STATUS}</i><!-- ENDIF --> - </td> - <td width="6%" align="center" nowrap="nowrap"><!-- IF nonmember.S_CAN_JOIN --><input type="radio" class="radio" name="selected" value="{nonmember.GROUP_ID}" /><!-- ENDIF --></td> - </tr> -<!-- END nonmember --> - -<tr> - <td class="cat" colspan="3"><!-- IF S_CHANGE_DEFAULT --><div style="float: {S_CONTENT_FLOW_BEGIN};"><input class="btnlite" type="submit" name="change_default" value="{L_CHANGE_DEFAULT_GROUP}" /></div><!-- ENDIF --><div style="float: {S_CONTENT_FLOW_END};"><span class="genmed">{L_SELECT}{L_COLON} </span><select name="action"><option value="join">{L_JOIN_SELECTED}</option><option value="resign">{L_RESIGN_SELECTED}</option><option value="demote">{L_DEMOTE_SELECTED}</option></select> <input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> </div></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_header.html b/phpBB/styles/subsilver2/template/ucp_header.html deleted file mode 100644 index e3aaef6943..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_header.html +++ /dev/null @@ -1,163 +0,0 @@ -<!-- INCLUDE overall_header.html --> - - -<!-- IF S_SHOW_PM_BOX and S_POST_ACTION --> - <form action="{S_POST_ACTION}" method="post" name="postform"{S_FORM_ENCTYPE}> -<!-- ENDIF --> -<table width="100%" cellspacing="0" cellpadding="0" border="0"> -<tr> - <td width="20%" valign="top"> - -<!-- IF S_SHOW_PM_BOX and S_POST_ACTION --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_PM_TO}</th> - </tr> - <!-- IF not S_ALLOW_MASS_PM --> - <tr> - <td class="row1"><b class="genmed">{L_USERNAME}{L_COLON}</b><br />[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</td> - </tr> - - <tr> - <td class="row2"><input class="post" type="text" name="username_list" size="20" value="" /> <input class="post" type="submit" name="add_to" value="{L_ADD}" /></td> - </tr> - <!-- ELSE --> - <tr> - <td class="row1"><b class="genmed">{L_USERNAMES}{L_COLON}</b></td> - </tr> - <tr> - <td class="row2"><textarea name="username_list" rows="5" cols="22" tabindex="1"></textarea><br /> - [ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ] - </td> - </tr> - <!-- ENDIF --> - <!-- IF S_GROUP_OPTIONS --> - <tr> - <td class="row1"><b class="genmed">{L_USERGROUPS}{L_COLON}</b></td> - </tr> - <tr> - <td class="row2"><select name="group_list[]" multiple="multiple" size="5" style="width:150px">{S_GROUP_OPTIONS}</select></td> - </tr> - <!-- ENDIF --> - <!-- IF S_ALLOW_MASS_PM --> - <tr> - <td class="row1"><div style="float: {S_CONTENT_FLOW_BEGIN};"> <input class="post" type="submit" name="add_bcc" value="{L_ADD_BCC}" tabindex="1" /> </div><div style="float: {S_CONTENT_FLOW_END};"> <input class="post" type="submit" name="add_to" value="{L_ADD_TO}" tabindex="1" /> </div></td> - </tr> - <!-- ENDIF --> - </table> - <div style="padding: 2px;"></div> -<!-- ENDIF --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th>{L_OPTIONS}</th> -</tr> - -<!-- BEGIN l_block1 --> - <tr> - <!-- IF l_block1.S_SELECTED --> - <td class="row1"><b class="nav">{l_block1.L_TITLE}</b> - - <!-- IF S_PRIVMSGS --> - - <!-- the ! at the beginning of the loop name forces the loop to be not a nested one of l_block1 (it gets parsed separately) --> - <!-- BEGIN !folder --> - <!-- IF folder.S_FIRST_ROW --> - <ul class="nav" style="margin: 0; padding: 0; list-style-type: none; line-height: 175%;"> - <!-- ENDIF --> - - <!-- IF folder.S_CUR_FOLDER --> - <li class="row2" style="padding: 1px 0;">» <a href="{folder.U_FOLDER}">{folder.FOLDER_NAME}<!-- IF folder.S_UNREAD_MESSAGES --> ({folder.UNREAD_MESSAGES})<!-- ENDIF --></a></li> - <!-- ELSE --> - <li>» <a href="{folder.U_FOLDER}">{folder.FOLDER_NAME}<!-- IF folder.S_UNREAD_MESSAGES --> ({folder.UNREAD_MESSAGES})<!-- ENDIF --></a></li> - <!-- ENDIF --> - - <!-- IF folder.S_LAST_ROW --> - </ul> - <hr /> - <!-- ENDIF --> - <!-- END !folder --> - - <!-- ENDIF --> - - <ul class="nav" style="margin: 0; padding: 0; list-style-type: none; line-height: 175%;"> - <!-- BEGIN l_block2 --> - <li>» <!-- IF l_block1.l_block2.S_SELECTED --><b>{l_block1.l_block2.L_TITLE}</b><!-- ELSE --><a href="{l_block1.l_block2.U_TITLE}">{l_block1.l_block2.L_TITLE}</a><!-- ENDIF --></li> - <!-- END l_block2 --> - </ul> - <!-- ELSE --> - <td class="row2" nowrap="nowrap" onmouseover="this.className='row1'" onmouseout="this.className='row2'" onclick="location.href=this.firstChild.href;"><a class="nav" href="{l_block1.U_TITLE}">{l_block1.L_TITLE}</a> - <!-- ENDIF --> - </td> - </tr> -<!-- END l_block1 --> -</table> - -<div style="padding: 2px;"></div> - -<!-- IF S_SHOW_COLOUR_LEGEND --> - <table class="tablebg" width="100%" cellspacing="1" cellpadding="0"> - <tr> - <th colspan="2">{L_MESSAGE_COLOURS}</th> - </tr> - <!-- BEGIN pm_colour_info --> - <tr> - <!-- IF not pm_colour_info.IMG --> - <td class="row1 {pm_colour_info.CLASS}" width="5"><img src="images/spacer.gif" width="5" alt="{pm_colour_info.LANG}" /></td> - <!-- ELSE --> - <td class="row1" width="25" align="center">{pm_colour_info.IMG}</td> - <!-- ENDIF --> - <td class="row1"><span class="genmed">{pm_colour_info.LANG}</span></td> - </tr> - <!-- END pm_colour_info --> - </table> - - <div style="padding: 2px;"></div> -<!-- ENDIF --> - -<!-- IF S_ZEBRA_ENABLED and S_ZEBRA_FRIENDS_ENABLED --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{L_FRIENDS}</th> - </tr> - <tr> - <td class="row1" align="center"> - - <b class="genmed online">{L_FRIENDS_ONLINE}</b> - - <ul class="nav" style="margin: 0; padding: 0; list-style-type: none; line-height: 175%;"> - <!-- BEGIN friends_online --> - <li>{friends_online.USERNAME_FULL} - <!-- IF S_SHOW_PM_BOX --> - [ <input class="post" style="font-size: 90%;" type="submit" name="add_to[{friends_online.USER_ID}]" value="{L_ADD}" /> ] - <!-- ENDIF --> - </li> - <!-- BEGINELSE --> - <li>{L_NO_FRIENDS_ONLINE}</li> - <!-- END friends_online --> - </ul> - - <hr /> - - <b class="genmed offline">{L_FRIENDS_OFFLINE}</b> - - <ul class="nav" style="margin: 0; padding: 0; list-style-type: none; line-height: 175%;"> - <!-- BEGIN friends_offline --> - <li>{friends_offline.USERNAME_FULL} - <!-- IF S_SHOW_PM_BOX --> - [ <input class="post" style="font-size: 90%;" type="submit" name="add_to[{friends_offline.USER_ID}]" value="{L_ADD}" /> ] - <!-- ENDIF --> - </li> - <!-- BEGINELSE --> - <li>{L_NO_FRIENDS_OFFLINE}</li> - <!-- END friends_offline --> - </ul> - - </td> - </tr> - </table> -<!-- ENDIF --> - -</td> -<td><img src="images/spacer.gif" width="4" alt="" /></td> -<td width="80%" valign="top"><!-- IF not S_PRIVMSGS or S_SHOW_DRAFTS --><form name="ucp" id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}><!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/ucp_login_link.html b/phpBB/styles/subsilver2/template/ucp_login_link.html deleted file mode 100644 index 5d8e3ee27b..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_login_link.html +++ /dev/null @@ -1,74 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th>{SITENAME} - {L_LOGIN_LINK}</th> - </tr> - - <tr> - <td class="row1" align="center"><span class="genmed">{L_LOGIN_LINK_EXPLAIN}</span></td> - </tr> - - <!-- IF LOGIN_LINK_ERROR --> - <tr> - <td class="row1" align="center"><span class="genmed error">{LOGIN_LINK_ERROR}</span></td> - </tr> - <!-- ENDIF --> - - <tr> - <td class="row1"> - <form action="{REGISTER_ACTION}" method="post" id="register"> - <table width="100%" cellspacing="1"> - <tr> - <th colspan="2">{L_REGISTER}</th> - </tr> - - <tr> - <td>{S_HIDDEN_FIELDS}<input type="submit" name="register" tabindex="1" value="{L_REGISTER}" class="button1" /></td> - </tr> - </table> - </form> - </td> - </tr> - - <tr> - <td class="row1"> - <form action="{LOGIN_ACTION}" method="post" id="login"> - <table width="100%" cellspacing="1"> - <tr> - <th colspan="2">{L_LOGIN}</th> - </tr> - - <!-- IF LOGIN_ERROR --> - <tr> - <td class="row1" align="center" colspan="2"><span class="genmed error">{LOGIN_ERROR}</span></td> - </tr> - <!-- ENDIF --> - - <tr> - <td><label for="{USERNAME_CREDENTIAL}">{L_USERNAME}{L_COLON}</label></td> - <td><input type="text" tabindex="2" name="{USERNAME_CREDENTIAL}" id="{USERNAME_CREDENTIAL}" size="25" value="{LOGIN_USERNAME}" class="inputbox autowidth" /></td> - </tr> - - <tr> - <td><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></td> - <td><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></td> - </tr> - - <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE --> - <!-- DEFINE $CAPTCHA_TAB_INDEX = 4 --> - <!-- INCLUDE {CAPTCHA_TEMPLATE} --> - <!-- ENDIF --> - - {S_LOGIN_REDIRECT} - <tr> - <td> </td> - <td>{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="5" value="{L_LOGIN}" class="button1" /></td> - </tr> - </table> - </form> - </td> - </tr> -</table> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_main_bookmarks.html b/phpBB/styles/subsilver2/template/ucp_main_bookmarks.html deleted file mode 100644 index a8c6b4a9a8..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_main_bookmarks.html +++ /dev/null @@ -1,86 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="4">{L_UCP}</th> -</tr> -<tr> - <td class="row1" colspan="4" align="center"><span class="genmed">{L_BOOKMARKS_EXPLAIN}</span></td> -</tr> -<!-- IF .topicrow --> -<tr> - <th colspan="4">{L_BOOKMARKS}</th> -</tr> -<!-- ENDIF --> - -<!-- IF S_NO_DISPLAY_BOOKMARKS --> - <tr class="row1"> - <td colspan="4" align="center"><b class="genmed">{L_BOOKMARKS_DISABLED}</b></td> - </tr> -<!-- ELSE --> - - <!-- IF TOTAL_TOPICS --> - <tr> - <td class="row3" colspan="4"> - <table width="100%" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ {TOTAL_TOPICS} ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - </tr> - </table> - </td> - </tr> - <!-- ENDIF --> - - <!-- BEGIN topicrow --> - - <!-- IF topicrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td style="padding: 4px;" width="20" align="center" valign="middle">{topicrow.TOPIC_FOLDER_IMG}</td> - <!-- IF topicrow.S_DELETED_TOPIC --> - <td class="postdetails" style="padding: 4px" width="100%" colspan="2">{L_DELETED_TOPIC}</td> - <!-- ELSE --> - <td style="padding: 4px;" width="100%" valign="top"> - <p class="topictitle"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="<!-- IF topicrow.S_UNREAD_TOPIC -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->">{topicrow.TOPIC_TITLE}</a></p> - <!-- IF topicrow.S_GLOBAL_TOPIC --><span class="gensmall">{L_GLOBAL_ANNOUNCEMENT}</span><!-- ELSE --><span class="gensmall"><b>{L_FORUM}{L_COLON} </b><a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a></span><!-- ENDIF --> - <!-- IF .topicrow.pagination --> - <p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} - <!-- BEGIN pagination --> - <!-- IF topicrow.pagination.S_IS_PREV --> - <!-- ELSEIF topicrow.pagination.S_IS_CURRENT --><strong>{topicrow.pagination.PAGE_NUMBER}</strong> - <!-- ELSEIF topicrow.pagination.S_IS_ELLIPSIS --> {L_ELLIPSIS} - <!-- ELSEIF topicrow.pagination.S_IS_NEXT --> - <!-- ELSE --><a href="{topicrow.pagination.PAGE_URL}">{topicrow.pagination.PAGE_NUMBER}</a> - <!-- ENDIF --> - <!-- END pagination --> - ] </p> - <!-- ENDIF --> - </td> - <td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap"> - <p class="topicdetails">{topicrow.LAST_POST_TIME}</p> - <p class="topicdetails">{topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> - </p> - </td> - <!-- ENDIF --> - <td style="padding: 4px;"> <input type="checkbox" class="radio" name="t[{topicrow.TOPIC_ID}]" /> </td> - </tr> - <!-- BEGINELSE --> - <tr class="row1"> - <td colspan="4" align="center"><b class="genmed">{L_NO_BOOKMARKS}</b></td> - </tr> - <!-- END topicrow --> - - <!-- IF .topicrow --> - <tr> - <td class="cat" colspan="5" align="{S_CONTENT_FLOW_END}"><input class="btnlite" type="submit" name="unbookmark" value="{L_REMOVE_BOOKMARK_MARKED}" /> </td> - </tr> - <!-- ENDIF --> - <!-- ENDIF --> -</table> - -<!-- IF not S_NO_DISPLAY_BOOKMARKS and .topicrow --> - <div class="gensmall" style="float: {S_CONTENT_FLOW_END}; padding-top: 2px;"><b><a href="#" onclick="marklist('ucp', 't', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('ucp', 't', false); return false;">{L_UNMARK_ALL}</a></b></div> -<!-- ENDIF --> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_main_drafts.html b/phpBB/styles/subsilver2/template/ucp_main_drafts.html deleted file mode 100644 index d63d678250..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_main_drafts.html +++ /dev/null @@ -1,96 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="4">{L_UCP}</th> -</tr> -<tr> - <td class="row1" colspan="4" align="center"><span class="genmed">{L_DRAFTS_EXPLAIN}</span></td> -</tr> - -<!-- IF ERROR --> - <tr> - <td class="row1" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> - -<!-- IF not S_EDIT_DRAFT --> - - <!-- IF S_DRAFT_ROWS --> - <tr> - <th>{L_SAVE_DATE}</th> - <th>{L_DRAFT_TITLE}</th> - <th>{L_OPTIONS}</th> - <th>{L_DELETE}</th> - </tr> - <!-- ENDIF --> - - <!-- BEGIN draftrow --> - - <!-- IF draftrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td class="postdetails" style="padding: 4px;" nowrap="nowrap">{draftrow.DATE}</td> - <td style="padding: 4px;" valign="top" width="100%"> - <p class="topictitle">{draftrow.DRAFT_SUBJECT}</p> - <!-- IF draftrow.S_LINK_TOPIC --><span class="gensmall">{L_TOPIC}{L_COLON} <a href="{draftrow.U_VIEW}">{draftrow.TITLE}</a></span> - <!-- ELSEIF draftrow.S_LINK_FORUM --><span class="gensmall">{L_FORUM}{L_COLON} <a href="{draftrow.U_VIEW}">{draftrow.TITLE}</a></span> - <!-- ELSEIF draftrow.S_LINK_PM --><span class="gensmall">{L_PRIVATE_MESSAGE}</span> - <!-- ELSE --><span class="gensmall">{L_NO_TOPIC_FORUM}</span><!-- ENDIF --> - </td> - <td style="padding: 4px;" align="center" nowrap="nowrap"><span class="genmed"><!-- IF draftrow.U_INSERT --><a href="{draftrow.U_INSERT}">{L_LOAD_DRAFT}</a><br /><!-- ENDIF --><a href="{draftrow.U_VIEW_EDIT}">{L_VIEW_EDIT}</a></span></td> - <td style="padding: 4px;" align="center"><input type="checkbox" class="radio" name="d[{draftrow.DRAFT_ID}]" /></td> - </tr> - <!-- BEGINELSE --> - <tr> - <td class="row1" colspan="4" align="center"><b class="genmed">{L_NO_SAVED_DRAFTS}</b></td> - </tr> - <!-- END draftrow --> - - <!-- IF S_DRAFT_ROWS --> - <tr> - <td class="cat" colspan="4" align="{S_CONTENT_FLOW_END}"><input class="btnlite" type="submit" name="delete" value="{L_DELETE_MARKED}" /> </td> - </tr> - <!-- ENDIF --> - -<!-- ELSEIF S_EDIT_DRAFT --> - <tr> - <td class="row1" width="22%"><b class="genmed">{L_SUBJECT}{L_COLON}</b></td> - <td class="row2"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="64" tabindex="2" value="{DRAFT_SUBJECT}" /></td> - </tr> - <tr> - <td class="row1" width="22%"><b class="genmed">{L_MESSAGE}{L_COLON} </b><br /><span class="gensmall">{L_EDIT_DRAFT_EXPLAIN}</span></td> - <td class="row2"> - <script type="text/javascript"> - // <![CDATA[ - var form_name = 'ucp'; - var text_name = 'message'; - // ]]> - </script> - <table cellspacing="0" cellpadding="2" border="0"> - <!-- INCLUDE posting_buttons.html --> - <tr> - <td colspan="9"><textarea class="post" name="message" rows="10" cols="70" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();">{DRAFT_MESSAGE}</textarea></td> - </tr> - <tr> - <td colspan="9"> - <table cellspacing="0" cellpadding="0" border="0" width="100%"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}" id="color_palette_placeholder" data-orientation="h" data-width="11" data-height="10" data-bbcode="true"> - </td> - </tr> - </table> - </td> - </tr> - </table> - </td> - </tr> - <tr class="row1"> - <td colspan="9" align="{S_CONTENT_FLOW_BEGIN}"><p class="topictitle"><a href="{S_UCP_ACTION}">{L_BACK_TO_DRAFTS}</a></p></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> - </tr> -<!-- ENDIF --> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html deleted file mode 100644 index bc26266bef..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ /dev/null @@ -1,72 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="3">{L_UCP}</th> -</tr> -<tr> - <td class="row1" colspan="3" align="center"><p class="genmed">{L_UCP_WELCOME}</p></td> -</tr> -<tr> - <th colspan="3">{L_IMPORTANT_NEWS}</th> -</tr> - -<!-- BEGIN topicrow --> - - <!-- IF topicrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td class="row1" width="25" align="center">{topicrow.TOPIC_FOLDER_IMG}</td> - <td class="row1" width="100%"> - <p class="topictitle"><!-- IF topicrow.S_UNREAD --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="<!-- IF topicrow.S_UNREAD -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->">{topicrow.TOPIC_TITLE}</a></p><p class="gensmall">{topicrow.GOTO_PAGE}</p> - </td> - <td class="row1" width="120" align="center" nowrap="nowrap"> - <p class="topicdetails">{topicrow.LAST_POST_TIME}</p> - <p class="topicdetails">{topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> - </p> - </td> - </tr> -<!-- BEGINELSE --> - <tr class="row1"> - <td align="center" colspan="3"><b class="gen">{L_NO_IMPORTANT_NEWS}</b></td> - </tr> -<!-- END topicrow --> - -<tr> - <th colspan="3">{L_YOUR_DETAILS}</th> -</tr> -<tr> - <td class="row1" colspan="3"> - <table width="100%" cellspacing="1" cellpadding="4"> - <tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="genmed">{L_JOINED}{L_COLON} </b></td> - <td width="100%"><b class="gen">{JOINED}</b></td> - </tr> - <tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="genmed">{L_TOTAL_POSTS}{L_COLON} </b></td> - <td><!-- IF POSTS_PCT --><b class="gen">{POSTS}</b><br /><span class="genmed">[{POSTS_PCT} / {POSTS_DAY}]<!-- IF S_DISPLAY_SEARCH --><br /><a href="{U_SEARCH_SELF}">{L_SEARCH_YOUR_POSTS}</a><!-- ENDIF --></span><!-- ELSE --><b class="gen">{POSTS}<b><!-- ENDIF --></td> - </tr> - <!-- IF S_SHOW_ACTIVITY --> - <tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="genmed">{L_ACTIVE_IN_FORUM}{L_COLON} </b></td> - <td><!-- IF ACTIVE_FORUM != '' --><b><a class="gen" href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></b><br /><span class="genmed">[ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]</span><!-- ELSE --><span class="gen">-</span><!-- ENDIF --></td> - </tr> - <tr> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="genmed">{L_ACTIVE_IN_TOPIC}{L_COLON} </b></td> - <td><!-- IF ACTIVE_TOPIC != '' --><b><a class="gen" href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></b><br /><span class="genmed">[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]</span><!-- ELSE --><span class="gen">-</span><!-- ENDIF --></td> - </tr> - <!-- ENDIF --> - <!-- IF WARNINGS --> - <tr> - <td align="{S_CONTENT_FLOW_END}" valign="middle" nowrap="nowrap"><b class="genmed">{L_YOUR_WARNINGS}{L_COLON} </b></td> - <td class="genmed">{WARNING_IMG} [ <b>{WARNINGS}</b> ]</td> - </tr> - <!-- ENDIF --> - </table> - </td> -</tr> -<tr> - <td class="cat" colspan="3"> </td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_main_subscribed.html b/phpBB/styles/subsilver2/template/ucp_main_subscribed.html deleted file mode 100644 index 9de44dd9ed..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_main_subscribed.html +++ /dev/null @@ -1,93 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="4">{L_UCP}</th> -</tr> -<tr> - <td class="row1" colspan="4" align="center"><span class="genmed">{L_WATCHED_EXPLAIN}</span></td> -</tr> -<!-- IF S_FORUM_NOTIFY --> - <tr> - <th colspan="4">{L_WATCHED_FORUMS}</th> - </tr> - - <!-- BEGIN forumrow --> - - <!-- IF forumrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td style="padding: 4px;" width="20" align="center" valign="middle">{forumrow.FORUM_FOLDER_IMG}</td> - <td style="padding: 4px;" width="100%"><p class="topictitle"><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a></p></td> - <td class="gensmall" style="padding: 4px;" align="center" valign="middle" nowrap="nowrap"><!-- IF forumrow.LAST_POST_TIME -->{forumrow.LAST_POST_TIME}<br />{forumrow.LAST_POST_AUTHOR_FULL} <a href="{forumrow.U_LAST_POST}" class="imageset">{LAST_POST_IMG}</a><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></td> - <td style="padding: 4px;"> <input type="checkbox" class="radio" name="f[{forumrow.FORUM_ID}]" /> </td> - </tr> - <!-- BEGINELSE --> - <tr class="row1"> - <td colspan="4" align="center"><b class="genmed">{L_NO_WATCHED_FORUMS}</b></td> - </tr> - <!-- END forumrow --> -<!-- ENDIF --> -<!-- IF S_TOPIC_NOTIFY --> - <tr> - <th colspan="4">{L_WATCHED_TOPICS}</th> - </tr> - - <!-- IF TOTAL_TOPICS --> - <tr> - <td class="row3" colspan="4"> - <table width="100%" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ {TOTAL_TOPICS} ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - </tr> - </table> - </td> - </tr> - <!-- ENDIF --> - - <!-- BEGIN topicrow --> - - <!-- IF topicrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td style="padding: 4px;" width="20" align="center" valign="middle">{topicrow.TOPIC_FOLDER_IMG}</td> - <td style="padding: 4px;" width="100%" valign="top"> - <p class="topictitle"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG} <a href="<!-- IF topicrow.S_UNREAD_TOPIC -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->">{topicrow.TOPIC_TITLE}</a></p> - <!-- IF topicrow.S_GLOBAL_TOPIC --><span class="gensmall">{L_GLOBAL_ANNOUNCEMENT}</span><!-- ELSE --><span class="gensmall"><b>{L_FORUM}{L_COLON} </b><a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a></span><!-- ENDIF --> - <!-- IF .topicrow.pagination --> - <p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} - <!-- BEGIN pagination --> - <!-- IF topicrow.pagination.S_IS_PREV --> - <!-- ELSEIF topicrow.pagination.S_IS_CURRENT --><strong>{topicrow.pagination.PAGE_NUMBER}</strong> - <!-- ELSEIF topicrow.pagination.S_IS_ELLIPSIS --> {L_ELLIPSIS} - <!-- ELSEIF topicrow.pagination.S_IS_NEXT --> - <!-- ELSE --><a href="{topicrow.pagination.PAGE_URL}">{topicrow.pagination.PAGE_NUMBER}</a> - <!-- ENDIF --> - <!-- END pagination --> - ] </p> - <!-- ENDIF --> - </td> - <td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap"> - <p class="topicdetails">{topicrow.LAST_POST_TIME}</p> - <p class="topicdetails">{topicrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}" class="imageset">{LAST_POST_IMG}</a> - </p> - </td> - <td style="padding: 4px;"> <input type="checkbox" class="radio" name="t[{topicrow.TOPIC_ID}]" /> </td> - </tr> - <!-- BEGINELSE --> - <tr class="row1"> - <td colspan="4" align="center"><b class="genmed">{L_NO_WATCHED_TOPICS}</b></td> - </tr> - <!-- END topicrow --> -<!-- ENDIF --> - -<!-- IF .topicrow or .forumrow --> -<tr> - <td class="cat" colspan="4" align="{S_CONTENT_FLOW_END}"><input class="btnlite" type="submit" name="unwatch" value="{L_UNWATCH_MARKED}" /> </td> -</tr> -<!-- ENDIF --> -</table> -<!-- IF .topicrow or .forumrow --> -<div class="gensmall" style="float: {S_CONTENT_FLOW_END}; padding-top: 2px;"><b><a href="#" onclick="marklist('ucp', 't', true); marklist('ucp', 'f', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('ucp', 't', false);marklist('ucp', 'f', false); return false;">{L_UNMARK_ALL}</a></b></div> -<!-- ENDIF --> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_notifications.html b/phpBB/styles/subsilver2/template/ucp_notifications.html deleted file mode 100644 index a8b0d2b896..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_notifications.html +++ /dev/null @@ -1,139 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<form id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}> - -<!-- IF MODE == 'notification_options' --> - <table width="100%" cellspacing="1"> - <tr> - <th colspan="{NOTIFICATION_TYPES_COLS}">{TITLE}</th> - </tr> - <tr> - <td class="row1" colspan="{NOTIFICATION_TYPES_COLS}" align="center"><span class="genmed">{TITLE_EXPLAIN}</span></td> - </tr> - <tr> - <th>{L_NOTIFICATION_TYPE}</th> - <th width="10%">{L_NOTIFICATIONS}</th> - <!-- BEGIN notification_methods --> - <th width="10%">{notification_methods.NAME}</th> - <!-- END notification_methods --> - </tr> - - <!-- BEGIN notification_types --> - <!-- IF notification_types.GROUP_NAME --> - <tr> - <td class="row3" colspan="{NOTIFICATION_TYPES_COLS}">{notification_types.GROUP_NAME}</td> - </tr> - <!-- ELSE --> - <!-- IF notification_types.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td> - {notification_types.NAME} - <!-- IF notification_types.EXPLAIN --><br /> {notification_types.EXPLAIN}<!-- ENDIF --> - </td> - <td align="center"><input type="checkbox" name="{notification_types.TYPE}_notification"<!-- IF notification_types.SUBSCRIBED --> checked="checked"<!-- ENDIF --> /></td> - <!-- BEGIN notification_methods --> - <td align="center"><input type="checkbox" name="{notification_types.TYPE}_{notification_methods.METHOD}"<!-- IF notification_methods.SUBSCRIBED --> checked="checked"<!-- ENDIF --> /></td> - <!-- END notification_methods --> - </tr> - <!-- ENDIF --> - <!-- END notification_types --> - <tr> - <td class="cat" colspan="{NOTIFICATION_TYPES_COLS}" align="center"> - <input type="hidden" name="form_time" value="{FORM_TIME}" /> - {S_HIDDEN_FIELDS} - <input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> - <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /> - {S_FORM_TOKEN} - </td> - </tr> - </table> -<!-- ELSE --> - <table class="tablebg" width="100%" cellspacing="1" cellpadding="0"> - <tr> - <td class="row1"> - <table border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}"> - <!-- IF TOTAL_COUNT --> - <table width="100%" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}</td> - <td class="gensmall" nowrap="nowrap" width="100%"> {L_NOTIFICATIONS} [ <b>{TOTAL_COUNT}</b> ] </td> - </tr> - </table> - <!-- ENDIF --> - </td> - <td align="{S_CONTENT_FLOW_END}"><!-- INCLUDE pagination.html --></td> - </tr> - </table> - </td> - </tr> - </table> - - <div class="notification_list"> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat" colspan="3"> - <table width="100%" cellspacing="0"> - <tr class="nav"> - <td align="{S_CONTENT_FLOW_END}" valign="middle"><!-- IF U_MARK_ALL --><a href="{U_MARK_ALL}">{L_NOTIFICATIONS_MARK_ALL_READ}</a><!-- ENDIF --></td> - </tr> - </table> - </td> - </tr> - <tr> - <th colspan="2">{L_NOTIFICATIONS}</th> - <th width="15%">{L_MARK_READ}</th> - </tr> - <!-- BEGIN notification_list --> - <tr class="row<!-- IF notification_list.UNREAD -->3<!-- ELSEIF notification_list.S_ROW_COUNT is even -->1<!-- ELSE -->2<!-- ENDIF -->"> - <td width="50"> - <!-- IF notification_list.AVATAR -->{notification_list.AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF --> - </td> - <td valign="top"> - <span class="gen"> - <!-- IF notification_list.URL --><a href="<!-- IF notification_list.UNREAD -->{notification_list.U_MARK_READ}<!-- ELSE -->{notification_list.URL}<!-- ENDIF -->"><!-- ENDIF --> - <strong>{notification_list.FORMATTED_TITLE}</strong> - <!-- IF notification_list.URL --></a><!-- ENDIF --><br /> - {notification_list.TIME} - </span> - </td> - <td align="center"> - <input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}"<!-- IF not notification_list.UNREAD --> disabled="disabled"<!-- ENDIF --> /> - </td> - </tr> - <!-- END notification_list --> - <tr> - <td class="cat" colspan="3" align="center"> - <input type="hidden" name="form_time" value="{FORM_TIME}" /> - {S_HIDDEN_FIELDS} - <input class="btnmain" type="submit" name="submit" value="{L_MARK_READ}" /> - {S_FORM_TOKEN} - </td> - </tr> - </table> - </div> - - <!-- IF .pagination --> - <table class="tablebg" width="100%" cellspacing="1" cellpadding="0"> - <tr> - <td class="row1"> - <table border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}"> - <!-- INCLUDE pagination.html --> - </td> - </tr> - </table> - </td> - </tr> - </table> - <!-- ENDIF --> -<!-- ENDIF --> - -<!-- IF .notifications --> -<div class="gensmall" style="float: {S_CONTENT_FLOW_END}; padding-top: 2px;"><b><a href="#" onclick="$('#ucp input:checkbox').attr('checked', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="$('#ucp input:checkbox').attr('checked', false); return false;">{L_UNMARK_ALL}</a></b></div> -<!-- ENDIF --> - -</form> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html deleted file mode 100644 index ad06da2b7e..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ /dev/null @@ -1,73 +0,0 @@ -<script type="text/javascript"> -// <![CDATA[ - bbcodeEnabled = {S_BBCODE_ALLOWED}; -// ]]> -</script> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th align="center">{L_MESSAGE_HISTORY}</th> -</tr> -<tr> - <td class="row1"><div style="overflow: auto; width: 100%; height: 300px;"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th width="22%">{L_AUTHOR}</th> - <th>{L_MESSAGE}</th> - </tr> - <!-- BEGIN history_row --> - <!-- IF history_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a name="{history_row.MSG_ID}"></a> - <table width="150" cellspacing="0"> - <tr> - <td align="center" colspan="2"><span class="postauthor">{history_row.MESSAGE_AUTHOR_FULL}</span></td> - </tr> - </table> - </td> - <td width="100%"<!-- IF history_row.S_CURRENT_MSG --> class="current"<!-- ENDIF -->> - <div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"><b>{L_PM_SUBJECT}{L_COLON}</b> {history_row.SUBJECT}</div><div class="gensmall" style="float: {S_CONTENT_FLOW_END};"><b>{L_FOLDER}{L_COLON}</b> {history_row.FOLDER}</div> - </td> - </tr> - - <!-- IF history_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td valign="top"> - <table width="100%" cellspacing="0"> - <tr> - <td valign="top"> - <table width="100%" cellspacing="0" cellpadding="2"> - <tr> - <td><div class="postbody"><!-- IF history_row.MESSAGE -->{history_row.MESSAGE}<!-- ELSE --><span class="error">{L_MESSAGE_REMOVED_FROM_OUTBOX}</span><!-- ENDIF --></div><div id="message_{history_row.MSG_ID}" style="display: none;">{history_row.DECODED_MESSAGE}</div></td> - </tr> - </table> - </td> - </tr> - <tr> - <td> - <table width="100%" cellspacing="0"> - <tr valign="middle"> - <td width="100%"> </td> - <td width="10" nowrap="nowrap">{history_row.MINI_POST_IMG}</td> - <td class="gensmall" nowrap="nowrap"><b>{L_SENT_AT}{L_COLON}</b> {history_row.SENT_DATE}</td> - </tr> - </table> - </td> - </tr> - </table> - </td> - </tr> - - <!-- IF history_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td class="gensmall"><a href="{history_row.U_VIEW_MESSAGE}">{L_VIEW_PM}</a></td> - <td><div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"> <!-- IF history_row.U_PROFILE --><a href="{history_row.U_PROFILE}" class="imageset">{PROFILE_IMG}</a> <!-- ENDIF --> <!-- IF history_row.U_EMAIL --><a href="{history_row.U_EMAIL}" class="imageset">{EMAIL_IMG}</a> <!-- ENDIF --> </div> <div class="gensmall" style="float: {S_CONTENT_FLOW_END};"><!-- IF history_row.U_QUOTE or history_row.MESSAGE_AUTHOR_QUOTE --><a <!-- IF history_row.U_QUOTE -->href="{history_row.U_QUOTE}"<!-- ELSE -->href="#" onclick="addquote({history_row.MSG_ID}, '{history_row.MESSAGE_AUTHOR_QUOTE}', '{LA_WROTE}'); return false;"<!-- ENDIF --> class="imageset">{QUOTE_IMG}</a> <!-- ENDIF --> <!-- IF history_row.U_POST_REPLY_PM --><a href="{history_row.U_POST_REPLY_PM}" class="imageset">{REPLY_IMG}</a><!-- ENDIF --> </div></td> - </tr> - <tr> - <td class="spacer" colspan="2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> - <!-- END history_row --> - </table> - </div></td> -</tr> -</table> - -<br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html b/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html deleted file mode 100644 index 20c5c7fe9f..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html +++ /dev/null @@ -1,47 +0,0 @@ - -<!-- IF not S_VIEW_MESSAGE --> - {S_FORM_TOKEN} - </form> -<!-- ENDIF --> - -<table class="tablebg" width="100%" cellspacing="1" cellpadding="0"> -<tr> - <td class="row1"> - <table border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}"><!-- INCLUDE pagination.html --> - <!-- IF S_VIEW_MESSAGE --> - <span class="gensmall"> - <!-- IF U_PRINT_PM --><a href="{U_PRINT_PM}" title="{L_PRINT_PM}">{L_PRINT_PM}</a><!-- IF U_FORWARD_PM --> | <!-- ENDIF --><!-- ENDIF --> - <!-- IF U_FORWARD_PM --><a href="{U_FORWARD_PM}" title="{L_FORWARD_PM}">{L_FORWARD_PM}</a><!-- ENDIF --> - <!-- IF U_POST_REPLY_PM and S_PM_RECIPIENTS gt 1 --><!-- IF U_PRINT_PM or U_FORWARD_PM --> | <!-- ENDIF --><a title="{L_REPLY_TO_ALL}" href="{U_POST_REPLY_ALL}">{L_REPLY_TO_ALL}</a><!-- ENDIF --> - </span> - <!-- ENDIF --> - </td> - <td align="{S_CONTENT_FLOW_END}" nowrap="nowrap"> - <!-- IF S_VIEW_MESSAGE --> - <!-- IF not S_SPECIAL_FOLDER --> - <form name="movepm" method="post" action="{S_PM_ACTION}" style="margin:0px"> - <input type="hidden" name="marked_msg_id[]" value="{MSG_ID}" /> - <input type="hidden" name="cur_folder_id" value="{CUR_FOLDER_ID}" /> - <input type="hidden" name="p" value="{MSG_ID}" /> - <select name="dest_folder">{S_TO_FOLDER_OPTIONS}</select> <input class="btnlite" type="submit" name="move_pm" value="{L_MOVE_TO_FOLDER}" /> - {S_FORM_TOKEN} - </form> - <!-- ENDIF --> - <!-- ELSE --> - <form name="sortmsg" method="post" action="{S_PM_ACTION}" style="margin:0px"> - <span class="gensmall">{L_DISPLAY_MESSAGES}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" name="sort" value="{L_GO}" /> - {S_FORM_TOKEN} - </form> - <!-- ENDIF --> - </td> - </tr> - </table> - </td> -</tr> -</table> - -<!-- IF not S_VIEW_MESSAGE --> - <div style="float: {S_CONTENT_FLOW_END};"><b class="gensmall"><a href="#" onclick="marklist('viewfolder', 'marked_msg_id', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('viewfolder', 'marked_msg_id', false); return false;">{L_UNMARK_ALL}</a></b></div> -<!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_message_header.html b/phpBB/styles/subsilver2/template/ucp_pm_message_header.html deleted file mode 100644 index 370fa673dd..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_pm_message_header.html +++ /dev/null @@ -1,34 +0,0 @@ - -<table class="tablebg" width="100%" cellspacing="1" cellpadding="0"> -<tr> - <td class="row1"> - <table border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}"> - <!-- IF TOTAL_MESSAGES --> - <table width="100%" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <!-- IF FOLDER_MAX_MESSAGES neq 0 --> - <td class="gensmall" nowrap="nowrap" width="100%"> [ <b>{FOLDER_CUR_MESSAGES}</b>/{FOLDER_MAX_MESSAGES} {L_MESSAGES} ({FOLDER_PERCENT}%) ] </td> - <!-- ELSE --> - <td class="gensmall" nowrap="nowrap" width="100%"> [ <b>{FOLDER_CUR_MESSAGES}</b> {L_MESSAGES} ] </td> - <!-- ENDIF --> - </tr> - </table> - <!-- ENDIF --> - - <!-- IF S_VIEW_MESSAGE --> - <span class="gensmall"> - <!-- IF S_DISPLAY_HISTORY --> - <!-- IF U_VIEW_PREVIOUS_HISTORY --><a href="{U_VIEW_PREVIOUS_HISTORY}">{L_VIEW_PREVIOUS_HISTORY}</a> | <!-- ENDIF --><!-- IF U_VIEW_NEXT_HISTORY --><a href="{U_VIEW_NEXT_HISTORY}">{L_VIEW_NEXT_HISTORY}</a> | <!-- ENDIF --> - <!-- ENDIF --><a href="{U_PREVIOUS_PM}">{L_VIEW_PREVIOUS_PM}</a> | <a href="{U_NEXT_PM}">{L_VIEW_NEXT_PM}</a> - </span> - <!-- ENDIF --> - </td> - <td align="{S_CONTENT_FLOW_END}"><!-- INCLUDE pagination.html --></td> - </tr> - </table> - </td> -</tr> -</table> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_options.html b/phpBB/styles/subsilver2/template/ucp_pm_options.html deleted file mode 100644 index beb867c75a..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_pm_options.html +++ /dev/null @@ -1,192 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<!-- IF ERROR_MESSAGE or NOTIFICATION_MESSAGE --> - <table border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td class="row3" align="center"> - <!-- IF ERROR_MESSAGE --><span class="genmed error">{ERROR_MESSAGE}</span><!-- ENDIF --> - <!-- IF NOTIFICATION_MESSAGE --><span class="genmed error">{NOTIFICATION_MESSAGE}</span><!-- ENDIF --> - </td> - </tr> - </table> - <div style="padding: 2px;"></div> -<!-- ENDIF --> - -<form name="ucp" method="post" action="{S_UCP_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="3">{L_ADD_NEW_RULE}</th> -</tr> -<!-- IF S_CHECK_DEFINED --> - <tr> - <td class="row1" width="50" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><b class="gen">{L_IF}{L_COLON}</b></td> - <td class="row2" align="center" valign="top"><!-- IF S_CHECK_SELECT --><select name="check_option">{S_CHECK_OPTIONS}</select><!-- ELSE --><b class="gen">{CHECK_CURRENT}</b><input type="hidden" name="check_option" value="{CHECK_OPTION}" /><!-- ENDIF --></td> - <td class="row1" width="50" align="{S_CONTENT_FLOW_END}" valign="top"><!-- IF S_CHECK_SELECT --><input type="submit" name="next" value="{L_NEXT_STEP}" class="btnlite" /><!-- ELSE --> <!-- ENDIF --></td> - </tr> -<!-- ENDIF --> -<!-- IF S_RULE_DEFINED --> - <tr> - <td class="row1" width="50" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><!-- IF S_RULE_SELECT --><input type="submit" name="back[rule]" value="{L_PREVIOUS_STEP}" class="btnlite" /><!-- ELSE --> <!-- ENDIF --></td> - <td class="row2" align="center" valign="top"><!-- IF S_RULE_SELECT --><select name="rule_option">{S_RULE_OPTIONS}</select><!-- ELSE --><b class="gen">{RULE_CURRENT}</b><input type="hidden" name="rule_option" value="{RULE_OPTION}" /><!-- ENDIF --></td> - <td class="row1" width="50" align="{S_CONTENT_FLOW_END}" valign="top"><!-- IF S_RULE_SELECT --><input type="submit" name="next" value="{L_NEXT_STEP}" class="btnlite" /><!-- ELSE --> <!-- ENDIF --></td> - </tr> -<!-- ENDIF --> - -<!-- IF S_COND_DEFINED --> - <!-- IF S_COND_SELECT or COND_CURRENT --> - <tr> - <td class="row1" width="50" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><!-- IF S_COND_SELECT --><input type="submit" name="back[cond]" value="{L_PREVIOUS_STEP}" class="btnlite" /><!-- ELSE --> <!-- ENDIF --></td> - <td class="row2" align="center" valign="top"> - <!-- IF S_COND_SELECT --> - <!-- IF S_TEXT_CONDITION --> - <input type="text" name="rule_string" value="{CURRENT_STRING}" size="30" maxlength="250" class="post" /> - <!-- ELSEIF S_USER_CONDITION --> - <input type="text" class="post" name="rule_string" value="{CURRENT_STRING}" size="20" /> <span class="gensmall">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span> - <!-- ELSEIF S_GROUP_CONDITION --> - <input type="hidden" name="rule_string" value="{CURRENT_STRING}" /><!-- IF S_GROUP_OPTIONS --><select name="rule_group_id">{S_GROUP_OPTIONS}</select><!-- ELSE -->{L_NO_GROUPS}<!-- ENDIF --> - <!-- ENDIF --> - <!-- ELSE --> - <b class="gen">{COND_CURRENT}</b> - <input type="hidden" name="rule_string" value="{CURRENT_STRING}" /><input type="hidden" name="rule_user_id" value="{CURRENT_USER_ID}" /><input type="hidden" name="rule_group_id" value="{CURRENT_GROUP_ID}" /> - <!-- ENDIF --> - </td> - <td class="row1" width="50" align="{S_CONTENT_FLOW_END}" valign="top"><!-- IF S_COND_SELECT --><input type="submit" name="next" value="{L_NEXT_STEP}" class="btnlite" /><!-- ELSE --> <!-- ENDIF --></td> - </tr> - <!-- ENDIF --> - <input type="hidden" name="cond_option" value="{COND_OPTION}" /> -<!-- ENDIF --> - -<!-- IF NONE_CONDITION --><input type="hidden" name="cond_option" value="none" /><!-- ENDIF --> - -<!-- IF S_ACTION_DEFINED --> - <tr> - <td class="row1" width="50" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><!-- IF S_ACTION_SELECT --><input type="submit" name="back[action]" value="{L_PREVIOUS_STEP}" class="btnlite" /><!-- ELSE --> <!-- ENDIF --></td> - <td class="row2" align="center" valign="top"><!-- IF S_ACTION_SELECT --><select name="action_option">{S_ACTION_OPTIONS}</select><!-- ELSE --><b class="gen">{ACTION_CURRENT}</b><input type="hidden" name="action_option" value="{ACTION_OPTION}" /><!-- ENDIF --></td> - <td class="row1" width="50" align="{S_CONTENT_FLOW_END}" valign="top"><!-- IF S_ACTION_SELECT --><input type="submit" name="add_rule" value="{L_ADD_RULE}" class="btnlite" /><!-- ELSE --> <!-- ENDIF --></td> - </tr> -<!-- ENDIF --> -</table> - -<div style="padding: 2px;"></div> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="6">{L_DEFINED_RULES}</th> -</tr> -<!-- BEGIN rule --> - <tr> - <td class="row1" width="25" align="center"><span class="gen">#{rule.COUNT}</span></td> - <td class="row2" width="120"><span class="gen"><strong>{L_IF}</strong> {rule.CHECK}</span></td> - <td class="row1" width="120"><span class="gen">{rule.RULE}</span></td> - <td class="row2" width="120"><span class="gen"><!-- IF rule.STRING -->{rule.STRING}<!-- ENDIF --></span></td> - <td class="row1"><span class="gen">{rule.ACTION}<!-- IF rule.FOLDER --> -> {rule.FOLDER}<!-- ENDIF --></span></td> - <td class="row2" width="25"><input type="submit" name="delete_rule[{rule.RULE_ID}]" value="{L_DELETE_RULE}" class="btnlite" /></td> - </tr> -<!-- BEGINELSE --> - <tr> - <td colspan="6" class="row3" align="center"><span class="gen">{L_NO_RULES_DEFINED}</span></td> - </tr> -<!-- END rule --> -</table> - -<div style="padding: 2px;"></div> - -<!-- IF S_FOLDER_OPTIONS --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="2">{L_RENAME_FOLDER}</th> - </tr> - <tr> - <td class="row1" width="200"><b class="gen">{L_RENAME_FOLDER}{L_COLON} </b></td> - <td class="row1"><select name="rename_folder_id">{S_FOLDER_OPTIONS}</select></td> - </tr> - <tr> - <td class="row1" width="200"><b class="gen">{L_NEW_FOLDER_NAME}{L_COLON} </b></td> - <td class="row1"><input type="text" class="post" name="new_folder_name" size="30" maxlength="30" /></td> - </tr> - <tr> - <td class="row1" align="{S_CONTENT_FLOW_END}" colspan="2"><input class="btnlite" style="width:150px" type="submit" name="rename_folder" value="{L_RENAME}" /></td> - </tr> - </table> - - <div style="padding: 2px;"></div> -<!-- ENDIF --> - -<!-- IF not S_MAX_FOLDER_ZERO --> -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2">{L_ADD_FOLDER}</th> -</tr> -<!-- IF S_MAX_FOLDER_REACHED --> - <tr> - <td colspan="2">{L_MAX_FOLDER_REACHED}</td> - </tr> -<!-- ELSE --> - <tr> - <td class="row1" width="200"><b class="gen">{L_ADD_FOLDER}{L_COLON} </b></td> - <td class="row1"><input type="text" class="post" name="foldername" size="30" maxlength="30" /></td> - </tr> - <tr> - <td class="row1" align="{S_CONTENT_FLOW_END}" colspan="2"><input class="btnlite" style="width:150px" type="submit" name="addfolder" value="{L_ADD}" /></td> - </tr> -<!-- ENDIF --> -</table> -<!-- ENDIF --> - -<div style="padding: 2px;"></div> - -<!-- IF S_FOLDER_OPTIONS --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <th colspan="3">{L_REMOVE_FOLDER}</th> - </tr> - <tr> - <td class="row1" width="200"><b class="gen">{L_REMOVE_FOLDER}{L_COLON} </b></td> - <td class="row1"><select name="remove_folder_id">{S_FOLDER_OPTIONS}</select></td> - <td class="row1"><b class="genmed">{L_AND}</b></td> - </tr> - <tr> - <td class="row2" width="200"> </td> - <td class="row2" colspan="2"><input type="radio" class="radio" name="remove_action" value="1" checked="checked" /> <span class="genmed">{L_MOVE_DELETED_MESSAGES_TO} </span> <select name="move_to">{S_TO_FOLDER_OPTIONS}</select></td> - </tr> - <tr> - <td class="row2" width="200"> </td> - <td class="row2" colspan="2"><input type="radio" class="radio" name="remove_action" value="2" /> <span class="genmed">{L_DELETE_MESSAGES_IN_FOLDER}</span></td> - </tr> - <tr> - <td class="row2" width="200"> </td> - <td class="row2" colspan="2" align="{S_CONTENT_FLOW_END}"><input class="btnlite" style="width:150px" type="submit" name="remove_folder" value="{L_REMOVE}" /></td> - </tr> - </table> - - <div style="padding: 2px;"></div> -<!-- ENDIF --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2">{L_FOLDER_OPTIONS}</th> -</tr> -<tr> - <td class="row1" width="200"><span><b class="genmed">{L_IF_FOLDER_FULL}{L_COLON} </b></span></td> - <td class="row1"><input type="radio" class="radio" name="full_action" value="1"{S_DELETE_CHECKED} /> <span class="genmed">{L_DELETE_OLDEST_MESSAGES}</span></td> -</tr> -<tr> - <td class="row1" width="200"> </td> - <td class="row1"><input type="radio" class="radio" name="full_action" value="2"{S_MOVE_CHECKED} /> <span class="genmed">{L_MOVE_TO_FOLDER}{L_COLON} </span><select name="full_move_to">{S_FULL_FOLDER_OPTIONS}</select></td> -</tr> -<tr> - <td class="row1" width="200"> </td> - <td class="row1"><input type="radio" class="radio" name="full_action" value="3"{S_HOLD_CHECKED} /> <span class="genmed">{L_HOLD_NEW_MESSAGES}</span></td> -</tr> -<tr> - <td class="row2" width="200"><b class="genmed">{L_DEFAULT_ACTION}{L_COLON} </b><br /><span class="gensmall">{L_DEFAULT_ACTION_EXPLAIN}</span></td> - <td class="row2"><span class="genmed">{DEFAULT_ACTION}</span></td> -</tr> -<tr> - <td class="row1" colspan="2" align="{S_CONTENT_FLOW_END}"><input class="btnlite" style="width:150px" type="submit" name="fullfolder" value="{L_CHANGE}" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html b/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html deleted file mode 100644 index edcf553b84..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html +++ /dev/null @@ -1,131 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<div id="pagecontent"> - -<!-- IF not PROMPT --> - <!-- INCLUDE ucp_pm_message_header.html --> -<!-- ENDIF --> - -<div style="padding: 2px;"></div> - -<!-- IF S_PM_ICONS --> - <!-- DEFINE $COLSPAN = 6 --> -<!-- ELSE --> - <!-- DEFINE $COLSPAN = 5 --> -<!-- ENDIF --> - -<form name="viewfolder" method="post" action="{S_PM_ACTION}" style="margin:0px"> - -<!-- IF PROMPT --> - <table class="tablebg" width="100%" cellspacing="1" cellpadding="0" border="0"> - <tr> - <th colspan="2" valign="middle">{L_OPTIONS}</th> - </tr> - <tr> - <td class="row1" width="35%">{L_DELIMITER}{L_COLON} </td> - <td class="row2"><input class="post" type="text" name="delimiter" value="," /></td> - </tr> - <tr> - <td class="row1" width="35%">{L_ENCLOSURE}{L_COLON} </td> - <td class="row2"><input class="post" type="text" name="enclosure" value=""" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="hidden" name="export_option" value="CSV" /><input class="btnmain" type="submit" name="submit_export" value="{L_EXPORT_FOLDER}" /> <input class="btnlite" type="reset" value="Reset" name="reset" /></td> - </tr> - </table> - {S_FORM_TOKEN} - -</form> -<!-- ELSE --> - - <table class="tablebg" width="100%" cellspacing="1" cellpadding="0" border="0"> - <!-- IF NUM_NOT_MOVED or NUM_REMOVED --> - <tr> - <td class="row3" colspan="{$COLSPAN}" align="center"><span class="gen"> - <!-- IF NUM_REMOVED --> - {RULE_REMOVED_MESSAGES} - <!-- IF NUM_NOT_MOVED --><br /><!-- ENDIF --> - <!-- ENDIF --> - <!-- IF NUM_NOT_MOVED --> - {NOT_MOVED_MESSAGES}<br />{RELEASE_MESSAGE_INFO} - <!-- ENDIF --> - </span></td> - </tr> - <!-- ENDIF --> - <tr> - <th colspan="<!-- IF S_PM_ICONS -->3<!-- ELSE -->2<!-- ENDIF -->"> {L_SUBJECT} </th> - <th> <!-- IF S_SHOW_RECIPIENTS -->{L_RECIPIENTS}<!-- ELSE -->{L_AUTHOR}<!-- ENDIF --> </th> - <th> {L_SENT_AT} </th> - <th> {L_MARK} </th> - </tr> - - <!-- BEGIN messagerow --> - <tr> - <td class="row1" width="25" align="center" nowrap="nowrap">{messagerow.FOLDER_IMG}</td> - <!-- IF S_PM_ICONS --> - <td class="row1" width="25" align="center">{messagerow.PM_ICON_IMG}</td> - <!-- ENDIF --> - - <!-- IF messagerow.S_PM_DELETED --><td class="row3"><!-- ELSE --><td class="row1"><!-- ENDIF --> - <!-- IF not messagerow.PM_IMG and messagerow.PM_CLASS --> - <span class="{messagerow.PM_CLASS}" style="float: {S_CONTENT_FLOW_BEGIN};"><img src="images/spacer.gif" width="10" height="10" alt="" /></span> - <!-- ELSEIF messagerow.PM_IMG --> - {messagerow.PM_IMG} - <!-- ENDIF --> - - <span class="topictitle"> - {messagerow.ATTACH_ICON_IMG} - <!-- IF messagerow.S_PM_DELETED --> - {L_MESSAGE_REMOVED_FROM_OUTBOX}<br /> - <a href="{messagerow.U_REMOVE_PM}" style="float: {S_CONTENT_FLOW_END};">{L_DELETE_MESSAGE}</a> - <!-- ELSE --> - <a href="{messagerow.U_VIEW_PM}">{messagerow.SUBJECT}</a> - <!-- ENDIF --> - <!-- IF messagerow.S_PM_REPORTED --> - <a href="{messagerow.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a> - <!-- ENDIF --> - <!-- IF messagerow.S_AUTHOR_DELETED --> - <br /><em class="gensmall">{L_PM_FROM_REMOVED_AUTHOR}</em> - <!-- ENDIF --> - </span></td> - - <td class="row1" width="100" align="center"><p class="topicauthor"><!-- IF S_SHOW_RECIPIENTS -->{messagerow.RECIPIENTS}<!-- ELSE -->{messagerow.MESSAGE_AUTHOR_FULL}<!-- ENDIF --></p></td> - <td class="row1" width="120" align="center"><p class="topicdetails">{messagerow.SENT_TIME}</p></td> - <td class="row1" width="20" align="center"><p class="topicdetails"><input type="checkbox" class="radio" name="marked_msg_id[]" value="{messagerow.MESSAGE_ID}" /></p></td> - </tr> - <!-- BEGINELSE --> - <tr> - <td class="row1" colspan="{$COLSPAN}" height="30" align="center" valign="middle"><span class="gen"> - <!-- IF S_COMPOSE_PM_VIEW and S_NO_AUTH_SEND_MESSAGE --> - <!-- IF S_USER_NEW -->{L_USER_NEW_PERMISSION_DISALLOWED}<!-- ELSE -->{L_NO_AUTH_SEND_MESSAGE}<!-- ENDIF --> - <!-- ELSE --> - {L_NO_MESSAGES} - <!-- ENDIF --> - </span></td> - </tr> - <!-- END messagerow --> -</table> - -<input type="hidden" name="cur_folder_id" value="{CUR_FOLDER_ID}" /> - -<table border="0" cellspacing="0" cellpadding="0" width="100%"> -<tr> - <td class="cat"> -<!-- IF .messagerow --> - <div style="float: {S_CONTENT_FLOW_BEGIN};"><select name="export_option"><option value="CSV">{L_EXPORT_AS_CSV}</option><option value="CSV_EXCEL">{L_EXPORT_AS_CSV_EXCEL}</option><option value="XML">{L_EXPORT_AS_XML}</option></select> <input class="btnlite" type="submit" name="submit_export" value="{L_EXPORT_FOLDER}" /></div> - <div style="float: {S_CONTENT_FLOW_END};"><select name="mark_option">{S_MARK_OPTIONS}{S_MOVE_MARKED_OPTIONS}</select> <input class="btnlite" type="submit" name="submit_mark" value="{L_GO}" /> </div> -<!-- ENDIF --> - </td> -</tr> -</table> - -<div style="padding: 2px;"></div> -<!-- INCLUDE ucp_pm_message_footer.html --> - -<!-- ENDIF --> - -<br clear="all" /> - -</div> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html deleted file mode 100644 index be1e27c5f3..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html +++ /dev/null @@ -1,124 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<div id="pagecontent"> - -<!-- INCLUDE ucp_pm_message_header.html --> -<div style="padding: 2px;"></div> - -<table class="tablebg" width="100%" cellspacing="1" cellpadding="4"> - -<tr class="row1"> - <td class="genmed" nowrap="nowrap" width="150"><b>{L_PM_SUBJECT}{L_COLON}</b></td> - <td class="gen">{SUBJECT}</td> -</tr> - -<tr class="row1"> - <td class="genmed" nowrap="nowrap" width="150"><b>{L_PM_FROM}{L_COLON}</b></td> - <td class="gen">{MESSAGE_AUTHOR_FULL}</td> -</tr> - -<tr class="row1"> - <td class="genmed" nowrap="nowrap" width="150"><b>{L_SENT_AT}{L_COLON}</b></td> - <td class="gen">{SENT_DATE}</td> -</tr> - -<!-- IF S_TO_RECIPIENT --> - <tr class="row1"> - <td class="genmed" nowrap="nowrap" width="150"><b>{L_TO}{L_COLON}</b></td> - <td class="gen"> - <!-- BEGIN to_recipient --> - <!-- IF to_recipient.IS_GROUP --><span class="sep"><a href="{to_recipient.U_VIEW}">{to_recipient.NAME}</a></span><!-- ELSE -->{to_recipient.NAME_FULL} <!-- ENDIF --> - <!-- END to_recipient --> - </td> - </tr> -<!-- ENDIF --> - -<!-- IF S_BCC_RECIPIENT --> - <tr class="row1"> - <td class="genmed" nowrap="nowrap" width="150"><b>{L_BCC}{L_COLON}</b></td> - <td class="gen"> - <!-- BEGIN bcc_recipient --> - <!-- IF bcc_recipient.IS_GROUP --><span class="sep"><a href="{bcc_recipient.U_VIEW}">{bcc_recipient.NAME}</a></span><!-- ELSE -->{bcc_recipient.NAME_FULL} <!-- ENDIF --> - <!-- END bcc_recipient --> - </td> - </tr> -<!-- ENDIF --> -</table> - -<div style="padding: 2px;"></div> - -<table class="tablebg" width="100%" cellspacing="1" cellpadding="0"> - -<tr> - <th nowrap="nowrap">{L_MESSAGE}</th> -</tr> - -<tr> - <td class="spacer" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> -</tr> - -<tr class="row1"> - <td valign="top"> - <table width="100%" cellspacing="5"> - <tr> - <td> - <div class="postbody">{MESSAGE}</div> - - <!-- IF S_HAS_ATTACHMENTS --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <td class="row2">{attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - - <!-- IF S_DISPLAY_NOTICE --> - <span class="gensmall error"><br /><br />{L_DOWNLOAD_NOTICE}</span> - <!-- ENDIF --> - <!-- IF SIGNATURE --> - <span class="postbody"><br />_________________<br />{SIGNATURE}</span> - <!-- ENDIF --> - <!-- IF EDITED_MESSAGE --> - <span class="gensmall">{EDITED_MESSAGE}</span> - <!-- ENDIF --> - - <!-- IF not S_HAS_ATTACHMENTS --><br clear="all" /><br /><!-- ENDIF --> - - <table width="100%" cellspacing="0"> - <tr valign="middle"> - <td class="gensmall" align="{S_CONTENT_FLOW_END}"> <!-- IF U_REPORT --><a href="{U_REPORT}" class="imageset">{REPORT_IMG}</a> <!-- ENDIF --><!-- IF U_DELETE --><a href="{U_DELETE}" class="imageset">{DELETE_IMG}</a> <!-- ENDIF --></td> - </tr> - </table> - - </td> - </tr> - </table> - </td> -</tr> - -<tr class="row1"> - <td><div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"> <!-- IF U_MESSAGE_AUTHOR --><a href="{U_MESSAGE_AUTHOR}" class="imageset">{PROFILE_IMG}</a> <!-- ENDIF --> <!-- IF U_EMAIL --><a href="{U_EMAIL}" class="imageset">{EMAIL_IMG}</a> <!-- ENDIF --> </div> <div class="gensmall" style="float: {S_CONTENT_FLOW_END};"><!-- IF U_EDIT --><a href="{U_EDIT}" class="imageset">{EDIT_IMG}</a> <!-- ENDIF --> <!-- IF U_QUOTE --><a href="{U_QUOTE}" class="imageset">{QUOTE_IMG}</a> <!-- ENDIF --> <!-- IF U_POST_REPLY_PM --><a href="{U_POST_REPLY_PM}" class="imageset">{REPLY_IMG}</a><!-- ENDIF --> </div></td> -</tr> - -<tr> - <td class="spacer" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> -</tr> -</table> - -<div style="padding: 2px;"></div> -<!-- INCLUDE ucp_pm_message_footer.html --> - -<br clear="all" /> - -</div> - -<!-- IF S_DISPLAY_HISTORY --><!-- INCLUDE ucp_pm_history.html --><!-- ENDIF --> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html deleted file mode 100644 index abe6199d71..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html +++ /dev/null @@ -1,121 +0,0 @@ -<!DOCTYPE html> -<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> -<head> -<meta charset="utf-8"> -<meta name="robots" content="noindex" /> -<title>{SITENAME} :: {PAGE_TITLE}</title> - -<style type="text/css"> -<!-- - -body { - font-family: Verdana,serif; - font-size: 10pt; -} - -td { - font-family: Verdana,serif; - font-size: 10pt; - line-height: 150%; -} - -.code, -.quote { - font-size: smaller; - border: black solid 1px; -} - -.forum { - font-family: Arial,Helvetica,sans-serif; - font-weight: bold; - font-size: 18pt; -} - -.topic { - font-family: Arial,Helvetica,sans-serif; - font-size: 14pt; - font-weight: bold; -} - -.gensmall { - font-size: 8pt; -} - -hr { - color: #888; - height: 3px; - border-style: solid; -} - -hr.sep { - color: #aaa; - height: 1px; - border-style: dashed; -} -//--> -</style> -<!-- EVENT ucp_pm_viewmessage_print_head_append --> -</head> -<body> - -<table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> -<tr> - <td colspan="2" align="center"><span class="Forum">{SITENAME}</span><br /><span class="gensmall">{L_PRIVATE_MESSAGING}</span></td> -</tr> -<tr> - <td colspan="2"><br /></td> -</tr> -<tr> - <td><span class="topic">{SUBJECT}</span><br /></td> - <td align="{S_CONTENT_FLOW_END}" valign="bottom"><span class="gensmall">{PAGE_NUMBER}</span></td> -</tr> -</table> - -<hr width="85%" /> - -<table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> -<tr> - <td width="10%" nowrap="nowrap">{L_PM_FROM}{L_COLON} </td> - <td><b>{MESSAGE_AUTHOR}</b> [ {SENT_DATE} ]</td> -</tr> - -<!-- IF S_TO_RECIPIENT --> - <tr> - <td width="10%" nowrap="nowrap">{L_TO}{L_COLON}</td> - <td> - <!-- BEGIN to_recipient --> - <span<!-- IF to_recipient.IS_GROUP --> class="sep"<!-- ENDIF -->>{to_recipient.NAME}</span> - <!-- END to_recipient --> - </td> - </tr> -<!-- ENDIF --> - -<!-- IF S_BCC_RECIPIENT --> - <tr> - <td width="10%" nowrap="nowrap">{L_BCC}{L_COLON}</td> - <td> - <!-- BEGIN bcc_recipient --> - <!-- IF bcc_recipient.COLOUR --><span style="color:{bcc_recipient.COLOUR}"><!-- ELSE --><span<!-- IF bcc_recipient.IS_GROUP --> class="sep"<!-- ENDIF -->><!-- ENDIF -->{bcc_recipient.NAME}</span> - <!-- END bcc_recipient --> - </td> - </tr> -<!-- ENDIF --> -<tr> - <td colspan="2"><hr class="sep" />{MESSAGE}</td> -</tr> -</table> - -<hr width="85%" /> - -<table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> -<tr> - <td><span class="gensmall">{PAGE_NUMBER}</span></td> - <td align="{S_CONTENT_FLOW_END}"><span class="gensmall">{S_TIMEZONE}</span></td> -</tr> -<tr> - <td colspan="2" align="center"><span class="gensmall">Powered by phpBB® Forum Software © phpBB Group<br />https://www.phpbb.com/</span></td> -</tr> -</table> - -</body> -</html> diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html deleted file mode 100644 index cd5fc9a13f..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html +++ /dev/null @@ -1,85 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<script type="text/javascript"> -// <![CDATA[ - /** - * Set display of page element - * s[-1,0,1] = hide,toggle display,show - */ - function dE(n,s) - { - var e = document.getElementById(n); - if (!s) - { - s = (e.style.display == '') ? -1 : 1; - } - e.style.display = (s == 1) ? 'block' : 'none'; - } - - var default_dateformat = '{A_DEFAULT_DATEFORMAT}'; -// ]]> -</script> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<!-- EVENT ucp_prefs_personal_prepend --> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_SHOW_EMAIL}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="viewemail" value="1"<!-- IF S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="viewemail" value="0"<!-- IF not S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_ADMIN_EMAIL}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="massemail" value="1"<!-- IF S_MASS_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="massemail" value="0"<!-- IF not S_MASS_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_ALLOW_PM}{L_COLON}</b><br /><span class="gensmall">{L_ALLOW_PM_EXPLAIN}</span></td> - <td class="row2"><input type="radio" class="radio" name="allowpm" value="1"<!-- IF S_ALLOW_PM --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="allowpm" value="0"<!-- IF not S_ALLOW_PM --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td> -</tr> -<!-- IF S_CAN_HIDE_ONLINE --> - <tr> - <td class="row1" width="50%"><b class="genmed">{L_HIDE_ONLINE}{L_COLON}</b><br /><span class="gensmall">{L_HIDE_ONLINE_EXPLAIN}</span></td> - <td class="row2"><input type="radio" class="radio" name="hideonline" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="hideonline" value="0"<!-- IF not S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td> - </tr> -<!-- ENDIF --> -<!-- IF S_SELECT_NOTIFY --> - <tr> - <td class="row1" width="50%"><b class="genmed">{L_NOTIFY_METHOD}{L_COLON}</b><br /><span class="gensmall">{L_NOTIFY_METHOD_EXPLAIN}</span></td> - <td class="row2"><input type="radio" class="radio" name="notifymethod" value="0"<!-- IF S_NOTIFY_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NOTIFY_METHOD_EMAIL}</span> <input type="radio" class="radio" name="notifymethod" value="1"<!-- IF S_NOTIFY_IM --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NOTIFY_METHOD_IM}</span> <input type="radio" class="radio" name="notifymethod" value="2"<!-- IF S_NOTIFY_BOTH --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NOTIFY_METHOD_BOTH}</span></td> - </tr> -<!-- ENDIF --> -<!-- IF S_MORE_LANGUAGES --> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_BOARD_LANGUAGE}{L_COLON}</b></td> - <td class="row2"><select name="lang">{S_LANG_OPTIONS}</select></td> -</tr> -<!-- ENDIF --> -<!-- IF S_STYLE_OPTIONS and S_MORE_STYLES --> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_BOARD_STYLE}{L_COLON}</b></td> - <td class="row2"><select name="style">{S_STYLE_OPTIONS}</select></td> -</tr> -<!-- ENDIF --> -<!-- INCLUDE timezone_option.html --> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_BOARD_DATE_FORMAT}{L_COLON}</b><br /><span class="gensmall">{L_BOARD_DATE_FORMAT_EXPLAIN}</span></td> - <td class="row2"> - <select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){dE('custom_date',1);}else{dE('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }"> - {S_DATEFORMAT_OPTIONS} - </select> - <div id="custom_date"<!-- IF not S_CUSTOM_DATEFORMAT --> style="display:none;"<!-- ENDIF -->><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="post" style="margin-top: 3px;" /></div> - </td> -</tr> -<!-- EVENT ucp_prefs_personal_append --> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_post.html b/phpBB/styles/subsilver2/template/ucp_prefs_post.html deleted file mode 100644 index 0a558b863c..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_prefs_post.html +++ /dev/null @@ -1,35 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<!-- EVENT ucp_prefs_post_prepend --> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_DEFAULT_BBCODE}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="bbcode" value="1"<!-- IF S_BBCODE --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="bbcode" value="0"<!-- IF not S_BBCODE --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_DEFAULT_SMILIES}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="smilies" value="1"<!-- IF S_SMILIES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="smilies" value="0"<!-- IF not S_SMILIES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_DEFAULT_ADD_SIG}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="sig" value="1"<!-- IF S_SIG --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="sig" value="0"<!-- IF not S_SIG --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_DEFAULT_NOTIFY}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="notify" value="1"<!-- IF S_NOTIFY --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="notify" value="0"<!-- IF not S_NOTIFY --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<!-- EVENT ucp_prefs_post_append --> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_view.html b/phpBB/styles/subsilver2/template/ucp_prefs_view.html deleted file mode 100644 index c10c458627..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_prefs_view.html +++ /dev/null @@ -1,77 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<!-- EVENT ucp_prefs_view_radio_buttons_prepend --> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_IMAGES}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="images" value="1"<!-- IF S_IMAGES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="images" value="0"<!-- IF not S_IMAGES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_FLASH}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="flash" value="1"<!-- IF S_FLASH --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="flash" value="0"<!-- IF not S_FLASH --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_SMILIES}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="smilies" value="1"<!-- IF S_SMILIES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="smilies" value="0"<!-- IF not S_SMILIES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_SIGS}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="sigs" value="1"<!-- IF S_SIGS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="sigs" value="0"<!-- IF not S_SIGS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_AVATARS}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="avatars" value="1"<!-- IF S_AVATARS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="avatars" value="0"<!-- IF not S_AVATARS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> -</tr> -<!-- IF S_CHANGE_CENSORS --> - <tr> - <td class="row1" width="50%"><b class="genmed">{L_DISABLE_CENSORS}{L_COLON}</b></td> - <td class="row2"><input type="radio" class="radio" name="wordcensor" value="1"<!-- IF S_DISABLE_CENSORS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span> <input type="radio" class="radio" name="wordcensor" value="0"<!-- IF not S_DISABLE_CENSORS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td> - </tr> -<!-- ENDIF --> -<!-- EVENT ucp_prefs_view_radio_buttons_append --> -<tr> - <td colspan="2" class="spacer"></td> -</tr> -<!-- EVENT ucp_prefs_view_select_menu_prepend --> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DAYS}{L_COLON}</b></td> - <td class="row2">{S_TOPIC_SORT_DAYS}</td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_KEY}{L_COLON}</b></td> - <td class="row2">{S_TOPIC_SORT_KEY}</td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DIR}{L_COLON}</b></td> - <td class="row2">{S_TOPIC_SORT_DIR}</td> -</tr> -<tr> - <td colspan="2" class="spacer"></td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_DAYS}{L_COLON}</b></td> - <td class="row2">{S_POST_SORT_DAYS}</td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_KEY}{L_COLON}</b></td> - <td class="row2">{S_POST_SORT_KEY}</td> -</tr> -<tr> - <td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_DIR}{L_COLON}</b></td> - <td class="row2">{S_POST_SORT_DIR}</td> -</tr> -<!-- EVENT ucp_prefs_view_select_menu_append --> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_autologin_keys.html b/phpBB/styles/subsilver2/template/ucp_profile_autologin_keys.html deleted file mode 100644 index 1dab9acb9c..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_profile_autologin_keys.html +++ /dev/null @@ -1,49 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="4" valign="middle">{L_TITLE}</th> -</tr> -<!-- IF .errors --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error"> - <!-- BEGIN errors --> - {errors} <br /> - <!-- END errors --> - </td> - </tr> -<!-- ENDIF --> - -<tr> - <td colspan="4" class="row1">{L_PROFILE_AUTOLOGIN_KEYS}</td> -</tr> -<tr> - <th>{L_MARK}</th> - <th>{L_LOGIN_KEY}</th> - <th>{L_IP}</th> - <th>{L_LOGIN_TIME}</th> -</tr> -<!-- BEGIN sessions --> - <!-- IF sessions.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td class="genmed" style="text-align: center"><input type="checkbox" name="keys[]" value="{sessions.KEY}" id="{sessions.KEY}"/></td> - <td class="genmed"><label for="{sessions.KEY}">{sessions.KEY}</label></td> - <td class="genmed" style="text-align: center">{sessions.IP}</td> - <td class="genmed" style="text-align: center">{sessions.LOGIN_TIME}</td> - </tr> -<!-- BEGINELSE --> - <tr> - <td colspan="4" class="row1" style="text-align: center">{L_PROFILE_NO_AUTOLOGIN_KEYS}</td> - </tr> -<!-- END sessions --> - -<!-- IF .sessions --> - <tr> - <td class="cat" colspan="4" align="center"> - {S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_DELETE}" /> - {S_FORM_TOKEN} - </td> - </tr> -<!-- ENDIF --> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html deleted file mode 100644 index 60a816d00a..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html +++ /dev/null @@ -1,53 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_CURRENT_IMAGE}{L_COLON} </b><br /><span class="gensmall">{L_AVATAR_EXPLAIN}</span></td> - <td class="row2" align="center"><br /> - <!-- IF AVATAR -->{AVATAR}<br /><br /><input type="checkbox" class="radio" name="avatar_delete" /> <span class="gensmall">{L_DELETE_AVATAR}</span> - <!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /> - <!-- ENDIF --></td> -</tr> -<!-- IF not S_AVATARS_ENABLED --> - <tr> - <td class="row3" colspan="2" align="center">{L_AVATAR_FEATURES_DISABLED}</td> - </tr> -<!-- ENDIF --> - <tr> - <th colspan="2">{L_AVATAR_SELECT}</th> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_AVATAR_TYPE}{L_COLON}</b></td> - <td class="row2"> - <select name="avatar_driver" id="avatar_driver"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> - <!-- BEGIN avatar_drivers --> - <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_drivers.L_TITLE}</option> - <!-- END avatar_drivers --> - </select></td> - </tr> -<!-- BEGIN avatar_drivers --> - <tr class="avatar_option_{avatar_drivers.DRIVER}"> - <td class="row1" width="35%" colspan="2"><noscript><b class="genmed">{avatar_drivers.L_TITLE} </b><br /></noscript>{avatar_drivers.L_EXPLAIN}</span></td> - </tr> - <tr class="avatar_option_{avatar_drivers.DRIVER}"> - <td colspan="2" style="padding: 0">{avatar_drivers.OUTPUT}</td> - </tr> -<!-- END avatar_drivers --> - - <tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <!-- IF S_IN_AVATAR_GALLERY --><input class="btnlite" type="submit" name="cancel" value="{L_CANCEL}" /><!-- ELSE --><input class="btnlite" type="reset" value="{L_RESET}" name="reset" /><!-- ENDIF --></td> - </tr> -</table> - -<!-- INCLUDEJS avatars.js --> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_profile_info.html b/phpBB/styles/subsilver2/template/ucp_profile_profile_info.html deleted file mode 100644 index a565cac5ce..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_profile_profile_info.html +++ /dev/null @@ -1,60 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1" colspan="2"><span class="gensmall">{L_PROFILE_INFO_NOTICE}</span></td> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_UCP_ICQ}{L_COLON} </b></td> - <td class="row2"><input class="post" type="text" name="icq" size="30" maxlength="15" value="{ICQ}" /></td> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_UCP_AIM}{L_COLON} </b></td> - <td class="row2"><input class="post" type="text" name="aim" size="30" maxlength="255" value="{AIM}" /></td> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_UCP_MSNM}{L_COLON} </b></td> - <td class="row2"><input class="post" type="email" name="msn" size="30" maxlength="255" value="{MSN}" /></td> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_UCP_YIM}{L_COLON} </b></td> - <td class="row2"><input class="post" type="email" name="yim" size="30" maxlength="255" value="{YIM}" /></td> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_UCP_JABBER}{L_COLON} </b></td> - <td class="row2"><input class="post" type="text" name="jabber" size="30" maxlength="255" value="{JABBER}" /></td> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_WEBSITE}{L_COLON} </b></td> - <td class="row2"><input class="post" type="url" name="website" size="30" maxlength="255" value="{WEBSITE}" /></td> -</tr> -<!-- IF S_BIRTHDAYS_ENABLED --> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_BIRTHDAY}{L_COLON} </b><br /><span class="gensmall">{L_BIRTHDAY_EXPLAIN}</span></td> - <td class="row2"><span class="genmed">{L_DAY}{L_COLON}</span> <select name="bday_day">{S_BIRTHDAY_DAY_OPTIONS}</select> <span class="genmed">{L_MONTH}{L_COLON}</span> <select name="bday_month">{S_BIRTHDAY_MONTH_OPTIONS}</select> <span class="genmed">{L_YEAR}{L_COLON}</span> <select name="bday_year">{S_BIRTHDAY_YEAR_OPTIONS}</select></td> - </tr> -<!-- ENDIF --> -<!-- BEGIN profile_fields --> - <tr> - <td class="row1" width="35%"> - <b class="genmed">{profile_fields.LANG_NAME}{L_COLON} </b> - <!-- IF profile_fields.S_REQUIRED --><b>*</b><!-- ENDIF --> - <!-- IF profile_fields.LANG_EXPLAIN --><br /><span class="gensmall">{profile_fields.LANG_EXPLAIN}</span><!-- ENDIF --> - </td> - <td class="row2">{profile_fields.FIELD}<!-- IF profile_fields.ERROR --><br /><span class="gensmall error">{profile_fields.ERROR}</span><!-- ENDIF --></td> - </tr> -<!-- END profile_fields --> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html deleted file mode 100644 index d8fe84bf79..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html +++ /dev/null @@ -1,47 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<!-- IF S_FORCE_PASSWORD --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{L_FORCE_PASSWORD_EXPLAIN}</span></td> - </tr> -<!-- ENDIF --> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_USERNAME}{L_COLON} </b><br /><span class="gensmall">{L_USERNAME_EXPLAIN}</span></td> - <td class="row2"><!-- IF S_CHANGE_USERNAME --><input type="text" class="post" name="username" size="30" value="{USERNAME}" /><!-- ELSE --><b class="gen">{USERNAME}</b><!-- ENDIF --></td> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_EMAIL_ADDRESS}{L_COLON} </b></td> - <td class="row2"><!-- IF S_CHANGE_EMAIL --><input type="email" class="post" name="email" size="30" maxlength="100" value="{EMAIL}" /><!-- ELSE --><b class="gen">{EMAIL}</b><!-- ENDIF --></td> -</tr> -<!-- IF S_CHANGE_PASSWORD --> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_NEW_PASSWORD}{L_COLON} </b><br /><span class="gensmall">{L_CHANGE_PASSWORD_EXPLAIN}</span></td> - <td class="row2"><input type="password" class="post" name="new_password" size="30" maxlength="255" value="{NEW_PASSWORD}" /></td> - </tr> - <tr> - <td class="row1" width="35%"><b class="genmed">{L_CONFIRM_PASSWORD}{L_COLON} </b><br /><span class="gensmall">{L_CONFIRM_PASSWORD_EXPLAIN}</span></td> - <td class="row2"><input type="password" class="post" name="password_confirm" size="30" maxlength="255" value="{PASSWORD_CONFIRM}" /></td> - </tr> -<!-- ENDIF --> -<tr> - <th colspan="2">{L_CONFIRM_CHANGES}</th> -</tr> -<tr> - <td class="row1" width="35%"><b class="genmed">{L_CURRENT_PASSWORD}{L_COLON} </b><br /><span class="gensmall"><!-- IF S_CHANGE_PASSWORD -->{L_CURRENT_CHANGE_PASSWORD_EXPLAIN}<!-- ELSE -->{L_CURRENT_PASSWORD_EXPLAIN}<!-- ENDIF --></span></td> - <td class="row2"><input type="password" class="post" name="cur_password" size="30" maxlength="255" value="{CUR_PASSWORD}" /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_signature.html b/phpBB/styles/subsilver2/template/ucp_profile_signature.html deleted file mode 100644 index 5a2690edda..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_profile_signature.html +++ /dev/null @@ -1,132 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<script type="text/javascript"> -// <![CDATA[ - var form_name = 'ucp'; - var text_name = 'signature'; -// ]]> -</script> - -<!-- DEFINE $S_SIGNATURE = 1 --> -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2">{L_TITLE}</th> -</tr> -<!-- IF not S_SMILIES_ALLOWED --> -<tr> - <td colspan="2" class="row1">{L_SIGNATURE_EXPLAIN}</td> -</tr> -<!-- ENDIF --> - -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> - -<tr> - <!-- IF S_SMILIES_ALLOWED --> - <td class="row1" width="22%" valign="top"> - {L_SIGNATURE_EXPLAIN} - <table width="100%" cellspacing="5" cellpadding="0" border="0" align="center"> - <tr> - <td class="gensmall" align="center"><b>{L_SMILIES}</b></td> - </tr> - <tr> - <td align="center"> - <!-- BEGIN smiley --> - <a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;" style="line-height: 20px;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" hspace="2" vspace="2" /></a> - <!-- END smiley --> - </td> - </tr> - <!-- IF S_SHOW_SMILEY_LINK --> - <tr> - <td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a></td> - </tr> - <!-- ENDIF --> - </table> - </td> - <td class="row2"> - <!-- ELSE --> - <td class="row2" colspan="2"> - <!-- ENDIF --> - - <table cellspacing="0" cellpadding="2" border="0" width="99%"> - <!-- INCLUDE posting_buttons.html --> - <tr> - <td colspan="2"><textarea class="post" name="signature" rows="10" cols="76" style="width: 90%;" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();">{SIGNATURE}</textarea></td> - </tr> - <!-- IF S_BBCODE_ALLOWED --> - <tr> - <td colspan="2"> - <table cellspacing="0" cellpadding="0" border="0" width="100%"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}" id="color_palette_placeholder" data-orientation="h" data-width="11" data-height="10"> - </td> - </tr> - </table> - </td> - </tr> - <!-- ENDIF --> - </table> - </td> -</tr> -<tr> - <td class="row1" valign="top"><b class="genmed">{L_OPTIONS}</b><br /> - <table cellspacing="2" cellpadding="0" border="0"> - <tr> - <td class="gensmall">{BBCODE_STATUS}</td> - </tr> - <tr> - <td class="gensmall">{IMG_STATUS}</td> - </tr> - <tr> - <td class="gensmall">{FLASH_STATUS}</td> - </tr> - <tr> - <td class="gensmall">{URL_STATUS}</td> - </tr> - <tr> - <td class="gensmall">{SMILIES_STATUS}</td> - </tr> - </table> - </td> - <td class="row2" valign="top"> - <table cellspacing="0" cellpadding="1" border="0"> - <!-- IF S_BBCODE_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="disable_bbcode"{S_BBCODE_CHECKED} /></td> - <td class="gen">{L_DISABLE_BBCODE}</td> - </tr> - <!-- ENDIF --> - <!-- IF S_SMILIES_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="disable_smilies"{S_SMILIES_CHECKED} /></td> - <td class="gen">{L_DISABLE_SMILIES}</td> - </tr> - <!-- ENDIF --> - <!-- IF S_LINKS_ALLOWED --> - <tr> - <td><input type="checkbox" class="radio" name="disable_magic_url"{S_MAGIC_URL_CHECKED} /></td> - <td class="gen">{L_DISABLE_MAGIC_URL}</td> - </tr> - <!-- ENDIF --> - </table> - </td> -</tr> - -<!-- IF SIGNATURE_PREVIEW != '' --> - <tr> - <th colspan="2" valign="middle">{L_SIGNATURE_PREVIEW}</th> - </tr> - <tr> - <td class="row1" colspan="2"><div class="postbody" style="padding: 6px;">{SIGNATURE_PREVIEW}</div></td> - </tr> -<!-- ENDIF --> - -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnlite" type="submit" name="preview" value="{L_PREVIEW}" /> <input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html deleted file mode 100644 index 3392c557a2..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ /dev/null @@ -1,96 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<script type="text/javascript"> -// <![CDATA[ - /** - * Change language - */ - function change_language(lang_iso) - { - document.forms['register'].change_lang.value = lang_iso; - document.forms['register'].submit.click(); - } - -// ]]> -</script> - -<form name="register" method="post" action="{S_UCP_ACTION}"> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_REGISTRATION}</th> -</tr> - -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> - -<!-- IF L_REG_COND --> - <tr> - <td class="row2" colspan="2"><span class="gensmall">{L_REG_COND}</span></td> - </tr> -<!-- ENDIF --> - -<tr> - <td class="row1" width="38%"><b class="genmed">{L_USERNAME}{L_COLON} </b><br /><span class="gensmall">{L_USERNAME_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="text" name="username" size="25" value="{USERNAME}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_EMAIL_ADDRESS}{L_COLON} </b></td> - <td class="row2"><input class="post" type="email" name="email" size="25" maxlength="100" value="{EMAIL}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_PASSWORD}{L_COLON} </b><br /><span class="gensmall">{L_PASSWORD_EXPLAIN}</span></td> - <td class="row2"><input class="post" type="password" name="new_password" size="25" value="{PASSWORD}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_CONFIRM_PASSWORD}{L_COLON} </b></td> - <td class="row2"><input class="post" type="password" name="password_confirm" size="25" value="{PASSWORD_CONFIRM}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_LANGUAGE}{L_COLON} </b></td> - <td class="row2"><select name="lang" onchange="change_language(this.value); return false;">{S_LANG_OPTIONS}</select></td> -</tr> - -<!-- INCLUDE timezone_option.html --> - -<!-- IF .profile_fields --> - <tr> - <td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td> - </tr> -<!-- BEGIN profile_fields --> - <tr> - <td class="row1" width="35%"> - <b class="genmed">{profile_fields.LANG_NAME}{L_COLON} </b> - <!-- IF profile_fields.S_REQUIRED --><b>*</b><!-- ENDIF --> - <!-- IF profile_fields.LANG_EXPLAIN --><br /><span class="gensmall">{profile_fields.LANG_EXPLAIN}</span><!-- ENDIF --> - </td> - <td class="row2">{profile_fields.FIELD}<!-- IF profile_fields.ERROR --><br /><span class="gensmall error">{profile_fields.ERROR}</span><!-- ENDIF --></td> - </tr> - -<!-- END profile_fields --> -<!-- ENDIF --> - - <!-- IF CAPTCHA_TEMPLATE --> - <!-- INCLUDE {CAPTCHA_TEMPLATE} --> - <!-- ENDIF --> - -<!-- IF S_COPPA --> - <tr> - <th colspan="2" valign="middle">{L_COPPA_COMPLIANCE}</th> - </tr> - <tr> - <td class="row3" colspan="2"><span class="gensmall">{L_COPPA_EXPLAIN}</span></td> - </tr> -<!-- ENDIF --> - -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" id="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_remind.html b/phpBB/styles/subsilver2/template/ucp_remind.html deleted file mode 100644 index f7fde4b3be..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_remind.html +++ /dev/null @@ -1,28 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div align="center"> - -<form action="{S_PROFILE_ACTION}" method="post"> - -<table class="tablebg" width="50%" cellspacing="1" cellpadding="4" border="0"> -<tr> - <th colspan="2">{L_SEND_PASSWORD}</th> -</tr> -<tr> - <td class="row1" width="38%"><b class="genmed">{L_USERNAME}{L_COLON} </b></td> - <td class="row2"><input type="text" class="post" name="username" size="25" value="{USERNAME}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_EMAIL_ADDRESS}{L_COLON} </b><br /><span class="gensmall">{L_EMAIL_REMIND}</span></td> - <td class="row2"><input type="email" class="post" name="email" size="25" maxlength="100" value="{EMAIL}" /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="btnmain" /> <input type="reset" value="{L_RESET}" name="reset" class="btnlite" /></td> -</tr> -</table> -{S_FORM_TOKEN} -</form> - -</div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_resend.html b/phpBB/styles/subsilver2/template/ucp_resend.html deleted file mode 100644 index 62e7e96d6b..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_resend.html +++ /dev/null @@ -1,29 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<div align="center"> - -<form action="{S_PROFILE_ACTION}" method="post"> - -<table class="tablebg" width="50%" cellspacing="1" cellpadding="4" border="0"> -<tr> - <th colspan="2">{L_UCP_RESEND}</th> -</tr> -<tr> - <td class="row1" width="38%"><b class="genmed">{L_USERNAME}{L_COLON} </b></td> - <td class="row2"><input type="text" class="post" name="username" size="25" value="{USERNAME}" /></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_EMAIL_ADDRESS}{L_COLON} </b><br /><span class="gensmall">{L_EMAIL_REMIND}</span></td> - <td class="row2"><input type="email" class="post" name="email" size="25" maxlength="100" value="{EMAIL}" /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="btnmain" /> <input type="reset" value="{L_RESET}" name="reset" class="btnlite" /></td> -</tr> -</table> -{S_FORM_TOKEN} - -</form> - -</div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_zebra_foes.html b/phpBB/styles/subsilver2/template/ucp_zebra_foes.html deleted file mode 100644 index 6149a80e69..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_zebra_foes.html +++ /dev/null @@ -1,28 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<tr> - <td class="row3" colspan="2"><span class="gensmall">{L_FOES_EXPLAIN}</span></td> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1" width="40%"><b class="genmed">{L_YOUR_FOES}{L_COLON}</b><br /><span class="gensmall">{L_YOUR_FOES_EXPLAIN}</span></td> - <td class="row2" align="center"><!-- IF S_USERNAME_OPTIONS --><select name="usernames[]" multiple="multiple" size="5">{S_USERNAME_OPTIONS}</select><!-- ELSE --><b class="genmed">{L_NO_FOES}</b><!-- ENDIF --></td> -</tr> -<tr> - <td class="row1"><b class="genmed">{L_ADD_FOES}{L_COLON}</b><br /><span class="gensmall">{L_ADD_FOES_EXPLAIN} [ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span></td> - <td class="row2" align="center"><textarea name="add" rows="5" cols="30">{USERNAMES}</textarea><br /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_zebra_friends.html b/phpBB/styles/subsilver2/template/ucp_zebra_friends.html deleted file mode 100644 index 3e18af9969..0000000000 --- a/phpBB/styles/subsilver2/template/ucp_zebra_friends.html +++ /dev/null @@ -1,30 +0,0 @@ -<!-- INCLUDE ucp_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th colspan="2" valign="middle">{L_TITLE}</th> -</tr> -<!-- EVENT ucp_friend_list_before --> -<tr> - <td class="row3" colspan="2"><span class="gensmall">{L_FRIENDS_EXPLAIN}</span></td> -</tr> -<!-- IF ERROR --> - <tr> - <td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td> - </tr> -<!-- ENDIF --> -<tr> - <td class="row1" width="40%"><b class="genmed">{L_YOUR_FRIENDS}{L_COLON}</b><br /><span class="gensmall">{L_YOUR_FRIENDS_EXPLAIN}</span></td> - <td class="row2" align="center"><!-- IF S_USERNAME_OPTIONS --><select name="usernames[]" multiple="multiple" size="5">{S_USERNAME_OPTIONS}</select><!-- ELSE --><b class="genmed">{L_NO_FRIENDS}</b><!-- ENDIF --></td> -</tr> -<!-- EVENT ucp_friend_list_after --> -<tr> - <td class="row1"><b class="genmed">{L_ADD_FRIENDS}{L_COLON}</b><br /><span class="gensmall">{L_ADD_FRIENDS_EXPLAIN} [ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span></td> - <td class="row2" align="center"><textarea name="add" rows="5" cols="30">{USERNAMES}</textarea><br /></td> -</tr> -<tr> - <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> -</tr> -</table> - -<!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html deleted file mode 100644 index 3d4336a2a3..0000000000 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ /dev/null @@ -1,359 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<!-- IF S_FORUM_RULES --> - <div class="forumrules"> - <!-- IF U_FORUM_RULES --> - <h3>{L_FORUM_RULES}</h3><br /> - <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a> - <!-- ELSE --> - <h3>{L_FORUM_RULES}</h3><br /> - {FORUM_RULES} - <!-- ENDIF --> - </div> - - <br clear="all" /> -<!-- ENDIF --> - -<!-- IF S_DISPLAY_ACTIVE --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat" colspan="<!-- IF S_TOPIC_ICONS -->7<!-- ELSE -->6<!-- ENDIF -->"><span class="nav">{L_ACTIVE_TOPICS}</span></td> - </tr> - - <tr> - <!-- IF S_TOPIC_ICONS --> - <th colspan="3"> {L_TOPICS} </th> - <!-- ELSE --> - <th colspan="2"> {L_TOPICS} </th> - <!-- ENDIF --> - <th> {L_AUTHOR} </th> - <th> {L_REPLIES} </th> - <th> {L_VIEWS} </th> - <th> {L_LAST_POST} </th> - </tr> - - <!-- BEGIN topicrow --> - - <tr> - <td class="row1" width="25" align="center">{topicrow.TOPIC_FOLDER_IMG}</td> - <!-- IF S_TOPIC_ICONS --> - <td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td> - <!-- ENDIF --> - <td class="row1"> - <!-- EVENT topiclist_row_prepend --> - <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF --> - {topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --><a title="{L_POSTED}{L_COLON} {topicrow.FIRST_POST_TIME}" href="{topicrow.U_VIEW_TOPIC}"class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> - <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.UNAPPROVED_IMG}</a> - <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_DELETED --> - <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{DELETED_IMG}</a> - <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --> - <a href="{topicrow.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a> - <!-- ENDIF --> - <!-- IF .topicrow.pagination --> - <p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} - <!-- BEGIN pagination --> - <!-- IF topicrow.pagination.S_IS_PREV --> - <!-- ELSEIF topicrow.pagination.S_IS_CURRENT --><strong>{topicrow.pagination.PAGE_NUMBER}</strong> - <!-- ELSEIF topicrow.pagination.S_IS_ELLIPSIS --> {L_ELLIPSIS} - <!-- ELSEIF topicrow.pagination.S_IS_NEXT --> - <!-- ELSE --><a href="{topicrow.pagination.PAGE_URL}">{topicrow.pagination.PAGE_NUMBER}</a> - <!-- ENDIF --> - <!-- END pagination --> - ] </p> - <!-- ENDIF --> - <!-- EVENT topiclist_row_append --> - </td> - <td class="row2" width="130" align="center"><p class="topicauthor">{topicrow.TOPIC_AUTHOR_FULL}</p></td> - <td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td> - <td class="row2" width="50" align="center"><p class="topicdetails">{topicrow.VIEWS}</p></td> - <td class="row1" width="140" align="center"> - <p class="topicdetails" style="white-space: nowrap;">{topicrow.LAST_POST_TIME}</p> - <p class="topicdetails">{topicrow.LAST_POST_AUTHOR_FULL} - <!-- IF not S_IS_BOT --><a href="{topicrow.U_LAST_POST}" class="imageset">{LAST_POST_IMG}</a><!-- ENDIF --> - </p> - </td> - </tr> - - <!-- BEGINELSE --> - - <tr> - <!-- IF S_TOPIC_ICONS --> - <td class="row1" colspan="7" height="30" align="center" valign="middle"><span class="gen"><!-- IF not S_SORT_DAYS -->{L_NO_TOPICS}<!-- ELSE -->{L_NO_TOPICS_TIME_FRAME}<!-- ENDIF --></span></td> - <!-- ELSE --> - <td class="row1" colspan="6" height="30" align="center" valign="middle"><span class="gen"><!-- IF not S_SORT_DAYS -->{L_NO_TOPICS}<!-- ELSE -->{L_NO_TOPICS_TIME_FRAME}<!-- ENDIF --></span></td> - <!-- ENDIF --> - </tr> - <!-- END topicrow --> - - <tr align="center"> - <td class="cat" colspan="<!-- IF S_TOPIC_ICONS -->7<!-- ELSE -->6<!-- ENDIF -->"> </td> - </tr> - </table> - - <br clear="all" /> -<!-- ENDIF --> - -<!-- IF S_HAS_SUBFORUM --> - <!-- INCLUDE forumlist_body.html --> - <br clear="all" /> -<!-- ENDIF --> - -<!-- IF S_IS_POSTABLE or S_NO_READ_ACCESS --> - <div id="pageheader"> - <h2><a class="titles" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></h2> - - <!-- IF MODERATORS --> - <p class="moderators"><!-- IF S_SINGLE_MODERATOR -->{L_MODERATOR}<!-- ELSE -->{L_MODERATORS}<!-- ENDIF -->{L_COLON} {MODERATORS}</p> - <!-- ENDIF --> - <!-- IF U_MCP --> - <p class="linkmcp">[ <!-- IF U_ACP --><a href="{U_ACP}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}">{L_MCP}</a><!-- ENDIF --> ]</p> - <!-- ENDIF --> - </div> - - <br clear="all" /><br /> -<!-- ENDIF --> - -<div id="pagecontent"> - -<!-- IF S_NO_READ_ACCESS --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row1" height="30" align="center" valign="middle"><span class="gen">{L_NO_READ_ACCESS}</span></td> - </tr> - </table> - - <!-- IF not S_USER_LOGGED_IN and not S_IS_BOT --> - - <br /><br /> - - <form method="post" action="{S_LOGIN_ACTION}"> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat"><h4><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h4></td> - </tr> - <tr> - <td class="row1" align="center"><span class="genmed">{L_USERNAME}{L_COLON}</span> <input class="post" type="text" name="username" size="10" /> <span class="genmed">{L_PASSWORD}{L_COLON}</span> <input class="post" type="password" name="password" size="10" /><!-- IF S_AUTOLOGIN_ENABLED --> <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF --> <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td> - </tr> - </table> - {S_LOGIN_REDIRECT} - </form> - - <!-- ENDIF --> - - <br clear="all" /> -<!-- ENDIF --> - - <!-- IF S_DISPLAY_POST_INFO or TOTAL_TOPICS --> - <table width="100%" cellspacing="1"> - <tr> - <!-- IF S_DISPLAY_POST_INFO and not S_IS_BOT --> - <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle"><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a></td> - <!-- ENDIF --> - <!-- IF TOTAL_TOPICS --> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ {TOTAL_TOPICS} ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - <!-- ENDIF --> - </tr> - </table> - <!-- ENDIF --> - - <!-- IF not S_DISPLAY_ACTIVE and (S_IS_POSTABLE or .topicrow) --> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat" colspan="<!-- IF S_TOPIC_ICONS -->7<!-- ELSE -->6<!-- ENDIF -->"> - <table width="100%" cellspacing="0"> - <tr class="nav"> - <td valign="middle"> <!-- IF U_WATCH_FORUM_LINK and not S_IS_BOT --><a href="{U_WATCH_FORUM_LINK}">{S_WATCH_FORUM_TITLE}</a><!-- ENDIF --></td> - <td align="{S_CONTENT_FLOW_END}" valign="middle"><!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}">{L_MARK_TOPICS_READ}</a><!-- ENDIF --> </td> - </tr> - </table> - </td> - </tr> - - <tr> - <!-- IF S_TOPIC_ICONS --> - <th colspan="3"> {L_TOPICS} </th> - <!-- ELSE --> - <th colspan="2"> {L_TOPICS} </th> - <!-- ENDIF --> - <th> {L_AUTHOR} </th> - <th> {L_REPLIES} </th> - <th> {L_VIEWS} </th> - <th> {L_LAST_POST} </th> - </tr> - - <!-- BEGIN topicrow --> - - <!-- IF topicrow.S_TOPIC_TYPE_SWITCH eq 1 --> - <tr> - <td class="row3" colspan="<!-- IF S_TOPIC_ICONS -->7<!-- ELSE -->6<!-- ENDIF -->"><b class="gensmall">{L_ANNOUNCEMENTS}</b></td> - </tr> - <!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH eq 0 --> - <tr> - <td class="row3" colspan="<!-- IF S_TOPIC_ICONS -->7<!-- ELSE -->6<!-- ENDIF -->"><b class="gensmall">{L_TOPICS}</b></td> - </tr> - <!-- ENDIF --> - - <tr> - <td class="row1" width="25" align="center">{topicrow.TOPIC_FOLDER_IMG}</td> - <!-- IF S_TOPIC_ICONS --> - <td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td> - <!-- ENDIF --> - <td class="row1"> - <!-- EVENT topiclist_row_prepend --> - <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF --> - {topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --> - <a title="{L_POSTED}{L_COLON} {topicrow.FIRST_POST_TIME}" href="<!-- IF not S_IS_BOT and topicrow.S_UNREAD_TOPIC -->{topicrow.U_NEWEST_POST}<!-- ELSE -->{topicrow.U_VIEW_TOPIC}<!-- ENDIF -->" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --> - <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.UNAPPROVED_IMG}</a> - <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_DELETED --> - <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{DELETED_IMG}</a> - <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --> - <a href="{topicrow.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a> - <!-- ENDIF --> - <!-- IF .topicrow.pagination --> - <p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}{L_COLON} - <!-- BEGIN pagination --> - <!-- IF topicrow.pagination.S_IS_PREV --> - <!-- ELSEIF topicrow.pagination.S_IS_CURRENT --><strong>{topicrow.pagination.PAGE_NUMBER}</strong> - <!-- ELSEIF topicrow.pagination.S_IS_ELLIPSIS --> {L_ELLIPSIS} - <!-- ELSEIF topicrow.pagination.S_IS_NEXT --> - <!-- ELSE --><a href="{topicrow.pagination.PAGE_URL}">{topicrow.pagination.PAGE_NUMBER}</a> - <!-- ENDIF --> - <!-- END pagination --> - ] </p> - <!-- ENDIF --> - <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --><p class="gensmall">{L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a></p><!-- ENDIF --> - <!-- EVENT topiclist_row_append --> - </td> - <td class="row2" width="130" align="center"><p class="topicauthor">{topicrow.TOPIC_AUTHOR_FULL}</p></td> - <td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td> - <td class="row2" width="50" align="center"><p class="topicdetails">{topicrow.VIEWS}</p></td> - <td class="row1" width="140" align="center"> - <p class="topicdetails" style="white-space: nowrap;">{topicrow.LAST_POST_TIME}</p> - <p class="topicdetails">{topicrow.LAST_POST_AUTHOR_FULL} - <!-- IF not S_IS_BOT --><a href="{topicrow.U_LAST_POST}" class="imageset">{LAST_POST_IMG}</a><!-- ENDIF --> - </p> - </td> - </tr> - - <!-- BEGINELSE --> - <!-- IF S_IS_POSTABLE --> - <tr> - <!-- IF S_TOPIC_ICONS --> - <td class="row1" colspan="7" height="30" align="center" valign="middle"><span class="gen"><!-- IF not S_SORT_DAYS -->{L_NO_TOPICS}<!-- ELSE -->{L_NO_TOPICS_TIME_FRAME}<!-- ENDIF --></span></td> - <!-- ELSE --> - <td class="row1" colspan="6" height="30" align="center" valign="middle"><span class="gen"><!-- IF not S_SORT_DAYS -->{L_NO_TOPICS}<!-- ELSE -->{L_NO_TOPICS_TIME_FRAME}<!-- ENDIF --></span></td> - <!-- ENDIF --> - </tr> - <!-- ENDIF --> - <!-- END topicrow --> - - <!-- IF not S_IS_BOT --> - <tr align="center"> - <!-- IF S_TOPIC_ICONS --> - <td class="cat" colspan="7"> - <!-- ELSE --> - <td class="cat" colspan="6"> - <!-- ENDIF --> - <form method="post" action="{S_FORUM_ACTION}"><span class="gensmall">{L_DISPLAY_TOPICS}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" name="sort" value="{L_GO}" /></form> - </td> - </tr> - <!-- ENDIF --> - </table> - <!-- ENDIF --> - - <!-- IF S_DISPLAY_POST_INFO or TOTAL_TOPICS --> - <table width="100%" cellspacing="1"> - <tr> - <!-- IF S_DISPLAY_POST_INFO and not S_IS_BOT --> - <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle"><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a></td> - <!-- ENDIF --> - <!-- IF TOTAL_TOPICS --> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ {TOTAL_TOPICS} ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - <!-- ENDIF --> - </tr> - </table> - <!-- ENDIF --> - - <br clear="all" /> -</div> - -<!-- INCLUDE breadcrumbs.html --> - -<!-- IF S_DISPLAY_ONLINE_LIST --> - <br clear="all" /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat"><h4>{L_WHO_IS_ONLINE}</h4></td> - </tr> - <tr> - <td class="row1"><p class="gensmall">{LOGGED_IN_USER_LIST}</p></td> - </tr> - </table> -<!-- ENDIF --> - -<!-- IF S_DISPLAY_POST_INFO --> - <br clear="all" /> - - <table width="100%" cellspacing="0"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}" valign="top"> - <table cellspacing="3" cellpadding="0" border="0"> - <tr> - <td width="20" style="text-align: center;">{FOLDER_UNREAD_IMG}</td> - <td class="gensmall">{L_UNREAD_POSTS}</td> - <td> </td> - <td width="20" style="text-align: center;">{FOLDER_IMG}</td> - <td class="gensmall">{L_NO_UNREAD_POSTS}</td> - <td> </td> - <td width="20" style="text-align: center;">{FOLDER_ANNOUNCE_IMG}</td> - <td class="gensmall">{L_ICON_ANNOUNCEMENT}</td> - </tr> - <tr> - <td style="text-align: center;">{FOLDER_HOT_UNREAD_IMG}</td> - <td class="gensmall">{L_UNREAD_POSTS_HOT}</td> - <td> </td> - <td style="text-align: center;">{FOLDER_HOT_IMG}</td> - <td class="gensmall">{L_NO_UNREAD_POSTS_HOT}</td> - <td> </td> - <td style="text-align: center;">{FOLDER_STICKY_IMG}</td> - <td class="gensmall">{L_ICON_STICKY}</td> - </tr> - <tr> - <td style="text-align: center;">{FOLDER_LOCKED_UNREAD_IMG}</td> - <td class="gensmall">{L_UNREAD_POSTS_LOCKED}</td> - <td> </td> - <td style="text-align: center;">{FOLDER_LOCKED_IMG}</td> - <td class="gensmall">{L_NO_UNREAD_POSTS_LOCKED}</td> - <td> </td> - <td style="text-align: center;">{FOLDER_MOVED_IMG}</td> - <td class="gensmall">{L_TOPIC_MOVED}</td> - </tr> - </table> - </td> - <td align="{S_CONTENT_FLOW_END}"><span class="gensmall"><!-- BEGIN rules -->{rules.RULE}<br /><!-- END rules --></span></td> - </tr> - </table> -<!-- ENDIF --> - -<br clear="all" /> - -<table width="100%" cellspacing="0"> -<tr> - <td><!-- IF S_DISPLAY_SEARCHBOX --><!-- INCLUDE searchbox.html --><!-- ENDIF --></td> - <td align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></td> -</tr> -</table> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/viewonline_body.html b/phpBB/styles/subsilver2/template/viewonline_body.html deleted file mode 100644 index 70b8b52efa..0000000000 --- a/phpBB/styles/subsilver2/template/viewonline_body.html +++ /dev/null @@ -1,57 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<h4>{TOTAL_REGISTERED_USERS_ONLINE}</h4> -<h4>{TOTAL_GUEST_USERS_ONLINE}<!-- IF S_SWITCH_GUEST_DISPLAY --> [ <a href="{U_SWITCH_GUEST_DISPLAY}">{L_SWITCH_GUEST_DISPLAY}</a> ]<!-- ENDIF --></h4> -<br /> - -<!-- IF .pagination --> - <table width="100%" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - </tr> - </table> -<!-- ENDIF --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th width="40%"><a href="{U_SORT_USERNAME}">{L_USERNAME}</a></th> - <th width="20%"><a href="{U_SORT_UPDATED}">{L_LAST_UPDATED}</a></th> - <th width="40%"><a href="{U_SORT_LOCATION}">{L_FORUM_LOCATION}</a></th> -</tr> -<!-- BEGIN user_row --> - <tr> - <td class="row1"><p class="gen">{user_row.USERNAME_FULL}</p><!-- IF user_row.USER_IP --><p class="gensmall">{L_IP}{L_COLON} <a href="{user_row.U_USER_IP}">{user_row.USER_IP}</a> » <a href="{user_row.U_WHOIS}" onclick="popup(this.href, 750, 500); return false;">{L_WHOIS}</a></p><!-- ENDIF --> - <!-- IF user_row.USER_BROWSER -->{user_row.USER_BROWSER}<!-- ENDIF --></td> - <td class="row2" align="center" nowrap="nowrap"><p class="genmed"> {user_row.LASTUPDATE}</p></td> - <td class="row1"><p class="genmed"><a href="{user_row.U_FORUM_LOCATION}">{user_row.FORUM_LOCATION}</a></p></td> - </tr> -<!-- END user_row --> - -<!-- IF LEGEND --> - <tr> - <td class="row1" colspan="3"><b class="gensmall">{L_LEGEND} :: {LEGEND}</b></td> - </tr> -<!-- ENDIF --> -</table> - -<!-- IF .pagination --> - <table width="100%" cellspacing="1"> - <tr> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - </tr> - </table> -<!-- ENDIF --> - -<div class="gensmall" align="{S_CONTENT_FLOW_END}">{L_ONLINE_EXPLAIN}</div> - -<br clear="all" /> - -<!-- INCLUDE breadcrumbs.html --> - -<br clear="all" /> - -<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/viewonline_whois.html b/phpBB/styles/subsilver2/template/viewonline_whois.html deleted file mode 100644 index ca5b326df8..0000000000 --- a/phpBB/styles/subsilver2/template/viewonline_whois.html +++ /dev/null @@ -1,12 +0,0 @@ -<!-- INCLUDE simple_header.html --> - -<table class="tablebg" width="100%" cellspacing="1"> -<tr> - <th>{L_WHOIS}</th> -</tr> -<tr> - <td class="row1"><pre>{WHOIS}</pre><br /><a class="nav" href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a></td> -</tr> -</table> - -<!-- INCLUDE simple_footer.html --> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html deleted file mode 100644 index 9ba71d78bc..0000000000 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ /dev/null @@ -1,426 +0,0 @@ -<!-- INCLUDE overall_header.html --> - -<!-- IF S_FORUM_RULES --> - <div class="forumrules"> - <!-- IF U_FORUM_RULES --> - <h3>{L_FORUM_RULES}</h3><br /> - <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a> - <!-- ELSE --> - <h3>{L_FORUM_RULES}</h3><br /> - {FORUM_RULES} - <!-- ENDIF --> - </div> - - <br clear="all" /> -<!-- ENDIF --> - -<div id="pageheader"> - <h2><!-- EVENT viewtopic_topic_title_prepend --><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2> - -<!-- IF MODERATORS --> - <p class="moderators"><!-- IF S_SINGLE_MODERATOR -->{L_MODERATOR}<!-- ELSE -->{L_MODERATORS}<!-- ENDIF -->{L_COLON} {MODERATORS}</p> -<!-- ENDIF --> -<!-- IF U_MCP --> - <p class="linkmcp">[ <!-- IF U_ACP --><a href="{U_ACP}">{L_ACP}</a><!-- IF U_MCP --> | <!-- ENDIF --><!-- ENDIF --><!-- IF U_MCP --><a href="{U_MCP}">{L_MCP}</a><!-- ENDIF --> ]</p> -<!-- ENDIF --> -</div> - -<br clear="all" /><br /> - -<div id="pagecontent"> - - <table width="100%" cellspacing="1"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap"> - <!-- IF not S_IS_BOT --> - <!-- IF S_DISPLAY_POST_INFO --><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a> <!-- ENDIF --> - <!-- IF S_DISPLAY_REPLY_INFO --><a href="{U_POST_REPLY_TOPIC}" class="imageset">{REPLY_IMG}</a><!-- ENDIF --> - <!-- ENDIF --> - </td> - <!-- IF TOTAL_POSTS --> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ {TOTAL_POSTS} ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - <!-- ENDIF --> - </tr> - </table> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat"> - <table width="100%" cellspacing="0"> - <tr> - <td class="nav" nowrap="nowrap"> - <!-- IF not S_IS_BOT --> - <!-- IF U_WATCH_TOPIC --><a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}">{S_WATCH_TOPIC_TITLE}</a><!-- IF U_PRINT_TOPIC or U_EMAIL_TOPIC or U_BUMP_TOPIC or U_BOOKMARK_TOPIC --> | <!-- ENDIF --><!-- ENDIF --> - <!-- IF U_BOOKMARK_TOPIC --><a href="{U_BOOKMARK_TOPIC}" title="{S_BOOKMARK_TOPIC}">{S_BOOKMARK_TOPIC}</a><!-- IF U_PRINT_TOPIC or U_EMAIL_TOPIC or U_BUMP_TOPIC --> | <!-- ENDIF --><!-- ENDIF --> - <!-- IF U_PRINT_TOPIC --><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}">{L_PRINT_TOPIC}</a><!-- IF U_EMAIL_TOPIC or U_BUMP_TOPIC --> | <!-- ENDIF --><!-- ENDIF --> - <!-- IF U_EMAIL_TOPIC --><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}">{L_EMAIL_TOPIC}</a><!-- IF U_BUMP_TOPIC --> | <!-- ENDIF --><!-- ENDIF --> - <!-- IF U_BUMP_TOPIC --><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}">{L_BUMP_TOPIC}</a><!-- ENDIF --> - <!-- ENDIF --> - </td> - <td class="nav" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><a href="{U_VIEW_OLDER_TOPIC}">{L_VIEW_PREVIOUS_TOPIC}</a><!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> | <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a><!-- ENDIF --> | <a href="{U_VIEW_NEWER_TOPIC}">{L_VIEW_NEXT_TOPIC}</a> </td> - </tr> - </table> - </td> - </tr> -<!-- IF S_HAS_POLL --> - <tr> - <td class="row2" colspan="2" align="center"><br clear="all" /> - - <form method="post" action="{S_POLL_ACTION}"> - - <table cellspacing="0" cellpadding="4" border="0" align="center"> - <tr> - <td align="center"><span class="gen"><b>{POLL_QUESTION}</b></span><br /><span class="gensmall">{L_POLL_LENGTH}</span></td> - </tr> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}"> - <table cellspacing="0" cellpadding="2" border="0"> - <!-- BEGIN poll_option --> - <tr> - <!-- IF S_CAN_VOTE --> - <td> - <!-- IF S_IS_MULTI_CHOICE --> - <input type="checkbox" class="radio" name="vote_id[]" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /> - <!-- ELSE --> - <input type="radio" class="radio" name="vote_id[]" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /> - <!-- ENDIF --> - </td> - <!-- ENDIF --> - <td><span class="gen">{poll_option.POLL_OPTION_CAPTION}</span></td> - <!-- IF S_DISPLAY_RESULTS --> - <td dir="ltr">{POLL_LEFT_CAP_IMG}<span class="imageset poll_center" style="width: {poll_option.POLL_OPTION_WIDTH}px; background-repeat: repeat-x;">{poll_option.POLL_OPTION_PERCENT}</span>{POLL_RIGHT_CAP_IMG}</td> - <td class="gen" align="{S_CONTENT_FLOW_END}"><b> {poll_option.POLL_OPTION_PERCENT} </b></td> - <td class="gen" align="center">[ {poll_option.POLL_OPTION_RESULT} ]</td> - <!-- IF poll_option.POLL_OPTION_VOTED --> - <td class="gensmall" valign="top"><b title="{L_POLL_VOTED_OPTION}">x</b></td> - <!-- ENDIF --> - <!-- ENDIF --> - </tr> - <!-- END poll_option --> - </table> - </td> - </tr> - <!-- IF S_CAN_VOTE --> - <tr> - <td align="center"><span class="gensmall">{L_MAX_VOTES}</span><br /><br /><input type="submit" name="update" value="{L_SUBMIT_VOTE}" class="btnlite" /></td> - </tr> - <!-- ENDIF --> - <!-- IF S_DISPLAY_RESULTS --> - <tr> - <td class="gensmall" colspan="4" align="center"><b>{L_TOTAL_VOTES}{L_COLON} {TOTAL_VOTES}</b></td> - </tr> - <!-- ELSE --> - <tr> - <td align="center"><span class="gensmall"><b><a href="{U_VIEW_RESULTS}">{L_VIEW_RESULTS}</a></b></span></td> - </tr> - <!-- ENDIF --> - </table> - {S_HIDDEN_FIELDS} - {S_FORM_TOKEN} - </form> - - </td> - </tr> -<!-- ENDIF --> - </table> - -<!-- BEGIN postrow --> - <!-- EVENT viewtopic_body_postrow_post_before --> - <table class="tablebg" width="100%" cellspacing="1"> - <!-- IF postrow.S_FIRST_ROW --> - <tr> - <th>{L_AUTHOR}</th> - <th>{L_MESSAGE}</th> - </tr> - <!-- ENDIF --> - <!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <!-- IF postrow.S_POST_HIDDEN --> - <td class="gensmall" colspan="2" height="25" align="center"> - <!-- IF postrow.S_FIRST_UNREAD --><a name="unread"></a><!-- ENDIF --> - <a name="p{postrow.POST_ID}"></a> - <!-- IF postrow.S_POST_HIDDEN --> - <!-- IF postrow.S_POST_DELETED --> - {postrow.L_POST_DELETED_MESSAGE} - <!-- ELSEIF postrow.S_IGNORE_POST --> - {postrow.L_IGNORE_POST} - <!-- ENDIF --> - <br />{postrow.L_POST_DISPLAY} - <!-- ENDIF --> - </td> - <!-- ELSE --> - - <td align="center" valign="middle"> - <!-- IF postrow.S_FIRST_UNREAD --><a name="unread"></a><!-- ENDIF --><a name="p{postrow.POST_ID}"></a> - <b class="postauthor"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{postrow.POST_AUTHOR}</b> - </td> - <td width="100%" height="25"> - <table width="100%" cellspacing="0"> - <tr> - <!-- IF postrow.POST_ICON_IMG --> - <td><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" title="" /></td> - <!-- ENDIF --> - <td class="gensmall" width="100%"><div style="float: {S_CONTENT_FLOW_BEGIN};"> <b>{L_POST_SUBJECT}{L_COLON}</b> <a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></div><div style="float: {S_CONTENT_FLOW_END};"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}" class="imageset">{postrow.MINI_POST_IMG}</a><!-- ENDIF --><b>{L_POSTED}{L_COLON}</b> {postrow.POST_DATE} </div></td> - </tr> - </table> - </td> - </tr> - - <!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td valign="top" class="profile"> - <table cellspacing="4" align="center" width="150"> - <!-- IF postrow.ONLINE_IMG --> - <tr> - <td>{postrow.ONLINE_IMG}</td> - </tr> - <!-- ENDIF --> - <!-- IF postrow.RANK_TITLE --> - <tr> - <td class="postdetails">{postrow.RANK_TITLE}</td> - </tr> - <!-- ENDIF --> - <!-- IF postrow.RANK_IMG --> - <tr> - <td>{postrow.RANK_IMG}</td> - </tr> - <!-- ENDIF --> - <!-- IF postrow.POSTER_AVATAR --> - <tr> - <td>{postrow.POSTER_AVATAR}</td> - </tr> - <!-- ENDIF --> - <!-- IF not (postrow.ONLINE_IMG or postrow.RANK_TITLE or postrow.RANK_IMG or postrow.POSTER_AVATAR) --> - <tr> - <td></td> - </tr> - <!-- ENDIF --> - </table> - - <span class="postdetails"> - <!-- IF postrow.POSTER_JOINED --><br /><b>{L_JOINED}{L_COLON}</b> {postrow.POSTER_JOINED}<!-- ENDIF --> - <!-- IF postrow.POSTER_POSTS != '' --><br /><b>{L_POSTS}{L_COLON}</b> {postrow.POSTER_POSTS}<!-- ENDIF --> - - <!-- IF postrow.S_PROFILE_FIELD1 --> - <!-- Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. --> - <br /><b>{postrow.PROFILE_FIELD1_NAME}{L_COLON}</b> {postrow.PROFILE_FIELD1_VALUE} - <!-- ENDIF --> - - <!-- EVENT viewtopic_body_postrow_custom_fields_before --> - <!-- BEGIN custom_fields --> - <br /><b>{postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON}</b> {postrow.custom_fields.PROFILE_FIELD_VALUE} - <!-- END custom_fields --> - <!-- EVENT viewtopic_body_postrow_custom_fields_after --> - </span> - - </td> - <td valign="top"> - <table width="100%" cellspacing="5"> - <tr> - <td> - <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_DELETED or postrow.S_POST_REPORTED --> - <table width="100%" cellspacing="0"> - <tr> - <td class="gensmall"> - <!-- IF postrow.S_POST_UNAPPROVED --><span class="postapprove">{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span><br /> <!-- ENDIF --> - <!-- IF postrow.S_POST_DELETED --><span class="postapprove">{DELETED_IMG} <a href="{postrow.U_MCP_RESTORE}">{L_POST_DELETED}</a></span><br /> <!-- ENDIF --> - <!-- IF postrow.S_POST_REPORTED --><span class="postreported">{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF --> - </td> - </tr> - </table> - - <br clear="all" /> - <!-- ENDIF --> - - <div class="postbody">{postrow.MESSAGE}</div> - - <!-- IF postrow.S_HAS_ATTACHMENTS --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <!-- IF postrow.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{postrow.attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - - <!-- IF postrow.S_DISPLAY_NOTICE --> - <span class="gensmall error"><br /><br />{L_DOWNLOAD_NOTICE}</span> - <!-- ENDIF --> - <!-- IF postrow.SIGNATURE --> - <div class="postbody"><br />_________________<br />{postrow.SIGNATURE}</div> - <!-- ENDIF --> - - <!-- IF postrow.DELETED_MESSAGE or postrow.DELETE_REASON --> - <!-- IF postrow.DELETE_REASON --> - <br /><br /> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><span class="gensmall">{postrow.DELETED_MESSAGE}</span></td> - </tr> - <tr> - <td class="row2"><span class="genmed">{postrow.DELETE_REASON}</span></td> - </tr> - </table> - <!-- ELSE --> - <br /><br /> - <span class="gensmall">{postrow.DELETED_MESSAGE}</span> - <!-- ENDIF --> - <!-- ELSEIF postrow.EDITED_MESSAGE or postrow.EDIT_REASON --> - <!-- IF postrow.EDIT_REASON --> - <br /><br /> - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="row3"><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td> - </tr> - <tr> - <td class="row2"><span class="genmed">{postrow.EDIT_REASON}</span></td> - </tr> - </table> - <!-- ELSE --> - <br /><br /> - <span class="gensmall">{postrow.EDITED_MESSAGE}</span> - <!-- ENDIF --> - <!-- ENDIF --> - - <!-- IF postrow.BUMPED_MESSAGE --> - <span class="gensmall"><br /><br />{postrow.BUMPED_MESSAGE}</span> - <!-- ENDIF --> - - <!-- IF not postrow.S_HAS_ATTACHMENTS --><br clear="all" /><br /><!-- ENDIF --> - - <table width="100%" cellspacing="0"> - <tr valign="middle"> - <td class="gensmall" align="{S_CONTENT_FLOW_END}"> - <!-- IF not S_IS_BOT --> - <!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}" class="imageset">{REPORT_IMG}</a> <!-- ENDIF --> - <!-- IF postrow.U_INFO --><a href="{postrow.U_INFO}" class="imageset">{INFO_IMG}</a> <!-- ENDIF --> - <!-- IF postrow.U_WARN --><a href="{postrow.U_WARN}" class="imageset">{WARN_IMG}</a> <!-- ENDIF --> - <!-- IF postrow.U_DELETE --><a href="{postrow.U_DELETE}" class="imageset">{DELETE_IMG}</a> <!-- ENDIF --> - <!-- ENDIF --> - </td> - </tr> - </table> - </td> - </tr> - </table> - </td> - </tr> - - <!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - - <td class="profile"><strong><a href="#wrapheader">{L_BACK_TO_TOP}</a></strong></td> - <td> - <div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"> - <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="imageset">{PROFILE_IMG}</a><!-- ENDIF --> - <!-- IF postrow.U_PM --><a href="{postrow.U_PM}" class="imageset">{PM_IMG}</a><!-- ENDIF --> - <!-- IF postrow.U_EMAIL --><a href="{postrow.U_EMAIL}" class="imageset">{EMAIL_IMG}</a><!-- ENDIF --> - </div> - <div class="gensmall" style="float: {S_CONTENT_FLOW_END};"> - <!-- EVENT viewtopic_body_post_buttons_before --> - <!-- IF not S_IS_BOT --> - <!-- IF postrow.U_EDIT --><a href="{postrow.U_EDIT}" class="imageset">{EDIT_IMG}</a><!-- ENDIF --> - <!-- IF postrow.U_QUOTE --><a href="{postrow.U_QUOTE}" class="imageset">{QUOTE_IMG}</a><!-- ENDIF --> - <!-- ENDIF --> - <!-- EVENT viewtopic_body_post_buttons_after --> - </div> - </td> - <!-- ENDIF --> - </tr> - - <tr> - <td class="spacer" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> - </table> - <!-- EVENT viewtopic_body_postrow_post_after --> -<!-- END postrow --> - - <!-- IF not S_IS_BOT --> - <table width="100%" cellspacing="1" class="tablebg"> - <tr align="center"> - <td class="cat"><form name="viewtopic" method="post" action="{S_TOPIC_ACTION}"><span class="gensmall">{L_DISPLAY_POSTS}{L_COLON}</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" value="{L_GO}" name="sort" /></form></td> - </tr> - </table> - <!-- ENDIF --> - - <!-- EVENT viewtopic_body_topic_actions_before --> - - <table width="100%" cellspacing="1"> - <tr> - <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap"> - <!-- IF not S_IS_BOT --> - <!-- IF S_DISPLAY_POST_INFO --><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a> <!-- ENDIF --> - <!-- IF S_DISPLAY_REPLY_INFO --><a href="{U_POST_REPLY_TOPIC}" class="imageset">{REPLY_IMG}</a><!-- ENDIF --> - <!-- ENDIF --> - </td> - <!-- IF TOTAL_POSTS --> - <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> - <td class="gensmall" nowrap="nowrap"> [ {TOTAL_POSTS} ] </td> - <td class="gensmall" width="100%" align="{S_CONTENT_FLOW_END}" nowrap="nowrap"><!-- INCLUDE pagination.html --></td> - <!-- ENDIF --> - </tr> - </table> - -</div> - -<div id="pagefooter"></div> - -<br clear="all" /> -<!-- IF S_QUICK_REPLY --> -<!-- INCLUDE quickreply_editor.html --> -<!-- ENDIF --> - -<!-- EVENT viewtopic_body_footer_before --> -<!-- INCLUDE breadcrumbs.html --> - -<!-- IF S_DISPLAY_ONLINE_LIST --> - <br clear="all" /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td class="cat"><h4>{L_WHO_IS_ONLINE}</h4></td> - </tr> - <tr> - <td class="row1"><p class="gensmall">{LOGGED_IN_USER_LIST}</p></td> - </tr> - </table> -<!-- ENDIF --> - -<br clear="all" /> - -<table width="100%" cellspacing="1"> -<tr> - <td width="40%" valign="top" nowrap="nowrap" align="{S_CONTENT_FLOW_BEGIN}"> - <!-- IF .quickmod --> - <form method="post" action="{S_MOD_ACTION}"> - <span class="gensmall">{L_QUICK_MOD}{L_COLON}</span> - <select name="action" id="quick-mod-select"> - <!-- BEGIN quickmod --> - <option value="{quickmod.VALUE}">{quickmod.TITLE}</option> - <!-- END quickmod --> - </select> - <input class="btnlite" type="submit" value="{L_GO}" /> - </form> - <!-- ENDIF --> - </td> - <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><span class="gensmall"><!-- BEGIN rules -->{rules.RULE}<br /><!-- END rules --></span></td> -</tr> -</table> - -<br clear="all" /> - -<table width="100%" cellspacing="0"> -<tr> - <td><!-- IF S_DISPLAY_SEARCHBOX --><!-- INCLUDE searchbox.html --><!-- ENDIF --></td> - <td align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></td> -</tr> -</table> - -<!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/viewtopic_print.html b/phpBB/styles/subsilver2/template/viewtopic_print.html deleted file mode 100644 index a4e4c1b691..0000000000 --- a/phpBB/styles/subsilver2/template/viewtopic_print.html +++ /dev/null @@ -1,135 +0,0 @@ -<!DOCTYPE html> -<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}"> -<head> -<meta charset="utf-8"> -<meta name="robots" content="noindex" /> -<title>{SITENAME} :: {PAGE_TITLE}</title> - -<style type="text/css"> -<!-- - -body { - font-family: Verdana,serif; - font-size: 10pt; -} - -img { - border: 0; -} - -td { - font-family: Verdana,serif; - font-size: 10pt; - line-height: 150%; -} - -.code, .codecontent, -.quote, .quotecontent { - margin: 0 5px 0 5px; - padding: 5px; - font-size: smaller; - border: black solid 1px; -} - -.quotetitle { - color: black; - display : block; - font-weight: bold; -} - -.forum { - font-family: Arial,Helvetica,sans-serif; - font-weight: bold; - font-size: 18pt; -} - -.topic { - font-family: Arial,Helvetica,sans-serif; - font-size: 14pt; - font-weight: bold; -} - -.gensmall { - font-size: 8pt; -} - -hr { - color: #888; - height: 3px; - border-style: solid; -} - -hr.sep { - color: #aaa; - height: 1px; - border-style: dashed; -} -//--> -</style> -<!-- EVENT viewtopic_print_head_append --> -</head> -<body> - -<table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> -<tr> - <td colspan="2" align="center"><span class="Forum">{SITENAME}</span><br /><span class="gensmall"><a href="{U_FORUM}">{U_FORUM}</a></span></td> -</tr> -<tr> - <td colspan="2"><br /></td> -</tr> -<tr> - <td><span class="topic">{TOPIC_TITLE}</span><br /><span class="gensmall"><a href="{U_TOPIC}">{U_TOPIC}</a></span></td> - <td align="{S_CONTENT_FLOW_END}" valign="bottom"><span class="gensmall">{PAGE_NUMBER}</span></td> -</tr> -</table> - -<!-- BEGIN postrow --> - - <hr width="85%" /> - - <table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> - <tr> - <td width="10%" nowrap="nowrap">{L_AUTHOR}{L_COLON} </td> - <td><b>{postrow.POST_AUTHOR}</b> [ {postrow.POST_DATE} ]</td> - </tr> - <tr> - <td width="10%" nowrap="nowrap">{L_POST_SUBJECT}{L_COLON} </td> - <td><b>{postrow.POST_SUBJECT}</b></td> - </tr> - <tr> - <td colspan="2"><hr class="sep" />{postrow.MESSAGE} - - <!-- IF postrow.S_HAS_ATTACHMENTS --> - <br clear="all" /><br /> - - <table class="tablebg" width="100%" cellspacing="1"> - <tr> - <td><b class="genmed">{L_ATTACHMENTS}{L_COLON} </b></td> - </tr> - <!-- BEGIN attachment --> - <tr> - <td>{postrow.attachment.DISPLAY_ATTACHMENT}</td> - </tr> - <!-- END attachment --> - </table> - <!-- ENDIF --> - - </td> - </tr> - </table> -<!-- END postrow --> - -<hr width="85%" /> - -<table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> -<tr> - <td><span class="gensmall">{PAGE_NUMBER}</span></td> - <td align="{S_CONTENT_FLOW_END}"><span class="gensmall">{S_TIMEZONE}</span></td> -</tr> -<tr> - <td colspan="2" align="center"><span class="gensmall">Powered by phpBB® Forum Software © phpBB Group<br />https://www.phpbb.com/</span></td> -</tr> -</table> - -</body> -</html> diff --git a/phpBB/styles/subsilver2/theme/en/button_pm_new.gif b/phpBB/styles/subsilver2/theme/en/button_pm_new.gif Binary files differdeleted file mode 100644 index 07df748d3a..0000000000 --- a/phpBB/styles/subsilver2/theme/en/button_pm_new.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/button_pm_reply.gif b/phpBB/styles/subsilver2/theme/en/button_pm_reply.gif Binary files differdeleted file mode 100644 index c476f06a44..0000000000 --- a/phpBB/styles/subsilver2/theme/en/button_pm_reply.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/button_topic_locked.gif b/phpBB/styles/subsilver2/theme/en/button_topic_locked.gif Binary files differdeleted file mode 100644 index 124a2d4a7d..0000000000 --- a/phpBB/styles/subsilver2/theme/en/button_topic_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/button_topic_new.gif b/phpBB/styles/subsilver2/theme/en/button_topic_new.gif Binary files differdeleted file mode 100644 index 66e1007129..0000000000 --- a/phpBB/styles/subsilver2/theme/en/button_topic_new.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/button_topic_reply.gif b/phpBB/styles/subsilver2/theme/en/button_topic_reply.gif Binary files differdeleted file mode 100644 index e8fe5115a0..0000000000 --- a/phpBB/styles/subsilver2/theme/en/button_topic_reply.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_aim.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_aim.gif Binary files differdeleted file mode 100644 index c6533e2817..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_aim.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_email.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_email.gif Binary files differdeleted file mode 100644 index f126a1960d..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_email.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_icq.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_icq.gif Binary files differdeleted file mode 100644 index ba3fa12436..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_icq.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_jabber.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_jabber.gif Binary files differdeleted file mode 100644 index be2e53f9c2..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_jabber.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_msnm.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_msnm.gif Binary files differdeleted file mode 100644 index 1bf681e9a2..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_msnm.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_pm.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_pm.gif Binary files differdeleted file mode 100644 index 26ac558c2f..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_pm.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_www.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_www.gif Binary files differdeleted file mode 100644 index 14a33b36a5..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_www.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_contact_yahoo.gif b/phpBB/styles/subsilver2/theme/en/icon_contact_yahoo.gif Binary files differdeleted file mode 100644 index d11711789f..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_contact_yahoo.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_post_delete.gif b/phpBB/styles/subsilver2/theme/en/icon_post_delete.gif Binary files differdeleted file mode 100644 index e008e5ff9f..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_post_delete.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_post_edit.gif b/phpBB/styles/subsilver2/theme/en/icon_post_edit.gif Binary files differdeleted file mode 100644 index 1511ee34d3..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_post_edit.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_post_info.gif b/phpBB/styles/subsilver2/theme/en/icon_post_info.gif Binary files differdeleted file mode 100644 index 166de2724f..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_post_info.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_post_quote.gif b/phpBB/styles/subsilver2/theme/en/icon_post_quote.gif Binary files differdeleted file mode 100644 index 4cf103280c..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_post_quote.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_post_report.gif b/phpBB/styles/subsilver2/theme/en/icon_post_report.gif Binary files differdeleted file mode 100644 index 9a3f65b1e3..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_post_report.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_user_offline.gif b/phpBB/styles/subsilver2/theme/en/icon_user_offline.gif Binary files differdeleted file mode 100644 index 3065f4d7fe..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_user_offline.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_user_online.gif b/phpBB/styles/subsilver2/theme/en/icon_user_online.gif Binary files differdeleted file mode 100644 index b950612c57..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_user_online.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_user_profile.gif b/phpBB/styles/subsilver2/theme/en/icon_user_profile.gif Binary files differdeleted file mode 100644 index d9cf7f4c4a..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_user_profile.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_user_search.gif b/phpBB/styles/subsilver2/theme/en/icon_user_search.gif Binary files differdeleted file mode 100644 index 46475fbf4c..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_user_search.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/icon_user_warn.gif b/phpBB/styles/subsilver2/theme/en/icon_user_warn.gif Binary files differdeleted file mode 100644 index 44cbcc953a..0000000000 --- a/phpBB/styles/subsilver2/theme/en/icon_user_warn.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/en/stylesheet.css b/phpBB/styles/subsilver2/theme/en/stylesheet.css deleted file mode 100644 index 563492d4fc..0000000000 --- a/phpBB/styles/subsilver2/theme/en/stylesheet.css +++ /dev/null @@ -1,116 +0,0 @@ -/* EN Language Pack */ -.imageset.icon_contact_aim { - background-image: url("./icon_contact_aim.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_email { - background-image: url("./icon_contact_email.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_icq { - background-image: url("./icon_contact_icq.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_jabber { - background-image: url("./icon_contact_jabber.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_msnm { - background-image: url("./icon_contact_msnm.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_pm { - background-image: url("./icon_contact_pm.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_yahoo { - background-image: url("./icon_contact_yahoo.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_www { - background-image: url("./icon_contact_www.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_post_delete { - background-image: url("./icon_post_delete.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_edit { - background-image: url("./icon_post_edit.gif"); - padding-left: 90px; - padding-top: 20px; -} -.imageset.icon_post_info { - background-image: url("./icon_post_info.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_quote { - background-image: url("./icon_post_quote.gif"); - padding-left: 90px; - padding-top: 20px; -} -.imageset.icon_post_report { - background-image: url("./icon_post_report.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_user_online { - background-image: url("./icon_user_online.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_offline { - background-image: url("./icon_user_offline.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_profile { - background-image: url("./icon_user_profile.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_search { - background-image: url("./icon_user_search.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_warn { - background-image: url("./icon_user_warn.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.button_pm_new { - background-image: url("./button_pm_new.gif"); - padding-left: 97px; - padding-top: 27px; -} -.imageset.button_pm_reply { - background-image: url("./button_pm_reply.gif"); - padding-left: 90px; - padding-top: 20px; -} -.imageset.button_topic_locked { - background-image: url("./button_topic_locked.gif"); - padding-left: 97px; - padding-top: 27px; -} -.imageset.button_topic_new { - background-image: url("./button_topic_new.gif"); - padding-left: 97px; - padding-top: 27px; -} -.imageset.button_topic_reply { - background-image: url("./button_topic_reply.gif"); - padding-left: 97px; - padding-top: 27px; -} diff --git a/phpBB/styles/subsilver2/theme/images/announce_read.gif b/phpBB/styles/subsilver2/theme/images/announce_read.gif Binary files differdeleted file mode 100644 index 0589feb14f..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_read.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/announce_read_locked.gif b/phpBB/styles/subsilver2/theme/images/announce_read_locked.gif Binary files differdeleted file mode 100644 index a738616e06..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_read_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/announce_read_locked_mine.gif b/phpBB/styles/subsilver2/theme/images/announce_read_locked_mine.gif Binary files differdeleted file mode 100644 index f7ffe7f8dd..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_read_locked_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/announce_read_mine.gif b/phpBB/styles/subsilver2/theme/images/announce_read_mine.gif Binary files differdeleted file mode 100644 index 636d353867..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_read_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/announce_unread.gif b/phpBB/styles/subsilver2/theme/images/announce_unread.gif Binary files differdeleted file mode 100644 index 56b2702b17..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_unread.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/announce_unread_locked.gif b/phpBB/styles/subsilver2/theme/images/announce_unread_locked.gif Binary files differdeleted file mode 100644 index 37033da653..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_unread_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/announce_unread_locked_mine.gif b/phpBB/styles/subsilver2/theme/images/announce_unread_locked_mine.gif Binary files differdeleted file mode 100644 index d91f2520ca..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_unread_locked_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/announce_unread_mine.gif b/phpBB/styles/subsilver2/theme/images/announce_unread_mine.gif Binary files differdeleted file mode 100644 index e1dd23a0bf..0000000000 --- a/phpBB/styles/subsilver2/theme/images/announce_unread_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/background.gif b/phpBB/styles/subsilver2/theme/images/background.gif Binary files differdeleted file mode 100644 index 5c731e4fc2..0000000000 --- a/phpBB/styles/subsilver2/theme/images/background.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/cellpic.gif b/phpBB/styles/subsilver2/theme/images/cellpic.gif Binary files differdeleted file mode 100644 index 47457ef5f7..0000000000 --- a/phpBB/styles/subsilver2/theme/images/cellpic.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/cellpic1.gif b/phpBB/styles/subsilver2/theme/images/cellpic1.gif Binary files differdeleted file mode 100644 index 715b8d4aa8..0000000000 --- a/phpBB/styles/subsilver2/theme/images/cellpic1.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/cellpic2.jpg b/phpBB/styles/subsilver2/theme/images/cellpic2.jpg Binary files differdeleted file mode 100644 index a0ca7e89d3..0000000000 --- a/phpBB/styles/subsilver2/theme/images/cellpic2.jpg +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/cellpic2_rtl.jpg b/phpBB/styles/subsilver2/theme/images/cellpic2_rtl.jpg Binary files differdeleted file mode 100644 index 201e063725..0000000000 --- a/phpBB/styles/subsilver2/theme/images/cellpic2_rtl.jpg +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/cellpic3.gif b/phpBB/styles/subsilver2/theme/images/cellpic3.gif Binary files differdeleted file mode 100644 index ecf70e1fd1..0000000000 --- a/phpBB/styles/subsilver2/theme/images/cellpic3.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/created_by.jpg b/phpBB/styles/subsilver2/theme/images/created_by.jpg Binary files differdeleted file mode 100644 index f27472781e..0000000000 --- a/phpBB/styles/subsilver2/theme/images/created_by.jpg +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/forum_link.gif b/phpBB/styles/subsilver2/theme/images/forum_link.gif Binary files differdeleted file mode 100644 index d5e86d47d7..0000000000 --- a/phpBB/styles/subsilver2/theme/images/forum_link.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/forum_read.gif b/phpBB/styles/subsilver2/theme/images/forum_read.gif Binary files differdeleted file mode 100644 index 9b2bc47c67..0000000000 --- a/phpBB/styles/subsilver2/theme/images/forum_read.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/forum_read_locked.gif b/phpBB/styles/subsilver2/theme/images/forum_read_locked.gif Binary files differdeleted file mode 100644 index 436f3d21c8..0000000000 --- a/phpBB/styles/subsilver2/theme/images/forum_read_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/forum_read_subforum.gif b/phpBB/styles/subsilver2/theme/images/forum_read_subforum.gif Binary files differdeleted file mode 100644 index 9179303e7f..0000000000 --- a/phpBB/styles/subsilver2/theme/images/forum_read_subforum.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/forum_unread.gif b/phpBB/styles/subsilver2/theme/images/forum_unread.gif Binary files differdeleted file mode 100644 index 5eec565b38..0000000000 --- a/phpBB/styles/subsilver2/theme/images/forum_unread.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/forum_unread_locked.gif b/phpBB/styles/subsilver2/theme/images/forum_unread_locked.gif Binary files differdeleted file mode 100644 index 58a79c376c..0000000000 --- a/phpBB/styles/subsilver2/theme/images/forum_unread_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/forum_unread_subforum.gif b/phpBB/styles/subsilver2/theme/images/forum_unread_subforum.gif Binary files differdeleted file mode 100644 index af3c93b1a1..0000000000 --- a/phpBB/styles/subsilver2/theme/images/forum_unread_subforum.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_faq.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_faq.gif Binary files differdeleted file mode 100644 index fc50e7ca30..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_faq.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_groups.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_groups.gif Binary files differdeleted file mode 100644 index a4d1c7bb70..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_groups.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_login.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_login.gif Binary files differdeleted file mode 100644 index c7590a423f..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_login.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_members.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_members.gif Binary files differdeleted file mode 100644 index d636089b38..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_members.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_message.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_message.gif Binary files differdeleted file mode 100644 index b8aea1eafb..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_message.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_notification.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_notification.gif Binary files differdeleted file mode 100644 index f165d3cb27..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_notification.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_profile.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_profile.gif Binary files differdeleted file mode 100644 index 1ec7c649e9..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_profile.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_register.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_register.gif Binary files differdeleted file mode 100644 index b49ac31ec9..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_register.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_mini_search.gif b/phpBB/styles/subsilver2/theme/images/icon_mini_search.gif Binary files differdeleted file mode 100644 index 2bd1a648c0..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_mini_search.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_post_target.gif b/phpBB/styles/subsilver2/theme/images/icon_post_target.gif Binary files differdeleted file mode 100644 index d172abb060..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_post_target.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_post_target_unread.gif b/phpBB/styles/subsilver2/theme/images/icon_post_target_unread.gif Binary files differdeleted file mode 100644 index 8ec44a1787..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_post_target_unread.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_topic_attach.gif b/phpBB/styles/subsilver2/theme/images/icon_topic_attach.gif Binary files differdeleted file mode 100644 index 1c9c89bc70..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_topic_attach.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_topic_deleted.png b/phpBB/styles/subsilver2/theme/images/icon_topic_deleted.png Binary files differdeleted file mode 100644 index 494b4fb563..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_topic_deleted.png +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_topic_latest.gif b/phpBB/styles/subsilver2/theme/images/icon_topic_latest.gif Binary files differdeleted file mode 100644 index b45e57aedb..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_topic_latest.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_topic_newest.gif b/phpBB/styles/subsilver2/theme/images/icon_topic_newest.gif Binary files differdeleted file mode 100644 index eca2861836..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_topic_newest.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_topic_reported.gif b/phpBB/styles/subsilver2/theme/images/icon_topic_reported.gif Binary files differdeleted file mode 100644 index 026092854a..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_topic_reported.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/icon_topic_unapproved.gif b/phpBB/styles/subsilver2/theme/images/icon_topic_unapproved.gif Binary files differdeleted file mode 100644 index 2ccaf19c23..0000000000 --- a/phpBB/styles/subsilver2/theme/images/icon_topic_unapproved.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/index.htm b/phpBB/styles/subsilver2/theme/images/index.htm deleted file mode 100644 index 29531416fe..0000000000 --- a/phpBB/styles/subsilver2/theme/images/index.htm +++ /dev/null @@ -1,16 +0,0 @@ -<html> -<head> -<title>subSilver created by subBlue Design</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -</head> - -<body bgcolor="#FFFFFF" text="#000000"> - -<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td align="center" valign="middle"><a href="http://www.subblue.com/" target="_new"><img src="created_by.jpg" width="400" height="300" alt="Created by subBlue Design" /></a></td> - </tr> -</table> - -</body> -</html>
\ No newline at end of file diff --git a/phpBB/styles/subsilver2/theme/images/no_avatar.gif b/phpBB/styles/subsilver2/theme/images/no_avatar.gif Binary files differdeleted file mode 100644 index ad73330e71..0000000000 --- a/phpBB/styles/subsilver2/theme/images/no_avatar.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/poll_center.gif b/phpBB/styles/subsilver2/theme/images/poll_center.gif Binary files differdeleted file mode 100644 index 99473151ec..0000000000 --- a/phpBB/styles/subsilver2/theme/images/poll_center.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/poll_left.gif b/phpBB/styles/subsilver2/theme/images/poll_left.gif Binary files differdeleted file mode 100644 index 269088b81d..0000000000 --- a/phpBB/styles/subsilver2/theme/images/poll_left.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/poll_right.gif b/phpBB/styles/subsilver2/theme/images/poll_right.gif Binary files differdeleted file mode 100644 index f9584e23a1..0000000000 --- a/phpBB/styles/subsilver2/theme/images/poll_right.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/site_logo.gif b/phpBB/styles/subsilver2/theme/images/site_logo.gif Binary files differdeleted file mode 100644 index abce3cd51d..0000000000 --- a/phpBB/styles/subsilver2/theme/images/site_logo.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/spacer.gif b/phpBB/styles/subsilver2/theme/images/spacer.gif Binary files differdeleted file mode 100644 index 5bfd67a2d6..0000000000 --- a/phpBB/styles/subsilver2/theme/images/spacer.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_read.gif b/phpBB/styles/subsilver2/theme/images/sticky_read.gif Binary files differdeleted file mode 100644 index 09861a996c..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_read.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_read_locked.gif b/phpBB/styles/subsilver2/theme/images/sticky_read_locked.gif Binary files differdeleted file mode 100644 index 24bca303d6..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_read_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_read_locked_mine.gif b/phpBB/styles/subsilver2/theme/images/sticky_read_locked_mine.gif Binary files differdeleted file mode 100644 index 3fd04ec3a9..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_read_locked_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_read_mine.gif b/phpBB/styles/subsilver2/theme/images/sticky_read_mine.gif Binary files differdeleted file mode 100644 index 381634c364..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_read_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_unread.gif b/phpBB/styles/subsilver2/theme/images/sticky_unread.gif Binary files differdeleted file mode 100644 index dd2e366543..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_unread.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_unread_locked.gif b/phpBB/styles/subsilver2/theme/images/sticky_unread_locked.gif Binary files differdeleted file mode 100644 index 608f4822e3..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_unread_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_unread_locked_mine.gif b/phpBB/styles/subsilver2/theme/images/sticky_unread_locked_mine.gif Binary files differdeleted file mode 100644 index fe5e115312..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_unread_locked_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/sticky_unread_mine.gif b/phpBB/styles/subsilver2/theme/images/sticky_unread_mine.gif Binary files differdeleted file mode 100644 index b5fc3b3627..0000000000 --- a/phpBB/styles/subsilver2/theme/images/sticky_unread_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_moved.gif b/phpBB/styles/subsilver2/theme/images/topic_moved.gif Binary files differdeleted file mode 100644 index fe758f02ca..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_moved.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_read.gif b/phpBB/styles/subsilver2/theme/images/topic_read.gif Binary files differdeleted file mode 100644 index c16bfa75d5..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_read.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_read_hot.gif b/phpBB/styles/subsilver2/theme/images/topic_read_hot.gif Binary files differdeleted file mode 100644 index a7a7e8fc78..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_read_hot.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_read_hot_mine.gif b/phpBB/styles/subsilver2/theme/images/topic_read_hot_mine.gif Binary files differdeleted file mode 100644 index 853452a74b..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_read_hot_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_read_locked.gif b/phpBB/styles/subsilver2/theme/images/topic_read_locked.gif Binary files differdeleted file mode 100644 index 10eb776972..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_read_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_read_locked_mine.gif b/phpBB/styles/subsilver2/theme/images/topic_read_locked_mine.gif Binary files differdeleted file mode 100644 index 3f24928b48..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_read_locked_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_read_mine.gif b/phpBB/styles/subsilver2/theme/images/topic_read_mine.gif Binary files differdeleted file mode 100644 index 560927aa06..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_read_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_unread.gif b/phpBB/styles/subsilver2/theme/images/topic_unread.gif Binary files differdeleted file mode 100644 index 4e56157dce..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_unread.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_unread_hot.gif b/phpBB/styles/subsilver2/theme/images/topic_unread_hot.gif Binary files differdeleted file mode 100644 index ceef4919d5..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_unread_hot.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_unread_hot_mine.gif b/phpBB/styles/subsilver2/theme/images/topic_unread_hot_mine.gif Binary files differdeleted file mode 100644 index 1c748f708a..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_unread_hot_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_unread_locked.gif b/phpBB/styles/subsilver2/theme/images/topic_unread_locked.gif Binary files differdeleted file mode 100644 index 720e210289..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_unread_locked.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_unread_locked_mine.gif b/phpBB/styles/subsilver2/theme/images/topic_unread_locked_mine.gif Binary files differdeleted file mode 100644 index 90873431ef..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_unread_locked_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/topic_unread_mine.gif b/phpBB/styles/subsilver2/theme/images/topic_unread_mine.gif Binary files differdeleted file mode 100644 index 34fd2ec179..0000000000 --- a/phpBB/styles/subsilver2/theme/images/topic_unread_mine.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/upload_bar.gif b/phpBB/styles/subsilver2/theme/images/upload_bar.gif Binary files differdeleted file mode 100644 index 75cf61c59e..0000000000 --- a/phpBB/styles/subsilver2/theme/images/upload_bar.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/images/whosonline.gif b/phpBB/styles/subsilver2/theme/images/whosonline.gif Binary files differdeleted file mode 100644 index b450927432..0000000000 --- a/phpBB/styles/subsilver2/theme/images/whosonline.gif +++ /dev/null diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css deleted file mode 100644 index da99051329..0000000000 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ /dev/null @@ -1,1217 +0,0 @@ -/* phpBB3 Style Sheet - -------------------------------------------------------------- - Style name: subsilver2 - Based on style: subSilver (the default phpBB 2.0.x style) - Original author: Tom Beddard ( http://www.subblue.com/ ) - Modified by: phpBB Group ( https://www.phpbb.com/ ) - -------------------------------------------------------------- -*/ - -/* Layout - ------------ */ -* { - /* Reset browsers default margin, padding and font sizes */ - margin: 0; - padding: 0; -} - -html { - font-size: 100%; -} - -body { - /* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */ - font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; - color: #323D4F; - background-color: #FFFFFF; - font-size: 62.5%; /* This sets the default font size to be equivalent to 10px */ - margin: 0; -} - -#wrapheader { - height: auto !important; - padding: 0; -} - -#wrapcentre { - margin: 15px 25px 0 25px; -} - -#wrapfooter { - text-align: center; - clear: both; -} - -#wrapnav { - width: 100%; - margin: 0; - background-color: #ECECEC; - border-width: 1px; - border-style: solid; - border-color: #A9B8C2; -} - -#logodesc { - background-color: #C1CAD2; - background-image: url('./images/background.gif'); - background-repeat: repeat-x; - background-position: center bottom; - padding: 0 25px 15px 25px; -} - -#menubar { - margin: 0 25px; -} - -#datebar { - margin: 10px 25px 0 25px; -} - -#findbar { - width: 100%; - margin: 0; - padding: 0; - border: 0; -} - -.forumrules { - background-color: #F9CC79; - border-width: 1px; - border-style: solid; - border-color: #BB9860; - padding: 4px; - font-weight: normal; - font-size: 1.1em; - font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; -} - -.forumrules h3 { - color: red; -} - -#pageheader { } -#pagecontent { } -#pagefooter { } - -#poll { } -#postrow { } -#postdata { } - - -/* Text - --------------------- */ -h1 { - color: black; - font-family: "Lucida Grande", "Trebuchet MS", Verdana, sans-serif; - font-weight: bold; - font-size: 1.8em; - text-decoration: none; -} - -h2 { - font-family: Arial, Helvetica, sans-serif; - font-weight: bold; - font-size: 1.5em; - text-decoration: none; - line-height: 120%; -} - -h3 { - font-size: 1.3em; - font-weight: bold; - font-family: Arial, Helvetica, sans-serif; - line-height: 120%; -} - -h4 { - margin: 0; - font-size: 1.1em; - font-weight: bold; -} - -p { - font-size: 1.1em; -} - -p.moderators { - margin: 0; - float: left; - color: black; - font-weight: bold; -} - -.rtl p.moderators { - float: right; -} - -p.linkmcp { - margin: 0; - float: right; - white-space: nowrap; -} - -.rtl p.linkmcp { - float: left; -} - -p.breadcrumbs { - margin: 0; - float: left; - color: black; - font-weight: bold; - white-space: normal; - font-size: 1em; -} - -.rtl p.breadcrumbs { - float: right; -} - -p.datetime { - margin: 0; - float: right; - white-space: nowrap; - font-size: 1em; -} - -.rtl p.datetime { - float: left; -} - -p.searchbar { - padding: 2px 0; - white-space: nowrap; -} - -p.searchbarreg { - margin: 0; - float: right; - white-space: nowrap; -} - -.rtl p.searchbarreg { - float: left; -} - -p.forumdesc { - padding-bottom: 4px; -} - -p.topicauthor { - margin: 1px 0; -} - -p.topicdetails { - margin: 1px 0; -} - -.postreported, .postreported a:link, .postreported a:visited, .postreported a:hover, .postreported a:active { - margin: 1px 0; - color: red; - font-weight:bold; -} - -.postapprove, .postapprove a:link, .postapprove a:visited, .postapprove a:hover, .postapprove a:active { - color: green; - font-weight:bold; -} - -.postapprove img, .postreported img { - vertical-align: bottom; - padding-top: 5px; -} - -.postauthor { - color: #000000; -} - -.postdetails { - color: #000000; -} - -.postbody { - font-size: 1.3em; - line-height: 1.4em; - font-family: "Lucida Grande", "Trebuchet MS", Helvetica, Arial, sans-serif; -} - -.postbody li, ol, ul { - margin: 0 0 0 1.5em; -} - -.rtl .postbody li, .rtl ol, .rtl ul { - margin: 0 1.5em 0 0; -} - -.posthilit { - background-color: yellow; -} - -.nav { - margin: 0; - color: black; - font-weight: bold; -} - -.pagination { - padding: 4px; - color: black; - font-size: 1em; - font-weight: bold; -} - -.cattitle { - -} - -.gen { - margin: 1px 1px; - font-size: 1.2em; -} - -.genmed { - margin: 1px 1px; - font-size: 1.1em; -} - -.gensmall { - margin: 1px 1px; - font-size: 1em; -} - -.copyright { - color: #444; - font-weight: normal; - font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; -} - -.titles { - font-family: "Lucida Grande", Helvetica, Arial, sans-serif; - font-weight: bold; - font-size: 1.3em; - text-decoration: none; -} - -.online { - color: green; -} - -.offline, .error, .inactive { - color: red; -} - - -/* Tables - ------------ */ -#color_palette_placeholder table { - border-collapse: separate; - border-spacing: 1px; -} - -#color_palette_placeholder td { - padding: 0; -} - -th { - color: #FFA34F; - font-size: 1.1em; - font-weight: bold; - background-color: #006699; - background-image: url('./images/cellpic3.gif'); - white-space: nowrap; - padding: 7px 5px; -} - -td { - padding: 2px; -} -td.profile { - padding: 4px; -} - -.tablebg { - background-color: #A9B8C2; -} - -.catdiv { - height: 28px; - margin: 0; - padding: 0; - border: 0; - background: white url('./images/cellpic2.jpg') repeat-y scroll top left; -} -.rtl .catdiv { - background: white url('./images/cellpic2_rtl.jpg') repeat-y scroll top right; -} - -.cat { - height: 28px; - margin: 0; - padding: 0; - border: 0; - background-color: #C7D0D7; - background-image: url('./images/cellpic1.gif'); - text-indent: 4px; -} - -.row1 { - background-color: #ECECEC; - padding: 4px; -} - -.row2 { - background-color: #DCE1E5; - padding: 4px; -} - -.row3 { - background-color: #C0C8D0; - padding: 4px; -} - -.spacer { - background-color: #D1D7DC; -} - -.current { - background-color: lightblue; -} - -hr { - height: 1px; - border-width: 0; - background-color: #D1D7DC; - color: #D1D7DC; -} - -.legend { - text-align:center; - margin: 0 auto; -} - -/* Links - ------------ */ - -/* Links adjustment to correctly display an order of rtl/ltr mixed content */ -.rtl a { - direction: rtl; - unicode-bidi: embed; -} - -/* CSS spec requires a:link, a:visited, a:hover and a:active rules to be specified in this order. */ -/* See http://www.phpbb.com/bugs/phpbb3/59685 */ -a:link { - color: #006597; - text-decoration: none; -} - -a:visited { - color: #005784; - text-decoration: none; -} - -a:hover { - color: #D46400; - text-decoration: underline; -} - -a:active { - color: #005784; - text-decoration: none; -} - -a.forumlink { - color: #069; - font-weight: bold; - font-family: "Lucida Grande", Helvetica, Arial, sans-serif; - font-size: 1.2em; -} - -a.topictitle { - margin: 1px 0; - font-family: "Lucida Grande", Helvetica, Arial, sans-serif; - font-weight: bold; - font-size: 1.2em; -} - -a.topictitle:visited { - color: #5493B4; - text-decoration: none; -} - -a.lastsubject { - font-weight: bold; - text-decoration: none; -} - -a.lastsubject:hover { - text-decoration: underline; -} - -th a, -th a:visited { - color: #FFA34F !important; - text-decoration: none; -} - -th a:hover { - text-decoration: underline; -} - - -/* Form Elements - ------------ */ -form { - margin: 0; - padding: 0; - border: 0; -} - -input { - color: #333333; - font-family: "Lucida Grande", Verdana, Helvetica, sans-serif; - font-size: 1.1em; - font-weight: normal; - padding: 1px; - border: 1px solid #A9B8C2; - background-color: #FAFAFA; -} - -textarea { - background-color: #FAFAFA; - color: #333333; - font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; - font-size: 1.3em; - line-height: 1.4em; - font-weight: normal; - border: 1px solid #A9B8C2; - padding: 2px; -} - -select { - color: #333333; - background-color: #FAFAFA; - font-family: "Lucida Grande", Verdana, Helvetica, sans-serif; - font-size: 1.1em; - font-weight: normal; - border: 1px solid #A9B8C2; - padding: 1px; -} - -option { - padding: 0 1em 0 0; -} - -option.disabled-option { - color: graytext; -} - -.rtl option { - padding: 0 0 0 1em; -} - -input.radio { - border: none; - background-color: transparent; -} - -.post { - background-color: white; - border-style: solid; - border-width: 1px; -} - -.btnbbcode { - color: #000000; - font-weight: normal; - font-size: 1.1em; - font-family: "Lucida Grande", Verdana, Helvetica, sans-serif; - background-color: #EFEFEF; - border: 1px solid #666666; -} - -.btnmain { - font-weight: bold; - background-color: #ECECEC; - border: 1px solid #A9B8C2; - cursor: pointer; - padding: 1px 5px; - font-size: 1.1em; -} - -.btnlite { - font-weight: normal; - background-color: #ECECEC; - border: 1px solid #A9B8C2; - cursor: pointer; - padding: 1px 5px; - font-size: 1.1em; -} - -.btnfile { - font-weight: normal; - background-color: #ECECEC; - border: 1px solid #A9B8C2; - padding: 1px 5px; - font-size: 1.1em; -} - -.helpline { - background-color: #DEE3E7; - border-style: none; -} - -input:focus, select:focus, textarea:focus { - outline-style: none; -} - -/* BBCode - ------------ */ -.quotetitle, .attachtitle { - margin: 10px 5px 0 5px; - padding: 4px; - border-width: 1px 1px 0 1px; - border-style: solid; - border-color: #A9B8C2; - color: #333333; - background-color: #A9B8C2; - font-size: 0.85em; - font-weight: bold; -} - -.quotetitle .quotetitle { - font-size: 1em; -} - -.quotecontent, .attachcontent { - margin: 0 5px 10px 5px; - padding: 5px; - border-color: #A9B8C2; - border-width: 0 1px 1px 1px; - border-style: solid; - font-weight: normal; - font-size: 1em; - line-height: 1.4em; - font-family: "Lucida Grande", "Trebuchet MS", Helvetica, Arial, sans-serif; - background-color: #FAFAFA; - color: #4B5C77; -} - -.attachcontent { - font-size: 0.85em; -} - -.codetitle { - margin: 10px 5px 0 5px; - padding: 2px 4px; - border-width: 1px 1px 0 1px; - border-style: solid; - border-color: #A9B8C2; - color: #333333; - background-color: #A9B8C2; - font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; - font-size: 0.8em; -} - -.codecontent { - direction: ltr; - margin: 0 5px 10px 5px; - padding: 5px; - border-color: #A9B8C2; - border-width: 0 1px 1px 1px; - border-style: solid; - font-weight: normal; - color: #006600; - font-size: 0.85em; - font-family: Monaco, 'Courier New', monospace; - background-color: #FAFAFA; -} - -.syntaxbg { - color: #FFFFFF; -} - -.syntaxcomment { - color: #FF8000; -} - -.syntaxdefault { - color: #0000BB; -} - -.syntaxhtml { - color: #000000; -} - -.syntaxkeyword { - color: #007700; -} - -.syntaxstring { - color: #DD0000; -} - - -/* Private messages - ------------------ */ -.pm_marked_colour { - background-color: #000000; -} - -.pm_replied_colour { - background-color: #A9B8C2; -} - -.pm_friend_colour { - background-color: #007700; -} - -.pm_foe_colour { - background-color: #DD0000; -} - - -/* Misc - ------------ */ -img { - border: none; -} - -.sep { - color: black; - background-color: #FFA34F; -} - -table.colortable td { - padding: 0; -} - -pre { - font-size: 1.1em; - font-family: Monaco, 'Courier New', monospace; -} - -.nowrap { - white-space: nowrap; -} - -.username-coloured { - font-weight: bold; -} - - -/* Former imageset */ -span.imageset { - display: inline-block; - background: transparent none 0 0 no-repeat; - margin: 0; - padding: 0; - width: 0; - height: 0; - overflow: hidden; -} -a.imageset { - text-decoration: none !important; -} - -/* Global imageset items */ -.imageset.site_logo { - background-image: url("./images/site_logo.gif"); - padding-left: 170px; - padding-top: 94px; -} -.imageset.upload_bar { - background-image: url("./images/upload_bar.gif"); - padding-left: 280px; - padding-top: 16px; -} -.imageset.poll_left { - background-image: url("./images/poll_left.gif"); - padding-left: 4px; - padding-top: 12px; -} -.imageset.poll_center { - background-image: url("./images/poll_center.gif"); - padding-left: 1px; - padding-top: 12px; -} -.imageset.poll_right { - background-image: url("./images/poll_right.gif"); - padding-left: 4px; - padding-top: 12px; -} -.imageset.forum_link { - background-image: url("./images/forum_link.gif"); - padding-left: 46px; - padding-top: 25px; -} -.imageset.forum_read { - background-image: url("./images/forum_read.gif"); - padding-left: 46px; - padding-top: 25px; -} -.imageset.forum_read_locked { - background-image: url("./images/forum_read_locked.gif"); - padding-left: 46px; - padding-top: 25px; -} -.imageset.forum_read_subforum { - background-image: url("./images/forum_read_subforum.gif"); - padding-left: 46px; - padding-top: 25px; -} -.imageset.forum_unread { - background-image: url("./images/forum_unread.gif"); - padding-left: 46px; - padding-top: 25px; -} -.imageset.forum_unread_locked { - background-image: url("./images/forum_unread_locked.gif"); - padding-left: 46px; - padding-top: 25px; -} -.imageset.forum_unread_subforum { - background-image: url("./images/forum_unread_subforum.gif"); - padding-left: 46px; - padding-top: 25px; -} -.imageset.topic_moved { - background-image: url("./images/topic_moved.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_read { - background-image: url("./images/topic_read.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_read_mine { - background-image: url("./images/topic_read_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_read_hot { - background-image: url("./images/topic_read_hot.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_read_hot_mine { - background-image: url("./images/topic_read_hot_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_read_locked { - background-image: url("./images/topic_read_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_read_locked_mine { - background-image: url("./images/topic_read_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_unread { - background-image: url("./images/topic_unread.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_unread_mine { - background-image: url("./images/topic_unread_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_unread_hot { - background-image: url("./images/topic_unread_hot.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_unread_hot_mine { - background-image: url("./images/topic_unread_hot_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_unread_locked { - background-image: url("./images/topic_unread_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.topic_unread_locked_mine { - background-image: url("./images/topic_unread_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_read { - background-image: url("./images/sticky_read.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_read_mine { - background-image: url("./images/sticky_read_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_read_locked { - background-image: url("./images/sticky_read_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_read_locked_mine { - background-image: url("./images/sticky_read_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_unread { - background-image: url("./images/sticky_unread.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_unread_mine { - background-image: url("./images/sticky_unread_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_unread_locked { - background-image: url("./images/sticky_unread_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.sticky_unread_locked_mine { - background-image: url("./images/sticky_unread_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_read { - background-image: url("./images/announce_read.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_read_mine { - background-image: url("./images/announce_read_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_read_locked { - background-image: url("./images/announce_read_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_read_locked_mine { - background-image: url("./images/announce_read_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_unread { - background-image: url("./images/announce_unread.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_unread_mine { - background-image: url("./images/announce_unread_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_unread_locked { - background-image: url("./images/announce_unread_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.announce_unread_locked_mine { - background-image: url("./images/announce_unread_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_read { - background-image: url("./images/announce_read.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_read_mine { - background-image: url("./images/announce_read_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_read_locked { - background-image: url("./images/announce_read_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_read_locked_mine { - background-image: url("./images/announce_read_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_unread { - background-image: url("./images/announce_unread.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_unread_mine { - background-image: url("./images/announce_unread_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_unread_locked { - background-image: url("./images/announce_unread_locked.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.global_unread_locked_mine { - background-image: url("./images/announce_unread_locked_mine.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.pm_read { - background-image: url("./images/topic_read.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.pm_unread { - background-image: url("./images/topic_unread.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.icon_post_target { - background-image: url("./images/icon_post_target.gif"); - padding-left: 12px; - padding-top: 9px; -} -.imageset.icon_post_target_unread { - background-image: url("./images/icon_post_target_unread.gif"); - padding-left: 12px; - padding-top: 9px; -} -.imageset.icon_topic_attach { - background-image: url("./images/icon_topic_attach.gif"); - padding-left: 14px; - padding-top: 18px; -} -.imageset.icon_topic_latest { - background-image: url("./images/icon_topic_latest.gif"); - padding-left: 18px; - padding-top: 9px; -} -.imageset.icon_topic_newest { - background-image: url("./images/icon_topic_newest.gif"); - padding-left: 18px; - padding-top: 9px; -} -.imageset.icon_topic_reported { - background-image: url("./images/icon_topic_reported.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.icon_topic_unapproved { - background-image: url("./images/icon_topic_unapproved.gif"); - padding-left: 19px; - padding-top: 18px; -} -.imageset.icon_topic_deleted { - background-image: url("./images/icon_topic_deleted.png"); - padding-left: 14px; - padding-top: 14px; -} - - -/* English images for fallback */ -.imageset.icon_contact_aim { - background-image: url("./en/icon_contact_aim.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_email { - background-image: url("./en/icon_contact_email.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_icq { - background-image: url("./en/icon_contact_icq.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_jabber { - background-image: url("./en/icon_contact_jabber.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_msnm { - background-image: url("./en/icon_contact_msnm.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_pm { - background-image: url("./en/icon_contact_pm.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_yahoo { - background-image: url("./en/icon_contact_yahoo.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_contact_www { - background-image: url("./en/icon_contact_www.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_post_delete { - background-image: url("./en/icon_post_delete.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_edit { - background-image: url("./en/icon_post_edit.gif"); - padding-left: 90px; - padding-top: 20px; -} -.imageset.icon_post_info { - background-image: url("./en/icon_post_info.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_post_quote { - background-image: url("./en/icon_post_quote.gif"); - padding-left: 90px; - padding-top: 20px; -} -.imageset.icon_post_report { - background-image: url("./en/icon_post_report.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.icon_user_online { - background-image: url("./en/icon_user_online.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_offline { - background-image: url("./en/icon_user_offline.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_profile { - background-image: url("./en/icon_user_profile.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_search { - background-image: url("./en/icon_user_search.gif"); - padding-left: 72px; - padding-top: 20px; -} -.imageset.icon_user_warn { - background-image: url("./en/icon_user_warn.gif"); - padding-left: 20px; - padding-top: 20px; -} -.imageset.button_pm_new { - background-image: url("./en/button_pm_new.gif"); - padding-left: 97px; - padding-top: 27px; -} -.imageset.button_pm_reply { - background-image: url("./en/button_pm_reply.gif"); - padding-left: 90px; - padding-top: 20px; -} -.imageset.button_topic_locked { - background-image: url("./en/button_topic_locked.gif"); - padding-left: 97px; - padding-top: 27px; -} -.imageset.button_topic_new { - background-image: url("./en/button_topic_new.gif"); - padding-left: 97px; - padding-top: 27px; -} -.imageset.button_topic_reply { - background-image: url("./en/button_topic_reply.gif"); - padding-left: 97px; - padding-top: 27px; -} - -/* RTL imageset entries */ -.rtl .imageset.site_logo { - padding-right: 170px; - padding-left: 0; -} -.rtl .imageset.upload_bar { - padding-right: 280px; - padding-left: 0; -} -.rtl .imageset.poll_left, .rtl .imageset.poll_right { - padding-right: 4px; - padding-left: 0; -} -.rtl .imageset.poll_center { - padding-right: 1px; - padding-left: 0; -} -.rtl .imageset.forum_link, .rtl .imageset.forum_read, .rtl .imageset.forum_read_locked, .rtl .imageset.forum_read_subforum, .rtl .imageset.forum_unread, .rtl .imageset.forum_unread_locked, .rtl .imageset.forum_unread_subforum { - padding-right: 46px; - padding-left: 0; -} -.rtl .imageset.topic_moved, .rtl .imageset.topic_read, .rtl .imageset.topic_read_mine, .rtl .imageset.topic_read_hot, .rtl .imageset.topic_read_hot_mine, .rtl .imageset.topic_read_locked, .rtl .imageset.topic_read_locked_mine, .rtl .imageset.topic_unread, .rtl .imageset.topic_unread_mine, .rtl .imageset.topic_unread_hot, .rtl .imageset.topic_unread_hot_mine, .rtl .imageset.topic_unread_locked, .rtl .imageset.topic_unread_locked_mine, .rtl .imageset.sticky_read, .rtl .imageset.sticky_read_mine, .rtl .imageset.sticky_read_locked, .rtl .imageset.sticky_read_locked_mine, .rtl .imageset.sticky_unread, .rtl .imageset.sticky_unread_mine, .rtl .imageset.sticky_unread_locked, .rtl .imageset.sticky_unread_locked_mine, .rtl .imageset.announce_read, .rtl .imageset.announce_read_mine, .rtl .imageset.announce_read_locked, .rtl .imageset.announce_read_locked_mine, .rtl .imageset.announce_unread, .rtl .imageset.announce_unread_mine, .rtl .imageset.announce_unread_locked, .rtl .imageset.announce_unread_locked_mine, .rtl .imageset.global_read, .rtl .imageset.global_read_mine, .rtl .imageset.global_read_locked, .rtl .imageset.global_read_locked_mine, .rtl .imageset.global_unread, .rtl .imageset.global_unread_mine, .rtl .imageset.global_unread_locked, .rtl .imageset.global_unread_locked_mine, .rtl .imageset.pm_read, .rtl .imageset.pm_unread, .rtl .imageset.icon_topic_reported, .rtl .imageset.icon_topic_unapproved { - padding-right: 19px; - padding-left: 0; -} -.rtl .imageset.icon_post_target, .rtl .imageset.icon_post_target_unread { - padding-right: 12px; - padding-left: 0; -} -.rtl .imageset.icon_topic_attach { - padding-right: 14px; - padding-left: 0; -} -.rtl .imageset.icon_topic_latest, .rtl .imageset.icon_topic_newest { - padding-right: 18px; - padding-left: 0; -} - -#notification_list { - display: none; - position: absolute; - width: 310px; - z-index: 1; - box-shadow: 3px 3px 5px darkgray; -} - -#notification_list .notification_scroll { - max-height: 350px; - overflow-y: auto; - overflow-x: hidden; -} - -#notification_list .notification_title { - padding: 5px; -} - -#notification_list .header { - width: 298px; - padding: 5px; - font-weight: bold; - border: 1px solid #A9B8C2; - border-bottom: 0; -} - -#notification_list > .header > .header_settings { - float: right; - font-weight: normal; - text-transform: none; -} - -#notification_list .footer { - width: 300px; - text-align: center; - font-size: 1.2em; - border: 1px solid #A9B8C2; - border-top: 0; -} - -.notification_list img { - max-width: 50px; - max-height: 50px; -} - -#notification_list .footer > a { - display: block; -} diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 0c587cbf28..720b56ae8b 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -1,9 +1,13 @@ <?php /** * -* @package ucp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,8 +22,8 @@ require($phpbb_root_path . 'includes/functions_user.' . $phpEx); require($phpbb_root_path . 'includes/functions_module.' . $phpEx); // Basic parameter data -$id = request_var('i', ''); -$mode = request_var('mode', ''); +$id = $request->variable('i', ''); +$mode = $request->variable('mode', ''); if (in_array($mode, array('login', 'login_link', 'logout', 'confirm', 'sendpassword', 'activate'))) { @@ -77,7 +81,7 @@ switch ($mode) redirect(append_sid("{$phpbb_root_path}index.$phpEx")); } - login_box(request_var('redirect', "index.$phpEx")); + login_box($request->variable('redirect', "index.$phpEx")); break; case 'login_link': @@ -94,7 +98,6 @@ switch ($mode) if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id) { $user->session_kill(); - $user->session_begin(); } else if ($user->data['user_id'] != ANONYMOUS) { @@ -128,7 +131,7 @@ switch ($mode) ); // Disable online list - page_header($user->lang[$title], false); + page_header($user->lang[$title]); $template->assign_vars(array( 'S_AGREEMENT' => true, @@ -161,6 +164,22 @@ switch ($mode) $cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name); + /** + * Event to save custom cookies from deletion + * + * @event core.ucp_delete_cookies + * @var string cookie_name Cookie name to checking + * @var bool retain_cookie Do we retain our cookie or not, true if retain + * @since 3.1.3-RC1 + */ + $retain_cookie = false; + $vars = array('cookie_name', 'retain_cookie'); + extract($phpbb_dispatcher->trigger_event('core.ucp_delete_cookies', compact($vars))); + if ($retain_cookie) + { + continue; + } + // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_ if (strpos($cookie_name, 'poll_') !== 0) { @@ -193,7 +212,7 @@ switch ($mode) case 'switch_perm': - $user_id = request_var('u', 0); + $user_id = $request->variable('u', 0); $sql = 'SELECT * FROM ' . USERS_TABLE . ' @@ -202,7 +221,7 @@ switch ($mode) $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id'] || !check_link_hash(request_var('hash', ''), 'switchperm')) + if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id'] || !check_link_hash($request->variable('hash', ''), 'switchperm')) { redirect(append_sid("{$phpbb_root_path}index.$phpEx")); } @@ -215,7 +234,7 @@ switch ($mode) redirect(append_sid("{$phpbb_root_path}index.$phpEx")); } - add_log('admin', 'LOG_ACL_TRANSFER_PERMISSIONS', $user_row['username']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_TRANSFER_PERMISSIONS', false, array($user_row['username'])); $message = sprintf($user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); trigger_error($message); @@ -238,7 +257,7 @@ switch ($mode) $username = $db->sql_fetchfield('username'); $db->sql_freeresult($result); - add_log('admin', 'LOG_ACL_RESTORE_PERMISSIONS', $username); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_RESTORE_PERMISSIONS', false, array($username)); $message = $user->lang['PERMISSIONS_RESTORED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); trigger_error($message); @@ -266,7 +285,7 @@ if (!$user->data['is_registered']) if ($id == 'pm' && $mode == 'view' && isset($_GET['p'])) { - $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx?i=pm&p=" . request_var('p', 0)); + $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx?i=pm&p=" . $request->variable('p', 0)); login_box($redirect_url, $user->lang['LOGIN_EXPLAIN_UCP']); } @@ -338,7 +357,7 @@ if (!$config['allow_topic_notify'] && !$config['allow_forum_notify']) * @var p_master module Object holding all modules and their status * @var mixed id Active module category (can be the int or string) * @var string mode Active module -* @since 3.1-A1 +* @since 3.1.0-a1 */ $vars = array('module', 'id', 'mode'); extract($phpbb_dispatcher->trigger_event('core.ucp_display_module_before', compact($vars))); @@ -353,24 +372,4 @@ $module->load_active(); $module->assign_tpl_vars(append_sid("{$phpbb_root_path}ucp.$phpEx")); // Generate the page, do not display/query online list -$module->display($module->get_page_title(), false); - -/** -* Function for assigning a template var if the zebra module got included -*/ -function _module_zebra($mode, &$module_row) -{ - global $template; - - $template->assign_var('S_ZEBRA_ENABLED', true); - - if ($mode == 'friends') - { - $template->assign_var('S_ZEBRA_FRIENDS_ENABLED', true); - } - - if ($mode == 'foes') - { - $template->assign_var('S_ZEBRA_FOES_ENABLED', true); - } -} +$module->display($module->get_page_title()); diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 7f194bbcef..c9a081cc0e 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,18 +25,19 @@ $user->session_begin(); $auth->acl($user->data); // Start initial var setup -$forum_id = request_var('f', 0); -$mark_read = request_var('mark', ''); -$start = request_var('start', 0); +$forum_id = $request->variable('f', 0); +$mark_read = $request->variable('mark', ''); +$start = $request->variable('start', 0); $default_sort_days = (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0; $default_sort_key = (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'; $default_sort_dir = (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'; -$sort_days = request_var('st', $default_sort_days); -$sort_key = request_var('sk', $default_sort_key); -$sort_dir = request_var('sd', $default_sort_dir); +$sort_days = $request->variable('st', $default_sort_days); +$sort_key = $request->variable('sk', $default_sort_key); +$sort_dir = $request->variable('sd', $default_sort_dir); +/* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); // Check if the user has actually sent a forum ID with his/her request @@ -142,6 +147,7 @@ else } } +/* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // Dump out the page header and load viewforum template @@ -180,10 +186,10 @@ if (!$auth->acl_get('f_read', $forum_id)) // Handle marking posts if ($mark_read == 'topics') { - $token = request_var('hash', ''); + $token = $request->variable('hash', ''); if (check_link_hash($token, 'global')) { - markread('topics', array($forum_id), false, request_var('mark_time', 0)); + markread('topics', array($forum_id), false, $request->variable('mark_time', 0)); } $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); meta_refresh(3, $redirect_url); @@ -214,6 +220,7 @@ if ($forum_data['forum_topics_per_page']) // Do the forum Prune thang - cron type job ... if (!$config['use_system_cron']) { + /* @var $cron \phpbb\cron\manager */ $cron = $phpbb_container->get('cron.manager'); $task = $cron->find_task('cron.task.core.prune_forum'); @@ -224,6 +231,18 @@ if (!$config['use_system_cron']) $url = $task->get_url(); $template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />'); } + else + { + // See if we should prune the shadow topics instead + $task = $cron->find_task('cron.task.core.prune_shadow_topics'); + $task->set_forum_data($forum_data); + + if ($task->is_ready()) + { + $url = $task->get_url(); + $template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />'); + } + } } // Forum rules and subscription info @@ -235,7 +254,7 @@ $s_watching_forum = array( 'is_watching' => false, ); -if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS)) +if ($config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS)) { $notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL; watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status, $start, $forum_data['forum_name']); @@ -248,7 +267,7 @@ gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']); $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); -$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views'); +$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 'LOWER(t.topic_title)', 'v' => 't.topic_views'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); @@ -324,6 +343,7 @@ $template->assign_vars(array( 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), + 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), 'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'], @@ -353,6 +373,7 @@ $template->assign_vars(array( 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '', 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $forum_id) : '', 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($start == 0) ? '' : "&start=$start")), + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewforum.$phpEx", "f=$forum_id" . (($start) ? "&start=$start" : ''), true, ''), 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics&mark_time=" . time()) : '', )); @@ -373,11 +394,30 @@ $sql_array = array( /** * Event to modify the SQL query before the topic data is retrieved * +* It may also be used to override the above assigned template vars +* * @event core.viewforum_get_topic_data -* @var array sql_array The SQL array to get the data of all topics -* @since 3.1-A1 +* @var array forum_data Array with forum data +* @var array sql_array The SQL array to get the data of all topics +* @var array forum_id The forum_id whose topics are being listed +* @var array topics_count The total number of topics for display +* @var array sort_days The oldest topic displayable in elapsed days +* @var array sort_key The sorting by. It is one of the first character of (in low case): +* Author, Post time, Replies, Subject, Views +* @var array sort_dir Either "a" for ascending or "d" for descending +* @since 3.1.0-a1 +* @change 3.1.0-RC4 Added forum_data var +* @change 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars */ -$vars = array('sql_array'); +$vars = array( + 'forum_data', + 'sql_array', + 'forum_id', + 'topics_count', + 'sort_days', + 'sort_key', + 'sort_dir', +); extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_data', compact($vars))); $sql_approved = ' AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); @@ -451,11 +491,11 @@ if ($forum_data['forum_type'] == FORUM_POST) $forum_tracking_info = array(); -if ($user->data['is_registered']) +if ($user->data['is_registered'] && $config['load_db_lastread']) { $forum_tracking_info[$forum_id] = $forum_data['mark_time']; - if (!empty($global_announce_forums) && $config['load_db_lastread']) + if (!empty($global_announce_forums)) { $sql = 'SELECT forum_id, mark_time FROM ' . FORUMS_TRACK_TABLE . ' @@ -479,18 +519,27 @@ if ($start > $topics_count / 2) $store_reverse = true; // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); + $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); - $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count); - $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count); + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - sizeof($announcement_list)); + $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - sizeof($announcement_list)); } else { // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); $sql_start = $start; } +if (is_array($sort_by_sql[$sort_key])) +{ + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} + if ($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary)) { $sql_where = 't.forum_id = ' . $forum_id; @@ -506,13 +555,50 @@ else } // Grab just the sorted topic ids -$sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . " t - WHERE $sql_where +$sql_ary = array( + 'SELECT' => 't.topic_id', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => "$sql_where AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ") $sql_approved - $sql_limit_time - ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order; + $sql_limit_time", + 'ORDER_BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order, +); + +/** +* Event to modify the SQL query before the topic ids data is retrieved +* +* @event core.viewforum_get_topic_ids_data +* @var array forum_data Data about the forum +* @var array sql_ary SQL query array to get the topic ids data +* @var string sql_approved Topic visibility SQL string +* @var int sql_limit Number of records to select +* @var string sql_limit_time SQL string to limit topic_last_post_time data +* @var array sql_sort_order SQL sorting string +* @var int sql_start Offset point to start selection from +* @var string sql_where SQL WHERE clause string +* @var bool store_reverse Flag indicating if we select from the late pages +* +* @since 3.1.0-RC4 +* +* @changed 3.1.3 Added forum_data +*/ +$vars = array( + 'forum_data', + 'sql_ary', + 'sql_approved', + 'sql_limit', + 'sql_limit_time', + 'sql_sort_order', + 'sql_start', + 'sql_where', + 'store_reverse', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_ids_data', compact($vars))); + +$sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); while ($row = $db->sql_fetchrow($result)) @@ -570,7 +656,7 @@ if (sizeof($shadow_topic_list)) * * @event core.viewforum_get_shadowtopic_data * @var array sql_array SQL array to get the data of any shadowtopics - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('sql_array'); extract($phpbb_dispatcher->trigger_event('core.viewforum_get_shadowtopic_data', compact($vars))); @@ -629,10 +715,10 @@ if ($s_display_active) // We need to remove the global announcements from the forums total topic count, // otherwise the number is different from the one on the forum list -$total_topic_count = $topics_count - sizeof($global_announce_forums); +$total_topic_count = $topics_count - sizeof($announcement_list); $base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')); -$pagination->generate_template_pagination($base_url, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_topic_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'TOTAL_TOPICS' => ($s_display_active) ? false : $user->lang('VIEW_FORUM_TOPICS', (int) $total_topic_count), @@ -641,6 +727,18 @@ $template->assign_vars(array( $topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list); $topic_tracking_info = $tracking_topics = array(); +/** +* Modify topics data before we display the viewforum page +* +* @event core.viewforum_modify_topics_data +* @var array topic_list Array with current viewforum page topic ids +* @var array rowset Array with topics data (in topic_id => topic_data format) +* @var int total_topic_count Forum's total topic count +* @since 3.1.0-b3 +*/ +$vars = array('topic_list', 'rowset', 'total_topic_count'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars))); + // Okay, lets dump out the page ... if (sizeof($topic_list)) { @@ -725,7 +823,7 @@ if (sizeof($topic_list)) $view_topic_url_params = 'f=' . $row['forum_id'] . '&t=' . $topic_id; $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); - $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id'])); + $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id'])); $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])); $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; @@ -795,7 +893,7 @@ if (sizeof($topic_list)) * @event core.viewforum_modify_topicrow * @var array row Array with topic data * @var array topic_row Template array with topic data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('row', 'topic_row'); extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topicrow', compact($vars))); @@ -806,6 +904,28 @@ if (sizeof($topic_list)) $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; + /** + * Event after the topic data has been assigned to the template + * + * @event core.viewforum_topic_row_after + * @var array row Array with the topic data + * @var array rowset Array with topics data (in topic_id => topic_data format) + * @var bool s_type_switch Flag indicating if the topic type is [global] announcement + * @var int topic_id The topic ID + * @var array topic_list Array with current viewforum page topic ids + * @var array topic_row Template array with topic data + * @since 3.1.3-RC1 + */ + $vars = array( + 'row', + 'rowset', + 's_type_switch', + 'topic_id', + 'topic_list', + 'topic_row', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_topic_row_after', compact($vars))); + if ($unread_topic) { $mark_forum_read = false; diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 87813596fa..765599f165 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,12 +25,12 @@ $auth->acl($user->data); $user->setup('memberlist'); // Get and set some variables -$mode = request_var('mode', ''); -$session_id = request_var('s', ''); -$start = request_var('start', 0); -$sort_key = request_var('sk', 'b'); -$sort_dir = request_var('sd', 'd'); -$show_guests = ($config['load_online_guests']) ? request_var('sg', 0) : 0; +$mode = $request->variable('mode', ''); +$session_id = $request->variable('s', ''); +$start = $request->variable('start', 0); +$sort_key = $request->variable('sk', 'b'); +$sort_dir = $request->variable('sd', 'd'); +$show_guests = ($config['load_online_guests']) ? $request->variable('sg', 0) : 0; // Can this user view profiles/memberlist? if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) @@ -39,8 +43,12 @@ if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) login_box('', $user->lang['LOGIN_EXPLAIN_VIEWONLINE']); } +/* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); +/* @var $viewonline_helper \phpbb\viewonline_helper */ +$viewonline_helper = $phpbb_container->get('viewonline_helper'); + $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']); $sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page'); @@ -81,10 +89,26 @@ if ($mode == 'whois' && $auth->acl_get('a_') && $session_id) } // Forum info -$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id - FROM ' . FORUMS_TABLE . ' - ORDER BY left_id ASC'; -$result = $db->sql_query($sql, 600); +$sql_ary = array( + 'SELECT' => 'f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id', + 'FROM' => array( + FORUMS_TABLE => 'f', + ), + 'ORDER_BY' => 'f.left_id ASC', +); + +/** +* Modify the forum data SQL query for getting additional fields if needed +* +* @event core.viewonline_modify_forum_data_sql +* @var array sql_ary The SQL array +* @since 3.1.5-RC1 +*/ +$vars = array('sql_ary'); +extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_forum_data_sql', compact($vars))); + +$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary), 600); +unset($sql_ary); $forum_data = array(); while ($row = $db->sql_fetchrow($result)) @@ -98,9 +122,10 @@ $guest_counter = 0; // Get number of online guests (if we do not display them) if (!$show_guests) { - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': + case 'sqlite3': $sql = 'SELECT COUNT(session_ip) as num_guests FROM ( SELECT DISTINCT session_ip @@ -143,7 +168,7 @@ $sql_ary = array( * @var bool show_guests Do we display guests in the list * @var int guest_counter Number of guests displayed * @var array forum_data Array with forum data -* @since 3.1-A1 +* @since 3.1.0-a1 * @change 3.1.0-a2 Added vars guest_counter and forum_data */ $vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data'); @@ -154,6 +179,12 @@ $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); $prev_id = $prev_ip = $user_list = array(); $logged_visible_online = $logged_hidden_online = $counter = 0; +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); + +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + while ($row = $db->sql_fetchrow($result)) { if ($row['user_id'] != ANONYMOUS && !isset($prev_id[$row['user_id']])) @@ -165,7 +196,7 @@ while ($row = $db->sql_fetchrow($result)) if (!$row['session_viewonline']) { - $view_online = ($auth->acl_get('u_viewonline')) ? true : false; + $view_online = ($auth->acl_get('u_viewonline') || $row['user_id'] === $user->data['user_id']) ? true : false; $logged_hidden_online++; $username_full = '<em>' . $username_full . '</em>'; @@ -208,11 +239,7 @@ while ($row = $db->sql_fetchrow($result)) continue; } - preg_match('#^([a-z0-9/_-]+)#i', $row['session_page'], $on_page); - if (!sizeof($on_page)) - { - $on_page[1] = ''; - } + $on_page = $viewonline_helper->get_user_page($row['session_page']); switch ($on_page[1]) { @@ -282,19 +309,27 @@ while ($row = $db->sql_fetchrow($result)) $location_url = append_sid("{$phpbb_root_path}search.$phpEx"); break; - case 'faq': - $location = $user->lang['VIEWING_FAQ']; - $location_url = append_sid("{$phpbb_root_path}faq.$phpEx"); - break; - case 'viewonline': $location = $user->lang['VIEWING_ONLINE']; $location_url = append_sid("{$phpbb_root_path}viewonline.$phpEx"); break; case 'memberlist': - $location = (strpos($row['session_page'], 'mode=viewprofile') !== false) ? $user->lang['VIEWING_MEMBER_PROFILE'] : $user->lang['VIEWING_MEMBERS']; $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx"); + + if (strpos($row['session_page'], 'mode=viewprofile') !== false) + { + $location = $user->lang['VIEWING_MEMBER_PROFILE']; + } + else if (strpos($row['session_page'], 'mode=contactadmin') !== false) + { + $location = $user->lang['VIEWING_CONTACT_ADMIN']; + $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); + } + else + { + $location = $user->lang['VIEWING_MEMBERS']; + } break; case 'mcp': @@ -339,6 +374,13 @@ while ($row = $db->sql_fetchrow($result)) default: $location = $user->lang['INDEX']; $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + + if ($row['session_page'] === 'app.' . $phpEx . '/help/faq' || + $row['session_page'] === 'app.' . $phpEx . '/help/bbcode') + { + $location = $user->lang['VIEWING_FAQ']; + $location_url = $controller_helper->route('phpbb_help_faq_controller'); + } break; } @@ -351,13 +393,13 @@ while ($row = $db->sql_fetchrow($result)) * @var string location Page name to displayed in the list * @var string location_url Page url to displayed in the list * @var array forum_data Array with forum data - * @since 3.1-A1 + * @since 3.1.0-a1 * @change 3.1.0-a2 Added var forum_data */ $vars = array('on_page', 'row', 'location', 'location_url', 'forum_data'); extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars))); - $template->assign_block_vars('user_row', array( + $template_row = array( 'USERNAME' => $row['username'], 'USERNAME_COLOUR' => $row['user_colour'], 'USERNAME_FULL' => $username_full, @@ -374,7 +416,22 @@ while ($row = $db->sql_fetchrow($result)) 'S_USER_HIDDEN' => $s_user_hidden, 'S_GUEST' => ($row['user_id'] == ANONYMOUS) ? true : false, 'S_USER_TYPE' => $row['user_type'], - )); + ); + + /** + * Modify viewonline template data before it is displayed in the list + * + * @event core.viewonline_modify_user_row + * @var array on_page File name and query string + * @var array row Array with the users sql row + * @var array forum_data Array with forum data + * @var array template_row Array with template variables for the user row + * @since 3.1.0-RC4 + */ + $vars = array('on_page', 'row', 'forum_data', 'template_row'); + extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_user_row', compact($vars))); + + $template->assign_block_vars('user_row', $template_row); } $db->sql_freeresult($result); unset($prev_id, $prev_ip); @@ -413,7 +470,7 @@ while ($row = $db->sql_fetchrow($result)) } else { - $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>'; + $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_helper->get_name($row['group_name']) . '</a>'; } } $db->sql_freeresult($result); @@ -437,8 +494,9 @@ $template->assign_vars(array( 'U_SWITCH_GUEST_DISPLAY' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sg=' . ((int) !$show_guests)), 'L_SWITCH_GUEST_DISPLAY' => ($show_guests) ? $user->lang['HIDE_GUESTS'] : $user->lang['DISPLAY_GUESTS'], - 'S_SWITCH_GUEST_DISPLAY' => ($config['load_online_guests']) ? true : false) -); + 'S_SWITCH_GUEST_DISPLAY' => ($config['load_online_guests']) ? true : false, + 'S_VIEWONLINE' => true, +)); // We do not need to load the who is online box here. ;) $config['load_online'] = false; diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e02052a14d..87de7c79a4 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1,9 +1,13 @@ <?php /** * -* @package phpBB3 -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,40 +20,42 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.' . $phpEx); +include($phpbb_root_path . 'includes/functions_user.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); // Initial var setup -$forum_id = request_var('f', 0); -$topic_id = request_var('t', 0); -$post_id = request_var('p', 0); -$voted_id = request_var('vote_id', array('' => 0)); +$forum_id = $request->variable('f', 0); +$topic_id = $request->variable('t', 0); +$post_id = $request->variable('p', 0); +$voted_id = $request->variable('vote_id', array('' => 0)); $voted_id = (sizeof($voted_id) > 1) ? array_unique($voted_id) : $voted_id; -$start = request_var('start', 0); -$view = request_var('view', ''); +$start = $request->variable('start', 0); +$view = $request->variable('view', ''); $default_sort_days = (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0; $default_sort_key = (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'; $default_sort_dir = (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'; -$sort_days = request_var('st', $default_sort_days); -$sort_key = request_var('sk', $default_sort_key); -$sort_dir = request_var('sd', $default_sort_dir); +$sort_days = $request->variable('st', $default_sort_days); +$sort_key = $request->variable('sk', $default_sort_key); +$sort_dir = $request->variable('sd', $default_sort_dir); -$update = request_var('update', false); +$update = $request->variable('update', false); +/* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); $s_can_vote = false; /** * @todo normalize? */ -$hilit_words = request_var('hilit', '', true); +$hilit_words = $request->variable('hilit', '', true); // Do we have a topic or post id? if (!$topic_id && !$post_id) @@ -57,6 +63,7 @@ if (!$topic_id && !$post_id) trigger_error('NO_TOPIC'); } +/* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // Find topic id if user requested a newer or older topic @@ -89,7 +96,7 @@ if ($view && !$post_id) AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . " AND post_time > $topic_last_read AND forum_id = $forum_id - ORDER BY post_time ASC"; + ORDER BY post_time ASC, post_id ASC"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -141,7 +148,7 @@ if ($view && !$post_id) AND topic_moved_id = 0 AND topic_last_post_time $sql_condition {$row['topic_last_post_time']} AND " . $phpbb_content_visibility->get_visibility_sql('topic', $row['forum_id']) . " - ORDER BY topic_last_post_time $sql_ordering"; + ORDER BY topic_last_post_time $sql_ordering, topic_last_post_id $sql_ordering"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -266,7 +273,7 @@ if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_appro if ($post_id) { // are we where we are supposed to be? - if ($topic_data['post_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $topic_data['forum_id'])) + if (($topic_data['post_visibility'] == ITEM_UNAPPROVED || $topic_data['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $topic_data['forum_id'])) { // If post_id was submitted, we try at least to display the topic as a last resort... if ($topic_id) @@ -331,8 +338,41 @@ if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == PO // Setup look and feel $user->setup('viewtopic', $topic_data['forum_style']); +$overrides_f_read_check = false; +$overrides_forum_password_check = false; +$topic_tracking_info = isset($topic_tracking_info) ? $topic_tracking_info : null; + +/** +* Event to apply extra permissions and to override original phpBB's f_read permission and forum password check +* on viewtopic access +* +* @event core.viewtopic_before_f_read_check +* @var int forum_id The forum id from where the topic belongs +* @var int topic_id The id of the topic the user tries to access +* @var int post_id The id of the post the user tries to start viewing at. +* It may be 0 for none given. +* @var array topic_data All the information from the topic and forum tables for this topic +* It includes posts information if post_id is not 0 +* @var bool overrides_f_read_check Set true to remove f_read check afterwards +* @var bool overrides_forum_password_check Set true to remove forum_password check afterwards +* @var array topic_tracking_info Information upon calling get_topic_tracking() +* Set it to NULL to allow auto-filling later. +* Set it to an array to override original data. +* @since 3.1.3-RC1 +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'topic_data', + 'overrides_f_read_check', + 'overrides_forum_password_check', + 'topic_tracking_info', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_before_f_read_check', compact($vars))); + // Start auth check -if (!$auth->acl_get('f_read', $forum_id)) +if (!$overrides_f_read_check && !$auth->acl_get('f_read', $forum_id)) { if ($user->data['user_id'] != ANONYMOUS) { @@ -344,7 +384,7 @@ if (!$auth->acl_get('f_read', $forum_id)) // Forum is passworded ... check whether access has been granted to this // user this session, if not show login box -if ($topic_data['forum_password']) +if (!$overrides_forum_password_check && $topic_data['forum_password']) { login_forum_box($topic_data); } @@ -383,7 +423,7 @@ if (!isset($topic_tracking_info)) $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); -$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => 'p.post_time', 's' => array('p.post_subject', 'p.post_id')); +$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => array('p.post_time', 'p.post_id'), 's' => array('p.post_subject', 'p.post_id')); $join_user_sql = array('a' => true, 't' => false, 's' => false); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -422,17 +462,11 @@ else $highlight_match = $highlight = ''; if ($hilit_words) { - foreach (explode(' ', trim($hilit_words)) as $word) - { - if (trim($word)) - { - $word = str_replace('\*', '\w+?', preg_quote($word, '#')); - $word = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $word); - $highlight_match .= (($highlight_match != '') ? '|' : '') . $word; - } - } - - $highlight = urlencode($hilit_words); + $highlight_match = phpbb_clean_search_string($hilit_words); + $highlight = urlencode($highlight_match); + $highlight_match = str_replace('\*', '\w+?', preg_quote($highlight_match, '#')); + $highlight_match = preg_replace('#(?<=^|\s)\\\\w\*\?(?=\s|$)#', '\w+?', $highlight_match); + $highlight_match = str_replace(' ', '|', $highlight_match); } // Make sure $start is set to the last page if it exceeds the amount @@ -450,7 +484,7 @@ $s_watching_topic = array( 'is_watching' => false, ); -if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify']) +if ($config['allow_topic_notify']) { $notify_status = (isset($topic_data['notify_status'])) ? $topic_data['notify_status'] : null; watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']); @@ -464,9 +498,9 @@ if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_n } // Bookmarks -if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) +if ($config['allow_bookmarks'] && $user->data['is_registered'] && $request->variable('bookmark', 0)) { - if (check_link_hash(request_var('hash', ''), "topic_$topic_id")) + if (check_link_hash($request->variable('hash', ''), "topic_$topic_id")) { if (!$topic_data['bookmarked']) { @@ -524,11 +558,24 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); // Quick mod tools $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; +$s_quickmod_action = append_sid( + "{$phpbb_root_path}mcp.$phpEx", + array( + 'f' => $forum_id, + 't' => $topic_id, + 'start' => $start, + 'quickmod' => 1, + 'redirect' => urlencode(str_replace('&', '&', $viewtopic_url)), + ), + true, + $user->session_id +); + $quickmod_array = array( // 'key' => array('LANG_KEY', $userHasPermissions), - 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), - 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), + 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster']))), + 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id))), 'delete_topic' => array('DELETE_TOPIC', ($auth->acl_get('m_delete', $forum_id) || (($topic_data['topic_visibility'] != ITEM_DELETED) && $auth->acl_get('m_softdelete', $forum_id)))), 'restore_topic' => array('RESTORE_TOPIC', (($topic_data['topic_visibility'] == ITEM_DELETED) && $auth->acl_get('m_approve', $forum_id))), 'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED), @@ -536,18 +583,18 @@ $quickmod_array = array( 'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)), 'merge_topic' => array('MERGE_TOPIC', $auth->acl_get('m_merge', $forum_id)), 'fork' => array('FORK_TOPIC', $auth->acl_get('m_move', $forum_id)), - 'make_normal' => array('MAKE_NORMAL', ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL)), + 'make_normal' => array('MAKE_NORMAL', ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_NORMAL)), 'make_sticky' => array('MAKE_STICKY', ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY)), 'make_announce' => array('MAKE_ANNOUNCE', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE)), - 'make_global' => array('MAKE_GLOBAL', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL)), + 'make_global' => array('MAKE_GLOBAL', ($allow_change_type && $auth->acl_get('f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL)), 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), ); -foreach($quickmod_array as $option => $qm_ary) +foreach ($quickmod_array as $option => $qm_ary) { if (!empty($qm_ary[1])) { - phpbb_add_quickmod_option($option, $qm_ary[0]); + phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); } } @@ -590,6 +637,38 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); + +/** +* Event to modify data before template variables are being assigned +* +* @event core.viewtopic_assign_template_vars_before +* @var string base_url URL to be passed to generate pagination +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var int start Pagination information +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var int total_posts Topic total posts count +* @var string viewtopic_url URL to the topic page +* @since 3.1.0-RC4 +* @change 3.1.2-RC1 Added viewtopic_url +*/ +$vars = array( + 'base_url', + 'forum_id', + 'post_id', + 'quickmod_array', + 'start', + 'topic_data', + 'topic_id', + 'topic_tracking_info', + 'total_posts', + 'viewtopic_url', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars))); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); // Send vars to template @@ -620,11 +699,6 @@ $template->assign_vars(array( 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), - 'WWW_IMG' => $user->img('icon_contact_www', 'VISIT_WEBSITE'), - 'ICQ_IMG' => $user->img('icon_contact_icq', 'ICQ'), - 'AIM_IMG' => $user->img('icon_contact_aim', 'AIM'), - 'MSN_IMG' => $user->img('icon_contact_msnm', 'MSNM'), - 'YIM_IMG' => $user->img('icon_contact_yahoo', 'YIM'), 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER') , 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), @@ -637,9 +711,11 @@ $template->assign_vars(array( 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), - 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . "&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), + 'S_MOD_ACTION' => $s_quickmod_action, + 'L_RETURN_TO_FORUM' => $user->lang('RETURN_TO', $topic_data['forum_name']), 'S_VIEWTOPIC' => true, + 'S_UNREAD_VIEW' => $view == 'unread', 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), @@ -651,6 +727,7 @@ $template->assign_vars(array( 'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_FORUM' => $server_path, 'U_VIEW_TOPIC' => $viewtopic_url, + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . (($start) ? "&start=$start" : ''), true, ''), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=previous"), 'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=next"), @@ -729,6 +806,36 @@ if (!empty($topic_data['poll_start'])) ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false; $s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false; + /** + * Event to manipulate the poll data + * + * @event core.viewtopic_modify_poll_data + * @var array cur_voted_id Array with options' IDs current user has voted for + * @var int forum_id The topic's forum id + * @var array poll_info Array with the poll information + * @var bool s_can_vote Flag indicating if a user can vote + * @var bool s_display_results Flag indicating if results or poll options should be displayed + * @var int topic_id The id of the topic the user tries to access + * @var array topic_data All the information from the topic and forum tables for this topic + * @var string viewtopic_url URL to the topic page + * @var array vote_counts Array with the vote counts for every poll option + * @var array voted_id Array with updated options' IDs current user is voting for + * @since 3.1.5-RC1 + */ + $vars = array( + 'cur_voted_id', + 'forum_id', + 'poll_info', + 's_can_vote', + 's_display_results', + 'topic_id', + 'topic_data', + 'viewtopic_url', + 'vote_counts', + 'voted_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_data', compact($vars))); + if ($update && $s_can_vote) { @@ -846,9 +953,11 @@ if (!empty($topic_data['poll_start'])) } $poll_total = 0; + $poll_most = 0; foreach ($poll_info as $poll_option) { $poll_total += $poll_option['poll_option_total']; + $poll_most = ($poll_option['poll_option_total'] >= $poll_most) ? $poll_option['poll_option_total'] : $poll_most; } $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; @@ -860,25 +969,31 @@ if (!empty($topic_data['poll_start'])) $topic_data['poll_title'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_flags, true); + $poll_template_data = $poll_options_template_data = array(); foreach ($poll_info as $poll_option) { $option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0; $option_pct_txt = sprintf("%.1d%%", round($option_pct * 100)); - - $template->assign_block_vars('poll_option', array( - 'POLL_OPTION_ID' => $poll_option['poll_option_id'], - 'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'], - 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'], - 'POLL_OPTION_PERCENT' => $option_pct_txt, - 'POLL_OPTION_PCT' => round($option_pct * 100), - 'POLL_OPTION_WIDTH' => round($option_pct * 250), - 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false) + $option_pct_rel = ($poll_most > 0) ? $poll_option['poll_option_total'] / $poll_most : 0; + $option_pct_rel_txt = sprintf("%.1d%%", round($option_pct_rel * 100)); + $option_most_votes = ($poll_option['poll_option_total'] > 0 && $poll_option['poll_option_total'] == $poll_most) ? true : false; + + $poll_options_template_data[] = array( + 'POLL_OPTION_ID' => $poll_option['poll_option_id'], + 'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'], + 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'], + 'POLL_OPTION_PERCENT' => $option_pct_txt, + 'POLL_OPTION_PERCENT_REL' => $option_pct_rel_txt, + 'POLL_OPTION_PCT' => round($option_pct * 100), + 'POLL_OPTION_WIDTH' => round($option_pct * 250), + 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false, + 'POLL_OPTION_MOST_VOTES' => $option_most_votes, ); } $poll_end = $topic_data['poll_length'] + $topic_data['poll_start']; - $template->assign_vars(array( + $poll_template_data = array( 'POLL_QUESTION' => $topic_data['poll_title'], 'TOTAL_VOTES' => $poll_total, 'POLL_LEFT_CAP_IMG' => $user->img('poll_left'), @@ -893,10 +1008,46 @@ if (!empty($topic_data['poll_start'])) 'S_IS_MULTI_CHOICE' => ($topic_data['poll_max_options'] > 1) ? true : false, 'S_POLL_ACTION' => $viewtopic_url, - 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll') + 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll', ); - unset($poll_end, $poll_info, $voted_id); + /** + * Event to add/modify poll template data + * + * @event core.viewtopic_modify_poll_template_data + * @var array cur_voted_id Array with options' IDs current user has voted for + * @var int poll_end The poll end time + * @var array poll_info Array with the poll information + * @var array poll_options_template_data Array with the poll options template data + * @var array poll_template_data Array with the common poll template data + * @var int poll_total Total poll votes count + * @var int poll_most Mostly voted option votes count + * @var array topic_data All the information from the topic and forum tables for this topic + * @var string viewtopic_url URL to the topic page + * @var array vote_counts Array with the vote counts for every poll option + * @var array voted_id Array with updated options' IDs current user is voting for + * @since 3.1.5-RC1 + */ + $vars = array( + 'cur_voted_id', + 'poll_end', + 'poll_info', + 'poll_options_template_data', + 'poll_template_data', + 'poll_total', + 'poll_most', + 'topic_data', + 'viewtopic_url', + 'vote_counts', + 'voted_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_template_data', compact($vars))); + + $template->assign_block_vars_array('poll_option', $poll_options_template_data); + + $template->assign_vars($poll_template_data); + + unset($poll_end, $poll_info, $poll_options_template_data, $poll_template_data, $voted_id); } // If the user is trying to reach the second half of the topic, fetch it starting from the end @@ -932,8 +1083,7 @@ else // Container for user details, only process once $post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = $post_delete_list = array(); -$has_attachments = $display_notice = false; -$bbcode_bitfield = ''; +$has_unapproved_attachments = $has_approved_attachments = $display_notice = false; $i = $i_total = 0; // Go ahead and pull all data for this topic @@ -1002,10 +1152,20 @@ $sql_ary = array( * @var string sort_dir Direction the posts are sorted by * @var int start Pagination information * @var array sql_ary The SQL array to get the data of posts and posters -* @since 3.1-A1 +* @since 3.1.0-a1 * @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start */ -$vars = array('forum_id', 'topic_id', 'topic_data', 'post_list', 'sort_days', 'sort_key', 'sort_dir', 'start', 'sql_ary'); +$vars = array( + 'forum_id', + 'topic_id', + 'topic_data', + 'post_list', + 'sort_days', + 'sort_key', + 'sort_dir', + 'start', + 'sql_ary', +); extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); @@ -1031,9 +1191,13 @@ while ($row = $db->sql_fetchrow($result)) { $attach_list[] = (int) $row['post_id']; - if ($row['post_visibility'] == ITEM_UNAPPROVED) + if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) + { + $has_unapproved_attachments = true; + } + else if ($row['post_visibility'] == ITEM_APPROVED) { - $has_attachments = true; + $has_approved_attachments = true; } } @@ -1078,22 +1242,13 @@ while ($row = $db->sql_fetchrow($result)) * @event core.viewtopic_post_rowset_data * @var array rowset_data Array with the rowset data for this post * @var array row Array with original user and post data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('rowset_data', 'row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_rowset_data', compact($vars))); $rowset[$row['post_id']] = $rowset_data; - // Define the global bbcode bitfield, will be used to load bbcodes - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); - - // Is a signature attached? Are we going to display it? - if ($row['enable_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) - { - $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['user_sig_bbcode_bitfield']); - } - // Cache various user specific data ... so we don't have to recompute // this each time the same user appears on this page if (!isset($user_cache[$poster_id])) @@ -1101,6 +1256,7 @@ while ($row = $db->sql_fetchrow($result)) if ($poster_id == ANONYMOUS) { $user_cache_data = array( + 'user_type' => USER_IGNORE, 'joined' => '', 'posts' => '', @@ -1114,21 +1270,15 @@ while ($row = $db->sql_fetchrow($result)) 'rank_image' => '', 'rank_image_src' => '', 'sig' => '', - 'profile' => '', 'pm' => '', 'email' => '', - 'www' => '', - 'icq_status_img' => '', - 'icq' => '', - 'aim' => '', - 'msn' => '', - 'yim' => '', 'jabber' => '', 'search' => '', 'age' => '', 'username' => $row['username'], 'user_colour' => $row['user_colour'], + 'contact_user' => '', 'warnings' => 0, 'allow_pm' => 0, @@ -1141,14 +1291,17 @@ while ($row = $db->sql_fetchrow($result)) * @var array user_cache_data Array with the user's data * @var int poster_id Poster's user id * @var array row Array with original user and post data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('user_cache_data', 'poster_id', 'row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_guest_data', compact($vars))); $user_cache[$poster_id] = $user_cache_data; - get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); + $user_rank_data = phpbb_get_user_rank($row, false); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; } else { @@ -1163,6 +1316,9 @@ while ($row = $db->sql_fetchrow($result)) $id_cache[] = $poster_id; $user_cache_data = array( + 'user_type' => $row['user_type'], + 'user_inactive_reason' => $row['user_inactive_reason'], + 'joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, @@ -1183,15 +1339,11 @@ while ($row = $db->sql_fetchrow($result)) 'username' => $row['username'], 'user_colour' => $row['user_colour'], + 'contact_user' => $user->lang('CONTACT_USER', get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['username'])), 'online' => false, - 'profile' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$poster_id"), - 'www' => $row['user_website'], - 'aim' => ($row['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=aim&u=$poster_id") : '', - 'msn' => ($row['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=$poster_id") : '', - 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', - 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', - 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', + 'jabber' => ($config['jab_enable'] && $row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', + 'search' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), @@ -1206,14 +1358,17 @@ while ($row = $db->sql_fetchrow($result)) * @var array user_cache_data Array with the user's data * @var int poster_id Poster's user id * @var array row Array with original user and post data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('user_cache_data', 'poster_id', 'row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_user_data', compact($vars))); $user_cache[$poster_id] = $user_cache_data; - get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); + $user_rank_data = phpbb_get_user_rank($row, $row['user_posts']); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) { @@ -1224,17 +1379,6 @@ while ($row = $db->sql_fetchrow($result)) $user_cache[$poster_id]['email'] = ''; } - if (!empty($row['user_icq'])) - { - $user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/' . urlencode($row['user_icq']) . '/'; - $user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />'; - } - else - { - $user_cache[$poster_id]['icq_status_img'] = ''; - $user_cache[$poster_id]['icq'] = ''; - } - if ($config['allow_birthdays'] && !empty($row['user_birthday'])) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); @@ -1262,10 +1406,11 @@ $db->sql_freeresult($result); // Load custom profile fields if ($config['load_cpf_viewtopic']) { + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); // Grab all profile fields from users in id cache for later use - similar to the poster cache - $profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache); + $profile_fields_tmp = $cp->grab_profile_fields_data($id_cache); // filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs. $profile_fields_cache = array(); @@ -1356,7 +1501,7 @@ if (sizeof($attach_list)) $db->sql_query($sql); } } - else if ($has_attachments && !$topic_data['topic_attachment']) + else if ($has_approved_attachments && !$topic_data['topic_attachment']) { // Topic has approved attachments but its flag is wrong $sql = 'UPDATE ' . TOPICS_TABLE . " @@ -1366,6 +1511,11 @@ if (sizeof($attach_list)) $topic_data['topic_attachment'] = 1; } + else if ($has_unapproved_attachments && !$topic_data['topic_attachment']) + { + // Topic has only unapproved attachments but we have the right to see and download them + $topic_data['topic_attachment'] = 1; + } } else { @@ -1373,30 +1523,61 @@ if (sizeof($attach_list)) } } -$methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); -foreach ($methods as $method) -{ - $template->assign_block_vars('dl_method', $method); -} +// Get the list of users who can receive private messages +$can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm'); +$can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm']; -$template->assign_vars(array( - 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], - 'U_DOWNLOAD_ALL_ATTACHMENTS' => $methods[0]['LINK'], -)); - -// Instantiate BBCode if need be -if ($bbcode_bitfield !== '') -{ - $bbcode = new bbcode(base64_encode($bbcode_bitfield)); -} +// Get the list of permanently banned users +$permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); $i_total = sizeof($rowset) - 1; $prev_post_id = ''; $template->assign_vars(array( + 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], 'S_NUM_POSTS' => sizeof($post_list)) ); +/** +* Event to modify the post, poster and attachment data before assigning the posts +* +* @event core.viewtopic_modify_post_data +* @var int forum_id Forum ID +* @var int topic_id Topic ID +* @var array topic_data Array with topic data +* @var array post_list Array with post_ids we are going to display +* @var array rowset Array with post_id => post data +* @var array user_cache Array with prepared user data +* @var int start Pagination information +* @var int sort_days Display posts of previous x days +* @var string sort_key Key the posts are sorted by +* @var string sort_dir Direction the posts are sorted by +* @var bool display_notice Shall we display a notice instead of attachments +* @var bool has_approved_attachments Does the topic have approved attachments +* @var array attachments List of attachments post_id => array of attachments +* @var array permanently_banned_users List of permanently banned users +* @var array can_receive_pm_list Array with posters that can receive pms +* @since 3.1.0-RC3 +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'topic_data', + 'post_list', + 'rowset', + 'user_cache', + 'sort_days', + 'sort_key', + 'sort_dir', + 'start', + 'permanently_banned_users', + 'can_receive_pm_list', + 'display_notice', + 'has_approved_attachments', + 'attachments', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', compact($vars))); + // Output the posts $first_unread = $post_unread = false; for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) @@ -1575,7 +1756,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // if ($config['load_cpf_viewtopic']) { - $cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$poster_id]) : array(); + $cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$poster_id]) : array(); } $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false; @@ -1586,22 +1767,102 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $s_first_unread = $first_unread = true; } - $edit_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( - $user->data['user_id'] == $poster_id && - $auth->acl_get('f_edit', $forum_id) && - !$row['post_edit_locked'] && - ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']) - ))); + $force_edit_allowed = $force_delete_allowed = false; + + $s_cannot_edit = !$auth->acl_get('f_edit', $forum_id) || $user->data['user_id'] != $poster_id; + $s_cannot_edit_time = $config['edit_time'] && $row['post_time'] <= time() - ($config['edit_time'] * 60); + $s_cannot_edit_locked = $topic_data['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']; + + $s_cannot_delete = $user->data['user_id'] != $poster_id || ( + !$auth->acl_get('f_delete', $forum_id) && + (!$auth->acl_get('f_softdelete', $forum_id) || $row['post_visibility'] == ITEM_DELETED) + ); + $s_cannot_delete_lastpost = $topic_data['topic_last_post_id'] != $row['post_id']; + $s_cannot_delete_time = $config['delete_time'] && $row['post_time'] <= time() - ($config['delete_time'] * 60); + // we do not want to allow removal of the last post if a moderator locked it! + $s_cannot_delete_locked = $topic_data['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']; - $delete_allowed = ($user->data['is_registered'] && (($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) || ( - $user->data['user_id'] == $poster_id && - ($auth->acl_get('f_delete', $forum_id) || ($auth->acl_get('f_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) && - $topic_data['topic_last_post_id'] == $row['post_id'] && - ($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) && - // we do not want to allow removal of the last post if a moderator locked it! - !$row['post_edit_locked'] + /** + * This event allows you to modify the conditions for the "can edit post" and "can delete post" checks + * + * @event core.viewtopic_modify_post_action_conditions + * @var array row Array with post data + * @var array topic_data Array with topic data + * @var bool force_edit_allowed Allow the user to edit the post (all permissions and conditions are ignored) + * @var bool s_cannot_edit User can not edit the post because it's not his + * @var bool s_cannot_edit_locked User can not edit the post because it's locked + * @var bool s_cannot_edit_time User can not edit the post because edit_time has passed + * @var bool force_delete_allowed Allow the user to delete the post (all permissions and conditions are ignored) + * @var bool s_cannot_delete User can not delete the post because it's not his + * @var bool s_cannot_delete_lastpost User can not delete the post because it's not the last post of the topic + * @var bool s_cannot_delete_locked User can not delete the post because it's locked + * @var bool s_cannot_delete_time User can not delete the post because edit_time has passed + * @since 3.1.0-b4 + */ + $vars = array( + 'row', + 'topic_data', + 'force_edit_allowed', + 's_cannot_edit', + 's_cannot_edit_locked', + 's_cannot_edit_time', + 'force_delete_allowed', + 's_cannot_delete', + 's_cannot_delete_lastpost', + 's_cannot_delete_locked', + 's_cannot_delete_time', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_action_conditions', compact($vars))); + + $edit_allowed = $force_edit_allowed || ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( + !$s_cannot_edit && + !$s_cannot_edit_time && + !$s_cannot_edit_locked ))); + $quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED && + ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id)) + ); + + // Only display the quote button if the post is quotable. Posts not approved are not quotable. + $quote_allowed = ($quote_allowed && $row['post_visibility'] == ITEM_APPROVED) ? true : false; + + $delete_allowed = $force_delete_allowed || ($user->data['is_registered'] && ( + ($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) || + (!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked) + )); + + $softdelete_allowed = ($auth->acl_get('m_softdelete', $forum_id) || + ($auth->acl_get('f_softdelete', $forum_id) && $user->data['user_id'] == $poster_id)) && ($row['post_visibility'] != ITEM_DELETED); + + $permanent_delete_allowed = ($auth->acl_get('m_delete', $forum_id) || + ($auth->acl_get('f_delete', $forum_id) && $user->data['user_id'] == $poster_id)); + + // Can this user receive a Private Message? + $can_receive_pm = ( + // They must be a "normal" user + $user_cache[$poster_id]['user_type'] != USER_IGNORE && + + // They must not be deactivated by the administrator + ($user_cache[$poster_id]['user_type'] != USER_INACTIVE || $user_cache[$poster_id]['user_inactive_reason'] != INACTIVE_MANUAL) && + + // They must be able to read PMs + in_array($poster_id, $can_receive_pm_list) && + + // They must not be permanently banned + !in_array($poster_id, $permanently_banned_users) && + + // They must allow users to contact via PM + (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $user_cache[$poster_id]['allow_pm']) + ); + + $u_pm = ''; + + if ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm) + { + $u_pm = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']); + } + // $post_row = array( 'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), @@ -1615,8 +1876,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_JOINED' => $user_cache[$poster_id]['joined'], 'POSTER_POSTS' => $user_cache[$poster_id]['posts'], 'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'], - 'POSTER_WARNINGS' => $user_cache[$poster_id]['warnings'], + 'POSTER_WARNINGS' => $auth->acl_get('m_warn') ? $user_cache[$poster_id]['warnings'] : '', 'POSTER_AGE' => $user_cache[$poster_id]['age'], + 'CONTACT_USER' => $user_cache[$poster_id]['contact_user'], 'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false), 'POST_SUBJECT' => $row['post_subject'], @@ -1632,28 +1894,22 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '', 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '', 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '', - 'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'], + 'POST_ICON_IMG_ALT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['alt'] : '', 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), 'U_EDIT' => ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '', - 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', + 'U_QUOTE' => ($quote_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', - 'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '', + 'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=' . (($softdelete_allowed) ? 'soft_delete' : 'delete') . "&f=$forum_id&p={$row['post_id']}") : '', - 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], - 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', + 'U_PM' => $u_pm, 'U_EMAIL' => $user_cache[$poster_id]['email'], - 'U_WWW' => $user_cache[$poster_id]['www'], - 'U_ICQ' => $user_cache[$poster_id]['icq'], - 'U_AIM' => $user_cache[$poster_id]['aim'], - 'U_MSN' => $user_cache[$poster_id]['msn'], - 'U_YIM' => $user_cache[$poster_id]['yim'], 'U_JABBER' => $user_cache[$poster_id]['jabber'], 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p={$row['post_id']}&f=$forum_id&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url . '&p=' . $row['post_id'] . '#p' . $row['post_id']))), - 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '', + 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? $phpbb_container->get('controller.helper')->route('phpbb_report_post_controller', array('id' => $row['post_id'])) : '', 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MCP_RESTORE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_data['topic_visibility'] != ITEM_DELETED) ? 'deleted_posts' : 'deleted_topics') . '&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', @@ -1666,10 +1922,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POST_ID' => $row['post_id'], 'POST_NUMBER' => $i + $start + 1, 'POSTER_ID' => $poster_id, + 'MINI_POST' => ($post_unread) ? $user->lang['UNREAD_POST'] : $user->lang['POST'], + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, - 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED) ? true : false, + 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false, 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, 'L_POST_DELETED_MESSAGE' => $l_deleted_message, 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, @@ -1684,6 +1942,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', 'S_POST_HIDDEN' => $row['hide_post'], 'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $row['post_id'] . '" href="' . $viewtopic_url . "&p={$row['post_id']}&view=show#p{$row['post_id']}" . '">', '</a>') : '', + 'S_DELETE_PERMANENT' => $permanent_delete_allowed, ); $user_poster_data = $user_cache[$poster_id]; @@ -1697,15 +1956,32 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var int start Start item of this page * @var int current_row_number Number of the post on this page * @var int end Number of posts on this page + * @var int total_posts Total posts count + * @var int poster_id Post author id * @var array row Array with original post and user data * @var array cp_row Custom profile field data of the poster * @var array attachments List of attachments * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post - * @since 3.1-A1 + * @var array topic_data Array with topic data + * @since 3.1.0-a1 * @change 3.1.0-a3 Added vars start, current_row_number, end, attachments + * @change 3.1.0-b3 Added topic_data array, total_posts + * @change 3.1.0-RC3 Added poster_id */ - $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + $vars = array( + 'start', + 'current_row_number', + 'end', + 'total_posts', + 'poster_id', + 'row', + 'cp_row', + 'attachments', + 'user_poster_data', + 'post_row', + 'topic_data', + ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); $i = $current_row_number; @@ -1718,11 +1994,46 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // Dump vars into template $template->assign_block_vars('postrow', $post_row); + $contact_fields = array( + array( + 'ID' => 'pm', + 'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'], + 'U_CONTACT' => $u_pm, + ), + array( + 'ID' => 'email', + 'NAME' => $user->lang['SEND_EMAIL'], + 'U_CONTACT' => $user_cache[$poster_id]['email'], + ), + array( + 'ID' => 'jabber', + 'NAME' => $user->lang['JABBER'], + 'U_CONTACT' => $user_cache[$poster_id]['jabber'], + ), + ); + + foreach ($contact_fields as $field) + { + if ($field['U_CONTACT']) + { + $template->assign_block_vars('postrow.contact', $field); + } + } + if (!empty($cp_row['blockrow'])) { foreach ($cp_row['blockrow'] as $field_data) { $template->assign_block_vars('postrow.custom_fields', $field_data); + + if ($field_data['S_PROFILE_CONTACT']) + { + $template->assign_block_vars('postrow.contact', array( + 'ID' => $field_data['PROFILE_FIELD_IDENT'], + 'NAME' => $field_data['PROFILE_FIELD_NAME'], + 'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'], + )); + } } } @@ -1735,12 +2046,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'DISPLAY_ATTACHMENT' => $attachment) ); } - - $methods = phpbb_gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); - foreach ($methods as $method) - { - $template->assign_block_vars('postrow.dl_method', $method); - } } $current_row_number = $i; @@ -1752,14 +2057,28 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var int start Start item of this page * @var int current_row_number Number of the post on this page * @var int end Number of posts on this page + * @var int total_posts Total posts count * @var array row Array with original post and user data * @var array cp_row Custom profile field data of the poster * @var array attachments List of attachments * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post + * @var array topic_data Array with topic data * @since 3.1.0-a3 + * @change 3.1.0-b3 Added topic_data array, total_posts */ - $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + $vars = array( + 'start', + 'current_row_number', + 'end', + 'total_posts', + 'row', + 'cp_row', + 'attachments', + 'user_poster_data', + 'post_row', + 'topic_data', + ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars))); $i = $current_row_number; @@ -1886,13 +2205,13 @@ if ($s_can_vote || $s_quick_reply) // We overwrite $_REQUEST['f'] if there is no forum specified // to be able to display the correct online list. // One downside is that the user currently viewing this topic/post is not taken into account. -if (!request_var('f', 0)) +if (!$request->variable('f', 0)) { $request->overwrite('f', $forum_id); } // We need to do the same with the topic_id. See #53025. -if (!request_var('t', 0) && !empty($topic_id)) +if (!$request->variable('t', 0) && !empty($topic_id)) { $request->overwrite('t', $topic_id); } @@ -1903,13 +2222,15 @@ $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang * You can use this event to modify the page title of the viewtopic page * * @event core.viewtopic_modify_page_title -* @var string page_title Title of the index page +* @var string page_title Title of the viewtopic page * @var array topic_data Array with topic data * @var int forum_id Forum ID of the topic * @var int start Start offset used to calculate the page -* @since 3.1-A1 +* @var array post_list Array with post_ids we are going to display +* @since 3.1.0-a1 +* @change 3.1.0-RC4 Added post_list var */ -$vars = array('page_title', 'topic_data', 'forum_id', 'start'); +$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars))); // Output the page diff --git a/phpBB/web.config b/phpBB/web.config index a73c328626..99a1fe6023 100644 --- a/phpBB/web.config +++ b/phpBB/web.config @@ -1,6 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> + <rewrite> + <rules> + <rule name="Extension Routes" stopProcessing="true"> + <match url="^(.*)$" ignoreCase="true" /> + <conditions> + <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> + <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> + </conditions> + <action type="Rewrite" url="app.php" appendQueryString="true" /> + </rule> + </rules> + </rewrite> <security> <requestFiltering> <hiddenSegments> diff --git a/phpunit.xml.all b/phpunit.xml.all deleted file mode 100644 index d5ee606ce2..0000000000 --- a/phpunit.xml.all +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit backupGlobals="true" - backupStaticAttributes="true" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="false" - bootstrap="tests/bootstrap.php" -> - <testsuites> - <testsuite name="phpBB Test Suite"> - <directory suffix="_test.php">./tests/</directory> - <exclude>tests/lint_test.php</exclude> - </testsuite> - <testsuite name="phpBB Lint Test"> - <file>tests/lint_test.php</file> - </testsuite> - </testsuites> - - <filter> - <blacklist> - <directory>./tests/</directory> - </blacklist> - <whitelist> - <directory suffix=".php">./phpBB/includes/</directory> - <directory suffix=".php">./phpBB/phpbb/</directory> - <exclude> - <directory suffix=".php">./phpBB/includes/captcha/</directory> - </exclude> - </whitelist> - </filter> -</phpunit> diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 700af8b2b2..c6e539b7ba 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,31 +13,33 @@ > <testsuites> <testsuite name="phpBB Test Suite"> - <directory suffix="_test.php">./tests/</directory> - <exclude>tests/lint_test.php</exclude> + <directory suffix="_test.php">./tests</directory> + <exclude>./tests/functional</exclude> + <exclude>./tests/lint_test.php</exclude> + <exclude>./tests/ui</exclude> + </testsuite> + <testsuite name="phpBB Functional Tests"> + <directory suffix="_test.php">./tests/functional</directory> </testsuite> <testsuite name="phpBB Lint Test"> - <file>tests/lint_test.php</file> + <file>./tests/lint_test.php</file> + </testsuite> + <testsuite name="phpBB UI Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" + phpVersionOperator=">=">./tests/ui</directory> </testsuite> </testsuites> <groups> <exclude> - <group>functional</group> <group>slow</group> </exclude> </groups> <filter> - <blacklist> - <directory>./tests/</directory> - </blacklist> <whitelist> <directory suffix=".php">./phpBB/includes/</directory> <directory suffix=".php">./phpBB/phpbb/</directory> - <exclude> - <directory suffix=".php">./phpBB/includes/captcha/</directory> - </exclude> </whitelist> </filter> </phpunit> diff --git a/phpunit.xml.functional b/phpunit.xml.functional deleted file mode 100644 index 44d060e615..0000000000 --- a/phpunit.xml.functional +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit backupGlobals="true" - backupStaticAttributes="true" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - processIsolation="false" - stopOnFailure="false" - syntaxCheck="false" - bootstrap="tests/bootstrap.php" -> - <testsuites> - <testsuite name="phpBB Test Suite"> - <directory suffix="_test.php">./tests/</directory> - <exclude>tests/lint_test.php</exclude> - </testsuite> - <testsuite name="phpBB Lint Test"> - <file>tests/lint_test.php</file> - </testsuite> - </testsuites> - - <groups> - <include> - <group>functional</group> - </include> - </groups> - - <filter> - <blacklist> - <directory>./tests/</directory> - </blacklist> - <whitelist> - <directory suffix=".php">./phpBB/includes/</directory> - <directory suffix=".php">./phpBB/phpbb/</directory> - <exclude> - <directory suffix=".php">./phpBB/includes/captcha/</directory> - </exclude> - </whitelist> - </filter> -</phpunit> diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md index 0778046141..b082197166 100644 --- a/tests/RUNNING_TESTS.md +++ b/tests/RUNNING_TESTS.md @@ -32,7 +32,6 @@ will be skipped: - apc (APC cache driver) - bz2 (compress tests) -- interbase, pdo_firebird (Firebird database driver) - mysql, pdo_mysql (MySQL database driver) - mysqli, pdo_mysql (MySQLi database driver) - pcntl (flock class) @@ -82,16 +81,10 @@ Special Database Cases ---------------------- In order to run tests on some of the databases that we support, it will be necessary to provide a custom DSN string in test_config.php. This is only -needed for MSSQL 2000+ (PHP module), MSSQL via ODBC, and Firebird when -PDO_Firebird does not work on your system -(https://bugs.php.net/bug.php?id=61183). The variable must be named `$custom_dsn`. +needed for MSSQL 2000+ (PHP module) and MSSQL via ODBC. The variable must be +named `$custom_dsn`. -Examples: -Firebird using http://www.firebirdsql.org/en/odbc-driver/ - - $custom_dsn = "Driver={Firebird/InterBase(r) driver};dbname=$dbhost:$dbname"; - -MSSQL +Example MSSQL: $custom_dsn = "Driver={SQL Server Native Client 10.0};Server=$dbhost;Database=$dbname"; @@ -127,13 +120,18 @@ directory (above phpBB): Slow tests -------------- -Certain tests, such as the UTF-8 normalizer or the DNS tests tend to be slow. +Certain tests, such as the DNS tests tend to be slow. Thus these tests are in the `slow` group, which is excluded by default. You can enable slow tests by copying the phpunit.xml.all file to phpunit.xml. If you only want the slow tests, run: $ phpBB/vendor/bin/phpunit --group slow +If you want all tests, run: + + $ phpBB/vendor/bin/phpunit --group __nogroup__,functional,slow + + Functional tests ----------------- @@ -154,10 +152,10 @@ on which to run tests. $phpbb_functional_url = 'http://localhost/phpBB3/'; -To then run the tests, you run PHPUnit, but use the phpunit.xml.functional -config file instead of the default one. Specify this through the "-c" option: +Functional tests are automatically run, if '$phpbb_functional_url' is configured. +If you only want the functional tests, run: - $ phpBB/vendor/bin/phpunit -c phpunit.xml.functional + $ phpBB/vendor/bin/phpunit --group functional This will change your board's config.php file, but it makes a backup at config_dev.php, so you can restore it after the test run is complete. diff --git a/tests/acp_board/auth_provider/invalid.php b/tests/acp_board/auth_provider/invalid.php index acce3b7e2d..dbd1d159a4 100644 --- a/tests/acp_board/auth_provider/invalid.php +++ b/tests/acp_board/auth_provider/invalid.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/acp_board/auth_provider/valid.php b/tests/acp_board/auth_provider/valid.php index 13ec1e3250..6477bf4b53 100644 --- a/tests/acp_board/auth_provider/valid.php +++ b/tests/acp_board/auth_provider/valid.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index b943554564..16e5954c64 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,8 +22,8 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case public static function select_auth_method_data() { return array( - array('acp_board_valid', '<option value="acp_board_valid" selected="selected">Acp_board_valid</option>'), - array('acp_board_invalid', '<option value="acp_board_valid">Acp_board_valid</option>'), + array('acp_board_valid', '<option value="acp_board_valid" selected="selected" data-toggle-setting="#auth_acp_board_valid_settings">Acp_board_valid</option>'), + array('acp_board_invalid', '<option value="acp_board_valid" data-toggle-setting="#auth_acp_board_valid_settings">Acp_board_valid</option>'), ); } diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php new file mode 100644 index 0000000000..f1835dd37a --- /dev/null +++ b/tests/attachment/delete_test.php @@ -0,0 +1,127 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once(dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php'); + +class phpbb_attachment_delete_test extends \phpbb_database_test_case +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\filesystem\filesystem */ + protected $filesystem; + + /** @var \phpbb\attachment\resync */ + protected $resync; + + /** @var \phpbb\attachment\delete */ + protected $attachment_delete; + + protected $phpbb_root_path; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml'); + } + + public function setUp() + { + global $db, $phpbb_root_path; + + parent::setUp(); + + $this->config = new \phpbb\config\config(array()); + $this->db = $this->new_dbal(); + $db = $this->db; + $this->resync = new \phpbb\attachment\resync($this->db); + $this->filesystem = $this->getMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); + $this->filesystem->expects($this->any()) + ->method('remove') + ->willReturn(false); + $this->filesystem->expects($this->any()) + ->method('exists') + ->willReturn(true); + $this->phpbb_root_path = $phpbb_root_path; + $this->dispatcher = new \phpbb_mock_event_dispatcher(); + $this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->filesystem, $this->resync, $phpbb_root_path); + } + + public function data_attachment_delete() + { + return array( + array('attach', '', false, false), + array('meh', 5, false, 0), + array('attach', array(5), false, 0), + array('attach', array(1,2), false, 2), + array('attach', array(1,2), true, 2), + array('post', 5, false, 0), + array('topic', 5, false, 0), + array('topic', 1, true, 3), + array('user', 1, false, 0), + ); + } + + /** + * @dataProvider data_attachment_delete + */ + public function test_attachment_delete($mode, $ids, $resync, $expected) + { + // We need to reset the attachment ID sequence to properly test this + if ($this->db->get_sql_layer() === 'postgres') + { + $sql = 'ALTER SEQUENCE phpbb_attachments_seq RESTART WITH 1'; + $this->db->sql_query($sql); + } + + $this->assertSame($expected, $this->attachment_delete->delete($mode, $ids, $resync)); + } + + public function data_attachment_unlink() + { + return array( + array(true, true, true), + array(true, false, false), + array(true, true, false, true), + ); + } + + /** + * @dataProvider data_attachment_unlink + */ + public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false) + { + $this->filesystem = $this->getMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); + if ($throw_exception) + { + $this->filesystem->expects($this->any()) + ->method('remove') + ->willThrowException(new \phpbb\filesystem\exception\filesystem_exception);; + } + else + { + $this->filesystem->expects($this->any()) + ->method('remove') + ->willReturn($remove_success); + } + + $this->filesystem->expects($this->any()) + ->method('exists') + ->willReturn($exists_success); + + $this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->filesystem, $this->resync, $this->phpbb_root_path); + $this->assertSame($expected, $this->attachment_delete->unlink_attachment('foobar')); + } +} diff --git a/tests/attachment/fixtures/resync.xml b/tests/attachment/fixtures/resync.xml new file mode 100644 index 0000000000..6e2cc62f68 --- /dev/null +++ b/tests/attachment/fixtures/resync.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_attachments"> + <column>post_msg_id</column> + <column>topic_id</column> + <column>in_message</column> + <column>is_orphan</column> + <column>attach_comment</column> + <column>physical_filename</column> + <column>thumbnail</column> + <row> + <value>1</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>foo</value> + <value>foo</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value>foo2</value> + <value>foo2</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value>foo2</value> + <value>foo2</value> + <value>1</value> + </row> + </table> + <table name="phpbb_extensions"> + <column>extension</column> + <column>group_id</column> + <row> + <value>jpg</value> + <value>1</value> + </row> + <row> + <value>png</value> + <value>1</value> + </row> + </table> + <table name="phpbb_extension_groups"> + <column>cat_id</column> + <column>group_id</column> + <column>download_mode</column> + <column>upload_icon</column> + <column>max_filesize</column> + <column>allow_group</column> + <column>allow_in_pm</column> + <column>allowed_forums</column> + <column>group_name</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value> </value> + <value>1000</value> + <value>1</value> + <value>1</value> + <value>a:1:{i:0;i:1;}</value> + <value>Images</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>post_text</column> + <column>poster_id</column> + <column>post_attachment</column> + <row> + <value>1</value> + <value>foo</value> + <value>1</value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>foo</value> + <value>1</value> + <value>1</value> + </row> + </table> + <table name="phpbb_privmsgs"> + <column>msg_id</column> + <column>message_text</column> + <column>message_attachment</column> + <column>to_address</column> + <column>bcc_address</column> + <row> + <value>1</value> + <value>foo</value> + <value>1</value> + <value>2</value> + <value>2</value> + </row> + <row> + <value>2</value> + <value>foo</value> + <value>1</value> + <value>2</value> + <value>2</value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <column>topic_title</column> + <column>topic_attachment</column> + <row> + <value>1</value> + <value>1</value> + <value>foo</value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>bar</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/attachment/manager_test.php b/tests/attachment/manager_test.php new file mode 100644 index 0000000000..47d7f38b1d --- /dev/null +++ b/tests/attachment/manager_test.php @@ -0,0 +1,131 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_attachment_manager_test extends \phpbb_test_case +{ + protected $delete; + protected $resync; + protected $upload; + + public function setUp() + { + $this->delete = $this->getMockBuilder('\phpbb\attachment\delete') + ->disableOriginalConstructor() + ->setMethods(['delete', 'unlink_attachment']) + ->getMock(); + $this->resync = $this->getMockBuilder('\phpbb\attachment\resync') + ->disableOriginalConstructor() + ->setMethods(['resync']) + ->getMock(); + $this->upload = $this->getMockBuilder('\phpbb\attachment\upload') + ->disableOriginalConstructor() + ->setMethods(['upload']) + ->getMock(); + } + + protected function get_manager() + { + return new \phpbb\attachment\manager($this->delete, $this->resync, $this->upload); + } + + public function data_manager() + { + return array( + array( + 'delete', + 'unlink_attachment', + 'unlink', + ['foo'], + ['foo', 'file', false], + true, + true, + ), + array( + 'delete', + 'unlink_attachment', + 'unlink', + ['foo', 'bar'], + ['foo', 'bar', false], + true, + true, + ), + array( + 'delete', + 'unlink_attachment', + 'unlink', + ['foo', 'bar', true], + ['foo', 'bar', true], + true, + true, + ), + array( + 'delete', + 'delete', + 'delete', + ['foo', [1, 2, 3]], + ['foo', [1, 2, 3], true], + 5, + 5, + ), + array( + 'delete', + 'delete', + 'delete', + ['foo', [1, 2, 3], false], + ['foo', [1, 2, 3], false], + 2, + 2, + ), + array( + 'resync', + 'resync', + 'resync', + ['foo', [1, 2, 3]], + ['foo', [1, 2, 3]], + true, + null, + ), + array( + 'upload', + 'upload', + 'upload', + ['foo', 1], + ['foo', 1, false, '', false, []], + true, + true, + ), + array( + 'upload', + 'upload', + 'upload', + ['foo', 1, true, 'bar', true, ['filename' => 'foobar']], + ['foo', 1, true, 'bar', true, ['filename' => 'foobar']], + true, + true, + ), + ); + } + + /** + * @dataProvider data_manager + */ + public function test_manager($class, $method_class, $method_manager, $input_manager, $input_method, $return, $output) + { + $mock = call_user_func_array([$this->{$class}, 'expects'], [$this->atLeastOnce()]); + $mock = $mock->method($method_class); + $mock = call_user_func_array([$mock, 'with'], $input_method); + $mock->willReturn($return); + $manager = $this->get_manager(); + $this->assertSame($output, call_user_func_array([$manager, $method_manager], $input_manager)); + } +} diff --git a/tests/attachment/resync_test.php b/tests/attachment/resync_test.php new file mode 100644 index 0000000000..f882af9ae5 --- /dev/null +++ b/tests/attachment/resync_test.php @@ -0,0 +1,74 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_attachment_resync_test extends \phpbb_database_test_case +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\attachment\resync */ + protected $resync; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml'); + } + + public function setUp() + { + parent::setUp(); + + $this->db = $this->new_dbal(); + $this->resync = new \phpbb\attachment\resync($this->db); + } + + public function data_resync() + { + return array( + array('', array(1), 'post_id', POSTS_TABLE, array('post_attachment' => '1'), array('post_attachment' => '1')), + array('post', array(1), 'post_id', POSTS_TABLE, array('post_attachment' => '1'), array('post_attachment' => '1')), + array('post', array(2), 'post_id', POSTS_TABLE, array('post_attachment' => '1'), array('post_attachment' => '0')), + array('topic', array(1), 'topic_id', TOPICS_TABLE, array('topic_attachment' => '1'), array('topic_attachment' => '1')), + array('topic', array(2), 'topic_id', TOPICS_TABLE, array('topic_attachment' => '1'), array('topic_attachment' => '0')), + array('message', array(1), 'msg_id', PRIVMSGS_TABLE, array('message_attachment' => '1'), array('message_attachment' => '1')), + array('message', array(2), 'msg_id', PRIVMSGS_TABLE, array('message_attachment' => '1'), array('message_attachment' => '0')), + ); + } + + /** + * @dataProvider data_resync + */ + public function test_resync($type, $ids, $sql_id, $exist_table, $exist_data, $resync_data) + { + $sql_prefix = ($type) ?: 'post'; + $sql = 'SELECT ' . $sql_prefix . '_attachment + FROM ' . $exist_table . ' + WHERE ' . $sql_id . ' = ' . $ids[0]; + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals($exist_data, $data); + + $this->resync->resync($type, $ids); + + $sql = 'SELECT ' . $sql_prefix . '_attachment + FROM ' . $exist_table . ' + WHERE ' . $sql_id . ' = ' . $ids[0]; + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals($resync_data, $data); + } +} diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php new file mode 100644 index 0000000000..295b6b15c9 --- /dev/null +++ b/tests/attachment/upload_test.php @@ -0,0 +1,430 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once(dirname(__FILE__) . '/../../phpBB/includes/functions.php'); +require_once(dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php'); + +class phpbb_attachment_upload_test extends \phpbb_database_test_case +{ + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var \phpbb\cache\service */ + protected $cache; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\files\upload */ + protected $files_upload; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\mimetype\guesser */ + protected $mimetype_guesser; + + /** @var \phpbb\event\dispatcher */ + protected $phpbb_dispatcher; + + /** @var \phpbb\plupload\plupload */ + protected $plupload; + + /** @var \phpbb\user */ + protected $user; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\attachment\upload */ + protected $upload; + + private $filesystem; + + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml'); + } + + public function setUp() + { + global $config, $phpbb_root_path, $phpEx; + + parent::setUp(); + + $this->auth = new \phpbb\auth\auth(); + $this->config = new \phpbb\config\config(array( + 'upload_path' => '', + 'img_create_thumbnail' => true, + )); + $config = $this->config; + $this->db = $this->new_dbal(); + $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx); + $this->request = $this->getMock('\phpbb\request\request'); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + $guessers = array( + new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), + new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \phpbb\mimetype\content_guesser(), + new \phpbb\mimetype\extension_guesser(), + ); + $guessers[2]->set_priority(-2); + $guessers[3]->set_priority(-2); + $this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers); + $this->plupload = new \phpbb\plupload\plupload($phpbb_root_path, $this->config, $this->request, new \phpbb\user($this->language, '\phpbb\datetime'), $this->php_ini, $this->mimetype_guesser); + $factory_mock = $this->getMockBuilder('\phpbb\files\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory_mock->expects($this->any()) + ->method('get') + ->willReturn(new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $this->phpbb_root_path, + $this->mimetype_guesser + )); + + $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container->set('files.filespec', new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + )))); + $this->container->set('files.types.form', new \phpbb\files\types\form( + $factory_mock, + $this->language, + $this->php_ini, + $this->plupload, + $this->request + )); + $this->container->set('files.types.local', new \phpbb\files\types\local( + $factory_mock, + $this->language, + $this->php_ini, + $this->request + )); + $this->factory = new \phpbb\files\factory($this->container); + $this->files_upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $this->phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $this->user = new \phpbb\user($this->language, '\phpbb\datetime'); + + + $this->upload = new \phpbb\attachment\upload( + $this->auth, + $this->cache, + $this->config, + $this->files_upload, + $this->language, + $this->mimetype_guesser, + $this->phpbb_dispatcher, + $this->plupload, + $this->user, + $this->phpbb_root_path + ); + } + + public function data_upload() + { + return array( + array('foobar', 1, false, + array(), + array( + 'error' => array( + 'Upload initiated but no valid file upload form found.', + ), + 'post_attach' => false, + ) + ), + array('foobar', 1, true, + array( + 'realname' => 'foobar.jpg', + 'type' => 'jpg', + 'size' => 100, + ), + array( + 'error' => array( + 'NOT_UPLOADED', + 'The image file you tried to attach is invalid.', + ), + 'post_attach' => false, + 'thumbnail' => 1, + ) + ), + array('foobar', 1, true, + array(), + array( + 'error' => array( + 'NOT_UPLOADED', + ), + 'post_attach' => false, + 'thumbnail' => 0, + ) + ), + ); + } + + /** + * @dataProvider data_upload + */ + public function test_upload($form_name, $forum_id, $local, $filedata, $expected) + { + $filedata = $this->upload->upload($form_name, $forum_id, $local, '', false, $filedata); + + $this->assertSame($expected, $filedata); + } + + public function test_init_error() + { + $filespec = $this->getMockBuilder('\phpbb\files\filespec') + ->disableOriginalConstructor() + ->getMock(); + $filespec->expects($this->any()) + ->method('init_error') + ->willReturn(true); + $filespec->expects($this->any()) + ->method('set_upload_namespace') + ->willReturnSelf(); + $filespec->expects($this->any()) + ->method('set_upload_ary') + ->willReturnSelf(); + $this->container->set('files.filespec', $filespec); + $factory_mock = $this->getMockBuilder('\phpbb\files\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory_mock->expects($this->any()) + ->method('get') + ->willReturn($filespec); + $this->container->set('files.types.local', new \phpbb\files\types\local( + $factory_mock, + $this->language, + $this->php_ini, + $this->request + )); + + $this->upload = new \phpbb\attachment\upload( + $this->auth, + $this->cache, + $this->config, + $this->files_upload, + $this->language, + $this->mimetype_guesser, + $this->phpbb_dispatcher, + $this->plupload, + $this->user, + $this->phpbb_root_path + ); + + $filedata = $this->upload->upload('foobar', 1, true); + + $this->assertSame(array( + 'error' => array(), + 'post_attach' => false, + ), $filedata); + } + + public function data_image_upload() + { + return array( + array(false, false, array(), + array( + 'error' => array('The image file you tried to attach is invalid.'), + 'post_attach' => false, + 'thumbnail' => 1, + ) + ), + array(false, true, array(), + array( + 'error' => array('The image file you tried to attach is invalid.'), + 'post_attach' => false, + 'thumbnail' => 1, + ) + ), + array(true, false, array(), + array( + 'error' => array(), + 'post_attach' => true, + // thumbnail gets reset to 0 as creation was not possible + 'thumbnail' => 0, + 'filesize' => 100, + 'mimetype' => 'jpg', + 'extension' => 'jpg', + 'real_filename' => 'foobar.jpg', + ) + ), + array(true, false, + array( + 'check_attachment_content' => true, + 'mime_triggers' => '', + ), + array( + 'error' => array(), + 'post_attach' => true, + // thumbnail gets reset to 0 as creation was not possible + 'thumbnail' => 0, + 'filesize' => 100, + 'mimetype' => 'jpg', + 'extension' => 'jpg', + 'real_filename' => 'foobar.jpg', + ) + ), + array(true, false, + array( + 'attachment_quota' => 150, + ), + array( + 'error' => array(), + 'post_attach' => true, + // thumbnail gets reset to 0 as creation was not possible + 'thumbnail' => 0, + 'filesize' => 100, + 'mimetype' => 'jpg', + 'extension' => 'jpg', + 'real_filename' => 'foobar.jpg', + ) + ), + array(true, false, + array( + 'attachment_quota' => 50, + ), + array( + 'error' => array( + 'ATTACH_QUOTA_REACHED', + ), + 'post_attach' => false, + 'thumbnail' => 1, + 'filesize' => 100, + 'mimetype' => 'jpg', + 'extension' => 'jpg', + 'real_filename' => 'foobar.jpg', + ) + ), + ); + } + + /** + * @dataProvider data_image_upload + */ + public function test_image_upload($is_image, $plupload_active, $config_data, $expected) + { + $filespec = $this->getMock('\phpbb\files\filespec', + array( + 'init_error', + 'is_image', + 'move_file', + 'is_uploaded', + ), + array( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $this->phpbb_root_path, + $this->mimetype_guesser, + $this->plupload + )); + foreach ($config_data as $key => $value) + { + $this->config[$key] = $value; + } + $filespec->set_upload_namespace($this->files_upload); + $filespec->expects($this->any()) + ->method('init_error') + ->willReturn(false); + $filespec->expects($this->any()) + ->method('is_image') + ->willReturn($is_image); + $filespec->expects($this->any()) + ->method('is_uploaded') + ->willReturn(true); + $filespec->expects($this->any()) + ->method('move_file') + ->willReturn(false); + $this->container->set('files.filespec', $filespec); + $factory_mock = $this->getMockBuilder('\phpbb\files\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory_mock->expects($this->any()) + ->method('get') + ->willReturn($filespec); + $this->container->set('files.types.local', new \phpbb\files\types\local( + $factory_mock, + $this->language, + $this->php_ini, + $this->request + )); + + $plupload = $this->getMockBuilder('\phpbb\plupload\plupload') + ->disableOriginalConstructor() + ->getMock(); + $plupload->expects($this->any()) + ->method('is_active') + ->willReturn($plupload_active); + if ($plupload_active) + { + $plupload->expects($this->once()) + ->method('emit_error') + ->with(104, 'ATTACHED_IMAGE_NOT_IMAGE') + ->willReturn(false); + } + $this->upload = new \phpbb\attachment\upload( + $this->auth, + $this->cache, + $this->config, + $this->files_upload, + $this->language, + $this->mimetype_guesser, + $this->phpbb_dispatcher, + $plupload, + $this->user, + $this->phpbb_root_path + ); + + $filedata = $this->upload->upload('foobar', 1, true, '', false, array( + 'realname' => 'foobar.jpg', + 'type' => 'jpg', + 'size' => 100, + )); + + foreach ($expected as $key => $entry) + { + $this->assertEquals($entry, $filedata[$key]); + } + + // Reset config data + foreach ($config_data as $key => $value) + { + $this->config->delete($key); + } + } +} diff --git a/tests/auth/fixtures/oauth_tokens.xml b/tests/auth/fixtures/oauth_tokens.xml index 9bfb5a4422..6c82e94e62 100644 --- a/tests/auth/fixtures/oauth_tokens.xml +++ b/tests/auth/fixtures/oauth_tokens.xml @@ -5,6 +5,12 @@ <column>session_id</column> <column>provider</column> <column>oauth_token</column> + <row> + <value>1</value> + <value>abcd</value> + <value>auth.provider.oauth.service.testing</value> + <value>{"token_class":"phpbb_not_a_token","accessToken":"error","refreshToken":0,"endOfLife":null,"extraParams":null}</value> + </row> </table> </dataset> diff --git a/tests/auth/fixtures/user.xml b/tests/auth/fixtures/user.xml index 77f707bab3..1e0eb6ee49 100644 --- a/tests/auth/fixtures/user.xml +++ b/tests/auth/fixtures/user.xml @@ -6,7 +6,6 @@ <column>username_clean</column> <column>user_password</column> <column>user_passchg</column> - <column>user_pass_convert</column> <column>user_email</column> <column>user_type</column> <column>user_login_attempts</column> @@ -18,7 +17,6 @@ <value>foobar</value> <value>$2y$10$4RmpyVu2y8Yf/lP3.yQBquKvE54TCUuEDEBJYY6FDDFN3LcbCGz9i</value> <value>0</value> - <value>0</value> <value>example@example.com</value> <value>0</value> <value>0</value> @@ -31,7 +29,6 @@ <value>foobar2</value> <value>$H$9E45lK6J8nLTSm9oJE5aNCSTFK9wqa/</value> <value>0</value> - <value>0</value> <value>example@example.com</value> <value>0</value> <value>0</value> diff --git a/tests/auth/fixtures/user_533.xml b/tests/auth/fixtures/user_533.xml index b64f376e5b..9731e4db4a 100644 --- a/tests/auth/fixtures/user_533.xml +++ b/tests/auth/fixtures/user_533.xml @@ -6,7 +6,6 @@ <column>username_clean</column> <column>user_password</column> <column>user_passchg</column> - <column>user_pass_convert</column> <column>user_email</column> <column>user_type</column> <column>user_login_attempts</column> @@ -18,7 +17,6 @@ <value>foobar</value> <value>$2a$10$e01Syh9PbJjUkio66eFuUu4FhCE2nRgG7QPc1JACalsPXcIuG2bbi</value> <value>0</value> - <value>0</value> <value>example@example.com</value> <value>0</value> <value>0</value> @@ -31,7 +29,6 @@ <value>foobar2</value> <value>$H$9E45lK6J8nLTSm9oJE5aNCSTFK9wqa/</value> <value>0</value> - <value>0</value> <value>example@example.com</value> <value>0</value> <value>0</value> diff --git a/tests/auth/phpbb_not_a_token.php b/tests/auth/phpbb_not_a_token.php new file mode 100644 index 0000000000..61cc14fa10 --- /dev/null +++ b/tests/auth/phpbb_not_a_token.php @@ -0,0 +1,23 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_not_a_token +{ + public function __construct($param1, $param2, $param3, $param4) + { + } + + public function setEndOfLife() + { + } +} diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php index ac5377f2f6..60423acbc1 100644 --- a/tests/auth/provider_apache_test.php +++ b/tests/auth/provider_apache_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -24,8 +28,10 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case $db = $this->new_dbal(); $config = new \phpbb\config\config(array()); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); $this->request = $this->getMock('\phpbb\request\request'); - $this->user = $this->getMock('\phpbb\user'); + $this->user = new \phpbb\user($lang, '\phpbb\datetime'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), @@ -144,7 +150,6 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case 'username_clean' => 'foobar', 'user_password' => $this->password_hash, 'user_passchg' => '0', - 'user_pass_convert' => '0', 'user_email' => 'example@example.com', 'user_email_hash' => '0', 'user_birthday' => '', @@ -161,7 +166,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case 'user_inactive_time' => '0', 'user_posts' => '0', 'user_lang' => '', - 'user_timezone' => 'UTC', + 'user_timezone' => '', 'user_dateformat' => 'd M Y H:i', 'user_style' => '0', 'user_rank' => '0', @@ -193,12 +198,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case 'user_sig' => '', 'user_sig_bbcode_uid' => '', 'user_sig_bbcode_bitfield' => '', - 'user_icq' => '', - 'user_aim' => '', - 'user_yim' => '', - 'user_msnm' => '', 'user_jabber' => '', - 'user_website' => '', 'user_actkey' => '', 'user_newpasswd' => '', 'user_form_salt' => '', diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php index 91ffcdc2a7..38dbfa1fcb 100644 --- a/tests/auth/provider_db_test.php +++ b/tests/auth/provider_db_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -34,8 +38,10 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case 'ip_login_limit_use_forwarded' => 0, 'max_login_attempts' => 0, )); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); $request = $this->getMock('\phpbb\request\request'); - $user = $this->getMock('\phpbb\user'); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), @@ -48,7 +54,9 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case // Set up passwords manager $passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers)); - $provider = new \phpbb\auth\provider\db($db, $config, $passwords_manager, $request, $user, $phpbb_root_path, $phpEx); + $phpbb_container = new phpbb_mock_container_builder(); + + $provider = new \phpbb\auth\provider\db($db, $config, $passwords_manager, $request, $user, $phpbb_container, $phpbb_root_path, $phpEx); if (version_compare(PHP_VERSION, '5.3.7', '<')) { $password_hash = '$2a$10$e01Syh9PbJjUkio66eFuUu4FhCE2nRgG7QPc1JACalsPXcIuG2bbi'; @@ -66,14 +74,20 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case 'username' => 'foobar', 'user_password' => $password_hash, 'user_passchg' => '0', - 'user_pass_convert' => '0', 'user_email' => 'example@example.com', 'user_type' => '0', 'user_login_attempts' => '0', ), ); - $this->assertEquals($expected, $provider->login('foobar', 'example')); + $login_return = $provider->login('foobar', 'example'); + $this->assertEquals($expected['status'], $login_return['status']); + $this->assertEquals($expected['error_msg'], $login_return['error_msg']); + + foreach ($expected['user_row'] as $key => $value) + { + $this->assertEquals($value, $login_return['user_row'][$key]); + } // Check if convert works $login_return = $provider->login('foobar2', 'example'); diff --git a/tests/auth/provider_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php index fdc08833a3..ae5de6aa7e 100644 --- a/tests/auth/provider_oauth_token_storage_test.php +++ b/tests/auth/provider_oauth_token_storage_test.php @@ -1,14 +1,20 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ use OAuth\OAuth2\Token\StdOAuth2Token; +require_once dirname(__FILE__) . '/phpbb_not_a_token.php'; + class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_case { protected $db; @@ -16,6 +22,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c protected $session_id; protected $token_storage; protected $token_storage_table; + protected $state_table; protected $user; protected function setup() @@ -25,9 +32,12 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c global $phpbb_root_path, $phpEx; $this->db = $this->new_dbal(); - $this->user = $this->getMock('\phpbb\user'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $this->user = new \phpbb\user($lang, '\phpbb\datetime'); $this->service_name = 'auth.provider.oauth.service.testing'; $this->token_storage_table = 'phpbb_oauth_tokens'; + $this->state_table = 'phpbb_oauth_states'; // Give the user a session_id that we will remember $this->session_id = '12345'; @@ -36,7 +46,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c // Set the user id to anonymous $this->user->data['user_id'] = ANONYMOUS; - $this->token_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table); + $this->token_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table, $this->state_table); } public function getDataSet() @@ -69,12 +79,28 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c $this->assertEquals($token, $stored_token); } + public function test_retrieveAccessToken_wrong_token() + { + $this->user->data['session_id'] = 'abcd'; + try + { + $this->token_storage->retrieveAccessToken($this->service_name); + $this->fail('The token can not be deserialized and an exception should be thrown.'); + } + catch (\OAuth\Common\Storage\Exception\TokenNotFoundException $e) + { + } + + $row = $this->get_token_row_by_session_id('abcd'); + $this->assertFalse($row); + } + public function test_retrieveAccessToken_from_db() { $expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES); // Store a token in the database - $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table); + $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table, $this->state_table); $temp_storage->storeAccessToken($this->service_name, $expected_token); unset($temp_storage); @@ -105,7 +131,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c $expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES); // Store a token in the database - $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table); + $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table, $this->state_table); $temp_storage->storeAccessToken($this->service_name, $expected_token); unset($temp_storage); diff --git a/tests/avatar/driver/barfoo.php b/tests/avatar/driver/barfoo.php index 0bf30b8a91..067bb3ef97 100644 --- a/tests/avatar/driver/barfoo.php +++ b/tests/avatar/driver/barfoo.php @@ -1,26 +1,26 @@ -<?php
-
-namespace phpbb\avatar\driver;
-
-class barfoo extends \phpbb\avatar\driver\driver
-{
- public function get_data($row)
- {
- return array();
- }
-
- public function prepare_form($request, $template, $user, $row, &$error)
- {
- return false;
- }
-
- public function process_form($request, $template, $user, $row, &$error)
- {
- return false;
- }
-
- public function get_template_name()
- {
- return 'barfoo.html';
- }
-}
+<?php + +namespace phpbb\avatar\driver; + +class barfoo extends \phpbb\avatar\driver\driver +{ + public function get_data($row) + { + return array(); + } + + public function prepare_form($request, $template, $user, $row, &$error) + { + return false; + } + + public function process_form($request, $template, $user, $row, &$error) + { + return false; + } + + public function get_template_name() + { + return 'barfoo.html'; + } +} diff --git a/tests/avatar/driver/foobar.php b/tests/avatar/driver/foobar.php index aabdaf5ac4..16d50ccad4 100644 --- a/tests/avatar/driver/foobar.php +++ b/tests/avatar/driver/foobar.php @@ -1,26 +1,26 @@ -<?php
-
-namespace phpbb\avatar\driver;
-
-class foobar extends \phpbb\avatar\driver\driver
-{
- public function get_data($row)
- {
- return array();
- }
-
- public function prepare_form($request, $template, $user, $row, &$error)
- {
- return false;
- }
-
- public function process_form($request, $template, $user, $row, &$error)
- {
- return false;
- }
-
- public function get_template_name()
- {
- return 'foobar.html';
- }
-}
+<?php + +namespace phpbb\avatar\driver; + +class foobar extends \phpbb\avatar\driver\driver +{ + public function get_data($row) + { + return array(); + } + + public function prepare_form($request, $template, $user, $row, &$error) + { + return false; + } + + public function process_form($request, $template, $user, $row, &$error) + { + return false; + } + + public function get_template_name() + { + return 'foobar.html'; + } +} diff --git a/tests/avatar/fixtures/users.xml b/tests/avatar/fixtures/users.xml new file mode 100644 index 0000000000..1773d438c2 --- /dev/null +++ b/tests/avatar/fixtures/users.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_avatar</column> + <column>user_avatar_type</column> + <column>user_avatar_width</column> + <column>user_avatar_height</column> + <row> + <value>1</value> + <value>barfoo</value> + <value></value> + <value></value> + <value>foobar@example.com</value> + <value>avatar.driver.gravatar</value> + <value>80</value> + <value>80</value> + </row> + <row> + <value>2</value> + <value>foobar</value> + <value></value> + <value></value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>foo</value> + <value></value> + <value></value> + <value>g5_1414350991.jpg</value> + <value>avatar.driver.upload</value> + <value>80</value> + <value>80</value> + </row> + </table> + <table name="phpbb_groups"> + <column>group_id</column> + <column>group_type</column> + <column>group_name</column> + <column>group_avatar</column> + <column>group_avatar_type</column> + <column>group_avatar_width</column> + <column>group_avatar_height</column> + <row> + <value>5</value> + <value>3</value> + <value>ADMINISTRATORS</value> + <value>g5_1414350991.jpg</value> + <value>avatar.driver.upload</value> + <value>80</value> + <value>80</value> + </row> + </table> +</dataset> diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 527bb223d5..924f1319a2 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -1,66 +1,109 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ require_once dirname(__FILE__) . '/driver/foobar.php'; -class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase +class phpbb_avatar_manager_test extends \phpbb_database_test_case { + /** @var \phpbb\avatar\manager */ + protected $manager; + protected $avatar_foobar; + protected $avatar_barfoo; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/users.xml'); + } + public function setUp() { global $phpbb_root_path, $phpEx; // Mock phpbb_container - $this->phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $this->phpbb_container->expects($this->any()) + $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container->expects($this->any()) ->method('get') ->will($this->returnArgument(0)); + $filesystem = new \phpbb\filesystem\filesystem(); + // Prepare dependencies for avatar manager and driver - $config = new \phpbb\config\config(array()); - $request = $this->getMock('\phpbb\request\request'); + $this->config = new \phpbb\config\config(array()); $cache = $this->getMock('\phpbb\cache\driver\driver_interface'); $path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), - new \phpbb\filesystem(), - $this->phpbb_root_path, - $this->phpEx + $filesystem, + $this->getMock('\phpbb\request\request'), + $phpbb_root_path, + $phpEx + ); + + $guessers = array( + new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), + new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \phpbb\mimetype\extension_guesser, + new \phpbb\mimetype\content_guesser, ); + $guesser = new \phpbb\mimetype\guesser($guessers); + $imagesize = new \FastImageSize\FastImageSize(); + + $dispatcher = new phpbb_mock_event_dispatcher(); // $this->avatar_foobar will be needed later on - $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $path_helper, $cache)); + $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)); $this->avatar_foobar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.foobar')); // barfoo driver can't be mocked with constructor arguments - $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name')); + $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name', 'get_config_name')); $this->avatar_barfoo->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.barfoo')); + $this->avatar_barfoo->expects($this->any()) + ->method('get_config_name') + ->will($this->returnValue('barfoo')); $avatar_drivers = array($this->avatar_foobar, $this->avatar_barfoo); + $files_factory = new \phpbb\files\factory($phpbb_container); + foreach ($this->avatar_drivers() as $driver) { - $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $path_helper, $cache)); + if ($driver !== 'upload') + { + $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)); + } + else + { + $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $filesystem, $path_helper, $dispatcher, $files_factory, $cache)); + } $cur_avatar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.' . $driver)); - $config['allow_avatar_' . get_class($cur_avatar)] = false; + $this->config['allow_avatar_' . get_class($cur_avatar)] = $driver == 'gravatar'; $avatar_drivers[] = $cur_avatar; } - $config['allow_avatar_' . get_class($this->avatar_foobar)] = true; - $config['allow_avatar_' . get_class($this->avatar_barfoo)] = false; + $this->config['allow_avatar_' . get_class($this->avatar_foobar)] = true; + $this->config['allow_avatar_' . get_class($this->avatar_barfoo)] = false; // Set up avatar manager - $this->manager = new \phpbb\avatar\manager($config, $avatar_drivers, $this->phpbb_container); + $this->manager = new \phpbb\avatar\manager($this->config, $avatar_drivers, $phpbb_container); + $this->db = $this->new_dbal(); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $this->user = new \phpbb\user($lang, '\phpbb\datetime'); } protected function avatar_drivers() @@ -98,6 +141,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase { return array( array('avatar.driver.foobar', 'avatar.driver.foobar'), + array('avatar.driver.gravatar', 'avatar.driver.gravatar'), array('avatar.driver.foo_wrong', null), array('avatar.driver.local', null), array(AVATAR_GALLERY, null), @@ -172,8 +216,8 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase array( 'avatar' => '', 'avatar_type' => '', - 'avatar_width' => '', - 'avatar_height' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, ), ), array( @@ -222,8 +266,6 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase */ public function test_clean_row(array $input, array $output, $prefix = '') { - $cleaned_row = array(); - $cleaned_row = \phpbb\avatar\manager::clean_row($input, $prefix); foreach ($output as $key => $value) { @@ -244,7 +286,12 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase public function test_localize_errors() { - $user = $this->getMock('\phpbb\user'); + global $phpbb_root_path, $phpEx; + + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime') + ); $lang_array = array( array('FOOBAR_OFF', 'foobar_off'), array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'), @@ -265,4 +312,76 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase array('FOOBAR_EXPLAIN', 'foo'), ))); } + + public function data_handle_avatar_delete() + { + return array( + array( + array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, + ), 1, array( + 'avatar' => 'foobar@example.com', + 'avatar_type' => 'avatar.driver.gravatar', + 'avatar_width' => '16', + 'avatar_height' => '16', + ), USERS_TABLE, 'user_', + ), + array( + array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, + ), 5, array( + 'avatar' => 'g5_1414350991.jpg', + 'avatar_type' => 'avatar.driver.upload', + 'avatar_width' => '80', + 'avatar_height' => '80' + ), GROUPS_TABLE, 'group_', + ), + ); + } + + /** + * @dataProvider data_handle_avatar_delete + */ + public function test_handle_avatar_delete($expected, $id, $avatar_data, $table, $prefix) + { + $this->config['allow_avatar_gravatar'] = true; + $this->assertNull($this->manager->handle_avatar_delete($this->db, $this->user, $avatar_data, $table, $prefix)); + + $sql = 'SELECT * FROM ' . $table . ' + WHERE ' . $prefix . 'id = ' . $id; + $result = $this->db->sql_query_limit($sql, 1); + + $row = $this->manager->clean_row($this->db->sql_fetchrow($result), substr($prefix, 0, -1)); + $this->db->sql_freeresult($result); + + foreach ($expected as $key => $value) + { + $this->assertEquals($value, $row[$key]); + } + } + + /** + * @dependsOn test_handle_avatar_delete + */ + public function test_user_group_avatar_deleted() + { + $sql = 'SELECT * FROM ' . USERS_TABLE . ' + WHERE user_id = 3'; + $result = $this->db->sql_query_limit($sql, 1); + $row = $this->manager->clean_row($this->db->sql_fetchrow($result), 'user'); + $this->db->sql_freeresult($result); + + $this->assertEquals(array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, + ), $row); + } } diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php index d0dcce5bbf..14736627f3 100644 --- a/tests/bbcode/parser_test.php +++ b/tests/bbcode/parser_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,7 +16,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php'; -class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase +class phpbb_bbcode_parser_test extends \phpbb_test_case { public function bbcode_firstpass_data() { diff --git a/tests/bbcode/url_bbcode_test.php b/tests/bbcode/url_bbcode_test.php index d5df386714..83176abe4c 100644 --- a/tests/bbcode/url_bbcode_test.php +++ b/tests/bbcode/url_bbcode_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index afb586435c..86e1e5314b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,20 +1,29 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ define('IN_PHPBB', true); +define('PHPBB_ENVIRONMENT', 'test'); + $phpbb_root_path = 'phpBB/'; $phpEx = 'php'; + +global $table_prefix; require_once $phpbb_root_path . 'includes/startup.php'; $table_prefix = 'phpbb_'; require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx; +require_once($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); $phpbb_class_loader_mock = new \phpbb\class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php"); $phpbb_class_loader_mock->register(); @@ -28,3 +37,9 @@ require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; require_once 'test_framework/phpbb_functional_test_case.php'; +require_once 'test_framework/phpbb_ui_test_case.php'; + +if (version_compare(PHP_VERSION, '5.3.19', ">=") && file_exists(__DIR__ . '/vendor/autoload.php')) +{ + require_once __DIR__ . '/vendor/autoload.php'; +} diff --git a/tests/cache/apc_driver_test.php b/tests/cache/apc_driver_test.php index 51f3ac24b6..706f274448 100644 --- a/tests/cache/apc_driver_test.php +++ b/tests/cache/apc_driver_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -30,14 +34,14 @@ class phpbb_cache_apc_driver_test extends phpbb_cache_common_test_case self::markTestSkipped('APC extension is not loaded'); } - $php_ini = new \phpbb\php\ini; + $php_ini = new \bantu\IniGetWrapper\IniGetWrapper; - if (!$php_ini->get_bool('apc.enabled')) + if (!$php_ini->getBool('apc.enabled')) { self::markTestSkipped('APC is not enabled. Make sure apc.enabled=1 in php.ini'); } - if (PHP_SAPI == 'cli' && !$php_ini->get_bool('apc.enable_cli')) + if (PHP_SAPI == 'cli' && !$php_ini->getBool('apc.enable_cli')) { self::markTestSkipped('APC is not enabled for CLI. Set apc.enable_cli=1 in php.ini'); } diff --git a/tests/cache/cache_memory.php b/tests/cache/cache_memory.php new file mode 100644 index 0000000000..806edb963a --- /dev/null +++ b/tests/cache/cache_memory.php @@ -0,0 +1,64 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_cache_memory extends \phpbb\cache\driver\memory +{ + protected $data = array(); + + /** + * Set cache path + */ + function phpbb_cache_memory() + { + } + + /** + * Fetch an item from the cache + * + * @access protected + * @param string $var Cache key + * @return mixed Cached data + */ + function _read($var) + { + return $this->data[$var]; + } + + /** + * Store data in the cache + * + * @access protected + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + function _write($var, $data, $ttl = 2592000) + { + $this->data[$var] = $data; + return true; + } + + /** + * Remove an item from the cache + * + * @access protected + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + function _delete($var) + { + unset($this->data[$var]); + return true; + } +} diff --git a/tests/cache/cache_memory_test.php b/tests/cache/cache_memory_test.php new file mode 100644 index 0000000000..9f92e8d8dc --- /dev/null +++ b/tests/cache/cache_memory_test.php @@ -0,0 +1,129 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once dirname(__FILE__) . '/cache_memory.php'; + +class phpbb_cache_memory_test extends phpbb_database_test_case +{ + protected $cache; + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/cache_memory.xml'); + } + + protected function setUp() + { + global $db; + parent::setUp(); + + $this->cache = new phpbb_cache_memory(); + $db = $this->new_dbal(); + $this->db = $db; + } + + static public function cache_single_query_data() + { + return array( + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE, + 3, + ), + ), + POSTS_TABLE, + ), + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE, + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id', + 3, + ), + ), + POSTS_TABLE, + ), + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE, + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id', + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id + LEFT JOIN ' . USERS_TABLE . ' u ON p.poster_id = u.user_id', + 3, + ), + ), + POSTS_TABLE, + ), + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id', + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id + LEFT JOIN ' . USERS_TABLE . ' u ON p.poster_id = u.user_id', + 3, + ), + ), + TOPICS_TABLE, + ), + ); + } + + /** + * @dataProvider cache_single_query_data + */ + public function test_cache_single_query($sql_queries, $table) + { + foreach ($sql_queries as $query) + { + $sql_request_res = $this->db->sql_query($query[0]); + + $this->cache->sql_save($this->db, $query[0], $sql_request_res, 1); + + $results = array(); + $query_id = $this->cache->sql_load($query[0]); + while ($row = $this->cache->sql_fetchrow($query_id)) + { + $results[] = $row; + } + $this->cache->sql_freeresult($query_id); + $this->assertEquals($query[1], sizeof($results)); + } + + $this->cache->destroy('sql', $table); + + foreach ($sql_queries as $query) + { + $this->assertNotEquals(false, $this->cache->sql_load($query[0])); + } + } +} diff --git a/tests/cache/common_test_case.php b/tests/cache/common_test_case.php index 3fe10c63e1..ee0649a755 100644 --- a/tests/cache/common_test_case.php +++ b/tests/cache/common_test_case.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/cache/dummy_driver_test.php b/tests/cache/dummy_driver_test.php new file mode 100644 index 0000000000..6cb6b73729 --- /dev/null +++ b/tests/cache/dummy_driver_test.php @@ -0,0 +1,77 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_cache_dummy_driver_test extends phpbb_database_test_case +{ + protected $driver; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + } + + protected function setUp() + { + parent::setUp(); + + $this->driver = new \phpbb\cache\driver\dummy; + } + + public function test_get_put() + { + $this->assertSame(false, $this->driver->get('key')); + + $this->driver->put('key', 'value'); + + // null driver does not cache + $this->assertSame(false, $this->driver->get('key')); + } + + public function test_purge() + { + $this->assertNull($this->driver->purge()); + } + + public function test_destroy() + { + $this->assertNull($this->driver->destroy('foo')); + } + + public function test_cache_sql() + { + global $db, $cache, $phpbb_root_path, $phpEx; + $config = new phpbb\config\config(array()); + $db = $this->new_dbal(); + $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx); + + $sql = "SELECT * FROM phpbb_config + WHERE config_name = 'foo'"; + $result = $db->sql_query($sql, 300); + $first_result = $db->sql_fetchrow($result); + $expected = array('config_name' => 'foo', 'config_value' => '23', 'is_dynamic' => 0); + $this->assertEquals($expected, $first_result); + + $sql = 'DELETE FROM phpbb_config'; + $result = $db->sql_query($sql); + + // As null cache driver does not actually cache, + // this should return no results + $sql = "SELECT * FROM phpbb_config + WHERE config_name = 'foo'"; + $result = $db->sql_query($sql, 300); + + $this->assertSame(false, $db->sql_fetchrow($result)); + + $db->sql_close(); + } +} diff --git a/tests/cache/file_driver_test.php b/tests/cache/file_driver_test.php index c0843e8ed9..471316847d 100644 --- a/tests/cache/file_driver_test.php +++ b/tests/cache/file_driver_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/cache/fixtures/cache_memory.xml b/tests/cache/fixtures/cache_memory.xml new file mode 100644 index 0000000000..9c19ebb7ba --- /dev/null +++ b/tests/cache/fixtures/cache_memory.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <column>topic_title</column> + <column>topic_first_post_id</column> + <column>topic_last_post_id</column> + <row> + <value>1</value> + <value>1</value> + <value>Topic</value> + <value>2</value> + <value>2</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>poster_id</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Post 1</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>1</value> + <value>1</value> + <value>Post 2</value> + </row> + <row> + <value>3</value> + <value>3</value> + <value>1</value> + <value>1</value> + <value>Post 3</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>user_posts</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>1</value> + <value>1</value> + <value>user 1</value> + <value>user 1</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>user 2</value> + <value>user 2</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>1</value> + <value>user 3</value> + <value>user 3</value> + <value></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php deleted file mode 100644 index 58e57f2b3a..0000000000 --- a/tests/cache/null_driver_test.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -class phpbb_cache_null_driver_test extends phpbb_database_test_case -{ - protected $driver; - - public function getDataSet() - { - return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); - } - - protected function setUp() - { - parent::setUp(); - - $this->driver = new \phpbb\cache\driver\null; - } - - public function test_get_put() - { - $this->assertSame(false, $this->driver->get('key')); - - $this->driver->put('key', 'value'); - - // null driver does not cache - $this->assertSame(false, $this->driver->get('key')); - } - - public function test_purge() - { - // does nothing - $this->driver->purge(); - } - - public function test_destroy() - { - // does nothing - $this->driver->destroy('foo'); - } - - public function test_cache_sql() - { - global $db, $cache, $phpbb_root_path, $phpEx; - $config = new phpbb\config\config(array()); - $db = $this->new_dbal(); - $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx); - - $sql = "SELECT * FROM phpbb_config - WHERE config_name = 'foo'"; - $result = $db->sql_query($sql, 300); - $first_result = $db->sql_fetchrow($result); - $expected = array('config_name' => 'foo', 'config_value' => '23', 'is_dynamic' => 0); - $this->assertEquals($expected, $first_result); - - $sql = 'DELETE FROM phpbb_config'; - $result = $db->sql_query($sql); - - // As null cache driver does not actually cache, - // this should return no results - $sql = "SELECT * FROM phpbb_config - WHERE config_name = 'foo'"; - $result = $db->sql_query($sql, 300); - - $this->assertSame(false, $db->sql_fetchrow($result)); - - $db->sql_close(); - } -} diff --git a/tests/cache/redis_driver_test.php b/tests/cache/redis_driver_test.php index 3d954dc0db..387e6ca855 100644 --- a/tests/cache/redis_driver_test.php +++ b/tests/cache/redis_driver_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/captcha/qa_test.php b/tests/captcha/qa_test.php new file mode 100644 index 0000000000..4aa5e714f5 --- /dev/null +++ b/tests/captcha/qa_test.php @@ -0,0 +1,97 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_captcha_qa_test extends \phpbb_database_test_case +{ + protected $request; + + /** @var \phpbb\captcha\plugins\qa */ + protected $qa; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml'); + } + + public function setUp() + { + global $db, $request, $phpbb_container; + + $db = $this->new_dbal(); + + parent::setUp(); + + $request = new \phpbb_mock_request(); + $phpbb_container = new \phpbb_mock_container_builder(); + $factory = new \phpbb\db\tools\factory(); + $phpbb_container->set('dbal.tools', $factory->get($db)); + $this->qa = new \phpbb\captcha\plugins\qa('phpbb_captcha_questions', 'phpbb_captcha_answers', 'phpbb_qa_confirm'); + } + + public function test_is_installed() + { + $this->assertFalse($this->qa->is_installed()); + + $this->qa->install(); + + $this->assertTrue($this->qa->is_installed()); + } + + public function test_set_get_name() + { + $this->assertNull($this->qa->get_service_name()); + $this->qa->set_name('foobar'); + $this->assertSame('foobar', $this->qa->get_service_name()); + } + + public function data_acp_get_question_input() + { + return array( + array("foobar\ntest\nyes", array( + 'question_text' => '', + 'strict' => false, + 'lang_iso' => '', + 'answers' => array('foobar', 'test', 'yes') + )), + array("foobar\ntest\n \nyes", array( + 'question_text' => '', + 'strict' => false, + 'lang_iso' => '', + 'answers' => array( + 0 => 'foobar', + 1 => 'test', + 3 => 'yes', + ) + )), + array('', array( + 'question_text' => '', + 'strict' => false, + 'lang_iso' => '', + 'answers' => '', + )), + ); + } + + /** + * @dataProvider data_acp_get_question_input + */ + public function test_acp_get_question_input($value, $expected) + { + global $request; + $request->overwrite('answers', $value); + + $this->assertEquals($expected, $this->qa->acp_get_question_input()); + } +} diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php index 6e551f658a..ffb14b0720 100644 --- a/tests/class_loader/class_loader_test.php +++ b/tests/class_loader/class_loader_test.php @@ -1,13 +1,17 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -class phpbb_class_loader_test extends PHPUnit_Framework_TestCase +class phpbb_class_loader_test extends \phpbb_test_case { public function setUp() { diff --git a/tests/composer.json b/tests/composer.json new file mode 100644 index 0000000000..69512f30a6 --- /dev/null +++ b/tests/composer.json @@ -0,0 +1,5 @@ +{ + "require-dev": { + "facebook/webdriver": "dev-master" + } +} diff --git a/tests/composer.lock b/tests/composer.lock new file mode 100644 index 0000000000..f714495d84 --- /dev/null +++ b/tests/composer.lock @@ -0,0 +1,66 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "cf1d8a4841e5e669b148e0df6645a788", + "packages": [ + + ], + "packages-dev": [ + { + "name": "facebook/webdriver", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "b6e002e5bf811a8edba393ce6872322c1b7cf796" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/b6e002e5bf811a8edba393ce6872322c1b7cf796", + "reference": "b6e002e5bf811a8edba393ce6872322c1b7cf796", + "shasum": "" + }, + "require": { + "php": ">=5.3.19" + }, + "require-dev": { + "phpdocumentor/phpdocumentor": "2.*", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "http://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A php client for WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2014-08-05 02:55:46" + } + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": { + "facebook/webdriver": 20 + }, + "platform": [ + + ], + "platform-dev": [ + + ] +} diff --git a/tests/compress/compress_test.php b/tests/compress/compress_test.php index 6623f7ed8a..56c406b206 100644 --- a/tests/compress/compress_test.php +++ b/tests/compress/compress_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php'; diff --git a/tests/config/config_test.php b/tests/config/config_test.php index 5373fcef5f..380b4336a7 100644 --- a/tests/config/config_test.php +++ b/tests/config/config_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/config/db_test.php b/tests/config/db_test.php index dd1c88f707..713e6cb6d9 100644 --- a/tests/config/db_test.php +++ b/tests/config/db_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/config/db_text_test.php b/tests/config/db_text_test.php index 354c0efacf..a91abf990f 100644 --- a/tests/config/db_text_test.php +++ b/tests/config/db_text_test.php @@ -1,16 +1,20 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ class phpbb_config_db_text_test extends phpbb_database_test_case { - private $db; - private $config_text; + /** @var \phpbb\config\db_text */ + protected $config_text; public function getDataSet() { @@ -48,6 +52,12 @@ class phpbb_config_db_text_test extends phpbb_database_test_case $this->assertSame('24', $this->config_text->get('foo')); } + public function test_set_same_value_get() + { + $this->config_text->set('foo', '23'); + $this->assertSame('23', $this->config_text->get('foo')); + } + public function test_set_get_long_string() { $expected = str_repeat('ABC', 10000); @@ -89,6 +99,8 @@ class phpbb_config_db_text_test extends phpbb_database_test_case 'baby' => 'phpBB', // Entry update 'bar' => '64', + // Entry update - same value + 'foo' => '23', ); $this->config_text->set_array($set_array_param); diff --git a/tests/config_php_file_test.php b/tests/config_php_file_test.php new file mode 100644 index 0000000000..c319678108 --- /dev/null +++ b/tests/config_php_file_test.php @@ -0,0 +1,40 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_config_php_file_test extends phpbb_test_case +{ + public function test_default() + { + $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php'); + $this->assertSame('bar', $config_php->get('foo')); + $this->assertNull($config_php->get('bar')); + $this->assertSame(array('foo' => 'bar', 'foo_foo' => 'bar bar'), $config_php->get_all()); + } + + public function test_set_config_file() + { + $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php'); + $config_php->set_config_file(dirname( __FILE__ ) . '/fixtures/config_other.php'); + $this->assertSame('foo', $config_php->get('bar')); + $this->assertNull($config_php->get('foo')); + $this->assertSame(array('bar' => 'foo', 'bar_bar' => 'foo foo'), $config_php->get_all()); + } + + public function test_non_existent_file() + { + $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/non_existent/', 'php'); + $this->assertNull($config_php->get('bar')); + $this->assertNull($config_php->get('foo')); + $this->assertSame(array(), $config_php->get_all()); + } +} diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php new file mode 100644 index 0000000000..6c92660580 --- /dev/null +++ b/tests/console/cache/purge_test.php @@ -0,0 +1,100 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; +use phpbb\console\command\cache\purge; + +require_once dirname(__FILE__) . '/../../../phpBB/includes/functions_admin.php'; + +class phpbb_console_command_cache_purge_test extends phpbb_test_case +{ + protected $cache_dir; + protected $cache; + protected $command_name; + protected $db; + protected $config; + + public function __construct() + { + $this->cache_dir = dirname(__FILE__) . '/tmp/cache/'; + } + + protected function setUp() + { + global $phpbb_root_path, $phpEx; + + if (file_exists($this->cache_dir)) + { + // cache directory possibly left after aborted + // or failed run earlier + $this->remove_cache_dir(); + } + $this->create_cache_dir(); + + $this->cache = new \phpbb\cache\driver\file($this->cache_dir); + + $this->db = $this->getMock('\phpbb\db\driver\driver_interface'); + + $this->config = new \phpbb\config\config(array('assets_version' => 1)); + $this->user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime') + ); + } + + public function test_purge() + { + $this->cache->put('test_key', 'test_value'); + + $this->assertEquals( + 'test_value', + $this->cache->get('test_key'), + 'File ACM put and get' + ); + + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertSame(false, $this->cache->get('test_key')); + $this->assertSame(2, $this->config['assets_version']); + } + + private function create_cache_dir() + { + $this->get_test_case_helpers()->makedirs($this->cache_dir); + } + + private function remove_cache_dir() + { + $iterator = new DirectoryIterator($this->cache_dir); + foreach ($iterator as $file) + { + if ($file != '.' && $file != '..') + { + unlink($this->cache_dir . '/' . $file); + } + } + rmdir($this->cache_dir); + } + + public function get_command_tester() + { + $application = new Application(); + $application->add(new purge($this->user, $this->cache, $this->db, $this->getMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config)); + + $command = $application->find('cache:purge'); + $this->command_name = $command->getName(); + return new CommandTester($command); + } +} diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php new file mode 100644 index 0000000000..076316217d --- /dev/null +++ b/tests/console/config/config_test.php @@ -0,0 +1,256 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; + +class phpbb_console_command_config_test extends phpbb_test_case +{ + protected $config; + protected $command_name; + protected $user; + + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->config = new \phpbb\config\config(array()); + + $this->user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime') + ); + $this->user->method('lang')->will($this->returnArgument(0)); + } + + public function test_set_dynamic() + { + $this->assertEmpty($this->config); + + $command_tester = $this->get_command_tester('set'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'value' => 'test_value', + '--dynamic' => true, + )); + + $this->assertSame($this->config['test_key'], 'test_value'); + } + + public function test_set_no_dynamic() + { + $this->assertEmpty($this->config); + + $command_tester = $this->get_command_tester('set'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'value' => 'test_value', + '--dynamic' => false, + )); + + $this->assertSame($this->config['test_key'], 'test_value'); + } + + public function test_set_atomic_dynamic() + { + $this->assertEmpty($this->config); + + $this->config->set('test_key', 'old_value', true); + $this->assertSame($this->config['test_key'], 'old_value'); + + $command_tester = $this->get_command_tester('set_atomic'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'old' => 'old_value', + 'new' => 'new_value', + '--dynamic' => true, + )); + + $this->assertSame($this->config['test_key'], 'new_value'); + } + + public function test_set_atomic_no_dynamic() + { + $this->assertEmpty($this->config); + + $this->config->set('test_key', 'old_value', false); + $this->assertSame($this->config['test_key'], 'old_value'); + + $command_tester = $this->get_command_tester('set_atomic'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'old' => 'old_value', + 'new' => 'new_value', + '--dynamic' => false, + )); + + $this->assertSame($this->config['test_key'], 'new_value'); + } + + public function test_set_atomic_error_dynamic() + { + $this->assertEmpty($this->config); + + $this->config->set('test_key', 'wrong_value', true); + $this->assertSame($this->config['test_key'], 'wrong_value'); + + $command_tester = $this->get_command_tester('set_atomic'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'old' => 'old_value', + 'new' => 'new_value', + '--dynamic' => true, + )); + + $this->assertSame($this->config['test_key'], 'wrong_value'); + } + + public function test_get_no_new_line() + { + $this->config->set('test_key', 'test_value', false); + $this->assertSame($this->config['test_key'], 'test_value'); + + $command_tester = $this->get_command_tester('get'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + '--no-newline' => true, + )); + + $this->assertSame($this->config['test_key'], $command_tester->getDisplay()); + } + + public function test_get_new_line() + { + $this->config->set('test_key', 'test_value', false); + $this->assertSame($this->config['test_key'], 'test_value'); + + $command_tester = $this->get_command_tester('get'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + '--no-newline' => false, + )); + + $this->assertSame($this->config['test_key'] . PHP_EOL, $command_tester->getDisplay()); + } + + public function test_get_error() + { + $this->config->set('test_key', 'test_value', false); + $this->assertSame($this->config['test_key'], 'test_value'); + + $command_tester = $this->get_command_tester('get'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'wrong_key', + '--no-newline' => false, + )); + + $this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay()); + } + + public function test_increment_dynamic() + { + $this->config->set('test_key', 0, false); + $this->assertSame($this->config['test_key'], 0); + + $command_tester = $this->get_command_tester('increment'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'increment' => 2, + '--dynamic' => true, + )); + + $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay()); + $this->assertSame(2, $this->config['test_key']); + } + + public function test_increment_no_dynamic() + { + $this->config->set('test_key', 0, false); + $this->assertSame($this->config['test_key'], 0); + + $command_tester = $this->get_command_tester('increment'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'increment' => 2, + '--dynamic' => false, + )); + + $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay()); + $this->assertSame(2, $this->config['test_key']); + } + + public function test_increment_no_set() + { + $this->assertEmpty($this->config); + + $command_tester = $this->get_command_tester('increment'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + 'increment' => 2, + '--dynamic' => true, + )); + + $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay()); + $this->assertSame(2, $this->config['test_key']); + } + + public function test_delete_ok() + { + $this->config->set('test_key', 'test_value', false); + $this->assertSame($this->config['test_key'], 'test_value'); + + $command_tester = $this->get_command_tester('delete'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + )); + + $this->assertContains('CLI_CONFIG_DELETE_SUCCESS', $command_tester->getDisplay()); + $this->assertEmpty($this->config); + } + + public function test_delete_error() + { + $this->assertEmpty($this->config); + + $command_tester = $this->get_command_tester('delete'); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'wrong_key', + )); + + $this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay()); + $this->assertEmpty($this->config); + } + + public function get_command_tester($class_name) + { + $command_complete_name = '\phpbb\console\command\config' . '\\' . $class_name; + $application = new Application(); + $application->add(new $command_complete_name($this->user, $this->config)); + $command = $application->find('config:' . $this->command_name); + $this->command_name = $command->getName(); + return new CommandTester($command); + } +} diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php new file mode 100644 index 0000000000..3bbe2078ba --- /dev/null +++ b/tests/console/cron/cron_list_test.php @@ -0,0 +1,108 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/tasks/simple_ready.php'; +require_once dirname(__FILE__) . '/tasks/simple_not_ready.php'; + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; +use phpbb\console\command\cron\cron_list; + +class phpbb_console_command_cron_list_test extends phpbb_test_case +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\user */ + protected $user; + + protected $command_name; + + protected $command_tester; + + protected function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $this->user->method('lang')->will($this->returnArgument(0)); + } + + public function test_no_task() + { + $this->initiate_test(0, 0); + $this->assertContains('CRON_NO_TASKS', $this->command_tester->getDisplay()); + } + + public function test_only_ready() + { + $this->initiate_test(2, 0); + $this->assertContains('TASKS_READY command1 command2', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay()))); + } + + public function test_only_not_ready() + { + $this->initiate_test(0, 2); + $this->assertContains('TASKS_NOT_READY command1 command2', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay()))); + } + + public function test_both_ready() + { + $this->initiate_test(2, 2); + $this->assertSame('TASKS_READY command1 command2 TASKS_NOT_READY command3 command4', preg_replace('/\s+/', ' ', trim($this->command_tester->getDisplay()))); + } + + public function get_cron_manager(array $tasks) + { + global $pathEx, $phpbb_root_path; + $i = 1; + foreach ($tasks as $task) + { + $task->set_name('command' . $i); + $i++; + } + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); + } + + public function get_command_tester() + { + $application = new Application(); + $application->add(new cron_list($this->user, $this->cron_manager)); + + $command = $application->find('cron:list'); + $this->command_name = $command->getName(); + return new CommandTester($command); + } + + public function initiate_test($number_ready, $number_not_ready) + { + $tasks = array(); + + for ($i = 0; $i < $number_ready; $i++) + { + $tasks[] = new phpbb_cron_task_simple_ready(); + } + + for ($i = 0; $i < $number_not_ready; $i++) + { + $tasks[] = new phpbb_cron_task_simple_not_ready(); + } + + $this->get_cron_manager($tasks); + $this->command_tester = $this->get_command_tester(); + $this->command_tester->execute(array('command' => $this->command_name), array('decorated' => false)); + } +} diff --git a/tests/console/cron/fixtures/config.xml b/tests/console/cron/fixtures/config.xml new file mode 100644 index 0000000000..2cb683d409 --- /dev/null +++ b/tests/console/cron/fixtures/config.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_config"> + <column>config_name</column> + <column>config_value</column> + <column>is_dynamic</column> + </table> +</dataset> diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php new file mode 100644 index 0000000000..d6c7b21781 --- /dev/null +++ b/tests/console/cron/run_test.php @@ -0,0 +1,168 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; +use phpbb\console\command\cron\run; + +require_once dirname(__FILE__) . '/tasks/simple.php'; +require_once dirname(__FILE__) . '/../../../phpBB/includes/functions.php'; + +class phpbb_console_command_cron_run_test extends phpbb_database_test_case +{ + protected $db; + protected $config; + protected $lock; + protected $user; + protected $cron_manager; + protected $command_name; + protected $task; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + } + + public function setUp() + { + global $db, $config, $phpbb_root_path, $phpEx; + + $db = $this->db = $this->new_dbal(); + $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); + $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); + + $this->user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $this->user->method('lang')->will($this->returnArgument(0)); + + $this->task = new phpbb_cron_task_simple(); + $tasks = array( + $this->task, + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phbEx); + + $this->assertSame('0', $config['cron_lock']); + } + + public function test_normal_use() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_verbose_mode() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); + + $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + /** + * @expectedException \phpbb\exception\runtime_exception + * @expectedExceptionMessage CRON_LOCK_ERROR + */ + public function test_error_lock() + { + $this->lock->acquire(); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); + $this->assertSame(false, $this->task->executed); + $this->assertSame(1, $exit_status); + } + + public function test_no_task() + { + $tasks = array( + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_no_task_verbose() + { + $tasks = array( + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); + + $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay()); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_arg_valid() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple')); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + /** + * @expectedException \phpbb\exception\runtime_exception + * @expectedExceptionMessage CRON_NO_SUCH_TASK + */ + public function test_arg_invalid() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo')); + + $this->assertContains('CRON_NO_SUCH_TASK', $command_tester->getDisplay()); + $this->assertSame(false, $this->task->executed); + $this->assertSame(2, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_arg_valid_verbose() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true)); + + $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function get_command_tester() + { + $application = new Application(); + $application->add(new run($this->user, $this->cron_manager, $this->lock)); + + $command = $application->find('cron:run'); + $this->command_name = $command->getName(); + return new CommandTester($command); + } +} diff --git a/tests/console/cron/tasks/simple.php b/tests/console/cron/tasks/simple.php new file mode 100644 index 0000000000..194c52afe1 --- /dev/null +++ b/tests/console/cron/tasks/simple.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_cron_task_simple extends \phpbb\cron\task\base +{ + public $executed = false; + + public function get_name() + { + return get_class($this); + } + + public function run() + { + $this->executed = true; + } +} diff --git a/tests/console/cron/tasks/simple_not_ready.php b/tests/console/cron/tasks/simple_not_ready.php new file mode 100644 index 0000000000..887768e5fe --- /dev/null +++ b/tests/console/cron/tasks/simple_not_ready.php @@ -0,0 +1,13 @@ +<?php + +class phpbb_cron_task_simple_not_ready extends \phpbb\cron\task\base +{ + public function run() + { + } + + public function should_run() + { + return false; + } +} diff --git a/tests/console/cron/tasks/simple_ready.php b/tests/console/cron/tasks/simple_ready.php new file mode 100644 index 0000000000..47970e104f --- /dev/null +++ b/tests/console/cron/tasks/simple_ready.php @@ -0,0 +1,8 @@ +<?php + +class phpbb_cron_task_simple_ready extends \phpbb\cron\task\base +{ + public function run() + { + } +} diff --git a/tests/console/fixtures/png.png b/tests/console/fixtures/png.png Binary files differnew file mode 100644 index 0000000000..c143a26a06 --- /dev/null +++ b/tests/console/fixtures/png.png diff --git a/tests/console/fixtures/thumbnail.xml b/tests/console/fixtures/thumbnail.xml new file mode 100644 index 0000000000..8037523633 --- /dev/null +++ b/tests/console/fixtures/thumbnail.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_attachments"> + <column>attach_id</column> + <column>physical_filename</column> + <column>real_filename</column> + <column>thumbnail</column> + <column>extension</column> + <column>mimetype</column> + <column>attach_comment</column> + + <row> + <value>1</value> + <value>test_png_1</value> + <value>real_test.png</value> + <value>0</value> + <value>png</value> + <value>image/png</value> + <value></value> + </row> + <row> + <value>2</value> + <value>test_png_2</value> + <value>real_test.png</value> + <value>1</value> + <value>png</value> + <value>image/png</value> + <value></value> + </row> + <row> + <value>10</value> + <value>test_txt</value> + <value>real_test.txt</value> + <value>0</value> + <value>txt</value> + <value>text/plain</value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/console/fixtures/txt.txt b/tests/console/fixtures/txt.txt new file mode 100644 index 0000000000..a78c858f5c --- /dev/null +++ b/tests/console/fixtures/txt.txt @@ -0,0 +1,2 @@ +<HTML>mime trigger</HTML> +The HTML tags should remain uppercase so that case-insensitivity can be checked. diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php new file mode 100644 index 0000000000..45d7adacb9 --- /dev/null +++ b/tests/console/thumbnail_test.php @@ -0,0 +1,125 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_compatibility.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; +use phpbb\console\command\thumbnail\generate; +use phpbb\console\command\thumbnail\delete; +use phpbb\console\command\thumbnail\recreate; + +class phpbb_console_command_thumbnail_test extends phpbb_database_test_case +{ + protected $db; + protected $config; + protected $cache; + protected $user; + protected $phpEx; + protected $phpbb_root_path; + protected $application; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/thumbnail.xml'); + } + + public function setUp() + { + global $config, $phpbb_root_path, $phpEx, $phpbb_filesystem; + + if (!@extension_loaded('gd')) + { + $this->markTestSkipped('Thumbnail tests require gd extension.'); + } + + parent::setUp(); + + $config = $this->config = new \phpbb\config\config(array( + 'img_min_thumb_filesize' => 2, + 'img_max_thumb_width' => 2, + 'img_imagick' => '', + )); + + $this->db = $this->db = $this->new_dbal(); + $this->user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime') + ); + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + + $this->cache = $this->getMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx)); + $this->cache->expects(self::any())->method('obtain_attach_extensions')->will(self::returnValue(array( + 'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE), + 'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE), + ))); + + $this->application = new Application(); + $this->application->add(new generate($this->user, $this->db, $this->cache, $this->phpbb_root_path, $this->phpEx)); + $this->application->add(new delete($this->user, $this->db, $this->phpbb_root_path)); + $this->application->add(new recreate($this->user)); + + $phpbb_filesystem = new \phpbb\filesystem\filesystem(); + + copy(dirname(__FILE__) . '/fixtures/png.png', $this->phpbb_root_path . 'files/test_png_1'); + copy(dirname(__FILE__) . '/fixtures/png.png', $this->phpbb_root_path . 'files/test_png_2'); + copy(dirname(__FILE__) . '/fixtures/png.png', $this->phpbb_root_path . 'files/thumb_test_png_2'); + copy(dirname(__FILE__) . '/fixtures/txt.txt', $this->phpbb_root_path . 'files/test_txt'); + } + + protected function tearDown() + { + parent::tearDown(); + + unlink($this->phpbb_root_path . 'files/test_png_1'); + unlink($this->phpbb_root_path . 'files/test_png_2'); + unlink($this->phpbb_root_path . 'files/test_txt'); + unlink($this->phpbb_root_path . 'files/thumb_test_png_1'); + unlink($this->phpbb_root_path . 'files/thumb_test_png_2'); + } + + public function test_thumbnails() + { + $command_tester = $this->get_command_tester('thumbnail:generate'); + $exit_status = $command_tester->execute(array('command' => 'thumbnail:generate')); + + self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1')); + self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2')); + self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_txt')); + self::assertSame(0, $exit_status); + + $command_tester = $this->get_command_tester('thumbnail:delete'); + $exit_status = $command_tester->execute(array('command' => 'thumbnail:delete')); + + self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1')); + self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2')); + self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_txt')); + self::assertSame(0, $exit_status); + + $command_tester = $this->get_command_tester('thumbnail:recreate'); + $exit_status = $command_tester->execute(array('command' => 'thumbnail:recreate')); + + self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1')); + self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2')); + self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_txt')); + self::assertSame(0, $exit_status); + } + + public function get_command_tester($command_name) + { + $command = $this->application->find($command_name); + return new CommandTester($command); + } +} diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index b2bdcb3b49..ba0a21a1a4 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -63,6 +67,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 1, @@ -89,6 +96,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 3, @@ -115,6 +125,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 2, @@ -141,6 +154,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 1, @@ -167,6 +183,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3), ), + array( + array('user_posts' => 3), + ), ), array( 1, 1, 3, @@ -193,6 +212,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2), ), + array( + array('user_posts' => 3), + ), ), array( @@ -218,6 +240,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 0), ), + array( + array('user_posts' => 3), + ), ), array( @@ -253,6 +278,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case array( array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0), ), + array( + array('user_posts' => 3), + ), ), ); } @@ -260,14 +288,18 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case /** * @dataProvider delete_post_data */ - public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum) + public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum, $expected_user) { - global $auth, $cache, $config, $db, $phpbb_container, $phpbb_root_path, $phpEx; + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx; - $config['search_type'] = 'phpbb_mock_search'; + $config = new \phpbb\config\config(array( + 'num_posts' => 3, + 'num_topics' => 1, + 'search_type' => 'phpbb_mock_search', + )); $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - set_config_count(null, null, null, new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1))); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // Create auth mock $auth = $this->getMock('\phpbb\auth\auth'); @@ -277,11 +309,18 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case ->will($this->returnValueMap(array( array('m_approve', 1, true), ))); - $user = $this->getMock('\phpbb\user'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $attachment_delete = new \phpbb\attachment\delete($config, $db, new \phpbb_mock_event_dispatcher(), new \phpbb\filesystem\filesystem(), new \phpbb\attachment\resync($db), $phpbb_root_path); + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); - $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + // Works as a workaround for tests + $phpbb_container->set('attachment.manager', $attachment_delete); delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason); @@ -306,5 +345,13 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case $this->assertEquals($expected_forum, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); + + $sql = 'SELECT user_posts + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $data['poster_id']; + $result = $db->sql_query($sql); + + $this->assertEquals($expected_user, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); } } diff --git a/tests/content_visibility/fixtures/set_post_visibility.xml b/tests/content_visibility/fixtures/set_post_visibility.xml index 5f792d0f05..1b8dac2670 100644 --- a/tests/content_visibility/fixtures/set_post_visibility.xml +++ b/tests/content_visibility/fixtures/set_post_visibility.xml @@ -10,6 +10,7 @@ <column>topic_posts_approved</column> <column>topic_posts_softdeleted</column> <column>topic_posts_unapproved</column> + <column>topic_attachment</column> <row> <value>1</value> <value>1</value> @@ -20,6 +21,7 @@ <value>1</value> <value>1</value> <value>1</value> + <value>0</value> </row> <row> @@ -32,6 +34,7 @@ <value>1</value> <value>1</value> <value>1</value> + <value>0</value> </row> <row> @@ -44,6 +47,33 @@ <value>1</value> <value>0</value> <value>0</value> + <value>0</value> + </row> + + <row> + <value>10</value> + <value>10</value> + <value>1</value> + <value>Only 3 posts (2 with attachments)</value> + <value>10</value> + <value>12</value> + <value>3</value> + <value>0</value> + <value>0</value> + <value>1</value> + </row> + + <row> + <value>11</value> + <value>10</value> + <value>1</value> + <value>Only 2 posts (1 with attachments)</value> + <value>13</value> + <value>14</value> + <value>3</value> + <value>0</value> + <value>0</value> + <value>1</value> </row> </table> <table name="phpbb_posts"> @@ -53,6 +83,7 @@ <column>forum_id</column> <column>post_visibility</column> <column>post_text</column> + <column>post_attachment</column> <row> <value>1</value> <value>1</value> @@ -60,6 +91,7 @@ <value>1</value> <value>0</value> <value>Unapproved</value> + <value>0</value> </row> <row> <value>2</value> @@ -68,6 +100,7 @@ <value>1</value> <value>1</value> <value>Approved</value> + <value>0</value> </row> <row> <value>3</value> @@ -76,6 +109,7 @@ <value>1</value> <value>2</value> <value>Softdeleted</value> + <value>0</value> </row> <row> @@ -85,6 +119,7 @@ <value>1</value> <value>0</value> <value>Unapproved</value> + <value>0</value> </row> <row> <value>5</value> @@ -93,6 +128,7 @@ <value>1</value> <value>1</value> <value>Approved</value> + <value>0</value> </row> <row> <value>6</value> @@ -101,6 +137,7 @@ <value>1</value> <value>1</value> <value>Approved 2</value> + <value>0</value> </row> <row> <value>7</value> @@ -109,6 +146,7 @@ <value>1</value> <value>2</value> <value>Softdeleted</value> + <value>0</value> </row> <row> <value>8</value> @@ -117,6 +155,52 @@ <value>1</value> <value>1</value> <value>Approved</value> + <value>0</value> + </row> + <row> + <value>10</value> + <value>1</value> + <value>10</value> + <value>10</value> + <value>1</value> + <value>Softdeleted</value> + <value>1</value> + </row> + <row> + <value>11</value> + <value>1</value> + <value>10</value> + <value>10</value> + <value>1</value> + <value>Softdeleted</value> + <value>1</value> + </row> + <row> + <value>12</value> + <value>1</value> + <value>10</value> + <value>10</value> + <value>1</value> + <value>Approved</value> + <value>0</value> + </row> + <row> + <value>13</value> + <value>1</value> + <value>11</value> + <value>10</value> + <value>1</value> + <value>Approved</value> + <value>1</value> + </row> + <row> + <value>14</value> + <value>1</value> + <value>11</value> + <value>10</value> + <value>1</value> + <value>Approved</value> + <value>0</value> </row> </table> <table name="phpbb_users"> diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index 22f210c406..6c5066119e 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -130,8 +134,12 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); - $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $config = new phpbb\config\config(array()); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index 9488a8c0b3..9ae4182673 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -130,8 +134,12 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); - $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $config = new phpbb\config\config(array()); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index 111e735650..aaaf64330e 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -77,8 +81,12 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) ->will($this->returnValueMap($permissions)); - $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $config = new phpbb\config\config(array()); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php index f81b83ff86..6375ce8f6d 100644 --- a/tests/content_visibility/set_post_visibility_test.php +++ b/tests/content_visibility/set_post_visibility_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -120,8 +124,12 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $cache = new phpbb_mock_cache; $db = $this->new_dbal(); $auth = $this->getMock('\phpbb\auth\auth'); - $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $config = new phpbb\config\config(array()); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $content_visibility->set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest); @@ -140,4 +148,49 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $this->assertEquals($expected_topic, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); } + + public function set_post_soft_deleted_data() + { + return array( + array( + 10, 10, 10, + 1, time(), 'soft-deleted', + true, false, + array(array('topic_attachment' => 1)), + ), + array( + 13, 11, 10, + 1, time(), 'soft-deleted', + true, false, + array(array('topic_attachment' => 0)), + ), + ); + } + + /** + * @dataProvider set_post_soft_deleted_data + */ + public function test_set_post_soft_deleted($post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $expected) + { + global $cache, $db, $auth, $phpbb_root_path, $phpEx; + + $cache = new phpbb_mock_cache; + $db = $this->new_dbal(); + $auth = $this->getMock('\phpbb\auth\auth'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $config = new phpbb\config\config(array()); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + + $content_visibility->set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest); + + $result = $db->sql_query('SELECT topic_attachment + FROM phpbb_topics + WHERE topic_id = ' . $topic_id); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); + } } diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php index 92b1253a15..f4d65f9ce3 100644 --- a/tests/content_visibility/set_topic_visibility_test.php +++ b/tests/content_visibility/set_topic_visibility_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -84,8 +88,12 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_ $cache = new phpbb_mock_cache; $db = $this->new_dbal(); $auth = $this->getMock('\phpbb\auth\auth'); - $user = $this->getMock('\phpbb\user'); - $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $config = new phpbb\config\config(array()); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $content_visibility->set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all); diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php new file mode 100644 index 0000000000..72c5328b0b --- /dev/null +++ b/tests/controller/common_helper_route.php @@ -0,0 +1,483 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +abstract class phpbb_controller_common_helper_route extends phpbb_test_case +{ + protected $root_path; + + public function setUp() + { + global $phpbb_dispatcher, $phpbb_root_path, $phpEx; + + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/foo/', + ), + ) + ); + $this->generate_route_objects(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + } + + protected function get_phpbb_root_path() + { + return ''; + } + + protected function get_uri() + { + return '/app.php'; + } + + protected function get_base_uri() + { + return $this->get_uri(); + } + + protected function get_script_name() + { + return 'app.php'; + } + + protected function path_to_app() + { + return ''; + } + + protected function generate_route_objects() + { + $this->request = new phpbb_mock_request(); + $this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER); + $this->request->overwrite('SCRIPT_FILENAME', $this->get_script_name(), \phpbb\request\request_interface::SERVER); + $this->request->overwrite('REQUEST_URI', $this->get_base_uri(), \phpbb\request\request_interface::SERVER); + $this->request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER); + $this->request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER); + + $this->symfony_request = new \phpbb\symfony_request( + $this->request + ); + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->phpbb_path_helper = new \phpbb\path_helper( + $this->symfony_request, + $this->filesystem, + $this->request, + $phpbb_root_path, + $phpEx + ); + + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $this->user = new \phpbb\user($lang, '\phpbb\datetime');; + + $container = new phpbb_mock_container_builder(); + $container->setParameter('core.environment', PHPBB_ENVIRONMENT); + $cache_path = $phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader($this->filesystem, ''); + $twig = new \phpbb\template\twig\environment( + $this->config, + $this->filesystem, + $this->phpbb_path_helper, + $container, + $cache_path, + null, + $loader, + array( + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ) + ); + $this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $this->config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user))); + $container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); + + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/foo/', + ), + ) + ); + + $loader = new \Symfony\Component\Routing\Loader\YamlFileLoader( + new \phpbb\routing\file_locator($this->filesystem, dirname(__FILE__) . '/') + ); + $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); + $this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT); + + // Set correct current phpBB root path + $this->root_path = $this->get_phpbb_root_path(); + } + + public function helper_url_data_no_rewrite() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + + // Resolves DI parameters + array('controller4', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + ); + } + + /** + * @dataProvider helper_url_data_no_rewrite() + */ + public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description); + } + + public function helper_url_data_with_rewrite() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + + // Resolves DI parameters + array('controller4', array(), true, false, '/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + ); + } + + /** + * @dataProvider helper_url_data_with_rewrite() + */ + public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id), $description); + } + + public function helper_url_data_absolute() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + + // Resolves DI parameters + array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + ); + } + + /** + * @dataProvider helper_url_data_absolute() + */ + public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description); + } + + public function helper_url_data_relative_path() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'app.php/foo/bar/p-3', 'no params using empty array'), + + // Resolves DI parameters + array('controller4', array(), true, false, 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + ); + } + + /** + * @dataProvider helper_url_data_relative_path() + */ + public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description); + } + + public function helper_url_data_network() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), + + // Resolves DI parameters + array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + ); + } + + /** + * @dataProvider helper_url_data_network() + */ + public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description); + } + + public function helper_url_data_absolute_with_rewrite() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + + // Resolves DI parameters + array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + ); + } + + /** + * @dataProvider helper_url_data_absolute_with_rewrite() + */ + public function test_helper_url_absolute_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL), $description); + } + + public function helper_url_data_relative_path_with_rewrite() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'foo/bar/p-3', 'no params using empty array'), + ); + } + + /** + * @dataProvider helper_url_data_relative_path_with_rewrite() + */ + public function test_helper_url_relative_path_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH), $description); + } + + public function helper_url_data_network_with_rewrite() + { + return array( + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + + // Custom sid parameter + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + + // Testing anchors + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + + // Anchors and custom sid + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + + // Empty parameters should not append the & or ? + array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), + + // Resolves DI parameters + array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'), + ); + } + + /** + * @dataProvider helper_url_data_network_with_rewrite() + */ + public function test_helper_url_network_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) + { + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); + $this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->symfony_request, $this->request, $this->routing_helper); + $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH), $description); + } +} diff --git a/tests/controller/config/routing.yml b/tests/controller/config/routing.yml deleted file mode 100644 index 175b11f130..0000000000 --- a/tests/controller/config/routing.yml +++ /dev/null @@ -1,3 +0,0 @@ -core_controller: - pattern: /core_foo - defaults: { _controller: core_foo.controller:bar } diff --git a/tests/controller/config/test/routing/environment.yml b/tests/controller/config/test/routing/environment.yml new file mode 100644 index 0000000000..1e7df02684 --- /dev/null +++ b/tests/controller/config/test/routing/environment.yml @@ -0,0 +1,3 @@ +core_controller: + path: /core_foo + defaults: { _controller: core_foo.controller:bar } diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 588adbcfb1..431b26b2bc 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -1,15 +1,19 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; @@ -21,20 +25,30 @@ class phpbb_controller_controller_test extends phpbb_test_case $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', array( - 'foo' => array( - 'ext_name' => 'foo', + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/foo/', + ), + 'vendor2/bar' => array( + 'ext_name' => 'vendor2/bar', 'ext_active' => '1', - 'ext_path' => 'ext/foo/', + 'ext_path' => 'ext/vendor2/bar/', ), )); } - public function test_provider() + public function test_router_default_loader() { - $provider = new \phpbb\controller\provider; - $routes = $provider - ->import_paths_from_finder($this->extension_manager->get_finder()) - ->find(__DIR__); + $container = new phpbb_mock_container_builder(); + $container->setParameter('core.environment', PHPBB_ENVIRONMENT); + + $loader = new \Symfony\Component\Routing\Loader\YamlFileLoader( + new \phpbb\routing\file_locator(new \phpbb\filesystem\filesystem(), dirname(__FILE__) . '/') + ); + $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); + $router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT); + $routes = $router->get_routes(); // This will need to be updated if any new routes are defined $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('core_controller')); @@ -45,6 +59,11 @@ class phpbb_controller_controller_test extends phpbb_test_case $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('controller2')); $this->assertEquals('/foo/bar', $routes->get('controller2')->getPath()); + + $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('controller3')); + $this->assertEquals('/bar', $routes->get('controller3')->getPath()); + + $this->assertNull($routes->get('controller_noroute')); } public function test_controller_resolver() @@ -52,7 +71,7 @@ class phpbb_controller_controller_test extends phpbb_test_case $container = new ContainerBuilder(); // YamlFileLoader only uses one path at a time, so we need to loop // through all of the ones we are using. - foreach (array(__DIR__.'/config', __DIR__.'/ext/foo/config') as $path) + foreach (array(__DIR__.'/config', __DIR__ . '/ext/vendor2/foo/config') as $path) { $loader = new YamlFileLoader($container, new FileLocator($path)); $loader->load('services.yml'); @@ -60,16 +79,16 @@ class phpbb_controller_controller_test extends phpbb_test_case // Autoloading classes within the tests folder does not work // so I'll include them manually. - if (!class_exists('foo\\controller')) + if (!class_exists('vendor2\\foo\\controller')) { - include(__DIR__.'/ext/foo/controller.php'); + include(__DIR__ . '/ext/vendor2/foo/controller.php'); } if (!class_exists('phpbb\\controller\\foo')) { include(__DIR__.'/phpbb/controller/foo.php'); } - $resolver = new \phpbb\controller\resolver(new \phpbb\user, $container); + $resolver = new \phpbb\controller\resolver($container, dirname(__FILE__) . '/'); $symfony_request = new Request(); $symfony_request->attributes->set('_controller', 'foo.controller:handle'); diff --git a/tests/controller/ext/foo/config/routing.yml b/tests/controller/ext/foo/config/routing.yml deleted file mode 100644 index 6cc275d96d..0000000000 --- a/tests/controller/ext/foo/config/routing.yml +++ /dev/null @@ -1,7 +0,0 @@ -controller1: - pattern: /foo - defaults: { _controller: foo.controller:handle } - -include_controller2: - resource: "routing_2.yml" - prefix: /foo diff --git a/tests/controller/ext/foo/config/routing_2.yml b/tests/controller/ext/foo/config/routing_2.yml deleted file mode 100644 index 35fff27037..0000000000 --- a/tests/controller/ext/foo/config/routing_2.yml +++ /dev/null @@ -1,3 +0,0 @@ -controller2: - pattern: /bar - defaults: { _controller: foo.controller:handle } diff --git a/tests/controller/ext/vendor2/bar/config/services.yml b/tests/controller/ext/vendor2/bar/config/services.yml new file mode 100644 index 0000000000..05a8a1994d --- /dev/null +++ b/tests/controller/ext/vendor2/bar/config/services.yml @@ -0,0 +1,3 @@ +services: + bar.controller: + class: bar\controller diff --git a/tests/controller/ext/vendor2/bar/config/test/routing/environment.yml b/tests/controller/ext/vendor2/bar/config/test/routing/environment.yml new file mode 100644 index 0000000000..5696ecb180 --- /dev/null +++ b/tests/controller/ext/vendor2/bar/config/test/routing/environment.yml @@ -0,0 +1,3 @@ +controller3: + path: /bar + defaults: { _controller: bar.controller:handle } diff --git a/tests/controller/ext/vendor2/bar/controller.php b/tests/controller/ext/vendor2/bar/controller.php new file mode 100644 index 0000000000..ad35f5a051 --- /dev/null +++ b/tests/controller/ext/vendor2/bar/controller.php @@ -0,0 +1,18 @@ +<?php + +namespace bar; + +use Symfony\Component\HttpFoundation\Response; + +class controller +{ + /** + * Handle method + * + * @return null + */ + public function handle() + { + return new Response('Test', 200); + } +} diff --git a/tests/controller/ext/vendor2/foo/config/routing.yml b/tests/controller/ext/vendor2/foo/config/routing.yml new file mode 100644 index 0000000000..7d4ac7be93 --- /dev/null +++ b/tests/controller/ext/vendor2/foo/config/routing.yml @@ -0,0 +1,11 @@ +controller1: + path: /foo + defaults: { _controller: foo.controller:handle } + +include_controller2: + resource: "routing_2.yml" + prefix: /foo + +controller4: + path: /foo/%core.environment% + defaults: { _controller: foo.controller:handle } diff --git a/tests/controller/ext/vendor2/foo/config/routing_2.yml b/tests/controller/ext/vendor2/foo/config/routing_2.yml new file mode 100644 index 0000000000..ee05898c66 --- /dev/null +++ b/tests/controller/ext/vendor2/foo/config/routing_2.yml @@ -0,0 +1,6 @@ +controller2: + path: /bar + defaults: { _controller: foo.controller:handle } +controller3: + path: /bar/p-{p} + defaults: { _controller: foo.controller:handle } diff --git a/tests/controller/ext/foo/config/services.yml b/tests/controller/ext/vendor2/foo/config/services.yml index 9ed67d5bc2..9ed67d5bc2 100644 --- a/tests/controller/ext/foo/config/services.yml +++ b/tests/controller/ext/vendor2/foo/config/services.yml diff --git a/tests/controller/ext/foo/controller.php b/tests/controller/ext/vendor2/foo/controller.php index ce2233b3c9..ce2233b3c9 100644 --- a/tests/controller/ext/foo/controller.php +++ b/tests/controller/ext/vendor2/foo/controller.php diff --git a/tests/controller/ext/vendor2/foo/subfolder/config/routing.yml b/tests/controller/ext/vendor2/foo/subfolder/config/routing.yml new file mode 100644 index 0000000000..20810a8f25 --- /dev/null +++ b/tests/controller/ext/vendor2/foo/subfolder/config/routing.yml @@ -0,0 +1,3 @@ +controller_noroute: + path: /donotfindthis + defaults: { _controller: foo.controller:handle } diff --git a/tests/controller/helper_route_adm_subdir_test.php b/tests/controller/helper_route_adm_subdir_test.php new file mode 100644 index 0000000000..f27ac81b04 --- /dev/null +++ b/tests/controller/helper_route_adm_subdir_test.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; + +class phpbb_controller_helper_route_adm_subdir_test extends phpbb_controller_common_helper_route +{ + protected function get_phpbb_root_path() + { + return './../../'; + } + + protected function get_uri() + { + return '/adm/subdir/index.php'; + } + + protected function get_script_name() + { + return 'index.php'; + } +} diff --git a/tests/controller/helper_route_adm_test.php b/tests/controller/helper_route_adm_test.php new file mode 100644 index 0000000000..86dc36ef1f --- /dev/null +++ b/tests/controller/helper_route_adm_test.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; + +class phpbb_controller_helper_route_adm_test extends phpbb_controller_common_helper_route +{ + protected function get_phpbb_root_path() + { + return './../'; + } + + protected function get_uri() + { + return '/adm/index.php'; + } + + protected function get_script_name() + { + return 'index.php'; + } +} diff --git a/tests/controller/helper_route_other_app.php b/tests/controller/helper_route_other_app.php new file mode 100644 index 0000000000..e5513a5180 --- /dev/null +++ b/tests/controller/helper_route_other_app.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/common_helper_route.php'; + +class phpbb_controller_helper_route_other_app_test extends phpbb_controller_common_helper_route +{ + protected function get_phpbb_root_path() + { + return './../'; + } + + protected function get_uri() + { + return '/foo/app.php'; + } + + protected function get_script_name() + { + return 'app.php'; + } + + protected function path_to_app() + { + return 'foo/'; + } +} diff --git a/tests/controller/helper_route_root_test.php b/tests/controller/helper_route_root_test.php new file mode 100644 index 0000000000..63a2f2f8f7 --- /dev/null +++ b/tests/controller/helper_route_root_test.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; + +class phpbb_controller_helper_route_test extends phpbb_controller_common_helper_route +{ + protected function get_phpbb_root_path() + { + return ''; + } + + protected function get_uri() + { + return '/app.php'; + } + + protected function get_script_name() + { + return 'app.php'; + } +} diff --git a/tests/controller/helper_route_slash_test.php b/tests/controller/helper_route_slash_test.php new file mode 100644 index 0000000000..3db5ec19e5 --- /dev/null +++ b/tests/controller/helper_route_slash_test.php @@ -0,0 +1,43 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; + +class phpbb_controller_helper_route_slash_test extends phpbb_controller_common_helper_route +{ + protected function get_phpbb_root_path() + { + return './../'; + } + + protected function get_uri() + { + return '/phpBB3/app.php'; + } + + protected function get_base_uri() + { + return '/phpBB3/'; + } + + protected function get_script_name() + { + return 'app.php'; + } + + protected function path_to_app() + { + return 'phpBB3/'; + } +} diff --git a/tests/controller/helper_route_unclean_path_test.php b/tests/controller/helper_route_unclean_path_test.php new file mode 100644 index 0000000000..9d8b62bc1c --- /dev/null +++ b/tests/controller/helper_route_unclean_path_test.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/common_helper_route.php'; + +class phpbb_controller_helper_route_unclean_path_test extends phpbb_controller_common_helper_route +{ + protected function get_phpbb_root_path() + { + return './../'; + } + + protected function get_uri() + { + return '/adm/../bertie/index.php'; + } + + protected function get_script_name() + { + return 'index.php'; + } +} diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php deleted file mode 100644 index 33fc6c4f1b..0000000000 --- a/tests/controller/helper_url_test.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - -class phpbb_controller_helper_url_test extends phpbb_test_case -{ - - public function helper_url_data_no_rewrite() - { - return array( - array('foo/bar?t=1&f=2', false, true, false, 'app.php/foo/bar?t=1&f=2', 'parameters in url-argument'), - array('foo/bar', 't=1&f=2', true, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument using amp'), - array('foo/bar', 't=1&f=2', false, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument using &'), - array('foo/bar', array('t' => 1, 'f' => 2), true, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - - // Custom sid parameter - array('foo/bar', 't=1&f=2', true, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'using session_id'), - - // Testing anchors - array('foo/bar?t=1&f=2#anchor', false, true, false, 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in url-argument'), - array('foo/bar', 't=1&f=2#anchor', true, false, 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument'), - array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - - // Anchors and custom sid - array('foo/bar?t=1&f=2#anchor', false, true, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in url-argument using session_id'), - array('foo/bar', 't=1&f=2#anchor', true, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument using session_id'), - array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - - // Empty parameters should not append the & - array('foo/bar', false, true, false, 'app.php/foo/bar', 'no params using bool false'), - array('foo/bar', '', true, false, 'app.php/foo/bar', 'no params using empty string'), - array('foo/bar', array(), true, false, 'app.php/foo/bar', 'no params using empty array'), - ); - } - - /** - * @dataProvider helper_url_data_no_rewrite() - */ - public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) - { - global $phpbb_dispatcher, $phpbb_root_path, $phpEx; - - $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->user = $this->getMock('\phpbb\user'); - $phpbb_path_helper = new \phpbb\path_helper( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - new \phpbb\filesystem(), - $phpbb_root_path, - $phpEx - ); - $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $this->user, new \phpbb\template\context()); - - // We don't use mod_rewrite in these tests - $config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php'); - $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); - } - - public function helper_url_data_with_rewrite() - { - return array( - array('foo/bar?t=1&f=2', false, true, false, 'foo/bar?t=1&f=2', 'parameters in url-argument'), - array('foo/bar', 't=1&f=2', true, false, 'foo/bar?t=1&f=2', 'parameters in params-argument using amp'), - array('foo/bar', 't=1&f=2', false, false, 'foo/bar?t=1&f=2', 'parameters in params-argument using &'), - array('foo/bar', array('t' => 1, 'f' => 2), true, false, 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), - - // Custom sid parameter - array('foo/bar', 't=1&f=2', true, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid', 'using session_id'), - - // Testing anchors - array('foo/bar?t=1&f=2#anchor', false, true, false, 'foo/bar?t=1&f=2#anchor', 'anchor in url-argument'), - array('foo/bar', 't=1&f=2#anchor', true, false, 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument'), - array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - - // Anchors and custom sid - array('foo/bar?t=1&f=2#anchor', false, true, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in url-argument using session_id'), - array('foo/bar', 't=1&f=2#anchor', true, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument using session_id'), - array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - - // Empty parameters should not append the & - array('foo/bar', false, true, false, 'foo/bar', 'no params using bool false'), - array('foo/bar', '', true, false, 'foo/bar', 'no params using empty string'), - array('foo/bar', array(), true, false, 'foo/bar', 'no params using empty array'), - ); - } - - /** - * @dataProvider helper_url_data_with_rewrite() - */ - public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) - { - global $phpbb_dispatcher, $phpbb_root_path, $phpEx; - - $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->user = $this->getMock('\phpbb\user'); - $phpbb_path_helper = new \phpbb\path_helper( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - new \phpbb\filesystem(), - $phpbb_root_path, - $phpEx - ); - $this->template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $this->user, new \phpbb\template\context()); - - $config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); - $helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php'); - $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected); - } -} diff --git a/tests/cron/ext/testext/cron/dummy_task.php b/tests/cron/ext/testext/cron/dummy_task.php index 8cdb6b09d5..5c474dca4f 100644 --- a/tests/cron/ext/testext/cron/dummy_task.php +++ b/tests/cron/ext/testext/cron/dummy_task.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/cron/includes/cron/task/core/dummy_task.php b/tests/cron/includes/cron/task/core/dummy_task.php index c34684701b..1ef28c5cca 100644 --- a/tests/cron/includes/cron/task/core/dummy_task.php +++ b/tests/cron/includes/cron/task/core/dummy_task.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/cron/includes/cron/task/core/second_dummy_task.php b/tests/cron/includes/cron/task/core/second_dummy_task.php index 1b212ab05d..ada175a501 100644 --- a/tests/cron/includes/cron/task/core/second_dummy_task.php +++ b/tests/cron/includes/cron/task/core/second_dummy_task.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php index 713f44c1e2..f4dd69b19b 100644 --- a/tests/cron/manager_test.php +++ b/tests/cron/manager_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,7 +18,7 @@ require_once dirname(__FILE__) . '/tasks/simple_ready.php'; require_once dirname(__FILE__) . '/tasks/simple_not_runnable.php'; require_once dirname(__FILE__) . '/tasks/simple_should_not_run.php'; -class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase +class phpbb_cron_manager_test extends \phpbb_test_case { public function setUp() { diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index 34f7f9ae44..7ecb546768 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -33,9 +37,11 @@ class phpbb_datetime_from_format_test extends phpbb_test_case */ public function test_from_format($timezone, $format, $expected) { - global $user; + global $phpbb_root_path, $phpEx; - $user = new \phpbb\user(); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->timezone = new DateTimeZone($timezone); $user->lang['datetime'] = array( 'TODAY' => 'Today', @@ -51,4 +57,78 @@ class phpbb_datetime_from_format_test extends phpbb_test_case $timestamp = $user->get_timestamp_from_format($format, $expected, new DateTimeZone($timezone)); $this->assertEquals($expected, $user->format_date($timestamp, $format, true)); } + + + public function relative_format_date_data() + { + // If the current time is too close to the testing time, + // the relative time will use "x minutes ago" instead of "today ..." + // So we use 18:01 in the morning and 06:01 in the afternoon. + $testing_time = gmdate('H') <= 12 ? '18:01' : '06:01'; + + return array( + array( + gmdate('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, false, + gmdate('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, + ), + + array( + gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, false, + 'Tomorrow ' . $testing_time, + ), + array( + gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, true, + gmdate('Y-m-d', time() + 86400) . ' ' . $testing_time, + ), + + array( + gmdate('Y-m-d') . ' ' . $testing_time, false, + 'Today ' . $testing_time, + ), + array( + gmdate('Y-m-d') . ' ' . $testing_time, true, + gmdate('Y-m-d') . ' ' . $testing_time, + ), + + array( + gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, false, + 'Yesterday ' . $testing_time, + ), + array( + gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, true, + gmdate('Y-m-d', time() - 86400) . ' ' . $testing_time, + ), + + array( + gmdate('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, false, + gmdate('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, + ), + ); + } + + /** + * @dataProvider relative_format_date_data() + */ + public function test_relative_format_date($timestamp, $forcedate, $expected) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->timezone = new DateTimeZone('UTC'); + $user->lang['datetime'] = array( + 'TODAY' => 'Today', + 'TOMORROW' => 'Tomorrow', + 'YESTERDAY' => 'Yesterday', + 'AGO' => array( + 0 => 'less than a minute ago', + 1 => '%d minute ago', + 2 => '%d minutes ago', + ), + ); + + $timestamp = $user->get_timestamp_from_format('Y-m-d H:i', $timestamp, new DateTimeZone('UTC')); + $this->assertEquals($expected, $user->format_date($timestamp, '|Y-m-d| H:i', $forcedate)); + } } diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php index 2196292e83..39eb6835ff 100644 --- a/tests/dbal/auto_increment_test.php +++ b/tests/dbal/auto_increment_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -26,7 +30,8 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new \phpbb\db\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->tools = $factory->get($this->db); $this->table_data = array( 'COLUMNS' => array( diff --git a/tests/dbal/boolean_processor_test.php b/tests/dbal/boolean_processor_test.php new file mode 100644 index 0000000000..226f5307b2 --- /dev/null +++ b/tests/dbal/boolean_processor_test.php @@ -0,0 +1,324 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_boolean_processor_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/boolean_processor.xml'); + } + + public function test_single_not_like() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + ), + 'WHERE' => array('u.username_clean', 'NOT_LIKE', 'gr' . $db->get_any_char()), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('user_id' => '1'), + array('user_id' => '2'), + array('user_id' => '3'), + array('user_id' => '6'), + ), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + } + + public function test_single_like() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + ), + 'WHERE' => array('u.username_clean', 'LIKE', 'gr' . $db->get_any_char()), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('user_id' => '4'), + array('user_id' => '5'), + ), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + } + + public function test_single_not_in() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + ), + 'WHERE' => array('u.user_id', 'NOT_IN', array(3,4,5)), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('user_id' => '1'), + array('user_id' => '2'), + array('user_id' => '6'), + ), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + } + + public function test_single_in() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + ), + 'WHERE' => array('u.user_id', 'IN', array(3,4,5)), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('user_id' => '3'), + array('user_id' => '4'), + array('user_id' => '5'), + ), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + } + + public function test_and_of_or_of_and() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + 'phpbb_user_group' => 'ug', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array( + 'phpbb_banlist' => 'b', + ), + 'ON' => 'u.user_id = b.ban_userid', + ), + ), + 'WHERE' => array('AND', + array( + array('OR', + array( + array('AND', + array( + array('ug.user_id', 'IN', array(1, 2, 3, 4)), + array('ug.group_id', '=', 2), + ), + ), + array('AND', + array( + array('ug.group_id', '=', 1), + array('b.ban_id', 'IS_NOT', NULL), + ), + ), + ), + ), + array('u.user_id', '=', 'ug.user_id'), + ), + ), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('user_id' => '2'), + array('user_id' => '4'), + ), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + } + + public function test_triple_and_with_in() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + 'phpbb_user_group' => 'ug', + ), + 'WHERE' => array('AND', + array( + array('ug.user_id', 'IN', array(1, 2, 3, 4)), + array('ug.group_id', '=', 1), + array('u.user_id', '=', 'ug.user_id'), + ), + ), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('user_id' => '1'), + array('user_id' => '2'), + array('user_id' => '3'), + ), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + + } + + public function test_double_and_with_not_of_or() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + 'phpbb_user_group' => 'ug', + ), + 'WHERE' => array('AND', + array( + array('NOT', + array( + array('OR', + array( + array('ug.group_id', '=', 1), + array('ug.group_id', '=', 2), + ), + ), + ), + ), + array('u.user_id', '=', 'ug.user_id'), + ), + ), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array(), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + } + + public function test_triple_and_with_is_null() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.username', + 'FROM' => array( + 'phpbb_users' => 'u', + 'phpbb_user_group' => 'ug', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array( + 'phpbb_banlist' => 'b', + ), + 'ON' => 'u.user_id = b.ban_userid', + ), + ), + 'WHERE' => array('AND', + array( + array('ug.group_id', '=', 1), + array('u.user_id', '=', 'ug.user_id'), + array('b.ban_id', 'IS', NULL), + ), + ), + 'ORDER_BY' => 'u.username', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('username' => 'helper'), + array('username' => 'mass email'), + ), $db->sql_fetchrowset($result), + ($result === false) ? + "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() : + var_export($sql, true) . ' ' . var_export($result, true) + ); + } +} diff --git a/tests/dbal/case_test.php b/tests/dbal/case_test.php index 57a1729a39..5f1c7d61fa 100644 --- a/tests/dbal/case_test.php +++ b/tests/dbal/case_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/concatenate_test.php b/tests/dbal/concatenate_test.php index 0891fa58a0..00e7e107aa 100644 --- a/tests/dbal/concatenate_test.php +++ b/tests/dbal/concatenate_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/connect_test.php b/tests/dbal/connect_test.php index 1e352d6b03..edf57189cb 100644 --- a/tests/dbal/connect_test.php +++ b/tests/dbal/connect_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,9 @@ class phpbb_dbal_connect_test extends phpbb_database_test_case public function test_failing_connect() { - global $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx, $phpbb_filesystem; + + $phpbb_filesystem = new phpbb\filesystem\filesystem(); $config = $this->get_database_config(); diff --git a/tests/dbal/cross_join_test.php b/tests/dbal/cross_join_test.php index 6c6b8a8449..7ba937ccc6 100644 --- a/tests/dbal/cross_join_test.php +++ b/tests/dbal/cross_join_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index e25335165a..aa0b6ccf48 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,9 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_dbal_db_tools_test extends phpbb_database_test_case { + /** @var \phpbb\db\driver\driver_interface */ protected $db; + /** @var \phpbb\db\tools\tools_interface */ protected $tools; protected $table_exists; protected $table_data; @@ -26,7 +32,8 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new \phpbb\db\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->tools = $factory->get($this->db); $this->table_data = array( 'COLUMNS' => array( @@ -40,6 +47,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case 'c_bool' => array('BOOL', 1), 'c_vchar' => array('VCHAR', 'foo'), 'c_vchar_size' => array('VCHAR:4', 'foo'), + 'c_vchar_null' => array('VCHAR', null), 'c_char_size' => array('CHAR:4', 'foo'), 'c_xstext' => array('XSTEXT', 'foo'), 'c_stext' => array('STEXT', 'foo'), @@ -105,6 +113,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case 'c_bool' => 0, 'c_vchar' => '', 'c_vchar_size' => '', + 'c_vchar_null' => null, 'c_char_size' => 'abcd', 'c_xstext' => '', 'c_stext' => '', @@ -138,6 +147,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case array('c_bool', 0), array('c_vchar', str_repeat('a', 255)), array('c_vchar_size', str_repeat('a', 4)), + array('c_vchar_null', str_repeat('a', 4)), array('c_char_size', str_repeat('a', 4)), array('c_xstext', str_repeat('a', 1000)), array('c_stext', str_repeat('a', 3000)), @@ -207,6 +217,50 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'column_does_not_exist')); } + public function test_column_change_with_index() + { + // Create column + $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012')); + $this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_12012', array('DECIMAL', 0))); + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012')); + + // Create index over the column + $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012')); + $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'i_bug_12012', array('c_bug_12012', 'c_bool'))); + $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012')); + + // Change type from int to string + $this->assertTrue($this->tools->sql_column_change('prefix_table_name', 'c_bug_12012', array('VCHAR:100', ''))); + + // Remove the index + $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012')); + $this->assertTrue($this->tools->sql_index_drop('prefix_table_name', 'i_bug_12012')); + $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012')); + + // Remove the column + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012')); + $this->assertTrue($this->tools->sql_column_remove('prefix_table_name', 'c_bug_12012')); + $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012')); + } + + public function test_column_change_with_composite_primary() + { + // Remove the old primary key + $this->assertTrue($this->tools->sql_column_remove('prefix_table_name', 'c_id')); + $this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_id', array('UINT', 0))); + + // Create a composite key + $this->assertTrue($this->tools->sql_create_primary_key('prefix_table_name', array('c_id', 'c_uint'))); + + // Create column + $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12643')); + $this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_12643', array('DECIMAL', 0))); + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12643')); + + // Change type from int to string + $this->assertTrue($this->tools->sql_column_change('prefix_table_name', 'c_bug_12643', array('VCHAR:100', ''))); + } + public function test_column_remove() { $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_int_size')); @@ -216,6 +270,39 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_int_size')); } + public function test_column_remove_similar_name() + { + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_vchar')); + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_vchar_size')); + + $this->assertTrue($this->tools->sql_column_remove('prefix_table_name', 'c_vchar')); + + $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_vchar')); + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_vchar_size')); + } + + public function test_column_remove_with_index() + { + // Create column + $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2')); + $this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_12012_2', array('UINT', 4))); + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2')); + + // Create index over the column + $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_2')); + $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'bug_12012_2', array('c_bug_12012_2', 'c_bool'))); + $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_2')); + + $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_3')); + $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'bug_12012_3', array('c_bug_12012_2'))); + $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_3')); + + // Remove the column + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2')); + $this->assertTrue($this->tools->sql_column_remove('prefix_table_name', 'c_bug_12012_2')); + $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2')); + } + public function test_column_remove_primary() { $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_id')); @@ -252,9 +339,9 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case $this->assertFalse($this->tools->sql_table_exists('prefix_test_table')); } - public function test_peform_schema_changes_drop_tables() + public function test_perform_schema_changes_drop_tables() { - $db_tools = $this->getMock('\phpbb\db\tools', array( + $db_tools = $this->getMock('\phpbb\db\tools\tools', array( 'sql_table_exists', 'sql_table_drop', ), array(&$this->db)); @@ -278,9 +365,9 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case )); } - public function test_peform_schema_changes_drop_columns() + public function test_perform_schema_changes_drop_columns() { - $db_tools = $this->getMock('\phpbb\db\tools', array( + $db_tools = $this->getMock('\phpbb\db\tools\tools', array( 'sql_column_exists', 'sql_column_remove', ), array(&$this->db)); @@ -329,4 +416,11 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case $this->tools->sql_create_unique_index('prefix_table_name', 'i_uniq_ts_id', array('c_timestamp', 'c_id')); $this->assertTrue($this->tools->sql_unique_index_exists('prefix_table_name', 'i_uniq_ts_id')); } + + public function test_create_int_default_null() + { + $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_13282')); + $this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_13282', array('TINT:2'))); + $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_13282')); + } } diff --git a/tests/dbal/fixtures/boolean_processor.xml b/tests/dbal/fixtures/boolean_processor.xml new file mode 100644 index 0000000000..c5da677116 --- /dev/null +++ b/tests/dbal/fixtures/boolean_processor.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_banlist"> + <column>ban_id</column> + <column>ban_userid</column> + <row> + <value>1</value> + <value>2</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>1</value> + <value>mass email</value> + <value>mass email</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>banned</value> + <value>banned</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>helper</value> + <value>helper</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>GroupBPal</value> + <value>groupbpal</value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>GroupBPal2</value> + <value>groupBPal2</value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>not in group</value> + <value>not in group</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_user_group"> + <column>user_id</column> + <column>group_id</column> + <row> + <value>1</value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>1</value> + </row> + <row> + <value>3</value> + <value>1</value> + </row> + <row> + <value>4</value> + <value>2</value> + </row> + <row> + <value>5</value> + <value>2</value> + </row> + </table> +</dataset> diff --git a/tests/dbal/fixtures/migrator_config_text.xml b/tests/dbal/fixtures/migrator_config_text.xml new file mode 100644 index 0000000000..ba8e1fcfcc --- /dev/null +++ b/tests/dbal/fixtures/migrator_config_text.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_config_text"> + <column>config_name</column> + <column>config_value</column> + </table> +</dataset> diff --git a/tests/dbal/fixtures/migrator_permission.xml b/tests/dbal/fixtures/migrator_permission.xml index 08cec42a42..c07956fa85 100644 --- a/tests/dbal/fixtures/migrator_permission.xml +++ b/tests/dbal/fixtures/migrator_permission.xml @@ -27,5 +27,139 @@ <value>1</value> <value>0</value> </row> + <row> + <value>4</value> + <value>a_test</value> + <value>1</value> + <value>0</value> + <value>0</value> + </row> + <row> + <value>5</value> + <value>m_test</value> + <value>1</value> + <value>0</value> + <value>0</value> + </row> + <row> + <value>6</value> + <value>u_test</value> + <value>1</value> + <value>0</value> + <value>0</value> + </row> + </table> + + <table name="phpbb_groups"> + <column>group_id</column> + <column>group_name</column> + <column>group_desc</column> + <row> + <value>2</value> + <value>REGISTERED</value> + <value></value> + </row> + <row> + <value>4</value> + <value>GLOBAL_MODERATORS</value> + <value></value> + </row> + <row> + <value>5</value> + <value>ADMINISTRATORS</value> + <value></value> + </row> + </table> + + <table name="phpbb_acl_groups"> + <column>group_id</column> + <column>auth_role_id</column> + <column>forum_id</column> + <row> + <value>2</value> + <value>5</value> + <value>0</value> + </row> + <row> + <value>4</value> + <value>5</value> + <value>0</value> + </row> + <row> + <value>4</value> + <value>10</value> + <value>0</value> + </row> + <row> + <value>5</value> + <value>1</value> + <value>0</value> + </row> + <row> + <value>5</value> + <value>5</value> + <value>0</value> + </row> + </table> + + <table name="phpbb_acl_roles"> + <column>role_id</column> + <column>role_name</column> + <column>role_type</column> + <column>role_description</column> + <row> + <value>1</value> + <value>ROLE_ADMIN_STANDARD</value> + <value>a_</value> + <value></value> + </row> + <row> + <value>5</value> + <value>ROLE_USER_FULL</value> + <value>u_</value> + <value></value> + </row> + <row> + <value>10</value> + <value>ROLE_MOD_FULL</value> + <value>m_</value> + <value></value> + </row> + </table> + + <table name="phpbb_acl_roles_data"> + <column>role_id</column> + <column>auth_option_id</column> + <column>auth_setting</column> + <row> + <value>1</value> + <value>4</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>5</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>6</value> + <value>0</value> + </row> + <row> + <value>6</value> + <value>6</value> + <value>0</value> + </row> + <row> + <value>10</value> + <value>5</value> + <value>0</value> + </row> + <row> + <value>10</value> + <value>6</value> + <value>0</value> + </row> </table> </dataset> diff --git a/tests/dbal/fixtures/styles.xml b/tests/dbal/fixtures/styles.xml index dcbe39d3b0..d51dcd0320 100644 --- a/tests/dbal/fixtures/styles.xml +++ b/tests/dbal/fixtures/styles.xml @@ -12,7 +12,7 @@ <row> <value>1</value> <value>prosilver</value> - <value>&copy; phpBB Group</value> + <value>&copy; phpBB Limited</value> <value>1</value> <value>prosilver</value> <value>kNg=</value> @@ -22,7 +22,7 @@ <row> <value>2</value> <value>prosilver2</value> - <value>&copy; phpBB Group</value> + <value>&copy; phpBB Limited</value> <value>0</value> <value>prosilver2</value> <value>kNg=</value> @@ -32,7 +32,7 @@ <row> <value>3</value> <value>Prosilver1</value> - <value>&copy; phpBB Group</value> + <value>&copy; phpBB Limited</value> <value>0</value> <value>prosilver1</value> <value>kNg=</value> diff --git a/tests/dbal/migration/dummy.php b/tests/dbal/migration/dummy.php index 041c529855..d564754892 100644 --- a/tests/dbal/migration/dummy.php +++ b/tests/dbal/migration/dummy.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/dummy_order.php b/tests/dbal/migration/dummy_order.php new file mode 100644 index 0000000000..5ab8f5d129 --- /dev/null +++ b/tests/dbal/migration/dummy_order.php @@ -0,0 +1,30 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'column_order_test1' => array( + 'COLUMNS' => array( + 'foobar1' => array('BOOL', 0), + 'foobar3' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => array('foobar1'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_0.php b/tests/dbal/migration/dummy_order_0.php new file mode 100644 index 0000000000..4caea76704 --- /dev/null +++ b/tests/dbal/migration/dummy_order_0.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_0 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar2' => array('BOOL', 0, 'after' => 'foobar1'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_1.php b/tests/dbal/migration/dummy_order_1.php new file mode 100644 index 0000000000..ea512765fa --- /dev/null +++ b/tests/dbal/migration/dummy_order_1.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_1 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar4' => array('BOOL', 0, 'after' => 'foobar3'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_2.php b/tests/dbal/migration/dummy_order_2.php new file mode 100644 index 0000000000..a7669b1ac8 --- /dev/null +++ b/tests/dbal/migration/dummy_order_2.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_2 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar5' => array('BOOL', 0, 'after' => 'non-existing'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_3.php b/tests/dbal/migration/dummy_order_3.php new file mode 100644 index 0000000000..501db09b7e --- /dev/null +++ b/tests/dbal/migration/dummy_order_3.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_3 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar6' => array('BOOL', 0, 'after' => ''), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_4.php b/tests/dbal/migration/dummy_order_4.php new file mode 100644 index 0000000000..77bb5a24b3 --- /dev/null +++ b/tests/dbal/migration/dummy_order_4.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_4 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar7' => array('BOOL', 0), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_5.php b/tests/dbal/migration/dummy_order_5.php new file mode 100644 index 0000000000..8f92392a8b --- /dev/null +++ b/tests/dbal/migration/dummy_order_5.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_5 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar8' => array('BOOL', 0, 'after' => 'foobar3'), + 'foobar9' => array('BOOL', 0, 'after' => 'foobar3'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/fail.php b/tests/dbal/migration/fail.php index d90972720d..a7a8a41694 100644 --- a/tests/dbal/migration/fail.php +++ b/tests/dbal/migration/fail.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/if.php b/tests/dbal/migration/if.php index bbbda60ea3..98a66526ed 100644 --- a/tests/dbal/migration/if.php +++ b/tests/dbal/migration/if.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/installed.php b/tests/dbal/migration/installed.php index 4b86896d9c..83edaae23a 100644 --- a/tests/dbal/migration/installed.php +++ b/tests/dbal/migration/installed.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/recall.php b/tests/dbal/migration/recall.php index 041d12ad27..c0333b084d 100644 --- a/tests/dbal/migration/recall.php +++ b/tests/dbal/migration/recall.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/revert.php b/tests/dbal/migration/revert.php index 1882b20492..7da65a83f1 100644 --- a/tests/dbal/migration/revert.php +++ b/tests/dbal/migration/revert.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -35,6 +39,14 @@ class phpbb_dbal_migration_revert extends \phpbb\db\migration\migration { return array( array('config.add', array('foobartest', 0)), + array('custom', array(array(&$this, 'my_custom_function'))), ); } + + function my_custom_function() + { + global $migrator_test_revert_counter; + + $migrator_test_revert_counter += 1; + } } diff --git a/tests/dbal/migration/revert_with_dependency.php b/tests/dbal/migration/revert_with_dependency.php index 0b09fb784d..43e9a4aa42 100644 --- a/tests/dbal/migration/revert_with_dependency.php +++ b/tests/dbal/migration/revert_with_dependency.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/schema.php b/tests/dbal/migration/schema.php index 98407eb1bd..38663bcc16 100644 --- a/tests/dbal/migration/schema.php +++ b/tests/dbal/migration/schema.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/unfulfillable.php b/tests/dbal/migration/unfulfillable.php index a1cdef9a23..11c87a6b85 100644 --- a/tests/dbal/migration/unfulfillable.php +++ b/tests/dbal/migration/unfulfillable.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index f22f5f5b30..f52e6ea63d 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -34,7 +38,8 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->db_tools = new \phpbb\db\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->db_tools = $factory->get($this->db); $this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config'); @@ -42,7 +47,10 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case new \phpbb\db\migration\tool\config($this->config), ); + $container = new phpbb_mock_container_builder(); + $this->migrator = new \phpbb\db\migrator( + $container, $this->config, $this->db, $this->db_tools, @@ -53,15 +61,14 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $tools, new \phpbb\db\migration\helper() ); - - $container = new phpbb_mock_container_builder(); - $container->set('migrator', $migrator); + $container->set('migrator', $this->migrator); + $container->set('dispatcher', new phpbb_mock_event_dispatcher()); $this->extension_manager = new \phpbb\extension\manager( $container, $this->db, $this->config, - new phpbb\filesystem(), + new phpbb\filesystem\filesystem(), 'phpbb_ext', dirname(__FILE__) . '/../../phpBB/', 'php', @@ -174,10 +181,14 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case public function test_revert() { + global $migrator_test_revert_counter; + // Make sure there are no other migrations in the db, this could cause issues $this->db->sql_query("DELETE FROM phpbb_migrations"); $this->migrator->load_migration_state(); + $migrator_test_revert_counter = 0; + $this->migrator->set_migrations(array('phpbb_dbal_migration_revert', 'phpbb_dbal_migration_revert_with_dependency')); $this->assertFalse($this->migrator->migration_state('phpbb_dbal_migration_revert')); @@ -219,6 +230,8 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case { $this->fail('Revert did not remove test_column.'); } + + $this->assertEquals(1, $migrator_test_revert_counter, 'Revert did call custom function again'); } public function test_fail() diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php index 807399385c..13e0c13e3c 100644 --- a/tests/dbal/migrator_tool_config_test.php +++ b/tests/dbal/migrator_tool_config_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migrator_tool_config_text_test.php b/tests/dbal/migrator_tool_config_text_test.php new file mode 100644 index 0000000000..b271c2d62e --- /dev/null +++ b/tests/dbal/migrator_tool_config_text_test.php @@ -0,0 +1,75 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migrator_tool_config_text_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator_config_text.xml'); + } + + public function setup() + { + parent::setup(); + + $this->db = $this->new_dbal(); + $this->config_text = new \phpbb\config\db_text($this->db, 'phpbb_config_text'); + + $this->tool = new \phpbb\db\migration\tool\config_text($this->config_text); + } + + public function test_add() + { + $this->tool->add('foo', 'bar'); + $this->assertEquals('bar', $this->config_text->get('foo')); + } + + public function test_add_twice() + { + $this->tool->add('foo', 'bar'); + $this->assertEquals('bar', $this->config_text->get('foo')); + + $this->tool->add('foo', 'bar2'); + $this->assertEquals('bar', $this->config_text->get('foo')); + } + + public function test_update() + { + $this->config_text->set('foo', 'bar'); + + $this->tool->update('foo', 'bar2'); + $this->assertEquals('bar2', $this->config_text->get('foo')); + } + + public function test_remove() + { + $this->config_text->set('foo', 'bar'); + + $this->tool->remove('foo'); + $this->assertNull($this->config_text->get('foo')); + } + + public function test_reverse_add() + { + $this->config_text->set('foo', 'bar'); + + $this->tool->reverse('add', 'foo'); + $this->assertNull($this->config_text->get('foo')); + } + + public function test_reverse_remove() + { + $this->tool->reverse('remove', 'foo'); + $this->assertSame('', $this->config_text->get('foo')); + } +} diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 3c23891348..a71334f23f 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -23,19 +27,24 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case parent::setup(); - // Force add_log function to not be used + // Disable the logs $skip_add_log = true; $db = $this->db = $this->new_dbal(); - $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx); - $user = $this->user = new \phpbb\user(); + $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = $this->user = new \phpbb\user($lang, '\phpbb\datetime'); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $auth = $this->getMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); - $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules'); + $phpbb_extension_manager = new phpbb_mock_extension_manager($phpbb_root_path); + $module_manager = new \phpbb\module\module_manager($cache, $this->db, $phpbb_extension_manager, MODULES_TABLE, $phpbb_root_path, $phpEx); + + $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->cache, $this->user, $module_manager, $phpbb_root_path, $phpEx, 'phpbb_modules'); } public function exists_data() diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index 1090b4726a..bfb2e07080 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,6 +15,12 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case { + public $group_ids = array( + 'REGISTERED' => 2, + 'GLOBAL_MODERATORS' => 4, + 'ADMINISTRATORS' => 5, + ); + public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator_permission.xml'); @@ -24,7 +34,7 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case parent::setup(); $db = $this->db = $this->new_dbal(); - $cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx); + $cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx); $this->auth = new \phpbb\auth\auth(); $this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx); @@ -154,4 +164,60 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case } $this->assertFalse($this->tool->exists('global_test', true)); } + + public function test_permission_set_data() + { + return array( + array( + 'ADMINISTRATORS', + 'a_test', + 'group', + true, + ), + array( + 'GLOBAL_MODERATORS', + 'm_test', + 'group', + true, + ), + array( + 'REGISTERED', + 'u_test', + 'group', + true, + ), + ); + } + + /** + * @dataProvider test_permission_set_data + */ + public function test_permission_set($group_name, $auth_option, $type, $has_permission) + { + $this->tool->permission_set($group_name, $auth_option, $type, $has_permission); + $administrators_perm = $this->auth->acl_group_raw_data($this->group_ids['ADMINISTRATORS'], $auth_option); + $global_moderators_perm = $this->auth->acl_group_raw_data($this->group_ids['GLOBAL_MODERATORS'], $auth_option); + $registered_users_perm = $this->auth->acl_group_raw_data($this->group_ids['REGISTERED'], $auth_option); + + switch($group_name) + { + case 'GLOBAL_MODERATORS': + $this->assertEquals(false, empty($administrators_perm), 'm_test is not empty for Administrators'); + $this->assertEquals(false, empty($global_moderators_perm), 'm_test is not empty for Global moderators'); + $this->assertEquals(true, empty($registered_users_perm), 'm_test empty for Registered users'); + break; + + case 'ADMINISTRATORS': + $this->assertEquals(false, empty($administrators_perm), 'a_test is not empty for Administrators'); + $this->assertEquals(true, empty($global_moderators_perm), 'a_test is empty for Global moderators'); + $this->assertEquals(true, empty($registered_users_perm), 'a_test is empty for Registered users'); + break; + + case 'REGISTERED': + $this->assertEquals(false, empty($administrators_perm), 'u_test is not empty for Administrators'); + $this->assertEquals(false, empty($global_moderators_perm), 'u_test is not empty for Global moderators'); + $this->assertEquals(false, empty($registered_users_perm), 'u_test is not empty for Registered users'); + break; + } + } } diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php index d826765681..b101d28c7d 100644 --- a/tests/dbal/order_lower_test.php +++ b/tests/dbal/order_lower_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case { $db = $this->new_dbal(); - if (strpos($db->sql_layer, 'mysql') === 0 && version_compare($db->sql_server_info(true, false), '5.6', '>=')) + if (strpos($db->get_sql_layer(), 'mysql') === 0 && version_compare($db->sql_server_info(true, false), '5.6', '>=')) { $this->markTestSkipped('MySQL 5.6 fails to order things correctly. See also: http://tracker.phpbb.com/browse/PHPBB3-11571 http://bugs.mysql.com/bug.php?id=69005'); } @@ -36,7 +40,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case array( 'style_id' => 1, 'style_name' => 'prosilver', - 'style_copyright' => '© phpBB Group', + 'style_copyright' => '© phpBB Limited', 'style_active' => 1, 'style_path' => 'prosilver', 'bbcode_bitfield' => 'kNg=', @@ -46,7 +50,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case array( 'style_id' => 3, 'style_name' => 'Prosilver1', - 'style_copyright' => '© phpBB Group', + 'style_copyright' => '© phpBB Limited', 'style_active' => 0, 'style_path' => 'prosilver1', 'bbcode_bitfield' => 'kNg=', @@ -56,7 +60,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case array( 'style_id' => 2, 'style_name' => 'prosilver2', - 'style_copyright' => '© phpBB Group', + 'style_copyright' => '© phpBB Limited', 'style_active' => 0, 'style_path' => 'prosilver2', 'bbcode_bitfield' => 'kNg=', diff --git a/tests/dbal/schema_test.php b/tests/dbal/schema_test.php index 2a332fddba..f13c7ce032 100644 --- a/tests/dbal/schema_test.php +++ b/tests/dbal/schema_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index c8cfad04e0..b7074552ba 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -215,8 +219,8 @@ class phpbb_dbal_select_test extends phpbb_database_test_case { $db = $this->new_dbal(); - $like_expression = str_replace('*', $db->any_char, $like_expression); - $like_expression = str_replace('#', $db->one_char, $like_expression); + $like_expression = str_replace('*', $db->get_any_char(), $like_expression); + $like_expression = str_replace('#', $db->get_one_char(), $like_expression); $where = ($like_expression) ? 'username_clean ' . $db->sql_like_expression($like_expression) : ''; $result = $db->sql_query('SELECT username_clean @@ -229,6 +233,66 @@ class phpbb_dbal_select_test extends phpbb_database_test_case $db->sql_freeresult($result); } + public function not_like_expression_data() + { + // * = any_char; # = one_char + return array( + array('barfoo', array( + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie') + )), + array('bar', array( + array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'), + )), + array('bar*', array( + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie')) + ), + array('*bar*', array(array('username_clean' => 'bertie'))), + array('b*r', array( + array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie') + )), + array('b*e', array( + array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar') + )), + array('#b*e', array( + array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie') + )), + array('b####e', array( + array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar') + )), + ); + } + + /** + * @dataProvider not_like_expression_data + */ + public function test_not_like_expression($like_expression, $expected) + { + $db = $this->new_dbal(); + + $like_expression = str_replace('*', $db->get_any_char(), $like_expression); + $like_expression = str_replace('#', $db->get_one_char(), $like_expression); + $where = ($like_expression) ? 'username_clean ' . $db->sql_not_like_expression($like_expression) : ''; + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + ' . (($where) ? ' WHERE ' . $where : '') . ' + ORDER BY user_id ASC'); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } + public function in_set_data() { return array( diff --git a/tests/dbal/sql_affected_rows_test.php b/tests/dbal/sql_affected_rows_test.php new file mode 100644 index 0000000000..07d7318358 --- /dev/null +++ b/tests/dbal/sql_affected_rows_test.php @@ -0,0 +1,68 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_sql_affected_rows_test extends phpbb_database_test_case +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + public function setUp() + { + parent::setUp(); + $this->db = $this->new_dbal(); + } + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + } + + public function test_update() + { + $sql = 'UPDATE ' . CONFIG_TABLE . " + SET config_value = 'bertie'"; + $this->db->sql_query($sql); + + $this->assertEquals(2, $this->db->sql_affectedrows()); + } + + public function test_update_all_matched_unequal_updated() + { + $sql = 'UPDATE ' . CONFIG_TABLE . " + SET config_value = 'foo'"; + $this->db->sql_query($sql); + + $this->assertEquals(2, $this->db->sql_affectedrows()); + } + + public function test_update_same_value_matched_unequal_updated() + { + $sql = 'UPDATE ' . CONFIG_TABLE . " + SET config_value = 'foo' + WHERE config_value = 'foo'"; + $this->db->sql_query($sql); + + $this->assertEquals(1, $this->db->sql_affectedrows()); + } + + public function test_insert() + { + $sql = 'INSERT INTO ' . CONFIG_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( + 'config_name' => 'bertie', + 'config_value' => 'rules', + )); + $this->db->sql_query($sql); + + $this->assertEquals(1, $this->db->sql_affectedrows()); + } +} diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php index a70eea4f7e..eae0abceba 100644 --- a/tests/dbal/sql_insert_buffer_test.php +++ b/tests/dbal/sql_insert_buffer_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -28,7 +32,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case public function test_multi_insert_disabled_insert_and_flush() { - $this->db->multi_insert = false; + $this->db->set_multi_insert(false); $this->assertTrue($this->buffer->insert($this->get_row(1))); $this->assert_config_count(3); $this->assertFalse($this->buffer->flush()); @@ -46,7 +50,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case public function test_multi_insert_disabled_insert_with_flush() { - $this->db->multi_insert = false; + $this->db->set_multi_insert(false); $this->assertTrue($this->buffer->insert($this->get_row(1))); $this->assert_config_count(3); $this->assertTrue($this->buffer->insert($this->get_row(2))); @@ -64,7 +68,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case public function test_multi_insert_disabled_insert_all_and_flush() { - $this->db->multi_insert = false; + $this->db->set_multi_insert(false); $this->assertTrue($this->buffer->insert_all($this->get_rows(3))); $this->assert_config_count(5); } @@ -89,7 +93,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case protected function check_multi_insert_support() { - if (!$this->db->multi_insert) + if (!$this->db->get_multi_insert()) { $this->markTestSkipped('Database does not support multi_insert'); } diff --git a/tests/dbal/write_sequence_test.php b/tests/dbal/write_sequence_test.php index 5fe0fe8de9..a1b589c578 100644 --- a/tests/dbal/write_sequence_test.php +++ b/tests/dbal/write_sequence_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index c069d9a796..2426f2b0be 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index a3a1ad3597..2d94f1d778 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -1,78 +1,162 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace { require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php'; + require_once dirname(__FILE__) . '/fixtures/ext/vendor/enabled_4/di/extension.php'; - class phpbb_di_container_test extends phpbb_test_case + class phpbb_di_container_test extends \phpbb_test_case { - public function test_phpbb_create_container() + protected $config_php; + + /** + * @var \phpbb\di\container_builder + */ + protected $builder; + protected $phpbb_root_path; + protected $filename; + + public function setUp() { - $phpbb_root_path = __DIR__ . '/../../phpBB/'; - $extensions = array( - new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'), - new \phpbb\di\extension\core($phpbb_root_path . 'config'), - ); - $container = phpbb_create_container($extensions, $phpbb_root_path, 'php'); + $this->phpbb_root_path = dirname(__FILE__) . '/'; + $this->config_php = new \phpbb\config_php_file($this->phpbb_root_path . 'fixtures/', 'php'); + $this->builder = new phpbb_mock_phpbb_di_container_builder($this->phpbb_root_path . 'fixtures/', 'php'); + $this->builder->with_config($this->config_php); + + $this->filename = $this->phpbb_root_path . '../tmp/container.php'; + if (is_file($this->filename)) + { + unlink($this->filename); + } + parent::setUp(); + } + + public function test_default_container() + { + $container = $this->builder->get_container(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + + // Checks the core services + $this->assertTrue($container->hasParameter('core')); + + // Checks compile_container + $this->assertTrue($container->isFrozen()); + + // Checks inject_config + $this->assertTrue($container->hasParameter('dbal.dbhost')); + + // Checks use_extensions + $this->assertTrue($container->hasParameter('enabled')); + $this->assertTrue($container->hasParameter('enabled_2')); + $this->assertTrue($container->hasParameter('enabled_3')); + $this->assertTrue($container->hasParameter('enabled_4')); + $this->assertFalse($container->hasParameter('disabled')); + $this->assertFalse($container->hasParameter('available')); + + // Checks set_custom_parameters + $this->assertTrue($container->hasParameter('core.root_path')); + + // Checks dump_container + $this->assertTrue(is_file($this->filename)); + + // Checks the construction of a dumped container + $container = $this->builder->get_container(); + $this->assertInstanceOf('phpbb_cache_container', $container); + $this->assertFalse($container->isFrozen()); + $container->getParameterBag(); // needed, otherwise the container is not marked as frozen + $this->assertTrue($container->isFrozen()); } - public function test_phpbb_create_install_container() + public function test_without_cache() { - $phpbb_root_path = __DIR__ . '/../../phpBB/'; - $extensions = array( - new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'), - new \phpbb\di\extension\core($phpbb_root_path . 'config'), - ); - $container = phpbb_create_install_container($phpbb_root_path, 'php'); + $this->builder->without_cache(); + $container = $this->builder->get_container(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + + // Checks dump_container + $this->assertFalse(is_file($this->filename)); + // Checks the construction of a dumped container + $container = $this->builder->get_container(); + $this->assertNotInstanceOf('phpbb_cache_container', $container); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); $this->assertTrue($container->isFrozen()); } - public function test_phpbb_create_compiled_container() + public function test_without_extensions() { - $phpbb_root_path = __DIR__ . '/../../phpBB/'; - $config_file = __DIR__ . '/fixtures/config.php'; - $extensions = array( - new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'), - new \phpbb\di\extension\core($phpbb_root_path . 'config'), - ); - $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php'); + $this->builder->without_extensions(); + $container = $this->builder->get_container(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + + // Checks the core services + $this->assertTrue($container->hasParameter('core')); + // Checks use_extensions + $this->assertFalse($container->hasParameter('enabled')); + $this->assertFalse($container->hasParameter('disabled')); + $this->assertFalse($container->hasParameter('available')); + } + + public function test_without_compiled_container() + { + $this->builder->without_compiled_container(); + $container = $this->builder->get_container(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); - $this->assertTrue($container->isFrozen()); + + // Checks compile_container + $this->assertFalse($container->isFrozen()); } - } -} -namespace phpbb\db\driver -{ - class container_mock extends \phpbb\db\driver\driver - { - public function sql_connect() + public function test_with_config_path() { + $this->builder->with_config_path($this->phpbb_root_path . 'fixtures/other_config/'); + $container = $this->builder->get_container(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + + $this->assertTrue($container->hasParameter('other_config')); + $this->assertFalse($container->hasParameter('core')); } - public function sql_query() + public function test_with_custom_parameters() { + $this->builder->with_custom_parameters(array('my_parameter' => true)); + $container = $this->builder->get_container(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + + $this->assertTrue($container->hasParameter('my_parameter')); } + } +} - public function sql_fetchrow() +namespace phpbb\extension +{ + class manager_mock extends \phpbb\extension\manager + { + public function __construct() { } - public function sql_freeresult() + public function all_enabled($phpbb_relative = true) { + return array( + 'vendor/enabled' => dirname(__FILE__) . '/fixtures/ext/vendor/enabled/', + 'vendor/enabled-2' => dirname(__FILE__) . '/fixtures/ext/vendor/enabled-2/', + 'vendor/enabled-3' => dirname(__FILE__) . '/fixtures/ext/vendor/enabled-3/', + 'vendor/enabled_4' => dirname(__FILE__) . '/fixtures/ext/vendor/enabled_4/', + ); } } } diff --git a/tests/di/fixtures/config.php b/tests/di/fixtures/config.php index 04e20f63d8..1e9207d924 100644 --- a/tests/di/fixtures/config.php +++ b/tests/di/fixtures/config.php @@ -1,11 +1,11 @@ <?php // phpBB 3.1.x auto-generated configuration file // Do not change anything in this file! -$dbms = 'container_mock'; +$dbms = 'mysql'; $dbhost = '127.0.0.1'; $dbport = ''; $dbname = 'phpbb'; $dbuser = 'root'; $dbpasswd = ''; $table_prefix = 'phpbb_'; -$acm_type = '\phpbb\cache\driver\null'; +$acm_type = '\phpbb\cache\driver\dummy'; diff --git a/tests/di/fixtures/config/production/config.yml b/tests/di/fixtures/config/production/config.yml new file mode 100644 index 0000000000..fcfa84f68b --- /dev/null +++ b/tests/di/fixtures/config/production/config.yml @@ -0,0 +1,2 @@ +core: + require_dev_dependencies: true diff --git a/tests/di/fixtures/config/production/container/environment.yml b/tests/di/fixtures/config/production/container/environment.yml new file mode 100644 index 0000000000..9dcf11d865 --- /dev/null +++ b/tests/di/fixtures/config/production/container/environment.yml @@ -0,0 +1,29 @@ +parameters: + core: true + +services: + config.php: + synthetic: true + + dbal.conn: + class: phpbb\db\driver\factory + arguments: + - @service_container + + dispatcher: + class: phpbb\db\driver\container_mock + + ext.manager: + class: phpbb\extension\manager_mock + + template.twig.environment: + class: Exception + arguments: + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - [] diff --git a/tests/di/fixtures/config/test/config.yml b/tests/di/fixtures/config/test/config.yml new file mode 100644 index 0000000000..fcfa84f68b --- /dev/null +++ b/tests/di/fixtures/config/test/config.yml @@ -0,0 +1,2 @@ +core: + require_dev_dependencies: true diff --git a/tests/di/fixtures/config/test/container/environment.yml b/tests/di/fixtures/config/test/container/environment.yml new file mode 100644 index 0000000000..14c986d123 --- /dev/null +++ b/tests/di/fixtures/config/test/container/environment.yml @@ -0,0 +1,26 @@ +parameters: + core: true + +services: + config.php: + synthetic: true + + dbal.conn: + class: phpbb\db\driver\factory + arguments: + - @service_container + + dispatcher: + class: phpbb\db\driver\container_mock + + template.twig.environment: + class: Exception + arguments: + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - [] diff --git a/tests/di/fixtures/ext/vendor/available/config/services.yml b/tests/di/fixtures/ext/vendor/available/config/services.yml new file mode 100644 index 0000000000..2ced431f5a --- /dev/null +++ b/tests/di/fixtures/ext/vendor/available/config/services.yml @@ -0,0 +1,2 @@ +parameters: + available: true diff --git a/tests/di/fixtures/ext/vendor/disabled/config/test/container/environment.yml b/tests/di/fixtures/ext/vendor/disabled/config/test/container/environment.yml new file mode 100644 index 0000000000..31ada384bf --- /dev/null +++ b/tests/di/fixtures/ext/vendor/disabled/config/test/container/environment.yml @@ -0,0 +1,2 @@ +parameters: + disabled: true diff --git a/tests/di/fixtures/ext/vendor/enabled-2/config/test/container/environment.yml b/tests/di/fixtures/ext/vendor/enabled-2/config/test/container/environment.yml new file mode 100644 index 0000000000..feeb5a7a2d --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled-2/config/test/container/environment.yml @@ -0,0 +1,2 @@ +parameters: + enabled_2: true diff --git a/tests/di/fixtures/ext/vendor/enabled-3/config/services.yml b/tests/di/fixtures/ext/vendor/enabled-3/config/services.yml new file mode 100644 index 0000000000..0dae35d2bd --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled-3/config/services.yml @@ -0,0 +1,2 @@ +parameters: + enabled_3: true diff --git a/tests/di/fixtures/ext/vendor/enabled/config/default/container/environment.yml b/tests/di/fixtures/ext/vendor/enabled/config/default/container/environment.yml new file mode 100644 index 0000000000..88a7919ed1 --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled/config/default/container/environment.yml @@ -0,0 +1,2 @@ +parameters: + enabled: true diff --git a/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php b/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php new file mode 100644 index 0000000000..8e5ed6c52c --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php @@ -0,0 +1,32 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace vendor\enabled_4\di; + +use phpbb\extension\di\extension_base; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + +/** +* Container core extension +*/ +class extension extends extension_base +{ + protected function load_services(ContainerBuilder $container) + { + $filesystem = new \phpbb\filesystem\filesystem(); + $loader = new YamlFileLoader($container, new FileLocator($filesystem->realpath($this->ext_path))); + $loader->load('environment.yml'); + } +} diff --git a/tests/di/fixtures/ext/vendor/enabled_4/environment.yml b/tests/di/fixtures/ext/vendor/enabled_4/environment.yml new file mode 100644 index 0000000000..d0affe4fd6 --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled_4/environment.yml @@ -0,0 +1,2 @@ +parameters: + enabled_4: true diff --git a/tests/di/fixtures/other_config/production/config.yml b/tests/di/fixtures/other_config/production/config.yml new file mode 100644 index 0000000000..fcfa84f68b --- /dev/null +++ b/tests/di/fixtures/other_config/production/config.yml @@ -0,0 +1,2 @@ +core: + require_dev_dependencies: true diff --git a/tests/di/fixtures/other_config/production/container/environment.yml b/tests/di/fixtures/other_config/production/container/environment.yml new file mode 100644 index 0000000000..4960562a6c --- /dev/null +++ b/tests/di/fixtures/other_config/production/container/environment.yml @@ -0,0 +1,29 @@ +parameters: + other_config: true + +services: + config.php: + synthetic: true + + dbal.conn: + class: phpbb\db\driver\factory + arguments: + - @service_container + + dispatcher: + class: phpbb\db\driver\container_mock + + ext.manager: + class: phpbb\extension\manager_mock + + template.twig.environment: + class: Exception + arguments: + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - [] diff --git a/tests/di/fixtures/other_config/test/config.yml b/tests/di/fixtures/other_config/test/config.yml new file mode 100644 index 0000000000..fcfa84f68b --- /dev/null +++ b/tests/di/fixtures/other_config/test/config.yml @@ -0,0 +1,2 @@ +core: + require_dev_dependencies: true diff --git a/tests/di/fixtures/other_config/test/container/environment.yml b/tests/di/fixtures/other_config/test/container/environment.yml new file mode 100644 index 0000000000..e285b1b781 --- /dev/null +++ b/tests/di/fixtures/other_config/test/container/environment.yml @@ -0,0 +1,26 @@ +parameters: + other_config: true + +services: + config.php: + synthetic: true + + dbal.conn: + class: phpbb\db\driver\factory + arguments: + - @service_container + + dispatcher: + class: phpbb\db\driver\container_mock + + template.twig.environment: + class: Exception + arguments: + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - ~ + - [] diff --git a/tests/di/ordered_service_collection_test.php b/tests/di/ordered_service_collection_test.php new file mode 100644 index 0000000000..47e6d23744 --- /dev/null +++ b/tests/di/ordered_service_collection_test.php @@ -0,0 +1,51 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_ordered_service_collection_test extends \phpbb_test_case +{ + /** + * @var \phpbb\di\ordered_service_collection + */ + protected $service_collection; + + public function setUp() + { + $container = new phpbb_mock_container_builder(); + $container->set('foo', new StdClass); + $container->set('bar', new StdClass); + $container->set('foobar', new StdClass); + $container->set('barfoo', new StdClass); + + $this->service_collection = new \phpbb\di\ordered_service_collection($container); + $this->service_collection->add('foo', 7); + $this->service_collection->add('bar', 3); + $this->service_collection->add('barfoo', 5); + $this->service_collection->add('foobar', 2); + + parent::setUp(); + } + + public function test_service_collection() + { + $service_names = array(); + + // Test the iterator + foreach ($this->service_collection as $name => $service) + { + $service_names[] = $name; + $this->assertInstanceOf('StdClass', $service); + } + + $this->assertSame(array('foobar', 'bar', 'barfoo', 'foo'), $service_names); + } +} diff --git a/tests/di/service_collection_test.php b/tests/di/service_collection_test.php new file mode 100644 index 0000000000..5b51254a4a --- /dev/null +++ b/tests/di/service_collection_test.php @@ -0,0 +1,47 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_service_collection_test extends \phpbb_test_case +{ + /** + * @var \phpbb\di\service_collection + */ + protected $service_collection; + + public function setUp() + { + $container = new phpbb_mock_container_builder(); + $container->set('foo', new StdClass); + $container->set('bar', new StdClass); + + $this->service_collection = new \phpbb\di\service_collection($container); + $this->service_collection->add('foo'); + $this->service_collection->add('bar'); + + parent::setUp(); + } + + public function test_service_collection() + { + $service_names = array(); + + // Test the iterator + foreach ($this->service_collection as $name => $service) + { + $service_names[] = $name; + $this->assertInstanceOf('StdClass', $service); + } + + $this->assertSame(array('foo', 'bar'), $service_names); + } +} diff --git a/tests/download/http_byte_range_test.php b/tests/download/http_byte_range_test.php index 23b9169fe3..f920299048 100644 --- a/tests/download/http_byte_range_test.php +++ b/tests/download/http_byte_range_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/download/http_user_agent_test.php b/tests/download/http_user_agent_test.php index 166a186913..bfee265add 100644 --- a/tests/download/http_user_agent_test.php +++ b/tests/download/http_user_agent_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index 0804c64f6f..ddbe2e3af1 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,16 +15,53 @@ require_once dirname(__FILE__) . '/../phpBB/includes/functions.php'; class phpbb_error_collector_test extends phpbb_test_case { + public function setUp() + { + parent::setUp(); + + global $phpbb_filesystem; + + $phpbb_filesystem = new \phpbb\filesystem\filesystem(); + } + public function test_collection() { - $collector = new \phpbb\error_collector; + $collector = new \phpbb\error_collector(E_ALL | E_STRICT); // php set_error_handler() default + $collector->install(); + + // Cause a warning + 1/0; $line = __LINE__; + + $collector->uninstall(); + + list($errno, $msg_text, $errfile, $errline) = $collector->errors[0]; + $error_contents = $collector->format_errors(); + + $this->assertEquals($errno, 2); + + // Unfortunately $error_contents will contain the full path here, + // because the tests directory is outside of phpbb root path. + $this->assertStringStartsWith('Errno 2: Division by zero at ', $error_contents); + $this->assertStringEndsWith(" line $line", $error_contents); + } + + public function test_collection_with_mask() + { + $collector = new \phpbb\error_collector(E_ALL & ~E_NOTICE); // not collecting notices $collector->install(); // Cause a warning 1/0; $line = __LINE__; + // Cause a notice + $array = array('ITEM' => 'value'); + $value = $array[ITEM]; $line2 = __LINE__; + $collector->uninstall(); + // The notice should not be collected + $this->assertEmpty($collector->errors[1]); + list($errno, $msg_text, $errfile, $errline) = $collector->errors[0]; $error_contents = $collector->format_errors(); diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php index a76df90809..7bba5bf337 100644 --- a/tests/event/dispatcher_test.php +++ b/tests/event/dispatcher_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/event/exception_listener_test.php b/tests/event/exception_listener_test.php new file mode 100644 index 0000000000..e643fadf2c --- /dev/null +++ b/tests/event/exception_listener_test.php @@ -0,0 +1,102 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class exception_listener extends phpbb_test_case +{ + public function phpbb_exception_data() + { + return array( + array( + true, + new \Exception(), + array( + 'status_code' => 500, + ), + ), + array( + true, + new \Exception('AJAX_ERROR_TEXT'), + array( + 'status_code' => 500, + 'content' => 'AJAX_ERROR_TEXT', + ), + ), + array( + true, + new \phpbb\exception\runtime_exception('AJAX_ERROR_TEXT'), + array( + 'status_code' => 500, + 'content' => 'Something went wrong when processing your request.', + ), + ), + array( + true, + new \Symfony\Component\HttpKernel\Exception\HttpException(404, 'AJAX_ERROR_TEXT'), + array( + 'status_code' => 404, + 'content' => 'AJAX_ERROR_TEXT', + ), + ), + array( + true, + new \phpbb\exception\http_exception(404, 'AJAX_ERROR_TEXT'), + array( + 'status_code' => 404, + 'content' => 'Something went wrong when processing your request.', + ), + ), + array( + true, + new \phpbb\exception\http_exception(404, 'CURRENT_TIME', array('today')), + array( + 'status_code' => 404, + 'content' => 'It is currently today', + ), + ), + ); + } + + /** + * @dataProvider phpbb_exception_data + */ + public function test_phpbb_exception($is_ajax, $exception, $expected) + { + $request = \Symfony\Component\HttpFoundation\Request::create('test.php', 'GET', array(), array(), array(), $is_ajax ? array('HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest') : array()); + + $template = $this->getMockBuilder('\phpbb\template\twig\twig') + ->disableOriginalConstructor() + ->getMock(); + + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + + $exception_listener = new \phpbb\event\kernel_exception_subscriber($template, $lang); + + $event = new \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST, $exception); + $exception_listener->on_kernel_exception($event); + + $response = $event->getResponse(); + + $this->assertEquals($expected['status_code'], $response->getStatusCode()); + $this->assertEquals($is_ajax, $response instanceof \Symfony\Component\HttpFoundation\JsonResponse); + + if (isset($expected['content'])) + { + $this->assertContains($expected['content'], $response->getContent()); + } + } +} diff --git a/tests/event/export_php_test.php b/tests/event/export_php_test.php new file mode 100644 index 0000000000..21bbb0620a --- /dev/null +++ b/tests/event/export_php_test.php @@ -0,0 +1,49 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_event_export_php_test extends phpbb_test_case +{ + /** @var \phpbb\event\php_exporter */ + protected $exporter; + + public function setUp() + { + parent::setUp(); + + global $phpbb_root_path; + $this->exporter = new \phpbb\event\php_exporter($phpbb_root_path); + } + + static public function crawl_php_file_data() + { + global $phpbb_root_path; + $exporter = new \phpbb\event\php_exporter($phpbb_root_path); + $files = $exporter->get_recursive_file_list($phpbb_root_path); + + $data_provider = array(); + foreach ($files as $file) + { + $data_provider[] = array($file); + } + + return $data_provider; + } + + /** + * @dataProvider crawl_php_file_data + */ + public function test_crawl_php_file($file) + { + $this->assertGreaterThanOrEqual(0, $this->exporter->crawl_php_file($file)); + } +} diff --git a/phpBB/language/en/mods/index.htm b/tests/event/fixtures/adm/style/acp_bbcodes.html index e69de29bb2..e69de29bb2 100644 --- a/phpBB/language/en/mods/index.htm +++ b/tests/event/fixtures/adm/style/acp_bbcodes.html diff --git a/tests/event/fixtures/default.test b/tests/event/fixtures/default.test new file mode 100644 index 0000000000..edfe4823dc --- /dev/null +++ b/tests/event/fixtures/default.test @@ -0,0 +1,9 @@ +<?php + +/** +* Description +* +* @event default.dispatch +* @since 3.1.0-b2 +*/ +$phpbb_dispatcher->dispatch('default.dispatch'); diff --git a/tests/event/fixtures/duplicate_event.test b/tests/event/fixtures/duplicate_event.test new file mode 100644 index 0000000000..b042ca0377 --- /dev/null +++ b/tests/event/fixtures/duplicate_event.test @@ -0,0 +1,19 @@ +<?php + + /** + * Event after the post data has been assigned to the template + * + * @event duplicate.trigger + * @var int start Start item of this page + * @since 3.1.0-a3 + */ + $vars = array('start'); + extract($phpbb_dispatcher->trigger_event('duplicate.trigger', compact($vars))); + + /** + * Event after the post data has been assigned to the template + * + * @event duplicate.trigger + * @since 3.1.0-b1 + */ + $phpbb_dispatcher->dispatch('duplicate.trigger'); diff --git a/tests/event/fixtures/extra_description.test b/tests/event/fixtures/extra_description.test new file mode 100644 index 0000000000..ce8f97ce89 --- /dev/null +++ b/tests/event/fixtures/extra_description.test @@ -0,0 +1,11 @@ +<?php + +/** +* Description +* +* NOTE: This will not be exported +* +* @event extra_description.dispatch +* @since 3.1.0-b2 +*/ +$phpbb_dispatcher->dispatch('extra_description.dispatch'); diff --git a/tests/event/fixtures/missing_var.test b/tests/event/fixtures/missing_var.test new file mode 100644 index 0000000000..7ced5e93dc --- /dev/null +++ b/tests/event/fixtures/missing_var.test @@ -0,0 +1,17 @@ +<?php + + /** + * Event after the post data has been assigned to the template + * + * @event core.trigger + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array attachments List of attachments + * @var array user_poster_data Poster's data from user cache + * @since 3.1.0-a3 + */ + $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + extract($phpbb_dispatcher->trigger_event('core.trigger', compact($vars))); diff --git a/tests/event/fixtures/none.test b/tests/event/fixtures/none.test new file mode 100644 index 0000000000..6e2267024b --- /dev/null +++ b/tests/event/fixtures/none.test @@ -0,0 +1,6 @@ +<?php + +/** +* Hi there :) +*/ +echo 1 + 2; diff --git a/tests/event/fixtures/normal_events.md.test b/tests/event/fixtures/normal_events.md.test new file mode 100644 index 0000000000..47921c4e57 --- /dev/null +++ b/tests/event/fixtures/normal_events.md.test @@ -0,0 +1,20 @@ +acp_bbcodes_actions_append +=== +* Location: adm/style/acp_bbcodes.html +* Since: 3.1.0-a3 +* Changed: 3.1.0-a4 +* Purpose: desc1 + +acp_bbcodes_actions_prepend +=== +* Location: adm/style/acp_bbcodes.html +* Since: 3.1.0-a5 +* Purpose: desc2 + +acp_bbcodes_actions_prepend2 +=== +* Location: adm/style/acp_bbcodes.html +* Since: 3.1.0-a4 +* Changed: 3.1.0-a5 Moved up +* Changed: 3.1.0-a6 Moved down +* Purpose: desc2 diff --git a/tests/event/fixtures/trigger.test b/tests/event/fixtures/trigger.test new file mode 100644 index 0000000000..7cd6a7b956 --- /dev/null +++ b/tests/event/fixtures/trigger.test @@ -0,0 +1,15 @@ +<?php + + /** + * Event after the post data has been assigned to the template + * + * @event core.trigger + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @since 3.1.0-a3 + */ + $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row'); + extract($phpbb_dispatcher->trigger_event('core.trigger', compact($vars))); diff --git a/tests/event/fixtures/trigger_many_vars.test b/tests/event/fixtures/trigger_many_vars.test new file mode 100644 index 0000000000..a624138588 --- /dev/null +++ b/tests/event/fixtures/trigger_many_vars.test @@ -0,0 +1,65 @@ +<?php + + /** + * This event allows you to modify template variables for the posting screen + * + * @event core.posting_modify_template_vars + * @var array post_data Array with post data + * @var array moderators Array with forum moderators + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var string page_title Title of the mode page + * @var bool s_topic_icons Whether or not to show the topic icons + * @var string form_enctype If attachments are allowed for this form + * "multipart/form-data" or empty string + * @var string s_action The URL to submit the POST data to + * @var string s_hidden_fields Concatenated hidden input tags of posting form + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var bool preview Whether or not the post is being previewed + * @var bool save Whether or not a draft is being saved + * @var bool load Whether or not a draft is being loaded + * @var bool delete Whether or not the post is being deleted + * @var bool cancel Whether or not to cancel the form (returns to + * viewtopic or viewforum depending on if the user + * is posting a new topic or editing a post) + * @var array error Any error strings; a non-empty array aborts + * form submission. + * NOTE: Should be actual language strings, NOT + * language keys. + * @var bool refresh Whether or not to retain previously submitted data + * @var array page_data Posting page data that should be passed to the + * posting page via $template->assign_vars() + * @var object message_parser The message parser object + * @since 3.1.0-a1 + * @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, + * s_topic_icons, form_enctype, s_action, s_hidden_fields, + * post_id, topic_id, forum_id, submit, preview, save, load, + * delete, cancel, refresh, error, page_data, message_parser + */ + $vars = array( + 'post_data', + 'moderators', + 'mode', + 'page_title', + 's_topic_icons', + 'form_enctype', + 's_action', + 's_hidden_fields', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'preview', + 'save', + 'load', + 'delete', + 'cancel', + 'refresh', + 'error', + 'page_data', + 'message_parser', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', compact($vars))); diff --git a/tests/event/fixtures/trigger_wspace.test b/tests/event/fixtures/trigger_wspace.test new file mode 100644 index 0000000000..0334a9c80b --- /dev/null +++ b/tests/event/fixtures/trigger_wspace.test @@ -0,0 +1,15 @@ +<?php + + /** + * Event after the post data has been assigned to the template + * + * @event core.trigger + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @since 3.1.0-a3 + */ + $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row'); + extract($phpbb_dispatcher->trigger_event('core.trigger', compact($vars))); diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php new file mode 100644 index 0000000000..a6c1dc78de --- /dev/null +++ b/tests/event/md_exporter_test.php @@ -0,0 +1,154 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_event_md_exporter_test extends phpbb_test_case +{ + static public function crawl_eventsmd_data() + { + return array( + array('normal_events.md.test', null, null, array( + 'acp_bbcodes_actions_append' => array( + 'event' => 'acp_bbcodes_actions_append', + 'files' => array( + 'prosilver' => array(), + 'adm' => array('acp_bbcodes.html'), + ), + 'since' => '3.1.0-a3', + 'changed' => array( + '3.1.0-a4' => '', + ), + 'description' => 'desc1' . "\n", + ), + 'acp_bbcodes_actions_prepend' => array( + 'event' => 'acp_bbcodes_actions_prepend', + 'files' => array( + 'prosilver' => array(), + 'adm' => array('acp_bbcodes.html'), + ), + 'since' => '3.1.0-a5', + 'changed' => array(), + 'description' => 'desc2' . "\n", + ), + 'acp_bbcodes_actions_prepend2' => array( + 'event' => 'acp_bbcodes_actions_prepend2', + 'files' => array( + 'prosilver' => array(), + 'adm' => array('acp_bbcodes.html'), + ), + 'since' => '3.1.0-a4', + 'changed' => array( + '3.1.0-a5' => 'Moved up', + '3.1.0-a6' => 'Moved down', + ), + 'description' => 'desc2' . "\n", + ), + )), + array('normal_events.md.test', '3.1.0-a5', '3.1.0-a5', array( + 'acp_bbcodes_actions_prepend' => array( + 'event' => 'acp_bbcodes_actions_prepend', + 'files' => array( + 'prosilver' => array(), + 'adm' => array('acp_bbcodes.html'), + ), + 'since' => '3.1.0-a5', + 'changed' => array(), + 'description' => 'desc2' . "\n", + ), + 'acp_bbcodes_actions_prepend2' => array( + 'event' => 'acp_bbcodes_actions_prepend2', + 'files' => array( + 'prosilver' => array(), + 'adm' => array('acp_bbcodes.html'), + ), + 'since' => '3.1.0-a4', + 'changed' => array( + '3.1.0-a5' => 'Moved up', + '3.1.0-a6' => 'Moved down', + ), + 'description' => 'desc2' . "\n", + ), + )), + ); + } + + /** + * @dataProvider crawl_eventsmd_data + * + * @param string $file + * @param string $min_version + * @param string $max_version + * @param array $events + */ + public function test_crawl_eventsmd($file, $min_version, $max_version, $events) + { + $exporter = new \phpbb\event\md_exporter(dirname(__FILE__) . '/fixtures/', null, $min_version, $max_version); + $this->assertSame(sizeof($events), $exporter->crawl_eventsmd($file, 'adm')); + $this->assertEquals($events, $exporter->get_events()); + } + + static public function crawl_phpbb_eventsmd_data() + { + return array( + array('styles'), + array('adm'), + ); + } + + /** + * @dataProvider crawl_phpbb_eventsmd_data + */ + public function test_crawl_phpbb_eventsmd($filter) + { + global $phpbb_root_path; + $exporter = new \phpbb\event\md_exporter($phpbb_root_path); + $this->assertGreaterThan(0, $exporter->crawl_eventsmd('docs/events.md', $filter)); + } + + static public function crawl_template_file_data() + { + global $phpbb_root_path; + $exporter = new \phpbb\event\md_exporter($phpbb_root_path); + $data_provider = array(); + + $styles = array( + 'adm/style/' => 'adm', + 'styles/prosilver/template/' => 'styles', + ); + foreach ($styles as $path => $filter) + { + $files = $exporter->get_recursive_file_list($phpbb_root_path . $path, $path); + foreach ($files as $file) + { + $data_provider[] = array($filter, $path . $file); + } + } + + return $data_provider; + } + + /** + * @dataProvider crawl_template_file_data + */ + public function test_crawl_template_file($filter, $file) + { + global $phpbb_root_path; + $exporter = new \phpbb\event\md_exporter($phpbb_root_path); + $exporter->crawl_eventsmd('docs/events.md', $filter); + $events = $exporter->crawl_file_for_events($file); + + $this->assertGreaterThanOrEqual(0, sizeof($events)); + $this->assertTrue($exporter->validate_events_from_file($file, $events)); + } +} diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php new file mode 100644 index 0000000000..692a57f93c --- /dev/null +++ b/tests/event/php_exporter_test.php @@ -0,0 +1,740 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_event_php_exporter_test extends phpbb_test_case +{ + /** @var \phpbb\event\php_exporter */ + protected $exporter; + + public function setUp() + { + parent::setUp(); + $this->exporter = new \phpbb\event\php_exporter(dirname(__FILE__) . '/fixtures/'); + } + + static public function crawl_php_file_data() + { + return array( + array( + 'default.test', + array( + 'default.dispatch' => array( + 'event' => 'default.dispatch', + 'file' => 'default.test', + 'arguments' => array(), + 'since' => '3.1.0-b2', + 'description' => 'Description', + ), + ), + ), + array( + 'extra_description.test', + array( + 'extra_description.dispatch' => array( + 'event' => 'extra_description.dispatch', + 'file' => 'extra_description.test', + 'arguments' => array(), + 'since' => '3.1.0-b2', + 'description' => 'Description', + ), + ), + ), + array( + 'trigger.test', + array( + 'core.trigger' => array( + 'event' => 'core.trigger', + 'file' => 'trigger.test', + 'arguments' => array('cp_row', 'current_row_number', 'end', 'row', 'start'), + 'since' => '3.1.0-a3', + 'description' => 'Event after the post data has been assigned to the template', + ), + ), + ), + array( + 'trigger_wspace.test', + array( + 'core.trigger' => array( + 'event' => 'core.trigger', + 'file' => 'trigger_wspace.test', + 'arguments' => array('cp_row', 'current_row_number', 'end', 'row', 'start'), + 'since' => '3.1.0-a3', + 'description' => 'Event after the post data has been assigned to the template', + ), + ), + ), + array( + 'trigger_many_vars.test', + array( + 'core.posting_modify_template_vars' => array( + 'event' => 'core.posting_modify_template_vars', + 'file' => 'trigger_many_vars.test', + 'arguments' => array( + 'cancel', 'delete', 'error', 'form_enctype', 'forum_id', + 'load', 'message_parser', 'mode', 'moderators', 'page_data', + 'page_title', 'post_data', 'post_id', 'preview', 'refresh', + 's_action', 's_hidden_fields', 's_topic_icons', 'save', + 'submit', 'topic_id', + ), + 'since' => '3.1.0-a1', + 'description' => 'This event allows you to modify template variables for the posting screen', + ), + ), + ), + array( + 'none.test', + array(), + ), + ); + } + + /** + * @dataProvider crawl_php_file_data + */ + public function test_crawl_php_file($file, $expected) + { + $this->exporter->crawl_php_file($file); + $this->assertEquals($expected, $this->exporter->get_events()); + } + + static public function crawl_php_file_throws_data() + { + return array( + array('missing_var.test', null), + array('duplicate_event.test', 10), + ); + } + + /** + * @dataProvider crawl_php_file_throws_data + */ + public function test_crawl_php_file_throws($file, $exception_code) + { + $this->setExpectedException('LogicException', '', $exception_code); + $this->exporter->crawl_php_file($file); + } + + static public function validate_since_data() + { + return array( + array('* @since 3.1.0-a1', '3.1.0-a1'), + array('* @since 3.1.0-b3', '3.1.0-b3'), + array(' * @since 3.1.0-b3', '3.1.0-b3'), + array('* @since 3.1.0-RC2', '3.1.0-RC2'), + array(' * @since 3.1.0-a1', '3.1.0-a1'), + ); + } + + /** + * @dataProvider validate_since_data + */ + public function test_validate_since($since, $expected) + { + $this->assertEquals($expected, $this->exporter->validate_since($since)); + } + + static public function validate_since_throws_data() + { + return array( + array('* @since 3.1.0-a1 '), + array('* @since 3.1.0-a1 bertie is cool'), + array('bertie* @since 3.1.0-a1'), + array('* @since 3.1-A2'), + array('* @since 3.1.0-rc1'), + ); + } + + /** + * @dataProvider validate_since_throws_data + * @expectedException LogicException + */ + public function test_validate_since_throws($since) + { + $this->exporter->validate_since($since); + } + + static public function validate_event_data() + { + return array( + array('test.event', '* @event test.event', 'test.event'), + array('test.event2', ' * @event test.event2', 'test.event2'), + array('test.event', ' * @event test.event', 'test.event'), + ); + } + + /** + * @dataProvider validate_event_data + */ + public function test_validate_event($event_name, $event, $expected) + { + $this->assertEquals($expected, $this->exporter->validate_event($event_name, $event)); + } + + static public function validate_event_throws_data() + { + return array( + array('test.event', '* @event test.event bertie is cool', 2), + array('test.event', 'bertie* @event test.event', 2), + ); + } + + /** + * @dataProvider validate_event_throws_data + * @expectedException LogicException + */ + public function test_validate_event_throws($event_name, $event, $exception_code) + { + $this->setExpectedException('LogicException', '', $exception_code); + $this->exporter->validate_event($event_name, $event); + } + + static public function validate_vars_docblock_array_data() + { + return array( + array(array('abc', 'def'), array('abc', 'def')), + ); + } + + /** + * @dataProvider validate_vars_docblock_array_data + */ + public function test_validate_vars_docblock_array($vars_array, $vars_docblock) + { + $this->assertNull($this->exporter->validate_vars_docblock_array($vars_array, $vars_docblock)); + } + + static public function validate_vars_docblock_array_throws_data() + { + return array( + array(array('abc', 'def'), array()), + array(array('abc', 'def'), array('abc')), + array(array('abc', 'defg'), array('abc', 'def')), + array(array('abc'), array('abc', 'def')), + array(array(), array('abc', 'def')), + ); + } + + /** + * @dataProvider validate_vars_docblock_array_throws_data + * @expectedException LogicException + */ + public function test_validate_vars_docblock_array_throws($vars_array, $vars_docblock) + { + $this->exporter->validate_vars_docblock_array($vars_array, $vars_docblock); + } + + static public function get_dispatch_name_data() + { + return array( + array("\$phpbb_dispatcher->dispatch('dispatch.one2');", 'dispatch.one2'), + array("\t\$phpbb_dispatcher->dispatch('dispatch.one2.thr_ee4');", 'dispatch.one2.thr_ee4'), + array("\$this->dispatcher->dispatch('dispatch.one2');", 'dispatch.one2'), + array("\$phpbb_dispatcher->dispatch('dis_patch.one');", 'dis_patch.one'), + ); + } + + /** + * @dataProvider get_dispatch_name_data + */ + public function test_get_dispatch_name($event_line, $expected) + { + $this->exporter->set_content(array($event_line)); + $this->assertEquals($expected, $this->exporter->get_event_name(0, true)); + } + + static public function get_dispatch_name_throws_data() + { + return array( + array("\$phpbb_dispatcher->dispatch();"), + array("\$phpbb_dispatcher->dispatch('');"), + array("\$phpbb_dispatcher->dispatch('dispatch.2one');"), + array("\$phpbb_dispatcher->dispatch('dispatch');"), + ); + } + + /** + * @dataProvider get_dispatch_name_throws_data + * @expectedException LogicException + */ + public function test_get_dispatch_name_throws($event_line) + { + $this->exporter->set_content(array($event_line)); + $this->exporter->get_event_name(0, true); + } + + static public function get_trigger_event_name_data() + { + return array( + array("extract(\$phpbb_dispatcher->trigger_event('dispatch.one2', compact(\$vars)));", 'dispatch.one2'), + array("\textract(\$phpbb_dispatcher->trigger_event('dispatch.one2.thr_ee4', compact(\$vars)));", 'dispatch.one2.thr_ee4'), + array("extract(\$this->dispatcher->trigger_event('dispatch.one2', compact(\$vars)));", 'dispatch.one2'), + array("extract(\$phpbb_dispatcher->trigger_event('dis_patch.one', compact(\$vars)));", 'dis_patch.one'), + ); + } + + /** + * @dataProvider get_trigger_event_name_data + */ + public function test_get_trigger_event_name($event_line, $expected) + { + $this->exporter->set_content(array($event_line)); + $this->assertEquals($expected, $this->exporter->get_event_name(0, false)); + } + + static public function get_trigger_event_name_throws_data() + { + return array( + array("extract(\$phpbb_dispatcher->trigger_event());"), + array("extract(\$phpbb_dispatcher->trigger_event(''));"), + array("extract(\$phpbb_dispatcher->trigger_event('dispatch.2one'));"), + array("extract(\$phpbb_dispatcher->trigger_event('dispatch'));"), + array("extract(\$phpbb_dispatcher->trigger_event('dispatch.one', \$vars));"), + array("extract(\$phpbb_dispatcher->trigger_event('dispatch.one', compact(\$var)));"), + array("extract(\$phpbb_dispatcher->trigger_event('dispatch.one', compact(\$array)));"), + array("\$phpbb_dispatcher->trigger_event('dis_patch.one', compact(\$vars));", 'dis_patch.one'), + ); + } + + /** + * @dataProvider get_trigger_event_name_throws_data + * @expectedException LogicException + */ + public function test_get_trigger_event_name_throws($event_line) + { + $this->exporter->set_content(array($event_line)); + $this->exporter->get_event_name(0, false); + } + + static public function get_vars_from_array_data() + { + return array( + array( + array( + '/**', + '*/', + '$vars = array(\'bertie\');', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 3, + array('bertie'), + ), + array( + array( + "\t/**", + "\t*/", + "\t\$vars = array('_Strange123', 'phpBB3_Test');", + "\t\$this->dispatcher->dispatch('test');", + ), + 3, + array('_Strange123', 'phpBB3_Test'), + ), + ); + } + + /** + * @dataProvider get_vars_from_array_data + */ + public function test_get_vars_from_array($lines, $event_line, $expected) + { + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->assertEquals($expected, $this->exporter->get_vars_from_array()); + } + + static public function get_vars_from_array_throws_data() + { + return array( + array( + array( + '/**', + '*/', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 2, + 1, + ), + array( + array( + '/**', + '*/', + '$vars = $bertie;', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 3, + 1, + ), + array( + array( + '/**', + '*/', + '$vars = array(\'$bertie\');', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 3, + 1, + ), + array( + array( + '/**', + '*/', + '$vars = array();', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 3, + 1, + ), + array( + array( + '/**', + '*/', + '$vars = array(\'t1\', \'t2\', \'t3\', \'t4\', \'t5\', \'t6\', \'t7\');', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 3, + 2, + ), + array( + array( + '/**', + '*/', + '$vars = array(\'test2\', \'\');', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 3, + 3, + ), + array( + array( + '/**', + '*/', + '$vars = array(\'bertie\'\');', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 3, + 3, + ), + array( + array( + '/**', + '*/', + '$vars = array(\'bertie\',\'basically_valid\');', + '$phpbb_dispatcher->trigger_event(\'test\', compact($vars));', + ), + 3, + 3, + ), + ); + } + + /** + * @dataProvider get_vars_from_array_throws_data + * @expectedException LogicException + */ + public function test_get_vars_from_array_throws($lines, $event_line, $exception_code) + { + $this->setExpectedException('LogicException', '', $exception_code); + + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->exporter->get_vars_from_array(); + } + + static public function get_vars_from_docblock_data() + { + return array( + array( + array( + '/**', + '* @var int name1 Description', + '* @var array name2 Description test', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + array('name1', 'name2'), + ), + ); + } + + /** + * @dataProvider get_vars_from_docblock_data + */ + public function test_get_vars_from_docblock($lines, $event_line, $expected) + { + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->assertEquals($expected, $this->exporter->get_vars_from_docblock()); + } + + static public function get_vars_from_docblock_throws_data() + { + return array( + array( + array( + '$vars = array();', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 1, + 2, + ), + array( + array( + '/**', + '* @var int name1', + '* @var array name2 Description test', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + 1, + ), + array( + array( + '/**', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 2, + 3, + ), + array( + array( + '/**', + '* @var int name1 Description', + '* @var array $name2 Description', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + 4, + ), + ); + } + + /** + * @dataProvider get_vars_from_docblock_throws_data + * @expectedException LogicException + */ + public function test_get_vars_from_docblock_throws($lines, $event_line, $exception_code) + { + $this->setExpectedException('LogicException', '', $exception_code); + + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->exporter->get_vars_from_docblock(); + } + + static public function find_since_data() + { + return array( + array( + array( + '/**', + '* @since 3.1.0-a1', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 3, + 1, + ), + array( + array( + '* @since 3.1.0-a1', + '/**', + '* @since 3.1.0-a1', + '* @changed 3.1.0-a2', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 5, + 2, + ), + ); + } + + /** + * @dataProvider find_since_data + */ + public function test_find_since($lines, $event_line, $expected) + { + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->assertEquals($expected, $this->exporter->find_since()); + } + + static public function find_since_throws_data() + { + return array( + array( + array( + '/**', + '* @since 3.1.0-a1', + '*/', + '/**', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 5, + 1, + ), + array( + array( + '/**', + '* @changed 3.1.0-a1', + '* @changed 3.1.0-a2', + '* @changed 3.1.0-a3', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 5, + 2, + ), + array( + array( + '/**', + '* @since 3.1.0-a2', + '* @var', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + 3, + ), + array( + array( + '/**', + '* @since 3.1.0-a2', + '* @event', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + 3, + ), + ); + } + + /** + * @dataProvider find_since_throws_data + * @expectedException LogicException + */ + public function test_find_since_throws($lines, $event_line, $exception_code) + { + $this->setExpectedException('LogicException', '', $exception_code); + + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->exporter->find_since(); + } + + static public function find_description_data() + { + return array( + array( + array( + '/**', + '* Hello Bertie!', + '* @since 3.1.0-a1', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + 1, + ), + array( + array( + ' /**', + ' * Hello Bertie!', + ' *', + ' * @since 3.1.0-a1', + ' * @changed 3.1.0-a2', + ' */', + ' $phpbb_dispatcher->dispatch(\'test\');', + ), + 6, + 1, + ), + ); + } + + /** + * @dataProvider find_description_data + */ + public function test_find_description($lines, $event_line, $expected) + { + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->assertEquals($expected, $this->exporter->find_description()); + } + + static public function find_description_throws_data() + { + return array( + array( + array( + '$vars = array();', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 1, + 1, + ), + array( + array( + '/**', + '* @changed 3.1.0-a1', + '* @changed 3.1.0-a2', + '* @changed 3.1.0-a3', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 5, + 2, + ), + array( + array( + '/**', + '*', + '* @since 3.1.0-a2', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + 2, + ), + array( + array( + '/**', + '* ', + '* @event', + '*/', + '$phpbb_dispatcher->dispatch(\'test\');', + ), + 4, + 2, + ), + ); + } + + /** + * @dataProvider find_description_throws_data + * @expectedException LogicException + */ + public function test_find_description_throws($lines, $event_line, $exception_code) + { + $this->setExpectedException('LogicException', '', $exception_code); + + $this->exporter->set_current_event('', $event_line); + $this->exporter->set_content($lines); + $this->exporter->find_description(); + } +} diff --git a/tests/extension/ext/barfoo/composer.json b/tests/extension/ext/barfoo/composer.json index 35d5d2a956..05bb099707 100644 --- a/tests/extension/ext/barfoo/composer.json +++ b/tests/extension/ext/barfoo/composer.json @@ -4,7 +4,7 @@ "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", "time": "2012-02-15 01:01:01", - "licence": "GNU GPL v2", + "license": "GNU GPL v2", "authors": [{ "name": "John Smith", "username": "JohnSmith27", @@ -13,10 +13,12 @@ "role": "N/A" }], "require": { - "php": ">=5.3", - "phpbb/phpbb": "3.1.*@dev" + "php": ">=5.3" }, "extra": { - "display-name": "phpBB BarFoo Extension" + "display-name": "phpBB BarFoo Extension", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } } } diff --git a/tests/extension/ext/vendor/moo/composer.json b/tests/extension/ext/vendor/moo/composer.json index 901cb7f17a..d49aab47cd 100644 --- a/tests/extension/ext/vendor/moo/composer.json +++ b/tests/extension/ext/vendor/moo/composer.json @@ -4,7 +4,7 @@ "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", "time": "2012-02-15 01:01:01", - "licence": "GNU GPL v2", + "license": "GNU GPL v2", "authors": [{ "name": "John Smith", "username": "JohnSmith27", @@ -13,10 +13,12 @@ "role": "N/A" }], "require": { - "php": ">=5.3", - "phpbb/phpbb": "3.1.*@dev" + "php": ">=5.3" }, "extra": { - "display-name": "phpBB Moo Extension" + "display-name": "phpBB Moo Extension", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } } } diff --git a/tests/extension/ext/vendor2/bar/acp/a_info.php b/tests/extension/ext/vendor2/bar/acp/a_info.php index 8132df587f..8268006f9f 100644 --- a/tests/extension/ext/vendor2/bar/acp/a_info.php +++ b/tests/extension/ext/vendor2/bar/acp/a_info.php @@ -9,7 +9,6 @@ class a_info return array( 'filename' => 'vendor2\\bar\\acp\\a_module', 'title' => 'Bar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), ), diff --git a/tests/extension/ext/vendor2/bar/composer.json b/tests/extension/ext/vendor2/bar/composer.json index 5d60ec031e..9d2ed86a0c 100644 --- a/tests/extension/ext/vendor2/bar/composer.json +++ b/tests/extension/ext/vendor2/bar/composer.json @@ -4,7 +4,7 @@ "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", "time": "2012-02-15 01:01:01", - "licence": "GPL-2.0", + "license": "GPL-2.0", "authors": [{ "name": "John Smith", "email": "email@phpbb.com", @@ -12,10 +12,12 @@ "role": "N/A" }], "require": { - "php": ">=5.3", - "phpbb/phpbb": "3.1.*@dev" + "php": ">=5.3" }, "extra": { - "display-name": "phpBB Bar Extension" + "display-name": "phpBB Bar Extension", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } } } diff --git a/tests/extension/ext/vendor2/bar/migrations/migration.php b/tests/extension/ext/vendor2/bar/migrations/migration.php new file mode 100644 index 0000000000..71caa34fd9 --- /dev/null +++ b/tests/extension/ext/vendor2/bar/migrations/migration.php @@ -0,0 +1,18 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace vendor2\bar\migrations; + +class migration extends \phpbb\db\migration\migration +{ +} diff --git a/tests/extension/ext/vendor2/foo/acp/a_info.php b/tests/extension/ext/vendor2/foo/acp/a_info.php index e1eaa340b7..48ab4cf8e7 100644 --- a/tests/extension/ext/vendor2/foo/acp/a_info.php +++ b/tests/extension/ext/vendor2/foo/acp/a_info.php @@ -9,7 +9,6 @@ class a_info return array( 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array('ACP_MODS')), ), diff --git a/tests/extension/ext/vendor2/foo/acp/fail_info.php b/tests/extension/ext/vendor2/foo/acp/fail_info.php index d9b4353957..78479fee70 100644 --- a/tests/extension/ext/vendor2/foo/acp/fail_info.php +++ b/tests/extension/ext/vendor2/foo/acp/fail_info.php @@ -13,7 +13,6 @@ class foo_info return array( 'filename' => 'vendor2\foo\acp\fail_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), ), diff --git a/tests/extension/ext/vendor2/foo/composer.json b/tests/extension/ext/vendor2/foo/composer.json index 8821d9d50e..efcdfc338f 100644 --- a/tests/extension/ext/vendor2/foo/composer.json +++ b/tests/extension/ext/vendor2/foo/composer.json @@ -4,7 +4,7 @@ "description": "An example/sample extension to be used for testing purposes in phpBB Development.", "version": "1.0.0", "time": "2012-02-15 01:01:01", - "licence": "GPL-2.0", + "license": "GPL-2.0", "authors": [{ "name": "John Smith", "email": "email@phpbb.com", @@ -12,10 +12,12 @@ "role": "N/A" }], "require": { - "php": ">=5.3", - "phpbb/phpbb": "3.1.*@dev" + "php": ">=5.3" }, "extra": { - "display-name": "phpBB Foo Extension" + "display-name": "phpBB Foo Extension", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } } } diff --git a/tests/extension/ext/vendor2/foo/mcp/a_info.php b/tests/extension/ext/vendor2/foo/mcp/a_info.php index b5599fde65..2532e44b12 100644 --- a/tests/extension/ext/vendor2/foo/mcp/a_info.php +++ b/tests/extension/ext/vendor2/foo/mcp/a_info.php @@ -9,7 +9,6 @@ class a_info return array( 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')), ), diff --git a/tests/extension/ext/vendor3/foo/composer.json b/tests/extension/ext/vendor3/foo/composer.json new file mode 100644 index 0000000000..b4b3e6f32f --- /dev/null +++ b/tests/extension/ext/vendor3/foo/composer.json @@ -0,0 +1,23 @@ +{ + "name": "vendor3/foo", + "type": "phpbb-extension", + "description": "An example/sample extension to be used for testing purposes in phpBB Development.", + "version": "1.0.0", + "time": "2012-02-15 01:01:01", + "license": "GPL-2.0", + "authors": [{ + "name": "John Smith", + "email": "email@phpbb.com", + "homepage": "http://phpbb.com", + "role": "N/A" + }], + "require": { + "php": ">=5.3" + }, + "extra": { + "display-name": "phpBB Bar Extension", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } + } +} diff --git a/tests/extension/ext/vendor3/foo/ext.php b/tests/extension/ext/vendor3/foo/ext.php new file mode 100644 index 0000000000..b52649d921 --- /dev/null +++ b/tests/extension/ext/vendor3/foo/ext.php @@ -0,0 +1,20 @@ +<?php + +namespace vendor3\foo; + +class ext extends \phpbb\extension\base +{ + static public $enabled; + + public function enable_step($old_state) + { + self::$enabled = true; + + return self::$enabled; + } + + public function is_enableable() + { + return false; + } +} diff --git a/tests/extension/ext/vendor4/bar/composer.json b/tests/extension/ext/vendor4/bar/composer.json new file mode 100644 index 0000000000..1a2fddc3f4 --- /dev/null +++ b/tests/extension/ext/vendor4/bar/composer.json @@ -0,0 +1,23 @@ +{ + "name": "vendor4/bar", + "type": "phpbb-extension", + "description": "An example/sample extension to be used for testing purposes in phpBB Development.", + "version": "1.0.0", + "time": "2012-02-15 01:01:01", + "license": "GPL-2.0", + "authors": [{ + "name": "John Smith", + "email": "email@phpbb.com", + "homepage": "http://phpbb.com", + "role": "N/A" + }], + "require": { + "php": ">=5.3" + }, + "extra": { + "display-name": "phpBB Bar Extension", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } + } +} diff --git a/tests/extension/ext/vendor4/bar/styles/all/template/foobar_body.html b/tests/extension/ext/vendor4/bar/styles/all/template/foobar_body.html new file mode 100644 index 0000000000..c8f8cf957e --- /dev/null +++ b/tests/extension/ext/vendor4/bar/styles/all/template/foobar_body.html @@ -0,0 +1 @@ +All folder diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php new file mode 100644 index 0000000000..eee38186db --- /dev/null +++ b/tests/extension/extension_base_test.php @@ -0,0 +1,79 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_extension_extension_base_test extends phpbb_test_case +{ + protected static $reflection_method_get_migration_file_list; + + /** @var phpbb_mock_extension_manager */ + protected $extension_manager; + + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + $reflection_class = new ReflectionClass('\phpbb\extension\base'); + self::$reflection_method_get_migration_file_list = $reflection_class->getMethod('get_migration_file_list'); + self::$reflection_method_get_migration_file_list->setAccessible(true); + } + + public function setUp() + { + $container = new phpbb_mock_container_builder(); + $migrator = new phpbb_mock_migrator(); + $container->set('migrator', $migrator); + + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/foo/', + ), + 'vendor3/bar' => array( + 'ext_name' => 'vendor3/bar', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor3/bar/', + ), + 'vendor2/bar' => array( + 'ext_name' => 'vendor2/bar', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/bar/', + ), + ), + $container); + } + + public function data_test_suffix_get_classes() + { + return array( + array( + 'vendor2/bar', + array( + '\vendor2\bar\migrations\migration', + ), + ), + ); + } + + /** + * @dataProvider data_test_suffix_get_classes + */ + public function test_suffix_get_classes($extension_name, $expected) + { + $extension = $this->extension_manager->get_extension($extension_name); + $this->assertEquals($expected, self::$reflection_method_get_migration_file_list->invoke($extension)); + } +} diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index d0ca5956b4..463b69e9a9 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -1,16 +1,22 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_extension_finder_test extends phpbb_test_case { + /** @var \phpbb\extension\manager */ protected $extension_manager; + /** @var \phpbb\finder */ protected $finder; public function setUp() @@ -52,6 +58,47 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } + public function set_extensions_data() + { + return array( + array( + array(), + array('\phpbb\default\implementation'), + ), + array( + array('vendor3/bar'), + array( + '\phpbb\default\implementation', + '\vendor3\bar\my\hidden_class', + ), + ), + array( + array('vendor2/foo', 'vendor3/bar'), + array( + '\phpbb\default\implementation', + '\vendor2\foo\a_class', + '\vendor2\foo\b_class', + '\vendor3\bar\my\hidden_class', + ), + ), + ); + } + + /** + * @dataProvider set_extensions_data + */ + public function test_set_extensions($extensions, $expected) + { + $classes = $this->finder + ->set_extensions($extensions) + ->core_path('phpbb/default/') + ->extension_suffix('_class') + ->get_classes(); + + sort($classes); + $this->assertEquals($expected, $classes); + } + public function test_get_directories() { $dirs = $this->finder @@ -128,6 +175,22 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } + public function test_non_absolute_directory_get_classes() + { + $classes = $this->finder + ->directory('type/') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + '\vendor2\foo\sub\type\alternative', + '\vendor2\foo\type\alternative', + ), + $classes + ); + } + public function test_sub_directory_get_classes() { $classes = $this->finder @@ -181,7 +244,8 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_get_classes_create_cache() { $cache = new phpbb_mock_cache; - $finder = new \phpbb\extension\finder($this->extension_manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name'); + $finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name'); + $finder->set_extensions(array_keys($this->extension_manager->all_enabled())); $files = $finder->suffix('_class.php')->get_files(); $expected_files = array( @@ -219,9 +283,8 @@ class phpbb_extension_finder_test extends phpbb_test_case 'is_dir' => false, ); - $finder = new \phpbb\extension\finder( - $this->extension_manager, - new \phpbb\filesystem(), + $finder = new \phpbb\finder( + new \phpbb\filesystem\filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache(array( '_ext_finder' => array( @@ -229,6 +292,7 @@ class phpbb_extension_finder_test extends phpbb_test_case ), )) ); + $finder->set_extensions(array_keys($this->extension_manager->all_enabled())); $classes = $finder ->core_path($query['core_path']) diff --git a/tests/extension/includes/acp/acp_foobar.php b/tests/extension/includes/acp/acp_foobar.php index c256a432e2..c4591cae07 100644 --- a/tests/extension/includes/acp/acp_foobar.php +++ b/tests/extension/includes/acp/acp_foobar.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_foobar { var $u_action; diff --git a/tests/extension/includes/acp/info/acp_foobar.php b/tests/extension/includes/acp/info/acp_foobar.php index b89cfb9574..8ca1afa1c6 100644 --- a/tests/extension/includes/acp/info/acp_foobar.php +++ b/tests/extension/includes/acp/info/acp_foobar.php @@ -1,15 +1,16 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -/** -* @package module_install -*/ class acp_foobar_info { function module() @@ -17,7 +18,6 @@ class acp_foobar_info return array( 'filename' => 'acp_foobar', 'title' => 'ACP Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')), ), diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index 789dc20d14..a24b0cf178 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -1,14 +1,19 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ require_once dirname(__FILE__) . '/ext/vendor2/bar/ext.php'; require_once dirname(__FILE__) . '/ext/vendor2/foo/ext.php'; +require_once dirname(__FILE__) . '/ext/vendor3/foo/ext.php'; require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php'; class phpbb_extension_manager_test extends phpbb_database_test_case @@ -28,22 +33,62 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $this->extension_manager = $this->create_extension_manager(); } - public function test_available() + public function test_all_available() { // barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure. - $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_available())); + $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo', 'vendor4/bar'), array_keys($this->extension_manager->all_available())); } - public function test_enabled() + public function test_all_enabled() { $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); } - public function test_configured() + public function test_all_configured() { $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); } + public function test_is_enabled() + { + $this->assertSame(true, $this->extension_manager->is_enabled('vendor2/foo')); + $this->assertSame(false, $this->extension_manager->is_enabled('vendor/moo')); + $this->assertSame(false, $this->extension_manager->is_enabled('vendor2/bar')); + $this->assertSame(false, $this->extension_manager->is_enabled('bertie/worlddominationplan')); + } + + public function test_is_disabled() + { + $this->assertSame(false, $this->extension_manager->is_disabled('vendor2/foo')); + $this->assertSame(true, $this->extension_manager->is_disabled('vendor/moo')); + $this->assertSame(false, $this->extension_manager->is_disabled('vendor2/bar')); + $this->assertSame(false, $this->extension_manager->is_disabled('bertie/worlddominationplan')); + } + + public function test_is_purged() + { + $this->assertSame(false, $this->extension_manager->is_purged('vendor2/foo')); + $this->assertSame(false, $this->extension_manager->is_purged('vendor/moo')); + $this->assertSame(true, $this->extension_manager->is_purged('vendor2/bar')); + $this->assertSame(false, $this->extension_manager->is_purged('bertie/worlddominationplan')); + } + + public function test_is_configured() + { + $this->assertSame(true, $this->extension_manager->is_configured('vendor2/foo')); + $this->assertSame(true, $this->extension_manager->is_configured('vendor/moo')); + $this->assertSame(false, $this->extension_manager->is_configured('vendor2/bar')); + $this->assertSame(false, $this->extension_manager->is_configured('bertie/worlddominationplan')); + } + + public function test_is_available() + { + $this->assertSame(true, $this->extension_manager->is_available('vendor2/foo')); + $this->assertSame(true, $this->extension_manager->is_available('vendor/moo')); + $this->assertSame(true, $this->extension_manager->is_available('vendor2/bar')); + $this->assertSame(false, $this->extension_manager->is_available('bertie/worlddominationplan')); + } + public function test_enable() { vendor2\bar\ext::$state = 0; @@ -56,6 +101,18 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $this->assertEquals(4, vendor2\bar\ext::$state); } + public function test_enable_not_enableable() + { + vendor3\foo\ext::$enabled = false; + + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->extension_manager->enable('vendor3/foo'); + $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled())); + $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured())); + + $this->assertSame(false, vendor3\foo\ext::$enabled); + } + public function test_disable() { vendor2\foo\ext::$disabled = false; @@ -91,14 +148,18 @@ class phpbb_extension_manager_test extends phpbb_database_test_case protected function create_extension_manager($with_cache = true) { - $config = new \phpbb\config\config(array()); + $config = new \phpbb\config\config(array('version' => PHPBB_VERSION)); $db = $this->new_dbal(); - $db_tools = new \phpbb\db\tools($db); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db); $phpbb_root_path = __DIR__ . './../../phpBB/'; $php_ext = 'php'; $table_prefix = 'phpbb_'; + $container = new phpbb_mock_container_builder(); + $migrator = new \phpbb\db\migrator( + $container, $config, $db, $db_tools, @@ -109,14 +170,13 @@ class phpbb_extension_manager_test extends phpbb_database_test_case array(), new \phpbb\db\migration\helper() ); - $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); return new \phpbb\extension\manager( $container, $db, $config, - new \phpbb\filesystem(), + new \phpbb\filesystem\filesystem(), 'phpbb_ext', dirname(__FILE__) . '/', $php_ext, diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index a3c4cc89e9..53bd3d109b 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,8 +19,11 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case protected $cache; protected $config; protected $db; + protected $db_tools; + protected $table_prefix; protected $phpbb_root_path; protected $phpEx; + protected $migrator; protected $template; protected $user; @@ -34,27 +41,46 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case 'version' => '3.1.0', )); $this->db = $this->new_dbal(); - $this->db_tools = new \phpbb\db\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->db_tools = $factory->get($this->db); $this->phpbb_root_path = dirname(__FILE__) . '/'; $this->phpEx = 'php'; - $this->user = new \phpbb\user(); $this->table_prefix = 'phpbb_'; - $this->template = new \phpbb\template\twig\twig( - new \phpbb\path_helper( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - new \phpbb\filesystem(), - $this->phpbb_root_path, - $this->phpEx + $container = new phpbb_mock_container_builder(); + $cache_path = $this->phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), ''); + $filesystem = new \phpbb\filesystem\filesystem(); + $phpbb_path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new phpbb_mock_request() ), + $filesystem, + $this->getMock('\phpbb\request\request'), + $this->phpbb_root_path, + $this->phpEx + ); + $twig = new \phpbb\template\twig\environment( $this->config, - $this->user, - new \phpbb\template\context() + $filesystem, + $phpbb_path_helper, + $container, + $cache_path, + null, + $loader, + array( + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ) ); + $container = new phpbb_mock_container_builder(); + $this->migrator = new \phpbb\db\migrator( + $container, $this->config, $this->db, $this->db_tools, @@ -65,19 +91,28 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case array(), new \phpbb\db\migration\helper() ); - $container = new phpbb_mock_container_builder(); - $container->set('migrator', $migrator); + $container->set('migrator', $this->migrator); $this->extension_manager = new \phpbb\extension\manager( $container, $this->db, $this->config, - new \phpbb\filesystem(), + new \phpbb\filesystem\filesystem(), 'phpbb_ext', $this->phpbb_root_path, $this->phpEx, $this->cache ); + + global $phpbb_root_path; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $this->phpEx); + $lang_loader->set_extension_manager($this->extension_manager); + $lang = new \phpbb\language\language($lang_loader); + $this->user = new \phpbb\user($lang, '\phpbb\datetime'); + + $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user))); + $container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); } // Should fail from missing composer.json @@ -91,9 +126,11 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { $manager->get_metadata(); } - catch(\phpbb\extension\exception $e){} - - $this->assertEquals((string) $e, 'The required file does not exist: ' . $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json'); + catch (\phpbb\extension\exception $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->assertEquals($message, $this->user->lang('FILE_NOT_FOUND', $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json')); + } } // Should be the same as a direct json_decode of the composer.json file @@ -107,76 +144,58 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { $metadata = $manager->get_metadata(); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { - $this->fail($e); + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->fail($message); } $json = json_decode(file_get_contents($this->phpbb_root_path . 'ext/vendor2/foo/composer.json'), true); + array_walk_recursive($json, array($manager, 'sanitize_json')); $this->assertEquals($metadata, $json); } - public function test_validator_non_existant() + public function validator_non_existing_data() { - $ext_name = 'validator'; - - $manager = $this->get_metadata_manager($ext_name); - - // Non-existant data - try - { - $manager->validate('name'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, 'Required meta field \'name\' has not been set.'); - } - - try - { - $manager->validate('type'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, 'Required meta field \'type\' has not been set.'); - } - - try - { - $manager->validate('licence'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, 'Required meta field \'licence\' has not been set.'); - } + return array( + array('name'), + array('type'), + array('license'), + array('version'), + ); + } + /** + * @dataProvider validator_non_existing_data + */ + public function test_validator_non_existing($field_name) + { + $manager = $this->get_metadata_manager('validator'); try { - $manager->validate('version'); - + $manager->validate($field_name); $this->fail('Exception not triggered'); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'version\' has not been set.'); + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->assertEquals($message, $this->user->lang('META_FIELD_NOT_SET', $field_name)); } + } + public function test_validator_non_existing_authors() + { + $manager = $this->get_metadata_manager('validator'); try { $manager->validate_authors(); - $this->fail('Exception not triggered'); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'authors\' has not been set.'); + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->assertEquals($message, $this->user->lang('META_FIELD_NOT_SET', 'authors')); } $manager->merge_metadata(array( @@ -188,72 +207,46 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case try { $manager->validate_authors(); - $this->fail('Exception not triggered'); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'author name\' has not been set.'); + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->assertEquals($message, $this->user->lang('META_FIELD_NOT_SET', 'author name')); } } - - public function test_validator_invalid() + public function validator_invalid_data() { - $ext_name = 'validator'; + return array( + array('name', 'asdf'), + array('type', 'asdf'), + array('license', ''), + array('version', ''), + ); + } - $manager = $this->get_metadata_manager($ext_name); + /** + * @dataProvider validator_invalid_data + */ + public function test_validator_invalid($field_name, $field_value) + { + $manager = $this->get_metadata_manager('validator'); // Invalid data $manager->set_metadata(array( - 'name' => 'asdf', - 'type' => 'asdf', - 'licence' => '', - 'version' => '', + $field_name => $field_value, )); try { - $manager->validate('name'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, 'Meta field \'name\' is invalid.'); - } - - try - { - $manager->validate('type'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, 'Meta field \'type\' is invalid.'); - } - - try - { - $manager->validate('licence'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, 'Meta field \'licence\' is invalid.'); - } - - try - { - $manager->validate('version'); - + $manager->validate($field_name); $this->fail('Exception not triggered'); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Meta field \'version\' is invalid.'); + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->assertEquals($message, $this->user->lang('META_FIELD_INVALID', $field_name)); } } @@ -267,7 +260,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $manager->set_metadata(array( 'name' => 'test/foo', 'type' => 'phpbb-extension', - 'licence' => 'GPL v2', + 'license' => 'GPL v2', 'version' => '1.0.0', )); @@ -275,149 +268,89 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { $this->assertEquals(true, $manager->validate('enable')); } - catch(\phpbb\extension\exception $e) + catch (\phpbb\extension\exception $e) { - $this->fail($e); + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); } } - - public function test_validator_requirements() + public function validator_requirements_data() { - $ext_name = 'validator'; - - $manager = $this->get_metadata_manager($ext_name); - // Too high of requirements - $manager->merge_metadata(array( - 'require' => array( - 'php' => '10.0.0', - 'phpbb/phpbb' => '3.2.0', // config is set to 3.1.0 + return array( + array( + '10.0.0', + '100.2.0', + false, + false, + 'Versions are not compared at the moment', ), - )); - - try - { - //$this->assertEquals(false, $manager->validate_require_php()); - //$this->assertEquals(false, $manager->validate_require_phpbb()); - } - catch(\phpbb\extension\exception $e) - { - $this->fail($e); - } - - - // Too high of requirements - $manager->merge_metadata(array( - 'require' => array( - 'php' => '5.3.0', - 'phpbb/phpbb' => '3.1.0-beta', // config is set to 3.1.0 + array( + '5.3.0', + '3.1.0-beta', + true, + true, ), - )); - - try - { - $this->assertEquals(true, $manager->validate_require_php()); - $this->assertEquals(true, $manager->validate_require_phpbb()); - } - catch(\phpbb\extension\exception $e) - { - $this->fail($e); - } - - - // Too high of requirements - $manager->merge_metadata(array( - 'require' => array( - 'php' => '>' . phpversion(), - 'phpbb/phpbb' => '>3.1.0', // config is set to 3.1.0 + array( + '>' . phpversion(), + '>3.1.0', + false, + false, + 'Versions are not compared at the moment', ), - )); - - try - { - //$this->assertEquals(false, $manager->validate_require_php()); - //$this->assertEquals(false, $manager->validate_require_phpbb()); - } - catch(\phpbb\extension\exception $e) - { - $this->fail($e); - } - - - // Too high of current install - $manager->merge_metadata(array( - 'require' => array( - 'php' => '<' . phpversion(), - 'phpbb/phpbb' => '<3.1.0', // config is set to 3.1.0 + array( + '<' . phpversion(), + '<3.1.0', + false, + false, + 'Versions are not compared at the moment', ), - )); - - try - { - //$this->assertEquals(false, $manager->validate_require_php()); - //$this->assertEquals(false, $manager->validate_require_phpbb()); - } - catch(\phpbb\extension\exception $e) - { - $this->fail($e); - } - - - // Matching requirements - $manager->merge_metadata(array( - 'require' => array( - 'php' => phpversion(), - 'phpbb/phpbb' => '3.1.0', // config is set to 3.1.0 + array( + phpversion(), + '3.1.0', + true, + true, ), - )); - - try - { - $this->assertEquals(true, $manager->validate_require_php()); - $this->assertEquals(true, $manager->validate_require_phpbb()); - } - catch(\phpbb\extension\exception $e) - { - $this->fail($e); - } - - - // Matching requirements - $manager->merge_metadata(array( - 'require' => array( - 'php' => '>=' . phpversion(), - 'phpbb/phpbb' => '>=3.1.0', // config is set to 3.1.0 + array( + '>=' . phpversion(), + '>=3.1.0', + true, + true, ), - )); + array( + '<=' . phpversion(), + '<=3.1.0', + true, + true, + ), + ); + } - try - { - $this->assertEquals(true, $manager->validate_require_php()); - $this->assertEquals(true, $manager->validate_require_phpbb()); - } - catch(\phpbb\extension\exception $e) + /** + * @dataProvider validator_requirements_data + */ + public function test_validator_requirements($php_version, $phpbb_version, $expected_php, $expected_phpbb, $incomplete_reason = '') + { + if ($incomplete_reason) { - $this->fail($e); + $this->markTestIncomplete($incomplete_reason); } - - // Matching requirements + $ext_name = 'validator'; + $manager = $this->get_metadata_manager($ext_name); + // Too high of requirements $manager->merge_metadata(array( 'require' => array( - 'php' => '<=' . phpversion(), - 'phpbb/phpbb' => '<=3.1.0', // config is set to 3.1.0 + 'php' => $php_version, + ), + 'extra' => array( + 'soft-require' => array( + 'phpbb/phpbb' => $phpbb_version, // config is set to 3.1.0 + ), ), )); - try - { - $this->assertEquals(true, $manager->validate_require_php()); - $this->assertEquals(true, $manager->validate_require_phpbb()); - } - catch(\phpbb\extension\exception $e) - { - $this->fail($e); - } + $this->assertEquals($expected_php, $manager->validate_require_php()); + $this->assertEquals($expected_phpbb, $manager->validate_require_phpbb()); } /** diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php index c0a136e173..88634bc6ba 100644 --- a/tests/extension/modules_test.php +++ b/tests/extension/modules_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,6 +22,7 @@ class phpbb_extension_modules_test extends phpbb_test_case { protected $extension_manager; protected $finder; + protected $module_manager; public function setUp() { @@ -39,7 +44,14 @@ class phpbb_extension_modules_test extends phpbb_test_case )); $phpbb_extension_manager = $this->extension_manager; - $this->acp_modules = new acp_modules(); + $this->module_manager = new \phpbb\module\module_manager( + new \phpbb\cache\driver\dummy(), + $this->getMock('\phpbb\db\driver\driver_interface'), + $this->extension_manager, + MODULES_TABLE, + dirname(__FILE__) . '/', + 'php' + ); } public function test_get_module_infos() @@ -52,13 +64,11 @@ class phpbb_extension_modules_test extends phpbb_test_case $phpbb_root_path = dirname(__FILE__) . '/'; // Find acp module info files - $this->acp_modules->module_class = 'acp'; - $acp_modules = $this->acp_modules->get_module_infos(); + $acp_modules = $this->module_manager->get_module_infos('acp'); $this->assertEquals(array( 'vendor2\\foo\\acp\\a_module' => array( 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array('ACP_MODS')), ), @@ -66,7 +76,6 @@ class phpbb_extension_modules_test extends phpbb_test_case 'acp_foobar' => array( 'filename' => 'acp_foobar', 'title' => 'ACP Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')), ), @@ -74,13 +83,11 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); // Find mcp module info files - $this->acp_modules->module_class = 'mcp'; - $acp_modules = $this->acp_modules->get_module_infos(); + $acp_modules = $this->module_manager->get_module_infos('mcp'); $this->assertEquals(array( 'vendor2\\foo\\mcp\\a_module' => array( 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')), ), @@ -88,27 +95,11 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); // Find a specific module info file (mcp_a_module) - $this->acp_modules->module_class = 'mcp'; - $acp_modules = $this->acp_modules->get_module_infos('mcp_a_module'); - $this->assertEquals(array( - 'vendor2\\foo\\mcp\\a_module' => array( - 'filename' => 'vendor2\\foo\\mcp\\a_module', - 'title' => 'Foobar', - 'version' => '3.1.0-dev', - 'modes' => array( - 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')), - ), - ), - ), $acp_modules); - - // Find a specific module info file (mcp_a_module) with passing the module_class - $this->acp_modules->module_class = ''; - $acp_modules = $this->acp_modules->get_module_infos('mcp_a_module', 'mcp'); + $acp_modules = $this->module_manager->get_module_infos('mcp', 'mcp_a_module'); $this->assertEquals(array( 'vendor2\\foo\\mcp\\a_module' => array( 'filename' => 'vendor2\\foo\\mcp\\a_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('MCP_MAIN')), ), @@ -116,23 +107,19 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); // The mcp module info file we're looking for shouldn't exist - $this->acp_modules->module_class = 'mcp'; - $acp_modules = $this->acp_modules->get_module_infos('mcp_a_fail'); + $acp_modules = $this->module_manager->get_module_infos('mcp', 'mcp_a_fail'); $this->assertEquals(array(), $acp_modules); // As there are no ucp modules we shouldn't find any - $this->acp_modules->module_class = 'ucp'; - $acp_modules = $this->acp_modules->get_module_infos(); + $acp_modules = $this->module_manager->get_module_infos('ucp'); $this->assertEquals(array(), $acp_modules); // Get module info of specified extension module - $this->acp_modules->module_class = 'acp'; - $acp_modules = $this->acp_modules->get_module_infos('foo_acp_a_module'); + $acp_modules = $this->module_manager->get_module_infos('acp', 'foo_acp_a_module'); $this->assertEquals(array( 'vendor2\\foo\\acp\\a_module' => array ( 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array ( 'config' => array ('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array ('ACP_MODS')), ), @@ -140,23 +127,20 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); // No specific module and module class set to an incorrect name - $acp_modules = $this->acp_modules->get_module_infos('', 'wcp', true); + $acp_modules = $this->module_manager->get_module_infos('wcp', '', true); $this->assertEquals(array(), $acp_modules); // No specific module, no module_class set in the function parameter, and an incorrect module class - $this->acp_modules->module_class = 'wcp'; - $acp_modules = $this->acp_modules->get_module_infos(); + $acp_modules = $this->module_manager->get_module_infos('wcp'); $this->assertEquals(array(), $acp_modules); // No specific module, module class set to false (will default to the above acp) // Setting $use_all_available will cause get_module_infos() to also load not enabled extensions (vendor2/bar) - $this->acp_modules->module_class = 'acp'; - $acp_modules = $this->acp_modules->get_module_infos('', false, true); + $acp_modules = $this->module_manager->get_module_infos('acp', '', true); $this->assertEquals(array( 'vendor2\\foo\\acp\\a_module' => array( 'filename' => 'vendor2\\foo\\acp\\a_module', 'title' => 'Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => 'ext_vendor2/foo', 'cat' => array('ACP_MODS')), ), @@ -164,7 +148,6 @@ class phpbb_extension_modules_test extends phpbb_test_case 'acp_foobar' => array( 'filename' => 'acp_foobar', 'title' => 'ACP Foobar', - 'version' => '3.1.0-dev', 'modes' => array( 'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')), ), @@ -172,7 +155,6 @@ class phpbb_extension_modules_test extends phpbb_test_case 'vendor2\\bar\\acp\\a_module' => array( 'filename' => 'vendor2\\bar\\acp\\a_module', 'title' => 'Bar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), ), @@ -180,12 +162,11 @@ class phpbb_extension_modules_test extends phpbb_test_case ), $acp_modules); // Specific module set to disabled extension - $acp_modules = $this->acp_modules->get_module_infos('vendor2_bar_acp_a_module', 'acp', true); + $acp_modules = $this->module_manager->get_module_infos('acp', 'vendor2_bar_acp_a_module', true); $this->assertEquals(array( 'vendor2\\bar\\acp\\a_module' => array( 'filename' => 'vendor2\\bar\\acp\\a_module', 'title' => 'Bar', - 'version' => '3.1.0-dev', 'modes' => array( 'config' => array('title' => 'Config', 'auth' => '', 'cat' => array('ACP_MODS')), ), @@ -209,7 +190,7 @@ class phpbb_extension_modules_test extends phpbb_test_case */ public function test_modules_auth($module_auth, $expected) { - global $phpbb_extension_manager; + global $phpbb_extension_manager, $phpbb_dispatcher; $phpbb_extension_manager = $this->extension_manager = new phpbb_mock_extension_manager( dirname(__FILE__) . '/', @@ -227,6 +208,8 @@ class phpbb_extension_modules_test extends phpbb_test_case ) ); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $this->assertEquals($expected, p_master::module_auth($module_auth, 0)); } } diff --git a/tests/files/type_foo.php b/tests/files/type_foo.php new file mode 100644 index 0000000000..95940b9d2f --- /dev/null +++ b/tests/files/type_foo.php @@ -0,0 +1,31 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files\types; + +class foo extends \phpbb\files\types\remote +{ + static public $tempnam_path; +} + +function tempnam($one, $two) +{ + if (empty(foo::$tempnam_path)) + { + return \tempnam($one, $two); + } + else + { + return foo::$tempnam_path; + } +} diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php new file mode 100644 index 0000000000..e630bf8c48 --- /dev/null +++ b/tests/files/types_base_test.php @@ -0,0 +1,93 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_files_types_base_test extends phpbb_test_case +{ + private $path; + + private $filesystem; + + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + protected function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->request = $this->getMock('\phpbb\request\request'); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + + $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container->set('files.filespec', new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + )))); + $this->factory = new \phpbb\files\factory($this->container); + + $this->path = __DIR__ . '/fixture/'; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function data_check_upload_size() + { + return array( + array('foo', '500KB', array()), + array('none', '500KB', array('PHP_SIZE_OVERRUN')), + array('none', '', array('PHP_SIZE_NA')), + ); + } + + /** + * @dataProvider data_check_upload_size + */ + public function test_check_upload_size($filename, $max_filesize, $expected) + { + $php_ini = $this->getMock('\bantu\IniGetWrapper\IniGetWrapper'); + $php_ini->expects($this->any()) + ->method('getString') + ->willReturn($max_filesize); + $type_form = new \phpbb\files\types\local($this->factory, $this->language, $php_ini, $this->request); + $file = $this->getMockBuilder('\phpbb\files\filespec') + ->disableOriginalConstructor() + ->getMock(); + $file->expects($this->any()) + ->method('get') + ->willReturn($filename); + $type_form->check_upload_size($file); + + $this->assertSame($expected, $file->error); + } +} diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php new file mode 100644 index 0000000000..efcece49d1 --- /dev/null +++ b/tests/files/types_form_test.php @@ -0,0 +1,174 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_files_types_form_test extends phpbb_test_case +{ + private $path; + + private $filesystem; + + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var \phpbb\plupload\plupload */ + protected $plupload; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + protected function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->request = $this->getMock('\phpbb\request\request'); + $this->request->expects($this->any()) + ->method('file') + ->willReturn(array()); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + + $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container->set('files.filespec', new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + )))); + $this->factory = new \phpbb\files\factory($this->container); + $this->plupload = $this->getMockBuilder('\phpbb\plupload\plupload') + ->disableOriginalConstructor() + ->getMock(); + $this->plupload->expects($this->any()) + ->method('handle_upload') + ->willReturn(array()); + + $this->path = __DIR__ . '/fixture/'; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function data_upload_form() + { + return array( + array( + array(), + array(''), + ), + array( + array( + 'tmp_name' => 'foo', + 'name' => 'foo', + 'size' => 500, + 'type' => 'image/png', + 'error' => UPLOAD_ERR_PARTIAL, + ), + array('PARTIAL_UPLOAD'), + ), + array( + array( + 'tmp_name' => 'foo', + 'name' => 'foo', + 'size' => 500, + 'type' => 'image/png', + 'error' => -9, + ), + array('NOT_UPLOADED'), + ), + array( + array( + 'tmp_name' => 'foo', + 'name' => 'foo', + 'size' => 0, + 'type' => 'image/png', + ), + array('EMPTY_FILEUPLOAD'), + ), + array( + array( + 'tmp_name' => 'none', + 'name' => 'none', + 'size' => 50, + 'type' => 'image/png', + ), + array('PHP_SIZE_OVERRUN'), + ), + array( + array( + 'tmp_name' => 'tests/upload/fixture/png', + 'name' => 'foo.png', + 'size' => 500, + 'type' => 'image/png', + 'local_mode' => true, + ), + array(), + array('local_mode' => true), + ), + ); + } + + /** + * @dataProvider data_upload_form + */ + public function test_upload_form($upload, $expected, $plupload = array()) + { + $this->request = $this->getMock('\phpbb\request\request'); + $this->request->expects($this->any()) + ->method('file') + ->willReturn($upload); + $filespec = new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $this->phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + ))); + $this->container->set('files.filespec', $filespec); + $this->factory = new \phpbb\files\factory($this->container); + $this->plupload = $this->getMockBuilder('\phpbb\plupload\plupload') + ->disableOriginalConstructor() + ->getMock(); + $this->plupload->expects($this->any()) + ->method('handle_upload') + ->willReturn($plupload); + + $type_form = new \phpbb\files\types\form($this->factory, $this->language, $this->php_ini, $this->plupload, $this->request); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('png')); + $type_form->set_upload($upload); + + + $file = $type_form->upload('foobar'); + $this->assertSame($expected, $file->error); + $this->assertInstanceOf('\phpbb\files\filespec', $file); + } +} diff --git a/tests/files/types_local_test.php b/tests/files/types_local_test.php new file mode 100644 index 0000000000..f4fa7fad3f --- /dev/null +++ b/tests/files/types_local_test.php @@ -0,0 +1,163 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_files_types_local_test extends phpbb_test_case +{ + private $path; + + private $filesystem; + + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var \phpbb\plupload\plupload */ + protected $plupload; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + protected function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->request = $this->getMock('\phpbb\request\request'); + $this->request->expects($this->any()) + ->method('file') + ->willReturn(array()); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + + $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container->set('files.filespec', new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + )))); + $this->factory = new \phpbb\files\factory($this->container); + $this->plupload = $this->getMockBuilder('\phpbb\plupload\plupload') + ->disableOriginalConstructor() + ->getMock(); + $this->plupload->expects($this->any()) + ->method('handle_upload') + ->willReturn(array()); + + $this->path = __DIR__ . '/fixture/'; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function test_upload_init_error() + { + $filespec = $this->getMockBuilder('\phpbb\files\filespec') + ->disableOriginalConstructor() + ->getMock(); + $filespec->expects($this->any()) + ->method('init_error') + ->willReturn(true); + $filespec->expects($this->any()) + ->method('set_upload_ary') + ->willReturnSelf(); + $filespec->expects($this->any()) + ->method('set_upload_namespace') + ->willReturnSelf(); + $this->container->set('files.filespec', $filespec); + $this->factory = new \phpbb\files\factory($this->container); + + $type_local = new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request); + + + $file = $type_local->upload('foo', false); + $this->assertSame(array(''), $file->error); + $this->assertInstanceOf('\phpbb\files\filespec', $file); + } + + public function data_upload_form() + { + return array( + array( + 'foo', + array( + 'tmp_name' => 'foo', + 'size' => 500, + 'type' => 'image/png', + ), + array('NOT_UPLOADED'), + ), + array( + 'none', + false, + array('PHP_SIZE_OVERRUN'), + ), + array( + 'tests/upload/fixture/png', + array( + 'realname' => 'foo.png', + 'size' => 500, + 'type' => 'image/png', + 'local_mode' => true, + ), + array(), + ), + ); + } + + /** + * @dataProvider data_upload_form + */ + public function test_upload_form($filename, $upload_ary, $expected) + { + $filespec = new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $this->phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + ))); + $filespec_local = new ReflectionProperty($filespec, 'local'); + $filespec_local->setAccessible(true); + $filespec_local->setValue($filespec, true); + $this->container->set('files.filespec', $filespec); + $this->factory = new \phpbb\files\factory($this->container); + + $type_local = new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('png')); + $type_local->set_upload($upload); + + + $file = $type_local->upload($filename, $upload_ary); + $this->assertSame($expected, $file->error); + $this->assertInstanceOf('\phpbb\files\filespec', $file); + } +} diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php new file mode 100644 index 0000000000..a85844ee78 --- /dev/null +++ b/tests/files/types_remote_test.php @@ -0,0 +1,141 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/type_foo.php'; + +class phpbb_files_types_remote_test extends phpbb_test_case +{ + private $path; + + private $filesystem; + + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + protected function setUp() + { + global $config, $phpbb_root_path, $phpEx; + + $config = new \phpbb\config\config(array()); + $this->request = $this->getMock('\phpbb\request\request'); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + + $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container->set('files.filespec', new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + )))); + $this->factory = new \phpbb\files\factory($this->container); + + $this->path = __DIR__ . '/fixture/'; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function test_upload_fsock_fail() + { + $type_remote = new \phpbb\files\types\remote($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('png')); + $type_remote->set_upload($upload); + + $file = $type_remote->upload('https://bärföö.com/foo.png'); + + $this->assertSame(array('NOT_UPLOADED'), $file->error); + } + + public function data_get_max_file_size() + { + return array( + array('', 'http://example.com/foo/bar.png'), + array('2k', 'http://example.com/foo/bar.png'), + array('500k', 'http://example.com/foo/bar.png'), + array('500M', 'http://example.com/foo/bar.png'), + array('500m', 'http://example.com/foo/bar.png'), + array('500k', 'http://google.com/.png', 'DISALLOWED_CONTENT'), + array('1', 'http://google.com/.png', 'WRONG_FILESIZE'), + array('500g', 'http://example.com/foo/bar.png'), + array('foobar', 'http://example.com/foo/bar.png'), + array('-5k', 'http://example.com/foo/bar.png'), + ); + } + + /** + * @dataProvider data_get_max_file_size + */ + public function test_get_max_file_size($max_file_size, $link, $expected = 'URL_NOT_FOUND') + { + $php_ini = $this->getMock('\bantu\IniGetWrapper\IniGetWrapper', array('getString')); + $php_ini->expects($this->any()) + ->method('getString') + ->willReturn($max_file_size); + $type_remote = new \phpbb\files\types\remote($this->factory, $this->language, $php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('png')); + $type_remote->set_upload($upload); + + $file = $type_remote->upload($link); + + $this->assertSame(array($expected), $file->error); + } + + public function test_upload_timeout() + { + $type_remote = new \phpbb\files\types\remote($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('png')); + $type_remote->set_upload($upload); + $upload->upload_timeout = -5; + + $file = $type_remote->upload('http://google.com/.png'); + + $this->assertSame(array('REMOTE_UPLOAD_TIMEOUT'), $file->error); + } + + public function test_upload_wrong_path() + { + $type_remote = new \phpbb\files\types\foo($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('png')); + $type_remote->set_upload($upload); + $type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path'; + + $file = $type_remote->upload('http://google.com/.png'); + + $this->assertSame(array('NOT_UPLOADED'), $file->error); + $type_remote::$tempnam_path = ''; + } +} diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php new file mode 100644 index 0000000000..c41204a0d5 --- /dev/null +++ b/tests/files/upload_test.php @@ -0,0 +1,128 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_files_upload_test extends phpbb_test_case +{ + private $path; + + private $filesystem; + + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + protected function setUp() + { + // Global $config required by unique_id + global $config, $phpbb_root_path, $phpEx; + + if (!is_array($config)) + { + $config = array(); + } + + $config['rand_seed'] = ''; + $config['rand_seed_last_update'] = time() + 600; + + $this->request = $this->getMock('\phpbb\request\request'); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + + $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container->set('files.filespec', new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + )))); + $this->factory = new \phpbb\files\factory($this->container); + + $this->path = __DIR__ . '/fixture/'; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function test_reset_vars() + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_max_filesize(500); + $this->assertEquals(500, $upload->max_filesize); + $upload->reset_vars(); + $this->assertEquals(0, $upload->max_filesize); + } + + public function test_set_disallowed_content() + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $disallowed_content = new ReflectionProperty($upload, 'disallowed_content'); + $disallowed_content->setAccessible(true); + + $upload->set_disallowed_content(array('foo')); + $this->assertEquals(array('foo'), $disallowed_content->getValue($upload)); + $upload->set_disallowed_content(array('foo', 'bar', 'meh')); + $this->assertEquals(array('foo', 'bar', 'meh'), $disallowed_content->getValue($upload)); + $upload->set_disallowed_content(''); + $this->assertEquals(array('foo', 'bar', 'meh'), $disallowed_content->getValue($upload)); + $this->assertINstanceOf('\phpbb\files\upload', $upload->set_disallowed_content(array())); + $this->assertEquals(array(), $disallowed_content->getValue($upload)); + $upload->reset_vars(); + $this->assertEquals(array(), $disallowed_content->getValue($upload)); + } + + public function test_is_valid() + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $this->assertFalse($upload->is_valid('foobar')); + } + + public function data_internal_error() + { + return array( + array(UPLOAD_ERR_INI_SIZE, 'PHP_SIZE_OVERRUN'), + array(UPLOAD_ERR_FORM_SIZE, 'WRONG_FILESIZE'), + array(UPLOAD_ERR_PARTIAL, 'PARTIAL_UPLOAD'), + array(UPLOAD_ERR_NO_FILE, 'NOT_UPLOADED'), + array(UPLOAD_ERR_NO_TMP_DIR, 'NO_TEMP_DIR'), + array(UPLOAD_ERR_CANT_WRITE, 'NO_TEMP_DIR'), + array(UPLOAD_ERR_EXTENSION, 'PHP_UPLOAD_STOPPED'), + array(9, false), + ); + } + + /** + * @dataProvider data_internal_error + */ + public function test_assign_internal_error($error_code, $expected) + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $this->assertSame($expected, $upload->assign_internal_error($error_code)); + } +} diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index fedadc103b..d2dec424b4 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,7 +18,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case public function setUp() { parent::setUp(); - $this->filesystem = new \phpbb\filesystem(); + $this->filesystem = new \phpbb\filesystem\filesystem(); } public function clean_path_data() @@ -28,6 +32,8 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case array('foo/bar/.', 'foo/bar'), array('./foo/bar', './foo/bar'), array('../foo/bar', '../foo/bar'), + array('./../foo/bar', './../foo/bar'), + array('././../foo/bar', './../foo/bar'), array('one/two/three', 'one/two/three'), array('one/two/../three', 'one/three'), array('one/../two/three', 'two/three'), diff --git a/tests/filesystem/is_absolute_test.php b/tests/filesystem/is_absolute_test.php new file mode 100644 index 0000000000..7a50989b74 --- /dev/null +++ b/tests/filesystem/is_absolute_test.php @@ -0,0 +1,68 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_filesystem_is_absolute_test extends phpbb_test_case +{ + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + public function setUp() + { + parent::setUp(); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + } + + static public function is_absolute_data() + { + return array( + // Empty + array('', false), + + // Absolute unix style + array('/etc/phpbb', true), + // Unix does not support \ so that is not an absolute path + array('\etc\phpbb', false), + + // Absolute windows style + array('c:\windows', true), + array('C:\Windows', true), + array('c:/windows', true), + array('C:/Windows', true), + + // Executable + array('etc/phpbb', false), + array('explorer.exe', false), + + // Relative subdir + array('Windows\System32', false), + array('Windows\System32\explorer.exe', false), + array('Windows/System32', false), + array('Windows/System32/explorer.exe', false), + + // Relative updir + array('..\Windows\System32', false), + array('..\Windows\System32\explorer.exe', false), + array('../Windows/System32', false), + array('../Windows/System32/explorer.exe', false), + ); + } + + /** + * @dataProvider is_absolute_data + */ + public function test_is_absolute($path, $expected) + { + $this->assertEquals($expected, $this->filesystem->is_absolute_path($path)); + } +} diff --git a/tests/filesystem/realpath_test.php b/tests/filesystem/realpath_test.php new file mode 100644 index 0000000000..d994935f94 --- /dev/null +++ b/tests/filesystem/realpath_test.php @@ -0,0 +1,90 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_filesystem_realpath_test extends phpbb_test_case +{ + static protected $filesystem_own_realpath; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + $reflection_class = new ReflectionClass('\phpbb\filesystem\filesystem'); + self::$filesystem_own_realpath = $reflection_class->getMethod('phpbb_own_realpath'); + self::$filesystem_own_realpath->setAccessible(true); + } + + public function setUp() + { + parent::setUp(); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + } + + public function realpath_resolve_absolute_without_symlinks_data() + { + return array( + // Constant data + array(__DIR__, __DIR__), + array(__DIR__ . '/../filesystem/../filesystem', __DIR__), + array(__DIR__ . '/././', __DIR__), + array(__DIR__ . '/non_existent', false), + + array(__FILE__, __FILE__), + array(__FILE__ . '../', false), + ); + } + + public function realpath_resolve_relative_without_symlinks_data() + { + if (!function_exists('getcwd')) + { + return array(); + } + + $filesystem = new \phpbb\filesystem\filesystem(); + $relative_path = $filesystem->make_path_relative(__DIR__, getcwd()); + + return array( + array($relative_path, __DIR__), + array($relative_path . '../filesystem/../filesystem', __DIR__), + array($relative_path . '././', __DIR__), + + array($relative_path . 'realpath_test.php', __FILE__), + ); + } + + /** + * @dataProvider realpath_resolve_absolute_without_symlinks_data + */ + public function test_realpath_absolute_without_links($path, $expected) + { + $this->assertEquals($expected, self::$filesystem_own_realpath->invoke($this->filesystem, $path)); + } + + /** + * @dataProvider realpath_resolve_relative_without_symlinks_data + */ + public function test_realpath_relative_without_links($path, $expected) + { + if (!function_exists('getcwd')) + { + $this->markTestSkipped('phpbb_own_realpath() cannot be tested with relative paths: getcwd is not available.'); + } + + $this->assertEquals($expected, self::$filesystem_own_realpath->invoke($this->filesystem, $path)); + } +} diff --git a/tests/fixtures/config.php b/tests/fixtures/config.php new file mode 100644 index 0000000000..ae9e8c22de --- /dev/null +++ b/tests/fixtures/config.php @@ -0,0 +1,3 @@ +<?php +$foo = 'bar'; +$foo_foo = 'bar bar'; diff --git a/tests/fixtures/config_other.php b/tests/fixtures/config_other.php new file mode 100644 index 0000000000..e0ecc17bb9 --- /dev/null +++ b/tests/fixtures/config_other.php @@ -0,0 +1,3 @@ +<?php +$bar = 'foo'; +$bar_bar = 'foo foo'; diff --git a/tests/functional/acp_attachments_test.php b/tests/functional/acp_attachments_test.php new file mode 100644 index 0000000000..8e810a508a --- /dev/null +++ b/tests/functional/acp_attachments_test.php @@ -0,0 +1,78 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * @group functional + */ +class phpbb_functional_acp_attachments_test extends phpbb_functional_test_case +{ + public function data_imagick_path_linux() + { + return array( + array('/usr/bin', 'Configuration updated successfully'), + array('/usr/foobar', 'The entered path “/usr/foobar†does not exist.'), + array('/usr/bin/which', 'The entered path “/usr/bin/which†is not a directory.'), + ); + } + + /** + * @dataProvider data_imagick_path_linux + */ + public function test_imagick_path_linux($imagick_path, $expected) + { + if (strtolower(substr(PHP_OS, 0, 5)) !== 'linux') + { + $this->markTestSkipped('Unable to test linux specific paths on other OS.'); + } + + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', 'adm/index.php?i=attachments&mode=attach&sid=' . $this->sid); + + $form = $crawler->selectButton('Submit')->form(array('config[img_imagick]' => $imagick_path)); + + $crawler = self::submit($form); + $this->assertContains($expected, $crawler->filter('#main')->text()); + } + + public function data_imagick_path_windows() + { + return array( + array('C:\Windows', 'Configuration updated successfully'), + array('C:\Windows\foobar1', 'The entered path “C:\Windows\foobar1†does not exist.'), + array('C:\Windows\explorer.exe', 'The entered path “C:\Windows\explorer.exe†is not a directory.'), + ); + } + + /** + * @dataProvider data_imagick_path_windows + */ + public function test_imagick_path_windows($imagick_path, $expected) + { + if (strtolower(substr(PHP_OS, 0, 3)) !== 'win') + { + $this->markTestSkipped('Unable to test windows specific paths on other OS.'); + } + + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', 'adm/index.php?i=attachments&mode=attach&sid=' . $this->sid); + + $form = $crawler->selectButton('Submit')->form(array('config[img_imagick]' => $imagick_path)); + + $crawler = self::submit($form); + $this->assertContains($expected, $crawler->filter('#main')->text()); + } +} diff --git a/tests/functional/acp_groups_test.php b/tests/functional/acp_groups_test.php index cdf8bf5117..9dfdc93474 100644 --- a/tests/functional/acp_groups_test.php +++ b/tests/functional/acp_groups_test.php @@ -1,18 +1,22 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -require_once dirname(__FILE__) . '/common_groups_test.php'; +require_once dirname(__FILE__) . '/common_groups_test_case.php'; /** * @group functional */ -class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_test +class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_test_case { protected $form_data; diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php index e17f33dc96..0a40e76057 100644 --- a/tests/functional/acp_permissions_test.php +++ b/tests/functional/acp_permissions_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/acp_profile_field_test.php b/tests/functional/acp_profile_field_test.php new file mode 100644 index 0000000000..88df782faa --- /dev/null +++ b/tests/functional/acp_profile_field_test.php @@ -0,0 +1,71 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_acp_profile_field_test extends phpbb_functional_test_case +{ + public function setUp() + { + parent::setUp(); + + $this->login(); + $this->admin_login(); + $this->add_lang('acp/profile'); + } + + public function data_add_profile_field() + { + return array( + array('bool', 'profilefields.type.bool', + array( + 'lang_options[0]' => 'foo', + 'lang_options[1]' => 'bar', + ), + array(), + ), + array('dropdown', 'profilefields.type.dropdown', + array( + 'lang_options' => "foo\nbar\nbar\nfoo", + ), + array(), + ), + ); + } + + /** + * @dataProvider data_add_profile_field + */ + public function test_add_profile_field($name, $type, $page1_settings, $page2_settings) + { + // Custom profile fields page + $crawler = self::request('GET', 'adm/index.php?i=acp_profile&mode=profile&sid=' . $this->sid); + // these language strings are html + $form = $crawler->selectButton('Create new field')->form(array( + 'field_ident' => $name, + 'field_type' => $type, + )); + $crawler = self::submit($form); + + // Fill form for profile field options + $form = $crawler->selectButton('Profile type specific options')->form($page1_settings); + $crawler = self::submit($form); + + // Fill form for profile field specific options + $form = $crawler->selectButton('Save')->form($page2_settings); + $crawler= self::submit($form); + + $this->assertContainsLang('ADDED_PROFILE_FIELD', $crawler->text()); + } +} diff --git a/tests/functional/acp_registration_test.php b/tests/functional/acp_registration_test.php new file mode 100644 index 0000000000..ef9843679e --- /dev/null +++ b/tests/functional/acp_registration_test.php @@ -0,0 +1,55 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_acp_registration_test extends phpbb_functional_test_case +{ + protected function set_email_enable($db, $status) + { + $sql = "UPDATE phpbb_config + SET config_value = '" . (($status) ? '1' : '0') . "' + WHERE config_name = 'email_enable'"; + $db->sql_query($sql); + + $this->purge_cache(); + } + + public function test_submitting_activation_method() + { + $db = $this->get_db(); + + $this->set_email_enable($db, false); + + $this->add_lang('acp/board'); + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid); + $this->assertContainsLang('ACP_REGISTER_SETTINGS_EXPLAIN', $this->get_content()); + + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[require_activation]']->select(USER_ACTIVATION_ADMIN); + $crawler = self::submit($form); + $this->assertContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text()); + + $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[require_activation]']->select(USER_ACTIVATION_NONE); + $crawler = self::submit($form); + $this->assertNotContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text()); + + $this->set_email_enable($db, true); + } +} diff --git a/tests/functional/acp_users_test.php b/tests/functional/acp_users_test.php new file mode 100644 index 0000000000..78028aacb8 --- /dev/null +++ b/tests/functional/acp_users_test.php @@ -0,0 +1,49 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_acp_users_test extends phpbb_functional_test_case +{ + public function setUp() + { + parent::setUp(); + + $this->login(); + $this->admin_login(); + $this->add_lang('acp/users'); + } + + public function test_founder_deletion() + { + $username = 'founder-account'; + $user_id = $this->create_user($username); + $this->make_founder($user_id); + + $crawler = self::request('GET', "adm/index.php?i=users&mode=overview&u=$user_id&sid={$this->sid}"); + $form = $crawler->filter('#user_delete')->selectButton($this->lang('SUBMIT'))->form(); + $crawler = self::submit($form); + $this->assertContains($this->lang('CANNOT_REMOVE_FOUNDER'), $this->get_content()); + } + + protected function make_founder($user_id) + { + $crawler = self::request('GET', "adm/index.php?i=users&mode=overview&u=$user_id&sid={$this->sid}"); + $form = $crawler->filter('#user_overview')->selectButton($this->lang('SUBMIT'))->form(); + $data = array('user_founder' => '1'); + $form->setValues($data); + $crawler = self::submit($form); + $this->assertContains($this->lang('USER_OVERVIEW_UPDATED'), $this->get_content()); + } +} diff --git a/tests/functional/auth_test.php b/tests/functional/auth_test.php index cfd85571b7..76e1709afb 100644 --- a/tests/functional/auth_test.php +++ b/tests/functional/auth_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,7 +22,7 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case // check for logout link $crawler = self::request('GET', 'index.php'); - $this->assertContains($this->lang('LOGOUT_USER', 'admin'), $crawler->filter('.navbar')->text()); + $this->assertContains($this->lang('LOGOUT', 'admin'), $crawler->filter('.navbar')->text()); } public function test_login_other() @@ -26,7 +30,26 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case $this->create_user('anothertestuser'); $this->login('anothertestuser'); $crawler = self::request('GET', 'index.php'); - $this->assertContains('anothertestuser', $crawler->filter('.icon-logout')->text()); + $this->assertContains('anothertestuser', $crawler->filter('#username_logged_in')->text()); + } + + /** + * @dependsOn test_login_other + */ + public function test_login_ucp_other_auth_provider() + { + global $cache, $config; + $cache = new phpbb_mock_null_cache; + $db = $this->get_db(); + $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = 'foobar' WHERE config_name = 'auth_method'"; + $db->sql_query($sql); + $config['auth_method'] = 'foobar'; + $this->login('anothertestuser'); + $crawler = self::request('GET', 'index.php'); + $this->assertContains('anothertestuser', $crawler->filter('#username_logged_in')->text()); + $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = 'db' WHERE config_name = 'auth_method'"; + $db->sql_query($sql); + $config['auth_method'] = 'db'; } /** diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php index 5f767b44f2..ca8c84ab2e 100644 --- a/tests/functional/avatar_acp_groups_test.php +++ b/tests/functional/avatar_acp_groups_test.php @@ -1,18 +1,22 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ -require_once dirname(__FILE__) . '/common_avatar_test.php'; +require_once dirname(__FILE__) . '/common_avatar_test_case.php'; /** * @group functional */ -class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_avatar_test +class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_avatar_test_case { public function get_url() { @@ -44,7 +48,7 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av ), // Delete avatar image to reset group settings array( - 'GROUP_UPDATED', + array('CONFIRM_AVATAR_DELETE', 'GROUP_UPDATED'), 'avatar_driver_gravatar', array( 'avatar_delete' => array('tick', ''), diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php index 0afd05e530..8b05a28658 100644 --- a/tests/functional/avatar_acp_users_test.php +++ b/tests/functional/avatar_acp_users_test.php @@ -1,18 +1,22 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ -require_once dirname(__FILE__) . '/common_avatar_test.php'; +require_once dirname(__FILE__) . '/common_avatar_test_case.php'; /** * @group functional */ -class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_avatar_test +class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_avatar_test_case { public function get_url() { @@ -42,7 +46,7 @@ class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_ava ), // Reset avatar settings array( - 'USER_AVATAR_UPDATED', + array('CONFIRM_AVATAR_DELETE', 'USER_AVATAR_UPDATED'), 'avatar_driver_gravatar', array( 'avatar_delete' => array('tick', ''), diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php index 233b7d36e1..52ef67543e 100644 --- a/tests/functional/avatar_ucp_groups_test.php +++ b/tests/functional/avatar_ucp_groups_test.php @@ -1,18 +1,21 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ - -require_once dirname(__FILE__) . '/common_avatar_test.php'; +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once dirname(__FILE__) . '/common_avatar_test_case.php'; /** * @group functional */ -class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_avatar_test +class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_avatar_test_case { public function get_url() { @@ -52,7 +55,7 @@ class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_av ), ), array( - 'GROUP_UPDATED', + array('CONFIRM_AVATAR_DELETE', 'GROUP_UPDATED'), 'avatar_driver_gravatar', array( 'avatar_delete' => array('tick', ''), diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php index f828559e0d..2f0832e092 100644 --- a/tests/functional/avatar_ucp_users_test.php +++ b/tests/functional/avatar_ucp_users_test.php @@ -1,18 +1,22 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ -require_once dirname(__FILE__) . '/common_avatar_test.php'; +require_once dirname(__FILE__) . '/common_avatar_test_case.php'; /** * @group functional */ -class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_avatar_test +class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_avatar_test_case { public function get_url() { @@ -32,18 +36,9 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava 'avatar_gravatar_height' => 80, ), ), - // Wrong driver selected - array( - 'NO_AVATAR_SELECTED', - 'avatar_driver_upload', - array( - 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', - 'avatar_remote_width' => 80, - 'avatar_remote_height' => 80, - ), - ), + array( - 'PROFILE_UPDATED', + array('CONFIRM_AVATAR_DELETE', 'PROFILE_UPDATED'), 'avatar_driver_gravatar', array( 'avatar_delete' => array('tick', ''), diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index c3be301762..280e814c06 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -30,9 +34,21 @@ class phpbb_functional_browse_test extends phpbb_functional_test_case $this->assertGreaterThan(0, $crawler->filter('.postbody')->count()); } + public function test_help_faq() + { + $crawler = self::request('GET', 'app.php/help/faq'); + $this->assertGreaterThan(0, $crawler->filter('h2.faq-title')->count()); + } + + public function test_help_bbcode() + { + $crawler = self::request('GET', 'app.php/help/bbcode'); + $this->assertGreaterThan(0, $crawler->filter('h2.faq-title')->count()); + } + public function test_feed() { - $crawler = self::request('GET', 'feed.php', array(), false); + $crawler = self::request('GET', 'app.php/feed', array(), false); self::assert_response_xml(); $this->assertGreaterThan(0, $crawler->filter('entry')->count()); } diff --git a/tests/functional/common_avatar_test.php b/tests/functional/common_avatar_test.php deleted file mode 100644 index 1fd8f2ed6f..0000000000 --- a/tests/functional/common_avatar_test.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ - -/** - * @group functional - */ -abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test_case -{ - private $path; - private $form_content; - - abstract function get_url(); - - public function setUp() - { - parent::setUp(); - $this->path = __DIR__ . '/fixtures/files/'; - $this->login(); - $this->admin_login(); - $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups')); - $this->set_acp_settings(); - } - - private function set_acp_settings() - { - $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); - // Check the default entries we should have - $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); - $this->assertContainsLang('ALLOW_REMOTE_UPLOAD', $crawler->text()); - $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); - $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); - - // Now start setting the needed settings - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['config[allow_avatar_local]']->select(1); - $form['config[allow_avatar_gravatar]']->select(1); - $form['config[allow_avatar_remote]']->select(1); - $form['config[allow_avatar_remote_upload]']->select(1); - $crawler = self::submit($form); - $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); - } - - public function assert_avatar_submit($expected, $type, $data, $button_text = 'SUBMIT') - { - $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); - - // Test if setting a gravatar avatar properly works - $form = $crawler->selectButton($this->lang($button_text))->form(); - $form['avatar_driver']->select($type); - - foreach ($data as $key => $value) - { - if (is_array($value)) - { - $form[$key]->$value[0]($value[1]); - } - else - { - $form[$key]->setValue($value); - } - } - - $crawler = self::submit($form); - - try - { - $this->assertContainsLang($expected, $crawler->text()); - } - catch (Exception $e) - { - $this->assertContains($expected, $crawler->text()); - } - } -} diff --git a/tests/functional/common_avatar_test_case.php b/tests/functional/common_avatar_test_case.php new file mode 100644 index 0000000000..924eb1273c --- /dev/null +++ b/tests/functional/common_avatar_test_case.php @@ -0,0 +1,97 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** + * @group functional + */ +abstract class phpbb_functional_common_avatar_test_case extends phpbb_functional_test_case +{ + private $path; + private $form_content; + + abstract function get_url(); + + public function setUp() + { + parent::setUp(); + $this->path = __DIR__ . '/fixtures/files/'; + $this->login(); + $this->admin_login(); + $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups')); + $this->set_acp_settings(); + } + + private function set_acp_settings() + { + $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); + // Check the default entries we should have + $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); + $this->assertContainsLang('ALLOW_REMOTE_UPLOAD', $crawler->text()); + $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); + $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); + + // Now start setting the needed settings + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[allow_avatar_local]']->select(1); + $form['config[allow_avatar_gravatar]']->select(1); + $form['config[allow_avatar_remote]']->select(1); + $form['config[allow_avatar_remote_upload]']->select(1); + $crawler = self::submit($form); + $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); + } + + public function assert_avatar_submit($expected, $type, $data, $delete = false, $button_text = 'SUBMIT') + { + $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); + + // Test if setting a gravatar avatar properly works + $form = $crawler->selectButton($this->lang($button_text))->form(); + $form['avatar_driver']->select($type); + + foreach ($data as $key => $value) + { + if (is_array($value)) + { + $form[$key]->{$value[0]}($value[1]); + } + else + { + $form[$key]->setValue($value); + } + } + + $crawler = self::submit($form); + + if (is_array($expected)) + { + $delete_expected = $expected[1]; + $expected = $expected[0]; + } + + try + { + $this->assertContainsLang($expected, $crawler->text()); + } + catch (Exception $e) + { + $this->assertContains($expected, $crawler->text()); + } + + if ($delete) + { + $form = $crawler->selectButton('confirm')->form(); + $crawler = self::submit($form); + $this->assertContainsLang($delete_expected, $crawler->text()); + } + } +} diff --git a/tests/functional/common_groups_test.php b/tests/functional/common_groups_test.php deleted file mode 100644 index 950db24767..0000000000 --- a/tests/functional/common_groups_test.php +++ /dev/null @@ -1,113 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @group functional -*/ -abstract class phpbb_functional_common_groups_test extends phpbb_functional_test_case -{ - abstract protected function get_url(); - - /** - * Get group_manage form - * @param int $group_id ID of the group that should be managed - */ - protected function get_group_manage_form($group_id = 5) - { - // Manage Administrators group - $crawler = self::request('GET', $this->get_url() . "&g=$group_id&sid=" . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - return $form; - } - - /** - * Execute login calls and add_lang() calls for tests - */ - protected function group_manage_login() - { - $this->login(); - $this->admin_login(); - $this->add_lang(array('ucp', 'acp/groups')); - } - - // Enable all avatars in the ACP - protected function enable_all_avatars() - { - $this->add_lang('acp/board'); - - $crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid); - // Check the default entries we should have - $this->assertContains($this->lang('ALLOW_REMOTE_UPLOAD'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); - $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); - - // Now start setting the needed settings - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['config[allow_avatar_local]']->select(1); - $form['config[allow_avatar_remote]']->select(1); - $form['config[allow_avatar_remote_upload]']->select(1); - $crawler = self::submit($form); - $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); - } - - public function groups_manage_test_data() - { - return array( - array('', 'GROUP_UPDATED'), - array('aa0000', 'GROUP_UPDATED'), - - array('AAG000','WRONG_DATA_COLOUR'), - array('#AA0000', 'WRONG_DATA_COLOUR'), - ); - } - - /** - * @dataProvider groups_manage_test_data - */ - public function test_groups_manage($input, $expected) - { - $this->group_manage_login(); - - // Manage Administrators group - $form = $this->get_group_manage_form(); - $form['group_colour']->setValue($input); - $crawler = self::submit($form); - $this->assertContains($this->lang($expected), $crawler->text()); - } - - public function group_avatar_min_max_data() - { - return array( - array('avatar_driver_upload', 'avatar_upload_url', 'foo', 'AVATAR_URL_INVALID'), - array('avatar_driver_upload', 'avatar_upload_url', 'foobar', 'AVATAR_URL_INVALID'), - array('avatar_driver_upload', 'avatar_upload_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'), - array('avatar_driver_remote', 'avatar_remote_url', 'foo', 'AVATAR_URL_INVALID'), - array('avatar_driver_remote', 'avatar_remote_url', 'foobar', 'AVATAR_URL_INVALID'), - array('avatar_driver_remote', 'avatar_remote_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'), - ); - } - - /** - * @dataProvider group_avatar_min_max_data - */ - public function test_group_avatar_min_max($avatar_type, $form_name, $input, $expected) - { - $this->login(); - $this->admin_login(); - $this->add_lang(array('ucp', 'acp/groups')); - $this->enable_all_avatars(); - - $crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid); - $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); - $form['avatar_driver']->setValue($avatar_type); - $form[$form_name]->setValue($input); - $crawler = self::submit($form); - $this->assertContains($this->lang($expected), $crawler->text()); - } -} diff --git a/tests/functional/common_groups_test_case.php b/tests/functional/common_groups_test_case.php new file mode 100644 index 0000000000..521b7c84d2 --- /dev/null +++ b/tests/functional/common_groups_test_case.php @@ -0,0 +1,117 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +abstract class phpbb_functional_common_groups_test_case extends phpbb_functional_test_case +{ + abstract protected function get_url(); + + /** + * Get group_manage form + * @param int $group_id ID of the group that should be managed + */ + protected function get_group_manage_form($group_id = 5) + { + // Manage Administrators group + $crawler = self::request('GET', $this->get_url() . "&g=$group_id&sid=" . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + return $form; + } + + /** + * Execute login calls and add_lang() calls for tests + */ + protected function group_manage_login() + { + $this->login(); + $this->admin_login(); + $this->add_lang(array('ucp', 'acp/groups')); + } + + // Enable all avatars in the ACP + protected function enable_all_avatars() + { + $this->add_lang('acp/board'); + + $crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid); + // Check the default entries we should have + $this->assertContains($this->lang('ALLOW_REMOTE_UPLOAD'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text()); + $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text()); + + // Now start setting the needed settings + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[allow_avatar_local]']->select(1); + $form['config[allow_avatar_remote]']->select(1); + $form['config[allow_avatar_remote_upload]']->select(1); + $crawler = self::submit($form); + $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text()); + } + + public function groups_manage_test_data() + { + return array( + array('', 'GROUP_UPDATED'), + array('aa0000', 'GROUP_UPDATED'), + + array('AAG000','WRONG_DATA_COLOUR'), + array('#AA0000', 'WRONG_DATA_COLOUR'), + ); + } + + /** + * @dataProvider groups_manage_test_data + */ + public function test_groups_manage($input, $expected) + { + $this->group_manage_login(); + + // Manage Administrators group + $form = $this->get_group_manage_form(); + $form['group_colour']->setValue($input); + $crawler = self::submit($form); + $this->assertContains($this->lang($expected), $crawler->text()); + } + + public function group_avatar_min_max_data() + { + return array( + array('avatar_driver_upload', 'avatar_upload_url', 'foo', 'AVATAR_URL_INVALID'), + array('avatar_driver_upload', 'avatar_upload_url', 'foobar', 'AVATAR_URL_INVALID'), + array('avatar_driver_upload', 'avatar_upload_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'), + array('avatar_driver_remote', 'avatar_remote_url', 'foo', 'AVATAR_URL_INVALID'), + array('avatar_driver_remote', 'avatar_remote_url', 'foobar', 'AVATAR_URL_INVALID'), + array('avatar_driver_remote', 'avatar_remote_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'), + ); + } + + /** + * @dataProvider group_avatar_min_max_data + */ + public function test_group_avatar_min_max($avatar_type, $form_name, $input, $expected) + { + $this->login(); + $this->admin_login(); + $this->add_lang(array('ucp', 'acp/groups')); + $this->enable_all_avatars(); + + $crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['avatar_driver']->setValue($avatar_type); + $form[$form_name]->setValue($input); + $crawler = self::submit($form); + $this->assertContains($this->lang($expected), $crawler->text()); + } +} diff --git a/tests/functional/controllers_compatibility_test.php b/tests/functional/controllers_compatibility_test.php new file mode 100644 index 0000000000..9499888a1a --- /dev/null +++ b/tests/functional/controllers_compatibility_test.php @@ -0,0 +1,56 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ + +class phpbb_functional_controllers_compatibility_test extends phpbb_functional_test_case +{ + public function test_report_compatibility() + { + $this->assert301('report.php?f=1&p=1', 'app.php/post/1/report'); + $this->assert301('report.php?p=1', 'app.php/post/1/report'); + $this->assert301('report.php?pm=1', 'app.php/pm/1/report'); + } + + public function test_feed_compatibility() + { + $this->assert301('feed.php', 'app.php/feed'); + $this->assert301('feed.php?mode=foobar', 'app.php/feed/foobar'); + $this->assert301('feed.php?mode=news', 'app.php/feed/news'); + $this->assert301('feed.php?mode=topics', 'app.php/feed/topics'); + $this->assert301('feed.php?mode=topics_news', 'app.php/feed/topics_news'); + $this->assert301('feed.php?mode=topics_active', 'app.php/feed/topics_active'); + $this->assert301('feed.php?mode=forums', 'app.php/feed/forums'); + $this->assert301('feed.php?f=1', 'app.php/feed/forum/1'); + $this->assert301('feed.php?t=1', 'app.php/feed/topic/1'); + } + + protected function assert301($from, $to) + { + self::$client->followRedirects(false); + self::request('GET', $from, array(), false); + + // Fix sid issues + $location = self::$client->getResponse()->getHeader('Location'); + $location = preg_replace('#sid=[^&]+(&(amp;)?)?#', '', $location); + if (substr($location, -1) === '?') + { + $location = substr($location, 0, -1); + } + + $this->assertEquals(301, self::$client->getResponse()->getStatus()); + $this->assertStringEndsWith($to, $location); + } +} diff --git a/tests/functional/download_test.php b/tests/functional/download_test.php index 24366992d5..1e863210e6 100644 --- a/tests/functional/download_test.php +++ b/tests/functional/download_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -57,11 +61,16 @@ class phpbb_functional_download_test extends phpbb_functional_test_case $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); $this->assertContains('Re: Download Topic #1-#2', $crawler->filter('html')->text()); - $this->data['posts']['Re: Download Topic #1-#2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->eq(1)->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + $this->data['posts']['Re: Download Topic #1-#2'] = (int) $post2['post_id']; } public function test_download_accessible() { + if (!class_exists('finfo')) + { + $this->markTestSkipped('Unable to run test with fileinfo disabled'); + } + $this->load_ids(array( 'forums' => array( 'Download #1', @@ -76,20 +85,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case 'attachments' => true, )); - // Download topic archive as guest - $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false); - self::assert_response_status_code(200); - $content = self::$client->getResponse()->getContent(); - $finfo = new finfo(FILEINFO_MIME_TYPE); - self::assertEquals('application/zip', $finfo->buffer($content)); - - // Download post archive as guest - $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false); - self::assert_response_status_code(200); - $content = self::$client->getResponse()->getContent(); - $finfo = new finfo(FILEINFO_MIME_TYPE); - self::assertEquals('application/zip', $finfo->buffer($content)); - // Download attachment as guest $crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false); self::assert_response_status_code(200); @@ -128,6 +123,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case public function test_download_softdeleted_post() { + if (!class_exists('finfo')) + { + $this->markTestSkipped('Unable to run test with fileinfo disabled'); + } + $this->load_ids(array( 'forums' => array( 'Download #1', @@ -143,18 +143,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case )); $this->add_lang('viewtopic'); - // Download topic archive as guest: still works - $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false); - self::assert_response_status_code(200); - $content = self::$client->getResponse()->getContent(); - $finfo = new finfo(FILEINFO_MIME_TYPE); - self::assertEquals('application/zip', $finfo->buffer($content)); - - // No download post archive as guest - $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false); - self::assert_response_html(404); - $this->assertContainsLang('ERROR_NO_ATTACHMENT', $crawler->filter('#message')->text()); - // No download attachment as guest $crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false); self::assert_response_html(404); @@ -163,20 +151,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case // Login as admin and try again, should work now. $this->login(); - // Download topic archive as admin - $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false); - self::assert_response_status_code(200); - $content = self::$client->getResponse()->getContent(); - $finfo = new finfo(FILEINFO_MIME_TYPE); - self::assertEquals('application/zip', $finfo->buffer($content)); - - // Download post archive as admin - $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false); - self::assert_response_status_code(200); - $content = self::$client->getResponse()->getContent(); - $finfo = new finfo(FILEINFO_MIME_TYPE); - self::assertEquals('application/zip', $finfo->buffer($content)); - // Download attachment as admin $crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false); self::assert_response_status_code(200); @@ -201,12 +175,8 @@ class phpbb_functional_download_test extends phpbb_functional_test_case ), )); - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Download Topic #1']}&sid={$this->sid}"); - $this->add_lang('posting'); - $form = $crawler->selectButton('Go')->eq(2)->form(); - $form['action']->select('delete_topic'); - $crawler = self::submit($form); + $crawler = $this->get_quickmod_page($this->data['topics']['Download Topic #1'], 'DELETE_TOPIC'); $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); $this->add_lang('mcp'); @@ -220,6 +190,11 @@ class phpbb_functional_download_test extends phpbb_functional_test_case public function test_download_softdeleted_topic() { + if (!class_exists('finfo')) + { + $this->markTestSkipped('Unable to run test with fileinfo disabled'); + } + $this->load_ids(array( 'forums' => array( 'Download #1', @@ -235,16 +210,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case )); $this->add_lang('viewtopic'); - // Download topic archive as guest: still works - $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false); - self::assert_response_html(404); - $this->assertContainsLang('ERROR_NO_ATTACHMENT', $crawler->filter('#message')->text()); - - // No download post archive as guest - $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false); - self::assert_response_html(404); - $this->assertContainsLang('ERROR_NO_ATTACHMENT', $crawler->filter('#message')->text()); - // No download attachment as guest $crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false); self::assert_response_html(404); @@ -253,20 +218,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case // Login as admin and try again, should work now. $this->login(); - // Download topic archive as admin - $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false); - self::assert_response_status_code(200); - $content = self::$client->getResponse()->getContent(); - $finfo = new finfo(FILEINFO_MIME_TYPE); - self::assertEquals('application/zip', $finfo->buffer($content)); - - // Download post archive as admin - $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false); - self::assert_response_status_code(200); - $content = self::$client->getResponse()->getContent(); - $finfo = new finfo(FILEINFO_MIME_TYPE); - self::assertEquals('application/zip', $finfo->buffer($content)); - // Download attachment as admin $crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false); self::assert_response_status_code(200); diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 53f62c4f19..8a71a5ce04 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -37,6 +41,8 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case { parent::setUp(); + $this->purge_cache(); + $this->get_db(); // Clear the phpbb_ext table @@ -80,19 +86,19 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid); $this->assertCount(1, $crawler->filter('.ext_enabled')); - $this->assertCount(4, $crawler->filter('.ext_disabled')); + $this->assertCount(6, $crawler->filter('.ext_disabled')); $this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text()); $this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text()); - $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(1)->text()); - $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(1)->text()); - $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(1)->text()); - $this->assertContainsLang('EXTENSION_DELETE_DATA', $crawler->filter('.ext_disabled')->eq(1)->text()); + $this->assertContains('phpBB Moo Extension', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('EXTENSION_ENABLE', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContainsLang('EXTENSION_DELETE_DATA', $crawler->filter('.ext_disabled')->eq(2)->text()); $this->assertContains('The “vendor/test2†extension is not valid.', $crawler->filter('.ext_disabled')->eq(0)->text()); - $this->assertContains('The “vendor/test3†extension is not valid.', $crawler->filter('.ext_disabled')->eq(2)->text()); + $this->assertContains('The “vendor/test3†extension is not valid.', $crawler->filter('.ext_disabled')->eq(1)->text()); $this->assertContains('phpBB Bar Extension', $crawler->filter('.ext_disabled')->eq(3)->text()); $this->assertContainsLang('DETAILS', $crawler->filter('.ext_disabled')->eq(3)->text()); @@ -116,7 +122,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case 'DESCRIPTION' => 'An example/sample extension to be used for testing purposes in phpBB Development.', 'VERSION' => '1.0.0', 'TIME' => '2012-02-15 01:01:01', - 'LICENCE' => 'GPL-2.0', + 'LICENSE' => 'GPL-2.0', 'PHPBB_VERSION' => '3.1.*@dev', 'PHP_VERSION' => '>=5.3', 'AUTHOR_NAME' => 'John Smith', @@ -157,7 +163,11 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('.errorbox')->text()); + $this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('#main')->text()); + + // Correctly submit the enable form + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor3%2Ffoo&sid=' . $this->sid); + $this->assertContainsLang('EXTENSION_NOT_ENABLEABLE', $crawler->filter('.errorbox')->text()); } public function test_disable_pre() @@ -169,14 +179,14 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $this->assertContainsLang('EXTENSION_ACTIONS', $crawler->filter('div.main thead')->text()); $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); - $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('.errorbox')->text()); + $this->assertContains($this->lang('EXTENSION_DISABLE_CONFIRM', 'phpBB Foo Extension'), $crawler->filter('#main')->text()); } public function test_delete_data_pre() { // test2 is not available (error) $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid); - $this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text()); + $this->assertContains($this->lang('FILE_NOT_FOUND', ''), $crawler->filter('.errorbox')->text()); // foo is not disabled (redirect to list) $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 4725301141..18eb9ad4c6 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -22,6 +26,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c 'foo/bar/event/', 'foo/bar/language/en/', 'foo/bar/styles/prosilver/template/', + 'foo/foo/config/', + 'foo/foo/controller/', ); static public function setUpBeforeClass() @@ -61,6 +67,18 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c } /** + * Check a controller for extension foo/bar. + */ + public function test_routing_resources() + { + $this->phpbb_extension_manager->enable('foo/foo'); + $crawler = self::request('GET', 'app.php/foo/foo', array(), false); + self::assert_response_status_code(); + $this->assertContains("foo/foo controller handle() method", $crawler->filter('body')->text()); + $this->phpbb_extension_manager->purge('foo/foo'); + } + + /** * Check the output of a controller using the template system */ public function test_controller_with_template() @@ -113,11 +131,32 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c } /** + * Check the redirect after using the login_box() form + */ + public function test_login_redirect() + { + $this->markTestIncomplete('Session table contains incorrect data for controllers on travis,' + . 'therefor the redirect fails.'); + + $this->phpbb_extension_manager->enable('foo/bar'); + $crawler = self::request('GET', 'app.php/foo/login_redirect'); + $this->assertContainsLang('LOGIN', $crawler->filter('h2')->text()); + $form = $crawler->selectButton('login')->form(array( + 'username' => 'admin', + 'password' => 'adminadmin', + )); + $this->assertStringStartsWith('./app.php/foo/login_redirect', $form->get('redirect')->getValue()); + + $crawler = self::submit($form); + $this->assertContains("I am a variable", $crawler->filter('#content')->text(), 'Unsuccessful redirect after using login_box()'); + $this->phpbb_extension_manager->purge('foo/bar'); + } + + /** * Check the output of a controller using the template system */ public function test_redirect() { - $filesystem = new \phpbb\filesystem(); $this->phpbb_extension_manager->enable('foo/bar'); $crawler = self::request('GET', 'app.php/foo/redirect'); diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php index 094eda8257..f615114c08 100644 --- a/tests/functional/extension_global_lang_test.php +++ b/tests/functional/extension_global_lang_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -48,6 +52,13 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_ $this->purge_cache(); } + public function tearDown() + { + parent::tearDown(); + + $this->purge_cache(); + } + public function test_load_extension_lang_globally() { $this->phpbb_extension_manager->enable('foo/bar'); diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php index ba025d582e..95107665cd 100644 --- a/tests/functional/extension_module_test.php +++ b/tests/functional/extension_module_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php'; @@ -45,8 +49,9 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case $this->phpbb_extension_manager = $this->get_extension_manager(); $this->phpbb_extension_manager->enable('foo/bar'); - $modules = new acp_modules(); $db = $this->get_db(); + $cache = $this->get_cache_driver(); + $modules = new \phpbb\module\module_manager($cache, $db, $this->phpbb_extension_manager, MODULES_TABLE, dirname(__FILE__) . '/../../phpBB/', 'php'); $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " @@ -66,7 +71,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case 'module_mode' => '', 'module_auth' => '', ); - $modules->update_module_data($parent_data, true); + $modules->update_module_data($parent_data); $module_data = array( 'module_basename' => 'foo\\bar\\acp\\main_module', @@ -78,7 +83,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case 'module_mode' => 'mode', 'module_auth' => '', ); - $modules->update_module_data($module_data, true); + $modules->update_module_data($module_data); $parent_data = array( 'module_basename' => '', @@ -90,7 +95,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case 'module_mode' => '', 'module_auth' => '', ); - $modules->update_module_data($parent_data, true); + $modules->update_module_data($parent_data); $module_data = array( 'module_basename' => 'foo\\bar\\ucp\\main_module', @@ -102,7 +107,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case 'module_mode' => 'mode', 'module_auth' => '', ); - $modules->update_module_data($module_data, true); + $modules->update_module_data($module_data); $this->purge_cache(); } diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index e922abdaf1..92d8d596c7 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php new file mode 100644 index 0000000000..dad5ca7e1a --- /dev/null +++ b/tests/functional/feed_test.php @@ -0,0 +1,1512 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +/** +* @group functional +*/ +class phpbb_functional_feed_test extends phpbb_functional_test_case +{ + protected $data = array(); + + static public $init_values = array(); + + public function setUp() + { + parent::setUp(); + $this->purge_cache(); + } + + public function __construct($name = null, array $data = array(), $dataName = '') + { + parent::__construct($name, $data, $dataName); + + $this->backupStaticAttributesBlacklist['phpbb_functional_feed_test'] = array('init_values'); + + $this->purge_cache(); + } + + public function test_setup_config_before_state() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=feed"); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + self::$init_values['post_base_items'] = (int) $values['config[feed_limit_post]']; + self::$init_values['topic_base_items'] = (int) $values['config[feed_limit_topic]']; + + // Enable all feeds + $values['config[feed_enable]'] = true; + $values['config[feed_forum]'] = true; + $values['config[feed_item_statistics]'] = true; + $values['config[feed_overall]'] = true; + $values['config[feed_overall_forums]'] = true; + $values['config[feed_topic]'] = true; + $values['config[feed_topics_active]'] = true; + $values['config[feed_topics_new]'] = true; + + $form->setValues($values); + + $crawler = self::submit($form); + self::assertContainsLang('CONFIG_UPDATED', $crawler->filter('.successbox')->text()); + + // Special config (Guest can't see attachments) + $this->add_lang('acp/permissions'); + + $crawler = self::request('GET', "adm/index.php?i=acp_permissions&sid={$this->sid}&icat=16&mode=setting_group_global&group_id[0]=1"); + self::assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text()); + + $form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form(); + $form['setting[1][0][u_download]']->select(-1); + + $crawler = self::submit($form); + self::assertContainsLang('AUTH_UPDATED', $crawler->filter('.successbox')->text()); + } + + public function test_dump_board_state() + { + $crawler = self::request('GET', 'app.php/feed/forums', array(), false); + self::assert_response_xml(); + self::$init_values['disapprove_user']['forums_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/overall', array(), false); + self::assert_response_xml(); + self::$init_values['disapprove_user']['overall_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/topics', array(), false); + self::assert_response_xml(); + self::$init_values['disapprove_user']['topics_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/topics_new', array(), false); + self::assert_response_xml(); + self::$init_values['disapprove_user']['topics_new_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/topics_active', array(), false); + self::assert_response_xml(); + self::$init_values['disapprove_user']['topics_active_value'] = $crawler->filterXPath('//entry')->count(); + + $this->login(); + + $crawler = self::request('GET', 'app.php/feed/forums', array(), false); + self::assert_response_xml(); + self::$init_values['admin']['forums_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/overall', array(), false); + self::assert_response_xml(); + self::$init_values['admin']['overall_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/topics', array(), false); + self::assert_response_xml(); + self::$init_values['admin']['topics_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/topics_new', array(), false); + self::assert_response_xml(); + self::$init_values['admin']['topics_new_value'] = $crawler->filterXPath('//entry')->count(); + + $crawler = self::request('GET', 'app.php/feed/topics_active', array(), false); + self::assert_response_xml(); + self::$init_values['admin']['topics_active_value'] = $crawler->filterXPath('//entry')->count(); + } + + public function test_setup_forums() + { + $this->login(); + $this->admin_login(); + $this->create_user('disapprove_user'); + $this->add_user_group('NEWLY_REGISTERED', array('disapprove_user')); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + self::submit($form); + + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + // 'Feeds #1.1' is a sub-forum of 'Feeds #1' + $crawler = self::request('GET', "adm/index.php?i=acp_forums&sid={$this->sid}&icat=6&mode=manage&parent_id={$this->data['forums']['Feeds #1']}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #1.1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + self::submit($form); + + // 'Feeds #news' will be used for feed.php?mode=news + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #news', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + self::submit($form); + + // 'Feeds #exclude' will not be displayed on app.php/feed/forums + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Feeds #exclude', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + self::submit($form); + } + + public function test_setup_config_after_forums() + { + $this->login(); + $this->admin_login(); + + $this->load_ids(array( + 'forums' => array( + 'Feeds #news', + 'Feeds #exclude', + ), + )); + + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=feed"); + + $form = $crawler->selectButton('Submit')->form(); + + // News/Exclude's forums config + $form['feed_news_id']->select(array($this->data['forums']['Feeds #news'])); + $form['feed_exclude_id']->select(array($this->data['forums']['Feeds #exclude'])); + + $crawler = self::submit($form); + self::assertContainsLang('CONFIG_UPDATED', $crawler->filter('.successbox')->text()); + } + + public function test_feeds_empty() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + 'Feeds #1.1', + ), + )); + + // Excluded forums (and topics under them) shouldn't be displayed in feeds + $this->assert_feeds(array( + 'f' => array( + array( + 'id' => $this->data['forums']['Feeds #1'], + 'nb_entries' => 0, + ), + array( + 'id' => $this->data['forums']['Feeds #1.1'], + 'nb_entries' => 0, + ), + ), + 'forums' => array( + array( + 'nb_entries' => 3, + 'xpath' => array( + '//entry/category[@label="Feeds #exclude"]' => 0, + ), + ), + ), + 'news' => array( + array( + 'nb_entries' => 0, + ), + ), + ), 'admin'); + } + + public function test_create_exclude_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #exclude', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #exclude'], 'Feeds #exclude - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #exclude - Topic #1'] = (int) $post['topic_id']; + } + + public function test_feeds_exclude() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #exclude', + ), + 'topics' => array( + 'Feeds #exclude - Topic #1', + ), + )); + + // Assert that feeds aren't available for excluded forums + $this->assert_feeds(array( + 'f' => array( + array( + 'id' => $this->data['forums']['Feeds #exclude'], + 'contents_lang' => array('NO_FEED'), + 'invalid' => true, + 'response_code' => 404, + ), + ), + 't' => array( + array( + 'id' => $this->data['topics']['Feeds #exclude - Topic #1'], + 'contents_lang' => array('NO_FEED'), + 'invalid' => true, + 'response_code' => 404, + ), + ), + 'overall' => array( + array( + 'nb_entries' => 0, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 0, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 0, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 0, + 'xpath' => array( + '//entry/title[contains(., "#exclude")]' => 0, + ), + ), + ), + ), 'admin'); + } + + public function test_create_news_topics() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #news', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #news'], 'Feeds #news - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #news - Topic #1'] = (int) $post['topic_id']; + + $post = $this->create_topic($this->data['forums']['Feeds #news'], 'Feeds #news - Topic #2', 'This is a test topic posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + + self::assertContains('Feeds #news - Topic #2', $crawler->filter('html')->text()); + $this->data['topics']['Feeds #news - Topic #2'] = (int) $post['topic_id']; + $this->data['posts']['Feeds #news - Topic #2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Feeds #news'], $post['topic_id'], 'Re: Feeds #news - Topic #2', 'This is a test post posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); + + self::assertContains('Re: Feeds #news - Topic #2', $crawler->filter('html')->text()); + $this->data['posts']['Re: Feeds #news - Topic #2'] = (int) $post2['post_id']; + } + + public function test_feeds_news_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #news', + ), + 'topics' => array( + 'Feeds #news - Topic #1', + 'Feeds #news - Topic #2', + ), + 'posts' => array( + 'Feeds #news - Topic #2', + ), + )); + + // Assert that the first post of the two topics are displayed in news feed + $this->assert_feeds(array( + 'news' => array( + array( + 'nb_entries' => 2, + 'contents' => array( + 1 => 'This is a test topic posted by the testing framework.', + 2 => 'This is a test topic posted by the testing framework.', + ), + ), + ), + // News should also be displayed in other feeds + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #news'], + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #news - Topic #1'], + ), + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #news - Topic #2'], + ), + ), + 'overall' => array( + array( + 'nb_entries' => 3, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 3, + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 2, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 2, + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 2, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 2, + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 2, + 'xpath' => array( + '//entry/title[contains(., "#news")]' => 2, + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_news_guest() + { + $this->load_ids(array( + 'posts' => array( + 'Feeds #news - Topic #2', + ), + )); + + // Assert that first post of the the two topics are displayed in news feed + $this->assert_feeds(array( + 'news' => array( + array( + 'nb_entries' => 2, + 'contents' => array( + 1 => 'This is a test topic posted by the testing framework.', + 2 => 'This is a test topic posted by the testing framework.', + ), + ), + ), + )); + } + + public function test_create_sub_forum_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + 'Feeds #1.1', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1 - Topic #1'] = (int) $post['topic_id']; + + $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #1', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1.1 - Topic #1'] = (int) $post['topic_id']; + } + + public function test_feeds_sub_forum() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + // The topics of the sub-forum shouldn't be displayed + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['forums']['Feeds #1'], + ), + ), + ), 'admin'); + } + + public function test_create_softdelete_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #2', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1 - Topic #2'] = (int) $post['topic_id']; + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Feeds #1'], $post['topic_id'], 'Re: Feeds #1 - Topic #2', 'This is a test post posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); + + self::assertContains('Re: Feeds #1 - Topic #2', $crawler->filter('html')->text()); + $this->data['posts']['Re: Feeds #1 - Topic #2'] = (int) $post2['post_id']; + } + + public function test_softdelete_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + 'posts' => array( + 'Re: Feeds #1 - Topic #2', + ), + )); + $this->add_lang('posting'); + + $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Feeds #1']}&p={$this->data['posts']['Re: Feeds #1 - Topic #2']}&sid={$this->sid}"); + self::assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + self::assertContainsLang('POST_DELETED', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1 - Topic #2']}&sid={$this->sid}"); + self::assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + } + + public function test_feeds_softdeleted_post_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + // Assert that the soft-deleted post is marked as soft-delete for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #1'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 7, + 'contents_lang' => array( + 1 => 'POST_DELETED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_softdeleted_post_guest() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + // Assert that the soft-deleted post is marked as soft-delete for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1'], + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + ), + ), + 'overall' => array( + array( + 'nb_entries' => 6, + ), + ), + )); + } + + public function test_softdelete_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + $this->add_lang('posting'); + $crawler = $this->get_quickmod_page($this->data['topics']['Feeds #1 - Topic #2'], 'DELETE_TOPIC'); + self::assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + self::assertContainsLang('TOPIC_DELETED_SUCCESS', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1 - Topic #2']}&sid={$this->sid}"); + self::assertContains('Feeds #1 - Topic #2', $crawler->filter('h2')->text()); + } + + public function test_feeds_softdeleted_topic_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + // Assert that the soft-deleted post is marked as soft-delete for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #1'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + 2 => 'POST_DELETED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + 'contents_lang' => array( + 1 => 'POST_DELETED', + 2 => 'POST_DELETED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 7, + 'contents_lang' => array( + 1 => 'POST_DELETED', + 2 => 'POST_DELETED', + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 5, + 'contents_lang' => array( + 1 => 'TOPIC_DELETED', + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 5, + 'contents_lang' => array( + 1 => 'TOPIC_DELETED', + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 5, + 'contents_lang' => array( + 1 => 'TOPIC_DELETED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_softdeleted_topic_guest() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #2', + ), + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['forums']['Feeds #1'], + ), + ), + 't' => array( + array( + 'id' => $this->data['topics']['Feeds #1 - Topic #2'], + 'contents_lang' => array('SORRY_AUTH_READ_TOPIC'), + 'invalid' => true, + 'response_code' => 403, + ), + ), + 'overall' => array( + array( + 'nb_entries' => 5, + ), + ), + 'topics' => array( + array( + 'nb_entries' => 4, + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 4, + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 4, + ), + ), + )); + } + + public function test_create_unapproved_post() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + )); + + $this->login('admin'); + $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #2', 'This is a test topic posted by the testing framework.'); + $this->data['topics']['Feeds #1.1 - Topic #2'] = (int) $post['topic_id']; + $this->logout(); + + // Test creating a reply + $this->login('disapprove_user'); + $this->create_post($this->data['forums']['Feeds #1.1'], $post['topic_id'], 'Re: Feeds #1.1 - Topic #2', 'This is a test post posted by the testing framework.', array(), 'POST_STORED_MOD'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1.1 - Topic #2']}&sid={$this->sid}"); + self::assertNotContains('Re: Feeds #1.1 - Topic #2', $crawler->filter('html')->text()); + } + + public function test_feeds_unapproved_post_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #2', + ), + )); + + // Assert that the unapproved post is marked as unapproved for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 3, + 'id' => $this->data['forums']['Feeds #1.1'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1.1 - Topic #2'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 9, + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_unapproved_post_disapprove_user() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #2', + ), + )); + + // Assert that the unapproved isn't displayed for regular users + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1.1'], + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1.1 - Topic #2'], + ), + ), + 'overall' => array( + array( + 'nb_entries' => 6, + ), + ), + ), 'disapprove_user'); + } + + public function test_create_unapproved_topic() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + )); + $this->set_flood_interval(0); + + $this->login('disapprove_user'); + $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #3', 'This is a test topic posted by the testing framework.', array(), 'POST_STORED_MOD'); + $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id']; + $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Feeds #1.1']}&sid={$this->sid}"); + + self::assertNotContains('Feeds #1.1 - Topic #3', $crawler->filter('html')->text()); + + $this->logout(); + $this->set_flood_interval(15); + } + + protected function set_flood_interval($flood_interval) + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values['config[flood_interval]'] = $flood_interval; + $form->setValues($values); + $crawler = self::submit($form); + self::assertGreaterThan(0, $crawler->filter('.successbox')->count()); + + $this->logout(); + } + + public function test_feeds_unapproved_topic_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #3', + ), + )); + + // Assert that the unapproved topic is marked as unapproved for users that have the right to see it. + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 4, + 'id' => $this->data['forums']['Feeds #1.1'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1.1 - Topic #3'], + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 10, + 'contents_lang' => array( + 1 => 'POST_UNAPPROVED', + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 7, + 'contents_lang' => array( + 1 => 'TOPIC_UNAPPROVED', + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 7, + 'contents_lang' => array( + 1 => 'TOPIC_UNAPPROVED', + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 7, + 'contents_lang' => array( + 1 => 'TOPIC_UNAPPROVED', + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_unapproved_topic_disapprove_user() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1.1', + ), + 'topics' => array( + 'Feeds #1.1 - Topic #3', + ), + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1.1'], + ), + ), + 't' => array( + array( + 'id' => $this->data['topics']['Feeds #1.1 - Topic #3'], + 'contents_lang' => array('SORRY_AUTH_READ_TOPIC'), + 'invalid' => true, + 'response_code' => 403, + ), + ), + 'overall' => array( + array( + 'nb_entries' => 6, + ), + ), + 'topics' => array( + array( + 'nb_entries' => 5, + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 5, + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 5, + ), + ), + ), 'disapprove_user'); + } + + public function test_create_attachment_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + )); + + // Test creating a topic with 1 attachment + $post = $this->create_topic($this->data['forums']['Feeds #1'], 'Feeds #1 - Topic #3', 'This is a test topic posted by the testing framework. [attachment=0]Attachment #0[/attachment]', array('upload_files' => 1)); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + + self::assertContains('Feeds #1 - Topic #3', $crawler->filter('html')->text()); + $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id']; + } + + public function test_feeds_attachment_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + 'posts' => array( + 'Feeds #1 - Topic #3', + ), + 'attachments' => true, + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 4, + 'id' => $this->data['forums']['Feeds #1'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1 - Topic #3'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 11, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 8, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 8, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 8, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + ), 'admin'); + } + + public function test_feeds_attachment_guest() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + 'posts' => array( + 'Feeds #1 - Topic #3', + ), + 'attachments' => true, + )); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['forums']['Feeds #1'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 1, + 'id' => $this->data['topics']['Feeds #1 - Topic #3'], + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 7, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 6, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 6, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 6, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => false, + ), + ), + ), + ), + ), + )); + } + + public function test_create_missing_attachment_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + )); + + // Test creating a reply with 1 missing attachment + $post2 = $this->create_post($this->data['forums']['Feeds #1'], $this->data['topics']['Feeds #1 - Topic #3'], 'Re: Feeds #1 - Topic #3-1', 'This is a test post posted by the testing framework. [attachment=0]Attachment #0[/attachment]'); + $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); + + self::assertContains('Re: Feeds #1 - Topic #3-1', $crawler->filter('html')->text()); + $this->data['posts']['Re: Feeds #1 - Topic #3-1'] = (int) $post2['post_id']; + } + + public function test_feeds_missing_attachment_admin() + { + $this->load_ids(array( + 'forums' => array( + 'Feeds #1', + ), + 'topics' => array( + 'Feeds #1 - Topic #3', + ), + 'posts' => array( + 'Feeds #1 - Topic #3', + ), + )); + + $this->add_lang('viewtopic'); + + $this->assert_feeds(array( + 'f' => array( + array( + 'nb_entries' => 5, + 'id' => $this->data['forums']['Feeds #1'], + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + 't' => array( + array( + 'nb_entries' => 2, + 'id' => $this->data['topics']['Feeds #1 - Topic #3'], + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + 'overall' => array( + array( + 'nb_entries' => 12, + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + 'topics' => array( + array( + 'nb_entries' => 8, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics_new' => array( + array( + 'nb_entries' => 8, + 'attachments' => array( + 1 => array( // First entry + array( // First attachment to fetch + 'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0], + 'displayed' => true, + ), + ), + ), + ), + ), + 'topics_active' => array( + array( + 'nb_entries' => 8, + 'contents' => array( + 1 => 'Attachment #0', + ), + ), + ), + ), 'admin'); + } + + protected function assert_feeds($data, $username = false) + { + if ($username) + { + $this->login($username); + $init_values = self::$init_values[$username]; + } + else + { + $init_values = self::$init_values['disapprove_user']; + } + + foreach ($data as $mode => $feeds) + { + foreach ($feeds as $feed_data) + { + if ($mode === 'f') + { + $params = "/forum/{$feed_data['id']}"; + $this->assert_feed($params, $feed_data); + } + else if ($mode === 't') + { + $params = "/topic/{$feed_data['id']}"; + $this->assert_feed($params, $feed_data); + } + else + { + switch ($mode) { + case 'forums': + $feed_data['nb_entries'] = ((int)$feed_data['nb_entries'] + $init_values['forums_value']); + break; + case 'overall': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['overall_value'], self::$init_values['post_base_items']); + break; + case 'topics': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_value'], self::$init_values['topic_base_items']); + break; + case 'topics_new': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_new_value'], self::$init_values['topic_base_items']); + break; + case 'topics_active': + $feed_data['nb_entries'] = min($feed_data['nb_entries'] + $init_values['topics_active_value'], self::$init_values['topic_base_items']); + break; + case 'news': + break; + default: + self::fail('Unsupported feed mode: ' . $mode); + } + + $params = "/{$mode}"; + $this->assert_feed($params, $feed_data); + } + } + } + } + + protected function assert_feed($params, $data) + { + $crawler = self::request('GET', 'app.php/feed' . $params, array(), false); + + if (empty($data['invalid'])) + { + self::assert_response_xml(); + self::assertEquals($data['nb_entries'], $crawler->filter('entry')->count(), "Tested feed : 'app.php/feed{$params}'"); + + if (!empty($data['xpath'])) + { + + foreach($data['xpath'] as $xpath => $count_expected) + { + self::assertCount($count_expected, $crawler->filterXPath($xpath), "Tested feed : 'app.php/feed{$params}', Search for {$xpath}"); + } + } + + if (!empty($data['contents'])) + { + foreach($data['contents'] as $entry_id => $string) + { + $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); + self::assertContains($string, $content, "Tested feed : 'app.php/feed{$params}'"); + } + } + + if (!empty($data['contents_lang'])) + { + foreach($data['contents_lang'] as $entry_id => $string) + { + $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); + self::assertContainsLang($string, $content, "Tested feed : 'app.php/feed{$params}'"); + } + } + + if (!empty($data['attachments'])) + { + foreach($data['attachments'] as $entry_id => $attachments) + { + $content = $crawler->filterXPath("//entry[{$entry_id}]/content")->text(); + foreach ($attachments as $i => $attachment) + { + $url = self::$root_url . "download/file.php?id={$attachment['id']}"; + $string = "Attachment #{$i}"; + + if ($attachment['displayed']) + { + self::assertContains($url, $content, "Tested feed : 'app.php/feed{$params}'"); + self::assertNotContains($string, $content, "Tested feed : 'app.php/feed{$params}'"); + } + else + { + self::assertContains($string, $content, "Tested feed : 'app.php/feed{$params}'"); + self::assertNotContains($url, $content, "Tested feed : 'app.php/feed{$params}'"); + } + } + } + } + } + else + { + self::assert_response_html($data['response_code'] ?: 202); + + if (!empty($data['contents_lang'])) + { + $content = $crawler->filter('html')->text(); + foreach($data['contents_lang'] as $string) + { + self::assertContainsLang($string, $content, "Tested feed : 'app.php/feed{$params}'"); + } + } + } + } + + protected function load_ids($data) + { + $this->db = $this->get_db(); + + if (!empty($data['forums'])) + { + $sql = 'SELECT * + FROM phpbb_forums + WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['forum_name'], $data['forums'], false)) + { + $this->data['forums'][$row['forum_name']] = (int) $row['forum_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['topics'])) + { + $sql = 'SELECT * + FROM phpbb_topics + WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['topic_title'], $data['topics'], false)) + { + $this->data['topics'][$row['topic_title']] = (int) $row['topic_id']; + } + } + $this->db->sql_freeresult($result); + } + + $post_ids = array(); + if (!empty($data['posts'])) + { + $sql = 'SELECT * + FROM phpbb_posts + WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['post_subject'], $data['posts'], false)) + { + $this->data['posts'][$row['post_subject']] = (int) $row['post_id']; + $post_ids[] = (int) $row['post_id']; + } + } + $this->db->sql_freeresult($result); + + if (isset($data['attachments'])) + { + $sql = 'SELECT * + FROM phpbb_attachments + WHERE in_message = 0 AND ' . $this->db->sql_in_set('post_msg_id', $post_ids); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $this->data['attachments'][(int) $row['post_msg_id']][] = (int) $row['attach_id']; + } + $this->db->sql_freeresult($result); + } + } + } +} diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php index c291712c71..d381fa1ae2 100644 --- a/tests/functional/fileupload_form_test.php +++ b/tests/functional/fileupload_form_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** * @group functional @@ -76,6 +80,47 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case $this->assertEquals($this->lang('DISALLOWED_EXTENSION', 'bif'), $crawler->filter('p.error')->text()); } + public function test_disallowed_content() + { + $this->login(); + + $crawler = $this->upload_file('disallowed.jpg', 'image/jpeg'); + $this->assertEquals($this->lang('DISALLOWED_CONTENT'), $crawler->filter('p.error')->text()); + } + + public function test_disallowed_content_no_check() + { + $this->login(); + $this->admin_login(); + $this->add_lang('ucp'); + + // Make sure check_attachment_content is set to false + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_attachments&mode=attach'); + + $form = $crawler->selectButton('Submit')->form(array( + 'config[check_attachment_content]' => 0, + 'config[img_imagick]' => '', + )); + self::submit($form); + + // Request index for correct URL + self::request('GET', 'index.php?sid=' . $this->sid); + + $crawler = $this->upload_file('disallowed.jpg', 'image/jpeg'); + + // Hitting the UNABLE_GET_IMAGE_SIZE error means we passed the + // DISALLOWED_CONTENT check + $this->assertContainsLang('UNABLE_GET_IMAGE_SIZE', $crawler->text()); + + // Reset check_attachment_content to default (enabled) + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_attachments&mode=attach'); + + $form = $crawler->selectButton('Submit')->form(array( + 'config[check_attachment_content]' => 1, + )); + self::submit($form); + } + public function test_too_large() { $this->create_user('fileupload'); diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 65c4b6b7c4..7e0f192b40 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -1,17 +1,39 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** * @group functional */ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case { + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + public function setUp() { parent::setUp(); @@ -19,8 +41,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case // URL // Global $config required by unique_id - // Global $user required by fileupload::remote_upload - global $config, $user; + global $config, $phpbb_root_path, $phpEx; if (!is_array($config)) { @@ -30,8 +51,17 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; - $user = new phpbb_mock_user(); - $user->lang = new phpbb_mock_lang(); + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->request = $this->getMock('\phpbb\request\request'); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + + $container = new phpbb_mock_container_builder(); + $container->set('files.filespec', new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path)); + $this->factory = new \phpbb\files\factory($container); + $container->set('files.factory', $this->factory); + $container->set('files.types.remote', new \phpbb\files\types\remote($this->factory, $this->language, $this->php_ini, $this->request, $phpbb_root_path)); + $this->phpbb_root_path = $phpbb_root_path; } public function tearDown() @@ -43,30 +73,47 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_invalid_extension() { - $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload(self::$root_url . 'develop/blank.gif'); + /** @var \phpbb\files\upload $upload */ + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_error_prefix('') + ->set_allowed_extensions(array('jpg')) + ->set_max_filesize(100); + $file = $upload->handle_upload('files.types.remote', self::$root_url . 'develop/blank.gif'); $this->assertEquals('URL_INVALID', $file->error[0]); } public function test_empty_file() { - $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload(self::$root_url . 'develop/blank.jpg'); + /** @var \phpbb\files\upload $upload */ + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_error_prefix('') + ->set_allowed_extensions(array('jpg')) + ->set_max_filesize(100); + $file = $upload->handle_upload('files.types.remote', self::$root_url . 'develop/blank.jpg'); $this->assertEquals('EMPTY_REMOTE_DATA', $file->error[0]); } public function test_successful_upload() { - $upload = new fileupload('', array('gif'), 1000); - $file = $upload->remote_upload(self::$root_url . 'styles/prosilver/theme/images/forum_read.gif'); + /** @var \phpbb\files\upload $upload */ + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_error_prefix('') + ->set_allowed_extensions(array('gif')) + ->set_max_filesize(1000); + $file = $upload->handle_upload('files.types.remote', self::$root_url . 'styles/prosilver/theme/images/forum_read.gif'); $this->assertEquals(0, sizeof($file->error)); - $this->assertTrue(file_exists($file->filename)); + $this->assertTrue(file_exists($file->get('filename'))); + $this->assertTrue($file->is_uploaded()); } public function test_too_large() { - $upload = new fileupload('', array('gif'), 100); - $file = $upload->remote_upload(self::$root_url . 'styles/prosilver/theme/images/forum_read.gif'); + /** @var \phpbb\files\upload $upload */ + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_error_prefix('') + ->set_allowed_extensions(array('gif')) + ->set_max_filesize(100); + $file = $upload->handle_upload('files.types.remote', self::$root_url . 'styles/prosilver/theme/images/forum_read.gif'); $this->assertEquals(1, sizeof($file->error)); $this->assertEquals('WRONG_FILESIZE', $file->error[0]); } diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php index 2ad6d08503..371ab7c967 100644 --- a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php +++ b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php @@ -1,10 +1,13 @@ <?php - /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -25,7 +28,6 @@ class main_info return array( 'filename' => 'foo\bar\acp\main_module', 'title' => 'ACP_FOOBAR_TITLE', - 'version' => '1.0.0', 'modes' => array( 'mode' => array('title' => 'ACP_FOOBAR_MODE', 'auth' => '', 'cat' => array('ACP_FOOBAR_TITLE')), ), diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php index c59b3c6820..ee797c718d 100644 --- a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php +++ b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php @@ -1,10 +1,13 @@ <?php - /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/fixtures/ext/foo/bar/composer.json b/tests/functional/fixtures/ext/foo/bar/composer.json index e3e5fc21cd..f0c7f0e6c1 100644 --- a/tests/functional/fixtures/ext/foo/bar/composer.json +++ b/tests/functional/fixtures/ext/foo/bar/composer.json @@ -5,7 +5,7 @@ "homepage": "", "version": "1.0.0", "time": "2013-03-21 01:01:01", - "licence": "GPL-2.0", + "license": "GPL-2.0", "authors": [{ "name": "Joas Schilling", "email": "nickvergessen@phpbb.com", @@ -13,10 +13,12 @@ "role": "Developer" }], "require": { - "php": ">=5.3", - "phpbb/phpbb": "3.1.*@dev" + "php": ">=5.3" }, "extra": { - "display-name": "phpBB 3.1 Extension Testing" + "display-name": "phpBB 3.1 Extension Testing", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } } } diff --git a/tests/functional/fixtures/ext/foo/bar/config/routing.yml b/tests/functional/fixtures/ext/foo/bar/config/routing.yml index 9b1ce3cfd7..374a58046d 100644 --- a/tests/functional/fixtures/ext/foo/bar/config/routing.yml +++ b/tests/functional/fixtures/ext/foo/bar/config/routing.yml @@ -1,19 +1,35 @@ foo_bar_controller: - pattern: /foo/bar + path: /foo/bar defaults: { _controller: foo_bar.controller:handle } foo_baz_controller: - pattern: /foo/baz + path: /foo/baz defaults: { _controller: foo_bar.controller:baz } foo_template_controller: - pattern: /foo/template + path: /foo/template defaults: { _controller: foo_bar.controller:template } foo_exception_controller: - pattern: /foo/exception + path: /foo/exception defaults: { _controller: foo_bar.controller:exception } +foo_login_redirect_controller: + path: /foo/login_redirect + defaults: { _controller: foo_bar.controller:login_redirect } + foo_redirect_controller: - pattern: /foo/redirect + path: /foo/redirect + defaults: { _controller: foo_bar.controller:redirect } + +foo_index_controller: + path: /index + defaults: { _controller: foo_bar.controller:redirect } + +foo_tests_index_controller: + path: /tests/index + defaults: { _controller: foo_bar.controller:redirect } + +foo_tests_dotdot_index_controller: + path: /tests/../index defaults: { _controller: foo_bar.controller:redirect } diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml index cec69f7807..d35be7955a 100644 --- a/tests/functional/fixtures/ext/foo/bar/config/services.yml +++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml @@ -6,6 +6,7 @@ services: - @path_helper - @template - @config + - @user - %core.root_path% - %core.php_ext% diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php index 558b202948..47d856a5df 100644 --- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php +++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php @@ -10,13 +10,15 @@ class controller protected $helper; protected $path_helper; protected $config; + protected $user; - public function __construct(\phpbb\controller\helper $helper, \phpbb\path_helper $path_helper, \phpbb\template\template $template, \phpbb\config\config $config, $root_path, $php_ext) + public function __construct(\phpbb\controller\helper $helper, \phpbb\path_helper $path_helper, \phpbb\template\template $template, \phpbb\config\config $config, \phpbb\user $user, $root_path, $php_ext) { $this->template = $template; $this->helper = $helper; $this->path_helper = $path_helper; $this->config = $config; + $this->user = $user; $this->root_path = $root_path; $this->php_ext = $php_ext; } @@ -43,6 +45,18 @@ class controller throw new \phpbb\controller\exception('Exception thrown from foo/exception route'); } + public function login_redirect() + { + if (!$this->user->data['is_registered']) + { + login_box(); + } + + $this->template->assign_var('A_VARIABLE', 'I am a variable'); + + return $this->helper->render('foo_bar_body.html'); + } + public function redirect() { $url_root = generate_board_url(); @@ -63,40 +77,19 @@ class controller 'tests/index.php', ), array( - $this->helper->url('index'), + $this->helper->route('foo_index_controller'), $rewrite_prefix . 'index', ), array( - $this->helper->url('tests/index'), + $this->helper->route('foo_tests_index_controller'), $rewrite_prefix . 'tests/index', ), + /** + * Symfony does not allow /../ in routes array( - $this->helper->url('tests/../index'), + $this->helper->route('foo_tests_dotdot_index_controller'), $rewrite_prefix . 'index', ), - /* - // helper URLs starting with ../ are prone to failure. - // Do not test them right now. - array( - $this->helper->url('../index'), - '../index', - ), - array( - $this->helper->url('../../index'), - '../index', - ), - array( - $this->helper->url('../tests/index'), - $rewrite_prefix . '../tests/index', - ), - array( - $this->helper->url('../tests/../index'), - '../index', - ), - array( - $this->helper->url('../../tests/index'), - '../tests/index', - ), */ ); diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php index 9b319dd35f..cdbdf40465 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/permission.php +++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php @@ -1,10 +1,13 @@ <?php - /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php index 8fa7ac97da..3a60019f68 100644 --- a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php +++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php @@ -1,10 +1,13 @@ <?php - /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php b/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php index 2ba37f3050..4c74442639 100644 --- a/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php +++ b/tests/functional/fixtures/ext/foo/bar/ucp/main_info.php @@ -1,10 +1,13 @@ <?php - /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +20,6 @@ class main_info return array( 'filename' => '\foo\bar\ucp\main_module', 'title' => 'ACP_FOOBAR_TITLE', - 'version' => '1.0.0', 'modes' => array( 'mode' => array('title' => 'ACP_FOOBAR_MODE', 'auth' => '', 'cat' => array('ACP_FOOBAR_TITLE')), ), diff --git a/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php b/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php index cd3dacc9db..f1cd03f4ab 100644 --- a/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php +++ b/tests/functional/fixtures/ext/foo/bar/ucp/main_module.php @@ -1,10 +1,13 @@ <?php - /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/fixtures/ext/foo/foo/composer.json b/tests/functional/fixtures/ext/foo/foo/composer.json new file mode 100644 index 0000000000..d85c76a6a2 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/composer.json @@ -0,0 +1,24 @@ +{ + "name": "foo/foo", + "type": "phpbb-extension", + "description": "Testing extensions", + "homepage": "", + "version": "1.0.0", + "time": "2013-03-21 01:01:01", + "license": "GPL-2.0", + "authors": [{ + "name": "Tristan Darricau", + "email": "nicofuma@phpbb.com", + "homepage": "http://www.phpbb.com", + "role": "Developer" + }], + "require": { + "php": ">=5.3" + }, + "extra": { + "display-name": "phpBB 3.1 Extension Testing", + "soft-require": { + "phpbb/phpbb": "3.1.*@dev" + } + } +} diff --git a/tests/functional/fixtures/ext/foo/foo/config/resource.yml b/tests/functional/fixtures/ext/foo/foo/config/resource.yml new file mode 100644 index 0000000000..4f2b9cce70 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/config/resource.yml @@ -0,0 +1,3 @@ +foo_foo_controller: + path: /foo + defaults: { _controller: foo_foo.controller:handle } diff --git a/tests/functional/fixtures/ext/foo/foo/config/routing.yml b/tests/functional/fixtures/ext/foo/foo/config/routing.yml new file mode 100644 index 0000000000..c2c401687d --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/config/routing.yml @@ -0,0 +1,3 @@ +foo_foo.general: + resource: "resource.yml" + prefix: /foo diff --git a/tests/functional/fixtures/ext/foo/foo/config/services.yml b/tests/functional/fixtures/ext/foo/foo/config/services.yml new file mode 100644 index 0000000000..b3c7719715 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/config/services.yml @@ -0,0 +1,3 @@ +services: + foo_foo.controller: + class: foo\foo\controller\controller diff --git a/tests/functional/fixtures/ext/foo/foo/controller/controller.php b/tests/functional/fixtures/ext/foo/foo/controller/controller.php new file mode 100644 index 0000000000..771eaeacfc --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/controller/controller.php @@ -0,0 +1,13 @@ +<?php + +namespace foo\foo\controller; + +use Symfony\Component\HttpFoundation\Response; + +class controller +{ + public function handle() + { + return new Response('foo/foo controller handle() method', 200); + } +} diff --git a/tests/functional/fixtures/ext/foo/foo/ext.php b/tests/functional/fixtures/ext/foo/foo/ext.php new file mode 100644 index 0000000000..80acda74fe --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/ext.php @@ -0,0 +1,8 @@ +<?php + +namespace foo\foo; + +class ext extends \phpbb\extension\base +{ + +} diff --git a/tests/functional/fixtures/files/disallowed.jpg b/tests/functional/fixtures/files/disallowed.jpg Binary files differnew file mode 100644 index 0000000000..06a437585a --- /dev/null +++ b/tests/functional/fixtures/files/disallowed.jpg diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php index 3b6fd15d02..64fa19557f 100644 --- a/tests/functional/forgot_password_test.php +++ b/tests/functional/forgot_password_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/forum_password_test.php b/tests/functional/forum_password_test.php index 40a8059ad1..4b2b69a92c 100644 --- a/tests/functional/forum_password_test.php +++ b/tests/functional/forum_password_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/forum_style_test.php b/tests/functional/forum_style_test.php index 59f7341eb6..b3c1115b7f 100644 --- a/tests/functional/forum_style_test.php +++ b/tests/functional/forum_style_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,16 +16,28 @@ */ class phpbb_functional_forum_style_test extends phpbb_functional_test_case { + public function test_font_awesome_style() + { + $crawler = self::request('GET', 'viewtopic.php?t=1&f=2'); + $this->assertContains('font-awesome.min', $crawler->filter('head > link[rel=stylesheet]')->eq(0)->attr('href')); + + $crawler = self::request('GET', 'viewtopic.php?t=1'); + $this->assertContains('font-awesome.min', $crawler->filter('head > link[rel=stylesheet]')->eq(0)->attr('href')); + + $crawler = self::request('GET', 'viewtopic.php?t=1&view=next'); + $this->assertContains('font-awesome.min', $crawler->filter('head > link[rel=stylesheet]')->eq(0)->attr('href')); + } + public function test_default_forum_style() { $crawler = self::request('GET', 'viewtopic.php?t=1&f=2'); - $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href')); + $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href')); $crawler = self::request('GET', 'viewtopic.php?t=1'); - $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href')); + $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href')); $crawler = self::request('GET', 'viewtopic.php?t=1&view=next'); - $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href')); + $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href')); } public function test_custom_forum_style() @@ -31,13 +47,13 @@ class phpbb_functional_forum_style_test extends phpbb_functional_test_case $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 2 WHERE forum_id = 2'); $crawler = self::request('GET', 'viewtopic.php?t=1&f=2'); - $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href')); + $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href')); $crawler = self::request('GET', 'viewtopic.php?t=1'); - $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href')); + $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href')); $crawler = self::request('GET', 'viewtopic.php?t=1&view=next'); - $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href')); + $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->eq(1)->attr('href')); $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 0 WHERE forum_id = 2'); $this->delete_style(2, 'test_style'); diff --git a/tests/functional/group_create_test.php b/tests/functional/group_create_test.php index 96780069f7..a1417b5ba0 100644 --- a/tests/functional/group_create_test.php +++ b/tests/functional/group_create_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/jumpbox_test.php b/tests/functional/jumpbox_test.php new file mode 100644 index 0000000000..f5a671b1b9 --- /dev/null +++ b/tests/functional/jumpbox_test.php @@ -0,0 +1,35 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_jumpbox_test extends phpbb_functional_test_case +{ + public function test_jumpbox() + { + $this->login(); + + $this->crawler = $this->get_quickmod_page(1, 'MERGE_TOPIC'); + $this->check_valid_jump('Your first forum'); + + $link = $this->crawler->filter('#jumpbox')->selectLink('Your first category')->link()->getUri(); + $this->crawler = self::request('GET', substr($link, strpos($link, 'mcp.'))); + $this->check_valid_jump('Your first category'); + } + + protected function check_valid_jump($forum) + { + $this->assertContains($this->lang('FORUM') . ": $forum", $this->crawler->filter('#cp-main h2')->text(), $this->crawler->text()); + } +} diff --git a/tests/functional/lang_test.php b/tests/functional/lang_test.php index 053806a431..7cffd0ef61 100644 --- a/tests/functional/lang_test.php +++ b/tests/functional/lang_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php index f65a7d0784..40615d66a5 100644 --- a/tests/functional/mcp_test.php +++ b/tests/functional/mcp_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -31,11 +35,7 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case public function test_handle_quickmod($crawler) { // Test moving a post - $form = $crawler->selectButton('Go')->eq(1)->form(); - $form['action']->select('merge'); - $crawler = self::submit($form); - - return $crawler; + return $this->get_quickmod_page(0, 'MERGE_POSTS', $crawler); } /** @@ -64,4 +64,20 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text()); } + + public function test_delete_logs() + { + $this->login(); + $crawler = self::request('GET', "mcp.php?i=mcp_logs&mode=front&sid={$this->sid}"); + $this->assertGreaterThanOrEqual(1, $crawler->filter('input[type=checkbox]')->count()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton($this->lang('DELETE_ALL'))->form(); + $crawler = self::submit($form); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + + $this->assertCount(0, $crawler->filter('input[type=checkbox]')); + } } diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php index 738ec4f9dd..1da5c39401 100644 --- a/tests/functional/memberlist_test.php +++ b/tests/functional/memberlist_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -39,7 +43,7 @@ class phpbb_functional_memberlist_test extends phpbb_functional_test_case protected function get_memberlist_leaders_table_crawler() { - $crawler = self::request('GET', 'memberlist.php?mode=leaders&sid=' . $this->sid); + $crawler = self::request('GET', 'memberlist.php?mode=team&sid=' . $this->sid); return $crawler->filter('.forumbg-table'); } @@ -102,4 +106,32 @@ class phpbb_functional_memberlist_test extends phpbb_functional_test_case $this->assertContains('admin', $crawler->eq(0)->text()); $this->assertNotContains('admin', $crawler->eq(1)->text()); } + + public function test_group_rank() + { + copy(__DIR__ . '/fixtures/files/valid.jpg', __DIR__ . '/../../phpBB/images/ranks/valid.jpg'); + + $this->login(); + $this->admin_login(); + $this->add_lang(array('acp/groups', 'acp/posting')); + + // Set a group rank to the registered users + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_groups&mode=manage&action=edit&g=2"); + $form = $crawler->selectButton('Submit')->form(); + $form['group_rank']->select('1'); + $crawler = self::submit($form); + $this->assertContainsLang('GROUP_UPDATED', $crawler->filter('.successbox')->text()); + + // Set a rank image for site_admin + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_ranks&mode=ranks&action=edit&id=1"); + $form = $crawler->selectButton('Submit')->form(); + $form['rank_image']->select('valid.jpg'); + $crawler = self::submit($form); + $this->assertContainsLang('RANK_UPDATED', $crawler->filter('.successbox')->text()); + + $crawler = self::request('GET', 'memberlist.php?mode=group&g=2'); + $this->assertContains('memberlist-test-user', $crawler->text()); + + unlink(__DIR__ . '/../../phpBB/images/ranks/valid.jpg'); + } } diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index 651c99a99d..0d2fdf082e 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,6 +24,13 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case 'foo/bar/', ); + public function tearDown() + { + $this->purge_cache(); + + parent::tearDown(); + } + static public function setUpBeforeClass() { parent::setUpBeforeClass(); @@ -70,7 +81,7 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case // Details should be html escaped // However, text() only returns the displayed text, so HTML Special Chars are decoded. // So we test this directly on the content of the response. - $this->assertContains('<p id="require_php">>=5.3</p>', $this->get_content()); + $this->assertContains('<span id="require_php">>=5.3</span>', $this->get_content()); } public function test_extensions_details_notexists() @@ -78,6 +89,6 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=not%2Fexists&sid=' . $this->sid); // Error message because the files do not exist - $this->assertContains('The required file does not exist:', $crawler->filter('#main')->text()); + $this->assertContains($this->lang('FILE_NOT_FOUND', ''), $crawler->filter('#main')->text()); } } diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index dd1b8ec981..87c36dd4d1 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -1,12 +1,18 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + /** * @group functional */ @@ -17,20 +23,20 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case return array( // Rows inserted by phpBB/install/schemas/schema_data.sql // Also see PHPBB3-11460 - array('post_notification', true), - array('topic_notification', true), - array('post_email', true), - array('topic_email', true), + array('notification.type.post_notification.method.board', true), + array('notification.type.topic_notification.method.board', true), + array('notification.type.post_notification.method.email', true), + array('notification.type.topic_notification.method.email', true), // Default behaviour for in-board notifications: // If user did not opt-out, in-board notifications are on. - array('bookmark_notification', true), - array('quote_notification', true), + array('notification.type.bookmark_notification.method.board', true), + array('notification.type.quote_notification.method.board', true), // Default behaviour for email notifications: // If user did not opt-in, email notifications are off. - array('bookmark_email', false), - array('quote_email', false), + array('notification.type.bookmark_notification.method.email', false), + array('notification.type.quote_notification.method.email', false), ); } @@ -59,20 +65,17 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case $this->create_user('notificationtestuser'); $this->add_user_group('NEWLY_REGISTERED', array('notificationtestuser')); $this->login('notificationtestuser'); - $crawler = self::request('GET', 'index.php'); - $this->assertContains('notificationtestuser', $crawler->filter('.icon-logout')->text()); // Post a new post that needs approval $this->create_post(2, 1, 'Re: Welcome to phpBB3', 'This is a test [b]post[/b] posted by notificationtestuser.', array(), 'POST_STORED_MOD'); $crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}"); $this->assertNotContains('This is a test post posted by notificationtestuser.', $crawler->filter('html')->text()); - // logout - $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout'); - - // admin login + // Login as admin + $this->logout(); $this->login(); $this->add_lang('ucp'); + $crawler = self::request('GET', 'ucp.php?i=ucp_notifications'); // At least one notification should exist @@ -81,8 +84,6 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case // Get form token $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); - $form = $crawler->selectButton($this->lang('YES'))->form(); - $crawler = self::submit($form); $this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text()); } } diff --git a/tests/functional/paging_test.php b/tests/functional/paging_test.php index 91f14cb75d..cfaf9104a8 100644 --- a/tests/functional/paging_test.php +++ b/tests/functional/paging_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,22 +22,22 @@ class phpbb_functional_paging_test extends phpbb_functional_test_case $this->login(); $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); - for ($post_id = 1; $post_id <= 11; $post_id++) + for ($post_id = 1; $post_id <= 16; $post_id++) { $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post no' . $post_id . ' posted by the testing framework.'); } $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); - $this->assertContains('post no9', $crawler->text()); - $this->assertNotContains('post no11', $crawler->text()); + $this->assertContains('post no4', $crawler->text()); + $this->assertNotContains('post no16', $crawler->text()); - $next_link = $crawler->filter('#viewtopic > fieldset > a.arrow-right')->attr('href'); + $next_link = $crawler->filter('.pagination > ul > li.next > a')->attr('href'); $crawler = self::request('GET', $next_link); - $this->assertContains('post no11', $crawler->text()); - $this->assertNotContains('post no9', $crawler->text()); + $this->assertNotContains('post no4', $crawler->text()); + $this->assertContains('post no16', $crawler->text()); - $prev_link = $crawler->filter('#viewtopic > fieldset > a.arrow-left')->attr('href'); + $prev_link = $crawler->filter('.pagination > ul > li.previous > a')->attr('href'); $crawler = self::request('GET', $prev_link); - $this->assertContains('post no9', $crawler->text()); - $this->assertNotContains('post no11', $crawler->text()); + $this->assertContains('post no4', $crawler->text()); + $this->assertNotContains('post no16', $crawler->text()); } } diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php index a91e70c7bb..d358681ad1 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** * @group functional @@ -29,6 +33,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case public function setUp() { parent::setUp(); + $this->purge_cache(); $this->set_extension_group_permission(1); $this->path = __DIR__ . '/fixtures/files/'; $this->add_lang('posting'); diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index dd95704952..bf9e3eb51a 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -32,4 +36,198 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case $crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}"); $this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text()); } + + public function test_unsupported_characters() + { + $this->login(); + + $this->add_lang('posting'); + + self::create_post(2, + 1, + "Unsupported: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6", + 'This is a test with emoji characters in the topic title.', + array(), + 'Your subject contains the following unsupported characters' + ); + } + + public function test_supported_unicode_characters() + { + $this->login(); + + $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); + $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', "This is a test with these weird characters: \xF0\x9F\x84\x90 \xF0\x9F\x84\x91"); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains("\xF0\x9F\x84\x90 \xF0\x9F\x84\x91", $crawler->text()); + } + + public function test_html_entities() + { + $this->login(); + + $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); + $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', '😀'); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains('😀', $crawler->text()); + } + + public function test_quote() + { + $text = 'Test post </textarea>"\' &&amp;'; + $expected = "(\\[quote=admin[^\\]]*\\]\n" . preg_quote($text) . "\n\\[/quote\\])"; + + $this->login(); + $topic = $this->create_topic(2, 'Test Topic 1', 'Test topic'); + $post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text); + + $crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post['topic_id']}&p={$post['post_id']}&sid={$this->sid}"); + + $this->assertRegexp($expected, $crawler->filter('textarea#message')->text()); + } + + /** + * @testdox max_quote_depth is applied to the text populating the posting form + */ + public function test_quote_depth_form() + { + $text = '0[quote]1[quote]2[/quote]1[/quote]0'; + $expected = array( + 0 => '0[quote]1[quote]2[/quote]1[/quote]0', + 1 => '00', + 2 => '0[quote]11[/quote]0', + 3 => '0[quote]1[quote]2[/quote]1[/quote]0', + ); + + $this->login(); + $topic = $this->create_topic(2, 'Test Topic 1', 'Test topic'); + $post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text); + $quote_url = "posting.php?mode=quote&f=2&t={$post['topic_id']}&p={$post['post_id']}&sid={$this->sid}"; + + $this->admin_login(); + foreach ($expected as $quote_depth => $expected_text) + { + $this->set_quote_depth($quote_depth); + $crawler = self::request('GET', $quote_url); + $this->assertRegexp( + "(\\[quote=admin[^\\]]*\\]\n?" . preg_quote($expected_text) . "\n?\\[/quote\\])", + $crawler->filter('textarea#message')->text() + ); + } + } + + /** + * @testdox max_quote_depth is applied to the submitted text + */ + public function test_quote_depth_submit() + { + $text = 'depth:0[quote]depth:1[quote]depth:2[quote]depth:3[/quote][/quote][/quote]'; + $contains = array( + 0 => array('depth:0', 'depth:1', 'depth:2', 'depth:3'), + 1 => array('depth:0', 'depth:1'), + 2 => array('depth:0', 'depth:1', 'depth:2'), + 3 => array('depth:0', 'depth:1', 'depth:2', 'depth:3'), + ); + $not_contains = array( + 0 => array(), + 1 => array('depth:2', 'depth:3'), + 2 => array('depth:3'), + 3 => array(), + ); + + $this->login(); + $this->admin_login(); + $topic = $this->create_topic(2, 'Test Topic 1', 'Test topic'); + + for ($quote_depth = 0; $quote_depth <= 2; ++$quote_depth) + { + $this->set_quote_depth($quote_depth); + + $post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text); + $url = "viewtopic.php?p={$post['post_id']}&sid={$this->sid}"; + + $crawler = self::request('GET', $url); + $text_content = $crawler->filter('#p' . $post['post_id'])->text(); + foreach ($contains[$quote_depth] as $contains_text) + { + $this->assertContains($contains_text, $text_content); + } + foreach ($not_contains[$quote_depth] as $not_contains_text) + { + $this->assertNotContains($not_contains_text, $text_content); + } + } + } + + protected function set_quote_depth($depth) + { + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + $values['config[max_quote_depth]'] = $depth; + $form->setValues($values); + $crawler = self::submit($form); + $this->assertEquals(1, $crawler->filter('.successbox')->count()); + } + + public function test_ticket_8420() + { + $text = '[b][url=http://example.org] :arrow: here[/url][/b]'; + + $this->login(); + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => $text + )); + $crawler = self::submit($form); + $this->assertEquals($text, $crawler->filter('#message')->text()); + } + + public function test_old_signature_in_preview() + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_sig = '[b:2u8sdcwb]My signature[/b:2u8sdcwb]', + user_sig_bbcode_uid = '2u8sdcwb', + user_sig_bbcode_bitfield = 'QA==' + WHERE user_id = 2"; + $this->get_db()->sql_query($sql); + + $this->login(); + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => 'My post', + )); + $crawler = self::submit($form); + $this->assertContains( + '<span style="font-weight: bold">My signature</span>', + $crawler->filter('#preview .signature')->html() + ); + } + + /** + * @ticket PHPBB3-10628 + */ + public function test_www_links_preview() + { + $text = 'www.example.org'; + $url = 'http://' . $text; + + $this->add_lang('posting'); + $this->login(); + + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => $text + )); + $crawler = self::submit($form); + + // Test that the textarea remains unchanged + $this->assertEquals($text, $crawler->filter('#message')->text()); + + // Test that the preview contains the correct link + $this->assertEquals($url, $crawler->filter('#preview a')->attr('href')); + } } diff --git a/tests/functional/private_messages_test.php b/tests/functional/private_messages_test.php new file mode 100644 index 0000000000..7fda26fb49 --- /dev/null +++ b/tests/functional/private_messages_test.php @@ -0,0 +1,110 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_private_messages_test extends phpbb_functional_test_case +{ + public function test_setup_config() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message"); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + // Set the maximum number of private messages per folder to 1 + $values['config[pm_max_msgs]'] = 1; + + $form->setValues($values); + + $crawler = self::submit($form); + $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text()); + } + + public function test_inbox_full() + { + $this->login(); + $message_id = $this->create_private_message('Test private message #1', 'This is a test private message sent by the testing framework.', array(2)); + + $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}"); + $this->assertContains($this->lang('UCP_PM_VIEW'), $crawler->filter('html')->text()); + + $message_id = $this->create_private_message('Test private message #2', 'This is a test private message sent by the testing framework.', array(2)); + + $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}"); + $this->assertContains($this->lang('NO_AUTH_READ_HOLD_MESSAGE'), $crawler->filter('html')->text()); + } + + public function test_restore_config() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message"); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values['config[pm_max_msgs]'] = 50; + + $form->setValues($values); + + $crawler = self::submit($form); + $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text()); + } + + public function test_quote_post() + { + $text = 'Test post'; + + $this->login(); + $topic = $this->create_topic(2, 'Test Topic 1', 'Test topic'); + $post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text); + + $expected = '(\\[quote=admin post_id=' . $post['post_id'] . ' time=\\d+ user_id=2\\]' . $text . '\\[/quote\\])'; + + $crawler = self::request('GET', 'ucp.php?i=pm&mode=compose&action=quotepost&p=' . $post['post_id'] . '&sid=' . $this->sid); + + $this->assertRegexp($expected, $crawler->filter('textarea#message')->text()); + } + + public function test_quote_pm() + { + $text = 'This is a test private message sent by the testing framework.'; + $expected = "(\\[quote=admin time=\\d+ user_id=2\\]\n" . $text . "\n\\[/quote\\])"; + + $this->login(); + $message_id = $this->create_private_message('Test', $text, array(2)); + + $crawler = self::request('GET', 'ucp.php?i=pm&mode=compose&action=quote&p=' . $message_id . '&sid=' . $this->sid); + + $this->assertRegexp($expected, $crawler->filter('textarea#message')->text()); + } + + public function test_quote_forward() + { + $text = 'This is a test private message sent by the testing framework.'; + $expected = "[quote=admin]\n" . $text . "\n[/quote]"; + + $this->login(); + $message_id = $this->create_private_message('Test', $text, array(2)); + + $crawler = self::request('GET', 'ucp.php?i=pm&mode=compose&action=forward&f=0&p=' . $message_id . '&sid=' . $this->sid); + + $this->assertContains($expected, $crawler->filter('textarea#message')->text()); + } +} diff --git a/tests/functional/prune_shadow_topic_test.php b/tests/functional/prune_shadow_topic_test.php new file mode 100644 index 0000000000..c014119b98 --- /dev/null +++ b/tests/functional/prune_shadow_topic_test.php @@ -0,0 +1,211 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_prune_shadow_topic_test extends phpbb_functional_test_case +{ + protected $data = array(); + protected $post; + + public function test_setup_forums() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Prune Shadow', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + 'enable_shadow_prune' => true, + 'prune_shadow_freq' => 1, + 'prune_shadow_days' => 1, + )); + $crawler = self::submit($form); + } + + public function test_create_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Prune Shadow', + ), + )); + + $this->assert_forum_details($this->data['forums']['Prune Shadow'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'initial comparison'); + + // Test creating topic + $this->post = $this->create_topic($this->data['forums']['Prune Shadow'], 'Prune Shadow #1', 'This is a test topic posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$this->post['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Prune Shadow #1', $crawler->filter('html')->text()); + $this->data['topics']['Prune Shadow #1'] = (int) $this->post['topic_id']; + $this->data['posts']['Prune Shadow #1'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + + $this->assert_forum_details($this->data['forums']['Prune Shadow'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Prune Shadow #1'], + ), 'after creating topic #1'); + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Prune Shadow'], $this->post['topic_id'], 'Re: Prune Shadow #1-#2', 'This is a test post posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Re: Prune Shadow #1-#2', $crawler->filter('html')->text()); + $this->data['posts']['Re: Prune Shadow #1-#2'] = (int) $post2['post_id']; + + $this->assert_forum_details($this->data['forums']['Prune Shadow'], array( + 'forum_posts_approved' => 2, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Prune Shadow #1-#2'], + ), 'after replying'); + } + + public function test_move_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Prune Shadow', + ), + 'topics' => array( + 'Prune Shadow #1', + ), + )); + + $crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Prune Shadow']}&i=main&action=move&mode=forum_view&start=0&topic_id_list[]={$this->data['topics']['Prune Shadow #1']}&sid={$this->sid}"); + $form = $crawler->selectButton('confirm')->form(array( + 'to_forum_id' => 2, + 'move_leave_shadow' => true, + )); + $crawler = self::submit($form); + + $this->assert_forum_details($this->data['forums']['Prune Shadow'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + ), 'after moving'); + + $this->db = $this->get_db(); + // Date topic 3 days back + $sql = 'UPDATE phpbb_topics + SET topic_last_post_time = ' . (time() - 60*60*24*3) . ' + WHERE topic_id = ' . ($this->data['topics']['Prune Shadow #1'] + 1); + $result = $this->db->sql_query($sql); + + $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Prune Shadow']}&sid={$this->sid}"); + $this->assertNotEmpty($crawler->filter('img')->last()->attr('src')); + self::request('GET', "cron.php?cron_type=cron.task.core.prune_shadow_topics&f={$this->data['forums']['Prune Shadow']}&sid={$this->sid}", array(), false); + + $this->assert_forum_details($this->data['forums']['Prune Shadow'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + ), 'after the cron job'); + } + + public function assert_forum_details($forum_id, $details, $additional_error_message = '') + { + $this->db = $this->get_db(); + + $sql = 'SELECT ' . implode(', ', array_keys($details)) . ' + FROM phpbb_forums + WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}"); + } + + public function load_ids($data) + { + $this->db = $this->get_db(); + + if (!empty($data['forums'])) + { + $sql = 'SELECT * + FROM phpbb_forums + WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['forum_name'], $data['forums'])) + { + $this->data['forums'][$row['forum_name']] = (int) $row['forum_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['topics'])) + { + $sql = 'SELECT * + FROM phpbb_topics + WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['topic_title'], $data['topics'])) + { + $this->data['topics'][$row['topic_title']] = (int) $row['topic_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['posts'])) + { + $sql = 'SELECT * + FROM phpbb_posts + WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['post_subject'], $data['posts'])) + { + $this->data['posts'][$row['post_subject']] = (int) $row['post_id']; + } + } + $this->db->sql_freeresult($result); + } + } +} diff --git a/tests/functional/registration_test.php b/tests/functional/registration_test.php index 5baf33c59e..690f4ae9f2 100644 --- a/tests/functional/registration_test.php +++ b/tests/functional/registration_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -41,12 +45,23 @@ class phpbb_functional_registration_test extends phpbb_functional_test_case $form = $crawler->selectButton('Submit')->form(array( 'username' => 'user-reg-test', 'email' => 'user-reg-test@phpbb.com', - 'new_password' => 'testtest', - 'password_confirm' => 'testtest', + 'new_password' => 'user-reg-testuser-reg-test', + 'password_confirm' => 'user-reg-testuser-reg-test', )); $form['tz']->select('Europe/Berlin'); $crawler = self::submit($form); $this->assertContainsLang('ACCOUNT_ADDED', $crawler->filter('#message')->text()); } + + /** + * @depends test_register_new_account + */ + public function test_default_subscription_options() + { + $this->login('user-reg-test'); + $crawler = self::request('GET', 'ucp.php?i=ucp_notifications&mode=notification_options&sid=' . $this->sid); + $this->assert_checkbox_is_checked($crawler, 'notification.type.post_notification.method.email'); + $this->assert_checkbox_is_checked($crawler, 'notification.type.topic_notification.method.email'); + } } diff --git a/tests/functional/report_post_captcha_test.php b/tests/functional/report_post_captcha_test.php index 8283465041..36a1a9ee4d 100644 --- a/tests/functional/report_post_captcha_test.php +++ b/tests/functional/report_post_captcha_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** * @group functional @@ -14,12 +18,13 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca { public function test_guest_report_post() { - $crawler = self::request('GET', 'report.php?f=2&p=1'); + $crawler = self::request('GET', 'app.php/post/1/report', array(), false); + $this->assert_response_html(403); $this->add_lang('mcp'); $this->assertContains($this->lang('USER_CANNOT_REPORT'), $crawler->filter('html')->text()); $this->set_reporting_guest(1); - $crawler = self::request('GET', 'report.php?f=2&p=1'); + $crawler = self::request('GET', 'app.php/post/1/report'); $this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); $this->set_reporting_guest(-1); } @@ -27,7 +32,7 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca public function test_user_report_post() { $this->login(); - $crawler = self::request('GET', 'report.php?f=2&p=1'); + $crawler = self::request('GET', 'app.php/post/1/report'); $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); $this->add_lang('mcp'); diff --git a/tests/functional/search/base.php b/tests/functional/search/base.php index 28327da914..a3cac381d2 100644 --- a/tests/functional/search/base.php +++ b/tests/functional/search/base.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,11 +16,11 @@ */ abstract class phpbb_functional_search_base extends phpbb_functional_test_case { - protected function assert_search_found($keywords) + protected function assert_search_found($keywords, $posts_found, $words_highlighted) { $crawler = self::request('GET', 'search.php?keywords=' . $keywords); - $this->assertEquals(1, $crawler->filter('.postbody')->count()); - $this->assertEquals(3, $crawler->filter('.posthilit')->count()); + $this->assertEquals($posts_found, $crawler->filter('.postbody')->count()); + $this->assertEquals($words_highlighted, $crawler->filter('.posthilit')->count()); } protected function assert_search_not_found($keywords) @@ -32,6 +36,10 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case $this->login(); $this->admin_login(); + $this->create_search_index('\phpbb\search\fulltext_native'); + + $post = $this->create_topic(2, 'Test Topic 1 foosubject', 'This is a test topic posted by the barsearch testing framework.'); + $crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=settings&sid=' . $this->sid); $form = $crawler->selectButton('Submit')->form(); $values = $form->getValues(); @@ -49,28 +57,32 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case // check if search backend is not supported if ($crawler->filter('.errorbox')->count() > 0) { + $this->delete_topic($post['topic_id']); $this->markTestSkipped("Search backend is not supported/running"); } + $this->create_search_index(); } $this->logout(); - $this->assert_search_found('phpbb3+installation'); + $this->assert_search_found('phpbb3+installation', 1, 3); + $this->assert_search_found('foosubject+barsearch', 1, 2); $this->assert_search_not_found('loremipsumdedo'); $this->login(); $this->admin_login(); $this->delete_search_index(); + $this->delete_topic($post['topic_id']); } - protected function create_search_index() + protected function create_search_index($backend = null) { $this->add_lang('acp/search'); $crawler = self::request( 'POST', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid, array( - 'search_type' => $this->search_backend, + 'search_type' => ( ($backend === null) ? $this->search_backend : $backend ), 'action' => 'create', 'submit' => true, ) diff --git a/tests/functional/search/mysql_test.php b/tests/functional/search/mysql_test.php index 7af8051417..a97b12e905 100644 --- a/tests/functional/search/mysql_test.php +++ b/tests/functional/search/mysql_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,8 +20,4 @@ class phpbb_functional_search_mysql_test extends phpbb_functional_search_base { protected $search_backend = '\phpbb\search\fulltext_mysql'; - protected function assert_search_not_found($keywords) - { - $this->markTestIncomplete('MySQL search when fails doesn\'t show the search query'); - } } diff --git a/tests/functional/search/native_test.php b/tests/functional/search/native_test.php index ce568df616..9908b9cdaa 100644 --- a/tests/functional/search/native_test.php +++ b/tests/functional/search/native_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,4 @@ require_once dirname(__FILE__) . '/base.php'; class phpbb_functional_search_native_test extends phpbb_functional_search_base { protected $search_backend = '\phpbb\search\fulltext_native'; - - protected function assert_search_not_found($keywords) - { - $this->markTestIncomplete('Native search when fails doesn\'t show the search query'); - } } diff --git a/tests/functional/search/postgres_test.php b/tests/functional/search/postgres_test.php index 487b8aeebb..a76cc13493 100644 --- a/tests/functional/search/postgres_test.php +++ b/tests/functional/search/postgres_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,8 +20,4 @@ class phpbb_functional_search_postgres_test extends phpbb_functional_search_base { protected $search_backend = '\phpbb\search\fulltext_postgres'; - protected function assert_search_not_found($keywords) - { - $this->markTestIncomplete('Postgres search when fails doesn\'t show the search query'); - } } diff --git a/tests/functional/search/sphinx_test.php b/tests/functional/search/sphinx_test.php index ef2522f9ed..4bf1ab0e16 100644 --- a/tests/functional/search/sphinx_test.php +++ b/tests/functional/search/sphinx_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/softdelete_test.php b/tests/functional/softdelete_test.php deleted file mode 100644 index bd4d34cf99..0000000000 --- a/tests/functional/softdelete_test.php +++ /dev/null @@ -1,761 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @group functional -*/ -class phpbb_functional_softdelete_test extends phpbb_functional_test_case -{ - protected $data = array(); - - public function test_setup_forums() - { - $this->login(); - $this->admin_login(); - - $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); - $form = $crawler->selectButton('addforum')->form(array( - 'forum_name' => 'Soft Delete #1', - )); - $crawler = self::submit($form); - $form = $crawler->selectButton('update')->form(array( - 'forum_perm_from' => 2, - )); - $crawler = self::submit($form); - - $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); - $form = $crawler->selectButton('addforum')->form(array( - 'forum_name' => 'Soft Delete #2', - )); - $crawler = self::submit($form); - $form = $crawler->selectButton('update')->form(array( - 'forum_perm_from' => 2, - )); - $crawler = self::submit($form); - } - - public function test_create_post() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'initial comparison'); - - // Test creating topic - $post = $this->create_topic($this->data['forums']['Soft Delete #1'], 'Soft Delete Topic #1', 'This is a test topic posted by the testing framework.'); - $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); - - $this->assertContains('Soft Delete Topic #1', $crawler->filter('html')->text()); - $this->data['topics']['Soft Delete Topic #1'] = (int) $post['topic_id']; - $this->data['posts']['Soft Delete Topic #1'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after creating topic #1'); - - // Test creating a reply - $post2 = $this->create_post($this->data['forums']['Soft Delete #1'], $post['topic_id'], 'Re: Soft Delete Topic #1-#2', 'This is a test post posted by the testing framework.'); - $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); - - $this->assertContains('Re: Soft Delete Topic #1-#2', $crawler->filter('html')->text()); - $this->data['posts']['Re: Soft Delete Topic #1-#2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->eq(1)->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 2, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'], - ), 'after replying'); - } - - public function test_softdelete_post() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 2, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'], - ), 'before softdelete'); - - $this->add_lang('posting'); - $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#2']}&sid={$this->sid}"); - $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); - - $form = $crawler->selectButton('Yes')->form(); - $crawler = self::submit($form); - $this->assertContainsLang('POST_DELETED', $crawler->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after softdelete'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text()); - } - - public function test_move_softdeleted_post() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'before moving #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'before moving #2'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - - $form = $crawler->selectButton('Go')->eq(2)->form(); - $form['action']->select('move'); - $crawler = self::submit($form); - $this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text()); - - $this->add_lang('mcp'); - $form = $crawler->selectButton('Yes')->form(); - $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']); - $crawler = self::submit($form); - $this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text()); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text()); - $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'after moving #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after moving #2'); - } - - public function test_softdelete_topic() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'before softdeleting #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'before softdeleting #2'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - - $this->add_lang('posting'); - $form = $crawler->selectButton('Go')->eq(2)->form(); - $form['action']->select('delete_topic'); - $crawler = self::submit($form); - $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); - - $this->add_lang('mcp'); - $form = $crawler->selectButton('Yes')->form(); - $crawler = self::submit($form); - $this->assertContainsLang('TOPIC_DELETED_SUCCESS', $crawler->text()); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text()); - $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'after moving #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 2, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 1, - 'forum_last_post_id' => 0, - ), 'after moving #2'); - } - - public function test_move_softdeleted_topic() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'before moving #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 2, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 1, - 'forum_last_post_id' => 0, - ), 'before moving #2'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - - $form = $crawler->selectButton('Go')->eq(2)->form(); - $form['action']->select('move'); - $crawler = self::submit($form); - $this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text()); - - $this->add_lang('mcp'); - $form = $crawler->selectButton('Yes')->form(); - $form['to_forum_id']->select($this->data['forums']['Soft Delete #1']); - $crawler = self::submit($form); - $this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text()); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text()); - $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 2, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 1, - 'forum_last_post_id' => 0, - ), 'after moving #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'after moving #2'); - } - - public function test_restore_post() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 2, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 1, - 'forum_last_post_id' => 0, - ), 'before restoring #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'before restoring #2'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - - $this->add_lang('mcp'); - $form = $crawler->selectButton($this->lang('RESTORE'))->form(); - $crawler = self::submit($form); - $this->assertContainsLang('RESTORE_POST', $crawler->text()); - - $form = $crawler->selectButton('Yes')->form(); - $crawler = self::submit($form); - $this->assertContainsLang('POST_RESTORED_SUCCESS', $crawler->text()); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text()); - $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after restoring #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'after restoring #2'); - } - - public function test_split_topic() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'before splitting #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'before splitting #2'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - - $this->add_lang('mcp'); - $form = $crawler->selectButton('Go')->eq(2)->form(); - $form['action']->select('split'); - $crawler = self::submit($form); - $this->assertContainsLang('SPLIT_TOPIC_EXPLAIN', $crawler->text()); - - $form = $crawler->selectButton('Submit')->form(array( - 'subject' => 'Soft Delete Topic #2', - )); - $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']); - $form['post_id_list'][1]->tick(); - $crawler = self::submit($form); - - $form = $crawler->selectButton('Yes')->form(); - $crawler = self::submit($form); - $this->assertContainsLang('TOPIC_SPLIT_SUCCESS', $crawler->text()); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - $this->assertNotContains('Re: Soft Delete Topic #1-#2', $crawler->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after restoring #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 1, - 'forum_last_post_id' => 0, - ), 'after restoring #2'); - } - - public function test_move_topic_back() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - 'Soft Delete Topic #2', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}"); - - $form = $crawler->selectButton('Go')->eq(1)->form(); - $form['action']->select('move'); - $crawler = self::submit($form); - - $form = $crawler->selectButton('Yes')->form(); - $form['to_forum_id']->select($this->data['forums']['Soft Delete #1']); - $crawler = self::submit($form); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 1, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after moving back'); - } - - public function test_merge_topics() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - 'Soft Delete Topic #2', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 1, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'before merging #1'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}"); - - $this->add_lang('mcp'); - $form = $crawler->selectButton('Go')->eq(1)->form(); - $form['action']->select('merge_topic'); - $crawler = self::submit($form); - $this->assertContainsLang('SELECT_MERGE', $crawler->text()); - - $crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Soft Delete #1']}&t={$this->data['topics']['Soft Delete Topic #2']}&i=main&mode=forum_view&action=merge_topic&to_topic_id={$this->data['topics']['Soft Delete Topic #1']}"); - $this->assertContainsLang('MERGE_TOPICS_CONFIRM', $crawler->text()); - - $form = $crawler->selectButton('Yes')->form(); - $crawler = self::submit($form); - $this->assertContainsLang('POSTS_MERGED_SUCCESS', $crawler->text()); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); - $this->assertContainsLang('POST_DELETED', $crawler->filter('body')->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after merging #1'); - } - - public function test_fork_topic() - { - $this->login(); - $this->load_ids(array( - 'forums' => array( - 'Soft Delete #1', - 'Soft Delete #2', - ), - 'topics' => array( - 'Soft Delete Topic #1', - ), - 'posts' => array( - 'Soft Delete Topic #1', - 'Re: Soft Delete Topic #1-#2', - ), - )); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'before forking #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => 0, - ), 'before forking #2'); - - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - - $this->add_lang('mcp'); - $form = $crawler->selectButton('Go')->eq(2)->form(); - $form['action']->select('fork'); - $crawler = self::submit($form); - $this->assertContainsLang('FORK_TOPIC', $crawler->text()); - - $form = $crawler->selectButton('Yes')->form(); - $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']); - $crawler = self::submit($form); - $this->assertContainsLang('TOPIC_FORKED_SUCCESS', $crawler->text()); - - $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], - ), 'after forking #1'); - - $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( - 'forum_posts_approved' => 1, - 'forum_posts_unapproved' => 0, - 'forum_posts_softdeleted' => 1, - 'forum_topics_approved' => 1, - 'forum_topics_unapproved' => 0, - 'forum_topics_softdeleted' => 0, - 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'] + 2, - ), 'after forking #2'); - } - - public function assert_forum_details($forum_id, $details, $additional_error_message = '') - { - $this->db = $this->get_db(); - - $sql = 'SELECT ' . implode(', ', array_keys($details)) . ' - FROM phpbb_forums - WHERE forum_id = ' . (int) $forum_id; - $result = $this->db->sql_query($sql); - $data = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - $this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}"); - } - - public function load_ids($data) - { - $this->db = $this->get_db(); - - if (!empty($data['forums'])) - { - $sql = 'SELECT * - FROM phpbb_forums - WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if (in_array($row['forum_name'], $data['forums'])) - { - $this->data['forums'][$row['forum_name']] = (int) $row['forum_id']; - } - } - $this->db->sql_freeresult($result); - } - - if (!empty($data['topics'])) - { - $sql = 'SELECT * - FROM phpbb_topics - WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if (in_array($row['topic_title'], $data['topics'])) - { - $this->data['topics'][$row['topic_title']] = (int) $row['topic_id']; - } - } - $this->db->sql_freeresult($result); - } - - if (!empty($data['posts'])) - { - $sql = 'SELECT * - FROM phpbb_posts - WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - if (in_array($row['post_subject'], $data['posts'])) - { - $this->data['posts'][$row['post_subject']] = (int) $row['post_id']; - } - } - $this->db->sql_freeresult($result); - } - } -} diff --git a/tests/functional/ucp_allow_pm_test.php b/tests/functional/ucp_allow_pm_test.php new file mode 100644 index 0000000000..2d41296ddf --- /dev/null +++ b/tests/functional/ucp_allow_pm_test.php @@ -0,0 +1,74 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_ucp_allow_pm_test extends phpbb_functional_test_case +{ + static protected $data = array(); + + public function __construct() + { + parent::__construct(); + + $this->backupStaticAttributesBlacklist += array( + 'phpbb_functional_ucp_allow_pm_test' => array('data'), + ); + } + + // user A sends a PM to user B where B accepts PM + public function test_enabled_pm_user_to_user() + { + // setup + $this->create_user('test_ucp_allow_pm_sender'); + $this->login('test_ucp_allow_pm_sender'); + self::$data['recipient_id'] = $this->create_user('test_ucp_allow_pm_recipient'); + self::$data['pm_url'] = "ucp.php?i=pm&mode=compose&u=" . (int) self::$data['recipient_id'] . "&sid={$this->sid}"; + + // the actual test + $this->set_user_allow_pm(self::$data['recipient_id'], 1); + $crawler = self::request('GET', self::$data['pm_url']); + $this->assertNotContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('html')->text()); + } + + // user A sends a PM to user B where B does not accept PM + public function test_disabled_pm_user_to_user() + { + $this->login('test_ucp_allow_pm_sender'); + $this->set_user_allow_pm(self::$data['recipient_id'], 0); + $crawler = self::request('GET', self::$data['pm_url']); + $this->assertContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('.error')->text()); + } + + + // An admin sends a PM to user B where B does not accept PM, but cannot + // ignore a PM from an admin + public function test_disabled_pm_admin_to_user() + { + $this->login(); + $crawler = self::request('GET', self::$data['pm_url']); + $this->assertNotContainsLang('PM_USERS_REMOVED_NO_PM', $crawler->filter('html')->text()); + } + + // enable or disable PM for a user, like from ucp + protected function set_user_allow_pm($user_id, $allow) + { + $db = $this->get_db(); + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_allow_pm = " . $allow . " + WHERE user_id = " . $user_id; + $result = $db->sql_query($sql); + $db->sql_freeresult($result); + } +} diff --git a/tests/functional/ucp_groups_test.php b/tests/functional/ucp_groups_test.php index f48c793ea1..cd18a0fcae 100644 --- a/tests/functional/ucp_groups_test.php +++ b/tests/functional/ucp_groups_test.php @@ -1,18 +1,22 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -require_once dirname(__FILE__) . '/common_groups_test.php'; +require_once dirname(__FILE__) . '/common_groups_test_case.php'; /** * @group functional */ -class phpbb_functional_ucp_groups_test extends phpbb_functional_common_groups_test +class phpbb_functional_ucp_groups_test extends phpbb_functional_common_groups_test_case { protected $db; diff --git a/tests/functional/ucp_pm_test.php b/tests/functional/ucp_pm_test.php new file mode 100644 index 0000000000..ddd5c8d791 --- /dev/null +++ b/tests/functional/ucp_pm_test.php @@ -0,0 +1,52 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_ucp_pm_test extends phpbb_functional_test_case +{ + public function setUp() + { + parent::setUp(); + $this->login(); + $this->admin_login(); + } + + public function test_pm_enabled() + { + $crawler = self::request('GET', 'ucp.php'); + $this->assertContainsLang('PRIVATE_MESSAGES', $crawler->filter('html')->text()); + } + + public function test_pm_disabled() + { + $this->set_allow_pm(0); + $crawler = self::request('GET', 'ucp.php'); + $this->assertNotContainsLang('PRIVATE_MESSAGES', $crawler->filter('html')->text()); + $this->set_allow_pm(1); + } + + protected function set_allow_pm($enable_pm) + { + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=message'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values["config[allow_privmsg]"] = $enable_pm; + $form->setValues($values); + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + } +} diff --git a/tests/functional/ucp_preferences_test.php b/tests/functional/ucp_preferences_test.php new file mode 100644 index 0000000000..7ef325dc4b --- /dev/null +++ b/tests/functional/ucp_preferences_test.php @@ -0,0 +1,85 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_ucp_preferences_test extends phpbb_functional_test_case +{ + public function test_submitting_preferences_view() + { + $this->add_lang('ucp'); + $this->login(); + + $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view'); + $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text()); + + $form = $crawler->selectButton('Submit')->form(array( + 'topic_sk' => 'a', + 'topic_sd' => 'a', + 'topic_st' => '1', + 'post_sk' => 'a', + 'post_sd' => 'a', + 'post_st' => '1', + )); + + $crawler = self::submit($form); + $this->assertContainsLang('PREFERENCES_UPDATED', $crawler->filter('#message')->text()); + } + + public function test_submitting_invalid_preferences_view() + { + $this->add_lang('ucp'); + $this->login(); + + $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view'); + $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text()); + $form = $crawler->selectButton('Submit')->form(); + + if (!method_exists($form, 'disableValidation')) + { + $this->markTestIncomplete('The crawler cannot select invalid values, until Symfony 2.4!'); + } + + $form = $form->disableValidation(); + $form['topic_sk']->select('z'); + $form['topic_sd']->select('z'); + $form['topic_st']->select('test'); + $form['post_sk']->select('z'); + $form['post_sd']->select('z'); + $form['post_st']->select('test'); + + $crawler = self::submit($form); + $this->assertContainsLang('WRONG_DATA_POST_SD', $crawler->filter('#cp-main')->text()); + $this->assertContainsLang('WRONG_DATA_POST_SK', $crawler->filter('#cp-main')->text()); + $this->assertContainsLang('WRONG_DATA_TOPIC_SD', $crawler->filter('#cp-main')->text()); + $this->assertContainsLang('WRONG_DATA_TOPIC_SK', $crawler->filter('#cp-main')->text()); + } + + public function test_read_preferences_view() + { + $this->add_lang('ucp'); + $this->login(); + + $crawler = self::request('GET', 'ucp.php?i=ucp_prefs&mode=view'); + $this->assertContainsLang('UCP_PREFS_VIEW', $crawler->filter('#cp-main h2')->text()); + $form = $crawler->selectButton('Submit')->form(); + + $this->assertEquals('a', $form->get('topic_sk')->getValue()); + $this->assertEquals('a', $form->get('topic_sd')->getValue()); + $this->assertEquals('1', $form->get('topic_st')->getValue()); + $this->assertEquals('a', $form->get('post_sk')->getValue()); + $this->assertEquals('a', $form->get('post_sd')->getValue()); + $this->assertEquals('1', $form->get('post_st')->getValue()); + } +} diff --git a/tests/functional/ucp_profile_test.php b/tests/functional/ucp_profile_test.php new file mode 100644 index 0000000000..e7abba9255 --- /dev/null +++ b/tests/functional/ucp_profile_test.php @@ -0,0 +1,49 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case +{ + public function test_submitting_profile_info() + { + $this->add_lang('ucp'); + $this->login(); + + $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info'); + $this->assertContainsLang('UCP_PROFILE_PROFILE_INFO', $crawler->filter('#cp-main h2')->text()); + + $form = $crawler->selectButton('Submit')->form(array( + 'pf_phpbb_facebook' => 'phpbb', + 'pf_phpbb_googleplus' => 'phpbb', + 'pf_phpbb_location' => 'Bertie´s Empire', + 'pf_phpbb_skype' => 'phpbb.skype.account', + 'pf_phpbb_twitter' => 'phpbb_twitter', + 'pf_phpbb_youtube' => 'phpbb.youtube', + )); + + $crawler = self::submit($form); + $this->assertContainsLang('PROFILE_UPDATED', $crawler->filter('#message')->text()); + + $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info'); + $form = $crawler->selectButton('Submit')->form(); + + $this->assertEquals('phpbb', $form->get('pf_phpbb_facebook')->getValue()); + $this->assertEquals('phpbb', $form->get('pf_phpbb_googleplus')->getValue()); + $this->assertEquals('Bertie´s Empire', $form->get('pf_phpbb_location')->getValue()); + $this->assertEquals('phpbb.skype.account', $form->get('pf_phpbb_skype')->getValue()); + $this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue()); + $this->assertEquals('phpbb.youtube', $form->get('pf_phpbb_youtube')->getValue()); + } +} diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php index 65222c1aa6..f9406f0eb5 100644 --- a/tests/functional/user_password_reset_test.php +++ b/tests/functional/user_password_reset_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functional/viewforum_paging_test.php b/tests/functional/viewforum_paging_test.php new file mode 100644 index 0000000000..4a574bebbb --- /dev/null +++ b/tests/functional/viewforum_paging_test.php @@ -0,0 +1,256 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class viewforum_paging_test extends phpbb_functional_test_case +{ + protected $data = array(); + + public function test_setup_forums() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Viewforum Pagination Test #1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + self::submit($form); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Viewforum Pagination Test #2', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + self::submit($form); + + $this->set_post_settings(array( + 'flood_interval' => 0, + 'topics_per_page' => 3, + )); + } + + public function test_create_posts() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Viewforum Pagination Test #1', + 'Viewforum Pagination Test #2', + ), + )); + + $this->assert_forum_details($this->data['forums']['Viewforum Pagination Test #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'initial comparison'); + + for ($topic_id = 1; $topic_id <= 6; $topic_id++) + { + $this->create_topic($this->data['forums']['Viewforum Pagination Test #1'], 'Viewforum Pagination TestTopic #' . $topic_id, 'This is a test topic posted by the testing framework.'); + } + + $this->create_topic($this->data['forums']['Viewforum Pagination Test #2'], 'Viewforum Pagination TestTopic #GA1', 'This is a test topic posted by the testing framework.', array( + 'topic_type' => POST_GLOBAL, + )); + + $this->assert_forum_details($this->data['forums']['Viewforum Pagination Test #1'], array( + 'forum_posts_approved' => 6, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 6, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + ), 'after creating topics'); + + $this->assert_forum_details($this->data['forums']['Viewforum Pagination Test #2'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + ), 'after creating GA'); + + // Set flood interval back to 15 + $this->admin_login(); + $this->set_post_settings(array( + 'flood_interval' => 15, + )); + } + + public function test_viewforum_first_page() + { + $this->load_ids(array( + 'forums' => array( + 'Viewforum Pagination Test #1', + 'Viewforum Pagination Test #2', + ), + )); + $crawler = self::request('GET', 'viewforum.php?f=' . $this->data['forums']['Viewforum Pagination Test #1']); + + // Test the topics that are displayed + $topiclists = $crawler->filter('.forumbg .topics'); + $this->assertEquals(2, $topiclists->count()); + $topiclist = $topiclists->eq(0)->filter('li'); + $this->assertStringEndsWith('TestTopic #GA1', $topiclist->eq(0)->filter('.topictitle')->text()); + $topiclist = $topiclists->eq(1)->filter('li'); + $this->assertStringEndsWith('TestTopic #6', $topiclist->eq(0)->filter('.topictitle')->text()); + $this->assertStringEndsWith('TestTopic #5', $topiclist->eq(1)->filter('.topictitle')->text()); + $this->assertStringEndsWith('TestTopic #4', $topiclist->eq(2)->filter('.topictitle')->text()); + + // Test the pagination, should only have: 1 - 2 - Next + $this->assertEquals(2, $crawler->filter('div.pagination')->count()); + $top_pagination = $crawler->filter('div.pagination')->eq(0); + $this->assertEquals(3, $top_pagination->filter('li')->count(), 'Number of pagination items on page 1 does not match'); + $this->assertContains('1', $top_pagination->filter('li')->eq(0)->text()); + $this->assertContains('2', $top_pagination->filter('li')->eq(1)->text()); + $this->assertContainsLang('NEXT', $top_pagination->filter('li')->eq(2)->text()); + } + + public function test_viewforum_second_page() + { + $this->load_ids(array( + 'forums' => array( + 'Viewforum Pagination Test #1', + 'Viewforum Pagination Test #2', + ), + )); + $crawler = self::request('GET', 'viewforum.php?f=' . $this->data['forums']['Viewforum Pagination Test #1'] . '&start=3'); + + // Test the topics that are displayed + $topiclists = $crawler->filter('.forumbg .topics'); + $this->assertEquals(2, $topiclists->count()); + $topiclist = $topiclists->eq(0)->filter('li'); + $this->assertStringEndsWith('TestTopic #GA1', $topiclist->eq(0)->filter('.topictitle')->text()); + $topiclist = $topiclists->eq(1)->filter('li'); + $this->assertStringEndsWith('TestTopic #3', $topiclist->eq(0)->filter('.topictitle')->text()); + $this->assertStringEndsWith('TestTopic #2', $topiclist->eq(1)->filter('.topictitle')->text()); + $this->assertStringEndsWith('TestTopic #1', $topiclist->eq(2)->filter('.topictitle')->text()); + + // Test the pagination, should only have: Previous - 1 - 2 + $this->assertEquals(2, $crawler->filter('div.pagination')->count()); + $top_pagination = $crawler->filter('div.pagination')->eq(0); + $this->assertEquals(3, $top_pagination->filter('li')->count(), 'Number of pagination items on page 2 does not match'); + $this->assertContainsLang('PREVIOUS', $top_pagination->filter('li')->eq(0)->text()); + $this->assertContains('1', $top_pagination->filter('li')->eq(1)->text()); + $this->assertContains('2', $top_pagination->filter('li')->eq(2)->text()); + } + + protected function assert_forum_details($forum_id, $details, $additional_error_message = '') + { + $this->db = $this->get_db(); + + $sql = 'SELECT ' . implode(', ', array_keys($details)) . ' + FROM phpbb_forums + WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}"); + } + + /** + * Sets the post setting via the ACP page + * + * @param array $settings + */ + protected function set_post_settings($settings) + { + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + foreach ($settings as $setting => $value) + { + $values["config[{$setting}]"] = $value; + } + $form->setValues($values); + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + } + + /** + * Loads forum, topic and post IDs + * + * @param array $data + */ + protected function load_ids($data) + { + $this->db = $this->get_db(); + + if (!empty($data['forums'])) + { + $sql = 'SELECT * + FROM phpbb_forums + WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['forum_name'], $data['forums'])) + { + $this->data['forums'][$row['forum_name']] = (int) $row['forum_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['topics'])) + { + $sql = 'SELECT * + FROM phpbb_topics + WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['topic_title'], $data['topics'])) + { + $this->data['topics'][$row['topic_title']] = (int) $row['topic_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['posts'])) + { + $sql = 'SELECT * + FROM phpbb_posts + WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['post_subject'], $data['posts'])) + { + $this->data['posts'][$row['post_subject']] = (int) $row['post_id']; + } + } + $this->db->sql_freeresult($result); + } + } +} diff --git a/tests/functional/visibility_disapprove_test.php b/tests/functional/visibility_disapprove_test.php new file mode 100644 index 0000000000..6f6edba422 --- /dev/null +++ b/tests/functional/visibility_disapprove_test.php @@ -0,0 +1,323 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_visibility_disapprove_test extends phpbb_functional_test_case +{ + protected $data = array(); + + public function test_setup_forums() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Disapprove Test #1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + + // Set flood interval to 0 + $this->set_flood_interval(0); + } + + public function test_create_posts() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Disapprove Test #1', + ), + )); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'initial comparison'); + + // Test creating topic #1 + $post = $this->create_topic($this->data['forums']['Disapprove Test #1'], 'Disapprove Test Topic #1', 'This is a test topic posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Disapprove Test Topic #1', $crawler->filter('html')->text()); + $this->data['topics']['Disapprove Test Topic #1'] = (int) $post['topic_id']; + $this->data['posts']['Disapprove Test Topic #1'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Disapprove Test Topic #1'], + ), 'after creating topic #1'); + + $this->logout(); + $this->create_user('disapprove_testuser'); + $this->add_user_group('NEWLY_REGISTERED', array('disapprove_testuser')); + $this->login('disapprove_testuser'); + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Disapprove Test #1'], $post['topic_id'], 'Re: Disapprove Test Topic #1-#2', 'This is a test post posted by the testing framework.', array(), 'POST_STORED_MOD'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Disapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertNotContains('Re: Disapprove Test Topic #1-#2', $crawler->filter('html')->text()); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 1, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Disapprove Test Topic #1'], + ), 'after replying'); + + // Test creating topic #2 + $post = $this->create_topic($this->data['forums']['Disapprove Test #1'], 'Disapprove Test Topic #2', 'This is a test topic posted by the testing framework.', array(), 'POST_STORED_MOD'); + $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Disapprove Test #1']}&sid={$this->sid}"); + + $this->assertNotContains('Disapprove Test Topic #2', $crawler->filter('html')->text()); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 2, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Disapprove Test Topic #1'], + ), 'after creating topic #2'); + + $this->logout(); + } + + public function test_reset_flood_interval() + { + $this->login(); + $this->admin_login(); + + // Set flood interval back to 15 + $this->set_flood_interval(15); + } + + public function test_disapprove_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Disapprove Test #1', + ), + 'topics' => array( + 'Disapprove Test Topic #1', + 'Disapprove Test Topic #2', + ), + 'posts' => array( + 'Disapprove Test Topic #1', + 'Re: Disapprove Test Topic #1-#2', + 'Disapprove Test Topic #2', + ), + )); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 2, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Disapprove Test Topic #1'], + ), 'before disapproving post'); + + $this->add_lang('posting'); + $this->add_lang('viewtopic'); + $this->add_lang('mcp'); + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Disapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertContains('Disapprove Test Topic #1', $crawler->filter('html')->text()); + $this->assertContains('Re: Disapprove Test Topic #1-#2', $crawler->filter('html')->text()); + + $form = $crawler->selectButton($this->lang('DISAPPROVE'))->form(); + $crawler = self::submit($form); + $form = $crawler->selectButton($this->lang('YES'))->form(); + $crawler = self::submit($form); + $this->assertContainsLang('POST_DISAPPROVED_SUCCESS', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 1, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Disapprove Test Topic #1'], + ), 'after disapproving post'); + + $link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link(); + $link_url = $link->getUri(); + $this->assertContains('viewtopic.php?f=' . $this->data['forums']['Disapprove Test #1'] . '&t=' . $this->data['topics']['Disapprove Test Topic #1'], $link_url); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Disapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertContains('Disapprove Test Topic #1', $crawler->filter('html')->text()); + $this->assertNotContains('Re: Disapprove Test Topic #1-#2', $crawler->filter('html')->text()); + } + + public function test_disapprove_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Disapprove Test #1', + ), + 'topics' => array( + 'Disapprove Test Topic #1', + 'Disapprove Test Topic #2', + ), + 'posts' => array( + 'Disapprove Test Topic #1', + 'Disapprove Test Topic #2', + ), + )); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 1, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Disapprove Test Topic #1'], + ), 'before disapproving topic'); + + $this->add_lang('posting'); + $this->add_lang('viewtopic'); + $this->add_lang('mcp'); + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Disapprove Test Topic #2']}&sid={$this->sid}"); + $this->assertContains('Disapprove Test Topic #2', $crawler->filter('html')->text()); + + $form = $crawler->selectButton($this->lang('DISAPPROVE'))->form(); + $crawler = self::submit($form); + $form = $crawler->selectButton($this->lang('YES'))->form(); + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_DISAPPROVED_SUCCESS', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Disapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Disapprove Test Topic #1'], + ), 'after disapproving topic'); + + $link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link(); + $link_url = $link->getUri(); + $this->assertContains('viewforum.php?f=' . $this->data['forums']['Disapprove Test #1'], $link_url); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Disapprove Test Topic #2']}&sid={$this->sid}", array(), false); + self::assert_response_html(404); + $this->assertNotContains('Disapprove Test Topic #2', $crawler->filter('html')->text()); + } + + protected function assert_forum_details($forum_id, $details, $additional_error_message = '') + { + $this->db = $this->get_db(); + + $sql = 'SELECT ' . implode(', ', array_keys($details)) . ' + FROM phpbb_forums + WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}"); + } + + protected function set_flood_interval($flood_interval) + { + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values["config[flood_interval]"] = $flood_interval; + $form->setValues($values); + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + } + + protected function load_ids($data) + { + $this->db = $this->get_db(); + + if (!empty($data['forums'])) + { + $sql = 'SELECT * + FROM phpbb_forums + WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['forum_name'], $data['forums'])) + { + $this->data['forums'][$row['forum_name']] = (int) $row['forum_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['topics'])) + { + $sql = 'SELECT * + FROM phpbb_topics + WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['topic_title'], $data['topics'])) + { + $this->data['topics'][$row['topic_title']] = (int) $row['topic_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['posts'])) + { + $sql = 'SELECT * + FROM phpbb_posts + WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['post_subject'], $data['posts'])) + { + $this->data['posts'][$row['post_subject']] = (int) $row['post_id']; + } + } + $this->db->sql_freeresult($result); + } + } +} diff --git a/tests/functional/visibility_reapprove_test.php b/tests/functional/visibility_reapprove_test.php new file mode 100644 index 0000000000..5af2ddafa4 --- /dev/null +++ b/tests/functional/visibility_reapprove_test.php @@ -0,0 +1,419 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_case +{ + protected $data = array(); + + public function test_setup_forums() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Reapprove Test #1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + + // Set flood interval to 0 + $this->set_flood_interval(0); + } + + public function test_create_posts() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Reapprove Test #1', + ), + )); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'initial comparison'); + + // Test creating topic #1 + $post = $this->create_topic($this->data['forums']['Reapprove Test #1'], 'Reapprove Test Topic #1', 'This is a test topic posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Reapprove Test Topic #1', $crawler->filter('h2')->text()); + $this->data['topics']['Reapprove Test Topic #1'] = (int) $post['topic_id']; + $this->data['posts']['Reapprove Test Topic #1'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #1'], + ), 'after creating topic #1'); + + $this->logout(); + $this->create_user('reapprove_testuser'); + $this->add_user_group('NEWLY_REGISTERED', array('reapprove_testuser')); + $this->login('reapprove_testuser'); + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Reapprove Test #1'], $post['topic_id'], 'Re: Reapprove Test Topic #1-#2', 'This is a test post posted by the testing framework.', array(), 'POST_STORED_MOD'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertNotContains('Re: Reapprove Test Topic #1-#2', $crawler->filter('#page-body')->text()); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 1, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #1'], + ), 'after replying'); + + // Test creating topic #2 + $post = $this->create_topic($this->data['forums']['Reapprove Test #1'], 'Reapprove Test Topic #2', 'This is a test topic posted by the testing framework.', array(), 'POST_STORED_MOD'); + $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Reapprove Test #1']}&sid={$this->sid}"); + + $this->assertNotContains('Reapprove Test Topic #2', $crawler->filter('html')->text()); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 2, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #1'], + ), 'after creating topic #2'); + + $this->logout(); + } + + public function test_approve_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Reapprove Test #1', + ), + 'topics' => array( + 'Reapprove Test Topic #1', + 'Reapprove Test Topic #2', + ), + 'posts' => array( + 'Reapprove Test Topic #1', + 'Re: Reapprove Test Topic #1-#2', + 'Reapprove Test Topic #2', + ), + )); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 2, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #1'], + ), 'before approving post'); + + $this->add_lang('posting'); + $this->add_lang('viewtopic'); + $this->add_lang('mcp'); + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertContains('Reapprove Test Topic #1', $crawler->filter('h2')->text()); + $this->assertContains('Re: Reapprove Test Topic #1-#2', $crawler->filter('#page-body')->text()); + + $form = $crawler->selectButton($this->lang('APPROVE'))->form(); + $crawler = self::submit($form); + $form = $crawler->selectButton($this->lang('YES'))->form(); + $crawler = self::submit($form); + $this->assertContainsLang('POST_APPROVED_SUCCESS', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 2, + 'forum_posts_unapproved' => 1, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Reapprove Test Topic #1-#2'], + ), 'after approving post'); + + $link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link(); + $link_url = $link->getUri(); + $this->assertContains('viewtopic.php?f=' . $this->data['forums']['Reapprove Test #1'] . '&t=' . $this->data['topics']['Reapprove Test Topic #1'], $link_url); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertContains('Reapprove Test Topic #1', $crawler->filter('h2')->text()); + $this->assertContains('Re: Reapprove Test Topic #1-#2', $crawler->filter('#page-body')->text()); + } + + public function test_approve_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Reapprove Test #1', + ), + 'topics' => array( + 'Reapprove Test Topic #1', + 'Reapprove Test Topic #2', + ), + 'posts' => array( + 'Reapprove Test Topic #1', + 'Re: Reapprove Test Topic #1-#2', + 'Reapprove Test Topic #2', + ), + )); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 2, + 'forum_posts_unapproved' => 1, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Reapprove Test Topic #1-#2'], + ), 'before approving topic'); + + $this->add_lang('posting'); + $this->add_lang('viewtopic'); + $this->add_lang('mcp'); + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #2']}&sid={$this->sid}"); + $this->assertContains('Reapprove Test Topic #2', $crawler->filter('h2')->text()); + + $form = $crawler->selectButton($this->lang('APPROVE'))->form(); + $crawler = self::submit($form); + $form = $crawler->selectButton($this->lang('YES'))->form(); + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_APPROVED_SUCCESS', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 3, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 2, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #2'], + ), 'after approving topic'); + + $link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link(); + $link_url = $link->getUri(); + $this->assertContains('viewtopic.php?f=' . $this->data['topic']['Reapprove Test Topic #2'], $link_url); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #2']}&sid={$this->sid}"); + $this->assertContains('Reapprove Test Topic #2', $crawler->filter('h2')->text()); + } + + public function test_edit_posts() + { + $this->load_ids(array( + 'forums' => array( + 'Reapprove Test #1', + ), + 'topics' => array( + 'Reapprove Test Topic #1', + 'Reapprove Test Topic #2', + ), + 'posts' => array( + 'Reapprove Test Topic #1', + 'Re: Reapprove Test Topic #1-#2', + 'Reapprove Test Topic #2', + ), + )); + $this->add_lang('posting'); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 3, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 2, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #2'], + ), 'before editing post'); + + $this->login('reapprove_testuser'); + $this->add_user_group('NEWLY_REGISTERED', array('reapprove_testuser')); + + // Test editing a post + $posting_url = "posting.php?mode=edit&f={$this->data['forums']['Reapprove Test #1']}&p={$this->data['posts']['Re: Reapprove Test Topic #1-#2']}&sid={$this->sid}"; + $form_data = array( + 'message' => 'Post edited by testing framework', + 'subject' => 'Re: Reapprove Test Topic #1-#2', + 'post' => true, + ); + $this->submit_post($posting_url, 'EDIT_POST', $form_data, 'POST_EDITED_MOD'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertNotContains('Re: Reapprove Test Topic #1-#2', $crawler->filter('#page-body')->text()); + $this->assertNotContains('Post edited by testing framework', $crawler->filter('#page-body')->text()); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 2, + 'forum_posts_unapproved' => 1, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 2, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #2'], + ), 'after editing post'); + + // Test editing a topic + $posting_url = "posting.php?mode=edit&f={$this->data['forums']['Reapprove Test #1']}&p={$this->data['posts']['Reapprove Test Topic #2']}&sid={$this->sid}"; + $form_data = array( + 'message' => 'Post edited by testing framework', + 'subject' => 'Reapprove Test Topic #2', + 'post' => true, + ); + $this->submit_post($posting_url, 'EDIT_POST', $form_data, 'POST_EDITED_MOD'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #2']}&sid={$this->sid}", array(), false); + self::assert_response_html(404); + $this->assertNotContains('Reapprove Test Topic #2', $crawler->filter('#page-body')->text()); + $this->assertNotContains('Post edited by testing framework', $crawler->filter('#page-body')->text()); + + $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 2, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 1, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Reapprove Test Topic #1'], + ), 'after editing topic'); + + $this->logout(); + $this->login(); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #1']}&sid={$this->sid}"); + $this->assertContains('Re: Reapprove Test Topic #1-#2', $crawler->filter('#page-body')->text()); + $this->assertContains('Post edited by testing framework', $crawler->filter('#page-body')->text()); + } + + public function test_approve_post_again() + { + $this->test_approve_post(); + } + + public function test_approve_topic_again() + { + $this->test_approve_topic(); + } + + public function test_reset_flood_interval() + { + $this->login(); + $this->admin_login(); + + // Set flood interval back to 15 + $this->set_flood_interval(15); + } + + protected function assert_forum_details($forum_id, $details, $additional_error_message = '') + { + $this->db = $this->get_db(); + + $sql = 'SELECT ' . implode(', ', array_keys($details)) . ' + FROM phpbb_forums + WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}"); + } + + protected function set_flood_interval($flood_interval) + { + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values["config[flood_interval]"] = $flood_interval; + $form->setValues($values); + $crawler = self::submit($form); + $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); + } + + protected function load_ids($data) + { + $this->db = $this->get_db(); + + if (!empty($data['forums'])) + { + $sql = 'SELECT * + FROM phpbb_forums + WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['forum_name'], $data['forums'])) + { + $this->data['forums'][$row['forum_name']] = (int) $row['forum_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['topics'])) + { + $sql = 'SELECT * + FROM phpbb_topics + WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['topic_title'], $data['topics'])) + { + $this->data['topics'][$row['topic_title']] = (int) $row['topic_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['posts'])) + { + $sql = 'SELECT * + FROM phpbb_posts + WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['post_subject'], $data['posts'])) + { + $this->data['posts'][$row['post_subject']] = (int) $row['post_id']; + } + } + $this->db->sql_freeresult($result); + } + } +} diff --git a/tests/functional/visibility_softdelete_test.php b/tests/functional/visibility_softdelete_test.php new file mode 100644 index 0000000000..39efc99a35 --- /dev/null +++ b/tests/functional/visibility_softdelete_test.php @@ -0,0 +1,836 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_case +{ + protected $data = array(); + + public function test_setup_forums() + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Soft Delete #1', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + + $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}"); + $form = $crawler->selectButton('addforum')->form(array( + 'forum_name' => 'Soft Delete #2', + )); + $crawler = self::submit($form); + $form = $crawler->selectButton('update')->form(array( + 'forum_perm_from' => 2, + )); + $crawler = self::submit($form); + + // Create second user which does not have m_delete permission + $this->add_lang('acp/permissions'); + + $second_user = $this->create_user('no m_delete moderator'); + $this->add_user_group("GLOBAL_MODERATORS", 'no m_delete moderator', true); + + // Set m_delete to never + $crawler = self::request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=setting_user_global&user_id[0]=$second_user&type=m_&sid={$this->sid}"); + $form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form(); + $data = array("setting[$second_user][0][m_delete]" => ACL_NEVER); + $form->setValues($data); + $crawler = self::submit($form); + } + + public function test_create_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'initial comparison'); + + // Test creating topic + $post = $this->create_topic($this->data['forums']['Soft Delete #1'], 'Soft Delete Topic #1', 'This is a test topic posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Soft Delete Topic #1', $crawler->filter('html')->text()); + $this->data['topics']['Soft Delete Topic #1'] = (int) $post['topic_id']; + $this->data['posts']['Soft Delete Topic #1'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after creating topic #1'); + + // Test creating a reply + $post2 = $this->create_post($this->data['forums']['Soft Delete #1'], $post['topic_id'], 'Re: Soft Delete Topic #1-#2', 'This is a test post posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Re: Soft Delete Topic #1-#2', $crawler->filter('html')->text()); + $this->data['posts']['Re: Soft Delete Topic #1-#2'] = (int) $post2['post_id']; + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 2, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'], + ), 'after replying'); + + // Test creating another reply + $post3 = $this->create_post($this->data['forums']['Soft Delete #1'], $post['topic_id'], 'Re: Soft Delete Topic #1-#3', 'This is another test post posted by the testing framework.'); + $crawler = self::request('GET', "viewtopic.php?t={$post3['topic_id']}&sid={$this->sid}"); + + $this->assertContains('Re: Soft Delete Topic #1-#3', $crawler->filter('html')->text()); + $this->data['posts']['Re: Soft Delete Topic #1-#3'] = (int) $post3['post_id']; + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 3, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#3'], + ), 'after replying a second time'); + } + + public function test_softdelete_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3', + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 3, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#3'], + ), 'before softdelete'); + + $this->add_lang('posting'); + $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#3']}&sid={$this->sid}"); + $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContainsLang('POST_DELETED', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 2, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 1, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'], + ), 'after softdelete'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + } + + public function test_softdelete_post_no_m_delete() + { + $this->login('no m_delete moderator'); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3', + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 2, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 1, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'], + ), 'before softdelete without m_delete'); + + $this->add_lang('posting'); + $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#2']}&sid={$this->sid}"); + $this->assertNotContainsLang('DELETE_PERMANENTLY', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContainsLang('POST_DELETED', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after softdelete without m_delete'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + } + + public function test_move_softdeleted_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3', + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'before moving #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'before moving #2'); + + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'MOVE_TOPIC'); + $this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton('Yes')->form(); + $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']); + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text()); + $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'after moving #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after moving #2'); + } + + public function test_softdelete_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3' + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'before softdeleting #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'before softdeleting #2'); + + $this->add_lang('posting'); + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'DELETE_TOPIC'); + $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_DELETED_SUCCESS', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text()); + $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'after moving #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 3, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 1, + 'forum_last_post_id' => 0, + ), 'after moving #2'); + } + + public function test_move_softdeleted_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3' + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'before moving #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 3, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 1, + 'forum_last_post_id' => 0, + ), 'before moving #2'); + + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'MOVE_TOPIC'); + $this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton('Yes')->form(); + $form['to_forum_id']->select($this->data['forums']['Soft Delete #1']); + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text()); + $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 3, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 1, + 'forum_last_post_id' => 0, + ), 'after moving #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'after moving #2'); + } + + public function test_restore_post() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3' + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 3, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 1, + 'forum_last_post_id' => 0, + ), 'before restoring #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'before restoring #2'); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + + $this->add_lang('mcp'); + $form = $crawler->filter('#p' . $this->data['posts']['Soft Delete Topic #1'])->selectButton($this->lang('RESTORE'))->form(); + $crawler = self::submit($form); + $this->assertContainsLang('RESTORE_POST', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContainsLang('POST_RESTORED_SUCCESS', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text()); + $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after restoring #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'after restoring #2'); + } + + public function test_split_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3' + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'before splitting #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'before splitting #2'); + + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'SPLIT_TOPIC'); + + $this->add_lang('mcp'); + $this->assertContainsLang('SPLIT_TOPIC_EXPLAIN', $crawler->text()); + + $form = $crawler->selectButton('Submit')->form(array( + 'subject' => 'Soft Delete Topic #2', + )); + $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']); + $form['post_id_list'][1]->tick(); + $crawler = self::submit($form); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_SPLIT_SUCCESS', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); + $this->assertNotContains('Re: Soft Delete Topic #1-#2', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 1, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after restoring #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 1, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 1, + 'forum_last_post_id' => 0, + ), 'after restoring #2'); + } + + public function test_move_topic_back() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + 'Soft Delete Topic #2', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3' + ), + )); + + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MOVE_TOPIC'); + $form = $crawler->selectButton('Yes')->form(); + $form['to_forum_id']->select($this->data['forums']['Soft Delete #1']); + $crawler = self::submit($form); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 1, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after moving back'); + } + + public function test_merge_topics() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + 'Soft Delete Topic #2', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3' + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 1, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'before merging #1'); + + $this->add_lang('viewtopic'); + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}"); + + $bookmark_tag = $crawler->filter('a.bookmark-link'); + $this->assertContainsLang('BOOKMARK_TOPIC', $bookmark_tag->text()); + $bookmark_link = $bookmark_tag->attr('href'); + $crawler_bookmark = self::request('GET', $bookmark_link); + $this->assertContainsLang('BOOKMARK_ADDED', $crawler_bookmark->text()); + + $this->add_lang('mcp'); + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MERGE_TOPIC', $crawler); + $this->assertContainsLang('SELECT_MERGE', $crawler->text()); + + $crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Soft Delete #1']}&t={$this->data['topics']['Soft Delete Topic #2']}&i=main&mode=forum_view&action=merge_topic&to_topic_id={$this->data['topics']['Soft Delete Topic #1']}"); + $this->assertContainsLang('MERGE_TOPICS_CONFIRM', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContainsLang('POSTS_MERGED_SUCCESS', $crawler->text()); + + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); + $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text()); + $this->assertContainsLang('POST_DELETED_ACTION', $crawler->filter('body')->text()); + $this->assertContainsLang('BOOKMARK_TOPIC_REMOVE', $crawler->filter('body')->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after merging #1'); + } + + public function test_fork_topic() + { + $this->login(); + $this->load_ids(array( + 'forums' => array( + 'Soft Delete #1', + 'Soft Delete #2', + ), + 'topics' => array( + 'Soft Delete Topic #1', + ), + 'posts' => array( + 'Soft Delete Topic #1', + 'Re: Soft Delete Topic #1-#2', + 'Re: Soft Delete Topic #1-#3' + ), + )); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'before forking #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => 0, + ), 'before forking #2'); + + $this->add_lang('mcp'); + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'FORK_TOPIC'); + $this->assertContainsLang('FORK_TOPIC', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']); + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_FORKED_SUCCESS', $crawler->text()); + + $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'], + ), 'after forking #1'); + + $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array( + 'forum_posts_approved' => 1, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 2, + 'forum_topics_approved' => 1, + 'forum_topics_unapproved' => 0, + 'forum_topics_softdeleted' => 0, + 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'] + 3, + ), 'after forking #2'); + } + + public function assert_forum_details($forum_id, $details, $additional_error_message = '') + { + $this->db = $this->get_db(); + + $sql = 'SELECT ' . implode(', ', array_keys($details)) . ' + FROM phpbb_forums + WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query($sql); + $data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}"); + } + + public function load_ids($data) + { + $this->db = $this->get_db(); + + if (!empty($data['forums'])) + { + $sql = 'SELECT * + FROM phpbb_forums + WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['forum_name'], $data['forums'])) + { + $this->data['forums'][$row['forum_name']] = (int) $row['forum_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['topics'])) + { + $sql = 'SELECT * + FROM phpbb_topics + WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['topic_title'], $data['topics'])) + { + $this->data['topics'][$row['topic_title']] = (int) $row['topic_id']; + } + } + $this->db->sql_freeresult($result); + } + + if (!empty($data['posts'])) + { + $sql = 'SELECT * + FROM phpbb_posts + WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (in_array($row['post_subject'], $data['posts'])) + { + $this->data['posts'][$row['post_subject']] = (int) $row['post_id']; + } + } + $this->db->sql_freeresult($result); + } + } +} diff --git a/tests/functions/build_hidden_fields_for_query_params_test.php b/tests/functions/build_hidden_fields_for_query_params_test.php index ef2f5744d3..14cb4b9a94 100644 --- a/tests/functions/build_hidden_fields_for_query_params_test.php +++ b/tests/functions/build_hidden_fields_for_query_params_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php new file mode 100644 index 0000000000..3e19b51f02 --- /dev/null +++ b/tests/functions/build_url_test.php @@ -0,0 +1,92 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_build_url_test extends phpbb_test_case +{ + protected function setUp() + { + global $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpbb_path_helper; + + parent::setUp(); + + $phpbb_container = new phpbb_mock_container_builder(); + $user = new phpbb_mock_user(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + + $phpbb_path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new phpbb_mock_request() + ), + new \phpbb\filesystem\filesystem(), + $this->getMock('\phpbb\request\request'), + $phpbb_root_path, + 'php' + ); + $phpbb_container->set('path_helper', $phpbb_path_helper); + } + public function build_url_test_data() + { + return array( + array( + 'index.php', + false, + 'phpBB/index.php?', + ), + array( + 'index.php', + 't', + 'phpBB/index.php?', + ), + array( + 'viewtopic.php?t=5&f=4', + false, + 'phpBB/viewtopic.php?t=5&f=4', + ), + array( + 'viewtopic.php?f=2&style=1&t=6', + 'f', + 'phpBB/viewtopic.php?style=1&t=6', + ), + array( + 'viewtopic.php?f=2&style=1&t=6', + array('f', 'style', 't'), + 'phpBB/viewtopic.php?', + ), + array( + 'http://test.phpbb.com/viewtopic.php?f=2&style=1&t=6', + array('f', 'style', 't'), + 'http://test.phpbb.com/viewtopic.php?', + ), + array( + 'posting.php?f=2&mode=delete&p=20%22%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E', + false, + 'phpBB/posting.php?f=2&mode=delete&p=20%22%3Cscript%3Ealert%281%29%3B%3C%2Fscript%3E', + ) + ); + } + + /** + * @dataProvider build_url_test_data + */ + public function test_build_url($page, $strip_vars, $expected) + { + global $user, $phpbb_root_path; + + $user->page['page'] = $page; + $output = build_url($strip_vars); + + $this->assertEquals($expected, $output); + } +} diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php index 4d210d7b29..729c0a82f0 100644 --- a/tests/functions/convert_30_dbms_to_31_test.php +++ b/tests/functions/convert_30_dbms_to_31_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -14,7 +18,6 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case public function convert_30_dbms_to_31_data() { return array( - array('firebird'), array('mssql'), array('mssql_odbc'), array('mssqlnative'), @@ -33,7 +36,8 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case { $expected = "phpbb\\db\\driver\\$input"; - $output = phpbb_convert_30_dbms_to_31($input); + $config_php_file = new \phpbb\config_php_file('', ''); + $output = $config_php_file->convert_30_dbms_to_31($input); $this->assertEquals($expected, $output); } diff --git a/tests/functions/fixtures/banned_users.xml b/tests/functions/fixtures/banned_users.xml new file mode 100644 index 0000000000..cec3f4e51f --- /dev/null +++ b/tests/functions/fixtures/banned_users.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_banlist"> + <column>ban_userid</column> + <column>ban_exclude</column> + <column>ban_end</column> + <row> + <value>1</value> + <value>1</value> + <value>0</value> + </row> + <row> + <value>2</value> + <value>0</value> + <value>0</value> + </row> + <row> + <value>3</value> + <value>0</value> + <value>0</value> + </row> + <row> + <value>4</value> + <value>0</value> + <value>2</value> + </row> + <row> + <value>5</value> + <value>0</value> + <value>999999999999999999999</value> + </row> + <row> + <value>6</value> + <value>0</value> + <value>3</value> + </row> + </table> +</dataset> diff --git a/tests/functions/fixtures/user_delete.xml b/tests/functions/fixtures/user_delete.xml new file mode 100644 index 0000000000..4c4479d29b --- /dev/null +++ b/tests/functions/fixtures/user_delete.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>username</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>1</value> + <value>anonymous</value> + <value>anonymous</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_oauth_accounts"> + <column>user_id</column> + <column>provider</column> + <column>oauth_provider_id</column> + <row> + <value>2</value> + <value>google</value> + <value>1234567890123456789</value> + </row> + </table> + <table name="phpbb_oauth_tokens"> + <column>user_id</column> + <column>session_id</column> + <column>provider</column> + <column>oauth_token</column> + <row> + <value>2</value> + <value>897a897b797c8789997d7979879</value> + <value>auth.provider.oauth.service.google</value> + <value>{"accessToken":"ya29.YPHwCWVkrvwu1kgbYKiDNYaQ451ZuHy9OEQAGVME8if-WBzR-v7a9ftxbx41kaL)5VLEXB-6qJEvri","endOfLife":1429959670,"extraParams":{"token_type":"Bearer","id_token":"eyJhbGciOiJSUzI1NiIsImupZCI6IjE0YuRjNzc2MDQwYjUyNDZmNTI5OWFkZDVlMmQ1NWNOPTdjMDdlZTAifQ.eyJpc3MiOiJhY2NvdW90cy5nb78nbGUuY29tIiwic3ViIjoiMTExMDMwNwerNjM4MTM5NTQwMTM1IiwiYXpwIjoiOTk3MzUwMTY0NzE0LWhwOXJrYjZpcjM4MW80YjV1NjRpaGtmM29zMnRvbWxhLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZW1haWwiOiJtYXJjLmFsZXhhbmRlci4zN0BnbWFpbC5jb20iLCJhdF9oYXNoIjoiWHk2b1JabnVZUWRfRTZDeDV0RkItdyIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhdWQiOiI5OTczNTAxNjQ3MTQtaHA5cmtiNmlyMzgxbzRiNXU2NGloa2Yzb3MydG9tbGEuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJpYXQiOjE0Mjk5NTYwNzEsImV4cCI6MTQyOTk1OTY3MX0.C5gfSzjqwlRRvVMuTP6jfWIuEHMXn55oYHsSA3eh97n2BZL0TZHhUm4K206Fgucd6ufAphan4l0J7y6tMAHLZPr-kk6KDINxWnPG-up99reblGutay0lRYjMCcrhJAOql8EI1bi84GyliZFYHL67pE0ZtSf-CMb1CeH18TFe-Fk"},"refreshToken":null,"token_class":"OAuth\\\\OAuth2\\\\Token\\\\StdOAuth2Token"}</value> + </row> + </table> +</dataset> diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php new file mode 100644 index 0000000000..bcf0c09fe4 --- /dev/null +++ b/tests/functions/generate_string_list.php @@ -0,0 +1,69 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_generate_string_list_test extends phpbb_test_case +{ + public $user; + + public function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $this->user = $user; + $this->user->data = array('user_lang' => 'en'); + $this->user->add_lang('common'); + } + + public function generate_string_list_data() + { + return array( + array( + array(), + '', + ), + array( + array('A'), + 'A', + ), + array( + array(2 => 'A', 3 => 'B'), + 'A and B', + ), + array( + array('A' => 'A', 'B' => 'B', 'C' => 'C'), + 'A, B, and C', + ), + array( + array('A', 'B', 'C', 'D'), + 'A, B, C, and D', + ) + ); + } + + /** + * @dataProvider generate_string_list_data + */ + public function test_generate_string_list($items, $expected_result) + { + $result = phpbb_generate_string_list($items, $this->user); + $this->assertEquals($expected_result, $result); + } +} diff --git a/tests/functions/get_formatted_filesize_test.php b/tests/functions/get_formatted_filesize_test.php index 96ea2be132..635753d737 100644 --- a/tests/functions/get_formatted_filesize_test.php +++ b/tests/functions/get_formatted_filesize_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/get_preg_expression_test.php b/tests/functions/get_preg_expression_test.php new file mode 100644 index 0000000000..e74017d315 --- /dev/null +++ b/tests/functions/get_preg_expression_test.php @@ -0,0 +1,40 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_functions_get_preg_expression_test extends phpbb_test_case +{ + public function data_path_remove_dot_trailing_slash() + { + return array( + array('./../', '$2', '/..'), + array('/../', '$2', '/..'), + array('', '$2', ''), + array('./', '$2', ''), + array('/', '$2', ''), + array('./../../', '$2', '/../..'), + array('/../../', '$2', '/../..'), + array('./dir/', '$2', '/dir'), + array('./../dir/', '$2', '/../dir'), + ); + } + + /** + * @dataProvider data_path_remove_dot_trailing_slash + */ + public function test_path_remove_dot_trailing_slash($input, $replace, $expected) + { + $this->assertSame($expected, preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), $replace, $input)); + } +} diff --git a/tests/functions/get_remote_file_test.php b/tests/functions/get_remote_file_test.php index 4032ca5b58..781a73a462 100644 --- a/tests/functions/get_remote_file_test.php +++ b/tests/functions/get_remote_file_test.php @@ -1,14 +1,18 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_compatibility.php'; /** * @group slow @@ -17,6 +21,10 @@ class phpbb_functions_get_remote_file extends phpbb_test_case { public function test_version_phpbb_com() { + global $phpbb_container; + $phpbb_container = new phpbb_mock_container_builder(); + $phpbb_container->set('file_downloader', new \phpbb\file_downloader()); + $hostname = 'version.phpbb.com'; if (!phpbb_checkdnsrr($hostname, 'A')) diff --git a/tests/functions/is_absolute_test.php b/tests/functions/is_absolute_test.php deleted file mode 100644 index 6d26793d82..0000000000 --- a/tests/functions/is_absolute_test.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - -class phpbb_functions_is_absolute_test extends phpbb_test_case -{ - static public function is_absolute_data() - { - return array( - // Empty - array('', false), - - // Absolute unix style - array('/etc/phpbb', true), - // Unix does not support \ so that is not an absolute path - array('\etc\phpbb', false), - - // Absolute windows style - array('c:\windows', true), - array('C:\Windows', true), - array('c:/windows', true), - array('C:/Windows', true), - - // Executable - array('etc/phpbb', false), - array('explorer.exe', false), - - // Relative subdir - array('Windows\System32', false), - array('Windows\System32\explorer.exe', false), - array('Windows/System32', false), - array('Windows/System32/explorer.exe', false), - - // Relative updir - array('..\Windows\System32', false), - array('..\Windows\System32\explorer.exe', false), - array('../Windows/System32', false), - array('../Windows/System32/explorer.exe', false), - ); - } - - /** - * @dataProvider is_absolute_data - */ - public function test_is_absolute($path, $expected) - { - $this->assertEquals($expected, phpbb_is_absolute($path)); - } -} diff --git a/tests/functions/language_select_test.php b/tests/functions/language_select_test.php index 3341e2a256..6762ead5a1 100644 --- a/tests/functions/language_select_test.php +++ b/tests/functions/language_select_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/make_clickable_email_test.php b/tests/functions/make_clickable_email_test.php new file mode 100644 index 0000000000..4c802d0487 --- /dev/null +++ b/tests/functions/make_clickable_email_test.php @@ -0,0 +1,222 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; + +class phpbb_functions_make_clickable_email_test extends phpbb_test_case +{ + protected function setUp() + { + parent::setUp(); + + global $config, $user, $request; + $user = new phpbb_mock_user(); + $request = new phpbb_mock_request(); + } + + /** + * 'e' tag for email addresses html + **/ + public function data_test_make_clickable_email_positive() + { + return array( + array( + 'nobody@phpbb.com', + '<!-- e --><a href="mailto:nobody@phpbb.com">nobody@phpbb.com</a><!-- e -->' + ), + array( + 'Nobody@sub.phpbb.com', + '<!-- e --><a href="mailto:Nobody@sub.phpbb.com">Nobody@sub.phpbb.com</a><!-- e -->' + ), + array( + 'alice.bob@foo.phpbb.com', + '<!-- e --><a href="mailto:alice.bob@foo.phpbb.com">alice.bob@foo.phpbb.com</a><!-- e -->' + ), + array( + 'alice-foo@bar.phpbb.com', + '<!-- e --><a href="mailto:alice-foo@bar.phpbb.com">alice-foo@bar.phpbb.com</a><!-- e -->' + ), + array( + 'alice_foo@bar.phpbb.com', + '<!-- e --><a href="mailto:alice_foo@bar.phpbb.com">alice_foo@bar.phpbb.com</a><!-- e -->' + ), + array( + 'alice+tag@foo.phpbb.com', + '<!-- e --><a href="mailto:alice+tag@foo.phpbb.com">alice+tag@foo.phpbb.com</a><!-- e -->' + ), + array( + 'alice&tag@foo.phpbb.com', + '<!-- e --><a href="mailto:alice&tag@foo.phpbb.com">alice&tag@foo.phpbb.com</a><!-- e -->' + ), + array( + 'alice@phpbb.australia', + '<!-- e --><a href="mailto:alice@phpbb.australia">alice@phpbb.australia</a><!-- e -->' + ), + + // Test shortened text for email > 55 characters long + // Email text should be turned into: first 39 chars + ' ... ' + last 10 chars + array( + 'alice@phpbb.topZlevelZdomainZnamesZcanZbeZupZtoZsixtyZthreeZcharactersZlong', + '<!-- e --><a href="mailto:alice@phpbb.topZlevelZdomainZnamesZcanZbeZupZtoZsixtyZthreeZcharactersZlong">alice@phpbb.topZlevelZdomainZnamesZcanZ ... ctersZlong</a><!-- e -->' + ), + array( + 'l3tt3rsAndNumb3rs@domain.com', + '<!-- e --><a href="mailto:l3tt3rsAndNumb3rs@domain.com">l3tt3rsAndNumb3rs@domain.com</a><!-- e -->' + ), + array( + 'has-dash@domain.com', + '<!-- e --><a href="mailto:has-dash@domain.com">has-dash@domain.com</a><!-- e -->' + ), + array( + 'hasApostrophe.o\'leary@domain.org', + '<!-- e --><a href="mailto:hasApostrophe.o\'leary@domain.org">hasApostrophe.o\'leary@domain.org</a><!-- e -->' + ), + array( + 'uncommonTLD@domain.museum', + '<!-- e --><a href="mailto:uncommonTLD@domain.museum">uncommonTLD@domain.museum</a><!-- e -->' + ), + array( + 'uncommonTLD@domain.travel', + '<!-- e --><a href="mailto:uncommonTLD@domain.travel">uncommonTLD@domain.travel</a><!-- e -->' + ), + array( + 'uncommonTLD@domain.mobi', + '<!-- e --><a href="mailto:uncommonTLD@domain.mobi">uncommonTLD@domain.mobi</a><!-- e -->' + ), + array( + 'countryCodeTLD@domain.uk', + '<!-- e --><a href="mailto:countryCodeTLD@domain.uk">countryCodeTLD@domain.uk</a><!-- e -->' + ), + array( + 'countryCodeTLD@domain.rw', + '<!-- e --><a href="mailto:countryCodeTLD@domain.rw">countryCodeTLD@domain.rw</a><!-- e -->' + ), + array( + 'numbersInDomain@911.com', + '<!-- e --><a href="mailto:numbersInDomain@911.com">numbersInDomain@911.com</a><!-- e -->' + ), + array( + 'underscore_inLocal@domain.net', + '<!-- e --><a href="mailto:underscore_inLocal@domain.net">underscore_inLocal@domain.net</a><!-- e -->' + ), + array( + 'IPInsteadOfDomain@127.0.0.1', + '<!-- e --><a href="mailto:IPInsteadOfDomain@127.0.0.1">IPInsteadOfDomain@127.0.0.1</a><!-- e -->' + ), + array( + 'IPAndPort@127.0.0.1:25', + '<!-- e --><a href="mailto:IPAndPort@127.0.0.1:25">IPAndPort@127.0.0.1:25</a><!-- e -->' + ), + array( + 'subdomain@sub.domain.com', + '<!-- e --><a href="mailto:subdomain@sub.domain.com">subdomain@sub.domain.com</a><!-- e -->' + ), + array( + 'local@dash-inDomain.com', + '<!-- e --><a href="mailto:local@dash-inDomain.com">local@dash-inDomain.com</a><!-- e -->' + ), + array( + 'dot.inLocal@foo.com', + '<!-- e --><a href="mailto:dot.inLocal@foo.com">dot.inLocal@foo.com</a><!-- e -->' + ), + array( + 'a@singleLetterLocal.org', + '<!-- e --><a href="mailto:a@singleLetterLocal.org">a@singleLetterLocal.org</a><!-- e -->' + ), + array( + 'singleLetterDomain@x.org', + '<!-- e --><a href="mailto:singleLetterDomain@x.org">singleLetterDomain@x.org</a><!-- e -->' + ), + array( + '&*=?^+{}\'~@validCharsInLocal.net', + '<!-- e --><a href="mailto:&*=?^+{}\'~@validCharsInLocal.net">&*=?^+{}\'~@validCharsInLocal.net</a><!-- e -->' + ), + array( + 'foor@bar.newTLD', + '<!-- e --><a href="mailto:foor@bar.newTLD">foor@bar.newTLD</a><!-- e -->' + ), + ); + } + + public function data_test_make_clickable_email_negative() + { + return array( + array('foo.example.com'), // @ is missing + array('.foo.example.com'), // . as first character + array('Foo.@example.com'), // . is last in local part + array('foo..123@example.com'), // . doubled + array('a@b@c@example.com'), // @ doubled + + // Emails with invalid characters + // (only 'valid' pieces having localparts prepended with one of the \n \t ( > chars should parsed if any) + array('()[]\;:,<>@example.com'), // invalid characters + array('abc(def@example.com', 'abc(<!-- e --><a href="mailto:def@example.com">def@example.com</a><!-- e -->'), // invalid character ( + array('abc)def@example.com'), // invalid character ) + array('abc[def@example.com'), // invalid character [ + array('abc]def@example.com'), // invalid character ] + array('abc\def@example.com'), // invalid character \ + array('abc;def@example.com'), // invalid character ; + array('abc:def@example.com'), // invalid character : + array('abc,def@example.com'), // invalid character , + array('abc<def@example.com'), // invalid character < + array('abc>def@example.com', 'abc><!-- e --><a href="mailto:def@example.com">def@example.com</a><!-- e -->'), // invalid character > + + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + array('missingDomain@.com'), + array('@missingLocal.org'), + array('missingatSign.net'), + array('missingDot@com'), + array('two@@signs.com'), + // Trailing colon is ignored + array('colonButNoPort@127.0.0.1:', '<!-- e --><a href="mailto:colonButNoPort@127.0.0.1">colonButNoPort@127.0.0.1</a><!-- e -->:'), + + array(''), + // Trailing part after the 3rd dot is ignored + array('someone-else@127.0.0.1.26', '<!-- e --><a href="mailto:someone-else@127.0.0.1">someone-else@127.0.0.1</a><!-- e -->.26'), + + array('.localStartsWithDot@domain.com'), + array('localEndsWithDot.@domain.com'), + array('two..consecutiveDots@domain.com'), + array('domainStartsWithDash@-domain.com'), + array('domainEndsWithDash@domain-.com'), + array('numbersInTLD@domain.c0m'), + array('missingTLD@domain.'), + array('! "#$%(),/;<>[]`|@invalidCharsInLocal.org'), + array('invalidCharsInDomain@! "#$%(),/;<>_[]`|.org'), + array('local@SecondLevelDomainNamesAreInvalidIfTheyAreLongerThan64Charactersss.org'), + // The domain zone name part after the 63rd char is ignored + array( + 'alice@phpbb.topZlevelZdomainZnamesZcanZbeZupZtoZsixtyZthreeZcharactersZlongZ', + '<!-- e --><a href="mailto:alice@phpbb.topZlevelZdomainZnamesZcanZbeZupZtoZsixtyZthreeZcharactersZlong">alice@phpbb.topZlevelZdomainZnamesZcanZ ... ctersZlong</a><!-- e -->Z' + ), + ); + } + + /** + * @dataProvider data_test_make_clickable_email_positive + */ + public function test_email_matching_positive($email, $expected) + { + $this->assertSame($expected, make_clickable($email)); + } + + /** + * @dataProvider data_test_make_clickable_email_negative + */ + public function test_email_matching_negative($email, $expected = null) + { + $expected = ($expected) ?: $email; + $this->assertSame($expected, make_clickable($email)); + } +} diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php new file mode 100644 index 0000000000..63beeb06b2 --- /dev/null +++ b/tests/functions/make_clickable_test.php @@ -0,0 +1,180 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; + +class phpbb_functions_make_clickable_test extends phpbb_test_case +{ + /** + * Tags: + * 'm' - full URL like xxxx://aaaaa.bbb.cccc. + * 'l' - local relative board URL like http://domain.tld/path/to/board/index.php + * 'w' - URL without http/https protocol like www.xxxx.yyyy[/zzzz] aka 'lazy' URLs + * 'e' - email@domain type address + * + * Classes: + * "postlink-local" for 'l' URLs + * "postlink" for the rest of URLs + * empty for email addresses + **/ + public function data_test_make_clickable_url_positive() + { + return array( + array( + 'http://www.phpbb.com/community/', + '<!-- m --><a class="postlink" href="http://www.phpbb.com/community/">http://www.phpbb.com/community/</a><!-- m -->' + ), + array( + 'http://www.phpbb.com/path/file.ext#section', + '<!-- m --><a class="postlink" href="http://www.phpbb.com/path/file.ext#section">http://www.phpbb.com/path/file.ext#section</a><!-- m -->' + ), + array( + 'ftp://ftp.phpbb.com/', + '<!-- m --><a class="postlink" href="ftp://ftp.phpbb.com/">ftp://ftp.phpbb.com/</a><!-- m -->' + ), + array( + 'sip://bantu@phpbb.com', + '<!-- m --><a class="postlink" href="sip://bantu@phpbb.com">sip://bantu@phpbb.com</a><!-- m -->' + ), + array( + 'www.phpbb.com/community/', + '<!-- w --><a class="postlink" href="http://www.phpbb.com/community/">www.phpbb.com/community/</a><!-- w -->' + ), + array( + 'http://testhost/viewtopic.php?t=1', + '<!-- l --><a class="postlink-local" href="http://testhost/viewtopic.php?t=1">viewtopic.php?t=1</a><!-- l -->' + ), + array( + 'email@domain.com', + '<!-- e --><a href="mailto:email@domain.com">email@domain.com</a><!-- e -->' + ), + // Test appending punctuation mark to the URL + array( + 'http://testhost/viewtopic.php?t=1!', + '<!-- l --><a class="postlink-local" href="http://testhost/viewtopic.php?t=1">viewtopic.php?t=1</a><!-- l -->!' + ), + array( + 'www.phpbb.com/community/?', + '<!-- w --><a class="postlink" href="http://www.phpbb.com/community/">www.phpbb.com/community/</a><!-- w -->?' + ), + // Test shortened text for URL > 55 characters long + // URL text should be turned into: first 39 chars + ' ... ' + last 10 chars + array( + 'http://www.phpbb.com/community/path/to/long/url/file.ext#section', + '<!-- m --><a class="postlink" href="http://www.phpbb.com/community/path/to/long/url/file.ext#section">http://www.phpbb.com/community/path/to/ ... xt#section</a><!-- m -->' + ), + ); + } + + public function data_test_make_clickable_url_idn() + { + return array( + array( + 'http://www.täst.de/community/', + '<!-- m --><a class="postlink" href="http://www.täst.de/community/">http://www.täst.de/community/</a><!-- m -->' + ), + array( + 'http://www.täst.de/path/file.ext#section', + '<!-- m --><a class="postlink" href="http://www.täst.de/path/file.ext#section">http://www.täst.de/path/file.ext#section</a><!-- m -->' + ), + array( + 'ftp://ftp.täst.de/', + '<!-- m --><a class="postlink" href="ftp://ftp.täst.de/">ftp://ftp.täst.de/</a><!-- m -->' + ), + array( + 'sip://bantu@täst.de', + '<!-- m --><a class="postlink" href="sip://bantu@täst.de">sip://bantu@täst.de</a><!-- m -->' + ), + array( + 'www.täst.de/community/', + '<!-- w --><a class="postlink" href="http://www.täst.de/community/">www.täst.de/community/</a><!-- w -->' + ), + // Test appending punctuation mark to the URL + array( + 'http://домен.рф/viewtopic.php?t=1!', + '<!-- m --><a class="postlink" href="http://домен.рф/viewtopic.php?t=1">http://домен.рф/viewtopic.php?t=1</a><!-- m -->!' + ), + array( + 'www.домен.рф/ÑообщеÑтво/?', + '<!-- w --><a class="postlink" href="http://www.домен.рф/ÑообщеÑтво/">www.домен.рф/ÑообщеÑтво/</a><!-- w -->?' + ), + // Test shortened text for URL > 55 characters long + // URL text should be turned into: first 39 chars + ' ... ' + last 10 chars + array( + 'http://www.домен.рф/ÑообщеÑтво/путь/по/длинной/ÑÑылке/file.ext#section', + '<!-- m --><a class="postlink" href="http://www.домен.рф/ÑообщеÑтво/путь/по/длинной/ÑÑылке/file.ext#section">http://www.домен.рф/ÑообщеÑтво/путь/по/ ... xt#section</a><!-- m -->' + ), + + // IDN with invalid characters shouldn't be parsed correctly (only 'valid' part) + array( + 'http://www.tästâ•«.de', + '<!-- m --><a class="postlink" href="http://www.täst">http://www.täst</a><!-- m -->â•«.de' + ), + // IDN in emails is unsupported yet + array('почта@домен.рф', 'почта@домен.рф'), + ); + } + + public function data_test_make_clickable_local_url_idn() + { + return array( + array( + 'http://www.домен.рф/viewtopic.php?t=1', + '<!-- l --><a class="postlink-local" href="http://www.домен.рф/viewtopic.php?t=1">viewtopic.php?t=1</a><!-- l -->' + ), + // Test appending punctuation mark to the URL + array( + 'http://www.домен.рф/viewtopic.php?t=1!', + '<!-- l --><a class="postlink-local" href="http://www.домен.рф/viewtopic.php?t=1">viewtopic.php?t=1</a><!-- l -->!' + ), + array( + 'http://www.домен.рф/ÑообщеÑтво/?', + '<!-- l --><a class="postlink-local" href="http://www.домен.рф/ÑообщеÑтво/">ÑообщеÑтво/</a><!-- l -->?' + ), + ); + } + + protected function setUp() + { + parent::setUp(); + + global $config, $user, $request; + $user = new phpbb_mock_user(); + $request = new phpbb_mock_request(); + } + + /** + * @dataProvider data_test_make_clickable_url_positive + */ + public function test_urls_matching_positive($url, $expected) + { + $this->assertSame($expected, make_clickable($url)); + } + + /** + * @dataProvider data_test_make_clickable_url_idn + */ + public function test_urls_matching_idn($url, $expected) + { + $this->assertSame($expected, make_clickable($url)); + } + + /** + * @dataProvider data_test_make_clickable_local_url_idn + */ + public function test_local_urls_matching_idn($url, $expected) + { + $this->assertSame($expected, make_clickable($url, "http://www.домен.рф")); + } +} diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index cf42fd5b58..e793a4eb82 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -124,19 +128,19 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case { return array( array(0, false, array( - 'online_userlist' => 'REGISTERED_USERS 2, 3', + 'online_userlist' => 'REGISTERED_USERS <span class="username">2</span>, <span class="username">3</span>', 'l_online_users' => 'ONLINE_USERS_TOTAL 5 REG_USERS_TOTAL 2 HIDDEN_USERS_TOTAL 3', )), array(0, true, array( - 'online_userlist' => 'REGISTERED_USERS 2, 3', + 'online_userlist' => 'REGISTERED_USERS <span class="username">2</span>, <span class="username">3</span>', 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 7 REG_USERS_TOTAL 2 HIDDEN_USERS_TOTAL 3 GUEST_USERS_TOTAL 2', )), array(1, false, array( - 'online_userlist' => 'BROWSING_FORUM 3', + 'online_userlist' => 'BROWSING_FORUM <span class="username">3</span>', 'l_online_users' => 'ONLINE_USERS_TOTAL 2 REG_USERS_TOTAL 1 HIDDEN_USERS_TOTAL 1', )), array(1, true, array( - 'online_userlist' => 'BROWSING_FORUM_GUESTS 1 3', + 'online_userlist' => 'BROWSING_FORUM_GUESTS 1 <span class="username">3</span>', 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 3 REG_USERS_TOTAL 1 HIDDEN_USERS_TOTAL 1 GUEST_USERS_TOTAL 1', )), array(2, false, array( diff --git a/tests/functions/parse_cfg_file_test.php b/tests/functions/parse_cfg_file_test.php new file mode 100644 index 0000000000..b47e25fbc1 --- /dev/null +++ b/tests/functions/parse_cfg_file_test.php @@ -0,0 +1,110 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_functions_parse_cfg_file extends phpbb_test_case +{ + public function parse_cfg_file_data() + { + return array( + array( + array( + '#', + '# phpBB Style Configuration File', + '#', + '# This file is part of the phpBB Forum Software package.', + '#', + '# @copyright (c) phpBB Limited <https://www.phpbb.com>', + '# @license GNU General Public License, version 2 (GPL-2.0)', + '#', + '# For full copyright and license information, please see', + '# the docs/CREDITS.txt file.', + '#', + '# At the left is the name, please do not change this', + '# At the right the value is entered', + '# For on/off options the valid values are on, off, 1, 0, true and false', + '#', + '# Values get trimmed, if you want to add a space in front or at the end of', + '# the value, then enclose the value with single or double quotes.', + '# Single and double quotes do not need to be escaped.', + '#', + '', + '# General Information about this style', + 'name = prosilver', + 'copyright = © phpBB Limited, 2007', + 'version = 3.0.12', + ), + array( + 'name' => 'prosilver', + 'copyright' => '© phpBB Limited, 2007', + 'version' => '3.0.12', + ), + ), + array( + array( + 'name = subsilver2', + 'copyright = © 2005 phpBB Limited', + 'version = 3.0.12', + ), + array( + 'name' => 'subsilver2', + 'copyright' => '© 2005 phpBB Limited', + 'version' => '3.0.12', + ), + ), + array( + array( + 'foo = on', + 'foo1 = true', + 'foo2 = 1', + 'bar = off', + 'bar1 = false', + 'bar2 = 0', + 'foobar =', + 'foobar1 = "asdf"', + 'foobar2 = \'qwer\'', + ), + array( + 'foo' => true, + 'foo1' => true, + 'foo2' => true, + 'bar' => false, + 'bar1' => false, + 'bar2' => false, + 'foobar' => '', + 'foobar1' => 'asdf', + 'foobar2' => 'qwer', + ), + ), + array( + array( + 'foo = & bar', + 'bar = <a href="test">Test</a>', + ), + array( + 'foo' => '&amp; bar', + 'bar' => '<a href="test">Test</a>', + ), + ), + ); + } + + /** + * @dataProvider parse_cfg_file_data + */ + public function test_parse_cfg_file($file_contents, $expected) + { + $this->assertEquals($expected, parse_cfg_file(false, $file_contents)); + } +} diff --git a/tests/functions/phpbb_get_banned_user_ids.php b/tests/functions/phpbb_get_banned_user_ids.php new file mode 100644 index 0000000000..6f7607132e --- /dev/null +++ b/tests/functions/phpbb_get_banned_user_ids.php @@ -0,0 +1,62 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; + +class phpbb_get_banned_user_ids_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/banned_users.xml'); + } + + public function phpbb_get_banned_user_ids_data() + { + return array( + // Input to phpbb_get_banned_user_ids (user_id list, ban_end) + // Expected output + array( + // True to get users currently banned + array(array(1, 2, 4, 5, 6), true), + array(2 => 2, 5 => 5), + ), + array( + // False to only get permanently banned users + array(array(1, 2, 4, 5, 6), false), + array(2 => 2), + ), + array( + // Unix timestamp to get users banned until that time + array(array(1, 2, 4, 5, 6), 2), + array(2 => 2, 5 => 5, 6 => 6), + ), + ); + } + + public function setUp() + { + global $db; + + $db = $this->new_dbal(); + + return parent::setUp(); + } + + /** + * @dataProvider phpbb_get_banned_user_ids_data + */ + public function test_phpbb_get_banned_user_ids($input, $expected) + { + $this->assertEquals($expected, call_user_func_array('phpbb_get_banned_user_ids', $input)); + } +} diff --git a/tests/functions/quoteattr_test.php b/tests/functions/quoteattr_test.php index 9d2a7d470e..6e191f9610 100644 --- a/tests/functions/quoteattr_test.php +++ b/tests/functions/quoteattr_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/style_select_test.php b/tests/functions/style_select_test.php index 1e44f3c2cb..a918f83155 100644 --- a/tests/functions/style_select_test.php +++ b/tests/functions/style_select_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php new file mode 100644 index 0000000000..bd6b53c59f --- /dev/null +++ b/tests/functions/user_delete_test.php @@ -0,0 +1,114 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; + +class phpbb_functions_user_delete_test extends phpbb_database_test_case +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_delete.xml'); + } + + protected function setUp() + { + parent::setUp(); + + global $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx; + + $this->db = $db = $this->new_dbal(); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $phpbb_container = new phpbb_mock_container_builder(); + $config = new \phpbb\config\config(array( + 'auth_method' => 'oauth', + 'auth_oauth_google_key' => 'foo', + 'auth_oauth_google_secret' => 'bar', + )); + $cache = new \phpbb\cache\driver\dummy(); + $request = new phpbb_mock_request(); + $notification_manager = new phpbb_mock_notification_manager(); + $provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config); + $oauth_provider_google = new \phpbb\auth\provider\oauth\service\google($config, $request); + $oauth_provider_collection = new \phpbb\di\service_collection($phpbb_container); + $oauth_provider_collection->offsetSet('auth.provider.oauth.service.google', $oauth_provider_google); + + $driver_helper = new \phpbb\passwords\driver\helper($config); + $passwords_drivers = array( + 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), + 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $driver_helper), + 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $driver_helper), + 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $driver_helper), + ); + + $passwords_helper = new \phpbb\passwords\helper; + // Set up passwords manager + $passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers)); + + $oauth_provider = new \phpbb\auth\provider\oauth\oauth( + $db, + $config, + $passwords_manager, + $request, + $user, + 'phpbb_oauth_tokens', + 'phpbb_oauth_states', + 'phpbb_oauth_accounts', + $oauth_provider_collection, + 'phpbb_users', + $phpbb_container, + $this->phpbb_root_path, + $this->php_ext + ); + $provider_collection->offsetSet('auth.provider.oauth', $oauth_provider); + + $phpbb_container->set('auth.provider.oauth', $oauth_provider); + $phpbb_container->set('auth.provider.oauth.service.google', $oauth_provider_google); + $phpbb_container->set('auth.provider_collection', $provider_collection); + $phpbb_container->set('notification_manager', $notification_manager); + } + + public function test_user_delete() + { + // Check that user is linked + $sql = 'SELECT ot.user_id AS user_id + FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot + WHERE oa.user_id = 2 + AND ot.user_id = oa.user_id'; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEquals(array('user_id' => '2'), $row); + + // user_delete() should return false + $this->assertFalse(user_delete('remove', array(2))); + + // Make sure user link was removed + $sql = 'SELECT ot.user_id AS user_id + FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot + WHERE oa.user_id = 2 + AND ot.user_id = oa.user_id'; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->assertEmpty($row); + } +} diff --git a/tests/functions/validate_data_helper.php b/tests/functions/validate_data_helper.php index b92a3aa5eb..448d029d3f 100644 --- a/tests/functions/validate_data_helper.php +++ b/tests/functions/validate_data_helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_date_test.php b/tests/functions/validate_date_test.php index 1dcd1361a2..9dc0db46d6 100644 --- a/tests/functions/validate_date_test.php +++ b/tests/functions/validate_date_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_email_test.php b/tests/functions/validate_email_test.php index 9a6ce39251..b46509fda7 100644 --- a/tests/functions/validate_email_test.php +++ b/tests/functions/validate_email_test.php @@ -2,7 +2,7 @@ /** * * @package testing -* @copyright (c) 2013 phpBB Group +* @copyright (c) 2014 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -47,60 +47,54 @@ class phpbb_functions_validate_email_test extends phpbb_database_test_case $user->optionset('banned_users', array('banned@example.com')); } - public function test_validate_email() + public static function validate_email_data() + { + return array( + array('empty', array('EMAIL_INVALID'), ''), // email does not allow empty + array('allowed', array(), 'foobar@example.com'), + array('valid_complex', array(), "'%$~test@example.com"), + array('invalid', array('EMAIL_INVALID'), 'fööbar@example.com'), + array('taken', array(), 'admin@example.com'), // email does not check taken, should use user_email instead + array('banned', array(), 'banned@example.com'), // email does not check ban, should use user_email instead + ); + } + + /** + * @dataProvider validate_email_data + */ + public function test_validate_email($case, $errors, $email) { $this->set_validation_prerequisites(false); $this->helper->assert_valid_data(array( - 'empty' => array( - array(), - '', - array('email'), - ), - 'allowed' => array( - array(), - 'foobar@example.com', - array('email', 'foobar@example.com'), - ), - 'invalid' => array( - array('EMAIL_INVALID'), - 'fööbar@example.com', - array('email'), - ), - 'valid_complex' => array( - array(), - "'%$~test@example.com", - array('email'), - ), - 'taken' => array( - array('EMAIL_TAKEN'), - 'admin@example.com', - array('email'), - ), - 'banned' => array( - array('EMAIL_BANNED'), - 'banned@example.com', + $case => array( + $errors, + $email, array('email'), ), )); } + public static function validate_email_mx_data() + { + return array( + array('valid', array(), 'foobar@phpbb.com'), + array('no_mx', array('DOMAIN_NO_MX_RECORD'), 'test@does-not-exist.phpbb.com'), + ); + } + /** + * @dataProvider validate_email_mx_data * @group slow */ - public function test_validate_email_mx() + public function test_validate_email_mx($case, $errors, $email) { $this->set_validation_prerequisites(true); $this->helper->assert_valid_data(array( - 'valid' => array( - array(), - 'foobar@phpbb.com', - array('email'), - ), - 'no_mx' => array( - array('DOMAIN_NO_MX_RECORD'), - 'test@does-not-exist.phpbb.com', + $case => array( + $errors, + $email, array('email'), ), )); diff --git a/tests/functions/validate_hex_colour_test.php b/tests/functions/validate_hex_colour_test.php index 812ebe5eeb..b2c4862458 100644 --- a/tests/functions/validate_hex_colour_test.php +++ b/tests/functions/validate_hex_colour_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_jabber_test.php b/tests/functions/validate_jabber_test.php index 5a53c963bd..23811a94c0 100644 --- a/tests/functions/validate_jabber_test.php +++ b/tests/functions/validate_jabber_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_lang_iso_test.php b/tests/functions/validate_lang_iso_test.php index c8a5b71021..81b56055e6 100644 --- a/tests/functions/validate_lang_iso_test.php +++ b/tests/functions/validate_lang_iso_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_match_test.php b/tests/functions/validate_match_test.php index 73a363e003..811bed3e33 100644 --- a/tests/functions/validate_match_test.php +++ b/tests/functions/validate_match_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_num_test.php b/tests/functions/validate_num_test.php index 4deac02ebc..798468759c 100644 --- a/tests/functions/validate_num_test.php +++ b/tests/functions/validate_num_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_password_test.php b/tests/functions/validate_password_test.php index 82c5fa03c1..c5942e79bf 100644 --- a/tests/functions/validate_password_test.php +++ b/tests/functions/validate_password_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_string_test.php b/tests/functions/validate_string_test.php index ab44c28541..24026e4c9f 100644 --- a/tests/functions/validate_string_test.php +++ b/tests/functions/validate_string_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions/validate_user_email_test.php b/tests/functions/validate_user_email_test.php new file mode 100644 index 0000000000..951d5794e6 --- /dev/null +++ b/tests/functions/validate_user_email_test.php @@ -0,0 +1,106 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; +require_once dirname(__FILE__) . '/../mock/user.php'; +require_once dirname(__FILE__) . '/validate_data_helper.php'; + +class phpbb_functions_validate_user_email_test extends phpbb_database_test_case +{ + protected $db; + protected $user; + protected $helper; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/validate_email.xml'); + } + + protected function setUp() + { + parent::setUp(); + + $this->db = $this->new_dbal(); + $this->user = new phpbb_mock_user; + $this->helper = new phpbb_functions_validate_data_helper($this); + } + + /** + * Get validation prerequesites + * + * @param bool $check_mx Whether mx records should be checked + */ + protected function set_validation_prerequisites($check_mx) + { + global $config, $db, $user; + + $config['email_check_mx'] = $check_mx; + $db = $this->db; + $user = $this->user; + $user->optionset('banned_users', array('banned@example.com')); + } + + public static function validate_user_email_data() + { + return array( + array('empty', array(), ''), + array('allowed', array(), 'foobar@example.com'), + array('valid_complex', array(), "'%$~test@example.com"), + array('invalid', array('EMAIL_INVALID'), 'fööbar@example.com'), + array('taken', array('EMAIL_TAKEN'), 'admin@example.com'), + array('banned', array('EMAIL_BANNED'), 'banned@example.com'), + ); + } + + /** + * @dataProvider validate_user_email_data + */ + public function test_validate_user_email($case, $errors, $email) + { + $this->set_validation_prerequisites(false); + + $this->helper->assert_valid_data(array( + $case => array( + $errors, + $email, + array('user_email'), + ), + )); + } + + public static function validate_user_email_mx_data() + { + return array( + array('valid', array(), 'foobar@phpbb.com'), + array('no_mx', array('DOMAIN_NO_MX_RECORD'), 'test@does-not-exist.phpbb.com'), + ); + } + + /** + * @dataProvider validate_user_email_mx_data + * @group slow + */ + public function test_validate_user_email_mx($case, $errors, $email) + { + $this->set_validation_prerequisites(true); + + $this->helper->assert_valid_data(array( + $case => array( + $errors, + $email, + array('user_email'), + ), + )); + } +} diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php index 0819974e54..4fa5af7ff3 100644 --- a/tests/functions/validate_username_test.php +++ b/tests/functions/validate_username_test.php @@ -1,12 +1,17 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; require_once dirname(__FILE__) . '/../mock/cache.php'; diff --git a/tests/functions/validate_with_method_test.php b/tests/functions/validate_with_method_test.php new file mode 100644 index 0000000000..37e05d412a --- /dev/null +++ b/tests/functions/validate_with_method_test.php @@ -0,0 +1,43 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; +require_once dirname(__FILE__) . '/validate_data_helper.php'; + +class phpbb_functions_validate_with_method_test extends phpbb_test_case +{ + protected $helper; + + protected function setUp() + { + parent::setUp(); + + $this->helper = new phpbb_functions_validate_data_helper($this); + } + + public function test_validate_date() + { + $this->helper->assert_valid_data(array( + 'method_call' => array( + array(), + true, + array(array(array($this, 'with_method'), false)), + ), + )); + } + + public function validate_with_method($bool, $optional = false) + { + return ! $bool; + } +} diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php index 7f8db799c5..a8d7ae6f09 100644 --- a/tests/functions_acp/build_cfg_template_test.php +++ b/tests/functions_acp/build_cfg_template_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -28,7 +32,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case array('config_key_name' => '2'), 'config_key_name', array(), - '<input id="key_name" type="password" size="20" maxlength="128" name="config[config_key_name]" value="2" autocomplete="off" />', + '<input id="key_name" type="password" size="20" maxlength="128" name="config[config_key_name]" value="********" autocomplete="off" />', ), array( array('text', 0, 255), diff --git a/tests/functions_acp/build_select_test.php b/tests/functions_acp/build_select_test.php index c44fd97ec3..ebdc58fd64 100644 --- a/tests/functions_acp/build_select_test.php +++ b/tests/functions_acp/build_select_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions_acp/h_radio_test.php b/tests/functions_acp/h_radio_test.php index 4c1872d341..5ae4e91ea2 100644 --- a/tests/functions_acp/h_radio_test.php +++ b/tests/functions_acp/h_radio_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions_acp/insert_config_array_test.php b/tests/functions_acp/insert_config_array_test.php new file mode 100644 index 0000000000..1264b35bf4 --- /dev/null +++ b/tests/functions_acp/insert_config_array_test.php @@ -0,0 +1,144 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php'; + +class phpbb_functions_insert_config_array_test extends phpbb_test_case +{ + public function config_display_vars() + { + return array( + 'legend1' => '', + 'acp_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'acp_config_5' => array(), + ); + } + + public function insert_config_array_data() + { + return array( + array( // Add a new config after 1st array item + array('new_config_1' => array()), + array('after' => 'legend1'), + array( + 'legend1' => '', + 'new_config_1' => array(), + 'acp_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'acp_config_5' => array(), + ), + ), + array( // Add a new config after last array item + array('new_config_1' => array()), + array('after' => 'acp_config_5'), + array( + 'legend1' => '', + 'acp_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'acp_config_5' => array(), + 'new_config_1' => array(), + ), + ), + array( // Add a new config before 2nd array item + array('new_config_1' => array()), + array('before' => 'acp_config_1'), + array( + 'legend1' => '', + 'new_config_1' => array(), + 'acp_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'acp_config_5' => array(), + ), + ), + array( // Add a new config before last config item + array('new_config_1' => array()), + array('before' => 'acp_config_5'), + array( + 'legend1' => '', + 'acp_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'new_config_1' => array(), + 'acp_config_5' => array(), + ), + ), + array( // When an array key does not exist + array('new_config_1' => array()), + array('after' => 'foobar'), + array( + 'legend1' => '', + 'acp_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'acp_config_5' => array(), + ), + ), + array( // When after|before is not used correctly (defaults to after) + array('new_config_1' => array()), + array('foobar' => 'acp_config_1'), + array( + 'legend1' => '', + 'acp_config_1' => array(), + 'new_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'acp_config_5' => array(), + ), + ), + array( // Add a new config set after the last array item + array( + 'legend2' => array(), + 'new_config_1' => array(), + 'new_config_2' => array(), + 'new_config_3' => array(), + ), + array('after' => 'acp_config_5'), + array( + 'legend1' => '', + 'acp_config_1' => array(), + 'acp_config_2' => array(), + 'acp_config_3' => array(), + 'acp_config_4' => array(), + 'acp_config_5' => array(), + 'legend2' => array(), + 'new_config_1' => array(), + 'new_config_2' => array(), + 'new_config_3' => array(), + ), + ), + ); + } + + /** + * @dataProvider insert_config_array_data + */ + public function test_insert_config_array($new_config, $position, $expected) + { + $config_array = $this->config_display_vars(); + $new_config_array = phpbb_insert_config_array($config_array, $new_config, $position); + + $this->assertSame($expected, $new_config_array); + } +} diff --git a/tests/functions_acp/validate_config_vars_test.php b/tests/functions_acp/validate_config_vars_test.php index acc98fbf0d..32738e4351 100644 --- a/tests/functions_acp/validate_config_vars_test.php +++ b/tests/functions_acp/validate_config_vars_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -158,4 +162,100 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case $this->assertEquals($expected, $phpbb_error); } + + public function data_validate_path_linux() + { + return array( + array('/usr/bin', 'absolute_path', true), + array('/usr/bin/', 'absolute_path:50:200', true), + array('/usr/bin/which', 'absolute_path', 'DIRECTORY_NOT_DIR'), + array('/foo/bar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + array('C:\Windows', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + array('.', 'absolute_path', true), + array('', 'absolute_path', true), + array('mkdir /foo/bar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + // Make sure above command didn't do anything + array('/foo/bar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + ); + } + + /** + * @dataProvider data_validate_path_linux + */ + public function test_validate_path_linux($path, $validation_type, $expected) + { + if (strtolower(substr(PHP_OS, 0, 5)) !== 'linux') + { + $this->markTestSkipped('Unable to test linux specific paths on other OS.'); + } + + $error = array(); + $config_ary = array( + 'path' => $path, + ); + + validate_config_vars(array( + 'path' => array('lang' => 'FOOBAR', 'validate' => $validation_type), + ), + $config_ary, + $error + ); + + if ($expected === true) + { + $this->assertEmpty($error); + } + else + { + $this->assertEquals(array($expected), $error); + } + } + + public function data_validate_path_windows() + { + return array( + array('C:\Windows', 'absolute_path', true), + array('C:\Windows\\', 'absolute_path:50:200', true), + array('C:\Windows\explorer.exe', 'absolute_path', 'DIRECTORY_NOT_DIR'), + array('C:\foobar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + array('/usr/bin', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + array('.', 'absolute_path', true), + array('', 'absolute_path', true), + array('mkdir C:\Windows\foobar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + // Make sure above command didn't do anything + array('C:\Windows\foobar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'), + ); + } + + /** + * @dataProvider data_validate_path_windows + */ + public function test_validate_path_windows($path, $validation_type, $expected) + { + if (strtolower(substr(PHP_OS, 0, 3)) !== 'win') + { + $this->markTestSkipped('Unable to test windows specific paths on other OS.'); + } + + $error = array(); + $config_ary = array( + 'path' => $path, + ); + + validate_config_vars(array( + 'path' => array('lang' => 'FOOBAR', 'validate' => $validation_type), + ), + $config_ary, + $error + ); + + if ($expected === true) + { + $this->assertEmpty($error); + } + else + { + $this->assertEquals(array($expected), $error); + } + } } diff --git a/tests/functions_acp/validate_range_test.php b/tests/functions_acp/validate_range_test.php index cb028d4d07..6408e29a26 100644 --- a/tests/functions_acp/validate_range_test.php +++ b/tests/functions_acp/validate_range_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions_content/get_username_string_test.php b/tests/functions_content/get_username_string_test.php new file mode 100644 index 0000000000..01ec97f6a4 --- /dev/null +++ b/tests/functions_content/get_username_string_test.php @@ -0,0 +1,130 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; + +class phpbb_functions_content_get_username_string_test extends phpbb_test_case +{ + public function setUp() + { + parent::setUp(); + + global $auth, $phpbb_dispatcher, $user; + $auth = $this->getMock('\phpbb\auth\auth'); + $auth->expects($this->any()) + ->method('acl_get') + ->with($this->stringContains('_'), $this->anything()) + ->will($this->returnValueMap(array( + array('u_viewprofile', true), + ))); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + $user->data['user_id'] = ANONYMOUS; + $user->lang['GUEST'] = 'Guest'; + } + + public function get_username_string_profile_data() + { + global $phpbb_root_path, $phpEx; + + return array( + array(ANONYMOUS, 'Anonymous', '', false, false, ''), + array(2, 'Administrator', 'FF0000', false, false, "{$phpbb_root_path}memberlist.$phpEx?mode=viewprofile&u=2"), + array(42, 'User42', '', false, 'http://www.example.org/user.php?mode=show', 'http://www.example.org/user.php?mode=show&u=42'), + ); + } + + /** + * @dataProvider get_username_string_profile_data + */ + public function test_get_username_string_profile($user_id, $username, $user_colour, $guest_username, $custom_profile_url, $expected) + { + $this->assertEquals($expected, get_username_string('profile', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); + } + + public function get_username_string_username_data() + { + return array( + array(ANONYMOUS, '', '', false, false, 'Guest'), + array(ANONYMOUS, '', '', 'CustomName', false, 'CustomName'), + array(2, 'User2', '', false, false, 'User2'), + array(5, 'User5', '', 'Anonymous', false, 'User5'), + array(128, 'User128', '', false, false, 'User128'), + ); + } + + /** + * @dataProvider get_username_string_username_data + */ + public function test_get_username_string_username($user_id, $username, $user_colour, $guest_username, $custom_profile_url, $expected) + { + $this->assertEquals($expected, get_username_string('username', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); + } + + public function get_username_string_colour_data() + { + return array( + array(0, '', '', false, false, ''), + array(0, '', 'F0F0F0', false, false, '#F0F0F0'), + array(ANONYMOUS, 'Anonymous', '000000', false, false, '#000000'), + array(2, 'Administrator', '', false, false, ''), + ); + } + + /** + * @dataProvider get_username_string_colour_data + */ + public function test_get_username_string_colour($user_id, $username, $user_colour, $guest_username, $custom_profile_url, $expected) + { + $this->assertEquals($expected, get_username_string('colour', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); + } + + public function get_username_string_full_data() + { + global $phpbb_root_path, $phpEx; + + return array( + array(0, '', '', false, false, '<span class="username">Guest</span>'), + array(ANONYMOUS, 'Anonymous', '', false, false, '<span class="username">Anonymous</span>'), + array(2, 'Administrator', 'FF0000', false, false, '<a href="' . $phpbb_root_path . 'memberlist.' . $phpEx . '?mode=viewprofile&u=2" style="color: #FF0000;" class="username-coloured">Administrator</a>'), + array(5, 'User5', '', false, 'http://www.example.org/user.php?mode=show', '<a href="http://www.example.org/user.php?mode=show&u=5" class="username">User5</a>'), + array(8, 'Eight', '', false, false, '<a href="' . $phpbb_root_path . 'memberlist.php?mode=viewprofile&u=8" class="username">Eight</a>'), + ); + } + + /** + * @dataProvider get_username_string_full_data + */ + public function test_get_username_string_full($user_id, $username, $user_colour, $guest_username, $custom_profile_url, $expected) + { + $this->assertEquals($expected, get_username_string('full', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); + } + + public function get_username_string_no_profile_data() + { + return array( + array(ANONYMOUS, 'Anonymous', '', false, false, '<span class="username">Anonymous</span>'), + array(ANONYMOUS, 'Anonymous', '', '', false, '<span class="username">Guest</span>'), + array(2, 'Administrator', 'FF0000', false, false, '<span style="color: #FF0000;" class="username-coloured">Administrator</span>'), + array(8, 'Eight', '', false, false, '<span class="username">Eight</span>'), + ); + } + + /** + * @dataProvider get_username_string_no_profile_data + */ + public function test_get_username_string_no_profile($user_id, $username, $user_colour, $guest_username, $custom_profile_url, $expected) + { + $this->assertEquals($expected, get_username_string('no_profile', $user_id, $username, $user_colour, $guest_username, $custom_profile_url)); + } +} diff --git a/tests/functions_content/phpbb_clean_search_string_test.php b/tests/functions_content/phpbb_clean_search_string_test.php new file mode 100644 index 0000000000..abd107097c --- /dev/null +++ b/tests/functions_content/phpbb_clean_search_string_test.php @@ -0,0 +1,42 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; + +class phpbb_functions_content_phpbb_clean_search_string_test extends phpbb_test_case +{ + public function phpbb_clean_search_string_data() + { + return array( + array('*', ''), + array('* *', ''), + array('test', 'test'), + array(' test ', 'test'), + array(' test * ', 'test'), + array('test* *', 'test*'), + array('* *test*', '*test*'), + array('test test * test', 'test test test'), + array(' some wild*cards * between wo*rds ', 'some wild*cards between wo*rds'), + array(' we * now have*** multiple wild***cards * ', 'we now have* multiple wild*cards'), + array('pi is *** . * **** * *****', 'pi is .'), + ); + } + + /** + * @dataProvider phpbb_clean_search_string_data + */ + public function test_phpbb_clean_search_string($search_string, $expected) + { + $this->assertEquals($expected, phpbb_clean_search_string($search_string)); + } +} diff --git a/tests/functions_database_helper/update_rows_avoiding_duplicates_notify_status_test.php b/tests/functions_database_helper/update_rows_avoiding_duplicates_notify_status_test.php index d4881daf7e..150b091ceb 100644 --- a/tests/functions_database_helper/update_rows_avoiding_duplicates_notify_status_test.php +++ b/tests/functions_database_helper/update_rows_avoiding_duplicates_notify_status_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions_database_helper/update_rows_avoiding_duplicates_test.php b/tests/functions_database_helper/update_rows_avoiding_duplicates_test.php index 2f01d29d15..0e27f129de 100644 --- a/tests/functions_database_helper/update_rows_avoiding_duplicates_test.php +++ b/tests/functions_database_helper/update_rows_avoiding_duplicates_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/functions_install/ignore_new_file_on_update_test.php b/tests/functions_install/ignore_new_file_on_update_test.php deleted file mode 100644 index 703da4e435..0000000000 --- a/tests/functions_install/ignore_new_file_on_update_test.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_install.php'; - -class phpbb_functions_install_ignore_new_file_on_update_test extends phpbb_test_case -{ - static public function ignore_new_file_on_update_data() - { - return array( - array('willneverexist.php', false), - array('includes/dirwillneverexist/newfile.php', false), - - array('language/en/email/short/bookmark.txt', false), - array('language/languagewillneverexist/email/short/bookmark.txt', true), - - array('styles/prosilver/template/bbcode.html', false), - array('styles/stylewillneverexist/template/bbcode.html', true), - - array('styles/prosilver/theme/en/icon_user_online.gif', false), - array('styles/prosilver/theme/languagewillneverexist/icon_user_online.gif', true), - - array('styles/prosilver/theme/imageset.css', false), - ); - } - - /** - * @dataProvider ignore_new_file_on_update_data - */ - public function test_ignore_new_file_on_update($file, $expected) - { - global $phpbb_root_path; - $this->assertEquals($expected, phpbb_ignore_new_file_on_update($phpbb_root_path, $file)); - } -} diff --git a/tests/functions_privmsgs/fixtures/get_max_setting_from_group.xml b/tests/functions_privmsgs/fixtures/get_max_setting_from_group.xml new file mode 100644 index 0000000000..c78d63f7cb --- /dev/null +++ b/tests/functions_privmsgs/fixtures/get_max_setting_from_group.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_groups"> + <column>group_id</column> + <column>group_desc</column> + <column>group_message_limit</column> + <column>group_max_recipients</column> + <row> + <value>1</value> + <value></value> + <value>1</value> + <value>3</value> + </row> + <row> + <value>2</value> + <value></value> + <value>2</value> + <value>4</value> + </row> + <row> + <value>3</value> + <value></value> + <value>0</value> + <value>0</value> + </row> + <row> + <value>4</value> + <value></value> + <value>0</value> + <value>5</value> + </row> + </table> + <table name="phpbb_user_group"> + <column>user_id</column> + <column>group_id</column> + <column>user_pending</column> + <row> + <value>1</value> + <value>1</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>2</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>3</value> + <value>0</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>0</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>0</value> + </row> + <row> + <value>3</value> + <value>3</value> + <value>0</value> + </row> + <row> + <value>4</value> + <value>4</value> + <value>0</value> + </row> + <row> + <value>5</value> + <value>3</value> + <value>1</value> + </row> + <row> + <value>5</value> + <value>2</value> + <value>0</value> + </row> + </table> +</dataset> diff --git a/tests/functions_privmsgs/get_max_setting_from_group_test.php b/tests/functions_privmsgs/get_max_setting_from_group_test.php new file mode 100644 index 0000000000..3eb7866802 --- /dev/null +++ b/tests/functions_privmsgs/get_max_setting_from_group_test.php @@ -0,0 +1,64 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_privmsgs.php'; + +class phpbb_functions_privmsgs_get_max_setting_from_group_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/get_max_setting_from_group.xml'); + } + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + protected function setUp() + { + parent::setUp(); + + $this->db = $this->new_dbal(); + } + + static public function get_max_setting_from_group_data() + { + return array( + array(1, 0, 'message_limit'), + array(2, 2, 'message_limit'), + array(3, 0, 'message_limit'), + array(4, 0, 'message_limit'), + array(5, 2, 'message_limit'), + array(1, 0, 'max_recipients'), + array(2, 4, 'max_recipients'), + array(3, 0, 'max_recipients'), + array(4, 5, 'max_recipients'), + array(5, 4, 'max_recipients'), + ); + } + + /** + * @dataProvider get_max_setting_from_group_data + */ + public function test_get_max_setting_from_group($user_id, $expected, $setting) + { + $this->assertEquals($expected, phpbb_get_max_setting_from_group($this->db, $user_id, $setting)); + } + + /** + * @expectedException InvalidArgumentException + */ + public function test_get_max_setting_from_group_throws() + { + phpbb_get_max_setting_from_group($this->db, ANONYMOUS, 'not_a_setting'); + } +} diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php new file mode 100644 index 0000000000..6d2e1fa20a --- /dev/null +++ b/tests/functions_user/delete_user_test.php @@ -0,0 +1,450 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_functions_user_delete_user_test extends phpbb_database_test_case +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/delete_user.xml'); + } + + protected function setUp() + { + parent::setUp(); + + global $cache, $config, $db, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path; + + $db = $this->db = $this->new_dbal(); + $config = new \phpbb\config\config(array( + 'load_online_time' => 5, + 'search_type' => '\phpbb\search\fulltext_mysql', + )); + $cache = new phpbb_mock_null_cache(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $phpbb_container = new phpbb_mock_container_builder(); + $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); + // Works as a workaround for tests + $phpbb_container->set('attachment.manager', new \phpbb\attachment\delete($config, $db, new \phpbb_mock_event_dispatcher(), new \phpbb\filesystem\filesystem(), new \phpbb\attachment\resync($db), $phpbb_root_path)); + $phpbb_container->set( + 'auth.provider.db', + new phpbb_mock_auth_provider() + ); + $provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config); + $provider_collection->add('auth.provider.db'); + $phpbb_container->set( + 'auth.provider_collection', + $provider_collection + ); + } + + public function first_last_post_data() + { + return array( + array( + 'retain', false, + array( + array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => ''), + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => ''), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 1, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 3, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + array( + 'remove', false, + array( + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + array( + 'retain', true, + array( + array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => 'Foobar'), + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => 'Foobar'), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 1, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Foobar', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Foobar', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 3, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Foobar', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Foobar', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Foobar', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Foobar', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + array( + 'remove', true, + array( + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + ); + } + + /** + * @dataProvider first_last_post_data + */ + public function test_first_last_post_info($mode, $retain_username, $expected_posts, $expected_topics, $expected_forums) + { + $this->assertFalse(user_delete($mode, 2, $retain_username)); + + $sql = 'SELECT post_id, poster_id, post_username + FROM ' . POSTS_TABLE . ' + ORDER BY post_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_posts, $this->db->sql_fetchrowset($result), 'Post table poster info is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT topic_id, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour + FROM ' . TOPICS_TABLE . ' + ORDER BY topic_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_topics, $this->db->sql_fetchrowset($result), 'Topic table first/last poster info is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT forum_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour + FROM ' . FORUMS_TABLE . ' + ORDER BY forum_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_forums, $this->db->sql_fetchrowset($result), 'Forum table last poster info is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + } + + public function report_attachment_data() + { + return array( + array( + 'retain', + array( + array('post_id' => 1, 'post_reported' => 1, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 2, 'post_reported' => 1, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 3, 'post_reported' => 0, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 4, 'post_reported' => 0, 'post_edit_user' => 1, 'post_delete_user' => 1), + ), + array( + array('report_id' => 1, 'post_id' => 1, 'user_id' => 1), + array('report_id' => 3, 'post_id' => 2, 'user_id' => 1), + ), + array( + array('topic_id' => 1, 'topic_reported' => 1, 'topic_delete_user' => 1), + array('topic_id' => 2, 'topic_reported' => 1, 'topic_delete_user' => 1), + array('topic_id' => 3, 'topic_reported' => 0, 'topic_delete_user' => 1), + array('topic_id' => 4, 'topic_reported' => 0, 'topic_delete_user' => 1), + ), + array( + array('attach_id' => 1, 'post_msg_id' => 1, 'poster_id' => 1), + array('attach_id' => 2, 'post_msg_id' => 2, 'poster_id' => 1), + array('attach_id' => 3, 'post_msg_id' => 0, 'poster_id' => 1), // TODO should be deleted: PHPBB3-13089 + ), + ), + array( + 'remove', + array( + array('post_id' => 2, 'post_reported' => 1, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 4, 'post_reported' => 0, 'post_edit_user' => 1, 'post_delete_user' => 1), + ), + array( + array('report_id' => 3, 'post_id' => 2, 'user_id' => 1), + ), + array( + array('topic_id' => 2, 'topic_reported' => 1, 'topic_delete_user' => 1), + array('topic_id' => 4, 'topic_reported' => 0, 'topic_delete_user' => 1), + ), + array( + array('attach_id' => 2, 'post_msg_id' => 2, 'poster_id' => 1), + array('attach_id' => 3, 'post_msg_id' => 0, 'poster_id' => 2), // TODO should be deleted: PHPBB3-13089 + ), + ), + ); + } + + /** + * @dataProvider report_attachment_data + */ + public function test_report_attachment_info($mode, $expected_posts, $expected_reports, $expected_topics, $expected_attach) + { + $this->assertFalse(user_delete($mode, 2)); + + $sql = 'SELECT post_id, post_reported, post_edit_user, post_delete_user + FROM ' . POSTS_TABLE . ' + ORDER BY post_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_posts, $this->db->sql_fetchrowset($result), 'Post report status content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT report_id, post_id, user_id + FROM ' . REPORTS_TABLE . ' + ORDER BY report_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_reports, $this->db->sql_fetchrowset($result), 'Report table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT topic_id, topic_reported, topic_delete_user + FROM ' . TOPICS_TABLE . ' + ORDER BY topic_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_topics, $this->db->sql_fetchrowset($result), 'Topic report status is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT attach_id, post_msg_id, poster_id + FROM ' . ATTACHMENTS_TABLE . ' + ORDER BY attach_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_attach, $this->db->sql_fetchrowset($result), 'Attachment table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + } + + public function delete_data() + { + return array( + array( + 'retain', + array(array('user_id' => 1, 'user_posts' => 4)), + array(array('user_id' => 1, 'zebra_id' => 3)), + array(array('ban_id' => 2), array('ban_id' => 3)), + array(array('session_id' => '12345678901234567890123456789013')), + array( + array('log_id' => 2, 'user_id' => 1, 'reportee_id' => 1), + array('log_id' => 3, 'user_id' => 1, 'reportee_id' => 1), + ), + array( + array('msg_id' => 1, 'author_id' => 3, 'message_edit_user' => 3), + array('msg_id' => 2, 'author_id' => 1, 'message_edit_user' => 1), + ), + ), + array( + 'remove', + array(array('user_id' => 1, 'user_posts' => 2)), + array(array('user_id' => 1, 'zebra_id' => 3)), + array(array('ban_id' => 2), array('ban_id' => 3)), + array(array('session_id' => '12345678901234567890123456789013')), + array( + array('log_id' => 2, 'user_id' => 1, 'reportee_id' => 1), + array('log_id' => 3, 'user_id' => 1, 'reportee_id' => 1), + ), + array( + array('msg_id' => 1, 'author_id' => 3, 'message_edit_user' => 3), + array('msg_id' => 2, 'author_id' => 1, 'message_edit_user' => 1), + ), + ), + ); + } + + /** + * @dataProvider delete_data + */ + public function test_delete_data($mode, $expected_users, $expected_zebra, $expected_ban, $expected_sessions, $expected_logs, $expected_pms) + { + $this->assertFalse(user_delete($mode, 2)); + + $sql = 'SELECT user_id, user_posts + FROM ' . USERS_TABLE . ' + ORDER BY user_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_users, $this->db->sql_fetchrowset($result), 'User table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT user_id, zebra_id + FROM ' . ZEBRA_TABLE . ' + ORDER BY user_id ASC, zebra_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_zebra, $this->db->sql_fetchrowset($result), 'Zebra table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT ban_id + FROM ' . BANLIST_TABLE . ' + ORDER BY ban_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_ban, $this->db->sql_fetchrowset($result), 'Ban table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT session_id + FROM ' . SESSIONS_TABLE . ' + ORDER BY session_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_sessions, $this->db->sql_fetchrowset($result), 'Session table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT log_id, user_id, reportee_id + FROM ' . LOG_TABLE . ' + ORDER BY log_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_logs, $this->db->sql_fetchrowset($result), 'Log table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT msg_id, author_id, message_edit_user + FROM ' . PRIVMSGS_TABLE . ' + ORDER BY msg_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_pms, $this->db->sql_fetchrowset($result), 'Private messages table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + } + + public function delete_user_id_data() + { + return array( + array( + 'retain', + array( + USER_GROUP_TABLE, + TOPICS_WATCH_TABLE, + FORUMS_WATCH_TABLE, + ACL_USERS_TABLE, + TOPICS_TRACK_TABLE, + TOPICS_POSTED_TABLE, + FORUMS_TRACK_TABLE, + PROFILE_FIELDS_DATA_TABLE, + MODERATOR_CACHE_TABLE, + DRAFTS_TABLE, + BOOKMARKS_TABLE, + SESSIONS_KEYS_TABLE, + PRIVMSGS_FOLDER_TABLE, + PRIVMSGS_RULES_TABLE, + ), + ), + array( + 'remove', + array( + USER_GROUP_TABLE, + TOPICS_WATCH_TABLE, + FORUMS_WATCH_TABLE, + ACL_USERS_TABLE, + TOPICS_TRACK_TABLE, + TOPICS_POSTED_TABLE, + FORUMS_TRACK_TABLE, + PROFILE_FIELDS_DATA_TABLE, + MODERATOR_CACHE_TABLE, + DRAFTS_TABLE, + BOOKMARKS_TABLE, + SESSIONS_KEYS_TABLE, + PRIVMSGS_FOLDER_TABLE, + PRIVMSGS_RULES_TABLE, + ), + ), + ); + } + + /** + * @dataProvider delete_user_id_data + */ + public function test_delete_user_id_data($mode, $cleaned_tables) + { + $this->assertFalse(user_delete($mode, 2)); + + foreach ($cleaned_tables as $table) + { + $sql = 'SELECT user_id + FROM ' . $table . ' + WHERE user_id = 2'; + $result = $this->db->sql_query($sql); + $this->assertFalse($this->db->sql_fetchfield('user_id'), 'Found data for deleted user in table: ' . $table); + $this->db->sql_freeresult($result); + + $sql = 'SELECT user_id + FROM ' . $table . ' + WHERE user_id = 3'; + $result = $this->db->sql_query($sql); + $this->assertEquals(3, $this->db->sql_fetchfield('user_id'), 'Missing data for user in table: ' . $table); + $this->db->sql_freeresult($result); + } + } +} diff --git a/tests/functions_user/fixtures/delete_user.xml b/tests/functions_user/fixtures/delete_user.xml new file mode 100644 index 0000000000..56014b35d1 --- /dev/null +++ b/tests/functions_user/fixtures/delete_user.xml @@ -0,0 +1,549 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_attachments"> + <column>attach_id</column> + <column>post_msg_id</column> + <column>topic_id</column> + <column>in_message</column> + <column>poster_id</column> + <column>is_orphan</column> + <column>attach_comment</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value>2</value> + <value>0</value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + <row> + <value>3</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>2</value> + <value>1</value> + <value></value> + </row> + </table> + <table name="phpbb_banlist"> + <column>ban_id</column> + <column>ban_userid</column> + <column>ban_email</column> + <column>ban_reason</column> + <column>ban_give_reason</column> + <row> + <value>1</value> + <value>2</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>3</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>0</value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_forums"> + <column>forum_id</column> + <column>forum_last_poster_id</column> + <column>forum_last_poster_name</column> + <column>forum_last_poster_colour</column> + <column>forum_parents</column> + <column>forum_desc</column> + <column>forum_rules</column> + <row> + <value>1</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>Other</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>1</value> + <value>Other</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_log"> + <column>log_id</column> + <column>user_id</column> + <column>reportee_id</column> + <column>log_operation</column> + <column>log_data</column> + <row> + <value>1</value> + <value>1</value> + <value>2</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>2</value> + <value>2</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>poster_id</column> + <column>post_edit_user</column> + <column>post_delete_user</column> + <column>post_username</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_visibility</column> + <column>post_time</column> + <column>post_text</column> + <column>post_reported</column> + <row> + <value>1</value> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value>2</value> + <value>2</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + <row> + <value>3</value> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value>3</value> + <value>3</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + <row> + <value>4</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value>4</value> + <value>4</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + </table> + <table name="phpbb_privmsgs"> + <column>msg_id</column> + <column>author_id</column> + <column>message_edit_user</column> + <column>message_text</column> + <column>to_address</column> + <column>bcc_address</column> + <row> + <value>1</value> + <value>3</value> + <value>3</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_privmsgs_to"> + <column>msg_id</column> + <column>user_id</column> + <column>author_id</column> + <row> + <value>1</value> + <value>3</value> + <value>3</value> + </row> + <row> + <value>1</value> + <value>2</value> + <value>3</value> + </row> + <row> + <value>2</value> + <value>3</value> + <value>2</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + </row> + </table> + <table name="phpbb_reports"> + <column>report_id</column> + <column>post_id</column> + <column>user_id</column> + <column>report_text</column> + <column>reported_post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Post Removed?</value> + <value></value> + </row> + <row> + <value>2</value> + <value>3</value> + <value>2</value> + <value>Post Removed?</value> + <value></value> + </row> + <row> + <value>3</value> + <value>2</value> + <value>1</value> + <value>Keep</value> + <value></value> + </row> + <row> + <value>4</value> + <value>4</value> + <value>2</value> + <value>Remove Report</value> + <value></value> + </row> + </table> + <table name="phpbb_sessions"> + <column>session_id</column> + <column>session_user_id</column> + <column>session_page</column> + <row> + <value>12345678901234567890123456789012</value> + <value>2</value> + <value></value> + </row> + <row> + <value>12345678901234567890123456789013</value> + <value>3</value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <column>topic_reported</column> + <column>topic_poster</column> + <column>topic_delete_user</column> + <column>topic_first_poster_name</column> + <column>topic_first_poster_colour</column> + <column>topic_last_poster_id</column> + <column>topic_last_poster_name</column> + <column>topic_last_poster_colour</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>2</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value>2</value> + <value></value> + <value>00AA00</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value></value> + <value>1</value> + <value>Other</value> + <value></value> + </row> + <row> + <value>3</value> + <value>3</value> + <value>1</value> + <value>2</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value>2</value> + <value></value> + <value>00AA00</value> + </row> + <row> + <value>4</value> + <value>4</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value></value> + <value>1</value> + <value>Other</value> + <value></value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_posts</column> + <row> + <value>1</value> + <value>Anonymous</value> + <value>anonymous</value> + <value></value> + <value></value> + <value>2</value> + </row> + <row> + <value>2</value> + <value>Foobar</value> + <value>foobar</value> + <value></value> + <value></value> + <value>2</value> + </row> + </table> + <table name="phpbb_zebra"> + <column>user_id</column> + <column>zebra_id</column> + <row> + <value>1</value> + <value>2</value> + </row> + <row> + <value>1</value> + <value>3</value> + </row> + <row> + <value>2</value> + <value>1</value> + </row> + </table> + <table name="phpbb_user_group"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_topics_watch"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_forums_watch"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_acl_users"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_topics_track"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_forums_track"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_topics_posted"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_profile_fields_data"> + <column>user_id</column> + <column>pf_phpbb_interests</column> + <column>pf_phpbb_occupation</column> + <row> + <value>2</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_moderator_cache"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_bookmarks"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_sessions_keys"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_privmsgs_folder"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_privmsgs_rules"> + <column>user_id</column> + <column>rule_string</column> + <row> + <value>2</value> + <value></value> + </row> + <row> + <value>3</value> + <value></value> + </row> + </table> + <table name="phpbb_drafts"> + <column>user_id</column> + <column>draft_message</column> + <row> + <value>2</value> + <value></value> + </row> + <row> + <value>3</value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php index 86e4767970..6ccada44f8 100644 --- a/tests/functions_user/group_user_attributes_test.php +++ b/tests/functions_user/group_user_attributes_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -135,7 +139,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes $auth = $this->getMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_clear_prefetch'); - $cache_driver = new \phpbb\cache\driver\null(); + $cache_driver = new \phpbb\cache\driver\dummy(); $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) diff --git a/tests/group/helper_test.php b/tests/group/helper_test.php new file mode 100644 index 0000000000..2377a6f47c --- /dev/null +++ b/tests/group/helper_test.php @@ -0,0 +1,68 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_group_helper_test extends phpbb_test_case +{ + /** @var \phpbb\group\helper */ + protected $group_helper; + + public function setUp() + { + global $phpbb_root_path, $phpEx; + + // Set up language service + $lang = new \phpbb\language\language( + new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx) + ); + + // Set up language data for testing + $reflection_class = new ReflectionClass('\phpbb\language\language'); + + // Set default language files loaded flag to true + $loaded_flag = $reflection_class->getProperty('common_language_files_loaded'); + $loaded_flag->setAccessible(true); + $loaded_flag->setValue($lang, true); + + // Set up test language data + $lang_array = $reflection_class->getProperty('lang'); + $lang_array->setAccessible(true); + $lang_array->setValue($lang, $this->get_test_language_data_set()); + + // Set up group helper + $this->group_helper = new \phpbb\group\helper($lang); + } + + public function test_get_name() + { + // They should be totally fine + $this->assertEquals('Bots', $this->group_helper->get_name('Bots')); + $this->assertEquals('Some new group', $this->group_helper->get_name('new_group')); + $this->assertEquals('Should work', $this->group_helper->get_name('group_with_ümlauts')); + + // This should fail (obviously) + $this->assertNotEquals('They key does not contain uppercase letters', $this->group_helper->get_name('not_uppercase')); + + // The key doesn't exist so just return group name... + $this->assertEquals('Awesome group', $this->group_helper->get_name('Awesome group')); + } + + protected function get_test_language_data_set() + { + return array( + 'G_BOTS' => 'Bots', + 'G_NEW_GROUP' => 'Some new group', + 'G_not_uppercase' => 'The key does not contain uppercase letters', + 'G_GROUP_WITH_ÜMLAUTS' => 'Should work', + ); + } +} diff --git a/tests/groupposition/legend_test.php b/tests/groupposition/legend_test.php index ac54a86b8e..566a8a2935 100644 --- a/tests/groupposition/legend_test.php +++ b/tests/groupposition/legend_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -29,11 +33,13 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case */ public function test_get_group_value($group_id, $expected, $throws_exception) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); if ($throws_exception) @@ -47,11 +53,13 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case public function test_get_group_count() { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\legend($db, $user); @@ -87,11 +95,13 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case */ public function test_add_group($group_id, $expected_added, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\legend($db, $user); @@ -175,11 +185,13 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case */ public function test_delete_group($group_id, $skip_group, $expected_deleted, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\legend($db, $user); @@ -230,11 +242,13 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case */ public function test_move_up($group_id, $excepted_moved, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\legend($db, $user); @@ -285,11 +299,13 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case */ public function test_move_down($group_id, $excepted_moved, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\legend($db, $user); @@ -383,11 +399,13 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case */ public function test_move($group_id, $increment, $excepted_moved, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\legend($db, $user); diff --git a/tests/groupposition/teampage_test.php b/tests/groupposition/teampage_test.php index ec89f56775..dff52f7a43 100644 --- a/tests/groupposition/teampage_test.php +++ b/tests/groupposition/teampage_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -31,11 +35,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case */ public function test_get_group_value($group_id, $expected, $throws_exception) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); if ($throws_exception) @@ -49,11 +55,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case public function test_get_group_count() { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); @@ -133,11 +141,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case */ public function test_add_group_teampage($group_id, $parent_id, $expected_added, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); @@ -176,11 +186,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case */ public function test_add_category_teampage($group_name, $expected_added, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); @@ -243,11 +255,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case */ public function test_delete_group($group_id, $expected_deleted, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); @@ -295,11 +309,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case */ public function test_delete_teampage($teampage_id, $expected_deleted, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); @@ -458,11 +474,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case */ public function test_move($group_id, $move_delta, $excepted_moved, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); @@ -621,11 +639,13 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case */ public function test_move_teampage($teampage_id, $move_delta, $excepted_moved, $expected) { - global $cache; + global $cache, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = array(); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache); diff --git a/tests/help/manager_test.php b/tests/help/manager_test.php new file mode 100644 index 0000000000..68534d9a32 --- /dev/null +++ b/tests/help/manager_test.php @@ -0,0 +1,184 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_help_manager_test extends phpbb_test_case +{ + /** @var \phpbb\help\manager */ + protected $manager; + /** @var \phpbb\template\template */ + protected $template; + /** @var \phpbb\language\language */ + protected $language; + + public function setUp() + { + $this->template = $this->getMockBuilder('\phpbb\template\template') + ->disableOriginalConstructor() + ->getMock(); + $this->language = $this->getMockBuilder('\phpbb\language\language') + ->disableOriginalConstructor() + ->getMock(); + + $this->manager = new \phpbb\help\manager( + new \phpbb_mock_event_dispatcher(), + $this->language, + $this->template + ); + } + + public function add_block_data() + { + return array( + array('abc', false, array(), false), + array('def', true, array(), true), + array( + 'abc', + false, + array( + 'question1' => 'answer1', + 'question2' => 'answer2', + 'question3' => 'answer3', + ), + false + ), + ); + } + + /** + * @dataProvider add_block_data + * + * @param string $block_name + * @param bool $switch + * @param array $questions + * @param bool $switch_expected + */ + public function test_add_block($block_name, $switch, $questions, $switch_expected) + { + $this->language->expects($this->at(0)) + ->method('lang') + ->with($block_name) + ->willReturn(strtoupper($block_name)); + $lang_call_count = 1; + foreach ($questions as $question => $answer) + { + $this->language->expects($this->at($lang_call_count)) + ->method('lang') + ->with($question) + ->willReturn(strtoupper($question)); + $lang_call_count++; + + $this->language->expects($this->at($lang_call_count)) + ->method('lang') + ->with($answer) + ->willReturn(strtoupper($answer)); + $lang_call_count++; + } + + $this->template->expects($this->at(0)) + ->method('assign_block_vars') + ->with('faq_block', array( + 'BLOCK_TITLE' => strtoupper($block_name), + 'SWITCH_COLUMN' => $switch_expected, + )); + $template_call_count = 1; + foreach ($questions as $question => $answer) + { + $this->template->expects($this->at($template_call_count)) + ->method('assign_block_vars') + ->with('faq_block.faq_row', array( + 'FAQ_QUESTION' => strtoupper($question), + 'FAQ_ANSWER' => strtoupper($answer), + )); + $template_call_count++; + } + + $this->manager->add_block($block_name, $switch, $questions); + + $this->assertEquals($switch_expected, $this->manager->switched_column()); + } + + public function add_question_data() + { + return array( + array('abc', false, false), + array('def', true, true), + ); + } + + /** + * @dataProvider add_question_data + * + * @param string $question + * @param string $answer + */ + public function test_add_question($question, $answer) + { + $this->language->expects($this->at(0)) + ->method('lang') + ->with($question) + ->willReturn(strtoupper($question)); + $this->language->expects($this->at(1)) + ->method('lang') + ->with($answer) + ->willReturn(strtoupper($answer)); + + $this->template->expects($this->once()) + ->method('assign_block_vars') + ->with('faq_block.faq_row', array( + 'FAQ_QUESTION' => strtoupper($question), + 'FAQ_ANSWER' => strtoupper($answer), + )); + + $this->manager->add_question($question, $answer); + } + + public function test_add_block_double_switch() + { + $block_name = 'abc'; + $switch_expected = true; + + $this->language->expects($this->at(0)) + ->method('lang') + ->with($block_name) + ->willReturn(strtoupper($block_name)); + + $this->template->expects($this->at(0)) + ->method('assign_block_vars') + ->with('faq_block', array( + 'BLOCK_TITLE' => strtoupper($block_name), + 'SWITCH_COLUMN' => $switch_expected, + )); + + $this->manager->add_block($block_name, true); + $this->assertTrue($this->manager->switched_column()); + + // Add a second block with switch + $block_name = 'def'; + $switch_expected = false; + + $this->language->expects($this->at(0)) + ->method('lang') + ->with($block_name) + ->willReturn(strtoupper($block_name)); + + $this->template->expects($this->at(0)) + ->method('assign_block_vars') + ->with('faq_block', array( + 'BLOCK_TITLE' => strtoupper($block_name), + 'SWITCH_COLUMN' => $switch_expected, + )); + + $this->manager->add_block($block_name, true); + $this->assertTrue($this->manager->switched_column()); + } +} diff --git a/tests/installer/database_helper_test.php b/tests/installer/database_helper_test.php new file mode 100644 index 0000000000..ed355884f6 --- /dev/null +++ b/tests/installer/database_helper_test.php @@ -0,0 +1,157 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_installer_database_helper_test extends phpbb_test_case +{ + /** + * @var phpbb\install\helper\database + */ + private $database_helper; + + public function setUp() + { + $filesystem = new \phpbb\filesystem\filesystem(); + $phpbb_root_path = ''; + $this->database_helper = new \phpbb\install\helper\database($filesystem, $phpbb_root_path); + } + + /** + * @param string $input + * @param string $expected + * + * @dataProvider comment_string_provider + */ + public function test_remove_comments($input, $expected) + { + $this->assertEquals($expected, $this->database_helper->remove_comments($input)); + } + + /** + * @param array $expected + * @param string $sql + * @param string $delimiter + * + * @dataProvider sql_file_string_provider + */ + public function test_split_sql($expected, $sql, $delimiter) + { + $this->assertEquals($expected, $this->database_helper->split_sql_file($sql, $delimiter)); + } + + /** + * @param bool|array $expected + * @param string $test_string + * + * @dataProvider prefix_test_case_provider + */ + public function test_validate_table_prefix($expected, $test_string) + { + $db_helper_mock = $this->getMockBuilder('\phpbb\install\helper\database') + ->setMethods(array('get_available_dbms')) + ->disableOriginalConstructor() + ->getMock(); + + $db_helper_mock->method('get_available_dbms') + ->willReturn(array('sqlite3' => array( + 'LABEL' => 'SQLite3', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite3', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite3', + 'AVAILABLE' => true, + '2.0.x' => false, + ))); + + $this->assertEquals($expected, $db_helper_mock->validate_table_prefix('sqlite3', $test_string)); + } + + // Data provider for the remove comments function + public function comment_string_provider() + { + return array( + array( + 'abc', + 'abc', + ), + array( + 'abc /* asdf */', + "abc \n", + ), + array( + 'abc /* asdf */ f', + "abc \n f", + ), + array( + '# abc', + "\n", + ), + ); + } + + // Data provider for the sql file splitter function + public function sql_file_string_provider() + { + return array( + array( + array( + 'abcd "efgh"' . "\n" . 'qwerty', + 'SELECT * FROM table', + ), + 'abcd "efgh"' . "\n" . + 'qwerty;' . "\n" . + 'SELECT * FROM table', + ';', + ), + ); + } + + // Test data for prefix test + public function prefix_test_case_provider() + { + return array( + array( + true, + 'phpbb_', + ), + array( + true, + 'phpbb', + ), + array( + array( + array('title' => 'INST_ERR_DB_INVALID_PREFIX'), + ), + '1hpbb_', + ), + array( + array( + array('title' => 'INST_ERR_DB_INVALID_PREFIX'), + ), + '?hpbb_', + ), + array( + array( + array('title' => array('INST_ERR_PREFIX_TOO_LONG', 200)), + ), + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + ), + array( + array( + array('title' => 'INST_ERR_DB_INVALID_PREFIX'), + array('title' => array('INST_ERR_PREFIX_TOO_LONG', 200)), + ), + '_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + ), + ); + } +} diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php new file mode 100644 index 0000000000..c8e482e260 --- /dev/null +++ b/tests/installer/installer_config_test.php @@ -0,0 +1,79 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +use phpbb\install\helper\config; + +class phpbb_installer_config_test extends phpbb_test_case +{ + /** + * @var \phpbb\install\helper\config + */ + private $config; + + public function setUp() + { + $phpbb_root_path = __DIR__ . './../../phpBB/'; + $filesystem = $this->getMock('\phpbb\filesystem\filesystem'); + $php_ini = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper') + ->getMock(); + $php_ini->method('getInt') + ->willReturn(-1); + $php_ini->method('getBytes') + ->willReturn(-1); + + $this->config = new config($filesystem, $php_ini, $phpbb_root_path); + } + + public function test_set_get_var() + { + $this->config->set('foo', 'bar'); + $this->assertEquals('bar', $this->config->get('foo')); + } + + public function test_get_time_remaining() + { + $this->assertGreaterThan(0, $this->config->get_time_remaining()); + } + + public function test_get_memory_remaining() + { + $this->assertGreaterThan(0, $this->config->get_memory_remaining()); + } + + public function test_progress_tracking() + { + $this->config->set_finished_task('foo'); + $this->config->set_active_module('bar'); + $this->config->set_task_progress_count(10); + $this->config->increment_current_task_progress(); + + $progress_data = $this->config->get_progress_data(); + $this->assertEquals(1, $progress_data['current_task_progress']); + + $this->config->increment_current_task_progress(2); + + // We only want to check these values + $result = $this->config->get_progress_data(); + $expected_result = array( + 'last_task_module_name' => 'bar', + 'last_task_name' => 'foo', + 'max_task_progress' => 10, + 'current_task_progress' => 3, + ); + + foreach ($expected_result as $key => $value) + { + $this->assertEquals($value, $result[$key]); + } + } +} diff --git a/tests/installer/mocks/test_installer_module.php b/tests/installer/mocks/test_installer_module.php new file mode 100644 index 0000000000..e6ebbba263 --- /dev/null +++ b/tests/installer/mocks/test_installer_module.php @@ -0,0 +1,20 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class test_installer_module extends \phpbb\install\module_base +{ + public function get_navigation_stage_path() + { + return array(); + } +} diff --git a/tests/installer/mocks/test_installer_task_mock.php b/tests/installer/mocks/test_installer_task_mock.php new file mode 100644 index 0000000000..ccd62b3bf4 --- /dev/null +++ b/tests/installer/mocks/test_installer_task_mock.php @@ -0,0 +1,44 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class test_installer_task_mock extends \phpbb\install\task_base +{ + private $task_was_runned; + + public function __construct() + { + $this->task_was_runned = false; + + parent::__construct(); + } + + public function run() + { + $this->task_was_runned = true; + } + + public function was_task_runned() + { + return $this->task_was_runned; + } + + public function get_task_lang_name() + { + return ''; + } + + public static function get_step_count() + { + return 2; + } +} diff --git a/tests/installer/module_base_test.php b/tests/installer/module_base_test.php new file mode 100644 index 0000000000..9578010047 --- /dev/null +++ b/tests/installer/module_base_test.php @@ -0,0 +1,65 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once __DIR__ . '/mocks/test_installer_task_mock.php'; +require_once __DIR__ . '/mocks/test_installer_module.php'; + +class module_base_test extends phpbb_test_case +{ + /** + * @var \phpbb\install\module_interface + */ + protected $module; + + /** + * @var phpbb_mock_container_builder + */ + protected $container; + + public function setUp() + { + // DI container mock + $this->container = new phpbb_mock_container_builder(); + $this->container->set('task_one', new test_installer_task_mock()); + $this->container->set('task_two', new test_installer_task_mock()); + + // the collection + $module_collection = new \phpbb\di\ordered_service_collection($this->container); + $module_collection->add('task_one'); + $module_collection->add('task_two'); + $module_collection->add_service_class('task_one', 'test_installer_task_mock'); + $module_collection->add_service_class('task_two', 'test_installer_task_mock'); + + $this->module = new test_installer_module($module_collection, true, false); + + $iohandler = $this->getMock('\phpbb\install\helper\iohandler\iohandler_interface'); + $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '', 'php'); + $this->module->setup($config, $iohandler); + } + + public function test_run() + { + $this->module->run(); + + $task = $this->container->get('task_one'); + $this->assertTrue($task->was_task_runned()); + + $task = $this->container->get('task_two'); + $this->assertTrue($task->was_task_runned()); + } + + public function test_step_count() + { + $this->assertEquals(4, $this->module->get_step_count()); + } +} diff --git a/tests/installer/navigation_provider_test.php b/tests/installer/navigation_provider_test.php new file mode 100644 index 0000000000..ea39af66cd --- /dev/null +++ b/tests/installer/navigation_provider_test.php @@ -0,0 +1,34 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_installer_navigation_provider_test extends phpbb_test_case +{ + public function test_navigation() + { + // Mock nav interface + $nav_stub = $this->getMockBuilder('\phpbb\install\helper\navigation\navigation_interface') + ->getMock(); + $nav_stub->method('get') + ->willReturn(array('foo' => 'bar')); + + // Set up dependencies + $container = new phpbb_mock_container_builder(); + $container->set('foo', $nav_stub); + $nav_collection = new \phpbb\di\service_collection($container); + $nav_collection->add('foo'); + + // Let's test + $nav_provider = new \phpbb\install\helper\navigation\navigation_provider($nav_collection); + $this->assertEquals(array('foo' => 'bar'), $nav_provider->get()); + } +} diff --git a/tests/language/language_test.php b/tests/language/language_test.php new file mode 100644 index 0000000000..6a814e39dc --- /dev/null +++ b/tests/language/language_test.php @@ -0,0 +1,224 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_language_test extends phpbb_test_case +{ + /** @var \phpbb\language\language */ + protected $lang; + + public function setUp() + { + global $phpbb_root_path, $phpEx; + + // Set up language service + $this->lang = new \phpbb\language\language( + new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx) + ); + + // Set up language data for testing + $reflection_class = new ReflectionClass('\phpbb\language\language'); + + // Set default language files loaded flag to true + $loaded_flag = $reflection_class->getProperty('common_language_files_loaded'); + $loaded_flag->setAccessible(true); + $loaded_flag->setValue($this->lang, true); + + // Set up test language data + $lang_array = $reflection_class->getProperty('lang'); + $lang_array->setAccessible(true); + $lang_array->setValue($this->lang, $this->get_test_data_set()); + } + + public function test_is_set() + { + // Check for non-existing key + $this->assertFalse($this->lang->is_set('VALUE')); + $this->assertFalse($this->lang->is_set(array('dateformat', 'MAYBE'))); + + // Check for existing key + $this->assertTrue($this->lang->is_set('FOO')); + $this->assertTrue($this->lang->is_set(array('dateformat', 'AGO'))); + + // Array doesn't exist at all... + $this->assertFalse($this->lang->is_set(array('PHPBB', 'PHP'))); + } + + public function test_lang() + { + // No param + $this->assertEquals($this->lang->lang('FOO'), 'BAR'); + $this->assertEquals($this->lang->lang('EMPTY'), ''); + $this->assertEquals($this->lang->lang('ZERO'), '0'); + + // Invalid index + $this->assertEquals($this->lang->lang('VOID'), 'VOID'); + + // Unnecessary param + $this->assertEquals($this->lang->lang('FOO', 2), 'BAR'); + $this->assertEquals($this->lang->lang('FOO', 2, 3), 'BAR'); + $this->assertEquals($this->lang->lang('FOO', 2, 3, 'BARZ'), 'BAR'); + + // String + $this->assertEquals($this->lang->lang('STR', 24, 'x', 42), '24 x, 42 topics'); + $this->assertEquals($this->lang->lang('STR2', 64), '64 foos'); + + // Array + $this->assertEquals($this->lang->lang('ARRY', 0), 'No posts'); + $this->assertEquals($this->lang->lang('ARRY', 1), '1 post'); + $this->assertEquals($this->lang->lang('ARRY', 2), '2 posts'); + $this->assertEquals($this->lang->lang('ARRY', 123), '123 posts'); + + // Empty array returns the language key + $this->assertEquals($this->lang->lang('ARRY_EMPTY', 123), 'ARRY_EMPTY'); + + // No 0 key defined + $this->assertEquals($this->lang->lang('ARRY_NO_ZERO', 0), '0 posts'); + $this->assertEquals($this->lang->lang('ARRY_NO_ZERO', 1), '1 post'); + $this->assertEquals($this->lang->lang('ARRY_NO_ZERO', 2), '2 posts'); + + // Array with missing keys + $this->assertEquals($this->lang->lang('ARRY_MISSING', 2), '2 post'); + + // Floats as array key + $this->assertEquals($this->lang->lang('ARRY_FLOAT', 1.3), '1 post'); + $this->assertEquals($this->lang->lang('ARRY_FLOAT', 2.0), '2.0 posts'); + $this->assertEquals($this->lang->lang('ARRY_FLOAT', 2.51), '2.5 posts'); + + // Use sub key, if first paramenter is an array + $this->assertEquals($this->lang->lang(array('dateformat', 'AGO'), 2), '2 seconds'); + + // ticket PHPBB3-9949 - use first int to determinate the plural-form to use + $this->assertEquals($this->lang->lang('ARRY', 1, 2), '1 post'); + $this->assertEquals($this->lang->lang('ARRY', 1, 's', 2), '1 post'); + } + + public function test_lang_plural_rules() + { + $this->assertEquals($this->lang->lang('PLURAL_ARRY', 0), '0 is 0'); + $this->assertEquals($this->lang->lang('PLURAL_ARRY', 1), '1 is 1'); + $this->assertEquals($this->lang->lang('PLURAL_ARRY', 103), '103 ends with 01-10'); + $this->assertEquals($this->lang->lang('PLURAL_ARRY', 15), '15 ends with 11-19'); + $this->assertEquals($this->lang->lang('PLURAL_ARRY', 300), '300 is part of the last rule'); + } + + public function test_lang_bc() + { + $user = new \phpbb\user($this->lang, '\phpbb\datetime'); + + // Test lang array access + $this->assertEquals($user->lang['FOO'], 'BAR'); + + // No param + $this->assertEquals($user->lang('FOO'), 'BAR'); + $this->assertEquals($user->lang('EMPTY'), ''); + $this->assertEquals($user->lang('ZERO'), '0'); + + // Invalid index + $this->assertEquals($user->lang('VOID'), 'VOID'); + + // Unnecessary param + $this->assertEquals($user->lang('FOO', 2), 'BAR'); + $this->assertEquals($user->lang('FOO', 2, 3), 'BAR'); + $this->assertEquals($user->lang('FOO', 2, 3, 'BARZ'), 'BAR'); + + // String + $this->assertEquals($user->lang('STR', 24, 'x', 42), '24 x, 42 topics'); + $this->assertEquals($user->lang('STR2', 64), '64 foos'); + + // Array + $this->assertEquals($user->lang('ARRY', 0), 'No posts'); + $this->assertEquals($user->lang('ARRY', 1), '1 post'); + $this->assertEquals($user->lang('ARRY', 2), '2 posts'); + $this->assertEquals($user->lang('ARRY', 123), '123 posts'); + + // Empty array returns the language key + $this->assertEquals($user->lang('ARRY_EMPTY', 123), 'ARRY_EMPTY'); + + // No 0 key defined + $this->assertEquals($user->lang('ARRY_NO_ZERO', 0), '0 posts'); + $this->assertEquals($user->lang('ARRY_NO_ZERO', 1), '1 post'); + $this->assertEquals($user->lang('ARRY_NO_ZERO', 2), '2 posts'); + + // Array with missing keys + $this->assertEquals($user->lang('ARRY_MISSING', 2), '2 post'); + + // Floats as array key + $this->assertEquals($user->lang('ARRY_FLOAT', 1.3), '1 post'); + $this->assertEquals($user->lang('ARRY_FLOAT', 2.0), '2.0 posts'); + $this->assertEquals($user->lang('ARRY_FLOAT', 2.51), '2.5 posts'); + + // Use sub key, if first paramenter is an array + $this->assertEquals($user->lang(array('dateformat', 'AGO'), 2), '2 seconds'); + + // ticket PHPBB3-9949 - use first int to determinate the plural-form to use + $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); + $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); + } + + public function test_lang_plural_rules_bc() + { + $user = new \phpbb\user($this->lang, '\phpbb\datetime'); + + // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ + $this->assertEquals($user->lang('PLURAL_ARRY', 0), '0 is 0'); + $this->assertEquals($user->lang('PLURAL_ARRY', 1), '1 is 1'); + $this->assertEquals($user->lang('PLURAL_ARRY', 103), '103 ends with 01-10'); + $this->assertEquals($user->lang('PLURAL_ARRY', 15), '15 ends with 11-19'); + $this->assertEquals($user->lang('PLURAL_ARRY', 300), '300 is part of the last rule'); + } + + protected function get_test_data_set() + { + return array( + 'FOO' => 'BAR', + 'BARZ' => 'PENG', + 'EMPTY' => '', + 'ZERO' => '0', + 'STR' => '%d %s, %d topics', + 'STR2' => '%d foos', + 'ARRY' => array( + 0 => 'No posts', // 0 + 1 => '1 post', // 1 + 2 => '%d posts', // 2+ + ), + 'ARRY_NO_ZERO' => array( + 1 => '1 post', // 1 + 2 => '%d posts', // 0, 2+ + ), + 'ARRY_MISSING' => array( + 1 => '%d post', // 1 + //Missing second plural + ), + 'ARRY_FLOAT' => array( + 1 => '1 post', // 1.x + 2 => '%1$.1f posts', // 0.x, 2+.x + ), + 'ARRY_EMPTY' => array( + ), + 'dateformat' => array( + 'AGO' => array( + 1 => '%d second', + 2 => '%d seconds', + ), + ), + 'PLURAL_RULE' => 13, + 'PLURAL_ARRY' => array( + 0 => '%d is 0', // 0 + 1 => '%d is 1', // 1 + 2 => '%d ends with 01-10', // ending with 01-10 + 3 => '%d ends with 11-19', // ending with 11-19 + 4 => '%d is part of the last rule', // everything else + ), + ); + } +} diff --git a/tests/lint_test.php b/tests/lint_test.php index b0149063bd..70046bdfd2 100644 --- a/tests/lint_test.php +++ b/tests/lint_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -34,31 +38,34 @@ class phpbb_lint_test extends phpbb_test_case self::markTestSkipped(sprintf('Could not run PHP_BINARY %s. Output: %s', self::$php_binary, $output)); } } - - self::$exclude = array( - dirname(__FILE__) . '/../.git', - dirname(__FILE__) . '/../build/new_version', - dirname(__FILE__) . '/../build/old_versions', - dirname(__FILE__) . '/../phpBB/cache', - // PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20 - // https://gist.github.com/e003913ffd493da63cbc - dirname(__FILE__) . '/../phpBB/vendor', - ); } - public function test_lint() + /** + * @dataProvider lint_data + */ + public function test_lint($path) { if (version_compare(PHP_VERSION, '5.3.0', '<')) { $this->markTestSkipped('phpBB uses PHP 5.3 syntax in some files, linting on PHP < 5.3 will fail'); } - $root = dirname(__FILE__) . '/..'; - $this->check($root); + $cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path)); + $output = array(); + $status = 1; + exec($cmd, $output, $status); + $output = implode("\n", $output); + $this->assertEquals(0, $status, "PHP lint failed for $path:\n$output"); + } + + public function lint_data() + { + return $this->check(dirname(__FILE__) . '/..'); } protected function check($root) { + $files = array(); $dh = opendir($root); while (($filename = readdir($dh)) !== false) { @@ -72,19 +79,25 @@ class phpbb_lint_test extends phpbb_test_case { continue; } - if (is_dir($path) && !in_array($path, self::$exclude)) + if (is_dir($path) && !in_array($path, array( + dirname(__FILE__) . '/../.git', + dirname(__FILE__) . '/../build/new_version', + dirname(__FILE__) . '/../build/old_versions', + dirname(__FILE__) . '/../phpBB/cache', + dirname(__FILE__) . '/../phpBB/ext', + dirname(__FILE__) . '/../phpBB/store', + // PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20 + // https://gist.github.com/e003913ffd493da63cbc + dirname(__FILE__) . '/../phpBB/vendor', + ))) { - $this->check($path); + $files = array_merge($files, $this->check($path)); } else if (substr($filename, strlen($filename)-4) == '.php') { - $cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path)); - $output = array(); - $status = 1; - exec($cmd, $output, $status); - $output = implode("\n", $output); - $this->assertEquals(0, $status, "PHP lint failed for $path:\n$output"); + $files[] = array($path); } } + return $files; } } diff --git a/tests/lock/db_test.php b/tests/lock/db_test.php index da689b7fa3..389eab4152 100644 --- a/tests/lock/db_test.php +++ b/tests/lock/db_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -26,7 +30,6 @@ class phpbb_lock_db_test extends phpbb_database_test_case $db = $this->db = $this->new_dbal(); $config = $this->config = new \phpbb\config\config(array('rand_seed' => '', 'rand_seed_last_update' => '0')); - set_config(null, null, null, $this->config); $this->lock = new \phpbb\lock\db('test_lock', $this->config, $this->db); } diff --git a/tests/lock/flock_test.php b/tests/lock/flock_test.php index 5e5ac5aa78..554b7e57f4 100644 --- a/tests/lock/flock_test.php +++ b/tests/lock/flock_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -79,9 +83,9 @@ class phpbb_lock_flock_test extends phpbb_test_case sleep(1); $lock = new \phpbb\lock\flock($path); - $start = time(); + $start = microtime(true); $ok = $lock->acquire(); - $delta = time() - $start; + $delta = microtime(true) - $start; $this->assertTrue($ok); $this->assertTrue($lock->owns_lock()); $this->assertGreaterThan(0.5, $delta, 'First lock acquired too soon'); @@ -90,9 +94,9 @@ class phpbb_lock_flock_test extends phpbb_test_case $this->assertFalse($lock->owns_lock()); // acquire again, this should be instantaneous - $start = time(); + $start = microtime(true); $ok = $lock->acquire(); - $delta = time() - $start; + $delta = microtime(true) - $start; $this->assertTrue($ok); $this->assertTrue($lock->owns_lock()); $this->assertLessThan(0.1, $delta, 'Second lock not acquired instantaneously'); diff --git a/tests/log/add_test.php b/tests/log/add_test.php index 032546f002..cfc592a464 100644 --- a/tests/log/add_test.php +++ b/tests/log/add_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -23,7 +27,9 @@ class phpbb_log_add_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $auth = $this->getMock('\phpbb\auth\auth'); $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); @@ -52,7 +58,9 @@ class phpbb_log_add_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $auth = $this->getMock('\phpbb\auth\auth'); $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php new file mode 100644 index 0000000000..fe4c3835cb --- /dev/null +++ b/tests/log/delete_test.php @@ -0,0 +1,159 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_log_delete_test extends phpbb_database_test_case +{ + protected $log; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/delete_log.xml'); + } + + protected function setUp() + { + global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth; + + $db = $this->new_dbal(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->data['user_id'] = 1; + $auth = $this->getMock('\phpbb\auth\auth'); + + $this->log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + + parent::setUp(); + } + + public function log_delete_data() + { + return array( + array( + array(1, 2), + array(16), + array(), + 'admin', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(11), + array(), + array('keywords' => 'guest'), + 'mod', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + 'guest', + ), + array( + array(4, 5, 7), + array(), + array('forum_id' => 12, 'user_id' => 1), + 'mod', + false, + 0, + 0, + 12, + 0, + 1, + 0, + 'l.log_id ASC', + '', + ), + array( + array(12, 13), + array(), + array('forum_id' => array('IN' => array(14, 13))), + 'mod', + false, + 0, + 0, + array(13, 14), + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(3, 14, 15), + array(3), + array('user_id' => array('>', 1)), + 'critical', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(3, 14, 15), + array(), + array('keywords' => ''), + 'critical', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + ); + } + + /** + * @dataProvider log_delete_data + */ + public function test_log_delete($expected_before, $expected_after, $delete_conditions, $mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords) + { + $this->assertSame($expected_before, $this->get_ids($this->log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords)), 'before'); + $this->log->delete($mode, $delete_conditions); + $this->assertSame($expected_after, $this->get_ids($this->log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords)), 'after'); + } + + public function get_ids($logs) + { + $ids = array(); + foreach ($logs as $log_entry) + { + $ids[] = (int) $log_entry['id']; + } + return $ids; + } +} diff --git a/tests/log/fixtures/delete_log.xml b/tests/log/fixtures/delete_log.xml new file mode 100644 index 0000000000..393c686f0c --- /dev/null +++ b/tests/log/fixtures/delete_log.xml @@ -0,0 +1,248 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_log"> + <column>log_id</column> + <column>log_type</column> + <column>user_id</column> + <column>forum_id</column> + <column>topic_id</column> + <column>post_id</column> + <column>reportee_id</column> + <column>log_ip</column> + <column>log_time</column> + <column>log_operation</column> + <column>log_data</column> + <row> + <value>1</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_INSTALL_INSTALLED</value> + <value>a:1:{i:0;s:9:"3.1.0-dev";}</value> + </row> + <row> + <value>2</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_KEY_NOT_EXISTS</value> + <value>a:1:{i:0;s:15:"additional_data";}</value> + </row> + <row> + <value>3</value> + <value>2</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_CRITICAL</value> + <value>a:1:{i:0;s:13:"critical data";}</value> + </row> + <row> + <value>4</value> + <value>1</value> + <value>1</value> + <value>12</value> + <value>34</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD</value> + <value></value> + </row> + <row> + <value>5</value> + <value>1</value> + <value>1</value> + <value>12</value> + <value>45</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD</value> + <value></value> + </row> + <row> + <value>6</value> + <value>1</value> + <value>1</value> + <value>23</value> + <value>56</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD</value> + <value></value> + </row> + <row> + <value>7</value> + <value>1</value> + <value>1</value> + <value>12</value> + <value>45</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD2</value> + <value></value> + </row> + <row> + <value>8</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>2</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_USER</value> + <value>a:1:{i:0;s:5:"admin";}</value> + </row> + <row> + <value>9</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>1</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_USER</value> + <value>a:1:{i:0;s:5:"guest";}</value> + </row> + <row> + <value>10</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_SINGULAR_PLURAL</value> + <value>a:1:{i:0;i:2;}</value> + </row> + <row> + <value>11</value> + <value>1</value> + <value>1</value> + <value>15</value> + <value>3</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD3</value> + <value>a:1:{i:0;s:5:"guest";}</value> + </row> + <row> + <value>12</value> + <value>1</value> + <value>1</value> + <value>13</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>13</value> + <value>1</value> + <value>1</value> + <value>14</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>14</value> + <value>2</value> + <value>2</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>15</value> + <value>2</value> + <value>2</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>1</value> + <value>Anonymous</value> + <value>Anonymous</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>admin</value> + <value>admin</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <row> + <value>34</value> + <value>12</value> + </row> + <row> + <value>45</value> + <value>12</value> + </row> + <row> + <value>56</value> + <value>23</value> + </row> + </table> +</dataset> diff --git a/tests/log/fixtures/empty_log.xml b/tests/log/fixtures/empty_log.xml index 261b6a622a..47fd639b17 100644 --- a/tests/log/fixtures/empty_log.xml +++ b/tests/log/fixtures/empty_log.xml @@ -6,6 +6,7 @@ <column>user_id</column> <column>forum_id</column> <column>topic_id</column> + <column>post_id</column> <column>reportee_id</column> <column>log_ip</column> <column>log_time</column> diff --git a/tests/log/fixtures/full_log.xml b/tests/log/fixtures/full_log.xml index a10c224e0e..5b9ded9ffb 100644 --- a/tests/log/fixtures/full_log.xml +++ b/tests/log/fixtures/full_log.xml @@ -6,6 +6,7 @@ <column>user_id</column> <column>forum_id</column> <column>topic_id</column> + <column>post_id</column> <column>reportee_id</column> <column>log_ip</column> <column>log_time</column> @@ -18,6 +19,7 @@ <value>0</value> <value>0</value> <value>0</value> + <value>0</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_INSTALL_INSTALLED</value> @@ -30,6 +32,7 @@ <value>0</value> <value>0</value> <value>0</value> + <value>0</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_KEY_NOT_EXISTS</value> @@ -42,6 +45,7 @@ <value>0</value> <value>0</value> <value>0</value> + <value>0</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_CRITICAL</value> @@ -54,6 +58,7 @@ <value>12</value> <value>34</value> <value>0</value> + <value>0</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_MOD</value> @@ -66,6 +71,7 @@ <value>12</value> <value>45</value> <value>0</value> + <value>0</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_MOD</value> @@ -78,6 +84,7 @@ <value>23</value> <value>56</value> <value>0</value> + <value>0</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_MOD</value> @@ -90,6 +97,7 @@ <value>12</value> <value>45</value> <value>0</value> + <value>0</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_MOD2</value> @@ -101,6 +109,7 @@ <value>1</value> <value>0</value> <value>0</value> + <value>0</value> <value>2</value> <value>127.0.0.1</value> <value>1</value> @@ -113,12 +122,39 @@ <value>1</value> <value>0</value> <value>0</value> + <value>0</value> <value>1</value> <value>127.0.0.1</value> <value>1</value> <value>LOG_USER</value> <value>a:1:{i:0;s:5:"guest";}</value> </row> + <row> + <value>10</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_SINGULAR_PLURAL</value> + <value>a:1:{i:0;i:2;}</value> + </row> + <row> + <value>11</value> + <value>1</value> + <value>1</value> + <value>15</value> + <value>3</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD3</value> + <value>a:1:{i:0;s:5:"guest";}</value> + </row> </table> <table name="phpbb_users"> <column>user_id</column> diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php index e1bcd4acaf..cdfeb52996 100644 --- a/tests/log/function_add_log_test.php +++ b/tests/log/function_add_log_test.php @@ -1,13 +1,17 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_compatibility.php'; class phpbb_log_function_add_log_test extends phpbb_database_test_case { @@ -157,7 +161,10 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user'); + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); $auth = $this->getMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index 017484e8a7..81b1f4a78c 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -36,15 +40,16 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 0, 'topic_id' => 0, + 'post_id' => 0, 'viewforum' => '', - 'action' => 'installed: 3.1.0-dev', + 'action' => 'LOG_INSTALL_INSTALLED 3.1.0-dev', ), 2 => array( 'id' => 2, @@ -55,12 +60,13 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 0, 'topic_id' => 0, + 'post_id' => 0, 'viewforum' => '', 'action' => '{LOG KEY NOT EXISTS}<br />additional_data', @@ -74,12 +80,13 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 0, 'topic_id' => 0, + 'post_id' => 0, 'viewforum' => '', 'action' => '{LOG CRITICAL}<br />critical data', @@ -93,16 +100,18 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 12, 'topic_id' => 34, + 'post_id' => 0, 'viewforum' => '', 'action' => '{LOG MOD}', 'viewtopic' => '', + 'viewpost' => '', 'viewlogs' => '', ), 5 => array( @@ -114,16 +123,18 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 12, 'topic_id' => 45, + 'post_id' => 0, 'viewforum' => '', 'action' => '{LOG MOD}', 'viewtopic' => '', + 'viewpost' => '', 'viewlogs' => '', ), 6 => array( @@ -135,16 +146,18 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 23, 'topic_id' => 56, + 'post_id' => 0, 'viewforum' => append_sid("phpBB/viewforum.$phpEx", 'f=23'), 'action' => '{LOG MOD}', 'viewtopic' => append_sid("phpBB/viewtopic.$phpEx", 'f=23&t=56'), + 'viewpost' => '', 'viewlogs' => append_sid("phpBB/mcp.$phpEx", 'i=logs&mode=topic_logs&t=56'), ), 7 => array( @@ -156,16 +169,18 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 12, 'topic_id' => 45, + 'post_id' => 0, 'viewforum' => '', - 'action' => '{LOG MOD2}', + 'action' => 'LOG_MOD2', 'viewtopic' => '', + 'viewpost' => '', 'viewlogs' => '', ), 8 => array( @@ -173,38 +188,83 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'reportee_id' => 2, 'reportee_username' => 'admin', - 'reportee_username_full'=> 'admin', + 'reportee_username_full'=> '<span class="username">admin</span>', 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 0, 'topic_id' => 0, + 'post_id' => 0, 'viewforum' => '', - 'action' => '{LOG USER}<br />admin', + 'action' => 'LOG_USER admin', ), 9 => array( 'id' => 9, 'reportee_id' => 1, 'reportee_username' => 'Anonymous', - 'reportee_username_full'=> 'Anonymous', + 'reportee_username_full'=> '<span class="username">Anonymous</span>', + + 'user_id' => 1, + 'username' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', + + 'ip' => '127.0.0.1', + 'time' => 1, + 'forum_id' => 0, + 'topic_id' => 0, + 'post_id' => 0, + + 'viewforum' => '', + 'action' => 'LOG_USER guest', + ), + 10 => array( + 'id' => 10, + + 'reportee_id' => 0, + 'reportee_username' => '', + 'reportee_username_full'=> '', 'user_id' => 1, 'username' => 'Anonymous', - 'username_full' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, 'forum_id' => 0, 'topic_id' => 0, + 'post_id' => 0, 'viewforum' => '', - 'action' => '{LOG USER}<br />guest', + 'action' => 'LOG_SINGULAR_PLURAL 2', + ), + 11 => array( + 'id' => 11, + + 'reportee_id' => 0, + 'reportee_username' => '', + 'reportee_username_full'=> '', + + 'user_id' => 1, + 'username' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', + + 'ip' => '127.0.0.1', + 'time' => 1, + 'forum_id' => 15, + 'topic_id' => 3, + 'post_id' => 0, + + 'viewforum' => '', + 'action' => 'LOG_MOD3 guest ', + 'viewtopic' => '', + 'viewpost' => '', + 'viewlogs' => '', ), ); @@ -277,10 +337,25 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'user', 0, 5, 0, 0, 0, 2, ), array( - 'expected' => array(8, 9), + 'expected' => array(8, 9, 10), 'expected_returned' => 0, 'users', 0, ), + array( + 'expected' => array(1), + 'expected_returned' => 0, + 'admin', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'install', + ), + array( + 'expected' => array(10), + 'expected_returned' => 0, + 'user', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'plural', + ), + array( + 'expected' => array(11), + 'expected_returned' => 0, + 'mod', 0, 5, 0, 15, 3, + ), ); foreach ($test_cases as $case => $case_data) @@ -331,6 +406,13 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case // Test sprintf() of the data into the action $user->lang = array( 'LOG_INSTALL_INSTALLED' => 'installed: %s', + 'LOG_USER' => 'User<br /> %s', + 'LOG_MOD2' => 'Mod2', + 'LOG_MOD3' => 'Mod3: %1$s, %2$s', + 'LOG_SINGULAR_PLURAL' => array( + 1 => 'singular', + 2 => 'plural (%d)', + ), ); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/migrator/convert_timezones_test.php b/tests/migrator/convert_timezones_test.php new file mode 100644 index 0000000000..f8d780da0c --- /dev/null +++ b/tests/migrator/convert_timezones_test.php @@ -0,0 +1,101 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case +{ + protected $notifications, $db, $container, $user, $config, $auth, $cache; + + public function getDataSet() + { + $this->db = $this->new_dbal(); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db); + + // user_dst doesn't exist anymore, must re-add it to test this + $db_tools->sql_column_add('phpbb_users', 'user_dst', array('BOOL', 1)); + + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/convert_timezones.xml'); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_dst', + ), + ), + ); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_dst' => array('BOOL', 0), + ), + ), + ); + } + + protected function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + $this->db = $this->new_dbal(); + $factory = new \phpbb\db\tools\factory(); + + $this->migration = new \phpbb\db\migration\data\v310\timezone( + new \phpbb\config\config(array()), + $this->db, + $factory->get($this->db), + $phpbb_root_path, + $phpEx, + 'phpbb_' + ); + } + + protected $expected_results = array( + //user_id => user_timezone + 1 => 'Etc/GMT+12', + 2 => 'Etc/GMT+11', + 3 => 'Etc/GMT-3', + 4 => 'Etc/GMT-4', + 5 => 'America/St_Johns', + 6 => 'Australia/Eucla', + ); + + public function test_convert() + { + $this->migration->update_timezones(0); + + $sql = 'SELECT user_id, user_timezone + FROM phpbb_users + ORDER BY user_id ASC'; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $this->assertEquals($this->expected_results[$row['user_id']], $row['user_timezone']); + } + $this->db->sql_freeresult($result); + + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db); + + // Remove the user_dst field again + $db_tools->sql_column_remove('phpbb_users', 'user_dst'); + } +} diff --git a/tests/migrator/fixtures/convert_timezones.xml b/tests/migrator/fixtures/convert_timezones.xml new file mode 100644 index 0000000000..b02cf8393c --- /dev/null +++ b/tests/migrator/fixtures/convert_timezones.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_timezone</column> + <column>user_dst</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + <value></value> + <value>-12</value> + <value>0</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value></value> + <value>-12</value> + <value>1</value> + </row> + <row> + <value>3</value> + <value>3</value> + <value>3</value> + <value></value> + <value></value> + <value>3</value> + <value>0</value> + </row> + <row> + <value>4</value> + <value>4</value> + <value>4</value> + <value></value> + <value></value> + <value>3</value> + <value>1</value> + </row> + <row> + <value>5</value> + <value>5</value> + <value>5</value> + <value></value> + <value></value> + <value>-3.5</value> + <value>0</value> + </row> + <row> + <value>6</value> + <value>6</value> + <value>6</value> + <value></value> + <value></value> + <value>8.75</value> + <value>0</value> + </row> + </table> +</dataset> diff --git a/tests/migrator/get_schema_steps_test.php b/tests/migrator/get_schema_steps_test.php index 226535754e..3d15d2b200 100644 --- a/tests/migrator/get_schema_steps_test.php +++ b/tests/migrator/get_schema_steps_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php new file mode 100644 index 0000000000..40a8343e22 --- /dev/null +++ b/tests/migrator/schema_generator_test.php @@ -0,0 +1,139 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../dbal/migration/dummy_order.php'; +require_once __DIR__ . '/../dbal/migration/dummy_order_0.php'; +require_once __DIR__ . '/../dbal/migration/dummy_order_1.php'; +require_once __DIR__ . '/../dbal/migration/dummy_order_2.php'; +require_once __DIR__ . '/../dbal/migration/dummy_order_3.php'; +require_once __DIR__ . '/../dbal/migration/dummy_order_4.php'; +require_once __DIR__ . '/../dbal/migration/dummy_order_5.php'; + +class schema_generator_test extends phpbb_test_case +{ + /** @var \phpbb\db\migration\schema_generator */ + protected $generator; + + public function setUp() + { + parent::setUp(); + + $this->config = new \phpbb\config\config(array()); + $this->db = new \phpbb\db\driver\sqlite(); + $factory = new \phpbb\db\tools\factory(); + $this->db_tools = $factory->get($this->db); + $this->table_prefix = 'phpbb_'; + } + + protected function get_schema_generator(array $class_names) + { + $this->generator = new \phpbb\db\migration\schema_generator($class_names, $this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); + + return $this->generator; + } + + /** + * @expectedException \UnexpectedValueException + */ + public function test_check_dependencies_fail() + { + $this->get_schema_generator(array('\phpbb\db\migration\data\v310\forgot_password')); + + $this->generator->get_schema(); + } + + public function test_get_schema_success() + { + $this->get_schema_generator(array( + '\phpbb\db\migration\data\v30x\release_3_0_1_rc1', + '\phpbb\db\migration\data\v30x\release_3_0_0', + '\phpbb\db\migration\data\v310\boardindex' + )); + + $this->assertArrayHasKey('phpbb_users', $this->generator->get_schema()); + } + + public function column_add_after_data() + { + return array( + array( + 'phpbb_dbal_migration_dummy_order_0', + array( + 'foobar1', + 'foobar2', + 'foobar3', + ), + ), + array( + 'phpbb_dbal_migration_dummy_order_1', + array( + 'foobar1', + 'foobar3', + 'foobar4', + ), + ), + array( + 'phpbb_dbal_migration_dummy_order_2', + array( + 'foobar1', + 'foobar3', + 'foobar5', + ), + ), + array( + 'phpbb_dbal_migration_dummy_order_3', + array( + 'foobar1', + 'foobar3', + 'foobar6', + ), + ), + array( + 'phpbb_dbal_migration_dummy_order_4', + array( + 'foobar1', + 'foobar3', + 'foobar7', + ), + ), + array( + 'phpbb_dbal_migration_dummy_order_5', + array( + 'foobar1', + 'foobar3', + 'foobar9', + 'foobar8', + ), + ), + ); + } + + /** + * @dataProvider column_add_after_data + */ + public function test_column_add_after($migration, $expected) + { + $this->get_schema_generator(array( + 'phpbb_dbal_migration_dummy_order', + $migration, + )); + + $tables = $this->generator->get_schema(); + + $this->assertEquals( + $expected, + array_keys($tables[$this->table_prefix . 'column_order_test1']['COLUMNS']), + 'The schema generator could not position the column correctly, using the "after" option in the migration script.' + ); + } +} diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php index 9f0371262b..fa53e6c8c4 100644 --- a/tests/mimetype/guesser_test.php +++ b/tests/mimetype/guesser_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -19,7 +23,9 @@ function function_exists($name) class guesser_test extends \phpbb_test_case { - public static $function_exists = true; + public static $function_exists = false; + + protected $fileinfo_supported = false; public function setUp() { @@ -28,7 +34,16 @@ class guesser_test extends \phpbb_test_case $guessers = array( new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \phpbb\mimetype\extension_guesser, + new \phpbb\mimetype\content_guesser, ); + + // Check if any guesser except the extension_guesser is available + $this->fileinfo_supported = $guessers[0]->isSupported() | $guessers[1]->isSupported() | $guessers[3]->is_supported(); + + // Also create a guesser that emulates not having fileinfo available + $this->guesser_no_fileinfo = new \phpbb\mimetype\guesser(array($guessers[2])); + $this->guesser = new \phpbb\mimetype\guesser($guessers); $this->path = dirname(__FILE__); $this->jpg_file = $this->path . '/fixtures/jpg'; @@ -52,9 +67,32 @@ class guesser_test extends \phpbb_test_case */ public function test_guess_files($expected, $file) { + // We will always get application/octet-stream as mimetype if only the + // extension guesser is supported + if (!$this->fileinfo_supported) + { + $this->markTestSkipped('Unable to run tests depending on fileinfo if it is not available'); + } $this->assertEquals($expected, $this->guesser->guess($this->path . '/../upload/fixture/' . $file)); } + public function data_guess_files_no_fileinfo() + { + return array( + array('application/octet-stream', 'gif'), + array('application/octet-stream', 'txt'), + array(false, 'foobar'), + ); + } + + /** + * @dataProvider data_guess_files_no_fileinfo + */ + public function test_guess_files_no_fileinfo($expected, $file) + { + $this->assertEquals($expected, $this->guesser_no_fileinfo->guess($this->path . '/../upload/fixture/' . $file)); + } + public function test_file_not_readable() { @chmod($this->jpg_file, 0000); @@ -130,6 +168,11 @@ class guesser_test extends \phpbb_test_case $supported = false; self::$function_exists = !$overload; + if (!\function_exists('mime_content_type')) + { + $this->markTestSkipped('Emulating supported mime_content_type() when it is not supported will cause a fatal error'); + } + // Cover possible LogicExceptions foreach ($guessers as $cur_guesser) { @@ -163,4 +206,25 @@ class guesser_test extends \phpbb_test_case $this->assertInstanceOf('\phpbb\mimetype\content_guesser', $guessers[0]); $this->assertInstanceOf('\phpbb\mimetype\extension_guesser', $guessers[3]); } + + public function data_choose_mime_type() + { + return array( + array('application/octet-stream', 'application/octet-stream', null), + array('application/octet-stream', 'application/octet-stream', 'application/octet-stream'), + array('binary', 'application/octet-stream', 'binary'), + array('image/jpeg', 'application/octet-stream', 'image/jpeg'), + array('image/jpeg', 'binary', 'image/jpeg'), + array('image/jpeg', 'image/jpg', 'image/jpeg'), + array('image/jpeg', 'image/jpeg', 'binary'), + ); + } + + /** + * @dataProvider data_choose_mime_type + */ + public function test_choose_mime_type($expected, $mime_type, $guess) + { + $this->assertSame($expected, $this->guesser->choose_mime_type($mime_type, $guess)); + } } diff --git a/tests/mimetype/incorrect_guesser.php b/tests/mimetype/incorrect_guesser.php index 3939826faa..f74617b7a7 100644 --- a/tests/mimetype/incorrect_guesser.php +++ b/tests/mimetype/incorrect_guesser.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mimetype/null_guesser.php b/tests/mimetype/null_guesser.php index 5316d3726f..836ff4196a 100644 --- a/tests/mimetype/null_guesser.php +++ b/tests/mimetype/null_guesser.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php index 734e682ee9..abf0e4fdfb 100644 --- a/tests/mock/auth_provider.php +++ b/tests/mock/auth_provider.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** * Mock auth provider class with basic functions to help test sessions. diff --git a/tests/mock/cache.php b/tests/mock/cache.php index 83bbb8ef30..5fa3d28147 100644 --- a/tests/mock/cache.php +++ b/tests/mock/cache.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -140,7 +144,7 @@ class phpbb_mock_cache implements \phpbb\cache\driver\driver_interface /** * {@inheritDoc} */ - public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) + public function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl) { return $query_result; } diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index 734d3e1741..134589b0b8 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ use Symfony\Component\DependencyInjection\ContainerInterface; @@ -48,7 +52,15 @@ class phpbb_mock_container_builder implements ContainerInterface { if ($this->has($id)) { - return $this->services[$id]; + $service = $this->services[$id]; + if (is_array($service) && is_callable($service[0])) + { + return call_user_func_array($service[0], $service[1]); + } + else + { + return $service; + } } throw new Exception('Could not find service: ' . $id); @@ -176,4 +188,9 @@ class phpbb_mock_container_builder implements ContainerInterface public function isScopeActive($name) { } + + public function isFrozen() + { + return false; + } } diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php new file mode 100644 index 0000000000..0116dced49 --- /dev/null +++ b/tests/mock/controller_helper.php @@ -0,0 +1,20 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_mock_controller_helper extends \phpbb\controller\helper +{ + public function get_current_url() + { + return ''; + } +} diff --git a/tests/mock/event_dispatcher.php b/tests/mock/event_dispatcher.php index 8887b16163..fa8b4a1036 100644 --- a/tests/mock/event_dispatcher.php +++ b/tests/mock/event_dispatcher.php @@ -1,15 +1,28 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -class phpbb_mock_event_dispatcher +class phpbb_mock_event_dispatcher extends \phpbb\event\dispatcher { - public function trigger_event($eventName, $data) + /** + * Constructor. + * + * Overwrite the constructor to get rid of ContainerInterface param instance + */ + public function __construct() + { + } + + public function trigger_event($eventName, $data = array()) { return array(); } diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php index 7049cbdc50..2ce61c5149 100644 --- a/tests/mock/extension_manager.php +++ b/tests/mock/extension_manager.php @@ -1,19 +1,24 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ class phpbb_mock_extension_manager extends \phpbb\extension\manager { - public function __construct($phpbb_root_path, $extensions = array()) + public function __construct($phpbb_root_path, $extensions = array(), $container = null) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = 'php'; $this->extensions = $extensions; - $this->filesystem = new \phpbb\filesystem(); + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->container = $container; } } diff --git a/tests/mock/file_downloader.php b/tests/mock/file_downloader.php new file mode 100644 index 0000000000..d8951cebf6 --- /dev/null +++ b/tests/mock/file_downloader.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_mock_file_downloader extends \phpbb\file_downloader +{ + public $data; + + public function set($data) + { + $this->data = $data; + } + + public function get($host, $directory, $filename, $port = 80, $timeout = 6) + { + return $this->data; + } +} diff --git a/tests/mock/filespec.php b/tests/mock/filespec.php index 9d2a5c84de..7ea750afbe 100644 --- a/tests/mock/filespec.php +++ b/tests/mock/filespec.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** * Mock filespec class with some basic values to help with testing the diff --git a/tests/mock/filesystem_extension_manager.php b/tests/mock/filesystem_extension_manager.php index c5a51bbb3f..fa1b1c06bc 100644 --- a/tests/mock/filesystem_extension_manager.php +++ b/tests/mock/filesystem_extension_manager.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mock/fileupload.php b/tests/mock/fileupload.php index cbcbf4a6ab..5a0afc6cd3 100644 --- a/tests/mock/fileupload.php +++ b/tests/mock/fileupload.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** * Mock fileupload class with some basic values to help with testing the @@ -15,9 +19,10 @@ class phpbb_mock_fileupload { public $max_filesize = 100; public $error_prefix = ''; + public $valid_dimensions = true; public function valid_dimensions($filespec) { - return true; + return $this->valid_dimensions; } } diff --git a/tests/mock/lang.php b/tests/mock/lang.php index ac814b45db..bebbe5a29b 100644 --- a/tests/mock/lang.php +++ b/tests/mock/lang.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mock/metadata_manager.php b/tests/mock/metadata_manager.php index b6489acfa4..2443fad560 100644 --- a/tests/mock/metadata_manager.php +++ b/tests/mock/metadata_manager.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,11 +15,13 @@ class phpbb_mock_metadata_manager extends \phpbb\extension\metadata_manager { public function set_metadata($metadata) { + array_walk_recursive($metadata, array($this, 'sanitize_json')); $this->metadata = $metadata; } public function merge_metadata($metadata) { + array_walk_recursive($metadata, array($this, 'sanitize_json')); $this->metadata = array_merge($this->metadata, $metadata); } } diff --git a/tests/mock/migrator.php b/tests/mock/migrator.php new file mode 100644 index 0000000000..293f115335 --- /dev/null +++ b/tests/mock/migrator.php @@ -0,0 +1,55 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_mock_migrator extends \phpbb\db\migrator +{ + public function __construct() + { + } + + public function load_migration_state() + { + } + + public function set_migrations($class_names) + { + } + + public function update() + { + } + + public function revert($migration) + { + } + + public function unfulfillable($name) + { + } + + public function finished() + { + } + + public function migration_state($migration) + { + } + + public function populate_migrations($migrations) + { + } + + public function create_migrations_table() + { + } +} diff --git a/tests/mock/notification_manager.php b/tests/mock/notification_manager.php index 47fe30730f..952c0db489 100644 --- a/tests/mock/notification_manager.php +++ b/tests/mock/notification_manager.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * Notifications service class -* @package notifications */ class phpbb_mock_notification_manager { @@ -29,19 +32,18 @@ class phpbb_mock_notification_manager ); } - public function mark_notifications_read() + public function mark_notifications() { } - public function mark_notifications_read_by_parent() + public function mark_notifications_by_parent() { } - public function mark_notifications_read_by_id() + public function mark_notifications_by_id() { } - public function add_notifications() { return array(); diff --git a/tests/mock/notification_type_post.php b/tests/mock/notification_type_post.php new file mode 100644 index 0000000000..4116fecf5e --- /dev/null +++ b/tests/mock/notification_type_post.php @@ -0,0 +1,40 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class phpbb_mock_notification_type_post extends \phpbb\notification\type\post +{ + public function __construct($user_loader, $db, $cache, $language, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $user_notifications_table) + { + $this->user_loader = $user_loader; + $this->db = $db; + $this->cache = $cache; + $this->language = $language; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->notification_types_table = $notification_types_table; + $this->user_notifications_table = $user_notifications_table; + } +} diff --git a/tests/mock/notifications_auth.php b/tests/mock/notifications_auth.php index 2d387d8c00..1106c3004f 100644 --- a/tests/mock/notifications_auth.php +++ b/tests/mock/notifications_auth.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mock/null_cache.php b/tests/mock/null_cache.php index 7bd33b441b..5b801adf11 100644 --- a/tests/mock/null_cache.php +++ b/tests/mock/null_cache.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mock/phpbb_di_container_builder.php b/tests/mock/phpbb_di_container_builder.php new file mode 100644 index 0000000000..59cdf0bb2b --- /dev/null +++ b/tests/mock/phpbb_di_container_builder.php @@ -0,0 +1,20 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_mock_phpbb_di_container_builder extends \phpbb\di\container_builder +{ + protected function get_container_filename() + { + return $this->phpbb_root_path . '../../tmp/container.' . $this->php_ext; + } +} diff --git a/tests/mock/request.php b/tests/mock/request.php index 60ba725abd..e7217a94a9 100644 --- a/tests/mock/request.php +++ b/tests/mock/request.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,6 +15,8 @@ class phpbb_mock_request implements \phpbb\request\request_interface { protected $data; + protected $super_globals_disabled = false; + public function __construct($get = array(), $post = array(), $cookie = array(), $server = array(), $request = false, $files = array()) { $this->data[\phpbb\request\request_interface::GET] = $get; @@ -19,6 +25,8 @@ class phpbb_mock_request implements \phpbb\request\request_interface $this->data[\phpbb\request\request_interface::REQUEST] = ($request === false) ? $post + $get : $request; $this->data[\phpbb\request\request_interface::SERVER] = $server; $this->data[\phpbb\request\request_interface::FILES] = $files; + + $this->disable_super_globals(); } public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST) @@ -79,6 +87,21 @@ class phpbb_mock_request implements \phpbb\request\request_interface return $this->data[$super_global]; } + public function super_globals_disabled() + { + return $this->super_globals_disabled; + } + + public function disable_super_globals() + { + $this->super_globals_disabled = true; + } + + public function enable_super_globals() + { + $this->super_globals_disabled = false; + } + /* custom methods */ public function set_header($header_name, $value) @@ -91,4 +114,25 @@ class phpbb_mock_request implements \phpbb\request\request_interface { $this->data[$super_global] = array_merge($this->data[$super_global], $values); } + + public function escape($var, $multibyte) + { + $type_cast_helper = new \phpbb\request\type_cast_helper(); + if (is_array($var)) + { + $result = array(); + foreach ($var as $key => $value) + { + $type_cast_helper->set_var($key, $key, gettype($key), $multibyte); + $result[$key] = $this->escape($value, $multibyte); + } + $var = $result; + } + else + { + $type_cast_helper->set_var($var, $var, 'string', $multibyte); + } + + return $var; + } } diff --git a/tests/mock/router.php b/tests/mock/router.php new file mode 100644 index 0000000000..01faa338c5 --- /dev/null +++ b/tests/mock/router.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_mock_router extends \phpbb\routing\router +{ + public function get_matcher() + { + $this->create_new_url_matcher(); + return parent::get_matcher(); + } + + public function get_generator() + { + $this->create_new_url_generator(); + return parent::get_generator(); + } +} diff --git a/tests/mock/search.php b/tests/mock/search.php index 6739719216..f30876b4da 100644 --- a/tests/mock/search.php +++ b/tests/mock/search.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php index d81ae3163e..29dd2a5bff 100644 --- a/tests/mock/session_testable.php +++ b/tests/mock/session_testable.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -20,7 +24,7 @@ class phpbb_mock_session_testable extends \phpbb\session { private $_cookies = array(); - public function set_cookie($name, $data, $time) + public function set_cookie($name, $data, $time, $httponly = true) { $this->_cookies[$name] = array($data, $time); } diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php index aa7c54dddd..c751764d45 100644 --- a/tests/mock/sql_insert_buffer.php +++ b/tests/mock/sql_insert_buffer.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/mock/user.php b/tests/mock/user.php index bd547b3973..9888337a9e 100644 --- a/tests/mock/user.php +++ b/tests/mock/user.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -46,4 +50,9 @@ class phpbb_mock_user } return false; } + + public function lang() + { + return implode(' ', func_get_args()); + } } diff --git a/tests/network/checkdnsrr_test.php b/tests/network/checkdnsrr_test.php index 1942a50f06..a3852b2656 100644 --- a/tests/network/checkdnsrr_test.php +++ b/tests/network/checkdnsrr_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/network/ftp_fsock_pasv_epsv_test.php b/tests/network/ftp_fsock_pasv_epsv_test.php index 22f17785b8..6ed9d61dc0 100644 --- a/tests/network/ftp_fsock_pasv_epsv_test.php +++ b/tests/network/ftp_fsock_pasv_epsv_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/network/inet_ntop_pton_test.php b/tests/network/inet_ntop_pton_test.php index a59c2103bd..fae40ad74e 100644 --- a/tests/network/inet_ntop_pton_test.php +++ b/tests/network/inet_ntop_pton_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/network/ip_normalise_test.php b/tests/network/ip_normalise_test.php index 28059f376a..1acfd4521d 100644 --- a/tests/network/ip_normalise_test.php +++ b/tests/network/ip_normalise_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/notification/base.php b/tests/notification/base.php index f6333866c3..b64e25cf8c 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -1,12 +1,20 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + require_once dirname(__FILE__) . '/manager_helper.php'; abstract class phpbb_tests_notification_base extends phpbb_database_test_case @@ -17,21 +25,28 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case { return array( 'test', - 'approve_post', - 'approve_topic', - 'bookmark', - 'disapprove_post', - 'disapprove_topic', - 'pm', - 'post', - 'post_in_queue', - 'quote', - 'report_pm', - 'report_pm_closed', - 'report_post', - 'report_post_closed', - 'topic', - 'topic_in_queue', + 'notification.type.approve_post', + 'notification.type.approve_topic', + 'notification.type.bookmark', + 'notification.type.disapprove_post', + 'notification.type.disapprove_topic', + 'notification.type.pm', + 'notification.type.post', + 'notification.type.post_in_queue', + 'notification.type.quote', + 'notification.type.report_pm', + 'notification.type.report_pm_closed', + 'notification.type.report_post', + 'notification.type.report_post_closed', + 'notification.type.topic', + 'notification.type.topic_in_queue', + ); + } + + protected function get_notification_methods() + { + return array( + 'notification.method.board', ); } @@ -51,51 +66,83 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case 'allow_bookmarks' => true, 'allow_topic_notify' => true, 'allow_forum_notify' => true, + 'allow_board_notifications' => true, )); - $user = $this->user = new \phpbb\user(); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $this->user = $user; $this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users'); $auth = $this->auth = new phpbb_mock_notifications_auth(); + $cache_driver = new \phpbb\cache\driver\dummy(); $cache = $this->cache = new \phpbb\cache\service( - new \phpbb\cache\driver\null(), + $cache_driver, $this->config, $this->db, $phpbb_root_path, $phpEx ); - $phpbb_container = $this->container = new phpbb_mock_container_builder(); + $this->phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + + $phpbb_container = $this->container = new ContainerBuilder(); + $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures')); + $loader->load('services_notification.yml'); + $phpbb_container->set('user_loader', $this->user_loader); + $phpbb_container->set('user', $user); + $phpbb_container->set('language', $lang); + $phpbb_container->set('config', $this->config); + $phpbb_container->set('dbal.conn', $this->db); + $phpbb_container->set('auth', $auth); + $phpbb_container->set('cache.driver', $cache_driver); + $phpbb_container->set('cache', $cache); + $phpbb_container->set('text_formatter.utils', new \phpbb\textformatter\s9e\utils()); + $phpbb_container->set('dispatcher', $this->phpbb_dispatcher); + $phpbb_container->setParameter('core.root_path', $phpbb_root_path); + $phpbb_container->setParameter('core.php_ext', $phpEx); + $phpbb_container->setParameter('tables.notifications', 'phpbb_notifications'); + $phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications'); + $phpbb_container->setParameter('tables.notification_types', 'phpbb_notification_types'); $this->notifications = new phpbb_notification_manager_helper( array(), array(), $this->container, $this->user_loader, - $this->config, + $this->phpbb_dispatcher, $this->db, $this->cache, + $lang, $this->user, - $phpbb_root_path, - $phpEx, 'phpbb_notification_types', - 'phpbb_notifications', 'phpbb_user_notifications' ); $phpbb_container->set('notification_manager', $this->notifications); + $phpbb_container->compile(); $this->notifications->setDependencies($this->auth, $this->config); $types = array(); foreach ($this->get_notification_types() as $type) { - $class = $this->build_type('phpbb\notification\type\\' . $type); + $class = $this->build_type($type); $types[$type] = $class; - $this->container->set('notification.type.' . $type, $class); } $this->notifications->set_var('notification_types', $types); + $methods = array(); + foreach ($this->get_notification_methods() as $method) + { + $class = $this->container->get($method); + + $methods[$method] = $class; + } + + $this->notifications->set_var('notification_methods', $methods); + $this->db->sql_query('DELETE FROM phpbb_notification_types'); $this->db->sql_query('DELETE FROM phpbb_notifications'); $this->db->sql_query('DELETE FROM phpbb_user_notifications'); @@ -103,14 +150,14 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case protected function build_type($type) { - global $phpbb_root_path, $phpEx; + $instance = $this->container->get($type); - return new $type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $phpbb_root_path, $phpEx, 'phpbb_notification_types', 'phpbb_notifications', 'phpbb_user_notifications'); + return $instance; } protected function assert_notifications($expected, $options = array()) { - $notifications = $this->notifications->load_notifications(array_merge(array( + $notifications = $this->notifications->load_notifications('notification.method.board', array_merge(array( 'count_unread' => true, 'order_by' => 'notification_time', 'order_dir' => 'ASC', diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index c692f40b57..4a7fd89409 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ require_once dirname(__FILE__) . '/../mock/sql_insert_buffer.php'; @@ -24,11 +28,12 @@ class phpbb_notification_convert_test extends phpbb_database_test_case global $phpbb_root_path, $phpEx; $this->db = $this->new_dbal(); + $factory = new \phpbb\db\tools\factory(); $this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert( new \phpbb\config\config(array()), $this->db, - new \phpbb\db\tools($this->db), + $factory->get($this->db), $phpbb_root_path, $phpEx, 'phpbb_' diff --git a/tests/notification/ext/test/notification/type/test.php b/tests/notification/ext/test/notification/type/test.php index cdb921ca3b..7f3b4a4ef1 100644 --- a/tests/notification/ext/test/notification/type/test.php +++ b/tests/notification/ext/test/notification/type/test.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -43,12 +47,13 @@ class test extends \phpbb\notification\type\base { $this->notification_time = $post['post_time']; - return parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); } public function create_update_array($type_data) { - $data = $this->create_insert_array($type_data); + $this->create_insert_array($type_data); + $data = $this->get_insert_array(); // Unset data unique to each row unset( diff --git a/tests/notification/fixtures/services_notification.yml b/tests/notification/fixtures/services_notification.yml new file mode 100644 index 0000000000..6e68cccff6 --- /dev/null +++ b/tests/notification/fixtures/services_notification.yml @@ -0,0 +1,76 @@ +imports: + - { resource: ../../../phpBB/config/default/container/services_notification.yml } + +services: + notification_manager: + synthetic: true + + user_loader: + synthetic: true + + user: + synthetic: true + + config: + synthetic: true + + dbal.conn: + synthetic: true + + language: + synthetic: true + + auth: + synthetic: true + + cache.driver: + synthetic: true + + group_helper: + synthetic: true + + path_helper: + synthetic: true + + groupposition.legend: + synthetic: true + + groupposition.teampage: + synthetic: true + + groupposition.teampage: + synthetic: true + + text_formatter.s9e.factory: + synthetic: true + + text_formatter.s9e.quote_helper: + synthetic: true + + text_formatter.parser: + synthetic: true + + text_formatter.s9e.parser: + synthetic: true + + text_formatter.renderer: + synthetic: true + + text_formatter.s9e.renderer: + synthetic: true + + text_formatter.utils: + synthetic: true + + text_formatter.s9e.utils: + synthetic: true + + text_formatter.data_access: + synthetic: true + + test: + class: phpbb\notification\type\test + scope: prototype + parent: notification.type.base + tags: + - { name: notification.type } diff --git a/tests/notification/fixtures/submit_post_bookmark.xml b/tests/notification/fixtures/submit_post_bookmark.xml deleted file mode 100644 index 525d0484e0..0000000000 --- a/tests/notification/fixtures/submit_post_bookmark.xml +++ /dev/null @@ -1,161 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<dataset> - <table name="phpbb_bookmarks"> - <column>topic_id</column> - <column>user_id</column> - <row> - <value>1</value> - <value>2</value> - </row> - <row> - <value>1</value> - <value>3</value> - </row> - <row> - <value>1</value> - <value>4</value> - </row> - <row> - <value>1</value> - <value>5</value> - </row> - <row> - <value>1</value> - <value>6</value> - </row> - <row> - <value>1</value> - <value>7</value> - </row> - </table> - <table name="phpbb_notifications"> - <column>notification_type_id</column> - <column>user_id</column> - <column>item_id</column> - <column>item_parent_id</column> - <column>notification_read</column> - <column>notification_data</column> - <row> - <value>1</value> - <value>5</value> - <value>1</value> - <value>1</value> - <value>0</value> - <value></value> - </row> - </table> - <table name="phpbb_notification_types"> - <column>notification_type_id</column> - <column>notification_type_name</column> - <column>notification_type_enabled</column> - <row> - <value>1</value> - <value>bookmark</value> - <value>1</value> - </row> - </table> - <table name="phpbb_posts"> - <column>post_id</column> - <column>topic_id</column> - <column>forum_id</column> - <column>post_text</column> - <row> - <value>1</value> - <value>1</value> - <value>1</value> - <value></value> - </row> - </table> - <table name="phpbb_topics"> - <column>topic_id</column> - <column>forum_id</column> - <row> - <value>1</value> - <value>1</value> - </row> - </table> - <table name="phpbb_users"> - <column>user_id</column> - <column>username_clean</column> - <column>user_permissions</column> - <column>user_sig</column> - <row> - <value>2</value> - <value>poster</value> - <value></value> - <value></value> - </row> - <row> - <value>3</value> - <value>test</value> - <value></value> - <value></value> - </row> - <row> - <value>4</value> - <value>unauthorized</value> - <value></value> - <value></value> - </row> - <row> - <value>5</value> - <value>notified</value> - <value></value> - <value></value> - </row> - <row> - <value>6</value> - <value>disabled</value> - <value></value> - <value></value> - </row> - <row> - <value>7</value> - <value>default</value> - <value></value> - <value></value> - </row> - </table> - <table name="phpbb_user_notifications"> - <column>item_type</column> - <column>item_id</column> - <column>user_id</column> - <column>method</column> - <column>notify</column> - <row> - <value>bookmark</value> - <value>0</value> - <value>2</value> - <value></value> - <value>1</value> - </row> - <row> - <value>bookmark</value> - <value>0</value> - <value>3</value> - <value></value> - <value>1</value> - </row> - <row> - <value>bookmark</value> - <value>0</value> - <value>4</value> - <value></value> - <value>1</value> - </row> - <row> - <value>bookmark</value> - <value>0</value> - <value>5</value> - <value></value> - <value>1</value> - </row> - <row> - <value>bookmark</value> - <value>0</value> - <value>6</value> - <value></value> - <value>0</value> - </row> - </table> -</dataset> diff --git a/tests/notification/fixtures/submit_post_notification.type.bookmark.xml b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml new file mode 100644 index 0000000000..7f069abc59 --- /dev/null +++ b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml @@ -0,0 +1,161 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bookmarks"> + <column>topic_id</column> + <column>user_id</column> + <row> + <value>1</value> + <value>2</value> + </row> + <row> + <value>1</value> + <value>3</value> + </row> + <row> + <value>1</value> + <value>4</value> + </row> + <row> + <value>1</value> + <value>5</value> + </row> + <row> + <value>1</value> + <value>6</value> + </row> + <row> + <value>1</value> + <value>7</value> + </row> + </table> + <table name="phpbb_notifications"> + <column>notification_type_id</column> + <column>user_id</column> + <column>item_id</column> + <column>item_parent_id</column> + <column>notification_read</column> + <column>notification_data</column> + <row> + <value>1</value> + <value>5</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + </table> + <table name="phpbb_notification_types"> + <column>notification_type_id</column> + <column>notification_type_name</column> + <column>notification_type_enabled</column> + <row> + <value>1</value> + <value>notification.type.bookmark</value> + <value>1</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <row> + <value>1</value> + <value>1</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>2</value> + <value>poster</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>test</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>unauthorized</value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>notified</value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>disabled</value> + <value></value> + <value></value> + </row> + <row> + <value>7</value> + <value>default</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_user_notifications"> + <column>item_type</column> + <column>item_id</column> + <column>user_id</column> + <column>method</column> + <column>notify</column> + <row> + <value>notification.type.bookmark</value> + <value>0</value> + <value>2</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.bookmark</value> + <value>0</value> + <value>3</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.bookmark</value> + <value>0</value> + <value>4</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.bookmark</value> + <value>0</value> + <value>5</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.bookmark</value> + <value>0</value> + <value>6</value> + <value>notification.method.board</value> + <value>0</value> + </row> + </table> +</dataset> diff --git a/tests/notification/fixtures/submit_post_notification.type.post.xml b/tests/notification/fixtures/submit_post_notification.type.post.xml new file mode 100644 index 0000000000..a4bf9d3ee4 --- /dev/null +++ b/tests/notification/fixtures/submit_post_notification.type.post.xml @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_forums_watch"> + <column>forum_id</column> + <column>user_id</column> + <column>notify_status</column> + <row> + <value>1</value> + <value>6</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>7</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>8</value> + <value>0</value> + </row> + </table> + <table name="phpbb_notifications"> + <column>notification_type_id</column> + <column>user_id</column> + <column>item_id</column> + <column>item_parent_id</column> + <column>notification_read</column> + <column>notification_data</column> + <row> + <value>1</value> + <value>5</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + <row> + <value>1</value> + <value>8</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + </table> + <table name="phpbb_notification_types"> + <column>notification_type_id</column> + <column>notification_type_name</column> + <column>notification_type_enabled</column> + <row> + <value>1</value> + <value>notification.type.post</value> + <value>1</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <row> + <value>1</value> + <value>1</value> + </row> + </table> + <table name="phpbb_topics_watch"> + <column>topic_id</column> + <column>user_id</column> + <column>notify_status</column> + <row> + <value>1</value> + <value>2</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>3</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>4</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>5</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>6</value> + <value>0</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>2</value> + <value>poster</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>test</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>unauthorized</value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>notified</value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>disabled</value> + <value></value> + <value></value> + </row> + <row> + <value>7</value> + <value>default</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_user_notifications"> + <column>item_type</column> + <column>item_id</column> + <column>user_id</column> + <column>method</column> + <column>notify</column> + <row> + <value>notification.type.post</value> + <value>0</value> + <value>2</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.post</value> + <value>0</value> + <value>3</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.post</value> + <value>0</value> + <value>4</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.post</value> + <value>0</value> + <value>5</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.post</value> + <value>0</value> + <value>6</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.post</value> + <value>0</value> + <value>7</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.post</value> + <value>0</value> + <value>8</value> + <value>notification.method.board</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml new file mode 100644 index 0000000000..0a955c48d2 --- /dev/null +++ b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_notifications"> + <column>notification_type_id</column> + <column>user_id</column> + <column>item_id</column> + <column>item_parent_id</column> + <column>notification_read</column> + <column>notification_data</column> + <row> + <value>1</value> + <value>6</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + </table> + <table name="phpbb_notification_types"> + <column>notification_type_id</column> + <column>notification_type_name</column> + <column>notification_type_enabled</column> + <row> + <value>1</value> + <value>notification.type.post_in_queue</value> + <value>1</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <row> + <value>1</value> + <value>1</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>2</value> + <value>poster</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>test</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>unauthorized-mod</value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>unauthorized-read</value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>notified</value> + <value></value> + <value></value> + </row> + <row> + <value>7</value> + <value>disabled</value> + <value></value> + <value></value> + </row> + <row> + <value>8</value> + <value>default</value> + <value></value> + <value></value> + </row> + <row> + <value>9</value> + <value>test glboal-permissions</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_user_notifications"> + <column>item_type</column> + <column>item_id</column> + <column>user_id</column> + <column>method</column> + <column>notify</column> + <row> + <value>notification.type.needs_approval</value> + <value>0</value> + <value>2</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.needs_approval</value> + <value>0</value> + <value>3</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.needs_approval</value> + <value>0</value> + <value>4</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.needs_approval</value> + <value>0</value> + <value>5</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.needs_approval</value> + <value>0</value> + <value>6</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.needs_approval</value> + <value>0</value> + <value>7</value> + <value>notification.method.board</value> + <value>0</value> + </row> + <row> + <value>notification.type.needs_approval</value> + <value>0</value> + <value>9</value> + <value>notification.method.board</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/notification/fixtures/submit_post_notification.type.quote.xml b/tests/notification/fixtures/submit_post_notification.type.quote.xml new file mode 100644 index 0000000000..c66830fbf5 --- /dev/null +++ b/tests/notification/fixtures/submit_post_notification.type.quote.xml @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_notifications"> + <column>notification_type_id</column> + <column>user_id</column> + <column>item_id</column> + <column>item_parent_id</column> + <column>notification_read</column> + <column>notification_data</column> + <row> + <value>1</value> + <value>5</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + </table> + <table name="phpbb_notification_types"> + <column>notification_type_id</column> + <column>notification_type_name</column> + <column>notification_type_enabled</column> + <row> + <value>1</value> + <value>notification.type.quote</value> + <value>1</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <row> + <value>1</value> + <value>1</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>2</value> + <value>poster</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>test</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>unauthorized</value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>notified</value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>disabled</value> + <value></value> + <value></value> + </row> + <row> + <value>7</value> + <value>default</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_user_notifications"> + <column>item_type</column> + <column>item_id</column> + <column>user_id</column> + <column>method</column> + <column>notify</column> + <row> + <value>notification.type.quote</value> + <value>0</value> + <value>2</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.quote</value> + <value>0</value> + <value>3</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.quote</value> + <value>0</value> + <value>4</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.quote</value> + <value>0</value> + <value>5</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.quote</value> + <value>0</value> + <value>6</value> + <value>notification.method.board</value> + <value>0</value> + </row> + </table> +</dataset> diff --git a/tests/notification/fixtures/submit_post_notification.type.topic.xml b/tests/notification/fixtures/submit_post_notification.type.topic.xml new file mode 100644 index 0000000000..e0f6583f48 --- /dev/null +++ b/tests/notification/fixtures/submit_post_notification.type.topic.xml @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_forums_watch"> + <column>forum_id</column> + <column>user_id</column> + <column>notify_status</column> + <row> + <value>1</value> + <value>6</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>7</value> + <value>0</value> + </row> + <row> + <value>1</value> + <value>8</value> + <value>0</value> + </row> + </table> + <table name="phpbb_notifications"> + <column>notification_type_id</column> + <column>user_id</column> + <column>item_id</column> + <column>item_parent_id</column> + <column>notification_read</column> + <column>notification_data</column> + <row> + <value>1</value> + <value>8</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + </table> + <table name="phpbb_notification_types"> + <column>notification_type_id</column> + <column>notification_type_name</column> + <column>notification_type_enabled</column> + <row> + <value>1</value> + <value>notification.type.topic</value> + <value>1</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <row> + <value>1</value> + <value>1</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>2</value> + <value>poster</value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>noauth</value> + <value></value> + <value></value> + </row> + <row> + <value>7</value> + <value>default</value> + <value></value> + <value></value> + </row> + <row> + <value>8</value> + <value>notified</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_user_notifications"> + <column>item_type</column> + <column>item_id</column> + <column>user_id</column> + <column>method</column> + <column>notify</column> + <row> + <value>notification.type.topic</value> + <value>0</value> + <value>2</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.topic</value> + <value>0</value> + <value>6</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.topic</value> + <value>0</value> + <value>7</value> + <value>notification.method.board</value> + <value>1</value> + </row> + <row> + <value>notification.type.topic</value> + <value>0</value> + <value>8</value> + <value>notification.method.board</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/notification/fixtures/submit_post_post.xml b/tests/notification/fixtures/submit_post_post.xml deleted file mode 100644 index a38ca77ea0..0000000000 --- a/tests/notification/fixtures/submit_post_post.xml +++ /dev/null @@ -1,205 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<dataset> - <table name="phpbb_forums_watch"> - <column>forum_id</column> - <column>user_id</column> - <column>notify_status</column> - <row> - <value>1</value> - <value>6</value> - <value>0</value> - </row> - <row> - <value>1</value> - <value>7</value> - <value>0</value> - </row> - <row> - <value>1</value> - <value>8</value> - <value>0</value> - </row> - </table> - <table name="phpbb_notifications"> - <column>notification_type_id</column> - <column>user_id</column> - <column>item_id</column> - <column>item_parent_id</column> - <column>notification_read</column> - <column>notification_data</column> - <row> - <value>1</value> - <value>5</value> - <value>1</value> - <value>1</value> - <value>0</value> - <value></value> - </row> - <row> - <value>1</value> - <value>8</value> - <value>1</value> - <value>1</value> - <value>0</value> - <value></value> - </row> - </table> - <table name="phpbb_notification_types"> - <column>notification_type_id</column> - <column>notification_type_name</column> - <column>notification_type_enabled</column> - <row> - <value>1</value> - <value>post</value> - <value>1</value> - </row> - </table> - <table name="phpbb_posts"> - <column>post_id</column> - <column>topic_id</column> - <column>forum_id</column> - <column>post_text</column> - <row> - <value>1</value> - <value>1</value> - <value>1</value> - <value></value> - </row> - </table> - <table name="phpbb_topics"> - <column>topic_id</column> - <column>forum_id</column> - <row> - <value>1</value> - <value>1</value> - </row> - </table> - <table name="phpbb_topics_watch"> - <column>topic_id</column> - <column>user_id</column> - <column>notify_status</column> - <row> - <value>1</value> - <value>2</value> - <value>0</value> - </row> - <row> - <value>1</value> - <value>3</value> - <value>0</value> - </row> - <row> - <value>1</value> - <value>4</value> - <value>0</value> - </row> - <row> - <value>1</value> - <value>5</value> - <value>0</value> - </row> - <row> - <value>1</value> - <value>6</value> - <value>0</value> - </row> - </table> - <table name="phpbb_users"> - <column>user_id</column> - <column>username_clean</column> - <column>user_permissions</column> - <column>user_sig</column> - <row> - <value>2</value> - <value>poster</value> - <value></value> - <value></value> - </row> - <row> - <value>3</value> - <value>test</value> - <value></value> - <value></value> - </row> - <row> - <value>4</value> - <value>unauthorized</value> - <value></value> - <value></value> - </row> - <row> - <value>5</value> - <value>notified</value> - <value></value> - <value></value> - </row> - <row> - <value>6</value> - <value>disabled</value> - <value></value> - <value></value> - </row> - <row> - <value>7</value> - <value>default</value> - <value></value> - <value></value> - </row> - </table> - <table name="phpbb_user_notifications"> - <column>item_type</column> - <column>item_id</column> - <column>user_id</column> - <column>method</column> - <column>notify</column> - <row> - <value>post</value> - <value>0</value> - <value>2</value> - <value></value> - <value>1</value> - </row> - <row> - <value>post</value> - <value>0</value> - <value>3</value> - <value></value> - <value>1</value> - </row> - <row> - <value>post</value> - <value>0</value> - <value>4</value> - <value></value> - <value>1</value> - </row> - <row> - <value>post</value> - <value>0</value> - <value>5</value> - <value></value> - <value>1</value> - </row> - <row> - <value>post</value> - <value>0</value> - <value>6</value> - <value></value> - <value>1</value> - </row> - <row> - <value>post</value> - <value>0</value> - <value>7</value> - <value></value> - <value>1</value> - </row> - <row> - <value>post</value> - <value>0</value> - <value>8</value> - <value></value> - <value>1</value> - </row> - </table> -</dataset> diff --git a/tests/notification/fixtures/submit_post_post_in_queue.xml b/tests/notification/fixtures/submit_post_post_in_queue.xml deleted file mode 100644 index 28cb69be36..0000000000 --- a/tests/notification/fixtures/submit_post_post_in_queue.xml +++ /dev/null @@ -1,159 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<dataset> - <table name="phpbb_notifications"> - <column>notification_type_id</column> - <column>user_id</column> - <column>item_id</column> - <column>item_parent_id</column> - <column>notification_read</column> - <column>notification_data</column> - <row> - <value>1</value> - <value>6</value> - <value>1</value> - <value>1</value> - <value>0</value> - <value></value> - </row> - </table> - <table name="phpbb_notification_types"> - <column>notification_type_id</column> - <column>notification_type_name</column> - <column>notification_type_enabled</column> - <row> - <value>1</value> - <value>post_in_queue</value> - <value>1</value> - </row> - </table> - <table name="phpbb_posts"> - <column>post_id</column> - <column>topic_id</column> - <column>forum_id</column> - <column>post_text</column> - <row> - <value>1</value> - <value>1</value> - <value>1</value> - <value></value> - </row> - </table> - <table name="phpbb_topics"> - <column>topic_id</column> - <column>forum_id</column> - <row> - <value>1</value> - <value>1</value> - </row> - </table> - <table name="phpbb_users"> - <column>user_id</column> - <column>username_clean</column> - <column>user_permissions</column> - <column>user_sig</column> - <row> - <value>2</value> - <value>poster</value> - <value></value> - <value></value> - </row> - <row> - <value>3</value> - <value>test</value> - <value></value> - <value></value> - </row> - <row> - <value>4</value> - <value>unauthorized-mod</value> - <value></value> - <value></value> - </row> - <row> - <value>5</value> - <value>unauthorized-read</value> - <value></value> - <value></value> - </row> - <row> - <value>6</value> - <value>notified</value> - <value></value> - <value></value> - </row> - <row> - <value>7</value> - <value>disabled</value> - <value></value> - <value></value> - </row> - <row> - <value>8</value> - <value>default</value> - <value></value> - <value></value> - </row> - <row> - <value>9</value> - <value>test glboal-permissions</value> - <value></value> - <value></value> - </row> - </table> - <table name="phpbb_user_notifications"> - <column>item_type</column> - <column>item_id</column> - <column>user_id</column> - <column>method</column> - <column>notify</column> - <row> - <value>needs_approval</value> - <value>0</value> - <value>2</value> - <value></value> - <value>1</value> - </row> - <row> - <value>needs_approval</value> - <value>0</value> - <value>3</value> - <value></value> - <value>1</value> - </row> - <row> - <value>needs_approval</value> - <value>0</value> - <value>4</value> - <value></value> - <value>1</value> - </row> - <row> - <value>needs_approval</value> - <value>0</value> - <value>5</value> - <value></value> - <value>1</value> - </row> - <row> - <value>needs_approval</value> - <value>0</value> - <value>6</value> - <value></value> - <value>1</value> - </row> - <row> - <value>needs_approval</value> - <value>0</value> - <value>7</value> - <value></value> - <value>0</value> - </row> - <row> - <value>needs_approval</value> - <value>0</value> - <value>9</value> - <value></value> - <value>1</value> - </row> - </table> -</dataset> diff --git a/tests/notification/fixtures/submit_post_quote.xml b/tests/notification/fixtures/submit_post_quote.xml deleted file mode 100644 index 2b11992e54..0000000000 --- a/tests/notification/fixtures/submit_post_quote.xml +++ /dev/null @@ -1,133 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<dataset> - <table name="phpbb_notifications"> - <column>notification_type_id</column> - <column>user_id</column> - <column>item_id</column> - <column>item_parent_id</column> - <column>notification_read</column> - <column>notification_data</column> - <row> - <value>1</value> - <value>5</value> - <value>1</value> - <value>1</value> - <value>0</value> - <value></value> - </row> - </table> - <table name="phpbb_notification_types"> - <column>notification_type_id</column> - <column>notification_type_name</column> - <column>notification_type_enabled</column> - <row> - <value>1</value> - <value>quote</value> - <value>1</value> - </row> - </table> - <table name="phpbb_posts"> - <column>post_id</column> - <column>topic_id</column> - <column>forum_id</column> - <column>post_text</column> - <row> - <value>1</value> - <value>1</value> - <value>1</value> - <value></value> - </row> - </table> - <table name="phpbb_topics"> - <column>topic_id</column> - <column>forum_id</column> - <row> - <value>1</value> - <value>1</value> - </row> - </table> - <table name="phpbb_users"> - <column>user_id</column> - <column>username_clean</column> - <column>user_permissions</column> - <column>user_sig</column> - <row> - <value>2</value> - <value>poster</value> - <value></value> - <value></value> - </row> - <row> - <value>3</value> - <value>test</value> - <value></value> - <value></value> - </row> - <row> - <value>4</value> - <value>unauthorized</value> - <value></value> - <value></value> - </row> - <row> - <value>5</value> - <value>notified</value> - <value></value> - <value></value> - </row> - <row> - <value>6</value> - <value>disabled</value> - <value></value> - <value></value> - </row> - <row> - <value>7</value> - <value>default</value> - <value></value> - <value></value> - </row> - </table> - <table name="phpbb_user_notifications"> - <column>item_type</column> - <column>item_id</column> - <column>user_id</column> - <column>method</column> - <column>notify</column> - <row> - <value>quote</value> - <value>0</value> - <value>2</value> - <value></value> - <value>1</value> - </row> - <row> - <value>quote</value> - <value>0</value> - <value>3</value> - <value></value> - <value>1</value> - </row> - <row> - <value>quote</value> - <value>0</value> - <value>4</value> - <value></value> - <value>1</value> - </row> - <row> - <value>quote</value> - <value>0</value> - <value>5</value> - <value></value> - <value>1</value> - </row> - <row> - <value>quote</value> - <value>0</value> - <value>6</value> - <value></value> - <value>0</value> - </row> - </table> -</dataset> diff --git a/tests/notification/fixtures/user_list_trim.xml b/tests/notification/fixtures/user_list_trim.xml new file mode 100644 index 0000000000..4f708714da --- /dev/null +++ b/tests/notification/fixtures/user_list_trim.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_colour</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>2</value> + <value>A</value> + <value>a</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>B</value> + <value>b</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>C</value> + <value>c</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>D</value> + <value>d</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>E</value> + <value>e</value> + <value></value> + <value></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php index b812fff8f8..d16e198861 100644 --- a/tests/notification/group_request_test.php +++ b/tests/notification/group_request_test.php @@ -1,13 +1,18 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ require_once dirname(__FILE__) . '/base.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_notification_group_request_test extends phpbb_tests_notification_base { @@ -21,8 +26,8 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas return array_merge( parent::get_notification_types(), array( - 'group_request', - 'group_request_approved', + 'notification.type.group_request', + 'notification.type.group_request_approved', ) ); } @@ -35,8 +40,6 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_content.' . $phpEx); - set_config(false, false, false, $this->config); - $this->container->set('groupposition.legend', new \phpbb\groupposition\legend( $this->db, $this->user @@ -46,8 +49,14 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas $this->user, $this->cache->get_driver() )); + $this->container->set('group_helper', new \phpbb\group\helper( + new \phpbb\language\language( + new phpbb\language\language_file_loader($phpbb_root_path, $phpEx) + ) + )); $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $phpbb_log = new \phpbb\log\null(); + $phpbb_log = new \phpbb\log\dummy(); + $this->get_test_case_helpers()->set_s9e_services(); // Now on to the actual test diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php index 731dd00b7a..2e8699e1e0 100644 --- a/tests/notification/manager_helper.php +++ b/tests/notification/manager_helper.php @@ -1,9 +1,13 @@ <?php /** * -* @package notifications -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,7 +21,6 @@ if (!defined('IN_PHPBB')) /** * Notifications service class -* @package notifications */ class phpbb_notification_manager_helper extends \phpbb\notification\manager { @@ -34,34 +37,4 @@ class phpbb_notification_manager_helper extends \phpbb\notification\manager $this->auth = $auth; $this->config = $config; } - - /** - * Helper to get the notifications item type class and set it up - */ - public function get_item_type_class($item_type, $data = array()) - { - $item_type = 'phpbb\notification\type\\' . $item_type; - - $item = new $item_type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table); - - $item->set_notification_manager($this); - - $item->set_initial_data($data); - - return $item; - } - - /** - * Helper to get the notifications method class and set it up - */ - public function get_method_class($method_name) - { - $method_name = 'phpbb\notification\method\\' . $method_name; - - $method = new $method_name($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table); - - $method->set_notification_manager($this); - - return $method; - } } diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php index e1788e8670..ec42aa193c 100644 --- a/tests/notification/notification_test.php +++ b/tests/notification/notification_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,28 +25,28 @@ class phpbb_notification_test extends phpbb_tests_notification_base public function test_get_notification_type_id() { // They should be inserted the first time - $post_type_id = $this->notifications->get_notification_type_id('post'); - $quote_type_id = $this->notifications->get_notification_type_id('quote'); + $post_type_id = $this->notifications->get_notification_type_id('notification.type.post'); + $quote_type_id = $this->notifications->get_notification_type_id('notification.type.quote'); $test_type_id = $this->notifications->get_notification_type_id('test'); - $this->assertEquals(array( + self::assertEquals(array( 'test' => $test_type_id, - 'quote' => $quote_type_id, - 'post' => $post_type_id, + 'notification.type.quote' => $quote_type_id, + 'notification.type.post' => $post_type_id, ), $this->notifications->get_notification_type_ids(array( 'test', - 'quote', - 'post', + 'notification.type.quote', + 'notification.type.post', ) )); - $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('quote')); + self::assertEquals($quote_type_id, $this->notifications->get_notification_type_id('notification.type.quote')); try { - $this->assertEquals(false, $this->notifications->get_notification_type_id('fail')); + self::assertEquals(false, $this->notifications->get_notification_type_id('fail')); - $this->fail('Non-existent type should throw an exception'); + self::fail('Non-existent type should throw an exception'); } catch (Exception $e) {} } @@ -51,15 +55,15 @@ class phpbb_notification_test extends phpbb_tests_notification_base { $subscription_types = $this->notifications->get_subscription_types(); - $this->assertArrayHasKey('NOTIFICATION_GROUP_MISCELLANEOUS', $subscription_types); - $this->assertArrayHasKey('NOTIFICATION_GROUP_POSTING', $subscription_types); + self::assertArrayHasKey('NOTIFICATION_GROUP_MISCELLANEOUS', $subscription_types); + self::assertArrayHasKey('NOTIFICATION_GROUP_POSTING', $subscription_types); - $this->assertArrayHasKey('bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']); - $this->assertArrayHasKey('post', $subscription_types['NOTIFICATION_GROUP_POSTING']); - $this->assertArrayHasKey('quote', $subscription_types['NOTIFICATION_GROUP_POSTING']); - $this->assertArrayHasKey('topic', $subscription_types['NOTIFICATION_GROUP_POSTING']); + self::assertArrayHasKey('notification.type.bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']); + self::assertArrayHasKey('notification.type.post', $subscription_types['NOTIFICATION_GROUP_POSTING']); + self::assertArrayHasKey('notification.type.quote', $subscription_types['NOTIFICATION_GROUP_POSTING']); + self::assertArrayHasKey('notification.type.topic', $subscription_types['NOTIFICATION_GROUP_POSTING']); - $this->assertArrayHasKey('pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']); + self::assertArrayHasKey('notification.type.pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']); //get_subscription_types //get_subscription_methods @@ -67,20 +71,41 @@ class phpbb_notification_test extends phpbb_tests_notification_base public function test_subscriptions() { - $this->notifications->delete_subscription('post', 0, '', 2); + $expected_subscriptions = array( + 'notification.type.post' => array('notification.method.board'), + 'notification.type.topic' => array('notification.method.board'), + 'notification.type.quote' => array('notification.method.board'), + 'notification.type.bookmark' => array('notification.method.board'), + 'test' => array('notification.method.board'), + 'notification.type.pm' => array('notification.method.board'), + ); + + $subscriptions = $this->notifications->get_global_subscriptions(2); + foreach ($expected_subscriptions as $item_type => $methods) + { + self::assertArrayHasKey($item_type, $subscriptions); + $this->assert_array_content_equals($methods, $subscriptions[$item_type]); + } + + foreach ($subscriptions as $item_type => $methods) + { + $this->assert_array_content_equals($methods, $expected_subscriptions[$item_type]); + } + + $this->notifications->delete_subscription('notification.type.post', 0, 'notification.method.board', 2); - $this->assertArrayNotHasKey('post', $this->notifications->get_global_subscriptions(2)); + self::assertArrayNotHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2)); - $this->notifications->add_subscription('post', 0, '', 2); + $this->notifications->add_subscription('notification.type.post', 0, 'notification.method.board', 2); - $this->assertArrayHasKey('post', $this->notifications->get_global_subscriptions(2)); + self::assertArrayHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2)); } public function test_notifications() { $this->db->sql_query('DELETE FROM phpbb_notification_types'); - $types = array('quote', 'bookmark', 'post', 'test'); + $types = array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'); foreach ($types as $id => $type) { $this->db->sql_query('INSERT INTO phpbb_notification_types ' . @@ -99,11 +124,11 @@ class phpbb_notification_test extends phpbb_tests_notification_base 'user_id' => 0, ))); - $this->assertEquals(array( + self::assertEquals(array( 'notifications' => array(), 'unread_count' => 0, 'total_count' => 0, - ), $this->notifications->load_notifications(array( + ), $this->notifications->load_notifications('notification.method.board', array( 'count_unread' => true, ))); @@ -125,7 +150,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base 'post_time' => 1349413323, )); - $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array( + $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array( 'post_id' => '4', 'topic_id' => '2', 'post_time' => 1349413324, @@ -141,7 +166,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base 'user_id' => 0, ))); - $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array( + $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array( 'post_id' => '5', 'topic_id' => '2', 'post_time' => 1349413325, @@ -233,7 +258,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base 'post_time' => 1234, // change time )); - $this->notifications->update_notifications(array('quote', 'bookmark', 'post', 'test'), array( + $this->notifications->update_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array( 'post_id' => '5', 'topic_id' => '2', 'poster_id' => 2, diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index fb8e2ac807..14ca4499d2 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -1,12 +1,20 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php'; @@ -46,7 +54,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c { parent::setUp(); - global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $request, $phpEx, $phpbb_root_path; + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader; // Database $this->db = $this->new_dbal(); @@ -65,12 +73,15 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c ))); // Config - $config = new \phpbb\config\config(array('num_topics' => 1,'num_posts' => 1,)); - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); + $config = new \phpbb\config\config(array( + 'num_topics' => 1, + 'num_posts' => 1, + 'allow_board_notifications' => true, + )); + $cache_driver = new \phpbb\cache\driver\dummy(); $cache = new \phpbb\cache\service( - new \phpbb\cache\driver\null(), + $cache_driver, $config, $db, $phpbb_root_path, @@ -80,8 +91,14 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c // Event dispatcher $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + // Language + $lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + // User - $user = $this->getMock('\phpbb\user'); + $user = $this->getMock('\phpbb\user', array(), array( + $lang, + '\phpbb\datetime' + )); $user->ip = ''; $user->data = array( 'user_id' => 2, @@ -94,33 +111,47 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface'); $request = $this->getMock('\phpbb\request\request'); - // Container - $phpbb_container = new phpbb_mock_container_builder(); - $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); - + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); + // Container + $phpbb_container = new ContainerBuilder(); + $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures')); + $loader->load('services_notification.yml'); + $phpbb_container->set('user_loader', $user_loader); + $phpbb_container->set('user', $user); + $phpbb_container->set('language', $lang); + $phpbb_container->set('config', $config); + $phpbb_container->set('dbal.conn', $db); + $phpbb_container->set('auth', $auth); + $phpbb_container->set('cache.driver', $cache_driver); + $phpbb_container->set('cache', $cache); + $phpbb_container->set('text_formatter.utils', new \phpbb\textformatter\s9e\utils()); + $phpbb_container->set('dispatcher', $phpbb_dispatcher); + $phpbb_container->setParameter('core.root_path', $phpbb_root_path); + $phpbb_container->setParameter('core.php_ext', $phpEx); + $phpbb_container->setParameter('tables.notifications', 'phpbb_notifications'); + $phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications'); + $phpbb_container->setParameter('tables.notification_types', 'phpbb_notification_types'); + $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + $phpbb_container->compile(); + // Notification Types - $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'approve_topic', 'approve_post'); + $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'topic_in_queue', 'approve_topic', 'approve_post'); $notification_types_array = array(); foreach ($notification_types as $type) { - $class_name = '\phpbb\notification\type\\' . $type; - $class = new $class_name( - $user_loader, $db, $cache->get_driver(), $user, $auth, $config, - $phpbb_root_path, $phpEx, - NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE); - - $phpbb_container->set('notification.type.' . $type, $class); - + $class = $phpbb_container->get('notification.type.' . $type); $notification_types_array['notification.type.' . $type] = $class; } + // Methods Types + $notification_methods_array = array('notification.method.board' => $phpbb_container->get('notification.method.board')); + // Notification Manager - $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(), - $phpbb_container, $user_loader, $config, $db, $cache, $user, - $phpbb_root_path, $phpEx, - NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE); + $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, $notification_methods_array, + $phpbb_container, $user_loader, $phpbb_dispatcher, $db, $cache, $lang, $user, + NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE); $phpbb_container->set('notification_manager', $phpbb_notifications); } @@ -133,7 +164,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt WHERE nt.notification_type_name = '" . $this->item_type . "' AND n.notification_type_id = nt.notification_type_id - ORDER BY user_id, item_id ASC"; + ORDER BY user_id ASC, item_id ASC"; $result = $this->db->sql_query($sql); $this->assertEquals($expected_before, $this->db->sql_fetchrowset($result)); $this->db->sql_freeresult($result); @@ -142,11 +173,6 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $post_data = array_merge($this->post_data, $additional_post_data); submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false); - $sql = 'SELECT user_id, item_id, item_parent_id - FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt - WHERE nt.notification_type_name = '" . $this->item_type . "' - AND n.notification_type_id = nt.notification_type_id - ORDER BY user_id ASC, item_id ASC"; $result = $this->db->sql_query($sql); $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result)); $this->db->sql_freeresult($result); diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php index 861017ff5f..7c3b9f938f 100644 --- a/tests/notification/submit_post_type_bookmark_test.php +++ b/tests/notification/submit_post_type_bookmark_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php'; class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notification_submit_post_base { - protected $item_type = 'bookmark'; + protected $item_type = 'notification.type.bookmark'; public function setUp() { @@ -27,7 +31,7 @@ class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notificati $this->greaterThan(0)) ->will($this->returnValueMap(array( array( - array('3', '4', '5', '6', '7'), + array(3, 4, 5, 6, 7), 'f_read', 1, array( diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php index 6a7ac44e39..1390e92d96 100644 --- a/tests/notification/submit_post_type_post_in_queue_test.php +++ b/tests/notification/submit_post_type_post_in_queue_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php'; class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notification_submit_post_base { - protected $item_type = 'post_in_queue'; + protected $item_type = 'notification.type.post_in_queue'; public function setUp() { diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php index 473247a764..037c326bc0 100644 --- a/tests/notification/submit_post_type_post_test.php +++ b/tests/notification/submit_post_type_post_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php'; class phpbb_notification_submit_post_type_post_test extends phpbb_notification_submit_post_base { - protected $item_type = 'post'; + protected $item_type = 'notification.type.post'; public function setUp() { @@ -27,7 +31,7 @@ class phpbb_notification_submit_post_type_post_test extends phpbb_notification_s $this->greaterThan(0)) ->will($this->returnValueMap(array( array( - array('3', '4', '5', '6', '7', '8'), + array(3, 4, 5, 6, 7, 8), 'f_read', 1, array( diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php index 2b66d9c6a1..3fab8c05ba 100644 --- a/tests/notification/submit_post_type_quote_test.php +++ b/tests/notification/submit_post_type_quote_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php'; class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_submit_post_base { - protected $item_type = 'quote'; + protected $item_type = 'notification.type.quote'; public function setUp() { @@ -27,7 +31,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ $this->greaterThan(0)) ->will($this->returnValueMap(array( array( - array('3', '4', '5', '6', '7'), + array(3, 4, 5, 6, 7), 'f_read', 1, array( @@ -47,6 +51,9 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ */ public function submit_post_data() { + // The new mock container is needed because the data providers may be executed before phpunit call setUp() + $parser = $this->get_test_case_helpers()->set_s9e_services(new phpbb_mock_container_builder())->get('text_formatter.parser'); + return array( /** * Normal post @@ -55,21 +62,21 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ * 2 => Poster, should NOT receive a notification * 3 => Quoted, should receive a notification * 4 => Quoted, but unauthed to read, should NOT receive a notification - * 5 => Quoted, but already notified, should NOT receive a new notification + * 5 => Quoted, but already notified, should STILL receive a new notification * 6 => Quoted, but option disabled, should NOT receive a notification * 7 => Quoted, option set to default, should receive a notification */ array( array( - 'message' => implode(' ', array( - '[quote="poster":uid]poster should not be notified[/quote:uid]', - '[quote="test":uid]test should be notified[/quote:uid]', - '[quote="unauthorized":uid]unauthorized to read, should not receive a notification[/quote:uid]', - '[quote="notified":uid]already notified, should not receive a new notification[/quote:uid]', - '[quote="disabled":uid]option disabled, should not receive a notification[/quote:uid]', - '[quote="default":uid]option set to default, should receive a notification[/quote:uid]', - '[quote="doesn\'t exist":uid]user does not exist, should not receive a notification[/quote:uid]', - )), + 'message' => $parser->parse(implode(' ', array( + '[quote="poster"]poster should not be notified[/quote]', + '[quote="test"]test should be notified[/quote]', + '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]', + '[quote="notified"]already notified, should not receive a new notification[/quote]', + '[quote="disabled"]option disabled, should not receive a notification[/quote]', + '[quote="default"]option set to default, should receive a notification[/quote]', + '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]', + ))), 'bbcode_uid' => 'uid', ), array( @@ -78,6 +85,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ array( array('user_id' => 3, 'item_id' => 2, 'item_parent_id' => 1), array('user_id' => 5, 'item_id' => 1, 'item_parent_id' => 1), + array('user_id' => 5, 'item_id' => 2, 'item_parent_id' => 1), array('user_id' => 7, 'item_id' => 2, 'item_parent_id' => 1), ), ), @@ -89,15 +97,15 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ */ array( array( - 'message' => implode(' ', array( - '[quote="poster":uid]poster should not be notified[/quote:uid]', - '[quote="test":uid]test should be notified[/quote:uid]', - '[quote="unauthorized":uid]unauthorized to read, should not receive a notification[/quote:uid]', - '[quote="notified":uid]already notified, should not receive a new notification[/quote:uid]', - '[quote="disabled":uid]option disabled, should not receive a notification[/quote:uid]', - '[quote="default":uid]option set to default, should receive a notification[/quote:uid]', - '[quote="doesn\'t exist":uid]user does not exist, should not receive a notification[/quote:uid]', - )), + 'message' => $parser->parse(implode(' ', array( + '[quote="poster"]poster should not be notified[/quote]', + '[quote="test"]test should be notified[/quote]', + '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]', + '[quote="notified"]already notified, should not receive a new notification[/quote]', + '[quote="disabled"]option disabled, should not receive a notification[/quote]', + '[quote="default"]option set to default, should receive a notification[/quote]', + '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]', + ))), 'bbcode_uid' => 'uid', 'force_approved_state' => false, ), diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php new file mode 100644 index 0000000000..f14f305517 --- /dev/null +++ b/tests/notification/submit_post_type_topic_test.php @@ -0,0 +1,153 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/submit_post_base.php'; + +class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_submit_post_base +{ + protected $item_type = 'notification.type.topic'; + + public function setUp() + { + parent::setUp(); + + global $auth, $phpbb_log; + + // Add additional permissions + $auth->expects($this->any()) + ->method('acl_get_list') + ->with($this->anything(), + $this->stringContains('_'), + $this->greaterThan(0)) + ->will($this->returnValueMap(array( + array( + array(6, 7, 8), + 'f_read', + 1, + array( + 1 => array( + 'f_read' => array(7, 8), + ), + ), + ), + ))); + + $phpbb_log = $this->getMock('\phpbb\log\dummy'); + } + + /** + * submit_post() Notifications test + * + * submit_post() $mode = 'post' + * Notification item_type = 'topic' + */ + public function submit_post_data() + { + return array( + /** + * Normal post + * + * User => State description + * 2 => Poster, should NOT receive a notification + * 6 => Forum subscribed, but no-auth reading, should NOT receive a notification + * 7 => Forum subscribed, should receive a notification + * 8 => Forum subscribed, but already notified, should NOT receive a new notification + */ + array( + array(), + array( + array('user_id' => 8, 'item_id' => 1, 'item_parent_id' => 1), + ), + array( + array('user_id' => 7, 'item_id' => 2, 'item_parent_id' => 1), + array('user_id' => 8, 'item_id' => 1, 'item_parent_id' => 1), + array('user_id' => 8, 'item_id' => 2, 'item_parent_id' => 1), + ), + ), + + /** + * Unapproved post + * + * No new notifications + */ + array( + array('force_approved_state' => false), + array( + array('user_id' => 8, 'item_id' => 1, 'item_parent_id' => 1), + ), + array( + array('user_id' => 8, 'item_id' => 1, 'item_parent_id' => 1), + ), + ), + ); + } + + /** + * @dataProvider submit_post_data + */ + public function test_submit_post($additional_post_data, $expected_before, $expected_after) + { + $sql = 'SELECT user_id, item_id, item_parent_id + FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt + WHERE nt.notification_type_name = '" . $this->item_type . "' + AND n.notification_type_id = nt.notification_type_id + ORDER BY user_id ASC, item_id ASC"; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_before, $this->db->sql_fetchrowset($result)); + $this->db->sql_freeresult($result); + + $poll_data = array(); + $post_data = array_merge($this->post_data, $additional_post_data); + submit_post('post', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false); + + // Check whether the notifications got added successfully + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result), + 'Check whether the notifications got added successfully'); + $this->db->sql_freeresult($result); + + if (isset($additional_post_data['force_approved_state']) && $additional_post_data['force_approved_state'] === false) + { + return; + } + + $reply_data = array_merge($this->post_data, array( + 'topic_id' => 2, + )); + $url = submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $reply_data, false, false); + $reply_id = 3; + $this->assertStringEndsWith('p' . $reply_id, $url, 'Post ID of reply is not ' . $reply_id); + + // Check whether the notifications are still correct after a reply has been added + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result), + 'Check whether the notifications are still correct after a reply has been added'); + $this->db->sql_freeresult($result); + + $result = $this->db->sql_query( + 'SELECT * + FROM ' . POSTS_TABLE . ' + WHERE post_id = ' . $reply_id); + $reply_edit_data = array_merge($this->post_data, $this->db->sql_fetchrow($result), array( + 'force_approved_state' => false, + 'post_edit_reason' => 'PHPBB3-12370', + )); + submit_post('edit', '', 'poster-name', POST_NORMAL, $poll_data, $reply_edit_data, false, false); + + // Check whether the notifications are still correct after the reply has been edit + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result), + 'Check whether the notifications are still correct after the reply has been edit'); + $this->db->sql_freeresult($result); + } +} diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php new file mode 100644 index 0000000000..9f6eb492f6 --- /dev/null +++ b/tests/notification/user_list_trim_test.php @@ -0,0 +1,143 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_notification_user_list_trim_test extends phpbb_database_test_case +{ + protected $notification; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_list_trim.xml'); + } + + public function setUp() + { + global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $user, $cache, $auth; + + parent::setUp(); + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $db = $this->new_dbal(); + + $config = new \phpbb\config\config(array()); + + $cache = new \phpbb\cache\service( + new \phpbb\cache\driver\dummy(), + $config, + $db, + $phpbb_root_path, + $phpEx + ); + + $auth = $this->getMock('\phpbb\auth\auth'); + $auth->expects($this->any()) + ->method('acl_get') + ->with($this->stringContains('_'), + $this->anything()) + ->will($this->returnValueMap(array( + array('u_viewprofile', 1, false), + ))); + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->data = array('user_lang' => 'en'); + $lang->add_lang('common'); + + $user_loader = new phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); + $user_loader->load_users(array(2, 3, 4, 5, 6)); + + $this->notification = new phpbb_mock_notification_type_post( + $user_loader, null, null, $lang, $user, null, null, $phpbb_root_path, $phpEx, null, null + ); + } + + public function user_list_trim_data() + { + return array( + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => null, + ), + '<strong>Reply</strong> from A in topic:', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + ), + ), + '<strong>Reply</strong> from A and <span class="username">B</span> in topic:', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + array('username' => '', 'poster_id' => 4), + ), + ), + '<strong>Reply</strong> from A, <span class="username">B</span>, and <span class="username">C</span> in topic:', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + array('username' => '', 'poster_id' => 4), + array('username' => '', 'poster_id' => 5), + ), + ), + '<strong>Reply</strong> from A, <span class="username">B</span>, <span class="username">C</span>, and <span class="username">D</span> in topic:', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + array('username' => '', 'poster_id' => 4), + array('username' => '', 'poster_id' => 5), + array('username' => '', 'poster_id' => 6), + ), + ), + '<strong>Reply</strong> from A, <span class="username">B</span>, <span class="username">C</span>, and 2 others in topic:', + ), + ); + } + + /** + * @dataProvider user_list_trim_data + */ + public function test_user_list_trim($data, $expected_result) + { + $data = array('notification_data' => serialize($data)); + $this->notification->set_initial_data($data); + + $this->assertEquals($expected_result, $this->notification->get_title()); + } +} diff --git a/tests/pagination/config/test/routing/environment.yml b/tests/pagination/config/test/routing/environment.yml new file mode 100644 index 0000000000..2ce082c9d1 --- /dev/null +++ b/tests/pagination/config/test/routing/environment.yml @@ -0,0 +1,6 @@ +core_controller: + path: /test + defaults: { _controller: core_foo.controller:bar, page: 1} +core_page_controller: + path: /test/page/{page} + defaults: { _controller: core_foo.controller:bar} diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index b7a4f101aa..6a3b46cdae 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,11 +25,41 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case public function setUp() { parent::setUp(); - $user = $this->getMock('\phpbb\user'); - $user->expects($this->any()) + + global $phpbb_dispatcher, $phpbb_root_path, $phpEx; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $this->user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $this->user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $this->pagination = new \phpbb\pagination($this->template, $user); + + $filesystem = new \phpbb\filesystem\filesystem(); + $manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array()); + + $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); + + $loader = new \Symfony\Component\Routing\Loader\YamlFileLoader( + new \phpbb\routing\file_locator($filesystem, dirname(__FILE__) . '/') + ); + $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager); + $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT); + + $request = new phpbb_mock_request(); + $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER); + $request->overwrite('SCRIPT_FILENAME', 'app.php', \phpbb\request\request_interface::SERVER); + $request->overwrite('REQUEST_URI', '/app.php', \phpbb\request\request_interface::SERVER); + + $symfony_request = new \phpbb\symfony_request( + $request + ); + + $this->routing_helper = new \phpbb\routing\helper($this->config, $router, $symfony_request, $request, $filesystem, '', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $symfony_request, $request, $this->routing_helper); + $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper, $phpbb_dispatcher); } public function generate_template_pagination_data() @@ -69,7 +103,6 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case :current:3:page.php?start=20 :else:4:page.php?start=30 :else:5:page.php?start=40 - :else:6:page.php?start=50 :ellipsis:9:page.php?start=80 :else:10:page.php?start=90 :next::page.php?start=30 @@ -77,49 +110,54 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case :u_next:page.php?start=30', ), array( - 'test/page/%d', - '/page/%d', + array('routes' => array( + 'core_controller', + 'core_page_controller', + )), + 'page', 95, 10, 10, 'pagination :per_page:10 :current_page:2 - :base_url:test/page/%d - :previous::test - :else:1:test - :current:2:test/page/2 - :else:3:test/page/3 - :else:4:test/page/4 - :else:5:test/page/5 - :ellipsis:9:test/page/9 - :else:10:test/page/10 - :next::test/page/3 - :u_prev:test - :u_next:test/page/3', + :base_url: + :previous::/test + :else:1:/test + :current:2:/test/page/2 + :else:3:/test/page/3 + :else:4:/test/page/4 + :else:5:/test/page/5 + :ellipsis:9:/test/page/9 + :else:10:/test/page/10 + :next::/test/page/3 + :u_prev:/test + :u_next:/test/page/3', ), array( - 'test/page/%d', - '/page/%d', + array('routes' => array( + 'core_controller', + 'core_page_controller', + )), + 'page', 95, 10, 20, 'pagination :per_page:10 :current_page:3 - :base_url:test/page/%d - :previous::test/page/2 - :else:1:test - :else:2:test/page/2 - :current:3:test/page/3 - :else:4:test/page/4 - :else:5:test/page/5 - :else:6:test/page/6 - :ellipsis:9:test/page/9 - :else:10:test/page/10 - :next::test/page/4 - :u_prev:test/page/2 - :u_next:test/page/4', + :base_url: + :previous::/test/page/2 + :else:1:/test + :else:2:/test/page/2 + :current:3:/test/page/3 + :else:4:/test/page/4 + :else:5:/test/page/5 + :ellipsis:9:/test/page/9 + :else:10:/test/page/10 + :next::/test/page/4 + :u_prev:/test/page/2 + :u_next:/test/page/4', ), ); } @@ -135,6 +173,42 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); } + /** + * @dataProvider generate_template_pagination_data + */ + public function test_generate_template_pagination_sub($base_url, $start_name, $num_items, $per_page, $start_item, $expect) + { + // Block needs to be assigned before pagination + $this->template->assign_block_vars('sub', array( + 'FOO' => 'bar', + )); + + $this->pagination->generate_template_pagination($base_url, 'sub.pagination', $start_name, $num_items, $per_page, $start_item); + $this->template->set_filenames(array('test' => 'pagination_sub.html')); + + $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); + } + + /** + * @dataProvider generate_template_pagination_data + */ + public function test_generate_template_pagination_double_nested($base_url, $start_name, $num_items, $per_page, $start_item, $expect) + { + // Block needs to be assigned before pagination + $this->template->assign_block_vars('sub', array( + 'FOO' => 'bar', + )); + + $this->template->assign_block_vars('sub.level2', array( + 'BAR' => 'foo', + )); + + $this->pagination->generate_template_pagination($base_url, 'sub.level2.pagination', $start_name, $num_items, $per_page, $start_item); + $this->template->set_filenames(array('test' => 'pagination_double_nested.html')); + + $this->assertEquals(str_replace("\t", '', $expect), $this->display('test')); + } + public function on_page_data() { return array( diff --git a/tests/pagination/templates/pagination_double_nested.html b/tests/pagination/templates/pagination_double_nested.html new file mode 100644 index 0000000000..c179248233 --- /dev/null +++ b/tests/pagination/templates/pagination_double_nested.html @@ -0,0 +1,19 @@ +pagination +<!-- BEGIN sub --> +<!-- BEGIN level2 --> +:per_page:{sub.level2.PER_PAGE} +:current_page:{sub.level2.CURRENT_PAGE} +:base_url:{sub.level2.BASE_URL} +<!-- BEGIN pagination --> +<!-- IF sub.level2.pagination.S_IS_PREV -->:previous:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL} +<!-- ELSEIF sub.level2.pagination.S_IS_CURRENT -->:current:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL} +<!-- ELSEIF sub.level2.pagination.S_IS_ELLIPSIS -->:ellipsis:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL} +<!-- ELSEIF sub.level2.pagination.S_IS_NEXT -->:next:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL} +<!-- ELSE -->:else:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL} +<!-- ENDIF --> +<!-- END pagination --> +<!-- IF sub.level2.U_PREVIOUS_PAGE -->:u_prev:{sub.level2.U_PREVIOUS_PAGE}<!-- ENDIF --> + +<!-- IF sub.level2.U_NEXT_PAGE -->:u_next:{sub.level2.U_NEXT_PAGE}<!-- ENDIF --> +<!-- END level2 --> +<!-- END sub --> diff --git a/tests/pagination/templates/pagination_sub.html b/tests/pagination/templates/pagination_sub.html new file mode 100644 index 0000000000..4ec14039e0 --- /dev/null +++ b/tests/pagination/templates/pagination_sub.html @@ -0,0 +1,17 @@ +pagination +<!-- BEGIN sub --> +:per_page:{sub.PER_PAGE} +:current_page:{sub.CURRENT_PAGE} +:base_url:{sub.BASE_URL} +<!-- BEGIN pagination --> +<!-- IF sub.pagination.S_IS_PREV -->:previous:{sub.pagination.PAGE_NUMBER}:{sub.pagination.PAGE_URL} +<!-- ELSEIF sub.pagination.S_IS_CURRENT -->:current:{sub.pagination.PAGE_NUMBER}:{sub.pagination.PAGE_URL} +<!-- ELSEIF sub.pagination.S_IS_ELLIPSIS -->:ellipsis:{sub.pagination.PAGE_NUMBER}:{sub.pagination.PAGE_URL} +<!-- ELSEIF sub.pagination.S_IS_NEXT -->:next:{sub.pagination.PAGE_NUMBER}:{sub.pagination.PAGE_URL} +<!-- ELSE -->:else:{sub.pagination.PAGE_NUMBER}:{sub.pagination.PAGE_URL} +<!-- ENDIF --> +<!-- END pagination --> +<!-- IF sub.U_PREVIOUS_PAGE -->:u_prev:{sub.U_PREVIOUS_PAGE}<!-- ENDIF --> + +<!-- IF sub.U_NEXT_PAGE -->:u_next:{sub.U_NEXT_PAGE}<!-- ENDIF --> +<!-- END sub --> diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php index 2d26be7da5..5f9fd523c9 100644 --- a/tests/passwords/drivers_test.php +++ b/tests/passwords/drivers_test.php @@ -1,26 +1,42 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -class phpbb_passwords_helper_test extends PHPUnit_Framework_TestCase +class phpbb_passwords_helper_test extends \phpbb_test_case { public function setUp() { // Prepare dependencies for drivers $config = new \phpbb\config\config(array()); + $request = new phpbb_mock_request(array(), array(), array(), array(), array('password' => 'fööbar')); $this->driver_helper = new \phpbb\passwords\driver\helper($config); + $phpbb_root_path = dirname(__FILE__) . '/../../phpBB/'; + $php_ext = 'php'; $this->passwords_drivers = array( 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $this->driver_helper), - 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper), + 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper), 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $this->driver_helper), - 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $this->driver_helper), + 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $this->driver_helper), + 'passwords.driver.sha1_smf' => new \phpbb\passwords\driver\sha1_smf($config, $this->driver_helper), + 'passwords.driver.sha1_wcf1' => new \phpbb\passwords\driver\sha1_wcf1($config, $this->driver_helper), + 'passwords.driver.convert_password'=> new \phpbb\passwords\driver\convert_password($config, $this->driver_helper), + 'passwords.driver.sha1' => new \phpbb\passwords\driver\sha1($config, $this->driver_helper), + 'passwords.driver.md5_mybb' => new \phpbb\passwords\driver\md5_mybb($config, $this->driver_helper), + 'passwords.driver.md5_vb' => new \phpbb\passwords\driver\md5_vb($config, $this->driver_helper), + 'passwords.driver.sha_xf1' => new \phpbb\passwords\driver\sha_xf1($config, $this->driver_helper), ); + $this->passwords_drivers['passwords.driver.md5_phpbb2'] = new \phpbb\passwords\driver\md5_phpbb2($request, $this->passwords_drivers['passwords.driver.salted_md5'], $this->driver_helper, $phpbb_root_path, $php_ext); + $this->passwords_drivers['passwords.driver.bcrypt_wcf2'] = new \phpbb\passwords\driver\bcrypt_wcf2($this->passwords_drivers['passwords.driver.bcrypt'], $this->driver_helper); } public function data_helper_encode64() @@ -38,7 +54,7 @@ class phpbb_passwords_helper_test extends PHPUnit_Framework_TestCase public function test_helper_encode64($input, $length, $output) { $return = $this->driver_helper->hash_encode64($input, $length); - $this->assertEquals($output, $return); + $this->assertSame($output, $return); } public function data_get_random_salt() @@ -61,8 +77,8 @@ class phpbb_passwords_helper_test extends PHPUnit_Framework_TestCase while ((microtime(true) - $start) < 1) { $urandom_string = (empty($rand_seed)) ? $this->driver_helper->get_random_salt($length) : $this->driver_helper->get_random_salt($length, $rand_seed); - $this->assertEquals($length, strlen($urandom_string)); - $this->assertNotEquals($rand_string, $urandom_string); + $this->assertSame($length, strlen($urandom_string)); + $this->assertNotSame($rand_string, $urandom_string); } } @@ -78,4 +94,323 @@ class phpbb_passwords_helper_test extends PHPUnit_Framework_TestCase ); $this->assertEquals(false, $this->passwords_drivers['passwords.driver.salted_md5']->get_hash_settings(false)); } + + public function data_hash_sha1_smf() + { + return array( + array(false, 'test', array()), + array(false, 'test', ''), + array('6f9e2a1899e1f15708fd2e554103480eb53e8b57', 'foobar', array('login_name' => 'test')), + ); + } + + /** + * @dataProvider data_hash_sha1_smf + */ + public function test_hash_sha1_smf($expected, $password, $user_row) + { + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.sha1_smf']->hash($password, $user_row)); + } + + public function data_get_settings() + { + return array( + array(false, '6f9e2a1899e1f15708fd2e554103480eb53e8b57', 'passwords.driver.sha1_smf'), + ); + } + + /** + * @dataProvider data_get_settings + */ + public function test_get_settings_only($expected, $hash, $driver) + { + $this->assertSame($expected, $this->passwords_drivers[$driver]->get_settings_only($hash)); + } + + public function data_md5_phpbb2_check() + { + return array( + array(false, 'foobar', 'ae2fc75e20ee25d4520766788fbc96ae'), + array(false, 'foobar', 'ae2fc75e20ee25d4520766788fbc96aeddsf'), + array(false, 'fööbar', 'ae2fc75e20ee25d4520766788fbc96ae'), + array(true, 'fööbar', 'ae2fc75e20ee25d4520766788fbc96ae', utf8_decode('fööbar')), + array(true, 'fööbar', '$H$966CepJh9RC3hFIm7aKywR6jEn0kpA0', utf8_decode('fööbar')), + array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', $this->utf8_to_cp1252(utf8_decode('fööbar'))), + array(true, 'fööbar', '$H$9rNjgwETtmc8befO8JL1xFMrrMw8MC.', $this->utf8_to_cp1252('fööbar')), + ); + } + + /** + * @dataProvider data_md5_phpbb2_check + */ + public function test_md5_phpbb2_check($expected, $password, $hash, $request_password = false) + { + if (!$request_password) + { + unset($_REQUEST['password']); + } + else + { + $_REQUEST['password'] = $request_password; + } + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.md5_phpbb2']->check($password, $hash)); + } + + public function test_md5_phpbb2_hash() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_phpbb2']->hash('foobar')); + } + + public function test_convert_password_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.convert_password']->hash('foobar')); + } + + public function test_sha1_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha1']->hash('foobar')); + } + + public function data_md5_mybb_check() + { + return array( + array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'), + array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd', array('user_passwd_salt' => 'ae2fc75e')), + array(true, 'foobar', 'b86ee7e24008bfd2890dcfab1ed31333', array('user_passwd_salt' => 'yeOtfFO6')), + ); + } + + /** + * @dataProvider data_md5_mybb_check + */ + public function test_md5_mybb_check($expected, $password, $hash, $user_row = array()) + { + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.md5_mybb']->check($password, $hash, $user_row)); + } + + public function test_md5_mybb_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_mybb']->hash('foobar')); + } + + public function data_md5_vb_check() + { + return array( + array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'), + array(false, 'foobar', 'b86ee7e24008bfd2890dcfab1ed31333', array('user_passwd_salt' => 'yeOtfFO6')), + array(true, 'foobar', 'b452c54c44c588fc095d2d000935c470', array('user_passwd_salt' => '9^F')), + array(true, 'foobar', 'f23a8241bd115d270c703213e3ef7f52', array('user_passwd_salt' => 'iaU*U%`CBl;/e~>D%do2m@Xf/,KZB0')), + array(false, 'nope', 'f23a8241bd115d270c703213e3ef7f52', array('user_passwd_salt' => 'iaU*U%`CBl;/e~>D%do2m@Xf/,KZB0')), + ); + } + + /** + * @dataProvider data_md5_vb_check + */ + public function test_md5_vb_check($expected, $password, $hash, $user_row = array()) + { + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.md5_vb']->check($password, $hash, $user_row)); + } + + public function test_md5_vb_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_vb']->hash('foobar')); + } + + public function data_sha1_wcf1_check() + { + return array( + array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), + array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff', array('user_passwd_salt' => 'yeOtfFO6')), + array(true, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff', array('user_passwd_salt' => '1a783e478d63f6422783a868db667aed3a857840')), + ); + } + + /** + * @dataProvider data_sha1_wcf1_check + */ + public function test_sha1_wcf1_check($expected, $password, $hash, $user_row = array()) + { + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.sha1_wcf1']->check($password, $hash, $user_row)); + } + + public function test_sha1_wcf1_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha1_wcf1']->hash('foobar')); + } + + public function data_bcrypt_wcf2_check() + { + return array( + array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), + array(true, 'foobar', '$2a$08$p8h14U0jsEiVb1Luy.s8oOTXSQ0hVWUXpcNGBoCezeYNXrQyCKHfi'), + array(false, 'foobar', ''), + ); + } + + /** + * @dataProvider data_bcrypt_wcf2_check + */ + public function test_bcrypt_wcf2_check($expected, $password, $hash) + { + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.bcrypt_wcf2']->check($password, $hash)); + } + + public function test_bcrypt_wcf2_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.bcrypt_wcf2']->hash('foobar')); + } + + public function data_sha_xf1_check() + { + return array( + array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff'), + array(false, 'foobar', 'fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff', array('user_passwd_salt' => 'yeOtfFO6')), + array(true, 'foobar', '7f65d2fa8a826d232f8134772252f8b1aaef8594b1edcabd9ab65e5b0f236ff0', array('user_passwd_salt' => '15b6c02cedbd727f563dcca607a89b085287b448966f19c0cc78cae263b1e38c')), + array(true, 'foobar', '69962ae2079420573a3948cc4dedbabd35680051', array('user_passwd_salt' => '15b6c02cedbd727f563dcca607a89b085287b448966f19c0cc78cae263b1e38c')), + ); + } + + /** + * @dataProvider data_sha_xf1_check + */ + public function test_sha_xf1_check($expected, $password, $hash, $user_row = array()) + { + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.sha_xf1']->check($password, $hash, $user_row)); + } + + public function test_sha_xf1_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha_xf1']->hash('foobar')); + } + + protected function utf8_to_cp1252($string) + { + static $transform = array( + "\xE2\x82\xAC" => "\x80", + "\xE2\x80\x9A" => "\x82", + "\xC6\x92" => "\x83", + "\xE2\x80\x9E" => "\x84", + "\xE2\x80\xA6" => "\x85", + "\xE2\x80\xA0" => "\x86", + "\xE2\x80\xA1" => "\x87", + "\xCB\x86" => "\x88", + "\xE2\x80\xB0" => "\x89", + "\xC5\xA0" => "\x8A", + "\xE2\x80\xB9" => "\x8B", + "\xC5\x92" => "\x8C", + "\xC5\xBD" => "\x8E", + "\xE2\x80\x98" => "\x91", + "\xE2\x80\x99" => "\x92", + "\xE2\x80\x9C" => "\x93", + "\xE2\x80\x9D" => "\x94", + "\xE2\x80\xA2" => "\x95", + "\xE2\x80\x93" => "\x96", + "\xE2\x80\x94" => "\x97", + "\xCB\x9C" => "\x98", + "\xE2\x84\xA2" => "\x99", + "\xC5\xA1" => "\x9A", + "\xE2\x80\xBA" => "\x9B", + "\xC5\x93" => "\x9C", + "\xC5\xBE" => "\x9E", + "\xC5\xB8" => "\x9F", + "\xC2\xA0" => "\xA0", + "\xC2\xA1" => "\xA1", + "\xC2\xA2" => "\xA2", + "\xC2\xA3" => "\xA3", + "\xC2\xA4" => "\xA4", + "\xC2\xA5" => "\xA5", + "\xC2\xA6" => "\xA6", + "\xC2\xA7" => "\xA7", + "\xC2\xA8" => "\xA8", + "\xC2\xA9" => "\xA9", + "\xC2\xAA" => "\xAA", + "\xC2\xAB" => "\xAB", + "\xC2\xAC" => "\xAC", + "\xC2\xAD" => "\xAD", + "\xC2\xAE" => "\xAE", + "\xC2\xAF" => "\xAF", + "\xC2\xB0" => "\xB0", + "\xC2\xB1" => "\xB1", + "\xC2\xB2" => "\xB2", + "\xC2\xB3" => "\xB3", + "\xC2\xB4" => "\xB4", + "\xC2\xB5" => "\xB5", + "\xC2\xB6" => "\xB6", + "\xC2\xB7" => "\xB7", + "\xC2\xB8" => "\xB8", + "\xC2\xB9" => "\xB9", + "\xC2\xBA" => "\xBA", + "\xC2\xBB" => "\xBB", + "\xC2\xBC" => "\xBC", + "\xC2\xBD" => "\xBD", + "\xC2\xBE" => "\xBE", + "\xC2\xBF" => "\xBF", + "\xC3\x80" => "\xC0", + "\xC3\x81" => "\xC1", + "\xC3\x82" => "\xC2", + "\xC3\x83" => "\xC3", + "\xC3\x84" => "\xC4", + "\xC3\x85" => "\xC5", + "\xC3\x86" => "\xC6", + "\xC3\x87" => "\xC7", + "\xC3\x88" => "\xC8", + "\xC3\x89" => "\xC9", + "\xC3\x8A" => "\xCA", + "\xC3\x8B" => "\xCB", + "\xC3\x8C" => "\xCC", + "\xC3\x8D" => "\xCD", + "\xC3\x8E" => "\xCE", + "\xC3\x8F" => "\xCF", + "\xC3\x90" => "\xD0", + "\xC3\x91" => "\xD1", + "\xC3\x92" => "\xD2", + "\xC3\x93" => "\xD3", + "\xC3\x94" => "\xD4", + "\xC3\x95" => "\xD5", + "\xC3\x96" => "\xD6", + "\xC3\x97" => "\xD7", + "\xC3\x98" => "\xD8", + "\xC3\x99" => "\xD9", + "\xC3\x9A" => "\xDA", + "\xC3\x9B" => "\xDB", + "\xC3\x9C" => "\xDC", + "\xC3\x9D" => "\xDD", + "\xC3\x9E" => "\xDE", + "\xC3\x9F" => "\xDF", + "\xC3\xA0" => "\xE0", + "\xC3\xA1" => "\xE1", + "\xC3\xA2" => "\xE2", + "\xC3\xA3" => "\xE3", + "\xC3\xA4" => "\xE4", + "\xC3\xA5" => "\xE5", + "\xC3\xA6" => "\xE6", + "\xC3\xA7" => "\xE7", + "\xC3\xA8" => "\xE8", + "\xC3\xA9" => "\xE9", + "\xC3\xAA" => "\xEA", + "\xC3\xAB" => "\xEB", + "\xC3\xAC" => "\xEC", + "\xC3\xAD" => "\xED", + "\xC3\xAE" => "\xEE", + "\xC3\xAF" => "\xEF", + "\xC3\xB0" => "\xF0", + "\xC3\xB1" => "\xF1", + "\xC3\xB2" => "\xF2", + "\xC3\xB3" => "\xF3", + "\xC3\xB4" => "\xF4", + "\xC3\xB5" => "\xF5", + "\xC3\xB6" => "\xF6", + "\xC3\xB7" => "\xF7", + "\xC3\xB8" => "\xF8", + "\xC3\xB9" => "\xF9", + "\xC3\xBA" => "\xFA", + "\xC3\xBB" => "\xFB", + "\xC3\xBC" => "\xFC", + "\xC3\xBD" => "\xFD", + "\xC3\xBE" => "\xFE", + "\xC3\xBF" => "\xFF" + ); + return strtr($string, $transform); + } } diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index ee295ff043..333834ee07 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -1,13 +1,17 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase +class phpbb_passwords_manager_test extends \phpbb_test_case { protected $passwords_drivers; @@ -20,13 +24,25 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase // Prepare dependencies for manager and driver $config = new \phpbb\config\config(array()); $this->driver_helper = new \phpbb\passwords\driver\helper($config); + $request = new phpbb_mock_request(array(), array(), array(), array(), array('password' => 'töst')); + $phpbb_root_path = dirname(__FILE__) . '/../../phpBB/'; + $php_ext = 'php'; $this->passwords_drivers = array( - 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $this->driver_helper), + 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $this->driver_helper), 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper), - 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $this->driver_helper), + 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $this->driver_helper), 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $this->driver_helper), + 'passwords.driver.convert_password' => new \phpbb\passwords\driver\convert_password($config, $this->driver_helper), + 'passwords.driver.sha1_smf' => new \phpbb\passwords\driver\sha1_smf($config, $this->driver_helper), + 'passwords.driver.sha1' => new \phpbb\passwords\driver\sha1($config, $this->driver_helper), + 'passwords.driver.sha1_wcf1' => new \phpbb\passwords\driver\sha1_wcf1($config, $this->driver_helper), + 'passwords.driver.md5_mybb' => new \phpbb\passwords\driver\md5_mybb($config, $this->driver_helper), + 'passwords.driver.md5_vb' => new \phpbb\passwords\driver\md5_vb($config, $this->driver_helper), + 'passwords.driver.sha_xf1' => new \phpbb\passwords\driver\sha_xf1($config, $this->driver_helper), ); + $this->passwords_drivers['passwords.driver.md5_phpbb2'] = new \phpbb\passwords\driver\md5_phpbb2($request, $this->passwords_drivers['passwords.driver.salted_md5'], $this->driver_helper, $phpbb_root_path, $php_ext); + $this->passwords_drivers['passwords.driver.bcrypt_wcf2'] = new \phpbb\passwords\driver\bcrypt_wcf2($this->passwords_drivers['passwords.driver.bcrypt'], $this->driver_helper); $this->helper = new \phpbb\passwords\helper; // Set up passwords manager @@ -128,21 +144,39 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase public function check_hash_exceptions_data() { return array( - array('foobar', '3858f62230ac3c915f300c664312c63f', true), - array('foobar', '$S$b57a939fa4f2c04413a4eea9734a0903647b7adb93181295', false), - array('foobar', '$2a\S$kkkkaakdkdiej39023903204j2k3490234jk234j02349', false), - array('foobar', '$H$kklk938d023k//k3023', false), - array('foobar', '$H$3PtYMgXb39lrIWkgoxYLWtRkZtY3AY/', false), - array('foobar', '$2a$kwiweorurlaeirw', false), + array('3858f62230ac3c915f300c664312c63f', true), + array('$CP$3858f62230ac3c915f300c664312c63f', true), // md5_phpbb2 + array('$CP$3858f62230ac3c915f300c', false), + array('$S$b57a939fa4f2c04413a4eea9734a0903647b7adb93181295', false), + array('$2a\S$kkkkaakdkdiej39023903204j2k3490234jk234j02349', false), + array('$H$kklk938d023k//k3023', false), + array('$H$3PtYMgXb39lrIWkgoxYLWtRkZtY3AY/', false), + array('$2a$kwiweorurlaeirw', false), + array('6f9e2a1899e1f15708fd2e554103480eb53e8b57', false), + array('6f9e2a1899e1f15708fd2e554103480eb53e8b57', false, 'foobar', array('login_name' => 'test')), + array('$CP$6f9e2a1899e1f15708fd2e554103480eb53e8b57', true, 'foobar', array('login_name' => 'test')), // sha1_smf + array('6f9e2a1899', false, 'foobar', array('login_name' => 'test')), + array('ae2fc75e20ee25d4520766788fbc96ae', false, 'fööbar'), + array('$CP$ae2fc75e20ee25d4520766788fbc96ae', false, 'fööbar'), + array('$CP$ae2fc75e20ee25d4520766788fbc96ae', true, utf8_decode('fööbar')), // md5_phpbb2 + array('b86ee7e24008bfd2890dcfab1ed31333', false, 'foobar', array('user_passwd_salt' => 'yeOtfFO6')), + array('$CP$b86ee7e24008bfd2890dcfab1ed31333', true, 'foobar', array('user_passwd_salt' => 'yeOtfFO6')), // md5_mybb + array('$CP$b452c54c44c588fc095d2d000935c470', true, 'foobar', array('user_passwd_salt' => '9^F')), // md5_vb + array('$CP$f23a8241bd115d270c703213e3ef7f52', true, 'foobar', array('user_passwd_salt' => 'iaU*U%`CBl;/e~>D%do2m@Xf/,KZB0')), // md5_vb + array('$CP$fc46b9d9386167ce365ea3b891bf5dc31ddcd3ff', true, 'foobar', array('user_passwd_salt' => '1a783e478d63f6422783a868db667aed3a857840')), // sha_wcf1 + array('$2a$08$p8h14U0jsEiVb1Luy.s8oOTXSQ0hVWUXpcNGBoCezeYNXrQyCKHfi', false), + array('$CP$$2a$08$p8h14U0jsEiVb1Luy.s8oOTXSQ0hVWUXpcNGBoCezeYNXrQyCKHfi', true), // bcrypt_wcf2 + array('$CP$7f65d2fa8a826d232f8134772252f8b1aaef8594b1edcabd9ab65e5b0f236ff0', true, 'foobar', array('user_passwd_salt' => '15b6c02cedbd727f563dcca607a89b085287b448966f19c0cc78cae263b1e38c')), // sha_xf1 + array('$CP$69962ae2079420573a3948cc4dedbabd35680051', true, 'foobar', array('user_passwd_salt' => '15b6c02cedbd727f563dcca607a89b085287b448966f19c0cc78cae263b1e38c')), // sha_xf1 ); } /** * @dataProvider check_hash_exceptions_data */ - public function test_check_hash_exceptions($password, $hash, $expected) + public function test_check_hash_exceptions($hash, $expected, $password = 'foobar', $user_row = array()) { - $this->assertEquals($expected, $this->manager->check($password, $hash)); + $this->assertEquals($expected, $this->manager->check($password, $hash, $user_row)); } public function data_hash_password_length() @@ -176,7 +210,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase } } - public function test_combined_hash_data() + public function combined_hash_data() { if (version_compare(PHP_VERSION, '5.3.7', '<')) { @@ -242,7 +276,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase } /** - * @dataProvider test_combined_hash_data + * @dataProvider combined_hash_data */ public function test_combined_hash_password($first_type, $second_type, $expected = true) { @@ -273,7 +307,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase // Limit test to 1 second while ((microtime(true) - $time) < 1) { - $this->assertNotEquals($first_id, $this->driver_helper->unique_id()); + $this->assertNotSame($first_id, $this->driver_helper->unique_id()); } } @@ -292,4 +326,22 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase $this->assertFalse($this->manager->hash(str_repeat('a', 1024 * 1024 * 16))); $this->assertLessThanOrEqual(5, time() - $start_time); } + + public function data_test_string_compare() + { + return array( + array('foo', 'bar', false), + array(1, '1', false), + array('one', 'one', true), + array('foobar', 'foobaf', false), + ); + } + + /** + * @dataProvider data_test_string_compare + */ + public function test_string_compare($a, $b, $expected) + { + $this->assertSame($expected, $this->driver_helper->string_compare($a, $b)); + } } diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php new file mode 100644 index 0000000000..007441bc92 --- /dev/null +++ b/tests/path_helper/path_helper_test.php @@ -0,0 +1,464 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_path_helper_test extends phpbb_test_case +{ + /** @var \phpbb\path_helper */ + protected $path_helper; + protected $phpbb_root_path = ''; + + public function setUp() + { + parent::setUp(); + + $filesystem = new \phpbb\filesystem\filesystem(); + $this->set_phpbb_root_path($filesystem); + + $this->path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new phpbb_mock_request() + ), + new \phpbb\filesystem\filesystem(), + $this->getMock('\phpbb\request\request'), + $this->phpbb_root_path, + 'php' + ); + } + + /** + * Set the phpbb_root_path + * + * This is necessary because dataProvider functions are called + * before setUp or setUpBeforeClass; so we must set the path + * any time we wish to use it in one of these functions (and + * also in general for everything else) + */ + public function set_phpbb_root_path($filesystem) + { + $this->phpbb_root_path = $filesystem->clean_path(dirname(__FILE__) . '/../../phpBB/'); + } + + public function test_get_web_root_path() + { + // Symfony Request = null, so always should return phpbb_root_path + $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path()); + } + + public function basic_update_web_root_path_data() + { + $filesystem = new \phpbb\filesystem\filesystem(); + $this->set_phpbb_root_path($filesystem); + + return array( + array( + 'http://www.test.com/test.php', + 'http://www.test.com/test.php', + '/', + ), + array( + $this->phpbb_root_path . 'test.php', + $this->phpbb_root_path . 'test.php', + ), + array( + 'test.php', + 'test.php', + ), + array( + $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', + $filesystem->clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'), + ), + ); + } + + /** + * @dataProvider basic_update_web_root_path_data + */ + public function test_basic_update_web_root_path($input, $expected) + { + $this->assertEquals($expected, $this->path_helper->update_web_root_path($input)); + } + + public function update_web_root_path_data() + { + $this->set_phpbb_root_path(new \phpbb\filesystem\filesystem()); + + return array( + array( + $this->phpbb_root_path . 'test.php', + '/', + null, + null, + '', + ), + array( + $this->phpbb_root_path . 'test.php', + '//', + null, + null, + './../', + ), + array( + $this->phpbb_root_path . 'test.php', + '//', + 'foo/bar.php', + 'bar.php', + './../', + ), + array( + $this->phpbb_root_path . 'test.php', + '/foo/template', + '/phpbb3-fork/phpBB/app.php/foo/template', + '/phpbb3-fork/phpBB/app.php', + './../../', + ), + array( + $this->phpbb_root_path . 'test.php', + '/foo/template', + '/phpbb3-fork/phpBB/foo/template', + '/phpbb3-fork/phpBB/app.php', + './../', + ), + array( + $this->phpbb_root_path . 'test.php', + '/', + '/phpbb3-fork/phpBB/app.php/', + '/phpbb3-fork/phpBB/app.php', + './../', + ), + ); + } + + /** + * @dataProvider update_web_root_path_data + */ + public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction) + { + $symfony_request = $this->getMock('\phpbb\symfony_request', array(), array( + new phpbb_mock_request(), + )); + $symfony_request->expects($this->any()) + ->method('getPathInfo') + ->will($this->returnValue($getPathInfo)); + $symfony_request->expects($this->any()) + ->method('getRequestUri') + ->will($this->returnValue($getRequestUri)); + $symfony_request->expects($this->any()) + ->method('getScriptName') + ->will($this->returnValue($getScriptName)); + + $path_helper = new \phpbb\path_helper( + $symfony_request, + new \phpbb\filesystem\filesystem(), + $this->getMock('\phpbb\request\request'), + $this->phpbb_root_path, + 'php' + ); + + $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request)); + } + + public function clean_url_data() + { + return array( + array('', ''), + array('://', '://'), + array('http://', 'http://'), + array('http://one/two/three', 'http://one/two/three'), + array('http://../one/two', 'http://../one/two'), + array('http://one/../two/three', 'http://two/three'), + array('http://one/two/../three', 'http://one/three'), + array('http://one/two/../../three', 'http://three'), + array('http://one/two/../../../three', 'http://../three'), + ); + } + + /** + * @dataProvider clean_url_data + */ + public function test_clean_url($input, $expected) + { + $this->assertEquals($expected, $this->path_helper->clean_url($input)); + } + + public function glue_url_params_data() + { + return array( + array( + array(), + '', + ), + array( + array('test' => 'xyz'), + 'test=xyz', + ), + array( + array('test' => 'xyz', 'var' => 'value'), + 'test=xyz&var=value', + ), + array( + array('test' => null), + 'test', + ), + array( + array('test' => null, 'var' => null), + 'test&var', + ), + array( + array('test' => 'xyz', 'var' => null, 'bar' => 'value'), + 'test=xyz&var&bar=value', + ), + ); + } + + /** + * @dataProvider glue_url_params_data + */ + public function test_glue_url_params($params, $expected) + { + $this->assertEquals($expected, $this->path_helper->glue_url_params($params)); + } + + public function get_url_parts_data() + { + return array( + array( + 'viewtopic.php', + true, + array('base' => 'viewtopic.php', 'params' => array()), + ), + array( + './viewtopic.php?t=5&f=6', + true, + array('base' => './viewtopic.php', 'params' => array('t' => '5', 'f' => '6')), + ), + array( + 'viewtopic.php?t=5&f=6', + false, + array('base' => 'viewtopic.php', 'params' => array('t' => '5', 'f' => '6')), + ), + array( + 'https://phpbb.com/community/viewtopic.php?t=5&f=6', + true, + array('base' => 'https://phpbb.com/community/viewtopic.php', 'params' => array('t' => '5', 'f' => '6')), + ), + array( + 'test.php?topic=post=5&f=3', + true, + array('base' => 'test.php', 'params' => array('topic' => 'post=5', 'f' => '3')), + ), + array( + 'mcp.php?&t=4&f=3', + true, + array('base' => 'mcp.php', 'params' => array('t' => '4', 'f' => '3')), + ), + array( + 'mcp.php?=4&f=3', + true, + array('base' => 'mcp.php', 'params' => array('f' => '3')), + ), + array( + 'index.php?ready', + false, + array('base' => 'index.php', 'params' => array('ready' => null)), + ), + array( + 'index.php?i=1&ready', + true, + array('base' => 'index.php', 'params' => array('i' => '1', 'ready' => null)), + ), + array( + 'index.php?ready&i=1', + false, + array('base' => 'index.php', 'params' => array('ready' => null, 'i' => '1')), + ), + ); + } + + /** + * @dataProvider get_url_parts_data + */ + public function test_get_url_parts($url, $is_amp, $expected) + { + $this->assertEquals($expected, $this->path_helper->get_url_parts($url, $is_amp)); + } + + public function strip_url_params_data() + { + return array( + array( + 'viewtopic.php', + 'sid', + false, + 'viewtopic.php', + ), + array( + './viewtopic.php?t=5&f=6', + 'f', + true, + './viewtopic.php?t=5', + ), + array( + 'viewtopic.php?t=5&f=6&sid=19adc288814103cbb4625e74e77455aa', + array('t'), + false, + 'viewtopic.php?f=6&sid=19adc288814103cbb4625e74e77455aa', + ), + array( + 'https://phpbb.com/community/viewtopic.php?t=5&f=6', + array('t', 'f'), + true, + 'https://phpbb.com/community/viewtopic.php', + ), + ); + } + + /** + * @dataProvider strip_url_params_data + */ + public function test_strip_url_params($url, $strip, $is_amp, $expected) + { + $this->assertEquals($expected, $this->path_helper->strip_url_params($url, $strip, $is_amp)); + } + + public function append_url_params_data() + { + return array( + array( + 'viewtopic.php', + array(), + false, + 'viewtopic.php', + ), + array( + './viewtopic.php?t=5&f=6', + array('t' => '7'), + true, + './viewtopic.php?t=7&f=6', + ), + array( + 'viewtopic.php?t=5&f=6&sid=19adc288814103cbb4625e74e77455aa', + array('p' => '5'), + false, + 'viewtopic.php?t=5&f=6&p=5&sid=19adc288814103cbb4625e74e77455aa', + ), + array( + 'https://phpbb.com/community/viewtopic.php', + array('t' => '7', 'f' => '8'), + true, + 'https://phpbb.com/community/viewtopic.php?t=7&f=8', + ), + ); + } + + /** + * @dataProvider append_url_params_data + */ + public function test_append_url_params($url, $params, $is_amp, $expected) + { + $this->assertEquals($expected, $this->path_helper->append_url_params($url, $params, $is_amp)); + } + + public function get_web_root_path_from_ajax_referer_data() + { + return array( + array( + 'http://www.phpbb.com/community/route1/route2/', + 'http://www.phpbb.com/community', + '../../', + ), + array( + 'http://www.phpbb.com/community/route1/route2', + 'http://www.phpbb.com/community', + '../', + ), + array( + 'http://www.phpbb.com/community/route1', + 'http://www.phpbb.com/community', + '', + ), + array( + 'http://www.phpbb.com/community/', + 'http://www.phpbb.com/community', + '', + ), + array( + 'http://www.phpbb.com/notcommunity/route1/route2/', + 'http://www.phpbb.com/community', + '../../../community/', + ), + array( + 'http://www.phpbb.com/notcommunity/route1/route2', + 'http://www.phpbb.com/community', + '../../community/', + ), + array( + 'http://www.phpbb.com/notcommunity/route1', + 'http://www.phpbb.com/community', + '../community/', + ), + array( + 'http://www.phpbb.com/notcommunity/', + 'http://www.phpbb.com/community', + '../community/', + ), + array( + 'http://www.phpbb.com/foobar', + 'http://www.phpbb.com', + '', + ), + array( + 'http://www.foobar.com', + 'http://www.phpbb.com', + '/www.phpbb.com/', + ), + array( + 'foobar', + 'http://www.phpbb.com/community', + '', + ) + ); + } + + /** + * @dataProvider get_web_root_path_from_ajax_referer_data + */ + public function test_get_web_root_path_from_ajax_referer($referer_url, $board_url, $expected) + { + $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_web_root_path_from_ajax_referer($referer_url, $board_url)); + } + + public function data_get_valid_page() + { + return array( + // array( current page , mod_rewrite setting , expected output ) + array('index', true, 'index'), + array('index', false, 'index'), + array('foo/index', true, 'foo/index'), + array('foo/index', false, 'foo/index'), + array('app.php/foo', true, 'foo'), + array('app.php/foo', false, 'app.php/foo'), + array('/../app.php/foo', true, '../foo'), + array('/../app.php/foo', false, '../app.php/foo'), + array('/../example/app.php/foo/bar', true, '../example/foo/bar'), + array('/../example/app.php/foo/bar', false, '../example/app.php/foo/bar'), + ); + } + + /** + * @dataProvider data_get_valid_page + */ + public function test_get_valid_page($page, $mod_rewrite, $expected) + { + $this->assertEquals($this->phpbb_root_path . $expected, $this->path_helper->get_valid_page($page, $mod_rewrite)); + } +} diff --git a/tests/path_helper/web_root_path_test.php b/tests/path_helper/web_root_path_test.php deleted file mode 100644 index 2c22511402..0000000000 --- a/tests/path_helper/web_root_path_test.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -class phpbb_path_helper_web_root_path_test extends phpbb_test_case -{ - protected $path_helper; - protected $phpbb_root_path = ''; - - public function setUp() - { - parent::setUp(); - - $this->set_phpbb_root_path(); - - $this->path_helper = new \phpbb\path_helper( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - new \phpbb\filesystem(), - $this->phpbb_root_path, - 'php' - ); - } - - /** - * Set the phpbb_root_path - * - * This is necessary because dataProvider functions are called - * before setUp or setUpBeforeClass; so we must set the path - * any time we wish to use it in one of these functions (and - * also in general for everything else) - */ - public function set_phpbb_root_path() - { - $this->phpbb_root_path = dirname(__FILE__) . './../../phpBB/'; - } - - public function test_get_web_root_path() - { - // Symfony Request = null, so always should return phpbb_root_path - $this->assertEquals($this->phpbb_root_path, $this->path_helper->get_web_root_path()); - } - - public function basic_update_web_root_path_data() - { - $this->set_phpbb_root_path(); - - return array( - array( - 'http://www.test.com/test.php', - 'http://www.test.com/test.php', - '/', - ), - array( - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . 'test.php', - ), - array( - 'test.php', - 'test.php', - ), - array( - $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', - ), - ); - } - - /** - * @dataProvider basic_update_web_root_path_data - */ - public function test_basic_update_web_root_path($input, $expected) - { - $this->assertEquals($expected, $this->path_helper->update_web_root_path($input, $symfony_request)); - } - - public function update_web_root_path_data() - { - $this->set_phpbb_root_path(); - - return array( - array( - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . 'test.php', - '/', - ), - array( - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', - '//', - ), - array( - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', - '//', - 'foo/bar.php', - 'bar.php', - ), - array( - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../../test.php', - '/foo/template', - '/phpbb3-fork/phpBB/app.php/foo/template', - '/phpbb3-fork/phpBB/app.php', - ), - array( - $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', - '/foo/template', - '/phpbb3-fork/phpBB/foo/template', - '/phpbb3-fork/phpBB/app.php', - ), - ); - } - - /** - * @dataProvider update_web_root_path_data - */ - public function test_update_web_root_path($input, $expected, $getPathInfo, $getRequestUri = null, $getScriptName = null) - { - $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( - new phpbb_mock_request(), - )); - $symfony_request->expects($this->any()) - ->method('getPathInfo') - ->will($this->returnValue($getPathInfo)); - $symfony_request->expects($this->any()) - ->method('getRequestUri') - ->will($this->returnValue($getRequestUri)); - $symfony_request->expects($this->any()) - ->method('getScriptName') - ->will($this->returnValue($getScriptName)); - - $path_helper = new \phpbb\path_helper( - $symfony_request, - new \phpbb\filesystem(), - $this->phpbb_root_path, - 'php' - ); - - $this->assertEquals($expected, $path_helper->update_web_root_path($input, $symfony_request)); - } - - public function clean_url_data() - { - return array( - array('', ''), - array('://', '://'), - array('http://', 'http://'), - array('http://one/two/three', 'http://one/two/three'), - array('http://../one/two', 'http://../one/two'), - array('http://one/../two/three', 'http://two/three'), - array('http://one/two/../three', 'http://one/three'), - array('http://one/two/../../three', 'http://three'), - array('http://one/two/../../../three', 'http://../three'), - ); - } - - /** - * @dataProvider clean_url_data - */ - public function test_clean_url($input, $expected) - { - $this->assertEquals($expected, $this->path_helper->clean_url($input)); - } -} diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php new file mode 100644 index 0000000000..3312f4d0a0 --- /dev/null +++ b/tests/plupload/plupload_test.php @@ -0,0 +1,57 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_plupload_test extends phpbb_test_case +{ + public function generate_resize_string_data() + { + return array( + array( + 0, + 0, + '', + ), + array( + 130, + 150, + 'resize: {width: 130, height: 150, quality: 100},' + ), + ); + } + + /** + * @dataProvider generate_resize_string_data + */ + public function test_generate_resize_string($config_width, $config_height, $expected) + { + global $phpbb_root_path, $phpEx; + + $lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + + $config = new \phpbb\config\config(array( + 'img_max_width' => $config_width, + 'img_max_height' => $config_height, + 'upload_path' => 'files', + )); + $plupload = new \phpbb\plupload\plupload( + '', + $config, + new phpbb_mock_request, + new \phpbb\user($lang, '\phpbb\datetime'), + new \bantu\IniGetWrapper\IniGetWrapper, + new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\extension_guesser)) + ); + + $this->assertEquals($expected, $plupload->generate_resize_string()); + } +} diff --git a/tests/privmsgs/delete_user_pms_test.php b/tests/privmsgs/delete_user_pms_test.php index 92ee7c5f2a..9d6ba7a917 100644 --- a/tests/privmsgs/delete_user_pms_test.php +++ b/tests/privmsgs/delete_user_pms_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -81,12 +85,14 @@ class phpbb_privmsgs_delete_user_pms_test extends phpbb_database_test_case */ public function test_delete_user_pms($delete_user, $remaining_privmsgs, $remaining_privmsgs_to) { - global $db, $phpbb_container; + global $db, $phpbb_container, $phpbb_root_path; $db = $this->new_dbal(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); + // Works as a workaround for tests + $phpbb_container->set('attachment.manager', new \phpbb\attachment\delete(new \phpbb\config\config(array()), $db, new \phpbb_mock_event_dispatcher(), new \phpbb\filesystem\filesystem(), new \phpbb\attachment\resync($db), $phpbb_root_path)); phpbb_delete_user_pms($delete_user); diff --git a/tests/profile/custom_test.php b/tests/profile/custom_test.php deleted file mode 100644 index e68f1f7c4b..0000000000 --- a/tests/profile/custom_test.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -class phpbb_profile_custom_test extends phpbb_database_test_case -{ - public function getDataSet() - { - return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/profile_fields.xml'); - } - - static public function dropdown_fields() - { - return array( - // note, there is an offset of 1 between option_id (0-indexed) - // in the database and values (1-indexed) to avoid problems with - // transmitting 0 in an HTML form - // required, value, expected - array(1, '0', 'FIELD_INVALID_VALUE-field', 'Required field should throw error for out-of-range value'), - array(1, '1', 'FIELD_REQUIRED-field', 'Required field should throw error for default value'), - array(1, '2', false, 'Required field should accept non-default value'), - array(0, '0', 'FIELD_INVALID_VALUE-field', 'Optional field should throw error for out-of-range value'), - array(0, '1', false, 'Optional field should accept default value'), - array(0, '2', false, 'Optional field should accept non-default value'), - ); - } - - /** - * @dataProvider dropdown_fields - */ - public function test_dropdown_validate($field_required, $field_value, $expected, $description) - { - global $db, $table_prefix; - $db = $this->new_dbal(); - - $field_data = array( - 'field_id' => 1, - 'lang_id' => 1, - 'lang_name' => 'field', - 'field_novalue' => 1, - 'field_required' => $field_required, - ); - $user = $this->getMock('\phpbb\user'); - $user->expects($this->any()) - ->method('lang') - ->will($this->returnCallback(array($this, 'return_callback_implode'))); - - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); - - $cp = new \phpbb\profilefields\type\type_dropdown( - new \phpbb\profilefields\lang_helper($db, $table_prefix . 'profile_fields_lang'), - $request, - $template, - $user - ); - $result = $cp->validate_profile_field($field_value, $field_data); - - $this->assertEquals($expected, $result, $description); - } - - public function return_callback_implode() - { - return implode('-', func_get_args()); - } -} diff --git a/tests/profile/fixtures/profile_fields.xml b/tests/profile/fixtures/profile_fields.xml deleted file mode 100644 index e0c260bbf5..0000000000 --- a/tests/profile/fixtures/profile_fields.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<dataset> - <table name="phpbb_profile_fields_lang"> - <column>field_id</column> - <column>lang_id</column> - <column>option_id</column> - <column>field_type</column> - <column>lang_value</column> - <row> - <value>1</value> - <value>1</value> - <value>0</value> - <value>profilefields.type.dropdown</value> - <value>Default Option</value> - </row> - <row> - <value>1</value> - <value>1</value> - <value>1</value> - <value>profilefields.type.dropdown</value> - <value>First Alternative</value> - </row> - <row> - <value>1</value> - <value>1</value> - <value>2</value> - <value>profilefields.type.dropdown</value> - <value>Third Alternative</value> - </row> - </table> -</dataset> diff --git a/tests/profile/get_profile_value_test.php b/tests/profile/get_profile_value_test.php deleted file mode 100644 index e867455a03..0000000000 --- a/tests/profile/get_profile_value_test.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -class phpbb_profile_get_profile_value_test extends phpbb_test_case -{ - static public function get_profile_value_int_data() - { - return array( - array('\phpbb\profilefields\type\type_int', '10', true, 10), - array('\phpbb\profilefields\type\type_int', '0', true, 0), - array('\phpbb\profilefields\type\type_int', '', true, 0), - array('\phpbb\profilefields\type\type_int', null, true, 0), - array('\phpbb\profilefields\type\type_int', '10', false, 10), - array('\phpbb\profilefields\type\type_int', '0', false, 0), - array('\phpbb\profilefields\type\type_int', '', false, null), - array('\phpbb\profilefields\type\type_int', null, false, null), - ); - } - - /** - * @dataProvider get_profile_value_int_data - */ - public function test_get_profile_value_int($type, $value, $show_novalue, $expected) - { - $cp = new $type( - $this->getMock('\phpbb\request\request'), - $this->getMock('\phpbb\template\template'), - $this->getMock('\phpbb\user') - ); - - $this->assertSame($expected, $cp->get_profile_value($value, array( - 'field_type' => $type, - 'field_show_novalue' => $show_novalue, - ))); - } -} diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php new file mode 100644 index 0000000000..10239172c3 --- /dev/null +++ b/tests/profilefields/type_bool_test.php @@ -0,0 +1,200 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_profilefield_type_bool_test extends phpbb_test_case +{ + protected $cp; + protected $field_options = array(); + protected $options = array(); + + /** + * Sets up basic test objects + * + * @access public + * @return void + */ + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $user->expects($this->any()) + ->method('lang') + ->will($this->returnCallback(array($this, 'return_callback_implode'))); + + $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null)); + + $lang->expects($this->any()) + ->method('get_options_lang'); + + $lang->expects($this->any()) + ->method('is_set') + ->will($this->returnCallback(array($this, 'is_set_callback'))); + + $lang->expects($this->any()) + ->method('get') + ->will($this->returnCallback(array($this, 'get'))); + + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $this->cp = new \phpbb\profilefields\type\type_bool( + $lang, + $request, + $template, + $user + ); + + $this->field_options = array( + 'field_type' => '\phpbb\profilefields\type\type_bool', + 'field_name' => 'field', + 'field_id' => 1, + 'lang_id' => 1, + 'lang_name' => 'field', + 'field_required' => false, + 'field_default_value' => 1, + 'field_length' => 1, + ); + + $this->options = array( + 0 => 'Yes', + 1 => 'No', + ); + } + + public function validate_profile_field_data() + { + return array( + array( + false, + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should not accept empty values for required fields', + ), + ); + } + + /** + * @dataProvider validate_profile_field_data + */ + public function test_validate_profile_field($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->validate_profile_field($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_data() + { + return array( + array( + false, + array('field_show_novalue' => true), + 'No', + 'Field should output the default value', + ), + array( + false, + array('field_show_novalue' => false, 'field_length' => 2), + null, + 'Field should not show anything for empty value', + ), + array( + 0, + array(), + 'Yes', + 'Field should show the set value', + ), + ); + } + + /** + * @dataProvider profile_value_data + */ + public function test_get_profile_value($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_raw_data() + { + return array( + array( + '4', + array('field_show_novalue' => true), + '4', + 'Field should return the correct raw value', + ), + array( + '', + array('field_show_novalue' => false), + null, + 'Field should return correct raw value', + ), + array( + '', + array('field_show_novalue' => true), + null, + 'Field should return correct raw value', + ), + array( + null, + array('field_show_novalue' => false), + null, + 'Field should return correct raw value', + ), + array( + null, + array('field_show_novalue' => true), + null, + 'Field should return correct raw value', + ), + ); + } + + /** + * @dataProvider profile_value_raw_data + */ + public function test_get_profile_value_raw($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value_raw($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function is_set_callback($field_id, $lang_id, $field_value) + { + return isset($this->options[$field_value]); + } + + public function get($field_id, $lang_id, $field_value) + { + return $this->options[$field_value]; + } + + public function return_callback_implode() + { + return implode('-', func_get_args()); + } +} diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php new file mode 100644 index 0000000000..e0807b2f9b --- /dev/null +++ b/tests/profilefields/type_date_test.php @@ -0,0 +1,233 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_profilefield_type_date_test extends phpbb_test_case +{ + protected $cp; + protected $field_options; + protected $user; + + /** + * Sets up basic test objects + * + * @access public + * @return null + */ + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $this->user->expects($this->any()) + ->method('lang') + ->will($this->returnCallback(array($this, 'return_callback_implode'))); + + $this->user->expects($this->any()) + ->method('create_datetime') + ->will($this->returnCallback(array($this, 'create_datetime_callback'))); + + $this->user->timezone = new DateTimeZone('UTC'); + $this->user->lang = array( + 'datetime' => array(), + 'DATE_FORMAT' => 'm/d/Y', + ); + + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $this->cp = new \phpbb\profilefields\type\type_date( + $request, + $template, + $this->user + ); + + $this->field_options = array( + 'field_type' => '\phpbb\profilefields\type\type_date', + 'field_name' => 'field', + 'field_id' => 1, + 'lang_id' => 1, + 'lang_name' => 'field', + 'field_required' => false, + ); + } + + public function profile_value_data() + { + return array( + array( + '01-01-2009', + array('field_show_novalue' => true), + '01/01/2009', + 'Field should output the correctly formatted date', + ), + array( + null, + array('field_show_novalue' => false), + null, + 'Field should leave empty value as is', + ), + array( + 'None', + array('field_show_novalue' => true), + 'None', + 'Field should leave invalid value as is', + ), + ); + } + + /** + * @dataProvider profile_value_data + */ + public function test_get_profile_value($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function validate_profile_field_data() + { + return array( + array( + '', + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should reject value for being empty', + ), + array( + '0125', + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should reject value for being invalid', + ), + array( + '01-01-2012', + array(), + false, + 'Field should accept a valid value', + ), + array( + '40-05-2009', + array(), + 'FIELD_INVALID_DATE-field', + 'Field should reject value for being invalid', + ), + array( + '12-30-2012', + array(), + 'FIELD_INVALID_DATE-field', + 'Field should reject value for being invalid', + ), + array( + 'string', + array(), + false, + 'Field should reject value for being invalid', + ), + array( + 'string', + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should reject value for being invalid', + ), + array( + 100, + array(), + false, + 'Field should reject value for being invalid', + ), + array( + 100, + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should reject value for being invalid', + ), + array( + null, + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should reject value for being empty', + ), + array( + true, + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should reject value for being empty', + ), + ); + } + + /** + * @dataProvider validate_profile_field_data + */ + public function test_validate_profile_field($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->validate_profile_field($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_raw_data() + { + return array( + array( + '', + array('field_show_novalue' => false), + null, + 'Field should return the correct raw value', + ), + array( + '', + array('field_show_novalue' => true), + '', + 'Field should return correct raw value', + ), + array( + '12/06/2014', + array('field_show_novalue' => true), + '12/06/2014', + 'Field should return correct raw value', + ), + ); + } + + /** + * @dataProvider profile_value_raw_data + */ + public function test_get_profile_value_raw($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value_raw($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function return_callback_implode() + { + return implode('-', func_get_args()); + } + + public function create_datetime_callback($time = 'now', \DateTimeZone $timezone = null) + { + $timezone = $timezone ?: $this->user->timezone; + return new \phpbb\datetime($this->user, $time, $timezone); + } +} diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php new file mode 100644 index 0000000000..ab02353fb9 --- /dev/null +++ b/tests/profilefields/type_dropdown_test.php @@ -0,0 +1,240 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_profilefield_type_dropdown_test extends phpbb_test_case +{ + protected $cp; + protected $field_options = array(); + protected $dropdown_options = array(); + + /** + * Sets up basic test objects + * + * @access public + * @return null + */ + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $user->expects($this->any()) + ->method('lang') + ->will($this->returnCallback(array($this, 'return_callback_implode'))); + + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null)); + + $lang->expects($this->any()) + ->method('get_options_lang'); + + $lang->expects($this->any()) + ->method('is_set') + ->will($this->returnCallback(array($this, 'is_set_callback'))); + + $lang->expects($this->any()) + ->method('get') + ->will($this->returnCallback(array($this, 'get'))); + + $this->cp = new \phpbb\profilefields\type\type_dropdown( + $lang, + $request, + $template, + $user + ); + + $this->field_options = array( + 'field_type' => '\phpbb\profilefields\type\type_dropdown', + 'field_name' => 'field', + 'field_id' => 1, + 'lang_id' => 1, + 'lang_name' => 'field', + 'field_required' => false, + 'field_validation' => '.*', + 'field_novalue' => 0, + ); + + $this->dropdown_options = array( + 0 => '<No Value>', + 1 => 'Option 1', + 2 => 'Option 2', + 3 => 'Option 3', + 4 => 'Option 4', + ); + } + + public function validate_profile_field_data() + { + return array( + array( + 7, + array(), + 'FIELD_INVALID_VALUE-field', + 'Invalid value should throw error', + ), + array( + true, + array('field_required' => true), + false, + 'Boolean would evaluate to 1 and hence correct value', + ), + array( + 'string', + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'String should be rejected for value', + ), + array( + 2, + array(), + false, + 'Valid value should not throw error' + ), + array( + 0, + array(), + false, + 'Empty value should be acceptible', + ), + array( + 0, + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Required field should not accept empty value', + ), + ); + } + + /** + * @dataProvider validate_profile_field_data + */ + public function test_validate_profile_field($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->validate_profile_field($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_data() + { + return array( + array( + 1, + array('field_show_novalue' => true), + 'Option 1', + 'Field should output the given value', + ), + array( + 4, + array('field_show_novalue' => false), + 'Option 4', + 'Field should output the given value', + ), + array( + '', + array('field_show_novalue' => true), + '<No Value>', + 'Field should output nothing for empty value', + ), + array( + '', + array('field_show_novalue' => false), + null, + 'Field should simply output null for empty value', + ), + ); + } + + + /** + * @dataProvider profile_value_data + */ + public function test_get_profile_value($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_raw_data() + { + return array( + array( + '4', + array('field_show_novalue' => true), + '4', + 'Field should return the correct raw value', + ), + array( + '', + array('field_show_novalue' => false), + null, + 'Field should null for empty value without show_novalue', + ), + array( + '', + array('field_show_novalue' => true), + 0, + 'Field should return 0 for empty value with show_novalue', + ), + array( + null, + array('field_show_novalue' => false), + null, + 'Field should return correct raw value', + ), + array( + null, + array('field_show_novalue' => true), + 0, + 'Field should return 0 for empty value with show_novalue', + ), + ); + } + + /** + * @dataProvider profile_value_raw_data + */ + public function test_get_profile_value_raw($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value_raw($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function is_set_callback($field_id, $lang_id, $field_value) + { + return isset($this->dropdown_options[$field_value]); + } + + public function get($field_id, $lang_id, $field_value) + { + return $this->dropdown_options[$field_value]; + } + + public function return_callback_implode() + { + return implode('-', func_get_args()); + } +} diff --git a/tests/profilefields/type_googleplus_test.php b/tests/profilefields/type_googleplus_test.php new file mode 100644 index 0000000000..6faf939231 --- /dev/null +++ b/tests/profilefields/type_googleplus_test.php @@ -0,0 +1,98 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_profilefield_type_googleplus_test extends phpbb_test_case +{ + protected $field; + + public function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->add_lang('ucp'); + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $this->field = new \phpbb\profilefields\type\type_googleplus( + $request, + $template, + $user + ); + } + public function get_profile_contact_value_data() + { + return array( + array( + '112010191010100', + array(), + '112010191010100', + 'Field should return a numerical Google+ ID as is', + ), + array( + 'TestUsername', + array(), + '+TestUsername', + 'Field should return a string Google+ ID with a + prefixed', + ), + ); + } + + /** + * @dataProvider get_profile_contact_value_data + */ + public function test_get_profile_contact_value($value, $field_options, $expected, $description) + { + $default_field_options = array( + 'field_type' => '\phpbb\profilefields\type\type_googleplus', + 'field_name' => 'field', + 'field_id' => 1, + 'lang_id' => 1, + 'lang_name' => 'field', + 'field_required' => false, + 'field_validation' => '[\w]+', + ); + $field_options = array_merge($default_field_options, $field_options); + + $this->assertSame($expected, $this->field->get_profile_contact_value($value, $field_options), $description); + } + + public function data_validate_googleplus() + { + return array( + array('foobar', false), + array('2342340929304', false), + array('foo<bar', 'The field “googleplus†has invalid characters.'), + array('klkd.klkl', false), + array('kl+', 'The field “googleplus†has invalid characters.'), + array('foo=bar', 'The field “googleplus†has invalid characters.'), + array('..foo', 'The field “googleplus†has invalid characters.'), + array('foo..bar', 'The field “googleplus†has invalid characters.'), + ); + } + + /** + * @dataProvider data_validate_googleplus + */ + public function test_validate_googleplus($input, $expected) + { + $field_data = array_merge(array('lang_name' => 'googleplus'), $this->field->get_default_option_values()); + $this->assertSame($expected, $this->field->validate_string_profile_field('string', $input, $field_data)); + } +} diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php new file mode 100644 index 0000000000..33f3f575c8 --- /dev/null +++ b/tests/profilefields/type_int_test.php @@ -0,0 +1,241 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_profilefield_type_int_test extends phpbb_test_case +{ + protected $cp; + protected $field_options; + + /** + * Sets up basic test objects + * + * @access public + * @return null + */ + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $user->expects($this->any()) + ->method('lang') + ->will($this->returnCallback(array($this, 'return_callback_implode'))); + + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $this->cp = new \phpbb\profilefields\type\type_int( + $request, + $template, + $user + ); + + $this->field_options = array( + 'field_type' => '\phpbb\profilefields\type\type_int', + 'field_name' => 'field', + 'field_id' => 1, + 'lang_id' => 1, + 'lang_name' => 'field', + 'field_required' => false, + ); + } + + public function profile_value_data() + { + return array( + array( + '10', + array('field_show_novalue' => true), + 10, + 'Field should output integer value of given input', + ), + array( + '0', + array('field_show_novalue' => true), + 0, + 'Field should output integer value of given input', + ), + array( + '', + array('field_show_novalue' => true), + 0, + 'Field should translate empty value to 0 as integer', + false, + ), + array( + null, + array('field_show_novalue' => true), + 0, + 'Field should translate null value to 0 as integer', + ), + array( + '10', + array('field_show_novalue' => false), + 10, + 'Field should output integer value of given input', + ), + array( + '0', + array('field_show_novalue' => false), + 0, + 'Field should output integer value of given input', + ), + array( + '', + array('field_show_novalue' => false), + null, + 'Field should leave empty value as is', + ), + array( + null, + array('field_show_novalue' => false), + null, + 'Field should leave empty value as is', + ), + ); + } + + /** + * @dataProvider profile_value_data + */ + public function test_get_profile_value($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function validate_profile_field_data() + { + return array( + array( + '15', + array('field_minlen' => 10, 'field_maxlen' => 20, 'field_required' => true), + false, + 'Field should accept input of correct boundaries', + ), + array( + '556476', + array('field_maxlen' => 50000, 'field_required' => true), + 'FIELD_TOO_LARGE-50000-field', + 'Field should reject value of greater value than max', + ), + array( + '9', + array('field_minlen' => 10, 'field_required' => true), + 'FIELD_TOO_SMALL-10-field', + 'Field should reject value which is less than defined minimum', + ), + array( + true, + array('field_maxlen' => 20), + false, + 'Field should accept correct boolean value', + ), + array( + 'string', + array('field_maxlen' => 10, 'field_required' => true), + false, + 'Field should accept correct string value', + ), + array( + null, + array('field_minlen' => 1, 'field_maxlen' => 10, 'field_required' => true), + 'FIELD_TOO_SMALL-1-field', + 'Field should not accept an empty value', + ), + ); + } + + /** + * @dataProvider validate_profile_field_data + */ + public function test_validate_profile_field($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->validate_profile_field($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_raw_data() + { + return array( + array( + '10', + array('field_show_novalue' => true), + 10, + 'Field should return the correct raw value', + ), + array( + '0', + array('field_show_novalue' => true), + 0, + 'Field should return correct raw value', + ), + array( + '', + array('field_show_novalue' => true), + 0, + 'Field should return correct raw value', + ), + array( + '10', + array('field_show_novalue' => false), + 10, + 'Field should return the correct raw value', + ), + array( + '0', + array('field_show_novalue' => false), + 0, + 'Field should return correct raw value', + ), + array( + '', + array('field_show_novalue' => false), + null, + 'Field should return correct raw value', + ), + array( + 'string', + array('field_show_novalue' => false), + 0, + 'Field should return int cast of passed string' + ), + ); + } + + /** + * @dataProvider profile_value_raw_data + */ + public function test_get_profile_value_raw($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value_raw($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function return_callback_implode() + { + return implode('-', func_get_args()); + } +} diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php new file mode 100644 index 0000000000..447ab32a00 --- /dev/null +++ b/tests/profilefields/type_string_test.php @@ -0,0 +1,356 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_profilefield_type_string_test extends phpbb_test_case +{ + protected $cp; + protected $field_options; + + /** + * Sets up basic test objects + * + * @access public + * @return null + */ + public function setUp() + { + global $request, $user, $cache, $phpbb_root_path, $phpEx; + + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $cache = new phpbb_mock_cache; + $user->expects($this->any()) + ->method('lang') + ->will($this->returnCallback(array($this, 'return_callback_implode'))); + + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $this->cp = new \phpbb\profilefields\type\type_string( + $request, + $template, + $user + ); + + $this->field_options = array( + 'field_type' => '\phpbb\profilefields\type\type_string', + 'field_name' => 'field', + 'field_id' => 1, + 'lang_id' => 1, + 'lang_name' => 'field', + 'field_required' => false, + 'field_validation' => '.*', + ); + } + + public function validate_profile_field_data() + { + return array( + array( + '', + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should not accept empty values for required fields', + ), + array( + null, + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should not accept empty values for required field', + ), + array( + 0, + array('field_required' => true), + false, + 'Field should accept a non-empty input', + ), + array( + 'false', + array('field_required' => true), + false, + 'Field should accept a non-empty input', + ), + array( + 10, + array('field_required' => true), + false, + 'Field should accept a non-empty input', + ), + array( + 'tas', + array('field_minlen' => 2, 'field_maxlen' => 5), + false, + 'Field should accept value of correct length', + ), + array( + 't', + array('field_minlen' => 2, 'field_maxlen' => 5), + 'FIELD_TOO_SHORT-2-field', + 'Field should reject value of incorrect length', + ), + array( + 'this is a long string', + array('field_minlen' => 2, 'field_maxlen' => 5), + 'FIELD_TOO_LONG-5-field', + 'Field should reject value of incorrect length', + ), + array( + 'H3110', + array('field_validation' => '[0-9]+'), + 'FIELD_INVALID_CHARS_NUMBERS_ONLY-field', + 'Required field should reject characters in a numbers-only field', + ), + array( + '<>"&%&><>', + array('field_maxlen' => 10, 'field_minlen' => 2), + false, + 'Optional field should accept html entities', + ), + array( + 'ö ä ü ß', + array(), + false, + 'Required field should accept UTF-8 string', + ), + array( + 'This ö ä string has to b', + array('field_maxlen' => 10), + 'FIELD_TOO_LONG-10-field', + 'Required field should reject an UTF-8 string which is too long', + ), + array( + 'ö äö äö ä', + array('field_validation' => '[a-zA-Z0-9]+'), + 'FIELD_INVALID_CHARS_ALPHA_ONLY-field', + 'Required field should reject UTF-8 in alpha only field', + ), + array( + 'a_abc', + array('field_validation' => '[a-zA-Z0-9]+'), + 'FIELD_INVALID_CHARS_ALPHA_ONLY-field', + 'Required field should reject underscore in alpha only field', + ), + array( + 'Hello', + array('field_validation' => '[a-zA-Z0-9]+'), + false, + 'Required field should accept a characters only field', + ), + array( + 'Valid.Username123', + array('field_validation' => '[a-zA-Z0-9.]+'), + false, + 'Required field should accept a alphanumeric field with dots', + ), + array( + 'Invalid.,username123', + array('field_validation' => '[a-zA-Z0-9.]+'), + 'FIELD_INVALID_CHARS_ALPHA_DOTS-field', + 'Required field should reject field with comma', + ), + array( + 'Invalid._username123', + array('field_validation' => '[a-zA-Z0-9.]+'), + 'FIELD_INVALID_CHARS_ALPHA_DOTS-field', + 'Required field should reject field with underscore', + ), + array( + 'skype.test.name,_this', + array('field_validation' => '[a-zA-Z][\w\.,\-]+'), + false, + 'Required field should accept alphanumeric field with punctuations', + ), + array( + '1skype.this.should.faila', + array('field_validation' => '[a-zA-Z][\w\.,\-]+'), + 'FIELD_INVALID_CHARS_ALPHA_PUNCTUATION-field', + 'Required field should reject field having invalid input for the given validation', + ), + // UTF-8 string tests + array( + 'ö äö äö ä', + array('field_validation' => '[\p{Lu}\p{Ll}0-9]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_ONLY-field', + 'Required field should reject spaces in UTF-8 letternumeric only field', + ), + array( + 'ИмÑ123', + array('field_validation' => '[\p{Lu}\p{Ll}0-9]+'), + false, + 'Required field should accept UTF-8 letternumeric only field', + ), + array( + 'Ö äö äö- ä+', + array('field_validation' => '[\p{Lu}\p{Ll}0-9_]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_UNDERSCORE-field', + 'Required field should reject spacers in UTF-8 letternumeric with underscore field', + ), + array( + 'Правильное.ИмÑ123', + array('field_validation' => '[\p{Lu}\p{Ll}0-9.]+'), + false, + 'Required field should accept UTF-8 letternumeric field with dots', + ), + array( + 'Ðеправильное.,имÑ123', + array('field_validation' => '[\p{Lu}\p{Ll}0-9.]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_DOTS-field', + 'Required field should reject comma in UTF-8 letternumeric field with dots', + ), + array( + 'Ö äö äö- ä+', + array('field_validation' => '[\p{Lu}\p{Ll}0-9\x20_+\-\[\]]+'), + false, + 'Required field should accept spacers in UTF-8 letternumeric with spacers field', + ), + array( + 'skype.test.name,_this', + array('field_validation' => '[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_]+'), + false, + 'Required field should accept alphanumeric value for UTF-8 letternumeric field with punctuations', + ), + array( + '1skype.this.should.fail', + array('field_validation' => '[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_PUNCTUATION-field', + 'Required field should reject field having leading numeric for UTF-8 letternumeric field with punctuations', + ), + ); + } + + /** + * @dataProvider validate_profile_field_data + */ + public function test_validate_profile_field($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->validate_profile_field($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_data() + { + return array( + array( + 'test', + array('field_show_novalue' => true), + 'test', + 'Field should output the given value', + ), + array( + 'test', + array('field_show_novalue' => false), + 'test', + 'Field should output the given value', + ), + array( + '', + array('field_show_novalue' => true), + '', + 'Field should output nothing for empty value', + ), + array( + '', + array('field_show_novalue' => false), + null, + 'Field should simply output null for empty vlaue', + ), + ); + } + + + /** + * @dataProvider profile_value_data + */ + public function test_get_profile_value($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_raw_data() + { + return array( + array( + '[b]bbcode test[/b]', + array('field_show_novalue' => true), + '[b]bbcode test[/b]', + 'Field should return the correct raw value', + ), + array( + '[b]bbcode test[/b]', + array('field_show_novalue' => false), + '[b]bbcode test[/b]', + 'Field should return correct raw value', + ), + array( + 125, + array('field_show_novalue' => false), + 125, + 'Field should return value of integer as is', + ), + array( + 0, + array('field_show_novalue' => false), + 0, + 'Field should return value of integer 0 without show_novalue', + ), + array( + '0', + array('field_show_novalue' => false), + '0', + 'Field should return string 0', + ), + array( + 0, + array('field_show_novalue' => true), + 0, + 'Field should return 0 for empty integer with show_novalue', + ), + array( + null, + array('field_show_novalue' => true), + null, + 'field should return null value as is', + ), + ); + } + + /** + * @dataProvider profile_value_raw_data + */ + public function test_get_profile_value_raw($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value_raw($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function return_callback_implode() + { + return implode('-', func_get_args()); + } +} diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php new file mode 100644 index 0000000000..a0f93fe1f6 --- /dev/null +++ b/tests/profilefields/type_url_test.php @@ -0,0 +1,186 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_profilefield_type_url_test extends phpbb_test_case +{ + protected $cp; + protected $field_options; + + /** + * Sets up basic test objects + * + * @access public + * @return null + */ + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); + $user->expects($this->any()) + ->method('lang') + ->will($this->returnCallback(array($this, 'return_callback_implode'))); + + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $this->cp = new \phpbb\profilefields\type\type_url( + $request, + $template, + $user + ); + + $this->field_options = array( + 'field_type' => '\phpbb\profilefields\type\type_url', + 'field_name' => 'field', + 'field_id' => 1, + 'lang_id' => 1, + 'lang_name' => 'field', + 'field_required' => false, + ); + } + + public function validate_profile_field_data() + { + return array( + array( + '', + array('field_required' => true), + 'FIELD_INVALID_URL-field', + 'Field should reject empty field that is required', + ), + array( + 'invalidURL', + array(), + 'FIELD_INVALID_URL-field', + 'Field should reject invalid input', + ), + array( + 'http://onetwothree.example.io', + array(), + false, + 'Field should accept valid URL', + ), + array( + 'http://example.com/index.html?param1=test¶m2=awesome', + array(), + false, + 'Field should accept valid URL', + ), + array( + 'http://example.com/index.html/test/path?document=get', + array(), + false, + 'Field should accept valid URL', + ), + array( + 'http://example.com/index.html/test/path?document[]=DocType%20test&document[]=AnotherDoc', + array(), + 'FIELD_INVALID_URL-field', + 'Field should reject invalid URL having multi value parameters', + ), + + // IDN url type profilefields + array( + 'http://www.täst.de', + array(), + false, + 'Field should accept valid IDN', + ), + array( + 'http://täst.de/index.html?param1=test¶m2=awesome', + array(), + false, + 'Field should accept valid IDN URL with params', + ), + array( + 'http://домен.рф/index.html/теÑÑ‚/path?document=get', + array(), + false, + 'Field should accept valid IDN URL', + ), + array( + 'http://домен.рф/index.html/теÑÑ‚/path?document[]=DocType%20test&document[]=AnotherDoc', + array(), + 'FIELD_INVALID_URL-field', + 'Field should reject invalid IDN URL having multi value parameters', + ), + ); + } + + /** + * @dataProvider validate_profile_field_data + */ + public function test_validate_profile_field($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->validate_profile_field($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function profile_value_raw_data() + { + return array( + array( + 'http://example.com', + array('field_show_novalue' => true), + 'http://example.com', + 'Field should return the correct raw value', + ), + array( + 'http://example.com', + array('field_show_novalue' => false), + 'http://example.com', + 'Field should return correct raw value', + ), + + // IDN tests + array( + 'http://täst.de', + array('field_show_novalue' => true), + 'http://täst.de', + 'Field should return the correct raw value', + ), + array( + 'http://домен.рф', + array('field_show_novalue' => false), + 'http://домен.рф', + 'Field should return correct raw value', + ), + ); + } + + /** + * @dataProvider profile_value_raw_data + */ + public function test_get_profile_value_raw($value, $field_options, $expected, $description) + { + $field_options = array_merge($this->field_options, $field_options); + + $result = $this->cp->get_profile_value_raw($value, $field_options); + + $this->assertSame($expected, $result, $description); + } + + public function return_callback_implode() + { + return implode('-', func_get_args()); + } +} diff --git a/tests/random/gen_rand_string_test.php b/tests/random/gen_rand_string_test.php index 3317c78ed9..1d12d0622c 100644 --- a/tests/random/gen_rand_string_test.php +++ b/tests/random/gen_rand_string_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/regex/censor_test.php b/tests/regex/censor_test.php index 5929092e07..5625b0020b 100644 --- a/tests/regex/censor_test.php +++ b/tests/regex/censor_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -33,17 +37,7 @@ class phpbb_regex_censor_test extends phpbb_test_case */ public function test_censor_unicode($pattern, $subject) { - $regex = get_censor_preg_expression($pattern, true); - - $this->assertRegExp($regex, $subject); - } - - /** - * @dataProvider censor_test_data - */ - public function test_censor_no_unicode($pattern, $subject) - { - $regex = get_censor_preg_expression($pattern, false); + $regex = get_censor_preg_expression($pattern); $this->assertRegExp($regex, $subject); } diff --git a/tests/regex/email_test.php b/tests/regex/email_test.php index b4ea5b23aa..ede35c49bc 100644 --- a/tests/regex/email_test.php +++ b/tests/regex/email_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/regex/ipv4_test.php b/tests/regex/ipv4_test.php index 38a3aa4a8e..62c2567517 100644 --- a/tests/regex/ipv4_test.php +++ b/tests/regex/ipv4_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/regex/ipv6_test.php b/tests/regex/ipv6_test.php index d24217b346..41039c819d 100644 --- a/tests/regex/ipv6_test.php +++ b/tests/regex/ipv6_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/regex/password_complexity_test.php b/tests/regex/password_complexity_test.php index e2aefdaac8..8a1a9edd41 100644 --- a/tests/regex/password_complexity_test.php +++ b/tests/regex/password_complexity_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/regex/table_prefix_test.php b/tests/regex/table_prefix_test.php index 33bdd4ae2d..c593085b25 100644 --- a/tests/regex/table_prefix_test.php +++ b/tests/regex/table_prefix_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/regex/url_test.php b/tests/regex/url_test.php index b395f5cae2..e5d7c3256a 100644 --- a/tests/regex/url_test.php +++ b/tests/regex/url_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -28,6 +32,6 @@ class phpbb_regex_url_test extends phpbb_test_case */ public function test_url($url, $expected) { - $this->assertEquals($expected, preg_match('#^' . get_preg_expression('url') . '$#i', $url)); + $this->assertEquals($expected, preg_match('#^' . get_preg_expression('url') . '$#iu', $url)); } } diff --git a/tests/request/deactivated_super_global_test.php b/tests/request/deactivated_super_global_test.php index d28bd87eec..d45f9ca666 100644 --- a/tests/request/deactivated_super_global_test.php +++ b/tests/request/deactivated_super_global_test.php @@ -1,10 +1,13 @@ <?php /** * -* @package testing -* @version $Id$ -* @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/request/request_test.php b/tests/request/request_test.php index a25792e051..131abe6aac 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -1,10 +1,13 @@ <?php /** * -* @package testing -* @version $Id$ -* @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php index d126fe1e8b..b409e5ef25 100644 --- a/tests/request/request_var_test.php +++ b/tests/request/request_var_test.php @@ -1,13 +1,17 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_compatibility.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_request_var_test extends phpbb_test_case diff --git a/tests/request/type_cast_helper_test.php b/tests/request/type_cast_helper_test.php index 98f4538c08..d6ee1dc728 100644 --- a/tests/request/type_cast_helper_test.php +++ b/tests/request/type_cast_helper_test.php @@ -1,10 +1,13 @@ <?php /** * -* @package testing -* @version $Id$ -* @copyright (c) 2009 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/search/common_test_case.php b/tests/search/common_test_case.php index 029637b00b..0bb4549832 100644 --- a/tests/search/common_test_case.php +++ b/tests/search/common_test_case.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/search/fixtures/posts.xml b/tests/search/fixtures/posts.xml index 7b249ee303..16232b8f39 100644 --- a/tests/search/fixtures/posts.xml +++ b/tests/search/fixtures/posts.xml @@ -19,6 +19,11 @@ <value>commonword</value> <value>commonword</value> </row> + <row> + <value>baaz</value> + <value>baaz</value> + <value>baaz</value> + </row> </table> <table name="phpbb_search_wordlist"> <column>word_id</column> @@ -39,5 +44,10 @@ <value>commonword</value> <value>1</value> </row> + <row> + <value>4</value> + <value>baaz</value> + <value>0</value> + </row> </table> </dataset> diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php index c08484c78d..3a791f5e81 100644 --- a/tests/search/mysql_test.php +++ b/tests/search/mysql_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -33,8 +37,9 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case $config['fulltext_mysql_max_word_len'] = 254; $this->db = $this->new_dbal(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $error = null; $class = self::get_search_wrapper('\phpbb\search\fulltext_mysql'); - $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user); + $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_dispatcher); } } diff --git a/tests/search/native_test.php b/tests/search/native_test.php index 18c6df2445..29d0d0a8d3 100644 --- a/tests/search/native_test.php +++ b/tests/search/native_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -29,9 +33,12 @@ class phpbb_search_native_test extends phpbb_search_test_case $cache = new phpbb_mock_cache(); $this->db = $this->new_dbal(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $error = null; $class = self::get_search_wrapper('\phpbb\search\fulltext_native'); - $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user); + $config['fulltext_native_min_chars'] = 2; + $config['fulltext_native_max_chars'] = 14; + $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_dispatcher); } public function keywords() @@ -52,6 +59,54 @@ class phpbb_search_native_test extends phpbb_search_test_case array(), ), array( + 'baaz*', + 'all', + true, + array('\'baaz%\''), + array(), + array(), + ), + array( + 'ba*az', + 'all', + true, + array('\'ba%az\''), + array(), + array(), + ), + array( + 'ba*z', + 'all', + true, + array('\'ba%z\''), + array(), + array(), + ), + array( + 'baa* baaz*', + 'all', + true, + array('\'baa%\'', '\'baaz%\''), + array(), + array(), + ), + array( + 'ba*z baa*', + 'all', + true, + array('\'ba%z\'', '\'baa%\''), + array(), + array(), + ), + array( + 'baaz* commonword', + 'all', + true, + array('\'baaz%\''), + array(), + array('commonword'), + ), + array( 'foo bar', 'all', true, @@ -106,17 +161,66 @@ class phpbb_search_native_test extends phpbb_search_test_case array( '-foo', 'all', - false, - null, - null, + true, + array(), + array(1), array(), ), array( '-foo -bar', 'all', - false, - null, - null, + true, + array(), + array(1, 2), + array(), + ), + array( + 'foo -foo', + 'all', + true, + array(1), + array(1), + array(), + ), + array( + '-foo foo', + 'all', + true, + array(1), + array(1), + array(), + ), + // some creative edge cases + array( + 'foo foo-', + 'all', + true, + array(1), + array(), + array(), + ), + array( + 'foo- foo', + 'all', + true, + array(1), + array(), + array(), + ), + array( + 'foo-bar', + 'all', + true, + array(1, 2), + array(), + array(), + ), + array( + 'foo-bar-foo', + 'all', + true, + array(1, 2), + array(), array(), ), // all common diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php index a59f5abc7d..97cca0e70c 100644 --- a/tests/search/postgres_test.php +++ b/tests/search/postgres_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -33,8 +37,9 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case $config['fulltext_postgres_max_word_len'] = 254; $this->db = $this->new_dbal(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $error = null; $class = self::get_search_wrapper('\phpbb\search\fulltext_postgres'); - $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user); + $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_dispatcher); } } diff --git a/tests/security/base.php b/tests/security/base.php index 3ab2d1cfec..d2abdbc362 100644 --- a/tests/security/base.php +++ b/tests/security/base.php @@ -1,14 +1,20 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ abstract class phpbb_security_test_base extends phpbb_test_case { + protected $server = array(); + /** * Set up the required user object and server variables for the suites */ @@ -17,17 +23,18 @@ abstract class phpbb_security_test_base extends phpbb_test_case global $user, $phpbb_root_path, $phpEx, $request, $symfony_request, $phpbb_filesystem; // Put this into a global function being run by every test to init a proper user session - $server['HTTP_HOST'] = 'localhost'; - $server['SERVER_NAME'] = 'localhost'; - $server['SERVER_ADDR'] = '127.0.0.1'; - $server['SERVER_PORT'] = 80; - $server['REMOTE_ADDR'] = '127.0.0.1'; - $server['QUERY_STRING'] = ''; - $server['REQUEST_URI'] = '/tests/'; - $server['SCRIPT_NAME'] = '/tests/index.php'; - $server['PHP_SELF'] = '/tests/index.php'; - $server['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'; - $server['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3'; + $this->server['HTTP_HOST'] = 'localhost'; + $this->server['SERVER_NAME'] = 'localhost'; + $this->server['SERVER_ADDR'] = '127.0.0.1'; + $this->server['SERVER_PORT'] = 80; + $this->server['REMOTE_ADDR'] = '127.0.0.1'; + $this->server['QUERY_STRING'] = ''; + $this->server['REQUEST_URI'] = '/tests/'; + $this->server['SCRIPT_NAME'] = '/tests/index.php'; + $this->server['SCRIPT_FILENAME'] = '/var/www/tests/index.php'; + $this->server['PHP_SELF'] = '/tests/index.php'; + $this->server['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'; + $this->server['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3'; /* [HTTP_ACCEPT_ENCODING] => gzip,deflate @@ -36,31 +43,20 @@ abstract class phpbb_security_test_base extends phpbb_test_case [SCRIPT_FILENAME] => /var/www/tests/index.php */ - $request = new phpbb_mock_request(array(), array(), array(), $server); - $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( - $request, - )); - $symfony_request->expects($this->any()) - ->method('getScriptName') - ->will($this->returnValue($server['SCRIPT_NAME'])); - $symfony_request->expects($this->any()) - ->method('getQueryString') - ->will($this->returnValue($server['QUERY_STRING'])); - $symfony_request->expects($this->any()) - ->method('getBasePath') - ->will($this->returnValue($server['REQUEST_URI'])); - $symfony_request->expects($this->any()) - ->method('getPathInfo') - ->will($this->returnValue('/')); - $phpbb_filesystem = new \phpbb\filesystem($symfony_request, $phpbb_root_path, $phpEx); + $request = new phpbb_mock_request(array(), array(), array(), $this->server); + $symfony_request = new \phpbb\symfony_request($request); + + $phpbb_filesystem = new \phpbb\filesystem\filesystem(); // Set no user and trick a bit to circumvent errors - $user = new \phpbb\user(); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->lang = true; - $user->browser = $server['HTTP_USER_AGENT']; + $user->browser = $this->server['HTTP_USER_AGENT']; $user->referer = ''; $user->forwarded_for = ''; - $user->host = $server['HTTP_HOST']; + $user->host = $this->server['HTTP_HOST']; $user->page = \phpbb\session::extract_current_page($phpbb_root_path); } diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index 1284aab94c..767b901a43 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -16,33 +20,25 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base public function security_variables() { return array( - array('http://localhost/phpBB/index.php', 'mark=forums&x="><script>alert(/XSS/);</script>', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'), - array('http://localhost/phpBB/index.php', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'), + array('mark=forums&x="><script>alert(/XSS/);</script>', 'mark=forums&x=%22%3E%3Cscript%3Ealert%28%2FXSS%2F%29%3B%3C%2Fscript%3E'), + array('mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E', 'mark=forums&x=%22%3E%3Cscript%3Ealert%28%2FXSS%2F%29%3B%3C%2Fscript%3E'), + array('mark=forums&x=%22%3E%3Cscript%3Ealert%28%2FXSS%2F%29%3B%3C%2Fscript%3E', 'mark=forums&x=%22%3E%3Cscript%3Ealert%28%2FXSS%2F%29%3B%3C%2Fscript%3E'), ); } /** * @dataProvider security_variables */ - public function test_query_string_php_self($url, $query_string, $expected) + public function test_query_string_php_self($query_string, $expected) { global $symfony_request, $request; - $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( - $request, - )); - $symfony_request->expects($this->any()) - ->method('getScriptName') - ->will($this->returnValue($url)); - $symfony_request->expects($this->any()) - ->method('getQueryString') - ->will($this->returnValue($query_string)); - $symfony_request->expects($this->any()) - ->method('getBasePath') - ->will($this->returnValue($server['REQUEST_URI'])); - $symfony_request->expects($this->any()) - ->method('getPathInfo') - ->will($this->returnValue('/')); + $this->server['REQUEST_URI'] = ''; + $this->server['QUERY_STRING'] = $query_string; + + $request = new phpbb_mock_request(array(), array(), array(), $this->server); + $symfony_request = new \phpbb\symfony_request($request); + $result = \phpbb\session::extract_current_page('./'); $label = 'Running extract_current_page on ' . $query_string . ' with PHP_SELF filled.'; @@ -52,25 +48,14 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base /** * @dataProvider security_variables */ - public function test_query_string_request_uri($url, $query_string, $expected) + public function test_query_string_request_uri($query_string, $expected) { global $symfony_request, $request; - $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( - $request, - )); - $symfony_request->expects($this->any()) - ->method('getScriptName') - ->will($this->returnValue($url)); - $symfony_request->expects($this->any()) - ->method('getQueryString') - ->will($this->returnValue($query_string)); - $symfony_request->expects($this->any()) - ->method('getBasePath') - ->will($this->returnValue($server['REQUEST_URI'])); - $symfony_request->expects($this->any()) - ->method('getPathInfo') - ->will($this->returnValue('/')); + $this->server['QUERY_STRING'] = $query_string; + + $request = new phpbb_mock_request(array(), array(), array(), $this->server); + $symfony_request = new \phpbb\symfony_request($request); $result = \phpbb\session::extract_current_page('./'); diff --git a/tests/security/hash_test.php b/tests/security/hash_test.php index bc1bebd87a..0494c55c6d 100644 --- a/tests/security/hash_test.php +++ b/tests/security/hash_test.php @@ -1,13 +1,17 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_compatibility.php'; class phpbb_security_hash_test extends phpbb_test_case { diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index 77dc955c26..62781f3ee6 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,16 +19,13 @@ class phpbb_security_redirect_test extends phpbb_security_test_base { protected $path_helper; - protected $controller_helper; - public function provider() { - $this->controller_helper = $this->get_controller_helper(); // array(Input -> redirect(), expected triggered error (else false), expected returned result url (else false)) return array( - array('data://x', false, false, 'http://localhost/phpBB'), + array('data://x', false, 'INSECURE_REDIRECT', false), array('bad://localhost/phpBB/index.php', false, 'INSECURE_REDIRECT', false), - array('http://www.otherdomain.com/somescript.php', false, false, 'http://localhost/phpBB'), + array('http://www.otherdomain.com/somescript.php', false, 'INSECURE_REDIRECT', false), array("http://localhost/phpBB/memberlist.php\n\rConnection: close", false, 'INSECURE_REDIRECT', false), array('javascript:test', false, false, 'http://localhost/phpBB/javascript:test'), array('http://localhost/phpBB/index.php;url=', false, 'INSECURE_REDIRECT', false), @@ -38,8 +39,8 @@ class phpbb_security_redirect_test extends phpbb_security_test_base array('./../foo/bar', false, false, 'http://localhost/foo/bar'), array('./../foo/bar', true, false, 'http://localhost/foo/bar'), array('app.php/', false, false, 'http://localhost/phpBB/app.php/'), - array($this->controller_helper->url('a'), false, false, 'http://localhost/phpBB/app.php/a'), - array($this->controller_helper->url(''), false, false, 'http://localhost/phpBB/app.php/'), + array('app.php/a', false, false, 'http://localhost/phpBB/app.php/a'), + array('app.php/a/b', false, false, 'http://localhost/phpBB/app.php/a/b'), array('./app.php/', false, false, 'http://localhost/phpBB/app.php/'), array('foobar', false, false, 'http://localhost/phpBB/foobar'), array('./foobar', false, false, 'http://localhost/phpBB/foobar'), @@ -50,6 +51,11 @@ class phpbb_security_redirect_test extends phpbb_security_test_base array('../index.php', false, false, 'http://localhost/index.php'), array('../index.php', true, false, 'http://localhost/index.php'), array('./index.php', false, false, 'http://localhost/phpBB/index.php'), + array('https://foobar.com\@http://localhost/phpBB', false, 'INSECURE_REDIRECT', false), + array('https://foobar.com\@localhost/troll/http://localhost/', false, 'INSECURE_REDIRECT', false), + array('http://localhost.foobar.com\@localhost/troll/http://localhost/', false, 'INSECURE_REDIRECT', false), + array('http://localhost/phpBB', false, false, 'http://localhost/phpBB'), + array('http://localhost/phpBB/', false, false, 'http://localhost/phpBB/'), ); } @@ -61,7 +67,8 @@ class phpbb_security_redirect_test extends phpbb_security_test_base new \phpbb\symfony_request( new phpbb_mock_request() ), - new \phpbb\filesystem(), + new \phpbb\filesystem\filesystem(), + $this->getMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); @@ -69,33 +76,10 @@ class phpbb_security_redirect_test extends phpbb_security_test_base return $this->path_helper; } - protected function get_controller_helper() - { - if (!($this->controller_helper instanceof \phpbb\controller\helper)) - { - global $phpbb_dispatcher; - - $phpbb_dispatcher = new phpbb_mock_event_dispatcher; - $this->user = $this->getMock('\phpbb\user'); - $phpbb_path_helper = new \phpbb\path_helper( - new \phpbb\symfony_request( - new phpbb_mock_request() - ), - new \phpbb\filesystem(), - $phpbb_root_path, - $phpEx - ); - $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $this->user, new \phpbb\template\context()); - - // We don't use mod_rewrite in these tests - $config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); - $this->controller_helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php'); - } - return $this->controller_helper; - } - protected function setUp() { + global $phpbb_dispatcher; + parent::setUp(); $GLOBALS['config'] = array( @@ -103,7 +87,8 @@ class phpbb_security_redirect_test extends phpbb_security_test_base ); $this->path_helper = $this->get_path_helper(); - $this->controller_helper = $this->get_controller_helper(); + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); } /** @@ -125,7 +110,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base if ($expected_error !== false) { - $this->setExpectedTriggerError(E_USER_ERROR, $expected_error); + $this->setExpectedTriggerError(E_USER_ERROR, $user->lang[$expected_error]); } $result = redirect($test, true, $disable_cd_check); diff --git a/tests/session/append_sid_test.php b/tests/session/append_sid_test.php index b9e9ac1aa9..2a1d94514f 100644 --- a/tests/session/append_sid_test.php +++ b/tests/session/append_sid_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index 3f13b9f216..04da5f08b9 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; @@ -38,7 +42,10 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case parent::setUp(); // Get session here so that config is mocked correctly $this->session = $this->session_factory->get_session($this->db); - global $cache, $config, $phpbb_root_path, $phpEx; + global $cache, $config, $phpbb_root_path, $phpEx, $phpbb_filesystem; + + $phpbb_filesystem = new \phpbb\filesystem\filesystem(); + $this->backup_cache = $cache; // Change the global cache object for this test because // the mock cache object does not hit the database as is needed diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php index 760e2a6f24..90554bfe5f 100644 --- a/tests/session/check_isvalid_test.php +++ b/tests/session/check_isvalid_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/session/create_test.php b/tests/session/create_test.php index 442445599b..105c76eb7f 100644 --- a/tests/session/create_test.php +++ b/tests/session/create_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php index bd183fd438..3a9d498007 100644 --- a/tests/session/extract_hostname_test.php +++ b/tests/session/extract_hostname_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php index 6e137e28b8..96445ef9b3 100644 --- a/tests/session/extract_page_test.php +++ b/tests/session/extract_page_test.php @@ -1,13 +1,18 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_session_extract_page_test extends phpbb_session_test_case { @@ -95,7 +100,7 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case // ^-- Ignored because .. returns different directory in live vs testing 'query_string' => '', 'script_path' => '/phpBB/adm/', - //'root_script_path' => '/phpBB/', + //'root_script_path' => '/phpBB/adm/', //'page' => 'adm/index.php', 'forum' => 0, ), @@ -104,15 +109,15 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case './', '/phpBB/adm/app.php', 'page=1&test=2', - '/phpBB/', + '/phpBB/adm/', '/foo/bar', array( 'page_name' => 'app.php/foo/bar', - 'page_dir' => '', + //'page_dir' => '', 'query_string' => 'page=1&test=2', - 'script_path' => '/phpBB/', - 'root_script_path' => '/phpBB/', - 'page' => 'app.php/foo/bar?page=1&test=2', + 'script_path' => '/phpBB/adm/', + //'root_script_path' => '/phpBB/adm/', + //'page' => 'app.php/foo/bar?page=1&test=2', 'forum' => 0, ), ), @@ -138,23 +143,25 @@ class phpbb_session_extract_page_test extends phpbb_session_test_case /** @dataProvider extract_current_page_data */ function test_extract_current_page($root_path, $getScriptName, $getQueryString, $getBasePath, $getPathInfo, $expected) { - global $symfony_request; + global $symfony_request, $request, $phpbb_filesystem; + + $phpbb_filesystem = new \phpbb\filesystem\filesystem(); + + $server['HTTP_HOST'] = 'localhost'; + $server['SERVER_NAME'] = 'localhost'; + $server['SERVER_ADDR'] = '127.0.0.1'; + $server['SERVER_PORT'] = 80; + $server['REMOTE_ADDR'] = '127.0.0.1'; + $server['QUERY_STRING'] = $getQueryString; + $server['REQUEST_URI'] = $getScriptName . $getPathInfo . ($getQueryString === '' ? '' : '?' . $getQueryString); + $server['SCRIPT_NAME'] = $getScriptName; + $server['SCRIPT_FILENAME'] = '/var/www/' . $getScriptName; + $server['PHP_SELF'] = $getScriptName; + $server['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'; + $server['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3'; - $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( - new phpbb_mock_request(), - )); - $symfony_request->expects($this->any()) - ->method('getScriptName') - ->will($this->returnValue($getScriptName)); - $symfony_request->expects($this->any()) - ->method('getQueryString') - ->will($this->returnValue($getQueryString)); - $symfony_request->expects($this->any()) - ->method('getBasePath') - ->will($this->returnValue($getBasePath)); - $symfony_request->expects($this->any()) - ->method('getPathInfo') - ->will($this->returnValue($getPathInfo)); + $request = new phpbb_mock_request(array(), array(), array(), $server); + $symfony_request = new \phpbb\symfony_request($request); $output = \phpbb\session::extract_current_page($root_path); diff --git a/tests/session/fixtures/sessions_empty.xml b/tests/session/fixtures/sessions_empty.xml index 2acba58f45..068951dc4c 100644 --- a/tests/session/fixtures/sessions_empty.xml +++ b/tests/session/fixtures/sessions_empty.xml @@ -30,4 +30,11 @@ <column>session_ip</column> <column>session_browser</column> </table> + <table name="phpbb_banlist"> + <column>ban_id</column> + <column>ban_userid</column> + <column>ban_email</column> + <column>ban_reason</column> + <column>ban_give_reason</column> + </table> </dataset> diff --git a/tests/session/fixtures/sessions_key.xml b/tests/session/fixtures/sessions_key.xml index 4f349cd282..245f89a604 100644 --- a/tests/session/fixtures/sessions_key.xml +++ b/tests/session/fixtures/sessions_key.xml @@ -22,7 +22,6 @@ <value>4</value> <value>127.0.0.1</value> <value>user agent</value> - <value>1</value> </row> </table> <table name="phpbb_users"> diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php index e7d01785dd..3fad81c68b 100644 --- a/tests/session/garbage_collection_test.php +++ b/tests/session/garbage_collection_test.php @@ -1,13 +1,18 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_session_garbage_collection_test extends phpbb_session_test_case { @@ -22,6 +27,19 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case { parent::setUp(); $this->session = $this->session_factory->get_session($this->db); + + global $phpbb_container; + + $plugins = new \phpbb\di\service_collection($phpbb_container); + $plugins->add('core.captcha.plugins.nogd'); + $phpbb_container->set( + 'captcha.factory', + new \phpbb\captcha\factory($phpbb_container, $plugins) + ); + $phpbb_container->set( + 'core.captcha.plugins.nogd', + new \phpbb\captcha\plugins\nogd() + ); } public function test_cleanup_all() @@ -43,7 +61,7 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case global $config; $config['session_length'] = 0; // There is an error unless the captcha plugin is set - $config['captcha_plugin'] = 'phpbb_captcha_nogd'; + $config['captcha_plugin'] = 'core.captcha.plugins.nogd'; $this->session->session_gc(); $this->check_sessions_equals( array(), diff --git a/tests/session/session_key_test.php b/tests/session/session_key_test.php index 1cf2101385..bf3dfcaa3c 100644 --- a/tests/session/session_key_test.php +++ b/tests/session/session_key_test.php @@ -1,12 +1,17 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; class phpbb_session_login_keys_test extends phpbb_session_test_case @@ -24,13 +29,14 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case // With AutoLogin setup $this->session_factory->merge_config_data(array('allow_autologin' => true)); $session = $this->session_factory->get_session($this->db); + // Using a user_id and key that is already in the database $session->cookie_data['u'] = $this->user_id; $session->cookie_data['k'] = $this->key_id; - // Try to access session - $session->session_create($this->user_id, false, $this->user_id); - $this->assertEquals($this->user_id, $session->data['user_id'], "session should automatically login"); + // Try to access session with the session key + $session->session_create(false, false, false); + $this->assertEquals($this->user_id, $session->data['user_id'], 'User should be logged in by the session key'); } public function test_reset_keys() @@ -38,14 +44,19 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case // With AutoLogin setup $this->session_factory->merge_config_data(array('allow_autologin' => true)); $session = $this->session_factory->get_session($this->db); + // Reset of the keys for this user $session->reset_login_keys($this->user_id); + // Using a user_id and key that was in the database (before reset) $session->cookie_data['u'] = $this->user_id; $session->cookie_data['k'] = $this->key_id; - // Try to access session - $session->session_create($this->user_id, false, $this->user_id); - $this->assertNotEquals($this->user_id, $session->data['user_id'], "session should be cleared"); + // Try to access session with the session key + $session->session_create(false, false, $this->user_id); + $this->assertNotEquals($this->user_id, $session->data['user_id'], 'User is not logged in because the session key is invalid'); + + $session->session_create($this->user_id, false, false); + $this->assertEquals($this->user_id, $session->data['user_id'], 'User should be logged in because we create a new session'); } } diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 2600a46cc4..05858c8a63 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/testable_factory.php'; require_once dirname(__FILE__) . '/../../phpBB/phpbb/session.php'; diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index a58e208efc..7819063505 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -63,10 +67,10 @@ class phpbb_session_testable_factory /** * Retrieve the configured session class instance * - * @param \phpbb\db\driver\driver $dbal The database connection to use for session data + * @param \phpbb\db\driver\driver_interface $dbal The database connection to use for session data * @return phpbb_mock_session_testable A session instance */ - public function get_session(\phpbb\db\driver\driver $dbal) + public function get_session(\phpbb\db\driver\driver_interface $dbal) { // set up all the global variables used by session global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container; @@ -77,10 +81,8 @@ class phpbb_session_testable_factory $this->cookies, $this->server_data ); - request_var(null, null, null, null, $request); $config = $this->config = new \phpbb\config\config($this->get_config_data()); - set_config(null, null, null, $config); $db = $dbal; @@ -92,6 +94,13 @@ class phpbb_session_testable_factory 'auth.provider.db', new phpbb_mock_auth_provider() ); + $phpbb_container->setParameter('core.environment', PHPBB_ENVIRONMENT); + $provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config); + $provider_collection->add('auth.provider.db'); + $phpbb_container->set( + 'auth.provider_collection', + $provider_collection + ); $session = new phpbb_mock_session_testable; return $session; diff --git a/tests/session/unset_admin_test.php b/tests/session/unset_admin_test.php index 1d5b1759ab..9633d77be6 100644 --- a/tests/session/unset_admin_test.php +++ b/tests/session/unset_admin_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php index a302229287..7690a89018 100644 --- a/tests/session/validate_referrer_test.php +++ b/tests/session/validate_referrer_test.php @@ -1,11 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; diff --git a/tests/template/asset_test.php b/tests/template/asset_test.php new file mode 100644 index 0000000000..3d2fdd8959 --- /dev/null +++ b/tests/template/asset_test.php @@ -0,0 +1,49 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use phpbb\template\asset; + +class phpbb_template_asset_test extends phpbb_test_case +{ + public function set_path_data() + { + return array( + // array(phpbb_root_path, given path, expected path), + array('.', 'foo/bar', 'foo/bar'), + array('../', 'foo/bar', 'foo/bar'), + array('./phpBB/', 'foo/bar', 'foo/bar'), + array('../', __DIR__ . '/foo/bar', '../' . basename(dirname(dirname(__DIR__))) . '/tests/template/foo/bar'), + array('./', __DIR__ . '/foo/bar', './tests/template/foo/bar'), + array('./phpBB/', __DIR__ . '/foo/bar', 'tests/template/foo/bar'), + ); + } + + /** + * @dataProvider set_path_data + */ + public function test_set_path($phpbb_root_path, $path, $expected) + { + $path_helper = $this->getMockBuilder('\phpbb\path_helper') + ->disableOriginalConstructor() + ->setMethods(array()) + ->getMock(); + + $path_helper->method('get_phpbb_root_path') + ->willReturn($phpbb_root_path); + + $asset = new asset('', $path_helper, new phpbb\filesystem\filesystem()); + + $asset->set_path($path, true); + $this->assertEquals($expected, $asset->get_path()); + } +} diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_subloop.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_subloop.html new file mode 100644 index 0000000000..98fa1770ba --- /dev/null +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_subloop.html @@ -0,0 +1,2 @@ +[{event_loop.S_ROW_COUNT}<!-- BEGIN event_loop.subloop -->[subloop:{event_loop.subloop.S_ROW_COUNT}] +<!-- END event_loop.subloop -->] diff --git a/tests/template/datasets/ext_trivial/styles/silver/template/event_subloop.html b/tests/template/datasets/ext_trivial/styles/silver/template/event_subloop.html new file mode 100644 index 0000000000..233b32a4c7 --- /dev/null +++ b/tests/template/datasets/ext_trivial/styles/silver/template/event_subloop.html @@ -0,0 +1,3 @@ +<!-- BEGIN event_loop --> +event_loop<!-- EVENT test_event_subloop --> +<!-- END event_loop --> diff --git a/tests/template/ext/include/css/styles/all/theme/child_only.css b/tests/template/ext/include/css/styles/all/theme/child_only.css new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/template/ext/include/css/styles/all/theme/child_only.css diff --git a/tests/template/ext/include/css/styles/all/theme/test.css b/tests/template/ext/include/css/styles/all/theme/test.css new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/template/ext/include/css/styles/all/theme/test.css diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index a0dd8368cf..722e10e42d 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -35,8 +39,9 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case { global $phpbb_root_path; + $filesystem = new \phpbb\filesystem\filesystem(); $path_to_php = str_replace('\\', '/', dirname(__FILE__)) . '/templates/_dummy_include.php.inc'; - $this->assertTrue(phpbb_is_absolute($path_to_php)); + $this->assertTrue($filesystem->is_absolute_path($path_to_php)); $template_text = "Path is absolute.\n<!-- INCLUDEPHP $path_to_php -->"; $cache_dir = $phpbb_root_path . 'cache/'; diff --git a/tests/template/subdir/includephp_from_subdir_test.php b/tests/template/subdir/includephp_from_subdir_test.php index 6f9bc1efa6..08ffb0f7dc 100644 --- a/tests/template/subdir/includephp_from_subdir_test.php +++ b/tests/template/subdir/includephp_from_subdir_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php new file mode 100644 index 0000000000..9a0f1f512e --- /dev/null +++ b/tests/template/template_allfolder_test.php @@ -0,0 +1,85 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/template_test_case.php'; + +class phpbb_template_allfolder_test extends phpbb_template_template_test_case +{ + public function test_allfolder() + { + $this->setup_engine_for_allfolder(); + + $this->run_template('foobar_body.html', array(), array(), array(), "All folder"); + } + + protected function setup_engine_for_allfolder(array $new_config = array()) + { + global $phpbb_root_path, $phpEx; + + $defaults = $this->config_defaults(); + $config = new \phpbb\config\config(array_merge($defaults, $new_config)); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $this->user = $user; + + $filesystem = new \phpbb\filesystem\filesystem(); + + $path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new phpbb_mock_request() + ), + $filesystem, + $this->getMock('\phpbb\request\request'), + $phpbb_root_path, + $phpEx + ); + + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'vendor4/bar' => array( + 'ext_name' => 'vendor4/bar', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor4/bar/', + ), + ) + ); + + $container = new phpbb_mock_container_builder(); + $cache_path = $phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), ''); + $twig = new \phpbb\template\twig\environment( + $config, + $filesystem, + $path_helper, + $container, + $cache_path, + $this->extension_manager, + $loader, + array( + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ) + ); + $this->template = new \phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user)), $this->extension_manager); + $container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); + + $this->template_path = $this->test_path . '/templates'; + $this->ext_template_path = 'tests/extension/ext/vendor4/bar/styles/all/template'; + $this->template->set_custom_style('all', array($this->template_path, $this->ext_template_path)); + } +} diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 41e00e86a7..54e08652a1 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -90,14 +94,32 @@ Zeta test event in all', array(), 'event_loop0|event_loop1|event_loop2', ), + array( + 'EVENT with subloop in loop', + 'ext_trivial', + array('silver'), + 'event_subloop.html', + array(), + array( + 'event_loop' => array(array()), + 'event_loop.subloop' => array(array()), + ), + array(), + 'event_loop[0[subloop:0]]', + ), ); } /** * @dataProvider template_data */ - public function test_event($desc, $dataset, $style_names, $file, array $vars, array $block_vars, array $destroy, $expected) + public function test_event($desc, $dataset, $style_names, $file, array $vars, array $block_vars, array $destroy, $expected, $incomplete_message = '') { + if ($incomplete_message) + { + $this->markTestIncomplete($incomplete_message); + } + // Reset the engine state $this->setup_engine_for_events($dataset, $style_names); @@ -116,15 +138,40 @@ Zeta test event in all', $this->extension_manager = new phpbb_mock_filesystem_extension_manager( dirname(__FILE__) . "/datasets/$dataset/" ); + + $filesystem = new \phpbb\filesystem\filesystem(); $path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), - new \phpbb\filesystem(), + new \phpbb\filesystem\filesystem(), + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); - $this->template = new \phpbb\template\twig\twig($path_helper, $config, $user, new \phpbb\template\context, $this->extension_manager); + + $container = new phpbb_mock_container_builder(); + $cache_path = $phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), ''); + $twig = new \phpbb\template\twig\environment( + $config, + $filesystem, + $path_helper, + $container, + $cache_path, + $this->extension_manager, + $loader, + array( + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ) + ); + $this->template = new \phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user)), $this->extension_manager); + $container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); + $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path)); } } diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index 9ed8bd0947..ac62e820ae 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,18 +15,114 @@ require_once dirname(__FILE__) . '/template_test_case_with_tree.php'; class phpbb_template_template_includecss_test extends phpbb_template_template_test_case_with_tree { - public function test_includecss_compilation() + /** @var \phpbb\path_helper */ + protected $phpbb_path_helper; + + /** @var string */ + protected $parent_template_path; + + protected function setup_engine(array $new_config = array()) + { + global $phpbb_root_path, $phpEx, $user; + + $defaults = $this->config_defaults(); + $config = new \phpbb\config\config(array_merge($defaults, $new_config)); + + $filesystem = new \phpbb\filesystem\filesystem(); + + $this->phpbb_path_helper = new \phpbb\path_helper( + new \phpbb\symfony_request( + new phpbb_mock_request() + ), + $filesystem, + $this->getMock('\phpbb\request\request'), + $phpbb_root_path, + $phpEx + ); + + $this->template_path = $this->test_path . '/templates'; + $this->parent_template_path = $this->test_path . '/parent_templates'; + $container = new phpbb_mock_container_builder(); + $cache_path = $phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), ''); + $twig = new \phpbb\template\twig\environment( + $config, + $filesystem, + $this->phpbb_path_helper, + $container, + $cache_path, + null, + $loader, + array( + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ) + ); + $this->template = new phpbb\template\twig\twig( + $this->phpbb_path_helper, + $config, + $context, + $twig, + $cache_path, + $this->user, + array(new \phpbb\template\twig\extension($context, $this->user)), + new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'include/css' => array( + 'ext_name' => 'include/css', + 'ext_active' => '1', + 'ext_path' => 'ext/include/css/', + ), + ) + ) + ); + $container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); + $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); + } + + public function template_data() + { + return array( + /* + array( + // vars + // expected + ), + */ + array( + array('TEST' => 1), + '<link href="tests/template/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', + ), + array( + array('TEST' => 2), + '<link href="tests/template/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', + ), + array( + array('TEST' => 3), + '<link href="tests/template/ext/include/css/styles/all/theme/test.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', + ), + array( + array('TEST' => 4), + '<link href="tests/template/ext/include/css/styles/all/theme/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen" />', + ), + ); + } + + /** + * @dataProvider template_data + */ + public function test_includecss_compilation($vars, $expected) { // Reset the engine state $this->setup_engine(array('assets_version' => 1)); - // Prepare correct result - $scripts = array( - '<link href="tests/template/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', - '<link href="tests/template/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />', - ); + $this->template->assign_vars($vars); // Run test - $this->run_template('includecss.html', array(), array(), array(), implode('', $scripts)); + $this->run_template('includecss.html', array(), array(), array(), $expected); } } diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index b20d068a64..232f551b4a 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php index cc71ff99e0..4d918b3167 100644 --- a/tests/template/template_inheritance_test.php +++ b/tests/template/template_inheritance_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/template/template_parser_test.php b/tests/template/template_parser_test.php index c200770adf..d32fe78391 100644 --- a/tests/template/template_parser_test.php +++ b/tests/template/template_parser_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 6e9b7d3ee9..33dc4ca551 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -91,6 +95,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case '03!false', ), array( + 'if.html', + array('VALUE_TEST' => 'value'), + array(), + array(), + '03!falsevalue', + ), + array( 'loop.html', array(), array(), @@ -119,6 +130,34 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1", ), array( + 'loop_twig.html', + array(), + array(), + array(), + "noloop\nnoloop", + ), + array( + 'loop_twig.html', + array(), + array('test_loop' => array(array())), + array(), + "loop\nloop", + ), + array( + 'loop_twig.html', + array(), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array())), + array(), + "loop\nloop\nloop\nloop", + ), + array( + 'loop_twig.html', + array(), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array()), 'block' => array(array(), array())), + array(), + "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1", + ), + array( 'loop_vars.html', array(), array('test_loop' => array(array('VARIABLE' => 'x'))), @@ -140,6 +179,27 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner", ), array( + 'loop_vars_twig.html', + array(), + array('test_loop' => array(array('VARIABLE' => 'x'))), + array(), + "first\n0 - a\nx - b\nset\nlast", + ), + array( + 'loop_vars_twig.html', + array(), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), + array(), + "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast", + ), + array( + 'loop_vars_twig.html', + array(), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array(), + "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner", + ), + array( 'loop_advanced.html', array(), array('test_loop' => array(array(), array(), array(), array(), array(), array(), array())), @@ -147,6 +207,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561", ), array( + 'loop_advanced_twig.html', + array(), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array())), + array(), + "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561", + ), + array( 'loop_nested2.html', array(), array('outer' => array(array(), array()), 'outer.middle' => array(array(), array())), @@ -154,6 +221,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "o0o1m01m11", ), array( + 'loop_nested2_twig.html', + array(), + array('outer' => array(array(), array()), 'outer.middle' => array(array(), array())), + array(), + "o0o1m01m11", + ), + array( 'define.html', array(), array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), @@ -233,6 +307,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case '', ), array( + 'loop_vars_twig.html', + array(), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array('test_loop'), + '', + ), + array( 'include_define_variable.html', array('VARIABLE' => 'variable.html'), array(), @@ -264,6 +345,15 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "noloop\nnoloop", ), array( + // Just like a regular loop but the name begins + // with an underscore + 'loop_underscore_twig.html', + array(), + array(), + array(), + "noloop\nnoloop", + ), + array( 'lang.html', array(), array(), @@ -275,7 +365,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), array(), array(), - "Value'\n1 O'Clock\nValue\'\n1 O\'Clock", + "Value'\n1 O'Clock\nValue\\x27\n1\\x20O\\x27Clock", array('VARIABLE' => "Value'", '1_VARIABLE' => "1 O'Clock"), ), array( @@ -286,6 +376,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "top-level content", ), array( + 'loop_nested_multilevel_ref_twig.html', + array(), + array(), + array(), + "top-level content", + ), + array( 'loop_nested_multilevel_ref.html', array(), array('outer' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'outer.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))), @@ -293,6 +390,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "top-level content\nouter x\nouter y\ninner z\nfirst row\n\ninner zz", ), array( + 'loop_nested_multilevel_ref_twig.html', + array(), + array('outer' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'outer.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))), + array(), + "top-level content\nouter x\nouter y\ninner z\nfirst row\n\ninner zz", + ), + array( 'loop_nested_deep_multilevel_ref.html', array(), array('outer' => array(array()), 'outer.middle' => array(array()), 'outer.middle.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))), @@ -300,12 +404,62 @@ class phpbb_template_template_test extends phpbb_template_template_test_case "top-level content\nouter\nmiddle\ninner z\nfirst row of 2 in inner\n\ninner zz", ), array( + 'loop_nested_deep_multilevel_ref_twig.html', + array(), + array('outer' => array(array()), 'outer.middle' => array(array()), 'outer.middle.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))), + array(), + "top-level content\nouter\nmiddle\ninner z\nfirst row of 2 in inner\n\ninner zz", + ), + array( 'loop_size.html', array(), array('test_loop' => array(array()), 'empty_loop' => array()), array(), "nonexistent = 0\n! nonexistent\n\nempty = 0\n! empty\nloop\n\nin loop", ), + array( + 'loop_size_twig.html', + array(), + array('test_loop' => array(array()), 'empty_loop' => array()), + array(), + "nonexistent = 0\n! nonexistent\n\nempty = 0\n! empty\nloop\n\nin loop", + ), + array( + 'loop_include.html', + array(), + array('test_loop' => array(array('foo' => 'bar'), array('foo' => 'bar1'))), + array(), + "barbarbar1bar1", + ), + array( + 'loop_include_twig.html', + array(), + array('test_loop' => array(array('foo' => 'bar'), array('foo' => 'bar1'))), + array(), + "barbarbar1bar1", + ), + array( + 'loop_nested_include.html', + array(), + array( + 'test_loop' => array(array('foo' => 'bar'), array('foo' => 'bar1')), + 'test_loop.inner' => array(array('myinner' => 'works')), + ), + array(), + "[bar|[bar|]][bar1|[bar1|[bar1|works]]]", + array(), + ), + array( + 'loop_nested_include_twig.html', + array(), + array( + 'test_loop' => array(array('foo' => 'bar'), array('foo' => 'bar1')), + 'test_loop.inner' => array(array('myinner' => 'works')), + ), + array(), + "[bar|[bar|]][bar1|[bar1|[bar1|works]]]", + array(), + ), /* Does not pass with the current implementation. array( 'loop_reuse.html', @@ -314,8 +468,15 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), // Not entirely sure what should be outputted but the current output of "a" is most certainly wrong "a\nb\nc\nd", + ),*/ + array( + 'loop_reuse_twig.html', + array(), + array('one' => array(array('VAR' => 'a'), array('VAR' => 'b')), 'one.one' => array(array('VAR' => 'c'), array('VAR' => 'd'))), + array(), + // Not entirely sure what should be outputted but the current output of "a" is most certainly wrong + "a\nb\nc\nd", ), - */ array( 'twig.html', array('VARIABLE' => 'FOObar',), @@ -323,6 +484,34 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), "13FOOBAR|foobar", ), + array( + 'if_nested_tags.html', + array('S_VALUE' => true,), + array(), + array(), + 'inner_value', + ), + array( + 'loop_expressions.html', + array(), + array('loop' => array(array(),array(),array(),array(),array(),array()),), + array(), + 'yesnononoyesnoyesnonoyesnono', + ), + array( + 'loop_expressions_twig.html', + array(), + array('loop' => array(array(),array(),array(),array(),array(),array()),), + array(), + 'yesnononoyesnoyesnonoyesnono', + ), + array( + 'loop_expressions_twig2.html', + array('loop' => array(array(),array(),array(),array(),array(),array()),), + array(), + array(), + 'yesnononoyesnoyesnonoyesnono', + ), ); } @@ -349,8 +538,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case /** * @dataProvider template_data */ - public function test_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array()) + public function test_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array(), $incomplete_message = '') { + if ($incomplete_message) + { + $this->markTestIncomplete($incomplete_message); + } + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $lang_vars); } @@ -562,6 +756,40 @@ EOT $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); } + public function assign_block_vars_array_data() + { + return array( + array( + array( + 'outer' => array( + array('VARIABLE' => 'Test assigning block vars array loop 0:'), + array('VARIABLE' => 'Test assigning block vars array loop 1:'), + ), + 'outer.middle' => array( + array('VARIABLE' => '1st iteration',), + array('VARIABLE' => '2nd iteration',), + array('VARIABLE' => '3rd iteration',), + ), + ) + ) + ); + } + + /** + * @dataProvider assign_block_vars_array_data + */ + public function test_assign_block_vars_array($block_data) + { + $this->template->set_filenames(array('test' => 'loop_nested.html')); + + foreach ($block_data as $blockname => $block_vars_array) + { + $this->template->assign_block_vars_array($blockname, $block_vars_array); + } + + $this->assertEquals("outer - 0 - Test assigning block vars array loop 0:outer - 1 - Test assigning block vars array loop 1:middle - 0 - 1st iterationmiddle - 1 - 2nd iterationmiddle - 2 - 3rd iteration", $this->display('test'), 'Ensuring assigning block vars array to template is working correctly'); + } + /** * @expectedException Twig_Error_Syntax */ diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index c75b1e5065..62eea0d361 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,6 +15,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_template_template_test_case extends phpbb_test_case { + protected $lang; protected $template; protected $template_path; protected $user; @@ -20,6 +25,17 @@ class phpbb_template_template_test_case extends phpbb_test_case // Keep the contents of the cache for debugging? const PRESERVE_CACHE = true; + static protected $language_reflection_lang; + + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + $reflection = new ReflectionClass('\phpbb\language\language'); + self::$language_reflection_lang = $reflection->getProperty('lang'); + self::$language_reflection_lang->setAccessible(true); + } + protected function display($handle) { ob_start(); @@ -61,19 +77,46 @@ class phpbb_template_template_test_case extends phpbb_test_case $defaults = $this->config_defaults(); $config = new \phpbb\config\config(array_merge($defaults, $new_config)); - $this->user = new \phpbb\user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $this->lang = $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $this->user = $user; + + $filesystem = new \phpbb\filesystem\filesystem(); $path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), - new \phpbb\filesystem(), + $filesystem, + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); $this->template_path = $this->test_path . '/templates'; - $this->template = new \phpbb\template\twig\twig($path_helper, $config, $this->user, new \phpbb\template\context()); + + $container = new phpbb_mock_container_builder(); + $cache_path = $phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), ''); + $twig = new \phpbb\template\twig\environment( + $config, + $filesystem, + $path_helper, + $container, + $cache_path, + null, + $loader, + array( + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ) + ); + $this->template = new phpbb\template\twig\twig($path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user))); + $container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); $this->template->set_custom_style('tests', $this->template_path); } @@ -83,6 +126,10 @@ class phpbb_template_template_test_case extends phpbb_test_case $this->setup_engine(); $this->template->clear_cache(); + + global $phpbb_filesystem; + + $phpbb_filesystem = new \phpbb\filesystem\filesystem(); } protected function tearDown() @@ -116,7 +163,10 @@ class phpbb_template_template_test_case extends phpbb_test_case { foreach ($lang_vars as $name => $value) { - $this->user->lang[$name] = $value; + self::$language_reflection_lang->setValue($this->lang, array_merge( + self::$language_reflection_lang->getValue($this->lang), + array($name => $value) + )); } } diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index e614c42d73..bf5de6b85e 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -18,18 +22,42 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $defaults = $this->config_defaults(); $config = new \phpbb\config\config(array_merge($defaults, $new_config)); + $filesystem = new \phpbb\filesystem\filesystem(); + $this->phpbb_path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), - new \phpbb\filesystem(), + $filesystem, + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); $this->template_path = $this->test_path . '/templates'; $this->parent_template_path = $this->test_path . '/parent_templates'; - $this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $config, $user, new phpbb\template\context()); + + $container = new phpbb_mock_container_builder(); + $cache_path = $phpbb_root_path . 'cache/twig'; + $context = new \phpbb\template\context(); + $loader = new \phpbb\template\twig\loader(new \phpbb\filesystem\filesystem(), ''); + $twig = new \phpbb\template\twig\environment( + $config, + $filesystem, + $this->phpbb_path_helper, + $container, + $cache_path, + null, + $loader, + array( + 'cache' => false, + 'debug' => false, + 'auto_reload' => true, + 'autoescape' => false, + ) + ); + $this->template = new phpbb\template\twig\twig($this->phpbb_path_helper, $config, $context, $twig, $cache_path, $this->user, array(new \phpbb\template\twig\extension($context, $this->user))); + $container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig)); $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); } } diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html index f6ab6e575a..71312f994c 100644 --- a/tests/template/templates/if.html +++ b/tests/template/templates/if.html @@ -19,3 +19,7 @@ false <!-- IF S_TEST !== false --> !false <!-- ENDIF --> + +<!-- IF VALUE_TEST is defined --> +{VALUE_TEST} +<!-- ENDIF --> diff --git a/tests/template/templates/if_nested_tags.html b/tests/template/templates/if_nested_tags.html new file mode 100644 index 0000000000..0348a31a8d --- /dev/null +++ b/tests/template/templates/if_nested_tags.html @@ -0,0 +1 @@ +<!-- IF S_VALUE --><!-- DEFINE $INNER_VALUE = 'inner_value' --><!-- ENDIF -->{$INNER_VALUE} diff --git a/tests/template/templates/includecss.html b/tests/template/templates/includecss.html index a09e44f240..23e3c426d7 100644 --- a/tests/template/templates/includecss.html +++ b/tests/template/templates/includecss.html @@ -1,3 +1,10 @@ -<!-- INCLUDECSS child_only.css --> -<!-- INCLUDECSS parent_only.css --> +<!-- IF TEST === 1 --> + <!-- INCLUDECSS child_only.css --> +<!-- ELSEIF TEST === 2 --> + <!-- INCLUDECSS parent_only.css --> +<!-- ELSEIF TEST === 3 --> + <!-- INCLUDECSS @include_css/test.css --> +<!-- ELSEIF TEST === 4 --> + <!-- INCLUDECSS @include_css/child_only.css --> +<!-- ENDIF --> {$STYLESHEETS} diff --git a/tests/template/templates/loop_advanced_twig.html b/tests/template/templates/loop_advanced_twig.html new file mode 100644 index 0000000000..fd9fcae045 --- /dev/null +++ b/tests/template/templates/loop_advanced_twig.html @@ -0,0 +1,19 @@ +{% for test_loop_inner in test_loop %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(0) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(0,-1) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(1) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(1,1) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(0,1) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(2,4) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(0,-7) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(-2,6) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} +x +{% for test_loop_inner in test_loop|subset(-2,-1) %}{{ test_loop_inner.S_FIRST_ROW }}{{ test_loop_inner.S_ROW_COUNT }}{{ test_loop_inner.S_LAST_ROW }}{% endfor %} diff --git a/tests/template/templates/loop_expressions.html b/tests/template/templates/loop_expressions.html index 6bff53f388..ddb9fd52fa 100644 --- a/tests/template/templates/loop_expressions.html +++ b/tests/template/templates/loop_expressions.html @@ -1,11 +1,11 @@ <!-- BEGIN loop --> -<!-- IF loop.S_ROW_NUM is even by 4 -->on<!-- ELSE -->off<!-- ENDIF --> +<!-- IF loop.S_ROW_NUM is divisible by(4) -->yes<!-- ELSE -->no<!-- ENDIF --> <!-- END loop --> <!-- BEGIN loop --> -<!-- IF loop.S_ROW_NUM is odd by 3 -->on<!-- ELSE -->off<!-- ENDIF --> +<!-- IF loop.S_ROW_NUM is divisible by(3) -->yes<!-- ELSE -->no<!-- ENDIF --> <!-- END loop --> diff --git a/tests/template/templates/loop_expressions_twig.html b/tests/template/templates/loop_expressions_twig.html new file mode 100644 index 0000000000..5ca8cc3601 --- /dev/null +++ b/tests/template/templates/loop_expressions_twig.html @@ -0,0 +1,11 @@ +{% for loop_inner in loop %} + +{% if loop_inner.S_ROW_NUM is divisible by(4) %}yes{% else %}no{% endif %} + +{% endfor %} + +{% for loop_inner in loop %} + +{% if loop_inner.S_ROW_NUM is divisible by(3) %}yes{% else %}no{% endif %} + +{% endfor %} diff --git a/tests/template/templates/loop_expressions_twig2.html b/tests/template/templates/loop_expressions_twig2.html new file mode 100644 index 0000000000..16159ead4c --- /dev/null +++ b/tests/template/templates/loop_expressions_twig2.html @@ -0,0 +1,11 @@ +{% for loop_inner in loop %} + +{% if loop.index0 is divisible by(4) %}yes{% else %}no{% endif %} + +{% endfor %} + +{% for loop_inner in loop %} + +{% if loop.index0 is divisible by(3) %}yes{% else %}no{% endif %} + +{% endfor %} diff --git a/tests/template/templates/loop_include.html b/tests/template/templates/loop_include.html new file mode 100644 index 0000000000..7bbdfc4248 --- /dev/null +++ b/tests/template/templates/loop_include.html @@ -0,0 +1,4 @@ +<!-- BEGIN test_loop --> +{test_loop.foo} + <!-- INCLUDE loop_include1.html --> +<!-- END test_loop --> diff --git a/tests/template/templates/loop_include1.html b/tests/template/templates/loop_include1.html new file mode 100644 index 0000000000..851f6e6e75 --- /dev/null +++ b/tests/template/templates/loop_include1.html @@ -0,0 +1 @@ +{test_loop.foo} diff --git a/tests/template/templates/loop_include1_twig.html b/tests/template/templates/loop_include1_twig.html new file mode 100644 index 0000000000..2ff9f61b02 --- /dev/null +++ b/tests/template/templates/loop_include1_twig.html @@ -0,0 +1 @@ +{{ test_loop_inner.foo }} diff --git a/tests/template/templates/loop_include_twig.html b/tests/template/templates/loop_include_twig.html new file mode 100644 index 0000000000..1a534e2dbc --- /dev/null +++ b/tests/template/templates/loop_include_twig.html @@ -0,0 +1,4 @@ +{% for test_loop_inner in test_loop %} + {{ test_loop_inner.foo }} + {% INCLUDE 'loop_include1_twig.html' %} +{% endfor %} diff --git a/tests/template/templates/loop_nested2_twig.html b/tests/template/templates/loop_nested2_twig.html new file mode 100644 index 0000000000..cf802dc69f --- /dev/null +++ b/tests/template/templates/loop_nested2_twig.html @@ -0,0 +1,6 @@ +{% for outer_inner in outer %} + o{{ outer_inner.S_ROW_COUNT }} + {% for middle in outer_inner.middle %} + m{{ middle.S_ROW_COUNT }}{{ outer_inner.S_ROW_COUNT }} + {% endfor %} +{% endfor %} diff --git a/tests/template/templates/loop_nested_deep_multilevel_ref_twig.html b/tests/template/templates/loop_nested_deep_multilevel_ref_twig.html new file mode 100644 index 0000000000..9bc68e6e2e --- /dev/null +++ b/tests/template/templates/loop_nested_deep_multilevel_ref_twig.html @@ -0,0 +1,13 @@ +top-level content +{% for outer_inner in outer %} + outer + {% for middle in outer_inner.middle %} + {{ middle.S_BLOCK_NAME }} + {% for inner in middle.inner %} + inner {{ inner.VARIABLE }} + {% if inner.S_FIRST_ROW %} + first row of {{ inner.S_NUM_ROWS }} in {{ inner.S_BLOCK_NAME }} + {% endif %} + {% endfor %} + {% endfor %} +{% endfor %} diff --git a/tests/template/templates/loop_nested_include.html b/tests/template/templates/loop_nested_include.html new file mode 100644 index 0000000000..eaad46cc5b --- /dev/null +++ b/tests/template/templates/loop_nested_include.html @@ -0,0 +1,4 @@ +<!-- BEGIN test_loop --> +[{test_loop.foo} + |<!-- INCLUDE loop_nested_include1.html -->] +<!-- END test_loop --> diff --git a/tests/template/templates/loop_nested_include1.html b/tests/template/templates/loop_nested_include1.html new file mode 100644 index 0000000000..88efffc99c --- /dev/null +++ b/tests/template/templates/loop_nested_include1.html @@ -0,0 +1,5 @@ +[{test_loop.foo}| +<!-- BEGIN test_loop.inner --> +[{test_loop.foo}| +{test_loop.inner.myinner}] +<!-- END test_loop.inner -->] diff --git a/tests/template/templates/loop_nested_include1_twig.html b/tests/template/templates/loop_nested_include1_twig.html new file mode 100644 index 0000000000..4c2ebb5f15 --- /dev/null +++ b/tests/template/templates/loop_nested_include1_twig.html @@ -0,0 +1,5 @@ +[{{ test_loop_inner.foo }}| +{% for inner in test_loop_inner.inner %} + [{{ test_loop_inner.foo }}| + {{ inner.myinner }}] +{% endfor %}] diff --git a/tests/template/templates/loop_nested_include_twig.html b/tests/template/templates/loop_nested_include_twig.html new file mode 100644 index 0000000000..c92ac922d1 --- /dev/null +++ b/tests/template/templates/loop_nested_include_twig.html @@ -0,0 +1,4 @@ +{% for test_loop_inner in test_loop %} + [{{ test_loop_inner.foo }} + |{% INCLUDE 'loop_nested_include1_twig.html' %}] +{% endfor %} diff --git a/tests/template/templates/loop_nested_multilevel_ref_twig.html b/tests/template/templates/loop_nested_multilevel_ref_twig.html new file mode 100644 index 0000000000..336a57d0bc --- /dev/null +++ b/tests/template/templates/loop_nested_multilevel_ref_twig.html @@ -0,0 +1,10 @@ +top-level content +{% for outer_inner in outer %} + outer {{ outer_inner.VARIABLE }} + {% for inner in outer_inner.inner %} + inner {{ inner.VARIABLE }} + {% if inner.S_FIRST_ROW %} + first row + {% endif %} + {% endfor %} +{% endfor %} diff --git a/tests/template/templates/loop_nested_twig.html b/tests/template/templates/loop_nested_twig.html new file mode 100644 index 0000000000..b294226b3a --- /dev/null +++ b/tests/template/templates/loop_nested_twig.html @@ -0,0 +1,6 @@ +{% for outer_inner in outer %} +outer - {{ outer_inner.S_ROW_COUNT }}{% if outer_inner.VARIABLE %} - {{ outer_inner.VARIABLE }}{% endif %}{% if TEST_MORE %}[{{ outer_inner.S_BLOCK_NAME }}|{{ outer_inner.S_NUM_ROWS }}]{% endif %} +{% for middle in outer_inner.middle %} +middle - {{ middle.S_ROW_COUNT }}{% if middle.VARIABLE %} - {{ middle.VARIABLE }}{% endif %}{% if TEST_MORE %}[{{ middle.S_BLOCK_NAME }}|{{ middle.S_NUM_ROWS }}]{% endif %} +{% endfor %} +{% endfor %} diff --git a/tests/template/templates/loop_reuse_twig.html b/tests/template/templates/loop_reuse_twig.html new file mode 100644 index 0000000000..67452a737f --- /dev/null +++ b/tests/template/templates/loop_reuse_twig.html @@ -0,0 +1,6 @@ +{% for one_inner in one %} + {{ one_inner.VAR }} + {% for one_one_inner in one_inner.one %} + {{ one_one_inner.VAR }} + {% endfor %} +{% endfor %} diff --git a/tests/template/templates/loop_size_twig.html b/tests/template/templates/loop_size_twig.html new file mode 100644 index 0000000000..f6d2571e11 --- /dev/null +++ b/tests/template/templates/loop_size_twig.html @@ -0,0 +1,39 @@ +{% if nonexistent_loop|length %} +nonexistent +{% endif %} + +{% if nonexistent_loop|length == 0 %} +nonexistent = 0 +{% endif %} + +{% if ! nonexistent_loop|length %} +! nonexistent +{% endif %} + +{% if empty_loop|length %} +empty +{% endif %} + +{% if empty_loop|length == 0 %} +empty = 0 +{% endif %} + +{% if ! empty_loop|length %} +! empty +{% endif %} + +{% if test_loop|length %} +loop +{% endif %} + +{% if test_loop|length == 0 %} +loop = 0 +{% endif %} + +{% if ! test_loop|length %} +! loop +{% endif %} + +{% for test_loop_inner in test_loop %} +in loop +{% endfor %} diff --git a/tests/template/templates/loop_twig.html b/tests/template/templates/loop_twig.html new file mode 100644 index 0000000000..fb24f331b3 --- /dev/null +++ b/tests/template/templates/loop_twig.html @@ -0,0 +1,21 @@ +{% for test_loop_inner in test_loop %} +loop +{% else %} +noloop +{% endfor %} + +{% if test_loop|length %} +loop +{% else %} +noloop +{% endif %} + +{% if test_loop|length == 2 %} +loop +{% endif %} + +{% for test_loop_inner in test_loop %} +{% for block_inner in block %} +loop#{{ test_loop_inner.S_ROW_COUNT }}-block#{{ block_inner.S_ROW_COUNT }} +{% endfor %} +{% endfor %} diff --git a/tests/template/templates/loop_underscore_twig.html b/tests/template/templates/loop_underscore_twig.html new file mode 100644 index 0000000000..44b095c882 --- /dev/null +++ b/tests/template/templates/loop_underscore_twig.html @@ -0,0 +1,21 @@ +{% for _underscore_loop_inner in _underscore_loop %} +loop +{% else %} +noloop +{% endfor %} + +{% if _underscore_loop|length %} +loop +{% else %} +noloop +{% endif %} + +{% if _underscore_loop|length == 2 %} +loop +{% endif %} + +{% for _underscore_loop_inner in _underscore_loop %} +{% for block_inner in block %} +loop#{{ loop.S_ROW_COUNT }}-block#{{ block_inner.S_ROW_COUNT }} +{% endfor %} +{% endfor %} diff --git a/tests/template/templates/loop_vars_twig.html b/tests/template/templates/loop_vars_twig.html new file mode 100644 index 0000000000..af6c63d8e3 --- /dev/null +++ b/tests/template/templates/loop_vars_twig.html @@ -0,0 +1,13 @@ +{% for test_loop_inner in test_loop %} +{% if test_loop_inner.S_FIRST_ROW %}first{% endif %} +{{ test_loop_inner.S_ROW_NUM }} - a +{{ test_loop_inner.VARIABLE }} - b +{% if test_loop_inner.VARIABLE %}set{% endif %} +{% if test_loop_inner.S_LAST_ROW %} +last +{% endif %} +{% for inner_inner in test_loop_inner.inner %} +{{ inner_inner.S_ROW_NUM }} - c +{% if inner_inner.S_LAST_ROW and inner_inner.S_ROW_COUNT and inner_inner.S_NUM_ROWS %}last inner{% endif %} +{% endfor %} +{% endfor %} diff --git a/tests/test_framework/mock/phpbb_mock_null_installer_task.php b/tests/test_framework/mock/phpbb_mock_null_installer_task.php new file mode 100644 index 0000000000..c1b880d967 --- /dev/null +++ b/tests/test_framework/mock/phpbb_mock_null_installer_task.php @@ -0,0 +1,30 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_mock_null_installer_task extends \phpbb\install\task_base +{ + public function run() + { + + } + + static public function get_step_count() + { + return 0; + } + + public function get_task_lang_name() + { + return ''; + } +} diff --git a/tests/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php b/tests/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php index ec59fa3886..db31edc984 100644 --- a/tests/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php +++ b/tests/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -21,7 +25,7 @@ if (!class_exists('PDO')) */ class phpbb_database_connection_odbc_pdo_wrapper extends PDO { - // Name of the driver being used (i.e. mssql, firebird) + // Name of the driver being used (i.e. mssql) public $driver = ''; // Version number of driver since PDO::getAttribute(PDO::ATTR_CLIENT_VERSION) is pretty useless for this diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 4c2e9ff600..4d0460ebeb 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -17,6 +21,12 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test protected $fixture_xml_data; + static protected $schema_file; + + static protected $phpbb_schema_copy; + + static protected $install_schema_file; + public function __construct($name = NULL, array $data = array(), $dataName = '') { parent::__construct($name, $data, $dataName); @@ -34,6 +44,61 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $this->db_connections = array(); } + /** + * @return array List of extensions that should be set up + */ + static protected function setup_extensions() + { + return array(); + } + + static public function setUpBeforeClass() + { + global $phpbb_root_path, $phpEx; + + $setup_extensions = static::setup_extensions(); + + $finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path, null, $phpEx); + $finder->core_path('phpbb/db/migration/data/'); + if (!empty($setup_extensions)) + { + $finder->set_extensions($setup_extensions) + ->extension_directory('/migrations'); + } + $classes = $finder->get_classes(); + + $schema_sha1 = sha1(serialize($classes)); + self::$schema_file = __DIR__ . '/../tmp/' . $schema_sha1 . '.json'; + self::$install_schema_file = __DIR__ . '/../../phpBB/install/schemas/schema.json'; + + if (!file_exists(self::$schema_file)) + { + + global $table_prefix; + + $db = new \phpbb\db\driver\sqlite(); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db, true); + + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix); + file_put_contents(self::$schema_file, json_encode($schema_generator->get_schema())); + } + + copy(self::$schema_file, self::$install_schema_file); + + parent::setUpBeforeClass(); + } + + static public function tearDownAfterClass() + { + if (file_exists(self::$install_schema_file)) + { + unlink(self::$install_schema_file); + } + + parent::tearDownAfterClass(); + } + protected function tearDown() { parent::tearDown(); @@ -79,25 +144,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test public function createXMLDataSet($path) { - $db_config = $this->get_database_config(); - - // Firebird requires table and column names to be uppercase - if ($db_config['dbms'] == 'phpbb\db\driver\firebird') - { - $xml_data = file_get_contents($path); - $xml_data = preg_replace_callback('/(?:(<table name="))([a-z_]+)(?:(">))/', 'phpbb_database_test_case::to_upper', $xml_data); - $xml_data = preg_replace_callback('/(?:(<column>))([a-z_]+)(?:(<\/column>))/', 'phpbb_database_test_case::to_upper', $xml_data); - - $new_fixture = tmpfile(); - fwrite($new_fixture, $xml_data); - fseek($new_fixture, 0); - - $meta_data = stream_get_meta_data($new_fixture); - $path = $meta_data['uri']; - } - $this->fixture_xml_data = parent::createXMLDataSet($path); - return $this->fixture_xml_data; } @@ -138,7 +185,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test if (!self::$already_connected) { - $manager->load_schema(); + $manager->load_schema($this->new_dbal()); self::$already_connected = true; } @@ -147,8 +194,6 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test public function new_dbal() { - global $phpbb_root_path, $phpEx; - $config = $this->get_database_config(); $db = new $config['dbms'](); @@ -180,19 +225,6 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test return new phpbb_database_test_connection_manager($config); } - /** - * Converts a match in the middle of a string to uppercase. - * This is necessary for transforming the fixture information for Firebird tests - * - * @param $matches The array of matches from a regular expression - * - * @return string The string with the specified match converted to uppercase - */ - static public function to_upper($matches) - { - return $matches[1] . strtoupper($matches[2]) . $matches[3]; - } - public function assert_array_content_equals($one, $two) { // http://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index af9bd22662..fa50d89a70 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -1,19 +1,25 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_install.php'; require_once dirname(__FILE__) . '/phpbb_database_connection_odbc_pdo_wrapper.php'; class phpbb_database_test_connection_manager { + /** @var array */ private $config; + /** @var array */ private $dbms; + /** @var \PDO */ private $pdo; /** @@ -50,6 +56,7 @@ class phpbb_database_test_connection_manager switch ($this->dbms['PDO']) { case 'sqlite2': + case 'sqlite': // SQLite3 driver $dsn .= $this->config['dbhost']; break; @@ -108,7 +115,7 @@ class phpbb_database_test_connection_manager // These require different connection strings on the phpBB side than they do in PDO // so you must provide a DSN string for ODBC separately - if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb\db\driver\mssql' || $this->config['dbms'] == 'phpbb\db\driver\firebird')) + if (!empty($this->config['custom_dsn']) && $this->config['dbms'] == 'phpbb\db\driver\mssql') { $dsn = 'odbc:' . $this->config['custom_dsn']; } @@ -122,14 +129,6 @@ class phpbb_database_test_connection_manager $this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('mssql', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']); break; - case 'phpbb\db\driver\firebird': - if (!empty($this->config['custom_dsn'])) - { - $this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('firebird', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']); - break; - } - // Fall through if they're using the firebird PDO driver and not the generic ODBC driver - default: $this->pdo = new PDO($dsn, $this->config['dbuser'], $this->config['dbpasswd']); break; @@ -169,12 +168,12 @@ class phpbb_database_test_connection_manager /** * Load the phpBB database schema into the database */ - public function load_schema() + public function load_schema($db) { $this->ensure_connected(__METHOD__); $directory = dirname(__FILE__) . '/../../phpBB/install/schemas/'; - $this->load_schema_from_file($directory); + $this->load_schema_from_file($directory, $db); } /** @@ -188,7 +187,7 @@ class phpbb_database_test_connection_manager switch ($this->config['dbms']) { case 'phpbb\db\driver\sqlite': - case 'phpbb\db\driver\firebird': + case 'phpbb\db\driver\sqlite3': $this->connect(); // Drop all of the tables foreach ($this->get_tables() as $table) @@ -269,6 +268,13 @@ class phpbb_database_test_connection_manager WHERE type = "table"'; break; + case 'phpbb\db\driver\sqlite3': + $sql = 'SELECT name + FROM sqlite_master + WHERE type = "table" + AND name <> "sqlite_sequence"'; + break; + case 'phpbb\db\driver\mssql': case 'phpbb\db\driver\mssql_odbc': case 'phpbb\db\driver\mssqlnative': @@ -282,13 +288,6 @@ class phpbb_database_test_connection_manager FROM pg_stat_user_tables'; break; - case 'phpbb\db\driver\firebird': - $sql = 'SELECT rdb$relation_name - FROM rdb$relations - WHERE rdb$view_source is null - AND rdb$system_flag = 0'; - break; - case 'phpbb\db\driver\oracle': $sql = 'SELECT table_name FROM USER_TABLES'; @@ -321,7 +320,7 @@ class phpbb_database_test_connection_manager * Compile the correct schema filename (as per create_schema_files) and * load it into the database. */ - protected function load_schema_from_file($directory) + protected function load_schema_from_file($directory, \phpbb\db\driver\driver_interface $db) { $schema = $this->dbms['SCHEMA']; @@ -342,14 +341,68 @@ class phpbb_database_test_connection_manager $filename = $directory . $schema . '_schema.sql'; - $queries = file_get_contents($filename); - $sql = phpbb_remove_comments($queries); + if (file_exists($filename)) + { + global $phpbb_root_path; + + $queries = file_get_contents($filename); - $sql = split_sql_file($sql, $this->dbms['DELIM']); + $db_helper = new \phpbb\install\helper\database(new \phpbb\filesystem\filesystem(), $phpbb_root_path); + $sql = $db_helper->remove_comments($queries); + $sql = $db_helper->split_sql_file($sql, $this->dbms['DELIM']); - foreach ($sql as $query) + foreach ($sql as $query) + { + $this->pdo->exec($query); + } + } + + // Ok we have the db info go ahead and work on building the table + if (file_exists($directory . 'schema.json')) { - $this->pdo->exec($query); + $db_table_schema = file_get_contents($directory . 'schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + } + else + { + global $phpbb_root_path, $phpEx, $table_prefix; + + $finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path, null, $phpEx); + $classes = $finder->core_path('phpbb/db/migration/data/') + ->get_classes(); + + $db = new \phpbb\db\driver\sqlite(); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db, true); + + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix); + $db_table_schema = $schema_generator->get_schema(); + } + + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db, true); + foreach ($db_table_schema as $table_name => $table_data) + { + $queries = $db_tools->sql_create_table( + $table_name, + $table_data + ); + + foreach ($queries as $query) + { + if ($query === 'begin') + { + $this->pdo->beginTransaction(); + } + else if ($query === 'commit') + { + $this->pdo->commit(); + } + else + { + $this->pdo->exec($query); + } + } } } @@ -359,11 +412,6 @@ class phpbb_database_test_connection_manager protected function get_dbms_data($dbms) { $available_dbms = array( - 'phpbb\db\driver\firebird' => array( - 'SCHEMA' => 'firebird', - 'DELIM' => ';;', - 'PDO' => 'firebird', - ), 'phpbb\db\driver\mysqli' => array( 'SCHEMA' => 'mysql_41', 'DELIM' => ';', @@ -404,6 +452,11 @@ class phpbb_database_test_connection_manager 'DELIM' => ';', 'PDO' => 'sqlite2', ), + 'phpbb\db\driver\sqlite3' => array( + 'SCHEMA' => 'sqlite', + 'DELIM' => ';', + 'PDO' => 'sqlite', + ), ); if (isset($available_dbms[$dbms])) @@ -428,18 +481,6 @@ class phpbb_database_test_connection_manager switch ($this->config['dbms']) { - case 'phpbb\db\driver\firebird': - $sql = 'SELECT RDB$GENERATOR_NAME - FROM RDB$GENERATORS - WHERE RDB$SYSTEM_FLAG = 0'; - $result = $this->pdo->query($sql); - - while ($row = $result->fetch(PDO::FETCH_NUM)) - { - $queries[] = 'DROP GENERATOR ' . current($row); - } - break; - case 'phpbb\db\driver\oracle': $sql = 'SELECT sequence_name FROM USER_SEQUENCES'; @@ -591,6 +632,14 @@ class phpbb_database_test_connection_manager $queries[] = 'SELECT ' . implode(', ', $setval_queries); } break; + + case 'phpbb\db\driver\sqlite3': + /** + * Just delete all of the sequences. When an insertion occurs, the sequence will be automatically + * re-created from the key with the AUTOINCREMENT attribute + */ + $queries[] = 'DELETE FROM sqlite_sequence'; + break; } foreach ($queries as $query) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index e40efdec03..b91894f9c0 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -1,14 +1,18 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ use Symfony\Component\BrowserKit\CookieJar; -require_once __DIR__ . '/../../phpBB/includes/functions_install.php'; +require_once __DIR__ . '/mock/phpbb_mock_null_installer_task.php'; class phpbb_functional_test_case extends phpbb_test_case { @@ -34,6 +38,7 @@ class phpbb_functional_test_case extends phpbb_test_case static protected $config = array(); static protected $already_installed = false; + static protected $last_post_timestamp = 0; static public function setUpBeforeClass() { @@ -60,6 +65,14 @@ class phpbb_functional_test_case extends phpbb_test_case } } + /** + * @return array List of extensions that should be set up + */ + static protected function setup_extensions() + { + return array(); + } + public function setUp() { parent::setUp(); @@ -76,7 +89,34 @@ class phpbb_functional_test_case extends phpbb_test_case // that were added in other tests are gone $this->lang = array(); $this->add_lang('common'); - $this->purge_cache(); + + $db = $this->get_db(); + + foreach (static::setup_extensions() as $extension) + { + $sql = 'SELECT ext_active + FROM ' . EXT_TABLE . " + WHERE ext_name = '" . $db->sql_escape($extension). "'"; + $result = $db->sql_query($sql); + $status = (bool) $db->sql_fetchfield('ext_active'); + $db->sql_freeresult($result); + + if (!$status) + { + $this->install_ext($extension); + } + } + } + + protected function tearDown() + { + parent::tearDown(); + + if ($this->db instanceof \phpbb\db\driver\driver_interface) + { + // Close the database connections again this test + $this->db->sql_close(); + } } /** @@ -150,7 +190,7 @@ class phpbb_functional_test_case extends phpbb_test_case { global $phpbb_root_path, $phpEx; // so we don't reopen an open connection - if (!($this->db instanceof \phpbb\db\driver\driver)) + if (!($this->db instanceof \phpbb\db\driver\driver_interface)) { $dbms = self::$config['dbms']; $this->db = new $dbms(); @@ -163,6 +203,11 @@ class phpbb_functional_test_case extends phpbb_test_case { if (!$this->cache) { + global $phpbb_container; + + $phpbb_container = new phpbb_mock_container_builder(); + $phpbb_container->setParameter('core.environment', PHPBB_ENVIRONMENT); + $this->cache = new \phpbb\cache\driver\file; } @@ -184,30 +229,33 @@ class phpbb_functional_test_case extends phpbb_test_case $config = new \phpbb\config\config(array()); $db = $this->get_db(); - $db_tools = new \phpbb\db\tools($db); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db); + $container = new phpbb_mock_container_builder(); $migrator = new \phpbb\db\migrator( + $container, $config, $db, $db_tools, self::$config['table_prefix'] . 'migrations', $phpbb_root_path, - $php_ext, + $phpEx, self::$config['table_prefix'], array(), new \phpbb\db\migration\helper() ); - $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); + $container->set('dispatcher', new phpbb_mock_event_dispatcher()); $extension_manager = new \phpbb\extension\manager( $container, $db, $config, - new phpbb\filesystem(), + new phpbb\filesystem\filesystem(), self::$config['table_prefix'] . 'ext', dirname(__FILE__) . '/', - $php_ext, + $phpEx, $this->get_cache_driver() ); @@ -236,120 +284,128 @@ class phpbb_functional_test_case extends phpbb_test_case } } - self::$cookieJar = new CookieJar; - self::$client = new Goutte\Client(array(), null, self::$cookieJar); - // Set client manually so we can increase the cURL timeout - self::$client->setClient(new Guzzle\Http\Client('', array( - Guzzle\Http\Client::DISABLE_REDIRECTS => true, - 'curl.options' => array( - CURLOPT_TIMEOUT => 120, - ), - ))); - - // Reset the curl handle because it is 0 at this point and not a valid - // resource - self::$client->getClient()->getCurlMulti()->reset(true); + $container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $container = $container_builder + ->with_environment('installer') + ->without_extensions() + ->without_cache() + ->with_custom_parameters([ + 'core.disable_super_globals' => false, + 'installer.create_config_file.options' => [ + 'debug' => true, + 'environment' => 'test', + ], + 'cache.driver.class' => 'phpbb\cache\driver\file' + ]) + ->without_compiled_container() + ->get_container(); + + $container->register('installer.install_finish.notify_user')->setSynthetic(true); + $container->set('installer.install_finish.notify_user', new phpbb_mock_null_installer_task()); + $container->compile(); + + $language = $container->get('language'); + $language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + + $iohandler_factory = $container->get('installer.helper.iohandler_factory'); + $iohandler_factory->set_environment('cli'); + $iohandler = $iohandler_factory->get(); $parseURL = parse_url(self::$config['phpbb_functional_url']); - $crawler = self::request('GET', 'install/index.php?mode=install'); - self::assertContains('Welcome to Installation', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); + $output = new \Symfony\Component\Console\Output\NullOutput(); + $style = new \Symfony\Component\Console\Style\SymfonyStyle( + new \Symfony\Component\Console\Input\ArrayInput(array()), + $output + ); + $iohandler->set_style($style, $output); + + $installer = $container->get('installer.installer.install'); + $installer->set_iohandler($iohandler); + + // Set data + $iohandler->set_input('admin_name', 'admin'); + $iohandler->set_input('admin_pass1', 'adminadmin'); + $iohandler->set_input('admin_pass2', 'adminadmin'); + $iohandler->set_input('board_email', 'nobody@example.com'); + $iohandler->set_input('submit_admin', 'submit'); + + $iohandler->set_input('default_lang', 'en'); + $iohandler->set_input('board_name', 'yourdomain.com'); + $iohandler->set_input('board_description', 'A short text to describe your forum'); + $iohandler->set_input('submit_board', 'submit'); + + $iohandler->set_input('dbms', str_replace('phpbb\db\driver\\', '', self::$config['dbms'])); + $iohandler->set_input('dbhost', self::$config['dbhost']); + $iohandler->set_input('dbport', self::$config['dbport']); + $iohandler->set_input('dbuser', self::$config['dbuser']); + $iohandler->set_input('dbpasswd', self::$config['dbpasswd']); + $iohandler->set_input('dbname', self::$config['dbname']); + $iohandler->set_input('table_prefix', self::$config['table_prefix']); + $iohandler->set_input('submit_database', 'submit'); + + $iohandler->set_input('email_enable', true); + $iohandler->set_input('smtp_delivery', '1'); + $iohandler->set_input('smtp_host', 'nxdomain.phpbb.com'); + $iohandler->set_input('smtp_auth', 'PLAIN'); + $iohandler->set_input('smtp_user', 'nxuser'); + $iohandler->set_input('smtp_pass', 'nxpass'); + $iohandler->set_input('submit_email', 'submit'); + + $iohandler->set_input('cookie_secure', '0'); + $iohandler->set_input('server_protocol', '0'); + $iohandler->set_input('force_server_vars', $parseURL['scheme'] . '://'); + $iohandler->set_input('server_name', $parseURL['host']); + $iohandler->set_input('server_port', isset($parseURL['port']) ? (int) $parseURL['port'] : 80); + $iohandler->set_input('script_path', $parseURL['path']); + $iohandler->set_input('submit_server', 'submit'); + + do + { + $installer->run(); + } + while (file_exists($phpbb_root_path . 'store/install_config.php')); - // install/index.php?mode=install&sub=requirements - $crawler = self::submit($form); - self::assertContains('Installation compatibility', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); + copy($config_file, $config_file_test); - // install/index.php?mode=install&sub=database - $crawler = self::submit($form); - self::assertContains('Database configuration', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - // Installer uses 3.0-style dbms name - 'dbms' => str_replace('phpbb\db\driver\\', '', self::$config['dbms']), - 'dbhost' => self::$config['dbhost'], - 'dbport' => self::$config['dbport'], - 'dbname' => self::$config['dbname'], - 'dbuser' => self::$config['dbuser'], - 'dbpasswd' => self::$config['dbpasswd'], - 'table_prefix' => self::$config['table_prefix'], - )); + if (file_exists($phpbb_root_path . 'cache/install_lock')) + { + unlink($phpbb_root_path . 'cache/install_lock'); + } - // install/index.php?mode=install&sub=database - $crawler = self::submit($form); - self::assertContains('Successful connection', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); + global $phpbb_container, $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log, $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template; + $phpbb_container->reset(); + unset($phpbb_container, $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log, $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template); + } - // install/index.php?mode=install&sub=administrator - $crawler = self::submit($form); - self::assertContains('Administrator configuration', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - 'default_lang' => 'en', - 'admin_name' => 'admin', - 'admin_pass1' => 'adminadmin', - 'admin_pass2' => 'adminadmin', - 'board_email' => 'nobody@example.com', - )); + public function install_ext($extension) + { + $this->login(); + $this->admin_login(); + + $ext_path = str_replace('/', '%2F', $extension); + + $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid); + $this->assertGreaterThan(0, $crawler->filter('.submit-buttons')->count()); - // install/index.php?mode=install&sub=administrator + $form = $crawler->selectButton('Enable')->form(); $crawler = self::submit($form); - self::assertContains('Tests passed', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // We have to skip install/index.php?mode=install&sub=config_file - // because that step will create a config.php file if phpBB has the - // permission to do so. We have to create the config file on our own - // in order to get the DEBUG constants defined. - $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, true); - $config_created = file_put_contents($config_file, $config_php_data) !== false; - if (!$config_created) - { - self::markTestSkipped("Could not write $config_file file."); - } + $this->add_lang('acp/extensions'); + + $meta_refresh = $crawler->filter('meta[http-equiv="refresh"]'); - // We also have to create a install lock that is normally created by - // the installer. The file will be removed by the final step of the - // installer. - $install_lock_file = $phpbb_root_path . 'cache/install_lock'; - $lock_created = file_put_contents($install_lock_file, '') !== false; - if (!$lock_created) + // Wait for extension to be fully enabled + while (sizeof($meta_refresh)) { - self::markTestSkipped("Could not create $lock_created file."); + preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match); + $url = $match[1]; + $crawler = self::request('POST', $url); + $meta_refresh = $crawler->filter('meta[http-equiv="refresh"]'); } - @chmod($install_lock_file, 0666); - - // install/index.php?mode=install&sub=advanced - $form_data = $form->getValues(); - unset($form_data['submit']); - - $crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data); - self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(array( - 'email_enable' => true, - 'smtp_delivery' => true, - 'smtp_host' => 'nxdomain.phpbb.com', - 'smtp_auth' => 'PLAIN', - 'smtp_user' => 'nxuser', - 'smtp_pass' => 'nxpass', - 'cookie_secure' => false, - 'force_server_vars' => false, - 'server_protocol' => $parseURL['scheme'] . '://', - 'server_name' => 'localhost', - 'server_port' => isset($parseURL['port']) ? (int) $parseURL['port'] : 80, - 'script_path' => $parseURL['path'], - )); - - // install/index.php?mode=install&sub=create_table - $crawler = self::submit($form); - self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text()); - self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - // install/index.php?mode=install&sub=final - $crawler = self::submit($form); - self::assertContains('You have successfully installed', $crawler->text()); + $this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('div.successbox')->text()); - copy($config_file, $config_file_test); + $this->logout(); } static private function recreate_database($config) @@ -414,7 +470,7 @@ class phpbb_functional_test_case extends phpbb_test_case )); $db->sql_query($sql); - if ($style_path != 'prosilver' && $style_path != 'subsilver2') + if ($style_path != 'prosilver') { @mkdir($phpbb_root_path . 'styles/' . $style_path, 0777); @mkdir($phpbb_root_path . 'styles/' . $style_path . '/template', 0777); @@ -422,7 +478,7 @@ class phpbb_functional_test_case extends phpbb_test_case } else { - $db->sql_multi_insert(STYLES_TABLE, array( + $db->sql_multi_insert(STYLES_TABLE, array(array( 'style_id' => $style_id, 'style_name' => $style_path, 'style_copyright' => '', @@ -431,7 +487,7 @@ class phpbb_functional_test_case extends phpbb_test_case 'bbcode_bitfield' => 'kNg=', 'style_parent_id' => $parent_style_id, 'style_parent_tree' => $parent_style_path, - )); + ))); } } @@ -453,7 +509,7 @@ class phpbb_functional_test_case extends phpbb_test_case $db->sql_query('DELETE FROM ' . STYLES_TEMPLATE_TABLE . ' WHERE template_id = ' . $style_id); $db->sql_query('DELETE FROM ' . STYLES_THEME_TABLE . ' WHERE theme_id = ' . $style_id); - if ($style_path != 'prosilver' && $style_path != 'subsilver2') + if ($style_path != 'prosilver') { @rmdir($phpbb_root_path . 'styles/' . $style_path . '/template'); @rmdir($phpbb_root_path . 'styles/' . $style_path); @@ -473,6 +529,16 @@ class phpbb_functional_test_case extends phpbb_test_case global $config; $config = new \phpbb\config\config(array()); + + /* + * Add required config entries to the config array to prevent + * set_config() sending an INSERT query for already existing entries, + * resulting in a SQL error. + * This is because set_config() first sends an UPDATE query, then checks + * sql_affectedrows() which can be 0 (e.g. on MySQL) when the new + * data is already there. + */ + $config['newest_user_colour'] = ''; $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; @@ -485,13 +551,11 @@ class phpbb_functional_test_case extends phpbb_test_case } $cache = new phpbb_mock_null_cache; - $cache_driver = new \phpbb\cache\driver\null(); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $phpbb_container - ->expects($this->any()) - ->method('get') - ->with('cache.driver') - ->will($this->returnValue($cache_driver)); + $cache_driver = new \phpbb\cache\driver\dummy(); + $phpbb_container = new phpbb_mock_container_builder(); + $phpbb_container->set('cache.driver', $cache_driver); + $phpbb_notifications = new phpbb_mock_notification_manager(); + $phpbb_container->set('notification_manager', $phpbb_notifications); if (!function_exists('utf_clean_string')) { @@ -501,8 +565,7 @@ class phpbb_functional_test_case extends phpbb_test_case { require_once(__DIR__ . '/../../phpBB/includes/functions_user.php'); } - set_config(null, null, null, $config); - set_config_count(null, null, null, $config); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $passwords_manager = $this->get_passwords_manager(); @@ -512,8 +575,8 @@ class phpbb_functional_test_case extends phpbb_test_case 'user_email' => 'nobody@example.com', 'user_type' => 0, 'user_lang' => 'en', - 'user_timezone' => 0, - 'user_dateformat' => '', + 'user_timezone' => 'UTC', + 'user_dateformat' => 'r', 'user_password' => $passwords_manager->hash($username . $username), ); return user_add($user_row); @@ -528,13 +591,16 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user'); + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); $auth = $this->getMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; - $cache_driver = new \phpbb\cache\driver\null(); + $cache_driver = new \phpbb\cache\driver\dummy(); $phpbb_container = new phpbb_mock_container_builder(); $phpbb_container->set('cache.driver', $cache_driver); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); @@ -567,13 +633,16 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user'); + $user = $this->getMock('\phpbb\user', array(), array( + new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + )); $auth = $this->getMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; - $cache_driver = new \phpbb\cache\driver\null(); + $cache_driver = new \phpbb\cache\driver\dummy(); $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) @@ -698,6 +767,30 @@ class phpbb_functional_test_case extends phpbb_test_case $this->lang = array_merge($this->lang, $lang); } + protected function add_lang_ext($ext_name, $lang_file) + { + if (is_array($lang_file)) + { + foreach ($lang_file as $file) + { + $this->add_lang_ext($ext_name, $file); + } + + return; + } + + $lang_path = __DIR__ . "/../../phpBB/ext/{$ext_name}/language/en/$lang_file.php"; + + $lang = array(); + + if (file_exists($lang_path)) + { + include($lang_path); + } + + $this->lang = array_merge($this->lang, $lang); + } + protected function lang() { $args = func_get_args(); @@ -716,15 +809,27 @@ class phpbb_functional_test_case extends phpbb_test_case /** * assertContains for language strings * - * @param string $needle Search string - * @param string $haystack Search this - * @param string $message Optional failure message + * @param string $needle Search string + * @param string $haystack Search this + * @param string $message Optional failure message */ public function assertContainsLang($needle, $haystack, $message = null) { $this->assertContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message); } + /** + * assertNotContains for language strings + * + * @param string $needle Search string + * @param string $haystack Search this + * @param string $message Optional failure message + */ + public function assertNotContainsLang($needle, $haystack, $message = null) + { + $this->assertNotContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message); + } + /* * Perform some basic assertions for the page * @@ -735,15 +840,15 @@ class phpbb_functional_test_case extends phpbb_test_case */ static public function assert_response_html($status_code = 200) { - if ($status_code !== false) - { - self::assert_response_status_code($status_code); - } - // Any output before the doc type means there was an error $content = self::$client->getResponse()->getContent(); self::assertNotContains('[phpBB Debug]', $content); self::assertStringStartsWith('<!DOCTYPE', trim($content), 'Output found before DOCTYPE specification.'); + + if ($status_code !== false) + { + self::assert_response_status_code($status_code); + } } /* @@ -756,15 +861,15 @@ class phpbb_functional_test_case extends phpbb_test_case */ static public function assert_response_xml($status_code = 200) { - if ($status_code !== false) - { - self::assert_response_status_code($status_code); - } - // Any output before the xml opening means there was an error $content = self::$client->getResponse()->getContent(); self::assertNotContains('[phpBB Debug]', $content); self::assertStringStartsWith('<?xml', trim($content), 'Output found before XML specification.'); + + if ($status_code !== false) + { + self::assert_response_status_code($status_code); + } } /** @@ -778,7 +883,7 @@ class phpbb_functional_test_case extends phpbb_test_case */ static public function assert_response_status_code($status_code = 200) { - self::assertEquals($status_code, self::$client->getResponse()->getStatus()); + self::assertEquals($status_code, self::$client->getResponse()->getStatus(), 'HTTP status code does not match'); } public function assert_filter($crawler, $expr, $msg = null) @@ -828,8 +933,7 @@ class phpbb_functional_test_case extends phpbb_test_case */ public function assert_checkbox_is_unchecked($crawler, $name, $message = '') { - $this->assertSame( - '', + $this->assertNull( $this->assert_find_one_checkbox($crawler, $name)->attr('checked'), $message ?: "Failed asserting that checkbox $name is unchecked." ); @@ -871,9 +975,9 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request * @param string $expected Lang var of expected message after posting - * @return array|null post_id, topic_id if message is 'POST_STORED' + * @return array|null post_id, topic_id if message is empty */ - public function create_topic($forum_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED') + public function create_topic($forum_id, $subject, $message, $additional_form_data = array(), $expected = '') { $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; @@ -897,9 +1001,9 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $message * @param array $additional_form_data Any additional form data to be sent in the request * @param string $expected Lang var of expected message after posting - * @return array|null post_id, topic_id if message is 'POST_STORED' + * @return array|null post_id, topic_id if message is empty */ - public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = 'POST_STORED') + public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array(), $expected = '') { $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; @@ -919,12 +1023,88 @@ class phpbb_functional_test_case extends phpbb_test_case * @param string $posting_contains * @param array $form_data * @param string $expected Lang var of expected message after posting - * @return array|null post_id, topic_id if message is 'POST_STORED' + * @return array|null post_id, topic_id if message is empty */ - protected function submit_post($posting_url, $posting_contains, $form_data, $expected = 'POST_STORED') + protected function submit_post($posting_url, $posting_contains, $form_data, $expected = '') { $this->add_lang('posting'); + $crawler = $this->submit_message($posting_url, $posting_contains, $form_data); + + if ($expected !== '') + { + if (isset($this->lang[$expected])) + { + $this->assertContainsLang($expected, $crawler->filter('html')->text()); + } + else + { + $this->assertContains($expected, $crawler->filter('html')->text()); + } + return null; + } + + $url = $crawler->selectLink($form_data['subject'])->link()->getUri(); + + return array( + 'topic_id' => $this->get_parameter_from_link($url, 't'), + 'post_id' => $this->get_parameter_from_link($url, 'p'), + ); + } + + /** + * Creates a private message + * + * Be sure to login before creating + * + * @param string $subject + * @param string $message + * @param array $to + * @param array $additional_form_data Any additional form data to be sent in the request + * @return int private_message_id + */ + public function create_private_message($subject, $message, $to, $additional_form_data = array()) + { + $this->add_lang(array('ucp', 'posting')); + + $posting_url = "ucp.php?i=pm&mode=compose&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + foreach ($to as $user_id) + { + $form_data['address_list[u][' . $user_id . ']'] = 'to'; + } + + $crawler = self::submit_message($posting_url, 'POST_NEW_PM', $form_data); + + $this->assertContains($this->lang('MESSAGE_STORED'), $crawler->filter('html')->text()); + $url = $crawler->selectLink($this->lang('VIEW_PRIVATE_MESSAGE', '', ''))->link()->getUri(); + + return $this->get_parameter_from_link($url, 'p'); + } + + /** + * Helper for submitting a message (post or private message) + * + * @param string $posting_url + * @param string $posting_contains + * @param array $form_data + * @return \Symfony\Component\DomCrawler\Crawler the crawler object + */ + protected function submit_message($posting_url, $posting_contains, $form_data) + { + if (time() == self::$last_post_timestamp) + { + // Travis is too fast, so we have to wait to not mix up the post/topic order + sleep(1); + } + self::$last_post_timestamp = time(); + $crawler = self::request('GET', $posting_url); $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); @@ -966,19 +1146,49 @@ class phpbb_functional_test_case extends phpbb_test_case // I use a request because the form submission method does not allow you to send data that is not // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) // Instead, I send it as a request with the submit button "post" set to true. - $crawler = self::request('POST', $posting_url, $form_data); - $this->assertContainsLang($expected, $crawler->filter('html')->text()); + return self::request('POST', $posting_url, $form_data); + } - if ($expected !== 'POST_STORED') - { - return; - } - $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); + /** + * Deletes a topic + * + * Be sure to login before creating + * + * @param int $topic_id + * @return null + */ + public function delete_topic($topic_id) + { + $this->add_lang('posting'); + $crawler = $this->get_quickmod_page($topic_id, 'DELETE_TOPIC'); + $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); - return array( - 'topic_id' => $this->get_parameter_from_link($url, 't'), - 'post_id' => $this->get_parameter_from_link($url, 'p'), - ); + $this->add_lang('mcp'); + $form = $crawler->selectButton('Yes')->form(); + $form['delete_permanent'] = 1; + $crawler = self::submit($form); + $this->assertContainsLang('TOPIC_DELETED_SUCCESS', $crawler->text()); + } + + /** + * Deletes a post + * + * Be sure to login before creating + * + * @param int $forum_id + * @param int $topic_id + * @return null + */ + public function delete_post($forum_id, $post_id) + { + $this->add_lang('posting'); + $crawler = self::request('GET', "posting.php?mode=delete&f={$forum_id}&p={$post_id}&sid={$this->sid}"); + $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); + + $form = $crawler->selectButton('Yes')->form(); + $form['delete_permanent'] = 1; + $crawler = self::submit($form); + $this->assertContainsLang('POST_DELETED', $crawler->text()); } /** @@ -1041,4 +1251,25 @@ class phpbb_functional_test_case extends phpbb_test_case return $manager; } + + /** + * Get quickmod page + * + * @param int $topic_id + * @param string $action Language key for the quickmod action + * @param Symfony\Component\DomCrawler\Crawler Optional crawler object to use instead of creating new one. + * @return Symfony\Component\DomCrawler\Crawler + */ + public function get_quickmod_page($topic_id, $action, $crawler = false) + { + $this->add_lang('viewtopic'); + + if ($crawler === false) + { + $crawler = self::request('GET', "viewtopic.php?t={$topic_id}&sid={$this->sid}"); + } + $link = $crawler->filter('#quickmod')->selectLink($this->lang($action))->link()->getUri(); + + return self::request('GET', substr($link, strpos($link, 'mcp.'))); + } } diff --git a/tests/test_framework/phpbb_search_test_case.php b/tests/test_framework/phpbb_search_test_case.php index b929e740ea..b37ed1d039 100644 --- a/tests/test_framework/phpbb_search_test_case.php +++ b/tests/test_framework/phpbb_search_test_case.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index 0a2f767845..1c1930e88d 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -1,19 +1,29 @@ <?php /** - * - * @package testing - * @copyright (c) 2013 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../session/testable_factory.php'; require_once dirname(__FILE__) . '/../session/testable_facade.php'; abstract class phpbb_session_test_case extends phpbb_database_test_case { + /** @var phpbb_session_testable_factory */ protected $session_factory; + + /** @var phpbb_session_testable_facade */ protected $session_facade; + + /** @var \phpbb\db\driver\driver_interface */ protected $db; function setUp() @@ -24,10 +34,11 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $symfony_request = new \phpbb\symfony_request( new phpbb_mock_request() ); - $phpbb_filesystem = new \phpbb\filesystem(); + $phpbb_filesystem = new \phpbb\filesystem\filesystem(); $phpbb_path_helper = new \phpbb\path_helper( $symfony_request, $phpbb_filesystem, + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php index 8b16f02638..01d26fb67d 100644 --- a/tests/test_framework/phpbb_test_case.php +++ b/tests/test_framework/phpbb_test_case.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -22,7 +26,7 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase 'PHP_Token_Stream' => array('customTokens'), 'PHP_Token_Stream_CachingFactory' => array('cache'), - 'phpbb_database_test_case' => array('already_connected'), + 'phpbb_database_test_case' => array('already_connected', 'last_post_timestamp'), ); } diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 2f225fe7af..c4b653ec7c 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -1,12 +1,18 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +use Symfony\Component\DependencyInjection\ContainerInterface; + class phpbb_test_case_helpers { protected $expectedTriggerError = false; @@ -104,7 +110,19 @@ class phpbb_test_case_helpers { $config = array(); - if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) + + if (extension_loaded('sqlite3')) + { + $config = array_merge($config, array( + 'dbms' => 'phpbb\db\driver\sqlite3', + 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite3', // filename + 'dbport' => '', + 'dbname' => '', + 'dbuser' => '', + 'dbpasswd' => '', + )); + } + else if (extension_loaded('sqlite')) { $config = array_merge($config, array( 'dbms' => 'phpbb\db\driver\sqlite', @@ -126,17 +144,15 @@ class phpbb_test_case_helpers $test_config = dirname(__FILE__) . '/../test_config.php'; } + $config_php_file = new \phpbb\config_php_file('', ''); + if (file_exists($test_config)) { - include($test_config); - - if (!function_exists('phpbb_convert_30_dbms_to_31')) - { - require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - } + $config_php_file->set_config_file($test_config); + extract($config_php_file->get_all()); $config = array_merge($config, array( - 'dbms' => phpbb_convert_30_dbms_to_31($dbms), + 'dbms' => $config_php_file->convert_30_dbms_to_31($dbms), 'dbhost' => $dbhost, 'dbport' => $dbport, 'dbname' => $dbname, @@ -167,13 +183,8 @@ class phpbb_test_case_helpers if (isset($_SERVER['PHPBB_TEST_DBMS'])) { - if (!function_exists('phpbb_convert_30_dbms_to_31')) - { - require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - } - $config = array_merge($config, array( - 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? phpbb_convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '', + 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $config_php_file->convert_30_dbms_to_31($_SERVER['PHPBB_TEST_DBMS']) : '', 'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '', 'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '', 'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '', @@ -289,4 +300,295 @@ class phpbb_test_case_helpers } } } + + /** + * Set working instances of the text_formatter.* services + * + * If no container is passed, the global $phpbb_container will be used and/or + * created if applicable + * + * @param ContainerInterface $container Service container + * @param string $fixture Path to the XML fixture + * @param string $styles_path Path to the styles dir + * @return ContainerInterface + */ + public function set_s9e_services(ContainerInterface $container = null, $fixture = null, $styles_path = null) + { + static $first_run; + global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $request, $user; + + $cache_dir = __DIR__ . '/../tmp/'; + + // Remove old cache files on first run + if (!isset($first_run)) + { + $first_run = 1; + + array_map('unlink', array_merge( + glob($cache_dir . 'data_s9e_*'), + glob($cache_dir . 's9e_*') + )); + } + + if (!isset($container)) + { + if (!isset($phpbb_container)) + { + $phpbb_container = new phpbb_mock_container_builder; + } + + $container = $phpbb_container; + } + + if (!isset($fixture)) + { + $fixture = __DIR__ . '/../text_formatter/s9e/fixtures/default_formatting.xml'; + } + + if (!isset($styles_path)) + { + $styles_path = $phpbb_root_path . 'styles/'; + } + + $dataset = new DOMDocument; + $dataset->load($fixture); + + $tables = array( + 'phpbb_bbcodes' => array(), + 'phpbb_smilies' => array(), + 'phpbb_styles' => array(), + 'phpbb_words' => array() + ); + foreach ($dataset->getElementsByTagName('table') as $table) + { + $name = $table->getAttribute('name'); + $columns = array(); + + foreach ($table->getElementsByTagName('column') as $column) + { + $columns[] = $column->textContent; + } + + foreach ($table->getElementsByTagName('row') as $row) + { + $values = array(); + + foreach ($row->getElementsByTagName('value') as $value) + { + $values[] = $value->textContent; + } + + $tables[$name][] = array_combine($columns, $values); + } + } + + // Set up a default style if there's none set + if (empty($tables['phpbb_styles'])) + { + $tables['phpbb_styles'][] = array( + 'style_id' => 1, + 'style_path' => 'prosilver', + 'bbcode_bitfield' => 'kNg=' + ); + } + + // Mock the DAL, make it return data from the fixture + $mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access'); + $mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles')); + $mb->setConstructorArgs(array( + $this->test_case->getMock('phpbb\\db\\driver\\driver'), + 'phpbb_bbcodes', + 'phpbb_smilies', + 'phpbb_styles', + 'phpbb_words', + $styles_path + )); + + $dal = $mb->getMock(); + $container->set('text_formatter.data_access', $dal); + + $dal->expects($this->test_case->any()) + ->method('get_bbcodes') + ->will($this->test_case->returnValue($tables['phpbb_bbcodes'])); + $dal->expects($this->test_case->any()) + ->method('get_smilies') + ->will($this->test_case->returnValue($tables['phpbb_smilies'])); + $dal->expects($this->test_case->any()) + ->method('get_styles') + ->will($this->test_case->returnValue($tables['phpbb_styles'])); + $dal->expects($this->test_case->any()) + ->method('get_censored_words') + ->will($this->test_case->returnValue($tables['phpbb_words'])); + + // Cache the parser and renderer with a key based on this method's arguments + $cache = new \phpbb\cache\driver\file($cache_dir); + $prefix = '_s9e_' . md5(serialize(func_get_args())); + $cache_key_parser = $prefix . '_parser'; + $cache_key_renderer = $prefix . '_renderer'; + $container->set('cache.driver', $cache); + + if (!$container->isFrozen()) + { + $container->setParameter('cache.dir', $cache_dir); + } + + // Create a path_helper + if (!$container->has('path_helper') || $container->getDefinition('path_helper')->isSynthetic()) + { + $path_helper = $this->test_case->getMockBuilder('phpbb\\path_helper') + ->disableOriginalConstructor() + ->setMethods(array('get_web_root_path')) + ->getMock(); + $path_helper->expects($this->test_case->any()) + ->method('get_web_root_path') + ->will($this->test_case->returnValue('phpBB/')); + + $container->set('path_helper', $path_helper); + } + else + { + $path_helper = $container->get('path_helper'); + } + + // Create an event dispatcher + if ($container->has('dispatcher')) + { + $dispatcher = $container->get('dispatcher'); + } + else if (isset($phpbb_dispatcher)) + { + $dispatcher = $phpbb_dispatcher; + } + else + { + $dispatcher = new phpbb_mock_event_dispatcher; + } + if (!isset($phpbb_dispatcher)) + { + $phpbb_dispatcher = $dispatcher; + } + + // Set up the a minimum config + if ($container->has('config')) + { + $config = $container->get('config'); + } + elseif (!isset($config)) + { + $config = new \phpbb\config\config(array()); + } + $default_config = array( + 'allow_nocensors' => false, + 'allowed_schemes_links' => 'http,https,ftp', + 'script_path' => '/phpbb', + 'server_name' => 'localhost', + 'server_port' => 80, + 'server_protocol' => 'http://', + 'smilies_path' => 'images/smilies', + ); + foreach ($default_config as $config_name => $config_value) + { + if (!isset($config[$config_name])) + { + $config[$config_name] = $config_value; + } + } + + // Create a fake request + if (!isset($request)) + { + $request = new phpbb_mock_request; + } + + // Create and register the text_formatter.s9e.factory service + $factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, new \phpbb\textformatter\s9e\link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer); + $container->set('text_formatter.s9e.factory', $factory); + + // Create a user if none was provided, and add the common lang strings + if ($container->has('user')) + { + $user = $container->get('user'); + } + else + { + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + + $user = $this->test_case->getMockBuilder('\phpbb\user') + ->setConstructorArgs(array($lang, '\phpbb\datetime')) + ->setMethods(array('format_date')) + ->getMock(); + $user->expects($this->test_case->any()) + ->method('format_date') + ->will($this->test_case->returnCallback(__CLASS__ . '::format_date')); + + $user->date_format = 'Y-m-d H:i:s'; + $user->optionset('viewcensors', true); + $user->optionset('viewflash', true); + $user->optionset('viewimg', true); + $user->optionset('viewsmilies', true); + $user->timezone = new \DateTimeZone('UTC'); + $container->set('user', $user); + } + $user->add_lang('common'); + + if (!isset($user->style)) + { + $user->style = array('style_id' => 1); + } + + // Create and register a quote_helper + $quote_helper = new \phpbb\textformatter\s9e\quote_helper( + $container->get('user'), + $phpbb_root_path, + $phpEx + ); + $container->set('text_formatter.s9e.quote_helper', $quote_helper); + + // Create and register the text_formatter.s9e.parser service and its alias + $parser = new \phpbb\textformatter\s9e\parser( + $cache, + $cache_key_parser, + $factory, + $dispatcher + ); + $container->set('text_formatter.parser', $parser); + $container->set('text_formatter.s9e.parser', $parser); + + // Create and register the text_formatter.s9e.renderer service and its alias + $renderer = new \phpbb\textformatter\s9e\renderer( + $cache, + $cache_dir, + $cache_key_renderer, + $factory, + $dispatcher + ); + + // Calls configured in services.yml + $auth = ($container->has('auth')) ? $container->get('auth') : new \phpbb\auth\auth; + $renderer->configure_quote_helper($quote_helper); + $renderer->configure_smilies_path($config, $path_helper); + $renderer->configure_user($user, $config, $auth); + + $container->set('text_formatter.renderer', $renderer); + $container->set('text_formatter.s9e.renderer', $renderer); + + // Create and register the text_formatter.s9e.utils service and its alias + $utils = new \phpbb\textformatter\s9e\utils; + $container->set('text_formatter.utils', $utils); + $container->set('text_formatter.s9e.utils', $utils); + + return $container; + } + + /** + * Mocked replacement for \phpbb\user::format_date() + * + * @param integer $gmepoch unix timestamp + * @return string + */ + static public function format_date($gmepoch) + { + return gmdate('Y-m-d H:i:s', $gmepoch); + } } diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php new file mode 100644 index 0000000000..e118801972 --- /dev/null +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -0,0 +1,214 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/mock/phpbb_mock_null_installer_task.php'; + +class phpbb_ui_test_case extends phpbb_test_case +{ + static protected $host = '127.0.0.1'; + static protected $port = 8910; + + /** + * @var \RemoteWebDriver + */ + static protected $webDriver; + + static protected $config; + static protected $root_url; + static protected $already_installed = false; + + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + if (version_compare(PHP_VERSION, '5.3.19', '<')) + { + self::markTestSkipped('UI test case requires at least PHP 5.3.19.'); + } + else if (!class_exists('\RemoteWebDriver')) + { + self::markTestSkipped( + 'Could not find RemoteWebDriver class. ' . + 'Run "php ../composer.phar install" from the tests folder.' + ); + } + + self::$config = phpbb_test_case_helpers::get_test_config(); + self::$root_url = self::$config['phpbb_functional_url']; + + // Important: this is used both for installation and by + // test cases for querying the tables. + // Therefore table prefix must be set before a board is + // installed, and also before each test case is run. + self::$config['table_prefix'] = 'phpbb_'; + + if (!isset(self::$config['phpbb_functional_url'])) + { + self::markTestSkipped('phpbb_functional_url was not set in test_config and wasn\'t set as PHPBB_FUNCTIONAL_URL environment variable either.'); + } + + if (!self::$webDriver) + { + try { + $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'firefox'); + self::$webDriver = RemoteWebDriver::create(self::$host . ':' . self::$port, $capabilities); + } catch (WebDriverCurlException $e) { + self::markTestSkipped('PhantomJS webserver is not running.'); + } + } + + if (!self::$already_installed) + { + self::install_board(); + self::$already_installed = true; + } + } + + static public function visit($path) + { + self::$webDriver->get(self::$root_url . $path); + } + + static protected function recreate_database($config) + { + $db_conn_mgr = new phpbb_database_test_connection_manager($config); + $db_conn_mgr->recreate_db(); + } + + static public function find_element($type, $value) + { + return self::$webDriver->findElement(WebDriverBy::$type($value)); + } + + static public function submit($type = 'id', $value = 'submit') + { + $element = self::find_element($type, $value); + $element->click(); + } + + static public function install_board() + { + global $phpbb_root_path, $phpEx; + + self::recreate_database(self::$config); + + $config_file = $phpbb_root_path . "config.$phpEx"; + $config_file_dev = $phpbb_root_path . "config_dev.$phpEx"; + $config_file_test = $phpbb_root_path . "config_test.$phpEx"; + + if (file_exists($config_file)) + { + if (!file_exists($config_file_dev)) + { + rename($config_file, $config_file_dev); + } + else + { + unlink($config_file); + } + } + + $container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $container = $container_builder + ->with_environment('installer') + ->without_extensions() + ->without_cache() + ->with_custom_parameters([ + 'core.disable_super_globals' => false, + 'installer.create_config_file.options' => [ + 'debug' => true, + 'environment' => 'test', + ], + 'cache.driver.class' => 'phpbb\cache\driver\file' + ]) + ->without_compiled_container() + ->get_container(); + + $container->register('installer.install_finish.notify_user')->setSynthetic(true); + $container->set('installer.install_finish.notify_user', new phpbb_mock_null_installer_task()); + $container->compile(); + + $language = $container->get('language'); + $language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + + $iohandler_factory = $container->get('installer.helper.iohandler_factory'); + $iohandler_factory->set_environment('cli'); + $iohandler = $iohandler_factory->get(); + + $parseURL = parse_url(self::$config['phpbb_functional_url']); + + $output = new \Symfony\Component\Console\Output\NullOutput(); + $style = new \Symfony\Component\Console\Style\SymfonyStyle( + new \Symfony\Component\Console\Input\ArrayInput(array()), + $output + ); + $iohandler->set_style($style, $output); + + $installer = $container->get('installer.installer.install'); + $installer->set_iohandler($iohandler); + + // Set data + $iohandler->set_input('admin_name', 'admin'); + $iohandler->set_input('admin_pass1', 'adminadmin'); + $iohandler->set_input('admin_pass2', 'adminadmin'); + $iohandler->set_input('board_email', 'nobody@example.com'); + $iohandler->set_input('submit_admin', 'submit'); + + $iohandler->set_input('default_lang', 'en'); + $iohandler->set_input('board_name', 'yourdomain.com'); + $iohandler->set_input('board_description', 'A short text to describe your forum'); + $iohandler->set_input('submit_board', 'submit'); + + $iohandler->set_input('dbms', str_replace('phpbb\db\driver\\', '', self::$config['dbms'])); + $iohandler->set_input('dbhost', self::$config['dbhost']); + $iohandler->set_input('dbport', self::$config['dbport']); + $iohandler->set_input('dbuser', self::$config['dbuser']); + $iohandler->set_input('dbpasswd', self::$config['dbpasswd']); + $iohandler->set_input('dbname', self::$config['dbname']); + $iohandler->set_input('table_prefix', self::$config['table_prefix']); + $iohandler->set_input('submit_database', 'submit'); + + $iohandler->set_input('email_enable', true); + $iohandler->set_input('smtp_delivery', '1'); + $iohandler->set_input('smtp_host', 'nxdomain.phpbb.com'); + $iohandler->set_input('smtp_auth', 'PLAIN'); + $iohandler->set_input('smtp_user', 'nxuser'); + $iohandler->set_input('smtp_pass', 'nxpass'); + $iohandler->set_input('submit_email', 'submit'); + + $iohandler->set_input('cookie_secure', '0'); + $iohandler->set_input('server_protocol', '0'); + $iohandler->set_input('force_server_vars', $parseURL['scheme'] . '://'); + $iohandler->set_input('server_name', $parseURL['host']); + $iohandler->set_input('server_port', isset($parseURL['port']) ? (int) $parseURL['port'] : 80); + $iohandler->set_input('script_path', $parseURL['path']); + $iohandler->set_input('submit_server', 'submit'); + + do + { + $installer->run(); + } + while (file_exists($phpbb_root_path . 'store/install_config.php')); + + copy($config_file, $config_file_test); + + if (file_exists($phpbb_root_path . 'cache/install_lock')) + { + unlink($phpbb_root_path . 'cache/install_lock'); + } + + global $phpbb_container, $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log, $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template; + $phpbb_container->reset(); + unset($phpbb_container, $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log, $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template); + } +} diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php new file mode 100644 index 0000000000..1f7df15434 --- /dev/null +++ b/tests/text_formatter/s9e/default_formatting_test.php @@ -0,0 +1,315 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; + +class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case +{ + public function test_bbcode_code_lang_is_saved() + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $parser = $container->get('text_formatter.parser'); + + $original = '[code]...[/code][code=php]...[/code]'; + $expected = '<r><CODE><s>[code]</s>...<e>[/code]</e></CODE><CODE lang="php"><s>[code=php]</s>...<e>[/code]</e></CODE></r>'; + + $this->assertXmlStringEqualsXmlString($expected, $parser->parse($original)); + } + + /** + * @dataProvider get_default_formatting_tests + */ + public function test_default_formatting($original, $expected, $setup = null) + { + $fixture = __DIR__ . '/fixtures/default_formatting.xml'; + $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture); + + $parser = $container->get('text_formatter.parser'); + $renderer = $container->get('text_formatter.renderer'); + + if (isset($setup)) + { + call_user_func($setup, $container); + } + + $parsed_text = $parser->parse($original); + + $this->assertSame($expected, $renderer->render($parsed_text)); + } + + public function get_default_formatting_tests() + { + return array( + array( + '[b]bold[/b]', + '<span style="font-weight: bold">bold</span>' + ), + array( + '[u]underlined[/u]', + '<span style="text-decoration: underline">underlined</span>' + ), + array( + '[i]italic[/i]', + '<span style="font-style: italic">italic</span>' + ), + array( + '[color=#FF0000]colored[/color]', + '<span style="color: #FF0000">colored</span>' + ), + array( + '[color=red]colored[/color]', + '<span style="color: red">colored</span>' + ), + array( + '[size=75]smaller[/size]', + '<span style="font-size: 75%; line-height: normal">smaller</span>' + ), + array( + '[quote]quoted[/quote]', + '<blockquote class="uncited"><div>quoted</div></blockquote>' + ), + array( + '[quote="username"]quoted[/quote]', + '<blockquote><div><cite>username wrote:</cite>quoted</div></blockquote>' + ), + array( + '[code]unparsed code[/code]', + '<div class="codebox"><p>CODE: <a href="#" onclick="selectCode(this); return false;">Select all</a></p><pre><code>unparsed code</code></pre></div>' + ), + array( + '[list]no item[/list]', + '<ul>no item</ul>' + ), + array( + '[*]unparsed', + '[*]unparsed' + ), + array( + '[list][*]item[/list]', + '<ul><li>item</li></ul>' + ), + array( + '[list][*]item[/*][/list]', + '<ul><li>item</li></ul>' + ), + array( + '[list=1][*]item[/list]', + '<ol style="list-style-type: decimal"><li>item</li></ol>' + ), + array( + '[list=a][*]item[/list]', + '<ol style="list-style-type: lower-alpha"><li>item</li></ol>' + ), + array( + '[list=i][*]item[/list]', + '<ol style="list-style-type: lower-roman"><li>item</li></ol>' + ), + array( + '[list=I][*]item[/list]', + '<ol style="list-style-type: upper-roman"><li>item</li></ol>' + ), + array( + '[list=disc][*]item[/list]', + '<ul style="list-style-type: disc"><li>item</li></ul>' + ), + array( + '[list=circle][*]item[/list]', + '<ul style="list-style-type: circle"><li>item</li></ul>' + ), + array( + '[list=square][*]item[/list]', + '<ul style="list-style-type: square"><li>item</li></ul>' + ), + array( + '[img]https://area51.phpbb.com/images/area51.png[/img]', + '<img src="https://area51.phpbb.com/images/area51.png" class="postimage" alt="Image">' + ), + array( + '[url]https://area51.phpbb.com/[/url]', + '<a href="https://area51.phpbb.com/" class="postlink">https://area51.phpbb.com/</a>' + ), + array( + '[url=https://area51.phpbb.com/]Area51[/url]', + '<a href="https://area51.phpbb.com/" class="postlink">Area51</a>' + ), + array( + '[email]bbcode-test@phpbb.com[/email]', + '<a href="mailto:bbcode-test@phpbb.com">bbcode-test@phpbb.com</a>' + ), + array( + '[email=bbcode-test@phpbb.com]Email[/email]', + '<a href="mailto:bbcode-test@phpbb.com">Email</a>' + ), + array( + '[attachment=0]filename[/attachment]', + '<div class="inline-attachment"><!-- ia0 -->filename<!-- ia0 --></div>' + ), + array( + // PHPBB3-1401 - correct: parsed + '[quote="[test]test"]test [ test[/quote]', + '<blockquote><div><cite>[test]test wrote:</cite>test [ test</div></blockquote>' + ), + array( + // PHPBB3-6117 - correct: parsed + '[quote]test[/quote] test ] and [ test [quote]test[/quote]', + '<blockquote class="uncited"><div>test</div></blockquote> test ] and [ test <blockquote class="uncited"><div>test</div></blockquote>' + ), + array( + // PHPBB3-6200 - correct: parsed + '[quote="["]test[/quote]', + '<blockquote><div><cite>[ wrote:</cite>test</div></blockquote>' + ), + array( + // PHPBB3-9364 - quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted + '[quote]test[/[/b]quote] test [/quote][/quote] test', + '<blockquote class="uncited"><div>test[/[/b]quote] test </div></blockquote>[/quote] test' + ), + array( + // PHPBB3-8096 - first quote tag parsed, second quote tag unparsed + '[quote="a"]a[/quote][quote="a]a[/quote]', + '<blockquote><div><cite>a wrote:</cite>a</div></blockquote>[quote="a]a[/quote]' + ), + array( + // Allow textual bbcodes in textual bbcodes + '[b]bold [i]bold + italic[/i][/b]', + '<span style="font-weight: bold">bold <span style="font-style: italic">bold + italic</span></span>' + ), + array( + // Allow textual bbcodes in url with description + '[url=https://area51.phpbb.com/]Area51 [i]italic[/i][/url]', + '<a href="https://area51.phpbb.com/" class="postlink">Area51 <span style="font-style: italic">italic</span></a>' + ), + array( + // Allow url with description in textual bbcodes + '[i]italic [url=https://area51.phpbb.com/]Area51[/url][/i]', + '<span style="font-style: italic">italic <a href="https://area51.phpbb.com/" class="postlink">Area51</a></span>' + ), + array( + // Do not parse textual bbcodes in code + '[code]unparsed code [b]bold [i]bold + italic[/i][/b][/code]', + '<div class="codebox"><p>CODE: <a href="#" onclick="selectCode(this); return false;">Select all</a></p><pre><code>unparsed code [b]bold [i]bold + italic[/i][/b]</code></pre></div>' + ), + array( + // Do not parse quote bbcodes in code + '[code]unparsed code [quote="username"]quoted[/quote][/code]', + '<div class="codebox"><p>CODE: <a href="#" onclick="selectCode(this); return false;">Select all</a></p><pre><code>unparsed code [quote="username"]quoted[/quote]</code></pre></div>' + ), + array( + // Textual bbcode nesting into textual bbcode + '[b]bold [i]bold + italic[/b] italic[/i]', + '<span style="font-weight: bold">bold <span style="font-style: italic">bold + italic</span></span><span style="font-style: italic"> italic</span>' + ), + array( + "[code]\tline1\n line2[/code]", + '<div class="codebox"><p>CODE: <a href="#" onclick="selectCode(this); return false;">Select all</a></p><pre><code>' . "\tline1\n line2</code></pre></div>" + ), + array( + "[code]\n\tline1\n line2[/code]", + '<div class="codebox"><p>CODE: <a href="#" onclick="selectCode(this); return false;">Select all</a></p><pre><code>' . "\tline1\n line2</code></pre></div>" + ), + array( + '... http://example.org ...', + '... <a href="http://example.org" class="postlink">http://example.org</a> ...' + ), + array( + '... www.example.org ...', + '... <a href="http://www.example.org" class="postlink">www.example.org</a> ...' + ), + array( + // From make_clickable_test.php + 'www.phpbb.com/community/?', + '<a href="http://www.phpbb.com/community/" class="postlink">www.phpbb.com/community/</a>?' + ), + array( + // From make_clickable_test.php + 'http://www.phpbb.com/community/path/to/long/url/file.ext#section', + '<a href="http://www.phpbb.com/community/path/to/long/url/file.ext#section" class="postlink">http://www.phpbb.com/community/path/to/ ... xt#section</a>' + ), + array( + 'http://localhost/ http://localhost/phpbb/ http://localhost/phpbb/viewforum.php?f=1', + '<a href="http://localhost/" class="postlink">http://localhost/</a> <a href="http://localhost/phpbb/" class="postlink">http://localhost/phpbb/</a> <a href="http://localhost/phpbb/viewforum.php?f=1" class="postlink">viewforum.php?f=1</a>' + ), + array( + 'http://localhost/phpbb/viewforum.php?f=1#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', + '<a href="http://localhost/phpbb/viewforum.php?f=1#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" class="postlink">viewforum.php?f=1#xxxxxxxxxxxxxxxxxxxxx ... xxxxxxxxxx</a>' + ), + array( + '[url]http://example.org/0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0[/url]', + '<a href="http://example.org/0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0" class="postlink">http://example.org/0xxxxxxxxxxxxxxxxxxx ... xxxxxxxxx0</a>' + ), + array( + '[URL]http://example.org/0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0[/url]', + '<a href="http://example.org/0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0" class="postlink">http://example.org/0xxxxxxxxxxxxxxxxxxx ... xxxxxxxxx0</a>' + ), + array( + '[url=http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[/url]', + '<a href="http://example.org/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" class="postlink">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</a>' + ), + array( + '[quote="[url=http://example.org]xxx[/url]"]...[/quote]', + '<blockquote><div><cite><a href="http://example.org" class="postlink">xxx</a> wrote:</cite>...</div></blockquote>' + ), + array( + '[quote="[url]http://example.org[/url]"]...[/quote]', + '<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>' + ), + array( + '[quote=http://example.org]...[/quote]', + '<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>' + ), + array( + "[quote]\nThis is a long quote that is definitely going to exceed 80 characters\n[/quote]\n\nFollowed by a reply", + "<blockquote class=\"uncited\"><div>\nThis is a long quote that is definitely going to exceed 80 characters\n</div></blockquote>\n\nFollowed by a reply" + ), + array( + '[quote=Username post_id=123]...[/quote]', + '<blockquote><div><cite>Username wrote: <a href="phpBB/viewtopic.php?p=123#p123" data-post-id="123" onclick="if(document.getElementById(hash.substr(1)))href=hash">↑</a></cite>...</div></blockquote>' + ), + array( + // Users are not allowed to submit their own URL for the post + '[quote="Username" post_url="http://fake.example.org"]...[/quote]', + '<blockquote><div><cite>Username wrote:</cite>...</div></blockquote>' + ), + array( + '[quote=Username time=58705871]...[/quote]', + '<blockquote><div><cite>Username wrote:<div class="responsive-hide">1971-11-11 11:11:11</div></cite>...</div></blockquote>' + ), + array( + '[quote=Username user_id=123]...[/quote]', + '<blockquote><div><cite><a href="phpBB/memberlist.php?mode=viewprofile&u=123">Username</a> wrote:</cite>...</div></blockquote>' + ), + array( + // Users are not allowed to submit their own URL for the profile + '[quote=Username profile_url=http://fake.example.org]...[/quote]', + '<blockquote><div><cite>Username wrote:</cite>...</div></blockquote>' + ), + array( + // From phpbb_textformatter_s9e_utils_test::test_generate_quote() + '[quote=\'[quote="foo"]\']...[/quote]', + '<blockquote><div><cite>[quote="foo"] wrote:</cite>...</div></blockquote>' + ), + array( + "Emoji: \xF0\x9F\x98\x80", + 'Emoji: <img alt="' . "\xF0\x9F\x98\x80" . '" class="smilies" draggable="false" width="18" height="18" src="//twemoji.maxcdn.com/36x36/1f600.png">' + ), + array( + "Emoji: \xF0\x9F\x98\x80", + "Emoji: \xF0\x9F\x98\x80", + function ($container) + { + $container->get('text_formatter.renderer')->set_viewsmilies(false); + } + ), + ); + } +} diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php new file mode 100644 index 0000000000..8f8ec7ebc7 --- /dev/null +++ b/tests/text_formatter/s9e/factory_test.php @@ -0,0 +1,253 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../test_framework/phpbb_database_test_case.php'; + +class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case +{ + public function setUp() + { + $this->cache = new phpbb_mock_cache; + $this->dispatcher = new phpbb_mock_event_dispatcher; + parent::setUp(); + } + + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/factory.xml'); + } + + public function get_cache_dir() + { + return __DIR__ . '/../../tmp/'; + } + + public function get_factory() + { + global $config, $phpbb_root_path, $request, $user; + $this->cache = new phpbb_mock_cache; + $dal = new \phpbb\textformatter\data_access( + $this->new_dbal(), + 'phpbb_bbcodes', + 'phpbb_smilies', + 'phpbb_styles', + 'phpbb_words', + $phpbb_root_path . 'styles/' + ); + $factory = new \phpbb\textformatter\s9e\factory( + $dal, + $this->cache, + $this->dispatcher, + new \phpbb\config\config(array('allowed_schemes_links' => 'http,https,ftp')), + new \phpbb\textformatter\s9e\link_helper, + $this->get_cache_dir(), + '_foo_parser', + '_foo_renderer' + ); + + // Global objects required by generate_board_url() + $config = new \phpbb\config\config(array( + 'script_path' => '/phpbb', + 'server_name' => 'localhost', + 'server_port' => 80, + 'server_protocol' => 'http://', + )); + $request = new phpbb_mock_request; + $user = new phpbb_mock_user; + + return $factory; + } + + public function test_get_configurator() + { + $configurator = $this->get_factory()->get_configurator(); + + $this->assertInstanceOf('s9e\\TextFormatter\\Configurator', $configurator); + + $this->assertTrue(isset($configurator->plugins['Autoemail'])); + $this->assertTrue(isset($configurator->plugins['Autolink'])); + + $this->assertTrue(isset($configurator->BBCodes['B'])); + $this->assertTrue(isset($configurator->BBCodes['CODE'])); + $this->assertTrue(isset($configurator->BBCodes['COLOR'])); + $this->assertTrue(isset($configurator->BBCodes['EMAIL'])); + $this->assertTrue(isset($configurator->BBCodes['FLASH'])); + $this->assertTrue(isset($configurator->BBCodes['I'])); + $this->assertTrue(isset($configurator->BBCodes['IMG'])); + $this->assertTrue(isset($configurator->BBCodes['LIST'])); + $this->assertTrue(isset($configurator->BBCodes['*'])); + $this->assertTrue(isset($configurator->BBCodes['QUOTE'])); + $this->assertTrue(isset($configurator->BBCodes['SIZE'])); + $this->assertTrue(isset($configurator->BBCodes['U'])); + $this->assertTrue(isset($configurator->BBCodes['URL'])); + + // This custom BBCode should be set + $this->assertTrue(isset($configurator->BBCodes['CUSTOM'])); + + $this->assertTrue(isset($configurator->Emoticons[':D'])); + } + + public function test_regenerate() + { + extract($this->get_factory()->regenerate()); + + $this->assertInstanceOf('s9e\\TextFormatter\\Parser', $parser); + $this->assertInstanceOf('s9e\\TextFormatter\\Renderer', $renderer); + + $renderer_data = $this->cache->get('_foo_renderer'); + $this->assertEquals($parser, $this->cache->get('_foo_parser'), 'The parser was not cached'); + $this->assertEquals(get_class($renderer), $renderer_data['class']); + $this->assertInstanceOf('s9e\\TextFormatter\\Plugins\\Censor\\Helper', $renderer_data['censor']); + + $file = $this->get_cache_dir() . get_class($renderer) . '.php'; + $this->assertFileExists($file); + unlink($file); + } + + public function test_tidy() + { + $factory = $this->get_factory(); + + // Create a fake "old" cache file + $old_file = $this->get_cache_dir() . 's9e_foo.php'; + touch($old_file); + + // Create a current renderer + extract($factory->regenerate()); + $new_file = $this->get_cache_dir() . get_class($renderer) . '.php'; + + // Tidy the cache + $factory->tidy(); + + $this->assertFileExists($new_file, 'The current renderer has been deleted'); + $this->assertFileNotExists($old_file, 'The old renderer has not been deleted'); + + unlink($new_file); + } + + public function test_local_url() + { + global $config, $user, $request; + $config = new \phpbb\config\config(array( + 'force_server_vars' => true, + 'server_protocol' => 'http://', + 'server_name' => 'path', + 'server_port' => 80, + 'script_path' => '/to', + 'cookie_secure' => false + )); + $user = new phpbb_mock_user; + $request = new phpbb_mock_request; + + $fixture = __DIR__ . '/fixtures/local_url.xml'; + $renderer = $this->get_test_case_helpers()->set_s9e_services(null, $fixture)->get('text_formatter.renderer'); + + $this->assertSame( + '<a href="http://path/to/foo">http://path/to/foo</a>', + $renderer->render('<r><LOCAL content="foo"><s>[local]</s>foo<e>[/local]</e></LOCAL></r>') + ); + } + + public function test_smilies_special_chars() + { + // Use a smiley that contains every special chars in every field + $fixture = __DIR__ . '/fixtures/smilies_special_chars.xml'; + $renderer = $this->get_test_case_helpers()->set_s9e_services(null, $fixture)->get('text_formatter.renderer'); + + $this->assertSame( + '<img class="smilies" src="phpBB/images/smilies/%22%27%3C&%3E.png" alt=""\'<&>" title=""\'<&>">', + $renderer->render('<r><E>"\'<&></E></r>') + ); + } + + /** + * @testdox {INTTEXT} is supported in custom BBCodes + */ + public function test_inttext_token() + { + $fixture = __DIR__ . '/fixtures/inttext_token.xml'; + $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture); + $parser = $container->get('text_formatter.parser'); + $renderer = $container->get('text_formatter.renderer'); + + $original = '[spoiler=ɎɆS]text[/spoiler]'; + $expected = '<div class="spoiler"><div class="title">ɎɆS</div><div class="content">text</div></div>'; + $this->assertSame($expected, $renderer->render($parser->parse($original))); + + $original = '[spoiler=N:O:P:E]text[/spoiler]'; + $expected = $original; + $this->assertSame($expected, $renderer->render($parser->parse($original))); + } + + /** + * @testdox Preserves comments in custom BBCodes + */ + public function test_preserve_comments() + { + $fixture = __DIR__ . '/fixtures/preserve_comments.xml'; + $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture); + $parser = $container->get('text_formatter.parser'); + $renderer = $container->get('text_formatter.renderer'); + + $original = '[X]'; + $expected = '<!-- comment -->'; + $this->assertSame($expected, $renderer->render($parser->parse($original))); + } + + /** + * @testdox Accepts unsafe custom BBCodes + */ + public function test_unsafe_bbcode() + { + $fixture = __DIR__ . '/fixtures/unsafe_bbcode.xml'; + $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture); + $parser = $container->get('text_formatter.parser'); + $renderer = $container->get('text_formatter.renderer'); + + $original = '[xss=javascript:alert(1)]text[/xss]'; + $expected = '<a href="javascript:alert(1)">text</a>'; + $this->assertSame($expected, $renderer->render($parser->parse($original))); + } + + /** + * @testdox get_configurator() triggers events before and after configuration + */ + public function test_configure_events() + { + $this->dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $this->dispatcher + ->expects($this->at(0)) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_configure_before', + $this->callback(array($this, 'configure_event_callback')) + ) + ->will($this->returnArgument(1)); + $this->dispatcher + ->expects($this->at(1)) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_configure_after', + $this->callback(array($this, 'configure_event_callback')) + ) + ->will($this->returnArgument(1)); + + $this->get_factory()->get_configurator(); + } + + public function configure_event_callback($vars) + { + return isset($vars['configurator']) && $vars['configurator'] instanceof \s9e\TextFormatter\Configurator; + } +} diff --git a/tests/text_formatter/s9e/fixtures/default_formatting.xml b/tests/text_formatter/s9e/fixtures/default_formatting.xml new file mode 100644 index 0000000000..2b7236fb30 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/default_formatting.xml @@ -0,0 +1,466 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_smilies"> + <column>smiley_id</column> + <column>code</column> + <column>emotion</column> + <column>smiley_url</column> + <column>smiley_width</column> + <column>smiley_height</column> + <column>smiley_order</column> + <column>display_on_posting</column> + <row> + <value>1</value> + <value>:D</value> + <value>Very Happy</value> + <value>icon_e_biggrin.gif</value> + <value>15</value> + <value>17</value> + <value>1</value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>:-D</value> + <value>Very Happy</value> + <value>icon_e_biggrin.gif</value> + <value>15</value> + <value>17</value> + <value>2</value> + <value>1</value> + </row> + <row> + <value>3</value> + <value>:grin:</value> + <value>Very Happy</value> + <value>icon_e_biggrin.gif</value> + <value>15</value> + <value>17</value> + <value>3</value> + <value>1</value> + </row> + <row> + <value>4</value> + <value>:)</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>4</value> + <value>1</value> + </row> + <row> + <value>5</value> + <value>:-)</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>5</value> + <value>1</value> + </row> + <row> + <value>6</value> + <value>:smile:</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>6</value> + <value>1</value> + </row> + <row> + <value>7</value> + <value>;)</value> + <value>Wink</value> + <value>icon_e_wink.gif</value> + <value>15</value> + <value>17</value> + <value>7</value> + <value>1</value> + </row> + <row> + <value>8</value> + <value>;-)</value> + <value>Wink</value> + <value>icon_e_wink.gif</value> + <value>15</value> + <value>17</value> + <value>8</value> + <value>1</value> + </row> + <row> + <value>9</value> + <value>:wink:</value> + <value>Wink</value> + <value>icon_e_wink.gif</value> + <value>15</value> + <value>17</value> + <value>9</value> + <value>1</value> + </row> + <row> + <value>10</value> + <value>:(</value> + <value>Sad</value> + <value>icon_e_sad.gif</value> + <value>15</value> + <value>17</value> + <value>10</value> + <value>1</value> + </row> + <row> + <value>11</value> + <value>:-(</value> + <value>Sad</value> + <value>icon_e_sad.gif</value> + <value>15</value> + <value>17</value> + <value>11</value> + <value>1</value> + </row> + <row> + <value>12</value> + <value>:sad:</value> + <value>Sad</value> + <value>icon_e_sad.gif</value> + <value>15</value> + <value>17</value> + <value>12</value> + <value>1</value> + </row> + <row> + <value>13</value> + <value>:o</value> + <value>Surprised</value> + <value>icon_e_surprised.gif</value> + <value>15</value> + <value>17</value> + <value>13</value> + <value>1</value> + </row> + <row> + <value>14</value> + <value>:-o</value> + <value>Surprised</value> + <value>icon_e_surprised.gif</value> + <value>15</value> + <value>17</value> + <value>14</value> + <value>1</value> + </row> + <row> + <value>15</value> + <value>:eek:</value> + <value>Surprised</value> + <value>icon_e_surprised.gif</value> + <value>15</value> + <value>17</value> + <value>15</value> + <value>1</value> + </row> + <row> + <value>16</value> + <value>:shock:</value> + <value>Shocked</value> + <value>icon_eek.gif</value> + <value>15</value> + <value>17</value> + <value>16</value> + <value>1</value> + </row> + <row> + <value>17</value> + <value>:?</value> + <value>Confused</value> + <value>icon_e_confused.gif</value> + <value>15</value> + <value>17</value> + <value>17</value> + <value>1</value> + </row> + <row> + <value>18</value> + <value>:-?</value> + <value>Confused</value> + <value>icon_e_confused.gif</value> + <value>15</value> + <value>17</value> + <value>18</value> + <value>1</value> + </row> + <row> + <value>19</value> + <value>:???:</value> + <value>Confused</value> + <value>icon_e_confused.gif</value> + <value>15</value> + <value>17</value> + <value>19</value> + <value>1</value> + </row> + <row> + <value>20</value> + <value>8-)</value> + <value>Cool</value> + <value>icon_cool.gif</value> + <value>15</value> + <value>17</value> + <value>20</value> + <value>1</value> + </row> + <row> + <value>21</value> + <value>:cool:</value> + <value>Cool</value> + <value>icon_cool.gif</value> + <value>15</value> + <value>17</value> + <value>21</value> + <value>1</value> + </row> + <row> + <value>22</value> + <value>:lol:</value> + <value>Laughing</value> + <value>icon_lol.gif</value> + <value>15</value> + <value>17</value> + <value>22</value> + <value>1</value> + </row> + <row> + <value>23</value> + <value>:x</value> + <value>Mad</value> + <value>icon_mad.gif</value> + <value>15</value> + <value>17</value> + <value>23</value> + <value>1</value> + </row> + <row> + <value>24</value> + <value>:-x</value> + <value>Mad</value> + <value>icon_mad.gif</value> + <value>15</value> + <value>17</value> + <value>24</value> + <value>1</value> + </row> + <row> + <value>25</value> + <value>:mad:</value> + <value>Mad</value> + <value>icon_mad.gif</value> + <value>15</value> + <value>17</value> + <value>25</value> + <value>1</value> + </row> + <row> + <value>26</value> + <value>:P</value> + <value>Razz</value> + <value>icon_razz.gif</value> + <value>15</value> + <value>17</value> + <value>26</value> + <value>1</value> + </row> + <row> + <value>27</value> + <value>:-P</value> + <value>Razz</value> + <value>icon_razz.gif</value> + <value>15</value> + <value>17</value> + <value>27</value> + <value>1</value> + </row> + <row> + <value>28</value> + <value>:razz:</value> + <value>Razz</value> + <value>icon_razz.gif</value> + <value>15</value> + <value>17</value> + <value>28</value> + <value>1</value> + </row> + <row> + <value>29</value> + <value>:oops:</value> + <value>Embarrassed</value> + <value>icon_redface.gif</value> + <value>15</value> + <value>17</value> + <value>29</value> + <value>1</value> + </row> + <row> + <value>30</value> + <value>:cry:</value> + <value>Crying or Very Sad</value> + <value>icon_cry.gif</value> + <value>15</value> + <value>17</value> + <value>30</value> + <value>1</value> + </row> + <row> + <value>31</value> + <value>:evil:</value> + <value>Evil or Very Mad</value> + <value>icon_evil.gif</value> + <value>15</value> + <value>17</value> + <value>31</value> + <value>1</value> + </row> + <row> + <value>32</value> + <value>:twisted:</value> + <value>Twisted Evil</value> + <value>icon_twisted.gif</value> + <value>15</value> + <value>17</value> + <value>32</value> + <value>1</value> + </row> + <row> + <value>33</value> + <value>:roll:</value> + <value>Rolling Eyes</value> + <value>icon_rolleyes.gif</value> + <value>15</value> + <value>17</value> + <value>33</value> + <value>1</value> + </row> + <row> + <value>34</value> + <value>:!:</value> + <value>Exclamation</value> + <value>icon_exclaim.gif</value> + <value>15</value> + <value>17</value> + <value>34</value> + <value>1</value> + </row> + <row> + <value>35</value> + <value>:?:</value> + <value>Question</value> + <value>icon_question.gif</value> + <value>15</value> + <value>17</value> + <value>35</value> + <value>1</value> + </row> + <row> + <value>36</value> + <value>:idea:</value> + <value>Idea</value> + <value>icon_idea.gif</value> + <value>15</value> + <value>17</value> + <value>36</value> + <value>1</value> + </row> + <row> + <value>37</value> + <value>:arrow:</value> + <value>Arrow</value> + <value>icon_arrow.gif</value> + <value>15</value> + <value>17</value> + <value>37</value> + <value>1</value> + </row> + <row> + <value>38</value> + <value>:|</value> + <value>Neutral</value> + <value>icon_neutral.gif</value> + <value>15</value> + <value>17</value> + <value>38</value> + <value>1</value> + </row> + <row> + <value>39</value> + <value>:-|</value> + <value>Neutral</value> + <value>icon_neutral.gif</value> + <value>15</value> + <value>17</value> + <value>39</value> + <value>1</value> + </row> + <row> + <value>40</value> + <value>:mrgreen:</value> + <value>Mr. Green</value> + <value>icon_mrgreen.gif</value> + <value>15</value> + <value>17</value> + <value>40</value> + <value>1</value> + </row> + <row> + <value>41</value> + <value>:geek:</value> + <value>Geek</value> + <value>icon_e_geek.gif</value> + <value>17</value> + <value>17</value> + <value>41</value> + <value>1</value> + </row> + <row> + <value>42</value> + <value>:ugeek:</value> + <value>Uber Geek</value> + <value>icon_e_ugeek.gif</value> + <value>17</value> + <value>18</value> + <value>42</value> + <value>1</value> + </row> + </table> + + <table name="phpbb_styles"> + <column>style_id</column> + <column>style_name</column> + <column>style_copyright</column> + <column>style_active</column> + <column>style_path</column> + <column>bbcode_bitfield</column> + <column>style_parent_id</column> + <column>style_parent_tree</column> + <row> + <value>1</value> + <value>prosilver</value> + <value>&copy; phpBB Group</value> + <value>1</value> + <value>prosilver</value> + <value>kNg=</value> + <value>0</value> + <value></value> + </row> + </table> + + <table name="phpbb_words"> + <column>word_id</column> + <column>word</column> + <column>replacement</column> + + <row> + <value>1</value> + <value>apple</value> + <value>banana</value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/default_lang.xml b/tests/text_formatter/s9e/fixtures/default_lang.xml new file mode 100644 index 0000000000..2cfde4aab2 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/default_lang.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + + <row> + <value>13</value> + <value>foo</value> + <value></value> + <value>1</value> + <value>[foo]{TEXT}[/foo]</value> + <value>{L_FOO_BAR}</value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/factory.xml b/tests/text_formatter/s9e/fixtures/factory.xml new file mode 100644 index 0000000000..9ae52e9747 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/factory.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>custom</value> + <value></value> + <value>1</value> + <value>[custom]{TEXT}[/custom]</value> + <value><span style="color:red">{TEXT}</span></value> + <value>!\[custom\](.*?)\[/custom\]!ies</value> + <value>'[custom:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', '&#39;', '&#40;', '&#41;'), trim('${1}')).'[/custom:$uid]'</value> + <value>!\[custom:$uid\](.*?)\[/custom:$uid\]!s</value> + <value><span style="color:red">${1}</span></value> + </row> + <row> + <value>14</value> + <value>unsafe</value> + <value></value> + <value>1</value> + <value>[unsafe]{TEXT}[/unsafe]</value> + <value><script>{TEXT}</script></value> + <value>!\[unsafe\](.*?)\[/unsafe\]!ies</value> + <value>'[unsafe:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', '&#39;', '&#40;', '&#41;'), trim('${1}')).'[/unsafe:$uid]'</value> + <value>!\[unsafe:$uid\](.*?)\[/unsafe:$uid\]!s</value> + <value><script>${1}</script></value> + </row> + </table> + + <table name="phpbb_smilies"> + <column>smiley_id</column> + <column>code</column> + <column>emotion</column> + <column>smiley_url</column> + <column>smiley_width</column> + <column>smiley_height</column> + <column>smiley_order</column> + <column>display_on_posting</column> + <row> + <value>1</value> + <value>:D</value> + <value>Very Happy</value> + <value>icon_e_biggrin.gif</value> + <value>15</value> + <value>17</value> + <value>2</value> + <value>1</value> + </row> + <row> + <value>4</value> + <value>:)</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>4</value> + <value>1</value> + </row> + <row> + <value>10</value> + <value>:(</value> + <value>Sad</value> + <value>icon_e_sad.gif</value> + <value>15</value> + <value>17</value> + <value>10</value> + <value>1</value> + </row> + </table> + + <table name="phpbb_styles"> + <column>style_id</column> + <column>style_name</column> + <column>style_copyright</column> + <column>style_active</column> + <column>style_path</column> + <column>bbcode_bitfield</column> + <column>style_parent_id</column> + <column>style_parent_tree</column> + + <row> + <value>1</value> + <value>prosilver</value> + <value>&copy; phpBB Group</value> + <value>1</value> + <value>prosilver</value> + <value>kNg=</value> + <value>0</value> + <value></value> + </row> + </table> + + <table name="phpbb_words"> + <column>word_id</column> + <column>word</column> + <column>replacement</column> + + <row> + <value>1</value> + <value>apple</value> + <value>banana</value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/inttext_token.xml b/tests/text_formatter/s9e/fixtures/inttext_token.xml new file mode 100644 index 0000000000..30b971f315 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/inttext_token.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>spoiler=</value> + <value></value> + <value>1</value> + <value>[spoiler={INTTEXT}]{TEXT}[/spoiler]</value> + <value><![CDATA[<div class="spoiler"><div class="title">{INTTEXT}</div><div class="content">{TEXT}</div></div>]]></value> + <value><![CDATA[!\[spoiler\=([\p{L}\p{N}\-+,_. ]+)\](.*?)\[/spoiler\]!iues]]></value> + <value><![CDATA['[spoiler=${1}:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${2}')).'[/spoiler:$uid]']]></value> + <value><![CDATA[!\[spoiler\=([\p{L}\p{N}\-+,_. ]+):$uid\](.*?)\[/spoiler:$uid\]!su]]></value><value><![CDATA[<div class="spoiler"><div class="title">${1}</div><div class="content">${2}</div></div>]]></value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/local_url.xml b/tests/text_formatter/s9e/fixtures/local_url.xml new file mode 100644 index 0000000000..9db2bf4710 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/local_url.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>local</value> + <value></value> + <value>1</value> + <value>[local]{LOCAL_URL}[/local]</value> + <value><![CDATA[<a href="{LOCAL_URL}">{LOCAL_URL}</a>]]></value> + <value><*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~\!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~\!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:#(?:[a-z0-9\-._~\!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?)\[/local\]!ie]]></value> + <value><![CDATA['[local:$uid]'.$this->bbcode_specialchars('${1}').'[/local:$uid]']]></value> + <value><((?:[a-z0-9\-._~\!$&'()*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~\!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~\!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:#(?:[a-z0-9\-._~\!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?)(?-i)\[/local:$uid\]!s]]></value> + <value><![CDATA[<a href="http://path/to/phpBB/${1}">http://path/to/phpBB/${1}</a>]]></value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/preserve_comments.xml b/tests/text_formatter/s9e/fixtures/preserve_comments.xml new file mode 100644 index 0000000000..f81d366aad --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/preserve_comments.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>X</value> + <value></value> + <value>1</value> + <value>[X][/X]</value> + <value><![CDATA[<!-- comment -->]]></value> + <value><![CDATA[!\[x\]\[/x\]!i]]></value> + <value><![CDATA[[x:$uid][/x:$uid]]]></value> + <value><![CDATA[[x:$uid][/x:$uid]]]></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/smilies_special_chars.xml b/tests/text_formatter/s9e/fixtures/smilies_special_chars.xml new file mode 100644 index 0000000000..d3a7cfa4f7 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/smilies_special_chars.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_smilies"> + <column>smiley_id</column> + <column>code</column> + <column>emotion</column> + <column>smiley_url</column> + <column>smiley_width</column> + <column>smiley_height</column> + <column>smiley_order</column> + <column>display_on_posting</column> + <row> + <value>1</value> + <value>"'<&></value> + <value>"'<&></value> + <value>"'<&>.png</value> + <value>15</value> + <value>17</value> + <value>2</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/style_inheritance.xml b/tests/text_formatter/s9e/fixtures/style_inheritance.xml new file mode 100644 index 0000000000..a692d0ef2d --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/style_inheritance.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_styles"> + <column>style_id</column> + <column>style_name</column> + <column>style_copyright</column> + <column>style_active</column> + <column>style_path</column> + <column>bbcode_bitfield</column> + <column>style_parent_id</column> + <column>style_parent_tree</column> + + <row> + <value>1</value> + <value>foo</value> + <value></value> + <value>1</value> + <value>foo</value> + <!-- Bitfield for "b" only --> + <value>QA==</value> + <value>0</value> + <value></value> + </row> + <row> + <value>2</value> + <value>fooplus</value> + <value></value> + <value>1</value> + <value>fooplus</value> + <value>QA==</value> + <value>1</value> + <value></value> + </row> + <row> + <value>3</value> + <value>fooplusplus</value> + <value></value> + <value>1</value> + <value>fooplusplus</value> + <value>QA==</value> + <value>2</value> + <value></value> + </row> + <row> + <value>4</value> + <value>bar</value> + <value></value> + <value>1</value> + <value>bar</value> + <!-- Bitfield for "b" only --> + <value>QA==</value> + <value>0</value> + <value></value> + </row> + <row> + <value>5</value> + <value>barplus</value> + <value></value> + <value>1</value> + <value>barplus</value> + <value>QA==</value> + <value>4</value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/styles.xml b/tests/text_formatter/s9e/fixtures/styles.xml new file mode 100644 index 0000000000..8004412aea --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/styles.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_styles"> + <column>style_id</column> + <column>style_name</column> + <column>style_copyright</column> + <column>style_active</column> + <column>style_path</column> + <column>bbcode_bitfield</column> + <column>style_parent_id</column> + <column>style_parent_tree</column> + + <row> + <value>1</value> + <value>foo</value> + <value></value> + <value>1</value> + <value>foo</value> + <!-- Bitfield for "b" only --> + <value>QA==</value> + <value>0</value> + <value></value> + </row> + <row> + <value>2</value> + <value>bar</value> + <value></value> + <value>1</value> + <value>bar</value> + <!-- Bitfield for "b" only --> + <value>QA==</value> + <value>0</value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/fixtures/styles/bar/template/bbcode.html b/tests/text_formatter/s9e/fixtures/styles/bar/template/bbcode.html new file mode 100644 index 0000000000..76a35542be --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/styles/bar/template/bbcode.html @@ -0,0 +1,40 @@ +<!-- BEGIN ulist_open --><ul style="list-style-type: {LIST_TYPE}"><!-- END ulist_open --> +<!-- BEGIN ulist_open_default --><ul><!-- END ulist_open_default --> +<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> + +<!-- BEGIN olist_open --><ol style="list-style-type: {LIST_TYPE}"><!-- END olist_open --> +<!-- BEGIN olist_close --></ol><!-- END olist_close --> + +<!-- BEGIN listitem --><li><!-- END listitem --> +<!-- BEGIN listitem_close --></li><!-- END listitem_close --> + +<!-- BEGIN quote_username_open --><blockquote><div><cite>{USERNAME} {L_WROTE}{L_COLON}</cite><!-- END quote_username_open --> +<!-- BEGIN quote_open --><blockquote class="uncited"><div><!-- END quote_open --> +<!-- BEGIN quote_close --></div></blockquote><!-- END quote_close --> + +<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><code><!-- END code_open --> +<!-- BEGIN code_close --></code></div><!-- END code_close --> + +<!-- BEGIN inline_attachment_open --><div class="inline-attachment"><!-- END inline_attachment_open --> +<!-- BEGIN inline_attachment_close --></div><!-- END inline_attachment_close --> + +<!-- BEGIN b_open --><b><!-- END b_open --> +<!-- BEGIN b_close --></b><!-- END b_close --> + +<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> +<!-- BEGIN u_close --></span><!-- END u_close --> + +<!-- BEGIN i_open --><em><!-- END i_open --> +<!-- BEGIN i_close --></em><!-- END i_close --> + +<!-- BEGIN color --><span style="color: {COLOR}">{TEXT}</span><!-- END color --> + +<!-- BEGIN size --><span style="font-size: {SIZE}%; line-height: 116%;">{TEXT}</span><!-- END size --> + +<!-- BEGIN img --><img src="{URL}" class="postimage" alt="{L_IMAGE}" /><!-- END img --> + +<!-- BEGIN url --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END url --> + +<!-- BEGIN email --><a href="mailto:{EMAIL}">{DESCRIPTION}</a><!-- END email --> + +<!-- BEGIN flash --><object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{WIDTH}" height="{HEIGHT}"><param name="movie" value="{URL}" /><param name="play" value="false" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><embed src="{URL}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{WIDTH}" height="{HEIGHT}" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></embed></object><!-- END flash --> diff --git a/tests/text_formatter/s9e/fixtures/styles/barplus/template/bbcode.html b/tests/text_formatter/s9e/fixtures/styles/barplus/template/bbcode.html new file mode 100644 index 0000000000..fad8d828fd --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/styles/barplus/template/bbcode.html @@ -0,0 +1,40 @@ +<!-- BEGIN ulist_open --><ul style="list-style-type: {LIST_TYPE}"><!-- END ulist_open --> +<!-- BEGIN ulist_open_default --><ul><!-- END ulist_open_default --> +<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> + +<!-- BEGIN olist_open --><ol style="list-style-type: {LIST_TYPE}"><!-- END olist_open --> +<!-- BEGIN olist_close --></ol><!-- END olist_close --> + +<!-- BEGIN listitem --><li><!-- END listitem --> +<!-- BEGIN listitem_close --></li><!-- END listitem_close --> + +<!-- BEGIN quote_username_open --><blockquote><div><cite>{USERNAME} {L_WROTE}{L_COLON}</cite><!-- END quote_username_open --> +<!-- BEGIN quote_open --><blockquote class="uncited"><div><!-- END quote_open --> +<!-- BEGIN quote_close --></div></blockquote><!-- END quote_close --> + +<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><code><!-- END code_open --> +<!-- BEGIN code_close --></code></div><!-- END code_close --> + +<!-- BEGIN inline_attachment_open --><div class="inline-attachment"><!-- END inline_attachment_open --> +<!-- BEGIN inline_attachment_close --></div><!-- END inline_attachment_close --> + +<!-- BEGIN b_open --><b class="barplus"><!-- END b_open --> +<!-- BEGIN b_close --></b><!-- END b_close --> + +<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> +<!-- BEGIN u_close --></span><!-- END u_close --> + +<!-- BEGIN i_open --><em><!-- END i_open --> +<!-- BEGIN i_close --></em><!-- END i_close --> + +<!-- BEGIN color --><span style="color: {COLOR}">{TEXT}</span><!-- END color --> + +<!-- BEGIN size --><span style="font-size: {SIZE}%; line-height: 116%;">{TEXT}</span><!-- END size --> + +<!-- BEGIN img --><img src="{URL}" class="postimage" alt="{L_IMAGE}" /><!-- END img --> + +<!-- BEGIN url --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END url --> + +<!-- BEGIN email --><a href="mailto:{EMAIL}">{DESCRIPTION}</a><!-- END email --> + +<!-- BEGIN flash --><object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{WIDTH}" height="{HEIGHT}"><param name="movie" value="{URL}" /><param name="play" value="false" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><embed src="{URL}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{WIDTH}" height="{HEIGHT}" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></embed></object><!-- END flash --> diff --git a/tests/text_formatter/s9e/fixtures/styles/foo/template/bbcode.html b/tests/text_formatter/s9e/fixtures/styles/foo/template/bbcode.html new file mode 100644 index 0000000000..3e38d13a32 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/styles/foo/template/bbcode.html @@ -0,0 +1,40 @@ +<!-- BEGIN ulist_open --><ul style="list-style-type: {LIST_TYPE}"><!-- END ulist_open --> +<!-- BEGIN ulist_open_default --><ul><!-- END ulist_open_default --> +<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> + +<!-- BEGIN olist_open --><ol style="list-style-type: {LIST_TYPE}"><!-- END olist_open --> +<!-- BEGIN olist_close --></ol><!-- END olist_close --> + +<!-- BEGIN listitem --><li><!-- END listitem --> +<!-- BEGIN listitem_close --></li><!-- END listitem_close --> + +<!-- BEGIN quote_username_open --><blockquote><div><cite>{USERNAME} {L_WROTE}{L_COLON}</cite><!-- END quote_username_open --> +<!-- BEGIN quote_open --><blockquote class="uncited"><div><!-- END quote_open --> +<!-- BEGIN quote_close --></div></blockquote><!-- END quote_close --> + +<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><code><!-- END code_open --> +<!-- BEGIN code_close --></code></div><!-- END code_close --> + +<!-- BEGIN inline_attachment_open --><div class="inline-attachment"><!-- END inline_attachment_open --> +<!-- BEGIN inline_attachment_close --></div><!-- END inline_attachment_close --> + +<!-- BEGIN b_open --><strong><!-- END b_open --> +<!-- BEGIN b_close --></strong><!-- END b_close --> + +<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> +<!-- BEGIN u_close --></span><!-- END u_close --> + +<!-- BEGIN i_open --><em><!-- END i_open --> +<!-- BEGIN i_close --></em><!-- END i_close --> + +<!-- BEGIN color --><span style="color: {COLOR}">{TEXT}</span><!-- END color --> + +<!-- BEGIN size --><span style="font-size: {SIZE}%; line-height: 116%;">{TEXT}</span><!-- END size --> + +<!-- BEGIN img --><img src="{URL}" class="postimage" alt="{L_IMAGE}" /><!-- END img --> + +<!-- BEGIN url --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END url --> + +<!-- BEGIN email --><a href="mailto:{EMAIL}">{DESCRIPTION}</a><!-- END email --> + +<!-- BEGIN flash --><object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{WIDTH}" height="{HEIGHT}"><param name="movie" value="{URL}" /><param name="play" value="false" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><embed src="{URL}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{WIDTH}" height="{HEIGHT}" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></embed></object><!-- END flash --> diff --git a/tests/text_formatter/s9e/fixtures/unsafe_bbcode.xml b/tests/text_formatter/s9e/fixtures/unsafe_bbcode.xml new file mode 100644 index 0000000000..55a2e689b6 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/unsafe_bbcode.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>xss=</value> + <value></value> + <value>1</value> + <value>[xss={TEXT1}]{TEXT2}[/xss]</value> + <value><![CDATA[<a href="{TEXT1}">{TEXT2}</a>]]></value> + <value><\[/xss\]!ies]]></value> + <value><![CDATA['[xss='.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${1}')).':$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${2}')).'[/xss:$uid]']]></value> + <value><\[/xss:$uid\]!s]]></value> + <value><![CDATA[<a href="${1}">${2}</a>]]></value> + </row> + </table> +</dataset> diff --git a/tests/text_formatter/s9e/parser_test.php b/tests/text_formatter/s9e/parser_test.php new file mode 100644 index 0000000000..3b72e713e1 --- /dev/null +++ b/tests/text_formatter/s9e/parser_test.php @@ -0,0 +1,260 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; + +class phpbb_textformatter_s9e_parser_test extends phpbb_test_case +{ + public function test_load_from_cache() + { + $mock = $this->getMockBuilder('s9e\\TextFormatter\\Parser') + ->disableOriginalConstructor() + ->getMock(); + + $cache = $this->getMock('phpbb_mock_cache'); + $cache->expects($this->once()) + ->method('get') + ->with('_foo_parser') + ->will($this->returnValue($mock)); + + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->never())->method('regenerate'); + + $parser = new \phpbb\textformatter\s9e\parser( + $cache, + '_foo_parser', + $factory, + new phpbb_mock_event_dispatcher + ); + } + + public function test_use_from_cache() + { + $mock = $this->getMockBuilder('s9e\\TextFormatter\\Parser') + ->disableOriginalConstructor() + ->getMock(); + + $mock->expects($this->once()) + ->method('parse') + ->with('test') + ->will($this->returnValue('<t>test</t>')); + + $cache = new phpbb_mock_cache; + $cache->put('_foo_parser', $mock); + + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->never())->method('regenerate'); + + $parser = new \phpbb\textformatter\s9e\parser( + $cache, + '_foo_parser', + $factory, + new phpbb_mock_event_dispatcher + ); + + $this->assertSame('<t>test</t>', $parser->parse('test')); + } + + public function test_regenerate_on_cache_miss() + { + $mock = $this->getMockBuilder('s9e\\TextFormatter\\Parser') + ->disableOriginalConstructor() + ->getMock(); + + $mock->expects($this->once()) + ->method('parse') + ->with('test') + ->will($this->returnValue('<t>test</t>')); + + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->once()) + ->method('regenerate') + ->will($this->returnValue(array('parser' => $mock))); + + $parser = new \phpbb\textformatter\s9e\parser( + new phpbb_mock_cache, + '_foo_parser', + $factory, + new phpbb_mock_event_dispatcher + ); + + $this->assertSame('<t>test</t>', $parser->parse('test')); + } + + /** + * @dataProvider get_options_tests() + */ + public function test_options($adapter_method, $adapter_arg, $concrete_method, $concrete_arg) + { + $mock = $this->getMockBuilder('s9e\\TextFormatter\\Parser') + ->setMethods(array($concrete_method)) + ->disableOriginalConstructor() + ->getMock(); + foreach ((array) $concrete_arg as $i => $concrete_arg) + { + $mock->expects($this->at($i)) + ->method($concrete_method) + ->with($concrete_arg); + } + + $cache = new phpbb_mock_cache; + $cache->put('_foo_parser', $mock); + + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + + $parser = new \phpbb\textformatter\s9e\parser( + $cache, + '_foo_parser', + $factory, + new phpbb_mock_event_dispatcher + ); + + call_user_func_array(array($parser, $adapter_method), (array) $adapter_arg); + } + + public function get_options_tests() + { + return array( + array( + 'disable_bbcode', 'url', + 'disableTag', 'URL' + ), + array( + 'disable_bbcodes', null, + 'disablePlugin', 'BBCodes' + ), + array( + 'disable_magic_url', null, + 'disablePlugin', array('Autoemail', 'Autolink') + ), + array( + 'disable_smilies', null, + 'disablePlugin', 'Emoticons' + ), + array( + 'enable_bbcode', 'url', + 'enableTag', 'URL' + ), + array( + 'enable_bbcodes', null, + 'enablePlugin', 'BBCodes' + ), + array( + 'enable_magic_url', null, + 'enablePlugin', array('Autoemail', 'Autolink') + ), + array( + 'enable_smilies', null, + 'enablePlugin', 'Emoticons' + ) + ); + } + + /** + * @testdox The constructor triggers a core.text_formatter_s9e_parser_setup event + */ + public function test_setup_event() + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher + ->expects($this->once()) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_parser_setup', + $this->callback(array($this, 'setup_event_callback')) + ) + ->will($this->returnArgument(1)); + + new \phpbb\textformatter\s9e\parser( + $container->get('cache.driver'), + '_foo_parser', + $container->get('text_formatter.s9e.factory'), + $dispatcher + ); + } + + public function setup_event_callback($vars) + { + return isset($vars['parser']) + && $vars['parser'] instanceof \phpbb\textformatter\s9e\parser; + } + + /** + * @testdox parse() triggers a core.text_formatter_s9e_parse_before and core.text_formatter_s9e_parse_after events + */ + public function test_parse_event() + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher + ->expects($this->any()) + ->method('trigger_event') + ->will($this->returnArgument(1)); + $dispatcher + ->expects($this->at(1)) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_parse_before', + $this->callback(array($this, 'parse_before_event_callback')) + ) + ->will($this->returnArgument(1)); + $dispatcher + ->expects($this->at(2)) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_parse_after', + $this->callback(array($this, 'parse_after_event_callback')) + ) + ->will($this->returnArgument(1)); + + $parser = new \phpbb\textformatter\s9e\parser( + $container->get('cache.driver'), + '_foo_parser', + $container->get('text_formatter.s9e.factory'), + $dispatcher + ); + $parser->parse('...'); + } + + public function parse_before_event_callback($vars) + { + return isset($vars['parser']) + && $vars['parser'] instanceof \phpbb\textformatter\s9e\parser + && isset($vars['text']) + && $vars['text'] === '...'; + } + + public function parse_after_event_callback($vars) + { + return isset($vars['parser']) + && $vars['parser'] instanceof \phpbb\textformatter\s9e\parser + && isset($vars['xml']) + && $vars['xml'] === '<t>...</t>'; + } + + public function test_get_parser() + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $parser = $container->get('text_formatter.parser'); + $this->assertInstanceOf('s9e\\TextFormatter\\Parser', $parser->get_parser()); + } +} diff --git a/tests/text_formatter/s9e/renderer_test.php b/tests/text_formatter/s9e/renderer_test.php new file mode 100644 index 0000000000..ad5bfa78fc --- /dev/null +++ b/tests/text_formatter/s9e/renderer_test.php @@ -0,0 +1,483 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; + +class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case +{ + public function get_cache_dir() + { + return __DIR__ . '/../../tmp/'; + } + + public function test_load_from_cache() + { + // Save a fake renderer class in the cache dir + file_put_contents( + $this->get_cache_dir() . 'renderer_foo.php', + '<?php class renderer_foo { public function setParameter() {} }' + ); + + $cache = $this->getMock('phpbb_mock_cache'); + $cache->expects($this->once()) + ->method('get') + ->with('_foo_renderer') + ->will($this->returnValue(array('class' => 'renderer_foo'))); + + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->never())->method('regenerate'); + + $renderer = new \phpbb\textformatter\s9e\renderer( + $cache, + $this->get_cache_dir(), + '_foo_renderer', + $factory, + new phpbb_mock_event_dispatcher + ); + } + + public function test_regenerate_on_cache_miss() + { + $mock = $this->getMockForAbstractClass('s9e\\TextFormatter\\Renderer'); + + $cache = $this->getMock('phpbb_mock_cache'); + $cache->expects($this->once()) + ->method('get') + ->with('_foo_renderer') + ->will($this->returnValue(false)); + + $factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory') + ->disableOriginalConstructor() + ->getMock(); + $factory->expects($this->once()) + ->method('regenerate') + ->will($this->returnValue(array('parser' => $mock))); + + $renderer = new \phpbb\textformatter\s9e\renderer( + $cache, + $this->get_cache_dir(), + '_foo_renderer', + $factory, + new phpbb_mock_event_dispatcher + ); + } + + /** + * @dataProvider get_options_cases + */ + public function test_options($original, $expected, $calls) + { + $container = new phpbb_mock_container_builder; + $this->get_test_case_helpers()->set_s9e_services($container); + + $renderer = $container->get('text_formatter.renderer'); + + foreach ($calls as $method => $arg) + { + $renderer->$method($arg); + } + + $this->assertSame($expected, $renderer->render($original)); + } + + public function get_options_cases() + { + return array( + array( + '<t>apple</t>', + 'banana', + array('set_viewcensors' => true) + ), + array( + '<t>apple</t>', + 'apple', + array('set_viewcensors' => false) + ), + array( + '<r><FLASH height="456" url="http://example.org/foo.swf" width="123"><s>[flash=123,456]</s><URL url="http://example.org/foo.swf">http://example.org/foo.swf</URL><e>[/flash]</e></FLASH></r>', + '<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="123" height="456"><param name="movie" value="http://example.org/foo.swf"><param name="play" value="false"><param name="loop" value="false"><param name="quality" value="high"><param name="allowScriptAccess" value="never"><param name="allowNetworking" value="internal"><embed src="http://example.org/foo.swf" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="123" height="456" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></object>', + array('set_viewflash' => true) + ), + array( + '<r><IMG src="http://example.org/foo.png"><s>[img]</s>http://example.org/foo.png<e>[/img]</e></IMG></r>', + '<img src="http://example.org/foo.png" class="postimage" alt="Image">', + array('set_viewimg' => true) + ), + array( + '<r><E>:)</E></r>', + '<img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" alt=":)" title="Smile">', + array('set_viewsmilies' => true) + ), + array( + '<r><E>:)</E></r>', + ':)', + array('set_viewsmilies' => false) + ), + ); + } + + /** + * @dataProvider get_default_options_cases + */ + public function test_default_options($original, $expected, $setup = null) + { + $container = new phpbb_mock_container_builder; + + if (isset($setup)) + { + $setup($container, $this); + } + + $this->get_test_case_helpers()->set_s9e_services($container); + + $this->assertSame($expected, $container->get('text_formatter.renderer')->render($original)); + } + + public function get_default_options_cases() + { + return array( + array( + '<t>apple</t>', + 'banana' + ), + array( + '<t>apple</t>', + 'banana', + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewcensors', false); + + $phpbb_container->set('user', $user); + } + ), + array( + '<t>apple</t>', + 'banana', + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewcensors', false); + + $config = new \phpbb\config\config(array('allow_nocensors' => true)); + + $phpbb_container->set('user', $user); + $phpbb_container->set('config', $config); + } + ), + array( + '<t>apple</t>', + 'apple', + function ($phpbb_container, $test) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewcensors', false); + + $config = new \phpbb\config\config(array('allow_nocensors' => true)); + + $auth = $test->getMock('phpbb\\auth\\auth'); + $auth->expects($test->any()) + ->method('acl_get') + ->with('u_chgcensors') + ->will($test->returnValue(true)); + + $phpbb_container->set('user', $user); + $phpbb_container->set('config', $config); + $phpbb_container->set('auth', $auth); + } + ), + array( + '<r><FLASH url="http://localhost/foo.swf" width="123" height="456"><s>[flash=123,456]</s>http://localhost/foo.swf<e>[/flash]</e></FLASH></r>', + '<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="123" height="456"><param name="movie" value="http://localhost/foo.swf"><param name="play" value="false"><param name="loop" value="false"><param name="quality" value="high"><param name="allowScriptAccess" value="never"><param name="allowNetworking" value="internal"><embed src="http://localhost/foo.swf" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="123" height="456" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></object>' + ), + array( + '<r><FLASH url="http://localhost/foo.swf" width="123" height="456"><s>[flash=123,456]</s>http://localhost/foo.swf<e>[/flash]</e></FLASH></r>', + 'http://localhost/foo.swf', + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewflash', false); + + $phpbb_container->set('user', $user); + } + ), + array( + '<r><IMG src="http://localhost/mrgreen.gif"><s>[img]</s><URL url="http://localhost/mrgreen.gif">http://localhost/mrgreen.gif</URL><e>[/img]</e></IMG></r>', + '<img src="http://localhost/mrgreen.gif" class="postimage" alt="Image">' + ), + array( + '<r><IMG src="http://localhost/mrgreen.gif"><s>[img]</s><URL url="http://localhost/mrgreen.gif">http://localhost/mrgreen.gif</URL><e>[/img]</e></IMG></r>', + '<a href="http://localhost/mrgreen.gif" class="postlink">http://localhost/mrgreen.gif</a>', + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewimg', false); + + $phpbb_container->set('user', $user); + } + ), + array( + '<r><E>:)</E></r>', + '<img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" alt=":)" title="Smile">' + ), + array( + '<r><E>:)</E></r>', + ':)', + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('smilies', false); + + $phpbb_container->set('user', $user); + } + ), + ); + } + + public function test_default_lang() + { + global $phpbb_container; + $this->get_test_case_helpers()->set_s9e_services($phpbb_container, __DIR__ . '/fixtures/default_lang.xml'); + + $renderer = $phpbb_container->get('text_formatter.renderer'); + + $this->assertSame('FOO_BAR', $renderer->render('<r><FOO/></r>')); + } + + /** + * @dataProvider get_option_names + */ + public function test_get_option($option_name) + { + global $phpbb_container; + $this->get_test_case_helpers()->set_s9e_services(); + + $renderer = $phpbb_container->get('text_formatter.renderer'); + + $renderer->{'set_' . $option_name}(false); + $this->assertFalse($renderer->{'get_' . $option_name}()); + $renderer->{'set_' . $option_name}(true); + $this->assertTrue($renderer->{'get_' . $option_name}()); + } + + public function get_option_names() + { + return array( + array('viewcensors'), + array('viewflash'), + array('viewimg'), + array('viewsmilies') + ); + } + + public function test_styles() + { + global $phpbb_container; + + $tests = array( + 1 => '<strong>bold</strong>', + 2 => '<b>bold</b>' + ); + + global $phpbb_root_path, $phpEx; + + foreach ($tests as $style_id => $expected) + { + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->style = array('style_id' => $style_id); + + $phpbb_container = new phpbb_mock_container_builder; + $phpbb_container->set('user', $user); + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container, __DIR__ . '/fixtures/styles.xml', __DIR__ . '/fixtures/styles/'); + + $renderer = $phpbb_container->get('text_formatter.renderer'); + $this->assertSame( + $expected, + $renderer->render('<r><B><s>[b]</s>bold<e>[/b]</e></B></r>') + ); + } + } + + public function test_style_inheritance1() + { + global $phpbb_container, $phpbb_root_path, $phpEx; + + // Style 3 inherits from 2 which inherits from 1. Only style 1 has a bbcode.html + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->style = array('style_id' => 3); + + $phpbb_container = new phpbb_mock_container_builder; + $phpbb_container->set('user', $user); + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container, __DIR__ . '/fixtures/style_inheritance.xml', __DIR__ . '/fixtures/styles/'); + + $renderer = $phpbb_container->get('text_formatter.renderer'); + $this->assertSame( + '<strong>bold</strong>', + $renderer->render('<r><B><s>[b]</s>bold<e>[/b]</e></B></r>') + ); + } + + public function test_style_inheritance2() + { + global $phpbb_container, $phpbb_root_path, $phpEx; + + // Style 5 inherits from 4, but both have a bbcode.html + $tests = array( + 4 => '<b>bold</b>', + 5 => '<b class="barplus">bold</b>' + ); + + foreach ($tests as $style_id => $expected) + { + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->style = array('style_id' => $style_id); + + $phpbb_container = new phpbb_mock_container_builder; + $phpbb_container->set('user', $user); + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container, __DIR__ . '/fixtures/style_inheritance.xml', __DIR__ . '/fixtures/styles/'); + + $renderer = $phpbb_container->get('text_formatter.renderer'); + $this->assertSame( + $expected, + $renderer->render('<r><B><s>[b]</s>bold<e>[/b]</e></B></r>') + ); + } + } + + /** + * @testdox The constructor triggers a core.text_formatter_s9e_renderer_setup event + */ + public function test_setup_event() + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher + ->expects($this->once()) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_renderer_setup', + $this->callback(array($this, 'setup_event_callback')) + ) + ->will($this->returnArgument(1)); + + new \phpbb\textformatter\s9e\renderer( + $container->get('cache.driver'), + $container->getParameter('cache.dir'), + '_foo_renderer', + $container->get('text_formatter.s9e.factory'), + $dispatcher + ); + } + + public function setup_event_callback($vars) + { + return isset($vars['renderer']) + && $vars['renderer'] instanceof \phpbb\textformatter\s9e\renderer; + } + + /** + * @testdox render() triggers a core.text_formatter_s9e_render_before and core.text_formatter_s9e_render_after events + */ + public function test_render_event() + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher + ->expects($this->any()) + ->method('trigger_event') + ->will($this->returnArgument(1)); + $dispatcher + ->expects($this->at(1)) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_render_before', + $this->callback(array($this, 'render_before_event_callback')) + ) + ->will($this->returnArgument(1)); + $dispatcher + ->expects($this->at(2)) + ->method('trigger_event') + ->with( + 'core.text_formatter_s9e_render_after', + $this->callback(array($this, 'render_after_event_callback')) + ) + ->will($this->returnArgument(1)); + + $renderer = new \phpbb\textformatter\s9e\renderer( + $container->get('cache.driver'), + $container->getParameter('cache.dir'), + '_foo_renderer', + $container->get('text_formatter.s9e.factory'), + $dispatcher + ); + $renderer->render('<t>...</t>'); + } + + public function render_before_event_callback($vars) + { + return isset($vars['renderer']) + && $vars['renderer'] instanceof \phpbb\textformatter\s9e\renderer + && isset($vars['xml']) + && $vars['xml'] === '<t>...</t>'; + } + + public function render_after_event_callback($vars) + { + return isset($vars['html']) + && $vars['html'] === '...' + && isset($vars['renderer']) + && $vars['renderer'] instanceof \phpbb\textformatter\s9e\renderer; + } + + public function test_get_renderer() + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $renderer = $container->get('text_formatter.renderer'); + $this->assertInstanceOf('s9e\\TextFormatter\\Renderer', $renderer->get_renderer()); + } +} diff --git a/tests/text_formatter/s9e/utils_test.php b/tests/text_formatter/s9e/utils_test.php new file mode 100644 index 0000000000..dade259790 --- /dev/null +++ b/tests/text_formatter/s9e/utils_test.php @@ -0,0 +1,279 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; + +class phpbb_textformatter_s9e_utils_test extends phpbb_test_case +{ + /** + * @dataProvider get_unparse_tests + */ + public function test_unparse($original, $expected) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $utils = $container->get('text_formatter.utils'); + + $this->assertSame($expected, $utils->unparse($original)); + } + + public function get_unparse_tests() + { + return array( + array( + '<t>Plain text</t>', + 'Plain text' + ), + array( + "<t>Multi<br/>\nline</t>", + "Multi\nline" + ), + array( + '<r><B><s>[b]</s>bold<e>[/b]</e></B></r>', + '[b]bold[/b]' + ) + ); + } + + /** + * @dataProvider get_clean_formatting_tests + */ + public function test_clean_formatting($original, $expected) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $utils = $container->get('text_formatter.utils'); + + $this->assertSame($expected, $utils->clean_formatting($original)); + } + + public function get_clean_formatting_tests() + { + return array( + array( + '<t>Plain text</t>', + 'Plain text' + ), + array( + "<t>Multi<br/>\nline</t>", + "Multi\nline" + ), + array( + '<r><B><s>[b]</s>bold<e>[/b]</e></B></r>', + ' bold ' + ) + ); + } + + /** + * @dataProvider get_outermost_quote_authors_tests + */ + public function test_get_outermost_quote_authors($original, $expected) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $utils = $container->get('text_formatter.utils'); + $parser = $container->get('text_formatter.parser'); + + $this->assertSame($expected, $utils->get_outermost_quote_authors($parser->parse($original))); + } + + public function get_outermost_quote_authors_tests() + { + return array( + array( + 'No quotes here', + array() + ), + array( + '[quote="foo"]..[/quote] [quote]..[/quote]', + array('foo') + ), + array( + '[quote=foo]..[/quote] [quote]..[/quote]', + array('foo') + ), + array( + '[quote=foo]..[/quote] [quote=bar]..[/quote]', + array('foo', 'bar') + ), + array( + '[quote=foo].[quote=baz]..[/quote].[/quote] [quote=bar]..[/quote]', + array('foo', 'bar') + ), + ); + } + + /** + * @dataProvider get_generate_quote_tests + */ + public function test_generate_quote($text, $params, $expected) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $utils = $container->get('text_formatter.utils'); + + $this->assertSame($expected, $utils->generate_quote($text, $params)); + } + + public function get_generate_quote_tests() + { + return array( + array( + '...', + array(), + '[quote]...[/quote]', + ), + array( + '...', + array('author' => 'Brian Kibler'), + '[quote="Brian Kibler"]...[/quote]', + ), + array( + '...', + array('author' => 'Brian "Brian Kibler" Kibler of Brian Kibler Gaming'), + '[quote=\'Brian "Brian Kibler" Kibler of Brian Kibler Gaming\']...[/quote]', + ), + array( + '...', + array('author' => "Brian Kibler Gaming's Brian Kibler"), + '[quote="Brian Kibler Gaming\'s Brian Kibler"]...[/quote]', + ), + array( + '...', + array('author' => "\\\"'"), + '[quote="\\\\\\"\'"]...[/quote]', + ), + array( + '...', + array('author' => 'Lots of doubles """ one single \' one backslash \\'), + '[quote=\'Lots of doubles """ one single \\\' one backslash \\\\\']...[/quote]', + ), + array( + '...', + array('author' => "Lots of singles ''' one double \" one backslash \\"), + '[quote="Lots of singles \'\'\' one double \\" one backslash \\\\"]...[/quote]', + ), + array( + '...', + array('author' => 'Defaults to doublequotes """\'\'\''), + '[quote="Defaults to doublequotes \\"\\"\\"\'\'\'"]...[/quote]', + ), + array( + '...', + array( + 'author' => 'user', + 'post_id' => 123, + 'url' => 'http://example.org' + ), + '[quote=user post_id=123 url=http://example.org]...[/quote]', + ), + array( + '...', + array( + 'author' => 'user', + 'post_id' => 123, + 'user_id' => ANONYMOUS + ), + '[quote=user post_id=123]...[/quote]', + ), + array( + '...', + array('author' => ' '), + '[quote=" "]...[/quote]', + ), + array( + '...', + array('author' => 'foo bar'), + '[quote="foo bar"]...[/quote]', + ), + array( + '...', + array('author' => '\\'), + '[quote="\\\\"]...[/quote]', + ), + array( + '...', + array('author' => '[quote="foo"]'), + '[quote=\'[quote="foo"]\']...[/quote]', + ), + array( + '...', + array('author' => '""'), + '[quote=\'""\']...[/quote]', + ), + array( + '...', + array('author' => "''"), + '[quote="\'\'"]...[/quote]', + ), + array( + 'This is a long quote that is definitely going to exceed 80 characters', + array(), + "[quote]\nThis is a long quote that is definitely going to exceed 80 characters\n[/quote]", + ), + array( + ' This is a short quote on its own line ', + array(), + '[quote]This is a short quote on its own line[/quote]', + ), + array( + "This is a short quote\non two lines", + array(), + "[quote]\nThis is a short quote\non two lines\n[/quote]", + ), + ); + } + + /** + * @dataProvider get_remove_bbcode_tests + */ + public function test_remove_bbcode($original, $name, $depth, $expected) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $parser = $container->get('text_formatter.parser'); + $utils = $container->get('text_formatter.utils'); + + $parsed = $parser->parse($original); + $actual = $utils->unparse($utils->remove_bbcode($parsed, $name, $depth)); + + $this->assertSame($expected, $actual); + } + + public function get_remove_bbcode_tests() + { + return array( + array( + 'Plain text', + 'b', + 1, + 'Plain text' + ), + array( + '[quote="u0"][quote="u1"][quote="u2"]q2[/quote]q1[/quote]q0[/quote][b]bold[/b]', + 'quote', + 0, + '[b]bold[/b]', + ), + array( + '[quote="u0"][quote="u1"][quote="u2"]q2[/quote]q1[/quote]q0[/quote][b]bold[/b]', + 'quote', + 1, + '[quote="u0"]q0[/quote][b]bold[/b]', + ), + array( + '[quote="u0"][quote="u1"][quote="u2"]q2[/quote]q1[/quote]q0[/quote][b]bold[/b]', + 'quote', + 2, + '[quote="u0"][quote="u1"]q1[/quote]q0[/quote][b]bold[/b]', + ), + ); + } +} diff --git a/tests/text_processing/censor_text_test.php b/tests/text_processing/censor_text_test.php index 043d8eb27d..983a5ba2d3 100644 --- a/tests/text_processing/censor_text_test.php +++ b/tests/text_processing/censor_text_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php new file mode 100644 index 0000000000..7de599f2b1 --- /dev/null +++ b/tests/text_processing/decode_message_test.php @@ -0,0 +1,99 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; + +class phpbb_text_processing_decode_message_test extends phpbb_test_case +{ + /** + * @dataProvider get_legacy_tests + */ + public function test_legacy($original, $expected, $bbcode_uid = '') + { + $actual = $original; + decode_message($actual, $bbcode_uid); + + $this->assertSame($expected, $actual); + } + + public function get_legacy_tests() + { + return array( + array( + "&<>"'", + "&<>"'" + ), + array( + '<!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) -->', + ':)' + ), + array( + '<!-- w --><a class="postlink" href="http://www.phpbb.com">www.phpbb.com</a><!-- w -->', + 'www.phpbb.com' + ), + array( + '<!-- m --><a class="postlink" href="http://www.phpbb.com">http://www.phpbb.com</a><!-- m -->', + 'http://www.phpbb.com' + ), + /** + * Fails as per PHPBB3-8420 + * @link http://tracker.phpbb.com/browse/PHPBB3-8420 + * + array( + '[url=http://example.com:2cpxwbdy]<!-- s:arrow: --><img src="{SMILIES_PATH}/icon_arrow.gif" alt=":arrow:" title="Arrow" /><!-- s:arrow: --> here[/url:2cpxwbdy]', + '[url=http://example.com] :arrow: here[/url]', + '2cpxwbdy' + ), + */ + ); + } + + /** + * @dataProvider get_text_formatter_tests + */ + public function test_text_formatter($original, $expected) + { + $this->get_test_case_helpers()->set_s9e_services(); + + $actual = $original; + decode_message($actual); + + $this->assertSame($expected, $actual); + } + + public function get_text_formatter_tests() + { + return array( + array( + "<t>&<>\"'", + "&<>"'" + ), + array( + '<r><E>:)</E></r>', + ':)' + ), + array( + "<t>a<br/>\nb</t>", + "a\nb" + ), + /** + * @link http://tracker.phpbb.com/browse/PHPBB3-8420 + */ + array( + '<r><URL url="http://example.com"><s>[url=http://example.com]</s> <E>:arrow:</E> here<e>[/url]</e></URL></r>', + '[url=http://example.com] :arrow: here[/url]' + ), + ); + } +} diff --git a/tests/text_processing/fixtures/empty.xml b/tests/text_processing/fixtures/empty.xml new file mode 100644 index 0000000000..d8206ad124 --- /dev/null +++ b/tests/text_processing/fixtures/empty.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> +</dataset> diff --git a/tests/text_processing/fixtures/smilies.xml b/tests/text_processing/fixtures/smilies.xml new file mode 100644 index 0000000000..25b2e60836 --- /dev/null +++ b/tests/text_processing/fixtures/smilies.xml @@ -0,0 +1,443 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_smilies"> + <column>smiley_id</column> + <column>code</column> + <column>emotion</column> + <column>smiley_url</column> + <column>smiley_width</column> + <column>smiley_height</column> + <column>smiley_order</column> + <column>display_on_posting</column> + <row> + <value>1</value> + <value>:D</value> + <value>Very Happy</value> + <value>icon_e_biggrin.gif</value> + <value>15</value> + <value>17</value> + <value>1</value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>:-D</value> + <value>Very Happy</value> + <value>icon_e_biggrin.gif</value> + <value>15</value> + <value>17</value> + <value>2</value> + <value>1</value> + </row> + <row> + <value>3</value> + <value>:grin:</value> + <value>Very Happy</value> + <value>icon_e_biggrin.gif</value> + <value>15</value> + <value>17</value> + <value>3</value> + <value>1</value> + </row> + <row> + <value>4</value> + <value>:)</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>4</value> + <value>1</value> + </row> + <row> + <value>5</value> + <value>:-)</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>5</value> + <value>1</value> + </row> + <row> + <value>6</value> + <value>:smile:</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>6</value> + <value>1</value> + </row> + <row> + <value>7</value> + <value>;)</value> + <value>Wink</value> + <value>icon_e_wink.gif</value> + <value>15</value> + <value>17</value> + <value>7</value> + <value>1</value> + </row> + <row> + <value>8</value> + <value>;-)</value> + <value>Wink</value> + <value>icon_e_wink.gif</value> + <value>15</value> + <value>17</value> + <value>8</value> + <value>1</value> + </row> + <row> + <value>9</value> + <value>:wink:</value> + <value>Wink</value> + <value>icon_e_wink.gif</value> + <value>15</value> + <value>17</value> + <value>9</value> + <value>1</value> + </row> + <row> + <value>10</value> + <value>:(</value> + <value>Sad</value> + <value>icon_e_sad.gif</value> + <value>15</value> + <value>17</value> + <value>10</value> + <value>1</value> + </row> + <row> + <value>11</value> + <value>:-(</value> + <value>Sad</value> + <value>icon_e_sad.gif</value> + <value>15</value> + <value>17</value> + <value>11</value> + <value>1</value> + </row> + <row> + <value>12</value> + <value>:sad:</value> + <value>Sad</value> + <value>icon_e_sad.gif</value> + <value>15</value> + <value>17</value> + <value>12</value> + <value>1</value> + </row> + <row> + <value>13</value> + <value>:o</value> + <value>Surprised</value> + <value>icon_e_surprised.gif</value> + <value>15</value> + <value>17</value> + <value>13</value> + <value>1</value> + </row> + <row> + <value>14</value> + <value>:-o</value> + <value>Surprised</value> + <value>icon_e_surprised.gif</value> + <value>15</value> + <value>17</value> + <value>14</value> + <value>1</value> + </row> + <row> + <value>15</value> + <value>:eek:</value> + <value>Surprised</value> + <value>icon_e_surprised.gif</value> + <value>15</value> + <value>17</value> + <value>15</value> + <value>1</value> + </row> + <row> + <value>16</value> + <value>:shock:</value> + <value>Shocked</value> + <value>icon_eek.gif</value> + <value>15</value> + <value>17</value> + <value>16</value> + <value>1</value> + </row> + <row> + <value>17</value> + <value>:?</value> + <value>Confused</value> + <value>icon_e_confused.gif</value> + <value>15</value> + <value>17</value> + <value>17</value> + <value>1</value> + </row> + <row> + <value>18</value> + <value>:-?</value> + <value>Confused</value> + <value>icon_e_confused.gif</value> + <value>15</value> + <value>17</value> + <value>18</value> + <value>1</value> + </row> + <row> + <value>19</value> + <value>:???:</value> + <value>Confused</value> + <value>icon_e_confused.gif</value> + <value>15</value> + <value>17</value> + <value>19</value> + <value>1</value> + </row> + <row> + <value>20</value> + <value>8-)</value> + <value>Cool</value> + <value>icon_cool.gif</value> + <value>15</value> + <value>17</value> + <value>20</value> + <value>1</value> + </row> + <row> + <value>21</value> + <value>:cool:</value> + <value>Cool</value> + <value>icon_cool.gif</value> + <value>15</value> + <value>17</value> + <value>21</value> + <value>1</value> + </row> + <row> + <value>22</value> + <value>:lol:</value> + <value>Laughing</value> + <value>icon_lol.gif</value> + <value>15</value> + <value>17</value> + <value>22</value> + <value>1</value> + </row> + <row> + <value>23</value> + <value>:x</value> + <value>Mad</value> + <value>icon_mad.gif</value> + <value>15</value> + <value>17</value> + <value>23</value> + <value>1</value> + </row> + <row> + <value>24</value> + <value>:-x</value> + <value>Mad</value> + <value>icon_mad.gif</value> + <value>15</value> + <value>17</value> + <value>24</value> + <value>1</value> + </row> + <row> + <value>25</value> + <value>:mad:</value> + <value>Mad</value> + <value>icon_mad.gif</value> + <value>15</value> + <value>17</value> + <value>25</value> + <value>1</value> + </row> + <row> + <value>26</value> + <value>:P</value> + <value>Razz</value> + <value>icon_razz.gif</value> + <value>15</value> + <value>17</value> + <value>26</value> + <value>1</value> + </row> + <row> + <value>27</value> + <value>:-P</value> + <value>Razz</value> + <value>icon_razz.gif</value> + <value>15</value> + <value>17</value> + <value>27</value> + <value>1</value> + </row> + <row> + <value>28</value> + <value>:razz:</value> + <value>Razz</value> + <value>icon_razz.gif</value> + <value>15</value> + <value>17</value> + <value>28</value> + <value>1</value> + </row> + <row> + <value>29</value> + <value>:oops:</value> + <value>Embarrassed</value> + <value>icon_redface.gif</value> + <value>15</value> + <value>17</value> + <value>29</value> + <value>1</value> + </row> + <row> + <value>30</value> + <value>:cry:</value> + <value>Crying or Very Sad</value> + <value>icon_cry.gif</value> + <value>15</value> + <value>17</value> + <value>30</value> + <value>1</value> + </row> + <row> + <value>31</value> + <value>:evil:</value> + <value>Evil or Very Mad</value> + <value>icon_evil.gif</value> + <value>15</value> + <value>17</value> + <value>31</value> + <value>1</value> + </row> + <row> + <value>32</value> + <value>:twisted:</value> + <value>Twisted Evil</value> + <value>icon_twisted.gif</value> + <value>15</value> + <value>17</value> + <value>32</value> + <value>1</value> + </row> + <row> + <value>33</value> + <value>:roll:</value> + <value>Rolling Eyes</value> + <value>icon_rolleyes.gif</value> + <value>15</value> + <value>17</value> + <value>33</value> + <value>1</value> + </row> + <row> + <value>34</value> + <value>:!:</value> + <value>Exclamation</value> + <value>icon_exclaim.gif</value> + <value>15</value> + <value>17</value> + <value>34</value> + <value>1</value> + </row> + <row> + <value>35</value> + <value>:?:</value> + <value>Question</value> + <value>icon_question.gif</value> + <value>15</value> + <value>17</value> + <value>35</value> + <value>1</value> + </row> + <row> + <value>36</value> + <value>:idea:</value> + <value>Idea</value> + <value>icon_idea.gif</value> + <value>15</value> + <value>17</value> + <value>36</value> + <value>1</value> + </row> + <row> + <value>37</value> + <value>:arrow:</value> + <value>Arrow</value> + <value>icon_arrow.gif</value> + <value>15</value> + <value>17</value> + <value>37</value> + <value>1</value> + </row> + <row> + <value>38</value> + <value>:|</value> + <value>Neutral</value> + <value>icon_neutral.gif</value> + <value>15</value> + <value>17</value> + <value>38</value> + <value>1</value> + </row> + <row> + <value>39</value> + <value>:-|</value> + <value>Neutral</value> + <value>icon_neutral.gif</value> + <value>15</value> + <value>17</value> + <value>39</value> + <value>1</value> + </row> + <row> + <value>40</value> + <value>:mrgreen:</value> + <value>Mr. Green</value> + <value>icon_mrgreen.gif</value> + <value>15</value> + <value>17</value> + <value>40</value> + <value>1</value> + </row> + <row> + <value>41</value> + <value>:geek:</value> + <value>Geek</value> + <value>icon_e_geek.gif</value> + <value>17</value> + <value>17</value> + <value>41</value> + <value>1</value> + </row> + <row> + <value>42</value> + <value>:ugeek:</value> + <value>Uber Geek</value> + <value>icon_e_ugeek.gif</value> + <value>17</value> + <value>18</value> + <value>42</value> + <value>1</value> + </row> + <row> + <value>43</value> + <value>8)</value> + <value>8)</value> + <value>custom.gif</value> + <value>17</value> + <value>18</value> + <value>42</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php index 15905535ac..dba3713447 100644 --- a/tests/text_processing/generate_text_for_display_test.php +++ b/tests/text_processing/generate_text_for_display_test.php @@ -1,16 +1,18 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; -require_once dirname(__FILE__) . '/../mock/user.php'; -require_once dirname(__FILE__) . '/../mock/cache.php'; +require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_case { @@ -20,21 +22,195 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca parent::setUp(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + $config = new \phpbb\config\config(array()); + set_config(null, null, null, $config); + } + + /** + * @dataProvider get_legacy_tests + */ + public function test_legacy($original, $expected, $uid = '', $bitfield = '', $flags = 0, $censor_text = true) + { + global $cache, $user; + + global $phpbb_root_path, $phpEx; + $cache = new phpbb_mock_cache; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewcensors', true); + $user->optionset('viewflash', true); + $user->optionset('viewimg', true); + $user->optionset('viewsmilies', true); + + $actual = generate_text_for_display($original, $uid, $bitfield, $flags, $censor_text); + + $this->assertSame($expected, $actual); + } + + public function get_legacy_tests() + { + return array( + array( + '', + '' + ), + array( + '0', + '0' + ), + ); + } + + public function test_censor_is_restored() + { + global $phpbb_container; + + $phpbb_container = new phpbb_mock_container_builder; + + global $phpbb_root_path, $phpEx; - $user = new phpbb_mock_user; + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->optionset('viewcensors', false); - $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $config = new \phpbb\config\config(array('allow_nocensors' => true)); + + $auth = $this->getMock('phpbb\\auth\\auth'); + $auth->expects($this->any()) + ->method('acl_get') + ->with('u_chgcensors') + ->will($this->returnValue(true)); + + $phpbb_container->set('user', $user); + $phpbb_container->set('config', $config); + $phpbb_container->set('auth', $auth); + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container); + $renderer = $phpbb_container->get('text_formatter.renderer'); + + $original = '<r><CENSOR with="banana">apple</CENSOR></r>'; + + $renderer->set_viewcensors(false); + $this->assertSame('apple', $renderer->render($original)); + $renderer->set_viewcensors(true); + $this->assertSame('banana', $renderer->render($original)); + $this->assertSame('apple', generate_text_for_display($original, '', '', 0, false)); + $this->assertSame('banana', $renderer->render($original), 'The original setting was not restored'); + + $renderer->set_viewcensors(false); + $this->assertSame('apple', $renderer->render($original)); + $this->assertSame('banana', generate_text_for_display($original, '', '', 0, truee)); + $this->assertSame('apple', $renderer->render($original), 'The original setting was not restored'); } - public function test_empty_string() + /** + * @dataProvider get_text_formatter_tests + */ + public function test_text_formatter($original, $expected, $censor_text = true, $setup = null) { - $this->assertSame('', generate_text_for_display('', '', '', 0)); + global $phpbb_container; + + $phpbb_container = new phpbb_mock_container_builder; + + if (isset($setup)) + { + $setup($phpbb_container, $this); + } + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container); + + $this->assertSame($expected, generate_text_for_display($original, '', '', 0, $censor_text)); } - public function test_zero_string() + public function get_text_formatter_tests() { - $this->assertSame('0', generate_text_for_display('0', '', '', 0)); + return array( + array( + '<t>Plain text</t>', + 'Plain text' + ), + array( + '<r>Hello <URL url="http://example.org"><s>[url=http://example.org]</s>world<e>[/url]</e></URL></r>', + 'Hello <a href="http://example.org" class="postlink">world</a>' + ), + array( + '<t>&<>"\'</t>', + '&<>"\'' + ), + array( + '<r><CENSOR with="banana">apple</CENSOR></r>', + 'banana', + true + ), + array( + '<r><CENSOR with="banana">apple</CENSOR></r>', + 'apple', + false + ), + array( + '<r><FLASH url="http://localhost/foo.swf" width="123" height="456"><s>[flash=123,456]</s>http://localhost/foo.swf<e>[/flash]</e></FLASH></r>', + '<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="123" height="456"><param name="movie" value="http://localhost/foo.swf"><param name="play" value="false"><param name="loop" value="false"><param name="quality" value="high"><param name="allowScriptAccess" value="never"><param name="allowNetworking" value="internal"><embed src="http://localhost/foo.swf" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="123" height="456" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></object>' + ), + array( + '<r><FLASH url="http://localhost/foo.swf" width="123" height="456"><s>[flash=123,456]</s>http://localhost/foo.swf<e>[/flash]</e></FLASH></r>', + 'http://localhost/foo.swf', + true, + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewflash', false); + + $phpbb_container->set('user', $user); + } + ), + array( + '<r><IMG src="http://localhost/mrgreen.gif"><s>[img]</s><URL url="http://localhost/mrgreen.gif">http://localhost/mrgreen.gif</URL><e>[/img]</e></IMG></r>', + '<img src="http://localhost/mrgreen.gif" class="postimage" alt="Image">' + ), + array( + '<r><IMG src="http://localhost/mrgreen.gif"><s>[img]</s><URL url="http://localhost/mrgreen.gif">http://localhost/mrgreen.gif</URL><e>[/img]</e></IMG></r>', + '<a href="http://localhost/mrgreen.gif" class="postlink">http://localhost/mrgreen.gif</a>', + true, + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('viewimg', false); + + $phpbb_container->set('user', $user); + } + ), + array( + '<r><E>:)</E></r>', + '<img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" alt=":)" title="Smile">' + ), + array( + '<r><E>:)</E></r>', + ':)', + true, + function ($phpbb_container) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $user = new \phpbb\user($lang, '\phpbb\datetime'); + $user->optionset('smilies', false); + + $phpbb_container->set('user', $user); + } + ), + ); } } diff --git a/tests/text_processing/generate_text_for_edit_test.php b/tests/text_processing/generate_text_for_edit_test.php new file mode 100644 index 0000000000..105e8da86b --- /dev/null +++ b/tests/text_processing/generate_text_for_edit_test.php @@ -0,0 +1,92 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; + +class phpbb_text_processing_generate_text_for_edit_test extends phpbb_test_case +{ + /** + * @dataProvider get_legacy_tests + */ + public function test_legacy($original, $expected, $uid = '', $flags = 0) + { + global $cache, $user, $phpbb_dispatcher; + + $cache = new phpbb_mock_cache; + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + + $user = new phpbb_mock_user; + $user->optionset('viewcensors', false); + + $return = generate_text_for_edit($original, $uid, $flags); + + $this->assertSame($expected, $return['text']); + } + + public function get_legacy_tests() + { + return array( + array( + '', + '' + ), + array( + '0', + '0' + ), + array( + 'Hello [url=http://example.org:1f4coh9x]world[/url:1f4coh9x] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) -->', + 'Hello [url=http://example.org]world[/url] :)', + '1f4coh9x', + 0 + ), + array( + "&<>"'", + "&<>"'" + ) + ); + } + + /** + * @dataProvider get_text_formatter_tests + */ + public function test_text_formatter($original, $expected) + { + global $phpbb_dispatcher; + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + $this->get_test_case_helpers()->set_s9e_services(); + + $return = generate_text_for_edit($original, '', 0); + + $this->assertSame($expected, $return['text']); + } + + public function get_text_formatter_tests() + { + return array( + array( + '<t>Plain text</t>', + 'Plain text' + ), + array( + '<r>Hello <URL url="http://example.org"><s>[url=http://example.org]</s>world<e>[/url]</e></URL> <E>:)</E></r>', + 'Hello [url=http://example.org]world[/url] :)' + ), + array( + '<t>&<>"\'</t>', + "&<>"'" + ) + ); + } +} diff --git a/tests/text_processing/generate_text_for_storage_test.php b/tests/text_processing/generate_text_for_storage_test.php new file mode 100644 index 0000000000..474f6d8f0f --- /dev/null +++ b/tests/text_processing/generate_text_for_storage_test.php @@ -0,0 +1,183 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_compatibility.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_text_processing_generate_text_for_storage_test extends phpbb_test_case +{ + public function setUp() + { + global $config, $phpbb_container, $phpbb_dispatcher; + + parent::setUp(); + + $config = new \phpbb\config\config(array()); + set_config(null, null, null, $config); + + $phpbb_container = new phpbb_mock_container_builder; + $phpbb_container->set('config', $config); + $this->get_test_case_helpers()->set_s9e_services($phpbb_container); + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + } + + /** + * @dataProvider get_text_formatter_tests + */ + public function test_text_formatter($original, $expected, $allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, $setup = null) + { + $actual = $original; + $uid = ''; + $bitfield = ''; + $flags = 0; + + if (isset($setup)) + { + $setup(); + } + + generate_text_for_storage($actual, $uid, $bitfield, $flags, $allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode); + + $this->assertSame($expected, $actual); + } + + public function get_text_formatter_tests() + { + return array( + array( + 'Hello world', + '<t>Hello world</t>', + true, + true, + true, + true, + true, + true, + true, + ), + array( + 'Hello [url=http://example.org]world[/url] :)', + '<r>Hello <URL url="http://example.org"><s>[url=http://example.org]</s>world<e>[/url]</e></URL> <E>:)</E></r>', + true, + true, + true, + true, + true, + true, + true, + ), + array( + '&<>"\'', + '<t>&<>"\'</t>', + true, + true, + true, + true, + true, + true, + true, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<t>[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</t>', + false, + false, + false, + false, + false, + false, + false, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</r>', + true, + false, + false, + false, + false, + false, + false, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<r>[b]..[/b] <URL url="http://example.org">http://example.org</URL> :) [img]<URL url="http://example.org/img.png">http://example.org/img.png</URL>[/img] [flash=123,123]<URL url="http://example.org/flash.swf">http://example.org/flash.swf</URL>[/flash] [quote]...[/quote] [url]<URL url="http://example.org">http://example.org</URL>[/url]</r>', + false, + true, + false, + false, + false, + false, + true, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<r>[b]..[/b] http://example.org <E>:)</E> [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</r>', + false, + false, + true, + false, + false, + false, + false, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) <IMG src="http://example.org/img.png"><s>[img]</s>http://example.org/img.png<e>[/img]</e></IMG> [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</r>', + true, + false, + false, + true, + false, + false, + false, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] <FLASH height="123" url="http://example.org/flash.swf" width="123"><s>[flash=123,123]</s>http://example.org/flash.swf<e>[/flash]</e></FLASH> [quote]...[/quote] [url]http://example.org[/url]</r>', + true, + false, + false, + false, + true, + false, + false, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] <QUOTE><s>[quote]</s>...<e>[/quote]</e></QUOTE> [url]http://example.org[/url]</r>', + true, + false, + false, + false, + false, + true, + false, + ), + array( + '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]', + '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] <URL url="http://example.org"><s>[url]</s>http://example.org<e>[/url]</e></URL></r>', + true, + false, + false, + false, + false, + false, + true, + ), + ); + } +} diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php index d94fac2ae4..95e304dd97 100644 --- a/tests/text_processing/make_clickable_test.php +++ b/tests/text_processing/make_clickable_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -100,5 +104,50 @@ class phpbb_text_processing_make_clickable_test extends phpbb_test_case $this->assertEquals($expected, $result, $label); } + public function make_clickable_mixed_serverurl_data() + { + $urls = array( + 'http://thisdomain.org' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://thisdomain.org/' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://thisdomain.org/1' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://thisdomain.org/path/some?query=abc#test' => array('tag' => 'm', 'url' => false, 'text' => false), + + 'https://www.phpbb.com' => array('tag' => 'm', 'url' => false, 'text' => false), + 'https://www.phpbb.com/' => array('tag' => 'm', 'url' => false, 'text' => false), + 'https://www.phpbb.com/1' => array('tag' => 'l', 'url' => false, 'text' => '1'), + 'https://www.phpbb.com/path/some?query=abc#test' => array('tag' => 'l', 'url' => false, 'text' => 'path/some?query=abc#test'), + ); + + $test_data = array(); + + // run the test for each combination + foreach ($urls as $url => $url_type) + { + // false means it's the same as the url, less typing + $url_type['url'] = ($url_type['url']) ? $url_type['url'] : $url; + $url_type['text'] = ($url_type['text']) ? $url_type['text'] : $url; + + $class = ($url_type['tag'] === 'l') ? 'postlink-local' : 'postlink'; + + // replace the url with the desired output format + $output = '<!-- ' . $url_type['tag'] . ' --><a class="' . $class . '" href="' . $url_type['url'] . '">' . $url_type['text'] . '</a><!-- ' . $url_type['tag'] . ' -->'; + + $test_data[] = array($url, $output); + } + + return $test_data; + } + + /** + * @dataProvider make_clickable_mixed_serverurl_data + */ + public function test_make_clickable_mixed_serverurl($input, $expected) + { + $result = make_clickable($input, 'https://www.phpbb.com'); + + $label = 'Making text clickable: ' . $input; + $this->assertEquals($expected, $result, $label); + } + } diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php new file mode 100644 index 0000000000..bee1b3fca3 --- /dev/null +++ b/tests/text_processing/message_parser_test.php @@ -0,0 +1,543 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../../phpBB/includes/bbcode.php'; +require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../phpBB/includes/message_parser.php'; +require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_text_processing_message_parser_test extends phpbb_test_case +{ + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + // Set up an intercepting proxy for getimagesize() calls + stream_wrapper_unregister('http'); + stream_wrapper_register('http', __CLASS__ . '_proxy'); + } + + public static function tearDownAfterClass() + { + parent::tearDownAfterClass(); + stream_wrapper_restore('http'); + } + + protected function prepare_s9e_services($setup = null) + { + global $config, $phpbb_container, $user; + + $config = new \phpbb\config\config(array('max_poll_options' => 999)); + + $map = array( + array('MAX_FLASH_HEIGHT_EXCEEDED', 123, 'Your flash files may only be up to 123 pixels high.'), + array('MAX_FLASH_WIDTH_EXCEEDED', 456, 'Your flash files may only be up to 456 pixels wide.'), + array('MAX_FONT_SIZE_EXCEEDED', 120, 'You may only use fonts up to size 120.'), + array('MAX_FONT_SIZE_EXCEEDED', 200, 'You may only use fonts up to size 200.'), + array('MAX_IMG_HEIGHT_EXCEEDED', 12, 'Your images may only be up to 12 pixels high.'), + array('MAX_IMG_WIDTH_EXCEEDED', 34, 'Your images may only be up to 34 pixels wide.'), + array('TOO_MANY_SMILIES', 3, 'Your message contains too many smilies. The maximum number of smilies allowed is 3.'), + array('TOO_MANY_URLS', 2, 'Your message contains too many URLs. The maximum number of URLs allowed is 2.'), + array('UNAUTHORISED_BBCODE', '[flash]', 'You cannot use certain BBCodes: [flash].'), + array('UNAUTHORISED_BBCODE', '[img]', 'You cannot use certain BBCodes: [img].'), + array('UNAUTHORISED_BBCODE', '[quote]', 'You cannot use certain BBCodes: [quote].'), + array('UNAUTHORISED_BBCODE', '[url]', 'You cannot use certain BBCodes: [url].'), + array('UNABLE_GET_IMAGE_SIZE', 'It was not possible to determine the dimensions of the image.'), + ); + + $user = $this->getMockBuilder('phpbb\\user')->disableOriginalConstructor()->getMock(); + $user->expects($this->any()) + ->method('lang') + ->will($this->returnValueMap($map)); + + $user->data = array( + 'is_bot' => false, + 'is_registered' => true, + 'user_id' => 2, + ); + $user->style = array('style_id' => 1); + + $user->lang = array( + 'NO_POLL_TITLE' => 'You have to enter a poll title.', + 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', + 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', + 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', + 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', + 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', + ); + + $phpbb_container = new phpbb_mock_container_builder; + $phpbb_container->set('user', $user); + $phpbb_container->set('config', $config); + + if (isset($setup)) + { + $setup($phpbb_container, $this); + } + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container); + } + + /** + * @dataProvider get_test_polls + */ + public function test_parse_poll($poll, $expected, $warn_msg = array()) + { + $this->prepare_s9e_services(); + + $message_parser = new parse_message('Me[i]s[/i]sage'); + + // Add some default values + $poll += array( + 'poll_length' => 123, + 'poll_start' => 123, + 'poll_last_vote' => 123, + 'poll_vote_change' => true, + 'enable_bbcode' => true, + 'enable_urls' => true, + 'enable_smilies' => true, + 'img_status' => true + ); + + $message_parser->parse_poll($poll); + $this->assertSame($expected, array_intersect_key($poll, $expected)); + + $this->assertSame( + '<r>Me<I><s>[i]</s>s<e>[/i]</e></I>sage</r>', + $message_parser->parse(true, true, true, true, true, true, true, false) + ); + + $this->assertSame($warn_msg, $message_parser->warn_msg); + } + + public function get_test_polls() + { + return array( + array( + array( + 'poll_title' => 'foo [b]bar[/b] baz', + 'poll_option_text' => "[i]foo[/i]\nbar\n[i]baz[/i]", + 'poll_max_options' => 3, + 'poll_options_size' => 3 + ), + array( + 'poll_title' => '<r>foo <B><s>[b]</s>bar<e>[/b]</e></B> baz</r>', + 'poll_option_text' => "<r><I><s>[i]</s>foo<e>[/i]</e></I></r>\n<t>bar</t>\n<r><I><s>[i]</s>baz<e>[/i]</e></I></r>", + 'poll_options' => array( + '<r><I><s>[i]</s>foo<e>[/i]</e></I></r>', + '<t>bar</t>', + '<r><I><s>[i]</s>baz<e>[/i]</e></I></r>' + ) + ) + ), + array( + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[quote]quote[/quote]\n:)", + 'poll_max_options' => 2, + 'poll_options_size' => 2 + ), + array( + 'poll_title' => '<t>xxx</t>', + 'poll_option_text' => "<t>[quote]quote[/quote]</t>\n<r><E>:)</E></r>", + 'poll_options' => array( + '<t>[quote]quote[/quote]</t>', + '<r><E>:)</E></r>' + ) + ), + array('You cannot use certain BBCodes: [quote].') + ), + array( + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[flash=12,34]http://example.org/x.swf[/flash]\n:)", + 'poll_max_options' => 2, + 'poll_options_size' => 2 + ), + array( + 'poll_title' => '<t>xxx</t>', + 'poll_option_text' => "<t>[flash=12,34]http://example.org/x.swf[/flash]</t>\n<r><E>:)</E></r>", + 'poll_options' => array( + '<t>[flash=12,34]http://example.org/x.swf[/flash]</t>', + '<r><E>:)</E></r>' + ) + ), + array('You cannot use certain BBCodes: [flash].') + ), + array( + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[b]x\ny[/b]", + 'poll_max_options' => 2, + 'poll_options_size' => 2 + ), + array( + 'poll_title' => '<t>xxx</t>', + 'poll_option_text' => "<r><B><s>[b]</s>x</B></r>\n<t>y[/b]</t>", + 'poll_options' => array( + '<r><B><s>[b]</s>x</B></r>', + '<t>y[/b]</t>', + ) + ) + ), + ); + } + + /** + * @dataProvider get_test_cases + */ + public function test_options($original, $expected, array $args, $setup = null, $warn_msg = array()) + { + $this->prepare_s9e_services($setup); + + $message_parser = new parse_message($original); + call_user_func_array(array($message_parser, 'parse'), $args); + + $this->assertSame($expected, $message_parser->message); + $this->assertSame($warn_msg, $message_parser->warn_msg); + } + + public function get_test_cases() + { + return array( + array( + '[b]bold[/b]', + '<r><B><s>[b]</s>bold<e>[/b]</e></B></r>', + array(true, true, true, true, true, true, true) + ), + array( + '[b]bold[/b]', + '<t>[b]bold[/b]</t>', + array(false, true, true, true, true, true, true) + ), + array( + 'http://example.org', + '<r><URL url="http://example.org">http://example.org</URL></r>', + array(true, true, true, true, true, true, true) + ), + array( + 'http://example.org', + '<t>http://example.org</t>', + array(true, false, true, true, true, true, true) + ), + array( + ':)', + '<r><E>:)</E></r>', + array(true, true, true, true, true, true, true) + ), + array( + ':)', + '<t>:)</t>', + array(true, true, false, true, true, true, true) + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '<r><URL url="http://example.org"><s>[url=http://example.org]</s><IMG src="http://example.org/img.png"><s>[img]</s>http://example.org/img.png<e>[/img]</e></IMG><e>[/url]</e></URL></r>', + array(true, true, true, true, true, true, true) + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '<r><URL url="http://example.org"><s>[url=http://example.org]</s>[img]http://example.org/img.png[/img]<e>[/url]</e></URL></r>', + array(true, true, true, false, true, true, true), + null, + array('You cannot use certain BBCodes: [img].') + ), + array( + '[flash=12,34]http://example.org/foo.swf[/flash]', + '<r><FLASH height="34" url="http://example.org/foo.swf" width="12"><s>[flash=12,34]</s><URL url="http://example.org/foo.swf">http://example.org/foo.swf</URL><e>[/flash]</e></FLASH></r>', + array(true, true, true, true, true, true, true) + ), + array( + '[flash=12,34]http://example.org/foo.swf[/flash]', + '<r>[flash=12,34]<URL url="http://example.org/foo.swf">http://example.org/foo.swf</URL>[/flash]</r>', + array(true, true, true, true, false, true, true), + null, + array('You cannot use certain BBCodes: [flash].') + ), + array( + '[quote="foo"]bar :)[/quote]', + '<r><QUOTE author="foo"><s>[quote="foo"]</s>bar <E>:)</E><e>[/quote]</e></QUOTE></r>', + array(true, true, true, true, true, true, true) + ), + array( + '[quote="foo"]bar :)[/quote]', + '<r>[quote="foo"]bar <E>:)</E>[/quote]</r>', + array(true, true, true, true, true, false, true), + null, + array('You cannot use certain BBCodes: [quote].') + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '<r><URL url="http://example.org"><s>[url=http://example.org]</s><IMG src="http://example.org/img.png"><s>[img]</s>http://example.org/img.png<e>[/img]</e></IMG><e>[/url]</e></URL></r>', + array(true, true, true, true, true, true, true) + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '<r>[url=http://example.org]<IMG src="http://example.org/img.png"><s>[img]</s>http://example.org/img.png<e>[/img]</e></IMG>[/url]</r>', + array(true, true, true, true, true, true, false), + null, + array('You cannot use certain BBCodes: [url].') + ), + array( + '[size=200]200[/size]', + '<r><SIZE size="200"><s>[size=200]</s>200<e>[/size]</e></SIZE></r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 200); + } + ), + array( + '[size=200]200[/size]', + '<r><SIZE size="200"><s>[size=200]</s>200<e>[/size]</e></SIZE></r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 0); + } + ), + array( + '[size=2000]2000[/size]', + '<t>[size=2000]2000[/size]</t>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 200); + }, + array('You may only use fonts up to size 200.') + ), + array( + '[size=0]0[/size]', + '<t>[size=0]0[/size]</t>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 200); + } + ), + array( + '[size=200]200[/size]', + '<r><SIZE size="200"><s>[size=200]</s>200<e>[/size]</e></SIZE></r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_font_size', 200); + } + ), + array( + '[size=200]200[/size]', + '<t>[size=200]200[/size]</t>', + array(true, true, true, true, true, true, true, true, 'sig'), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_font_size', 120); + }, + array('You may only use fonts up to size 120.') + ), + array( + '[img]http://example.org/100x100.png[/img]', + '<r>[img]<URL url="http://example.org/100x100.png">http://example.org/100x100.png</URL>[/img]</r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 12); + }, + array('Your images may only be up to 12 pixels high.') + ), + array( + '[img]http://example.org/100x100.png[/img]', + '<r>[img]<URL url="http://example.org/100x100.png">http://example.org/100x100.png</URL>[/img]</r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_width', 34); + }, + array('Your images may only be up to 34 pixels wide.') + ), + array( + '[img]http://example.org/100x100.png[/img]', + '<r><IMG src="http://example.org/100x100.png"><s>[img]</s><URL url="http://example.org/100x100.png">http://example.org/100x100.png</URL><e>[/img]</e></IMG></r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 0); + $phpbb_container->get('config')->set('max_post_img_width', 0); + } + ), + array( + '[img]http://example.org/100x100.png[/img]', + '<r><IMG src="http://example.org/100x100.png"><s>[img]</s><URL url="http://example.org/100x100.png">http://example.org/100x100.png</URL><e>[/img]</e></IMG></r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 100); + $phpbb_container->get('config')->set('max_post_img_width', 100); + } + ), + array( + '[img]http://example.org/100x100.png[/img]', + '<r><IMG src="http://example.org/100x100.png"><s>[img]</s><URL url="http://example.org/100x100.png">http://example.org/100x100.png</URL><e>[/img]</e></IMG></r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_img_height', 12); + $phpbb_container->get('config')->set('max_sig_img_width', 34); + } + ), + array( + '[img]http://example.org/404.png[/img]', + '<r>[img]<URL url="http://example.org/404.png">http://example.org/404.png</URL>[/img]</r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 12); + }, + array('It was not possible to determine the dimensions of the image.') + ), + array( + '[flash=999,999]http://example.org/foo.swf[/flash]', + '<r>[flash=999,999]<URL url="http://example.org/foo.swf">http://example.org/foo.swf</URL>[/flash]</r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 123); + }, + array('Your flash files may only be up to 123 pixels high.') + ), + array( + '[flash=999,999]http://example.org/foo.swf[/flash]', + '<r>[flash=999,999]<URL url="http://example.org/foo.swf">http://example.org/foo.swf</URL>[/flash]</r>', + array(true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_width', 456); + }, + array('Your flash files may only be up to 456 pixels wide.') + ), + array( + ':) :) :)', + '<r><E>:)</E> <E>:)</E> <E>:)</E></r>', + array(true, true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_smilies', 3); + } + ), + array( + ':) :) :) :)', + '<r><E>:)</E> <E>:)</E> <E>:)</E> :)</r>', + array(true, true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_smilies', 3); + }, + array('Your message contains too many smilies. The maximum number of smilies allowed is 3.') + ), + array( + ':) :) :) :)', + '<r><E>:)</E> <E>:)</E> <E>:)</E> <E>:)</E></r>', + array(true, true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_smilies', 0); + } + ), + array( + ':) :) :) :)', + '<r><E>:)</E> <E>:)</E> <E>:)</E> <E>:)</E></r>', + array(true, true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_smilies', 3); + } + ), + array( + ':) :) :) :)', + '<r><E>:)</E> <E>:)</E> <E>:)</E> :)</r>', + array(true, true, true, true, true, true, true, true, 'sig'), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_smilies', 3); + }, + array('Your message contains too many smilies. The maximum number of smilies allowed is 3.') + ), + array( + 'http://example.org http://example.org http://example.org', + '<r><URL url="http://example.org">http://example.org</URL> <URL url="http://example.org">http://example.org</URL> http://example.org</r>', + array(true, true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_urls', 2); + }, + array('Your message contains too many URLs. The maximum number of URLs allowed is 2.') + ), + array( + 'http://example.org http://example.org http://example.org', + '<r><URL url="http://example.org">http://example.org</URL> <URL url="http://example.org">http://example.org</URL> <URL url="http://example.org">http://example.org</URL></r>', + array(true, true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_post_urls', 0); + } + ), + array( + 'http://example.org http://example.org http://example.org', + '<r><URL url="http://example.org">http://example.org</URL> <URL url="http://example.org">http://example.org</URL> <URL url="http://example.org">http://example.org</URL></r>', + array(true, true, true, true, true, true, true, true), + function ($phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_urls', 2); + } + ), + ); + } +} + +class phpbb_text_processing_message_parser_test_proxy +{ + protected $response; + + public function stream_open($url) + { + if (strpos($url, '100x100')) + { + // Return a 100 x 100 PNG image + $this->response = base64_decode('iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQAAAABYmaj5AAAAE0lEQVR4AWOgKxgFo2AUjIJRAAAFeAABHs0ozQAAAABJRU5ErkJggg=='); + } + else + { + $this->response = '404 not found'; + } + + return true; + } + + public function stream_stat() + { + return false; + } + + public function stream_read($len) + { + $chunk = substr($this->response, 0, $len); + $this->response = substr($this->response, $len); + + return $chunk; + } + + public function stream_eof() + { + return ($this->response === false); + } +} diff --git a/tests/text_processing/smilies_test.php b/tests/text_processing/smilies_test.php new file mode 100644 index 0000000000..3bbe065d36 --- /dev/null +++ b/tests/text_processing/smilies_test.php @@ -0,0 +1,52 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; + +class phpbb_text_processing_smilies_test extends phpbb_test_case +{ + /** + * @dataProvider get_text_formatter_tests + */ + public function test_text_formatter($original, $expected) + { + $container = $this->get_test_case_helpers()->set_s9e_services(null, __DIR__ . '/fixtures/smilies.xml'); + $parser = $container->get('text_formatter.parser'); + $renderer = $container->get('text_formatter.renderer'); + + $this->assertSame($expected, $renderer->render($parser->parse($original))); + } + + public function get_text_formatter_tests() + { + return array( + array( + ':) beginning', + '<img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" alt=":)" title="Smile"> beginning' + ), + array( + 'end :)', + 'end <img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" alt=":)" title="Smile">' + ), + array( + ':)', + '<img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" alt=":)" title="Smile">' + ), + array( + 'xx (18) 8) xx', + 'xx (18) <img class="smilies" src="phpBB/images/smilies/custom.gif" alt="8)" title="8)"> xx' + ), + ); + } +} diff --git a/tests/text_processing/strip_bbcode_test.php b/tests/text_processing/strip_bbcode_test.php new file mode 100644 index 0000000000..827d8d4a52 --- /dev/null +++ b/tests/text_processing/strip_bbcode_test.php @@ -0,0 +1,42 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; + +class phpbb_text_processing_strip_bbcode_test extends phpbb_test_case +{ + public function test_legacy() + { + $original = '[b:20m4ill1]bold[/b:20m4ill1]'; + $expected = ' bold '; + + $actual = $original; + strip_bbcode($actual); + + $this->assertSame($expected, $actual, '20m4ill1'); + } + + public function test_s9e() + { + $phpbb_container = $this->get_test_case_helpers()->set_s9e_services(); + + $original = '<r><B><s>[b]</s>bold<e>[/b]</e></B></r>'; + $expected = ' bold '; + + $actual = $original; + strip_bbcode($actual); + + $this->assertSame($expected, $actual); + } +} diff --git a/tests/text_processing/tickets_data/PHPBB3-10002.html b/tests/text_processing/tickets_data/PHPBB3-10002.html new file mode 100644 index 0000000000..82990b2253 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10002.html @@ -0,0 +1,2 @@ +<blockquote class="uncited"><div><ul><li>one +<blockquote class="uncited"><div><ul><li>two</li></ul></div></blockquote></li></ul></div></blockquote>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10002.txt b/tests/text_processing/tickets_data/PHPBB3-10002.txt new file mode 100644 index 0000000000..fe2f29073f --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10002.txt @@ -0,0 +1,2 @@ +[quote][list][*]one +[quote][list][*]two[/list][/quote]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10122.html b/tests/text_processing/tickets_data/PHPBB3-10122.html new file mode 100644 index 0000000000..f0fb6115b2 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10122.html @@ -0,0 +1 @@ +<ul style="list-style-type: none"><li>This is my indented text</li></ul>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10122.txt b/tests/text_processing/tickets_data/PHPBB3-10122.txt new file mode 100644 index 0000000000..a5e059df66 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10122.txt @@ -0,0 +1 @@ +[list=none][*]This is my indented text[/list]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10268.html b/tests/text_processing/tickets_data/PHPBB3-10268.html new file mode 100644 index 0000000000..c89e63f9a3 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10268.html @@ -0,0 +1,4 @@ +<blockquote><div><cite><a href="http://phpbb.com" class="postlink">http://phpbb.com</a> wrote:</cite>...</div></blockquote> +<blockquote><div><cite><a href="http://phpbb.com" class="postlink"> http://phpbb.com</a> wrote:</cite>...</div></blockquote> +<span style="font-weight: bold"><a href="http://phpbb.com" class="postlink">http://phpbb.com</a></span><br> +<span style="font-weight: bold"> <a href="http://phpbb.com" class="postlink">http://phpbb.com</a></span><br> diff --git a/tests/text_processing/tickets_data/PHPBB3-10268.txt b/tests/text_processing/tickets_data/PHPBB3-10268.txt new file mode 100644 index 0000000000..b4e49c9454 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10268.txt @@ -0,0 +1,4 @@ +[quote="http://phpbb.com"]...[/quote] +[quote=" http://phpbb.com"]...[/quote] +[b]http://phpbb.com[/b] +[b] http://phpbb.com[/b] diff --git a/tests/text_processing/tickets_data/PHPBB3-10425.html b/tests/text_processing/tickets_data/PHPBB3-10425.html new file mode 100644 index 0000000000..522b2f8858 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10425.html @@ -0,0 +1,3 @@ +<a href="http://ar.wikipedia.org/wiki/%D8%A7%D9%84%D8%B5%D9%81%D8%AD%D8%A9_%D8%A7%D9%84%D8%B1%D8%A6%D9%8A%D8%B3%D9%8A%D8%A9" class="postlink">http://ar.wikipedia.org/wiki/Ø§Ù„ØµÙØØ©_الرئيسية</a><br> +<a href="http://ar.wikipedia.org/wiki/%D8%A7%D9%84%D8%B5%D9%81%D8%AD%D8%A9_%D8%A7%D9%84%D8%B1%D8%A6%D9%8A%D8%B3%D9%8A%D8%A9" class="postlink">http://ar.wikipedia.org/wiki/Ø§Ù„ØµÙØØ©_الرئيسية</a><br> +<a href="http://ar.wikipedia.org/wiki/%D8%A7%D9%84%D8%B5%D9%81%D8%AD%D8%A9_%D8%A7%D9%84%D8%B1%D8%A6%D9%8A%D8%B3%D9%8A%D8%A9" class="postlink">link</a>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10425.txt b/tests/text_processing/tickets_data/PHPBB3-10425.txt new file mode 100644 index 0000000000..d93c0446b6 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10425.txt @@ -0,0 +1,3 @@ +http://ar.wikipedia.org/wiki/Ø§Ù„ØµÙØØ©_الرئيسية +[url]http://ar.wikipedia.org/wiki/Ø§Ù„ØµÙØØ©_الرئيسية[/url] +[url=http://ar.wikipedia.org/wiki/Ø§Ù„ØµÙØØ©_الرئيسية]link[/url]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10587.html b/tests/text_processing/tickets_data/PHPBB3-10587.html new file mode 100644 index 0000000000..4c2e536989 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10587.html @@ -0,0 +1,2 @@ +<a href="http://example.org/?tourney%5Bid%5D=34&action=brackets" class="postlink">http://example.org/?tourney[id]=34&action=brackets</a><br> +<a href="http://example.org/?tourney%5Bid%5D=34&action=brackets" class="postlink">link</a>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10587.txt b/tests/text_processing/tickets_data/PHPBB3-10587.txt new file mode 100644 index 0000000000..84788b720d --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10587.txt @@ -0,0 +1,2 @@ +[url]http://example.org/?tourney[id]=34&action=brackets[/url] +[url="http://example.org/?tourney[id]=34&action=brackets"]link[/url]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10922.html b/tests/text_processing/tickets_data/PHPBB3-10922.html new file mode 100644 index 0000000000..3ff117f171 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10922.html @@ -0,0 +1,9 @@ +<a href="mailto:user@example.org">user@example.org</a><br> +<a href="mailto:user@example.org">...</a><br> +<a href="mailto:user@example.org">...</a><br> +<a href="mailto:user@example.org?subject=Hello">...</a><br> +<a href="mailto:user@example.org?subject=Hi%20there">user@example.org</a><br> +<a href="mailto:user@example.org?body=Hi%20there">user@example.org</a><br> +<a href="mailto:user@example.org?subject=Hello&body=Sent%20from%20phpBB">user@example.org</a><br> +<a href="mailto:user@example.org?subject=Hello&body=Sent%20from%20phpBB">user@example.org</a><br> +<a href="mailto:user@example.org?subject=Hello&body=Sent%20from%20phpBB">...</a><br> diff --git a/tests/text_processing/tickets_data/PHPBB3-10922.txt b/tests/text_processing/tickets_data/PHPBB3-10922.txt new file mode 100644 index 0000000000..e533ce6ed5 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10922.txt @@ -0,0 +1,9 @@ +[email]user@example.org[/email] +[email=user@example.org]...[/email] +[email=user@example.org ]...[/email] +[email=user@example.org subject="Hello"]...[/email] +[email subject="Hi there"]user@example.org[/email] +[email body="Hi there"]user@example.org[/email] +[email subject="Hello" body="Sent from phpBB"]user@example.org[/email] +[email body="Sent from phpBB" subject="Hello"]user@example.org[/email] +[email body="Sent from phpBB" subject="Hello" email="user@example.org"]...[/email] diff --git a/tests/text_processing/tickets_data/PHPBB3-10989.html b/tests/text_processing/tickets_data/PHPBB3-10989.html new file mode 100644 index 0000000000..cd24df60e5 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10989.html @@ -0,0 +1,8 @@ +<blockquote><div><cite>Lorem wrote:</cite>[quote="Lorem"<blockquote class="uncited"><div> Suspendisse iaculis porta tempor. Nulla.</div></blockquote> + Nullam a tortor sit amet.</div></blockquote> + Proin ac mi eget magna.<br> + +<blockquote><div><cite>Lorem wrote:</cite>Quisque fermentum tortor quis odio scelerisque consequat fermentum urna gravida. In semper vehicula condimentum. Donec suscipit ante imperdiet augue rhoncus.</div></blockquote> + +<br> +Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas quis odio orci, sit amet semper.
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10989.txt b/tests/text_processing/tickets_data/PHPBB3-10989.txt new file mode 100644 index 0000000000..dc2430f210 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-10989.txt @@ -0,0 +1,8 @@ +[quote="Lorem"][quote="Lorem"[quote] Suspendisse iaculis porta tempor. Nulla.[/quote] + Nullam a tortor sit amet.[/quote] + Proin ac mi eget magna. + +[quote="Lorem"]Quisque fermentum tortor quis odio scelerisque consequat fermentum urna gravida. In semper vehicula condimentum. Donec suscipit ante imperdiet augue rhoncus.[/quote] + + +Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas quis odio orci, sit amet semper.
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-11153.html b/tests/text_processing/tickets_data/PHPBB3-11153.html new file mode 100644 index 0000000000..0f67ac4bc0 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-11153.html @@ -0,0 +1 @@ +<a href="mailto:user@example.org">...</a>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-11153.txt b/tests/text_processing/tickets_data/PHPBB3-11153.txt new file mode 100644 index 0000000000..d2794978d9 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-11153.txt @@ -0,0 +1 @@ +[myemail=user@example.org]...[/myemail]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-11153.xml b/tests/text_processing/tickets_data/PHPBB3-11153.xml new file mode 100644 index 0000000000..a7fc69520b --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-11153.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>myemail</value> + <value></value> + <value>1</value> + <value>[myemail={EMAIL}]{TEXT}[/myemail]</value> + <value><![CDATA[<a href="mailto:{EMAIL}">{TEXT}</a>]]></value> + <value><![CDATA[!\[myemail\=(([\w\!\#$\%\&'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%'\*\+\-\/\=\?\^\`{\|\}\~]|&)+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?))\](.*?)\[/myemail\]!ies]]></value> + <value><![CDATA['[myemail='.$this->bbcode_specialchars('${1}').':$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${2}')).'[/myemail:$uid]']]></value> + <value><![CDATA[!\[myemail\=(([\w\!\#$\%\&'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%'\*\+\-\/\=\?\^\`{\|\}\~]|&)+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)):$uid\](.*?)\[/myemail:$uid\]!s]]></value> + <value><![CDATA[<a href="mailto:${1}">${2}</a>]]></value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-11742.html b/tests/text_processing/tickets_data/PHPBB3-11742.html new file mode 100644 index 0000000000..e7890eef19 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-11742.html @@ -0,0 +1 @@ +<div class="codebox"><p>CODE: <a href="#" onclick="selectCode(this); return false;">Select all</a></p><pre><code> tab</code></pre></div>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-11742.txt b/tests/text_processing/tickets_data/PHPBB3-11742.txt new file mode 100644 index 0000000000..db72e5dda0 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-11742.txt @@ -0,0 +1 @@ +[code] tab[/code]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-12195.html b/tests/text_processing/tickets_data/PHPBB3-12195.html new file mode 100644 index 0000000000..c286c0fee9 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-12195.html @@ -0,0 +1 @@ +<a href="//example.org/" class="postlink"><img src="//example.org/img.png" class="postimage" alt="Image"></a>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-12195.txt b/tests/text_processing/tickets_data/PHPBB3-12195.txt new file mode 100644 index 0000000000..b66dbd5d96 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-12195.txt @@ -0,0 +1 @@ +[url=//example.org/][img]//example.org/img.png[/img][/url]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-12221.html b/tests/text_processing/tickets_data/PHPBB3-12221.html new file mode 100644 index 0000000000..567f552e84 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-12221.html @@ -0,0 +1 @@ +<a href="https://example.com/test/#?javascript:lolhax" class="postlink">https://example.com/test/#?javascript:lolhax</a>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-12221.txt b/tests/text_processing/tickets_data/PHPBB3-12221.txt new file mode 100644 index 0000000000..01a0bf8667 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-12221.txt @@ -0,0 +1 @@ +https://example.com/test/#?javascript:lolhax
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13425.html b/tests/text_processing/tickets_data/PHPBB3-13425.html new file mode 100644 index 0000000000..9a042dc558 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13425.html @@ -0,0 +1 @@ +<blockquote class="uncited"><div><img class="smilies" src="phpBB/images/smilies/icon_lol.gif" alt=":lol:" title="Laughing"> starts with a smiley</div></blockquote>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13425.txt b/tests/text_processing/tickets_data/PHPBB3-13425.txt new file mode 100644 index 0000000000..8456410df5 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13425.txt @@ -0,0 +1 @@ +[quote]:lol: starts with a smiley[/quote]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13425.xml b/tests/text_processing/tickets_data/PHPBB3-13425.xml new file mode 100644 index 0000000000..cbdcaa7fb7 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13425.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_smilies"> + <column>smiley_id</column> + <column>code</column> + <column>emotion</column> + <column>smiley_url</column> + <column>smiley_width</column> + <column>smiley_height</column> + <column>smiley_order</column> + <column>display_on_posting</column> + <row> + <value>22</value> + <value>:lol:</value> + <value>Laughing</value> + <value>icon_lol.gif</value> + <value>15</value> + <value>17</value> + <value>22</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-13451.html b/tests/text_processing/tickets_data/PHPBB3-13451.html new file mode 100644 index 0000000000..e0892c18a9 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13451.html @@ -0,0 +1 @@ +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@example.org
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13451.txt b/tests/text_processing/tickets_data/PHPBB3-13451.txt new file mode 100644 index 0000000000..e0892c18a9 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13451.txt @@ -0,0 +1 @@ +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@example.org
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13641.html b/tests/text_processing/tickets_data/PHPBB3-13641.html new file mode 100644 index 0000000000..1bd1c06dbb --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13641.html @@ -0,0 +1 @@ +<code>[color=#FF0000]</code> - <span style="color: #FF0000">red</span>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13641.txt b/tests/text_processing/tickets_data/PHPBB3-13641.txt new file mode 100644 index 0000000000..58f324715e --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13641.txt @@ -0,0 +1 @@ +[c][color=#FF0000][/c] - [color=#FF0000]red[/color]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13641.xml b/tests/text_processing/tickets_data/PHPBB3-13641.xml new file mode 100644 index 0000000000..451c5c69cd --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13641.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>c</value> + <value></value> + <value>1</value> + <value>[c]{TEXT}[/c]</value> + <value><![CDATA[<code>{TEXT}</code>]]></value> + <value><\[/c\]!ies]]></value> + <value><![CDATA['[c:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${1}')).'[/c:$uid]']]></value> + <value><\[/c:$uid\]!s]]></value> + <value><![CDATA[<code>${1}</code>]]></value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-13921.html b/tests/text_processing/tickets_data/PHPBB3-13921.html new file mode 100644 index 0000000000..6a9dc7f504 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13921.html @@ -0,0 +1 @@ +<span style="font-size: 200%; line-height: normal"></span><div style="text-align:center"><span style="font-size: 200%; line-height: normal">xxx</span></div>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13921.txt b/tests/text_processing/tickets_data/PHPBB3-13921.txt new file mode 100644 index 0000000000..392da0c3c8 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13921.txt @@ -0,0 +1 @@ +[size=200][center]xxx[/center][/size]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13921.xml b/tests/text_processing/tickets_data/PHPBB3-13921.xml new file mode 100644 index 0000000000..8d39246bb4 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-13921.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>center</value> + <value></value> + <value>1</value> + <value>[center]{TEXT}[/center]</value> + <value><![CDATA[<div style="text-align:center">{TEXT}</div>]]></value> + <value>!\[center\](.*?)\[/center\]!ies</value> + <value>'[center:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${1}')).'[/center:$uid]'</value> + <value>!\[center:$uid\](.*?)\[/center:$uid\]!s</value> + <value><![CDATA[<div style="text-align:center">${1}</div>]]></value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-14405.html b/tests/text_processing/tickets_data/PHPBB3-14405.html new file mode 100644 index 0000000000..5e76e032ec --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-14405.html @@ -0,0 +1 @@ +[url=<a href="http://example.org" class="postlink">http://example.org</a>]...
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14405.txt b/tests/text_processing/tickets_data/PHPBB3-14405.txt new file mode 100644 index 0000000000..7005b36b23 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-14405.txt @@ -0,0 +1 @@ +[url=http://example.org]...
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-3981.before.php b/tests/text_processing/tickets_data/PHPBB3-3981.before.php new file mode 100644 index 0000000000..1c326b52af --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-3981.before.php @@ -0,0 +1,21 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +function before_assert_phpbb3_3981($vars) +{ + if (!function_exists('idn_to_ascii')) + { + extract($vars); + $test->markTestSkipped('International URLs need idn_to_ascii()'); + } +} diff --git a/tests/text_processing/tickets_data/PHPBB3-3981.html b/tests/text_processing/tickets_data/PHPBB3-3981.html new file mode 100644 index 0000000000..e5f1b4561d --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-3981.html @@ -0,0 +1 @@ +<a href="http://www.xn--ndaaa.com" class="postlink">http://www.ööö.com</a>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-3981.txt b/tests/text_processing/tickets_data/PHPBB3-3981.txt new file mode 100644 index 0000000000..976823f1d1 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-3981.txt @@ -0,0 +1 @@ +[url]http://www.ööö.com[/url]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-7187.html b/tests/text_processing/tickets_data/PHPBB3-7187.html new file mode 100644 index 0000000000..9138779d29 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-7187.html @@ -0,0 +1 @@ +<blockquote class="uncited"><div><img class="smilies" src="phpBB/images/smilies/icon_e_geek.gif" alt=":geek:" title="Geek"> <img class="smilies" src="phpBB/images/smilies/icon_e_ugeek.gif" alt=":ugeek:" title="Uber Geek"></div></blockquote>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-7187.txt b/tests/text_processing/tickets_data/PHPBB3-7187.txt new file mode 100644 index 0000000000..584151a083 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-7187.txt @@ -0,0 +1 @@ +[quote]:geek: :ugeek:[/quote]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-7187.xml b/tests/text_processing/tickets_data/PHPBB3-7187.xml new file mode 100644 index 0000000000..d270b12619 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-7187.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_smilies"> + <column>smiley_id</column> + <column>code</column> + <column>emotion</column> + <column>smiley_url</column> + <column>smiley_width</column> + <column>smiley_height</column> + <column>smiley_order</column> + <column>display_on_posting</column> + <row> + <value>41</value> + <value>:geek:</value> + <value>Geek</value> + <value>icon_e_geek.gif</value> + <value>17</value> + <value>17</value> + <value>41</value> + <value>1</value> + </row> + <row> + <value>42</value> + <value>:ugeek:</value> + <value>Uber Geek</value> + <value>icon_e_ugeek.gif</value> + <value>17</value> + <value>18</value> + <value>42</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-7275.after.php b/tests/text_processing/tickets_data/PHPBB3-7275.after.php new file mode 100644 index 0000000000..99f41d7839 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-7275.after.php @@ -0,0 +1,19 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +function after_assert_phpbb3_7275($vars) +{ + extract($vars); + decode_message($parsed_text); + $test->assertSame($original, $parsed_text); +} diff --git a/tests/text_processing/tickets_data/PHPBB3-7275.html b/tests/text_processing/tickets_data/PHPBB3-7275.html new file mode 100644 index 0000000000..12502833fd --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-7275.html @@ -0,0 +1 @@ +<div align="center"><img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" alt=":)" title="Smile"></div>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-7275.txt b/tests/text_processing/tickets_data/PHPBB3-7275.txt new file mode 100644 index 0000000000..8de97d67e0 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-7275.txt @@ -0,0 +1 @@ +[center]:)[/center]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-7275.xml b/tests/text_processing/tickets_data/PHPBB3-7275.xml new file mode 100644 index 0000000000..9e979afffb --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-7275.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>center</value> + <value></value> + <value>1</value> + <value>[center]{TEXT}[/center]</value> + <value><![CDATA[<div align="center">{TEXT}</div>]]></value> + <value>!\[center\](.*?)\[/center\]!ies</value> + <value><![CDATA['[center:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${1}')).'[/center:$uid]']]></value> + <value>!\[center:$uid\](.*?)\[/center:$uid\]!s</value> + <value><![CDATA[<div align="center">${1}</div>]]></value> + </row> + </table> + + <table name="phpbb_smilies"> + <column>smiley_id</column> + <column>code</column> + <column>emotion</column> + <column>smiley_url</column> + <column>smiley_width</column> + <column>smiley_height</column> + <column>smiley_order</column> + <column>display_on_posting</column> + <row> + <value>4</value> + <value>:)</value> + <value>Smile</value> + <value>icon_e_smile.gif</value> + <value>15</value> + <value>17</value> + <value>4</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-8419.html b/tests/text_processing/tickets_data/PHPBB3-8419.html new file mode 100644 index 0000000000..38df626a94 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-8419.html @@ -0,0 +1 @@ +<span style="font-style: italic"><span style="font-weight: bold"><span style="color: #FF0000">tę </span></span></span>przykład
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-8419.txt b/tests/text_processing/tickets_data/PHPBB3-8419.txt new file mode 100644 index 0000000000..dac47823b6 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-8419.txt @@ -0,0 +1 @@ +[ort]tę [/ort]przykład
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-8419.xml b/tests/text_processing/tickets_data/PHPBB3-8419.xml new file mode 100644 index 0000000000..2f1df345f9 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-8419.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>myemail</value> + <value></value> + <value>1</value> + <value>[ort]{TEXT}[/ort]</value> + <value><![CDATA[<span style="font-style: italic"><span style="font-weight: bold"><span style="color: #FF0000">{TEXT}</span></span></span>]]></value> + <value><\[/ort\]!ies]]></value> + <value><![CDATA['[ort:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '(', ')'), trim('${1}')).'[/ort:$uid]']]></value> + <value><\[/ort:$uid\]!s]]></value> + <value><![CDATA[<span style="font-style: italic"><span style="font-weight: bold"><span style="color: #FF0000">${1}</span></span></span>]]></value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-9073.html b/tests/text_processing/tickets_data/PHPBB3-9073.html new file mode 100644 index 0000000000..ff1f9fd0ce --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9073.html @@ -0,0 +1,2 @@ +<a href="http://www.xxxx-xx-xxxx.com/" class="postlink">http://www.xxxx-xx-xxxx.com/</a><br> +<a href="http://www.xxxx-xx-xxxx.com/" class="postlink">http://www.xxxx-xx-xxxx.com/</a><br> diff --git a/tests/text_processing/tickets_data/PHPBB3-9073.txt b/tests/text_processing/tickets_data/PHPBB3-9073.txt new file mode 100644 index 0000000000..2c271173ce --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9073.txt @@ -0,0 +1,2 @@ +http://www.some-ad-site.com/ +[url]http://www.some-ad-site.com/[/url] diff --git a/tests/text_processing/tickets_data/PHPBB3-9073.xml b/tests/text_processing/tickets_data/PHPBB3-9073.xml new file mode 100644 index 0000000000..d635d51ed1 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9073.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_words"> + <column>word_id</column> + <column>word</column> + <column>replacement</column> + + <row> + <value>1</value> + <value>http://www.some-ad-site.com*</value> + <value>http://www.xxxx-xx-xxxx.com</value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-9377.html b/tests/text_processing/tickets_data/PHPBB3-9377.html new file mode 100644 index 0000000000..dcfb79c173 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9377.html @@ -0,0 +1 @@ +<span style="color:red">red <span style="color:blue">blue</span> red</span>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-9377.txt b/tests/text_processing/tickets_data/PHPBB3-9377.txt new file mode 100644 index 0000000000..dfd71492c5 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9377.txt @@ -0,0 +1 @@ +[red]red [blue]blue[/blue] red[/red]
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-9377.xml b/tests/text_processing/tickets_data/PHPBB3-9377.xml new file mode 100644 index 0000000000..1d8ee3d53f --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9377.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_bbcodes"> + <column>bbcode_id</column> + <column>bbcode_tag</column> + <column>bbcode_helpline</column> + <column>display_on_posting</column> + <column>bbcode_match</column> + <column>bbcode_tpl</column> + <column>first_pass_match</column> + <column>first_pass_replace</column> + <column>second_pass_match</column> + <column>second_pass_replace</column> + + <row> + <value>13</value> + <value>red</value> + <value></value> + <value>1</value> + <value>[red]{TEXT}[/red]</value> + <value><span style="color:red">{TEXT}</span></value> + <value>!\[red\](.*?)\[/red\]!ies</value> + <value>'[red:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', '&#39;', '&#40;', '&#41;'), trim('${1}')).'[/red:$uid]'</value> + <value>!\[red:$uid\](.*?)\[/red:$uid\]!s</value> + <value><span style="color:red">${1}</span></value> + </row> + + <row> + <value>14</value> + <value>blue</value> + <value></value> + <value>1</value> + <value>[blue]{TEXT}[/blue]</value> + <value><span style="color:blue">{TEXT}</span></value> + <value>!\[blue\](.*?)\[/blue\]!ies</value> + <value>'[blue:$uid]'.str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', '&#39;', '&#40;', '&#41;'), trim('${1}')).'[/blue:$uid]'</value> + <value>!\[blue:$uid\](.*?)\[/blue:$uid\]!s</value> + <value><span style="color:blue">${1}</span></value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-9791.html b/tests/text_processing/tickets_data/PHPBB3-9791.html new file mode 100644 index 0000000000..3d0108c8a6 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9791.html @@ -0,0 +1 @@ +<a href="http://www.phpbb.com/community/search.php?keywords=bogus&terms=all&author=&fid%5B%5D=46&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search" class="postlink">http://www.phpbb.com/community/search.p ... mit=Search</a>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-9791.txt b/tests/text_processing/tickets_data/PHPBB3-9791.txt new file mode 100644 index 0000000000..e29b20086d --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-9791.txt @@ -0,0 +1 @@ +http://www.phpbb.com/community/search.php?keywords=bogus&terms=all&author=&fid[]=46&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search
\ No newline at end of file diff --git a/tests/text_processing/tickets_test.php b/tests/text_processing/tickets_test.php new file mode 100644 index 0000000000..8c48a3f4a9 --- /dev/null +++ b/tests/text_processing/tickets_test.php @@ -0,0 +1,94 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_text_processing_tickets_test extends phpbb_test_case +{ + /** + * @dataProvider get_tickets_data + */ + public function test_tickets($ticket_id, $original, $expected, $fixture, $before_assert, $after_assert) + { + global $phpbb_container; + + $phpbb_container = new phpbb_mock_container_builder; + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container, $fixture); + + $parser = $phpbb_container->get('text_formatter.parser'); + $renderer = $phpbb_container->get('text_formatter.renderer'); + + if (isset($before_assert)) + { + $test = $this; + $before_assert(get_defined_vars()); + } + + $parsed_text = $parser->parse($original); + + $this->assertSame($expected, $renderer->render($parsed_text)); + + if (isset($after_assert)) + { + $test = $this; + $after_assert(get_defined_vars()); + } + } + + public function get_tickets_data() + { + $tests = array(); + + foreach (glob(__DIR__ . '/tickets_data/*.txt') as $txt_filename) + { + $ticket_id = basename($txt_filename, '.txt'); + $html_filename = substr($txt_filename, 0, -3) . 'html'; + $xml_filename = substr($txt_filename, 0, -3) . 'xml'; + $before_filename = substr($txt_filename, 0, -3) . 'before.php'; + $after_filename = substr($txt_filename, 0, -3) . 'after.php'; + + if (!file_exists($xml_filename)) + { + $xml_filename = __DIR__ . '/../fixtures/empty.xml'; + } + + $before_assert = null; + if (file_exists($before_filename)) + { + include($before_filename); + $before_assert = 'before_assert_' . strtolower(str_replace('-', '_', $ticket_id)); + } + + $after_assert = null; + if (file_exists($after_filename)) + { + include($after_filename); + $after_assert = 'after_assert_' . strtolower(str_replace('-', '_', $ticket_id)); + } + + $tests[] = array( + $ticket_id, + file_get_contents($txt_filename), + file_get_contents($html_filename), + $xml_filename, + $before_assert, + $after_assert + ); + } + + return $tests; + } +} diff --git a/tests/text_reparser/fixtures/config_text.xml b/tests/text_reparser/fixtures/config_text.xml new file mode 100644 index 0000000000..ba8e1fcfcc --- /dev/null +++ b/tests/text_reparser/fixtures/config_text.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_config_text"> + <column>config_name</column> + <column>config_value</column> + </table> +</dataset> diff --git a/tests/text_reparser/manager_test.php b/tests/text_reparser/manager_test.php new file mode 100644 index 0000000000..df6adacb66 --- /dev/null +++ b/tests/text_reparser/manager_test.php @@ -0,0 +1,117 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once __DIR__ . '/../mock/container_builder.php'; +require_once __DIR__ . '/../test_framework/phpbb_database_test_case.php'; + +class phpbb_text_reparser_manager_test extends phpbb_database_test_case +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\config\db_text */ + protected $config_text; + + /** @var \phpbb\textreparser\manager */ + protected $reparser_manager; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config_text.xml'); + } + + public function setUp() + { + parent::setUp(); + + $this->config = new \phpbb\config\config(array( + 'test_reparser_cron_interval' => 0, + 'my_reparser_cron_interval' => 100, + )); + + $db = $this->new_dbal(); + $this->config_text = new \phpbb\config\db_text($db, 'phpbb_config_text'); + + $service_collection = new \phpbb\di\service_collection(new phpbb_mock_container_builder()); + $service_collection->add('test_reparser'); + $service_collection->add('another_reparser'); + $service_collection->add('my_reparser'); + + $this->reparser_manager = new \phpbb\textreparser\manager($this->config, $this->config_text, $service_collection); + } + + public function test_get_resume_data() + { + $resume_data = array( + 'test_reparser' => array( + 'range-min' => 0, + 'range-max' => 100, + 'range-size' => 50, + ), + ); + $this->config_text->set('reparser_resume', serialize($resume_data)); + + $this->assert_array_content_equals($resume_data['test_reparser'], $this->reparser_manager->get_resume_data('test_reparser')); + $this->assertEmpty($this->reparser_manager->get_resume_data('another_reparser')); + } + + public function test_update_resume_data() + { + $resume_data = array( + 'test_reparser' => array( + 'range-min' => 0, + 'range-max' => 100, + 'range-size' => 50, + ), + ); + $this->config_text->set('reparser_resume', serialize($resume_data)); + + $this->reparser_manager->update_resume_data('another_reparser', 5, 20, 10, false); + $this->assert_array_content_equals($resume_data, unserialize($this->config_text->get('reparser_resume'))); + + $this->reparser_manager->update_resume_data('test_reparser', 0, 50, 50); + $resume_data = array( + 'test_reparser' => array( + 'range-min' => 0, + 'range-max' => 50, + 'range-size' => 50, + ), + 'another_reparser' => array( + 'range-min' => 5, + 'range-max' => 20, + 'range-size' => 10, + ), + ); + $this->assert_array_content_equals($resume_data, unserialize($this->config_text->get('reparser_resume'))); + } + + public function test_schedule() + { + $this->reparser_manager->schedule('no_reparser', 21); + $this->assertArrayNotHasKey('no_reparser_cron_interval', $this->config); + + $this->reparser_manager->schedule('another_reparser', 42); + $this->assertArrayNotHasKey('another_reparser_cron_interval', $this->config); + + $this->reparser_manager->schedule('test_reparser', 20); + $this->assertEquals(20, $this->config['test_reparser_cron_interval']); + } + + public function test_schedule_all() + { + $this->reparser_manager->schedule_all(180); + $this->assertEquals(180, $this->config['test_reparser_cron_interval']); + $this->assertEquals(180, $this->config['my_reparser_cron_interval']); + $this->assertArrayNotHasKey('another_reparser_cron_interval', $this->config); + } +} diff --git a/tests/text_reparser/plugins/contact_admin_info_test.php b/tests/text_reparser/plugins/contact_admin_info_test.php new file mode 100644 index 0000000000..1dc03834b6 --- /dev/null +++ b/tests/text_reparser/plugins/contact_admin_info_test.php @@ -0,0 +1,96 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../test_framework/phpbb_database_test_case.php'; + +class phpbb_textreparser_contact_admin_info_test extends phpbb_database_test_case +{ + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/contact_admin_info.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\contact_admin_info(new \phpbb\config\db_text($this->db, CONFIG_TEXT_TABLE)); + } + + protected function get_rows() + { + $sql = 'SELECT config_name, config_value + FROM ' . CONFIG_TEXT_TABLE . ' + ORDER BY config_name'; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + public function setUp() + { + global $config; + if (!isset($config)) + { + $config = new \phpbb\config\config(array()); + } + $this->get_test_case_helpers()->set_s9e_services(); + $this->db = $this->new_dbal(); + parent::setUp(); + } + + public function test_get_max_id() + { + $reparser = $this->get_reparser(); + $this->assertEquals(1, $reparser->get_max_id()); + } + + public function test_dry_run() + { + $old_rows = $this->get_rows(); + $reparser = $this->get_reparser(); + $reparser->disable_save(); + $reparser->reparse_range(1, 1); + $new_rows = $this->get_rows(); + $this->assertEquals($old_rows, $new_rows); + } + + public function test_reparse() + { + $reparser = $this->get_reparser(); + $reparser->enable_save(); + $reparser->reparse_range(1, 1); + $expected = array( + array( + 'config_name' => 'contact_admin_info', + 'config_value' => '<r><EMAIL email="admin@example.org"><s>[email]</s>admin@example.org<e>[/email]</e></EMAIL></r>', + ), + array( + 'config_name' => 'contact_admin_info_bitfield', + 'config_value' => 'ACA=', + ), + array( + 'config_name' => 'contact_admin_info_flags', + 'config_value' => '7', + ), + array( + 'config_name' => 'contact_admin_info_uid', + 'config_value' => '1a2hbwf5', + ), + ); + $this->assertEquals($expected, $this->get_rows()); + } +} diff --git a/tests/text_reparser/plugins/fixtures/contact_admin_info.xml b/tests/text_reparser/plugins/fixtures/contact_admin_info.xml new file mode 100644 index 0000000000..13cd82b1a4 --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/contact_admin_info.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_config_text"> + <column>config_name</column> + <column>config_value</column> + <row> + <value>contact_admin_info</value> + <value>[email:1a2hbwf5]admin@example.org[/email:1a2hbwf5]</value> + </row> + <row> + <value>contact_admin_info_uid</value> + <value>1a2hbwf5</value> + </row> + <row> + <value>contact_admin_info_bitfield</value> + <value>ACA=</value> + </row> + <row> + <value>contact_admin_info_flags</value> + <value>7</value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/fixtures/forums.xml b/tests/text_reparser/plugins/fixtures/forums.xml new file mode 100644 index 0000000000..c12c8d6d48 --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/forums.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_forums"> + <column>forum_id</column> + <column>forum_parents</column> + <column>forum_desc</column> + <column>forum_desc_uid</column> + <column>forum_desc_options</column> + <column>forum_rules</column> + <column>forum_rules_uid</column> + <column>forum_rules_options</column> + <row> + <value>1</value> + <value></value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + <value>0</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + <value>0</value> + </row> + <row> + <value>2</value> + <value></value> + <value>[b]Not bold[/b] :) http://example.org</value> + <value>abcd1234</value> + <value>0</value> + <value>[b]Not bold[/b] :) http://example.org</value> + <value>abcd1234</value> + <value>0</value> + </row> + <row> + <value>3</value> + <value></value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + <value>abcd1234</value> + <value>1</value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + <value>abcd1234</value> + <value>1</value> + </row> + <row> + <value>4</value> + <value></value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + <value>abcd1234</value> + <value>2</value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + <value>abcd1234</value> + <value>2</value> + </row> + <row> + <value>5</value> + <value></value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + <value>abcd1234</value> + <value>4</value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + <value>abcd1234</value> + <value>4</value> + </row> + <row> + <value>6</value> + <value></value> + <value><![CDATA[[flash=123,345:abcd1234]http://example.org/flash.swf[/flash:abcd1234]]]></value> + <value>abcd1234</value> + <value>1</value> + <value><![CDATA[[flash=123,345:abcd1234]http://example.org/flash.swf[/flash:abcd1234]]]></value> + <value>abcd1234</value> + <value>1</value> + </row> + <row> + <value>7</value> + <value></value> + <value><![CDATA[[flash=123,345]http://example.org/flash.swf[/flash]]]></value> + <value>abcd1234</value> + <value>0</value> + <value><![CDATA[[flash=123,345]http://example.org/flash.swf[/flash]]]></value> + <value>abcd1234</value> + <value>0</value> + </row> + <row> + <value>8</value> + <value></value> + <value><![CDATA[[img:abcd1234]http://example.org/img.png[/img:abcd1234]]]></value> + <value>abcd1234</value> + <value>1</value> + <value><![CDATA[[img:abcd1234]http://example.org/img.png[/img:abcd1234]]]></value> + <value>abcd1234</value> + <value>1</value> + </row> + <row> + <value>9</value> + <value></value> + <value><![CDATA[[img]http://example.org/img.png[/img]]]></value> + <value>abcd1234</value> + <value>0</value> + <value><![CDATA[[img]http://example.org/img.png[/img]]]></value> + <value>abcd1234</value> + <value>0</value> + </row> + <row> + <value>1000</value> + <value></value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + <value>0</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + <value>0</value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/fixtures/groups.xml b/tests/text_reparser/plugins/fixtures/groups.xml new file mode 100644 index 0000000000..15151426bc --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/groups.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_groups"> + <column>group_id</column> + <column>group_desc</column> + <column>group_desc_options</column> + <column>group_desc_uid</column> + <row> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + <value>7</value> + <value>abcd1234</value> + </row> + <row> + <value>2</value> + <value>[b]Not bold[/b] :) http://example.org</value> + <value>0</value> + <value>abcd1234</value> + </row> + <row> + <value>3</value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + <value>1</value> + <value>abcd1234</value> + </row> + <row> + <value>4</value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + <value>2</value> + <value>abcd1234</value> + </row> + <row> + <value>5</value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + <value>4</value> + <value>abcd1234</value> + </row> + <row> + <value>6</value> + <value><![CDATA[[flash=123,345:abcd1234]http://example.org/flash.swf[/flash:abcd1234]]]></value> + <value>1</value> + <value>abcd1234</value> + </row> + <row> + <value>7</value> + <value><![CDATA[[flash=123,345]http://example.org/flash.swf[/flash]]]></value> + <value>1</value> + <value>abcd1234</value> + </row> + <row> + <value>8</value> + <value><![CDATA[[img:abcd1234]http://example.org/img.png[/img:abcd1234]]]></value> + <value>1</value> + <value>abcd1234</value> + </row> + <row> + <value>9</value> + <value><![CDATA[[img]http://example.org/img.png[/img]]]></value> + <value>1</value> + <value>abcd1234</value> + </row> + <row> + <value>1000</value> + <value>This row should be [b]ignored[/b]</value> + <value>7</value> + <value>abcd1234</value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/fixtures/poll_options.xml b/tests/text_reparser/plugins/fixtures/poll_options.xml new file mode 100644 index 0000000000..48ba024315 --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/poll_options.xml @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_poll_options"> + <column>poll_option_id</column> + <column>topic_id</column> + <column>poll_option_text</column> + <row> + <value>1</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>This row should be [b:abcd1234]ignored[/b:abcd1234]</value> + </row> + <row> + <value>1</value> + <value>2</value> + <value>[b:abcd1234]Bold[/b:abcd1234]</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value><![CDATA[<!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) -->]]></value> + </row> + <row> + <value>3</value> + <value>2</value> + <value><![CDATA[<!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + </row> + <row> + <value>1</value> + <value>11</value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + </row> + <row> + <value>1</value> + <value>12</value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + </row> + <row> + <value>1</value> + <value>13</value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + </row> + <row> + <value>1</value> + <value>123</value> + <value>This row should be [b]ignored[/b]</value> + </row> + <row> + <value>2</value> + <value>123</value> + <value>This row should be [b:abcd1234]ignored[/b:abcd1234]</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>enable_bbcode</column> + <column>enable_smilies</column> + <column>enable_magic_url</column> + <column>post_text</column> + <column>bbcode_uid</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + <value>abcd1234</value> + </row> + <row> + <value>11</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value></value> + <value>abcd1234</value> + </row> + <row> + <value>12</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value></value> + <value>abcd1234</value> + </row> + <row> + <value>13</value> + <value>0</value> + <value>0</value> + <value>1</value> + <value></value> + <value>abcd1234</value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>topic_first_post_id</column> + <column>poll_title</column> + <row> + <value>1</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + </row> + <row> + <value>11</value> + <value>11</value> + <value>BBCode</value> + </row> + <row> + <value>12</value> + <value>12</value> + <value>Smilies</value> + </row> + <row> + <value>13</value> + <value>13</value> + <value>Magic URLs</value> + </row> + <row> + <value>123</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/fixtures/polls.xml b/tests/text_reparser/plugins/fixtures/polls.xml new file mode 100644 index 0000000000..2960d640a9 --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/polls.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_posts"> + <column>post_id</column> + <column>enable_bbcode</column> + <column>enable_smilies</column> + <column>enable_magic_url</column> + <column>post_text</column> + <column>bbcode_uid</column> + <row> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value></value> + <value>abcd1234</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value></value> + <value>abcd1234</value> + </row> + <row> + <value>3</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value></value> + <value>abcd1234</value> + </row> + <row> + <value>4</value> + <value>0</value> + <value>0</value> + <value>1</value> + <value></value> + <value>abcd1234</value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>topic_first_post_id</column> + <column>poll_title</column> + <row> + <value>1</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>[b]Not bold[/b] :) http://example.org</value> + </row> + <row> + <value>3</value> + <value>2</value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + </row> + <row> + <value>4</value> + <value>3</value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + </row> + <row> + <value>5</value> + <value>4</value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + </row> + <row> + <value>6</value> + <value>2</value> + <value><![CDATA[[flash=123,345:abcd1234]http://example.org/flash.swf[/flash:abcd1234]]]></value> + </row> + <row> + <value>7</value> + <value>1</value> + <value><![CDATA[[flash=123,345]http://example.org/flash.swf[/flash]]]></value> + </row> + <row> + <value>8</value> + <value>2</value> + <value><![CDATA[[img:abcd1234]http://example.org/img.png[/img:abcd1234]]]></value> + </row> + <row> + <value>9</value> + <value>1</value> + <value><![CDATA[[img]http://example.org/img.png[/img]]]></value> + </row> + <row> + <value>1000</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/fixtures/posts.xml b/tests/text_reparser/plugins/fixtures/posts.xml new file mode 100644 index 0000000000..ec31747ed9 --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/posts.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_posts"> + <column>post_id</column> + <column>enable_bbcode</column> + <column>enable_smilies</column> + <column>enable_magic_url</column> + <column>post_text</column> + <column>bbcode_uid</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + </row> + <row> + <value>2</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>[b]Not bold[/b] :) http://example.org</value> + <value>abcd1234</value> + </row> + <row> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + <value>abcd1234</value> + </row> + <row> + <value>4</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + <value>abcd1234</value> + </row> + <row> + <value>5</value> + <value>0</value> + <value>0</value> + <value>1</value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + <value>abcd1234</value> + </row> + <row> + <value>6</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[flash=123,345:abcd1234]http://example.org/flash.swf[/flash:abcd1234]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>7</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[flash=123,345]http://example.org/flash.swf[/flash]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>8</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[img:abcd1234]http://example.org/img.png[/img:abcd1234]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>9</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[img]http://example.org/img.png[/img]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>1000</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/fixtures/privmsgs.xml b/tests/text_reparser/plugins/fixtures/privmsgs.xml new file mode 100644 index 0000000000..4049b9890a --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/privmsgs.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_privmsgs"> + <column>msg_id</column> + <column>enable_bbcode</column> + <column>enable_smilies</column> + <column>enable_magic_url</column> + <column>message_text</column> + <column>bbcode_uid</column> + <column>to_address</column> + <column>bcc_address</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>[b]Not bold[/b] :) http://example.org</value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>0</value> + <value>0</value> + <value>1</value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[flash=123,345:abcd1234]http://example.org/flash.swf[/flash:abcd1234]]]></value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>7</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[flash=123,345]http://example.org/flash.swf[/flash]]]></value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>8</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[img:abcd1234]http://example.org/img.png[/img:abcd1234]]]></value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>9</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value><![CDATA[[img]http://example.org/img.png[/img]]]></value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + <row> + <value>1000</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + <value></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/fixtures/users.xml b/tests/text_reparser/plugins/fixtures/users.xml new file mode 100644 index 0000000000..60c623b6b1 --- /dev/null +++ b/tests/text_reparser/plugins/fixtures/users.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>user_permissions</column> + <column>username_clean</column> + <column>user_options</column> + <column>user_sig</column> + <column>user_sig_bbcode_uid</column> + <row> + <value>1</value> + <value></value> + <value>user1</value> + <value>230271</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + </row> + <row> + <value>2</value> + <value></value> + <value>user2</value> + <value>895</value> + <value>[b]Not bold[/b] :) http://example.org</value> + <value>abcd1234</value> + </row> + <row> + <value>3</value> + <value></value> + <value>user3</value> + <value>33663</value> + <value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value> + <value>abcd1234</value> + </row> + <row> + <value>4</value> + <value></value> + <value>user4</value> + <value>66431</value> + <value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value> + <value>abcd1234</value> + </row> + <row> + <value>5</value> + <value></value> + <value>user5</value> + <value>131967</value> + <value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value> + <value>abcd1234</value> + </row> + <row> + <value>6</value> + <value></value> + <value>user6</value> + <value>99199</value> + <value><![CDATA[[flash=123,345:abcd1234]http://example.org/flash.swf[/flash:abcd1234]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>7</value> + <value></value> + <value>user7</value> + <value>99199</value> + <value><![CDATA[[flash=123,345]http://example.org/flash.swf[/flash]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>8</value> + <value></value> + <value>user8</value> + <value>99199</value> + <value><![CDATA[[img:abcd1234]http://example.org/img.png[/img:abcd1234]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>9</value> + <value></value> + <value>user9</value> + <value>99199</value> + <value><![CDATA[[img]http://example.org/img.png[/img]]]></value> + <value>abcd1234</value> + </row> + <row> + <value>1000</value> + <value></value> + <value>user1000</value> + <value>230271</value> + <value>This row should be [b]ignored[/b]</value> + <value>abcd1234</value> + </row> + </table> +</dataset> diff --git a/tests/text_reparser/plugins/forum_description_test.php b/tests/text_reparser/plugins/forum_description_test.php new file mode 100644 index 0000000000..57166e6a3c --- /dev/null +++ b/tests/text_reparser/plugins/forum_description_test.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +include_once __DIR__ . '/test_row_based_plugin.php'; + +class phpbb_textreparser_forum_description_test extends phpbb_textreparser_test_row_based_plugin +{ + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/forums.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\forum_description($this->db, FORUMS_TABLE); + } +} diff --git a/tests/text_reparser/plugins/forum_rules_test.php b/tests/text_reparser/plugins/forum_rules_test.php new file mode 100644 index 0000000000..72e4e98876 --- /dev/null +++ b/tests/text_reparser/plugins/forum_rules_test.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +include_once __DIR__ . '/test_row_based_plugin.php'; + +class phpbb_textreparser_forum_rules_test extends phpbb_textreparser_test_row_based_plugin +{ + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/forums.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\forum_rules($this->db, FORUMS_TABLE); + } +} diff --git a/tests/text_reparser/plugins/group_description_test.php b/tests/text_reparser/plugins/group_description_test.php new file mode 100644 index 0000000000..babfc7e02f --- /dev/null +++ b/tests/text_reparser/plugins/group_description_test.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +include_once __DIR__ . '/test_row_based_plugin.php'; + +class phpbb_textreparser_group_description_test extends phpbb_textreparser_test_row_based_plugin +{ + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/groups.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\group_description($this->db, GROUPS_TABLE); + } +} diff --git a/tests/text_reparser/plugins/pm_text_test.php b/tests/text_reparser/plugins/pm_text_test.php new file mode 100644 index 0000000000..6dc1a9cb4c --- /dev/null +++ b/tests/text_reparser/plugins/pm_text_test.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +include_once __DIR__ . '/test_row_based_plugin.php'; + +class phpbb_textreparser_pm_text_test extends phpbb_textreparser_test_row_based_plugin +{ + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/privmsgs.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\pm_text($this->db, PRIVMSGS_TABLE); + } +} diff --git a/tests/text_reparser/plugins/poll_option_test.php b/tests/text_reparser/plugins/poll_option_test.php new file mode 100644 index 0000000000..dfa3a030ed --- /dev/null +++ b/tests/text_reparser/plugins/poll_option_test.php @@ -0,0 +1,130 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../test_framework/phpbb_database_test_case.php'; + +class phpbb_textreparser_poll_option_test extends phpbb_database_test_case +{ + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/poll_options.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\poll_option($this->db); + } + + protected function get_rows() + { + $sql = 'SELECT topic_id, poll_option_id, poll_option_text + FROM ' . POLL_OPTIONS_TABLE . ' + ORDER BY topic_id, poll_option_id'; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + public function setUp() + { + global $config; + if (!isset($config)) + { + $config = new \phpbb\config\config(array()); + } + $this->get_test_case_helpers()->set_s9e_services(); + $this->db = $this->new_dbal(); + parent::setUp(); + } + + public function test_get_max_id() + { + $reparser = $this->get_reparser(); + $this->assertEquals(123, $reparser->get_max_id()); + } + + public function test_dry_run() + { + $old_rows = $this->get_rows(); + $reparser = $this->get_reparser(); + $reparser->disable_save(); + $reparser->reparse_range(1, 1); + $new_rows = $this->get_rows(); + $this->assertEquals($old_rows, $new_rows); + } + + public function testReparse() + { + $reparser = $this->get_reparser(); + $reparser->enable_save(); + $reparser->reparse_range(2, 13); + $expected = array( + array( + 'topic_id' => 1, + 'poll_option_id' => 1, + 'poll_option_text' => 'This row should be [b]ignored[/b]', + ), + array( + 'topic_id' => 1, + 'poll_option_id' => 2, + 'poll_option_text' => 'This row should be [b:abcd1234]ignored[/b:abcd1234]', + ), + array( + 'topic_id' => 2, + 'poll_option_id' => 1, + 'poll_option_text' => '<r><B><s>[b]</s>Bold<e>[/b]</e></B></r>', + ), + array( + 'topic_id' => 2, + 'poll_option_id' => 2, + 'poll_option_text' => '<r><E>:)</E></r>', + ), + array( + 'topic_id' => 2, + 'poll_option_id' => 3, + 'poll_option_text' => '<r><URL url="http://example.org">http://example.org</URL></r>', + ), + array( + 'topic_id' => 11, + 'poll_option_id' => 1, + 'poll_option_text' => '<r><B><s>[b]</s>Bold<e>[/b]</e></B> :) http://example.org</r>', + ), + array( + 'topic_id' => 12, + 'poll_option_id' => 1, + 'poll_option_text' => '<r>[b]Not bold[/b] <E>:)</E> http://example.org</r>', + ), + array( + 'topic_id' => 13, + 'poll_option_id' => 1, + 'poll_option_text' => '<r>[b]Not bold[/b] :) <URL url="http://example.org">http://example.org</URL></r>', + ), + array( + 'topic_id' => 123, + 'poll_option_id' => 1, + 'poll_option_text' => 'This row should be [b]ignored[/b]', + ), + array( + 'topic_id' => 123, + 'poll_option_id' => 2, + 'poll_option_text' => 'This row should be [b:abcd1234]ignored[/b:abcd1234]', + ), + ); + $this->assertEquals($expected, $this->get_rows()); + } +} diff --git a/tests/text_reparser/plugins/poll_title_test.php b/tests/text_reparser/plugins/poll_title_test.php new file mode 100644 index 0000000000..046b6019c8 --- /dev/null +++ b/tests/text_reparser/plugins/poll_title_test.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +include_once __DIR__ . '/test_row_based_plugin.php'; + +class phpbb_textreparser_poll_title_test extends phpbb_textreparser_test_row_based_plugin +{ + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/polls.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\poll_title($this->db, TOPICS_TABLE); + } +} diff --git a/tests/text_reparser/plugins/post_text_test.php b/tests/text_reparser/plugins/post_text_test.php new file mode 100644 index 0000000000..8ea71e65f5 --- /dev/null +++ b/tests/text_reparser/plugins/post_text_test.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +include_once __DIR__ . '/test_row_based_plugin.php'; + +class phpbb_textreparser_post_text_test extends phpbb_textreparser_test_row_based_plugin +{ + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/posts.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\post_text($this->db, POSTS_TABLE); + } +} diff --git a/tests/text_reparser/plugins/test_row_based_plugin.php b/tests/text_reparser/plugins/test_row_based_plugin.php new file mode 100644 index 0000000000..e8218dfdd6 --- /dev/null +++ b/tests/text_reparser/plugins/test_row_based_plugin.php @@ -0,0 +1,151 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +require_once __DIR__ . '/../../../phpBB/includes/functions.php'; +require_once __DIR__ . '/../../../phpBB/includes/functions_content.php'; +require_once __DIR__ . '/../../test_framework/phpbb_database_test_case.php'; + +abstract class phpbb_textreparser_test_row_based_plugin extends phpbb_database_test_case +{ + protected $db; + + abstract protected function get_reparser(); + + protected function get_rows(array $ids) + { + $reparser = $this->get_reparser(); + $columns = $reparser->get_columns(); + + $reflection_reparser = new ReflectionClass(get_class($reparser)); + $table_property = $reflection_reparser->getProperty('table'); + $table_property->setAccessible(true); + + $sql = 'SELECT ' . $columns['id'] . ' AS id, ' . $columns['text'] . ' AS text + FROM ' . $table_property->getValue($reparser) . ' + WHERE ' . $this->db->sql_in_set($columns['id'], $ids) . ' + ORDER BY id'; + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + public function setUp() + { + global $config; + if (!isset($config)) + { + $config = new \phpbb\config\config(array()); + } + $this->get_test_case_helpers()->set_s9e_services(); + $this->db = $this->new_dbal(); + parent::setUp(); + } + + public function test_get_max_id() + { + $reparser = $this->get_reparser(); + $this->assertEquals(1000, $reparser->get_max_id()); + } + + public function test_dry_run() + { + $old_rows = $this->get_rows(array(1)); + $reparser = $this->get_reparser(); + $reparser->disable_save(); + $reparser->reparse_range(1, 1); + $new_rows = $this->get_rows(array(1)); + $this->assertEquals($old_rows, $new_rows); + } + + /** + * @dataProvider get_reparse_tests + */ + public function test_reparse($min_id, $max_id, $expected) + { + $reparser = $this->get_reparser(); + $reparser->reparse_range($min_id, $max_id); + + $ids = array(); + foreach ($expected as $row) + { + $ids[] = $row['id']; + } + + $this->assertEquals($expected, $this->get_rows($ids)); + } + + public function get_reparse_tests() + { + return array( + array( + 2, + 5, + array( + array( + 'id' => '1', + 'text' => 'This row should be [b]ignored[/b]', + ), + array( + 'id' => '2', + 'text' => '<t>[b]Not bold[/b] :) http://example.org</t>', + ), + array( + 'id' => '3', + 'text' => '<r><B><s>[b]</s>Bold<e>[/b]</e></B> :) http://example.org</r>', + ), + array( + 'id' => '4', + 'text' => '<r>[b]Not bold[/b] <E>:)</E> http://example.org</r>', + ), + array( + 'id' => '5', + 'text' => '<r>[b]Not bold[/b] :) <URL url="http://example.org">http://example.org</URL></r>', + ), + array( + 'id' => '1000', + 'text' => 'This row should be [b]ignored[/b]', + ), + ) + ), + array( + 6, + 7, + array( + array( + 'id' => '6', + 'text' => '<r><FLASH height="345" url="http://example.org/flash.swf" width="123"><s>[flash=123,345]</s>http://example.org/flash.swf<e>[/flash]</e></FLASH></r>', + ), + array( + 'id' => '7', + 'text' => '<t>[flash=123,345]http://example.org/flash.swf[/flash]</t>', + ), + ) + ), + array( + 8, + 9, + array( + array( + 'id' => '8', + 'text' => '<r><IMG src="http://example.org/img.png"><s>[img]</s>http://example.org/img.png<e>[/img]</e></IMG></r>', + ), + array( + 'id' => '9', + 'text' => '<t>[img]http://example.org/img.png[/img]</t>', + ), + ) + ), + ); + } +} diff --git a/tests/text_reparser/plugins/user_signature_test.php b/tests/text_reparser/plugins/user_signature_test.php new file mode 100644 index 0000000000..5b66f2788a --- /dev/null +++ b/tests/text_reparser/plugins/user_signature_test.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +include_once __DIR__ . '/test_row_based_plugin.php'; + +class phpbb_textreparser_user_signature_test extends phpbb_textreparser_test_row_based_plugin +{ + public function getDataSet() + { + return $this->createXMLDataSet(__DIR__ . '/fixtures/users.xml'); + } + + protected function get_reparser() + { + return new \phpbb\textreparser\plugins\user_signature($this->db, USERS_TABLE); + } +} diff --git a/tests/tree/nestedset_forum_base.php b/tests/tree/nestedset_forum_base.php index ce03c1fc21..647fcef2af 100644 --- a/tests/tree/nestedset_forum_base.php +++ b/tests/tree/nestedset_forum_base.php @@ -1,12 +1,18 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case { public function getDataSet() @@ -53,7 +59,6 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case global $config; $config = $this->config = new \phpbb\config\config(array('nestedset_forum_lock' => 0)); - set_config(null, null, null, $this->config); $this->lock = new \phpbb\lock\db('nestedset_forum_lock', $this->config, $this->db); $this->set = new \phpbb\tree\nestedset_forum($this->db, $this->lock, 'phpbb_forums'); diff --git a/tests/tree/nestedset_forum_get_data_test.php b/tests/tree/nestedset_forum_get_data_test.php index ca1863e55e..48fbabdb8c 100644 --- a/tests/tree/nestedset_forum_get_data_test.php +++ b/tests/tree/nestedset_forum_get_data_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -116,4 +120,20 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne $forum_data['forum_parents'] = $forum_parents; $this->assertEquals($expected, array_keys($this->set->get_path_basic_data($forum_data))); } + + public function get_all_tree_data_data() + { + return array( + array(true, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)), + array(false, array(11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)), + ); + } + + /** + * @dataProvider get_all_tree_data_data + */ + public function test_get_all_tree_data($order_asc, $expected) + { + $this->assertEquals($expected, array_keys($this->set->get_all_tree_data($order_asc))); + } } diff --git a/tests/tree/nestedset_forum_insert_delete_test.php b/tests/tree/nestedset_forum_insert_delete_test.php index d0e9e02c2e..6393752010 100644 --- a/tests/tree/nestedset_forum_insert_delete_test.php +++ b/tests/tree/nestedset_forum_insert_delete_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/tree/nestedset_forum_move_test.php b/tests/tree/nestedset_forum_move_test.php index fe506c8278..108faf5b71 100644 --- a/tests/tree/nestedset_forum_move_test.php +++ b/tests/tree/nestedset_forum_move_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/tree/nestedset_forum_regenerate_test.php b/tests/tree/nestedset_forum_regenerate_test.php index 38338dbc4d..914cc5f749 100644 --- a/tests/tree/nestedset_forum_regenerate_test.php +++ b/tests/tree/nestedset_forum_regenerate_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/tree/nestedset_forum_test.php b/tests/tree/nestedset_forum_test.php index 516c794ffc..7ccdc0a9b5 100644 --- a/tests/tree/nestedset_forum_test.php +++ b/tests/tree/nestedset_forum_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package tree -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/ui/quick_links_test.php b/tests/ui/quick_links_test.php new file mode 100644 index 0000000000..5bddb44a8b --- /dev/null +++ b/tests/ui/quick_links_test.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @group ui +*/ +class quick_links_test extends phpbb_ui_test_case +{ + + public function test_quick_links() + { + $this->visit('index.php'); + $this->assertEmpty(self::find_element('className', 'dropdown')->getText()); + self::find_element('className', 'dropdown-toggle')->click(); + $this->assertNotNull(self::find_element('className', 'dropdown')->getText()); + } +} diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php index 87cd00197f..1351b46002 100644 --- a/tests/upload/filespec_test.php +++ b/tests/upload/filespec_test.php @@ -1,15 +1,18 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once __DIR__ . '/../../phpBB/includes/functions.php'; require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; -require_once __DIR__ . '/../../phpBB/includes/functions_upload.php'; class phpbb_filespec_test extends phpbb_test_case { @@ -19,14 +22,19 @@ class phpbb_filespec_test extends phpbb_test_case const UPLOAD_MAX_FILESIZE = 1000; private $config; + private $filesystem; public $path; + /** @var \phpbb\language\language */ + protected $language; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + protected function setUp() { // Global $config required by unique_id - // Global $user required by filespec::additional_checks and - // filespec::move_file - global $config, $user; + global $config, $phpbb_root_path, $phpEx; if (!is_array($config)) { @@ -40,9 +48,6 @@ class phpbb_filespec_test extends phpbb_test_case // See: phpBB/install/schemas/schema_data.sql $config['mime_triggers'] = 'body|head|html|img|plaintext|a href|pre|script|table|title'; - $user = new phpbb_mock_user(); - $user->lang = new phpbb_mock_lang(); - $this->config = &$config; $this->path = __DIR__ . '/fixture/'; @@ -61,6 +66,27 @@ class phpbb_filespec_test extends phpbb_test_case copy($fileinfo->getPathname(), $this->path . 'copies/' . $fileinfo->getFilename() . '_copy_2'); } } + + $guessers = array( + new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), + new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \phpbb\mimetype\content_guesser(), + new \phpbb\mimetype\extension_guesser(), + ); + $guessers[2]->set_priority(-2); + $guessers[3]->set_priority(-2); + $this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->phpbb_root_path = $phpbb_root_path; + } + + private function set_reflection_property(&$class, $property_name, $value) + { + $property = new ReflectionProperty($class, $property_name); + $property->setAccessible(true); + $property->setValue($class, $value); } private function get_filespec($override = array()) @@ -74,14 +100,13 @@ class phpbb_filespec_test extends phpbb_test_case 'error' => '', ); - return new filespec(array_merge($upload_ary, $override), null); + $filespec = new \phpbb\files\filespec($this->filesystem, $this->language, new \bantu\IniGetWrapper\IniGetWrapper, new \FastImageSize\FastImageSize(), $this->phpbb_root_path, $this->mimetype_guesser); + return $filespec->set_upload_ary(array_merge($upload_ary, $override)); } protected function tearDown() { - global $user; $this->config = array(); - $user = null; $iterator = new DirectoryIterator($this->path . 'copies'); foreach ($iterator as $fileinfo) @@ -94,6 +119,13 @@ class phpbb_filespec_test extends phpbb_test_case } } + public function test_empty_upload_ary() + { + $filespec = new \phpbb\files\filespec($this->filesystem, $this->language, new \bantu\IniGetWrapper\IniGetWrapper, new \FastImageSize\FastImageSize(), $this->phpbb_root_path, $this->mimetype_guesser); + $this->assertInstanceOf('\phpbb\files\filespec', $filespec->set_upload_ary(array())); + $this->assertTrue($filespec->init_error()); + } + public function additional_checks_variables() { // False here just indicates the file is too large and fails the @@ -115,13 +147,26 @@ class phpbb_filespec_test extends phpbb_test_case { $upload = new phpbb_mock_fileupload(); $filespec = $this->get_filespec(); - $filespec->upload = $upload; - $filespec->file_moved = true; - $filespec->filesize = $filespec->get_filesize($this->path . $filename); + $filespec->set_upload_namespace($upload); + $this->set_reflection_property($filespec, 'file_moved', true); + $this->set_reflection_property($filespec, 'filesize', $filespec->get_filesize($this->path . $filename)); $this->assertEquals($expected, $filespec->additional_checks()); } + public function test_additional_checks_dimensions() + { + $upload = new phpbb_mock_fileupload(); + $filespec = $this->get_filespec(); + $filespec->set_upload_namespace($upload); + $upload->valid_dimensions = false; + $this->set_reflection_property($filespec, 'file_moved', true); + $upload->max_filesize = 0; + + $this->assertEquals(false, $filespec->additional_checks()); + $this->assertSame(array('WRONG_SIZE'), $filespec->error); + } + public function check_content_variables() { // False here indicates that a file is non-binary and contains @@ -143,6 +188,8 @@ class phpbb_filespec_test extends phpbb_test_case $disallowed_content = explode('|', $this->config['mime_triggers']); $filespec = $this->get_filespec(array('tmp_name' => $this->path . $filename)); $this->assertEquals($expected, $filespec->check_content($disallowed_content)); + // All files should pass if $disallowed_content is empty + $this->assertEquals(true, $filespec->check_content(array())); } public function clean_filename_variables() @@ -154,6 +201,7 @@ class phpbb_filespec_test extends phpbb_test_case array($chunks[2] . $chunks[9]), array($chunks[3] . $chunks[4]), array($chunks[5] . $chunks[6]), + array('foobar.png'), ); } @@ -165,7 +213,7 @@ class phpbb_filespec_test extends phpbb_test_case $bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|'); $filespec = $this->get_filespec(array('name' => $filename)); $filespec->clean_filename('real', self::PREFIX); - $name = $filespec->realname; + $name = $filespec->get('realname'); $this->assertEquals(0, preg_match('/%(\w{2})/', $name)); foreach ($bad_chars as $char) @@ -181,8 +229,8 @@ class phpbb_filespec_test extends phpbb_test_case { $filespec = $this->get_filespec(); $filespec->clean_filename('unique', self::PREFIX); - $name = $filespec->realname; - + $name = $filespec->get('realname'); + $this->assertEquals(strlen($name), 32 + strlen(self::PREFIX)); $this->assertRegExp('#^[A-Za-z0-9]+$#', substr($name, strlen(self::PREFIX))); $this->assertFalse(isset($filenames[$name])); @@ -190,6 +238,55 @@ class phpbb_filespec_test extends phpbb_test_case } } + public function test_clean_filename_unique_ext() + { + $filenames = array(); + for ($tests = 0; $tests < self::TEST_COUNT; $tests++) + { + $filespec = $this->get_filespec(array('name' => 'foobar.jpg')); + $filespec->clean_filename('unique_ext', self::PREFIX); + $name = $filespec->get('realname'); + + $this->assertEquals(strlen($name), 32 + strlen(self::PREFIX) + strlen('.jpg')); + $this->assertRegExp('#^[A-Za-z0-9]+\.jpg$#', substr($name, strlen(self::PREFIX))); + $this->assertFalse(isset($filenames[$name])); + $filenames[$name] = true; + } + } + + public function data_clean_filename_avatar() + { + return array( + array(false, false, ''), + array('foobar.png', 'u5.png', 'avatar', 'u', 5), + array('foobar.png', 'g9.png', 'avatar', 'g', 9), + + ); + } + + /** + * @dataProvider data_clean_filename_avatar + */ + public function test_clean_filename_avatar($filename, $expected, $mode, $prefix = '', $user_id = '') + { + $filespec = new \phpbb\files\filespec($this->filesystem, $this->language, new \bantu\IniGetWrapper\IniGetWrapper, new \FastImageSize\FastImageSize(), $this->phpbb_root_path, $this->mimetype_guesser); + + if ($filename) + { + $upload_ary = array( + 'name' => $filename, + 'type' => '', + 'size' => '', + 'tmp_name' => '', + 'error' => '', + ); + $filespec->set_upload_ary($upload_ary); + } + $filespec->clean_filename($mode, $prefix, $user_id); + + $this->assertSame($expected, $filespec->get('realname')); + } + public function get_extension_variables() { return array( @@ -197,6 +294,8 @@ class phpbb_filespec_test extends phpbb_test_case array('file.phpbb.gif', 'gif'), array('file..', ''), array('.file..jpg.webp', 'webp'), + array('/test.com/file', ''), + array('/test.com/file.gif', 'gif'), ); } @@ -205,7 +304,7 @@ class phpbb_filespec_test extends phpbb_test_case */ public function test_get_extension($filename, $expected) { - $this->assertEquals($expected, filespec::get_extension($filename)); + $this->assertEquals($expected, \phpbb\files\filespec::get_extension($filename)); } public function is_image_variables() @@ -216,6 +315,9 @@ class phpbb_filespec_test extends phpbb_test_case array('png', 'image/png', true), array('tif', 'image/tif', true), array('txt', 'text/plain', false), + array('jpg', 'application/octet-stream', false), + array('gif', 'application/octetstream', false), + array('png', 'application/mime', false), ); } @@ -228,6 +330,35 @@ class phpbb_filespec_test extends phpbb_test_case $this->assertEquals($expected, $filespec->is_image()); } + public function is_image_get_mimetype() + { + return array( + array('gif', 'image/gif', true), + array('jpg', 'image/jpg', true), + array('png', 'image/png', true), + array('tif', 'image/tif', true), + array('txt', 'text/plain', false), + array('jpg', 'application/octet-stream', true), + array('gif', 'application/octetstream', true), + array('png', 'application/mime', true), + ); + } + + /** + * @dataProvider is_image_get_mimetype + */ + public function test_is_image_get_mimetype($filename, $mimetype, $expected) + { + if (!class_exists('finfo') && strtolower(substr(PHP_OS, 0, 3)) === 'win') + { + $this->markTestSkipped('Unable to test mimetype guessing without fileinfo support on Windows'); + } + + $filespec = $this->get_filespec(array('tmp_name' => $this->path . $filename, 'type' => $mimetype)); + $filespec->get_mimetype($this->path . $filename); + $this->assertEquals($expected, $filespec->is_image()); + } + public function move_file_variables() { return array( @@ -236,7 +367,7 @@ class phpbb_filespec_test extends phpbb_test_case array('txt_copy', 'txt_as_img', 'image/jpg', 'txt', false, true), array('txt_copy_2', 'txt_moved', 'text/plain', 'txt', false, true), array('jpg_copy', 'jpg_moved', 'image/png', 'jpg', false, true), - array('png_copy', 'png_moved', 'image/png', 'jpg', 'IMAGE_FILETYPE_MISMATCH', true), + array('png_copy', 'png_moved', 'image/png', 'jpg', 'Image file type mismatch: expected extension png but extension jpg given.', true), ); } @@ -247,8 +378,7 @@ class phpbb_filespec_test extends phpbb_test_case { // Global $phpbb_root_path and $phpEx are required by phpbb_chmod global $phpbb_root_path, $phpEx; - $phpbb_root_path = ''; - $phpEx = 'php'; + $this->phpbb_root_path = ''; $upload = new phpbb_mock_fileupload(); $upload->max_filesize = self::UPLOAD_MAX_FILESIZE; @@ -258,17 +388,173 @@ class phpbb_filespec_test extends phpbb_test_case 'name' => $realname, 'type' => $mime_type, )); - $filespec->extension = $extension; - $filespec->upload = $upload; - $filespec->local = true; + $this->set_reflection_property($filespec, 'extension', $extension); + $filespec->set_upload_namespace($upload); + $this->set_reflection_property($filespec, 'local', true); $this->assertEquals($expected, $filespec->move_file($this->path . 'copies')); - $this->assertEquals($filespec->file_moved, file_exists($this->path . 'copies/' . $realname)); + $this->assertEquals($filespec->get('file_moved'), file_exists($this->path . 'copies/' . $realname)); if ($error) { $this->assertEquals($error, $filespec->error[0]); } - $phpEx = ''; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function test_move_file_error() + { + $filespec = $this->get_filespec(); + $this->assertFalse($filespec->move_file('foobar')); + $filespec->error[] = 'foo'; + $this->assertFalse($filespec->move_file('foo')); + } + + public function data_move_file_copy() + { + return array( + array('gif_copy', true, false, array()), + array('gif_copy', true, true, array()), + array('foo_bar', false, false, array('GENERAL_UPLOAD_ERROR')), + array('foo_bar', false, true, array('GENERAL_UPLOAD_ERROR')), + ); + } + + /** + * @dataProvider data_move_file_copy + */ + public function test_move_file_copy($tmp_name, $move_success, $safe_mode_on, $expected_error) + { + // Initialise a blank filespec object for use with trivial methods + $upload_ary = array( + 'name' => 'gif_moved', + 'type' => 'image/gif', + 'size' => '', + 'tmp_name' => $this->path . 'copies/' . $tmp_name, + 'error' => '', + ); + + $php_ini = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper') + ->getMock(); + $php_ini->expects($this->any()) + ->method('getBool') + ->with($this->anything()) + ->willReturn($safe_mode_on); + $upload = new phpbb_mock_fileupload(); + $upload->max_filesize = self::UPLOAD_MAX_FILESIZE; + $filespec = new \phpbb\files\filespec($this->filesystem, $this->language, $php_ini, new \FastImageSize\FastImagesize, '', $this->mimetype_guesser); + $filespec->set_upload_ary($upload_ary); + $this->set_reflection_property($filespec, 'local', false); + $this->set_reflection_property($filespec, 'extension', 'gif'); + $filespec->set_upload_namespace($upload); + + $this->assertEquals($move_success, $filespec->move_file($this->path . 'copies')); + $this->assertEquals($filespec->get('file_moved'), file_exists($this->path . 'copies/gif_moved')); + $this->assertSame($expected_error, $filespec->error); + } + + public function data_move_file_imagesize() + { + return array( + array( + array( + 'width' => 2, + 'height' => 2, + 'type' => IMAGETYPE_GIF, + ), + array() + ), + array( + array( + 'width' => 2, + 'height' => 2, + 'type' => -1, + ), + array('Image file type -1 for mimetype image/gif not supported.') + ), + array( + array( + 'width' => 0, + 'height' => 0, + 'type' => IMAGETYPE_GIF, + ), + array('The image file you tried to attach is invalid.') + ), + array( + false, + array('It was not possible to determine the dimensions of the image. Please verify that the URL you entered is correct.') + ) + ); + } + + /** + * @dataProvider data_move_file_imagesize + */ + public function test_move_file_imagesize($imagesize_return, $expected_error) + { + // Initialise a blank filespec object for use with trivial methods + $upload_ary = array( + 'name' => 'gif_moved', + 'type' => 'image/gif', + 'size' => '', + 'tmp_name' => $this->path . 'copies/gif_copy', + 'error' => '', + ); + + $imagesize = $this->getMockBuilder('\FastImageSize\FastImageSize') + ->getMock(); + $imagesize->expects($this->any()) + ->method('getImageSize') + ->with($this->anything()) + ->willReturn($imagesize_return); + + $upload = new phpbb_mock_fileupload(); + $upload->max_filesize = self::UPLOAD_MAX_FILESIZE; + $filespec = new \phpbb\files\filespec($this->filesystem, $this->language, new \bantu\IniGetWrapper\IniGetWrapper, $imagesize, '', $this->mimetype_guesser); + $filespec->set_upload_ary($upload_ary); + $this->set_reflection_property($filespec, 'local', false); + $this->set_reflection_property($filespec, 'extension', 'gif'); + $filespec->set_upload_namespace($upload); + + $this->assertEquals(true, $filespec->move_file($this->path . 'copies')); + $this->assertEquals($filespec->get('file_moved'), file_exists($this->path . 'copies/gif_moved')); + $this->assertSame($expected_error, $filespec->error); + } + + /** + * @dataProvider clean_filename_variables + */ + public function test_uploadname($filename) + { + $type_cast_helper = new \phpbb\request\type_cast_helper(); + + $upload_name = ''; + $type_cast_helper->set_var($upload_name, $filename, 'string', true, true); + $filespec = $this->get_filespec(array('name'=> $upload_name)); + + $this->assertSame(trim(utf8_basename(htmlspecialchars($filename))), $filespec->get('uploadname')); + } + + public function test_is_uploaded() + { + $filespec = new \phpbb\files\filespec($this->filesystem, $this->language, new \bantu\IniGetWrapper\IniGetWrapper, new \FastImageSize\FastImageSize(), $this->phpbb_root_path, null); + $reflection_filespec = new ReflectionClass($filespec); + $plupload_property = $reflection_filespec->getProperty('plupload'); + $plupload_property->setAccessible(true); + $plupload_mock = $this->getMockBuilder('\phpbb\plupload\plupload') + ->disableOriginalConstructor() + ->getMock(); + $plupload_mock->expects($this->any()) + ->method('is_active') + ->will($this->returnValue(true)); + $plupload_property->setValue($filespec, $plupload_mock); + $is_uploaded = $reflection_filespec->getMethod('is_uploaded'); + + // Plupload is active and file does not exist + $this->assertFalse($is_uploaded->invoke($filespec)); + + // Plupload is not active and file was not uploaded + $plupload_property->setValue($filespec, null); + $this->assertFalse($is_uploaded->invoke($filespec)); } } diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index 8b9df33a63..05cb8dcf93 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -1,42 +1,100 @@ <?php /** - * - * @package testing - * @copyright (c) 2012 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ require_once __DIR__ . '/../../phpBB/includes/functions.php'; require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; -require_once __DIR__ . '/../../phpBB/includes/functions_upload.php'; require_once __DIR__ . '/../mock/filespec.php'; class phpbb_fileupload_test extends phpbb_test_case { private $path; + private $filesystem; + + /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ + protected $container; + + /** @var \phpbb\files\factory */ + protected $factory; + + /** @var \bantu\IniGetWrapper\IniGetWrapper */ + protected $php_ini; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + protected function setUp() { // Global $config required by unique_id - // Global $user required by several functions dealing with translations - // Global $request required by form_upload, local_upload and is_valid - global $config, $user, $request; + global $config, $phpbb_root_path, $phpEx; if (!is_array($config)) { - $config = array(); + $config = new \phpbb\config\config(array()); } $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; - $user = new phpbb_mock_user(); - $user->lang = new phpbb_mock_lang(); - - $request = new phpbb_mock_request(); + $this->request = $this->getMock('\phpbb\request\request'); + $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; + + $this->filesystem = new \phpbb\filesystem\filesystem(); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $guessers = array( + new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), + new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \phpbb\mimetype\content_guesser(), + new \phpbb\mimetype\extension_guesser(), + ); + $guessers[2]->set_priority(-2); + $guessers[3]->set_priority(-2); + $this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers); + + $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx); + $this->container->set('files.filespec', new \phpbb\files\filespec( + $this->filesystem, + $this->language, + $this->php_ini, + new \FastImageSize\FastImageSize(), + $phpbb_root_path, + new \phpbb\mimetype\guesser(array( + 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), + )))); + $this->factory = new \phpbb\files\factory($this->container); + $plupload = new \phpbb\plupload\plupload($phpbb_root_path, $config, $this->request, new \phpbb\user($this->language, '\phpbb\datetime'), $this->php_ini, $this->mimetype_guesser); + $this->container->set('files.types.form', new \phpbb\files\types\form( + $this->factory, + $this->language, + $this->php_ini, + $plupload, + $this->request + ), phpbb_mock_container_builder::SCOPE_PROTOTYPE); + $this->container->set('files.types.local', new \phpbb\files\types\local( + $this->factory, + $this->language, + $this->php_ini, + $this->request + ), phpbb_mock_container_builder::SCOPE_PROTOTYPE); $this->path = __DIR__ . '/fixture/'; + $this->phpbb_root_path = $phpbb_root_path; } private function gen_valid_filespec() @@ -61,15 +119,38 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_invalid_extension() { - $upload = new fileupload('', array('png'), 100); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('png')) + ->set_max_filesize(100); $file = $this->gen_valid_filespec(); $upload->common_checks($file); $this->assertEquals('DISALLOWED_EXTENSION', $file->error[0]); } + public function test_common_checks_disallowed_content() + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('jpg')) + ->set_max_filesize(1000); + $file = new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path); + $file->set_upload_ary(array( + 'size' => 50, + 'tmp_name' => dirname(__FILE__) . '/fixture/disallowed', + 'name' => 'disallowed.jpg', + 'type' => 'image/jpg' + )) + ->set_upload_namespace($upload); + file_put_contents(dirname(__FILE__) . '/fixture/disallowed', '<body>' . file_get_contents(dirname(__FILE__) . '/fixture/jpg')); + $upload->common_checks($file); + $this->assertEquals('DISALLOWED_CONTENT', $file->error[0]); + unlink(dirname(__FILE__) . '/fixture/disallowed'); + } + public function test_common_checks_invalid_filename() { - $upload = new fileupload('', array('jpg'), 100); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('jpg')) + ->set_max_filesize(100); $file = $this->gen_valid_filespec(); $file->realname = 'invalid?'; $upload->common_checks($file); @@ -78,7 +159,9 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_too_large() { - $upload = new fileupload('', array('jpg'), 100); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('jpg')) + ->set_max_filesize(100); $file = $this->gen_valid_filespec(); $file->filesize = 1000; $upload->common_checks($file); @@ -87,7 +170,9 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_common_checks_valid_file() { - $upload = new fileupload('', array('jpg'), 1000); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('jpg')) + ->set_max_filesize(1000); $file = $this->gen_valid_filespec(); $upload->common_checks($file); $this->assertEquals(0, sizeof($file->error)); @@ -95,17 +180,53 @@ class phpbb_fileupload_test extends phpbb_test_case public function test_local_upload() { - $upload = new fileupload('', array('jpg'), 1000); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('jpg')) + ->set_max_filesize(1000); copy($this->path . 'jpg', $this->path . 'jpg.jpg'); - $file = $upload->local_upload($this->path . 'jpg.jpg'); + $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); + $this->assertEquals(0, sizeof($file->error)); + $this->assertFalse($file->additional_checks()); + $this->assertTrue($file->move_file('../tests/upload/fixture/copies', true)); + $file->remove(); + } + + public function test_move_existent_file() + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('jpg')) + ->set_max_filesize(1000); + + copy($this->path . 'jpg', $this->path . 'jpg.jpg'); + $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); + $this->assertEquals(0, sizeof($file->error)); + $this->assertFalse($file->move_file('../tests/upload/fixture')); + $this->assertFalse($file->get('file_moved')); + $this->assertEquals(1, sizeof($file->error)); + } + + public function test_move_existent_file_overwrite() + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(array('jpg')) + ->set_max_filesize(1000); + + copy($this->path . 'jpg', $this->path . 'jpg.jpg'); + copy($this->path . 'jpg', $this->path . 'copies/jpg.jpg'); + $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); + $this->assertEquals(0, sizeof($file->error)); + $file->move_file('../tests/upload/fixture/copies', true); $this->assertEquals(0, sizeof($file->error)); - unlink($this->path . 'jpg.jpg'); + unlink($this->path . 'copies/jpg.jpg'); } public function test_valid_dimensions() { - $upload = new fileupload('', false, false, 1, 1, 100, 100); + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path); + $upload->set_allowed_extensions(false) + ->set_max_filesize(false) + ->set_allowed_dimensions(1, 1, 100, 100); $file1 = $this->gen_valid_filespec(); $file2 = $this->gen_valid_filespec(); diff --git a/tests/upload/fixture/bmp b/tests/upload/fixture/bmp Binary files differnew file mode 100644 index 0000000000..04bff561ab --- /dev/null +++ b/tests/upload/fixture/bmp diff --git a/tests/upload/fixture/iff b/tests/upload/fixture/iff Binary files differnew file mode 100644 index 0000000000..24eda8f593 --- /dev/null +++ b/tests/upload/fixture/iff diff --git a/tests/upload/fixture/iff_maya b/tests/upload/fixture/iff_maya Binary files differnew file mode 100644 index 0000000000..b6fb85101b --- /dev/null +++ b/tests/upload/fixture/iff_maya diff --git a/tests/upload/fixture/jp2 b/tests/upload/fixture/jp2 Binary files differnew file mode 100644 index 0000000000..adca6ecf0e --- /dev/null +++ b/tests/upload/fixture/jp2 diff --git a/tests/upload/fixture/jpx b/tests/upload/fixture/jpx Binary files differnew file mode 100644 index 0000000000..adca6ecf0e --- /dev/null +++ b/tests/upload/fixture/jpx diff --git a/tests/upload/fixture/psd b/tests/upload/fixture/psd Binary files differnew file mode 100644 index 0000000000..d1bc9a6a70 --- /dev/null +++ b/tests/upload/fixture/psd diff --git a/tests/upload/fixture/tif_compressed b/tests/upload/fixture/tif_compressed Binary files differnew file mode 100644 index 0000000000..133b50c4f0 --- /dev/null +++ b/tests/upload/fixture/tif_compressed diff --git a/tests/upload/fixture/tif_msb b/tests/upload/fixture/tif_msb Binary files differnew file mode 100644 index 0000000000..32eb8abfbb --- /dev/null +++ b/tests/upload/fixture/tif_msb diff --git a/tests/upload/fixture/wbmp b/tests/upload/fixture/wbmp Binary files differnew file mode 100644 index 0000000000..708c86ccee --- /dev/null +++ b/tests/upload/fixture/wbmp diff --git a/tests/upload/imagesize_test.php b/tests/upload/imagesize_test.php new file mode 100644 index 0000000000..d20e866dab --- /dev/null +++ b/tests/upload/imagesize_test.php @@ -0,0 +1,99 @@ +<?php + +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once(__DIR__ . '/../../phpBB/includes/functions.php'); + +class phpbb_upload_imagesize_test extends \phpbb_test_case +{ + /** @var \FastImageSize\FastImageSize */ + protected $imagesize; + + /** @var string Path to fixtures */ + protected $path; + + public function setUp() + { + parent::setUp(); + $this->imagesize = new \FastImageSize\FastImageSize(); + $this->path = __DIR__ . '/fixture/'; + } + + public function data_get_imagesize() + { + return array( + array('foobar', 'image/bmp', false), + array('png', 'image/png', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_PNG)), + array('gif', 'image/png', false), + array('png', '', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_PNG)), + array('gif', 'image/gif', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_GIF)), + array('jpg', 'image/gif', false), + array('gif', '', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_GIF)), + array('jpg', 'image/jpg', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_JPEG)), + array('jpg', 'image/jpeg', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_JPEG)), + array('png', 'image/jpg', false), + array('jpg', '', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_JPEG)), + array('psd', 'image/psd', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_PSD)), + array('psd', 'image/photoshop', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_PSD)), + array('jpg', 'image/psd', false), + array('psd', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_PSD)), + array('bmp', 'image/bmp', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_BMP)), + array('png', 'image/bmp', false), + array('bmp', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_BMP)), + array('tif', 'image/tif', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_TIFF_II)), + array('png', 'image/tif', false), + array('tif', '', array('width' => 1, 'height' => 1, 'type' => IMAGETYPE_TIFF_II)), + array('tif_compressed', 'image/tif', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_TIFF_II)), + array('png', 'image/tiff', false), + array('tif_compressed', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_TIFF_II)), + array('tif_msb', 'image/tif', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_TIFF_MM)), + array('tif_msb', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_TIFF_MM)), + array('wbmp', 'image/wbmp', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_WBMP)), + array('wbmp', 'image/vnd.wap.wbmp', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_WBMP)), + array('png', 'image/vnd.wap.wbmp', false), + array('wbmp', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_WBMP)), + array('iff', 'image/iff', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_IFF)), + array('iff', 'image/x-iff', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_IFF)), + array('iff_maya', 'iamge/iff', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_IFF)), + array('png', 'image/iff', false), + array('png', 'image/x-iff', false), + array('iff', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_IFF)), + array('iff_maya', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_IFF)), + array('jp2', 'image/jp2', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_JPEG2000)), + array('jp2', 'image/jpx', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_JPEG2000)), + array('jp2', 'image/jpm', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_JPEG2000)), + array('jpg', 'image/jp2', false), + array('jpx', 'image/jpx', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_JPEG2000)), + array('jp2', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_JPEG2000)), + array('jpx', '', array('width' => 2, 'height' => 1, 'type' => IMAGETYPE_JPEG2000)), + ); + } + + /** + * @dataProvider data_get_imagesize + */ + public function test_get_imagesize($file, $mime_type, $expected) + { + $this->assertEquals($expected, $this->imagesize->getImageSize($this->path . $file, $mime_type)); + } + + public function test_get_imagesize_remote() + { + $this->assertSame(array( + 'width' => 80, + 'height' => 80, + 'type' => IMAGETYPE_JPEG, + ), + $this->imagesize->getImageSize('https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg')); + } +} diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php deleted file mode 100644 index 9cb9e320b3..0000000000 --- a/tests/user/lang_test.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - -class phpbb_user_lang_test extends phpbb_test_case -{ - public function test_user_lang_sprintf() - { - $user = new \phpbb\user; - $user->lang = array( - 'FOO' => 'BAR', - 'BARZ' => 'PENG', - 'EMPTY' => '', - 'ZERO' => '0', - 'STR' => '%d %s, %d topics', - 'STR2' => '%d foos', - 'ARRY' => array( - 0 => 'No posts', // 0 - 1 => '1 post', // 1 - 2 => '%d posts', // 2+ - ), - 'ARRY_NO_ZERO' => array( - 1 => '1 post', // 1 - 2 => '%d posts', // 0, 2+ - ), - 'ARRY_MISSING' => array( - 1 => '%d post', // 1 - //Missing second plural - ), - 'ARRY_FLOAT' => array( - 1 => '1 post', // 1.x - 2 => '%1$.1f posts', // 0.x, 2+.x - ), - 'ARRY_EMPTY' => array( - ), - 'dateformat' => array( - 'AGO' => array( - 1 => '%d second', - 2 => '%d seconds', - ), - ), - ); - - // No param - $this->assertEquals($user->lang('FOO'), 'BAR'); - $this->assertEquals($user->lang('EMPTY'), ''); - $this->assertEquals($user->lang('ZERO'), '0'); - - // Invalid index - $this->assertEquals($user->lang('VOID'), 'VOID'); - - // Unnecessary param - $this->assertEquals($user->lang('FOO', 2), 'BAR'); - $this->assertEquals($user->lang('FOO', 2, 3), 'BAR'); - $this->assertEquals($user->lang('FOO', 2, 3, 'BARZ'), 'BAR'); - - // String - $this->assertEquals($user->lang('STR', 24, 'x', 42), '24 x, 42 topics'); - $this->assertEquals($user->lang('STR2', 64), '64 foos'); - - // Array - $this->assertEquals($user->lang('ARRY', 0), 'No posts'); - $this->assertEquals($user->lang('ARRY', 1), '1 post'); - $this->assertEquals($user->lang('ARRY', 2), '2 posts'); - $this->assertEquals($user->lang('ARRY', 123), '123 posts'); - - // Empty array returns the language key - $this->assertEquals($user->lang('ARRY_EMPTY', 123), 'ARRY_EMPTY'); - - // No 0 key defined - $this->assertEquals($user->lang('ARRY_NO_ZERO', 0), '0 posts'); - $this->assertEquals($user->lang('ARRY_NO_ZERO', 1), '1 post'); - $this->assertEquals($user->lang('ARRY_NO_ZERO', 2), '2 posts'); - - // Array with missing keys - $this->assertEquals($user->lang('ARRY_MISSING', 2), '2 post'); - - // Floats as array key - $this->assertEquals($user->lang('ARRY_FLOAT', 1.3), '1 post'); - $this->assertEquals($user->lang('ARRY_FLOAT', 2.0), '2.0 posts'); - $this->assertEquals($user->lang('ARRY_FLOAT', 2.51), '2.5 posts'); - - // Use sub key, if first paramenter is an array - $this->assertEquals($user->lang(array('dateformat', 'AGO'), 2), '2 seconds'); - - // ticket PHPBB3-9949 - use first int to determinate the plural-form to use - $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); - $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); - - // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ - $user = new \phpbb\user; - $user->lang = array( - 'PLURAL_RULE' => 13, - 'ARRY' => array( - 0 => '%d is 0', // 0 - 1 => '%d is 1', // 1 - 2 => '%d ends with 01-10', // ending with 01-10 - 3 => '%d ends with 11-19', // ending with 11-19 - 4 => '%d is part of the last rule', // everything else - ), - ); - $this->assertEquals($user->lang('ARRY', 0), '0 is 0'); - $this->assertEquals($user->lang('ARRY', 1), '1 is 1'); - $this->assertEquals($user->lang('ARRY', 103), '103 ends with 01-10'); - $this->assertEquals($user->lang('ARRY', 15), '15 ends with 11-19'); - $this->assertEquals($user->lang('ARRY', 300), '300 is part of the last rule'); - } -} diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index 13c35030f9..8d1f43707b 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php deleted file mode 100644 index 92230cfcc9..0000000000 --- a/tests/utf/normalizer_test.php +++ /dev/null @@ -1,323 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_normalizer.php'; - -/** -* @group slow -*/ -class phpbb_utf_normalizer_test extends phpbb_test_case -{ - static private $data_dir; - - static public function setUpBeforeClass() - { - self::$data_dir = dirname(__file__) . '/../tmp'; - self::download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt', self::$data_dir); - self::download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt', self::$data_dir); - } - - public function test_normalizer() - { - $test_suite = array( - /** - * NFC - * c2 == NFC(c1) == NFC(c2) == NFC(c3) - * c4 == NFC(c4) == NFC(c5) - */ - 'NFC' => array( - 'c2' => array('c1', 'c2', 'c3'), - 'c4' => array('c4', 'c5') - ), - - /** - * NFD - * c3 == NFD(c1) == NFD(c2) == NFD(c3) - * c5 == NFD(c4) == NFD(c5) - */ - 'NFD' => array( - 'c3' => array('c1', 'c2', 'c3'), - 'c5' => array('c4', 'c5') - ), - - /** - * NFKC - * c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5) - */ - 'NFKC' => array( - 'c4' => array('c1', 'c2', 'c3', 'c4', 'c5') - ), - - /** - * NFKD - * c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5) - */ - 'NFKD' => array( - 'c5' => array('c1', 'c2', 'c3', 'c4', 'c5') - ) - ); - - $tested_chars = array(); - - $fp = fopen(self::$data_dir . '/NormalizationTest.txt', 'rb'); - while (!feof($fp)) - { - $line = fgets($fp); - - if ($line[0] == '@') - { - continue; - } - - if (!strpos(' 0123456789ABCDEF', $line[0])) - { - continue; - } - - list($c1, $c2, $c3, $c4, $c5) = explode(';', $line); - - if (!strpos($c1, ' ')) - { - /** - * We are currently testing a single character, we add it to the list of - * characters we have processed so that we can exclude it when testing - * for invariants - */ - $tested_chars[$c1] = 1; - } - - foreach ($test_suite as $form => $serie) - { - foreach ($serie as $expected => $tests) - { - $hex_expected = ${$expected}; - $utf_expected = $this->hexseq_to_utf($hex_expected); - - foreach ($tests as $test) - { - $utf_result = $utf_expected; - call_user_func_array(array('utf_normalizer', $form), array(&$utf_result)); - - $hex_result = $this->utf_to_hexseq($utf_result); - $this->assertEquals($utf_expected, $utf_result, "$expected == $form($test) ($hex_expected != $hex_result)"); - } - } - } - } - fclose($fp); - - return $tested_chars; - } - - /** - * @depends test_normalizer - */ - public function test_invariants(array $tested_chars) - { - $fp = fopen(self::$data_dir . '/UnicodeData.txt', 'rb'); - - while (!feof($fp)) - { - $line = fgets($fp, 1024); - - if (!$pos = strpos($line, ';')) - { - continue; - } - - $hex_tested = $hex_expected = substr($line, 0, $pos); - - if (isset($tested_chars[$hex_tested])) - { - continue; - } - - $utf_expected = $this->hex_to_utf($hex_expected); - - if ($utf_expected >= UTF8_SURROGATE_FIRST - && $utf_expected <= UTF8_SURROGATE_LAST) - { - /** - * Surrogates are illegal on their own, we expect the normalizer - * to return a replacement char - */ - $utf_expected = UTF8_REPLACEMENT; - $hex_expected = $this->utf_to_hexseq($utf_expected); - } - - foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form) - { - $utf_result = $utf_expected; - call_user_func_array(array('utf_normalizer', $form), array(&$utf_result)); - $hex_result = $this->utf_to_hexseq($utf_result); - - $this->assertEquals($utf_expected, $utf_result, "$hex_expected == $form($hex_tested) ($hex_expected != $hex_result)"); - } - } - fclose($fp); - } - - /** - * Convert a UTF string to a sequence of codepoints in hexadecimal - * - * @param string $utf UTF string - * @return integer Unicode codepoints in hex - */ - protected function utf_to_hexseq($str) - { - $pos = 0; - $len = strlen($str); - $ret = array(); - - while ($pos < $len) - { - $c = $str[$pos]; - switch ($c & "\xF0") - { - case "\xC0": - case "\xD0": - $utf_char = substr($str, $pos, 2); - $pos += 2; - break; - - case "\xE0": - $utf_char = substr($str, $pos, 3); - $pos += 3; - break; - - case "\xF0": - $utf_char = substr($str, $pos, 4); - $pos += 4; - break; - - default: - $utf_char = $c; - ++$pos; - } - - $hex = dechex($this->utf_to_cp($utf_char)); - - if (!isset($hex[3])) - { - $hex = substr('000' . $hex, -4); - } - - $ret[] = $hex; - } - - return strtr(implode(' ', $ret), 'abcdef', 'ABCDEF'); - } - - /** - * Convert a UTF-8 char to its codepoint - * - * @param string $utf_char UTF-8 char - * @return integer Unicode codepoint - */ - protected function utf_to_cp($utf_char) - { - switch (strlen($utf_char)) - { - case 1: - return ord($utf_char); - - case 2: - return ((ord($utf_char[0]) & 0x1F) << 6) | (ord($utf_char[1]) & 0x3F); - - case 3: - return ((ord($utf_char[0]) & 0x0F) << 12) | ((ord($utf_char[1]) & 0x3F) << 6) | (ord($utf_char[2]) & 0x3F); - - case 4: - return ((ord($utf_char[0]) & 0x07) << 18) | ((ord($utf_char[1]) & 0x3F) << 12) | ((ord($utf_char[2]) & 0x3F) << 6) | (ord($utf_char[3]) & 0x3F); - - default: - throw new RuntimeException('UTF-8 chars can only be 1-4 bytes long'); - } - } - - /** - * Return a UTF string formed from a sequence of codepoints in hexadecimal - * - * @param string $seq Sequence of codepoints, separated with a space - * @return string UTF-8 string - */ - protected function hexseq_to_utf($seq) - { - return implode('', array_map(array($this, 'hex_to_utf'), explode(' ', $seq))); - } - - /** - * Convert a codepoint in hexadecimal to a UTF-8 char - * - * @param string $hex Codepoint, in hexadecimal - * @return string UTF-8 char - */ - protected function hex_to_utf($hex) - { - return $this->cp_to_utf(hexdec($hex)); - } - - /** - * Convert a codepoint to a UTF-8 char - * - * @param integer $cp Unicode codepoint - * @return string UTF-8 string - */ - protected function cp_to_utf($cp) - { - if ($cp > 0xFFFF) - { - return chr(0xF0 | ($cp >> 18)) . chr(0x80 | (($cp >> 12) & 0x3F)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); - } - else if ($cp > 0x7FF) - { - return chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); - } - else if ($cp > 0x7F) - { - return chr(0xC0 | ($cp >> 6)) . chr(0x80 | ($cp & 0x3F)); - } - else - { - return chr($cp); - } - } - - // chunked download helper - static protected function download($url, $to) - { - $target = $to . '/' . basename($url); - - if (file_exists($target)) - { - return; - } - - if (!$fpr = fopen($url, 'rb')) - { - echo "Failed to download $url\n"; - return; - } - - if (!$fpw = fopen($target, 'wb')) - { - echo "Failed to open $target for writing\n"; - return; - } - - $chunk = 32768; - - while (!feof($fpr)) - { - fwrite($fpw, fread($fpr, $chunk)); - } - fclose($fpr); - fclose($fpw); - } -} diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php index ae11e00fbd..2bb65387e0 100644 --- a/tests/utf/utf8_clean_string_test.php +++ b/tests/utf/utf8_clean_string_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/utf/utf8_wordwrap_test.php b/tests/utf/utf8_wordwrap_test.php index 39fdf73308..ab053e2911 100644 --- a/tests/utf/utf8_wordwrap_test.php +++ b/tests/utf/utf8_wordwrap_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/version/version_fetch_test.php b/tests/version/version_fetch_test.php new file mode 100644 index 0000000000..6ecc9b7223 --- /dev/null +++ b/tests/version/version_fetch_test.php @@ -0,0 +1,65 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/* +* @group slow +*/ +class phpbb_version_helper_fetch_test extends phpbb_test_case +{ + public function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + include_once($phpbb_root_path . 'includes/functions.' . $phpEx); + + $this->cache = $this->getMockBuilder('\phpbb\cache\service') + ->disableOriginalConstructor() + ->getMock(); + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + + $this->version_helper = new \phpbb\version_helper( + $this->cache, + new \phpbb\config\config(array( + 'version' => '3.1.0', + )), + new \phpbb\file_downloader(), + new \phpbb\user(new \phpbb\language\language($lang_loader), '\phpbb\datetime') + ); + } + + public function test_version_phpbb_com() + { + global $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/functions.' . $phpEx); + + if (!phpbb_checkdnsrr('version.phpbb.com', 'A')) + { + $this->markTestSkipped(sprintf( + 'Could not find a DNS record for hostname %s. ' . + 'Assuming network is down.', + 'version.phpbb.com' + )); + } + + $this->version_helper->get_versions(); + + // get_versions checks to make sure we got a valid versions file or + // throws an exception if we did not. We don't need to test anything + // here, but adding an assertion so we do not get a warning about no + // assertions in this test + $this->assertSame(true, true); + } +} diff --git a/tests/version/version_helper_remote_test.php b/tests/version/version_helper_remote_test.php new file mode 100644 index 0000000000..724c4c970c --- /dev/null +++ b/tests/version/version_helper_remote_test.php @@ -0,0 +1,175 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class version_helper_remote_test extends \phpbb_test_case +{ + protected $file_downloader; + protected $cache; + protected $version_helper; + + public function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + include_once($phpbb_root_path . 'includes/functions.' . $phpEx); + + $config = new \phpbb\config\config(array( + 'version' => '3.1.0', + )); + $container = new \phpbb_mock_container_builder(); + $db = new \phpbb\db\driver\factory($container); + $this->cache = $this->getMock('\phpbb\cache\service', array('get'), array(new \phpbb\cache\driver\dummy(), $config, $db, '../../', 'php')); + $this->cache->expects($this->any()) + ->method('get') + ->with($this->anything()) + ->will($this->returnValue(false)); + $this->file_downloader = new phpbb_mock_file_downloader(); + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + + $this->version_helper = new \phpbb\version_helper( + $this->cache, + $config, + $this->file_downloader, + new \phpbb\user(new \phpbb\language\language($lang_loader), '\phpbb\datetime') + ); + $this->user = new \phpbb\user(new \phpbb\language\language($lang_loader), '\phpbb\datetime'); + $this->user->add_lang('acp/common'); + } + + public function provider_get_versions() + { + return array( + array('', false), + array('foobar', false), + array('{ + "stable": { + "1.0": { + "current": "1.0.1", + "download": "https://www.phpbb.com/customise/db/download/104136", + "announcement": "https://www.phpbb.com/customise/db/extension/boardrules/", + "eol": null, + "security": false + } + } +}', true, array ( + 'stable' => array ( + '1.0' => array ( + 'current' => '1.0.1', + 'download' => 'https://www.phpbb.com/customise/db/download/104136', + 'announcement' => 'https://www.phpbb.com/customise/db/extension/boardrules/', + 'eol' => NULL, + 'security' => false, + ), + ), + 'unstable' => array ( + '1.0' => array ( + 'current' => '1.0.1', + 'download' => 'https://www.phpbb.com/customise/db/download/104136', + 'announcement' => 'https://www.phpbb.com/customise/db/extension/boardrules/', + 'eol' => NULL, + 'security' => false, + ), + ), + )), + array('{ + "foobar": { + "1.0": { + "current": "1.0.1", + "download": "https://www.phpbb.com/customise/db/download/104136", + "announcement": "https://www.phpbb.com/customise/db/extension/boardrules/", + "eol": null, + "security": false + } + } +}', false), + array('{ + "stable": { + "1.0": { + "current": "1.0.1<script>alert(\'foo\');</script>", + "download": "https://www.phpbb.com/customise/db/download/104136<script>alert(\'foo\');</script>", + "announcement": "https://www.phpbb.com/customise/db/extension/boardrules/<script>alert(\'foo\');</script>", + "eol": "<script>alert(\'foo\');</script>", + "security": "<script>alert(\'foo\');</script>" + } + } +}', true, array ( + 'stable' => array ( + '1.0' => array ( + 'current' => '1.0.1<script>alert(\'foo\');</script>', + 'download' => 'https://www.phpbb.com/customise/db/download/104136<script>alert(\'foo\');</script>', + 'announcement' => 'https://www.phpbb.com/customise/db/extension/boardrules/<script>alert(\'foo\');</script>', + 'eol' => '<script>alert(\'foo\');</script>', + 'security' => '<script>alert(\'foo\');</script>', + ), + ), + 'unstable' => array ( + '1.0' => array ( + 'current' => '1.0.1<script>alert(\'foo\');</script>', + 'download' => 'https://www.phpbb.com/customise/db/download/104136<script>alert(\'foo\');</script>', + 'announcement' => 'https://www.phpbb.com/customise/db/extension/boardrules/<script>alert(\'foo\');</script>', + 'eol' => '<script>alert(\'foo\');</script>', + 'security' => '<script>alert(\'foo\');</script>', + ), + ), + )), + array('{ + "unstable": { + "1.0": { + "current": "1.0.1<script>alert(\'foo\');</script>", + "download": "https://www.phpbb.com/customise/db/download/104136<script>alert(\'foo\');</script>", + "announcement": "https://www.phpbb.com/customise/db/extension/boardrules/<script>alert(\'foo\');</script>", + "eol": "<script>alert(\'foo\');</script>", + "security": "<script>alert(\'foo\');</script>" + } + } +}', true, array ( + 'unstable' => array ( + '1.0' => array ( + 'current' => '1.0.1<script>alert(\'foo\');</script>', + 'download' => 'https://www.phpbb.com/customise/db/download/104136<script>alert(\'foo\');</script>', + 'announcement' => 'https://www.phpbb.com/customise/db/extension/boardrules/<script>alert(\'foo\');</script>', + 'eol' => '<script>alert(\'foo\');</script>', + 'security' => '<script>alert(\'foo\');</script>', + ), + ), + 'stable' => array(), + )), + ); + } + + /** + * @dataProvider provider_get_versions + */ + public function test_get_versions($input, $valid_data, $expected_return = '') + { + $this->file_downloader->set($input); + + if (!$valid_data) + { + try { + $return = $this->version_helper->get_versions(); + } catch (\RuntimeException $e) { + $this->assertEquals((string)$e->getMessage(), $this->user->lang('VERSIONCHECK_FAIL')); + } + } + else + { + $return = $this->version_helper->get_versions(); + } + + $this->assertEquals($expected_return, $return); + } +} diff --git a/tests/version/version_test.php b/tests/version/version_test.php new file mode 100644 index 0000000000..05577f6a18 --- /dev/null +++ b/tests/version/version_test.php @@ -0,0 +1,347 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_version_helper_test extends phpbb_test_case +{ + public function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + include_once($phpbb_root_path . 'includes/functions.' . $phpEx); + + $this->cache = $this->getMockBuilder('\phpbb\cache\service') + ->disableOriginalConstructor() + ->getMock(); + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + + $this->version_helper = new \phpbb\version_helper( + $this->cache, + new \phpbb\config\config(array( + 'version' => '3.1.0', + )), + new \phpbb\file_downloader(), + new \phpbb\user(new \phpbb\language\language($lang_loader), '\phpbb\datetime') + ); + } + + public function is_stable_data() + { + return array( + array( + '3.0.0-a1', + false, + ), + array( + '3.0.0-b1', + false, + ), + array( + '3.0.0-rc1', + false, + ), + array( + '3.0.0-RC1', + false, + ), + array( + '3.0.0', + true, + ), + array( + '3.0.0-pl1', + true, + ), + array( + '3.0.0.1-pl1', + true, + ), + array( + '3.1-dev', + false, + ), + array( + 'foobar', + false, + ), + ); + } + + /** + * @dataProvider is_stable_data + */ + public function test_is_stable($version, $expected) + { + $this->assertSame($expected, $this->version_helper->is_stable($version)); + } + + public function get_suggested_updates_data() + { + return array( + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + ), + array( + '1.0.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + '1.1' => array( + 'current' => '1.1.1', + ), + ), + ), + array( + '1.0.1-a1', + array( + '1.0' => array( + 'current' => '1.0.1-a2', + ), + '1.1' => array( + 'current' => '1.1.0', + ), + ), + array( + '1.0' => array( + 'current' => '1.0.1-a2', + ), + '1.1' => array( + 'current' => '1.1.0', + ), + ), + ), + array( + '1.1.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + '1.1' => array( + 'current' => '1.1.1', + ), + ), + ), + array( + '1.1.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '1.1.0-a1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.0-a2', + ), + ), + array( + '1.1' => array( + 'current' => '1.1.0-a2', + ), + ), + ), + array( + '1.1.0', + array(), + array(), + ), + ); + } + + /** + * @dataProvider get_suggested_updates_data + */ + public function test_get_suggested_updates($current_version, $versions, $expected) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + + $version_helper = $this + ->getMockBuilder('\phpbb\version_helper') + ->setMethods(array( + 'get_versions_matching_stability', + )) + ->setConstructorArgs(array( + $this->cache, + new \phpbb\config\config(array( + 'version' => $current_version, + )), + new \phpbb\file_downloader(), + new \phpbb\user($lang, '\phpbb\datetime'), + )) + ->getMock() + ; + + $version_helper->expects($this->any()) + ->method('get_versions_matching_stability') + ->will($this->returnValue($versions)); + + $this->assertSame($expected, $version_helper->get_suggested_updates()); + } + + public function get_latest_on_current_branch_data() + { + return array( + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + '1.0.1', + ), + array( + '1.0.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + '1.0.1', + ), + array( + '1.0.1-a1', + array( + '1.0' => array( + 'current' => '1.0.1-a2', + ), + '1.1' => array( + 'current' => '1.1.0', + ), + ), + '1.0.1-a2', + ), + array( + '1.1.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + '1.1.1', + ), + array( + '1.1.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + '1.1.1', + ), + array( + '1.1.0-a1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.0-a2', + ), + ), + '1.1.0-a2', + ), + array( + '1.1.0', + array(), + null, + ), + ); + } + + /** + * @dataProvider get_latest_on_current_branch_data + */ + public function test_get_latest_on_current_branch($current_version, $versions, $expected) + { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + + $version_helper = $this + ->getMockBuilder('\phpbb\version_helper') + ->setMethods(array( + 'get_versions_matching_stability', + )) + ->setConstructorArgs(array( + $this->cache, + new \phpbb\config\config(array( + 'version' => $current_version, + )), + new \phpbb\file_downloader(), + new \phpbb\user($lang, '\phpbb\datetime'), + )) + ->getMock() + ; + + $version_helper->expects($this->any()) + ->method('get_versions_matching_stability') + ->will($this->returnValue($versions)); + + $this->assertSame($expected, $version_helper->get_latest_on_current_branch()); + } +} diff --git a/tests/viewonline/helper_test.php b/tests/viewonline/helper_test.php new file mode 100644 index 0000000000..6540d33287 --- /dev/null +++ b/tests/viewonline/helper_test.php @@ -0,0 +1,46 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_viewonline_helper_test extends phpbb_test_case +{ + public function setUp() + { + parent::setUp(); + + $this->viewonline_helper = new \phpbb\viewonline_helper(new \phpbb\filesystem\filesystem()); + } + + public function session_pages_data() + { + return array( + array('index.php', 'index'), + array('foobar/test.php', 'foobar/test'), + array('', ''), + array('./../../index.php', '../../index'), + array('../subdir/index.php', '../subdir/index'), + array('../index.php', '../index'), + array('././index.php', 'index'), + array('./index.php', 'index'), + ); + } + + /** + * @dataProvider session_pages_data + */ + public function test_get_user_page($session_page, $expected) + { + $on_page = $this->viewonline_helper->get_user_page($session_page); + $this->assertArrayHasKey(1, $on_page); + $this->assertSame($expected, $on_page[1]); + } +} diff --git a/tests/wrapper/gmgetdate_test.php b/tests/wrapper/gmgetdate_test.php index a838cfdba9..2e55a78d21 100644 --- a/tests/wrapper/gmgetdate_test.php +++ b/tests/wrapper/gmgetdate_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -11,26 +15,28 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_wrapper_gmgetdate_test extends phpbb_test_case { - public function test_gmgetdate() + public static function phpbb_gmgetdate_data() { - $this->run_gmgetdate_assertion(); - $this->run_test_with_timezone('UTC'); - $this->run_test_with_timezone('Europe/Berlin'); - $this->run_test_with_timezone('America/Los_Angeles'); - $this->run_test_with_timezone('Antarctica/South_Pole'); + return array( + array(''), + array('UTC'), + array('Europe/Berlin'), + array('America/Los_Angeles'), + array('Antarctica/South_Pole'), + ); } - protected function run_test_with_timezone($timezone_identifier) + /** + * @dataProvider phpbb_gmgetdate_data + */ + public function test_phpbb_gmgetdate($timezone_identifier) { - $current_timezone = date_default_timezone_get(); - - date_default_timezone_set($timezone_identifier); - $this->run_gmgetdate_assertion(); - date_default_timezone_set($current_timezone); - } + if ($timezone_identifier) + { + $current_timezone = date_default_timezone_get(); + date_default_timezone_set($timezone_identifier); + } - protected function run_gmgetdate_assertion() - { $expected = time(); $date_array = phpbb_gmgetdate($expected); @@ -44,6 +50,22 @@ class phpbb_wrapper_gmgetdate_test extends phpbb_test_case $date_array['year'] ); - $this->assertEquals($expected, $actual); + // Calling second-granularity time functions twice isn't guaranteed to + // give the same results. As long as they're in the right order, allow + // a 1 second difference. + $this->assertGreaterThanOrEqual( + $expected, $actual, + 'Expected second time to be after (or equal to) the previous one' + ); + $this->assertLessThanOrEqual( + 1, + abs($actual - $expected), + "Expected $actual to be within 1 second of $expected." + ); + + if (isset($current_timezone)) + { + date_default_timezone_set($current_timezone); + } } } diff --git a/tests/wrapper/mt_rand_test.php b/tests/wrapper/mt_rand_test.php index eba0bf2faa..d190182286 100644 --- a/tests/wrapper/mt_rand_test.php +++ b/tests/wrapper/mt_rand_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/wrapper/phpbb_php_ini_fake.php b/tests/wrapper/phpbb_php_ini_fake.php index d9e96447e3..300ce30cfe 100644 --- a/tests/wrapper/phpbb_php_ini_fake.php +++ b/tests/wrapper/phpbb_php_ini_fake.php @@ -1,13 +1,17 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -class phpbb_php_ini_fake extends \phpbb\php\ini +class phpbb_php_ini_fake extends \bantu\IniGetWrapper\IniGetWrapper { function get($varname) { diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index 8e08d5c204..9f46a78d5b 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -12,6 +16,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case { + /** @var \phpbb_php_ini_fake php_ini */ protected $php_ini; public function setUp() @@ -21,44 +26,44 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case public function test_get_string() { - $this->assertSame(false, $this->php_ini->get_string(false)); - $this->assertSame('phpbb', $this->php_ini->get_string(' phpbb ')); + $this->assertSame('', $this->php_ini->getString(false)); + $this->assertSame('phpbb', $this->php_ini->getString(' phpbb ')); } public function test_get_bool() { - $this->assertSame(true, $this->php_ini->get_bool('ON')); - $this->assertSame(true, $this->php_ini->get_bool('on')); - $this->assertSame(true, $this->php_ini->get_bool('1')); + $this->assertSame(true, $this->php_ini->getBool('ON')); + $this->assertSame(true, $this->php_ini->getBool('on')); + $this->assertSame(true, $this->php_ini->getBool('1')); - $this->assertSame(false, $this->php_ini->get_bool('OFF')); - $this->assertSame(false, $this->php_ini->get_bool('off')); - $this->assertSame(false, $this->php_ini->get_bool('0')); - $this->assertSame(false, $this->php_ini->get_bool('')); + $this->assertSame(false, $this->php_ini->getBool('OFF')); + $this->assertSame(false, $this->php_ini->getBool('off')); + $this->assertSame(false, $this->php_ini->getBool('0')); + $this->assertSame(false, $this->php_ini->getBool('')); } public function test_get_int() { - $this->assertSame(1234, $this->php_ini->get_int('1234')); - $this->assertSame(-12345, $this->php_ini->get_int('-12345')); - $this->assertSame(false, $this->php_ini->get_int('phpBB')); + $this->assertSame(1234, $this->php_ini->getNumeric('1234')); + $this->assertSame(-12345, $this->php_ini->getNumeric('-12345')); + $this->assertSame(null, $this->php_ini->getNumeric('phpBB')); } public function test_get_float() { - $this->assertSame(1234.0, $this->php_ini->get_float('1234')); - $this->assertSame(-12345.0, $this->php_ini->get_float('-12345')); - $this->assertSame(false, $this->php_ini->get_float('phpBB')); + $this->assertSame(1234.0, $this->php_ini->getNumeric('1234.0')); + $this->assertSame(-12345.0, $this->php_ini->getNumeric('-12345.0')); + $this->assertSame(null, $this->php_ini->getNumeric('phpBB')); } public function test_get_bytes_invalid() { - $this->assertSame(false, $this->php_ini->get_bytes(false)); - $this->assertSame(false, $this->php_ini->get_bytes('phpBB')); - $this->assertSame(false, $this->php_ini->get_bytes('k')); - $this->assertSame(false, $this->php_ini->get_bytes('-k')); - $this->assertSame(false, $this->php_ini->get_bytes('M')); - $this->assertSame(false, $this->php_ini->get_bytes('-M')); + $this->assertSame(null, $this->php_ini->getBytes(false)); + $this->assertSame(null, $this->php_ini->getBytes('phpBB')); + $this->assertSame(null, $this->php_ini->getBytes('k')); + $this->assertSame(null, $this->php_ini->getBytes('-k')); + $this->assertSame(null, $this->php_ini->getBytes('M')); + $this->assertSame(null, $this->php_ini->getBytes('-M')); } /** @@ -66,7 +71,7 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case */ public function test_get_bytes($expected, $value) { - $actual = $this->php_ini->get_bytes($value); + $actual = $this->php_ini->getBytes($value); $this->assertTrue(is_float($actual) || is_int($actual)); $this->assertEquals($expected, $actual); diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php index 8b42eb4bee..93d9e0117d 100644 --- a/tests/wrapper/version_compare_test.php +++ b/tests/wrapper/version_compare_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/travis/check-executable-files.sh b/travis/check-executable-files.sh new file mode 100755 index 0000000000..1aa8dca073 --- /dev/null +++ b/travis/check-executable-files.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +DB=$1 +TRAVIS_PHP_VERSION=$2 +NOTESTS=$3 +root="$4" +path="${root}phpBB/" + +if [ "$NOTESTS" == '1' ] +then + # Check the permissions of the files + + # The following variables MUST NOT contain any wildcard + # Directories to skip + directories_skipped="-path ${path}develop -o -path ${path}vendor" + + # Files to skip + files_skipped="-false" + + # Files which have to be executable + executable_files="-path ${path}bin/* -o -path ${path}install/phpbbcli.php" + + incorrect_files=$( \ + find ${path} \ + '(' \ + '(' \ + ${directories_skipped} \ + ')' \ + -a -type d -prune -a -type f \ + ')' -o \ + '(' \ + -type f -a \ + -not '(' \ + ${files_skipped} \ + ')' -a \ + '(' \ + '(' \ + '(' \ + ${executable_files} \ + ')' -a \ + -not -perm +100 \ + ')' -o \ + '(' \ + -not '(' \ + ${executable_files} \ + ')' -a \ + -perm +111 \ + ')' \ + ')' \ + ')' \ + ) + + if [ "${incorrect_files}" != '' ] + then + echo "The following files do not have proper permissions:"; + ls -la ${incorrect_files} + exit 1; + fi +fi diff --git a/travis/check-image-icc-profiles.sh b/travis/check-image-icc-profiles.sh new file mode 100755 index 0000000000..05c7de2d27 --- /dev/null +++ b/travis/check-image-icc-profiles.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +DB=$1 +TRAVIS_PHP_VERSION=$2 +NOTESTS=$3 + +if [ "$NOTESTS" == '1' ] +then + find . -type f -a -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' -a -not -wholename '*vendor/*' | \ + parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}' +fi diff --git a/travis/check-sami-parse-errors.sh b/travis/check-sami-parse-errors.sh new file mode 100755 index 0000000000..4cc2cee525 --- /dev/null +++ b/travis/check-sami-parse-errors.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +DB=$1 +TRAVIS_PHP_VERSION=$2 +NOTESTS=$3 + +if [ "$NOTESTS" == '1' ] +then + # Workarounds for + # https://github.com/fabpot/Sami/issues/116 + # and + # https://github.com/fabpot/Sami/issues/117 + errors=$( + unbuffer phpBB/vendor/bin/sami.php parse build/sami-checkout.conf.php -v | \ + sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | \ + grep "ERROR: " | \ + tee /dev/tty | \ + wc -l + ) + if [ "$errors" != "0" ] + then + exit 1 + fi +fi diff --git a/travis/ext-sniff.sh b/travis/ext-sniff.sh new file mode 100755 index 0000000000..61ceda6834 --- /dev/null +++ b/travis/ext-sniff.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e +set -x + +DB=$1 +TRAVIS_PHP_VERSION=$2 +EXTNAME=$3 + +if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ] +then + phpBB/vendor/bin/phpcs \ + -s \ + --extensions=php \ + --standard=build/code_sniffer/ruleset-php-extensions.xml \ + "--ignore=phpBB/ext/$EXTNAME/tests/*" \ + "--ignore=phpBB/ext/$EXTNAME/vendor/*" \ + "phpBB/ext/$EXTNAME" +fi diff --git a/travis/install-phpbb-test-dependencies.sh b/travis/install-phpbb-test-dependencies.sh new file mode 100755 index 0000000000..25743ff2b1 --- /dev/null +++ b/travis/install-phpbb-test-dependencies.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e +set -x + +cd tests +php ../composer.phar install --dev --no-interaction --prefer-source +cd .. diff --git a/travis/phing-sniff.sh b/travis/phing-sniff.sh new file mode 100755 index 0000000000..3f43b64130 --- /dev/null +++ b/travis/phing-sniff.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e +set -x + +DB=$1 +TRAVIS_PHP_VERSION=$2 +NOTESTS=$3 + +if [ "$NOTESTS" == '1' ] +then + cd build + ../phpBB/vendor/bin/phing sniff + cd .. +fi diff --git a/travis/phpunit-mariadb-travis.xml b/travis/phpunit-mariadb-travis.xml index 1eaee5b7d8..53a206b9b0 100644 --- a/travis/phpunit-mariadb-travis.xml +++ b/travis/phpunit-mariadb-travis.xml @@ -13,13 +13,17 @@ bootstrap="../tests/bootstrap.php"> <testsuites> <testsuite name="phpBB Test Suite"> - <directory suffix="_test.php">../tests/</directory> - <exclude>tests/functional</exclude> - <exclude>tests/lint_test.php</exclude> + <directory suffix="_test.php">../tests</directory> + <exclude>../tests/functional</exclude> + <exclude>../tests/lint_test.php</exclude> + <exclude>../tests/ui</exclude> </testsuite> <testsuite name="phpBB Functional Tests"> <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> </testsuite> + <testsuite name="phpBB UI Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/ui</directory> + </testsuite> </testsuites> <groups> diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml index 5fa6c06e46..d0d3e3c0c0 100644 --- a/travis/phpunit-mysql-travis.xml +++ b/travis/phpunit-mysql-travis.xml @@ -13,16 +13,17 @@ bootstrap="../tests/bootstrap.php"> <testsuites> <testsuite name="phpBB Test Suite"> - <directory suffix="_test.php">../tests/</directory> - <exclude>tests/functional</exclude> - <exclude>tests/lint_test.php</exclude> - </testsuite> - <testsuite name="phpBB Lint Test"> - <file>tests/lint_test.php</file> + <directory suffix="_test.php">../tests</directory> + <exclude>../tests/functional</exclude> + <exclude>../tests/lint_test.php</exclude> + <exclude>../tests/ui</exclude> </testsuite> <testsuite name="phpBB Functional Tests"> <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> </testsuite> + <testsuite name="phpBB UI Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/ui</directory> + </testsuite> </testsuites> <groups> @@ -32,7 +33,7 @@ </groups> <php> - <server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli" /> + <server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysql" /> <server name="PHPBB_TEST_DBHOST" value="0.0.0.0" /> <server name="PHPBB_TEST_DBPORT" value="3306" /> <server name="PHPBB_TEST_DBNAME" value="phpbb_tests" /> diff --git a/travis/phpunit-mysqli-travis.xml b/travis/phpunit-mysqli-travis.xml new file mode 100644 index 0000000000..b12ae6fe8b --- /dev/null +++ b/travis/phpunit-mysqli-travis.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit backupGlobals="true" + backupStaticAttributes="true" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false" + syntaxCheck="true" + strict="true" + verbose="true" + bootstrap="../tests/bootstrap.php"> + <testsuites> + <testsuite name="phpBB Test Suite"> + <directory suffix="_test.php">../tests</directory> + <exclude>../tests/functional</exclude> + <exclude>../tests/lint_test.php</exclude> + <exclude>../tests/ui</exclude> + </testsuite> + <testsuite name="phpBB Functional Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> + </testsuite> + <testsuite name="phpBB UI Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/ui</directory> + </testsuite> + </testsuites> + + <groups> + <exclude> + <group>slow</group> + </exclude> + </groups> + + <php> + <server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli" /> + <server name="PHPBB_TEST_DBHOST" value="0.0.0.0" /> + <server name="PHPBB_TEST_DBPORT" value="3306" /> + <server name="PHPBB_TEST_DBNAME" value="phpbb_tests" /> + <server name="PHPBB_TEST_DBUSER" value="root" /> + <server name="PHPBB_TEST_DBPASSWD" value="" /> + <server name="PHPBB_TEST_REDIS_HOST" value="localhost" /> + <server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/> + <server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" /> + </php> +</phpunit> diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index 88d9e0f46a..fa497a1264 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -13,13 +13,17 @@ bootstrap="../tests/bootstrap.php"> <testsuites> <testsuite name="phpBB Test Suite"> - <directory suffix="_test.php">../tests/</directory> - <exclude>tests/functional</exclude> - <exclude>tests/lint_test.php</exclude> + <directory suffix="_test.php">../tests</directory> + <exclude>../tests/functional</exclude> + <exclude>../tests/lint_test.php</exclude> + <exclude>../tests/ui</exclude> </testsuite> <testsuite name="phpBB Functional Tests"> <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> </testsuite> + <testsuite name="phpBB UI Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/ui</directory> + </testsuite> </testsuites> <groups> @@ -29,8 +33,6 @@ </groups> <php> - <!-- "Real" test database --> - <!-- uncomment, otherwise sqlite memory runs --> <server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/> <server name="PHPBB_TEST_DBHOST" value="localhost" /> <server name="PHPBB_TEST_DBPORT" value="5432" /> diff --git a/travis/phpunit-sqlite3-travis.xml b/travis/phpunit-sqlite3-travis.xml new file mode 100644 index 0000000000..5baab791e0 --- /dev/null +++ b/travis/phpunit-sqlite3-travis.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit backupGlobals="true" + backupStaticAttributes="true" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false" + syntaxCheck="true" + strict="true" + verbose="true" + bootstrap="../tests/bootstrap.php"> + <testsuites> + <testsuite name="phpBB Test Suite"> + <directory suffix="_test.php">../tests</directory> + <exclude>../tests/functional</exclude> + <exclude>../tests/lint_test.php</exclude> + <exclude>../tests/ui</exclude> + </testsuite> + <testsuite name="phpBB Functional Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> + </testsuite> + <testsuite name="phpBB UI Tests"> + <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/ui</directory> + </testsuite> + </testsuites> + + <groups> + <exclude> + <group>slow</group> + </exclude> + </groups> + + <php> + <!--server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\sqlite3" /--> + <!--server name="PHPBB_TEST_DBHOST" value="../phpbb_unit_tests.sqlite3" /--> + <!--server name="PHPBB_TEST_DBPORT" value="" /--> + <!--server name="PHPBB_TEST_DBNAME" value="" /--> + <!--server name="PHPBB_TEST_DBUSER" value="" /--> + <!--server name="PHPBB_TEST_DBPASSWD" value="" /--> + <server name="PHPBB_TEST_REDIS_HOST" value="localhost" /> + <server name="PHPBB_TEST_TABLE_PREFIX" value="phpbb_"/> + <server name="PHPBB_FUNCTIONAL_URL" value="http://localhost/" /> + </php> +</phpunit> diff --git a/travis/prepare-extension.sh b/travis/prepare-extension.sh new file mode 100755 index 0000000000..4518f935f8 --- /dev/null +++ b/travis/prepare-extension.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e +set -x + +EXTNAME=$1 +BRANCH=$2 + +# Move the extension in place +mkdir --parents phpBB/ext/$EXTNAME +cp -R ../tmp/* phpBB/ext/$EXTNAME + +# Move the extensions travis/phpunit-*-travis.xml files in place +cp -R travis/* phpBB/ext/$EXTNAME/travis diff --git a/travis/setup-database.sh b/travis/setup-database.sh new file mode 100755 index 0000000000..3771f19073 --- /dev/null +++ b/travis/setup-database.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e +set -x + +DB=$1 +TRAVIS_PHP_VERSION=$2 +NOTESTS=$3 + +if [ "$NOTESTS" == '1' ] +then + exit 0 +fi + +if [ "$DB" == "postgres" ] +then + psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres + psql -c 'create database phpbb_tests;' -U postgres +fi + +if [ "$TRAVIS_PHP_VERSION" == "5.4" -a "$DB" == "mysqli" ] +then + mysql -e 'SET GLOBAL storage_engine=MyISAM;' +fi + +if [ "$DB" == "mysql" -o "$DB" == "mysqli" -o "$DB" == "mariadb" ] +then + mysql -e 'create database IF NOT EXISTS phpbb_tests;' +fi diff --git a/travis/setup-exiftool.sh b/travis/setup-exiftool.sh new file mode 100755 index 0000000000..04999b8600 --- /dev/null +++ b/travis/setup-exiftool.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +sudo apt-get update +sudo apt-get install -y parallel libimage-exiftool-perl diff --git a/travis/setup-mariadb.sh b/travis/setup-mariadb.sh index aceb6af7ee..9bc487915d 100755 --- a/travis/setup-mariadb.sh +++ b/travis/setup-mariadb.sh @@ -1,7 +1,12 @@ #!/bin/bash # -# @copyright (c) 2013 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. # set -e set -x diff --git a/travis/setup-php-extensions.sh b/travis/setup-php-extensions.sh index 86e3aaae47..d9544858b7 100755 --- a/travis/setup-php-extensions.sh +++ b/travis/setup-php-extensions.sh @@ -1,7 +1,12 @@ #!/bin/bash # -# @copyright (c) 2013 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. # set -e set -x @@ -37,20 +42,18 @@ function install_php_extension php_ini_file=$(find_php_ini) -# disable broken opcache on PHP 5.5.7 and 5.5.8 -if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.5.9', '<');"` == "1" ] -then - sed -i '/opcache.so/d' "$php_ini_file" -fi - # apc if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.5.0-dev', '<');"` == "1" ] then echo 'Enabling APC PHP extension' register_php_extension 'apc' "$php_ini_file" echo 'apc.enable_cli=1' >> "$php_ini_file" +else + echo 'Disabling Opcache' + echo 'opcache.enable=0' >> "$php_ini_file" fi # redis -git clone git://github.com/nicolasff/phpredis.git redis -install_php_extension 'redis' "$php_ini_file" +# Disabled redis for now as it causes travis to fail +# git clone git://github.com/nicolasff/phpredis.git redis +# install_php_extension 'redis' "$php_ini_file" diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh new file mode 100755 index 0000000000..30f79ee0cb --- /dev/null +++ b/travis/setup-phpbb.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e +set -x + +DB=$1 +TRAVIS_PHP_VERSION=$2 +NOTESTS=$3 + +if [ "$NOTESTS" == '1' ] +then + travis/setup-exiftool.sh + travis/setup-unbuffer.sh +fi + +if [ "$DB" == "mariadb" ] +then + travis/setup-mariadb.sh +fi + +if [ "$NOTESTS" != '1' -a "$TRAVIS_PHP_VERSION" != "hhvm" ] +then + travis/setup-php-extensions.sh +fi + +if [ "$NOTESTS" != '1' ] +then + travis/setup-webserver.sh + travis/install-phpbb-test-dependencies.sh +fi + +cd phpBB +php ../composer.phar install --dev --no-interaction --prefer-source +cd .. diff --git a/travis/setup-unbuffer.sh b/travis/setup-unbuffer.sh new file mode 100755 index 0000000000..4423d1b8b6 --- /dev/null +++ b/travis/setup-unbuffer.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e + +sudo apt-get update +sudo apt-get install -y expect-dev diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index f1bf69c575..911ba12f3c 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -1,7 +1,12 @@ #!/bin/bash # -# @copyright (c) 2013 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. # set -e set -x @@ -12,44 +17,60 @@ sudo apt-get install -y nginx realpath sudo service nginx stop DIR=$(dirname "$0") +USER=$(whoami) PHPBB_ROOT_PATH=$(realpath "$DIR/../phpBB") - NGINX_CONF="/etc/nginx/sites-enabled/default" +APP_SOCK=$(realpath "$DIR")/php-app.sock -PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" -PHP_FPM_CONF="$DIR/php-fpm.conf" -PHP_FPM_SOCK=$(realpath "$DIR")/php-fpm.sock +if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] +then + HHVM_LOG=$(realpath "$DIR")/hhvm.log -USER=$(whoami) + sudo service hhvm stop + sudo hhvm \ + --mode daemon \ + --user "$USER" \ + -vServer.Type=fastcgi \ + -vServer.FileSocket="$APP_SOCK" \ + -vLog.File="$HHVM_LOG" +else + # php-fpm + PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm" + PHP_FPM_CONF="$DIR/php-fpm.conf" -# php-fpm configuration -echo " -[global] + echo " + [global] -[travis] -user = $USER -group = $USER -listen = $PHP_FPM_SOCK -pm = static -pm.max_children = 2 + [travis] + user = $USER + group = $USER + listen = $APP_SOCK + listen.mode = 0666 + pm = static + pm.max_children = 2 -php_admin_value[memory_limit] = 128M -" > $PHP_FPM_CONF + php_admin_value[memory_limit] = 128M + " > $PHP_FPM_CONF -# nginx configuration + sudo $PHP_FPM_BIN \ + --fpm-config "$DIR/php-fpm.conf" +fi + +# nginx echo " -server { - listen 80; - root $PHPBB_ROOT_PATH/; - index index.php index.html; - - location ~ \.php { - fastcgi_pass unix:$PHP_FPM_SOCK; - include fastcgi_params; + server { + listen 80; + root $PHPBB_ROOT_PATH/; + index index.php index.html; + + location ~ \.php { + include fastcgi_params; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + fastcgi_param PATH_INFO \$fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; + fastcgi_pass unix:$APP_SOCK; + } } -} " | sudo tee $NGINX_CONF > /dev/null -# Start daemons -sudo $PHP_FPM_BIN --fpm-config "$DIR/php-fpm.conf" sudo service nginx start |